@modern-js/plugin-module-polyfill 2.21.1 → 2.22.0

Sign up to get free protection for your applications and to get access to all the features.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,24 @@
1
1
  # @modern-js/plugin-module-polyfill
2
2
 
3
+ ## 2.22.0
4
+
5
+ ### Patch Changes
6
+
7
+ - 3d48836: chore(deps): fix all missing peer dependencies
8
+
9
+ chore(deps): 修复缺少的 peer dependencies
10
+
11
+ - 5cbe8b5: fix: unable parsing within a ts ambient context, and set plugin options optional
12
+ fix: 关闭在 ts 环境中的解析,并将插件参数设为可选
13
+ - ad49140: chore: adjust output and package.json fields
14
+ chore: 调整包的产物格式以及 packgae.json 里的字段
15
+ - e2913dd: chore: update module plugin docs and readme
16
+ chore: 更新模块插件的文档和 readme
17
+ - Updated dependencies [d19dc11]
18
+ - Updated dependencies [c890980]
19
+ - Updated dependencies [4b7488c]
20
+ - @modern-js/module-tools@2.22.0
21
+
3
22
  ## 2.21.1
4
23
 
5
24
  ### Patch Changes
package/README.md CHANGED
@@ -9,14 +9,18 @@ A Library author don't want to "pollute" the global scope with the polyfills you
9
9
  ## Usage
10
10
 
11
11
  ```ts
12
- import { defineConfig } from '@modern-js/module-tools';
13
- import { ModulePolyfillPlugin } from '@modern-js/plugin-module-polyfill';
12
+ import moduleTools, { defineConfig } from '@modern-js/module-tools';
13
+ import { modulePluginPolyfill } from '@modern-js/plugin-module-polyfill';
14
+
14
15
  export default defineConfig({
15
- plugins: [ModulePolyfillPlugin({
16
- targets: {
17
- ios: '9';
18
- }
19
- })],
16
+ plugins: [
17
+ moduleTools(),
18
+ modulePluginPolyfill({
19
+ targets: {
20
+ ios: '9';
21
+ }
22
+ })
23
+ ],
20
24
  });
21
25
  ```
22
26
 
package/dist/index.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import { CliPlugin, ModuleTools } from '@modern-js/module-tools';
2
2
 
3
- declare const ModulePolyfillPlugin: (options: {
3
+ declare const ModulePolyfillPlugin: (options?: {
4
4
  targets?: Record<string, string> | string;
5
5
  }) => CliPlugin<ModuleTools>;
6
6
 
7
- export { ModulePolyfillPlugin };
7
+ export { ModulePolyfillPlugin, ModulePolyfillPlugin as modulePluginPolyfill };
package/dist/index.js CHANGED
@@ -19,7 +19,8 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
19
19
  // src/index.ts
20
20
  var src_exports = {};
21
21
  __export(src_exports, {
22
- ModulePolyfillPlugin: () => ModulePolyfillPlugin
22
+ ModulePolyfillPlugin: () => ModulePolyfillPlugin,
23
+ modulePluginPolyfill: () => ModulePolyfillPlugin
23
24
  });
24
25
  module.exports = __toCommonJS(src_exports);
25
26
  var import_libuild_plugin_babel = require("@modern-js/libuild-plugin-babel");
@@ -29,16 +30,13 @@ var ModulePolyfillPlugin = (options) => ({
29
30
  modifyLibuild(config) {
30
31
  var _a;
31
32
  const plugins = [
32
- [
33
- require("@babel/plugin-syntax-typescript"),
34
- { isTSX: true, dts: true }
35
- ],
33
+ [require("@babel/plugin-syntax-typescript"), { isTSX: true }],
36
34
  [require("@babel/plugin-syntax-jsx")],
37
35
  [
38
36
  require("babel-plugin-polyfill-corejs3"),
39
37
  {
40
38
  method: "usage-pure",
41
- targets: options.targets
39
+ targets: options == null ? void 0 : options.targets
42
40
  }
43
41
  ]
44
42
  ];
@@ -53,7 +51,8 @@ var ModulePolyfillPlugin = (options) => ({
53
51
  });
54
52
  // Annotate the CommonJS export names for ESM import in node:
55
53
  0 && (module.exports = {
56
- ModulePolyfillPlugin
54
+ ModulePolyfillPlugin,
55
+ modulePluginPolyfill
57
56
  });
58
57
 
59
58
  //# sourceMappingURL=index.js.map
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,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"]}
1
+ {"version":3,"mappings":";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,kCAA4B;AAGrB,IAAM,uBAAuB,CAAC,aAEN;AAAA,EAC7B,MAAM;AAAA,EACN,OAAO,OAAO;AAAA,IACZ,cAAc,QAAQ;AAT1B;AAUM,YAAM,UAAU;AAAA,QACd,CAAC,QAAQ,iCAAiC,GAAG,EAAE,OAAO,KAAK,CAAC;AAAA,QAC5D,CAAC,QAAQ,0BAA0B,CAAC;AAAA,QACpC;AAAA,UACE,QAAQ,+BAA+B;AAAA,UACvC;AAAA,YACE,QAAQ;AAAA,YACR,SAAS,mCAAS;AAAA,UACpB;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\n// deprecated named export\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 [require('@babel/plugin-syntax-typescript'), { isTSX: true }],\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\n// right named export\nexport { ModulePolyfillPlugin as modulePluginPolyfill };\n"]}
package/package.json CHANGED
@@ -15,26 +15,27 @@
15
15
  "modern",
16
16
  "modern.js"
17
17
  ],
18
- "version": "2.21.1",
19
- "types": "./dist/types/index.d.ts",
18
+ "version": "2.22.0",
19
+ "types": "./dist/index.d.ts",
20
20
  "main": "./dist/index.js",
21
21
  "devDependencies": {
22
22
  "@types/jest": "^29",
23
23
  "@types/node": "^14",
24
24
  "typescript": "^5",
25
25
  "jest": "^29",
26
- "@scripts/build": "2.21.1",
27
- "@scripts/jest-config": "2.21.1",
28
- "@modern-js/module-tools": "2.21.1"
26
+ "@scripts/build": "2.22.0",
27
+ "@scripts/jest-config": "2.22.0",
28
+ "@modern-js/module-tools": "2.22.0"
29
29
  },
30
30
  "peerDependencies": {
31
- "@modern-js/module-tools": "^2.21.1",
31
+ "@modern-js/module-tools": "^2.22.0",
32
32
  "core-js-pure": "^3.25.0"
33
33
  },
34
34
  "dependencies": {
35
- "@modern-js/libuild-plugin-babel": "0.7.1",
35
+ "@babel/core": "^7.21.8",
36
36
  "@babel/plugin-syntax-typescript": "7.21.4",
37
37
  "@babel/plugin-syntax-jsx": "7.21.4",
38
+ "@modern-js/libuild-plugin-babel": "0.7.1",
38
39
  "babel-plugin-polyfill-corejs3": "0.5.2"
39
40
  },
40
41
  "sideEffects": false,