@modern-js/utils 2.4.0 → 2.5.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 +14 -0
- package/dist/FileSizeReporter.d.ts +5 -5
- package/dist/FileSizeReporter.js +143 -136
- package/dist/alias.d.ts +14 -12
- package/dist/alias.js +94 -54
- package/dist/analyzeProject.d.ts +1 -1
- package/dist/analyzeProject.js +58 -33
- package/dist/applyOptionsChain.d.ts +1 -1
- package/dist/applyOptionsChain.js +55 -27
- package/dist/chainId.d.ts +256 -184
- package/dist/chainId.js +132 -187
- package/dist/clearConsole.d.ts +1 -1
- package/dist/clearConsole.js +29 -7
- package/dist/commands.d.ts +1 -1
- package/dist/commands.js +33 -10
- package/dist/compatRequire.d.ts +3 -3
- package/dist/compatRequire.js +74 -38
- package/dist/compiled.d.ts +2 -1
- package/dist/compiled.js +137 -72
- package/dist/constants.d.ts +131 -105
- package/dist/constants.js +298 -277
- package/dist/debug.d.ts +1 -1
- package/dist/debug.js +28 -11
- package/dist/emptyDir.d.ts +1 -1
- package/dist/emptyDir.js +51 -9
- package/dist/ensureAbsolutePath.d.ts +1 -1
- package/dist/ensureAbsolutePath.js +33 -14
- package/dist/ensureArray.d.ts +1 -1
- package/dist/ensureArray.js +30 -8
- package/dist/findExists.d.ts +1 -1
- package/dist/findExists.js +37 -17
- package/dist/format.d.ts +3 -3
- package/dist/format.js +93 -81
- package/dist/generateMetaTags.d.ts +3 -3
- package/dist/generateMetaTags.js +56 -43
- package/dist/getBrowserslist.d.ts +1 -1
- package/dist/getBrowserslist.js +31 -7
- package/dist/getCoreJsVersion.d.ts +1 -1
- package/dist/getCoreJsVersion.js +39 -35
- package/dist/getEntryOptions.d.ts +1 -1
- package/dist/getEntryOptions.js +51 -24
- package/dist/getPackageManager.d.ts +1 -1
- package/dist/getPackageManager.js +75 -28
- package/dist/getPort.d.ts +7 -4
- package/dist/getPort.js +104 -58
- package/dist/getServerConfig.d.ts +1 -1
- package/dist/getServerConfig.js +61 -32
- package/dist/import.d.ts +2 -2
- package/dist/import.js +31 -8
- package/dist/index.d.ts +1 -1
- package/dist/index.js +59 -59
- package/dist/is/index.d.ts +12 -1
- package/dist/is/index.js +83 -82
- package/dist/is/node-env.d.ts +1 -1
- package/dist/is/node-env.js +39 -17
- package/dist/is/platform.d.ts +1 -1
- package/dist/is/platform.js +30 -10
- package/dist/is/type.d.ts +1 -1
- package/dist/is/type.js +48 -22
- package/dist/logger.d.ts +48 -48
- package/dist/logger.js +127 -95
- package/dist/monorepo.d.ts +3 -3
- package/dist/monorepo.js +117 -74
- package/dist/nodeEnv.d.ts +1 -1
- package/dist/nodeEnv.js +72 -25
- package/dist/path.d.ts +3 -1
- package/dist/path.js +76 -59
- package/dist/pathSerializer.d.ts +6 -6
- package/dist/pathSerializer.js +65 -43
- package/dist/plugin.d.ts +1 -1
- package/dist/plugin.js +45 -26
- package/dist/prettyInstructions.d.ts +4 -4
- package/dist/prettyInstructions.js +107 -65
- package/dist/printBuildError.d.ts +1 -1
- package/dist/printBuildError.js +54 -40
- package/dist/react.d.ts +1 -1
- package/dist/react.js +57 -21
- package/dist/readTsConfig.d.ts +1 -1
- package/dist/readTsConfig.js +38 -12
- package/dist/removeSlash.d.ts +1 -1
- package/dist/removeSlash.js +33 -9
- package/dist/routes.d.ts +1 -1
- package/dist/routes.js +49 -22
- package/dist/runtimeExports.d.ts +3 -3
- package/dist/runtimeExports.js +59 -39
- package/dist/ssr.d.ts +2 -1
- package/dist/ssr.js +30 -7
- package/dist/storage.d.ts +3 -3
- package/dist/storage.js +65 -59
- package/dist/test-utils.d.ts +1 -1
- package/dist/test-utils.js +30 -24
- package/dist/tryResolve.d.ts +2 -1
- package/dist/tryResolve.js +45 -33
- package/dist/types.d.ts +1 -1
- package/dist/types.js +15 -2
- package/dist/version.d.ts +1 -1
- package/dist/version.js +83 -24
- package/dist/wait.d.ts +1 -1
- package/dist/wait.js +28 -6
- package/dist/watch.d.ts +3 -3
- package/dist/watch.js +82 -55
- package/package.json +7 -8
    
        package/dist/emptyDir.js
    CHANGED
    
    | @@ -1,10 +1,52 @@ | |
| 1 | 
            -
             | 
| 2 | 
            -
             | 
