Bump babel-parser (#4910)

master
Brian Ng 2018-08-02 22:19:21 -05:00 committed by GitHub
parent b6077e175e
commit 1597578b05
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 563 additions and 466 deletions

View File

@ -15,7 +15,7 @@
},
"dependencies": {
"@babel/code-frame": "7.0.0-beta.46",
"@babel/parser": "7.0.0-beta.49",
"@babel/parser": "7.0.0-beta.55",
"@glimmer/syntax": "0.30.3",
"camelcase": "4.1.0",
"chalk": "2.1.0",
@ -64,9 +64,9 @@
"yaml-unist-parser": "1.0.0-rc.3"
},
"devDependencies": {
"@babel/cli": "7.0.0-beta.49",
"@babel/core": "7.0.0-beta.49",
"@babel/preset-env": "7.0.0-beta.49",
"@babel/cli": "7.0.0-beta.55",
"@babel/core": "7.0.0-beta.55",
"@babel/preset-env": "7.0.0-beta.55",
"babel-loader": "8.0.0-beta.3",
"benchmark": "2.1.4",
"builtin-modules": "2.0.0",

View File

@ -3,9 +3,11 @@
//
// BEFORE:
// [__something__].includes(__something__)
// CONSTANT_CASE.includes(__something__)
//
// AFTER:
// [__something__].indexOf(__something__) !== -1
// CONSTANT_CASE.indexOf(__something__) !== -1
//
module.exports = ({ types: t }) => ({
@ -15,7 +17,9 @@ module.exports = ({ types: t }) => ({
const callee = node.callee;
if (
t.isMemberExpression(callee, { computed: false }) &&
t.isArrayExpression(callee.object) &&
(t.isArrayExpression(callee.object) ||
(t.isIdentifier(callee.object) &&
/^[A-Z_]+$/.test(callee.object.name))) &&
t.isIdentifier(callee.property, { name: "includes" })
) {
callee.property.name = "indexOf";

View File

@ -98,7 +98,7 @@ async function run(params) {
await execa("rm", ["-rf", ".cache"]);
}
const bundleCache = new Cache(".cache/", "v4");
const bundleCache = new Cache(".cache/", "v5");
await bundleCache.load();
console.log(chalk.inverse(" Building packages "));

View File

@ -24,7 +24,10 @@ const path = require("path");
const parsers = [
{
input: "src/language-js/parser-babylon.js",
target: "universal"
target: "universal",
babelPlugins: [
require.resolve("./babel-plugins/replace-array-includes-with-indexof")
]
},
{
input: "src/language-js/parser-flow.js",

View File

@ -32,7 +32,7 @@ function parse(text, parsers, opts) {
"optionalCatchBinding",
"optionalChaining",
"classPrivateProperties",
"pipelineOperator",
["pipelineOperator", { proposal: "minimal" }],
"nullishCoalescingOperator",
"bigInt",
"throwExpressions"

View File

@ -28,6 +28,10 @@ declare class X {
static deserialize(): mixed,
static deserialize: () => mixed,
}
interface I {
static(): number;
}
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
type T = { method: () => void };
type T = { method(): void };
@ -40,4 +44,8 @@ declare class X {
static deserialize: () => mixed;
}
interface I {
static(): number;
}
`;

View File

@ -1 +1 @@
run_spec(__dirname, ["flow"]);
run_spec(__dirname, ["flow", "babylon"]);

View File

@ -8,3 +8,7 @@ declare class X {
static deserialize(): mixed,
static deserialize: () => mixed,
}
interface I {
static(): number;
}

992
yarn.lock

File diff suppressed because it is too large Load Diff