@modern-js/utils 2.21.1 → 2.22.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (43) hide show
  1. package/CHANGELOG.md +11 -0
  2. package/dist/cjs/cli/alias.js +12 -4
  3. package/dist/cjs/cli/applyOptionsChain.js +3 -1
  4. package/dist/cjs/cli/babel.js +6 -2
  5. package/dist/cjs/cli/commands.js +12 -4
  6. package/dist/cjs/cli/common.js +9 -3
  7. package/dist/cjs/cli/constants/chainId.js +3 -1
  8. package/dist/cjs/cli/constants/index.js +93 -31
  9. package/dist/cjs/cli/ensure.js +6 -2
  10. package/dist/cjs/cli/fs.js +6 -2
  11. package/dist/cjs/cli/get/config.js +3 -1
  12. package/dist/cjs/cli/get/data.js +24 -8
  13. package/dist/cjs/cli/get/index.js +6 -2
  14. package/dist/cjs/cli/is/config.js +18 -6
  15. package/dist/cjs/cli/is/env.js +18 -6
  16. package/dist/cjs/cli/is/platform.js +6 -2
  17. package/dist/cjs/cli/is/project.js +21 -7
  18. package/dist/cjs/cli/is/type.js +27 -9
  19. package/dist/cjs/cli/logger.js +6 -2
  20. package/dist/cjs/cli/monorepo.js +21 -7
  21. package/dist/cjs/cli/package.js +12 -4
  22. package/dist/cjs/cli/path.js +39 -13
  23. package/dist/cjs/cli/pathSerializer.js +12 -4
  24. package/dist/cjs/cli/port.js +3 -1
  25. package/dist/cjs/cli/prettyInstructions.js +6 -2
  26. package/dist/cjs/cli/print.js +3 -1
  27. package/dist/cjs/cli/require.js +18 -6
  28. package/dist/cjs/cli/routes.js +3 -1
  29. package/dist/cjs/cli/runtimeExports.js +3 -1
  30. package/dist/cjs/cli/test.js +3 -1
  31. package/dist/cjs/cli/watch.js +6 -2
  32. package/dist/cjs/compiled.js +99 -33
  33. package/dist/cjs/import.js +6 -2
  34. package/dist/cjs/runtime/nestedRoutes.js +6 -2
  35. package/dist/cjs/runtime-browser/parsed.js +8 -2
  36. package/dist/cjs/runtime-node/index.js +9 -3
  37. package/dist/cjs/runtime-node/serialize.js +3 -1
  38. package/dist/cjs/runtime-node/storage.js +3 -1
  39. package/dist/cjs/universal/constants.js +6 -2
  40. package/dist/cjs/universal/formatWebpack.js +3 -1
  41. package/dist/cjs/universal/pluginDagSort.js +3 -1
  42. package/dist/esm/runtime-browser/parsed.js +5 -1
  43. package/package.json +5 -5
package/CHANGELOG.md CHANGED
@@ -1,5 +1,16 @@
1
1
  # @modern-js/utils
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
+ - 5050e8e: fix: browser should get last element that server insert to html for baseUrl
12
+ fix: 浏览器需要获取最后一个 Server 注入 HTML 的 baseUrl 数据
13
+
3
14
  ## 2.21.1
4
15
 
5
16
  ## 2.21.0
@@ -10,10 +10,18 @@ function _export(target, all) {
10
10
  });
11
11
  }
12
12
  _export(exports, {
13
- validAlias: () => validAlias,
14
- mergeAlias: () => mergeAlias,
15
- getAliasConfig: () => getAliasConfig,
16
- getUserAlias: () => getUserAlias
13
+ validAlias: function() {
14
+ return validAlias;
15
+ },
16
+ mergeAlias: function() {
17
+ return mergeAlias;
18
+ },
19
+ getAliasConfig: function() {
20
+ return getAliasConfig;
21
+ },
22
+ getUserAlias: function() {
23
+ return getUserAlias;
24
+ }
17
25
  });
18
26
  const _interop_require_default = require("@swc/helpers/_/_interop_require_default");
19
27
  const _fs = /* @__PURE__ */ _interop_require_default._(require("fs"));
@@ -4,7 +4,9 @@ Object.defineProperty(exports, "__esModule", {
4
4
  });
5
5
  Object.defineProperty(exports, "applyOptionsChain", {
6
6
  enumerable: true,
7
- get: () => applyOptionsChain
7
+ get: function() {
8
+ return applyOptionsChain;
9
+ }
8
10
  });
9
11
  const _is = require("./is");
10
12
  const _logger = require("./logger");
@@ -10,8 +10,12 @@ function _export(target, all) {
10
10
  });
11
11
  }
12
12
  _export(exports, {
13
- getBabelUtils: () => getBabelUtils,
14
- applyUserBabelConfig: () => applyUserBabelConfig
13
+ getBabelUtils: function() {
14
+ return getBabelUtils;
15
+ },
16
+ applyUserBabelConfig: function() {
17
+ return applyUserBabelConfig;
18
+ }
15
19
  });
16
20
  const _path = require("path");
17
21
  const _applyOptionsChain = require("./applyOptionsChain");
@@ -10,10 +10,18 @@ function _export(target, all) {
10
10
  });
11
11
  }
12
12
  _export(exports, {
13
- getFullArgv: () => getFullArgv,
14
- getArgv: () => getArgv,
15
- getCommand: () => getCommand,
16
- isDevCommand: () => isDevCommand
13
+ getFullArgv: function() {
14
+ return getFullArgv;
15
+ },
16
+ getArgv: function() {
17
+ return getArgv;
18
+ },
19
+ getCommand: function() {
20
+ return getCommand;
21
+ },
22
+ isDevCommand: function() {
23
+ return isDevCommand;
24
+ }
17
25
  });
