@modern-js/module-tools 2.35.1 → 2.37.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (223) hide show
  1. package/dist/build.js +43 -16
  2. package/dist/builder/build.d.ts +0 -10
  3. package/dist/builder/build.js +96 -208
  4. package/dist/builder/clear.d.ts +1 -4
  5. package/dist/builder/clear.js +32 -28
  6. package/dist/builder/copy.js +75 -60
  7. package/dist/builder/dts/index.js +27 -19
  8. package/dist/builder/dts/rollup.d.ts +6 -14
  9. package/dist/builder/dts/rollup.js +60 -37
  10. package/dist/builder/dts/tsc.d.ts +3 -2
  11. package/dist/builder/dts/tsc.js +50 -37
  12. package/dist/builder/esbuild/adapter.d.ts +3 -0
  13. package/dist/builder/esbuild/adapter.js +286 -0
  14. package/dist/builder/esbuild/hook.d.ts +4 -0
  15. package/dist/builder/esbuild/hook.js +103 -0
  16. package/dist/builder/esbuild/index.d.ts +35 -0
  17. package/dist/builder/esbuild/index.js +268 -0
  18. package/dist/builder/esbuild/resolve.d.ts +18 -0
  19. package/dist/builder/esbuild/resolve.js +140 -0
  20. package/dist/builder/esbuild/sourcemap.d.ts +16 -0
  21. package/dist/builder/esbuild/sourcemap.js +86 -0
  22. package/dist/builder/esbuild/transform.d.ts +7 -0
  23. package/dist/builder/esbuild/transform.js +45 -0
  24. package/dist/builder/esbuild/watch.d.ts +2 -0
  25. package/dist/builder/esbuild/watch.js +115 -0
  26. package/dist/builder/esbuild/write-file.d.ts +2 -0
  27. package/dist/builder/esbuild/write-file.js +89 -0
  28. package/dist/builder/feature/asset.d.ts +19 -0
  29. package/dist/builder/feature/asset.js +149 -0
  30. package/dist/builder/feature/format-cjs.d.ts +5 -0
  31. package/dist/builder/feature/format-cjs.js +53 -0
  32. package/dist/builder/feature/index.d.ts +2 -0
  33. package/dist/builder/feature/index.js +74 -0
  34. package/dist/builder/feature/json.d.ts +5 -0
  35. package/dist/builder/feature/json.js +47 -0
  36. package/dist/builder/feature/redirect.d.ts +5 -0
  37. package/dist/builder/feature/redirect.js +223 -0
  38. package/dist/builder/feature/style/index.d.ts +5 -0
  39. package/dist/builder/feature/style/index.js +94 -0
  40. package/dist/builder/feature/style/lessAliasPlugin.d.ts +12 -0
  41. package/dist/builder/feature/style/lessAliasPlugin.js +70 -0
  42. package/dist/builder/feature/style/lessRender.d.ts +2 -0
  43. package/dist/builder/feature/style/lessRender.js +64 -0
  44. package/dist/builder/feature/style/postcssTransformer.d.ts +6 -0
  45. package/dist/builder/feature/style/postcssTransformer.js +95 -0
  46. package/dist/builder/feature/style/postcssUrlPlugin.d.ts +6 -0
  47. package/dist/builder/feature/style/postcssUrlPlugin.js +58 -0
  48. package/dist/builder/feature/style/sassRender.d.ts +2 -0
  49. package/dist/builder/feature/style/sassRender.js +85 -0
  50. package/dist/builder/feature/style/transformStyle.d.ts +13 -0
  51. package/dist/builder/feature/style/transformStyle.js +101 -0
  52. package/dist/builder/feature/style/utils.d.ts +18 -0
  53. package/dist/builder/feature/style/utils.js +130 -0
  54. package/dist/builder/feature/swc.d.ts +9 -0
  55. package/dist/builder/feature/swc.js +170 -0
  56. package/dist/builder/feature/terser.d.ts +5 -0
  57. package/dist/builder/feature/terser.js +83 -0
  58. package/dist/builder/index.js +59 -28
  59. package/dist/builder/platform.js +38 -23
  60. package/dist/cli.js +58 -29
  61. package/dist/command.js +62 -38
  62. package/dist/config/defineConfig.js +25 -17
  63. package/dist/config/legacySchema.js +35 -32
  64. package/dist/config/merge.js +69 -36
  65. package/dist/config/normalize.js +63 -46
  66. package/dist/config/schema.d.ts +48 -0
  67. package/dist/config/schema.js +53 -34
  68. package/dist/config/transformLegacyConfig.js +67 -61
  69. package/dist/config/valid.d.ts +2 -2
  70. package/dist/config/valid.js +44 -21
  71. package/dist/constants/build.d.ts +5 -1
  72. package/dist/constants/build.js +88 -46
  73. package/dist/constants/color.js +27 -20
  74. package/dist/constants/dts.js +27 -20
  75. package/dist/constants/file.d.ts +2 -2
  76. package/dist/constants/file.js +48 -25
  77. package/dist/constants/legacy-preset.js +45 -32
  78. package/dist/constants/loader.d.ts +2 -0
  79. package/dist/constants/loader.js +53 -0
  80. package/dist/constants/log.d.ts +0 -8
  81. package/dist/constants/log.js +27 -41
  82. package/dist/constants/preset.d.ts +4 -4
  83. package/dist/constants/preset.js +55 -62
  84. package/dist/debug.d.ts +4 -0
  85. package/dist/debug.js +37 -0
  86. package/dist/dev.js +42 -25
  87. package/dist/error.js +49 -42
  88. package/dist/hooks/build.d.ts +1 -2
  89. package/dist/hooks/build.js +36 -28
  90. package/dist/hooks/dev.js +32 -17
  91. package/dist/hooks/index.d.ts +1 -1
  92. package/dist/hooks/index.js +31 -16
  93. package/dist/hooks/misc.d.ts +5 -2
  94. package/dist/hooks/misc.js +31 -12
  95. package/dist/index.d.ts +2 -1
  96. package/dist/index.js +39 -32
  97. package/dist/locale/en.js +32 -17
  98. package/dist/locale/index.d.ts +2 -1
  99. package/dist/locale/index.js +31 -24
  100. package/dist/locale/zh.js +32 -17
  101. package/dist/plugins.js +28 -13
  102. package/dist/types/color.js +15 -5
  103. package/dist/types/command.d.ts +3 -3
  104. package/dist/types/command.js +15 -5
  105. package/dist/types/config/copy.js +15 -5
  106. package/dist/types/config/dev.js +15 -5
  107. package/dist/types/config/index.d.ts +87 -52
  108. package/dist/types/config/index.js +24 -6
  109. package/dist/types/config/style.d.ts +58 -6
  110. package/dist/types/config/style.js +15 -5
  111. package/dist/types/context.js +15 -5
  112. package/dist/types/dts.d.ts +14 -3
  113. package/dist/types/dts.js +15 -5
  114. package/dist/types/esbuild.d.ts +107 -0
  115. package/dist/types/esbuild.js +32 -0
  116. package/dist/types/hooks.js +15 -5
  117. package/dist/types/index.d.ts +1 -0
  118. package/dist/types/index.js +32 -11
  119. package/dist/types/legacyConfig/index.js +15 -5
  120. package/dist/types/legacyConfig/output.d.ts +4 -4
  121. package/dist/types/legacyConfig/output.js +15 -5
  122. package/dist/types/legacyConfig/source.js +15 -5
  123. package/dist/types/legacyConfig/tools.js +15 -5
  124. package/dist/utils/assert.d.ts +5 -0
  125. package/dist/utils/assert.js +50 -0
  126. package/dist/utils/builder.d.ts +10 -14
  127. package/dist/utils/builder.js +59 -59
  128. package/dist/utils/common.d.ts +1 -1
  129. package/dist/utils/common.js +25 -17
  130. package/dist/utils/dts.d.ts +26 -9
  131. package/dist/utils/dts.js +98 -64
  132. package/dist/utils/hash.d.ts +2 -0
  133. package/dist/utils/hash.js +31 -0
  134. package/dist/utils/index.d.ts +11 -0
  135. package/dist/utils/index.js +42 -0
  136. package/dist/utils/input.js +47 -24
  137. package/dist/utils/log.d.ts +1 -2
  138. package/dist/utils/log.js +36 -20
  139. package/dist/utils/map.d.ts +13 -0
  140. package/dist/utils/map.js +58 -0
  141. package/dist/utils/onExit.js +35 -11
  142. package/dist/utils/print.d.ts +2 -2
  143. package/dist/utils/print.js +52 -49
  144. package/dist/utils/style.d.ts +5 -23
  145. package/dist/utils/style.js +57 -37
  146. package/dist/utils/tspath.js +114 -0
  147. package/package.json +61 -50
  148. package/vitest.config.ts +20 -0
  149. package/dist/build.js.map +0 -1
  150. package/dist/builder/build.js.map +0 -1
  151. package/dist/builder/clear.js.map +0 -1
  152. package/dist/builder/copy.js.map +0 -1
  153. package/dist/builder/dts/index.js.map +0 -1
  154. package/dist/builder/dts/rollup.js.map +0 -1
  155. package/dist/builder/dts/tsc.js.map +0 -1
  156. package/dist/builder/index.js.map +0 -1
  157. package/dist/builder/platform.js.map +0 -1
  158. package/dist/cli.js.map +0 -1
  159. package/dist/command.js.map +0 -1
  160. package/dist/config/defineConfig.js.map +0 -1
  161. package/dist/config/legacySchema.js.map +0 -1
  162. package/dist/config/merge.js.map +0 -1
  163. package/dist/config/normalize.js.map +0 -1
  164. package/dist/config/schema.js.map +0 -1
  165. package/dist/config/transformLegacyConfig.js.map +0 -1
  166. package/dist/config/valid.js.map +0 -1
  167. package/dist/constants/build.js.map +0 -1
  168. package/dist/constants/color.js.map +0 -1
  169. package/dist/constants/dts.js.map +0 -1
  170. package/dist/constants/file.js.map +0 -1
  171. package/dist/constants/legacy-preset.js.map +0 -1
  172. package/dist/constants/log.js.map +0 -1
  173. package/dist/constants/preset.js.map +0 -1
  174. package/dist/dev.js.map +0 -1
  175. package/dist/error.js.map +0 -1
  176. package/dist/hooks/build.js.map +0 -1
  177. package/dist/hooks/dev.js.map +0 -1
  178. package/dist/hooks/index.js.map +0 -1
  179. package/dist/hooks/misc.js.map +0 -1
  180. package/dist/index.js.map +0 -1
  181. package/dist/locale/en.js.map +0 -1
  182. package/dist/locale/index.js.map +0 -1
  183. package/dist/locale/zh.js.map +0 -1
  184. package/dist/plugins.js.map +0 -1
  185. package/dist/types/color.js.map +0 -1
  186. package/dist/types/command.js.map +0 -1
  187. package/dist/types/config/copy.js.map +0 -1
  188. package/dist/types/config/dev.js.map +0 -1
  189. package/dist/types/config/index.js.map +0 -1
  190. package/dist/types/config/style.js.map +0 -1
  191. package/dist/types/context.js.map +0 -1
  192. package/dist/types/dts.js.map +0 -1
  193. package/dist/types/hooks.js.map +0 -1
  194. package/dist/types/index.js.map +0 -1
  195. package/dist/types/legacyConfig/index.js.map +0 -1
  196. package/dist/types/legacyConfig/output.js.map +0 -1
  197. package/dist/types/legacyConfig/source.js.map +0 -1
  198. package/dist/types/legacyConfig/tools.js.map +0 -1
  199. package/dist/types/utils.d.ts +0 -5
  200. package/dist/types/utils.js +0 -4
  201. package/dist/utils/builder.js.map +0 -1
  202. package/dist/utils/common.js.map +0 -1
  203. package/dist/utils/context.d.ts +0 -7
  204. package/dist/utils/context.js +0 -23
  205. package/dist/utils/context.js.map +0 -1
  206. package/dist/utils/dts.js.map +0 -1
  207. package/dist/utils/input.js.map +0 -1
  208. package/dist/utils/language.d.ts +0 -1
  209. package/dist/utils/language.js +0 -22
  210. package/dist/utils/language.js.map +0 -1
  211. package/dist/utils/libuild-plugin.d.ts +0 -3
  212. package/dist/utils/libuild-plugin.js +0 -31
  213. package/dist/utils/libuild-plugin.js.map +0 -1
  214. package/dist/utils/log.js.map +0 -1
  215. package/dist/utils/onExit.js.map +0 -1
  216. package/dist/utils/path.d.ts +0 -1
  217. package/dist/utils/path.js +0 -19
  218. package/dist/utils/path.js.map +0 -1
  219. package/dist/utils/print.js.map +0 -1
  220. package/dist/utils/style.js.map +0 -1
  221. package/dist/utils/tspathsTransform.js +0 -91
  222. package/dist/utils/tspathsTransform.js.map +0 -1
  223. /package/dist/utils/{tspathsTransform.d.ts → tspath.d.ts} +0 -0
