-
-
Notifications
You must be signed in to change notification settings - Fork 401
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Reuse babel options and specify polyfills for karma explicitely (#1456)
* reuse babel options * add envioronment requirements * manually serialize a collection, because with ['@babel/env', {loose: true}] the spread is doing a different thing * avoid requiring polyfill for IE11 * make it clear that adding new polyfills to JSS implicite dependencies is a breaking change * use specific polyfills * build * add function name polyfill for IE9 * add raf polyfill * revert changes to yarn.lock * add core-js and remove babel-polyfill from yarn * update snapshots after merge * prettier * for in doesn't work on on collections in safari 7,8 * update environments description * link environment-requirements * remove plugin-proposal-export-namespace-from
- Loading branch information
Showing
17 changed files
with
93 additions
and
92 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
exports.getBabelOptions = ({useESModules}) => ({ | ||
presets: [['@babel/env', {loose: true}], '@babel/flow', '@babel/react'], | ||
plugins: [ | ||
['@babel/proposal-class-properties', {loose: true}], | ||
['@babel/transform-runtime', {useESModules}], | ||
['dev-expression'] | ||
] | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
## JavaScript Environment Requirements | ||
|
||
We run our tests against a [number of real browsers](../browsers.json) including IE9, but we do NOT include polyfills we rely on in the build. It is up to the user to include polyfills depending on what environment they need to support. Here is a [full list of polyfills](../polyfills.js) you will need if you support ALL browsers JSS does. | ||
|
||
We consider adding a requirement to a new polyfill - a breaking change and it will require a major version incrementation. | ||
|
||
We recommend using [babel-preset-env](https://babeljs.io/docs/en/babel-preset-env), which is a smart preset that allows you to use the latest JavaScript without needing to micromanage which syntax transforms (and optionally, browser polyfills) are needed by your target environment(s). This both makes your life easier and JavaScript bundles smaller! |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
// react-jss, css-jss | ||
import 'core-js/features/map' | ||
import 'core-js/features/function/name' | ||
// jss, jss-plugin-cache | ||
import 'core-js/features/weak-map' | ||
// styled-system | ||
import 'core-js/features/set' | ||
import 'core-js/features/symbol' | ||
// react-jss, css-jss | ||
import 'core-js/features/object/assign' | ||
// tests | ||
import 'core-js/features/typed-array' | ||
import 'core-js/features/string/includes' | ||
// examples | ||
import 'raf/polyfill' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -307,14 +307,6 @@ | |
"@babel/helper-create-class-features-plugin" "^7.3.0" | ||
"@babel/helper-plugin-utils" "^7.0.0" | ||
|
||
"@babel/plugin-proposal-export-namespace-from@^7.2.0": | ||
version "7.2.0" | ||
resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-export-namespace-from/-/plugin-proposal-export-namespace-from-7.2.0.tgz#308fd4d04ff257fc3e4be090550840eeabad5dd9" | ||
integrity sha512-DZUxbHYxQ5fUFIkMEnh75ogEdBLPfL+mQUqrO2hNY2LGm+tqFnxE924+mhAcCOh/8za8AaZsWHbq6bBoS3TAzA== | ||
dependencies: | ||
"@babel/helper-plugin-utils" "^7.0.0" | ||
"@babel/plugin-syntax-export-namespace-from" "^7.2.0" | ||
|
||
"@babel/plugin-proposal-json-strings@^7.2.0": | ||
version "7.2.0" | ||
resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-json-strings/-/plugin-proposal-json-strings-7.2.0.tgz#568ecc446c6148ae6b267f02551130891e29f317" | ||
|
@@ -355,13 +347,6 @@ | |
dependencies: | ||
"@babel/helper-plugin-utils" "^7.0.0" | ||
|
||
"@babel/plugin-syntax-export-namespace-from@^7.2.0": | ||
version "7.2.0" | ||
resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-export-namespace-from/-/plugin-syntax-export-namespace-from-7.2.0.tgz#8d257838c6b3b779db52c0224443459bd27fb039" | ||
integrity sha512-1zGA3UNch6A+A11nIzBVEaE3DDJbjfB+eLIcf0GGOh/BJr/8NxL3546MGhV/r0RhH4xADFIEso39TKCfEMlsGA== | ||
dependencies: | ||
"@babel/helper-plugin-utils" "^7.0.0" | ||
|
||
"@babel/plugin-syntax-flow@^7.0.0": | ||
version "7.0.0" | ||
resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-flow/-/plugin-syntax-flow-7.0.0.tgz#70638aeaad9ee426bc532e51523cff8ff02f6f17" | ||
|
@@ -669,14 +654,6 @@ | |
"@babel/helper-regex" "^7.0.0" | ||
regexpu-core "^4.1.3" | ||
|
||
"@babel/polyfill@^7.2.5": | ||
version "7.2.5" | ||
resolved "https://registry.yarnpkg.com/@babel/polyfill/-/polyfill-7.2.5.tgz#6c54b964f71ad27edddc567d065e57e87ed7fa7d" | ||
integrity sha512-8Y/t3MWThtMLYr0YNC/Q76tqN1w30+b0uQMeFUYauG2UGTR19zyUtFrAzT23zNtBxPp+LbE5E/nwV/q/r3y6ug== | ||
dependencies: | ||
core-js "^2.5.7" | ||
regenerator-runtime "^0.12.0" | ||
|
||
"@babel/preset-env@^7.3.1": | ||
version "7.3.1" | ||
resolved "https://registry.yarnpkg.com/@babel/preset-env/-/preset-env-7.3.1.tgz#389e8ca6b17ae67aaf9a2111665030be923515db" | ||
|
@@ -3481,10 +3458,10 @@ core-js@^2.2.0: | |
resolved "https://registry.yarnpkg.com/core-js/-/core-js-2.5.7.tgz#f972608ff0cead68b841a16a932d0b183791814e" | ||
integrity sha512-RszJCAxg/PP6uzXVXL6BsxSXx/B05oJAQ2vkJRjyjrEcNVycaqOmNb5OTxZPE3xa5gwZduqza6L9JOCenh/Ecw== | ||
|
||
core-js@^2.5.7: | ||
version "2.6.1" | ||
resolved "https://registry.yarnpkg.com/core-js/-/core-js-2.6.1.tgz#87416ae817de957a3f249b3b5ca475d4aaed6042" | ||
integrity sha512-L72mmmEayPJBejKIWe2pYtGis5r0tQ5NaJekdhyXgeMQTpJoBsH0NL4ElY2LfSoV15xeQWKQ+XTTOZdyero5Xg== | ||
core-js@^3.9.1: | ||
version "3.9.1" | ||
resolved "https://registry.yarnpkg.com/core-js/-/core-js-3.9.1.tgz#cec8de593db8eb2a85ffb0dbdeb312cb6e5460ae" | ||
integrity sha512-gSjRvzkxQc1zjM/5paAmL4idJBFzuJoo+jDjF1tStYFMV2ERfD02HhahhCGXUyHxQRG4yFKVSdO6g62eoRMcDg== | ||
|
||
[email protected], core-util-is@~1.0.0: | ||
version "1.0.2" | ||
|