@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
@@ -19,13 +19,12 @@ var getIpv4Interfaces = function() {
19
19
  });
20
20
  return ipv4Interfaces;
21
21
  };
22
- export var getAddressUrls = function() {
22
+ var getAddressUrls = function() {
23
23
  var protocol = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : "http", port = arguments.length > 1 ? arguments[1] : void 0, host = arguments.length > 2 ? arguments[2] : void 0;
24
24
  var LOCAL_LABEL = "Local: ";
25
25
  var NETWORK_LABEL = "Network: ";
26
26
  var isLocalhost = function(url) {
27
- var _url;
28
- return (_url = url) === null || _url === void 0 ? void 0 : _url.includes("localhost");
27
+ return url === null || url === void 0 ? void 0 : url.includes("localhost");
29
28
  };
30
29
  if (host && host !== DEFAULT_DEV_HOST) {
31
30
  return [
@@ -51,7 +50,7 @@ export var getAddressUrls = function() {
51
50
  return memo;
52
51
  }, []);
53
52
  };
54
- export var prettyInstructions = function(appContext, config) {
53
+ var prettyInstructions = function(appContext, config) {
55
54
  var _appContext_builder_context_devServer, _appContext_builder, _config_dev, _config_source;
56
55
  var entrypoints = appContext.entrypoints, serverRoutes = appContext.serverRoutes, port = appContext.port, apiOnly = appContext.apiOnly, checkedEntries = appContext.checkedEntries;
57
56
  var isHttps = isDev() && ((_appContext_builder = appContext.builder) === null || _appContext_builder === void 0 ? void 0 : (_appContext_builder_context_devServer = _appContext_builder.context.devServer) === null || _appContext_builder_context_devServer === void 0 ? void 0 : _appContext_builder_context_devServer.https);
@@ -59,7 +58,7 @@ export var prettyInstructions = function(appContext, config) {
59
58
  var routes = !apiOnly ? serverRoutes.filter(function(route) {
60
59
  return route.entryName;
61
60
  }) : serverRoutes;
62
- var message = "App running at:\n\n";
61
+ var message = "\n";
63
62
  if (isSingleEntry(entrypoints, (_config_source = config.source) === null || _config_source === void 0 ? void 0 : _config_source.mainEntryName) || apiOnly) {
64
63
  message += urls.map(function(param) {
65
64
  var label = param.label, url = param.url;
@@ -87,3 +86,7 @@ export var prettyInstructions = function(appContext, config) {
87
86
  }
88
87
  return message;
89
88
  };
89
+ export {
90
+ getAddressUrls,
91
+ prettyInstructions
92
+ };
@@ -1,14 +1,13 @@
1
1
  import { _ as _object_spread } from "@swc/helpers/_/_object_spread";
2
2
  import { findExists } from "./fs";
3
- export var compatRequire = function(filePath) {
3
+ var compatRequire = function(filePath) {
4
4
  var interop = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : true;
5
- var _mod;
6
5
  var mod = require(filePath);
7
- var rtnESMDefault = interop && ((_mod = mod) === null || _mod === void 0 ? void 0 : _mod.__esModule);
6
+ var rtnESMDefault = interop && (mod === null || mod === void 0 ? void 0 : mod.__esModule);
8
7
  return rtnESMDefault ? mod.default : mod;
9
8
  };
10
- export var dynamicImport = new Function("modulePath", "return import(modulePath)");
11
- export var requireExistModule = function(filename, opt) {
9
+ var dynamicImport = new Function("modulePath", "return import(modulePath)");
10
+ var requireExistModule = function(filename, opt) {
12
11
  var final = _object_spread({
13
12
  extensions: [
14
13
  ".ts",
@@ -24,12 +23,12 @@ export var requireExistModule = function(filename, opt) {
24
23
  }
25
24
  return compatRequire(exist, final.interop);
26
25
  };
27
- export var cleanRequireCache = function(filelist) {
26
+ var cleanRequireCache = function(filelist) {
28
27
  filelist.forEach(function(filepath) {
29
28
  delete require.cache[filepath];
30
29
  });
31
30
  };
32
- export function deleteRequireCache(path) {
31
+ function deleteRequireCache(path) {
33
32
  if (require.cache[path]) {
34
33
  delete require.cache[path];
35
34
  }
@@ -39,7 +38,7 @@ export function deleteRequireCache(path) {
39
38
  });
40
39
  }
41
40
  }
42
- export var tryResolve = function(name, resolvePath) {
41
+ var tryResolve = function(name, resolvePath) {
43
42
  var filePath = "";
44
43
  try {
45
44
  filePath = require.resolve(name, {
@@ -56,3 +55,11 @@ export var tryResolve = function(name, resolvePath) {
56
55
  }
57
56
  return filePath;
58
57
  };
58
+ export {
59
+ cleanRequireCache,
60
+ compatRequire,
61
+ deleteRequireCache,
62
+ dynamicImport,
63
+ requireExistModule,
64
+ tryResolve
65
+ };
@@ -18,7 +18,7 @@ var memo = function(fn) {
18
18
  return res;
19
19
  };
20
20
  };
21
- export var createRuntimeExportsUtils = memo(function() {
21
+ var createRuntimeExportsUtils = memo(function() {
22
22
  var pwd = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : "", namespace = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : "index";
23
23
  var entryExportFile = path.join(pwd, ".runtime-exports/".concat(namespace, ".js"));
24
24
  var addExport = function(statement) {
@@ -35,7 +35,10 @@ export var createRuntimeExportsUtils = memo(function() {
35
35
  return entryExportFile;
36
36
  };
37
37
  return {
38
- addExport: addExport,
39
- getPath: getPath
38
+ addExport,
39
+ getPath
40
40
  };
41
41
  });
42
+ export {
43
+ createRuntimeExportsUtils
44
+ };
@@ -2,16 +2,16 @@ 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 path from "path";
4
4
  import { chokidar } from "../compiled";
5
- export var WatchChangeType = {
5
+ var WatchChangeType = {
6
6
  ADD: "add",
7
7
  UNLINK: "unlink",
8
8
  CHANGE: "change"
9
9
  };
10
- export var watch = function(watchDir, runTask) {
10
+ var watch = function(watchDir, runTask) {
11
11
  var ignored = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : [];
12
12
  var ready = false;
13
13
  var watcher = chokidar.watch(watchDir, {
14
- ignored: ignored
14
+ ignored
15
15
  });
16
16
  watcher.on("ready", function() {
17
17
  return ready = true;
@@ -26,7 +26,7 @@ export var watch = function(watchDir, runTask) {
26
26
  return [
27
27
  4,
28
28
  runTask({
29
- changedFilePath: changedFilePath,
29
+ changedFilePath,
30
30
  changeType: WatchChangeType.CHANGE
31
31
  })
32
32
  ];
@@ -57,7 +57,7 @@ export var watch = function(watchDir, runTask) {
57
57
  return [
58
58
  4,
59
59
  runTask({
60
- changedFilePath: changedFilePath,
60
+ changedFilePath,
61
61
  changeType: WatchChangeType.ADD
62
62
  })
63
63
  ];
@@ -85,7 +85,7 @@ export var watch = function(watchDir, runTask) {
85
85
  return [
86
86
  4,
87
87
  runTask({
88
- changedFilePath: changedFilePath,
88
+ changedFilePath,
89
89
  changeType: WatchChangeType.UNLINK
90
90
  })
91
91
  ];
@@ -106,3 +106,7 @@ export var watch = function(watchDir, runTask) {
106
106
  });
107
107
  return watcher;
108
108
  };
109
+ export {
110
+ WatchChangeType,
111
+ watch
112
+ };
@@ -1,32 +1,66 @@
1
1
  import { Import } from "./import";
2
- export { default as fs } from "../compiled/fs-extra";
3
- export { default as ora } from "../compiled/ora";
4
- export { default as glob } from "../compiled/glob";
5
- export { default as yaml } from "../compiled/js-yaml";
6
- export { default as chalk } from "../compiled/chalk";
7
- export { default as debug } from "../compiled/debug";
8
- export { default as slash } from "../compiled/slash";
9
- export { default as execa } from "../compiled/execa";
10
- export { default as json5 } from "../compiled/json5";
11
- export { default as upath } from "../compiled/upath";
12
- export { default as pkgUp } from "../compiled/pkg-up";
13
- export { nanoid } from "../compiled/nanoid";
14
- export { default as semver } from "../compiled/semver";
15
- export { default as dotenv } from "../compiled/dotenv";
16
- export { default as lodash } from "../compiled/lodash";
17
- export { default as globby } from "../compiled/globby";
18
- export { default as address } from "../compiled/address";
19
- export { default as signale } from "../compiled/signale";
20
- export { default as urlJoin } from "../compiled/url-join";
21
- export { default as minimist } from "../compiled/minimist";
22
- export { default as fastGlob } from "../compiled/fast-glob";
23
- export { default as filesize } from "../compiled/filesize";
24
- export { default as gzipSize } from "../compiled/gzip-size";
25
- export { default as stripAnsi } from "../compiled/strip-ansi";
26
- export { default as dotenvExpand } from "../compiled/dotenv-expand";
27
- export { default as browserslist } from "../compiled/browserslist";
28
- export { program, Command } from "../compiled/commander";
29
- export { Signale } from "../compiled/signale";
30
- export var mime = Import.lazy("../compiled/mime-types", require);
31
- export var chokidar = Import.lazy("../compiled/chokidar", require);
32
- export var inquirer = Import.lazy("../compiled/inquirer", require);
2
+ import { default as default2 } from "../compiled/fs-extra";
3
+ import { default as default3 } from "../compiled/ora";
4
+ import { default as default4 } from "../compiled/glob";
5
+ import { default as default5 } from "../compiled/js-yaml";
6
+ import { default as default6 } from "../compiled/chalk";
7
+ import { default as default7 } from "../compiled/debug";
8
+ import { default as default8 } from "../compiled/slash";
9
+ import { default as default9 } from "../compiled/execa";
10
+ import { default as default10 } from "../compiled/json5";
11
+ import { default as default11 } from "../compiled/upath";
12
+ import { default as default12 } from "../compiled/pkg-up";
13
+ import { nanoid } from "../compiled/nanoid";
14
+ import { default as default13 } from "../compiled/semver";
15
+ import { default as default14 } from "../compiled/dotenv";
16
+ import { default as default15 } from "../compiled/lodash";
17
+ import { default as default16 } from "../compiled/globby";
18
+ import { default as default17 } from "../compiled/address";
19
+ import { default as default18 } from "../compiled/signale";
20
+ import { default as default19 } from "../compiled/url-join";
21
+ import { default as default20 } from "../compiled/minimist";
22
+ import { default as default21 } from "../compiled/fast-glob";
23
+ import { default as default22 } from "../compiled/filesize";
24
+ import { default as default23 } from "../compiled/gzip-size";
25
+ import { default as default24 } from "../compiled/strip-ansi";
26
+ import { default as default25 } from "../compiled/dotenv-expand";
27
+ import { default as default26 } from "../compiled/browserslist";
28
+ import { program, Command } from "../compiled/commander";
29
+ import { Signale } from "../compiled/signale";
30
+ var mime = Import.lazy("../compiled/mime-types", require);
31
+ var chokidar = Import.lazy("../compiled/chokidar", require);
32
+ var inquirer = Import.lazy("../compiled/inquirer", require);
33
+ export {
34
+ Command,
35
+ Signale,
36
+ default17 as address,
37
+ default26 as browserslist,
38
+ default6 as chalk,
39
+ chokidar,
40
+ default7 as debug,
41
+ default14 as dotenv,
42
+ default25 as dotenvExpand,
43
+ default9 as execa,
44
+ default21 as fastGlob,
45
+ default22 as filesize,
46
+ default2 as fs,
47
+ default4 as glob,
48
+ default16 as globby,
49
+ default23 as gzipSize,
50
+ inquirer,
51
+ default10 as json5,
52
+ default15 as lodash,
53
+ mime,
54
+ default20 as minimist,
55
+ nanoid,
56
+ default3 as ora,
57
+ default12 as pkgUp,
58
+ program,
59
+ default13 as semver,
60
+ default18 as signale,
61
+ default8 as slash,
62
+ default24 as stripAnsi,
63
+ default11 as upath,
64
+ default19 as urlJoin,
65
+ default5 as yaml
66
+ };
@@ -2,7 +2,10 @@ var lazy = function(moduleName, requireFn) {
2
2
  var importLazyLocal = require("../compiled/import-lazy")(requireFn);
3
3
  return importLazyLocal(moduleName);
4
4
  };
5
- export { lazy as lazyImport };
6
- export var Import = {
7
- lazy: lazy
5
+ var Import = {
6
+ lazy
7
+ };
8
+ export {
9
+ Import,
10
+ lazy as lazyImport
8
11
  };
@@ -1,4 +1,10 @@
1
- export var ROUTE_MANIFEST = "_MODERNJS_ROUTE_MANIFEST";
2
- export var HMR_SOCK_PATH = "/webpack-hmr";
3
- export var HTML_CHUNKSMAP_SEPARATOR = "<!--<?- chunksMap.js ?>-->";
4
- export var LOADER_REPORTER_NAME = "server-loader";
1
+ var ROUTE_MANIFEST = "_MODERNJS_ROUTE_MANIFEST";
2
+ var HMR_SOCK_PATH = "/webpack-hmr";
3
+ var HTML_CHUNKSMAP_SEPARATOR = "<!--<?- chunksMap.js ?>-->";
4
+ var LOADER_REPORTER_NAME = "server-loader";
5
+ export {
6
+ HMR_SOCK_PATH,
7
+ HTML_CHUNKSMAP_SEPARATOR,
8
+ LOADER_REPORTER_NAME,
9
+ ROUTE_MANIFEST
10
+ };
@@ -50,7 +50,7 @@ var defaultColor = {
50
50
  yellow: noop,
51
51
  underline: noop
52
52
  };
53
- export function addErrorTips(errors) {
53
+ function addErrorTips(errors) {
54
54
  var color = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : defaultColor;
55
55
  var errorHelpers = [
56
56
  {
@@ -71,9 +71,9 @@ export function addErrorTips(errors) {
71
71
  }
72
72
  function formatWebpackMessages(json) {
73
73
  var color = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : defaultColor;
74
- var _json_errors, _json, _json_warnings, _json1, _result_errors;
75
- var formattedErrors = (_json = json) === null || _json === void 0 ? void 0 : (_json_errors = _json.errors) === null || _json_errors === void 0 ? void 0 : _json_errors.map(formatMessage);
76
- var formattedWarnings = (_json1 = json) === null || _json1 === void 0 ? void 0 : (_json_warnings = _json1.warnings) === null || _json_warnings === void 0 ? void 0 : _json_warnings.map(formatMessage);
74
+ var _json_errors, _json_warnings, _result_errors;
75
+ var formattedErrors = json === null || json === void 0 ? void 0 : (_json_errors = json.errors) === null || _json_errors === void 0 ? void 0 : _json_errors.map(formatMessage);
76
+ var formattedWarnings = json === null || json === void 0 ? void 0 : (_json_warnings = json.warnings) === null || _json_warnings === void 0 ? void 0 : _json_warnings.map(formatMessage);
77
77
  var result = {
78
78
  errors: formattedErrors || [],
79
79
  warnings: formattedWarnings || [],
@@ -88,4 +88,7 @@ function formatWebpackMessages(json) {
88
88
  result.errors = addErrorTips(result.errors, color);
89
89
  return result;
90
90
  }
91
- export { formatWebpackMessages };
91
+ export {
92
+ addErrorTips,
93
+ formatWebpackMessages
94
+ };
@@ -1,4 +1,4 @@
1
- export var pluginDagSort = function(plugins) {
1
+ var pluginDagSort = function(plugins) {
2
2
  var _loop = function() {
3
3
  var zep = zeroEndPoints.shift();
4
4
  sortedPoint.push(getPluginByAny(zep));
@@ -67,7 +67,10 @@ export var pluginDagSort = function(plugins) {
67
67
  restInRingPoints[l[0]] = true;
68
68
  restInRingPoints[l[1]] = true;
69
69
  });
70
- throw new Error("plugins dependences has loop: ".concat(Object.keys(restInRingPoints).join(",")));
70
+ throw new Error("plugins dependencies has loop: ".concat(Object.keys(restInRingPoints).join(",")));
71
71
  }
72
72
  return sortedPoint;
73
73
  };
74
+ export {
75
+ pluginDagSort
76
+ };
@@ -1,26 +1,10 @@
1
1
  import fs from "fs";
2
2
  import path from "path";
3
- import { chalk } from "../compiled";
4
3
  import { readTsConfigByFile } from "./get";
5
4
  import { applyOptionsChain } from "./applyOptionsChain";
6
- export const validAlias = (modernConfig, { tsconfigPath }) => {
7
- const { source: { alias } } = modernConfig;
8
- if (!alias) {
9
- return null;
10
- }
11
- const isTsProject = fs.existsSync(tsconfigPath);
12
- if (!isTsProject) {
13
- return null;
14
- }
15
- const userAlias = getUserAlias(alias);
16
- if (Object.keys(userAlias).length > 0) {
17
- 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');
18
- }
19
- return null;
20
- };
21
- export const mergeAlias = (alias) => applyOptionsChain({}, alias);
22
- export const getAliasConfig = (aliasOption, option) => {
23
- var _tsconfig_compilerOptions, _tsconfig, _tsconfig_compilerOptions1, _tsconfig1;
5
+ const mergeAlias = (alias) => applyOptionsChain({}, alias);
6
+ const getAliasConfig = (aliasOption, option) => {
7
+ var _tsconfig_compilerOptions, _tsconfig_compilerOptions1;
24
8
  const isTsProject = fs.existsSync(option.tsconfigPath);
25
9
  const alias = mergeAlias(aliasOption);
26
10
  if (!isTsProject) {
@@ -32,20 +16,25 @@ export const getAliasConfig = (aliasOption, option) => {
32
16
  };
33
17
  }
34
18
  const tsconfig = readTsConfigByFile(option.tsconfigPath);
35
- const baseUrl = (_tsconfig = tsconfig) === null || _tsconfig === void 0 ? void 0 : (_tsconfig_compilerOptions = _tsconfig.compilerOptions) === null || _tsconfig_compilerOptions === void 0 ? void 0 : _tsconfig_compilerOptions.baseUrl;
19
+ const baseUrl = tsconfig === null || tsconfig === void 0 ? void 0 : (_tsconfig_compilerOptions = tsconfig.compilerOptions) === null || _tsconfig_compilerOptions === void 0 ? void 0 : _tsconfig_compilerOptions.baseUrl;
36
20
  return {
37
21
  absoluteBaseUrl: baseUrl ? path.join(option.appDirectory, baseUrl) : option.appDirectory,
38
22
  paths: {
39
23
  ...alias,
40
- ...(_tsconfig1 = tsconfig) === null || _tsconfig1 === void 0 ? void 0 : (_tsconfig_compilerOptions1 = _tsconfig1.compilerOptions) === null || _tsconfig_compilerOptions1 === void 0 ? void 0 : _tsconfig_compilerOptions1.paths
24
+ ...tsconfig === null || tsconfig === void 0 ? void 0 : (_tsconfig_compilerOptions1 = tsconfig.compilerOptions) === null || _tsconfig_compilerOptions1 === void 0 ? void 0 : _tsconfig_compilerOptions1.paths
41
25
  },
42
26
  isTsPath: true,
43
27
  isTsProject
44
28
  };
45
29
  };
46
- export const getUserAlias = (alias = {}) => Object.keys(alias).reduce((o, k) => {
30
+ const getUserAlias = (alias = {}) => Object.keys(alias).reduce((o, k) => {
47
31
  if (Array.isArray(alias[k])) {
48
32
  o[k] = alias[k];
49
33
  }
50
34
  return o;
51
35
  }, {});
36
+ export {
37
+ getAliasConfig,
38
+ getUserAlias,
39
+ mergeAlias
40
+ };
@@ -1,6 +1,6 @@
1
1
  import { isFunction, isPlainObject } from "./is";
2
2
  import { logger } from "./logger";
3
- export function applyOptionsChain(defaults, options, utils, mergeFn = Object.assign) {
3
+ function applyOptionsChain(defaults, options, utils, mergeFn = Object.assign) {
4
4
  if (!options) {
5
5
  return defaults;
6
6
  }
@@ -22,3 +22,6 @@ default options is: ${JSON.stringify(defaults)}`);
22
22
  }
23
23
  return defaults;
24
24
  }
25
+ export {
26
+ applyOptionsChain
27
+ };
@@ -74,7 +74,7 @@ const modifyPresetOptions = (presetName, options, presets = []) => {
74
74
  }
75
75
  });
76
76
  };
77
- export const getBabelUtils = (config) => {
77
+ const getBabelUtils = (config) => {
78
78
  const noop = () => {
79
79
  };
80
80
  return {
@@ -91,7 +91,7 @@ export const getBabelUtils = (config) => {
91
91
  modifyPresetReactOptions: (options) => modifyPresetOptions("@babel/preset-react", options, config.presets || [])
92
92
  };
93
93
  };
94
- export const applyUserBabelConfig = (defaultOptions, userBabelConfig, extraBabelUtils) => {
94
+ const applyUserBabelConfig = (defaultOptions, userBabelConfig, extraBabelUtils) => {
95
95
  if (userBabelConfig) {
96
96
  const babelUtils = {
97
97
  ...getBabelUtils(defaultOptions),
@@ -101,3 +101,7 @@ export const applyUserBabelConfig = (defaultOptions, userBabelConfig, extraBabel
101
101
  }
102
102
  return defaultOptions;
103
103
  };
104
+ export {
105
+ applyUserBabelConfig,
106
+ getBabelUtils
107
+ };
@@ -1,16 +1,22 @@
1
- export const getFullArgv = () => {
1
+ const getFullArgv = () => {
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 const getArgv = () => {
5
+ const getArgv = () => {
6
6
  return getFullArgv().slice(2);
7
7
  };
8
- export const getCommand = () => {
8
+ const getCommand = () => {
9
9
  const args = getArgv();
10
10
  const command = args[0];
11
11
  return command;
12
12
  };
13
- export const isDevCommand = () => {
13
+ const isDevCommand = () => {
14
14
  const command = getCommand();
15
15
  return command === "dev" || command === "start";
16
16
  };
17
+ export {
18
+ getArgv,
19
+ getCommand,
20
+ getFullArgv,
21
+ isDevCommand
22
+ };
@@ -1,10 +1,15 @@
1
1
  import { debug } from "../../compiled/debug";
2
- export const createDebugger = (scope) => debug(`modern-js:${scope}`);
3
- export const clearConsole = () => {
2
+ const createDebugger = (scope) => debug(`modern-js:${scope}`);
3
+ const clearConsole = () => {
4
4
  if (process.stdout.isTTY && !process.env.DEBUG) {
5
5
  process.stdout.write("\x1B[H\x1B[2J");
6
6
  }
7
7
  };
8
- export const wait = (time = 0) => new Promise((resolve) => {
8
+ const wait = (time = 0) => new Promise((resolve) => {
9
9
  setTimeout(resolve, time);
10
10
  });
11
+ export {
12
+ clearConsole,
13
+ createDebugger,
14
+ wait
15
+ };
@@ -1,5 +1,8 @@
1
- export const isOverriddenConfigKey = (key) => [
1
+ const isOverriddenConfigKey = (key) => [
2
2
  "removeConsole",
3
3
  "enableInlineScripts",
4
4
  "enableInlineStyles"
5
5
  ].includes(key);
6
+ export {
7
+ isOverriddenConfigKey
8
+ };
@@ -1,4 +1,4 @@
1
- export const CHAIN_ID = {
1
+ const CHAIN_ID = {
2
2
  /** Predefined rules */
3
3
  RULE: {
4
4
  /** Rule for .mjs */
@@ -89,8 +89,6 @@ export const 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 const 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 const CHAIN_ID = {
192
192
  TS_CONFIG_PATHS: "ts-config-paths"
193
193
  }
194
194
  };
195
+ export {
196
+ CHAIN_ID
197
+ };