| 3 | 
            -
             | 
| 4 | 
            -
             | 
| 5 | 
            -
             | 
| 6 | 
            -
             | 
| 7 | 
            -
             | 
| 8 | 
            -
                }
         | 
| 1 | 
            +
            var __defProp = Object.defineProperty;
         | 
| 2 | 
            +
            var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
         | 
| 3 | 
            +
            var __getOwnPropNames = Object.getOwnPropertyNames;
         | 
| 4 | 
            +
            var __hasOwnProp = Object.prototype.hasOwnProperty;
         | 
| 5 | 
            +
            var __export = (target, all) => {
         | 
| 6 | 
            +
              for (var name in all)
         | 
| 7 | 
            +
                __defProp(target, name, { get: all[name], enumerable: true });
         | 
| 9 8 | 
             
            };
         | 
| 10 | 
            -
             | 
| 9 | 
            +
            var __copyProps = (to, from, except, desc) => {
         | 
| 10 | 
            +
              if (from && typeof from === "object" || typeof from === "function") {
         | 
| 11 | 
            +
                for (let key of __getOwnPropNames(from))
         | 
| 12 | 
            +
                  if (!__hasOwnProp.call(to, key) && key !== except)
         | 
| 13 | 
            +
                    __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
         | 
| 14 | 
            +
              }
         | 
| 15 | 
            +
              return to;
         | 
| 16 | 
            +
            };
         | 
| 17 | 
            +
            var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
         | 
| 18 | 
            +
            var __async = (__this, __arguments, generator) => {
         | 
| 19 | 
            +
              return new Promise((resolve, reject) => {
         | 
| 20 | 
            +
                var fulfilled = (value) => {
         | 
| 21 | 
            +
                  try {
         | 
| 22 | 
            +
                    step(generator.next(value));
         | 
| 23 | 
            +
                  } catch (e) {
         | 
| 24 | 
            +
                    reject(e);
         | 
| 25 | 
            +
                  }
         | 
| 26 | 
            +
                };
         | 
| 27 | 
            +
                var rejected = (value) => {
         | 
| 28 | 
            +
                  try {
         | 
| 29 | 
            +
                    step(generator.throw(value));
         | 
| 30 | 
            +
                  } catch (e) {
         | 
| 31 | 
            +
                    reject(e);
         | 
| 32 | 
            +
                  }
         | 
| 33 | 
            +
                };
         | 
| 34 | 
            +
                var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
         | 
| 35 | 
            +
                step((generator = generator.apply(__this, __arguments)).next());
         | 
| 36 | 
            +
              });
         | 
| 37 | 
            +
            };
         | 
| 38 | 
            +
            var emptyDir_exports = {};
         | 
| 39 | 
            +
            __export(emptyDir_exports, {
         | 
| 40 | 
            +
              emptyDir: () => emptyDir
         | 
| 41 | 
            +
            });
         | 
| 42 | 
            +
            module.exports = __toCommonJS(emptyDir_exports);
         | 
| 43 | 
            +
            var import_compiled = require("./compiled");
         | 
| 44 | 
            +
            const emptyDir = (dir) => __async(void 0, null, function* () {
         | 
| 45 | 
            +
              if (yield import_compiled.fs.pathExists(dir)) {
         | 
| 46 | 
            +
                yield import_compiled.fs.emptyDir(dir);
         | 
| 47 | 
            +
              }
         | 
| 48 | 
            +
            });
         | 
| 49 | 
            +
            // Annotate the CommonJS export names for ESM import in node:
         | 
| 50 | 
            +
            0 && (module.exports = {
         | 
| 51 | 
            +
              emptyDir
         | 
| 52 | 
            +
            });
         | 
| @@ -4,4 +4,4 @@ | |
| 4 4 | 
             
             * @param filePath - Absolute or relative file path.
         | 
| 5 5 | 
             
             * @returns Resolved absolute file path.
         | 
| 6 6 | 
             
             */
         | 
| 7 | 
            -
            export declare const ensureAbsolutePath: (base: string, filePath: string) => string;
         | 
| 7 | 
            +
            export declare const ensureAbsolutePath: (base: string, filePath: string) => string;
         | 
| @@ -1,15 +1,34 @@ | |
| 1 | 
            -
             | 
| 2 | 
            -
            var  | 
| 3 | 
            -
             | 
| 1 | 
            +
            var __create = Object.create;
         | 
| 2 | 
            +
            var __defProp = Object.defineProperty;
         | 
| 3 | 
            +
            var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
         | 
| 4 | 
            +
            var __getOwnPropNames = Object.getOwnPropertyNames;
         | 
| 5 | 
            +
            var __getProtoOf = Object.getPrototypeOf;
         | 
| 6 | 
            +
            var __hasOwnProp = Object.prototype.hasOwnProperty;
         | 
| 7 | 
            +
            var __export = (target, all) => {
         | 
| 8 | 
            +
              for (var name in all)
         | 
| 9 | 
            +
                __defProp(target, name, { get: all[name], enumerable: true });
         | 
| 4 10 | 
             
            };
         | 
| 5 | 
            -
             | 
| 6 | 
            -
             | 
| 7 | 
            -
             | 
| 8 | 
            -
             | 
| 9 | 
            -
              | 
