@modern-js/plugin-polyfill 2.0.0-beta.4 → 2.0.0-beta.6
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 +35 -0
- package/dist/js/modern/cli.js +6 -0
- package/dist/js/node/cli.js +11 -3
- package/dist/js/node/const.js +8 -3
- package/dist/js/node/index.js +12 -10
- package/dist/js/node/libs/cache.js +7 -3
- package/dist/js/node/type.js +15 -0
- package/dist/js/treeshaking/cli.js +9 -0
- package/dist/types/cli.d.ts +2 -5
- package/package.json +25 -16
    
        package/CHANGELOG.md
    CHANGED
    
    | @@ -1,5 +1,40 @@ | |
| 1 1 | 
             
            # @modern-js/plugin-polyfill
         | 
| 2 2 |  | 
| 3 | 
            +
            ## 2.0.0-beta.6
         | 
| 4 | 
            +
             | 
| 5 | 
            +
            ### Major Changes
         | 
| 6 | 
            +
             | 
| 7 | 
            +
            - dda38c9c3e: chore: v2
         | 
| 8 | 
            +
             | 
| 9 | 
            +
            ### Patch Changes
         | 
| 10 | 
            +
             | 
| 11 | 
            +
            - ebbeed1ece: fix(plugin-polyfill): failed to join flags when restart CLI
         | 
| 12 | 
            +
             | 
| 13 | 
            +
              fix(plugin-polyfill): 修复重启 CLI 时报错 join flags 失败的问题
         | 
| 14 | 
            +
             | 
| 15 | 
            +
            - Updated dependencies [7879e8f711]
         | 
| 16 | 
            +
            - Updated dependencies [6aca875011]
         | 
| 17 | 
            +
            - Updated dependencies [2e6031955e]
         | 
| 18 | 
            +
            - Updated dependencies [7b7d12cf8f]
         | 
| 19 | 
            +
            - Updated dependencies [7efeed4]
         | 
| 20 | 
            +
            - Updated dependencies [92f0eade39]
         | 
| 21 | 
            +
            - Updated dependencies [edd1cfb1af]
         | 
| 22 | 
            +
            - Updated dependencies [cc971eabfc]
         | 
| 23 | 
            +
            - Updated dependencies [5b9049f2e9]
         | 
| 24 | 
            +
            - Updated dependencies [92004d1906]
         | 
| 25 | 
            +
            - Updated dependencies [b8bbe036c7]
         | 
| 26 | 
            +
            - Updated dependencies [d5a31df781]
         | 
| 27 | 
            +
            - Updated dependencies [dda38c9c3e]
         | 
| 28 | 
            +
            - Updated dependencies [3bbea92b2a]
         | 
| 29 | 
            +
            - Updated dependencies [b710adb843]
         | 
| 30 | 
            +
            - Updated dependencies [ea7cf06257]
         | 
| 31 | 
            +
            - Updated dependencies [bbe4c4ab64]
         | 
| 32 | 
            +
            - Updated dependencies [e4558a0bc4]
         | 
| 33 | 
            +
            - Updated dependencies [abf3421a75]
         | 
| 34 | 
            +
            - Updated dependencies [543be9558e]
         | 
| 35 | 
            +
            - Updated dependencies [14b712da84]
         | 
| 36 | 
            +
              - @modern-js/utils@2.0.0-beta.6
         | 
| 37 | 
            +
             | 
| 3 38 | 
             
            ## 2.0.0-beta.4
         | 
| 4 39 |  | 
| 5 40 | 
             
            ### Major Changes
         | 
    
        package/dist/js/modern/cli.js
    CHANGED
    
    | @@ -10,6 +10,12 @@ var cli_default = () => ({ | |
| 10 10 | 
             
                    );
         | 
| 11 11 | 
             
                  }
         | 
| 12 12 | 
             
                  return { partials, entrypoint };
         | 
| 13 | 
            +
                },
         | 
