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

Babel 7 updates updates #1564

Merged
merged 3 commits into from
Jun 10, 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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 23 additions & 3 deletions lib/install/config/.babelrc
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,37 @@
"targets": {
"forceAllTransforms": true
},
"useBuiltIns": "usage"
"useBuiltIns": "entry"
}
]
],
"plugins": [
"@babel/plugin-transform-destructuring",
"@babel/plugin-syntax-dynamic-import",
"@babel/plugin-proposal-object-rest-spread",
[
"@babel/plugin-proposal-object-rest-spread",
{
"useBuiltIns": true
}
],
[
"@babel/plugin-transform-runtime",
{
"helpers": false,
"polyfill": false,
"regenerator": true
}
],
[
"@babel/plugin-transform-regenerator",
{
"async": false
}
],
[
"@babel/plugin-proposal-class-properties",
{
"spec": true
"loose": true
}
]
]
Expand Down
33 changes: 29 additions & 4 deletions lib/install/examples/react/.babelrc
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,43 @@
"targets": {
"forceAllTransforms": true
},
"useBuiltIns": "usage"
"useBuiltIns": "entry"
}
],
"@babel/preset-react"
[
"@babel/preset-react",
{
"useBuiltIns": true
}
]
],
"plugins": [
"@babel/plugin-transform-destructuring",
"@babel/plugin-syntax-dynamic-import",
"@babel/plugin-proposal-object-rest-spread",
[
"@babel/plugin-proposal-object-rest-spread",
{
"useBuiltIns": true
}
],
[
"@babel/plugin-transform-runtime",
{
"helpers": false,
"polyfill": false,
"regenerator": true
}
],
[
"@babel/plugin-transform-regenerator",
{
"async": false
}
],
[
"@babel/plugin-proposal-class-properties",
{
"spec": true
"loose": true
}
]
]
Expand Down
5 changes: 3 additions & 2 deletions lib/install/react.rb
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
require "webpacker/configuration"

babelrc = Rails.root.join(".babelrc")
babel_react_preset = ["@babel/preset-react", { "useBuiltIns": true }]

if File.exist?(babelrc)
react_babelrc = JSON.parse(File.read(babelrc))
react_babelrc["presets"] ||= []

unless react_babelrc["presets"].include?("react")
react_babelrc["presets"].push("@babel/preset-react")
unless react_babelrc["presets"].flatten.include?("@babel/preset-react")
react_babelrc["presets"].push(babel_react_preset)
say "Copying react preset to your .babelrc file"