| 10 | 
            -
             | 
| 11 | 
            -
              | 
| 12 | 
            -
             | 
| 13 | 
            -
              | 
| 14 | 
            -
             | 
| 15 | 
            -
             | 
| 11 | 
            +
            var __copyProps = (to, from, except, desc) => {
         | 
| 12 | 
            +
              if (from && typeof from === "object" || typeof from === "function") {
         | 
| 13 | 
            +
                for (let key of __getOwnPropNames(from))
         | 
| 14 | 
            +
                  if (!__hasOwnProp.call(to, key) && key !== except)
         | 
| 15 | 
            +
                    __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
         | 
| 16 | 
            +
              }
         | 
| 17 | 
            +
              return to;
         | 
| 18 | 
            +
            };
         | 
| 19 | 
            +
            var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
         | 
| 20 | 
            +
              isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
         | 
| 21 | 
            +
              mod
         | 
| 22 | 
            +
            ));
         | 
| 23 | 
            +
            var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
         | 
| 24 | 
            +
            var ensureAbsolutePath_exports = {};
         | 
| 25 | 
            +
            __export(ensureAbsolutePath_exports, {
         | 
| 26 | 
            +
              ensureAbsolutePath: () => ensureAbsolutePath
         | 
| 27 | 
            +
            });
         | 
| 28 | 
            +
            module.exports = __toCommonJS(ensureAbsolutePath_exports);
         | 
| 29 | 
            +
            var import_path = __toESM(require("path"));
         | 
| 30 | 
            +
            const ensureAbsolutePath = (base, filePath) => import_path.default.isAbsolute(filePath) ? filePath : import_path.default.resolve(base, filePath);
         | 
| 31 | 
            +
            // Annotate the CommonJS export names for ESM import in node:
         | 
| 32 | 
            +
            0 && (module.exports = {
         | 
| 33 | 
            +
              ensureAbsolutePath
         | 
| 34 | 
            +
            });
         | 
    
        package/dist/ensureArray.d.ts
    CHANGED
    
    | @@ -1 +1 @@ | |
| 1 | 
            -
            export declare const ensureArray: <T>(params: T | T[]) => T[];
         | 
| 1 | 
            +
            export declare const ensureArray: <T>(params: T | T[]) => T[];
         | 
    
        package/dist/ensureArray.js
    CHANGED
    
    | @@ -1,10 +1,32 @@ | |
| 1 | 
            -
             | 
| 2 | 
            -
             | 
| 3 | 
            -
             | 
| 1 | 
            +
            var __defProp = Object.defineProperty;
         | 
| 2 | 
            +
            var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
         | 
| 3 | 
            +
            var __getOwnPropNames = Object.getOwnPropertyNames;
         | 
| 4 | 
            +
            var __hasOwnProp = Object.prototype.hasOwnProperty;
         | 
| 5 | 
            +
            var __export = (target, all) => {
         | 
| 6 | 
            +
              for (var name in all)
         | 
| 7 | 
            +
                __defProp(target, name, { get: all[name], enumerable: true });
         | 
| 8 | 
            +
            };
         | 
| 9 | 
            +
            var __copyProps = (to, from, except, desc) => {
         | 
| 10 | 
            +
              if (from && typeof from === "object" || typeof from === "function") {
         | 
| 11 | 
            +
                for (let key of __getOwnPropNames(from))
         | 
| 12 | 
            +
                  if (!__hasOwnProp.call(to, key) && key !== except)
         | 
| 13 | 
            +
                    __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
         | 
| 14 | 
            +
              }
         | 
| 15 | 
            +
              return to;
         | 
| 16 | 
            +
            };
         | 
| 17 | 
            +
            var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
         | 
| 18 | 
            +
            var ensureArray_exports = {};
         | 
| 19 | 
            +
            __export(ensureArray_exports, {
         | 
| 20 | 
            +
              ensureArray: () => ensureArray
         | 
| 21 | 
            +
            });
         | 
| 22 | 
            +
            module.exports = __toCommonJS(ensureArray_exports);
         | 
| 4 23 | 
             
            const ensureArray = (params) => {
         | 
| 5 | 
            -
             | 
| 6 | 
            -
             | 
| 7 | 
            -
             | 
| 8 | 
            -
             | 
| 24 | 
            +
              if (Array.isArray(params)) {
         | 
| 25 | 
            +
                return params;
         | 
| 26 | 
            +
              }
         | 
| 27 | 
            +
              return [params];
         | 
| 9 28 | 
             
            };
         | 
| 10 | 
            -
             | 
| 29 | 
            +
            // Annotate the CommonJS export names for ESM import in node:
         | 
| 30 | 
            +
            0 && (module.exports = {
         | 
| 31 | 
            +
              ensureArray
         | 
| 32 | 
            +
            });
         | 
    
        package/dist/findExists.d.ts
    CHANGED
    
    
    
        package/dist/findExists.js
    CHANGED
    
    | @@ -1,21 +1,41 @@ | |
| 1 | 
            -
             | 
| 2 | 
            -
            var  | 
| 3 | 
            -
             | 
| 1 | 
            +
            var __create = Object.create;
         | 
| 2 | 
            +
            var __defProp = Object.defineProperty;
         | 
