@modern-js/utils 2.35.0 → 2.36.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (173) hide show
  1. package/dist/cjs/cli/alias.js +48 -49
  2. package/dist/cjs/cli/applyOptionsChain.js +30 -13
  3. package/dist/cjs/cli/babel.js +36 -26
  4. package/dist/cjs/cli/commands.js +29 -21
  5. package/dist/cjs/cli/common.js +29 -20
  6. package/dist/cjs/cli/config.js +24 -7
  7. package/dist/cjs/cli/constants/chainId.js +27 -10
  8. package/dist/cjs/cli/constants/index.js +86 -104
  9. package/dist/cjs/cli/ensure.js +37 -18
  10. package/dist/cjs/cli/fs.js +29 -19
  11. package/dist/cjs/cli/get/config.js +26 -9
  12. package/dist/cjs/cli/get/data.js +67 -54
  13. package/dist/cjs/cli/get/index.js +46 -25
  14. package/dist/cjs/cli/index.js +58 -23
  15. package/dist/cjs/cli/is/config.js +45 -41
  16. package/dist/cjs/cli/is/env.js +32 -29
  17. package/dist/cjs/cli/is/index.js +26 -8
  18. package/dist/cjs/cli/is/project.js +67 -53
  19. package/dist/cjs/cli/is/type.js +39 -36
  20. package/dist/cjs/cli/logger.js +25 -125
  21. package/dist/cjs/cli/monorepo.js +58 -58
  22. package/dist/cjs/cli/package.js +34 -26
  23. package/dist/cjs/cli/path.js +64 -54
  24. package/dist/cjs/cli/port.js +39 -13
  25. package/dist/cjs/cli/prettyInstructions.js +50 -34
  26. package/dist/cjs/cli/require.js +36 -31
  27. package/dist/cjs/cli/runtimeExports.js +42 -16
  28. package/dist/cjs/cli/watch.js +41 -22
  29. package/dist/cjs/compiled.js +127 -138
  30. package/dist/cjs/import.js +25 -15
  31. package/dist/cjs/index.js +24 -6
  32. package/dist/cjs/universal/constants.js +29 -21
  33. package/dist/cjs/universal/formatWebpack.js +28 -18
  34. package/dist/cjs/universal/pluginDagSort.js +25 -8
  35. package/dist/esm/cli/alias.js +13 -25
  36. package/dist/esm/cli/applyOptionsChain.js +4 -1
  37. package/dist/esm/cli/babel.js +6 -2
  38. package/dist/esm/cli/commands.js +10 -4
  39. package/dist/esm/cli/common.js +8 -3
  40. package/dist/esm/cli/config.js +4 -1
  41. package/dist/esm/cli/constants/chainId.js +7 -4
  42. package/dist/esm/cli/constants/index.js +64 -31
  43. package/dist/esm/cli/ensure.js +6 -2
  44. package/dist/esm/cli/fs.js +6 -2
  45. package/dist/esm/cli/get/config.js +4 -1
  46. package/dist/esm/cli/get/data.js +18 -8
  47. package/dist/esm/cli/get/index.js +6 -2
  48. package/dist/esm/cli/is/config.js +23 -17
  49. package/dist/esm/cli/is/env.js +12 -8
  50. package/dist/esm/cli/is/index.js +0 -1
  51. package/dist/esm/cli/is/project.js +17 -8
  52. package/dist/esm/cli/is/type.js +20 -9
  53. package/dist/esm/cli/logger.js +4 -123
  54. package/dist/esm/cli/monorepo.js +14 -16
  55. package/dist/esm/cli/package.js +10 -4
  56. package/dist/esm/cli/path.js +24 -11
  57. package/dist/esm/cli/port.js +6 -3
  58. package/dist/esm/cli/prettyInstructions.js +8 -5
  59. package/dist/esm/cli/require.js +15 -8
  60. package/dist/esm/cli/runtimeExports.js +6 -3
  61. package/dist/esm/cli/watch.js +10 -6
  62. package/dist/esm/compiled.js +65 -31
  63. package/dist/esm/import.js +6 -3
  64. package/dist/esm/universal/constants.js +10 -4
  65. package/dist/esm/universal/formatWebpack.js +8 -5
  66. package/dist/esm/universal/pluginDagSort.js +5 -2
  67. package/dist/esm-node/cli/alias.js +11 -22
  68. package/dist/esm-node/cli/applyOptionsChain.js +4 -1
  69. package/dist/esm-node/cli/babel.js +6 -2
  70. package/dist/esm-node/cli/commands.js +10 -4
  71. package/dist/esm-node/cli/common.js +8 -3
  72. package/dist/esm-node/cli/config.js +4 -1
  73. package/dist/esm-node/cli/constants/chainId.js +7 -4
  74. package/dist/esm-node/cli/constants/index.js +64 -31
  75. package/dist/esm-node/cli/ensure.js +6 -2
  76. package/dist/esm-node/cli/fs.js +6 -2
  77. package/dist/esm-node/cli/get/config.js +4 -1
  78. package/dist/esm-node/cli/get/data.js +18 -8
  79. package/dist/esm-node/cli/get/index.js +6 -2
  80. package/dist/esm-node/cli/is/config.js +23 -17
  81. package/dist/esm-node/cli/is/env.js +12 -6
  82. package/dist/esm-node/cli/is/index.js +0 -1
  83. package/dist/esm-node/cli/is/project.js +16 -7
  84. package/dist/esm-node/cli/is/type.js +20 -9
  85. package/dist/esm-node/cli/logger.js +4 -108
  86. package/dist/esm-node/cli/monorepo.js +14 -18
  87. package/dist/esm-node/cli/package.js +10 -4
  88. package/dist/esm-node/cli/path.js +24 -11
  89. package/dist/esm-node/cli/port.js +5 -2
  90. package/dist/esm-node/cli/prettyInstructions.js +8 -7
  91. package/dist/esm-node/cli/require.js +15 -8
  92. package/dist/esm-node/cli/runtimeExports.js +4 -1
  93. package/dist/esm-node/cli/watch.js +6 -2
  94. package/dist/esm-node/compiled.js +65 -31
  95. package/dist/esm-node/import.js +5 -2
  96. package/dist/esm-node/universal/constants.js +10 -4
  97. package/dist/esm-node/universal/formatWebpack.js +8 -5
  98. package/dist/esm-node/universal/pluginDagSort.js +5 -2
  99. package/dist/types/cli/alias.d.ts +0 -5
  100. package/dist/types/cli/constants/chainId.d.ts +2 -2
  101. package/dist/types/cli/is/env.d.ts +1 -2
  102. package/dist/types/cli/is/index.d.ts +0 -1
  103. package/dist/types/cli/logger.d.ts +1 -64
  104. package/dist/types/cli/monorepo.d.ts +0 -1
  105. package/package.json +6 -84
  106. package/dist/cjs/cli/is/platform.js +0 -21
  107. package/dist/cjs/runtime/nestedRoutes.js +0 -149
  108. package/dist/cjs/runtime/remixRouter.js +0 -6
  109. package/dist/cjs/runtime/router.js +0 -6
  110. package/dist/cjs/runtime-browser/index.js +0 -6
  111. package/dist/cjs/runtime-browser/parsed.js +0 -28
  112. package/dist/cjs/runtime-node/index.js +0 -28
  113. package/dist/cjs/runtime-node/loaderContext/createLoaderCtx.js +0 -34
  114. package/dist/cjs/runtime-node/loaderContext/createRequestCtx.js +0 -38
  115. package/dist/cjs/runtime-node/loaderContext/index.js +0 -22
  116. package/dist/cjs/runtime-node/nestedRoutes.js +0 -28
  117. package/dist/cjs/runtime-node/router.js +0 -6
  118. package/dist/cjs/runtime-node/serialize.js +0 -17
  119. package/dist/cjs/runtime-node/storage.js +0 -48
  120. package/dist/cjs/universal/time.js +0 -38
  121. package/dist/compiled/gradient-string/index.d.ts +0 -1
  122. package/dist/compiled/gradient-string/index.js +0 -1
  123. package/dist/compiled/gradient-string/license +0 -21
  124. package/dist/compiled/gradient-string/package.json +0 -1
  125. package/dist/compiled/webpack-dev-middleware/index.js +0 -7
  126. package/dist/compiled/webpack-dev-middleware/license +0 -20
  127. package/dist/compiled/webpack-dev-middleware/package.json +0 -1
  128. package/dist/compiled/webpack-dev-middleware/types/index.d.ts +0 -262
  129. package/dist/esm/cli/is/platform.js +0 -6
  130. package/dist/esm/runtime/nestedRoutes.js +0 -163
  131. package/dist/esm/runtime/remixRouter.js +0 -1
  132. package/dist/esm/runtime/router.js +0 -1
  133. package/dist/esm/runtime-browser/index.js +0 -1
  134. package/dist/esm/runtime-browser/parsed.js +0 -18
  135. package/dist/esm/runtime-node/index.js +0 -6
  136. package/dist/esm/runtime-node/loaderContext/createLoaderCtx.js +0 -20
  137. package/dist/esm/runtime-node/loaderContext/createRequestCtx.js +0 -24
  138. package/dist/esm/runtime-node/loaderContext/index.js +0 -3
  139. package/dist/esm/runtime-node/nestedRoutes.js +0 -20
  140. package/dist/esm/runtime-node/router.js +0 -1
  141. package/dist/esm/runtime-node/serialize.js +0 -6
  142. package/dist/esm/runtime-node/storage.js +0 -36
  143. package/dist/esm/universal/time.js +0 -29
  144. package/dist/esm-node/cli/is/platform.js +0 -2
  145. package/dist/esm-node/runtime/nestedRoutes.js +0 -129
  146. package/dist/esm-node/runtime/remixRouter.js +0 -1
  147. package/dist/esm-node/runtime/router.js +0 -1
  148. package/dist/esm-node/runtime-browser/index.js +0 -1
  149. package/dist/esm-node/runtime-browser/parsed.js +0 -18
  150. package/dist/esm-node/runtime-node/index.js +0 -6
  151. package/dist/esm-node/runtime-node/loaderContext/createLoaderCtx.js +0 -15
  152. package/dist/esm-node/runtime-node/loaderContext/createRequestCtx.js +0 -19
  153. package/dist/esm-node/runtime-node/loaderContext/index.js +0 -3
  154. package/dist/esm-node/runtime-node/nestedRoutes.js +0 -18
  155. package/dist/esm-node/runtime-node/router.js +0 -1
  156. package/dist/esm-node/runtime-node/serialize.js +0 -6
  157. package/dist/esm-node/runtime-node/storage.js +0 -38
  158. package/dist/esm-node/universal/time.js +0 -28
  159. package/dist/types/cli/is/platform.d.ts +0 -2
  160. package/dist/types/runtime/nestedRoutes.d.ts +0 -13
  161. package/dist/types/runtime/remixRouter.d.ts +0 -1
  162. package/dist/types/runtime/router.d.ts +0 -1
  163. package/dist/types/runtime-browser/index.d.ts +0 -1
  164. package/dist/types/runtime-browser/parsed.d.ts +0 -1
  165. package/dist/types/runtime-node/index.d.ts +0 -10
  166. package/dist/types/runtime-node/loaderContext/createLoaderCtx.d.ts +0 -7
  167. package/dist/types/runtime-node/loaderContext/createRequestCtx.d.ts +0 -7
  168. package/dist/types/runtime-node/loaderContext/index.d.ts +0 -4
  169. package/dist/types/runtime-node/nestedRoutes.d.ts +0 -3
  170. package/dist/types/runtime-node/router.d.ts +0 -1
  171. package/dist/types/runtime-node/serialize.d.ts +0 -1
  172. package/dist/types/runtime-node/storage.d.ts +0 -5
  173. package/dist/types/universal/time.d.ts +0 -1
