Update tsep and account for AST differences (#2647)
parent
b77b1c82a7
commit
23e0e90779
|
@ -35,7 +35,7 @@
|
||||||
"postcss-values-parser": "git://github.com/shellscape/postcss-values-parser.git#5e351360479116f3fe309602cdd15b0a233bc29f",
|
"postcss-values-parser": "git://github.com/shellscape/postcss-values-parser.git#5e351360479116f3fe309602cdd15b0a233bc29f",
|
||||||
"strip-bom": "3.0.0",
|
"strip-bom": "3.0.0",
|
||||||
"typescript": "2.5.0-dev.20170617",
|
"typescript": "2.5.0-dev.20170617",
|
||||||
"typescript-eslint-parser": "git://github.com/eslint/typescript-eslint-parser.git#65b019ba9a10475af30e664ce38e550c21acdedd"
|
"typescript-eslint-parser": "git://github.com/eslint/typescript-eslint-parser.git#01c34f44e7bb3b8a1ec3d28433a6e0c9b2901d3c"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"babel-cli": "6.24.1",
|
"babel-cli": "6.24.1",
|
||||||
|
|
|
@ -612,7 +612,7 @@ function genericPrintNoParens(path, options, print, args) {
|
||||||
}
|
}
|
||||||
|
|
||||||
return path.call(print, "id");
|
return path.call(print, "id");
|
||||||
case "TSExportAssigment":
|
case "TSExportAssignment":
|
||||||
return concat(["export = ", path.call(print, "expression"), semi]);
|
return concat(["export = ", path.call(print, "expression"), semi]);
|
||||||
case "ExportDefaultDeclaration":
|
case "ExportDefaultDeclaration":
|
||||||
case "ExportNamedDeclaration":
|
case "ExportNamedDeclaration":
|
||||||
|
@ -2624,22 +2624,25 @@ function genericPrintNoParens(path, options, print, args) {
|
||||||
return concat(["require(", path.call(print, "expression"), ")"]);
|
return concat(["require(", path.call(print, "expression"), ")"]);
|
||||||
case "TSModuleDeclaration": {
|
case "TSModuleDeclaration": {
|
||||||
const parent = path.getParentNode();
|
const parent = path.getParentNode();
|
||||||
const isExternalModule = isLiteral(n.name);
|
const isExternalModule = isLiteral(n.id);
|
||||||
const parentIsDeclaration = parent.type === "TSModuleDeclaration";
|
const parentIsDeclaration = parent.type === "TSModuleDeclaration";
|
||||||
const bodyIsDeclaration = n.body && n.body.type === "TSModuleDeclaration";
|
const bodyIsDeclaration = n.body && n.body.type === "TSModuleDeclaration";
|
||||||
|
|
||||||
if (parentIsDeclaration) {
|
if (parentIsDeclaration) {
|
||||||
parts.push(".");
|
parts.push(".");
|
||||||
} else {
|
} else {
|
||||||
|
if (n.declare === true) {
|
||||||
|
parts.push("declare ");
|
||||||
|
}
|
||||||
parts.push(printTypeScriptModifiers(path, options, print));
|
parts.push(printTypeScriptModifiers(path, options, print));
|
||||||
|
|
||||||
// Global declaration looks like this:
|
// Global declaration looks like this:
|
||||||
// (declare)? global { ... }
|
// (declare)? global { ... }
|
||||||
const isGlobalDeclaration =
|
const isGlobalDeclaration =
|
||||||
n.name.type === "Identifier" &&
|
n.id.type === "Identifier" &&
|
||||||
n.name.name === "global" &&
|
n.id.name === "global" &&
|
||||||
!/namespace|module/.test(
|
!/namespace|module/.test(
|
||||||
options.originalText.slice(util.locStart(n), util.locStart(n.name))
|
options.originalText.slice(util.locStart(n), util.locStart(n.id))
|
||||||
);
|
);
|
||||||
|
|
||||||
if (!isGlobalDeclaration) {
|
if (!isGlobalDeclaration) {
|
||||||
|
@ -2647,7 +2650,7 @@ function genericPrintNoParens(path, options, print, args) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
parts.push(path.call(print, "name"));
|
parts.push(path.call(print, "id"));
|
||||||
|
|
||||||
if (bodyIsDeclaration) {
|
if (bodyIsDeclaration) {
|
||||||
parts.push(path.call(print, "body"));
|
parts.push(path.call(print, "body"));
|
||||||
|
|
|
@ -3808,9 +3808,9 @@ typedarray@^0.0.6:
|
||||||
version "0.0.6"
|
version "0.0.6"
|
||||||
resolved "https://registry.yarnpkg.com/typedarray/-/typedarray-0.0.6.tgz#867ac74e3864187b1d3d47d996a78ec5c8830777"
|
resolved "https://registry.yarnpkg.com/typedarray/-/typedarray-0.0.6.tgz#867ac74e3864187b1d3d47d996a78ec5c8830777"
|
||||||
|
|
||||||
"typescript-eslint-parser@git://github.com/eslint/typescript-eslint-parser.git#65b019ba9a10475af30e664ce38e550c21acdedd":
|
"typescript-eslint-parser@git://github.com/eslint/typescript-eslint-parser.git#01c34f44e7bb3b8a1ec3d28433a6e0c9b2901d3c":
|
||||||
version "6.0.1"
|
version "6.0.1"
|
||||||
resolved "git://github.com/eslint/typescript-eslint-parser.git#65b019ba9a10475af30e664ce38e550c21acdedd"
|
resolved "git://github.com/eslint/typescript-eslint-parser.git#01c34f44e7bb3b8a1ec3d28433a6e0c9b2901d3c"
|
||||||
dependencies:
|
dependencies:
|
||||||
lodash.unescape "4.0.1"
|
lodash.unescape "4.0.1"
|
||||||
semver "5.3.0"
|
semver "5.3.0"
|
||||||
|
|
Loading…
Reference in New Issue