| 3 | 
            +
            var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
         | 
| 4 | 
            +
            var __getOwnPropNames = Object.getOwnPropertyNames;
         | 
| 5 | 
            +
            var __getProtoOf = Object.getPrototypeOf;
         | 
| 6 | 
            +
            var __hasOwnProp = Object.prototype.hasOwnProperty;
         | 
| 7 | 
            +
            var __export = (target, all) => {
         | 
| 8 | 
            +
              for (var name in all)
         | 
| 9 | 
            +
                __defProp(target, name, { get: all[name], enumerable: true });
         | 
| 4 10 | 
             
            };
         | 
| 5 | 
            -
             | 
| 6 | 
            -
             | 
| 7 | 
            -
             | 
| 8 | 
            -
             | 
| 9 | 
            -
              | 
| 10 | 
            -
             | 
| 11 | 
            -
              | 
| 12 | 
            -
             | 
| 11 | 
            +
            var __copyProps = (to, from, except, desc) => {
         | 
| 12 | 
            +
              if (from && typeof from === "object" || typeof from === "function") {
         | 
| 13 | 
            +
                for (let key of __getOwnPropNames(from))
         | 
| 14 | 
            +
                  if (!__hasOwnProp.call(to, key) && key !== except)
         | 
| 15 | 
            +
                    __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
         | 
| 16 | 
            +
              }
         | 
| 17 | 
            +
              return to;
         | 
| 18 | 
            +
            };
         | 
| 19 | 
            +
            var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
         | 
| 20 | 
            +
              isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
         | 
| 21 | 
            +
              mod
         | 
| 22 | 
            +
            ));
         | 
| 23 | 
            +
            var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
         | 
| 24 | 
            +
            var findExists_exports = {};
         | 
| 25 | 
            +
            __export(findExists_exports, {
         | 
| 26 | 
            +
              findExists: () => findExists
         | 
| 27 | 
            +
            });
         | 
| 28 | 
            +
            module.exports = __toCommonJS(findExists_exports);
         | 
| 29 | 
            +
            var import_fs = __toESM(require("fs"));
         | 
| 13 30 | 
             
            const findExists = (files) => {
         | 
| 14 | 
            -
             | 
| 15 | 
            -
             | 
| 16 | 
            -
             | 
| 17 | 
            -
                    }
         | 
| 31 | 
            +
              for (const file of files) {
         | 
| 32 | 
            +
                if (import_fs.default.existsSync(file) && import_fs.default.statSync(file).isFile()) {
         | 
| 33 | 
            +
                  return file;
         | 
| 18 34 | 
             
                }
         | 
| 19 | 
            -
             | 
| 35 | 
            +
              }
         | 
| 36 | 
            +
              return false;
         | 
| 20 37 | 
             
            };
         | 
| 21 | 
            -
             | 
| 38 | 
            +
            // Annotate the CommonJS export names for ESM import in node:
         | 
| 39 | 
            +
            0 && (module.exports = {
         | 
| 40 | 
            +
              findExists
         | 
| 41 | 
            +
            });
         | 
    
        package/dist/format.d.ts
    CHANGED
    
    | @@ -7,7 +7,7 @@ | |
| 7 7 | 
             
             */
         | 
| 8 8 | 
             
            import type { StatsCompilation } from 'webpack';
         | 
| 9 9 | 
             
            declare function formatWebpackMessages(json?: Pick<StatsCompilation, 'errors' | 'warnings'>): {
         | 
| 10 | 
            -
             | 
| 11 | 
            -
             | 
| 10 | 
            +
              errors: string[];
         | 
| 11 | 
            +
              warnings: string[];
         | 
| 12 12 | 
             
            };
         | 
| 13 | 
            -
            export { formatWebpackMessages };
         | 
| 13 | 
            +
            export { formatWebpackMessages };
         | 
    
        package/dist/format.js
    CHANGED
    
    | @@ -1,88 +1,100 @@ | |
| 1 | 
            -
             | 
| 2 | 
            -
             | 
| 3 | 
            -
              | 
| 4 | 
            -
              | 
| 5 | 
            -
              | 
| 6 | 
            -
              | 
| 7 | 
            -
              | 
| 8 | 
            -
             | 
| 9 | 
            -
             | 
| 10 | 
            -
             | 
| 11 | 
            -
             | 
| 1 | 
            +
            var __defProp = Object.defineProperty;
         | 
| 2 | 
            +
            var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
         | 
| 3 | 
            +
            var __getOwnPropNames = Object.getOwnPropertyNames;
         | 
| 4 | 
            +
            var __hasOwnProp = Object.prototype.hasOwnProperty;
         | 
| 5 | 
            +
            var __export = (target, all) => {
         | 
| 6 | 
            +
              for (var name in all)
         | 
| 7 | 
            +
                __defProp(target, name, { get: all[name], enumerable: true });
         | 
| 8 | 
            +
            };
         | 
| 9 | 
            +
            var __copyProps = (to, from, except, desc) => {
         | 
| 10 | 
            +
              if (from && typeof from === "object" || typeof from === "function") {
         | 
| 11 | 
            +
                for (let key of __getOwnPropNames(from))
         | 
| 12 | 
            +
                  if (!__hasOwnProp.call(to, key) && key !== except)
         | 
| 13 | 
            +
                    __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
         | 
| 14 | 
            +
              }
         | 
| 15 | 
            +
              return to;
         | 
| 16 | 
            +
            };
         | 