| 14 | 
            +
                collectServerPlugins({ plugins }) {
         | 
| 15 | 
            +
                  plugins.push({
         | 
| 16 | 
            +
                    "@modern-js/plugin-polyfill": "@modern-js/plugin-polyfill/server"
         | 
| 17 | 
            +
                  });
         | 
| 18 | 
            +
                  return { plugins };
         | 
| 13 19 | 
             
                }
         | 
| 14 20 | 
             
              })
         | 
| 15 21 | 
             
            });
         | 
    
        package/dist/js/node/cli.js
    CHANGED
    
    | @@ -15,11 +15,11 @@ var __copyProps = (to, from, except, desc) => { | |
| 15 15 | 
             
              return to;
         | 
| 16 16 | 
             
            };
         | 
| 17 17 | 
             
            var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
         | 
| 18 | 
            -
            var  | 
| 19 | 
            -
            __export( | 
| 18 | 
            +
            var cli_exports = {};
         | 
| 19 | 
            +
            __export(cli_exports, {
         | 
| 20 20 | 
             
              default: () => cli_default
         | 
| 21 21 | 
             
            });
         | 
| 22 | 
            -
            module.exports = __toCommonJS( | 
| 22 | 
            +
            module.exports = __toCommonJS(cli_exports);
         | 
| 23 23 | 
             
            var import_const = require("./const");
         | 
| 24 24 | 
             
            var cli_default = () => ({
         | 
| 25 25 | 
             
              name: "@modern-js/plugin-polyfill",
         | 
| @@ -32,6 +32,14 @@ var cli_default = () => ({ | |
| 32 32 | 
             
                    );
         | 
| 33 33 | 
             
                  }
         | 
| 34 34 | 
             
                  return { partials, entrypoint };
         | 
| 35 | 
            +
                },
         | 
| 36 | 
            +
                collectServerPlugins({ plugins }) {
         | 
| 37 | 
            +
                  plugins.push({
         | 
| 38 | 
            +
                    "@modern-js/plugin-polyfill": "@modern-js/plugin-polyfill/server"
         | 
| 39 | 
            +
                  });
         | 
| 40 | 
            +
                  return { plugins };
         | 
| 35 41 | 
             
                }
         | 
| 36 42 | 
             
              })
         | 
| 37 43 | 
             
            });
         | 
| 44 | 
            +
            // Annotate the CommonJS export names for ESM import in node:
         | 
| 45 | 
            +
            0 && (module.exports = {});
         | 
    
        package/dist/js/node/const.js
    CHANGED
    
    | @@ -15,13 +15,18 @@ var __copyProps = (to, from, except, desc) => { | |
| 15 15 | 
             
              return to;
         | 
| 16 16 | 
             
            };
         | 
| 17 17 | 
             
            var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
         | 
| 18 | 
            -
            var  | 
| 19 | 
            -
            __export( | 
| 18 | 
            +
            var const_exports = {};
         | 
| 19 | 
            +
            __export(const_exports, {
         | 
| 20 20 | 
             
              defaultPolyfill: () => defaultPolyfill,
         | 
| 21 21 | 
             
              getDefaultFeatures: () => getDefaultFeatures
         | 
| 22 22 | 
             
            });
         | 
| 23 | 
            -
            module.exports = __toCommonJS( | 
| 23 | 
            +
            module.exports = __toCommonJS(const_exports);
         | 
| 24 24 | 
             
            const defaultPolyfill = "/__polyfill__";
         | 
| 25 25 | 
             
            const getDefaultFeatures = () => ({
         | 
| 26 26 | 
             
              es6: { flags: ["gated"] }
         | 
| 27 27 | 
             
            });
         | 
| 28 | 
            +
            // Annotate the CommonJS export names for ESM import in node:
         | 
| 29 | 
            +
            0 && (module.exports = {
         | 
| 30 | 
            +
              defaultPolyfill,
         | 
| 31 | 
            +
              getDefaultFeatures
         | 
| 32 | 
            +
            });
         | 
    
        package/dist/js/node/index.js
    CHANGED
    
    | @@ -21,16 +21,6 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge | |
| 21 21 | 
             
              mod
         | 
| 22 22 | 
             
            ));
         | 
| 23 23 | 
             
            var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
         | 
| 24 | 
            -
            var stdin_exports = {};
         | 