@@ -1,30 +1,28 @@
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
- assetExts: function() {
14
- return assetExts;
15
- },
16
- styleExts: function() {
17
- return styleExts;
18
- },
19
- dtsAliasExts: function() {
20
- return dtsAliasExts;
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 });
21
15
  }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+ var file_exports = {};
20
+ __export(file_exports, {
21
+ assetExt: () => assetExt,
22
+ dtsAliasExts: () => dtsAliasExts,
23
+ styleExts: () => styleExts
22
24
  });
23
- const assetExts = [
24
- ".png",
25
- ".jpg",
26
- ".svg"
27
- ];
25
+ module.exports = __toCommonJS(file_exports);
28
26
  const styleExts = [
29
27
  ".css",
30
28
  ".less",
@@ -34,5 +32,30 @@ const styleExts = [
34
32
  const dtsAliasExts = [
35
33
  ".d.ts"
36
34
  ];
37
-
38
- //# sourceMappingURL=file.js.map
35
+ const assetExt = [
36
+ ".svg",
37
+ ".png",
38
+ ".jpg",
39
+ ".jpeg",
40
+ ".gif",
41
+ ".webp",
42
+ ".ttf",
43
+ ".otf",
44
+ ".woff",
45
+ ".woff2",
46
+ ".eot",
47
+ ".mp3",
48
+ ".mp4",
49
+ ".webm",
50
+ ".ogg",
51
+ ".wav",
52
+ ".flac",
53
+ ".aac",
54
+ ".mov"
55
+ ];
56
+ // Annotate the CommonJS export names for ESM import in node:
57
+ 0 && (module.exports = {
58
+ assetExt,
59
+ dtsAliasExts,
60
+ styleExts
61
+ });
@@ -1,40 +1,46 @@
1
1
  "use strict";
2
- Object.defineProperty(exports, "__esModule", {
3
- value: true
4
- });
5
- function _export(target, all) {
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __export = (target, all) => {
6
9
  for (var name in all)
7
- Object.defineProperty(target, name, {
8
- enumerable: true,
9
- get: all[name]
10
- });
11
- }
12
- _export(exports, {
13
- universalJsPreset: function() {
14
- return universalJsPreset;
15
- },
16
- universalJsLitePreset: function() {
17
- return universalJsLitePreset;
18
- },
19
- browserJsPreset: function() {
20
- return browserJsPreset;
21
- },
22
- browserJsLitePreset: function() {
23
- return browserJsLitePreset;
24
- },
25
- nodeJsPreset: function() {
26
- return nodeJsPreset;
27
- },
28
- legacyPresets: function() {
29
- return legacyPresets;
10
+ __defProp(target, name, { get: all[name], enumerable: true });
11
+ };
12
+ var __copyProps = (to, from, except, desc) => {
13
+ if (from && typeof from === "object" || typeof from === "function") {
14
+ for (let key of __getOwnPropNames(from))
15
+ if (!__hasOwnProp.call(to, key) && key !== except)
16
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
30
17
  }
18
+ return to;
19
+ };
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ // If the importer is in node compatibility mode or this is not an ESM
22
+ // file that has been converted to a CommonJS file using a Babel-
23
+ // compatible transform (i.e. "__esModule" has not been set), then set
24
+ // "default" to the CommonJS "module.exports" for node compatibility.
25
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
+ mod
27
+ ));
28
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
+ var legacy_preset_exports = {};
30
+ __export(legacy_preset_exports, {
31
+ browserJsLitePreset: () => browserJsLitePreset,
32
+ browserJsPreset: () => browserJsPreset,
33
+ legacyPresets: () => legacyPresets,
34
+ nodeJsPreset: () => nodeJsPreset,
35
+ universalJsLitePreset: () => universalJsLitePreset,
36
+ universalJsPreset: () => universalJsPreset
31
37
  });
32
- const _interop_require_default = require("@swc/helpers/_/_interop_require_default");
33
- const _path = /* @__PURE__ */ _interop_require_default._(require("path"));
38
+ module.exports = __toCommonJS(legacy_preset_exports);
39
+ var import_path = __toESM(require("path"));
34
40
  const legacyWithSourceCodeToCopyConfig = {
35
41
  patterns: [
36
42
  {
37
- from: _path.default.join("src", "**/*.{less,sass,scss}"),
43
+ from: import_path.default.join("src", "**/*.{less,sass,scss}"),
38
44
  context: "src"
39
45
  }
40
46
  ]
@@ -199,5 +205,12 @@ const legacyPresets = {
199
205
  "node-js": nodeJsPreset,
200
206
  NODE_JS: nodeJsPreset
201
207
  };
202
-
203
- //# sourceMappingURL=legacy-preset.js.map
208
+ // Annotate the CommonJS export names for ESM import in node:
209
+ 0 && (module.exports = {
210
+ browserJsLitePreset,
211
+ browserJsPreset,
212
+ legacyPresets,
213
+ nodeJsPreset,
214
+ universalJsLitePreset,
215
+ universalJsPreset
216
+ });
@@ -0,0 +1,2 @@
1
+ import type { Loader } from 'esbuild';
2
+ export declare const loaderMap: Record<string, Loader>;
@@ -0,0 +1,53 @@
1
+ "use strict";
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 });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+ var loader_exports = {};
20
+ __export(loader_exports, {
21
+ loaderMap: () => loaderMap
22
+ });
23
+ module.exports = __toCommonJS(loader_exports);
24
+ const loaderMap = {
25
+ ".aac": "file",
26
+ ".css": "file",
27
+ ".eot": "file",
28
+ ".flac": "file",
29
+ ".gif": "file",
30
+ ".jpeg": "file",
31
+ ".jpg": "file",
32
+ ".mp3": "file",
33
+ ".mp4": "file",
34
+ ".ogg": "file",
35
+ ".otf": "file",
36
+ ".png": "file",
37
+ ".svg": "file",
38
+ ".ttf": "file",
39
+ ".wav": "file",
40
+ ".webm": "file",
41
+ ".webp": "file",
42
+ ".woff": "file",
43
+ ".woff2": "file",
44
+ ".jsx": "jsx",
45
+ ".tsx": "tsx",
46
+ ".ts": "ts",
47
+ ".js": "js",
48
+ ".json": "json"
49
+ };
50
+ // Annotate the CommonJS export names for ESM import in node:
51
+ 0 && (module.exports = {
52
+ loaderMap
53
+ });
@@ -1,11 +1,3 @@
1
- export declare enum SectionTitleStatus {
2
- Success = 0,
3
- Fail = 1,
4
- Log = 2,
5
- }
6
- export declare const BundleDtsLogPrefix = "[Bundle:DTS]";
7
- export declare const BundlelessDtsLogPrefix = "[Bundleless:DTS]";
8
- export declare const CopyLogPrefix = "[Copy]";
9
1
  export declare const buildSuccessText = "Build succeed";
10
2
  export declare const reportFile1LineText = "Bundle Files";
11
3
  export declare const reportFile2LineText = "Size";
@@ -1,48 +1,34 @@
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
- SectionTitleStatus: function() {
14
- return SectionTitleStatus;
15
- },
16
- BundleDtsLogPrefix: function() {
17
- return BundleDtsLogPrefix;
18
- },
19
- BundlelessDtsLogPrefix: function() {
20
- return BundlelessDtsLogPrefix;
21
- },
22
- CopyLogPrefix: function() {
23
- return CopyLogPrefix;
24
- },
25
- buildSuccessText: function() {
26
- return buildSuccessText;
27
- },
28
- reportFile1LineText: function() {
29
- return reportFile1LineText;
30
- },
31
- reportFile2LineText: function() {
32
- return reportFile2LineText;
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 });
33
15
  }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+ var log_exports = {};