| 17 | 
            +
            var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
         | 
| 18 | 
            +
            var format_exports = {};
         | 
| 19 | 
            +
            __export(format_exports, {
         | 
| 20 | 
            +
              formatWebpackMessages: () => formatWebpackMessages
         | 
| 21 | 
            +
            });
         | 
| 22 | 
            +
            module.exports = __toCommonJS(format_exports);
         | 
| 23 | 
            +
            const friendlySyntaxErrorLabel = "SyntaxError:";
         | 
| 12 24 | 
             
            function isLikelyASyntaxError(message) {
         | 
| 13 | 
            -
             | 
| 25 | 
            +
              return message.includes(friendlySyntaxErrorLabel);
         | 
| 14 26 | 
             
            }
         | 
| 15 | 
            -
            // Cleans up webpack error messages.
         | 
| 16 27 | 
             
            function formatMessage(stats) {
         | 
| 17 | 
            -
             | 
| 18 | 
            -
             | 
| 19 | 
            -
             | 
| 20 | 
            -
                 | 
| 21 | 
            -
             | 
| 22 | 
            -
             | 
| 23 | 
            -
             | 
| 24 | 
            -
             | 
| 25 | 
            -
             | 
| 28 | 
            +
              let lines = [];
         | 
| 29 | 
            +
              let message;
         | 
| 30 | 
            +
              if (typeof stats === "object") {
         | 
| 31 | 
            +
                const fileName = stats.moduleName ? `File: ${stats.moduleName}
         | 
| 32 | 
            +
            ` : "";
         | 
| 33 | 
            +
                const mainMessage = stats.message;
         | 
| 34 | 
            +
                const details = stats.details ? `
         | 
| 35 | 
            +
            Details: ${stats.details}
         | 
| 36 | 
            +
            ` : "";
         | 
| 37 | 
            +
                const stack = stats.stack ? `
         | 
| 38 | 
            +
            ${stats.stack}` : "";
         | 
| 39 | 
            +
                message = `${fileName}${mainMessage}${details}${stack}`;
         | 
| 40 | 
            +
              } else {
         | 
| 41 | 
            +
                message = stats;
         | 
| 42 | 
            +
              }
         | 
| 43 | 
            +
              lines = message.split("\n");
         | 
| 44 | 
            +
              lines = lines.map((line) => {
         | 
| 45 | 
            +
                const parsingError = /Line (\d+):(?:(\d+):)?\s*Parsing error: (.+)$/.exec(
         | 
| 46 | 
            +
                  line
         | 
| 47 | 
            +
                );
         | 
| 48 | 
            +
                if (!parsingError) {
         | 
| 49 | 
            +
                  return line;
         | 
| 26 50 | 
             
                }
         | 
| 27 | 
            -
                 | 
| 28 | 
            -
             | 
| 29 | 
            -
             | 
| 30 | 
            -
             | 
| 31 | 
            -
             | 
| 32 | 
            -
                 | 
| 33 | 
            -
             | 
| 34 | 
            -
             | 
| 35 | 
            -
             | 
| 36 | 
            -
             | 
| 37 | 
            -
             | 
| 38 | 
            -
             | 
| 39 | 
            -
             | 
| 40 | 
            -
             | 
| 41 | 
            -
             | 
| 42 | 
            -
                 | 
| 43 | 
            -
             | 
| 44 | 
            -
             | 
| 45 | 
            -
             | 
| 46 | 
            -
             | 
| 47 | 
            -
                 | 
| 48 | 
            -
             | 
| 49 | 
            -
             | 
| 50 | 
            -
             | 
| 51 | 
            -
             | 
| 52 | 
            -
             | 
| 53 | 
            -
             | 
| 54 | 
            -
             | 
| 55 | 
            -
             | 
| 56 | 
            -
                // exception of stacks containing `webpack:` because they're normally
         | 
| 57 | 
            -
                // from user code generated by webpack. For more information see
         | 
| 58 | 
            -
                // https://github.com/facebook/create-react-app/pull/1050
         | 
| 59 | 
            -
                message = message.replace(/^\s*at\s((?!webpack:).)*:\d+:\d+[\s)]*(\n|$)/gm, ''); // at ... ...:x:y
         | 
| 60 | 
            -
                message = message.replace(/^\s*at\s<anonymous>(\n|$)/gm, ''); // at <anonymous>
         | 
| 61 | 
            -
                lines = message.split('\n');
         | 
| 62 | 
            -
                // Remove duplicated newlines
         | 
| 63 | 
            -
                lines = lines.filter((line, index, arr) => index === 0 ||
         | 
| 64 | 
            -
                    line.trim() !== '' ||
         | 
| 65 | 
            -
                    line.trim() !== arr[index - 1].trim());
         | 
| 66 | 
            -
                // Reassemble the message
         | 
| 67 | 
            -
                message = lines.join('\n');
         | 
| 68 | 
            -
                return message.trim();
         | 
| 51 | 
            +
                const [, errorLine, errorColumn, errorMessage] = parsingError;
         | 
| 52 | 
            +
                return `${friendlySyntaxErrorLabel} ${errorMessage} (${errorLine}:${errorColumn})`;
         | 
| 53 | 
            +
              });
         | 