18
26
  const getFullArgv = () => {
19
27
  var _process_env_MODERN_ARGV;
@@ -10,9 +10,15 @@ function _export(target, all) {
10
10
  });
11
11
  }
12
12
  _export(exports, {
13
- createDebugger: () => createDebugger,
14
- clearConsole: () => clearConsole,
15
- wait: () => wait
13
+ createDebugger: function() {
14
+ return createDebugger;
15
+ },
16
+ clearConsole: function() {
17
+ return clearConsole;
18
+ },
19
+ wait: function() {
20
+ return wait;
21
+ }
16
22
  });
17
23
  const _debug = require("../../compiled/debug");
18
24
  const createDebugger = (scope) => (0, _debug.debug)(`modern-js:${scope}`);
@@ -4,7 +4,9 @@ Object.defineProperty(exports, "__esModule", {
4
4
  });
5
5
  Object.defineProperty(exports, "CHAIN_ID", {
6
6
  enumerable: true,
7
- get: () => CHAIN_ID
7
+ get: function() {
8
+ return CHAIN_ID;
9
+ }
8
10
  });
9
11
  const CHAIN_ID = {
10
12
  /** Predefined rules */
@@ -10,37 +10,99 @@ function _export(target, all) {
10
10
  });
11
11
  }
12
12
  _export(exports, {
13
- ROUTE_SPEC_FILE: () => ROUTE_SPEC_FILE,
14
- MAIN_ENTRY_NAME: () => MAIN_ENTRY_NAME,
15
- SERVER_BUNDLE_DIRECTORY: () => SERVER_BUNDLE_DIRECTORY,
16
- SERVER_WORKER_BUNDLE_DIRECTORY: () => SERVER_WORKER_BUNDLE_DIRECTORY,
17
- ENTRY_NAME_PATTERN: () => ENTRY_NAME_PATTERN,
18
- SERVER_RENDER_FUNCTION_NAME: () => SERVER_RENDER_FUNCTION_NAME,
19
- LOADABLE_STATS_FILE: () => LOADABLE_STATS_FILE,
20
- API_DIR: () => API_DIR,
21
- SERVER_DIR: () => SERVER_DIR,
22
- SHARED_DIR: () => SHARED_DIR,
23
- CONFIG_CACHE_DIR: () => CONFIG_CACHE_DIR,
24
- CONFIG_FILE_EXTENSIONS: () => CONFIG_FILE_EXTENSIONS,
25
- OUTPUT_CONFIG_FILE: () => OUTPUT_CONFIG_FILE,
26
- DEFAULT_SERVER_CONFIG: () => DEFAULT_SERVER_CONFIG,
27
- ROUTE_MANIFEST_FILE: () => ROUTE_MANIFEST_FILE,
28
- LOADER_ROUTES_DIR: () => LOADER_ROUTES_DIR,
29
- DEFAULT_DEV_HOST: () => DEFAULT_DEV_HOST,
30
- INTERNAL_APP_TOOLS_PLUGINS: () => INTERNAL_APP_TOOLS_PLUGINS,
31
- INTERNAL_APP_TOOLS_RUNTIME_PLUGINS: () => INTERNAL_APP_TOOLS_RUNTIME_PLUGINS,
32
- INTERNAL_MODULE_TOOLS_PLUGINS: () => INTERNAL_MODULE_TOOLS_PLUGINS,
33
- INTERNAL_MONOREPO_TOOLS_PLUGINS: () => INTERNAL_MONOREPO_TOOLS_PLUGINS,
34
- INTERNAL_DOC_TOOLS_PLUGINS: () => INTERNAL_DOC_TOOLS_PLUGINS,
35
- INTERNAL_CLI_PLUGINS: () => INTERNAL_CLI_PLUGINS,
36
- SERVER_PLUGIN_BFF: () => SERVER_PLUGIN_BFF,
37
- SERVER_PLUGIN_EXPRESS: () => SERVER_PLUGIN_EXPRESS,
38
- SERVER_PLUGIN_KOA: () => SERVER_PLUGIN_KOA,
39
- SERVER_PLUGIN_SERVER: () => SERVER_PLUGIN_SERVER,
40
- SERVER_PLUGIN_POLYFILL: () => SERVER_PLUGIN_POLYFILL,
41
- INTERNAL_SERVER_PLUGINS: () => INTERNAL_SERVER_PLUGINS,
42
- PLUGIN_SCHEMAS: () => PLUGIN_SCHEMAS,
43
- DEFAULT_BABEL_PRESET_TYPESCRIPT_OPTIONS: () => DEFAULT_BABEL_PRESET_TYPESCRIPT_OPTIONS
13
+ ROUTE_SPEC_FILE: function() {
14
+ return ROUTE_SPEC_FILE;
15
+ },
16
+ MAIN_ENTRY_NAME: function() {
17
+ return MAIN_ENTRY_NAME;
18
+ },
19
+ SERVER_BUNDLE_DIRECTORY: function() {
20
+ return SERVER_BUNDLE_DIRECTORY;
21
+ },
22
+ SERVER_WORKER_BUNDLE_DIRECTORY: function() {
23
+ return SERVER_WORKER_BUNDLE_DIRECTORY;
24
+ },
25
+ ENTRY_NAME_PATTERN: function() {
26
+ return ENTRY_NAME_PATTERN;
27
+ },
28
+ SERVER_RENDER_FUNCTION_NAME: function() {
29
+ return SERVER_RENDER_FUNCTION_NAME;
30
+ },
31
+ LOADABLE_STATS_FILE: function() {
32
+ return LOADABLE_STATS_FILE;
33
+ },
34
+ API_DIR: function() {
35
+ return API_DIR;
36
+ },
37
+ SERVER_DIR: function() {
38
+ return SERVER_DIR;
39
+ },
40
+ SHARED_DIR: function() {
41
+ return SHARED_DIR;
42
+ },
43
+ CONFIG_CACHE_DIR: function() {
44
+ return CONFIG_CACHE_DIR;
45
+ },
46
+ CONFIG_FILE_EXTENSIONS: function() {
47
+ return CONFIG_FILE_EXTENSIONS;
48
+ },
49
+ OUTPUT_CONFIG_FILE: function() {
50
+ return OUTPUT_CONFIG_FILE;
51
+ },
52
+ DEFAULT_SERVER_CONFIG: function() {
53
+ return DEFAULT_SERVER_CONFIG;
54
+ },
55
+ ROUTE_MANIFEST_FILE: function() {
56
+ return ROUTE_MANIFEST_FILE;
57
+ },
58
+ LOADER_ROUTES_DIR: function() {
59
+ return LOADER_ROUTES_DIR;
60
+ },
61
+ DEFAULT_DEV_HOST: function() {
62
+ return DEFAULT_DEV_HOST;
63
+ },
64
+ INTERNAL_APP_TOOLS_PLUGINS: function() {
65
+ return INTERNAL_APP_TOOLS_PLUGINS;
66
+ },
67
+ INTERNAL_APP_TOOLS_RUNTIME_PLUGINS: function() {
68
+ return INTERNAL_APP_TOOLS_RUNTIME_PLUGINS;
69
+ },
70
+ INTERNAL_MODULE_TOOLS_PLUGINS: function() {
71
+ return INTERNAL_MODULE_TOOLS_PLUGINS;
72
+ },
73
+ INTERNAL_MONOREPO_TOOLS_PLUGINS: function() {
74
+ return INTERNAL_MONOREPO_TOOLS_PLUGINS;
75
+ },
76
+ INTERNAL_DOC_TOOLS_PLUGINS: function() {
77
+ return INTERNAL_DOC_TOOLS_PLUGINS;
78
+ },
79
+ INTERNAL_CLI_PLUGINS: function() {
80
+ return INTERNAL_CLI_PLUGINS;
81
+ },
82
+ SERVER_PLUGIN_BFF: function() {
83
+ return SERVER_PLUGIN_BFF;
84
+ },
85
+ SERVER_PLUGIN_EXPRESS: function() {
86
+ return SERVER_PLUGIN_EXPRESS;
87
+ },
88
+ SERVER_PLUGIN_KOA: function() {
89
+ return SERVER_PLUGIN_KOA;
90
+ },
91
+ SERVER_PLUGIN_SERVER: function() {
92
+ return SERVER_PLUGIN_SERVER;
93
+ },
94
+ SERVER_PLUGIN_POLYFILL: function() {
95
+ return SERVER_PLUGIN_POLYFILL;
96
+ },
97
+ INTERNAL_SERVER_PLUGINS: function() {
98
+ return INTERNAL_SERVER_PLUGINS;
99
+ },
100
+ PLUGIN_SCHEMAS: function() {
101
+ return PLUGIN_SCHEMAS;
102
+ },
103
+ DEFAULT_BABEL_PRESET_TYPESCRIPT_OPTIONS: function() {
104
+ return DEFAULT_BABEL_PRESET_TYPESCRIPT_OPTIONS;
105
+ }
44
106
  });
