master
Lucas Azzola 2017-10-03 19:44:02 +10:00
parent 33a1f59e01
commit 2e655a3755
6 changed files with 703 additions and 576 deletions

View File

@ -8,7 +8,7 @@ Tip! Don't write this stuff manually.
-->
**Prettier 1.7.3**
**Prettier 1.7.4**
[Playground link](https://prettier.io/playground/#.....)
```sh
# Options (if any):

View File

@ -1,3 +1,11 @@
# 1.7.4
[link](https://github.com/prettier/prettier/compare/1.7.3...1.7.4)
* Force template literals to break after ` for sytled-components (#2926 by duailibe)
* Update cosmiconfig to v3.1.0 (#2952 by ikatyang)
* Respect --stdin-filepath, regardless of config source (#2948 by azz)
# 1.7.3
[link](https://github.com/prettier/prettier/compare/1.7.2...1.7.3)

View File

@ -1,6 +1,6 @@
{
"name": "prettier",
"version": "1.7.3",
"version": "1.7.4",
"description": "Prettier is an opinionated code formatter",
"bin": {
"prettier": "./bin/prettier.js"
@ -73,7 +73,9 @@
},
"scripts": {
"prepublishOnly": "echo \"Error: must publish from dist/\" && exit 1",
"prepare-release": "yarn && yarn build && yarn test:dist",
"test": "jest",
"test:dist": "cross-env NODE_ENV=production yarn test",
"test-integration": "jest tests_integration",
"lint": "cross-env EFF_NO_LINK_RULES=true eslint . --format node_modules/eslint-friendly-formatter",
"build": "node ./scripts/build/build.js",

View File

@ -135,7 +135,7 @@ shell.cp("README.md", "dist/README.md");
shell.echo("Done!");
shell.echo();
shell.echo("How to test against dist:");
shell.echo(" 1) NODE_ENV=production yarn test");
shell.echo(" 1) yarn test:dist");
shell.echo();
shell.echo("How to publish:");
shell.echo(" 1) IMPORTANT!!! Go to dist/");

View File

@ -1,4 +1,4 @@
'use strict';var _typeof=typeof Symbol==="function"&&typeof Symbol.iterator==="symbol"?function(obj){return typeof obj;}:function(obj){return obj&&typeof Symbol==="function"&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":typeof obj;};function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor)){throw new TypeError("Cannot call a class as a function");}}function _possibleConstructorReturn(self,call){if(!self){throw new ReferenceError("this hasn't been initialised - super() hasn't been called");}return call&&(typeof call==="object"||typeof call==="function")?call:self;}function _inherits(subClass,superClass){if(typeof superClass!=="function"&&superClass!==null){throw new TypeError("Super expression must either be null or a function, not "+typeof superClass);}subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,enumerable:false,writable:true,configurable:true}});if(superClass)Object.setPrototypeOf?Object.setPrototypeOf(subClass,superClass):subClass.__proto__=superClass;}function _interopDefault(ex){return ex&&(typeof ex==='undefined'?'undefined':_typeof(ex))==='object'&&'default'in ex?ex['default']:ex;}var require$$0=_interopDefault(require('assert'));var require$$0$1=_interopDefault(require('path'));var os=_interopDefault(require('os'));var fs=_interopDefault(require('fs'));var util=_interopDefault(require('util'));var module$1=_interopDefault(require('module'));var index$2=function index$2(x){if(typeof x!=='string'){throw new TypeError('Expected a string, got '+(typeof x==='undefined'?'undefined':_typeof(x)));}// Catches EFBBBF (UTF-8 BOM) because the buffer-to-string
'use strict';var _typeof=typeof Symbol==="function"&&typeof Symbol.iterator==="symbol"?function(obj){return typeof obj;}:function(obj){return obj&&typeof Symbol==="function"&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":typeof obj;};function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor)){throw new TypeError("Cannot call a class as a function");}}function _possibleConstructorReturn(self,call){if(!self){throw new ReferenceError("this hasn't been initialised - super() hasn't been called");}return call&&(typeof call==="object"||typeof call==="function")?call:self;}function _inherits(subClass,superClass){if(typeof superClass!=="function"&&superClass!==null){throw new TypeError("Super expression must either be null or a function, not "+typeof superClass);}subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,enumerable:false,writable:true,configurable:true}});if(superClass)Object.setPrototypeOf?Object.setPrototypeOf(subClass,superClass):subClass.__proto__=superClass;}function _interopDefault(ex){return ex&&(typeof ex==='undefined'?'undefined':_typeof(ex))==='object'&&'default'in ex?ex['default']:ex;}var require$$0=_interopDefault(require('assert'));var require$$0$1=_interopDefault(require('path'));var os=_interopDefault(require('os'));var fs=_interopDefault(require('fs'));var util=_interopDefault(require('util'));var module$1=_interopDefault(require('module'));var stream=_interopDefault(require('stream'));var index$2=function index$2(x){if(typeof x!=='string'){throw new TypeError('Expected a string, got '+(typeof x==='undefined'?'undefined':_typeof(x)));}// Catches EFBBBF (UTF-8 BOM) because the buffer-to-string
// conversion translates it to FEFF (UTF-16 BOM)
if(x.charCodeAt(0)===0xFEFF){return x.slice(1);}return x;};function assertDoc(val){/* istanbul ignore if */if(!(typeof val==="string"||val!=null&&typeof val.type==="string")){throw new Error("Value "+JSON.stringify(val)+" is not a valid document");}}function concat$1(parts){parts.forEach(assertDoc);// We cannot do this until we change `printJSXElement` to not
// access the internals of a document directly.
@ -176,7 +176,7 @@ if(isBlock){return concat([contents,util$2.hasNewline(options.originalText,locEn
// if this a comment on its own line; normal trailing comments are
// always at the end of another expression.
var isLineBeforeEmpty=util$2.isPreviousLineEmpty(options.originalText,comment);return lineSuffix(concat([hardline,isLineBeforeEmpty?hardline:"",contents]));}else if(isBlock){// Trailing block comments never need a newline
return concat([" ",contents]);}return concat([lineSuffix(" "+contents),!isBlock?breakParent:""]);}function printDanglingComments(path,options,sameIndent){var parts=[];var node=path.getValue();if(!node||!node.comments){return"";}path.each(function(commentPath){var comment=commentPath.getValue();if(comment&&!comment.leading&&!comment.trailing){parts.push(printComment(commentPath,options));}},"comments");if(parts.length===0){return"";}if(sameIndent){return join(hardline,parts);}return indent(concat([hardline,join(hardline,parts)]));}function prependCursorPlaceholder(path,options,printed){if(path.getNode()===options.cursorNode&&path.getValue()){return concat([cursor,printed]);}return printed;}function printComments(path,print,options,needsSemi){var value=path.getValue();var printed=print(path);var comments=value&&value.comments;if(!comments||comments.length===0){return prependCursorPlaceholder(path,options,printed);}var leadingParts=[];var trailingParts=[needsSemi?";":"",printed];path.each(function(commentPath){var comment=commentPath.getValue();var leading=comment.leading;var trailing=comment.trailing;if(leading){var contents=printLeadingComment(commentPath,print,options);if(!contents){return;}leadingParts.push(contents);var text=options.originalText;if(util$2.hasNewline(text,util$2.skipNewline(text,util$2.locEnd(comment)))){leadingParts.push(hardline);}}else if(trailing){trailingParts.push(printTrailingComment(commentPath,print,options));}},"comments");return prependCursorPlaceholder(path,options,concat(leadingParts.concat(trailingParts)));}var comments$1={attach:attach,printComments:printComments,printDanglingComments:printDanglingComments,getSortedChildNodes:getSortedChildNodes};var name="prettier";var version$1="1.7.2";var description="Prettier is an opinionated code formatter";var bin={"prettier":"./bin/prettier.js"};var repository="prettier/prettier";var homepage="https://prettier.io";var author="James Long";var license="MIT";var main="./index.js";var engines={"node":">=4"};var dependencies={"babel-code-frame":"7.0.0-alpha.12","babylon":"7.0.0-beta.23","camelcase":"4.1.0","chalk":"2.1.0","cosmiconfig":"3.0.1","dashify":"0.2.2","diff":"3.2.0","esutils":"2.0.2","flow-parser":"0.51.0","get-stream":"3.0.0","globby":"^6.1.0","graphql":"0.10.1","ignore":"^3.3.3","jest-docblock":"21.1.0","jest-validate":"21.1.0","leven":"2.1.0","mem":"1.1.0","minimatch":"3.0.4","minimist":"1.2.0","parse5":"3.0.2","postcss-less":"^1.0.0","postcss-media-query-parser":"0.2.3","postcss-scss":"1.0.0","postcss-selector-parser":"2.2.3","postcss-values-parser":"1.3.1","strip-bom":"3.0.0","typescript":"2.5.3","typescript-eslint-parser":"git://github.com/eslint/typescript-eslint-parser.git#9c71a627da36e97da52ed2731d58509c952b67ae"};var devDependencies={"babel-cli":"6.24.1","babel-preset-es2015":"6.24.1","codecov":"2.2.0","cross-env":"5.0.1","eslint":"4.1.1","eslint-friendly-formatter":"3.0.0","eslint-plugin-import":"2.6.1","eslint-plugin-prettier":"2.1.2","eslint-plugin-react":"7.1.0","jest":"21.1.0","markdown-toc":"1.1.0","mkdirp":"^0.5.1","prettier":"1.7.0","rimraf":"2.6.1","rollup":"0.41.1","rollup-plugin-commonjs":"7.0.0","rollup-plugin-json":"2.1.0","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.1.1","shelljs":"0.7.8","sw-toolbox":"3.6.0","uglify-es":"3.0.15","webpack":"2.6.1"};var scripts={"test":"jest","test-integration":"jest tests_integration","lint":"cross-env EFF_NO_LINK_RULES=true eslint . --format node_modules/eslint-friendly-formatter","build":"node ./scripts/build/build.js","toc":"node ./scripts/table-of-contents.js"};var _package={name:name,version:version$1,description:description,bin:bin,repository:repository,homepage:homepage,author:author,license:license,main:main,engines:engines,dependencies:dependencies,devDependencies:devDependencies,scripts:scripts};var _package$1=Object.freeze({name:name,version:version$1,description:description,bin:bin,repository:repository,homepage:homepage,author:author,license:license,main:main,engines:engines,dependencies:dependencies,devDependencies:devDependencies,scripts:scripts,default:_package});var assert$2=require$$0;var util$6=util$3;var startsWithNoLookaheadToken$1=util$6.startsWithNoLookaheadToken;function FastPath$1(value){assert$2.ok(this instanceof FastPath$1);this.stack=[value];}// The name of the current property is always the penultimate element of
return concat([" ",contents]);}return concat([lineSuffix(" "+contents),!isBlock?breakParent:""]);}function printDanglingComments(path,options,sameIndent){var parts=[];var node=path.getValue();if(!node||!node.comments){return"";}path.each(function(commentPath){var comment=commentPath.getValue();if(comment&&!comment.leading&&!comment.trailing){parts.push(printComment(commentPath,options));}},"comments");if(parts.length===0){return"";}if(sameIndent){return join(hardline,parts);}return indent(concat([hardline,join(hardline,parts)]));}function prependCursorPlaceholder(path,options,printed){if(path.getNode()===options.cursorNode&&path.getValue()){return concat([cursor,printed]);}return printed;}function printComments(path,print,options,needsSemi){var value=path.getValue();var printed=print(path);var comments=value&&value.comments;if(!comments||comments.length===0){return prependCursorPlaceholder(path,options,printed);}var leadingParts=[];var trailingParts=[needsSemi?";":"",printed];path.each(function(commentPath){var comment=commentPath.getValue();var leading=comment.leading;var trailing=comment.trailing;if(leading){var contents=printLeadingComment(commentPath,print,options);if(!contents){return;}leadingParts.push(contents);var text=options.originalText;if(util$2.hasNewline(text,util$2.skipNewline(text,util$2.locEnd(comment)))){leadingParts.push(hardline);}}else if(trailing){trailingParts.push(printTrailingComment(commentPath,print,options));}},"comments");return prependCursorPlaceholder(path,options,concat(leadingParts.concat(trailingParts)));}var comments$1={attach:attach,printComments:printComments,printDanglingComments:printDanglingComments,getSortedChildNodes:getSortedChildNodes};var name="prettier";var version$1="1.7.4";var description="Prettier is an opinionated code formatter";var bin={"prettier":"./bin/prettier.js"};var repository="prettier/prettier";var homepage="https://prettier.io";var author="James Long";var license="MIT";var main="./index.js";var engines={"node":">=4"};var dependencies={"babel-code-frame":"7.0.0-alpha.12","babylon":"7.0.0-beta.23","camelcase":"4.1.0","chalk":"2.1.0","cosmiconfig":"3.1.0","dashify":"0.2.2","diff":"3.2.0","esutils":"2.0.2","flow-parser":"0.51.0","get-stream":"3.0.0","globby":"6.1.0","graphql":"0.10.1","ignore":"3.3.5","jest-docblock":"21.1.0","jest-validate":"21.1.0","leven":"2.1.0","mem":"1.1.0","minimatch":"3.0.4","minimist":"1.2.0","parse5":"3.0.2","postcss-less":"1.1.1","postcss-media-query-parser":"0.2.3","postcss-scss":"1.0.0","postcss-selector-parser":"2.2.3","postcss-values-parser":"1.3.1","strip-bom":"3.0.0","typescript":"2.5.3","typescript-eslint-parser":"git://github.com/eslint/typescript-eslint-parser.git#9c71a627da36e97da52ed2731d58509c952b67ae"};var devDependencies={"babel-cli":"6.24.1","babel-preset-es2015":"6.24.1","codecov":"2.2.0","cross-env":"5.0.1","eslint":"4.1.1","eslint-friendly-formatter":"3.0.0","eslint-plugin-import":"2.6.1","eslint-plugin-prettier":"2.1.2","eslint-plugin-react":"7.1.0","jest":"21.1.0","markdown-toc":"1.1.0","mkdirp":"0.5.1","prettier":"1.7.3","rimraf":"2.6.1","rollup":"0.41.1","rollup-plugin-commonjs":"7.0.0","rollup-plugin-json":"2.1.0","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.1.1","shelljs":"0.7.8","strip-ansi":"4.0.0","sw-toolbox":"3.6.0","uglify-es":"3.0.15","webpack":"2.6.1"};var scripts={"prepublishOnly":"echo \"Error: must publish from dist/\" && exit 1","prepare-release":"yarn && yarn build && yarn test:prod","test":"jest","test:prod":"cross-env NODE_ENV=production yarn test","test-integration":"jest tests_integration","lint":"cross-env EFF_NO_LINK_RULES=true eslint . --format node_modules/eslint-friendly-formatter","build":"node ./scripts/build/build.js","toc":"node ./scripts/table-of-contents.js"};var _package={name:name,version:version$1,description:description,bin:bin,repository:repository,homepage:homepage,author:author,license:license,main:main,engines:engines,dependencies:dependencies,devDependencies:devDependencies,scripts:scripts};var _package$1=Object.freeze({name:name,version:version$1,description:description,bin:bin,repository:repository,homepage:homepage,author:author,license:license,main:main,engines:engines,dependencies:dependencies,devDependencies:devDependencies,scripts:scripts,default:_package});var assert$2=require$$0;var util$6=util$3;var startsWithNoLookaheadToken$1=util$6.startsWithNoLookaheadToken;function FastPath$1(value){assert$2.ok(this instanceof FastPath$1);this.stack=[value];}// The name of the current property is always the penultimate element of
// this.stack, and always a String.
FastPath$1.prototype.getName=function getName(){var s=this.stack;var len=s.length;if(len>1){return s[len-2];}// Since the name is always a string, null is a safe sentinel value to
// return if we do not know the name of the (root) value.
@ -380,7 +380,7 @@ if(parent.type==="style"){return{options:{parser:"css"},transformDoc:function tr
* @click="someFunction()"
*/if(/(^@)|(^v-)|:/.test(node.key)&&!/^\w+$/.test(node.value)){return{text:node.value,options:{parser:parseJavaScriptExpression,// Use singleQuote since HTML attributes use double-quotes.
// TODO(azz): We still need to do an entity escape on the attribute.
singleQuote:true},transformDoc:function transformDoc(doc){return concat$3([node.key,'="',util$7.hasNewlineInRange(node.value,0,node.value.length)?doc:docUtils$1.removeLines(doc),'"']);}};}}}}function transformCssDoc(quasisDoc,parent){var parentNode=parent.path.getValue();var expressionDocs=parentNode.expressions?parent.path.map(parent.print,"expressions"):[];var newDoc=replacePlaceholders(quasisDoc,expressionDocs);/* istanbul ignore if */if(!newDoc){throw new Error("Couldn't insert all the expressions");}return concat$3(["`",indent$3(concat$3([softline$2,stripTrailingHardline(newDoc)])),softline$2,"`"]);}// Search all the placeholders in the quasisDoc tree
singleQuote:true},transformDoc:function transformDoc(doc){return concat$3([node.key,'="',util$7.hasNewlineInRange(node.value,0,node.value.length)?doc:docUtils$1.removeLines(doc),'"']);}};}}}}function transformCssDoc(quasisDoc,parent){var parentNode=parent.path.getValue();var isEmpty=parentNode.quasis.length===1&&!parentNode.quasis[0].value.raw.trim();if(isEmpty){return"``";}var expressionDocs=parentNode.expressions?parent.path.map(parent.print,"expressions"):[];var newDoc=replacePlaceholders(quasisDoc,expressionDocs);/* istanbul ignore if */if(!newDoc){throw new Error("Couldn't insert all the expressions");}return concat$3(["`",indent$3(concat$3([hardline$3,stripTrailingHardline(newDoc)])),softline$2,"`"]);}// Search all the placeholders in the quasisDoc tree
// and replace them with the expression docs one by one
// returns a new doc with all the placeholders replaced,
// or null if it couldn't replace any expression
@ -1586,13 +1586,14 @@ var chainFuncsAsync=function chainFuncsAsync(result,func){return result.then(fun
* the result of each function to the next.
*/var funcRunner$2=function funcRunner(init,funcs){var isAsync=init instanceof Promise;return funcs.reduce(isAsync===true?chainFuncsAsync:chainFuncsSync,init);};var yaml=index$54;var requireFromString=index$56;var readFile$2=readFile_1;var parseJson$2=parseJson_1;var funcRunner$1=funcRunner$2;var loadRc$1=function loadRc(filepath,options){if(!options.sync){return readFile$2(filepath).then(parseExtensionlessRcFile).then(checkExtensionlessRcResult);}else{return checkExtensionlessRcResult(parseExtensionlessRcFile(readFile$2.sync(filepath)));}function checkExtensionlessRcResult(result){if(result)return result;if(options.rcExtensions)return loadRcWithExtensions();return null;}function parseExtensionlessRcFile(content){if(!content)return null;var pasedConfig=options.rcStrictJson?parseJson$2(content,filepath):yaml.safeLoad(content,{filename:filepath});return{config:pasedConfig,filepath:filepath};}function loadRcWithExtensions(){var foundConfig=null;return funcRunner$1(readRcFile('json'),[function(jsonContent){// Since this is the first try, config cannot have been found, so don't
// check `if (foundConfig)`.
if(jsonContent){var successFilepath=filepath+'.json';foundConfig={config:parseJson$2(jsonContent,successFilepath),filepath:successFilepath};}else{return readRcFile('yaml');}},function(yamlContent){if(foundConfig){return;}else if(yamlContent){var successFilepath=filepath+'.yaml';foundConfig={config:yaml.safeLoad(yamlContent,{filename:successFilepath}),filepath:successFilepath};}else{return readRcFile('yml');}},function(ymlContent){if(foundConfig){return;}else if(ymlContent){var successFilepath=filepath+'.yml';foundConfig={config:yaml.safeLoad(ymlContent,{filename:successFilepath}),filepath:successFilepath};}else{return readRcFile('js');}},function(jsContent){if(foundConfig){return;}else if(jsContent){var successFilepath=filepath+'.js';foundConfig={config:requireFromString(jsContent,successFilepath),filepath:successFilepath};}else{return;}},function(){return foundConfig;}]);}function readRcFile(extension){var filepathWithExtension=filepath+'.'+extension;return!options.sync?readFile$2(filepathWithExtension):readFile$2.sync(filepathWithExtension);}};var requireFromString$1=index$56;var readFile$3=readFile_1;var loadJs$1=function loadJs(filepath,options){function parseJsFile(content){if(!content)return null;return{config:requireFromString$1(content,filepath),filepath:filepath};}return!options.sync?readFile$3(filepath).then(parseJsFile):parseJsFile(readFile$3.sync(filepath));};var yaml$2=index$54;var requireFromString$2=index$56;var readFile$4=readFile_1;var parseJson$3=parseJson_1;var loadDefinedFile$1=function loadDefinedFile(filepath,options){function parseContent(content){if(!content){throw new Error('Config file is empty! Filepath - "'+filepath+'".');}var parsedConfig=void 0;switch(options.format){case'json':parsedConfig=parseJson$3(content,filepath);break;case'yaml':parsedConfig=yaml$2.safeLoad(content,{filename:filepath});break;case'js':parsedConfig=requireFromString$2(content,filepath);break;default:parsedConfig=tryAllParsing(content,filepath);}if(!parsedConfig){throw new Error('Failed to parse "'+filepath+'" as JSON, JS, or YAML.');}return{config:parsedConfig,filepath:filepath};}return!options.sync?readFile$4(filepath,{throwNotFound:true}).then(parseContent):parseContent(readFile$4.sync(filepath,{throwNotFound:true}));};function tryAllParsing(content,filepath){return tryYaml(content,filepath,function(){return tryRequire(content,filepath,function(){return null;});});}function tryYaml(content,filepath,cb){try{var result=yaml$2.safeLoad(content,{filename:filepath});if(typeof result==='string'){return cb();}return result;}catch(e){return cb();}}function tryRequire(content,filepath,cb){try{return requireFromString$2(content,filepath);}catch(e){return cb();}}var fs$2=fs;/**
if(jsonContent){var successFilepath=filepath+'.json';foundConfig={config:parseJson$2(jsonContent,successFilepath),filepath:successFilepath};}else{return readRcFile('yaml');}},function(yamlContent){if(foundConfig){return;}else if(yamlContent){var successFilepath=filepath+'.yaml';foundConfig={config:yaml.safeLoad(yamlContent,{filename:successFilepath}),filepath:successFilepath};}else{return readRcFile('yml');}},function(ymlContent){if(foundConfig){return;}else if(ymlContent){var successFilepath=filepath+'.yml';foundConfig={config:yaml.safeLoad(ymlContent,{filename:successFilepath}),filepath:successFilepath};}else{return readRcFile('js');}},function(jsContent){if(foundConfig){return;}else if(jsContent){var successFilepath=filepath+'.js';foundConfig={config:requireFromString(jsContent,successFilepath),filepath:successFilepath};}else{return;}},function(){return foundConfig;}]);}function readRcFile(extension){var filepathWithExtension=filepath+'.'+extension;return!options.sync?readFile$2(filepathWithExtension):readFile$2.sync(filepathWithExtension);}};var requireFromString$1=index$56;var readFile$3=readFile_1;var loadJs$1=function loadJs(filepath,options){function parseJsFile(content){if(!content)return null;return{config:requireFromString$1(content,filepath),filepath:filepath};}return!options.sync?readFile$3(filepath).then(parseJsFile):parseJsFile(readFile$3.sync(filepath));};var yaml$2=index$54;var requireFromString$2=index$56;var readFile$4=readFile_1;var parseJson$3=parseJson_1;var path$3=require$$0$1;var loadDefinedFile$1=function loadDefinedFile(filepath,options){function parseContent(content){if(!content){throw new Error('Config file is empty! Filepath - "'+filepath+'".');}var parsedConfig=void 0;switch(options.format||inferFormat(filepath)){case'json':parsedConfig=parseJson$3(content,filepath);break;case'yaml':parsedConfig=yaml$2.safeLoad(content,{filename:filepath});break;case'js':parsedConfig=requireFromString$2(content,filepath);break;default:parsedConfig=tryAllParsing(content,filepath);}if(!parsedConfig){throw new Error('Failed to parse "'+filepath+'" as JSON, JS, or YAML.');}return{config:parsedConfig,filepath:filepath};}return!options.sync?readFile$4(filepath,{throwNotFound:true}).then(parseContent):parseContent(readFile$4.sync(filepath,{throwNotFound:true}));};function inferFormat(filepath){switch(path$3.extname(filepath)){case'.js':return'js';case'.json':return'json';// istanbul ignore next
case'.yml':case'.yaml':return'yaml';default:return undefined;}}function tryAllParsing(content,filepath){return tryYaml(content,filepath,function(){return tryRequire(content,filepath,function(){return null;});});}function tryYaml(content,filepath,cb){try{var result=yaml$2.safeLoad(content,{filename:filepath});if(typeof result==='string'){return cb();}return result;}catch(e){return cb();}}function tryRequire(content,filepath,cb){try{return requireFromString$2(content,filepath);}catch(e){return cb();}}var fs$2=fs;/**
* async
*/function isDirectory$1(filepath,cb){if(typeof cb!=='function'){throw new Error('expected a callback function');}if(typeof filepath!=='string'){cb(new Error('expected filepath to be a string'));return;}fs$2.stat(filepath,function(err,stats){if(err){if(err.code==='ENOENT'){cb(null,false);return;}cb(err);return;}cb(null,stats.isDirectory());});}/**
* sync
*/isDirectory$1.sync=function isDirectorySync(filepath){if(typeof filepath!=='string'){throw new Error('expected filepath to be a string');}try{var stat=fs$2.statSync(filepath);return stat.isDirectory();}catch(err){if(err.code==='ENOENT'){return false;}else{throw err;}}return false;};/**
* Expose `isDirectory`
*/var index$58=isDirectory$1;var path$3=require$$0$1;var isDirectory=index$58;var getDirectory$1=function getDirectory(filepath,sync){if(sync===true){return isDirectory.sync(filepath)?filepath:path$3.dirname(filepath);}return new Promise(function(resolve,reject){return isDirectory(filepath,function(err,filepathIsDirectory){if(err){return reject(err);}return resolve(filepathIsDirectory?filepath:path$3.dirname(filepath));});});};var path$1=require$$0$1;var loadPackageProp=loadPackageProp$1;var loadRc=loadRc$1;var loadJs=loadJs$1;var loadDefinedFile=loadDefinedFile$1;var funcRunner=funcRunner$2;var getDirectory=getDirectory$1;var createExplorer$1=function createExplorer(options){// When `options.sync` is `false` (default),
*/var index$58=isDirectory$1;var path$4=require$$0$1;var isDirectory=index$58;var getDirectory$1=function getDirectory(filepath,sync){if(sync===true){return isDirectory.sync(filepath)?filepath:path$4.dirname(filepath);}return new Promise(function(resolve,reject){return isDirectory(filepath,function(err,filepathIsDirectory){if(err){return reject(err);}return resolve(filepathIsDirectory?filepath:path$4.dirname(filepath));});});};var path$1=require$$0$1;var loadPackageProp=loadPackageProp$1;var loadRc=loadRc$1;var loadJs=loadJs$1;var loadDefinedFile=loadDefinedFile$1;var funcRunner=funcRunner$2;var getDirectory=getDirectory$1;var createExplorer$1=function createExplorer(options){// When `options.sync` is `false` (default),
// these cache Promises that resolve with results, not the results themselves.
var fileCache=options.cache?new Map():null;var directoryCache=options.cache?new Map():null;var transform=options.transform||identity;var packageProp=options.packageProp;function clearFileCache(){if(fileCache)fileCache.clear();}function clearDirectoryCache(){if(directoryCache)directoryCache.clear();}function clearCaches(){clearFileCache();clearDirectoryCache();}function throwError(error){if(options.sync){throw error;}else{return Promise.reject(error);}}function load(searchPath,configPath){if(!configPath&&options.configPath){configPath=options.configPath;}if(configPath){var absoluteConfigPath=path$1.resolve(process.cwd(),configPath);if(fileCache&&fileCache.has(absoluteConfigPath)){return fileCache.get(absoluteConfigPath);}var _load=void 0;if(path$1.basename(absoluteConfigPath)==='package.json'){if(!packageProp){return throwError(new Error('Please specify the packageProp option. The configPath argument cannot point to a package.json file if packageProp is false.'));}_load=function _load(){return loadPackageProp(path$1.dirname(absoluteConfigPath),{packageProp:packageProp,sync:options.sync});};}else{_load=function _load(){return loadDefinedFile(absoluteConfigPath,{sync:options.sync,format:options.format});};}var loadResult=_load();var result=loadResult instanceof Promise?loadResult.then(transform):transform(loadResult);if(fileCache)fileCache.set(absoluteConfigPath,result);return result;}if(!searchPath)return!options.sync?Promise.resolve(null):null;var absoluteSearchPath=path$1.resolve(process.cwd(),searchPath);var searchPathDir=getDirectory(absoluteSearchPath,options.sync);return searchPathDir instanceof Promise?searchPathDir.then(searchDirectory):searchDirectory(searchPathDir);}function searchDirectory(directory){if(directoryCache&&directoryCache.has(directory)){return directoryCache.get(directory);}var result=funcRunner(!options.sync?Promise.resolve():undefined,[function(){if(!packageProp)return;return loadPackageProp(directory,{packageProp:packageProp,sync:options.sync});},function(result){if(result||!options.rc)return result;return loadRc(path$1.join(directory,options.rc),{sync:options.sync,rcStrictJson:options.rcStrictJson,rcExtensions:options.rcExtensions});},function(result){if(result||!options.js)return result;return loadJs(path$1.join(directory,options.js),{sync:options.sync});},function(result){if(result)return result;var nextDirectory=path$1.dirname(directory);if(nextDirectory===directory||directory===options.stopDir)return null;return searchDirectory(nextDirectory);},transform]);if(directoryCache)directoryCache.set(directory,result);return result;}return{load:load,clearFileCache:clearFileCache,clearDirectoryCache:clearDirectoryCache,clearCaches:clearCaches};};function identity(x){return x;}var os$2=os;var createExplorer=createExplorer$1;var homedir=os$2.homedir();var index$46=function cosmiconfig(moduleName,options){options=Object.assign({},{packageProp:moduleName,rc:'.'+moduleName+'rc',js:moduleName+'.config.js',rcStrictJson:false,stopDir:homedir,cache:true,sync:false},options);return createExplorer(options);};var index$62=function index$62(xs,fn){var res=[];for(var i=0;i<xs.length;i++){var x=fn(xs[i],i);if(isArray(x))res.push.apply(res,x);else res.push(x);}return res;};var isArray=Array.isArray||function(xs){return Object.prototype.toString.call(xs)==='[object Array]';};var index$64=balanced$1;function balanced$1(a,b,str){if(a instanceof RegExp)a=maybeMatch(a,str);if(b instanceof RegExp)b=maybeMatch(b,str);var r=range(a,b,str);return r&&{start:r[0],end:r[1],pre:str.slice(0,r[0]),body:str.slice(r[0]+a.length,r[1]),post:str.slice(r[1]+b.length)};}function maybeMatch(reg,str){var m=str.match(reg);return m?m[0]:null;}balanced$1.range=range;function range(a,b,str){var begs,beg,left,right,result;var ai=str.indexOf(a);var bi=str.indexOf(b,ai+1);var i=ai;if(ai>=0&&bi>0){begs=[];left=str.length;while(i>=0&&!result){if(i==ai){begs.push(i);ai=str.indexOf(a,i+1);}else if(begs.length==1){result=[begs.pop(),bi];}else{beg=begs.pop();if(beg<left){left=beg;right=bi;}bi=str.indexOf(b,i+1);}i=ai<bi&&ai>=0?ai:bi;}if(begs.length){result=[left,right];}}return result;}var concatMap=index$62;var balanced=index$64;var index$60=expandTop;var escSlash='\0SLASH'+Math.random()+'\0';var escOpen='\0OPEN'+Math.random()+'\0';var escClose='\0CLOSE'+Math.random()+'\0';var escComma='\0COMMA'+Math.random()+'\0';var escPeriod='\0PERIOD'+Math.random()+'\0';function numeric(str){return parseInt(str,10)==str?parseInt(str,10):str.charCodeAt(0);}function escapeBraces(str){return str.split('\\\\').join(escSlash).split('\\{').join(escOpen).split('\\}').join(escClose).split('\\,').join(escComma).split('\\.').join(escPeriod);}function unescapeBraces(str){return str.split(escSlash).join('\\').split(escOpen).join('{').split(escClose).join('}').split(escComma).join(',').split(escPeriod).join('.');}// Basically just str.split(","), but handling cases
// where we have nested braced sections, which should be
@ -1608,7 +1609,7 @@ if(m.post.match(/,.*\}/)){str=m.pre+'{'+m.body+escClose+m.post;return expand$1(s
n=expand$1(n[0],false).map(embrace);if(n.length===1){var post=m.post.length?expand$1(m.post,false):[''];return post.map(function(p){return m.pre+n[0]+p;});}}}// at this point, n is the parts, and we know it's not a comma set
// with a single entry.
// no need to expand pre, since it is guaranteed to be free of brace-sets
var pre=m.pre;var post=m.post.length?expand$1(m.post,false):[''];var N;if(isSequence){var x=numeric(n[0]);var y=numeric(n[1]);var width=Math.max(n[0].length,n[1].length);var incr=n.length==3?Math.abs(numeric(n[2])):1;var test=lte;var reverse=y<x;if(reverse){incr*=-1;test=gte;}var pad=n.some(isPadded);N=[];for(var i=x;test(i,y);i+=incr){var c;if(isAlphaSequence){c=String.fromCharCode(i);if(c==='\\')c='';}else{c=String(i);if(pad){var need=width-c.length;if(need>0){var z=new Array(need+1).join('0');if(i<0)c='-'+z+c.slice(1);else c=z+c;}}}N.push(c);}}else{N=concatMap(n,function(el){return expand$1(el,false);});}for(var j=0;j<N.length;j++){for(var k=0;k<post.length;k++){var expansion=pre+N[j]+post[k];if(!isTop||isSequence||expansion)expansions.push(expansion);}}return expansions;}var minimatch_1=minimatch$1;minimatch$1.Minimatch=Minimatch;var path$4={sep:'/'};try{path$4=require$$0$1;}catch(er){}var GLOBSTAR=minimatch$1.GLOBSTAR=Minimatch.GLOBSTAR={};var expand=index$60;var plTypes={'!':{open:'(?:(?!(?:',close:'))[^/]*?)'},'?':{open:'(?:',close:')?'},'+':{open:'(?:',close:')+'},'*':{open:'(?:',close:')*'},'@':{open:'(?:',close:')'}};// any single thing other than /
var pre=m.pre;var post=m.post.length?expand$1(m.post,false):[''];var N;if(isSequence){var x=numeric(n[0]);var y=numeric(n[1]);var width=Math.max(n[0].length,n[1].length);var incr=n.length==3?Math.abs(numeric(n[2])):1;var test=lte;var reverse=y<x;if(reverse){incr*=-1;test=gte;}var pad=n.some(isPadded);N=[];for(var i=x;test(i,y);i+=incr){var c;if(isAlphaSequence){c=String.fromCharCode(i);if(c==='\\')c='';}else{c=String(i);if(pad){var need=width-c.length;if(need>0){var z=new Array(need+1).join('0');if(i<0)c='-'+z+c.slice(1);else c=z+c;}}}N.push(c);}}else{N=concatMap(n,function(el){return expand$1(el,false);});}for(var j=0;j<N.length;j++){for(var k=0;k<post.length;k++){var expansion=pre+N[j]+post[k];if(!isTop||isSequence||expansion)expansions.push(expansion);}}return expansions;}var minimatch_1=minimatch$1;minimatch$1.Minimatch=Minimatch;var path$5={sep:'/'};try{path$5=require$$0$1;}catch(er){}var GLOBSTAR=minimatch$1.GLOBSTAR=Minimatch.GLOBSTAR={};var expand=index$60;var plTypes={'!':{open:'(?:(?!(?:',close:'))[^/]*?)'},'?':{open:'(?:',close:')?'},'+':{open:'(?:',close:')+'},'*':{open:'(?:',close:')*'},'@':{open:'(?:',close:')'}};// any single thing other than /
// don't need to escape / when using new RegExp()
var qmark='[^/]';// * => any number of characters
var star=qmark+'*?';// ** when dots are allowed. Anything goes, except .. and .
@ -1622,7 +1623,7 @@ function charSet(s){return s.split('').reduce(function(set,c){set[c]=true;return
var slashSplit=/\/+/;minimatch$1.filter=filter;function filter(pattern,options){options=options||{};return function(p,i,list){return minimatch$1(p,pattern,options);};}function ext(a,b){a=a||{};b=b||{};var t={};Object.keys(b).forEach(function(k){t[k]=b[k];});Object.keys(a).forEach(function(k){t[k]=a[k];});return t;}minimatch$1.defaults=function(def){if(!def||!Object.keys(def).length)return minimatch$1;var orig=minimatch$1;var m=function minimatch(p,pattern,options){return orig.minimatch(p,pattern,ext(def,options));};m.Minimatch=function Minimatch(pattern,options){return new orig.Minimatch(pattern,ext(def,options));};return m;};Minimatch.defaults=function(def){if(!def||!Object.keys(def).length)return Minimatch;return minimatch$1.defaults(def).Minimatch;};function minimatch$1(p,pattern,options){if(typeof pattern!=='string'){throw new TypeError('glob pattern string required');}if(!options)options={};// shortcut: comments match nothing.
if(!options.nocomment&&pattern.charAt(0)==='#'){return false;}// "" only matches ""
if(pattern.trim()==='')return p==='';return new Minimatch(pattern,options).match(p);}function Minimatch(pattern,options){if(!(this instanceof Minimatch)){return new Minimatch(pattern,options);}if(typeof pattern!=='string'){throw new TypeError('glob pattern string required');}if(!options)options={};pattern=pattern.trim();// windows support: need to use /, not \
if(path$4.sep!=='/'){pattern=pattern.split(path$4.sep).join('/');}this.options=options;this.set=[];this.pattern=pattern;this.regexp=null;this.negate=false;this.comment=false;this.empty=false;// make the set of regexps etc.
if(path$5.sep!=='/'){pattern=pattern.split(path$5.sep).join('/');}this.options=options;this.set=[];this.pattern=pattern;this.regexp=null;this.negate=false;this.comment=false;this.empty=false;// make the set of regexps etc.
this.make();}Minimatch.prototype.debug=function(){};Minimatch.prototype.make=make;function make(){// don't do it more than once.
if(this._made)return;var pattern=this.pattern;var options=this.options;// empty patterns and comments match nothing.
if(!options.nocomment&&pattern.charAt(0)==='#'){this.comment=true;return;}if(!pattern){this.empty=true;return;}// step 1: figure out negation, etc.
@ -1756,7 +1757,7 @@ re='^(?:'+re+')$';// can match anything, as long as it's not this.
if(this.negate)re='^(?!'+re+').*$';try{this.regexp=new RegExp(re,flags);}catch(ex){this.regexp=false;}return this.regexp;}minimatch$1.match=function(list,pattern,options){options=options||{};var mm=new Minimatch(pattern,options);list=list.filter(function(f){return mm.match(f);});if(mm.options.nonull&&!list.length){list.push(pattern);}return list;};Minimatch.prototype.match=match;function match(f,partial){this.debug('match',f,this.pattern);// short-circuit in the case of busted things.
// comments, etc.
if(this.comment)return false;if(this.empty)return f==='';if(f==='/'&&partial)return true;var options=this.options;// windows: need to use /, not \
if(path$4.sep!=='/'){f=f.split(path$4.sep).join('/');}// treat the test path as a set of pathparts.
if(path$5.sep!=='/'){f=f.split(path$5.sep).join('/');}// treat the test path as a set of pathparts.
f=f.split(slashSplit);this.debug(this.pattern,'split',f);// just ONE of the pattern sets in this.set needs to match
// in order for it to be valid. If negating, then just one
// match means that we have failed.
@ -1838,7 +1839,9 @@ function globUnescape(s){return s.replace(/\\(.)/g,'$1');}function regExpEscape(
var _iteratorNormalCompletion13=true;var _didIteratorError13=false;var _iteratorError13=undefined;try{for(var _iterator13=Object.getOwnPropertyNames(from).concat(Object.getOwnPropertySymbols(from))[Symbol.iterator](),_step13;!(_iteratorNormalCompletion13=(_step13=_iterator13.next()).done);_iteratorNormalCompletion13=true){var prop=_step13.value;Object.defineProperty(to,prop,Object.getOwnPropertyDescriptor(from,prop));}}catch(err){_didIteratorError13=true;_iteratorError13=err;}finally{try{if(!_iteratorNormalCompletion13&&_iterator13.return){_iterator13.return();}}finally{if(_didIteratorError13){throw _iteratorError13;}}}};var mimicFn=index$68;var cacheStore=new WeakMap();var defaultCacheKey=function defaultCacheKey(x){if(arguments.length===1&&(x===null||x===undefined||typeof x!=='function'&&(typeof x==='undefined'?'undefined':_typeof(x))!=='object')){return x;}return JSON.stringify(arguments);};var index$66=function index$66(fn,opts){opts=Object.assign({cacheKey:defaultCacheKey,cache:new Map()},opts);var memoized=function memoized(){var cache=cacheStore.get(memoized);var key=opts.cacheKey.apply(null,arguments);if(cache.has(key)){var c=cache.get(key);if(typeof opts.maxAge!=='number'||Date.now()<c.maxAge){return c.data;}}var ret=fn.apply(null,arguments);cache.set(key,{data:ret,maxAge:Date.now()+(opts.maxAge||0)});return ret;};mimicFn(memoized,fn);cacheStore.set(memoized,opts.cache);return memoized;};var clear=function clear(fn){var cache=cacheStore.get(fn);if(cache&&typeof cache.clear==='function'){cache.clear();}};index$66.clear=clear;var cosmiconfig=index$46;var minimatch=minimatch_1;var mem=index$66;var getExplorerMemoized=mem(function(opts){return cosmiconfig("prettier",{sync:opts.sync,cache:opts.cache,rcExtensions:true});});/** @param {{ cache: boolean, sync: boolean }} opts */function getLoadFunction(opts){// Normalize opts before passing to a memoized function
opts=Object.assign({sync:false,cache:false},opts);return getExplorerMemoized(opts).load;}function resolveConfig(filePath,opts){opts=Object.assign({useCache:true},opts);var load=getLoadFunction({cache:!!opts.useCache,sync:false});return load(filePath,opts.config).then(function(result){return!result?null:mergeOverrides(result.config,filePath);});}resolveConfig.sync=function(filePath,opts){opts=Object.assign({useCache:true},opts);var load=getLoadFunction({cache:!!opts.useCache,sync:true});var result=load(filePath,opts.config);return!result?null:mergeOverrides(result.config,filePath);};function clearCache(){mem.clear(getExplorerMemoized);}function resolveConfigFile(filePath){var load=getLoadFunction({sync:false});return load(filePath).then(function(result){return result?result.filepath:null;});}resolveConfigFile.sync=function(filePath){var load=getLoadFunction({sync:true});var result=load(filePath);return result?result.filepath:null;};function mergeOverrides(config,filePath){var options=Object.assign({},config);if(filePath&&options.overrides){var _iteratorNormalCompletion14=true;var _didIteratorError14=false;var _iteratorError14=undefined;try{for(var _iterator14=options.overrides[Symbol.iterator](),_step14;!(_iteratorNormalCompletion14=(_step14=_iterator14.next()).done);_iteratorNormalCompletion14=true){var override=_step14.value;if(pathMatchesGlobs(filePath,override.files,override.excludeFiles)){Object.assign(options,override.options);}}}catch(err){_didIteratorError14=true;_iteratorError14=err;}finally{try{if(!_iteratorNormalCompletion14&&_iterator14.return){_iterator14.return();}}finally{if(_didIteratorError14){throw _iteratorError14;}}}}delete options.overrides;return options;}// Based on eslint: https://github.com/eslint/eslint/blob/master/lib/config/config-ops.js
function pathMatchesGlobs(filePath,patterns,excludedPatterns){var patternList=[].concat(patterns);var excludedPatternList=[].concat(excludedPatterns||[]);var opts={matchBase:true};return patternList.some(function(pattern){return minimatch(filePath,pattern,opts);})&&!excludedPatternList.some(function(excludedPattern){return minimatch(filePath,excludedPattern,opts);});}var resolveConfig_1={resolveConfig:resolveConfig,resolveConfigFile:resolveConfigFile,clearCache:clearCache};var commentEndRe=/\*\/$/;var commentStartRe=/^\/\*\*/;var docblockRe=/^\s*(\/\*\*?(.|\r?\n)*?\*\/)/;var lineCommentRe=/\/\/([^\r\n]*)/g;var ltrimRe=/^\s*/;var multilineRe=/(?:^|\r?\n) *(@[^\r\n]*?) *\r?\n *([^@\r\n\s][^@\r\n]+?) *\r?\n/g;var propertyRe=/(?:^|\r?\n) *@(\S+) *([^\r\n]*)/g;var stringStartRe=/(\r?\n|^) *\*/g;var wsRe=/[\t ]+/g;function extract(contents){var match=contents.match(docblockRe);return match?match[0].replace(ltrimRe,'')||'':'';}function parse$3(docblock){docblock=docblock.replace(commentStartRe,'').replace(commentEndRe,'').replace(wsRe,' ').replace(lineCommentRe,'').replace(stringStartRe,'$1');// Normalize multi-line directives
var prev='';while(prev!==docblock){prev=docblock;docblock=docblock.replace(multilineRe,'\n$1 $2\n');}docblock=docblock.trim();var result=Object.create(null);var match=void 0;while(match=propertyRe.exec(docblock)){result[match[1]]=match[2];}return result;}var extract_1=extract;var parse_1$2=parse$3;var index$70={extract:extract_1,parse:parse_1$2};var require$$2$20=_package$1&&_package$1['default']||_package$1;var stripBom=index$2;var comments=comments$1;var version=require$$2$20.version;var printAstToDoc=printer.printAstToDoc;var util$1=util$3;var _printDocToString=docPrinter.printDocToString;var normalizeOptions=options.normalize;var parser=parser$1;var printDocToDebug=docDebug.printDocToDebug;var config=resolveConfig_1;var docblock=index$70;function guessLineEnding(text){var index=text.indexOf("\n");if(index>=0&&text.charAt(index-1)==="\r"){return"\r\n";}return"\n";}function attachComments(text,ast,opts){var astComments=ast.comments;if(astComments){delete ast.comments;comments.attach(astComments,ast,text,opts);}ast.tokens=[];opts.originalText=text.trimRight();return astComments;}function hasPragma(text){var pragmas=Object.keys(docblock.parse(docblock.extract(text)));return pragmas.indexOf("prettier")!==-1||pragmas.indexOf("format")!==-1;}function ensureAllCommentsPrinted(astComments){if(!astComments){return;}for(var _i34=0;_i34<astComments.length;++_i34){if(astComments[_i34].value.trim()==="prettier-ignore"){// If there's a prettier-ignore, we're not printing that sub-tree so we
var prev='';while(prev!==docblock){prev=docblock;docblock=docblock.replace(multilineRe,'\n$1 $2\n');}docblock=docblock.trim();var result=Object.create(null);var match=void 0;while(match=propertyRe.exec(docblock)){result[match[1]]=match[2];}return result;}var extract_1=extract;var parse_1$2=parse$3;var index$70={extract:extract_1,parse:parse_1$2};var PassThrough=stream.PassThrough;var bufferStream$1=function bufferStream$1(opts){opts=Object.assign({},opts);var array=opts.array;var encoding=opts.encoding;var buffer=encoding==='buffer';var objectMode=false;if(array){objectMode=!(encoding||buffer);}else{encoding=encoding||'utf8';}if(buffer){encoding=null;}var len=0;var ret=[];var stream$$1=new PassThrough({objectMode:objectMode});if(encoding){stream$$1.setEncoding(encoding);}stream$$1.on('data',function(chunk){ret.push(chunk);if(objectMode){len=ret.length;}else{len+=chunk.length;}});stream$$1.getBufferedValue=function(){if(array){return ret;}return buffer?Buffer.concat(ret,len):ret.join('');};stream$$1.getBufferedLength=function(){return len;};return stream$$1;};var bufferStream=bufferStream$1;function getStream$1(inputStream,opts){if(!inputStream){return Promise.reject(new Error('Expected a stream'));}opts=Object.assign({maxBuffer:Infinity},opts);var maxBuffer=opts.maxBuffer;var stream$$1=void 0;var clean=void 0;var p=new Promise(function(resolve,reject){var error=function error(err){if(err){// null check
err.bufferedData=stream$$1.getBufferedValue();}reject(err);};stream$$1=bufferStream(opts);inputStream.once('error',error);inputStream.pipe(stream$$1);stream$$1.on('data',function(){if(stream$$1.getBufferedLength()>maxBuffer){reject(new Error('maxBuffer exceeded'));}});stream$$1.once('error',error);stream$$1.on('end',resolve);clean=function clean(){// some streams doesn't implement the `stream.Readable` interface correctly
if(inputStream.unpipe){inputStream.unpipe(stream$$1);}};});p.then(clean,clean);return p.then(function(){return stream$$1.getBufferedValue();});}var index$72=getStream$1;var buffer=function buffer(stream$$1,opts){return getStream$1(stream$$1,Object.assign({},opts,{encoding:'buffer'}));};var array=function array(stream$$1,opts){return getStream$1(stream$$1,Object.assign({},opts,{array:true}));};index$72.buffer=buffer;index$72.array=array;var require$$2$20=_package$1&&_package$1['default']||_package$1;var stripBom=index$2;var comments=comments$1;var version=require$$2$20.version;var printAstToDoc=printer.printAstToDoc;var util$1=util$3;var _printDocToString=docPrinter.printDocToString;var normalizeOptions=options.normalize;var parser=parser$1;var printDocToDebug=docDebug.printDocToDebug;var config=resolveConfig_1;var docblock=index$70;var getStream=index$72;function guessLineEnding(text){var index=text.indexOf("\n");if(index>=0&&text.charAt(index-1)==="\r"){return"\r\n";}return"\n";}function attachComments(text,ast,opts){var astComments=ast.comments;if(astComments){delete ast.comments;comments.attach(astComments,ast,text,opts);}ast.tokens=[];opts.originalText=text.trimRight();return astComments;}function hasPragma(text){var pragmas=Object.keys(docblock.parse(docblock.extract(text)));return pragmas.indexOf("prettier")!==-1||pragmas.indexOf("format")!==-1;}function ensureAllCommentsPrinted(astComments){if(!astComments){return;}for(var _i34=0;_i34<astComments.length;++_i34){if(astComments[_i34].value.trim()==="prettier-ignore"){// If there's a prettier-ignore, we're not printing that sub-tree so we
// don't know if the comments was printed or not.
return;}}astComments.forEach(function(comment){if(!comment.printed){throw new Error('Comment "'+comment.value.trim()+'" was not printed. Please report this error!');}delete comment.printed;});}function _formatWithCursor(text,opts,addAlignmentSize){if(opts.requirePragma&&!hasPragma(text)){return{formatted:text};}text=stripBom(text);addAlignmentSize=addAlignmentSize||0;var ast=parser.parse(text,opts);var formattedRangeOnly=formatRange(text,opts,ast);if(formattedRangeOnly){return{formatted:formattedRangeOnly};}var cursorOffset=void 0;if(opts.cursorOffset>=0){var cursorNodeAndParents=findNodeAtOffset(ast,opts.cursorOffset);var cursorNode=cursorNodeAndParents.node;if(cursorNode){cursorOffset=opts.cursorOffset-util$1.locStart(cursorNode);opts.cursorNode=cursorNode;}}var astComments=attachComments(text,ast,opts);var doc=printAstToDoc(ast,opts,addAlignmentSize);opts.newLine=guessLineEnding(text);var toStringResult=_printDocToString(doc,opts);var str=toStringResult.formatted;var cursorOffsetResult=toStringResult.cursor;ensureAllCommentsPrinted(astComments);// Remove extra leading indentation as well as the added indentation after last newline
if(addAlignmentSize>0){return{formatted:str.trim()+opts.newLine};}if(cursorOffset!==undefined){return{formatted:str,cursorOffset:cursorOffsetResult+cursorOffset};}return{formatted:str};}function _format(text,opts,addAlignmentSize){return _formatWithCursor(text,opts,addAlignmentSize).formatted;}function findSiblingAncestors(startNodeAndParents,endNodeAndParents){var resultStartNode=startNodeAndParents.node;var resultEndNode=endNodeAndParents.node;if(resultStartNode===resultEndNode){return{startNode:resultStartNode,endNode:resultEndNode};}var _iteratorNormalCompletion15=true;var _didIteratorError15=false;var _iteratorError15=undefined;try{for(var _iterator15=endNodeAndParents.parentNodes[Symbol.iterator](),_step15;!(_iteratorNormalCompletion15=(_step15=_iterator15.next()).done);_iteratorNormalCompletion15=true){var endParent=_step15.value;if(endParent.type!=="Program"&&endParent.type!=="File"&&util$1.locStart(endParent)>=util$1.locStart(startNodeAndParents.node)){resultEndNode=endParent;}else{break;}}}catch(err){_didIteratorError15=true;_iteratorError15=err;}finally{try{if(!_iteratorNormalCompletion15&&_iterator15.return){_iterator15.return();}}finally{if(_didIteratorError15){throw _iteratorError15;}}}var _iteratorNormalCompletion16=true;var _didIteratorError16=false;var _iteratorError16=undefined;try{for(var _iterator16=startNodeAndParents.parentNodes[Symbol.iterator](),_step16;!(_iteratorNormalCompletion16=(_step16=_iterator16.next()).done);_iteratorNormalCompletion16=true){var startParent=_step16.value;if(startParent.type!=="Program"&&startParent.type!=="File"&&util$1.locEnd(startParent)<=util$1.locEnd(endNodeAndParents.node)){resultStartNode=startParent;}else{break;}}}catch(err){_didIteratorError16=true;_iteratorError16=err;}finally{try{if(!_iteratorNormalCompletion16&&_iterator16.return){_iterator16.return();}}finally{if(_didIteratorError16){throw _iteratorError16;}}}return{startNode:resultStartNode,endNode:resultEndNode};}function findNodeAtOffset(node,offset,predicate,parentNodes){predicate=predicate||function(){return true;};parentNodes=parentNodes||[];var start=util$1.locStart(node);var end=util$1.locEnd(node);if(start<=offset&&offset<=end){var _iteratorNormalCompletion17=true;var _didIteratorError17=false;var _iteratorError17=undefined;try{for(var _iterator17=comments.getSortedChildNodes(node)[Symbol.iterator](),_step17;!(_iteratorNormalCompletion17=(_step17=_iterator17.next()).done);_iteratorNormalCompletion17=true){var childNode=_step17.value;var childResult=findNodeAtOffset(childNode,offset,predicate,[node].concat(parentNodes));if(childResult){return childResult;}}}catch(err){_didIteratorError17=true;_iteratorError17=err;}finally{try{if(!_iteratorNormalCompletion17&&_iterator17.return){_iterator17.return();}}finally{if(_didIteratorError17){throw _iteratorError17;}}}if(predicate(node)){return{node:node,parentNodes:parentNodes};}}}// See https://www.ecma-international.org/ecma-262/5.1/#sec-A.5
@ -1881,5 +1884,5 @@ var rangeStringOrig=text.slice(opts.rangeStart,opts.rangeEnd);var startNonWhites
// Use `Math.min` since `lastIndexOf` returns 0 when `rangeStart` is 0
var rangeStart2=Math.min(rangeStart,text.lastIndexOf("\n",rangeStart)+1);var indentString=text.slice(rangeStart2,rangeStart);var alignmentSize=util$1.getAlignmentSize(indentString,opts.tabWidth);var rangeFormatted=_format(rangeString,Object.assign({},opts,{rangeStart:0,rangeEnd:Infinity,printWidth:opts.printWidth-alignmentSize}),alignmentSize);// Since the range contracts to avoid trailing whitespace,
// we need to remove the newline that was inserted by the `format` call.
var rangeTrimmed=rangeFormatted.trimRight();return text.slice(0,rangeStart)+rangeTrimmed+text.slice(rangeEnd);}var index={formatWithCursor:function formatWithCursor(text,opts){return _formatWithCursor(text,normalizeOptions(opts));},format:function format(text,opts){return _format(text,normalizeOptions(opts));},check:function check(text,opts){try{var formatted=_format(text,normalizeOptions(opts));return formatted===text;}catch(e){return false;}},resolveConfig:config.resolveConfig,clearConfigCache:config.clearCache,version:version,/* istanbul ignore next */__debug:{parse:function parse(text,opts){return parser.parse(text,opts);},formatAST:function formatAST(ast,opts){opts=normalizeOptions(opts);var doc=printAstToDoc(ast,opts);var str=_printDocToString(doc,opts);return str;},// Doesn't handle shebang for now
var rangeTrimmed=rangeFormatted.trimRight();return text.slice(0,rangeStart)+rangeTrimmed+text.slice(rangeEnd);}var index={formatWithCursor:function formatWithCursor(text,opts){return _formatWithCursor(text,normalizeOptions(opts));},format:function format(text,opts){return _format(text,normalizeOptions(opts));},check:function check(text,opts){try{var formatted=_format(text,normalizeOptions(opts));return formatted===text;}catch(e){return false;}},resolveConfig:config.resolveConfig,clearConfigCache:config.clearCache,version:version,/* istanbul ignore next */__debug:{getStream:getStream,parse:function parse(text,opts){return parser.parse(text,opts);},formatAST:function formatAST(ast,opts){opts=normalizeOptions(opts);var doc=printAstToDoc(ast,opts);var str=_printDocToString(doc,opts);return str;},// Doesn't handle shebang for now
formatDoc:function formatDoc(doc,opts){opts=normalizeOptions(opts);var debug=printDocToDebug(doc);var str=_format(debug,opts);return str;},printToDoc:function printToDoc(text,opts){opts=normalizeOptions(opts);var ast=parser.parse(text,opts);attachComments(text,ast,opts);var doc=printAstToDoc(ast,opts);return doc;},printDocToString:function printDocToString(doc,opts){opts=normalizeOptions(opts);var str=_printDocToString(doc,opts);return str;}}};module.exports=index;

File diff suppressed because it is too large Load Diff