20
+ __export(log_exports, {
21
+ buildSuccessText: () => buildSuccessText,
22
+ reportFile1LineText: () => reportFile1LineText,
23
+ reportFile2LineText: () => reportFile2LineText
34
24
  });
35
- var SectionTitleStatus;
36
- (function(SectionTitleStatus2) {
37
- SectionTitleStatus2[SectionTitleStatus2["Success"] = 0] = "Success";
38
- SectionTitleStatus2[SectionTitleStatus2["Fail"] = 1] = "Fail";
39
- SectionTitleStatus2[SectionTitleStatus2["Log"] = 2] = "Log";
40
- })(SectionTitleStatus || (SectionTitleStatus = {}));
41
- const BundleDtsLogPrefix = "[Bundle:DTS]";
42
- const BundlelessDtsLogPrefix = "[Bundleless:DTS]";
43
- const CopyLogPrefix = "[Copy]";
25
+ module.exports = __toCommonJS(log_exports);
44
26
  const buildSuccessText = "Build succeed";
45
27
  const reportFile1LineText = "Bundle Files";
46
28
  const reportFile2LineText = "Size";
47
-
48
- //# sourceMappingURL=log.js.map
29
+ // Annotate the CommonJS export names for ESM import in node:
30
+ 0 && (module.exports = {
31
+ buildSuccessText,
32
+ reportFile1LineText,
33
+ reportFile2LineText
34
+ });
@@ -7,19 +7,19 @@ export declare const npmComponentWithUmdPresetConfig: PartialBaseBuildConfig[];
7
7
  export declare const libraryPreset: {
8
8
  'npm-library': PartialBaseBuildConfig[];
9
9
  };
