This fixes all the TypeScript problems reported and a few regressions from 1.4.0.
This commit is contained in:
Christopher Chedeau committed 2017-06-02 16:25:57 -07:00
1 parent 3d175cc305
commit f56f9e5e8f
8 files changed
+322 -227

No files matched your search

+6
View File
@@ -1,3 +1,9 @@
# 1.4.1
[link](https://github.com/jlongster/prettier/compare/1.4.0...1.4.1)
* Lots of fixes for TypeScript and regressions from 1.4.0. If you are using 1.4.0, you should migrate to 1.4.1 asap ;)
# 1.4.0
[link](https://github.com/jlongster/prettier/compare/1.3.1...1.4.0)
+218 -132
View File
@@ -465,6 +465,11 @@ function startsWithNoLookaheadToken(node, forbidFunctionAndClass) {
node.expressions[0],
forbidFunctionAndClass
);
case "TSAsExpression":
return startsWithNoLookaheadToken(
node.expression,
forbidFunctionAndClass
);
default:
return false;
}
@@ -598,7 +603,12 @@ function getSortedChildNodes(node, text, resultArray) {
});
}
for (let i = 0, nameCount = names.length; i < nameCount; ++i) {
for (
let i = 0,
nameCount = names.length;
i < nameCount;
++i
) {
getSortedChildNodes(node[names[i]], text, resultArray);
}
@@ -612,7 +622,8 @@ function decorateComment(node, comment, text) {
const childNodes = getSortedChildNodes(node, text);
let precedingNode, followingNode;
// Time to dust off the old binary search robes and wizard hat.
let left = 0, right = childNodes.length;
let left = 0,
right = childNodes.length;
while (left < right) {
const middle = (left + right) >> 1;
const child = childNodes[middle];
@@ -1336,9 +1347,9 @@ function printComment(commentPath, options) {
return "/*" + comment.value + "*/";
case "CommentLine":
case "Line":
// Don't print the shebang, it's taken care of in index.js
// Print shebangs with the proper comment characters
if (options.originalText.slice(util$1.locStart(comment)).startsWith("#!")) {
return "";
return "#!" + comment.value;
}
return "//" + comment.value;
default:
@@ -1510,7 +1521,7 @@ var comments$1 = {
};
var name = "prettier";
var version$1 = "1.4.0";
var version$1 = "1.4.1";
var description = "Prettier is an opinionated JavaScript formatter";
var bin = {"prettier":"./bin/prettier.js"};
var repository = "prettier/prettier";
@@ -1518,7 +1529,7 @@ var author = "James Long";
var license = "MIT";
var main = "./index.js";
var dependencies = {};
var devDependencies = {"babel-code-frame":"6.22.0","babylon":"7.0.0-beta.10","chalk":"1.1.3","cross-spawn":"5.1.0","diff":"3.2.0","eslint":"3.19.0","eslint-plugin-prettier":"2.1.1","esutils":"2.0.2","flow-parser":"0.47.0","get-stdin":"5.0.1","glob":"7.1.2","jest":"20.0.0","jest-validate":"20.0.3","minimist":"1.2.0","mkdirp":"^0.5.1","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/shellscape/postcss-values-parser.git#5e351360479116f3fe309602cdd15b0a233bc29f","prettier":"1.3.1","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","typescript":"2.3.2","typescript-eslint-parser":"git://github.com/eslint/typescript-eslint-parser.git#32634f10b8c9bc4622762867d9d00e79ea1092fe","uglify-es":"mishoo/UglifyJS2#harmony","webpack":"2.6.1"};
var devDependencies = {"babel-code-frame":"7.0.0-alpha.12","babylon":"7.0.0-beta.10","chalk":"1.1.3","cross-spawn":"5.1.0","diff":"3.2.0","eslint":"3.19.0","eslint-plugin-prettier":"2.1.1","esutils":"2.0.2","flow-parser":"0.47.0","get-stdin":"5.0.1","glob":"7.1.2","jest":"20.0.0","jest-validate":"20.0.3","minimist":"1.2.0","mkdirp":"^0.5.1","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/shellscape/postcss-values-parser.git#5e351360479116f3fe309602cdd15b0a233bc29f","prettier":"1.4.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","typescript":"2.3.2","typescript-eslint-parser":"git://github.com/vjeux/typescript-eslint-parser.git#488ba4f273f52ee6ef8d951d7ae84d28231e2fe9","uglify-es":"3.0.15","webpack":"2.6.1"};
var scripts = {"test":"jest","test-integration":"jest tests_integration","lint":"eslint .","build":"./scripts/build/build.sh","build:docs":"rollup -c docs/rollup.config.js"};
var jest = {"setupFiles":["<rootDir>/tests_config/run_spec.js"],"snapshotSerializers":["<rootDir>/tests_config/raw-serializer.js"],"testRegex":"jsfmt\\.spec\\.js$|__tests__/.*\\.js$","testPathIgnorePatterns":["tests/new_react","tests/more_react"]};
var _package = {
@@ -1906,7 +1917,8 @@ FastPath$1.prototype.needsParens = function() {
case "YieldExpression":
if (
parent.type === "UnaryExpression" ||
parent.type === "AwaitExpression"
parent.type === "AwaitExpression" ||
parent.type === "TSAsExpression"
) {
return true;
}
@@ -1918,6 +1930,7 @@ FastPath$1.prototype.needsParens = function() {
case "LogicalExpression":
case "SpreadElement":
case "SpreadProperty":
case "TSAsExpression":
return true;
case "MemberExpression":
@@ -2071,9 +2084,6 @@ FastPath$1.prototype.needsParens = function() {
return false;
}
case "ObjectExpression":
return parent.type === "TSAsExpression";
case "ClassExpression":
return parent.type === "ExportDefaultDeclaration";
@@ -2892,10 +2902,11 @@ function genericPrint(path, options, printPath, args) {
(decorator.type === "Identifier" ||
decorator.type === "MemberExpression" ||
(decorator.type === "CallExpression" &&
decorator.arguments.length === 1 &&
(isStringLiteral(decorator.arguments[0]) ||
decorator.arguments[0].type === "Identifier" ||
decorator.arguments[0].type === "MemberExpression")))
(decorator.arguments.length === 0 ||
(decorator.arguments.length === 1 &&
(isStringLiteral(decorator.arguments[0]) ||
decorator.arguments[0].type === "Identifier" ||
decorator.arguments[0].type === "MemberExpression")))))
) {
separator = " ";
}
@@ -3174,6 +3185,9 @@ function genericPrintNoParens(path, options, print, args) {
parts.push("declare ");
}
parts.push(printFunctionDeclaration(path, print, options));
if (n.type === "TSNamespaceFunctionDeclaration" && !n.body) {
parts.push(semi);
}
return concat$2(parts);
case "ArrowFunctionExpression": {
if (n.async) {
@@ -3600,18 +3614,14 @@ function genericPrintNoParens(path, options, print, args) {
return concat$2(parts);
case "ObjectExpression":
case "ObjectPattern":
case "TSInterfaceBody":
case "ObjectTypeAnnotation":
case "TSInterfaceBody":
case "TSTypeLiteral": {
const isTypeAnnotation = n.type === "ObjectTypeAnnotation";
const isTypeScriptInterfaceBody = n.type === "TSInterfaceBody";
// Leave this here because we *might* want to make this
// configurable later -- flow accepts ";" for type separators,
// typescript accepts ";" and newlines
let separator = isTypeAnnotation ? "," : ",";
if (isTypeScriptInterfaceBody) {
separator = semi;
}
const separator = n.type === "TSInterfaceBody" ||
n.type === "TSTypeLiteral"
? semi
: ",";
const fields = [];
const leftBrace = n.exact ? "{|" : "{";
const rightBrace = n.exact ? "|}" : "}";
@@ -3659,8 +3669,10 @@ function genericPrintNoParens(path, options, print, args) {
const lastElem = util$4.getLast(n[propertiesField]);
const canHaveTrailingSeparator = !(lastElem &&
(lastElem.type === "RestProperty" || lastElem.type === "RestElement"));
const canHaveTrailingSeparator = !(
lastElem &&
(lastElem.type === "RestProperty" || lastElem.type === "RestElement")
);
let content;
if (props.length === 0 && !n.typeAnnotation) {
@@ -3788,8 +3800,9 @@ function genericPrintNoParens(path, options, print, args) {
}
} else {
const lastElem = util$4.getLast(n.elements);
const canHaveTrailingComma = !(lastElem &&
lastElem.type === "RestElement");
const canHaveTrailingComma = !(
lastElem && lastElem.type === "RestElement"
);
// JavaScript allows you to have empty elements in an array which
// changes its length based on the number of commas. The algorithm
@@ -3951,6 +3964,16 @@ function genericPrintNoParens(path, options, print, args) {
return print(childPath);
}, "declarations");
// We generally want to terminate all variable declarations with a
// semicolon, except when they in the () part of for loops.
const parentNode = path.getParentNode();
const isParentForLoop =
parentNode.type === "ForStatement" ||
parentNode.type === "ForInStatement" ||
parentNode.type === "ForOfStatement" ||
parentNode.type === "ForAwaitStatement";
const hasValue = n.declarations.some(decl => decl.init);
parts = [
@@ -3961,21 +3984,13 @@ function genericPrintNoParens(path, options, print, args) {
concat$2(
printed
.slice(1)
.map(p => concat$2([",", hasValue ? hardline$2 : line$1, p]))
.map(p =>
concat$2([",", hasValue && !isParentForLoop ? hardline$2 : line$1, p])
)
)
)
];
// We generally want to terminate all variable declarations with a
// semicolon, except when they in the () part of for loops.
const parentNode = path.getParentNode();
const isParentForLoop =
parentNode.type === "ForStatement" ||
parentNode.type === "ForInStatement" ||
parentNode.type === "ForOfStatement" ||
parentNode.type === "ForAwaitStatement";
if (!(isParentForLoop && parentNode.body !== n)) {
parts.push(semi);
}
@@ -4299,12 +4314,9 @@ function genericPrintNoParens(path, options, print, args) {
return concat$2(parts);
case "JSXIdentifier":
// Can be removed when this is fixed:
// https://github.com/eslint/typescript-eslint-parser/issues/257
if (n.object && n.property) {
return join$2(".", [
path.call(print, "object"),
path.call(print, "property")
]);
// https://github.com/eslint/typescript-eslint-parser/issues/307
if (!n.name) {
return "this";
}
return "" + n.name;
case "JSXNamespacedName":
@@ -4453,9 +4465,6 @@ function genericPrintNoParens(path, options, print, args) {
return concat$2(parts);
case "ClassProperty":
case "TSAbstractClassProperty": {
if (n.static) {
parts.push("static ");
}
const variance = getFlowVariance(n);
if (variance) {
parts.push(variance);
@@ -4463,6 +4472,9 @@ function genericPrintNoParens(path, options, print, args) {
if (n.accessibility) {
parts.push(n.accessibility + " ");
}
if (n.static) {
parts.push("static ");
}
if (n.type === "TSAbstractClassProperty") {
parts.push("abstract ");
}
@@ -4674,13 +4686,14 @@ function genericPrintNoParens(path, options, print, args) {
const parentParentParent = path.getParentNode(2);
let isArrowFunctionTypeAnnotation =
n.type === "TSFunctionType" ||
!((parent.type === "ObjectTypeProperty" &&
!getFlowVariance(parent) &&
!parent.optional &&
util$4.locStart(parent) === util$4.locStart(n)) ||
!(
(parent.type === "ObjectTypeProperty" &&
!getFlowVariance(parent) &&
!parent.optional &&
util$4.locStart(parent) === util$4.locStart(n)) ||
parent.type === "ObjectTypeCallProperty" ||
(parentParentParent &&
parentParentParent.type === "DeclareFunction"));
(parentParentParent && parentParentParent.type === "DeclareFunction")
);
let needsColon =
isArrowFunctionTypeAnnotation && parent.type === "TypeAnnotation";
@@ -4779,10 +4792,7 @@ function genericPrintNoParens(path, options, print, args) {
for (let i = 0; i < types.length; ++i) {
if (i === 0) {
result.push(types[i]);
} else if (
n.types[i - 1].type !== "ObjectTypeAnnotation" &&
n.types[i].type !== "ObjectTypeAnnotation"
) {
} else if (!isObjectType(n.types[i - 1]) && !isObjectType(n.types[i])) {
// If no object is involved, go to the next line if it breaks
result.push(indent$2(concat$2([" &", line$1, types[i]])));
} else {
@@ -4807,9 +4817,11 @@ function genericPrintNoParens(path, options, print, args) {
const shouldIndent =
parent.type !== "TypeParameterInstantiation" &&
parent.type !== "GenericTypeAnnotation" &&
!((parent.type === "TypeAlias" ||
parent.type === "VariableDeclarator") &&
hasLeadingOwnLineComment(options.originalText, n));
!(
(parent.type === "TypeAlias" ||
parent.type === "VariableDeclarator") &&
hasLeadingOwnLineComment(options.originalText, n)
);
// {
// a: string
@@ -5247,10 +5259,9 @@ function genericPrintNoParens(path, options, print, args) {
group$1(
concat$2([
"{",
options.bracketSpacing ? line$1 : softline$1,
indent$2(
concat$2([
softline$1,
hardline$2,
printArrayItems(path, options, "members", print)
])
),
@@ -5259,8 +5270,7 @@ function genericPrintNoParens(path, options, print, args) {
options,
/* sameIndent */ true
),
softline$1,
options.bracketSpacing ? line$1 : softline$1,
hardline$2,
"}"
])
)
@@ -6046,8 +6056,10 @@ function printFunctionParams(path, print, options, expandArg) {
fun[paramsField][0].typeAnnotation &&
flowTypeAnnotations.indexOf(fun[paramsField][0].typeAnnotation.type) !==
-1 &&
!(fun[paramsField][0].typeAnnotation.type === "GenericTypeAnnotation" &&
fun[paramsField][0].typeAnnotation.typeParameters) &&
!(
fun[paramsField][0].typeAnnotation.type === "GenericTypeAnnotation" &&
fun[paramsField][0].typeAnnotation.typeParameters
) &&
!fun.rest;
if (isFlowShorthandWithOneArg) {
@@ -6623,7 +6635,7 @@ function printMemberChain(path, options, print) {
.reduce((res, group) => res.concat(group), []);
const hasComment =
flatGroups.slice(1).some(node => hasLeadingComment(node.node)) ||
flatGroups.slice(1, -1).some(node => hasLeadingComment(node.node)) ||
flatGroups.slice(0, -1).some(node => hasTrailingComment(node.node));
// If we only have a single `.`, we shouldn't do anything fancy and just
@@ -7309,7 +7321,8 @@ function getLeftSide(node) {
node.callee ||
node.object ||
node.tag ||
node.argument
node.argument ||
node.expression
);
}
@@ -7383,6 +7396,12 @@ function classChildNeedsASIProtection(node) {
return;
}
if (!node.computed) {
const name = node.key && node.key.name;
if (name === "in" || name === "instanceof") {
return true;
}
}
switch (node.type) {
case "ClassProperty":
case "TSAbstractClassProperty":
@@ -7610,6 +7629,10 @@ function removeLines(doc) {
});
}
function isObjectType(n) {
return n.type === "ObjectTypeAnnotation" || n.type === "TSTypeLiteral";
}
function printAstToDoc$1(ast, options, addAlignmentSize) {
addAlignmentSize = addAlignmentSize || 0;
@@ -7840,7 +7863,6 @@ function printDocToString$1(doc, options) {
}
// fallthrough
case MODE_BREAK: {
shouldRemeasure = false;
@@ -8023,7 +8045,6 @@ function printDocToString$1(doc, options) {
}
// fallthrough
case MODE_BREAK:
if (lineSuffix.length) {
cmds.push([ind, mode, doc]);
@@ -11911,58 +11932,29 @@ var index$30 = createCommonjsModule(function (module, exports) {
"use strict";
exports.__esModule = true;
exports.codeFrameColumns = codeFrameColumns;
exports.default = function (rawLines, lineNumber, colNumber) {
var opts = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
if (!deprecationWarningShown) {
deprecationWarningShown = true;
var deprecationError = new Error("Passing lineNumber and colNumber is deprecated to babel-code-frame. Please use `codeFrameColumns`.");
deprecationError.name = "DeprecationWarning";
if (process.emitWarning) {
process.emitWarning(deprecationError);
} else {
console.warn(deprecationError);
}
}
colNumber = Math.max(colNumber, 0);
var highlighted = opts.highlightCode && _chalk2.default.supportsColor || opts.forceColor;
var chalk = _chalk2.default;
if (opts.forceColor) {
chalk = new _chalk2.default.constructor({ enabled: true });
}
var maybeHighlight = function maybeHighlight(chalkFn, string) {
return highlighted ? chalkFn(string) : string;
};
var defs = getDefs(chalk);
if (highlighted) rawLines = highlight(defs, rawLines);
var location = { start: { column: colNumber, line: lineNumber } };
var linesAbove = opts.linesAbove || 2;
var linesBelow = opts.linesBelow || 3;
var lines = rawLines.split(NEWLINE);
var start = Math.max(lineNumber - (linesAbove + 1), 0);
var end = Math.min(lines.length, lineNumber + linesBelow);
if (!lineNumber && !colNumber) {
start = 0;
end = lines.length;
}
var numberMaxWidth = String(end).length;
var frame = lines.slice(start, end).map(function (line, index) {
var number = start + 1 + index;
var paddedNumber = (" " + number).slice(-numberMaxWidth);
var gutter = " " + paddedNumber + " | ";
if (number === lineNumber) {
var markerLine = "";
if (colNumber) {
var markerSpacing = line.slice(0, colNumber - 1).replace(/[^\t]/g, " ");
markerLine = ["\n ", maybeHighlight(defs.gutter, gutter.replace(/\d/g, " ")), markerSpacing, maybeHighlight(defs.marker, "^")].join("");
}
return [maybeHighlight(defs.marker, ">"), maybeHighlight(defs.gutter, gutter), line, markerLine].join("");
} else {
return " " + maybeHighlight(defs.gutter, gutter) + line;
}
}).join("\n");
if (highlighted) {
return chalk.reset(frame);
} else {
return frame;
}
return codeFrameColumns(rawLines, location, opts);
};
var _jsTokens = index$32;
@@ -11979,6 +11971,8 @@ var _chalk2 = _interopRequireDefault(_chalk);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
var deprecationWarningShown = false;
function getDefs(chalk) {
return {
keyword: chalk.cyan,
@@ -12048,7 +12042,112 @@ function highlight(defs, text) {
});
}
module.exports = exports["default"];
function getMarkerLines(loc, source, opts) {
var startLoc = Object.assign({}, { column: 0, line: -1 }, loc.start);
var endLoc = Object.assign({}, startLoc, loc.end);
var linesAbove = opts.linesAbove || 2;
var linesBelow = opts.linesBelow || 3;
var startLine = startLoc.line;
var startColumn = startLoc.column;
var endLine = endLoc.line;
var endColumn = endLoc.column;
var start = Math.max(startLine - (linesAbove + 1), 0);
var end = Math.min(source.length, endLine + linesBelow);
if (startLine === -1) {
start = 0;
}
if (endLine === -1) {
end = source.length;
}
var lineDiff = endLine - startLine;
var markerLines = {};
if (lineDiff) {
for (var i = 0; i <= lineDiff; i++) {
var lineNumber = i + startLine;
if (!startColumn) {
markerLines[lineNumber] = true;
} else if (i === 0) {
var sourceLength = source[lineNumber - 1].length;
markerLines[lineNumber] = [startColumn, sourceLength - startColumn];
} else if (i === lineDiff) {
markerLines[lineNumber] = [0, endColumn];
} else {
var _sourceLength = source[lineNumber - i].length;
markerLines[lineNumber] = [0, _sourceLength];
}
}
} else {
if (startColumn === endColumn) {
if (startColumn) {
markerLines[startLine] = [startColumn, 0];
} else {
markerLines[startLine] = true;
}
} else {
markerLines[startLine] = [startColumn, endColumn - startColumn];
}
}
return { start: start, end: end, markerLines: markerLines };
}
function codeFrameColumns(rawLines, loc) {
var opts = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
var highlighted = opts.highlightCode && _chalk2.default.supportsColor || opts.forceColor;
var chalk = _chalk2.default;
if (opts.forceColor) {
chalk = new _chalk2.default.constructor({ enabled: true });
}
var maybeHighlight = function maybeHighlight(chalkFn, string) {
return highlighted ? chalkFn(string) : string;
};
var defs = getDefs(chalk);
if (highlighted) rawLines = highlight(defs, rawLines);
var lines = rawLines.split(NEWLINE);
var _getMarkerLines = getMarkerLines(loc, lines, opts),
start = _getMarkerLines.start,
end = _getMarkerLines.end,
markerLines = _getMarkerLines.markerLines;
var numberMaxWidth = String(end).length;
var frame = lines.slice(start, end).map(function (line, index) {
var number = start + 1 + index;
var paddedNumber = (" " + number).slice(-numberMaxWidth);
var gutter = " " + paddedNumber + " | ";
var hasMarker = markerLines[number];
if (hasMarker) {
var markerLine = "";
if (Array.isArray(hasMarker)) {
var markerSpacing = line.slice(0, Math.max(hasMarker[0] - 1, 0)).replace(/[^\t]/g, " ");
var numberOfMarkers = hasMarker[1] || 1;
markerLine = ["\n ", maybeHighlight(defs.gutter, gutter.replace(/\d/g, " ")), markerSpacing, maybeHighlight(defs.marker, "^").repeat(numberOfMarkers)].join("");
}
return [maybeHighlight(defs.marker, ">"), maybeHighlight(defs.gutter, gutter), line, markerLine].join("");
} else {
return " " + maybeHighlight(defs.gutter, gutter) + line;
}
}).join("\n");
if (highlighted) {
return chalk.reset(frame);
} else {
return frame;
}
}
});
function parse(text, opts) {
@@ -12071,7 +12170,7 @@ function parse(text, opts) {
if (loc) {
const codeFrame = index$30;
error.codeFrame = codeFrame(text, loc.line, loc.column, {
error.codeFrame = codeFrame.codeFrameColumns(text, loc, {
highlightCode: true
});
error.message += "\n" + error.codeFrame;
@@ -12460,29 +12559,16 @@ function formatRange(text, opts, ast) {
}
}
function formatWithShebang(text, opts) {
if (!text.startsWith("#!")) {
return format(text, opts);
}
const index = text.indexOf("\n");
const shebang = text.slice(0, index + 1);
const nextChar = text.charAt(index + 1);
const newLine = nextChar === "\n" ? "\n" : nextChar === "\r" ? "\r\n" : "";
return shebang + newLine + format(text, opts);
}
var index = {
formatWithCursor: function(text, opts) {
return formatWithCursor(text, normalizeOptions(opts));
},
format: function(text, opts) {
return formatWithShebang(text, normalizeOptions(opts));
return format(text, normalizeOptions(opts));
},
check: function(text, opts) {
try {
const formatted = formatWithShebang(text, normalizeOptions(opts));
const formatted = format(text, normalizeOptions(opts));
return formatted === text;
} catch (e) {
return false;
+1 -1
View File
@@ -8,7 +8,7 @@ function createCommonjsModule(fn, module) {
}
var parserBabylon_1 = createCommonjsModule(function (module) {
"use strict";function createError$1(t,e,s){const i=new SyntaxError(t+" ("+e+":"+s+")");return i.loc={line:e,column:s},i}function createCommonjsModule$$1(t,e){return e={exports:{}},t(e,e.exports),e.exports}function parse(t){const e=index,s={sourceType:"module",allowImportExportEverywhere:!1,allowReturnOutsideFunction:!0,plugins:["jsx","flow","doExpressions","objectRestSpread","decorators","classProperties","exportExtensions","asyncGenerators","functionBind","functionSent","dynamicImport"]};let i;try{i=e.parse(t,s);}catch(i){try{return e.parse(t,Object.assign({},s,{strictMode:!1}))}catch(t){throw createError(i.message.replace(/ \(.*\)/,""),i.loc.line,i.loc.column+1)}}return delete i.tokens,i}var parserCreateError=createError$1,index=createCommonjsModule$$1(function(t,e){function s(t){var e={};for(var s in b)e[s]=t&&s in t?t[s]:b[s];return e}function i(t){var e=t.split(" ");return function(t){return e.indexOf(t)>=0}}function r(t,e){for(var s=65536,i=0;i<e.length;i+=2){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&&j.test(String.fromCharCode(t)):r(t,D)))}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,D)||r(t,O))))}function o(t){return 10===t||13===t||8232===t||8233===t}function h(t,e){for(var s=1,i=0;;){F.lastIndex=i;var r=F.exec(t);if(!(r&&r.index<e))return new U(s,e-i);++s,i=r.index+r[0].length;}throw new Error("Unreachable")}function p(t){return t[t.length-1]}function c(t){return t<=65535?String.fromCharCode(t):String.fromCharCode(55296+(t-65536>>10),56320+(t-65536&1023))}function l(t){for(var e={},s=t,i=Array.isArray(s),r=0,s=i?s:s[Symbol.iterator]();;){var a;if(i){if(r>=s.length)break;a=s[r++];}else{if((r=s.next()).done)break;a=r.value;}e[a]=!0;}return e}function u(t){return null!=t&&"Property"===t.type&&"init"===t.kind&&!1===t.method}function d(t){return"DeclareExportAllDeclaration"===t.type||"DeclareExportDeclaration"===t.type&&(!t.declaration||"TypeAlias"!==t.declaration.type&&"InterfaceDeclaration"!==t.declaration.type)}function f(t){if("JSXIdentifier"===t.type)return t.name;if("JSXNamespacedName"===t.type)return t.namespace.name+":"+t.name.name;if("JSXMemberExpression"===t.type)return f(t.object)+"."+f(t.property);throw new Error("Node had unexpected type: "+t.type)}function m(t,e){return x(e,t).parse()}function y(t,e){var s=x(e,t);return s.options.strictMode&&(s.state.strict=!0),s.getExpression()}function x(t,e){return new(t&&t.plugins?v(t.plugins):tt)(t,e)}function v(t){var e=t.filter(function(t){return"estree"===t||"flow"===t||"jsx"===t});e.indexOf("flow")>=0&&(e=e.filter(function(t){return"flow"!==t})).push("flow"),e.indexOf("estree")>=0&&(e=e.filter(function(t){return"estree"!==t})).unshift("estree");var s=e.join("/"),i=pt[s];if(!i){i=tt;for(var r=e,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;}i=Z[o](i);}pt[s]=i;}return i}Object.defineProperty(e,"__esModule",{value:!0});var b={sourceType:"script",sourceFilename:void 0,startLine:1,allowReturnOutsideFunction:!1,allowImportExportEverywhere:!1,allowSuperOutsideMethod:!1,plugins:[],strictMode:null,ranges:!1},g=function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")},w=function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e);},P=function(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e},A=!0,k=function t(e){var s=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};g(this,t),this.label=e,this.keyword=s.keyword,this.beforeExpr=!!s.beforeExpr,this.startsExpr=!!s.startsExpr,this.rightAssociative=!!s.rightAssociative,this.isLoop=!!s.isLoop,this.isAssign=!!s.isAssign,this.prefix=!!s.prefix,this.postfix=!!s.postfix,this.binop=s.binop||null,this.updateContext=null;},E=function(t){function e(s){var i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return g(this,e),i.keyword=s,P(this,t.call(this,s,i))}return w(e,t),e}(k),T=function(t){function e(s,i){return g(this,e),P(this,t.call(this,s,{beforeExpr:A,binop:i}))}return w(e,t),e}(k),C={num:new k("num",{startsExpr:!0}),regexp:new k("regexp",{startsExpr:!0}),string:new k("string",{startsExpr:!0}),name:new k("name",{startsExpr:!0}),eof:new k("eof"),bracketL:new k("[",{beforeExpr:A,startsExpr:!0}),bracketR:new k("]"),braceL:new k("{",{beforeExpr:A,startsExpr:!0}),braceBarL:new k("{|",{beforeExpr:A,startsExpr:!0}),braceR:new k("}"),braceBarR:new k("|}"),parenL:new k("(",{beforeExpr:A,startsExpr:!0}),parenR:new k(")"),comma:new k(",",{beforeExpr:A}),semi:Line truncated
"use strict";function createError$1(t,e){const s=new SyntaxError(t+" ("+e.start.line+":"+e.start.column+")");return s.loc=e,s}function createCommonjsModule$$1(t,e){return e={exports:{}},t(e,e.exports),e.exports}function parse(t){const e=index,s={sourceType:"module",allowImportExportEverywhere:!1,allowReturnOutsideFunction:!0,plugins:["jsx","flow","doExpressions","objectRestSpread","decorators","classProperties","exportExtensions","asyncGenerators","functionBind","functionSent","dynamicImport"]};let i;try{i=e.parse(t,s);}catch(i){try{return e.parse(t,Object.assign({},s,{strictMode:!1}))}catch(t){throw createError(i.message.replace(/ \(.*\)/,""),{start:{line:i.loc.line,column:i.loc.column+1}})}}return delete i.tokens,i}var parserCreateError=createError$1,index=createCommonjsModule$$1(function(t,e){function s(t){var e={};for(var s in b)e[s]=t&&s in t?t[s]:b[s];return e}function i(t){var e=t.split(" ");return function(t){return e.indexOf(t)>=0}}function r(t,e){for(var s=65536,i=0;i<e.length;i+=2){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&&j.test(String.fromCharCode(t)):r(t,D)))}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,D)||r(t,O))))}function o(t){return 10===t||13===t||8232===t||8233===t}function h(t,e){for(var s=1,i=0;;){F.lastIndex=i;var r=F.exec(t);if(!(r&&r.index<e))return new U(s,e-i);++s,i=r.index+r[0].length;}throw new Error("Unreachable")}function p(t){return t[t.length-1]}function c(t){return t<=65535?String.fromCharCode(t):String.fromCharCode(55296+(t-65536>>10),56320+(t-65536&1023))}function l(t){for(var e={},s=t,i=Array.isArray(s),r=0,s=i?s:s[Symbol.iterator]();;){var a;if(i){if(r>=s.length)break;a=s[r++];}else{if((r=s.next()).done)break;a=r.value;}e[a]=!0;}return e}function u(t){return null!=t&&"Property"===t.type&&"init"===t.kind&&!1===t.method}function d(t){return"DeclareExportAllDeclaration"===t.type||"DeclareExportDeclaration"===t.type&&(!t.declaration||"TypeAlias"!==t.declaration.type&&"InterfaceDeclaration"!==t.declaration.type)}function f(t){if("JSXIdentifier"===t.type)return t.name;if("JSXNamespacedName"===t.type)return t.namespace.name+":"+t.name.name;if("JSXMemberExpression"===t.type)return f(t.object)+"."+f(t.property);throw new Error("Node had unexpected type: "+t.type)}function m(t,e){return x(e,t).parse()}function y(t,e){var s=x(e,t);return s.options.strictMode&&(s.state.strict=!0),s.getExpression()}function x(t,e){return new(t&&t.plugins?v(t.plugins):tt)(t,e)}function v(t){var e=t.filter(function(t){return"estree"===t||"flow"===t||"jsx"===t});e.indexOf("flow")>=0&&(e=e.filter(function(t){return"flow"!==t})).push("flow"),e.indexOf("estree")>=0&&(e=e.filter(function(t){return"estree"!==t})).unshift("estree");var s=e.join("/"),i=pt[s];if(!i){i=tt;for(var r=e,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;}i=Z[o](i);}pt[s]=i;}return i}Object.defineProperty(e,"__esModule",{value:!0});var b={sourceType:"script",sourceFilename:void 0,startLine:1,allowReturnOutsideFunction:!1,allowImportExportEverywhere:!1,allowSuperOutsideMethod:!1,plugins:[],strictMode:null,ranges:!1},g=function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")},w=function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e);},P=function(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e},A=!0,k=function t(e){var s=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};g(this,t),this.label=e,this.keyword=s.keyword,this.beforeExpr=!!s.beforeExpr,this.startsExpr=!!s.startsExpr,this.rightAssociative=!!s.rightAssociative,this.isLoop=!!s.isLoop,this.isAssign=!!s.isAssign,this.prefix=!!s.prefix,this.postfix=!!s.postfix,this.binop=s.binop||null,this.updateContext=null;},E=function(t){function e(s){var i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return g(this,e),i.keyword=s,P(this,t.call(this,s,i))}return w(e,t),e}(k),T=function(t){function e(s,i){return g(this,e),P(this,t.call(this,s,{beforeExpr:A,binop:i}))}return w(e,t),e}(k),C={num:new k("num",{startsExpr:!0}),regexp:new k("regexp",{startsExpr:!0}),string:new k("string",{startsExpr:!0}),name:new k("name",{startsExpr:!0}),eof:new k("eof"),bracketL:new k("[",{beforeExpr:A,startsExpr:!0}),bracketR:new k("]"),braceL:new k("{",{beforeExpr:A,startsExpr:!0}),braceBarL:new k("{|",{beforeExpr:A,startsExpr:!0}),braceR:new k("}"),braceBarR:new k("|}"),parenL:new k("(",{beforeExpr:A,startsExpr:!0}),parenR:new k(")"),comma:newLine truncated
});
var parserBabylon = unwrapExports(parserBabylon_1);
+1 -1
View File
@@ -1,5 +1,5 @@
var flow = (function () {
function createError$1(t,r,e){const n=new SyntaxError(t+" ("+r+":"+e+")");return n.loc={line:r,column:e},n}function createCommonjsModule(t,r){return r={exports:{}},t(r,r.exports),r.exports}function parse(t){const r=flow_parser.parse(t,{esproposal_class_instance_fields:!0,esproposal_class_static_fields:!0,esproposal_export_star_as:!0});if(r.errors.length>0)throw createError(r.errors[0].message,r.errors[0].loc.start.line,r.errors[0].loc.start.column+1);return r}var parserCreateError=createError$1; var flow_parser=createCommonjsModule(function(t,r){!function(t){"use strict";function e(t,r){throw[0,t,r]}function n(t,r){function n(r){e(Gd.Undefined_recursive_module,t);}function a(t,r,e){if("number"==typeof t)switch(t){case 0:r[e]={fun:n};break;case 1:r[e]=[ls,n];break;default:r[e]=[];}else switch(t[0]){case 0:r[e]=[0];for(var u=1;u<t[1].length;u++)a(t[1][u],r[e],u);break;default:r[e]=t[1];}}var u=[];return a(r,u,0),u[0]}function a(t,r){if(typeof r===Pk)return t.fun=r,0;if(r.fun)return t.fun=r.fun,0;for(var e=r.length;e--;)t[e]=r[e];return 0}function u(t,r,e){if("number"==typeof t)switch(t){case 0:r.fun=e;break;case 1:default:a(r,e);}else switch(t[0]){case 0:for(var n=1;n<t[1].length;n++)u(t[1][n],r[n],e[n]);}return 0}function i(t,r){var e=t.length,n=e+r.length-1,a=new Array(n);a[0]=0;for(var u=1,i=1;u<e;u++)a[u]=t[u];for(;u<n;u++,i++)a[u]=r[i];return a}function f(t,r,e,n,a){if(n<=r)for(u=1;u<=a;u++)e[n+u]=t[r+u];else for(var u=a;u>=1;u--)e[n+u]=t[r+u];return 0}function c(t,r,e){var n=new Array(e+1);n[0]=0;for(var a=1,u=r+1;a<=e;a++,u++)n[a]=t[u];return n}function s(t,r,e){for(var n=new Array(e),a=0;a<e;a++)n[a]=t[r+a];return n}function o(t,r,e){var n=String.fromCharCode;if(0==r&&e<=4096&&e==t.length)return n.apply(null,t);for(var a=mb;0<e;r+=Nu,e-=Nu)a+=n.apply(null,s(t,r,Math.min(e,Nu)));return a}function v(r){if(t.Uint8Array)e=new t.Uint8Array(r.l);else var e=new Array(r.l);for(var n=r.c,a=n.length,u=0;u<a;u++)e[u]=n.charCodeAt(u);for(a=r.l;u<a;u++)e[u]=0;return r.c=e,r.t=4,e}function l(t,r,e,n,a){if(0==a)return 0;if(0==n&&(a>=e.l||2==e.t&&a>=e.c.length))e.c=4==t.t?o(t.c,r,a):0==r&&t.c.length==a?t.c:t.c.substr(r,a),e.t=e.c.length==e.l?0:2;else if(2==e.t&&n==e.c.length)e.c+=4==t.t?o(t.c,r,a):0==r&&t.c.length==a?t.c:t.c.substr(r,a),e.t=e.c.length==e.l?0:2;else{4!=e.t&&v(e);var u=t.c,i=e.c;if(4==t.t)if(n<=r)for(c=0;c<a;c++)i[n+c]=u[r+c];else for(c=a-1;c>=0;c--)i[n+c]=u[r+c];else{for(var f=Math.min(a,u.length-r),c=0;c<f;c++)i[n+c]=u.charCodeAt(r+c);for(;c<a;c++)i[n+c]=0;}}return 0}function b(t,r){if(r.repeat)return r.repeat(t);var e=mb,n=0;if(0==t)return e;for(;;){if(1&t&&(e+=r),0==(t>>=1))return e;r+=r,9==++n&&r.slice(0,1);}}function k(t){2==t.t?t.c+=b(t.l-t.c.length,"\0"):t.c=o(t.c,0,t.c.length),t.t=0;}function p(t){if(t.length<24){for(var r=0;r<t.length;r++)if(t.charCodeAt(r)>Kb)return!1;return!0}return!/[^\x00-\x7f]/.test(t)}function h(t){for(var r,e,n,a,u=mb,i=mb,f=0,c=t.length;f<c;f++){if((e=t.charCodeAt(f))<Zn){for(var s=f+1;s<c&&(e=t.charCodeAt(s))<Zn;s++);if(s-f>Hn?(i.substr(0,1),u+=i,i=mb,u+=t.slice(f,s)):i+=t.slice(f,s),s==c)break;f=s;}a=1,++f<c&&(-64&(n=t.charCodeAt(f)))==Zn&&(r=n+(e<<6),e<Jl?(a=r-12416)<Zn&&(a=1):(a=2,++f<c&&(-64&(n=t.charCodeAt(f)))==Zn&&(r=n+(r<<6),e<$p?((a=r-925824)<Mc||a>=55295&&a<ml)&&(a=2):(a=3,++f<c&&(-64&(n=t.charCodeAt(f)))==Zn&&e<Mo&&((a=n-63447168+(r<<6))<rs||a>nl)&&(a=3))))),a<4?(f-=a,i+="�"):i+=a>ki?String.fromCharCode(55232+(a>>10),Ji+(a&va)):String.fromCharCode(a),i.length>Nu&&(i.substr(0,1),u+=i,i=mb);}return u+i}function d(t){switch(t.t){case 9:return t.c;default:k(t);case 0:if(p(t.c))return t.t=9,t.c;t.t=8;case 8:return h(t.c)}}function m(t,r,e){this.t=t,this.c=r,this.l=e;}function y(t){return new m(0,t,t.length)}function w(t,r){e(t,y(r));}function g(t){w(Gd.Invalid_argument,t);}function T(){g(pu);}function _(t,r,e){if(e&=lh,4!=t.t){if(r==t.c.length)return t.c+=String.fromCharCode(e),r+1==t.l&&(t.t=0),0;v(t);}return t.c[r]=e,0}function S(t,r,e){return r>>>0>=t.l&&T(),_(t,r,e)}function A(t,r){for(var e=t.length,n=new Array(e+1),a=0;a<e;a++)n[a]=t[a];return n[a]=r,n}function E(t,r){if(t.fun)return E(t.fun,r);var e=t.length,n=r.length,a=e-n;return 0==a?t.apply(null,r):a<0?E(t.apply(null,s(r,0,e)),s(r,e,n-e)):function(e){return E(t,A(r,e))}}function x(){g(pu);}function I(t,r){return r>>>0>=t.length-1&&x(),t}function C(t){return isFinite(t)?Math.abs(t)>=2.2250738585072014e-308?0:0!=t?1:2:isNaN(t)?4:3}function N(t,r){var e=t[3]<<16,n=r[3]<<16;return e>n?1:e<n?-1:t[2]>r[2]?1:t[2]<r[2]?-1:t[1]>r[1]?1:t[1]<r[1]?-1:0}function R(t,r){return t<r?-1:t==r?0:1}function L(t,r){return 6&t.t&&k(t),6&r.t&&k(r),t.c<r.c?-1:t.c>r.c?1:0}function P(t,r,e){for(var n=[];;){if(!e||t!==r)if(t instanceof m){if(!(r instanceof m))return 1;if(t!==r&&0!=(i=L(t,r)))return i}else if(t instanceof Array&&t[0]===(0|t[0])){var a=t[0];if(a===Cn&&(a=0),a===Ql){t=t[1];continue}if(!(r instanceof Array&&r[0]===(0|r[0])))return 1;var u=r[0];if(u===Cn&&(u=0),u===Ql){r=r[1];continue}if(a!=u)return a<u?-1:1;swiLine truncated
function createError$1(t,r){const e=new SyntaxError(t+" ("+r.start.line+":"+r.start.column+")");return e.loc=r,e}function includeShebang$1(t,r){if(!t.startsWith("#!"))return;const e=t.indexOf("\n"),n={type:"Line",value:t.slice(2,e),range:[0,e],loc:{source:null,start:{line:1,column:0},end:{line:1,column:e}}};r.comments=[n].concat(r.comments);}function createCommonjsModule(t,r){return r={exports:{}},t(r,r.exports),r.exports}function parse(t){const r=flow_parser.parse(t,{esproposal_class_instance_fields:!0,esproposal_class_static_fields:!0,esproposal_export_star_as:!0});if(r.errors.length>0){const t=r.errors[0].loc;throw createError(r.errors[0].message,{start:{line:t.start.line,column:t.start.column+1},end:{line:t.end.line,column:t.end.column+1}})}return includeShebang(t,r),r}var parserCreateError=createError$1; var parserIncludeShebang=includeShebang$1; var flow_parser=createCommonjsModule(function(t,r){!function(t){"use strict";function e(t,r){throw[0,t,r]}function n(t,r){function n(r){e(Gd.Undefined_recursive_module,t);}function a(t,r,e){if("number"==typeof t)switch(t){case 0:r[e]={fun:n};break;case 1:r[e]=[ls,n];break;default:r[e]=[];}else switch(t[0]){case 0:r[e]=[0];for(var u=1;u<t[1].length;u++)a(t[1][u],r[e],u);break;default:r[e]=t[1];}}var u=[];return a(r,u,0),u[0]}function a(t,r){if(typeof r===Pk)return t.fun=r,0;if(r.fun)return t.fun=r.fun,0;for(var e=r.length;e--;)t[e]=r[e];return 0}function u(t,r,e){if("number"==typeof t)switch(t){case 0:r.fun=e;break;case 1:default:a(r,e);}else switch(t[0]){case 0:for(var n=1;n<t[1].length;n++)u(t[1][n],r[n],e[n]);}return 0}function i(t,r){var e=t.length,n=e+r.length-1,a=new Array(n);a[0]=0;for(var u=1,i=1;u<e;u++)a[u]=t[u];for(;u<n;u++,i++)a[u]=r[i];return a}function f(t,r,e,n,a){if(n<=r)for(u=1;u<=a;u++)e[n+u]=t[r+u];else for(var u=a;u>=1;u--)e[n+u]=t[r+u];return 0}function c(t,r,e){var n=new Array(e+1);n[0]=0;for(var a=1,u=r+1;a<=e;a++,u++)n[a]=t[u];return n}function s(t,r,e){for(var n=new Array(e),a=0;a<e;a++)n[a]=t[r+a];return n}function o(t,r,e){var n=String.fromCharCode;if(0==r&&e<=4096&&e==t.length)return n.apply(null,t);for(var a=mb;0<e;r+=Nu,e-=Nu)a+=n.apply(null,s(t,r,Math.min(e,Nu)));return a}function v(r){if(t.Uint8Array)e=new t.Uint8Array(r.l);else var e=new Array(r.l);for(var n=r.c,a=n.length,u=0;u<a;u++)e[u]=n.charCodeAt(u);for(a=r.l;u<a;u++)e[u]=0;return r.c=e,r.t=4,e}function l(t,r,e,n,a){if(0==a)return 0;if(0==n&&(a>=e.l||2==e.t&&a>=e.c.length))e.c=4==t.t?o(t.c,r,a):0==r&&t.c.length==a?t.c:t.c.substr(r,a),e.t=e.c.length==e.l?0:2;else if(2==e.t&&n==e.c.length)e.c+=4==t.t?o(t.c,r,a):0==r&&t.c.length==a?t.c:t.c.substr(r,a),e.t=e.c.length==e.l?0:2;else{4!=e.t&&v(e);var u=t.c,i=e.c;if(4==t.t)if(n<=r)for(c=0;c<a;c++)i[n+c]=u[r+c];else for(c=a-1;c>=0;c--)i[n+c]=u[r+c];else{for(var f=Math.min(a,u.length-r),c=0;c<f;c++)i[n+c]=u.charCodeAt(r+c);for(;c<a;c++)i[n+c]=0;}}return 0}function b(t,r){if(r.repeat)return r.repeat(t);var e=mb,n=0;if(0==t)return e;for(;;){if(1&t&&(e+=r),0==(t>>=1))return e;r+=r,9==++n&&r.slice(0,1);}}function k(t){2==t.t?t.c+=b(t.l-t.c.length,"\0"):t.c=o(t.c,0,t.c.length),t.t=0;}function p(t){if(t.length<24){for(var r=0;r<t.length;r++)if(t.charCodeAt(r)>$b)return!1;return!0}return!/[^\x00-\x7f]/.test(t)}function h(t){for(var r,e,n,a,u=mb,i=mb,f=0,c=t.length;f<c;f++){if((e=t.charCodeAt(f))<Zn){for(var s=f+1;s<c&&(e=t.charCodeAt(s))<Zn;s++);if(s-f>Hn?(i.substr(0,1),u+=i,i=mb,u+=t.slice(f,s)):i+=t.slice(f,s),s==c)break;f=s;}a=1,++f<c&&(-64&(n=t.charCodeAt(f)))==Zn&&(r=n+(e<<6),e<Jl?(a=r-12416)<Zn&&(a=1):(a=2,++f<c&&(-64&(n=t.charCodeAt(f)))==Zn&&(r=n+(r<<6),e<Kp?((a=r-925824)<Mc||a>=55295&&a<ml)&&(a=2):(a=3,++f<c&&(-64&(n=t.charCodeAt(f)))==Zn&&e<Mo&&((a=n-63447168+(r<<6))<rs||a>nl)&&(a=3))))),a<4?(f-=a,i+="�"):i+=a>ki?String.fromCharCode(55232+(a>>10),Ji+(a&va)):String.fromCharCode(a),i.length>Nu&&(i.substr(0,1),u+=i,i=mb);}return u+i}function d(t){switch(t.t){case 9:return t.c;default:k(t);case 0:if(p(t.c))return t.t=9,t.c;t.t=8;case 8:return h(t.c)}}function m(t,r,e){this.t=t,this.c=r,this.l=e;}function y(t){return new m(0,t,t.length)}function w(t,r){e(t,y(r));}function g(t){w(Gd.Invalid_argument,t);}function T(){g(pu);}function _(t,r,e){if(e&=lh,4!=t.t){if(r==t.c.length)return t.c+=String.fromCharCode(e),r+1==t.l&&(t.t=0),0;v(t);}return t.c[r]=e,0}function S(t,r,e){return r>>>0>=t.l&&T(),_(t,r,e)}function A(t,r){for(var e=t.length,n=new Array(e+1),a=0;a<e;a++)n[a]=t[a];return n[a]=r,n}function E(t,r){if(t.fun)return E(t.fun,r);var e=t.length,n=r.length,a=e-n;return 0==a?t.apply(null,r):a<0?E(t.apply(null,s(r,0,e)),s(r,e,n-e)):function(e){return E(t,A(r,e))}}function x(){g(pu);}function I(t,r){return r>>>0>=t.length-1&&x(),t}function C(t){return isFinite(t)?Math.abs(t)>=2.2250738585072014e-308?0:0!=t?1:2:isNaN(t)?4:3}function N(t,r){var e=t[3]<<16,n=r[3]<<16;return e>n?1:e<n?-1:t[2]>r[2]?1:t[2]<r[2]?-1:t[1]>r[1]?1:t[1]<r[1]?-1:0}function L(t,r){return t<r?-1:t==r?0:1}function R(t,r){return 6&t.t&&k(t),6&r.t&&k(r),t.c<r.c?-1:t.c>rLine truncated
return parserFlow_1;
+89 -89
View File
@@ -1577,7 +1577,7 @@ exports.compareByGeneratedPositionsInflated = compareByGeneratedPositionsInflate
"use strict";
/* WEBPACK VAR INJECTION */(function(process) {
var escapeStringRegexp = __webpack_require__(90);
var ansiStyles = __webpack_require__(88);
var ansiStyles = __webpack_require__(87);
var stripAnsi = __webpack_require__(152);
var hasAnsi = __webpack_require__(91);
var supportsColor = __webpack_require__(89);
@@ -2795,7 +2795,7 @@ exports.SourceNode = __webpack_require__(151).SourceNode;
var base64 = __webpack_require__(87);
var base64 = __webpack_require__(88);
var ieee754 = __webpack_require__(92);
var isArray = __webpack_require__(93);
@@ -14877,10 +14877,12 @@ module.exports = parser;
"use strict";
function createError(message, line, column) {
function createError(message, loc) {
// Construct an error similar to the ones thrown by Babylon.
const error = new SyntaxError(message + " (" + line + ":" + column + ")");
error.loc = { line, column };
const error = new SyntaxError(
message + " (" + loc.start.line + ":" + loc.start.column + ")"
);
error.loc = loc;
return error;
}
@@ -14891,6 +14893,79 @@ module.exports = createError;
/* 87 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
/* WEBPACK VAR INJECTION */(function(module) {
function assembleStyles () {
var styles = {
modifiers: {
reset: [0, 0],
bold: [1, 22], // 21 isn't widely supported and 22 does the same thing
dim: [2, 22],
italic: [3, 23],
underline: [4, 24],
inverse: [7, 27],
hidden: [8, 28],
strikethrough: [9, 29]
},
colors: {
black: [30, 39],
red: [31, 39],
green: [32, 39],
yellow: [33, 39],
blue: [34, 39],
magenta: [35, 39],
cyan: [36, 39],
white: [37, 39],
gray: [90, 39]
},
bgColors: {
bgBlack: [40, 49],
bgRed: [41, 49],
bgGreen: [42, 49],
bgYellow: [43, 49],
bgBlue: [44, 49],
bgMagenta: [45, 49],
bgCyan: [46, 49],
bgWhite: [47, 49]
}
};
// fix humans
styles.colors.grey = styles.colors.gray;
Object.keys(styles).forEach(function (groupName) {
var group = styles[groupName];
Object.keys(group).forEach(function (styleName) {
var style = group[styleName];
styles[styleName] = group[styleName] = {
open: '\u001b[' + style[0] + 'm',
close: '\u001b[' + style[1] + 'm'
};
});
Object.defineProperty(styles, groupName, {
value: group,
enumerable: false
});
});
return styles;
}
Object.defineProperty(module, 'exports', {
enumerable: true,
get: assembleStyles
});
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(156)(module)));
/***/ }),
/* 88 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
@@ -15008,79 +15083,6 @@ function fromByteArray (uint8) {
}
/***/ }),
/* 88 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
/* WEBPACK VAR INJECTION */(function(module) {
function assembleStyles () {
var styles = {
modifiers: {
reset: [0, 0],
bold: [1, 22], // 21 isn't widely supported and 22 does the same thing
dim: [2, 22],
italic: [3, 23],
underline: [4, 24],
inverse: [7, 27],
hidden: [8, 28],
strikethrough: [9, 29]
},
colors: {
black: [30, 39],
red: [31, 39],
green: [32, 39],
yellow: [33, 39],
blue: [34, 39],
magenta: [35, 39],
cyan: [36, 39],
white: [37, 39],
gray: [90, 39]
},
bgColors: {
bgBlack: [40, 49],
bgRed: [41, 49],
bgGreen: [42, 49],
bgYellow: [43, 49],
bgBlue: [44, 49],
bgMagenta: [45, 49],
bgCyan: [46, 49],
bgWhite: [47, 49]
}
};
// fix humans
styles.colors.grey = styles.colors.gray;
Object.keys(styles).forEach(function (groupName) {
var group = styles[groupName];
Object.keys(group).forEach(function (styleName) {
var style = group[styleName];
styles[styleName] = group[styleName] = {
open: '\u001b[' + style[0] + 'm',
close: '\u001b[' + style[1] + 'm'
};
});
Object.defineProperty(styles, groupName, {
value: group,
enumerable: false
});
});
return styles;
}
Object.defineProperty(module, 'exports', {
enumerable: true,
get: assembleStyles
});
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(156)(module)));
/***/ }),
/* 89 */
/***/ (function(module, exports, __webpack_require__) {
@@ -24910,9 +24912,10 @@ function parseValueNodes(nodes) {
const commaGroupStack = [commaGroup];
for (let i = 0; i < nodes.length; ++i) {
if (nodes[i].type === "paren" && nodes[i].value === "(") {
const node = nodes[i];
if (node.type === "paren" && node.value === "(") {
parenGroup = {
open: nodes[i],
open: node,
close: null,
groups: [],
type: "paren_group"
@@ -24924,11 +24927,11 @@ function parseValueNodes(nodes) {
type: "comma_group"
};
commaGroupStack.push(commaGroup);
} else if (nodes[i].type === "paren" && nodes[i].value === ")") {
} else if (node.type === "paren" && node.value === ")") {
if (commaGroup.groups.length) {
parenGroup.groups.push(commaGroup);
}
parenGroup.close = nodes[i];
parenGroup.close = node;
if (commaGroupStack.length === 1) {
throw new Error("Unbalanced parenthesis");
@@ -24940,7 +24943,7 @@ function parseValueNodes(nodes) {
parenGroupStack.pop();
parenGroup = parenGroupStack[parenGroupStack.length - 1];
} else if (nodes[i].type === "comma") {
} else if (node.type === "comma") {
parenGroup.groups.push(commaGroup);
commaGroup = {
groups: [],
@@ -24948,7 +24951,7 @@ function parseValueNodes(nodes) {
};
commaGroupStack[commaGroupStack.length - 1] = commaGroup;
} else {
commaGroup.groups.push(nodes[i]);
commaGroup.groups.push(node);
}
}
if (commaGroup.groups.length > 0) {
@@ -25055,12 +25058,9 @@ function parseNestedCSS(node) {
try {
node.value = parseValue(node.value);
} catch (e) {
const line = +(e.toString().match(/line: ([0-9]+)/) || [1, 1])[1];
const column = +(e.toString().match(/column ([0-9]+)/) || [0, 0])[1];
throw createError(
"(postcss-values-parser) " + e.toString(),
node.source.start.line + line - 1,
node.source.start.column + column + node.prop.length
node.source
);
}
}
@@ -25079,7 +25079,7 @@ function parseWithParser(parser, text) {
if (typeof e.line !== "number") {
throw e;
}
throw createError("(postcss) " + e.name + " " + e.reason, e.line, e.column);
throw createError("(postcss) " + e.name + " " + e.reason, { start: e });
}
const prefixedResult = addTypePrefix(result, "css-");
const parsedResult = parseNestedCSS(prefixedResult);
+1 -1
View File
@@ -2231,7 +2231,7 @@ function createCommonjsModule(fn, module) {
}
var parserTypescript_1 = createCommonjsModule(function (module) {
"use strict";function _interopDefault(e){return e&&"object"==typeof e&&"default"in e?e.default:e}function createError$1(e,t,n){const r=new SyntaxError(e+" ("+t+":"+n+")");return r.loc={line:t,column:n},r}function commonjsRequire$$1(){throw new Error("Dynamic requires are not currently supported by rollup-plugin-commonjs")}function createCommonjsModule$$1(e,t){return t={exports:{}},e(t,t.exports),t.exports}function toVLQSigned(e){return e<0?1+(-e<<1):0+(e<<1)}function fromVLQSigned(e){var t=e>>1;return 1==(1&e)?-t:t}function ArraySet$1(){this._array=[],this._set=Object.create(null);}function generatedPositionAfter(e,t){var n=e.generatedLine,r=t.generatedLine,a=e.generatedColumn,i=t.generatedColumn;return r>n||r==n&&i>=a||util$4.compareByGeneratedPositionsInflated(e,t)<=0}function MappingList$1(){this._array=[],this._sorted=!0,this._last={generatedLine:-1,generatedColumn:0};}function SourceMapGenerator$1(e){e||(e={}),this._file=util.getArg(e,"file",null),this._sourceRoot=util.getArg(e,"sourceRoot",null),this._skipValidation=util.getArg(e,"skipValidation",!1),this._sources=new ArraySet,this._names=new ArraySet,this._mappings=new MappingList,this._sourcesContents=null;}function swap(e,t,n){var r=e[t];e[t]=e[n],e[n]=r;}function randomIntInRange(e,t){return Math.round(e+Math.random()*(t-e))}function doQuickSort(e,t,n,r){if(n<r){var a=n-1;swap(e,randomIntInRange(n,r),r);for(var i=e[r],o=n;o<r;o++)t(e[o],i)<=0&&swap(e,a+=1,o);swap(e,a+1,o);var s=a+1;doQuickSort(e,t,n,s-1),doQuickSort(e,t,s+1,r);}}function SourceMapConsumer$2(e){var t=e;return"string"==typeof e&&(t=JSON.parse(e.replace(/^\)\]\}'/,""))),null!=t.sections?new IndexedSourceMapConsumer(t):new BasicSourceMapConsumer(t)}function BasicSourceMapConsumer(e){var t=e;"string"==typeof e&&(t=JSON.parse(e.replace(/^\)\]\}'/,"")));var n=util$5.getArg(t,"version"),r=util$5.getArg(t,"sources"),a=util$5.getArg(t,"names",[]),i=util$5.getArg(t,"sourceRoot",null),o=util$5.getArg(t,"sourcesContent",null),s=util$5.getArg(t,"mappings"),c=util$5.getArg(t,"file",null);if(n!=this._version)throw new Error("Unsupported version: "+n);r=r.map(String).map(util$5.normalize).map(function(e){return i&&util$5.isAbsolute(i)&&util$5.isAbsolute(e)?util$5.relative(i,e):e}),this._names=ArraySet$2.fromArray(a.map(String),!0),this._sources=ArraySet$2.fromArray(r,!0),this.sourceRoot=i,this.sourcesContent=o,this._mappings=s,this.file=c;}function Mapping(){this.generatedLine=0,this.generatedColumn=0,this.source=null,this.originalLine=null,this.originalColumn=null,this.name=null;}function IndexedSourceMapConsumer(e){var t=e;"string"==typeof e&&(t=JSON.parse(e.replace(/^\)\]\}'/,"")));var n=util$5.getArg(t,"version"),r=util$5.getArg(t,"sections");if(n!=this._version)throw new Error("Unsupported version: "+n);this._sources=new ArraySet$2,this._names=new ArraySet$2;var a={line:-1,column:0};this._sections=r.map(function(e){if(e.url)throw new Error("Support for url field in sections not implemented.");var t=util$5.getArg(e,"offset"),n=util$5.getArg(t,"line"),r=util$5.getArg(t,"column");if(n<a.line||n===a.line&&r<a.column)throw new Error("Section offsets must be ordered and non-overlapping.");return a=t,{generatedOffset:{generatedLine:n+1,generatedColumn:r+1},consumer:new SourceMapConsumer$2(util$5.getArg(e,"map"))}});}function SourceNode$1(e,t,n,r,a){this.children=[],this.sourceContents={},this.line=null==e?null:e,this.column=null==t?null:t,this.source=null==n?null:n,this.name=null==a?null:a,this[isSourceNode]=!0,null!=r&&this.add(r);}function isInBrowser(){return"browser"===environment||"node"!==environment&&("undefined"!=typeof window&&"function"==typeof XMLHttpRequest&&!(window.require&&window.module&&window.process&&"renderer"===window.process.type))}function hasGlobalProcessEventEmitter(){return"object"==typeof process&&null!==process&&"function"==typeof process.on}function handlerExec(e){return function(t){for(var n=0;n<e.length;n++){var r=e[n](t);if(r)return r}return null}}function supportRelativeURL(e,t){if(!e)return t;var n=path$1.dirname(e),r=/^\w+:\/\/[^\/]*/.exec(n),a=r?r[0]:"";return a+path$1.resolve(n.slice(a.length),t)}function retrieveSourceMapURL(e){var t;if(isInBrowser())try{var n=new XMLHttpRequest;n.open("GET",e,!1),n.send(null),t=4===n.readyState?n.responseText:null;var r=n.getResponseHeader("SourceMap")||n.getResponseHeader("X-SourceMap");if(r)return r}catch(e){}t=retrieveFile(e);for(var a,i,o=/(?:\/\/[@#][ \t]+sourceMappingURL=([^\s'"]+?)[ \t]*$)|(?:\/\*[@#][ \t]+sourceMappingURL=([^\*]+?)[ \t]*(?:\*\/)[ \t]*$)/gm;i=o.exec(t);)a=i;return a?a[1]:null}function mapSourcePosition(e){var t=sourceMapCache[e.source];if(!t){var n=retrieveSourceMap(e.source);n?(t=sourceMapCache[e.source]={url:n.url,map:new SourceMapConsumer(n.map)}).map.sourcesContent&&t.map.sources.forEach(function(e,n){var r=t.map.sourcesContent[n];if(r){var a=supportRelativeURL(t.url,e);fileContentsCache[a]=r;}}):t=sourceMapCache[e.source]={url:null,map:null};}if(t&&t.map){var r=t.map.originalPositionFor(e);if(null!=Line truncated
"use strict";function _interopDefault(e){return e&&"object"==typeof e&&"default"in e?e.default:e}function createError$1(e,t){const n=new SyntaxError(e+" ("+t.start.line+":"+t.start.column+")");return n.loc=t,n}function includeShebang$1(e,t){if(!e.startsWith("#!"))return;const n=e.indexOf("\n"),r={type:"Line",value:e.slice(2,n),range:[0,n],loc:{source:null,start:{line:1,column:0},end:{line:1,column:n}}};t.comments=[r].concat(t.comments);}function commonjsRequire$$1(){throw new Error("Dynamic requires are not currently supported by rollup-plugin-commonjs")}function createCommonjsModule$$1(e,t){return t={exports:{}},e(t,t.exports),t.exports}function toVLQSigned(e){return e<0?1+(-e<<1):0+(e<<1)}function fromVLQSigned(e){var t=e>>1;return 1==(1&e)?-t:t}function ArraySet$1(){this._array=[],this._set=Object.create(null);}function generatedPositionAfter(e,t){var n=e.generatedLine,r=t.generatedLine,a=e.generatedColumn,i=t.generatedColumn;return r>n||r==n&&i>=a||util$4.compareByGeneratedPositionsInflated(e,t)<=0}function MappingList$1(){this._array=[],this._sorted=!0,this._last={generatedLine:-1,generatedColumn:0};}function SourceMapGenerator$1(e){e||(e={}),this._file=util.getArg(e,"file",null),this._sourceRoot=util.getArg(e,"sourceRoot",null),this._skipValidation=util.getArg(e,"skipValidation",!1),this._sources=new ArraySet,this._names=new ArraySet,this._mappings=new MappingList,this._sourcesContents=null;}function swap(e,t,n){var r=e[t];e[t]=e[n],e[n]=r;}function randomIntInRange(e,t){return Math.round(e+Math.random()*(t-e))}function doQuickSort(e,t,n,r){if(n<r){var a=n-1;swap(e,randomIntInRange(n,r),r);for(var i=e[r],o=n;o<r;o++)t(e[o],i)<=0&&swap(e,a+=1,o);swap(e,a+1,o);var s=a+1;doQuickSort(e,t,n,s-1),doQuickSort(e,t,s+1,r);}}function SourceMapConsumer$2(e){var t=e;return"string"==typeof e&&(t=JSON.parse(e.replace(/^\)\]\}'/,""))),null!=t.sections?new IndexedSourceMapConsumer(t):new BasicSourceMapConsumer(t)}function BasicSourceMapConsumer(e){var t=e;"string"==typeof e&&(t=JSON.parse(e.replace(/^\)\]\}'/,"")));var n=util$5.getArg(t,"version"),r=util$5.getArg(t,"sources"),a=util$5.getArg(t,"names",[]),i=util$5.getArg(t,"sourceRoot",null),o=util$5.getArg(t,"sourcesContent",null),s=util$5.getArg(t,"mappings"),c=util$5.getArg(t,"file",null);if(n!=this._version)throw new Error("Unsupported version: "+n);r=r.map(String).map(util$5.normalize).map(function(e){return i&&util$5.isAbsolute(i)&&util$5.isAbsolute(e)?util$5.relative(i,e):e}),this._names=ArraySet$2.fromArray(a.map(String),!0),this._sources=ArraySet$2.fromArray(r,!0),this.sourceRoot=i,this.sourcesContent=o,this._mappings=s,this.file=c;}function Mapping(){this.generatedLine=0,this.generatedColumn=0,this.source=null,this.originalLine=null,this.originalColumn=null,this.name=null;}function IndexedSourceMapConsumer(e){var t=e;"string"==typeof e&&(t=JSON.parse(e.replace(/^\)\]\}'/,"")));var n=util$5.getArg(t,"version"),r=util$5.getArg(t,"sections");if(n!=this._version)throw new Error("Unsupported version: "+n);this._sources=new ArraySet$2,this._names=new ArraySet$2;var a={line:-1,column:0};this._sections=r.map(function(e){if(e.url)throw new Error("Support for url field in sections not implemented.");var t=util$5.getArg(e,"offset"),n=util$5.getArg(t,"line"),r=util$5.getArg(t,"column");if(n<a.line||n===a.line&&r<a.column)throw new Error("Section offsets must be ordered and non-overlapping.");return a=t,{generatedOffset:{generatedLine:n+1,generatedColumn:r+1},consumer:new SourceMapConsumer$2(util$5.getArg(e,"map"))}});}function SourceNode$1(e,t,n,r,a){this.children=[],this.sourceContents={},this.line=null==e?null:e,this.column=null==t?null:t,this.source=null==n?null:n,this.name=null==a?null:a,this[isSourceNode]=!0,null!=r&&this.add(r);}function isInBrowser(){return"browser"===environment||"node"!==environment&&("undefined"!=typeof window&&"function"==typeof XMLHttpRequest&&!(window.require&&window.module&&window.process&&"renderer"===window.process.type))}function hasGlobalProcessEventEmitter(){return"object"==typeof process&&null!==process&&"function"==typeof process.on}function handlerExec(e){return function(t){for(var n=0;n<e.length;n++){var r=e[n](t);if(r)return r}return null}}function supportRelativeURL(e,t){if(!e)return t;var n=path$1.dirname(e),r=/^\w+:\/\/[^\/]*/.exec(n),a=r?r[0]:"";return a+path$1.resolve(n.slice(a.length),t)}function retrieveSourceMapURL(e){var t;if(isInBrowser())try{var n=new XMLHttpRequest;n.open("GET",e,!1),n.send(null),t=4===n.readyState?n.responseText:null;var r=n.getResponseHeader("SourceMap")||n.getResponseHeader("X-SourceMap");if(r)return r}catch(e){}t=retrieveFile(e);for(var a,i,o=/(?:\/\/[@#][ \t]+sourceMappingURL=([^\s'"]+?)[ \t]*$)|(?:\/\*[@#][ \t]+sourceMappingURL=([^\*]+?)[ \t]*(?:\*\/)[ \t]*$)/gm;i=o.exec(t);)a=i;return a?a[1]:null}function mapSourcePosition(e){var t=sourceMapCache[e.source];if(!t){var n=retrieveSourceMap(e.source);n?(t=sourceMapCache[e.source]={url:n.url,map:new SourceMapConsumer(n.map)}).map.sourcesContent&&tLine truncated
});
var parserTypescript = unwrapExports(parserTypescript_1);
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "prettier",
"version": "1.4.0",
"version": "1.4.1",
"description": "Prettier is an opinionated JavaScript formatter",
"bin": {
"prettier": "./bin/prettier.js"
+5 -2
View File
@@ -4,7 +4,7 @@ cd "$(dirname "$0")";
cd ../..;
rm -Rf dist/
rm docs/*.js
rm -f docs/*.js
echo 'The warning about eval being strongly discouraged is normal.'
@@ -51,7 +51,10 @@ node_modules/.bin/rollup -c scripts/build/rollup.docs.config.js --environment fi
echo 'Bundling docs postcss...';
node_modules/.bin/rollup -c scripts/build/rollup.docs.config.js --environment filepath:src/parser-postcss.js
## --- Remove eval ---
## --- Misc ---
echo 'Remove eval'
sed -i '' -e 's/eval("require")/require/g' dist/index.js dist/bin/prettier.js
echo 'Copy package.json'
cp package.json dist/