File.open(babelrc, "w") do |f|
Expand Down
5 changes: 4 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,16 @@
"yarn": ">=0.25.2"
},
"dependencies": {
"@babel/cli": "^7.0.0-beta.49",
"@babel/core": "^7.0.0-beta.49",
"@babel/plugin-proposal-class-properties": "^7.0.0-beta.49",
"@babel/plugin-proposal-object-rest-spread": "^7.0.0-beta.49",
"@babel/plugin-syntax-dynamic-import": "^7.0.0-beta.49",
"@babel/plugin-transform-destructuring": "^7.0.0-beta.49",
"@babel/plugin-transform-regenerator": "^7.0.0-beta.49",
"@babel/plugin-transform-runtime": "^7.0.0-beta.49",
"@babel/polyfill": "^7.0.0-beta.49",
"@babel/preset-env": "^7.0.0-beta.49",
"@babel/runtime": "^7.0.0-beta.49",
"babel-core": "^7.0.0-bridge",
"babel-loader": "^8.0.0-beta",
"case-sensitive-paths-webpack-plugin": "^2.1.2",
Expand Down
51 changes: 19 additions & 32 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,6 @@
# yarn lockfile v1


"@babel/cli@^7.0.0-beta.49":
version "7.0.0-beta.49"
resolved "https://registry.yarnpkg.com/@babel/cli/-/cli-7.0.0-beta.49.tgz#c8c3135f7bc48428436faf5e3f274227a99ef2a8"
dependencies:
commander "^2.8.1"
convert-source-map "^1.1.0"
fs-readdir-recursive "^1.0.0"
glob "^7.0.0"
lodash "^4.17.5"
output-file-sync "^2.0.0"
slash "^1.0.0"
source-map "^0.5.0"
optionalDependencies:
chokidar "^2.0.3"

"@babel/code-frame@7.0.0-beta.49", "@babel/code-frame@^7.0.0-beta.35":
version "7.0.0-beta.49"
resolved "https://registry.yarnpkg.com/@babel/code-frame/-/code-frame-7.0.0-beta.49.tgz#becd805482734440c9d137e46d77340e64d7f51b"
Expand Down Expand Up @@ -328,7 +313,7 @@
dependencies:
"@babel/helper-plugin-utils" "7.0.0-beta.49"

"@babel/plugin-transform-destructuring@7.0.0-beta.49":
"@babel/plugin-transform-destructuring@7.0.0-beta.49", "@babel/plugin-transform-destructuring@^7.0.0-beta.49":
version "7.0.0-beta.49"
resolved "https://registry.yarnpkg.com/@babel/plugin-transform-destructuring/-/plugin-transform-destructuring-7.0.0-beta.49.tgz#4366392c9c82d1231056c1d0029438a60d362b82"
dependencies:
Expand Down Expand Up @@ -424,12 +409,19 @@
"@babel/helper-get-function-arity" "7.0.0-beta.49"
"@babel/helper-plugin-utils" "7.0.0-beta.49"

"@babel/plugin-transform-regenerator@7.0.0-beta.49":
"@babel/plugin-transform-regenerator@7.0.0-beta.49", "@babel/plugin-transform-regenerator@^7.0.0-beta.49":
version "7.0.0-beta.49"
resolved "https://registry.yarnpkg.com/@babel/plugin-transform-regenerator/-/plugin-transform-regenerator-7.0.0-beta.49.tgz#d4ed7967033f4f5b49363c203503899b8357cae2"
dependencies:
regenerator-transform "^0.12.3"

"@babel/plugin-transform-runtime@^7.0.0-beta.49":
version "7.0.0-beta.49"
resolved "https://registry.yarnpkg.com/@babel/plugin-transform-runtime/-/plugin-transform-runtime-7.0.0-beta.49.tgz#65a30ec0bc36f4249325dbc2438f97f563b41f1a"
dependencies:
"@babel/helper-module-imports" "7.0.0-beta.49"
"@babel/helper-plugin-utils" "7.0.0-beta.49"

"@babel/plugin-transform-shorthand-properties@7.0.0-beta.49":
version "7.0.0-beta.49"
resolved "https://registry.yarnpkg.com/@babel/plugin-transform-shorthand-properties/-/plugin-transform-shorthand-properties-7.0.0-beta.49.tgz#49f134dbde4f655834c21524e9e61a58d4e17900"
Expand Down Expand Up @@ -521,6 +513,13 @@
invariant "^2.2.2"
semver "^5.3.0"

"@babel/runtime@^7.0.0-beta.49":
version "7.0.0-beta.49"
resolved "https://registry.yarnpkg.com/@babel/runtime/-/runtime-7.0.0-beta.49.tgz#03b3bf07eb982072c8e851dd2ddd5110282e61bf"
dependencies:
core-js "^2.5.6"
regenerator-runtime "^0.11.1"

"@babel/template@7.0.0-beta.49":
version "7.0.0-beta.49"
resolved "https://registry.yarnpkg.com/@babel/template/-/template-7.0.0-beta.49.tgz#e38abe8217cb9793f461a5306d7ad745d83e1d27"
Expand Down Expand Up @@ -1476,7 +1475,7 @@ chardet@^0.4.0:
version "0.4.2"
resolved "https://registry.yarnpkg.com/chardet/-/chardet-0.4.2.tgz#b5473b33dc97c424e5d98dc87d55d4d8a29c8bf2"

chokidar@^2.0.2, chokidar@^2.0.3:
chokidar@^2.0.2:
version "2.0.3"
resolved "https://registry.yarnpkg.com/chokidar/-/chokidar-2.0.3.tgz#dcbd4f6cbb2a55b4799ba8a840ac527e5f4b1176"
dependencies:
Expand Down Expand Up @@ -1656,7 +1655,7 @@ combined-stream@1.0.6, combined-stream@^1.0.5, combined-stream@~1.0.5:
dependencies:
delayed-stream "~1.0.0"

commander@^2.11.0, commander@^2.8.1, commander@^2.9.0:
commander@^2.11.0, commander@^2.9.0:
version "2.15.1"
resolved "https://registry.yarnpkg.com/commander/-/commander-2.15.1.tgz#df46e867d0fc2aec66a34662b406a9ccafff5b0f"

Expand Down Expand Up @@ -2679,10 +2678,6 @@ fs-minipass@^1.2.5:
dependencies:
minipass "^2.2.1"

fs-readdir-recursive@^1.0.0:
version "1.1.0"
resolved "https://registry.yarnpkg.com/fs-readdir-recursive/-/fs-readdir-recursive-1.1.0.tgz#e32fc030a2ccee44a6b5371308da54be0b397d27"

fs-write-stream-atomic@^1.0.8:
version "1.0.10"
resolved "https://registry.yarnpkg.com/fs-write-stream-atomic/-/fs-write-stream-atomic-1.0.10.tgz#b47df53493ef911df75731e70a9ded0189db40c9"
Expand Down Expand Up @@ -3349,7 +3344,7 @@ is-path-inside@^1.0.0:
dependencies:
path-is-inside "^1.0.1"

is-plain-obj@^1.0.0, is-plain-obj@^1.1.0:
is-plain-obj@^1.0.0:
version "1.1.0"
resolved "https://registry.yarnpkg.com/is-plain-obj/-/is-plain-obj-1.1.0.tgz#71a50c8429dfca773c92a390a4a03b39fcd51d3e"

Expand Down Expand Up @@ -4662,14 +4657,6 @@ osenv@0, osenv@^0.1.4:
os-homedir "^1.0.0"
os-tmpdir "^1.0.0"

output-file-sync@^2.0.0:
version "2.0.1"
resolved "https://registry.yarnpkg.com/output-file-sync/-/output-file-sync-2.0.1.tgz#f53118282f5f553c2799541792b723a4c71430c0"
dependencies:
graceful-fs "^4.1.11"
is-plain-obj "^1.1.0"
mkdirp "^0.5.1"

p-finally@^1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/p-finally/-/p-finally-1.0.0.tgz#3fbcfb15b899a44123b34b6dcc18b724336a2cae"
Expand Down