Skip to content

Commit

Permalink
Use Babel plugins to fix Fragments issue (#186)
Browse files Browse the repository at this point in the history
* Use Babel plugins to fix Fragments issue

developit/microbundle#623

A known issue in TypeScript:
microsoft/TypeScript#20469

* Remove default mention. It's not accurate here
  • Loading branch information
mdespuits authored May 27, 2020
1 parent f006116 commit 913859e
Show file tree
Hide file tree
Showing 3 changed files with 111 additions and 3 deletions.
14 changes: 14 additions & 0 deletions .babelrc
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,19 @@
}
],
"@babel/preset-react"
],
"plugins": [
[
"@babel/plugin-transform-react-jsx",
{
"pragmaFrag": "React.Fragment"
}
],
[
"@babel/plugin-proposal-optional-chaining",
{
"loose": false
}
]
]
}
4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
"test": "cross-env CI=1 react-scripts test --env=jsdom",
"test:watch": "react-scripts test --env=jsdom",
"test:debug": "react-scripts --inspect-brk test --runInBand --no-cache",
"compile": "microbundle-crl --raw --format modern,cjs --no-compress --css-modules 'rvr-[local]-[sha256:hash:base64:3]' && mv dist/index.css dist/rover-ui.css",
"compile": "microbundle-crl --raw --format modern,cjs --no-compress --css-modules 'rvr-[local]__[hash:base64:3]' && mv dist/index.css dist/rover-ui.css",
"build": "yarn compile",
"start": "yarn compile --watch",
"generate-component": "yarn hygen component new",
Expand All @@ -71,6 +71,8 @@
},
"devDependencies": {
"@babel/core": "^7.9.6",
"@babel/plugin-proposal-optional-chaining": "^7.10.0",
"@babel/plugin-transform-react-jsx": "^7.9.4",
"@babel/preset-env": "^7.9.6",
"@babel/preset-react": "^7.9.4",
"@storybook/addon-a11y": "^5.3.18",
Expand Down
96 changes: 94 additions & 2 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,16 @@
semver "^5.4.1"
source-map "^0.5.0"

"@babel/generator@^7.10.0":
version "7.10.0"
resolved "https://registry.yarnpkg.com/@babel/generator/-/generator-7.10.0.tgz#a238837896edf35ee5fbfb074548d3256b4bc55d"
integrity sha512-ThoWCJHlgukbtCP79nAK4oLqZt5fVo70AHUni/y8Jotyg5rtJiG2FVl+iJjRNKIyl4hppqztLyAoEWcCvqyOFQ==
dependencies:
"@babel/types" "^7.10.0"
jsesc "^2.5.1"
lodash "^4.17.13"
source-map "^0.5.0"

"@babel/generator@^7.4.0", "@babel/generator@^7.9.0", "@babel/generator@^7.9.6":
version "7.9.6"
resolved "https://registry.yarnpkg.com/@babel/generator/-/generator-7.9.6.tgz#5408c82ac5de98cda0d77d8124e99fa1f2170a43"
Expand Down Expand Up @@ -122,6 +132,18 @@
levenary "^1.1.1"
semver "^5.5.0"

"@babel/helper-create-class-features-plugin@^7.10.0":
version "7.10.0"
resolved "https://registry.yarnpkg.com/@babel/helper-create-class-features-plugin/-/helper-create-class-features-plugin-7.10.0.tgz#3a2b7b86f6365ea4ac3837a49ec5791e65217944"
integrity sha512-n4tPJaI0iuLRayriXTQ8brP3fMA/fNmxpxswfNuhe4qXQbcCWzeAqm6SeR/KExIOcdCvOh/KkPQVgBsjcb0oqA==
dependencies:
"@babel/helper-function-name" "^7.9.5"
"@babel/helper-member-expression-to-functions" "^7.10.0"
"@babel/helper-optimise-call-expression" "^7.10.0"
"@babel/helper-plugin-utils" "^7.8.3"
"@babel/helper-replace-supers" "^7.10.0"
"@babel/helper-split-export-declaration" "^7.8.3"

"@babel/helper-create-class-features-plugin@^7.7.4", "@babel/helper-create-class-features-plugin@^7.8.3", "@babel/helper-create-class-features-plugin@^7.9.6":
version "7.9.6"
resolved "https://registry.yarnpkg.com/@babel/helper-create-class-features-plugin/-/helper-create-class-features-plugin-7.9.6.tgz#965c8b0a9f051801fd9d3b372ca0ccf200a90897"
Expand Down Expand Up @@ -183,6 +205,13 @@
dependencies:
"@babel/types" "^7.8.3"

"@babel/helper-member-expression-to-functions@^7.10.0":
version "7.10.0"
resolved "https://registry.yarnpkg.com/@babel/helper-member-expression-to-functions/-/helper-member-expression-to-functions-7.10.0.tgz#e8cf57470bfd1247f2b41aa621a527e952efa6f1"
integrity sha512-xKLTpbMkJcvwEsDaTfs9h0IlfUiBLPFfybxaPpPPsQDsZTRg+UKh+86oK7sctHF3OUiRQkb10oS9MXSqgyV6/g==
dependencies:
"@babel/types" "^7.10.0"

"@babel/helper-member-expression-to-functions@^7.8.3":
version "7.8.3"
resolved "https://registry.yarnpkg.com/@babel/helper-member-expression-to-functions/-/helper-member-expression-to-functions-7.8.3.tgz#659b710498ea6c1d9907e0c73f206eee7dadc24c"
Expand Down Expand Up @@ -210,6 +239,13 @@
"@babel/types" "^7.9.0"
lodash "^4.17.13"

"@babel/helper-optimise-call-expression@^7.10.0":
version "7.10.0"
resolved "https://registry.yarnpkg.com/@babel/helper-optimise-call-expression/-/helper-optimise-call-expression-7.10.0.tgz#6dcfb565842f43bed31b24f3e4277f18826e5e79"
integrity sha512-HgMd8QKA8wMJs5uK/DYKdyzJAEuGt1zyDp9wLMlMR6LitTQTHPUE+msC82ZsEDwq+U3/yHcIXIngRm9MS4IcIg==
dependencies:
"@babel/types" "^7.10.0"

"@babel/helper-optimise-call-expression@^7.8.3":
version "7.8.3"
resolved "https://registry.yarnpkg.com/@babel/helper-optimise-call-expression/-/helper-optimise-call-expression-7.8.3.tgz#7ed071813d09c75298ef4f208956006b6111ecb9"
Expand Down Expand Up @@ -240,6 +276,16 @@
"@babel/traverse" "^7.8.3"
"@babel/types" "^7.8.3"

"@babel/helper-replace-supers@^7.10.0":
version "7.10.0"
resolved "https://registry.yarnpkg.com/@babel/helper-replace-supers/-/helper-replace-supers-7.10.0.tgz#26bc22ee1a35450934d2e2a9b27de10a22fac9d6"
integrity sha512-erl4iVeiANf14JszXP7b69bSrz3e3+qW09pVvEmTWwzRQEOoyb1WFlYCA8d/VjVZGYW8+nGpLh7swf9CifH5wg==
dependencies:
"@babel/helper-member-expression-to-functions" "^7.10.0"
"@babel/helper-optimise-call-expression" "^7.10.0"
"@babel/traverse" "^7.10.0"
"@babel/types" "^7.10.0"

"@babel/helper-replace-supers@^7.8.3", "@babel/helper-replace-supers@^7.8.6", "@babel/helper-replace-supers@^7.9.6":
version "7.9.6"
resolved "https://registry.yarnpkg.com/@babel/helper-replace-supers/-/helper-replace-supers-7.9.6.tgz#03149d7e6a5586ab6764996cd31d6981a17e1444"
Expand Down Expand Up @@ -303,6 +349,11 @@
resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.9.6.tgz#3b1bbb30dabe600cd72db58720998376ff653bc7"
integrity sha512-AoeIEJn8vt+d/6+PXDRPaksYhnlbMIiejioBZvvMQsOjW/JYK6k/0dKnvvP3EhK5GfMBWDPtrxRtegWdAcdq9Q==

"@babel/parser@^7.10.0":
version "7.10.0"
resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.10.0.tgz#8eca3e71a73dd562c5222376b08253436bb4995b"
integrity sha512-fnDUl1Uy2gThM4IFVW4ISNHqr3cJrCsRkSCasFgx0XDO9JcttDS5ytyBc4Cu4X1+fjoo3IVvFbRD6TeFlHJlEQ==

"@babel/plugin-proposal-async-generator-functions@^7.8.3":
version "7.8.3"
resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-async-generator-functions/-/plugin-proposal-async-generator-functions-7.8.3.tgz#bad329c670b382589721b27540c7d288601c6e6f"
Expand All @@ -328,7 +379,7 @@
"@babel/helper-create-class-features-plugin" "^7.8.3"
"@babel/helper-plugin-utils" "^7.8.3"

"@babel/plugin-proposal-decorators@7.8.3", "@babel/plugin-proposal-decorators@^7.8.3":
"@babel/plugin-proposal-decorators@7.8.3":
version "7.8.3"
resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-decorators/-/plugin-proposal-decorators-7.8.3.tgz#2156860ab65c5abf068c3f67042184041066543e"
integrity sha512-e3RvdvS4qPJVTe288DlXjwKflpfy1hr0j5dz5WpIYYeP7vQZg2WfAEIp8k5/Lwis/m5REXEteIz6rrcDtXXG7w==
Expand All @@ -337,6 +388,15 @@
"@babel/helper-plugin-utils" "^7.8.3"
"@babel/plugin-syntax-decorators" "^7.8.3"

"@babel/plugin-proposal-decorators@^7.8.3":
version "7.10.0"
resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-decorators/-/plugin-proposal-decorators-7.10.0.tgz#aa1c82288d9af1f2a5bc759e5dffbca8f8d01ea1"
integrity sha512-PTlxQfx0fZjOYlLe+gAhpb6Lph3zr03lpzqnzI8bWtcxDo/98rhO2adxe87F7OHg1G65nXxQ9ChPvB/0A3qSAg==
dependencies:
"@babel/helper-create-class-features-plugin" "^7.10.0"
"@babel/helper-plugin-utils" "^7.8.3"
"@babel/plugin-syntax-decorators" "^7.8.3"

"@babel/plugin-proposal-dynamic-import@^7.8.3":
version "7.8.3"
resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-dynamic-import/-/plugin-proposal-dynamic-import-7.8.3.tgz#38c4fe555744826e97e2ae930b0fb4cc07e66054"
Expand Down Expand Up @@ -386,14 +446,22 @@
"@babel/helper-plugin-utils" "^7.8.3"
"@babel/plugin-syntax-optional-catch-binding" "^7.8.0"

"@babel/plugin-proposal-optional-chaining@7.9.0", "@babel/plugin-proposal-optional-chaining@^7.8.3", "@babel/plugin-proposal-optional-chaining@^7.9.0":
"@babel/plugin-proposal-optional-chaining@7.9.0", "@babel/plugin-proposal-optional-chaining@^7.9.0":
version "7.9.0"
resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-optional-chaining/-/plugin-proposal-optional-chaining-7.9.0.tgz#31db16b154c39d6b8a645292472b98394c292a58"
integrity sha512-NDn5tu3tcv4W30jNhmc2hyD5c56G6cXx4TesJubhxrJeCvuuMpttxr0OnNCqbZGhFjLrg+NIhxxC+BK5F6yS3w==
dependencies:
"@babel/helper-plugin-utils" "^7.8.3"
"@babel/plugin-syntax-optional-chaining" "^7.8.0"

"@babel/plugin-proposal-optional-chaining@^7.10.0", "@babel/plugin-proposal-optional-chaining@^7.8.3":
version "7.10.0"
resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-optional-chaining/-/plugin-proposal-optional-chaining-7.10.0.tgz#f9bdcd5cbf2e3037674903a45e56ed0cbaea1550"
integrity sha512-bn+9XT8Y6FJCO37ewj4E1gIirR35nDm+mGcqQV4dM3LKSVp3QTAU3f65Z0ld4y6jdfAlv2VKzCh4mezhRnl+6Q==
dependencies:
"@babel/helper-plugin-utils" "^7.8.3"
"@babel/plugin-syntax-optional-chaining" "^7.8.0"

"@babel/plugin-proposal-unicode-property-regex@^7.4.4", "@babel/plugin-proposal-unicode-property-regex@^7.8.3":
version "7.8.8"
resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-unicode-property-regex/-/plugin-proposal-unicode-property-regex-7.8.8.tgz#ee3a95e90cdc04fe8cd92ec3279fa017d68a0d1d"
Expand Down Expand Up @@ -1047,6 +1115,21 @@
globals "^11.1.0"
lodash "^4.17.13"

"@babel/traverse@^7.10.0":
version "7.10.0"
resolved "https://registry.yarnpkg.com/@babel/traverse/-/traverse-7.10.0.tgz#290935529881baf619398d94fd453838bef36740"
integrity sha512-NZsFleMaLF1zX3NxbtXI/JCs2RPOdpGru6UBdGsfhdsDsP+kFF+h2QQJnMJglxk0kc69YmMFs4A44OJY0tKo5g==
dependencies:
"@babel/code-frame" "^7.8.3"
"@babel/generator" "^7.10.0"
"@babel/helper-function-name" "^7.9.5"
"@babel/helper-split-export-declaration" "^7.8.3"
"@babel/parser" "^7.10.0"
"@babel/types" "^7.10.0"
debug "^4.1.0"
globals "^11.1.0"
lodash "^4.17.13"

"@babel/types@^7.0.0", "@babel/types@^7.3.0", "@babel/types@^7.4.0", "@babel/types@^7.4.4", "@babel/types@^7.7.0", "@babel/types@^7.8.3", "@babel/types@^7.8.6", "@babel/types@^7.9.0", "@babel/types@^7.9.5", "@babel/types@^7.9.6":
version "7.9.6"
resolved "https://registry.yarnpkg.com/@babel/types/-/types-7.9.6.tgz#2c5502b427251e9de1bd2dff95add646d95cc9f7"
Expand All @@ -1056,6 +1139,15 @@
lodash "^4.17.13"
to-fast-properties "^2.0.0"

"@babel/types@^7.10.0":
version "7.10.0"
resolved "https://registry.yarnpkg.com/@babel/types/-/types-7.10.0.tgz#d47d92249e42393a5723aad5319035ae411e3e38"
integrity sha512-t41W8yWFyQFPOAAvPvjyRhejcLGnJTA3iRpFcDbEKwVJ3UnHQePFzLk8GagTsucJlImyNwrGikGsYURrWbQG8w==
dependencies:
"@babel/helper-validator-identifier" "^7.9.5"
lodash "^4.17.13"
to-fast-properties "^2.0.0"

"@base2/pretty-print-object@1.0.0":
version "1.0.0"
resolved "https://registry.yarnpkg.com/@base2/pretty-print-object/-/pretty-print-object-1.0.0.tgz#860ce718b0b73f4009e153541faff2cb6b85d047"
Expand Down

0 comments on commit 913859e

Please sign in to comment.