@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
package/dist/error.js CHANGED
@@ -1,36 +1,33 @@
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
- padSpaceWith: function() {
14
- return padSpaceWith;
15
- },
16
- InternalBuildError: function() {
17
- return InternalBuildError;
18
- },
19
- InternalDTSError: function() {
20
- return InternalDTSError;
21
- },
22
- ModuleBuildError: function() {
23
- return ModuleBuildError;
24
- },
25
- isInternalError: function() {
26
- return isInternalError;
27
- },
28
- isExecaError: function() {
29
- return isExecaError;
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 });
30
15
  }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+ var error_exports = {};
20
+ __export(error_exports, {
21
+ InternalBuildError: () => InternalBuildError,
22
+ InternalDTSError: () => InternalDTSError,
23
+ ModuleBuildError: () => ModuleBuildError,
24
+ isExecaError: () => isExecaError,
25
+ isInternalError: () => isInternalError,
26
+ padSpaceWith: () => padSpaceWith
31
27
  });
32
- const _define_property = require("@swc/helpers/_/_define_property");
33
- const _utils = require("@modern-js/utils");
28
+ module.exports = __toCommonJS(error_exports);
29
+ var import_define_property = require("@swc/helpers/_/_define_property");
30
+ var import_utils = require("@modern-js/utils");
34
31
  const padSpaceWith = (str, targetL, opts = {}) => {
35
32
  const { endStr = "|", style } = opts;
36
33
  const l = str.length;
@@ -57,7 +54,7 @@ class InternalBuildError extends Error {
57
54
  const { e, buildType, target, format } = this;
58
55
  const textL = 25;
59
56
  const title = `│ ${padSpaceWith(`${buildType} failed:`, textL - 2, {
60
- style: _utils.chalk.red.underline,
57
+ style: import_utils.chalk.red.underline,
61
58
  endStr: "│"
62
59
  })}`;
63
60
  const formatMsg = padSpaceWith(`│ - format is "${format}"`, textL, {
@@ -72,18 +69,21 @@ class InternalBuildError extends Error {
72
69
  const endLine = padSpaceWith("╰".padEnd(textL - 1, "─"), textL, {
73
70
  endStr: "╯"
74
71
  });
75
- msgs.push(startLine, title, formatMsg, targetMsg, endLine, _utils.chalk.blue.bold.underline(`
72
+ msgs.push(startLine, title, formatMsg, targetMsg, endLine, import_utils.chalk.blue.bold.underline(`
76
73
  Detailed Information: `));
77
- msgs.push(e.toString());
78
- msgs.push(e.stack || "");
74
+ if (e.stack) {
75
+ msgs.push(e.stack);
76
+ } else {
77
+ msgs.push(e.message);
78
+ }
79
79
  return msgs;
80
80
  }
81
81
  constructor(e, opts) {
82
82
  super(e.message);
83
- _define_property._(this, "buildType", void 0);
84
- _define_property._(this, "target", void 0);
85
- _define_property._(this, "format", void 0);
86
- _define_property._(this, "e", void 0);
83
+ (0, import_define_property._)(this, "buildType", void 0);
84
+ (0, import_define_property._)(this, "target", void 0);
85
+ (0, import_define_property._)(this, "format", void 0);
86
+ (0, import_define_property._)(this, "e", void 0);
87
87
  Error.captureStackTrace(this, this.constructor);
88
88
  this.e = e;
89
89
  this.buildType = opts.buildType;
@@ -98,7 +98,7 @@ class InternalDTSError extends Error {
98
98
  formatError() {
99
99
  const msgs = [];
100
100
  const { e, buildType } = this;
101
- msgs.push(_utils.chalk.red.bold(`${buildType} DTS failed:`));
101
+ msgs.push(import_utils.chalk.red.bold(`${buildType} DTS failed:`));
102
102
  if (isExecaError(e)) {
103
103
  if (e.stack) {
104
104
  var _e_stack;
@@ -111,8 +111,8 @@ class InternalDTSError extends Error {
111
111
  }
112
112
  constructor(e, opts) {
113
113
  super(e.message);
114
- _define_property._(this, "buildType", void 0);
115
- _define_property._(this, "e", void 0);
114
+ (0, import_define_property._)(this, "buildType", void 0);
115
+ (0, import_define_property._)(this, "e", void 0);
116
116
  Error.captureStackTrace(this, this.constructor);
117
117
  this.e = e;
118
118
  this.buildType = opts.buildType;
@@ -139,5 +139,12 @@ const isExecaError = (e) => {
139
139
  }
140
140
  return false;
141
141
  };
142
-
143
- //# sourceMappingURL=error.js.map
142
+ // Annotate the CommonJS export names for ESM import in node:
143
+ 0 && (module.exports = {
144
+ InternalBuildError,
145
+ InternalDTSError,
146
+ ModuleBuildError,
147
+ isExecaError,
148
+ isInternalError,
149
+ padSpaceWith
150
+ });
@@ -1,7 +1,6 @@
1
1
  import type { RegisterBuildPlatformResult } from '@modern-js/core';
2
2
  import { BuildCommandOptions } from '../types';
3
- import type { BuildConfig, BaseBuildConfig } from '../types/config';
4
- import type { BuildTaskResult, BuildResult, BuildPlatformResult, WatchDtsHookContext, WatchJsHookContext } from '../types/hooks';
3
+ import type { BuildTaskResult, BuildResult, BuildPlatformResult, WatchDtsHookContext, WatchJsHookContext, BuildConfig, BaseBuildConfig } from '../types';
5
4
  export declare const buildHooks: {
6
5
  beforeBuild: import("@modern-js/plugin").ParallelWorkflow<{
7
6
  config: BuildConfig;
@@ -1,36 +1,44 @@
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
- buildHooks: function() {
14
- return buildHooks;
15
- },
16
- buildWatchHooks: function() {
17
- return buildWatchHooks;
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 build_exports = {};
20
+ __export(build_exports, {
21
+ buildHooks: () => buildHooks,
22
+ buildWatchHooks: () => buildWatchHooks
19
23
  });
20
- const _plugin = require("@modern-js/plugin");
24
+ module.exports = __toCommonJS(build_exports);
25
+ var import_plugin = require("@modern-js/plugin");
21
26
  const buildHooks = {
22
- beforeBuild: (0, _plugin.createParallelWorkflow)(),
23
- beforeBuildTask: (0, _plugin.createAsyncWaterfall)(),
24
- afterBuildTask: (0, _plugin.createParallelWorkflow)(),
25
- afterBuild: (0, _plugin.createParallelWorkflow)(),
26
- registerBuildPlatform: (0, _plugin.createParallelWorkflow)(),
27
- beforeBuildPlatform: (0, _plugin.createParallelWorkflow)(),
28
- buildPlatform: (0, _plugin.createParallelWorkflow)(),
29
- afterBuildPlatform: (0, _plugin.createParallelWorkflow)()
27
+ beforeBuild: (0, import_plugin.createParallelWorkflow)(),
28
+ beforeBuildTask: (0, import_plugin.createAsyncWaterfall)(),
29
+ afterBuildTask: (0, import_plugin.createParallelWorkflow)(),
30
+ afterBuild: (0, import_plugin.createParallelWorkflow)(),
31
+ registerBuildPlatform: (0, import_plugin.createParallelWorkflow)(),
32
+ beforeBuildPlatform: (0, import_plugin.createParallelWorkflow)(),
33
+ buildPlatform: (0, import_plugin.createParallelWorkflow)(),
34
+ afterBuildPlatform: (0, import_plugin.createParallelWorkflow)()
30
35
  };
31
36
  const buildWatchHooks = {
32
- buildWatchJs: (0, _plugin.createParallelWorkflow)(),
33
- buildWatchDts: (0, _plugin.createParallelWorkflow)()
37
+ buildWatchJs: (0, import_plugin.createParallelWorkflow)(),
38
+ buildWatchDts: (0, import_plugin.createParallelWorkflow)()
34
39
  };
35
-
36
- //# sourceMappingURL=build.js.map
40
+ // Annotate the CommonJS export names for ESM import in node:
41
+ 0 && (module.exports = {
42
+ buildHooks,
43
+ buildWatchHooks
44
+ });
package/dist/hooks/dev.js CHANGED
@@ -1,23 +1,38 @@
1
1
  "use strict";
2
- Object.defineProperty(exports, "__esModule", {
3
- value: true
4
- });
5
- Object.defineProperty(exports, "devHooks", {
6
- enumerable: true,
7
- get: function() {
8
- return devHooks;
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 dev_exports = {};
20
+ __export(dev_exports, {
21
+ devHooks: () => devHooks
10
22
  });
11
- const _plugin = require("@modern-js/plugin");
23
+ module.exports = __toCommonJS(dev_exports);
24
+ var import_plugin = require("@modern-js/plugin");
12
25
  const devHooks = {
13
- registerDev: (0, _plugin.createParallelWorkflow)(),
14
- beforeDev: (0, _plugin.createParallelWorkflow)(),
15
- beforeDevMenu: (0, _plugin.createAsyncWaterfall)(),
16
- afterDevMenu: (0, _plugin.createParallelWorkflow)(),
17
- beforeDevTask: (0, _plugin.createParallelWorkflow)(),
18
- afterDev: (0, _plugin.createParallelWorkflow)(),
26
+ registerDev: (0, import_plugin.createParallelWorkflow)(),
27
+ beforeDev: (0, import_plugin.createParallelWorkflow)(),
28
+ beforeDevMenu: (0, import_plugin.createAsyncWaterfall)(),
29
+ afterDevMenu: (0, import_plugin.createParallelWorkflow)(),
30
+ beforeDevTask: (0, import_plugin.createParallelWorkflow)(),
31
+ afterDev: (0, import_plugin.createParallelWorkflow)(),
19
32
  // Special and rarely used hooks
20
- noDevTools: (0, _plugin.createAsyncWaterfall)()
33
+ noDevTools: (0, import_plugin.createAsyncWaterfall)()
21
34
  };
22
-
23
- //# sourceMappingURL=dev.js.map
35
+ // Annotate the CommonJS export names for ESM import in node:
36
+ 0 && (module.exports = {
37
+ devHooks
38
+ });
@@ -2,7 +2,7 @@ export declare const registerHook: {
2
2
  buildWatchJs: import("@modern-js/plugin").ParallelWorkflow<import("..").WatchJsHookContext, void>;
3
3
  buildWatchDts: import("@modern-js/plugin").ParallelWorkflow<import("..").WatchDtsHookContext, void>;
4
4
  addRuntimeExports: import("@modern-js/plugin").AsyncWaterfall<void>;
5
- modifyLibuild: import("@modern-js/plugin").AsyncPipeline<import("@modern-js/libuild").CLIConfig, import("@modern-js/libuild").CLIConfig>;
5
+ modifyLibuild: import("@modern-js/plugin").AsyncPipeline<unknown, unknown>;
6
6
  registerDev: import("@modern-js/plugin").ParallelWorkflow<void, import("..").DevToolData>;
7
7
  beforeDev: import("@modern-js/plugin").ParallelWorkflow<import("..").DevToolData[], void>;
8
8
  beforeDevMenu: import("@modern-js/plugin").AsyncWaterfall<any>;
@@ -1,21 +1,36 @@
1
1
  "use strict";
2
- Object.defineProperty(exports, "__esModule", {
3
- value: true
4
- });
5
- Object.defineProperty(exports, "registerHook", {
6
- enumerable: true,
7
- get: function() {
8
- return registerHook;
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 hooks_exports = {};
20
+ __export(hooks_exports, {
21
+ registerHook: () => registerHook
10
22
  });
11
- const _build = require("./build");
12
- const _dev = require("./dev");
13
- const _misc = require("./misc");
23
+ module.exports = __toCommonJS(hooks_exports);
24
+ var import_build = require("./build");
25
+ var import_dev = require("./dev");
26
+ var import_misc = require("./misc");
14
27
  const registerHook = {
15
- ..._build.buildHooks,
16
- ..._dev.devHooks,
17
- ..._misc.miscHooks,
18
- ..._build.buildWatchHooks
28
+ ...import_build.buildHooks,
29
+ ...import_dev.devHooks,
30
+ ...import_misc.miscHooks,
31
+ ...import_build.buildWatchHooks
19
32
  };
20
-
21
- //# sourceMappingURL=index.js.map
33
+ // Annotate the CommonJS export names for ESM import in node:
34
+ 0 && (module.exports = {
35
+ registerHook
36
+ });
@@ -1,5 +1,8 @@
1
- import type { CLIConfig } from '@modern-js/libuild';
2
1
  export declare const miscHooks: {
3
2
  addRuntimeExports: import("@modern-js/plugin").AsyncWaterfall<void>;
4
- modifyLibuild: import("@modern-js/plugin").AsyncPipeline<CLIConfig, CLIConfig>;
3
+ /**
4
+ * @deprecated
5
+ * use buildConfig.hooks and buildConfig.esbuildOptions instead.
6
+ */
7
+ modifyLibuild: import("@modern-js/plugin").AsyncPipeline<unknown, unknown>;
5
8
  };
@@ -1,17 +1,36 @@
1
1
  "use strict";
2
- Object.defineProperty(exports, "__esModule", {
3
- value: true
4
- });
5
- Object.defineProperty(exports, "miscHooks", {
6
- enumerable: true,
7
- get: function() {
8
- return miscHooks;
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 misc_exports = {};
20
+ __export(misc_exports, {
21
+ miscHooks: () => miscHooks
10
22
  });
11
- const _plugin = require("@modern-js/plugin");
23
+ module.exports = __toCommonJS(misc_exports);
24
+ var import_plugin = require("@modern-js/plugin");
12
25
  const miscHooks = {
13
- addRuntimeExports: (0, _plugin.createAsyncWaterfall)(),
14
- modifyLibuild: (0, _plugin.createAsyncPipeline)()
26
+ addRuntimeExports: (0, import_plugin.createAsyncWaterfall)(),
27
+ /**
28
+ * @deprecated
29
+ * use buildConfig.hooks and buildConfig.esbuildOptions instead.
30
+ */
31
+ modifyLibuild: (0, import_plugin.createAsyncPipeline)()
15
32
  };
16
-
17
- //# sourceMappingURL=misc.js.map
33
+ // Annotate the CommonJS export names for ESM import in node:
34
+ 0 && (module.exports = {
35
+ miscHooks
36
+ });
package/dist/index.d.ts CHANGED
@@ -3,4 +3,5 @@ export { defineConfig, defineLegacyConfig } from './config/defineConfig';
3
3
  export { legacyPresets } from './constants/legacy-preset';
4
4
  export * from './types';
5
5
  export { moduleTools };
6
- export default moduleTools;
6
+ export default moduleTools;
7
+ export * from './utils/assert';
package/dist/index.js CHANGED
@@ -1,36 +1,43 @@
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
- defineConfig: function() {
14
- return _defineConfig.defineConfig;
15
- },
16
- defineLegacyConfig: function() {
17
- return _defineConfig.defineLegacyConfig;
18
- },
19
- legacyPresets: function() {
20
- return _legacypreset.legacyPresets;
21
- },
22
- moduleTools: function() {
23
- return _cli.moduleTools;
24
- },
25
- default: function() {
26
- return _default;
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 });
27
15
  }
16
+ return to;
17
+ };
18
+ var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
19
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
20
+ var src_exports = {};
21
+ __export(src_exports, {
22
+ default: () => src_default,
23
+ defineConfig: () => import_defineConfig.defineConfig,
24
+ defineLegacyConfig: () => import_defineConfig.defineLegacyConfig,
25
+ legacyPresets: () => import_legacy_preset.legacyPresets,
26
+ moduleTools: () => import_cli.moduleTools
27
+ });
28
+ module.exports = __toCommonJS(src_exports);
29
+ var import_cli = require("./cli");
30
+ var import_defineConfig = require("./config/defineConfig");
31
+ var import_legacy_preset = require("./constants/legacy-preset");
32
+ __reExport(src_exports, require("./types"), module.exports);
33
+ __reExport(src_exports, require("./utils/assert"), module.exports);
34
+ var src_default = import_cli.moduleTools;
35
+ // Annotate the CommonJS export names for ESM import in node:
36
+ 0 && (module.exports = {
37
+ defineConfig,
38
+ defineLegacyConfig,
39
+ legacyPresets,
40
+ moduleTools,
41
+ ...require("./types"),
42
+ ...require("./utils/assert")
28
43
  });
29
- const _export_star = require("@swc/helpers/_/_export_star");
30
- const _cli = require("./cli");
31
- const _defineConfig = require("./config/defineConfig");
32
- const _legacypreset = require("./constants/legacy-preset");
33
- _export_star._(require("./types"), exports);
34
- const _default = _cli.moduleTools;
35
-
36
- //# sourceMappingURL=index.js.map
package/dist/locale/en.js CHANGED
@@ -1,16 +1,29 @@
1
1
  "use strict";
2
- Object.defineProperty(exports, "__esModule", {
3
- value: true
4
- });
5
- Object.defineProperty(exports, "EN_LOCALE", {
6
- enumerable: true,
7
- get: function() {
8
- return EN_LOCALE;
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 en_exports = {};
20
+ __export(en_exports, {
21
+ EN_LOCALE: () => EN_LOCALE
10
22
  });
11
- const _utils = require("@modern-js/utils");
23
+ module.exports = __toCommonJS(en_exports);
24
+ var import_utils = require("@modern-js/utils");
12
25
  const noDevTools = `There are no DevTools available, you can learn about them and choose to use them by following the link options.
13
- - ${_utils.chalk.underline(_utils.chalk.blue("[Storybook]"), "https://modernjs.dev/module-tools/guide/basic/using-storybook.html")}
26
+ - ${import_utils.chalk.underline(import_utils.chalk.blue("[Storybook]"), "https://modernjs.dev/module-tools/guide/basic/using-storybook.html")}
14
27
  `;
15
28
  const EN_LOCALE = {
16
29
  command: {
@@ -49,14 +62,14 @@ const EN_LOCALE = {
49
62
  },
50
63
  errors: {
51
64
  externalHelpers: `The 'externalHelpers' configuration is currently enabled, but the "@swc/helpers" dependency declaration was not found. This will cause issues with the build output.Use the following for installation:
52
- ${_utils.chalk.blue("Package Manager is npm:")}
53
- ${_utils.chalk.yellow("`npm i @swc/helpers`")} Or ${_utils.chalk.yellow("`npm i @swc/helpers -D`")}
65
+ ${import_utils.chalk.blue("Package Manager is npm:")}
66
+ ${import_utils.chalk.yellow("`npm i @swc/helpers`")} Or ${import_utils.chalk.yellow("`npm i @swc/helpers -D`")}
54
67
 
55
- ${_utils.chalk.blue("Package Manager is pnpm:")}
56
- ${_utils.chalk.yellow("`pnpm i @swc/helpers`")} Or ${_utils.chalk.yellow("`pnpm i @swc/helpers -D`")}
68
+ ${import_utils.chalk.blue("Package Manager is pnpm:")}
69
+ ${import_utils.chalk.yellow("`pnpm i @swc/helpers`")} Or ${import_utils.chalk.yellow("`pnpm i @swc/helpers -D`")}
57
70
 
58
- ${_utils.chalk.blue("Package Manager is yarn:")}
59
- ${_utils.chalk.yellow("`yarn add @swc/helpers`")} Or ${_utils.chalk.yellow("`yarn add @swc/helpers -D`")}
71
+ ${import_utils.chalk.blue("Package Manager is yarn:")}
72
+ ${import_utils.chalk.yellow("`yarn add @swc/helpers`")} Or ${import_utils.chalk.yellow("`yarn add @swc/helpers -D`")}
60
73
  `
61
74
  },
62
75
  warns: {
@@ -66,5 +79,7 @@ const EN_LOCALE = {
66
79
  clearRootPath: "It is detected that the outDir in the configuration is the same as the current project directory, and the current product directory will not be automatically deleted."
67
80
  }
68
81
  };
69
-
70
- //# sourceMappingURL=en.js.map
82
+ // Annotate the CommonJS export names for ESM import in node:
83
+ 0 && (module.exports = {
84
+ EN_LOCALE
85
+ });
@@ -1,4 +1,5 @@
1
- declare const i18n: import("@modern-js/plugin-i18n").I18n;
1
+ import { I18n } from '@modern-js/plugin-i18n';
2
+ declare const i18n: I18n;
2
3
  declare const localeKeys: {
3
4
  command: {
4
5
  shared: {
@@ -1,30 +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
- i18n: function() {
14
- return i18n;
15
- },
16
- localeKeys: function() {
17
- return localeKeys;
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 locale_exports = {};
20
+ __export(locale_exports, {
21
+ i18n: () => i18n,
22
+ localeKeys: () => localeKeys
19
23
  });
20
- const _utils = require("@modern-js/utils");
21
- const _zh = require("./zh");
22
- const _en = require("./en");
23
- const i18nPlugin = _utils.Import.lazy("@modern-js/plugin-i18n", require);
24
- const i18n = new i18nPlugin.I18n();
24
+ module.exports = __toCommonJS(locale_exports);
25
+ var import_plugin_i18n = require("@modern-js/plugin-i18n");
26
+ var import_zh = require("./zh");
27
+ var import_en = require("./en");
28
+ const i18n = new import_plugin_i18n.I18n();
25
29
  const localeKeys = i18n.init("en", {
26
- zh: _zh.ZH_LOCALE,
27
- en: _en.EN_LOCALE
30
+ zh: import_zh.ZH_LOCALE,
31
+ en: import_en.EN_LOCALE
32
+ });
33
+ // Annotate the CommonJS export names for ESM import in node:
34
+ 0 && (module.exports = {
35
+ i18n,
36
+ localeKeys
28
37
  });
29
-
30
- //# sourceMappingURL=index.js.map