This commit is contained in:
Weilanwl
2019-04-01 23:03:08 +08:00
parent 5429b98a38
commit 8fd0906450
31 changed files with 115010 additions and 290 deletions
+15
View File
@@ -0,0 +1,15 @@
#!/bin/sh
basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
case `uname` in
*CYGWIN*) basedir=`cygpath -w "$basedir"`;;
esac
if [ -x "$basedir/node" ]; then
"$basedir/node" "$basedir/../prettier/bin-prettier.js" "$@"
ret=$?
else
node "$basedir/../prettier/bin-prettier.js" "$@"
ret=$?
fi
exit $ret
+7
View File
@@ -0,0 +1,7 @@
@IF EXIST "%~dp0\node.exe" (
"%~dp0\node.exe" "%~dp0\..\prettier\bin-prettier.js" %*
) ELSE (
@SETLOCAL
@SET PATHEXT=%PATHEXT:;.JS;=;%
node "%~dp0\..\prettier\bin-prettier.js" %*
)
+96
View File
@@ -0,0 +1,96 @@
![Prettier Banner](https://raw.githubusercontent.com/prettier/prettier-logo/master/images/prettier-banner-light.png)
<h2 align="center">Opinionated Code Formatter</h2>
<p align="center">
<em>
JavaScript
· Flow
· TypeScript
· CSS
· SCSS
· Less
· JSX
· Vue
· GraphQL
· JSON
· Markdown
· <a href="https://prettier.io/docs/en/plugins.html">
Your favorite language?
</a>
</em>
</p>
<p align="center">
<a href="https://gitter.im/jlongster/prettier">
<img alt="Gitter" src="https://img.shields.io/gitter/room/jlongster/prettier.svg?style=flat-square">
</a>
<a href="https://travis-ci.org/prettier/prettier">
<img alt="Travis" src="https://img.shields.io/travis/prettier/prettier/master.svg?style=flat-square">
</a>
<a href="https://codecov.io/gh/prettier/prettier">
<img alt="Codecov" src="https://img.shields.io/codecov/c/github/prettier/prettier.svg?style=flat-square">
</a>
<a href="https://www.npmjs.com/package/prettier">
<img alt="npm version" src="https://img.shields.io/npm/v/prettier.svg?style=flat-square">
</a>
<a href="https://www.npmjs.com/package/prettier">
<img alt="monthly downloads" src="https://img.shields.io/npm/dm/prettier.svg?style=flat-square">
</a>
<a href="#badge">
<img alt="code style: prettier" src="https://img.shields.io/badge/code_style-prettier-ff69b4.svg?style=flat-square">
</a>
<a href="https://twitter.com/PrettierCode">
<img alt="Follow+Prettier+on+Twitter" src="https://img.shields.io/twitter/follow/prettiercode.svg?label=follow+prettier&style=flat-square">
</a>
</p>
## Intro
Prettier is an opinionated code formatter. It enforces a consistent style by parsing your code and re-printing it with its own rules that take the maximum line length into account, wrapping code when necessary.
### Input
<!-- prettier-ignore -->
```js
foo(reallyLongArg(), omgSoManyParameters(), IShouldRefactorThis(), isThereSeriouslyAnotherOne());
```
### Output
```js
foo(
reallyLongArg(),
omgSoManyParameters(),
IShouldRefactorThis(),
isThereSeriouslyAnotherOne()
);
```
Prettier can be run [in your editor](http://prettier.io/docs/en/editors.html) on-save, in a [pre-commit hook](https://prettier.io/docs/en/precommit.html), or in [CI environments](https://prettier.io/docs/en/cli.html#list-different) to ensure your codebase has a consistent style without devs ever having to post a nit-picky comment on a code review ever again!
---
**[Documentation](https://prettier.io/docs/en/)**
<!-- prettier-ignore -->
[Install](https://prettier.io/docs/en/install.html) ·
[Options](https://prettier.io/docs/en/options.html) ·
[CLI](https://prettier.io/docs/en/cli.html) ·
[API](https://prettier.io/docs/en/api.html)
**[Playground](https://prettier.io/playground/)**
---
## Badge
Show the world you're using _Prettier_ → [![code style: prettier](https://img.shields.io/badge/code_style-prettier-ff69b4.svg?style=flat-square)](https://github.com/prettier/prettier)
```md
[![code style: prettier](https://img.shields.io/badge/code_style-prettier-ff69b4.svg?style=flat-square)](https://github.com/prettier/prettier)
```
## Contributing
See [CONTRIBUTING.md](CONTRIBUTING.md).
File diff suppressed because one or more lines are too long
+29708
View File
File diff suppressed because one or more lines are too long
+86
View File
@@ -0,0 +1,86 @@
{
"_from": "prettier@~1.12.0",
"_id": "prettier@1.12.1",
"_inBundle": false,
"_integrity": "sha1-wa0g6APndJ+vkFpAnSNn4Gu+cyU=",
"_location": "/prettier",
"_phantomChildren": {},
"_requested": {
"type": "range",
"registry": true,
"raw": "prettier@~1.12.0",
"name": "prettier",
"escapedName": "prettier",
"rawSpec": "~1.12.0",
"saveSpec": null,
"fetchSpec": "~1.12.0"
},
"_requiredBy": [
"#USER",
"/"
],
"_resolved": "http://registry.npm.taobao.org/prettier/download/prettier-1.12.1.tgz",
"_shasum": "c1ad20e803e7749faf905a409d2367e06bbe7325",
"_spec": "prettier@~1.12.0",
"_where": "E:\\weilanwlSVN\\colorui\\github\\ColorUI\\Colorui-UniApp",
"author": {
"name": "James Long"
},
"bin": {
"prettier": "./bin-prettier.js"
},
"bugs": {
"url": "https://github.com/prettier/prettier/issues"
},
"bundleDependencies": false,
"deprecated": false,
"description": "Prettier is an opinionated code formatter",
"devDependencies": {
"babel-cli": "6.24.1",
"babel-preset-es2015": "6.24.1",
"codecov": "2.2.0",
"cross-env": "5.0.5",
"eslint": "4.18.2",
"eslint-config-prettier": "2.9.0",
"eslint-friendly-formatter": "3.0.0",
"eslint-plugin-import": "2.9.0",
"eslint-plugin-prettier": "2.6.0",
"eslint-plugin-react": "7.7.0",
"jest": "21.1.0",
"mkdirp": "0.5.1",
"prettier": "1.12.0",
"prettylint": "1.0.0",
"rimraf": "2.6.2",
"rollup": "0.47.6",
"rollup-plugin-commonjs": "8.2.6",
"rollup-plugin-json": "2.1.1",
"rollup-plugin-node-builtins": "2.0.0",
"rollup-plugin-node-globals": "1.1.0",
"rollup-plugin-node-resolve": "2.0.0",
"rollup-plugin-replace": "1.2.1",
"shelljs": "0.8.1",
"snapshot-diff": "0.2.2",
"strip-ansi": "4.0.0",
"tempy": "0.2.1",
"uglify-es": "3.3.9",
"webpack": "2.6.1"
},
"engines": {
"node": ">=4"
},
"files": [
"*.js"
],
"homepage": "https://prettier.io",
"license": "MIT",
"main": "./index.js",
"name": "prettier",
"repository": {
"type": "git",
"url": "git+https://github.com/prettier/prettier.git"
},
"scripts": {
"prepublishOnly": "node -e \"assert.equal(require('.').version, require('..').version)\""
},
"version": "1.12.1"
}
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
+1
View File
@@ -0,0 +1 @@
"use strict";function makeMap(e,t){const n=Object.create(null),a=e.split(",");for(let e=0;e<a.length;e++)n[a[e]]=!0;return t?e=>n[e.toLowerCase()]:e=>n[e]}const no=()=>!1,isNonPhrasingTag=makeMap("address,article,aside,base,blockquote,body,caption,col,colgroup,dd,details,dialog,div,dl,dt,fieldset,figcaption,figure,footer,form,h1,h2,h3,h4,h5,h6,head,header,hgroup,hr,html,legend,li,menuitem,meta,optgroup,option,param,rp,rt,source,style,summary,tbody,td,tfoot,th,thead,title,tr,track"),attribute=/^\s*([^\s"'<>/=]+)(?:\s*(=)\s*(?:"([^"]*)"+|'([^']*)'+|([^\s"'=<>`]+)))?/,ncname="[a-zA-Z_][\\w\\-\\.]*",qnameCapture=`((?:${ncname}\\:)?${ncname})`,startTagOpen=new RegExp(`^<${qnameCapture}`),startTagClose=/^\s*(\/?)>/,endTag=new RegExp(`^<\\/${qnameCapture}[^>]*>`),doctype=/^<!DOCTYPE [^>]+>/i,comment=/^<!--/,conditionalComment=/^<!\[/;let IS_REGEX_CAPTURING_BROKEN=!1;"x".replace(/x(.)?/g,(e,t)=>{IS_REGEX_CAPTURING_BROKEN=""===t});const isPlainTextElement=makeMap("script,style,textarea",!0),reCache={},decodingMap={"&lt;":"<","&gt;":">","&quot;":'"',"&amp;":"&","&#10;":"\n","&#9;":"\t"},encodedAttr=/&(?:lt|gt|quot|amp);/g,encodedAttrWithNewLines=/&(?:lt|gt|quot|amp|#10|#9);/g,isIgnoreNewlineTag=makeMap("pre,textarea",!0),shouldIgnoreFirstNewline=(e,t)=>e&&isIgnoreNewlineTag(e)&&"\n"===t[0];function decodeAttr(e,t){const n=t?encodedAttrWithNewLines:encodedAttr;return e.replace(n,e=>decodingMap[e])}function parseHTML(e,t){const n=[],a=t.expectHTML,r=t.isUnaryTag||no,o=t.canBeLeftOpenTag||no;let s,c,i=0;for(;e;){if(s=e,c&&isPlainTextElement(c)){let n=0;const a=c.toLowerCase(),r=reCache[a]||(reCache[a]=new RegExp("([\\s\\S]*?)(</"+a+"[^>]*>)","i")),o=e.replace(r,(e,r,o)=>(n=o.length,isPlainTextElement(a)||"noscript"===a||(r=r.replace(/<!--([\s\S]*?)-->/g,"$1").replace(/<!\[CDATA\[([\s\S]*?)]]>/g,"$1")),shouldIgnoreFirstNewline(a,r)&&(r=r.slice(1)),t.chars&&t.chars(r),""));i+=e.length-o.length,e=o,h(a,i-n,i)}else{let n,a,r,o=e.indexOf("<");if(0===o){if(comment.test(e)){const n=e.indexOf("--\x3e");if(n>=0){t.shouldKeepComment&&t.comment(e.substring(4,n)),l(n+3);continue}}if(conditionalComment.test(e)){const t=e.indexOf("]>");if(t>=0){l(t+2);continue}}const n=e.match(doctype);if(n){l(n[0].length);continue}const a=e.match(endTag);if(a){const e=i;l(a[0].length),h(a[1],e,i);continue}const r=d();if(r){g(r),shouldIgnoreFirstNewline(c,e)&&l(1);continue}}if(o>=0){for(a=e.slice(o);!(endTag.test(a)||startTagOpen.test(a)||comment.test(a)||conditionalComment.test(a)||(r=a.indexOf("<",1))<0);)o+=r,a=e.slice(o);n=e.substring(0,o),l(o)}o<0&&(n=e,e=""),t.chars&&n&&t.chars(n)}if(e===s){t.chars&&t.chars(e),"production"!==process.env.NODE_ENV&&!n.length&&t.warn&&t.warn(`Mal-formatted tag at end of template: "${e}"`);break}}function l(t){i+=t,e=e.substring(t)}function d(){const t=e.match(startTagOpen);if(t){const n={tagName:t[1],attrs:[],start:i};let a,r;for(l(t[0].length);!(a=e.match(startTagClose))&&(r=e.match(attribute));)l(r[0].length),n.attrs.push(r);if(a)return n.unarySlash=a[1],l(a[0].length),n.end=i,n}}function g(e){const s=e.tagName,i=e.unarySlash;a&&("p"===c&&isNonPhrasingTag(s)&&h(c),o(s)&&c===s&&h(s));const l=r(s)||!!i,d=e.attrs.length,g=new Array(d);for(let n=0;n<d;n++){const a=e.attrs[n];IS_REGEX_CAPTURING_BROKEN&&-1===a[0].indexOf('""')&&(""===a[3]&&delete a[3],""===a[4]&&delete a[4],""===a[5]&&delete a[5]);const r=a[3]||a[4]||a[5]||"",o="a"===s&&"href"===a[1]?t.shouldDecodeNewlinesForHref:t.shouldDecodeNewlines;g[n]={name:a[1],value:decodeAttr(r,o)}}l||(n.push({tag:s,lowerCasedTag:s.toLowerCase(),attrs:g}),c=s),t.start&&t.start(s,g,l,e.start,e.end)}function h(e,a,r){let o,s;if(null==a&&(a=i),null==r&&(r=i),e&&(s=e.toLowerCase()),e)for(o=n.length-1;o>=0&&n[o].lowerCasedTag!==s;o--);else o=0;if(o>=0){for(let s=n.length-1;s>=o;s--)"production"!==process.env.NODE_ENV&&(s>o||!e)&&t.warn&&t.warn(`tag <${n[s].tag}> has no matching end tag.`),t.end&&t.end(n[s].tag,a,r);n.length=o,c=o&&n[o-1].tag}else"br"===s?t.start&&t.start(e,[],!0,a,r):"p"===s&&(t.start&&t.start(e,[],!1,a,r),t.end&&t.end(e,a,r))}h()}function parse(e){const t={tag:"root",attrs:[],unary:!1,start:0,contentStart:0,contentEnd:e.length,end:e.length,children:[],comments:[]},n=[t];let a=t;return parseHTML(e,{start:function(e,t,r,o,s){const c={tag:e,attrs:t,unary:r,start:o,children:[]};a.children.push(c),r?c.end=s:(c.contentStart=s,n.push(c),a=c)},end:function(e,t,r){n.pop(),a.contentEnd=t,a.end=r,a=n[n.length-1]}}),t}var parserVue=parse;module.exports=parserVue;
File diff suppressed because one or more lines are too long