45
107
  const _export_star = require("@swc/helpers/_/_export_star");
46
108
  _export_star._(require("./chainId"), exports);
@@ -10,8 +10,12 @@ function _export(target, all) {
10
10
  });
11
11
  }
12
12
  _export(exports, {
13
- ensureAbsolutePath: () => ensureAbsolutePath,
14
- ensureArray: () => ensureArray
13
+ ensureAbsolutePath: function() {
14
+ return ensureAbsolutePath;
15
+ },
16
+ ensureArray: function() {
17
+ return ensureArray;
18
+ }
15
19
  });
16
20
  const _interop_require_default = require("@swc/helpers/_/_interop_require_default");
17
21
  const _path = /* @__PURE__ */ _interop_require_default._(require("path"));
@@ -10,8 +10,12 @@ function _export(target, all) {
10
10
  });
11
11
  }
12
12
  _export(exports, {
13
- findExists: () => findExists,
14
- emptyDir: () => emptyDir
13
+ findExists: function() {
14
+ return findExists;
15
+ },
16
+ emptyDir: function() {
17
+ return emptyDir;
18
+ }
15
19
  });
16
20
  const _compiled = require("../compiled");
17
21
  const findExists = (files) => {
@@ -4,7 +4,9 @@ Object.defineProperty(exports, "__esModule", {
4
4
  });
5
5
  Object.defineProperty(exports, "getEntryOptions", {
6
6
  enumerable: true,
7
- get: () => getEntryOptions
7
+ get: function() {
8
+ return getEntryOptions;
9
+ }
8
10
  });
9
11
  const _is = require("../is");
10
12
  const _constants = require("../constants");
@@ -10,14 +10,30 @@ function _export(target, all) {
10
10
  });
11
11
  }
12
12
  _export(exports, {
13
- getPackageManager: () => getPackageManager,
14
- getCoreJsVersion: () => getCoreJsVersion,
15
- getAntdMajorVersion: () => getAntdMajorVersion,
16
- defaults: () => defaults,
17
- getBrowserslist: () => getBrowserslist,
18
- getInternalPlugins: () => getInternalPlugins,
19
- readTsConfig: () => readTsConfig,
20
- readTsConfigByFile: () => readTsConfigByFile
13
+ getPackageManager: function() {
14
+ return getPackageManager;
15
+ },
16
+ getCoreJsVersion: function() {
17
+ return getCoreJsVersion;
18
+ },
19
+ getAntdMajorVersion: function() {
20
+ return getAntdMajorVersion;
21
+ },
22
+ defaults: function() {
23
+ return defaults;
24
+ },
25
+ getBrowserslist: function() {
26
+ return getBrowserslist;
27
+ },
28
+ getInternalPlugins: function() {
29
+ return getInternalPlugins;
30
+ },
31
+ readTsConfig: function() {
32
+ return readTsConfig;
33
+ },
34
+ readTsConfigByFile: function() {
35
+ return readTsConfigByFile;
36
+ }
21
37
  });
