@modern-js/plugin-module-polyfill 2.27.0 → 2.29.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +22 -0
- package/dist/index.d.ts +4 -6
- package/dist/index.js +32 -40
- package/package.json +6 -5
- package/dist/index.js.map +0 -1
    
        package/CHANGELOG.md
    CHANGED
    
    | @@ -1,5 +1,27 @@ | |
| 1 1 | 
             
            # @modern-js/plugin-module-polyfill
         | 
| 2 2 |  | 
| 3 | 
            +
            ## 2.29.0
         | 
| 4 | 
            +
             | 
| 5 | 
            +
            ### Patch Changes
         | 
| 6 | 
            +
             | 
| 7 | 
            +
            - Updated dependencies [6993eb6]
         | 
| 8 | 
            +
            - Updated dependencies [0f680ec]
         | 
| 9 | 
            +
              - @modern-js/module-tools@2.29.0
         | 
| 10 | 
            +
             | 
| 11 | 
            +
            ## 2.28.0
         | 
| 12 | 
            +
             | 
| 13 | 
            +
            ### Patch Changes
         | 
| 14 | 
            +
             | 
| 15 | 
            +
            - d3e52e4: chore(CI): update build config to improve vitest CI perf
         | 
| 16 | 
            +
             | 
| 17 | 
            +
              chore(CI): 更新构建配置来提升 vitest CI 性能
         | 
| 18 | 
            +
             | 
| 19 | 
            +
            - Updated dependencies [3092f1f]
         | 
| 20 | 
            +
            - Updated dependencies [118c1c0]
         | 
| 21 | 
            +
            - Updated dependencies [b7a8c43]
         | 
| 22 | 
            +
            - Updated dependencies [d3e52e4]
         | 
| 23 | 
            +
              - @modern-js/module-tools@2.28.0
         | 
| 24 | 
            +
             | 
| 3 25 | 
             
            ## 2.27.0
         | 
| 4 26 |  | 
| 5 27 | 
             
            ### Patch Changes
         | 
    
        package/dist/index.d.ts
    CHANGED
    
    | @@ -1,7 +1,5 @@ | |
| 1 | 
            -
            import { CliPlugin, ModuleTools } from '@modern-js/module-tools';
         | 
| 2 | 
            -
             | 
| 3 | 
            -
             | 
| 4 | 
            -
                targets?: Record<string, string> | string;
         | 
| 1 | 
            +
            import type { CliPlugin, ModuleTools } from '@modern-js/module-tools';
         | 
| 2 | 
            +
            export declare const ModulePolyfillPlugin: (options?: {
         | 
| 3 | 
            +
              targets?: Record<string, string> | string;
         | 
| 5 4 | 
             
            }) => CliPlugin<ModuleTools>;
         | 
| 6 | 
            -
             | 
| 7 | 
            -
            export { ModulePolyfillPlugin, ModulePolyfillPlugin as modulePluginPolyfill };
         | 
| 5 | 
            +
            export { ModulePolyfillPlugin as modulePluginPolyfill };
         | 
    
        package/dist/index.js
    CHANGED
    
    | @@ -1,58 +1,50 @@ | |
| 1 | 
            -
             | 
| 2 | 
            -
             | 
| 3 | 
            -
             | 
| 4 | 
            -
             | 
| 5 | 
            -
             | 
| 1 | 
            +
            "use strict";
         | 
| 2 | 
            +
            Object.defineProperty(exports, "__esModule", {
         | 
| 3 | 
            +
              value: true
         | 
| 4 | 
            +
            });
         | 
| 5 | 
            +
            function _export(target, all) {
         | 
| 6 6 | 
             
              for (var name in all)
         | 
| 7 | 
            -
                 | 
| 8 | 
            -
             | 
| 9 | 
            -
             | 
| 10 | 
            -
             | 
| 11 | 
            -
             | 
| 12 | 
            -
             | 
| 13 | 
            -
             | 
| 7 | 
            +
                Object.defineProperty(target, name, {
         | 
| 8 | 
            +
                  enumerable: true,
         | 
| 9 | 
            +
                  get: all[name]
         | 
| 10 | 
            +
                });
         | 
| 11 | 
            +
            }
         | 