10
- export declare const libraryPresetWithTarget: Record<"npm-library-es5" | "npm-library-es6" | "npm-library-esnext" | "npm-library-es2015" | "npm-library-es2016" | "npm-library-es2017" | "npm-library-es2018" | "npm-library-es2019" | "npm-library-es2020" | "npm-library-es2021" | "npm-library-es2022", PartialBaseBuildConfig[]>;
10
+ export declare const libraryPresetWithTarget: Record<"npm-library-es6" | "npm-library-esnext" | "npm-library-es5" | "npm-library-es2015" | "npm-library-es2016" | "npm-library-es2017" | "npm-library-es2018" | "npm-library-es2019" | "npm-library-es2020" | "npm-library-es2021" | "npm-library-es2022", PartialBaseBuildConfig[]>;
11
11
  export declare const libraryUmdPreset: {
12
12
  'npm-library-with-umd': PartialBaseBuildConfig[];
13
13
  };
14
- export declare const libraryUmdPresetWithTarget: Record<"npm-library-with-umd-es5" | "npm-library-with-umd-es6" | "npm-library-with-umd-esnext" | "npm-library-with-umd-es2015" | "npm-library-with-umd-es2016" | "npm-library-with-umd-es2017" | "npm-library-with-umd-es2018" | "npm-library-with-umd-es2019" | "npm-library-with-umd-es2020" | "npm-library-with-umd-es2021" | "npm-library-with-umd-es2022", PartialBaseBuildConfig[]>;
14
+ export declare const libraryUmdPresetWithTarget: Record<"npm-library-with-umd-es6" | "npm-library-with-umd-esnext" | "npm-library-with-umd-es5" | "npm-library-with-umd-es2015" | "npm-library-with-umd-es2016" | "npm-library-with-umd-es2017" | "npm-library-with-umd-es2018" | "npm-library-with-umd-es2019" | "npm-library-with-umd-es2020" | "npm-library-with-umd-es2021" | "npm-library-with-umd-es2022", PartialBaseBuildConfig[]>;
15
15
  export declare const componentPreset: {
16
16
  'npm-component': PartialBaseBuildConfig[];
17
17
  };
