Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bump babel-parser #4910

Merged
merged 6 commits into from Aug 3, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 4 additions & 4 deletions package.json
Expand Up @@ -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",
Expand Down Expand Up @@ -64,9 +64,9 @@
"yaml-unist-parser": "1.0.0-rc.2"
},
"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",
Expand Down
Expand Up @@ -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 }) => ({
Expand All @@ -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";
Expand Down
2 changes: 1 addition & 1 deletion scripts/build/build.js
Expand Up @@ -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 "));
Expand Down
5 changes: 4 additions & 1 deletion scripts/build/config.js
Expand Up @@ -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",
Expand Down
2 changes: 1 addition & 1 deletion src/language-js/parser-babylon.js
Expand Up @@ -32,7 +32,7 @@ function parse(text, parsers, opts) {
"optionalCatchBinding",
"optionalChaining",
"classPrivateProperties",
"pipelineOperator",
["pipelineOperator", { proposal: "minimal" }],
"nullishCoalescingOperator",
"bigInt",
"throwExpressions"
Expand Down
8 changes: 8 additions & 0 deletions tests/flow_method/__snapshots__/jsfmt.spec.js.snap
Expand Up @@ -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 };
Expand All @@ -40,4 +44,8 @@ declare class X {
static deserialize: () => mixed;
}

interface I {
static(): number;
}

`;
2 changes: 1 addition & 1 deletion tests/flow_method/jsfmt.spec.js
@@ -1 +1 @@
run_spec(__dirname, ["flow"]);
run_spec(__dirname, ["flow", "babylon"]);
4 changes: 4 additions & 0 deletions tests/flow_method/method.js
Expand Up @@ -8,3 +8,7 @@ declare class X {
static deserialize(): mixed,
static deserialize: () => mixed,
}

interface I {
static(): number;
}