| 25 | 
            -
            __export(stdin_exports, {
         | 
| 26 | 
            -
              default: () => src_default
         | 
| 27 | 
            -
            });
         | 
| 28 | 
            -
            module.exports = __toCommonJS(stdin_exports);
         | 
| 29 | 
            -
            var import_polyfill_lib = require("@modern-js/polyfill-lib");
         | 
| 30 | 
            -
            var import_utils = require("@modern-js/utils");
         | 
| 31 | 
            -
            var import_ua_parser_js = __toESM(require("ua-parser-js"));
         | 
| 32 | 
            -
            var import_const = require("./const");
         | 
| 33 | 
            -
            var import_cache = __toESM(require("./libs/cache"));
         | 
| 34 24 | 
             
            var __async = (__this, __arguments, generator) => {
         | 
| 35 25 | 
             
              return new Promise((resolve, reject) => {
         | 
| 36 26 | 
             
                var fulfilled = (value) => {
         | 
| @@ -51,6 +41,16 @@ var __async = (__this, __arguments, generator) => { | |
| 51 41 | 
             
                step((generator = generator.apply(__this, __arguments)).next());
         | 
| 52 42 | 
             
              });
         | 
| 53 43 | 
             
            };
         | 
| 44 | 
            +
            var src_exports = {};
         | 
| 45 | 
            +
            __export(src_exports, {
         | 
| 46 | 
            +
              default: () => src_default
         | 
| 47 | 
            +
            });
         | 
| 48 | 
            +
            module.exports = __toCommonJS(src_exports);
         | 
| 49 | 
            +
            var import_polyfill_lib = require("@modern-js/polyfill-lib");
         | 
| 50 | 
            +
            var import_utils = require("@modern-js/utils");
         | 
| 51 | 
            +
            var import_ua_parser_js = __toESM(require("ua-parser-js"));
         | 
| 52 | 
            +
            var import_const = require("./const");
         | 
| 53 | 
            +
            var import_cache = __toESM(require("./libs/cache"));
         | 
| 54 54 | 
             
            var src_default = () => ({
         | 
| 55 55 | 
             
              name: "@modern-js/plugin-polyfill",
         | 
| 56 56 | 
             
              setup: () => ({
         | 
| @@ -96,3 +96,5 @@ var src_default = () => ({ | |
| 96 96 | 
             
                }
         | 
| 97 97 | 
             
              })
         | 
| 98 98 | 
             
            });
         | 
| 99 | 
            +
            // Annotate the CommonJS export names for ESM import in node:
         | 
| 100 | 
            +
            0 && (module.exports = {});
         | 
| @@ -21,12 +21,12 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge | |
| 21 21 | 
             
              mod
         | 
| 22 22 | 
             
            ));
         | 
| 23 23 | 
             
            var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
         | 
| 24 | 
            -
            var  | 
| 25 | 
            -
            __export( | 
| 24 | 
            +
            var cache_exports = {};
         | 
| 25 | 
            +
            __export(cache_exports, {
         | 
| 26 26 | 
             
              default: () => Cache,
         | 
| 27 27 | 
             
              generateCacheKey: () => generateCacheKey
         | 
| 28 28 | 
             
            });
         | 
| 29 | 
            -
            module.exports = __toCommonJS( | 
| 29 | 
            +
            module.exports = __toCommonJS(cache_exports);
         | 
| 30 30 | 
             
            var import_crypto = __toESM(require("crypto"));
         | 
| 31 31 | 
             
            var import_lru_cache = __toESM(require("lru-cache"));
         | 
| 32 32 | 
             
            const KB = 1024;
         | 
| @@ -57,3 +57,7 @@ class Cache { | |
| 57 57 | 
             
                this.caches.set(hash, content);
         | 
| 58 58 | 
             
              }
         | 
| 59 59 | 
             
            }
         | 
| 60 | 
            +
            // Annotate the CommonJS export names for ESM import in node:
         | 
| 61 | 
            +
            0 && (module.exports = {
         | 
| 62 | 
            +
              generateCacheKey
         | 
| 63 | 
            +
            });
         | 
    
        package/dist/js/node/type.js
    CHANGED
    
    | @@ -0,0 +1,15 @@ | |
| 1 | 
            +
            var __defProp = Object.defineProperty;
         | 
| 2 | 
            +
            var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
         | 
| 3 | 
            +
            var __getOwnPropNames = Object.getOwnPropertyNames;
         | 
| 4 | 
            +
            var __hasOwnProp = Object.prototype.hasOwnProperty;
         | 
| 5 | 
            +
            var __copyProps = (to, from, except, desc) => {
         | 
| 6 | 
            +
              if (from && typeof from === "object" || typeof from === "function") {
         | 
| 7 | 
            +
                for (let key of __getOwnPropNames(from))
         | 
| 8 | 
            +
                  if (!__hasOwnProp.call(to, key) && key !== except)
         | 
| 9 | 
            +
                    __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
         | 
| 10 | 
            +
              }
         | 
| 11 | 
            +
              return to;
         | 
| 12 | 
            +
            };
         | 
| 13 | 
            +
            var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
         | 
| 14 | 
            +
            var type_exports = {};
         | 
| 15 | 
            +
            module.exports = __toCommonJS(type_exports);
         | 
| @@ -14,6 +14,15 @@ var cli_default = function() { | |
| 14 14 | 
             
                                    partials: partials,
         | 
| 15 15 | 
             
                                    entrypoint: entrypoint
         | 
| 16 16 | 
             
                                };
         | 
| 17 | 
            +
                            },
         | 
| 18 | 
            +
                            collectServerPlugins: function collectServerPlugins(param) {
         | 
| 19 | 
            +
                                var plugins = param.plugins;
         | 
| 20 | 
            +
                                plugins.push({
         | 
| 21 | 
            +
                                    "@modern-js/plugin-polyfill": "@modern-js/plugin-polyfill/server"
         | 
| 22 | 
            +
                                });
         | 
| 23 | 
            +
                                return {
         | 
| 24 | 
            +
                                    plugins: plugins
         | 
| 25 | 
            +
                                };
         | 
| 17 26 | 
             
                            }
         | 
| 18 27 | 
             
                        };
         | 