18
- export declare const componentPresetWithTarget: Record<"npm-component-es5" | "npm-component-es6" | "npm-component-esnext" | "npm-component-es2015" | "npm-component-es2016" | "npm-component-es2017" | "npm-component-es2018" | "npm-component-es2019" | "npm-component-es2020" | "npm-component-es2021" | "npm-component-es2022", PartialBaseBuildConfig[]>;
18
+ export declare const componentPresetWithTarget: Record<"npm-component-es6" | "npm-component-esnext" | "npm-component-es5" | "npm-component-es2015" | "npm-component-es2016" | "npm-component-es2017" | "npm-component-es2018" | "npm-component-es2019" | "npm-component-es2020" | "npm-component-es2021" | "npm-component-es2022", PartialBaseBuildConfig[]>;
19
19
  export declare const componentUmdPreset: {
20
20
  'npm-component-with-umd': PartialBaseBuildConfig[];
21
21
  };
22
- export declare const componentUmdPresetWithTarget: Record<"npm-component-with-umd-es5" | "npm-component-with-umd-es6" | "npm-component-with-umd-esnext" | "npm-component-with-umd-es2015" | "npm-component-with-umd-es2016" | "npm-component-with-umd-es2017" | "npm-component-with-umd-es2018" | "npm-component-with-umd-es2019" | "npm-component-with-umd-es2020" | "npm-component-with-umd-es2021" | "npm-component-with-umd-es2022", PartialBaseBuildConfig[]>;
22
+ export declare const componentUmdPresetWithTarget: Record<"npm-component-with-umd-es6" | "npm-component-with-umd-esnext" | "npm-component-with-umd-es5" | "npm-component-with-umd-es2015" | "npm-component-with-umd-es2016" | "npm-component-with-umd-es2017" | "npm-component-with-umd-es2018" | "npm-component-with-umd-es2019" | "npm-component-with-umd-es2020" | "npm-component-with-umd-es2021" | "npm-component-with-umd-es2022", PartialBaseBuildConfig[]>;
23
23
  export declare const nodeBuildConfig: PartialBaseBuildConfig[];