@@ -1,22 +1,27 @@
1
1
  "use strict";
2
- Object.defineProperty(exports, "__esModule", {
3
- value: true
4
- });
5
- function _export(target, all) {
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
6
7
  for (var name in all)
7
- Object.defineProperty(target, name, {
8
- enumerable: true,
9
- get: all[name]
10
- });
11
- }
12
- _export(exports, {
13
- lazyImport: function() {
14
- return lazy;
15
- },
16
- Import: function() {
17
- return Import;
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
18
15
  }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+ var import_exports = {};
20
+ __export(import_exports, {
21
+ Import: () => Import,
22
+ lazyImport: () => lazy
19
23
  });
24
+ module.exports = __toCommonJS(import_exports);
20
25
  const lazy = (moduleName, requireFn) => {
21
26
  const importLazyLocal = require("../compiled/import-lazy")(requireFn);
22
27
  return importLazyLocal(moduleName);
@@ -24,3 +29,8 @@ const lazy = (moduleName, requireFn) => {
24
29
  const Import = {
25
30
  lazy
26
31
  };
32
+ // Annotate the CommonJS export names for ESM import in node:
33
+ 0 && (module.exports = {
34
+ Import,
35
+ lazyImport
36
+ });
package/dist/cjs/index.js CHANGED
@@ -1,8 +1,26 @@
1
1
  "use strict";
2
- Object.defineProperty(exports, "__esModule", {
3
- value: true
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __copyProps = (to, from, except, desc) => {
7
+ if (from && typeof from === "object" || typeof from === "function") {
8
+ for (let key of __getOwnPropNames(from))
9
+ if (!__hasOwnProp.call(to, key) && key !== except)
10
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
11
+ }
12
+ return to;
13
+ };
14
+ var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
15
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
16
+ var src_exports = {};
17
+ module.exports = __toCommonJS(src_exports);
18
+ __reExport(src_exports, require("./compiled"), module.exports);
19
+ __reExport(src_exports, require("./cli"), module.exports);
20
+ __reExport(src_exports, require("./import"), module.exports);
21
+ // Annotate the CommonJS export names for ESM import in node:
22
+ 0 && (module.exports = {
23
+ ...require("./compiled"),
24
+ ...require("./cli"),
25
+ ...require("./import")
4
26
  });
5
- const _export_star = require("@swc/helpers/_/_export_star");
6
- _export_star._(require("./compiled"), exports);
7
- _export_star._(require("./cli"), exports);
8
- _export_star._(require("./import"), exports);
@@ -1,29 +1,37 @@
1
1
  "use strict";
2
- Object.defineProperty(exports, "__esModule", {
3
- value: true
4
- });
5
- function _export(target, all) {
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
6
7
  for (var name in all)
7
- Object.defineProperty(target, name, {
8
- enumerable: true,
9
- get: all[name]
10
- });
11
- }
12
- _export(exports, {
13
- ROUTE_MANIFEST: function() {
14
- return ROUTE_MANIFEST;
15
- },
16
- HMR_SOCK_PATH: function() {
17
- return HMR_SOCK_PATH;
18
- },
19
- HTML_CHUNKSMAP_SEPARATOR: function() {
20
- return HTML_CHUNKSMAP_SEPARATOR;
21
- },
22
- LOADER_REPORTER_NAME: function() {
23
- return LOADER_REPORTER_NAME;
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
24
15
  }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+ var constants_exports = {};
20
+ __export(constants_exports, {
21
+ HMR_SOCK_PATH: () => HMR_SOCK_PATH,
22
+ HTML_CHUNKSMAP_SEPARATOR: () => HTML_CHUNKSMAP_SEPARATOR,
23
+ LOADER_REPORTER_NAME: () => LOADER_REPORTER_NAME,
24
+ ROUTE_MANIFEST: () => ROUTE_MANIFEST
25
25
  });
26
+ module.exports = __toCommonJS(constants_exports);
26
27
  const ROUTE_MANIFEST = `_MODERNJS_ROUTE_MANIFEST`;
27
28
  const HMR_SOCK_PATH = "/webpack-hmr";
28
29
  const HTML_CHUNKSMAP_SEPARATOR = "<!--<?- chunksMap.js ?>-->";
29
30
  const LOADER_REPORTER_NAME = `server-loader`;
31
+ // Annotate the CommonJS export names for ESM import in node:
32
+ 0 && (module.exports = {
33
+ HMR_SOCK_PATH,
34
+ HTML_CHUNKSMAP_SEPARATOR,
35
+ LOADER_REPORTER_NAME,
36
+ ROUTE_MANIFEST
37
+ });
@@ -1,22 +1,27 @@
1
1
  "use strict";
2
- Object.defineProperty(exports, "__esModule", {
3
- value: true
4
- });
5
- function _export(target, all) {
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
6
7
  for (var name in all)
7
- Object.defineProperty(target, name, {
8
- enumerable: true,
9
- get: all[name]
10
- });
11
- }
12
- _export(exports, {
13
- addErrorTips: function() {
14
- return addErrorTips;
15
- },
16
- formatWebpackMessages: function() {
17
- return formatWebpackMessages;
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
18
15
  }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+ var formatWebpack_exports = {};
20
+ __export(formatWebpack_exports, {
21
+ addErrorTips: () => addErrorTips,
22
+ formatWebpackMessages: () => formatWebpackMessages
19
23
  });
24
+ module.exports = __toCommonJS(formatWebpack_exports);
20
25
  const friendlySyntaxErrorLabel = "SyntaxError:";
21
26
  function isLikelyASyntaxError(message) {
22
27
  return message.includes(friendlySyntaxErrorLabel);
@@ -98,9 +103,9 @@ export default {
98
103
  });
99
104
  }
100
105
  function formatWebpackMessages(json, color = defaultColor) {
101
- var _json_errors, _json, _json_warnings, _json1, _result_errors;
102
- const formattedErrors = (_json = json) === null || _json === void 0 ? void 0 : (_json_errors = _json.errors) === null || _json_errors === void 0 ? void 0 : _json_errors.map(formatMessage);
103
- const formattedWarnings = (_json1 = json) === null || _json1 === void 0 ? void 0 : (_json_warnings = _json1.warnings) === null || _json_warnings === void 0 ? void 0 : _json_warnings.map(formatMessage);
106
+ var _json_errors, _json_warnings, _result_errors;
107
+ const formattedErrors = json === null || json === void 0 ? void 0 : (_json_errors = json.errors) === null || _json_errors === void 0 ? void 0 : _json_errors.map(formatMessage);
108
+ const formattedWarnings = json === null || json === void 0 ? void 0 : (_json_warnings = json.warnings) === null || _json_warnings === void 0 ? void 0 : _json_warnings.map(formatMessage);
104
109
  const result = {
105
110
  errors: formattedErrors || [],
106
111
  warnings: formattedWarnings || [],
@@ -115,3 +120,8 @@ function formatWebpackMessages(json, color = defaultColor) {
115
120
  result.errors = addErrorTips(result.errors, color);
116
121
  return result;
117
122
  }
123
+ // Annotate the CommonJS export names for ESM import in node:
124
+ 0 && (module.exports = {
125
+ addErrorTips,
126
+ formatWebpackMessages
127
+ });
@@ -1,13 +1,26 @@
1
1
  "use strict";
2
- Object.defineProperty(exports, "__esModule", {
3
- value: true
4
- });
5
- Object.defineProperty(exports, "pluginDagSort", {
6
- enumerable: true,
7
- get: function() {
8
- return pluginDagSort;
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
9
15
  }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+ var pluginDagSort_exports = {};
20
+ __export(pluginDagSort_exports, {
21
+ pluginDagSort: () => pluginDagSort
10
22
  });
23
+ module.exports = __toCommonJS(pluginDagSort_exports);
11
24
  const pluginDagSort = (plugins, key = "name", preKey = "pre", postKey = "post") => {
12
25
  let allLines = [];
13
26
  function getPluginByAny(q) {
@@ -54,7 +67,11 @@ const pluginDagSort = (plugins, key = "name", preKey = "pre", postKey = "post")
54
67
  restInRingPoints[l[0]] = true;
55
68
  restInRingPoints[l[1]] = true;
56
69
  });
57
- throw new Error(`plugins dependences has loop: ${Object.keys(restInRingPoints).join(",")}`);
70
+ throw new Error(`plugins dependencies has loop: ${Object.keys(restInRingPoints).join(",")}`);
58
71
  }
59
72
  return sortedPoint;
60
73
  };
74
+ // Annotate the CommonJS export names for ESM import in node:
75
+ 0 && (module.exports = {
76
+ pluginDagSort
77
+ });
@@ -1,30 +1,13 @@
1
1
  import { _ as _object_spread } from "@swc/helpers/_/_object_spread";
2
2
  import fs from "fs";
3
3
  import path from "path";
4
- import { chalk } from "../compiled";
5
4
  import { readTsConfigByFile } from "./get";
6
5
  import { applyOptionsChain } from "./applyOptionsChain";
7
- export var validAlias = function(modernConfig, param) {
8
- var tsconfigPath = param.tsconfigPath;
9
- var alias = modernConfig.source.alias;
10
- if (!alias) {
11
- return null;
12
- }
13
- var isTsProject = fs.existsSync(tsconfigPath);
14
- if (!isTsProject) {
15
- return null;
16
- }
17
- var userAlias = getUserAlias(alias);
18
- if (Object.keys(userAlias).length > 0) {
19
- return chalk.red('Note: Please use `compilerOptions.paths` in "tsconfig.json" file replace `source.alias` config in "modern.config.js/ts" when project is typescript');
20
- }
21
- return null;
22
- };
23
- export var mergeAlias = function(alias) {
6
+ var mergeAlias = function(alias) {
24
7
  return applyOptionsChain({}, alias);
25
8
  };
26
- export var getAliasConfig = function(aliasOption, option) {
27
- var _tsconfig_compilerOptions, _tsconfig, _tsconfig_compilerOptions1, _tsconfig1;
9
+ var getAliasConfig = function(aliasOption, option) {
10
+ var _tsconfig_compilerOptions, _tsconfig_compilerOptions1;
28
11
  var isTsProject = fs.existsSync(option.tsconfigPath);
29
12
  var alias = mergeAlias(aliasOption);
30
13
  if (!isTsProject) {
@@ -32,19 +15,19 @@ export var getAliasConfig = function(aliasOption, option) {
32
15
  absoluteBaseUrl: option.appDirectory,
33
16
  paths: alias,
34
17
  isTsPath: false,
35
- isTsProject: isTsProject
18
+ isTsProject
36
19
  };
37
20
  }
38
21
  var tsconfig = readTsConfigByFile(option.tsconfigPath);
39
- var baseUrl = (_tsconfig = tsconfig) === null || _tsconfig === void 0 ? void 0 : (_tsconfig_compilerOptions = _tsconfig.compilerOptions) === null || _tsconfig_compilerOptions === void 0 ? void 0 : _tsconfig_compilerOptions.baseUrl;
22
+ var baseUrl = tsconfig === null || tsconfig === void 0 ? void 0 : (_tsconfig_compilerOptions = tsconfig.compilerOptions) === null || _tsconfig_compilerOptions === void 0 ? void 0 : _tsconfig_compilerOptions.baseUrl;
40
23
  return {
41
24
  absoluteBaseUrl: baseUrl ? path.join(option.appDirectory, baseUrl) : option.appDirectory,
42
- paths: _object_spread({}, alias, (_tsconfig1 = tsconfig) === null || _tsconfig1 === void 0 ? void 0 : (_tsconfig_compilerOptions1 = _tsconfig1.compilerOptions) === null || _tsconfig_compilerOptions1 === void 0 ? void 0 : _tsconfig_compilerOptions1.paths),
25
+ paths: _object_spread({}, alias, tsconfig === null || tsconfig === void 0 ? void 0 : (_tsconfig_compilerOptions1 = tsconfig.compilerOptions) === null || _tsconfig_compilerOptions1 === void 0 ? void 0 : _tsconfig_compilerOptions1.paths),
43
26
  isTsPath: true,
44
- isTsProject: isTsProject
27
+ isTsProject
45
28
  };
46
29
  };
47
- export var getUserAlias = function() {
30
+ var getUserAlias = function() {
48
31
  var alias = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
49
32
  return Object.keys(alias).reduce(function(o, k) {
50
33
  if (Array.isArray(alias[k])) {
@@ -53,3 +36,8 @@ export var getUserAlias = function() {
53
36
  return o;
54
37
  }, {});
55
38
  };
39
+ export {
40
+ getAliasConfig,
41
+ getUserAlias,
42
+ mergeAlias
43
+ };
@@ -1,6 +1,6 @@
1
1
  import { isFunction, isPlainObject } from "./is";
2
2
  import { logger } from "./logger";
3
- export function applyOptionsChain(defaults, options, utils) {
3
+ function applyOptionsChain(defaults, options, utils) {
4
4
  var mergeFn = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : Object.assign;
5
5
  if (!options) {
6
6
  return defaults;
@@ -24,3 +24,6 @@ export function applyOptionsChain(defaults, options, utils) {
24
24
  }
25
25
  return defaults;
26
26
  }
27
+ export {
28
+ applyOptionsChain
29
+ };
@@ -80,7 +80,7 @@ var modifyPresetOptions = function(presetName, options) {
80
80
  }
81
81
  });
82
82
  };
83
- export var getBabelUtils = function(config) {
83
+ var getBabelUtils = function(config) {
84
84
  var noop = function() {
85
85
  };
86
86
  return {
@@ -109,10 +109,14 @@ export var getBabelUtils = function(config) {
109
109
  }
110
110
  };
111
111
  };
112
- export var applyUserBabelConfig = function(defaultOptions, userBabelConfig, extraBabelUtils) {
112
+ var applyUserBabelConfig = function(defaultOptions, userBabelConfig, extraBabelUtils) {
113
113
  if (userBabelConfig) {
114
114
  var babelUtils = _object_spread({}, getBabelUtils(defaultOptions), extraBabelUtils);
115
115
  return applyOptionsChain(defaultOptions, userBabelConfig || {}, babelUtils);
116
116
  }
117
117
  return defaultOptions;
118
118
  };
119
+ export {
120
+ applyUserBabelConfig,
121
+ getBabelUtils
122
+ };
@@ -1,16 +1,22 @@
1
- export var getFullArgv = function() {
1
+ var getFullArgv = function() {
2
2
  var _process_env_MODERN_ARGV;
3
3
  return ((_process_env_MODERN_ARGV = process.env.MODERN_ARGV) === null || _process_env_MODERN_ARGV === void 0 ? void 0 : _process_env_MODERN_ARGV.split(" ")) || process.argv;
4
4
  };
5
- export var getArgv = function() {
5
+ var getArgv = function() {
6
6
  return getFullArgv().slice(2);
7
7
  };
8
- export var getCommand = function() {
8
+ var getCommand = function() {
9
9
  var args = getArgv();
10
10
  var command = args[0];
11
11
  return command;
12
12
  };
13
- export var isDevCommand = function() {
13
+ var isDevCommand = function() {
14
14
  var command = getCommand();
15
15
  return command === "dev" || command === "start";
16
16
  };
17
+ export {
18
+ getArgv,
19
+ getCommand,
20
+ getFullArgv,
21
+ isDevCommand
22
+ };
@@ -1,15 +1,20 @@
1
1
  import { debug } from "../../compiled/debug";
2
- export var createDebugger = function(scope) {
2
+ var createDebugger = function(scope) {
3
3
  return debug("modern-js:".concat(scope));
4
4
  };
5
- export var clearConsole = function() {
5
+ var clearConsole = function() {
6
6
  if (process.stdout.isTTY && !process.env.DEBUG) {
7
7
  process.stdout.write("\x1B[H\x1B[2J");
8
8
  }
9
9
  };
10
- export var wait = function() {
10
+ var wait = function() {
11
11
  var time = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : 0;
12
12
  return new Promise(function(resolve) {
13
13
  setTimeout(resolve, time);
14
14
  });
15
15
  };
16
+ export {
17
+ clearConsole,
18
+ createDebugger,
19
+ wait
20
+ };
@@ -1,7 +1,10 @@
1
- export var isOverriddenConfigKey = function(key) {
1
+ var isOverriddenConfigKey = function(key) {
2
2
  return [
3
3
  "removeConsole",
4
4
  "enableInlineScripts",
5
5
  "enableInlineStyles"
6
6
  ].includes(key);
7
7
  };
8
+ export {
9
+ isOverriddenConfigKey
10
+ };
@@ -1,4 +1,4 @@
1
- export var CHAIN_ID = {
1
+ var CHAIN_ID = {
2
2
  /** Predefined rules */
3
3
  RULE: {
4
4
  /** Rule for .mjs */
@@ -89,8 +89,6 @@ export var CHAIN_ID = {
89
89
  STYLE: "style-loader",
90
90
  /** postcss-loader */
91
91
  POSTCSS: "postcss",
92
- /** markdown-loader */
93
- MARKDOWN: "markdown",
94
92
  /** ignore-css-loader */
95
93
  IGNORE_CSS: "ignore-css",
96
94
  /** css-modules-typescript-loader */
@@ -171,7 +169,9 @@ export var CHAIN_ID = {
171
169
  /** HtmlAsyncChunkPlugin */
172
170
  HTML_ASYNC_CHUNK: "html-async-chunk",
173
171
  /** SWC_POLYFILL_CHECKER */
174
- SWC_POLYFILL_CHECKER: "swc-polyfill-checker-plugin"
172
+ SWC_POLYFILL_CHECKER: "swc-polyfill-checker-plugin",
173
+ /** RouterPlugin */
174
+ ROUTER_MANIFEST: "route-plugin"
175
175
  },
176
176
  /** Predefined minimizers */
177
177
  MINIMIZER: {
@@ -192,3 +192,6 @@ export var CHAIN_ID = {
192
192
  TS_CONFIG_PATHS: "ts-config-paths"
193
193
  }
194
194
  };
195
+ export {
196
+ CHAIN_ID
197
+ };
@@ -1,27 +1,27 @@
1
1
  import { _ as _define_property } from "@swc/helpers/_/_define_property";
2
- export var ROUTE_SPEC_FILE = "route.json";
3
- export var NESTED_ROUTE_SPEC_FILE = "nestedRoutes.json";
4
- export var MAIN_ENTRY_NAME = "main";
5
- export var SERVER_BUNDLE_DIRECTORY = "bundles";
6
- export var SERVER_WORKER_BUNDLE_DIRECTORY = "worker";
7
- export var ENTRY_NAME_PATTERN = "^[a-zA-Z0-9_-]+$";
8
- export var SERVER_RENDER_FUNCTION_NAME = "serverRender";
9
- export var LOADABLE_STATS_FILE = "loadable-stats.json";
10
- export var API_DIR = "api";
11
- export var SERVER_DIR = "server";
12
- export var SHARED_DIR = "shared";
13
- export var CONFIG_CACHE_DIR = "./node_modules/.cache/bundle-require";
14
- export var CONFIG_FILE_EXTENSIONS = [
2
+ var ROUTE_SPEC_FILE = "route.json";
3
+ var NESTED_ROUTE_SPEC_FILE = "nestedRoutes.json";
4
+ var MAIN_ENTRY_NAME = "main";
5
+ var SERVER_BUNDLE_DIRECTORY = "bundles";
6
+ var SERVER_WORKER_BUNDLE_DIRECTORY = "worker";
7
+ var ENTRY_NAME_PATTERN = "^[a-zA-Z0-9_-]+$";
8
+ var SERVER_RENDER_FUNCTION_NAME = "serverRender";
9
+ var LOADABLE_STATS_FILE = "loadable-stats.json";
10
+ var API_DIR = "api";
11
+ var SERVER_DIR = "server";
12
+ var SHARED_DIR = "shared";
13
+ var CONFIG_CACHE_DIR = "./node_modules/.cache/bundle-require";
14
+ var CONFIG_FILE_EXTENSIONS = [
15
15
  ".js",
16
16
  ".ts",
17
17
  ".mjs"
18
18
  ];
19
- export var OUTPUT_CONFIG_FILE = "modern.config.json";
20
- export var DEFAULT_SERVER_CONFIG = "modern.server-runtime.config";
21
- export var ROUTE_MANIFEST_FILE = "routes-manifest.json";
22
- export var LOADER_ROUTES_DIR = "loader-routes";
23
- export var DEFAULT_DEV_HOST = "0.0.0.0";
24
- export var INTERNAL_APP_TOOLS_PLUGINS = {
19
+ var OUTPUT_CONFIG_FILE = "modern.config.json";
20
+ var DEFAULT_SERVER_CONFIG = "modern.server-runtime.config";
21
+ var ROUTE_MANIFEST_FILE = "routes-manifest.json";
22
+ var LOADER_ROUTES_DIR = "loader-routes";
23
+ var DEFAULT_DEV_HOST = "0.0.0.0";
24
+ var INTERNAL_APP_TOOLS_PLUGINS = {
25
25
  "@modern-js/app-tools": "@modern-js/app-tools/cli",
26
26
  "@modern-js/plugin-proxy": "@modern-js/plugin-proxy/cli",
27
27
  "@modern-js/plugin-ssg": "@modern-js/plugin-ssg/cli",
@@ -37,10 +37,10 @@ export var INTERNAL_APP_TOOLS_PLUGINS = {
37
37
  // legacy router (inner react-router-dom v5)
38
38
  "@modern-js/plugin-router-v5": "@modern-js/plugin-router-v5/cli"
39
39
  };
40
- export var INTERNAL_APP_TOOLS_RUNTIME_PLUGINS = {
40
+ var INTERNAL_APP_TOOLS_RUNTIME_PLUGINS = {
41
41
  "@modern-js/runtime": "@modern-js/runtime/cli"
42
42
  };
43
- export var INTERNAL_MODULE_TOOLS_PLUGINS = {
43
+ var INTERNAL_MODULE_TOOLS_PLUGINS = {
44
44
  "@modern-js/module-tools": "@modern-js/module-tools",
45
45
  "@modern-js/runtime": "@modern-js/runtime/cli",
46
46
  "@modern-js/plugin-testing": "@modern-js/plugin-testing/cli",
@@ -49,16 +49,16 @@ export var INTERNAL_MODULE_TOOLS_PLUGINS = {
49
49
  // legacy router (inner react-router-dom v5)
50
50
  "@modern-js/plugin-router-legacy": "@modern-js/plugin-router-legacy/cli"
51
51
  };
52
- export var INTERNAL_MONOREPO_TOOLS_PLUGINS = {
52
+ var INTERNAL_MONOREPO_TOOLS_PLUGINS = {
53
53
  "@modern-js/monorepo-tools": "@modern-js/monorepo-tools/cli",
54
54
  "@modern-js/plugin-testing": "@modern-js/plugin-testing/cli"
55
55
  };
56
- export var INTERNAL_DOC_TOOLS_PLUGINS = {
56
+ var INTERNAL_DOC_TOOLS_PLUGINS = {
57
57
  "@modern-js/doc-tools": "@modern-js/doc-tools",
58
58
  "@modern-js/runtime": "@modern-js/runtime/cli",
59
59
  "@modern-js/plugin-testing": "@modern-js/plugin-testing/cli"
60
60
  };
61
- export var INTERNAL_CLI_PLUGINS = {
61
+ var INTERNAL_CLI_PLUGINS = {
62
62
  "@modern-js/app-tools": "@modern-js/app-tools/cli",
63
63
  "@modern-js/monorepo-tools": "@modern-js/monorepo-tools/cli",
64
64
  "@modern-js/module-tools": "@modern-js/module-tools",
@@ -79,14 +79,14 @@ export var INTERNAL_CLI_PLUGINS = {
79
79
  // legacy router (inner react-router-dom v5)
80
80
  "@modern-js/plugin-router-v5": "@modern-js/plugin-router-v5/cli"
81
81
  };
82
- export var SERVER_PLUGIN_BFF = "@modern-js/plugin-bff";
83
- export var SERVER_PLUGIN_EXPRESS = "@modern-js/plugin-express";
84
- export var SERVER_PLUGIN_KOA = "@modern-js/plugin-koa";
85
- export var SERVER_PLUGIN_SERVER = "@modern-js/plugin-server";
86
- export var SERVER_PLUGIN_POLYFILL = "@modern-js/plugin-polyfill";
82
+ var SERVER_PLUGIN_BFF = "@modern-js/plugin-bff";
83
+ var SERVER_PLUGIN_EXPRESS = "@modern-js/plugin-express";
84
+ var SERVER_PLUGIN_KOA = "@modern-js/plugin-koa";
85
+ var SERVER_PLUGIN_SERVER = "@modern-js/plugin-server";
86
+ var SERVER_PLUGIN_POLYFILL = "@modern-js/plugin-polyfill";
87
87
  var _obj;
88
- export var INTERNAL_SERVER_PLUGINS = (_obj = {}, _define_property(_obj, SERVER_PLUGIN_BFF, "@modern-js/plugin-bff/server"), _define_property(_obj, SERVER_PLUGIN_EXPRESS, "@modern-js/plugin-express/server"), _define_property(_obj, SERVER_PLUGIN_KOA, "@modern-js/plugin-koa/server"), _define_property(_obj, SERVER_PLUGIN_SERVER, "@modern-js/plugin-server/server"), _define_property(_obj, SERVER_PLUGIN_POLYFILL, "@modern-js/plugin-polyfill/server"), _obj);
89
- export var DEFAULT_BABEL_PRESET_TYPESCRIPT_OPTIONS = {
88
+ var INTERNAL_SERVER_PLUGINS = (_obj = {}, _define_property(_obj, SERVER_PLUGIN_BFF, "@modern-js/plugin-bff/server"), _define_property(_obj, SERVER_PLUGIN_EXPRESS, "@modern-js/plugin-express/server"), _define_property(_obj, SERVER_PLUGIN_KOA, "@modern-js/plugin-koa/server"), _define_property(_obj, SERVER_PLUGIN_SERVER, "@modern-js/plugin-server/server"), _define_property(_obj, SERVER_PLUGIN_POLYFILL, "@modern-js/plugin-polyfill/server"), _obj);
89
+ var DEFAULT_BABEL_PRESET_TYPESCRIPT_OPTIONS = {
90
90
  allowNamespaces: true,
91
91
  allExtensions: true,
92
92
  allowDeclareFields: true,
@@ -96,3 +96,36 @@ export var DEFAULT_BABEL_PRESET_TYPESCRIPT_OPTIONS = {
96
96
  isTSX: true
97
97
  };
98
98
  export * from "./chainId";
99
+ export {
100
+ API_DIR,
101
+ CONFIG_CACHE_DIR,
102
+ CONFIG_FILE_EXTENSIONS,
103
+ DEFAULT_BABEL_PRESET_TYPESCRIPT_OPTIONS,
104
+ DEFAULT_DEV_HOST,
105
+ DEFAULT_SERVER_CONFIG,
106
+ ENTRY_NAME_PATTERN,
107
+ INTERNAL_APP_TOOLS_PLUGINS,
108
+ INTERNAL_APP_TOOLS_RUNTIME_PLUGINS,
109
+ INTERNAL_CLI_PLUGINS,
110
+ INTERNAL_DOC_TOOLS_PLUGINS,
111
+ INTERNAL_MODULE_TOOLS_PLUGINS,
112
+ INTERNAL_MONOREPO_TOOLS_PLUGINS,
113
+ INTERNAL_SERVER_PLUGINS,
114
+ LOADABLE_STATS_FILE,
115
+ LOADER_ROUTES_DIR,
116
+ MAIN_ENTRY_NAME,
117
+ NESTED_ROUTE_SPEC_FILE,
118
+ OUTPUT_CONFIG_FILE,
119
+ ROUTE_MANIFEST_FILE,
120
+ ROUTE_SPEC_FILE,
121
+ SERVER_BUNDLE_DIRECTORY,
122
+ SERVER_DIR,
123
+ SERVER_PLUGIN_BFF,
124
+ SERVER_PLUGIN_EXPRESS,
125
+ SERVER_PLUGIN_KOA,
126
+ SERVER_PLUGIN_POLYFILL,
127
+ SERVER_PLUGIN_SERVER,
128
+ SERVER_RENDER_FUNCTION_NAME,
129
+ SERVER_WORKER_BUNDLE_DIRECTORY,
130
+ SHARED_DIR
131
+ };
@@ -1,8 +1,8 @@
1
1
  import path from "path";
2
- export var ensureAbsolutePath = function(base, filePath) {
2
+ var ensureAbsolutePath = function(base, filePath) {
3
3
  return path.isAbsolute(filePath) ? filePath : path.resolve(base, filePath);
4
4
  };
5
- export var ensureArray = function(params) {
5
+ var ensureArray = function(params) {
6
6
  if (Array.isArray(params)) {
7
7
  return params;
8
8
  }
@@ -10,3 +10,7 @@ export var ensureArray = function(params) {
10
10
  params
11
11
  ];
12
12
  };
13
+ export {
14
+ ensureAbsolutePath,
15
+ ensureArray
16
+ };
@@ -1,7 +1,7 @@
1
1
  import { _ as _async_to_generator } from "@swc/helpers/_/_async_to_generator";
2
2
  import { _ as _ts_generator } from "@swc/helpers/_/_ts_generator";
3
3
  import { fs } from "../compiled";
4
- export var findExists = function(files) {
4
+ var findExists = function(files) {
5
5
  var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = void 0;
6
6
  try {
7
7
  for (var _iterator = files[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
@@ -26,7 +26,7 @@ export var findExists = function(files) {
26
26
  }
27
27
  return false;
28
28
  };
29
- export var emptyDir = function() {
29
+ var emptyDir = function() {
30
30
  var _ref = _async_to_generator(function(dir) {
31
31
  return _ts_generator(this, function(_state) {
32
32
  switch (_state.label) {
@@ -59,3 +59,7 @@ export var emptyDir = function() {
59
59
  return _ref.apply(this, arguments);
60
60
  };
61
61
  }();
62
+ export {
63
+ emptyDir,
64
+ findExists
65
+ };
@@ -1,6 +1,6 @@
1
1
  import { _ as _object_spread } from "@swc/helpers/_/_object_spread";
2
2
  import { isPlainObject } from "../is";
3
- export var getEntryOptions = function(name, isMainEntry, baseOptions, optionsByEntries, packageName) {
3
+ var getEntryOptions = function(name, isMainEntry, baseOptions, optionsByEntries, packageName) {
4
4
  if (optionsByEntries) {
5
5
  var optionsByEntry = getOptionsByEntryName(name, optionsByEntries);
6
6
  if (optionsByEntry === void 0 && isMainEntry && packageName) {
@@ -14,3 +14,6 @@ export var getEntryOptions = function(name, isMainEntry, baseOptions, optionsByE
14
14
  var getOptionsByEntryName = function(name, optionsByEntries) {
15
15
  return optionsByEntries.hasOwnProperty(name) ? optionsByEntries[name] : void 0;
16
16
  };
17
+ export {
18
+ getEntryOptions
19
+ };