| 19 28 | 
             
                    }
         | 
    
        package/dist/types/cli.d.ts
    CHANGED
    
    | @@ -1,9 +1,6 @@ | |
| 1 1 | 
             
            import type { CliPlugin } from '@modern-js/core';
         | 
| 2 | 
            -
            import type {  | 
| 2 | 
            +
            import type { AppTools } from '@modern-js/app-tools';
         | 
| 3 3 |  | 
| 4 | 
            -
            declare const _default: () => CliPlugin< | 
| 5 | 
            -
              userConfig: UserConfig;
         | 
| 6 | 
            -
              normalizedConfig: ServerOptions;
         | 
| 7 | 
            -
            }>;
         | 
| 4 | 
            +
            declare const _default: () => CliPlugin<AppTools>;
         | 
| 8 5 |  | 
| 9 6 | 
             
            export default _default;
         | 
    
        package/package.json
    CHANGED
    
    | @@ -11,20 +11,20 @@ | |
| 11 11 | 
             
                "modern",
         | 
| 12 12 | 
             
                "modern.js"
         | 
| 13 13 | 
             
              ],
         | 
| 14 | 
            -
              "version": "2.0.0-beta. | 
| 15 | 
            -
              "jsnext:source": "./src/ | 
| 16 | 
            -
              "types": "./dist/types/ | 
| 17 | 
            -
              "main": "./dist/js/node/ | 
| 18 | 
            -
              "module": "./dist/js/treeshaking/ | 
| 19 | 
            -
              "jsnext:modern": "./dist/js/modern/ | 
| 14 | 
            +
              "version": "2.0.0-beta.6",
         | 
| 15 | 
            +
              "jsnext:source": "./src/cli.ts",
         | 
| 16 | 
            +
              "types": "./dist/types/cli.d.ts",
         | 
| 17 | 
            +
              "main": "./dist/js/node/cli.js",
         | 