22
38
  const _interop_require_default = require("@swc/helpers/_/_interop_require_default");
23
39
  const _os = /* @__PURE__ */ _interop_require_default._(require("os"));
@@ -10,8 +10,12 @@ function _export(target, all) {
10
10
  });
11
11
  }
12
12
  _export(exports, {
13
- getServerConfig: () => getServerConfig,
14
- getTargetDir: () => getTargetDir
13
+ getServerConfig: function() {
14
+ return getServerConfig;
15
+ },
16
+ getTargetDir: function() {
17
+ return getTargetDir;
18
+ }
15
19
  });
16
20
  const _export_star = require("@swc/helpers/_/_export_star");
17
21
  const _interop_require_default = require("@swc/helpers/_/_interop_require_default");
@@ -10,12 +10,24 @@ function _export(target, all) {
10
10
  });
11
11
  }
12
12
  _export(exports, {
13
- isSSR: () => isSSR,
14
- isUseSSRBundle: () => isUseSSRBundle,
15
- isServiceWorker: () => isServiceWorker,
16
- isRouterV5: () => isRouterV5,
17
- isSSGEntry: () => isSSGEntry,
18
- isSingleEntry: () => isSingleEntry
13
+ isSSR: function() {
14
+ return isSSR;
15
+ },
16
+ isUseSSRBundle: function() {
17
+ return isUseSSRBundle;
18
+ },
19
+ isServiceWorker: function() {
20
+ return isServiceWorker;
21
+ },
22
+ isRouterV5: function() {
23
+ return isRouterV5;
24
+ },
25
+ isSSGEntry: function() {
26
+ return isSSGEntry;
27
+ },
28
+ isSingleEntry: function() {
29
+ return isSingleEntry;
30
+ }
19
31
  });
20
32
  const _type = require("./type");
21
33
  const isSSR = (config) => {
@@ -10,12 +10,24 @@ function _export(target, all) {
10
10
  });
11
11
  }
12
12
  _export(exports, {
13
- getNodeEnv: () => getNodeEnv,
14
- isDev: () => isDev,
15
- isProd: () => isProd,
16
- isTest: () => isTest,
17
- isProdProfile: () => isProdProfile,
18
- isFastRefresh: () => isFastRefresh
13
+ getNodeEnv: function() {
14
+ return getNodeEnv;
15
+ },
16
+ isDev: function() {
17
+ return isDev;
18
+ },
19
+ isProd: function() {
20
+ return isProd;
21
+ },
22
+ isTest: function() {
23
+ return isTest;
24
+ },
25
+ isProdProfile: function() {
26
+ return isProdProfile;
27
+ },
28
+ isFastRefresh: function() {
29
+ return isFastRefresh;
30
+ }
19
31
  });
20
32
  const getNodeEnv = () => process.env.NODE_ENV || "development";
21
33
  const isDev = () => getNodeEnv() === "development";
@@ -10,8 +10,12 @@ function _export(target, all) {
10
10
  });
11
11
  }
12
12
  _export(exports, {
13
- isNodeJS: () => isNodeJS,
14
- isBrowser: () => isBrowser
13
+ isNodeJS: function() {
14
+ return isNodeJS;
15
+ },
16
+ isBrowser: function() {
17
+ return isBrowser;
18
+ }
15
19
  });
16
20
  const isNodeJS = () => typeof process !== "undefined" && process.versions != null && process.versions.node != null && process.versions.electron == null;
17
21
  const isBrowser = () => typeof window !== "undefined";
@@ -10,13 +10,27 @@ function _export(target, all) {
10
10
  });
11
11
  }
12
12
  _export(exports, {
13
- isDepExists: () => isDepExists,
14
- isPackageInstalled: () => isPackageInstalled,
15
- isApiOnly: () => isApiOnly,
16
- isWebOnly: () => isWebOnly,
17
- isBeyondReact17: () => isBeyondReact17,
18
- isReact18: () => isReact18,
19
- isTypescript: () => isTypescript
13
+ isDepExists: function() {
14
+ return isDepExists;
15
+ },
16
+ isPackageInstalled: function() {
17
+ return isPackageInstalled;
18
+ },
19
+ isApiOnly: function() {
20
+ return isApiOnly;
21
+ },
22
+ isWebOnly: function() {
23
+ return isWebOnly;
24
+ },
25
+ isBeyondReact17: function() {
26
+ return isBeyondReact17;
27
+ },
28
+ isReact18: function() {
29
+ return isReact18;
30
+ },
31
+ isTypescript: function() {
32
+ return isTypescript;
33
+ }
20
34
  });
21
35
  const _interop_require_default = require("@swc/helpers/_/_interop_require_default");
22
36
  const _path = /* @__PURE__ */ _interop_require_default._(require("path"));
@@ -10,15 +10,33 @@ function _export(target, all) {
10
10
  });
11
11
  }