24
24
  export declare const universalBuildConfig: PartialBaseBuildConfig[];
25
25
  export declare const presetList: Record<string, PartialBaseBuildConfig[]>;
@@ -1,67 +1,42 @@
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
- targets: function() {
14
- return targets;
15
- },
16
- npmLibraryPresetConfig: function() {
17
- return npmLibraryPresetConfig;
18
- },
19
- npmLibraryWithUmdPresetConfig: function() {
20
- return npmLibraryWithUmdPresetConfig;
21
- },
22
- npmComponentPresetConfig: function() {
23
- return npmComponentPresetConfig;
24
- },
25
- npmComponentWithUmdPresetConfig: function() {
26
- return npmComponentWithUmdPresetConfig;
27
- },
28
- libraryPreset: function() {
29
- return libraryPreset;
30
- },
31
- libraryPresetWithTarget: function() {
32
- return libraryPresetWithTarget;
33
- },
34
- libraryUmdPreset: function() {
35
- return libraryUmdPreset;
36
- },
37
- libraryUmdPresetWithTarget: function() {
38
- return libraryUmdPresetWithTarget;
39
- },
40
- componentPreset: function() {
41
- return componentPreset;
42
- },
43
- componentPresetWithTarget: function() {
44
- return componentPresetWithTarget;
45
- },
46
- componentUmdPreset: function() {
47
- return componentUmdPreset;
48
- },
49
- componentUmdPresetWithTarget: function() {
50
- return componentUmdPresetWithTarget;
51
- },
52
- nodeBuildConfig: function() {
53
- return nodeBuildConfig;
54
- },
55
- universalBuildConfig: function() {
56
- return universalBuildConfig;
57
- },
58
- presetList: function() {
59
- return presetList;
60
- },
61
- internalPreset: function() {
62
- return internalPreset;
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 });
63
15
  }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+ var preset_exports = {};
