Small regression fixes
master
Christopher Chedeau 2017-08-29 09:00:14 -07:00
parent 63835d1ccb
commit c3506198c0
6 changed files with 110 additions and 94 deletions

View File

@ -1,3 +1,12 @@
# 1.6.1
[link](https://github.com/jlongster/prettier/compare/1.6.0...1.6.1)
* Fix CLI option parsing with no arguments (#2684)
* Fix config file finding when using stdin (#2692)
* Fix union type with type params regression (#2688)
* Fix flow parenthesis regression (#2687)
# 1.6.0
[link](https://github.com/jlongster/prettier/compare/1.5.3...1.6.0)

View File

@ -1,6 +1,6 @@
{
"name": "prettier",
"version": "1.6.0",
"version": "1.6.1",
"description": "Prettier is an opinionated code formatter",
"bin": {
"prettier": "./bin/prettier.js"

View File

@ -170,7 +170,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.6.0";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 dependencies={"babel-code-frame":"7.0.0-alpha.12","babylon":"7.0.0-beta.17","chalk":"2.0.1","cosmiconfig":"2.2.2","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-validate":"20.0.3","minimatch":"3.0.4","minimist":"1.2.0","parse5":"3.0.2","postcss":"^6.0.1","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":"git://github.com/lydell/postcss-values-parser.git#af2c80b2bb558a6e7d61540d97f068f9fa162b38","strip-bom":"3.0.0","typescript":"2.5.1","typescript-eslint-parser":"git://github.com/eslint/typescript-eslint-parser.git#801d65585af6995a223136862944095b48f5c567"};var devDependencies={"babel-cli":"6.24.1","babel-preset-es2015":"6.24.1","codecov":"2.2.0","cross-env":"5.0.1","cross-spawn":"5.1.0","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":"20.0.0","mkdirp":"^0.5.1","prettier":"1.5.2","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":"./scripts/build/build.js"};var _package={name:name,version:version$1,description:description,bin:bin,repository:repository,homepage:homepage,author:author,license:license,main:main,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,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.6.1";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 dependencies={"babel-code-frame":"7.0.0-alpha.12","babylon":"7.0.0-beta.22","chalk":"2.0.1","cosmiconfig":"2.2.2","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-validate":"20.0.3","minimatch":"3.0.4","minimist":"1.2.0","parse5":"3.0.2","postcss":"^6.0.1","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":"git://github.com/lydell/postcss-values-parser.git#af2c80b2bb558a6e7d61540d97f068f9fa162b38","strip-bom":"3.0.0","typescript":"2.5.1","typescript-eslint-parser":"git://github.com/eslint/typescript-eslint-parser.git#801d65585af6995a223136862944095b48f5c567"};var devDependencies={"babel-cli":"6.24.1","babel-preset-es2015":"6.24.1","codecov":"2.2.0","cross-env":"5.0.1","cross-spawn":"5.1.0","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":"20.0.0","mkdirp":"^0.5.1","prettier":"1.6.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":"./scripts/build/build.js"};var _package={name:name,version:version$1,description:description,bin:bin,repository:repository,homepage:homepage,author:author,license:license,main:main,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,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.
@ -560,7 +560,7 @@ result.push(" & ",_i24>1?indent$2(types[_i24]):types[_i24]);}}return group$1(con
// | B
// | C
var _parent11=path.getParentNode();// If there's a leading comment, the parent is doing the indentation
var shouldIndent=_parent11.type!=="TypeParameterInstantiation"&&_parent11.type!=="GenericTypeAnnotation"&&!((_parent11.type==="TypeAlias"||_parent11.type==="VariableDeclarator")&&hasLeadingOwnLineComment(options.originalText,n));// {
var shouldIndent=_parent11.type!=="TypeParameterInstantiation"&&_parent11.type!=="GenericTypeAnnotation"&&_parent11.type!=="TSTypeReference"&&!((_parent11.type==="TypeAlias"||_parent11.type==="VariableDeclarator")&&hasLeadingOwnLineComment(options.originalText,n));// {
// a: string
// } | null | void
// should be inlined and not be printed in the multi-line variant
@ -1281,7 +1281,7 @@ return undefined;}// JSON.parse compat
if(typeof input!=='string')input=String(input);if(options==null)options={};if(options.reserved_keys==null)options.reserved_keys='ignore';if(options.reserved_keys==='throw'||options.reserved_keys==='ignore'){if(options.null_prototype==null){options.null_prototype=true;}}try{return parse(input,options);}catch(err){// jju is a recursive parser, so JSON.parse("{{{{{{{") could blow up the stack
//
// this catch is used to skip all those internal calls
if(err instanceof SyntaxError&&err.row!=null&&err.column!=null){var old_err=err;err=SyntaxError(old_err.message);err.column=old_err.column;err.row=old_err.row;}throw err;}};module.exports.tokenize=function tokenizeJSON(input,options){if(options==null)options={};options._tokenize=function(smth){if(options._addstack)smth.stack.unshift.apply(smth.stack,options._addstack);tokens.push(smth);};var tokens=[];tokens.data=module.exports.parse(input,options);return tokens;};});var errorEx=index$60;var fallback=parse_1;var JSONError=errorEx('JSONError',{fileName:errorEx.append('in %s')});var index$58=function index$58(x,reviver,filename){if(typeof reviver==='string'){filename=reviver;reviver=null;}try{try{return JSON.parse(x,reviver);}catch(err){fallback.parse(x,{mode:'json',reviver:reviver});throw err;}}catch(err){var jsonErr=new JSONError(err);if(filename){jsonErr.fileName=filename;}throw jsonErr;}};var parseJson$1=index$58;var parseJson_1=function parseJson_1(json,filepath){try{return parseJson$1(json);}catch(err){err.message='JSON Error in '+filepath+':\n'+err.message;throw err;}};var path$4=require$$0$1;var readFile=readFile$1;var parseJson=parseJson_1;var loadPackageProp$1=function loadPackageProp$1(packageDir,options){var packagePath=path$4.join(packageDir,'package.json');return readFile(packagePath).then(function(content){if(!content)return null;var parsedContent=parseJson(content,packagePath);var packagePropValue=parsedContent[options.packageProp];if(!packagePropValue)return null;return{config:packagePropValue,filepath:packagePath};});};function isNothing(subject){return typeof subject==='undefined'||subject===null;}function isObject(subject){return(typeof subject==='undefined'?'undefined':_typeof(subject))==='object'&&subject!==null;}function toArray(sequence){if(Array.isArray(sequence))return sequence;else if(isNothing(sequence))return[];return[sequence];}function extend(target,source){var index,length,key,sourceKeys;if(source){sourceKeys=Object.keys(source);for(index=0,length=sourceKeys.length;index<length;index+=1){key=sourceKeys[index];target[key]=source[key];}}return target;}function repeat(string,count){var result='',cycle;for(cycle=0;cycle<count;cycle+=1){result+=string;}return result;}function isNegativeZero(number){return number===0&&Number.NEGATIVE_INFINITY===1/number;}var isNothing_1=isNothing;var isObject_1=isObject;var toArray_1=toArray;var repeat_1=repeat;var isNegativeZero_1=isNegativeZero;var extend_1=extend;var common$1={isNothing:isNothing_1,isObject:isObject_1,toArray:toArray_1,repeat:repeat_1,isNegativeZero:isNegativeZero_1,extend:extend_1};// YAML error class. http://stackoverflow.com/questions/8458984
if(err instanceof SyntaxError&&err.row!=null&&err.column!=null){var old_err=err;err=SyntaxError(old_err.message);err.column=old_err.column;err.row=old_err.row;}throw err;}};module.exports.tokenize=function tokenizeJSON(input,options){if(options==null)options={};options._tokenize=function(smth){if(options._addstack)smth.stack.unshift.apply(smth.stack,options._addstack);tokens.push(smth);};var tokens=[];tokens.data=module.exports.parse(input,options);return tokens;};});var errorEx=index$60;var fallback=parse_1;var JSONError=errorEx('JSONError',{fileName:errorEx.append('in %s')});var index$58=function index$58(x,reviver,filename){if(typeof reviver==='string'){filename=reviver;reviver=null;}try{try{return JSON.parse(x,reviver);}catch(err){fallback.parse(x,{mode:'json',reviver:reviver});throw err;}}catch(err){var jsonErr=new JSONError(err);if(filename){jsonErr.fileName=filename;}throw jsonErr;}};var parseJson$1=index$58;var parseJson_1=function parseJson_1(json,filepath){try{return parseJson$1(json);}catch(err){err.message='JSON Error in '+filepath+':\n'+err.message;throw err;}};var path$3=require$$0$1;var readFile=readFile$1;var parseJson=parseJson_1;var loadPackageProp$1=function loadPackageProp$1(packageDir,options){var packagePath=path$3.join(packageDir,'package.json');return readFile(packagePath).then(function(content){if(!content)return null;var parsedContent=parseJson(content,packagePath);var packagePropValue=parsedContent[options.packageProp];if(!packagePropValue)return null;return{config:packagePropValue,filepath:packagePath};});};function isNothing(subject){return typeof subject==='undefined'||subject===null;}function isObject(subject){return(typeof subject==='undefined'?'undefined':_typeof(subject))==='object'&&subject!==null;}function toArray(sequence){if(Array.isArray(sequence))return sequence;else if(isNothing(sequence))return[];return[sequence];}function extend(target,source){var index,length,key,sourceKeys;if(source){sourceKeys=Object.keys(source);for(index=0,length=sourceKeys.length;index<length;index+=1){key=sourceKeys[index];target[key]=source[key];}}return target;}function repeat(string,count){var result='',cycle;for(cycle=0;cycle<count;cycle+=1){result+=string;}return result;}function isNegativeZero(number){return number===0&&Number.NEGATIVE_INFINITY===1/number;}var isNothing_1=isNothing;var isObject_1=isObject;var toArray_1=toArray;var repeat_1=repeat;var isNegativeZero_1=isNegativeZero;var extend_1=extend;var common$1={isNothing:isNothing_1,isObject:isObject_1,toArray:toArray_1,repeat:repeat_1,isNegativeZero:isNegativeZero_1,extend:extend_1};// YAML error class. http://stackoverflow.com/questions/8458984
//
function YAMLException$2(reason,mark){// Super constructor
Error.call(this);// Include stack trace in error object
@ -1529,8 +1529,8 @@ var scan=deprecated$3('scan');var parse$1=deprecated$3('parse');var compose=depr
return readRcFile('yaml');}).then(function(content){if(content){// If the previous check returned an object with a config
// property, then it succeeded and this step can be skipped
if(content.config)return content;// If it just returned a string, then *this* check succeeded
var successFilepath=filepath+'.yaml';return{config:yaml.safeLoad(content,{filename:successFilepath}),filepath:successFilepath};}return readRcFile('yml');}).then(function(content){if(content){if(content.config)return content;var successFilepath=filepath+'.yml';return{config:yaml.safeLoad(content,{filename:successFilepath}),filepath:successFilepath};}return readRcFile('js');}).then(function(content){if(content){if(content.config)return content;var successFilepath=filepath+'.js';return{config:requireFromString(content,successFilepath),filepath:successFilepath};}return null;});}function readRcFile(extension){var filepathWithExtension=extension?filepath+'.'+extension:filepath;return readFile$3(filepathWithExtension);}};var requireFromString$1=index$66;var readFile$4=readFile$1;var loadJs$1=function loadJs$1(filepath){return readFile$4(filepath).then(function(content){if(!content)return null;return{config:requireFromString$1(content,filepath),filepath:filepath};});};var yaml$2=index$64;var requireFromString$2=index$66;var readFile$5=readFile$1;var parseJson$3=parseJson_1;var loadDefinedFile$1=function loadDefinedFile$1(filepath,options){return readFile$5(filepath,{throwNotFound:true}).then(function(content){var parsedConfig=function(){switch(options.format){case'json':return parseJson$3(content,filepath);case'yaml':return yaml$2.safeLoad(content,{filename:filepath});case'js':return requireFromString$2(content,filepath);default:return tryAllParsing(content,filepath);}}();if(!parsedConfig){throw new Error('Failed to parse "'+filepath+'" as JSON, JS, or YAML.');}return{config:parsedConfig,filepath:filepath};});};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 path$3=require$$0$1;var isDir=index$56;var loadPackageProp=loadPackageProp$1;var loadRc=loadRc$1;var loadJs=loadJs$1;var loadDefinedFile=loadDefinedFile$1;var createExplorer$1=function createExplorer$1(options){// 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||identityPromise;function clearFileCache(){if(fileCache)fileCache.clear();}function clearDirectoryCache(){if(directoryCache)directoryCache.clear();}function clearCaches(){clearFileCache();clearDirectoryCache();}function load(searchPath,configPath){if(!configPath&&options.configPath){configPath=options.configPath;}if(configPath){var absoluteConfigPath=path$3.resolve(process.cwd(),configPath);if(fileCache&&fileCache.has(absoluteConfigPath)){return fileCache.get(absoluteConfigPath);}var result=loadDefinedFile(absoluteConfigPath,options).then(transform);if(fileCache)fileCache.set(absoluteConfigPath,result);return result;}if(!searchPath)return Promise.resolve(null);var absoluteSearchPath=path$3.resolve(process.cwd(),searchPath);return isDirectory(absoluteSearchPath).then(function(searchPathIsDirectory){var directory=searchPathIsDirectory?absoluteSearchPath:path$3.dirname(absoluteSearchPath);return searchDirectory(directory);});}function searchDirectory(directory){if(directoryCache&&directoryCache.has(directory)){return directoryCache.get(directory);}var result=Promise.resolve().then(function(){if(!options.packageProp)return;return loadPackageProp(directory,options);}).then(function(result){if(result||!options.rc)return result;return loadRc(path$3.join(directory,options.rc),options);}).then(function(result){if(result||!options.js)return result;return loadJs(path$3.join(directory,options.js));}).then(function(result){if(result)return result;var splitPath=directory.split(path$3.sep);var nextDirectory=splitPath.length>1?splitPath.slice(0,-1).join(path$3.sep):null;if(!nextDirectory||directory===options.stopDir)return null;return searchDirectory(nextDirectory);}).then(transform);if(directoryCache)directoryCache.set(directory,result);return result;}return{load:load,clearFileCache:clearFileCache,clearDirectoryCache:clearDirectoryCache,clearCaches:clearCaches};};function isDirectory(filepath){return new Promise(function(resolve,reject){return isDir(filepath,function(err,dir){if(err)return reject(err);return resolve(dir);});});}function identityPromise(x){return Promise.resolve(x);}var path$2=require$$0$1;var oshomedir=index$50;var minimist=index$52;var assign=index$54;var createExplorer=createExplorer$1;var parsedCliArgs=minimist(process.argv);var index$48=function index$48(moduleName,options){options=assign({packageProp:moduleName,rc:'.'+moduleName+'rc',js:moduleName+'.config.js',argv:'config',rcStrictJson:false,stopDir:oshomedir(),cache:true},options);if(options.argv&&parsedCliArgs[options.argv]){options.configPath=path$2.resolve(parsedCliArgs[options.argv]);}return createExplorer(options);};var index$70=function index$70(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$72=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$70;var balanced=index$72;var index$68=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
var successFilepath=filepath+'.yaml';return{config:yaml.safeLoad(content,{filename:successFilepath}),filepath:successFilepath};}return readRcFile('yml');}).then(function(content){if(content){if(content.config)return content;var successFilepath=filepath+'.yml';return{config:yaml.safeLoad(content,{filename:successFilepath}),filepath:successFilepath};}return readRcFile('js');}).then(function(content){if(content){if(content.config)return content;var successFilepath=filepath+'.js';return{config:requireFromString(content,successFilepath),filepath:successFilepath};}return null;});}function readRcFile(extension){var filepathWithExtension=extension?filepath+'.'+extension:filepath;return readFile$3(filepathWithExtension);}};var requireFromString$1=index$66;var readFile$4=readFile$1;var loadJs$1=function loadJs$1(filepath){return readFile$4(filepath).then(function(content){if(!content)return null;return{config:requireFromString$1(content,filepath),filepath:filepath};});};var yaml$2=index$64;var requireFromString$2=index$66;var readFile$5=readFile$1;var parseJson$3=parseJson_1;var loadDefinedFile$1=function loadDefinedFile$1(filepath,options){return readFile$5(filepath,{throwNotFound:true}).then(function(content){var parsedConfig=function(){switch(options.format){case'json':return parseJson$3(content,filepath);case'yaml':return yaml$2.safeLoad(content,{filename:filepath});case'js':return requireFromString$2(content,filepath);default:return tryAllParsing(content,filepath);}}();if(!parsedConfig){throw new Error('Failed to parse "'+filepath+'" as JSON, JS, or YAML.');}return{config:parsedConfig,filepath:filepath};});};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 path$2=require$$0$1;var isDir=index$56;var loadPackageProp=loadPackageProp$1;var loadRc=loadRc$1;var loadJs=loadJs$1;var loadDefinedFile=loadDefinedFile$1;var createExplorer$1=function createExplorer$1(options){// 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||identityPromise;function clearFileCache(){if(fileCache)fileCache.clear();}function clearDirectoryCache(){if(directoryCache)directoryCache.clear();}function clearCaches(){clearFileCache();clearDirectoryCache();}function load(searchPath,configPath){if(!configPath&&options.configPath){configPath=options.configPath;}if(configPath){var absoluteConfigPath=path$2.resolve(process.cwd(),configPath);if(fileCache&&fileCache.has(absoluteConfigPath)){return fileCache.get(absoluteConfigPath);}var result=loadDefinedFile(absoluteConfigPath,options).then(transform);if(fileCache)fileCache.set(absoluteConfigPath,result);return result;}if(!searchPath)return Promise.resolve(null);var absoluteSearchPath=path$2.resolve(process.cwd(),searchPath);return isDirectory(absoluteSearchPath).then(function(searchPathIsDirectory){var directory=searchPathIsDirectory?absoluteSearchPath:path$2.dirname(absoluteSearchPath);return searchDirectory(directory);});}function searchDirectory(directory){if(directoryCache&&directoryCache.has(directory)){return directoryCache.get(directory);}var result=Promise.resolve().then(function(){if(!options.packageProp)return;return loadPackageProp(directory,options);}).then(function(result){if(result||!options.rc)return result;return loadRc(path$2.join(directory,options.rc),options);}).then(function(result){if(result||!options.js)return result;return loadJs(path$2.join(directory,options.js));}).then(function(result){if(result)return result;var splitPath=directory.split(path$2.sep);var nextDirectory=splitPath.length>1?splitPath.slice(0,-1).join(path$2.sep):null;if(!nextDirectory||directory===options.stopDir)return null;return searchDirectory(nextDirectory);}).then(transform);if(directoryCache)directoryCache.set(directory,result);return result;}return{load:load,clearFileCache:clearFileCache,clearDirectoryCache:clearDirectoryCache,clearCaches:clearCaches};};function isDirectory(filepath){return new Promise(function(resolve,reject){return isDir(filepath,function(err,dir){if(err)return reject(err);return resolve(dir);});});}function identityPromise(x){return Promise.resolve(x);}var path$1=require$$0$1;var oshomedir=index$50;var minimist=index$52;var assign=index$54;var createExplorer=createExplorer$1;var parsedCliArgs=minimist(process.argv);var index$48=function index$48(moduleName,options){options=assign({packageProp:moduleName,rc:'.'+moduleName+'rc',js:moduleName+'.config.js',argv:'config',rcStrictJson:false,stopDir:oshomedir(),cache:true},options);if(options.argv&&parsedCliArgs[options.argv]){options.configPath=path$1.resolve(parsedCliArgs[options.argv]);}return createExplorer(options);};var index$70=function index$70(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$72=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$70;var balanced=index$72;var index$68=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
// treated as individual members, like {a,{b,c},d}
function parseCommaParts(str){if(!str)return[''];var parts=[];var m=balanced('{','}',str);if(!m)return str.split(',');var pre=m.pre;var body=m.body;var post=m.post;var p=pre.split(',');p[p.length-1]+='{'+body+'}';var postParts=parseCommaParts(post);if(post.length){p[p.length-1]+=postParts.shift();p.push.apply(p,postParts);}parts.push.apply(parts,p);return parts;}function expandTop(str){if(!str)return[];// I don't know why Bash 4.3 does this, but it does.
@ -1544,7 +1544,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$5={sep:'/'};try{path$5=require$$0$1;}catch(er){}var GLOBSTAR=minimatch$1.GLOBSTAR=Minimatch.GLOBSTAR={};var expand=index$68;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$4={sep:'/'};try{path$4=require$$0$1;}catch(er){}var GLOBSTAR=minimatch$1.GLOBSTAR=Minimatch.GLOBSTAR={};var expand=index$68;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 .
@ -1558,7 +1558,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$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.
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.
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.
@ -1692,7 +1692,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$5.sep!=='/'){f=f.split(path$5.sep).join('/');}// treat the test path as a set of pathparts.
if(path$4.sep!=='/'){f=f.split(path$4.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.
@ -1770,7 +1770,7 @@ return partial;}else if(pi===pl){// ran out of pattern, still have file left.
// a/* should match a/b/
var emptyFileEnd=fi===fl-1&&file[fi]==='';return emptyFileEnd;}// should be unreachable.
throw new Error('wtf?');};// replace stuff like \* with *
function globUnescape(s){return s.replace(/\\(.)/g,'$1');}function regExpEscape(s){return s.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,'\\$&');}var cosmiconfig=index$48;var minimatch=minimatch_1;var path$1=require$$0$1;var withCache=cosmiconfig("prettier");var noCache=cosmiconfig("prettier",{cache:false});function resolveConfig(filePath,opts){var useCache=!(opts&&opts.useCache===false);var fileDir=filePath?path$1.dirname(filePath):undefined;return(useCache?withCache:noCache).load(fileDir).then(function(result){if(!result){return null;}return mergeOverrides(result.config,filePath);});}function clearCache(){withCache.clearCaches();}function resolveConfigFile(filePath){return noCache.load(filePath).then(function(result){if(result){return result.filepath;}return null;});}function mergeOverrides(config,filePath){var options=Object.assign({},config);if(filePath&&options.overrides){var _iteratorNormalCompletion2=true;var _didIteratorError2=false;var _iteratorError2=undefined;try{for(var _iterator2=options.overrides[Symbol.iterator](),_step2;!(_iteratorNormalCompletion2=(_step2=_iterator2.next()).done);_iteratorNormalCompletion2=true){var override=_step2.value;if(pathMatchesGlobs(filePath,override.files,override.excludeFiles)){Object.assign(options,override.options);}}}catch(err){_didIteratorError2=true;_iteratorError2=err;}finally{try{if(!_iteratorNormalCompletion2&&_iterator2.return){_iterator2.return();}}finally{if(_didIteratorError2){throw _iteratorError2;}}}}delete options.overrides;return options;}// Based on eslint: https://github.com/eslint/eslint/blob/master/lib/config/config-ops.js
function globUnescape(s){return s.replace(/\\(.)/g,'$1');}function regExpEscape(s){return s.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,'\\$&');}var cosmiconfig=index$48;var minimatch=minimatch_1;var withCache=cosmiconfig("prettier");var noCache=cosmiconfig("prettier",{cache:false});function resolveConfig(filePath,opts){var useCache=!(opts&&opts.useCache===false);return(useCache?withCache:noCache).load(filePath).then(function(result){if(!result){return null;}return mergeOverrides(result.config,filePath);});}function clearCache(){withCache.clearCaches();}function resolveConfigFile(filePath){return noCache.load(filePath).then(function(result){if(result){return result.filepath;}return null;});}function mergeOverrides(config,filePath){var options=Object.assign({},config);if(filePath&&options.overrides){var _iteratorNormalCompletion2=true;var _didIteratorError2=false;var _iteratorError2=undefined;try{for(var _iterator2=options.overrides[Symbol.iterator](),_step2;!(_iteratorNormalCompletion2=(_step2=_iterator2.next()).done);_iteratorNormalCompletion2=true){var override=_step2.value;if(pathMatchesGlobs(filePath,override.files,override.excludeFiles)){Object.assign(options,override.options);}}}catch(err){_didIteratorError2=true;_iteratorError2=err;}finally{try{if(!_iteratorNormalCompletion2&&_iterator2.return){_iterator2.return();}}finally{if(_didIteratorError2){throw _iteratorError2;}}}}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 require$$2$19=_package$1&&_package$1['default']||_package$1;var stripBom=index$2;var comments=comments$1;var version=require$$2$19.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;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 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){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

View File

@ -42,9 +42,9 @@ var babylon = function () {
if ((s += e[i]) > t) return !1;if ((s += e[i + 1]) >= t) return !0;
}return !1;
}function a(t) {
return t < 65 ? 36 === t : t < 91 || (t < 97 ? 95 === t : t < 123 || (t <= 65535 ? t >= 170 && D.test(String.fromCharCode(t)) : r(t, O)));
return t < 65 ? 36 === t : t < 91 || (t < 97 ? 95 === t : t < 123 || (t <= 65535 ? t >= 170 && R.test(String.fromCharCode(t)) : r(t, O)));
}function n(t) {
return t < 48 ? 36 === t : t < 58 || !(t < 65) && (t < 91 || (t < 97 ? 95 === t : t < 123 || (t <= 65535 ? t >= 170 && R.test(String.fromCharCode(t)) : r(t, O) || r(t, j))));
return t < 48 ? 36 === t : t < 58 || !(t < 65) && (t < 91 || (t < 97 ? 95 === t : t < 123 || (t <= 65535 ? t >= 170 && _.test(String.fromCharCode(t)) : r(t, O) || r(t, j))));
}function o(t) {
return 10 === t || 13 === t || 8232 === t || 8233 === t;
}function h(t, e) {
@ -114,12 +114,12 @@ var babylon = function () {
t.prototype = Object.create(e.prototype), t.prototype.constructor = t, t.__proto__ = e;
},
w = !0,
k = function k(t) {
var e = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : {};this.label = t, this.keyword = e.keyword, this.beforeExpr = !!e.beforeExpr, this.startsExpr = !!e.startsExpr, this.rightAssociative = !!e.rightAssociative, this.isLoop = !!e.isLoop, this.isAssign = !!e.isAssign, this.prefix = !!e.prefix, this.postfix = !!e.postfix, this.binop = e.binop || null, this.updateContext = null;
k = function k(t, e) {
void 0 === e && (e = {}), this.label = t, this.keyword = e.keyword, this.beforeExpr = !!e.beforeExpr, this.startsExpr = !!e.startsExpr, this.rightAssociative = !!e.rightAssociative, this.isLoop = !!e.isLoop, this.isAssign = !!e.isAssign, this.prefix = !!e.prefix, this.postfix = !!e.postfix, this.binop = e.binop || null, this.updateContext = null;
},
N = function (t) {
function e(e) {
var s = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : {};return s.keyword = e, t.call(this, e, s) || this;
function e(e, s) {
return void 0 === s && (s = {}), s.keyword = e, t.call(this, e, s) || this;
}return A(e, t), e;
}(k),
E = function (t) {
@ -133,9 +133,9 @@ var babylon = function () {
});var L = { 6: i("enum await"), strict: i("implements interface let package private protected public static yield"), strictBind: i("eval arguments") },
I = i("break case catch continue debugger default do else finally for function if return switch throw try var while with null true false instanceof typeof void delete new in this let const class extends export import yield super"),
M = "ªµºÀ-ÖØ-öø-ˁˆ-ˑˠ-ˤˬˮͰ-ʹͶͷͺ-ͽͿΆΈ-ΊΌΎ-ΡΣ-ϵϷ-ҁҊ-ԯԱ-Ֆՙա-ևא-תװ-ײؠ-يٮٯٱ-ۓەۥۦۮۯۺ-ۼۿܐܒ-ܯݍ-ޥޱߊ-ߪߴߵߺࠀ-ࠕࠚࠤࠨࡀ-ࡘࢠ-ࢴࢶ-ࢽऄ-हऽॐक़-ॡॱ-ঀঅ-ঌএঐও-নপ-রলশ-হঽৎড়ঢ়য়-ৡৰৱਅ-ਊਏਐਓ-ਨਪ-ਰਲਲ਼ਵਸ਼ਸਹਖ਼-ੜਫ਼ੲ-ੴઅ-ઍએ-ઑઓ-નપ-રલળવ-હઽૐૠૡૹଅ-ଌଏଐଓ-ନପ-ରଲଳଵ-ହଽଡ଼ଢ଼ୟ-ୡୱஃஅ-ஊஎ-ஐஒ-கஙசஜஞடணதந-பம-ஹௐఅ-ఌఎ-ఐఒ-నప-హఽౘ-ౚౠౡಀಅ-ಌಎ-ಐಒ-ನಪ-ಳವ-ಹಽೞೠೡೱೲഅ-ഌഎ-ഐഒ-ഺഽൎൔ-ൖൟ-ൡൺ-ൿඅ-ඖක-නඳ-රලව-ෆก-ะาำเ-ๆກຂຄງຈຊຍດ-ທນ-ຟມ-ຣລວສຫອ-ະາຳຽເ-ໄໆໜ-ໟༀཀ-ཇཉ-ཬྈ-ྌက-ဪဿၐ-ၕၚ-ၝၡၥၦၮ-ၰၵ-ႁႎႠ-ჅჇჍა-ჺჼ-ቈቊ-ቍቐ-ቖቘቚ-ቝበ-ኈኊ-ኍነ-ኰኲ-ኵኸ-ኾዀዂ-ዅወ-ዖዘ-ጐጒ-ጕጘ-ፚᎀ-ᎏᎠ-Ᏽᏸ-ᏽᐁ-ᙬᙯ-ᙿᚁ-ᚚᚠ-ᛪᛮ-ᛸᜀ-ᜌᜎ-ᜑᜠ-ᜱᝀ-ᝑᝠ-ᝬᝮ-ᝰក-ឳៗៜᠠ-ᡷᢀ-ᢨᢪᢰ-ᣵᤀ-ᤞᥐ-ᥭᥰ-ᥴᦀ-ᦫᦰ-ᧉᨀ-ᨖᨠ-ᩔᪧᬅ-ᬳᭅ-ᭋᮃ-ᮠᮮᮯᮺ-ᯥᰀ-ᰣᱍ-ᱏᱚ-ᱽᲀ-ᲈᳩ-ᳬᳮ-ᳱᳵᳶᴀ-ᶿḀ-ἕἘ-Ἕἠ-ὅὈ-Ὅὐ-ὗὙὛὝὟ-ώᾀ-ᾴᾶ-ᾼιῂ-ῄῆ-ῌῐ-ΐῖ-Ίῠ-Ῥῲ-ῴῶ-ῼⁱⁿₐ-ₜℂℇℊ-ℓℕ℘-ℝℤΩℨK-ℹℼ-ℿⅅ-ⅉⅎⅠ-ↈⰀ-Ⱞⰰ-ⱞⱠ-ⳤⳫ-ⳮⳲⳳⴀ-ⴥⴧⴭⴰ-ⵧⵯⶀ-ⶖⶠ-ⶦⶨ-ⶮⶰ-ⶶⶸ-ⶾⷀ-ⷆⷈ-ⷎⷐ-ⷖⷘ-ⷞ々-〇〡-〩〱-〵〸-〼ぁ-ゖ゛-ゟァ-ヺー-ヿㄅ-ㄭㄱ-ㆎㆠ-ㆺㇰ-ㇿ㐀-䶵一-鿕ꀀ-ꒌꓐ-ꓽꔀ-ꘌꘐ-ꘟꘪꘫꙀ-ꙮꙿ-ꚝꚠ-ꛯꜗ-ꜟꜢ-ꞈꞋ-ꞮꞰ-ꞷꟷ-ꠁꠃ-ꠅꠇ-ꠊꠌ-ꠢꡀ-ꡳꢂ-ꢳꣲ-ꣷꣻꣽꤊ-ꤥꤰ-ꥆꥠ-ꥼꦄ-ꦲꧏꧠ-ꧤꧦ-ꧯꧺ-ꧾꨀ-ꨨꩀ-ꩂꩄ-ꩋꩠ-ꩶꩺꩾ-ꪯꪱꪵꪶꪹ-ꪽꫀꫂꫛ-ꫝꫠ-ꫪꫲ-ꫴꬁ-ꬆꬉ-ꬎꬑ-ꬖꬠ-ꬦꬨ-ꬮꬰ-ꭚꭜ-ꭥꭰ-ꯢ가-힣ힰ-ퟆퟋ-ퟻ豈-舘並-龎ff-stﬓ-ﬗיִײַ-ﬨשׁ-זּטּ-לּמּנּסּףּפּצּ-ﮱﯓ-ﴽﵐ-ﶏﶒ-ﷇﷰ-ﷻﹰ-ﹴﹶ-ﻼA--zヲ-하-ᅦᅧ-ᅬᅭ-ᅲᅳ-ᅵ",
_ = "‌‍·̀-ͯ·҃-֑҇-ׇֽֿׁׂׅׄؐ-ًؚ-٩ٰۖ-ۜ۟-۪ۤۧۨ-ۭ۰-۹ܑܰ-݊ަ-ް߀-߉߫-߳ࠖ-࠙ࠛ-ࠣࠥ-ࠧࠩ-࡙࠭-࡛ࣔ-ࣣ࣡-ःऺ-़ा-ॏ॑-ॗॢॣ०-९ঁ-ঃ়া-ৄেৈো-্ৗৢৣ০-৯ਁ-ਃ਼ਾ-ੂੇੈੋ-੍ੑ੦-ੱੵઁ-ઃ઼ા-ૅે-ૉો-્ૢૣ૦-૯ଁ-ଃ଼ା-ୄେୈୋ-୍ୖୗୢୣ୦-୯ஂா-ூெ-ைொ-்ௗ௦-௯ఀ-ఃా-ౄె-ైొ-్ౕౖౢౣ౦-౯ಁ-ಃ಼ಾ-ೄೆ-ೈೊ-್ೕೖೢೣ೦-೯ഁ-ഃാ-ൄെ-ൈൊ-്ൗൢൣ൦-൯ංඃ්ා-ුූෘ-ෟ෦-෯ෲෳัิ-ฺ็-๎๐-๙ັິ-ູົຼ່-ໍ໐-໙༘༙༠-༩༹༵༷༾༿ཱ-྄྆྇ྍ-ྗྙ-ྼ࿆ါ-ှ၀-၉ၖ-ၙၞ-ၠၢ-ၤၧ-ၭၱ-ၴႂ-ႍႏ-ႝ፝-፟፩-፱ᜒ-᜔ᜲ-᜴ᝒᝓᝲᝳ឴-៓៝០-៩᠋-᠍᠐-᠙ᢩᤠ-ᤫᤰ-᤻᥆-᥏᧐-᧚ᨗ-ᨛᩕ-ᩞ᩠-᩿᩼-᪉᪐-᪙᪰-᪽ᬀ-ᬄ᬴-᭄᭐-᭙᭫-᭳ᮀ-ᮂᮡ-ᮭ᮰-᮹᯦-᯳ᰤ-᰷᱀-᱉᱐-᱙᳐-᳔᳒-᳨᳭ᳲ-᳴᳸᳹᷀-᷵᷻-᷿‿⁀⁔⃐-⃥⃜⃡-⃰⳯-⵿⳱ⷠ-〪ⷿ-゙゚〯꘠-꘩꙯ꙴ-꙽ꚞꚟ꛰꛱ꠂ꠆ꠋꠣ-ꠧꢀꢁꢴ-ꣅ꣐-꣙꣠-꣱꤀-꤉ꤦ-꤭ꥇ-꥓ꦀ-ꦃ꦳-꧀꧐-꧙ꧥ꧰-꧹ꨩ-ꨶꩃꩌꩍ꩐-꩙ꩻ-ꩽꪰꪲ-ꪴꪷꪸꪾ꪿꫁ꫫ-ꫯꫵ꫶ꯣ-ꯪ꯬꯭꯰-꯹ﬞ︀-️︠-︯︳︴﹍--_",
D = new RegExp("[" + M + "]"),
R = new RegExp("[" + M + _ + "]");M = _ = null;var O = [0, 11, 2, 25, 2, 18, 2, 1, 2, 14, 3, 13, 35, 122, 70, 52, 268, 28, 4, 48, 48, 31, 17, 26, 6, 37, 11, 29, 3, 35, 5, 7, 2, 4, 43, 157, 19, 35, 5, 35, 5, 39, 9, 51, 157, 310, 10, 21, 11, 7, 153, 5, 3, 0, 2, 43, 2, 1, 4, 0, 3, 22, 11, 22, 10, 30, 66, 18, 2, 1, 11, 21, 11, 25, 71, 55, 7, 1, 65, 0, 16, 3, 2, 2, 2, 26, 45, 28, 4, 28, 36, 7, 2, 27, 28, 53, 11, 21, 11, 18, 14, 17, 111, 72, 56, 50, 14, 50, 785, 52, 76, 44, 33, 24, 27, 35, 42, 34, 4, 0, 13, 47, 15, 3, 22, 0, 2, 0, 36, 17, 2, 24, 85, 6, 2, 0, 2, 3, 2, 14, 2, 9, 8, 46, 39, 7, 3, 1, 3, 21, 2, 6, 2, 1, 2, 4, 4, 0, 19, 0, 13, 4, 159, 52, 19, 3, 54, 47, 21, 1, 2, 0, 185, 46, 42, 3, 37, 47, 21, 0, 60, 42, 86, 25, 391, 63, 32, 0, 449, 56, 264, 8, 2, 36, 18, 0, 50, 29, 881, 921, 103, 110, 18, 195, 2749, 1070, 4050, 582, 8634, 568, 8, 30, 114, 29, 19, 47, 17, 3, 32, 20, 6, 18, 881, 68, 12, 0, 67, 12, 65, 0, 32, 6124, 20, 754, 9486, 1, 3071, 106, 6, 12, 4, 8, 8, 9, 5991, 84, 2, 70, 2, 1, 3, 0, 3, 1, 3, 3, 2, 11, 2, 0, 2, 6, 2, 64, 2, 3, 3, 7, 2, 6, 2, 27, 2, 3, 2, 4, 2, 0, 4, 6, 2, 339, 3, 24, 2, 24, 2, 30, 2, 24, 2, 30, 2, 24, 2, 30, 2, 24, 2, 30, 2, 24, 2, 7, 4149, 196, 60, 67, 1213, 3, 2, 26, 2, 1, 2, 0, 3, 0, 2, 9, 2, 3, 2, 0, 2, 0, 7, 0, 5, 0, 2, 0, 2, 0, 2, 2, 2, 1, 2, 0, 3, 0, 2, 0, 2, 0, 2, 0, 2, 0, 2, 1, 2, 0, 3, 3, 2, 6, 2, 3, 2, 3, 2, 0, 2, 9, 2, 16, 6, 2, 2, 4, 2, 16, 4421, 42710, 42, 4148, 12, 221, 3, 5761, 10591, 541],
D = "‌‍·̀-ͯ·҃-֑҇-ׇֽֿׁׂׅׄؐ-ًؚ-٩ٰۖ-ۜ۟-۪ۤۧۨ-ۭ۰-۹ܑܰ-݊ަ-ް߀-߉߫-߳ࠖ-࠙ࠛ-ࠣࠥ-ࠧࠩ-࡙࠭-࡛ࣔ-ࣣ࣡-ःऺ-़ा-ॏ॑-ॗॢॣ०-९ঁ-ঃ়া-ৄেৈো-্ৗৢৣ০-৯ਁ-ਃ਼ਾ-ੂੇੈੋ-੍ੑ੦-ੱੵઁ-ઃ઼ા-ૅે-ૉો-્ૢૣ૦-૯ଁ-ଃ଼ା-ୄେୈୋ-୍ୖୗୢୣ୦-୯ஂா-ூெ-ைொ-்ௗ௦-௯ఀ-ఃా-ౄె-ైొ-్ౕౖౢౣ౦-౯ಁ-ಃ಼ಾ-ೄೆ-ೈೊ-್ೕೖೢೣ೦-೯ഁ-ഃാ-ൄെ-ൈൊ-്ൗൢൣ൦-൯ංඃ්ා-ුූෘ-ෟ෦-෯ෲෳัิ-ฺ็-๎๐-๙ັິ-ູົຼ່-ໍ໐-໙༘༙༠-༩༹༵༷༾༿ཱ-྄྆྇ྍ-ྗྙ-ྼ࿆ါ-ှ၀-၉ၖ-ၙၞ-ၠၢ-ၤၧ-ၭၱ-ၴႂ-ႍႏ-ႝ፝-፟፩-፱ᜒ-᜔ᜲ-᜴ᝒᝓᝲᝳ឴-៓៝០-៩᠋-᠍᠐-᠙ᢩᤠ-ᤫᤰ-᤻᥆-᥏᧐-᧚ᨗ-ᨛᩕ-ᩞ᩠-᩿᩼-᪉᪐-᪙᪰-᪽ᬀ-ᬄ᬴-᭄᭐-᭙᭫-᭳ᮀ-ᮂᮡ-ᮭ᮰-᮹᯦-᯳ᰤ-᰷᱀-᱉᱐-᱙᳐-᳔᳒-᳨᳭ᳲ-᳴᳸᳹᷀-᷵᷻-᷿‿⁀⁔⃐-⃥⃜⃡-⃰⳯-⵿⳱ⷠ-〪ⷿ-゙゚〯꘠-꘩꙯ꙴ-꙽ꚞꚟ꛰꛱ꠂ꠆ꠋꠣ-ꠧꢀꢁꢴ-ꣅ꣐-꣙꣠-꣱꤀-꤉ꤦ-꤭ꥇ-꥓ꦀ-ꦃ꦳-꧀꧐-꧙ꧥ꧰-꧹ꨩ-ꨶꩃꩌꩍ꩐-꩙ꩻ-ꩽꪰꪲ-ꪴꪷꪸꪾ꪿꫁ꫫ-ꫯꫵ꫶ꯣ-ꯪ꯬꯭꯰-꯹ﬞ︀-️︠-︯︳︴﹍--_",
R = new RegExp("[" + M + "]"),
_ = new RegExp("[" + M + D + "]");M = D = null;var O = [0, 11, 2, 25, 2, 18, 2, 1, 2, 14, 3, 13, 35, 122, 70, 52, 268, 28, 4, 48, 48, 31, 17, 26, 6, 37, 11, 29, 3, 35, 5, 7, 2, 4, 43, 157, 19, 35, 5, 35, 5, 39, 9, 51, 157, 310, 10, 21, 11, 7, 153, 5, 3, 0, 2, 43, 2, 1, 4, 0, 3, 22, 11, 22, 10, 30, 66, 18, 2, 1, 11, 21, 11, 25, 71, 55, 7, 1, 65, 0, 16, 3, 2, 2, 2, 26, 45, 28, 4, 28, 36, 7, 2, 27, 28, 53, 11, 21, 11, 18, 14, 17, 111, 72, 56, 50, 14, 50, 785, 52, 76, 44, 33, 24, 27, 35, 42, 34, 4, 0, 13, 47, 15, 3, 22, 0, 2, 0, 36, 17, 2, 24, 85, 6, 2, 0, 2, 3, 2, 14, 2, 9, 8, 46, 39, 7, 3, 1, 3, 21, 2, 6, 2, 1, 2, 4, 4, 0, 19, 0, 13, 4, 159, 52, 19, 3, 54, 47, 21, 1, 2, 0, 185, 46, 42, 3, 37, 47, 21, 0, 60, 42, 86, 25, 391, 63, 32, 0, 449, 56, 264, 8, 2, 36, 18, 0, 50, 29, 881, 921, 103, 110, 18, 195, 2749, 1070, 4050, 582, 8634, 568, 8, 30, 114, 29, 19, 47, 17, 3, 32, 20, 6, 18, 881, 68, 12, 0, 67, 12, 65, 0, 32, 6124, 20, 754, 9486, 1, 3071, 106, 6, 12, 4, 8, 8, 9, 5991, 84, 2, 70, 2, 1, 3, 0, 3, 1, 3, 3, 2, 11, 2, 0, 2, 6, 2, 64, 2, 3, 3, 7, 2, 6, 2, 27, 2, 3, 2, 4, 2, 0, 4, 6, 2, 339, 3, 24, 2, 24, 2, 30, 2, 24, 2, 30, 2, 24, 2, 30, 2, 24, 2, 30, 2, 24, 2, 7, 4149, 196, 60, 67, 1213, 3, 2, 26, 2, 1, 2, 0, 3, 0, 2, 9, 2, 3, 2, 0, 2, 0, 7, 0, 5, 0, 2, 0, 2, 0, 2, 2, 2, 1, 2, 0, 3, 0, 2, 0, 2, 0, 2, 0, 2, 0, 2, 1, 2, 0, 3, 3, 2, 6, 2, 3, 2, 3, 2, 0, 2, 9, 2, 16, 6, 2, 2, 4, 2, 16, 4421, 42710, 42, 4148, 12, 221, 3, 5761, 10591, 541],
j = [509, 0, 227, 0, 150, 4, 294, 9, 1368, 2, 2, 1, 6, 3, 41, 2, 5, 0, 166, 1, 1306, 2, 54, 14, 32, 9, 16, 3, 46, 10, 54, 9, 7, 2, 37, 13, 2, 9, 52, 0, 13, 2, 49, 13, 10, 2, 4, 9, 83, 11, 7, 0, 161, 11, 6, 9, 7, 3, 57, 0, 2, 6, 3, 1, 3, 2, 10, 0, 11, 1, 3, 6, 4, 4, 193, 17, 10, 9, 87, 19, 13, 9, 214, 6, 3, 8, 28, 1, 83, 16, 16, 9, 82, 12, 9, 9, 84, 14, 5, 9, 423, 9, 838, 7, 2, 7, 17, 9, 57, 21, 2, 13, 19882, 9, 135, 4, 60, 6, 26, 9, 1016, 45, 17, 3, 19723, 1, 5319, 4, 4, 5, 9, 7, 3, 6, 31, 3, 149, 2, 1418, 49, 513, 54, 5, 49, 9, 0, 15, 0, 23, 4, 2, 14, 1361, 6, 2, 16, 3, 6, 2, 1, 2, 4, 2214, 6, 110, 6, 6, 9, 792487, 239],
F = /\r\n?|\n|\u2028|\u2029/,
B = new RegExp(F.source, "g"),
@ -150,7 +150,7 @@ var babylon = function () {
var t = this.state.context.pop();t === U.braceStatement && this.curContext() === U.functionExpression ? (this.state.context.pop(), this.state.exprAllowed = !1) : t === U.templateQuasi ? this.state.exprAllowed = !0 : this.state.exprAllowed = !t.isExpr;
} else this.state.exprAllowed = !0;
}, C.name.updateContext = function (t) {
this.state.exprAllowed = !1, t !== C._let && t !== C._const && t !== C._var || F.test(this.input.slice(this.state.end)) && (this.state.exprAllowed = !0);
"of" !== this.state.value || this.curContext() !== U.parenStatement ? (this.state.exprAllowed = !1, t !== C._let && t !== C._const && t !== C._var || F.test(this.input.slice(this.state.end)) && (this.state.exprAllowed = !0)) : this.state.exprAllowed = !t.beforeExpr;
}, C.braceL.updateContext = function (t) {
this.state.context.push(this.braceIsBlock(t) ? U.braceStatement : U.braceExpression), this.state.exprAllowed = !0;
}, C.dollarBraceL.updateContext = function () {
@ -170,8 +170,8 @@ var babylon = function () {
X = function (t) {
function e() {
return t.apply(this, arguments) || this;
}return A(e, t), e.prototype.raise = function (t, e) {
var s = h(this.input, t);e += " (" + s.line + ":" + s.column + ")";var i = new SyntaxError(e);throw i.pos = t, i.loc = s, i;
}return A(e, t), e.prototype.raise = function (t, e, s) {
var i = h(this.input, t);e += " (" + i.line + ":" + i.column + ")";var r = new SyntaxError(e);throw r.pos = t, r.loc = i, s && (r.missingPlugin = s), r;
}, e;
}(function (t) {
function e() {
@ -263,8 +263,14 @@ var babylon = function () {
this.isLineTerminator() || this.unexpected(null, C.semi);
}, e.prototype.expect = function (t, e) {
this.eat(t) || this.unexpected(e, t);
}, e.prototype.unexpected = function (t) {
var e = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : "Unexpected token";throw "string" != typeof e && (e = "Unexpected token, expected " + e.label), this.raise(null != t ? t : this.state.start, e);
}, e.prototype.unexpected = function (t, e) {
throw void 0 === e && (e = "Unexpected token"), "string" != typeof e && (e = "Unexpected token, expected " + e.label), this.raise(null != t ? t : this.state.start, e);
}, e.prototype.expectPlugin = function (t) {
if (!this.hasPlugin(t)) throw this.raise(this.state.start, "This experimental syntax requires enabling the parser plugin: '" + t + "'", [t]);
}, e.prototype.expectOnePlugin = function (t) {
var e = this;if (!t.some(function (t) {
return e.hasPlugin(t);
})) throw this.raise(this.state.start, "This experimental syntax requires enabling one of the following parser plugin(s): '" + t.join(", ") + "'", t);
}, e;
}(function (t) {
function e(e, s) {
@ -450,7 +456,7 @@ var babylon = function () {
}return t + this.input.slice(s, this.state.pos);
}, e.prototype.readWord = function () {
var t = this.readWord1(),
e = C.name;return !this.state.containsEsc && this.isKeyword(t) && (e = S[t]), this.finishToken(e, t);
e = C.name;return this.isKeyword(t) && (this.state.containsEsc && this.raise(this.state.pos, "Escape sequence in keyword " + t), e = S[t]), this.finishToken(e, t);
}, e.prototype.braceIsBlock = function (t) {
if (t === C.colon) {
var e = this.curContext();if (e === U.braceStatement || e === U.braceExpression) return !e.isExpr;
@ -520,7 +526,7 @@ var babylon = function () {
}}var a = this.state.value,
n = this.parseExpression();return s === C.name && "Identifier" === n.type && this.eat(C.colon) ? this.parseLabeledStatement(i, a, n) : this.parseExpressionStatement(i, n);
}, e.prototype.takeDecorators = function (t) {
var e = this.state.decoratorStack[this.state.decoratorStack.length - 1];e.length && (t.decorators = e, this.hasPlugin("decorators2") && this.resetStartLocationFromNode(t, e[0]), this.state.decoratorStack[this.state.decoratorStack.length - 1] = []);
var e = this.state.decoratorStack[this.state.decoratorStack.length - 1];e.length && (t.decorators = e, this.resetStartLocationFromNode(t, e[0]), this.state.decoratorStack[this.state.decoratorStack.length - 1] = []);
}, e.prototype.parseDecorators = function (t) {
this.hasPlugin("decorators2") && (t = !1);for (var e = this.state.decoratorStack[this.state.decoratorStack.length - 1]; this.match(C.at);) {
var s = this.parseDecorator();e.push(s);
@ -528,7 +534,7 @@ var babylon = function () {
if (t) return;this.raise(this.state.start, "Using the export keyword between a decorator and a class is not allowed. Please use `export @dec class` instead");
}this.match(C._class) || this.raise(this.state.start, "Leading decorators must be attached to a class declaration");
}, e.prototype.parseDecorator = function () {
this.hasPlugin("decorators") || this.hasPlugin("decorators2") || this.unexpected();var t = this.startNode();if (this.next(), this.hasPlugin("decorators2")) {
this.expectOnePlugin(["decorators", "decorators2"]);var t = this.startNode();if (this.next(), this.hasPlugin("decorators2")) {
for (var e = this.state.start, s = this.state.startLoc, i = this.parseIdentifier(!1); this.eat(C.dot);) {
var r = this.startNodeAt(e, s);r.object = i, r.property = this.parseIdentifier(!0), r.computed = !1, i = this.finishNode(r, "MemberExpression");
}if (this.eat(C.parenL)) {
@ -546,7 +552,7 @@ var babylon = function () {
}, e.prototype.parseDoStatement = function (t) {
return this.next(), this.state.labels.push(Z), t.body = this.parseStatement(!1), this.state.labels.pop(), this.expect(C._while), t.test = this.parseParenExpression(), this.eat(C.semi), this.finishNode(t, "DoWhileStatement");
}, e.prototype.parseForStatement = function (t) {
this.next(), this.state.labels.push(Z);var e = !1;if (this.hasPlugin("asyncGenerators") && this.state.inAsync && this.isContextual("await") && (e = !0, this.next()), this.expect(C.parenL), this.match(C.semi)) return e && this.unexpected(), this.parseFor(t, null);if (this.match(C._var) || this.match(C._let) || this.match(C._const)) {
this.next(), this.state.labels.push(Z);var e = !1;if (this.state.inAsync && this.isContextual("await") && (this.expectPlugin("asyncGenerators"), e = !0, this.next()), this.expect(C.parenL), this.match(C.semi)) return e && this.unexpected(), this.parseFor(t, null);if (this.match(C._var) || this.match(C._let) || this.match(C._const)) {
var s = this.startNode(),
i = this.state.type;return this.next(), this.parseVar(s, !0, i), this.finishNode(s, "VariableDeclaration"), !this.match(C._in) && !this.isContextual("of") || 1 !== s.declarations.length || s.declarations[0].init ? (e && this.unexpected(), this.parseFor(t, s)) : this.parseForIn(t, s, e);
}var r = { start: 0 },
@ -569,7 +575,7 @@ var babylon = function () {
return this.next(), F.test(this.input.slice(this.state.lastTokEnd, this.state.start)) && this.raise(this.state.lastTokEnd, "Illegal newline after throw"), t.argument = this.parseExpression(), this.semicolon(), this.finishNode(t, "ThrowStatement");
}, e.prototype.parseTryStatement = function (t) {
if (this.next(), t.block = this.parseBlock(), t.handler = null, this.match(C._catch)) {
var e = this.startNode();this.next(), this.match(C.parenL) || !this.hasPlugin("optionalCatchBinding") ? (this.expect(C.parenL), e.param = this.parseBindingAtom(), this.checkLVal(e.param, !0, Object.create(null), "catch clause"), this.expect(C.parenR)) : e.param = null, e.body = this.parseBlock(), t.handler = this.finishNode(e, "CatchClause");
var e = this.startNode();this.next(), this.match(C.parenL) ? (this.expect(C.parenL), e.param = this.parseBindingAtom(), this.checkLVal(e.param, !0, Object.create(null), "catch clause"), this.expect(C.parenR)) : (this.expectPlugin("optionalCatchBinding"), e.param = null), e.body = this.parseBlock(), t.handler = this.finishNode(e, "CatchClause");
}return t.guardedHandlers = $, t.finalizer = this.eat(C._finally) ? this.parseBlock() : null, t.handler || t.finalizer || this.raise(t.start, "Missing catch or finally clause"), this.finishNode(t, "TryStatement");
}, e.prototype.parseVarStatement = function (t, e) {
return this.next(), this.parseVar(t, !1, e), this.semicolon(), this.finishNode(t, "VariableDeclaration");
@ -588,7 +594,7 @@ var babylon = function () {
}n.name === e && this.raise(s.start, "Label '" + e + "' is already declared");
}for (var o = this.state.type.isLoop ? "loop" : this.match(C._switch) ? "switch" : null, h = this.state.labels.length - 1; h >= 0; h--) {
var p = this.state.labels[h];if (p.statementStart !== t.start) break;p.statementStart = this.state.start, p.kind = o;
}return this.state.labels.push({ name: e, kind: o, statementStart: this.state.start }), t.body = this.parseStatement(!0), this.state.labels.pop(), t.label = s, this.finishNode(t, "LabeledStatement");
}return this.state.labels.push({ name: e, kind: o, statementStart: this.state.start }), t.body = this.parseStatement(!0), ("ClassDeclaration" == t.body.type || "VariableDeclaration" == t.body.type && "var" !== t.body.kind || "FunctionDeclaration" == t.body.type && (this.state.strict || t.body.generator || t.body.async)) && this.raise(t.body.start, "Invalid labeled declaration"), this.state.labels.pop(), t.label = s, this.finishNode(t, "LabeledStatement");
}, e.prototype.parseExpressionStatement = function (t, e) {
return t.expression = e, this.semicolon(), this.finishNode(t, "ExpressionStatement");
}, e.prototype.parseBlock = function (t) {
@ -615,7 +621,7 @@ var babylon = function () {
}, e.prototype.parseVarHead = function (t) {
t.id = this.parseBindingAtom(), this.checkLVal(t.id, !0, void 0, "variable declaration");
}, e.prototype.parseFunction = function (t, e, s, i, r) {
var a = this.state.inMethod;return this.state.inMethod = !1, this.initFunction(t, i), this.match(C.star) && (t.async && !this.hasPlugin("asyncGenerators") ? this.unexpected() : (t.generator = !0, this.next())), !e || r || this.match(C.name) || this.match(C._yield) || this.unexpected(), (this.match(C.name) || this.match(C._yield)) && (t.id = this.parseBindingIdentifier()), this.parseFunctionParams(t), this.parseFunctionBodyAndFinish(t, e ? "FunctionDeclaration" : "FunctionExpression", s), this.state.inMethod = a, t;
var a = this.state.inMethod;return this.state.inMethod = !1, this.initFunction(t, i), this.match(C.star) && (t.async && this.expectPlugin("asyncGenerators"), t.generator = !0, this.next()), !e || r || this.match(C.name) || this.match(C._yield) || this.unexpected(), (this.match(C.name) || this.match(C._yield)) && (t.id = this.parseBindingIdentifier()), this.parseFunctionParams(t), this.parseFunctionBodyAndFinish(t, e ? "FunctionDeclaration" : "FunctionExpression", s), this.state.inMethod = a, t;
}, e.prototype.parseFunctionParams = function (t) {
this.expect(C.parenL), t.params = this.parseBindingList(C.parenR);
}, e.prototype.parseClass = function (t, e, s) {
@ -631,7 +637,7 @@ var babylon = function () {
i = [],
r = this.startNode();for (r.body = [], this.expect(C.braceL); !this.eat(C.braceR);) {
if (this.eat(C.semi)) i.length > 0 && this.raise(this.state.lastTokEnd, "Decorators must not be followed by a semicolon");else if (this.match(C.at)) i.push(this.parseDecorator());else {
var a = this.startNode();i.length && (a.decorators = i, this.hasPlugin("decorators2") && this.resetStartLocationFromNode(a, i[0]), i = []), this.parseClassMember(r, a, s), this.hasPlugin("decorators2") && "method" != a.kind && a.decorators && a.decorators.length > 0 && this.raise(a.start, "Stage 2 decorators may only be used with a class or a class method");
var a = this.startNode();i.length && (a.decorators = i, this.resetStartLocationFromNode(a, i[0]), i = []), this.parseClassMember(r, a, s), this.hasPlugin("decorators2") && "method" != a.kind && a.decorators && a.decorators.length > 0 && this.raise(a.start, "Stage 2 decorators may only be used with a class or a class method");
}
}i.length && this.raise(this.state.start, "You have trailing decorators with no method"), t.body = this.finishNode(r, "ClassBody"), this.state.classLevel--, this.state.strict = e;
}, e.prototype.parseClassMember = function (t, e, s) {
@ -640,8 +646,8 @@ var babylon = function () {
a = i,
n = !1;if (this.match(C.name) && "static" === this.state.value) {
var o = this.parseIdentifier(!0);if (this.isClassMethod()) return r.kind = "method", r.computed = !1, r.key = o, r.static = !1, void this.parseClassMethod(t, r, !1, !1, !1);if (this.isClassProperty()) return a.computed = !1, a.key = o, a.static = !1, void t.body.push(this.parseClassProperty(a));n = !0;
}if (this.hasPlugin("classPrivateProperties") && this.match(C.hash)) {
this.next();var h = i;return h.key = this.parseIdentifier(!0), h.static = n, void t.body.push(this.parsePrivateClassProperty(h));
}if (this.match(C.hash)) {
this.expectPlugin("classPrivateProperties"), this.next();var h = i;return h.key = this.parseIdentifier(!0), h.static = n, void t.body.push(this.parsePrivateClassProperty(h));
}this.parseClassMemberWithIsStatic(t, e, s, n);
}, e.prototype.parseClassMemberWithIsStatic = function (t, e, s, i) {
var r = e,
@ -651,7 +657,7 @@ var babylon = function () {
p = this.parseClassPropertyName(a);if (this.parsePostMemberNameModifiers(a), this.isClassMethod()) {
var c = this.isNonstaticConstructor(n);n.kind = c ? "constructor" : "method", c && (n.decorators && this.raise(n.start, "You can't attach decorators to a class constructor"), s.hadConstructor && !this.hasPlugin("typescript") && this.raise(p.start, "Duplicate constructor in the same class"), s.hadConstructor = !0), this.parseClassMethod(t, n, !1, !1, c);
} else if (this.isClassProperty()) this.pushClassProperty(t, o);else if (h && "async" === p.name && !this.isLineTerminator()) {
var l = this.hasPlugin("asyncGenerators") && this.eat(C.star);n.kind = "method", this.parsePropertyName(n), this.isNonstaticConstructor(n) && this.raise(n.key.start, "Constructor can't be an async function"), this.parseClassMethod(t, n, l, !0, !1);
var l = !1;this.match(C.star) && (this.expectPlugin("asyncGenerators"), this.next(), l = !0), n.kind = "method", this.parsePropertyName(n), this.isNonstaticConstructor(n) && this.raise(n.key.start, "Constructor can't be an async function"), this.parseClassMethod(t, n, l, !0, !1);
} else !h || "get" !== p.name && "set" !== p.name || this.isLineTerminator() && this.match(C.star) ? this.isLineTerminator() ? (this.isNonstaticConstructor(o) && this.raise(o.key.start, "Classes may not have a non-static field named 'constructor'"), t.body.push(this.parseClassProperty(o))) : this.unexpected() : (n.kind = p.name, this.parsePropertyName(n), this.isNonstaticConstructor(n) && this.raise(n.key.start, "Constructor can't have get/set modifier"), this.parseClassMethod(t, n, !1, !1, !1), this.checkGetterSetterParamCount(n));
}, e.prototype.parseClassPropertyName = function (t) {
var e = this.parsePropertyName(t);return t.computed || !t.static || "prototype" !== t.key.name && "prototype" !== t.key.value || this.raise(t.key.start, "Classes may not have static property named prototype"), e;
@ -660,8 +666,7 @@ var babylon = function () {
}, e.prototype.parsePostMemberNameModifiers = function (t) {}, e.prototype.parseAccessModifier = function () {}, e.prototype.parsePrivateClassProperty = function (t) {
return this.state.inClassProperty = !0, this.match(C.eq) ? (this.next(), t.value = this.parseMaybeAssign()) : t.value = null, this.semicolon(), this.state.inClassProperty = !1, this.finishNode(t, "ClassPrivateProperty");
}, e.prototype.parseClassProperty = function (t) {
var e = this.hasPlugin("classProperties") || this.hasPlugin("typescript"),
s = "You can only use Class Properties when the 'classProperties' plugin is enabled.";return t.typeAnnotation || e || this.raise(t.start, s), this.state.inClassProperty = !0, this.match(C.eq) ? (e || this.raise(this.state.start, s), this.next(), t.value = this.parseMaybeAssign()) : t.value = null, this.semicolon(), this.state.inClassProperty = !1, this.finishNode(t, "ClassProperty");
return t.typeAnnotation || this.expectPlugin("classProperties"), this.state.inClassProperty = !0, this.match(C.eq) ? (this.expectPlugin("classProperties"), this.next(), t.value = this.parseMaybeAssign()) : t.value = null, this.semicolon(), this.state.inClassProperty = !1, this.finishNode(t, "ClassProperty");
}, e.prototype.parseClassMethod = function (t, e, s, i, r) {
t.body.push(this.parseMethod(e, s, i, r, "ClassMethod"));
}, e.prototype.parseClassId = function (t, e, s) {
@ -786,7 +791,8 @@ var babylon = function () {
}, e.prototype.parseMaybeConditional = function (t, e, s) {
var i = this.state.start,
r = this.state.startLoc,
a = this.parseExprOps(t, e);return e && e.start ? a : this.parseConditional(a, t, i, r, s);
a = this.state.potentialArrowAt,
n = this.parseExprOps(t, e);return "ArrowFunctionExpression" === n.type && n.start === a ? n : e && e.start ? n : this.parseConditional(n, t, i, r, s);
}, e.prototype.parseConditional = function (t, e, s, i, r) {
if (this.eat(C.question)) {
var a = this.startNodeAt(s, i);return a.test = t, a.consequent = this.parseMaybeAssign(), this.expect(C.colon), a.alternate = this.parseMaybeAssign(e), this.finishNode(a, "ConditionalExpression");
@ -794,7 +800,8 @@ var babylon = function () {
}, e.prototype.parseExprOps = function (t, e) {
var s = this.state.start,
i = this.state.startLoc,
r = this.parseMaybeUnary(e);return e && e.start ? r : this.parseExprOp(r, s, i, -1, t);
r = this.state.potentialArrowAt,
a = this.parseMaybeUnary(e);return "ArrowFunctionExpression" === a.type && a.start === r ? a : e && e.start ? a : this.parseExprOp(a, s, i, -1, t);
}, e.prototype.parseExprOp = function (t, e, s, i, r) {
var a = this.state.type.binop;if (!(null == a || r && this.match(C._in)) && a > i) {
var n = this.startNodeAt(e, s);n.left = t, n.operator = this.state.value, "**" !== n.operator || "UnaryExpression" !== t.type || !t.extra || t.extra.parenthesizedArgument || t.extra.parenthesized || this.raise(t.argument.start, "Illegal expression. Wrap left hand side or entire exponentiation in parentheses.");var o = this.state.type;this.next();var h = this.state.start,
@ -804,7 +811,7 @@ var babylon = function () {
if (this.state.type.prefix) {
var e = this.startNode(),
s = this.match(C.incDec);e.operator = this.state.value, e.prefix = !0, this.next();var i = this.state.type;if (e.argument = this.parseMaybeUnary(), this.addExtra(e, "parenthesizedArgument", !(i !== C.parenL || e.argument.extra && e.argument.extra.parenthesized)), t && t.start && this.unexpected(t.start), s) this.checkLVal(e.argument, void 0, void 0, "prefix operation");else if (this.state.strict && "delete" === e.operator) {
var r = e.argument;"Identifier" === r.type ? this.raise(e.start, "Deleting local variable in strict mode") : this.hasPlugin("classPrivateProperties") && ("PrivateName" === r.type || "MemberExpression" === r.type && "PrivateName" === r.property.type) && this.raise(e.start, "Deleting a private field is not allowed");
var r = e.argument;"Identifier" === r.type ? this.raise(e.start, "Deleting local variable in strict mode") : this.hasPlugin("classPrivateProperties") && "MemberExpression" === r.type && "PrivateName" === r.property.type && this.raise(e.start, "Deleting a private field is not allowed");
}return this.finishNode(e, s ? "UpdateExpression" : "UnaryExpression");
}var a = this.state.start,
n = this.state.startLoc,
@ -824,7 +831,7 @@ var babylon = function () {
if (!i && this.eat(C.doubleColon)) {
var a = this.startNodeAt(e, s);return a.object = t, a.callee = this.parseNoCallExpr(), r.stop = !0, this.parseSubscripts(this.finishNode(a, "BindExpression"), e, s, i);
}if (this.match(C.questionDot)) {
if (this.hasPlugin("optionalChaining") || this.raise(e, "You can only use optional-chaining when the 'optionalChaining' plugin is enabled."), i && this.lookahead().type == C.parenL) return r.stop = !0, t;this.next();var n = this.startNodeAt(e, s);if (this.eat(C.bracketL)) return n.object = t, n.property = this.parseExpression(), n.computed = !0, n.optional = !0, this.expect(C.bracketR), this.finishNode(n, "MemberExpression");if (this.eat(C.parenL)) {
if (this.expectPlugin("optionalChaining"), i && this.lookahead().type == C.parenL) return r.stop = !0, t;this.next();var n = this.startNodeAt(e, s);if (this.eat(C.bracketL)) return n.object = t, n.property = this.parseExpression(), n.computed = !0, n.optional = !0, this.expect(C.bracketR), this.finishNode(n, "MemberExpression");if (this.eat(C.parenL)) {
var o = this.atPossibleAsync(t);return n.callee = t, n.arguments = this.parseCallExpressionArguments(C.parenR, o), n.optional = !0, this.finishNode(n, "CallExpression");
}return n.object = t, n.property = this.parseIdentifier(!0), n.computed = !1, n.optional = !0, this.finishNode(n, "MemberExpression");
}if (this.eat(C.dot)) {
@ -832,9 +839,9 @@ var babylon = function () {
}if (this.eat(C.bracketL)) {
var p = this.startNodeAt(e, s);return p.object = t, p.property = this.parseExpression(), p.computed = !0, this.expect(C.bracketR), this.finishNode(p, "MemberExpression");
}if (!i && this.match(C.parenL)) {
var c = this.atPossibleAsync(t);this.next();var l = this.startNodeAt(e, s);return l.callee = t, l.arguments = this.parseCallExpressionArguments(C.parenR, c), this.finishCallExpression(l), c && this.shouldParseAsyncArrow() ? (r.stop = !0, this.parseAsyncArrowFromCallExpression(this.startNodeAt(e, s), l)) : (this.toReferencedList(l.arguments), l);
var c = this.atPossibleAsync(t);this.next();var l = this.startNodeAt(e, s);l.callee = t;var u = { start: -1 };return l.arguments = this.parseCallExpressionArguments(C.parenR, c, u), this.finishCallExpression(l), c && this.shouldParseAsyncArrow() ? (r.stop = !0, u.start > -1 && this.raise(u.start, "A trailing comma is not permitted after the rest element"), this.parseAsyncArrowFromCallExpression(this.startNodeAt(e, s), l)) : (this.toReferencedList(l.arguments), l);
}if (this.match(C.backQuote)) {
var u = this.startNodeAt(e, s);return u.tag = t, u.quasi = this.parseTemplate(!0), this.finishNode(u, "TaggedTemplateExpression");
var d = this.startNodeAt(e, s);return d.tag = t, d.quasi = this.parseTemplate(!0), this.finishNode(d, "TaggedTemplateExpression");
}return r.stop = !0, t;
}, e.prototype.atPossibleAsync = function (t) {
return this.state.potentialArrowAt === t.start && "Identifier" === t.type && "async" === t.name && !this.canInsertSemicolon();
@ -842,10 +849,10 @@ var babylon = function () {
if ("Import" === t.callee.type) {
1 !== t.arguments.length && this.raise(t.start, "import() requires exactly one argument");var e = t.arguments[0];e && "SpreadElement" === e.type && this.raise(e.start, "... is not allowed in import()");
}return this.finishNode(t, "CallExpression");
}, e.prototype.parseCallExpressionArguments = function (t, e) {
for (var s = [], i = void 0, r = !0; !this.eat(t);) {
if (r) r = !1;else if (this.expect(C.comma), this.eat(t)) break;this.match(C.parenL) && !i && (i = this.state.start), s.push(this.parseExprListItem(!1, e ? { start: 0 } : void 0, e ? { start: 0 } : void 0));
}return e && i && this.shouldParseAsyncArrow() && this.unexpected(), s;
}, e.prototype.parseCallExpressionArguments = function (t, e, s) {
for (var i = [], r = void 0, a = !0; !this.eat(t);) {
if (a) a = !1;else if (this.expect(C.comma), this.eat(t)) break;this.match(C.parenL) && !r && (r = this.state.start), i.push(this.parseExprListItem(!1, e ? { start: 0 } : void 0, e ? { start: 0 } : void 0, e ? s : void 0));
}return e && r && this.shouldParseAsyncArrow() && this.unexpected(), i;
}, e.prototype.shouldParseAsyncArrow = function () {
return this.match(C.arrow);
}, e.prototype.parseAsyncArrowFromCallExpression = function (t, e) {
@ -857,7 +864,7 @@ var babylon = function () {
var e = this.state.potentialArrowAt === this.state.start,
s = void 0;switch (this.state.type) {case C._super:
return this.state.inMethod || this.state.inClassProperty || this.options.allowSuperOutsideMethod || this.raise(this.state.start, "'super' outside of function or class"), s = this.startNode(), this.next(), this.match(C.parenL) || this.match(C.bracketL) || this.match(C.dot) || this.unexpected(), this.match(C.parenL) && "constructor" !== this.state.inMethod && !this.options.allowSuperOutsideMethod && this.raise(s.start, "super() is only valid inside a class constructor. Make sure the method name is spelled exactly as 'constructor'."), this.finishNode(s, "Super");case C._import:
return this.hasPlugin("importMeta") && this.lookahead().type === C.dot ? this.parseImportMetaProperty() : (this.hasPlugin("dynamicImport") || this.unexpected(), s = this.startNode(), this.next(), this.match(C.parenL) || this.unexpected(null, C.parenL), this.finishNode(s, "Import"));case C._this:
return this.lookahead().type === C.dot ? this.parseImportMetaProperty() : (this.expectPlugin("dynamicImport"), s = this.startNode(), this.next(), this.match(C.parenL) || this.unexpected(null, C.parenL), this.finishNode(s, "Import"));case C._this:
return s = this.startNode(), this.next(), this.finishNode(s, "ThisExpression");case C._yield:
this.state.inGenerator && this.unexpected();case C.name:
s = this.startNode();var i = "await" === this.state.value && this.state.inAsync,
@ -869,10 +876,8 @@ var babylon = function () {
var n = [this.parseIdentifier()];return this.expect(C.arrow), this.parseArrowExpression(s, n, !0);
}
}return e && !this.canInsertSemicolon() && this.eat(C.arrow) ? this.parseArrowExpression(s, [a]) : a;case C._do:
if (this.hasPlugin("doExpressions")) {
var o = this.startNode();this.next();var h = this.state.inFunction,
p = this.state.labels;return this.state.labels = [], this.state.inFunction = !1, o.body = this.parseBlock(!1), this.state.inFunction = h, this.state.labels = p, this.finishNode(o, "DoExpression");
}case C.regexp:
this.expectPlugin("doExpressions");var o = this.startNode();this.next();var h = this.state.inFunction,
p = this.state.labels;return this.state.labels = [], this.state.inFunction = !1, o.body = this.parseBlock(!1), this.state.inFunction = h, this.state.labels = p, this.finishNode(o, "DoExpression");case C.regexp:
var c = this.state.value;return s = this.parseLiteral(c.value, "RegExpLiteral"), s.pattern = c.pattern, s.flags = c.flags, s;case C.num:
return this.parseLiteral(this.state.value, "NumericLiteral");case C.bigint:
return this.parseLiteral(this.state.value, "BigIntLiteral");case C.string:
@ -884,8 +889,7 @@ var babylon = function () {
return this.parseObj(!1, t);case C._function:
return this.parseFunctionExpression();case C.at:
this.parseDecorators();case C._class:
return s = this.startNode(), this.takeDecorators(s), this.parseClass(s, !1);case C.hash:
if (this.hasPlugin("classPrivateProperties")) return this.parseMaybePrivateName();throw this.unexpected();case C._new:
return s = this.startNode(), this.takeDecorators(s), this.parseClass(s, !1);case C._new:
return this.parseNew();case C.backQuote:
return this.parseTemplate(!1);case C.doubleColon:
s = this.startNode(), this.next(), s.object = null;var l = s.callee = this.parseNoCallExpr();if ("MemberExpression" === l.type) return this.finishNode(s, "BindExpression");throw this.raise(l.start, "Binding should be performed on object property.");default:
@ -894,16 +898,16 @@ var babylon = function () {
var t = this.startNode();return t.value = this.match(C._true), this.next(), this.finishNode(t, "BooleanLiteral");
}, e.prototype.parseMaybePrivateName = function () {
if (this.eat(C.hash)) {
var t = this.startNode();return t.name = this.parseIdentifier(!0), this.finishNode(t, "PrivateName");
var t = this.startNode();return t.id = this.parseIdentifier(!0), this.finishNode(t, "PrivateName");
}return this.parseIdentifier(!0);
}, e.prototype.parseFunctionExpression = function () {
var t = this.startNode(),
e = this.parseIdentifier(!0);return this.state.inGenerator && this.hasPlugin("functionSent") && this.eat(C.dot) ? this.parseMetaProperty(t, e, "sent") : this.parseFunction(t, !1);
e = this.parseIdentifier(!0);return this.state.inGenerator && this.eat(C.dot) ? this.parseMetaProperty(t, e, "sent") : this.parseFunction(t, !1);
}, e.prototype.parseMetaProperty = function (t, e, s) {
return t.meta = e, t.property = this.parseIdentifier(!0), t.property.name !== s && this.raise(t.property.start, "The only valid meta property for " + e.name + " is " + e.name + "." + s), this.finishNode(t, "MetaProperty");
return t.meta = e, "function" === e.name && "sent" === s && (this.isContextual(s) ? this.expectPlugin("functionSent") : this.hasPlugin("functionSent") || this.unexpected()), t.property = this.parseIdentifier(!0), t.property.name !== s && this.raise(t.property.start, "The only valid meta property for " + e.name + " is " + e.name + "." + s), this.finishNode(t, "MetaProperty");
}, e.prototype.parseImportMetaProperty = function () {
var t = this.startNode(),
e = this.parseIdentifier(!0);return this.expect(C.dot), this.inModule || this.raise(e.start, "import.meta may appear only with 'sourceType: \"module\"'"), this.parseMetaProperty(t, e, "meta");
e = this.parseIdentifier(!0);return this.expect(C.dot), "import" === e.name && (this.isContextual("meta") ? this.expectPlugin("importMeta") : this.hasPlugin("importMeta") || this.raise(e.start, "Dynamic imports require a parameter: import('a.js').then")), this.inModule || this.raise(e.start, "import.meta may appear only with 'sourceType: \"module\"'"), this.parseMetaProperty(t, e, "meta");
}, e.prototype.parseLiteral = function (t, e, s, i) {
s = s || this.state.start, i = i || this.state.startLoc;var r = this.startNodeAt(s, i);return this.addExtra(r, "rawValue", t), this.addExtra(r, "raw", this.input.slice(s, this.state.end)), r.value = t, this.next(), this.finishNode(r, e);
}, e.prototype.parseParenExpression = function () {
@ -916,7 +920,7 @@ var babylon = function () {
l = this.state.start;break;
}if (this.match(C.ellipsis)) {
var u = this.state.start,
d = this.state.startLoc;c = this.state.start, n.push(this.parseParenItem(this.parseRest(), u, d));break;
d = this.state.startLoc;c = this.state.start, n.push(this.parseParenItem(this.parseRest(), u, d)), this.match(C.comma) && this.lookahead().type === C.parenR && this.raise(this.state.start, "A trailing comma is not permitted after the rest element");break;
}n.push(this.parseMaybeAssign(!1, o, this.parseParenItem, h));
}var f = this.state.start,
y = this.state.startLoc;this.expect(C.parenR);var m = this.startNodeAt(e, s);if (t && this.shouldParseArrow() && (m = this.parseArrow(m))) {
@ -956,14 +960,14 @@ var babylon = function () {
h = !1,
p = !1,
c = void 0,
l = void 0;if (s.length && (o.decorators = s, s = []), this.hasPlugin("objectRestSpread") && this.match(C.ellipsis)) {
if (o = this.parseSpread(t ? { start: 0 } : void 0), o.type = t ? "RestElement" : "SpreadElement", t && this.toAssignable(o.argument, !0, "object pattern"), a.properties.push(o), !t) continue;var u = this.state.start;if (null !== n) this.unexpected(n, "Cannot have multiple rest elements when destructuring");else {
l = void 0;if (s.length && (o.decorators = s, s = []), this.match(C.ellipsis)) {
if (this.expectPlugin("objectRestSpread"), o = this.parseSpread(t ? { start: 0 } : void 0), t && this.toAssignable(o, !0, "object pattern"), a.properties.push(o), !t) continue;var u = this.state.start;if (null !== n) this.unexpected(n, "Cannot have multiple rest elements when destructuring");else {
if (this.eat(C.braceR)) break;if (!this.match(C.comma) || this.lookahead().type !== C.braceR) {
n = u;continue;
}this.unexpected(u, "A trailing comma is not permitted after the rest element");
}
}if (o.method = !1, (t || e) && (c = this.state.start, l = this.state.startLoc), t || (h = this.eat(C.star)), !t && this.isContextual("async")) {
h && this.unexpected();var d = this.parseIdentifier();this.match(C.colon) || this.match(C.parenL) || this.match(C.braceR) || this.match(C.eq) || this.match(C.comma) ? (o.key = d, o.computed = !1) : (p = !0, this.hasPlugin("asyncGenerators") && (h = this.eat(C.star)), this.parsePropertyName(o));
h && this.unexpected();var d = this.parseIdentifier();this.match(C.colon) || this.match(C.parenL) || this.match(C.braceR) || this.match(C.eq) || this.match(C.comma) ? (o.key = d, o.computed = !1) : (p = !0, this.match(C.star) && (this.expectPlugin("asyncGenerators"), this.next(), h = !0), this.parsePropertyName(o));
} else this.parsePropertyName(o);this.parseObjPropValue(o, c, l, h, p, t, e), this.checkPropClash(o, i), o.shorthand && this.addExtra(o, "shorthand", !0), a.properties.push(o);
}return null !== n && this.unexpected(n, "The rest element has to be the last element when destructuring"), s.length && this.raise(this.state.start, "You have trailing decorators with no property"), this.finishNode(a, t ? "ObjectPattern" : "ObjectExpression");
}, e.prototype.isGetterOrSetterMethod = function (t, e) {
@ -1019,8 +1023,8 @@ var babylon = function () {
for (var i = [], r = !0; !this.eat(t);) {
if (r) r = !1;else if (this.expect(C.comma), this.eat(t)) break;i.push(this.parseExprListItem(e, s));
}return i;
}, e.prototype.parseExprListItem = function (t, e, s) {
return t && this.match(C.comma) ? null : this.match(C.ellipsis) ? this.parseSpread(e) : this.parseMaybeAssign(!1, e, this.parseParenItem, s);
}, e.prototype.parseExprListItem = function (t, e, s, i) {
var r = void 0;return t && this.match(C.comma) ? r = null : this.match(C.ellipsis) ? (r = this.parseSpread(e), i && this.match(C.comma) && (i.start = this.state.start)) : r = this.parseMaybeAssign(!1, e, this.parseParenItem, s), r;
}, e.prototype.parseIdentifier = function (t) {
var e = this.startNode(),
s = this.parseIdentifierName(e.start, t);return e.name = s, e.loc.identifierName = s, this.finishNode(e, "Identifier");
@ -1039,21 +1043,27 @@ var babylon = function () {
function e() {
return t.apply(this, arguments) || this;
}return A(e, t), e.prototype.toAssignable = function (t, e, s) {
if (t) switch (t.type) {case "Identifier":case "PrivateName":case "ObjectPattern":case "ArrayPattern":case "AssignmentPattern":
if (t) switch (t.type) {case "Identifier":case "ObjectPattern":case "ArrayPattern":case "AssignmentPattern":
break;case "ObjectExpression":
t.type = "ObjectPattern";for (var i = t.properties, r = Array.isArray(i), a = 0, i = r ? i : i[Symbol.iterator]();;) {
t.type = "ObjectPattern";for (var i = t.properties.entries(), r = Array.isArray(i), a = 0, i = r ? i : i[Symbol.iterator]();;) {
var n;if (r) {
if (a >= i.length) break;n = i[a++];
} else {
if ((a = i.next()).done) break;n = a.value;
}var o = n;"ObjectMethod" === o.type ? "get" === o.kind || "set" === o.kind ? this.raise(o.key.start, "Object pattern can't contain getter or setter") : this.raise(o.key.start, "Object pattern can't contain methods") : this.toAssignable(o, e, "object destructuring pattern");
}var o = n,
h = o[0],
p = o[1];this.toAssignableObjectExpressionProp(p, e, h === t.properties.length - 1);
}break;case "ObjectProperty":
this.toAssignable(t.value, e, s);break;case "SpreadElement":
t.type = "RestElement";var h = t.argument;this.toAssignable(h, e, s);break;case "ArrayExpression":
this.checkToRestConversion(t), t.type = "RestElement";var c = t.argument;this.toAssignable(c, e, s);break;case "ArrayExpression":
t.type = "ArrayPattern", this.toAssignableList(t.elements, e, s);break;case "AssignmentExpression":
"=" === t.operator ? (t.type = "AssignmentPattern", delete t.operator) : this.raise(t.left.end, "Only '=' operator can be used for specifying default value.");break;case "MemberExpression":
if (!e) break;default:
var p = "Invalid left-hand side" + (s ? " in " + s : "expression");this.raise(t.start, p);}return t;
var l = "Invalid left-hand side" + (s ? " in " + s : "expression");this.raise(t.start, l);}return t;
}, e.prototype.toAssignableObjectExpressionProp = function (t, e, s) {
if ("ObjectMethod" === t.type) {
var i = "get" === t.kind || "set" === t.kind ? "Object pattern can't contain getter or setter" : "Object pattern can't contain methods";this.raise(t.key.start, i);
} else "SpreadElement" !== t.type || s ? this.toAssignable(t, e, "object destructuring pattern") : this.raise(t.start, "The rest element has to be the last element when destructuring");
}, e.prototype.toAssignableList = function (t, e, s) {
var i = t.length;if (i) {
var r = t[i - 1];if (r && "RestElement" === r.type) --i;else if (r && "SpreadElement" === r.type) {
@ -1095,7 +1105,7 @@ var babylon = function () {
}, e.prototype.parseMaybeDefault = function (t, e, s) {
if (e = e || this.state.startLoc, t = t || this.state.start, s = s || this.parseBindingAtom(), !this.eat(C.eq)) return s;var i = this.startNodeAt(t, e);return i.left = s, i.right = this.parseMaybeAssign(), this.finishNode(i, "AssignmentPattern");
}, e.prototype.checkLVal = function (t, e, s, i) {
switch (t.type) {case "PrivateName":case "Identifier":
switch (t.type) {case "Identifier":
if (this.checkReservedWord(t.name, t.start, !1, !0), s) {
var r = "_" + t.name;s[r] ? this.raise(t.start, "Argument name clash in strict mode") : s[r] = !0;
}break;case "MemberExpression":
@ -1117,6 +1127,8 @@ var babylon = function () {
this.checkLVal(t.left, e, s, "assignment pattern");break;case "RestElement":
this.checkLVal(t.argument, e, s, "rest element");break;default:
var y = (e ? "Binding invalid" : "Invalid") + " left-hand side" + (i ? " in " + i : "expression");this.raise(t.start, y);}
}, e.prototype.checkToRestConversion = function (t) {
-1 === ["Identifier", "MemberExpression"].indexOf(t.argument.type) && this.raise(t.argument.start, "Invalid rest operator's argument");
}, e;
}(function (t) {
function e() {
@ -1203,15 +1215,9 @@ var babylon = function () {
}, e.prototype.parseObjectProperty = function (e, s, i, r, a) {
var n = t.prototype.parseObjectProperty.call(this, e, s, i, r, a);return n && (n.kind = "init", n.type = "Property"), n;
}, e.prototype.toAssignable = function (e, s, i) {
if (u(e)) return this.toAssignable(e.value, s, i), e;if ("ObjectExpression" === e.type) {
e.type = "ObjectPattern";for (var r = e.properties, a = Array.isArray(r), n = 0, r = a ? r : r[Symbol.iterator]();;) {
var o;if (a) {
if (n >= r.length) break;o = r[n++];
} else {
if ((n = r.next()).done) break;o = n.value;
}var h = o;"get" === h.kind || "set" === h.kind ? this.raise(h.key.start, "Object pattern can't contain getter or setter") : h.method ? this.raise(h.key.start, "Object pattern can't contain methods") : this.toAssignable(h, s, "object destructuring pattern");
}return e;
}return t.prototype.toAssignable.call(this, e, s, i);
return u(e) ? (this.toAssignable(e.value, s, i), e) : t.prototype.toAssignable.call(this, e, s, i);
}, e.prototype.toAssignableObjectExpressionProp = function (e, s, i) {
"get" === e.kind || "set" === e.kind ? this.raise(e.key.start, "Object pattern can't contain getter or setter") : e.method ? this.raise(e.key.start, "Object pattern can't contain methods") : t.prototype.toAssignableObjectExpressionProp.call(this, e, s, i);
}, e;
}(t);
},
@ -1344,8 +1350,8 @@ var babylon = function () {
r = this.lookahead();return r.type === C.colon || r.type === C.question ? (t = this.parseIdentifier(), this.eat(C.question) && (e = !0), s = this.flowParseTypeInitialiser()) : s = this.flowParseType(), i.name = t, i.optional = e, i.typeAnnotation = s, this.finishNode(i, "FunctionTypeParam");
}, e.prototype.reinterpretTypeAsFunctionTypeParam = function (t) {
var e = this.startNodeAt(t.start, t.loc.start);return e.name = null, e.optional = !1, e.typeAnnotation = t, this.finishNode(e, "FunctionTypeParam");
}, e.prototype.flowParseFunctionTypeParams = function () {
for (var t = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : [], e = null; !this.match(C.parenR) && !this.match(C.ellipsis);) {
}, e.prototype.flowParseFunctionTypeParams = function (t) {
void 0 === t && (t = []);for (var e = null; !this.match(C.parenR) && !this.match(C.ellipsis);) {
t.push(this.flowParseFunctionTypeParam()), this.match(C.parenR) || this.expect(C.comma);
}return this.eat(C.ellipsis) && (e = this.flowParseFunctionTypeParam()), { params: t, rest: e };
}, e.prototype.flowIdentToTypeAnnotation = function (t, e, s, i) {
@ -1380,8 +1386,8 @@ var babylon = function () {
return s.value = this.match(C._true), this.next(), this.finishNode(s, "BooleanLiteralTypeAnnotation");case C.plusMin:
if ("-" === this.state.value) return this.next(), this.match(C.num) || this.unexpected(null, "Unexpected token, expected number"), this.parseLiteral(-this.state.value, "NumberLiteralTypeAnnotation", s.start, s.loc.start);this.unexpected();case C.num:
return this.parseLiteral(this.state.value, "NumberLiteralTypeAnnotation");case C._null:
return s.value = this.match(C._null), this.next(), this.finishNode(s, "NullLiteralTypeAnnotation");case C._this:
return s.value = this.match(C._this), this.next(), this.finishNode(s, "ThisTypeAnnotation");case C.star:
return this.next(), this.finishNode(s, "NullLiteralTypeAnnotation");case C._this:
return this.next(), this.finishNode(s, "ThisTypeAnnotation");case C.star:
return this.next(), this.finishNode(s, "ExistsTypeAnnotation");default:
if ("typeof" === this.state.type.keyword) return this.flowParseTypeofType();}throw this.unexpected();
}, e.prototype.flowParsePostfixType = function () {
@ -1403,7 +1409,7 @@ var babylon = function () {
t.types.push(this.flowParseIntersectionType());
}return 1 === t.types.length ? e : this.finishNode(t, "UnionTypeAnnotation");
}, e.prototype.flowParseType = function () {
var t = this.state.inType;this.state.inType = !0;var e = this.flowParseUnionType();return this.state.inType = t, this.state.exprAllowed = this.state.noAnonFunctionType, e;
var t = this.state.inType;this.state.inType = !0;var e = this.flowParseUnionType();return this.state.inType = t, this.state.exprAllowed = this.state.exprAllowed || this.state.noAnonFunctionType, e;
}, e.prototype.flowParseTypeAnnotation = function () {
var t = this.startNode();return t.typeAnnotation = this.flowParseTypeInitialiser(), this.finishNode(t, "TypeAnnotation");
}, e.prototype.flowParseTypeAnnotatableIdentifier = function () {
@ -1701,9 +1707,9 @@ var babylon = function () {
}, e.prototype.tsParseTypeParameter = function () {
var t = this.startNode();return t.name = this.parseIdentifierName(t.start), this.eat(C._extends) && (t.constraint = this.tsParseType()), this.eat(C.eq) && (t.default = this.tsParseType()), this.finishNode(t, "TypeParameter");
}, e.prototype.tsTryParseTypeParameters = function () {
if (this.eatRelational("<")) return this.tsParseTypeParameters();
if (this.isRelational("<")) return this.tsParseTypeParameters();
}, e.prototype.tsParseTypeParameters = function () {
var t = this.startNode();return t.params = this.tsParseBracketedList("TypeParametersOrArguments", this.tsParseTypeParameter.bind(this), !1, !0), this.finishNode(t, "TypeParameterDeclaration");
var t = this.startNode();return this.isRelational("<") || this.match(C.jsxTagStart) ? this.next() : this.unexpected(), t.params = this.tsParseBracketedList("TypeParametersOrArguments", this.tsParseTypeParameter.bind(this), !1, !0), this.finishNode(t, "TypeParameterDeclaration");
}, e.prototype.tsFillSignature = function (t, e) {
var s = t === C.arrow;e.typeParameters = this.tsTryParseTypeParameters(), this.expect(C.parenL), e.parameters = this.tsParseBindingListForSignature(), s ? e.typeAnnotation = this.tsParseTypeOrTypePredicateAnnotation(t) : this.match(t) && (e.typeAnnotation = this.tsParseTypeOrTypePredicateAnnotation(t));
}, e.prototype.tsParseBindingListForSignature = function () {
@ -1810,9 +1816,8 @@ var babylon = function () {
return this.eat(C.colon) ? this.tsParseType() : void 0;
}, e.prototype.tsParseTypePredicatePrefix = function () {
var t = this.parseIdentifier();if (this.isContextual("is") && !this.hasPrecedingLineBreak()) return this.next(), t;
}, e.prototype.tsParseTypeAnnotation = function () {
var t = !(arguments.length > 0 && void 0 !== arguments[0]) || arguments[0],
e = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : this.startNode();return t && this.expect(C.colon), e.typeAnnotation = this.tsParseType(), this.finishNode(e, "TypeAnnotation");
}, e.prototype.tsParseTypeAnnotation = function (t, e) {
return void 0 === t && (t = !0), void 0 === e && (e = this.startNode()), t && this.expect(C.colon), e.typeAnnotation = this.tsParseType(), this.finishNode(e, "TypeAnnotation");
}, e.prototype.tsParseType = function () {
var t = this.state.inType;this.state.inType = !0;try {
return this.tsIsStartOfFunctionType() ? this.tsParseFunctionOrConstructorType("TSFunctionType") : this.match(C._new) ? this.tsParseFunctionOrConstructorType("TSConstructorType") : this.tsParseUnionTypeOrHigher();
@ -1844,7 +1849,7 @@ var babylon = function () {
var e = this.startNode();this.tsParseModuleOrNamespaceDeclaration(e), t.body = e;
} else t.body = this.tsParseModuleBlock();return this.finishNode(t, "TSModuleDeclaration");
}, e.prototype.tsParseAmbientExternalModuleDeclaration = function (t) {
return this.isContextual("global") ? (t.global = !0, t.id = this.parseIdentifier()) : this.match(C.string) ? t.id = this.parseLiteral(this.state.value, "StringLiteral") : this.unexpected(), this.match(C.braceL) ? t.body = this.tsParseModuleBlock() : this.semicolon(), this.finishNode(t, "TSModuleDeclaration");
return this.isContextual("global") ? (t.global = !0, t.id = this.parseIdentifier()) : this.match(C.string) ? t.id = this.parseExprAtom() : this.unexpected(), this.match(C.braceL) ? t.body = this.tsParseModuleBlock() : this.semicolon(), this.finishNode(t, "TSModuleDeclaration");
}, e.prototype.tsParseImportEqualsDeclaration = function (t, e) {
return t.isExport = e || !1, t.id = this.parseIdentifier(), this.expect(C.eq), t.moduleReference = this.tsParseModuleReference(), this.semicolon(), this.finishNode(t, "TSImportEqualsDeclaration");
}, e.prototype.tsIsExternalModuleReference = function () {
@ -1898,10 +1903,12 @@ var babylon = function () {
}, e.prototype.tsTryParseGenericAsyncArrowFunction = function (e, s) {
var i = this,
r = this.tsTryParseAndCatch(function () {
var r = i.startNodeAt(e, s);return i.expectRelational("<"), r.typeParameters = i.tsParseTypeParameters(), t.prototype.parseFunctionParams.call(i, r), r.returnType = i.tsTryParseTypeOrTypePredicateAnnotation(), i.expect(C.arrow), r;
var r = i.startNodeAt(e, s);return r.typeParameters = i.tsParseTypeParameters(), t.prototype.parseFunctionParams.call(i, r), r.returnType = i.tsTryParseTypeOrTypePredicateAnnotation(), i.expect(C.arrow), r;
});if (r) return r.id = null, r.generator = !1, r.expression = !0, r.async = !0, this.parseFunctionBody(r, !0), this.finishNode(r, "ArrowFunctionExpression");
}, e.prototype.tsParseTypeArguments = function () {
var t = this.startNode();return this.expectRelational("<"), t.params = this.tsParseDelimitedList("TypeParametersOrArguments", this.tsParseType.bind(this)), this.expectRelational(">"), this.finishNode(t, "TypeParameterInstantiation");
}, e.prototype.isExportDefaultSpecifier = function () {
return (!this.match(C.name) || "type" !== this.state.value && "interface" !== this.state.value && "enum" !== this.state.value) && t.prototype.isExportDefaultSpecifier.call(this);
}, e.prototype.parseAssignableListItem = function (t, e) {
var s = void 0,
i = !1;t && (s = this.parseAccessModifier(), i = !!this.tsParseModifier(["readonly"]));var r = this.parseMaybeDefault();this.parseAssignableListItemTypes(r);var a = this.parseMaybeDefault(r.start, r.loc.start, r);if (s || i) {
@ -2008,7 +2015,7 @@ var babylon = function () {
var o;return (o = t.prototype.parseMaybeAssign).call.apply(o, [this].concat(i));
}var h = void 0,
p = void 0,
c = this.state.clone();this.next();try {
c = this.state.clone();try {
var l;p = this.tsParseTypeParameters(), "ArrowFunctionExpression" !== (h = (l = t.prototype.parseMaybeAssign).call.apply(l, [this].concat(i))).type && this.unexpected();
} catch (s) {
var u;if (!(s instanceof SyntaxError)) throw s;if (e) throw e;return m(!this.hasPlugin("jsx")), this.state = c, (u = t.prototype.parseMaybeAssign).call.apply(u, [this].concat(i));

File diff suppressed because one or more lines are too long

View File

@ -1 +1 @@
prettierVersion = "1.6.0";
prettierVersion = "1.6.1";