12
12
  _export(exports, {
13
- isString: () => isString,
14
- isUndefined: () => isUndefined,
15
- isArray: () => isArray,
16
- isFunction: () => isFunction,
17
- isObject: () => isObject,
18
- isPlainObject: () => isPlainObject,
19
- isPromise: () => isPromise,
20
- isRegExp: () => isRegExp,
21
- isEmpty: () => isEmpty
13
+ isString: function() {
14
+ return isString;
15
+ },
16
+ isUndefined: function() {
17
+ return isUndefined;
18
+ },
19
+ isArray: function() {
20
+ return isArray;
21
+ },
22
+ isFunction: function() {
23
+ return isFunction;
24
+ },
25
+ isObject: function() {
26
+ return isObject;
27
+ },
28
+ isPlainObject: function() {
29
+ return isPlainObject;
30
+ },
31
+ isPromise: function() {
32
+ return isPromise;
33
+ },
34
+ isRegExp: function() {
35
+ return isRegExp;
36
+ },
37
+ isEmpty: function() {
38
+ return isEmpty;
39
+ }
22
40
  });
23
41
  function isString(str) {
24
42
  return typeof str === "string";
@@ -10,8 +10,12 @@ function _export(target, all) {
10
10
  });
11
11
  }
12
12
  _export(exports, {
13
- Logger: () => Logger,
14
- logger: () => logger
13
+ Logger: function() {
14
+ return Logger;
15
+ },
16
+ logger: function() {
17
+ return logger;
18
+ }
15
19
  });
16
20
  const _define_property = require("@swc/helpers/_/_define_property");
17
21
  const _interop_require_default = require("@swc/helpers/_/_interop_require_default");
@@ -10,13 +10,27 @@ function _export(target, all) {
10
10
  });
11
11
  }
12
12
  _export(exports, {
13
- isLerna: () => isLerna,
14
- isYarnWorkspaces: () => isYarnWorkspaces,
15
- isPnpmWorkspaces: () => isPnpmWorkspaces,
16
- isMonorepo: () => isMonorepo,
17
- isModernjsMonorepo: () => isModernjsMonorepo,
18
- findMonorepoRoot: () => findMonorepoRoot,
19
- getMonorepoPackages: () => getMonorepoPackages
13
+ isLerna: function() {
14
+ return isLerna;
15
+ },
16
+ isYarnWorkspaces: function() {
17
+ return isYarnWorkspaces;
18
+ },
19
+ isPnpmWorkspaces: function() {
20
+ return isPnpmWorkspaces;
21
+ },
22
+ isMonorepo: function() {
23
+ return isMonorepo;
24
+ },
25
+ isModernjsMonorepo: function() {
26
+ return isModernjsMonorepo;
27
+ },
28
+ findMonorepoRoot: function() {
29
+ return findMonorepoRoot;
30
+ },
31
+ getMonorepoPackages: function() {
32
+ return getMonorepoPackages;
33
+ }
20
34
  });
21
35
  const _interop_require_default = require("@swc/helpers/_/_interop_require_default");
22
36
  const _fs = /* @__PURE__ */ _interop_require_default._(require("fs"));
@@ -10,10 +10,18 @@ function _export(target, all) {
10
10
  });
11
11
  }
12
12
  _export(exports, {
13
- getPnpmVersion: () => getPnpmVersion,
14
- canUseNpm: () => canUseNpm,
15
- canUseYarn: () => canUseYarn,
16
- canUsePnpm: () => canUsePnpm
13
+ getPnpmVersion: function() {
14
+ return getPnpmVersion;
15
+ },
16
+ canUseNpm: function() {
17
+ return canUseNpm;
18
+ },
19
+ canUseYarn: function() {
20
+ return canUseYarn;
21
+ },
22
+ canUsePnpm: function() {
23
+ return canUsePnpm;
24
+ }
17
25
  });
18
26
  const _compiled = require("../compiled");
19
27
  async function getPnpmVersion() {
@@ -10,19 +10,45 @@ function _export(target, all) {
10
10
  });
11
11
  }
12
12
  _export(exports, {
13
- isPathString: () => isPathString,
14
- isRelativePath: () => isRelativePath,
15
- normalizeOutputPath: () => normalizeOutputPath,
16
- normalizeToPosixPath: () => normalizeToPosixPath,
17
- getTemplatePath: () => getTemplatePath,
18
- compilePathMatcherRegExp: () => compilePathMatcherRegExp,
19
- _joinPathParts: () => _joinPathParts,
20
- upwardPaths: () => upwardPaths,
21
- getRealTemporaryDirectory: () => getRealTemporaryDirectory,
22
- splitPathString: () => splitPathString,
23
- removeLeadingSlash: () => removeLeadingSlash,
24
- removeTailSlash: () => removeTailSlash,
25
- removeSlash: () => removeSlash
13
+ isPathString: function() {
14
+ return isPathString;
15
+ },
16
+ isRelativePath: function() {
17
+ return isRelativePath;
18
+ },
19
+ normalizeOutputPath: function() {
20
+ return normalizeOutputPath;
21
+ },
22
+ normalizeToPosixPath: function() {
23
+ return normalizeToPosixPath;
24
+ },
25
+ getTemplatePath: function() {
26
+ return getTemplatePath;
27
+ },
28
+ compilePathMatcherRegExp: function() {
29
+ return compilePathMatcherRegExp;
30
+ },
31
+ _joinPathParts: function() {
32
+ return _joinPathParts;
33
+ },
34
+ upwardPaths: function() {
35
+ return upwardPaths;
36
+ },
37
+ getRealTemporaryDirectory: function() {
38
+ return getRealTemporaryDirectory;
39
+ },
40
+ splitPathString: function() {
41
+ return splitPathString;
42
+ },
43
+ removeLeadingSlash: function() {
44
+ return removeLeadingSlash;
45
+ },
46
+ removeTailSlash: function() {
47
+ return removeTailSlash;
48
+ },
49
+ removeSlash: function() {
50
+ return removeSlash;
51
+ }
26
52
  });
27
53
  const _interop_require_default = require("@swc/helpers/_/_interop_require_default");
28
54
  const _path = /* @__PURE__ */ _interop_require_default._(require("path"));
