-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #325 from zloirock/v3
core-js@3
- Loading branch information
Showing
3,569 changed files
with
32,847 additions
and
102,544 deletions.
The diff you're trying to view is too large. We only load the first 3000 changed files.
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,23 @@ | ||
{ | ||
// use transforms which does not use ES5+ builtins | ||
plugins: [ | ||
['transform-es3-member-expression-literals'], | ||
['transform-es3-property-literals'], | ||
// use it instead of webpack es modules for support engines without descriptors | ||
['transform-es2015-modules-commonjs', { loose: true }], | ||
['transform-es2015-arrow-functions'], | ||
['transform-es2015-block-scoped-functions'], | ||
['transform-es2015-block-scoping'], | ||
['transform-es2015-classes', { loose: true }], | ||
['transform-es2015-computed-properties', { loose: true }], | ||
['transform-es2015-destructuring', { loose: true }], | ||
['transform-es2015-literals'], | ||
['transform-es2015-parameters'], | ||
['transform-es2015-shorthand-properties'], | ||
['transform-es2015-spread', { loose: true }], | ||
['transform-es2015-template-literals', { loose: true, spec: true }], | ||
['transform-exponentiation-operator'], | ||
['transform-for-of-as-array'], | ||
['check-es2015-constants'] | ||
] | ||
} |
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 |
---|---|---|
@@ -1,5 +1,5 @@ | ||
node_modules/** | ||
build/index.js | ||
client/** | ||
tests/** | ||
node_modules/ | ||
/packages/core-js-bundle/ | ||
/packages/core-js-pure/override/ | ||
/tests/bundles/ | ||
!**/.eslintrc.js |
Large diffs are not rendered by default.
Oops, something went wrong.
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 was deleted.
Oops, something went wrong.
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 |
---|---|---|
@@ -1,5 +1,6 @@ | ||
language: node_js | ||
node_js: | ||
- '10' | ||
- '8' | ||
- '6' | ||
|
||
|
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,48 @@ | ||
'use strict'; | ||
const resolve = require('path').resolve; | ||
|
||
module.exports = { | ||
options: { | ||
mode: 'none', | ||
module: { | ||
rules: [{ | ||
test: /\.js$/, | ||
exclude: /modules/, | ||
use: { | ||
loader: 'babel-loader', | ||
}, | ||
}], | ||
}, | ||
resolve: { | ||
alias: { | ||
'core-js': resolve(__dirname, './packages/core-js'), | ||
'core-js-pure': resolve(__dirname, './packages/core-js-pure'), | ||
}, | ||
}, | ||
node: { | ||
global: false, | ||
process: false, | ||
setImmediate: false, | ||
}, | ||
stats: false, | ||
output: { | ||
path: resolve(__dirname, './tests/bundles'), | ||
}, | ||
}, | ||
helpers: { | ||
entry: './tests/helpers/qunit-helpers.js', | ||
output: { filename: 'qunit-helpers.js' }, | ||
}, | ||
pure: { | ||
entry: './tests/pure/index.js', | ||
output: { filename: 'pure.js' }, | ||
}, | ||
tests: { | ||
entry: './tests/tests/index.js', | ||
output: { filename: 'tests.js' }, | ||
}, | ||
'promises-aplus-tests': { | ||
entry: 'promises-aplus-tests/lib/testFiles.js', | ||
output: { filename: 'promises-aplus.js' }, | ||
}, | ||
}; |
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,78 @@ | ||
# Contributing | ||
|
||
Contributions are always welcome. If you don't know what how you can help, you can check [issues](https://github.com/zloirock/core-js/issues) or ask @zloirock. | ||
|
||
## How to add a new polyfill | ||
|
||
- The polyfill implementation should be added to the [`packages/core-js/modules`](./packages/core-js/modules) directory. | ||
- If the implementation for the `pure` version should differ from the global version, it should be added to [`packages/core-js-pure/modules-pure`](./packages/core-js-pure/modules-pure) directory. The rest of `core-js-pure` will be copied from `core-js` package. | ||
- For export the polyfill, in almost all cases should be used `_export` helper. | ||
- The polyfill should be added to the [list of polyfills](./packages/core-js-builder/config.js) and to entry points, where it's required: [`packages/core-js/index.js`](./packages/core-js/index.js), directories [`packages/core-js/features`](./packages/core-js/features), [`packages/core-js/es`](./packages/core-js/es), [`packages/core-js/esnext`](./packages/core-js/esnext) and [`packages/core-js/web`](./packages/core-js/web). | ||
- Unit tests for the polyfill should be added to [`tests/tests`](./tests/tests) and [`tests/pure`](./tests/pure). | ||
- All new entry points should be added to [the test of entry points](./tests/commonjs). | ||
- Add it to [README.md](./README.md). | ||
|
||
## Style and standards | ||
|
||
Coding style should follow our [`.eslintrc`](./.eslintrc.js). You can test it by calling [`npm run eslint`](#testing). Different places have different syntax and standard library limitations: | ||
- Polyfill implementations should use only ES3 syntax and standard library. Polyfills should not use another polyfill from the global namespace. | ||
- In unit tests should be used modern syntax with our [minimalistic Babel config](./.babelrc). Unit tests for the `pure` version should not use any modern standard library features. | ||
- In building tools and tests, performed in Node.js, should be used only available in Node.js 4 syntax and standard library. | ||
|
||
File names should be in kebab-case. Name of files with polyfills should follow naming convention `namespace.subnamespase-where-required.feature-name`, for example, `esnext.promise.try`. Top level namespace could be `es` for stable ECMAScript features, `esnext` for ECMAScript proposals, `web` for another web standards and `core` for helpers. Internal `core-js` modules should use `_` prefix. | ||
|
||
## Testing | ||
|
||
Before testing, you should install dependencies: | ||
``` | ||
$ npm i | ||
``` | ||
You can run all tests by | ||
``` | ||
$ npm run test | ||
``` | ||
You can run parts of the test case separately: | ||
- Linting: | ||
``` | ||
$ npm run lint | ||
``` | ||
- Global version unit tests: | ||
``` | ||
$ npm run unit-tests | ||
``` | ||
- `pure` version unit tests: | ||
``` | ||
$ npm run unit-tests-pure | ||
``` | ||
- [Promises/A+ test case](https://github.com/promises-aplus/promises-tests): | ||
``` | ||
$ npm run promises-tests | ||
``` | ||
- [ECMAScript `Observable` test case](https://github.com/tc39/proposal-observable): | ||
``` | ||
$ npm run observables-tests | ||
``` | ||
- CommonJS entry points tests: | ||
``` | ||
$ npm run commonjs-tests | ||
``` | ||
If you want to run tests in a certain browser at first you should build packages and test bundles: | ||
``` | ||
$ npm run build | ||
``` | ||
- For running global version unit test case use this file: | ||
``` | ||
tests/tests.html | ||
``` | ||
- For running the `pure` version unit test case use this file: | ||
``` | ||
tests/pure.html | ||
``` | ||
- Before running [Promises/A+ test case](https://github.com/promises-aplus/promises-tests) in the browser you should bundle it: | ||
``` | ||
$ npm run bundle-promises-tests | ||
``` | ||
and after that use this file: | ||
``` | ||
tests/promises-aplus.html | ||
``` |
Oops, something went wrong.