| 12 | 
            +
            _export(exports, {
         | 
| 13 | 
            +
              ModulePolyfillPlugin: function() {
         | 
| 14 | 
            +
                return ModulePolyfillPlugin;
         | 
| 15 | 
            +
              },
         | 
| 16 | 
            +
              modulePluginPolyfill: function() {
         | 
| 17 | 
            +
                return ModulePolyfillPlugin;
         | 
| 14 18 | 
             
              }
         | 
| 15 | 
            -
              return to;
         | 
| 16 | 
            -
            };
         | 
| 17 | 
            -
            var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
         | 
| 18 | 
            -
             | 
| 19 | 
            -
            // src/index.ts
         | 
| 20 | 
            -
            var src_exports = {};
         | 
| 21 | 
            -
            __export(src_exports, {
         | 
| 22 | 
            -
              ModulePolyfillPlugin: () => ModulePolyfillPlugin,
         | 
| 23 | 
            -
              modulePluginPolyfill: () => ModulePolyfillPlugin
         | 
| 24 19 | 
             
            });
         | 
| 25 | 
            -
             | 
| 26 | 
            -
             | 
| 27 | 
            -
            var ModulePolyfillPlugin = (options) => ({
         | 
| 20 | 
            +
            const _libuildpluginbabel = require("@modern-js/libuild-plugin-babel");
         | 
| 21 | 
            +
            const ModulePolyfillPlugin = (options) => ({
         | 
| 28 22 | 
             
              name: "@modern-js/plugin-module-polyfill",
         | 
| 29 23 | 
             
              setup: () => ({
         | 
| 30 24 | 
             
                modifyLibuild(config) {
         | 
| 31 | 
            -
                  var  | 
| 25 | 
            +
                  var _options, _config_plugins;
         | 
| 32 26 | 
             
                  const plugins = [
         | 
| 33 | 
            -
                    [ | 
| 34 | 
            -
             | 
| 27 | 
            +
                    [
         | 
| 28 | 
            +
                      require("@babel/plugin-syntax-typescript"),
         | 
| 29 | 
            +
                      {
         | 
| 30 | 
            +
                        isTSX: true
         | 
| 31 | 
            +
                      }
         | 
| 32 | 
            +
                    ],
         | 
| 33 | 
            +
                    [
         | 
| 34 | 
            +
                      require("@babel/plugin-syntax-jsx")
         | 
| 35 | 
            +
                    ],
         | 
| 35 36 | 
             
                    [
         | 
| 36 37 | 
             
                      require("babel-plugin-polyfill-corejs3"),
         | 
| 37 38 | 
             
                      {
         | 
| 38 39 | 
             
                        method: "usage-pure",
         | 
| 39 | 
            -
                        targets: options  | 
| 40 | 
            +
                        targets: (_options = options) === null || _options === void 0 ? void 0 : _options.targets
         | 
| 40 41 | 
             
                      }
         | 
| 41 42 | 
             
                    ]
         | 
| 42 43 | 
             
                  ];
         | 
| 43 | 
            -
                  ( | 
| 44 | 
            -
                     | 
| 45 | 
            -
             | 
| 46 | 
            -
                    })
         | 
| 47 | 
            -
                  );
         | 
| 44 | 
            +
                  (_config_plugins = config.plugins) === null || _config_plugins === void 0 ? void 0 : _config_plugins.push((0, _libuildpluginbabel.babelPlugin)({
         | 
| 45 | 
            +
                    plugins
         | 
| 46 | 
            +
                  }));
         | 
| 48 47 | 
             
                  return config;
         | 
| 49 48 | 
             
                }
         | 
| 50 49 | 
             
              })
         | 
| 51 50 | 
             
            });
         | 
| 52 | 
            -
            // Annotate the CommonJS export names for ESM import in node:
         | 
| 53 | 
            -
            0 && (module.exports = {
         | 
| 54 | 
            -
              ModulePolyfillPlugin,
         | 
| 55 | 
            -
              modulePluginPolyfill
         | 
| 56 | 
            -
            });
         | 
| 57 | 
            -
             | 
| 58 | 
            -
            //# sourceMappingURL=index.js.map
         | 
    
        package/package.json
    CHANGED
    
    | @@ -15,7 +15,7 @@ | |
| 15 15 | 
             
                "modern",
         | 
| 16 16 | 
             
                "modern.js"
         | 
| 17 17 | 
             
              ],
         | 
| 18 | 
            -
              "version": "2. | 
| 18 | 
            +
              "version": "2.29.0",
         | 
| 19 19 | 
             
              "types": "./dist/index.d.ts",
         | 
| 20 20 | 
             
              "main": "./dist/index.js",
         | 
| 21 21 | 
             
              "devDependencies": {
         | 
| @@ -23,12 +23,13 @@ | |
| 23 23 | 
             
                "@types/node": "^14",
         | 
| 24 24 | 
             
                "typescript": "^5",
         | 
| 25 25 | 
             
                "jest": "^29",
         | 
| 26 | 
            -
                "@ | 
| 27 | 
            -
                "@scripts/jest-config": "2. | 
| 28 | 
            -
                "@ | 
| 26 | 
            +
                "@swc/helpers": "0.5.1",
         | 
| 27 | 
            +
                "@scripts/jest-config": "2.29.0",
         | 
| 28 | 
            +
                "@scripts/build": "2.29.0",
         | 
| 29 | 
            +
                "@modern-js/module-tools": "2.29.0"
         | 
| 29 30 | 
             
              },
         | 
| 30 31 | 
             
              "peerDependencies": {
         | 
| 31 | 
            -
                "@modern-js/module-tools": "^2. | 
| 32 | 
            +
                "@modern-js/module-tools": "^2.29.0",
         | 
| 32 33 | 
             
                "core-js-pure": "^3.25.0"
         | 
| 33 34 | 
             
              },
         | 
| 34 35 | 
             
              "dependencies": {
         | 
    
        package/dist/index.js.map
    DELETED
    
    | @@ -1 +0,0 @@ | |
| 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"]}
         |