@@ -10,10 +10,18 @@ function _export(target, all) {
10
10
  });
11
11
  }
12
12
  _export(exports, {
13
- matchUpwardPathsAsUnknown: () => matchUpwardPathsAsUnknown,
14
- applyPathMatcher: () => applyPathMatcher,
15
- applyMatcherReplacement: () => applyMatcherReplacement,
16
- createDefaultPathMatchers: () => createDefaultPathMatchers
13
+ matchUpwardPathsAsUnknown: function() {
14
+ return matchUpwardPathsAsUnknown;
15
+ },
16
+ applyPathMatcher: function() {
17
+ return applyPathMatcher;
18
+ },
19
+ applyMatcherReplacement: function() {
20
+ return applyMatcherReplacement;
21
+ },
22
+ createDefaultPathMatchers: function() {
23
+ return createDefaultPathMatchers;
24
+ }
17
25
  });
18
26
  const _interop_require_default = require("@swc/helpers/_/_interop_require_default");
19
27
  const _os = /* @__PURE__ */ _interop_require_default._(require("os"));
@@ -4,7 +4,9 @@ Object.defineProperty(exports, "__esModule", {
4
4
  });
5
5
  Object.defineProperty(exports, "getPort", {
6
6
  enumerable: true,
7
- get: () => getPort
7
+ get: function() {
8
+ return getPort;
9
+ }
8
10
  });
9
11
  const _interop_require_default = require("@swc/helpers/_/_interop_require_default");
10
12
  const _net = /* @__PURE__ */ _interop_require_default._(require("net"));
@@ -10,8 +10,12 @@ function _export(target, all) {
10
10
  });
11
11
  }
12
12
  _export(exports, {
13
- getAddressUrls: () => getAddressUrls,
14
- prettyInstructions: () => prettyInstructions
13
+ getAddressUrls: function() {
14
+ return getAddressUrls;
15
+ },
16
+ prettyInstructions: function() {
17
+ return prettyInstructions;
18
+ }
15
19
  });
16
20
  const _interop_require_default = require("@swc/helpers/_/_interop_require_default");
17
21
  const _os = /* @__PURE__ */ _interop_require_default._(require("os"));
@@ -4,7 +4,9 @@ Object.defineProperty(exports, "__esModule", {
4
4
  });
5
5
  Object.defineProperty(exports, "printBuildError", {
6
6
  enumerable: true,
7
- get: () => printBuildError
7
+ get: function() {
8
+ return printBuildError;
9
+ }
8
10
  });
9
11
  const _compiled = require("../compiled");
10
12
  const _logger = require("./logger");
@@ -10,12 +10,24 @@ function _export(target, all) {
10
10
  });
11
11
  }
12
12
  _export(exports, {
13
- compatRequire: () => compatRequire,
14
- dynamicImport: () => dynamicImport,
15
- requireExistModule: () => requireExistModule,
16
- cleanRequireCache: () => cleanRequireCache,
17
- deleteRequireCache: () => deleteRequireCache,
18
- tryResolve: () => tryResolve
13
+ compatRequire: function() {
14
+ return compatRequire;
15
+ },
16
+ dynamicImport: function() {
17
+ return dynamicImport;
18
+ },
19
+ requireExistModule: function() {
20
+ return requireExistModule;
21
+ },
22
+ cleanRequireCache: function() {
23
+ return cleanRequireCache;
24
+ },
25
+ deleteRequireCache: function() {
26
+ return deleteRequireCache;
27
+ },
28
+ tryResolve: function() {
29
+ return tryResolve;
30
+ }
19
31
  });
20
32
  const _fs = require("./fs");
21
33
  const compatRequire = (filePath, interop = true) => {
@@ -4,7 +4,9 @@ Object.defineProperty(exports, "__esModule", {
4
4
  });
5
5
  Object.defineProperty(exports, "getRouteId", {
6
6
  enumerable: true,
7
- get: () => getRouteId
7
+ get: function() {
8
+ return getRouteId;
9
+ }
8
10
  });
9
11
  const _interop_require_default = require("@swc/helpers/_/_interop_require_default");
10
12
  const _path = /* @__PURE__ */ _interop_require_default._(require("path"));
@@ -4,7 +4,9 @@ Object.defineProperty(exports, "__esModule", {
4
4
  });
5
5
  Object.defineProperty(exports, "createRuntimeExportsUtils", {
6
6
  enumerable: true,
7
- get: () => createRuntimeExportsUtils
7
+ get: function() {
8
+ return createRuntimeExportsUtils;
9
+ }
8
10
  });
9
11
  const _interop_require_default = require("@swc/helpers/_/_interop_require_default");
10
12
  const _path = /* @__PURE__ */ _interop_require_default._(require("path"));
@@ -4,7 +4,9 @@ Object.defineProperty(exports, "__esModule", {
4
4
  });
5
5
  Object.defineProperty(exports, "initSnapshotSerializer", {
6
6
  enumerable: true,
7
- get: () => initSnapshotSerializer
7
+ get: function() {
8
+ return initSnapshotSerializer;
9
+ }
8
10
  });
9
11
  const initSnapshotSerializer = (root) => {
10
12
  expect.addSnapshotSerializer({
@@ -10,8 +10,12 @@ function _export(target, all) {
10
10
  });
11
11
  }
12
12
  _export(exports, {
13
- WatchChangeType: () => WatchChangeType,
14
- watch: () => watch
13
+ WatchChangeType: function() {
14
+ return WatchChangeType;
15
+ },
16
+ watch: function() {
17
+ return watch;
18
+ }
15
19
  });
16
20
  const _interop_require_default = require("@swc/helpers/_/_interop_require_default");
17
21
  const _path = /* @__PURE__ */ _interop_require_default._(require("path"));
@@ -10,39 +10,105 @@ function _export(target, all) {
10
10
  });
11
11
  }
