@modern-js/plugin-module-polyfill 2.4.0 → 2.6.0
Sign up to get free protection for your applications and to get access to all the features.
- package/README.md +11 -4
- package/dist/index.js.map +1 -1
- package/package.json +7 -7
package/README.md
CHANGED
@@ -1,15 +1,14 @@
|
|
1
1
|
# @modern-js/plugin-module-polyfill
|
2
2
|
|
3
|
-
|
3
|
+
The polyfill plugin of Modern.js Module Tools.
|
4
4
|
|
5
5
|
A Library author don't want to "pollute" the global scope with the polyfills you are loading. This plugin injects imports to polyfills for unsupported features which are used in your code, without attaching the polyfills to the global scope but importing them as normal functions.
|
6
6
|
|
7
7
|
**Note: It will not transform syntax by targets**
|
8
8
|
|
9
|
-
|
10
9
|
## Usage
|
11
10
|
|
12
|
-
```
|
11
|
+
```ts
|
13
12
|
import { defineConfig } from '@modern-js/module-tools';
|
14
13
|
import { ModulePolyfillPlugin } from '@modern-js/plugin-module-polyfill';
|
15
14
|
export default defineConfig({
|
@@ -21,7 +20,15 @@ export default defineConfig({
|
|
21
20
|
});
|
22
21
|
```
|
23
22
|
|
23
|
+
## Documentation
|
24
|
+
|
25
|
+
- [English Documentation](https://modernjs.dev/module-tools/en)
|
26
|
+
- [中文文档](https://modernjs.dev/module-tools/)
|
24
27
|
|
25
28
|
## Contributing
|
26
29
|
|
27
|
-
|
30
|
+
Please read the [Contributing Guide](https://github.com/modern-js-dev/modern.js/blob/main/CONTRIBUTING.md).
|
31
|
+
|
32
|
+
## License
|
33
|
+
|
34
|
+
Modern.js is [MIT licensed](https://github.com/modern-js-dev/modern.js/blob/main/LICENSE).
|
package/dist/index.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"mappings":";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,kCAA4B;AAErB,IAAM,uBAAuB,CAAC,aAEN;AAAA,EAC7B,MAAM;AAAA,EACN,OAAO,OAAO;AAAA,IACZ,cAAc,QAAQ;AAR1B;AASM,YAAM,UAAU;AAAA,QACd;AAAA,UACE,QAAQ;AAAA,
|
1
|
+
{"version":3,"mappings":";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,kCAA4B;AAErB,IAAM,uBAAuB,CAAC,aAEN;AAAA,EAC7B,MAAM;AAAA,EACN,OAAO,OAAO;AAAA,IACZ,cAAc,QAAQ;AAR1B;AASM,YAAM,UAAU;AAAA,QACd;AAAA,UACE,QAAQ,iCAAiC;AAAA,UACzC,EAAE,OAAO,MAAM,KAAK,KAAK;AAAA,QAC3B;AAAA,QACA,CAAC,QAAQ,0BAA0B,CAAC;AAAA,QACpC;AAAA,UACE,QAAQ,+BAA+B;AAAA,UACvC;AAAA,YACE,QAAQ;AAAA,YACR,SAAS,QAAQ;AAAA,UACnB;AAAA,QACF;AAAA,MACF;AACA,mBAAO,YAAP,mBAAgB;AAAA,YACd,yCAAY;AAAA,UACV;AAAA,QACF,CAAC;AAAA;AAEH,aAAO;AAAA,IACT;AAAA,EACF;AACF;","names":[],"sources":["../src/index.ts"],"sourcesContent":["import type { CliPlugin, ModuleTools } from '@modern-js/module-tools';\nimport { babelPlugin } from '@modern-js/libuild-plugin-babel';\n\nexport const ModulePolyfillPlugin = (options: {\n targets?: Record<string, string> | string;\n}): CliPlugin<ModuleTools> => ({\n name: '@modern-js/plugin-module-polyfill',\n setup: () => ({\n modifyLibuild(config) {\n const plugins = [\n [\n require('@babel/plugin-syntax-typescript'),\n { isTSX: true, dts: true },\n ],\n [require('@babel/plugin-syntax-jsx')],\n [\n require('babel-plugin-polyfill-corejs3'),\n {\n method: 'usage-pure',\n targets: options.targets,\n },\n ],\n ];\n config.plugins?.push(\n babelPlugin({\n plugins,\n }),\n );\n return config;\n },\n }),\n});\n"]}
|
package/package.json
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
{
|
2
2
|
"name": "@modern-js/plugin-module-polyfill",
|
3
|
-
"description": "
|
4
|
-
"homepage": "https://modernjs.dev",
|
3
|
+
"description": "The polyfill plugin of Modern.js Module Tools.",
|
4
|
+
"homepage": "https://modernjs.dev/module-tools",
|
5
5
|
"bugs": "https://github.com/modern-js-dev/modern.js/issues",
|
6
6
|
"repository": "modern-js-dev/modern.js",
|
7
7
|
"license": "MIT",
|
@@ -11,7 +11,7 @@
|
|
11
11
|
"modern",
|
12
12
|
"modern.js"
|
13
13
|
],
|
14
|
-
"version": "2.
|
14
|
+
"version": "2.6.0",
|
15
15
|
"types": "./dist/types/index.d.ts",
|
16
16
|
"main": "./dist/index.js",
|
17
17
|
"devDependencies": {
|
@@ -19,12 +19,12 @@
|
|
19
19
|
"@types/node": "^14",
|
20
20
|
"typescript": "^4",
|
21
21
|
"jest": "^27",
|
22
|
-
"@scripts/build": "2.
|
23
|
-
"@scripts/jest-config": "2.
|
24
|
-
"@modern-js/module-tools": "2.
|
22
|
+
"@scripts/build": "2.6.0",
|
23
|
+
"@scripts/jest-config": "2.6.0",
|
24
|
+
"@modern-js/module-tools": "2.6.0"
|
25
25
|
},
|
26
26
|
"peerDependencies": {
|
27
|
-
"@modern-js/module-tools": "^2.
|
27
|
+
"@modern-js/module-tools": "^2.6.0",
|
28
28
|
"core-js-pure": "^3.25.0"
|
29
29
|
},
|
30
30
|
"dependencies": {
|