| 54 | 
            +
              message = lines.join("\n");
         | 
| 55 | 
            +
              message = message.replace(
         | 
| 56 | 
            +
                /SyntaxError\s+\((\d+):(\d+)\)\s*(.+?)\n/g,
         | 
| 57 | 
            +
                `${friendlySyntaxErrorLabel} $3 ($1:$2)
         | 
| 58 | 
            +
            `
         | 
| 59 | 
            +
              );
         | 
| 60 | 
            +
              lines = message.split("\n");
         | 
| 61 | 
            +
              if (lines.length > 2 && lines[1].trim() === "") {
         | 
| 62 | 
            +
                lines.splice(1, 1);
         | 
| 63 | 
            +
              }
         | 
| 64 | 
            +
              lines[0] = lines[0].replace(/^(.*) \d+:\d+-\d+$/, "$1");
         | 
| 65 | 
            +
              if (lines[1] && lines[1].indexOf("Module not found:") !== -1) {
         | 
| 66 | 
            +
                lines[1] = lines[1].replace("Error: ", "");
         | 
| 67 | 
            +
              }
         | 
| 68 | 
            +
              message = lines.join("\n");
         | 
| 69 | 
            +
              message = message.replace(
         | 
| 70 | 
            +
                /^\s*at\s((?!webpack:).)*:\d+:\d+[\s)]*(\n|$)/gm,
         | 
| 71 | 
            +
                ""
         | 
| 72 | 
            +
              );
         | 
| 73 | 
            +
              message = message.replace(/^\s*at\s<anonymous>(\n|$)/gm, "");
         | 
| 74 | 
            +
              lines = message.split("\n");
         | 
| 75 | 
            +
              lines = lines.filter(
         | 
| 76 | 
            +
                (line, index, arr) => index === 0 || line.trim() !== "" || line.trim() !== arr[index - 1].trim()
         | 
| 77 | 
            +
              );
         | 
| 78 | 
            +
              message = lines.join("\n");
         | 
| 79 | 
            +
              return message.trim();
         | 
| 69 80 | 
             
            }
         | 
| 70 81 | 
             
            function formatWebpackMessages(json) {
         | 
| 71 | 
            -
             | 
| 72 | 
            -
             | 
| 73 | 
            -
             | 
| 74 | 
            -
             | 
| 75 | 
            -
             | 
| 76 | 
            -
             | 
| 77 | 
            -
             | 
| 78 | 
            -
             | 
| 79 | 
            -
             | 
| 80 | 
            -
             | 
| 81 | 
            -
             | 
| 82 | 
            -
                 | 
| 83 | 
            -
             | 
| 84 | 
            -
             | 
| 85 | 
            -
                }
         | 
| 86 | 
            -
                return result;
         | 
| 82 | 
            +
              var _a, _b, _c;
         | 
| 83 | 
            +
              const formattedErrors = (_a = json == null ? void 0 : json.errors) == null ? void 0 : _a.map(formatMessage);
         | 
| 84 | 
            +
              const formattedWarnings = (_b = json == null ? void 0 : json.warnings) == null ? void 0 : _b.map(formatMessage);
         | 
| 85 | 
            +
              const result = {
         | 
| 86 | 
            +
                errors: formattedErrors || [],
         | 
| 87 | 
            +
                warnings: formattedWarnings || []
         | 
| 88 | 
            +
              };
         | 
| 89 | 
            +
              if ((_c = result.errors) == null ? void 0 : _c.some(isLikelyASyntaxError)) {
         | 
| 90 | 
            +
                result.errors = result.errors.filter(isLikelyASyntaxError);
         | 
| 91 | 
            +
              }
         | 
| 92 | 
            +
              if (result.errors.length > 1) {
         | 
| 93 | 
            +
                result.errors.length = 1;
         | 
| 94 | 
            +
              }
         | 
| 95 | 
            +
              return result;
         | 
| 87 96 | 
             
            }
         | 
| 88 | 
            -
             | 
| 97 | 
            +
            // Annotate the CommonJS export names for ESM import in node:
         | 
| 98 | 
            +
            0 && (module.exports = {
         | 
| 99 | 
            +
              formatWebpackMessages
         | 
| 100 | 
            +
            });
         | 
| @@ -8,9 +8,9 @@ | |
| 8 8 | 
             
             * Modified from https://github.com/jantimon/html-webpack-plugin/blob/2f5de7ab9e8bca60e9e200f2e4b4cfab90db28d4/index.js#L800
         | 
| 9 9 | 
             
             */
         | 
| 10 10 | 
             
            export type MetaAttributes = {
         | 
| 11 | 
            -
             | 
| 11 | 
            +
              [attributeName: string]: string | boolean;
         | 
| 12 12 | 
             
            };
         | 
| 13 13 | 
             
            export interface MetaOptions {
         | 
| 14 | 
            -
             | 
| 14 | 
            +
              [name: string]: string | false | MetaAttributes;
         | 
| 15 15 | 
             
            }
         | 