12
12
  _export(exports, {
13
- fs: () => _fsextra.default,
14
- ora: () => _ora.default,
15
- glob: () => _glob.default,
16
- yaml: () => _jsyaml.default,
17
- chalk: () => _chalk.default,
18
- debug: () => _debug.default,
19
- slash: () => _slash.default,
20
- execa: () => _execa.default,
21
- json5: () => _json5.default,
22
- upath: () => _upath.default,
23
- pkgUp: () => _pkgup.default,
24
- nanoid: () => _nanoid.nanoid,
25
- semver: () => _semver.default,
26
- dotenv: () => _dotenv.default,
27
- lodash: () => _lodash.default,
28
- globby: () => _globby.default,
29
- address: () => _address.default,
30
- signale: () => _signale.default,
31
- urlJoin: () => _urljoin.default,
32
- minimist: () => _minimist.default,
33
- fastGlob: () => _fastglob.default,
34
- filesize: () => _filesize.default,
35
- gzipSize: () => _gzipsize.default,
36
- stripAnsi: () => _stripansi.default,
37
- dotenvExpand: () => _dotenvexpand.default,
38
- browserslist: () => _browserslist.default,
39
- recursiveReaddir: () => _recursivereaddir.default,
40
- program: () => _commander.program,
41
- Command: () => _commander.Command,
42
- Signale: () => _signale.Signale,
43
- mime: () => mime,
44
- chokidar: () => chokidar,
45
- inquirer: () => inquirer
13
+ fs: function() {
14
+ return _fsextra.default;
15
+ },
16
+ ora: function() {
17
+ return _ora.default;
18
+ },
19
+ glob: function() {
20
+ return _glob.default;
21
+ },
22
+ yaml: function() {
23
+ return _jsyaml.default;
24
+ },
25
+ chalk: function() {
26
+ return _chalk.default;
27
+ },
28
+ debug: function() {
29
+ return _debug.default;
30
+ },
31
+ slash: function() {
32
+ return _slash.default;
33
+ },
34
+ execa: function() {
35
+ return _execa.default;
36
+ },
37
+ json5: function() {
38
+ return _json5.default;
39
+ },
40
+ upath: function() {
41
+ return _upath.default;
42
+ },
43
+ pkgUp: function() {
44
+ return _pkgup.default;
45
+ },
46
+ nanoid: function() {
47
+ return _nanoid.nanoid;
48
+ },
49
+ semver: function() {
50
+ return _semver.default;
51
+ },
52
+ dotenv: function() {
53
+ return _dotenv.default;
54
+ },
55
+ lodash: function() {
56
+ return _lodash.default;
57
+ },
58
+ globby: function() {
59
+ return _globby.default;
60
+ },
61
+ address: function() {
62
+ return _address.default;
63
+ },
64
+ signale: function() {
65
+ return _signale.default;
66
+ },
67
+ urlJoin: function() {
68
+ return _urljoin.default;
69
+ },
70
+ minimist: function() {
71
+ return _minimist.default;
72
+ },
73
+ fastGlob: function() {
74
+ return _fastglob.default;
75
+ },
76
+ filesize: function() {
77
+ return _filesize.default;
78
+ },
79
+ gzipSize: function() {
80
+ return _gzipsize.default;
81
+ },
82
+ stripAnsi: function() {
83
+ return _stripansi.default;
84
+ },
85
+ dotenvExpand: function() {
86
+ return _dotenvexpand.default;
87
+ },
88
+ browserslist: function() {
89
+ return _browserslist.default;
90
+ },
91
+ recursiveReaddir: function() {
92
+ return _recursivereaddir.default;
93
+ },
94
+ program: function() {
95
+ return _commander.program;
96
+ },
97
+ Command: function() {
98
+ return _commander.Command;
99
+ },
100
+ Signale: function() {
101
+ return _signale.Signale;
102
+ },
103
+ mime: function() {
104
+ return mime;
105
+ },
106
+ chokidar: function() {
107
+ return chokidar;
108
+ },
109
+ inquirer: function() {
110
+ return inquirer;
111
+ }
46
112
  });
47
113
  const _interop_require_default = require("@swc/helpers/_/_interop_require_default");
48
114
  const _interop_require_wildcard = require("@swc/helpers/_/_interop_require_wildcard");
@@ -10,8 +10,12 @@ function _export(target, all) {
10
10
  });
11
11
  }
12
12
  _export(exports, {
13
- lazyImport: () => lazy,
14
- Import: () => Import
13
+ lazyImport: function() {
14
+ return lazy;
15
+ },
16
+ Import: function() {
17
+ return Import;
18
+ }
15
19
  });
16
20
  const lazy = (moduleName, requireFn) => {
17
21
  const importLazyLocal = require("../compiled/import-lazy")(requireFn);
@@ -10,8 +10,12 @@ function _export(target, all) {
10
10
  });
11
11
  }
12
12
  _export(exports, {
13
- transformNestedRoutes: () => transformNestedRoutes,
14
- renderNestedRoute: () => renderNestedRoute
13
+ transformNestedRoutes: function() {
14
+ return transformNestedRoutes;
15
+ },
16
+ renderNestedRoute: function() {
17
+ return renderNestedRoute;
18
+ }
15
19
  });
16
20
  const _interop_require_wildcard = require("@swc/helpers/_/_interop_require_wildcard");
17
21
  const _jsxruntime = require("react/jsx-runtime");
@@ -4,10 +4,16 @@ Object.defineProperty(exports, "__esModule", {
4
4
  });
5
5
  Object.defineProperty(exports, "parsedJSONFromElement", {
6
6
  enumerable: true,
7
- get: () => parsedJSONFromElement
7
+ get: function() {
8
+ return parsedJSONFromElement;
9
+ }
8
10
  });