20
+ __export(preset_exports, {
21
+ componentPreset: () => componentPreset,
22
+ componentPresetWithTarget: () => componentPresetWithTarget,
23
+ componentUmdPreset: () => componentUmdPreset,
24
+ componentUmdPresetWithTarget: () => componentUmdPresetWithTarget,
25
+ internalPreset: () => internalPreset,
26
+ libraryPreset: () => libraryPreset,
27
+ libraryPresetWithTarget: () => libraryPresetWithTarget,
28
+ libraryUmdPreset: () => libraryUmdPreset,
29
+ libraryUmdPresetWithTarget: () => libraryUmdPresetWithTarget,
30
+ nodeBuildConfig: () => nodeBuildConfig,
31
+ npmComponentPresetConfig: () => npmComponentPresetConfig,
32
+ npmComponentWithUmdPresetConfig: () => npmComponentWithUmdPresetConfig,
33
+ npmLibraryPresetConfig: () => npmLibraryPresetConfig,
34
+ npmLibraryWithUmdPresetConfig: () => npmLibraryWithUmdPresetConfig,
35
+ presetList: () => presetList,
36
+ targets: () => targets,
37
+ universalBuildConfig: () => universalBuildConfig
64
38
  });
39
+ module.exports = __toCommonJS(preset_exports);
65
40
  const targets = [
66
41
  "es5",
67
42
  "es6",
@@ -313,5 +288,23 @@ const internalPreset = {
313
288
  "modern-js-node": nodeBuildConfig,
314
289
  "modern-js-universal": universalBuildConfig
315
290
  };
316
-
317
- //# sourceMappingURL=preset.js.map
291
+ // Annotate the CommonJS export names for ESM import in node:
292
+ 0 && (module.exports = {
293
+ componentPreset,
294
+ componentPresetWithTarget,
295
+ componentUmdPreset,
296
+ componentUmdPresetWithTarget,
297
+ internalPreset,
298
+ libraryPreset,
299
+ libraryPresetWithTarget,
300
+ libraryUmdPreset,
301
+ libraryUmdPresetWithTarget,
302
+ nodeBuildConfig,
303
+ npmComponentPresetConfig,
304
+ npmComponentWithUmdPresetConfig,
305
+ npmLibraryPresetConfig,
306
+ npmLibraryWithUmdPresetConfig,
307
+ presetList,
308
+ targets,
309
+ universalBuildConfig
310
+ });
@@ -0,0 +1,4 @@
1
+ import { debug as Debugger } from '@modern-js/utils';
2
+ export declare const debug: Debugger.Debugger;
3
+ export declare const label: (info: string) => string;
4
+ export declare const debugResolve: Debugger.Debugger;
package/dist/debug.js ADDED
@@ -0,0 +1,37 @@
1
+ "use strict";
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 });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+ var debug_exports = {};
20
+ __export(debug_exports, {
21
+ debug: () => debug,
22
+ debugResolve: () => debugResolve,
23
+ label: () => label
24
+ });
25
+ module.exports = __toCommonJS(debug_exports);
26
+ var import_utils = require("@modern-js/utils");
27
+ const debug = (0, import_utils.debug)("module");
28
+ const label = (info) => {
29
+ return import_utils.chalk.blue(`[${info.toUpperCase()}]`);
30
+ };
31
+ const debugResolve = (0, import_utils.debug)("module:resolve");
32
+ // Annotate the CommonJS export names for ESM import in node:
33
+ 0 && (module.exports = {
34
+ debug,
35
+ debugResolve,
36
+ label
37
+ });
package/dist/dev.js CHANGED
@@ -1,27 +1,41 @@
1
1
  "use strict";
