-
-
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.
move
core-js
bundle to a separate package
- Loading branch information
Showing
10 changed files
with
108 additions
and
10 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 |
---|---|---|
@@ -1,5 +1,5 @@ | ||
node_modules/ | ||
/packages/core-js/bundles/ | ||
/packages/core-js-bundle/ | ||
/packages/core-js-pure/override/ | ||
/tests/bundles/ | ||
!**/.eslintrc.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
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 |
---|---|---|
|
@@ -92,9 +92,9 @@ npm i core-js | |
// Include all polyfills | ||
require('core-js'); | ||
``` | ||
If you need already bundled version of `core-js`, use `core-js/bundles/core.js` or `core-js/bundles/core.min.js` from `npm` package. | ||
If you need already bundled version of `core-js`, use `core-js-bundle` `npm` package or a [version of this package from CDN](https://unpkg.com/core-js[email protected]) ([minified version](https://unpkg.com/core[email protected]/minified.js)). | ||
|
||
Warning: if you use `core-js` with the extension of native objects, require all needed `core-js` modules at the top of entry point of your application, otherwise, you can have conflicts. | ||
Warning: if you use `core-js` with the extension of native objects, load all `core-js` modules at the top of entry point of your application, otherwise, you can have conflicts. | ||
|
||
### CommonJS | ||
You can require only needed modules, like in examples in examples at the top of `README.md`. Available entry points for methods / constructors and namespaces: for example, `core-js/es/array` (`core-js-pure/es/array`) contains all [ES `Array` features](#ecmascript-array), `core-js/es` (`core-js-pure/es`) contains all ES features. | ||
|
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,5 @@ | ||
index.js | ||
minified.js | ||
minified.js,map | ||
*.log | ||
.* |
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,38 @@ | ||
# core-js | ||
|
||
Modular standard library for JavaScript. Includes polyfills for [ECMAScript 5, 2015, 2016, 2017](https://github.com/zloirock/core-js#ecmascript): [promises](https://github.com/zloirock/core-js#ecmascript-promise), [symbols](https://github.com/zloirock/core-js#ecmascript-symbol), [collections](https://github.com/zloirock/core-js#ecmascript-collections), iterators, [typed arrays](https://github.com/zloirock/core-js#ecmascript-typed-arrays), many other features, [ECMAScript proposals](https://github.com/zloirock/core-js#ecmascript-proposals), [some cross-platform WHATWG / W3C ECMAScript-related features and proposals](https://github.com/zloirock/core-js#web-standards) like [setImmediate](https://github.com/zloirock/core-js#setimmediate). You can load only required features or use it without global namespace pollution. | ||
|
||
[*Example*](http://goo.gl/a2xexl): | ||
```js | ||
import 'core-js'; // <- at the top of your entry point | ||
|
||
Array.from(new Set([1, 2, 3, 2, 1])); // => [1, 2, 3] | ||
[1, [2, 3], [4, [5]]].flatten(2); // => [1, 2, 3, 4, 5] | ||
Promise.resolve(32).then(x => console.log(x)); // => 32 | ||
``` | ||
|
||
*You can load only required features*: | ||
```js | ||
import 'core-js/features/array/from'; // <- at the top of your entry point | ||
import 'core-js/features/array/flatten'; // <- at the top of your entry point | ||
import 'core-js/features/set'; // <- at the top of your entry point | ||
import 'core-js/features/promise'; // <- at the top of your entry point | ||
|
||
Array.from(new Set([1, 2, 3, 2, 1])); // => [1, 2, 3] | ||
[1, [2, 3], [4, [5]]].flatten(2); // => [1, 2, 3, 4, 5] | ||
Promise.resolve(32).then(x => console.log(x)); // => 32 | ||
``` | ||
|
||
*Or use it without global namespace pollution*: | ||
```js | ||
import from from 'core-js-pure/features/array/from'; | ||
import flatten from 'core-js-pure/features/array/flatten'; | ||
import Set from 'core-js-pure/features/set'; | ||
import Promise from 'core-js-pure/features/promise'; | ||
|
||
from(new Set([1, 2, 3, 2, 1])); // => [1, 2, 3] | ||
flatten([1, [2, 3], [4, [5]]], 2); // => [1, 2, 3, 4, 5] | ||
Promise.resolve(32).then(x => console.log(x)); // => 32 | ||
``` | ||
|
||
**It's a bundled global version, for more info see [`core-js` documentation](https://github.com/zloirock/core-js/blob/v3/README.md).** |
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,40 @@ | ||
{ | ||
"name": "core-js-bundle", | ||
"description": "Standard library", | ||
"version": "3.0.0-alpha.1", | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/zloirock/core-js.git" | ||
}, | ||
"main": "index.js", | ||
"license": "MIT", | ||
"keywords": [ | ||
"ES3", | ||
"ES5", | ||
"ES6", | ||
"ES7", | ||
"ES2015", | ||
"ES2016", | ||
"ES2017", | ||
"ECMAScript 3", | ||
"ECMAScript 5", | ||
"ECMAScript 6", | ||
"ECMAScript 7", | ||
"ECMAScript 2015", | ||
"ECMAScript 2016", | ||
"ECMAScript 2017", | ||
"Harmony", | ||
"Strawman", | ||
"Map", | ||
"Set", | ||
"WeakMap", | ||
"WeakSet", | ||
"Promise", | ||
"Symbol", | ||
"TypedArray", | ||
"setImmediate", | ||
"Dict", | ||
"polyfill", | ||
"shim" | ||
] | ||
} |
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