9
11
  const parsedJSONFromElement = (id) => {
10
- const element = document.getElementById(id);
12
+ const elements = document.querySelectorAll(`#${id}`);
13
+ if (elements.length === 0) {
14
+ return void 0;
15
+ }
16
+ const element = elements[elements.length - 1];
11
17
  if (element) {
12
18
  try {
13
19
  const parsed = JSON.parse((element === null || element === void 0 ? void 0 : element.textContent) || "");
@@ -10,9 +10,15 @@ function _export(target, all) {
10
10
  });
11
11
  }
12
12
  _export(exports, {
13
- run: () => run,
14
- useHeaders: () => useHeaders,
15
- serializeJson: () => _serialize.serializeJson
13
+ run: function() {
14
+ return run;
15
+ },
16
+ useHeaders: function() {
17
+ return useHeaders;
18
+ },
19
+ serializeJson: function() {
20
+ return _serialize.serializeJson;
21
+ }
16
22
  });
17
23
  const _storage = require("./storage");
18
24
  const _serialize = require("./serialize");
@@ -4,7 +4,9 @@ Object.defineProperty(exports, "__esModule", {
4
4
  });
5
5
  Object.defineProperty(exports, "serializeJson", {
6
6
  enumerable: true,
7
- get: () => serializeJson
7
+ get: function() {
8
+ return serializeJson;
9
+ }
8
10
  });
9
11
  const _interop_require_default = require("@swc/helpers/_/_interop_require_default");
10
12
  const _serializejavascript = /* @__PURE__ */ _interop_require_default._(require("serialize-javascript"));
@@ -4,7 +4,9 @@ Object.defineProperty(exports, "__esModule", {
4
4
  });
5
5
  Object.defineProperty(exports, "createStorage", {
6
6
  enumerable: true,
7
- get: () => createStorage
7
+ get: function() {
8
+ return createStorage;
9
+ }
8
10
  });
9
11
  const _interop_require_wildcard = require("@swc/helpers/_/_interop_require_wildcard");
10
12
  const _async_hooks = /* @__PURE__ */ _interop_require_wildcard._(require("async_hooks"));
@@ -10,8 +10,12 @@ function _export(target, all) {
10
10
  });
11
11
  }
12
12
  _export(exports, {
13
- ROUTE_MANIFEST: () => ROUTE_MANIFEST,
14
- HMR_SOCK_PATH: () => HMR_SOCK_PATH
13
+ ROUTE_MANIFEST: function() {
14
+ return ROUTE_MANIFEST;
15
+ },
16
+ HMR_SOCK_PATH: function() {
17
+ return HMR_SOCK_PATH;
18
+ }
15
19
  });
16
20
  const ROUTE_MANIFEST = `_MODERNJS_ROUTE_MANIFEST`;
17
21
  const HMR_SOCK_PATH = "/webpack-hmr";
@@ -4,7 +4,9 @@ Object.defineProperty(exports, "__esModule", {
4
4
  });
5
5
  Object.defineProperty(exports, "formatWebpackMessages", {
6
6
  enumerable: true,
7
- get: () => formatWebpackMessages
7
+ get: function() {
8
+ return formatWebpackMessages;
9
+ }
8
10
  });
9
11
  const friendlySyntaxErrorLabel = "SyntaxError:";
10
12
  function isLikelyASyntaxError(message) {
@@ -4,7 +4,9 @@ Object.defineProperty(exports, "__esModule", {
4
4
  });
5
5
  Object.defineProperty(exports, "pluginDagSort", {
6
6
  enumerable: true,
7
- get: () => pluginDagSort
7
+ get: function() {
8
+ return pluginDagSort;
9
+ }
8
10
  });
9
11
  const pluginDagSort = (plugins, key = "name", preKey = "pre", postKey = "post") => {
10
12
  let allLines = [];
@@ -1,5 +1,9 @@
1
1
  export const parsedJSONFromElement = (id) => {
2
- const element = document.getElementById(id);
2
+ const elements = document.querySelectorAll(`#${id}`);
3
+ if (elements.length === 0) {
4
+ return void 0;
5
+ }
6
+ const element = elements[elements.length - 1];
3
7
  if (element) {
4
8
  try {
5
9
  const parsed = JSON.parse((element === null || element === void 0 ? void 0 : element.textContent) || "");
package/package.json CHANGED
@@ -15,7 +15,7 @@
15
15
  "modern",
16
16
  "modern.js"
17
17
  ],
18
- "version": "2.21.1",
18
+ "version": "2.22.0",
19
19
  "jsnext:source": "./src/index.ts",
20
20
  "types": "./dist/types/index.d.ts",
21
21
  "main": "./dist/cjs/index.js",
@@ -203,7 +203,7 @@
203
203
  }
204
204
  },
205
205
  "dependencies": {
206
- "caniuse-lite": "^1.0.30001451",
206
+ "caniuse-lite": "^1.0.30001489",
207
207
  "lodash": "^4.17.21",
208
208
  "serialize-javascript": "^6.0.0",
209
209
  "react-router-dom": "6.11.2",
@@ -231,9 +231,9 @@
231
231
  "typescript": "^5",
232
232
  "webpack": "^5.82.1",
233
233
  "@types/serialize-javascript": "^5.0.1",
234
- "@modern-js/types": "2.21.1",
235
- "@scripts/jest-config": "2.21.1",
236
- "@scripts/build": "2.21.1"
234
+ "@modern-js/types": "2.22.0",
235
+ "@scripts/jest-config": "2.22.0",
236
+ "@scripts/build": "2.22.0"
237
237
  },
238
238
  "sideEffects": false,
239
239
  "scripts": {