| 16 | 
            -
            export declare const generateMetaTags: (metaOptions?: MetaOptions) => string;
         | 
| 16 | 
            +
            export declare const generateMetaTags: (metaOptions?: MetaOptions) => string;
         | 
    
        package/dist/generateMetaTags.js
    CHANGED
    
    | @@ -1,48 +1,61 @@ | |
| 1 | 
            -
             | 
| 2 | 
            -
             | 
| 3 | 
            -
             | 
| 1 | 
            +
            var __defProp = Object.defineProperty;
         | 
| 2 | 
            +
            var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
         | 
| 3 | 
            +
            var __getOwnPropNames = Object.getOwnPropertyNames;
         | 
| 4 | 
            +
            var __hasOwnProp = Object.prototype.hasOwnProperty;
         | 
| 5 | 
            +
            var __export = (target, all) => {
         | 
| 6 | 
            +
              for (var name in all)
         | 
| 7 | 
            +
                __defProp(target, name, { get: all[name], enumerable: true });
         | 
| 8 | 
            +
            };
         | 
| 9 | 
            +
            var __copyProps = (to, from, except, desc) => {
         | 
| 10 | 
            +
              if (from && typeof from === "object" || typeof from === "function") {
         | 
| 11 | 
            +
                for (let key of __getOwnPropNames(from))
         | 
| 12 | 
            +
                  if (!__hasOwnProp.call(to, key) && key !== except)
         | 
| 13 | 
            +
                    __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
         | 
| 14 | 
            +
              }
         | 
| 15 | 
            +
              return to;
         | 
| 16 | 
            +
            };
         | 
| 17 | 
            +
            var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
         | 
| 18 | 
            +
            var generateMetaTags_exports = {};
         | 
| 19 | 
            +
            __export(generateMetaTags_exports, {
         | 
| 20 | 
            +
              generateMetaTags: () => generateMetaTags
         | 
| 21 | 
            +
            });
         | 
| 22 | 
            +
            module.exports = __toCommonJS(generateMetaTags_exports);
         | 
| 4 23 | 
             
            const tagObjectToString = (tagDefinition) => {
         | 
| 5 | 
            -
             | 
| 6 | 
            -
             | 
| 7 | 
            -
             | 
| 8 | 
            -
             | 
| 9 | 
            -
             | 
| 10 | 
            -
             | 
| 11 | 
            -
             | 
| 12 | 
            -
                });
         | 
| 13 | 
            -
                return `<${[tagDefinition.tagName].concat(attributes).join(' ')}>${tagDefinition.innerHTML || ''}${tagDefinition.voidTag ? '' : `</${tagDefinition.tagName}>`}`;
         | 
| 24 | 
            +
              const attributes = Object.keys(tagDefinition.attributes || {}).filter((attributeName) => tagDefinition.attributes[attributeName] !== false).map((attributeName) => {
         | 
| 25 | 
            +
                if (tagDefinition.attributes[attributeName] === true) {
         | 
| 26 | 
            +
                  return attributeName;
         | 
| 27 | 
            +
                }
         | 
| 28 | 
            +
                return `${attributeName}="${tagDefinition.attributes[attributeName]}"`;
         | 
| 29 | 
            +
              });
         | 
| 30 | 
            +
              return `<${[tagDefinition.tagName].concat(attributes).join(" ")}>${tagDefinition.innerHTML || ""}${tagDefinition.voidTag ? "" : `</${tagDefinition.tagName}>`}`;
         | 
| 14 31 | 
             
            };
         | 
| 15 32 | 
             
            const generateMetaTags = (metaOptions) => {
         | 
| 16 | 
            -
             | 
| 17 | 
            -
             | 
| 33 | 
            +
              if (!metaOptions) {
         | 
| 34 | 
            +
                return "";
         | 
| 35 | 
            +
              }
         | 
| 36 | 
            +
              const metaTagAttributeObjects = Object.keys(metaOptions).map((metaName) => {
         | 
| 37 | 
            +
                const metaTagContent = metaOptions[metaName];
         | 
| 38 | 
            +
                return typeof metaTagContent === "string" ? {
         | 
| 39 | 
            +
                  name: metaName,
         | 
| 40 | 
            +
                  content: metaTagContent
         | 
| 41 | 
            +
                } : metaTagContent;
         | 
| 42 | 
            +
              }).filter((attribute) => attribute !== false);
         | 
| 43 | 
            +
              return metaTagAttributeObjects.map((metaTagAttributes) => {
         | 
| 44 | 
            +
                if (metaTagAttributes === false) {
         | 
| 45 | 
            +
                  throw new Error("Invalid meta tag");
         | 
| 18 46 | 
             
                }
         | 
| 19 | 
            -
                 | 
| 20 | 
            -
             | 
| 21 | 
            -
             | 
| 22 | 
            -
             | 
| 23 | 
            -
             | 
| 24 | 
            -
             | 
| 25 | 
            -
             | 
| 26 | 
            -
             | 
| 27 | 
            -
             | 
| 28 | 
            -
             | 
| 29 | 
            -
                        }
         | 
| 30 | 
            -
                        : metaTagContent;
         | 
| 31 | 
            -
                })
         | 
| 32 | 
            -
                    .filter(attribute => attribute !== false);
         | 