| 18 | 
            +
              "module": "./dist/js/treeshaking/cli.js",
         | 
| 19 | 
            +
              "jsnext:modern": "./dist/js/modern/cli.js",
         | 
| 20 20 | 
             
              "exports": {
         | 
| 21 21 | 
             
                ".": {
         | 
| 22 | 
            +
                  "jsnext:source": "./src/cli.ts",
         | 
| 22 23 | 
             
                  "node": {
         | 
| 23 | 
            -
                    " | 
| 24 | 
            -
                    " | 
| 25 | 
            -
                    "require": "./dist/js/node/index.js"
         | 
| 24 | 
            +
                    "import": "./dist/js/node/cli.js",
         | 
| 25 | 
            +
                    "require": "./dist/js/node/cli.js"
         | 
| 26 26 | 
             
                  },
         | 
| 27 | 
            -
                  "default": "./dist/js/ | 
| 27 | 
            +
                  "default": "./dist/js/node/cli.js"
         | 
| 28 28 | 
             
                },
         | 
| 29 29 | 
             
                "./cli": {
         | 
| 30 30 | 
             
                  "jsnext:source": "./src/cli.ts",
         | 
| @@ -33,6 +33,14 @@ | |
| 33 33 | 
             
                    "require": "./dist/js/node/cli.js"
         | 
| 34 34 | 
             
                  },
         | 
| 35 35 | 
             
                  "default": "./dist/js/node/cli.js"
         | 
| 36 | 
            +
                },
         | 
| 37 | 
            +
                "./server": {
         | 
| 38 | 
            +
                  "node": {
         | 
| 39 | 
            +
                    "jsnext:source": "./src/index.ts",
         | 
| 40 | 
            +
                    "import": "./dist/js/modern/index.js",
         | 
| 41 | 
            +
                    "require": "./dist/js/node/index.js"
         | 
| 42 | 
            +
                  },
         | 
| 43 | 
            +
                  "default": "./dist/js/treeshaking/index.js"
         | 
| 36 44 | 
             
                }
         | 
| 37 45 | 
             
              },
         | 
| 38 46 | 
             
              "dependencies": {
         | 
| @@ -40,7 +48,7 @@ | |
| 40 48 | 
             
                "@modern-js/polyfill-lib": "^1.0.0",
         | 
| 41 49 | 
             
                "lru-cache": "^6.0.0",
         | 
| 42 50 | 
             
                "ua-parser-js": "^0.7.28",
         | 
| 43 | 
            -
                "@modern-js/utils": "2.0.0-beta. | 
| 51 | 
            +
                "@modern-js/utils": "2.0.0-beta.6"
         | 
| 44 52 | 
             
              },
         | 
| 45 53 | 
             
              "devDependencies": {
         | 
| 46 54 | 
             
                "@types/jest": "^27",
         | 
| @@ -49,11 +57,12 @@ | |
| 49 57 | 
             
                "@types/ua-parser-js": "^0.7.36",
         | 
| 50 58 | 
             
                "typescript": "^4",
         | 
| 51 59 | 
             
                "jest": "^27",
         | 
| 52 | 
            -
                "@modern-js/server-core": "2.0.0-beta. | 
| 53 | 
            -
                "@modern-js/ | 
| 54 | 
            -
                "@modern-js/ | 
| 55 | 
            -
                "@ | 
| 56 | 
            -
                "@scripts/ | 
| 60 | 
            +
                "@modern-js/server-core": "2.0.0-beta.6",
         | 
| 61 | 
            +
                "@modern-js/app-tools": "2.0.0-beta.6",
         | 
| 62 | 
            +
                "@modern-js/types": "2.0.0-beta.6",
         | 
| 63 | 
            +
                "@modern-js/core": "2.0.0-beta.6",
         | 
| 64 | 
            +
                "@scripts/build": "2.0.0-beta.6",
         | 
| 65 | 
            +
                "@scripts/jest-config": "2.0.0-beta.6"
         | 
| 57 66 | 
             
              },
         | 
| 58 67 | 
             
              "sideEffects": false,
         | 
| 59 68 | 
             
              "publishConfig": {
         |