Skip to content
This repository has been archived by the owner on Feb 12, 2022. It is now read-only.

Commit

Permalink
Upgrade Prepack to Babel 7 (#2256)
Browse files Browse the repository at this point in the history
Summary:
Release notes: upgrades Prepack to use Babel 7.0.0-beta.53

This is a big PR that updates all of Prepack to Babel 7. Babylon is now `babel/parser` and pretty much all of the the previous Babel packages are now located in scoped packages. I had to make a bunch of changes around Jest/Flow/Webpack to get this all working. The build times of building Prepack itself seem considerably faster (easily twice as fast locally). I followed most of the Babel 6 -> 7 upgrade guide from the Babel site in terms of changing nodes and type definitions to match the new ones.
Pull Request resolved: #2256

Differential Revision: D8850583

Pulled By: trueadm

fbshipit-source-id: 2d2aaec25c6a1ccd1ec0c08c5e7e2a71f78ac2d8
  • Loading branch information
trueadm authored and facebook-github-bot committed Jul 14, 2018
1 parent 37d6924 commit e170c37
Show file tree
Hide file tree
Showing 256 changed files with 16,720 additions and 2,158 deletions.
17 changes: 0 additions & 17 deletions .babelrc

This file was deleted.

2 changes: 1 addition & 1 deletion .circleci/config.yml
Expand Up @@ -60,7 +60,7 @@ jobs:
yarn test-sourcemaps
yarn test-std-in
yarn test-residual
yarn test-test262 --expectedCounts 11945,5566,0 --statusFile ~/artifacts/test262-status.txt --timeout 120 --cpuScale 0.25 --verbose
yarn test-test262 --expectedCounts 11944,5566,0 --statusFile ~/artifacts/test262-status.txt --timeout 120 --cpuScale 0.25 --verbose
#yarn test-test262-new --statusFile ~/artifacts/test262-new-status.txt --timeout 120 --verbose
- store_artifacts:
path: ~/artifacts/
Expand Down
1 change: 1 addition & 0 deletions .eslintignore
Expand Up @@ -4,3 +4,4 @@ lib
underscore-with-tests.js
flow-typed
test/**/*.js
babel.config.js
3 changes: 2 additions & 1 deletion .flowconfig
@@ -1,5 +1,5 @@
[ignore]
.*/node_modules/babel.*
.*/node_modules/@babel/.*
.*/test262/.*
.*/node_modules/.*\.json
.*/lib/.*
Expand All @@ -8,6 +8,7 @@
.*/test/serializer/.*
.*/scripts/prettier.js
.*/tmp_website_build/.*
babel.config.js

[include]

Expand Down
50 changes: 50 additions & 0 deletions babel.config.js
@@ -0,0 +1,50 @@
/**
* Copyright (c) 2017-present, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*/

module.exports = function (api) {
api.cache(true);

const plugins = [
"@babel/plugin-syntax-flow",
"@babel/plugin-syntax-jsx",
"@babel/plugin-transform-flow-strip-types",
"@babel/plugin-transform-react-jsx",
"@babel/plugin-transform-react-display-name",
"@babel/plugin-proposal-class-properties",
"@babel/plugin-proposal-object-rest-spread",
];

// Webpack bundle
if (process.env.NODE_ENV === "production") {
return {
presets: [
["@babel/env", {
"targets": {
"ie": "10",
},
forceAllTransforms: true,
}],
"@babel/preset-flow",
],
plugins,
};
}
// Default
return {
presets: [
["@babel/env", {
"targets": {
"node": "6.10",
}
}],
"@babel/preset-flow",
],
plugins,
};
};
87 changes: 87 additions & 0 deletions flow-typed/npm/@babel/cli_vx.x.x.js
@@ -0,0 +1,87 @@
// flow-typed signature: 88e150a250102d8b47b86c4a28175644
// flow-typed version: <<STUB>>/@babel/cli_v^7.0.0-beta.53/flow_v0.76.0

/**
* This is an autogenerated libdef stub for:
*
* '@babel/cli'
*
* Fill this stub out by replacing all the `any` types.
*
* Once filled out, we encourage you to share your work with the
* community by sending a pull request to:
* https://github.com/flowtype/flow-typed
*/

declare module '@babel/cli' {
declare module.exports: any;
}

/**
* We include stubs for each file inside this npm package in case you need to
* require those files directly. Feel free to delete any files that aren't
* needed.
*/
declare module '@babel/cli/bin/babel-external-helpers' {
declare module.exports: any;
}

declare module '@babel/cli/bin/babel' {
declare module.exports: any;
}

declare module '@babel/cli/lib/babel-external-helpers' {
declare module.exports: any;
}

declare module '@babel/cli/lib/babel/dir' {
declare module.exports: any;
}

declare module '@babel/cli/lib/babel/file' {
declare module.exports: any;
}

declare module '@babel/cli/lib/babel/index' {
declare module.exports: any;
}

declare module '@babel/cli/lib/babel/options' {
declare module.exports: any;
}

declare module '@babel/cli/lib/babel/util' {
declare module.exports: any;
}

// Filename aliases
declare module '@babel/cli/bin/babel-external-helpers.js' {
declare module.exports: $Exports<'@babel/cli/bin/babel-external-helpers'>;
}
declare module '@babel/cli/bin/babel.js' {
declare module.exports: $Exports<'@babel/cli/bin/babel'>;
}
declare module '@babel/cli/index' {
declare module.exports: $Exports<'@babel/cli'>;
}
declare module '@babel/cli/index.js' {
declare module.exports: $Exports<'@babel/cli'>;
}
declare module '@babel/cli/lib/babel-external-helpers.js' {
declare module.exports: $Exports<'@babel/cli/lib/babel-external-helpers'>;
}
declare module '@babel/cli/lib/babel/dir.js' {
declare module.exports: $Exports<'@babel/cli/lib/babel/dir'>;
}
declare module '@babel/cli/lib/babel/file.js' {
declare module.exports: $Exports<'@babel/cli/lib/babel/file'>;
}
declare module '@babel/cli/lib/babel/index.js' {
declare module.exports: $Exports<'@babel/cli/lib/babel/index'>;
}
declare module '@babel/cli/lib/babel/options.js' {
declare module.exports: $Exports<'@babel/cli/lib/babel/options'>;
}
declare module '@babel/cli/lib/babel/util.js' {
declare module.exports: $Exports<'@babel/cli/lib/babel/util'>;
}

0 comments on commit e170c37

Please sign in to comment.