| 33 | 
            -
                // Turn [{ name:"viewport" content:"width=500, initial-scale=1" }] into
         | 
| 34 | 
            -
                // the html-webpack-plugin tag structure
         | 
| 35 | 
            -
                return metaTagAttributeObjects
         | 
| 36 | 
            -
                    .map(metaTagAttributes => {
         | 
| 37 | 
            -
                    if (metaTagAttributes === false) {
         | 
| 38 | 
            -
                        throw new Error('Invalid meta tag');
         | 
| 39 | 
            -
                    }
         | 
| 40 | 
            -
                    return {
         | 
| 41 | 
            -
                        tagName: 'meta',
         | 
| 42 | 
            -
                        voidTag: true,
         | 
| 43 | 
            -
                        attributes: metaTagAttributes,
         | 
| 44 | 
            -
                    };
         | 
| 45 | 
            -
                })
         | 
| 46 | 
            -
                    .reduce((memo, tagObject) => `${memo}\n${tagObjectToString(tagObject)}`, '');
         | 
| 47 | 
            +
                return {
         | 
| 48 | 
            +
                  tagName: "meta",
         | 
| 49 | 
            +
                  voidTag: true,
         | 
| 50 | 
            +
                  attributes: metaTagAttributes
         | 
| 51 | 
            +
                };
         | 
| 52 | 
            +
              }).reduce(
         | 
| 53 | 
            +
                (memo, tagObject) => `${memo}
         | 
| 54 | 
            +
            ${tagObjectToString(tagObject)}`,
         | 
| 55 | 
            +
                ""
         | 
| 56 | 
            +
              );
         | 
| 47 57 | 
             
            };
         | 
| 48 | 
            -
             | 
| 58 | 
            +
            // Annotate the CommonJS export names for ESM import in node:
         | 
| 59 | 
            +
            0 && (module.exports = {
         | 
| 60 | 
            +
              generateMetaTags
         | 
| 61 | 
            +
            });
         | 
| @@ -1,2 +1,2 @@ | |
| 1 1 | 
             
            export declare const defaults: string[];
         | 
| 2 | 
            -
            export declare const getBrowserslist: (appDirectory: string) => string[];
         | 
| 2 | 
            +
            export declare const getBrowserslist: (appDirectory: string) => string[];
         | 
    
        package/dist/getBrowserslist.js
    CHANGED
    
    | @@ -1,7 +1,31 @@ | |
| 1 | 
            -
             | 
| 2 | 
            -
             | 
| 3 | 
            -
             | 
| 4 | 
            -
             | 
| 5 | 
            -
             | 
| 6 | 
            -
             | 
| 7 | 
            -
             | 
| 1 | 
            +
            var __defProp = Object.defineProperty;
         | 
| 2 | 
            +
            var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
         | 
| 3 | 
            +
            var __getOwnPropNames = Object.getOwnPropertyNames;
         | 
| 4 | 
            +
            var __hasOwnProp = Object.prototype.hasOwnProperty;
         | 
| 5 | 
            +
            var __export = (target, all) => {
         | 
| 6 | 
            +
              for (var name in all)
         | 
| 7 | 
            +
                __defProp(target, name, { get: all[name], enumerable: true });
         | 
| 8 | 
            +
            };
         | 
| 9 | 
            +
            var __copyProps = (to, from, except, desc) => {
         | 
| 10 | 
            +
              if (from && typeof from === "object" || typeof from === "function") {
         | 
| 11 | 
            +
                for (let key of __getOwnPropNames(from))
         | 
| 12 | 
            +
                  if (!__hasOwnProp.call(to, key) && key !== except)
         | 
| 13 | 
            +
                    __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
         | 
| 14 | 
            +
              }
         | 
| 15 | 
            +
              return to;
         | 
| 16 | 
            +
            };
         | 
| 17 | 
            +
            var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
         | 
| 18 | 
            +
            var getBrowserslist_exports = {};
         | 
| 19 | 
            +
            __export(getBrowserslist_exports, {
         | 
| 20 | 
            +
              defaults: () => defaults,
         | 
| 21 | 
            +
              getBrowserslist: () => getBrowserslist
         | 
| 22 | 
            +
            });
         | 
| 23 | 
            +
            module.exports = __toCommonJS(getBrowserslist_exports);
         | 
| 24 | 
            +
            var import_compiled = require("./compiled");
         | 
| 25 | 
            +
            const defaults = ["> 0.01%", "not dead", "not op_mini all"];
         | 
| 26 | 
            +
            const getBrowserslist = (appDirectory) => import_compiled.browserslist.loadConfig({ path: appDirectory }) || defaults;
         | 
| 27 | 
            +
            // Annotate the CommonJS export names for ESM import in node:
         | 
| 28 | 
            +
            0 && (module.exports = {
         | 
| 29 | 
            +
              defaults,
         | 
| 30 | 
            +
              getBrowserslist
         | 
| 31 | 
            +
            });
         | 
| @@ -1 +1 @@ | |
| 1 | 
            -
            export declare const getCoreJsVersion: (corejsPkgPath: string) => string;
         | 
| 1 | 
            +
            export declare const getCoreJsVersion: (corejsPkgPath: string) => string;
         |