2
- Object.defineProperty(exports, "__esModule", {
3
- value: true
4
- });
5
- function _export(target, all) {
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __export = (target, all) => {
6
9
  for (var name in all)
7
- Object.defineProperty(target, name, {
8
- enumerable: true,
9
- get: all[name]
10
- });
11
- }
12
- _export(exports, {
13
- showMenu: function() {
14
- return showMenu;
15
- },
16
- dev: function() {
17
- return dev;
10
+ __defProp(target, name, { get: all[name], enumerable: true });
11
+ };
12
+ var __copyProps = (to, from, except, desc) => {
13
+ if (from && typeof from === "object" || typeof from === "function") {
14
+ for (let key of __getOwnPropNames(from))
15
+ if (!__hasOwnProp.call(to, key) && key !== except)
16
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
18
17
  }
18
+ return to;
19
+ };
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ // If the importer is in node compatibility mode or this is not an ESM
22
+ // file that has been converted to a CommonJS file using a Babel-
23
+ // compatible transform (i.e. "__esModule" has not been set), then set
24
+ // "default" to the CommonJS "module.exports" for node compatibility.
25
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
+ mod
27
+ ));
28
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
+ var dev_exports = {};
30
+ __export(dev_exports, {
31
+ dev: () => dev,
32
+ showMenu: () => showMenu
19
33
  });
20
- const _interop_require_wildcard = require("@swc/helpers/_/_interop_require_wildcard");
21
- const _utils = require("@modern-js/utils");
34
+ module.exports = __toCommonJS(dev_exports);
35
+ var import_utils = require("@modern-js/utils");
22
36
  const showMenu = async (metas, devCmdOptions, api, context) => {
23
37
  const runner = api.useHookRunners();
24
- const menuTitle = _utils.chalk.rgb(255, 153, 0);
38
+ const menuTitle = import_utils.chalk.rgb(255, 153, 0);
25
39
  const choices = metas.map((meta) => meta.menuItem).filter((menuItem) => typeof menuItem === "object");
26
40
  const questions = [
27
41
  {
@@ -32,7 +46,7 @@ const showMenu = async (metas, devCmdOptions, api, context) => {
32
46
  }
33
47
  ];
34
48
  const newQuestions = await runner.beforeDevMenu(questions);
35
- const result = await _utils.inquirer.prompt(newQuestions.length !== 0 ? newQuestions : questions);
49
+ const result = await import_utils.inquirer.prompt(newQuestions.length !== 0 ? newQuestions : questions);
36
50
  await runner.afterDevMenu({
37
51
  result,
38
52
  devTools: metas
@@ -49,18 +63,18 @@ const showMenu = async (metas, devCmdOptions, api, context) => {
49
63
  }
50
64
  };
51
65
  const dev = async (options, metas, api, context) => {
52
- const { green } = await Promise.resolve().then(() => /* @__PURE__ */ _interop_require_wildcard._(require("./constants/color")));
66
+ const { green } = await Promise.resolve().then(() => __toESM(require("./constants/color")));
53
67
  const runner = api.useHookRunners();
54
68
  if (metas.length === 0) {
55
- const local = await Promise.resolve().then(() => /* @__PURE__ */ _interop_require_wildcard._(require("./locale")));
69
+ const local = await Promise.resolve().then(() => __toESM(require("./locale")));
56
70
  const noDevToolsLog = await runner.noDevTools(local.i18n.t(local.localeKeys.log.dev.noDevtools));
57
- _utils.logger.info(noDevToolsLog);
71
+ import_utils.logger.info(noDevToolsLog);
58
72
  process.exit(0);
59
73
  }
60
74
  if (metas.length === 1) {
61
75
  var _metas__menuItem;
62
76
  var _metas__menuItem_name;
63
- _utils.logger.info(_utils.chalk.rgb(...green)(`Only one dev tooling is currently detected as available, run it directly [${(_metas__menuItem_name = (_metas__menuItem = metas[0].menuItem) === null || _metas__menuItem === void 0 ? void 0 : _metas__menuItem.name) !== null && _metas__menuItem_name !== void 0 ? _metas__menuItem_name : metas[0].name}]`));
77
+ import_utils.logger.info(import_utils.chalk.rgb(...green)(`Only one dev tooling is currently detected as available, run it directly [${(_metas__menuItem_name = (_metas__menuItem = metas[0].menuItem) === null || _metas__menuItem === void 0 ? void 0 : _metas__menuItem.name) !== null && _metas__menuItem_name !== void 0 ? _metas__menuItem_name : metas[0].name}]`));
64
78
  const meta = metas[0];
65
79
  await runner.beforeDevTask(meta);
66
80
  await meta.action(options, {
@@ -70,5 +84,8 @@ const dev = async (options, metas, api, context) => {
70
84
  await showMenu(metas, options, api, context);
71
85
  }
72
86
  };
73
-
74
- //# sourceMappingURL=dev.js.map
87
+ // Annotate the CommonJS export names for ESM import in node:
88
+ 0 && (module.exports = {
89
+ dev,
90
+ showMenu
91
+ });