@modern-js/module-tools 2.35.1 → 2.36.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 (225) hide show
  1. package/dist/build.js +43 -16
  2. package/dist/builder/build.d.ts +1 -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 +275 -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 +17 -0
  19. package/dist/builder/esbuild/resolve.js +125 -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 +217 -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 +124 -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.d.ts +1 -0
  59. package/dist/builder/index.js +59 -28
  60. package/dist/builder/platform.js +38 -23
  61. package/dist/cli.js +58 -29
  62. package/dist/command.js +62 -38
  63. package/dist/config/defineConfig.js +25 -17
  64. package/dist/config/legacySchema.js +35 -32
  65. package/dist/config/merge.d.ts +1 -0
  66. package/dist/config/merge.js +69 -36
  67. package/dist/config/normalize.d.ts +1 -0
  68. package/dist/config/normalize.js +63 -46
  69. package/dist/config/schema.d.ts +48 -0
  70. package/dist/config/schema.js +53 -34
  71. package/dist/config/transformLegacyConfig.js +67 -61
  72. package/dist/config/valid.d.ts +2 -2
  73. package/dist/config/valid.js +44 -21
  74. package/dist/constants/build.d.ts +5 -1
  75. package/dist/constants/build.js +88 -46
  76. package/dist/constants/color.js +27 -20
  77. package/dist/constants/dts.js +27 -20
  78. package/dist/constants/file.d.ts +2 -2
  79. package/dist/constants/file.js +48 -25
  80. package/dist/constants/legacy-preset.js +45 -32
  81. package/dist/constants/loader.d.ts +2 -0
  82. package/dist/constants/loader.js +53 -0
  83. package/dist/constants/log.d.ts +0 -8
  84. package/dist/constants/log.js +27 -41
  85. package/dist/constants/preset.js +55 -62
  86. package/dist/debug.d.ts +4 -0
  87. package/dist/debug.js +37 -0
  88. package/dist/dev.js +42 -25
  89. package/dist/error.js +49 -42
  90. package/dist/hooks/build.d.ts +1 -2
  91. package/dist/hooks/build.js +36 -28
  92. package/dist/hooks/dev.js +32 -17
  93. package/dist/hooks/index.d.ts +1 -1
  94. package/dist/hooks/index.js +31 -16
  95. package/dist/hooks/misc.d.ts +5 -2
  96. package/dist/hooks/misc.js +31 -12
  97. package/dist/index.d.ts +2 -1
  98. package/dist/index.js +39 -32
  99. package/dist/locale/en.js +32 -17
  100. package/dist/locale/index.d.ts +2 -1
  101. package/dist/locale/index.js +31 -24
  102. package/dist/locale/zh.js +32 -17
  103. package/dist/plugins.js +28 -13
  104. package/dist/types/color.js +15 -5
  105. package/dist/types/command.d.ts +3 -3
  106. package/dist/types/command.js +15 -5
  107. package/dist/types/config/copy.js +15 -5
  108. package/dist/types/config/dev.js +15 -5
  109. package/dist/types/config/index.d.ts +87 -52
  110. package/dist/types/config/index.js +24 -6
  111. package/dist/types/config/style.d.ts +58 -6
  112. package/dist/types/config/style.js +15 -5
  113. package/dist/types/context.js +15 -5
  114. package/dist/types/dts.d.ts +14 -3
  115. package/dist/types/dts.js +15 -5
  116. package/dist/types/esbuild.d.ts +107 -0
  117. package/dist/types/esbuild.js +32 -0
  118. package/dist/types/hooks.js +15 -5
  119. package/dist/types/index.d.ts +1 -0
  120. package/dist/types/index.js +32 -11
  121. package/dist/types/legacyConfig/index.js +15 -5
  122. package/dist/types/legacyConfig/output.d.ts +4 -4
  123. package/dist/types/legacyConfig/output.js +15 -5
  124. package/dist/types/legacyConfig/source.js +15 -5
  125. package/dist/types/legacyConfig/tools.js +15 -5
  126. package/dist/utils/assert.d.ts +5 -0
  127. package/dist/utils/assert.js +50 -0
  128. package/dist/utils/builder.d.ts +10 -14
  129. package/dist/utils/builder.js +59 -59
  130. package/dist/utils/common.d.ts +1 -1
  131. package/dist/utils/common.js +25 -17
  132. package/dist/utils/dts.d.ts +26 -9
  133. package/dist/utils/dts.js +98 -64
  134. package/dist/utils/hash.d.ts +2 -0
  135. package/dist/utils/hash.js +31 -0
  136. package/dist/utils/index.d.ts +11 -0
  137. package/dist/utils/index.js +42 -0
  138. package/dist/utils/input.js +47 -24
  139. package/dist/utils/log.d.ts +1 -2
  140. package/dist/utils/log.js +36 -20
  141. package/dist/utils/map.d.ts +13 -0
  142. package/dist/utils/map.js +58 -0
  143. package/dist/utils/onExit.js +35 -11
  144. package/dist/utils/print.d.ts +2 -2
  145. package/dist/utils/print.js +52 -49
  146. package/dist/utils/style.d.ts +5 -23
  147. package/dist/utils/style.js +57 -37
  148. package/dist/utils/tspath.js +114 -0
  149. package/package.json +64 -50
  150. package/vitest.config.ts +20 -0
  151. package/dist/build.js.map +0 -1
  152. package/dist/builder/build.js.map +0 -1
  153. package/dist/builder/clear.js.map +0 -1
  154. package/dist/builder/copy.js.map +0 -1
  155. package/dist/builder/dts/index.js.map +0 -1
  156. package/dist/builder/dts/rollup.js.map +0 -1
  157. package/dist/builder/dts/tsc.js.map +0 -1
  158. package/dist/builder/index.js.map +0 -1
  159. package/dist/builder/platform.js.map +0 -1
  160. package/dist/cli.js.map +0 -1
  161. package/dist/command.js.map +0 -1
  162. package/dist/config/defineConfig.js.map +0 -1
  163. package/dist/config/legacySchema.js.map +0 -1
  164. package/dist/config/merge.js.map +0 -1
  165. package/dist/config/normalize.js.map +0 -1
  166. package/dist/config/schema.js.map +0 -1
  167. package/dist/config/transformLegacyConfig.js.map +0 -1
  168. package/dist/config/valid.js.map +0 -1
  169. package/dist/constants/build.js.map +0 -1
  170. package/dist/constants/color.js.map +0 -1
  171. package/dist/constants/dts.js.map +0 -1
  172. package/dist/constants/file.js.map +0 -1
  173. package/dist/constants/legacy-preset.js.map +0 -1
  174. package/dist/constants/log.js.map +0 -1
  175. package/dist/constants/preset.js.map +0 -1
  176. package/dist/dev.js.map +0 -1
  177. package/dist/error.js.map +0 -1
  178. package/dist/hooks/build.js.map +0 -1
  179. package/dist/hooks/dev.js.map +0 -1
  180. package/dist/hooks/index.js.map +0 -1
  181. package/dist/hooks/misc.js.map +0 -1
  182. package/dist/index.js.map +0 -1
  183. package/dist/locale/en.js.map +0 -1
  184. package/dist/locale/index.js.map +0 -1
  185. package/dist/locale/zh.js.map +0 -1
  186. package/dist/plugins.js.map +0 -1
  187. package/dist/types/color.js.map +0 -1
  188. package/dist/types/command.js.map +0 -1
  189. package/dist/types/config/copy.js.map +0 -1
  190. package/dist/types/config/dev.js.map +0 -1
  191. package/dist/types/config/index.js.map +0 -1
  192. package/dist/types/config/style.js.map +0 -1
  193. package/dist/types/context.js.map +0 -1
  194. package/dist/types/dts.js.map +0 -1
  195. package/dist/types/hooks.js.map +0 -1
  196. package/dist/types/index.js.map +0 -1
  197. package/dist/types/legacyConfig/index.js.map +0 -1
  198. package/dist/types/legacyConfig/output.js.map +0 -1
  199. package/dist/types/legacyConfig/source.js.map +0 -1
  200. package/dist/types/legacyConfig/tools.js.map +0 -1
  201. package/dist/types/utils.d.ts +0 -5
  202. package/dist/types/utils.js +0 -4
  203. package/dist/utils/builder.js.map +0 -1
  204. package/dist/utils/common.js.map +0 -1
  205. package/dist/utils/context.d.ts +0 -7
  206. package/dist/utils/context.js +0 -23
  207. package/dist/utils/context.js.map +0 -1
  208. package/dist/utils/dts.js.map +0 -1
  209. package/dist/utils/input.js.map +0 -1
  210. package/dist/utils/language.d.ts +0 -1
  211. package/dist/utils/language.js +0 -22
  212. package/dist/utils/language.js.map +0 -1
  213. package/dist/utils/libuild-plugin.d.ts +0 -3
  214. package/dist/utils/libuild-plugin.js +0 -31
  215. package/dist/utils/libuild-plugin.js.map +0 -1
  216. package/dist/utils/log.js.map +0 -1
  217. package/dist/utils/onExit.js.map +0 -1
  218. package/dist/utils/path.d.ts +0 -1
  219. package/dist/utils/path.js +0 -19
  220. package/dist/utils/path.js.map +0 -1
  221. package/dist/utils/print.js.map +0 -1
  222. package/dist/utils/style.js.map +0 -1
  223. package/dist/utils/tspathsTransform.js +0 -91
  224. package/dist/utils/tspathsTransform.js.map +0 -1
  225. /package/dist/utils/{tspathsTransform.d.ts → tspath.d.ts} +0 -0
@@ -13,6 +13,15 @@ export declare const buildConfig: {
13
13
  alias: {
14
14
  typeof: string[];
15
15
  };
16
+ hooks: {
17
+ type: string;
18
+ };
19
+ resolve: {
20
+ type: string;
21
+ };
22
+ banner: {
23
+ type: string;
24
+ };
16
25
  asset: {
17
26
  type: string;
18
27
  };
@@ -185,6 +194,9 @@ export declare const buildConfig: {
185
194
  externalHelpers: {
186
195
  type: string;
187
196
  };
197
+ tsconfig: {
198
+ type: string;
199
+ };
188
200
  transformImport: {
189
201
  type: string;
190
202
  };
@@ -203,6 +215,15 @@ export declare const buildConfig: {
203
215
  alias: {
204
216
  typeof: string[];
205
217
  };
218
+ hooks: {
219
+ type: string;
220
+ };
221
+ resolve: {
222
+ type: string;
223
+ };
224
+ banner: {
225
+ type: string;
226
+ };
206
227
  asset: {
207
228
  type: string;
208
229
  };
@@ -375,6 +396,9 @@ export declare const buildConfig: {
375
396
  externalHelpers: {
376
397
  type: string;
377
398
  };
399
+ tsconfig: {
400
+ type: string;
401
+ };
378
402
  transformImport: {
379
403
  type: string;
380
404
  };
@@ -421,6 +445,15 @@ export declare const schema: ({
421
445
  alias: {
422
446
  typeof: string[];
423
447
  };
448
+ hooks: {
449
+ type: string;
450
+ };
451
+ resolve: {
452
+ type: string;
453
+ };
454
+ banner: {
455
+ type: string;
456
+ };
424
457
  asset: {
425
458
  type: string;
426
459
  };
@@ -593,6 +626,9 @@ export declare const schema: ({
593
626
  externalHelpers: {
594
627
  type: string;
595
628
  };
629
+ tsconfig: {
630
+ type: string;
631
+ };
596
632
  transformImport: {
597
633
  type: string;
598
634
  };
@@ -611,6 +647,15 @@ export declare const schema: ({
611
647
  alias: {
612
648
  typeof: string[];
613
649
  };
650
+ hooks: {
651
+ type: string;
652
+ };
653
+ resolve: {
654
+ type: string;
655
+ };
656
+ banner: {
657
+ type: string;
658
+ };
614
659
  asset: {
615
660
  type: string;
616
661
  };
@@ -783,6 +828,9 @@ export declare const schema: ({
783
828
  externalHelpers: {
784
829
  type: string;
785
830
  };
831
+ tsconfig: {
832
+ type: string;
833
+ };
786
834
  transformImport: {
787
835
  type: string;
788
836
  };
@@ -1,38 +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
- targets: function() {
14
- return targets;
15
- },
16
- presets: function() {
17
- return presets;
18
- },
19
- buildConfig: function() {
20
- return buildConfig;
21
- },
22
- buildPreset: function() {
23
- return buildPreset;
24
- },
25
- legacy: function() {
26
- return legacy;
27
- },
28
- schema: function() {
29
- return schema;
30
- },
31
- legacySchema: function() {
32
- return _legacySchema.legacySchema;
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 schema_exports = {};
20
+ __export(schema_exports, {
21
+ buildConfig: () => buildConfig,
22
+ buildPreset: () => buildPreset,
23
+ legacy: () => legacy,
24
+ legacySchema: () => import_legacySchema.legacySchema,
25
+ presets: () => presets,
26
+ schema: () => schema,
27
+ targets: () => targets
34
28
  });
35
- const _legacySchema = require("./legacySchema");
29
+ module.exports = __toCommonJS(schema_exports);
30
+ var import_legacySchema = require("./legacySchema");
36
31
  const targets = [
37
32
  "es5",
38
33
  "es6",
@@ -73,6 +68,18 @@ const buildConfigProperties = {
73
68
  "function"
74
69
  ]
75
70
  },
71
+ hooks: {
72
+ // TODO: improve it
73
+ type: "array"
74
+ },
75
+ resolve: {
76
+ // TODO: add properties
77
+ type: "object"
78
+ },
79
+ banner: {
80
+ // TODO: add properties
81
+ type: "object"
82
+ },
76
83
  asset: {
77
84
  type: "object"
78
85
  },
@@ -190,7 +197,8 @@ const buildConfigProperties = {
190
197
  jsx: {
191
198
  enum: [
192
199
  "automatic",
193
- "transform"
200
+ "transform",
201
+ "preserve"
194
202
  ]
195
203
  },
196
204
  minify: {
@@ -273,6 +281,9 @@ const buildConfigProperties = {
273
281
  externalHelpers: {
274
282
  type: "boolean"
275
283
  },
284
+ tsconfig: {
285
+ type: "string"
286
+ },
276
287
  transformImport: {
277
288
  type: "array"
278
289
  },
@@ -331,5 +342,13 @@ const schema = [
331
342
  buildPreset,
332
343
  legacy
333
344
  ];
334
-
335
- //# sourceMappingURL=schema.js.map
345
+ // Annotate the CommonJS export names for ESM import in node:
346
+ 0 && (module.exports = {
347
+ buildConfig,
348
+ buildPreset,
349
+ legacy,
350
+ legacySchema,
351
+ presets,
352
+ schema,
353
+ targets
354
+ });
@@ -1,50 +1,48 @@
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
- transformToolsToBuildConfig: function() {
14
- return transformToolsToBuildConfig;
15
- },
16
- transformSourceToBuildConfig: function() {
17
- return transformSourceToBuildConfig;
18
- },
19
- transformOutputToBuildConfig: function() {
20
- return transformOutputToBuildConfig;
21
- },
22
- commonTransformAndLog: function() {
23
- return commonTransformAndLog;
24
- },
25
- createConfigByBuildConfig: function() {
26
- return createConfigByBuildConfig;
27
- },
28
- createConfigByBuildPreset: function() {
29
- return createConfigByBuildPreset;
30
- },
31
- createConfigByPackageFields: function() {
32
- return createConfigByPackageFields;
33
- },
34
- createConfigByPackageMode: function() {
35
- return createConfigByPackageMode;
36
- },
37
- createConfigByDefault: function() {
38
- return createConfigByDefault;
39
- },
40
- createUserConfigFromLegacy: function() {
41
- return createUserConfigFromLegacy;
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 });
42
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 transformLegacyConfig_exports = {};
30
+ __export(transformLegacyConfig_exports, {
31
+ commonTransformAndLog: () => commonTransformAndLog,
32
+ createConfigByBuildConfig: () => createConfigByBuildConfig,
33
+ createConfigByBuildPreset: () => createConfigByBuildPreset,
34
+ createConfigByDefault: () => createConfigByDefault,
35
+ createConfigByPackageFields: () => createConfigByPackageFields,
36
+ createConfigByPackageMode: () => createConfigByPackageMode,
37
+ createUserConfigFromLegacy: () => createUserConfigFromLegacy,
38
+ transformOutputToBuildConfig: () => transformOutputToBuildConfig,
39
+ transformSourceToBuildConfig: () => transformSourceToBuildConfig,
40
+ transformToolsToBuildConfig: () => transformToolsToBuildConfig
43
41
  });
44
- const _interop_require_default = require("@swc/helpers/_/_interop_require_default");
45
- const _path = /* @__PURE__ */ _interop_require_default._(require("path"));
46
- const _utils = require("@modern-js/utils");
47
- const _legacypreset = require("../constants/legacy-preset");
42
+ module.exports = __toCommonJS(transformLegacyConfig_exports);
43
+ var import_path = __toESM(require("path"));
44
+ var import_utils = require("@modern-js/utils");
45
+ var import_legacy_preset = require("../constants/legacy-preset");
48
46
  const transformToolsToBuildConfig = (buildConfig, legacyUserConfig) => {
49
47
  if (!legacyUserConfig.tools) {
50
48
  return;
@@ -109,10 +107,10 @@ const commonTransformAndLog = async (legacyUserConfig) => {
109
107
  if (legacyUserConfig.tools) {
110
108
  const legacyTools = legacyUserConfig.tools;
111
109
  if (legacyTools.babel) {
112
- _utils.logger.warn("`tools.babel` is not support in legacy mode. Please check migrate documentation.");
110
+ import_utils.logger.warn("`tools.babel` is not support in legacy mode. Please check migrate documentation.");
113
111
  }
114
112
  if (legacyTools.lodash) {
115
- _utils.logger.warn("`tools.lodash` is not support in legacy mode. Please check migrate documentation.");
113
+ import_utils.logger.warn("`tools.lodash` is not support in legacy mode. Please check migrate documentation.");
116
114
  }
117
115
  if (legacyTools.jest) {
118
116
  finalConfig.testing = {
@@ -121,10 +119,10 @@ const commonTransformAndLog = async (legacyUserConfig) => {
121
119
  }
122
120
  }
123
121
  if ((_legacyUserConfig_output = legacyUserConfig.output) === null || _legacyUserConfig_output === void 0 ? void 0 : _legacyUserConfig_output.importStyle) {
124
- _utils.logger.warn("`output.importStyle` is not support in legacy mode. Please check migrate documentation. By default, the style will be compiled");
122
+ import_utils.logger.warn("`output.importStyle` is not support in legacy mode. Please check migrate documentation. By default, the style will be compiled");
125
123
  }
126
124
  if ((_legacyUserConfig_output1 = legacyUserConfig.output) === null || _legacyUserConfig_output1 === void 0 ? void 0 : _legacyUserConfig_output1.jsPath) {
127
- _utils.logger.warn("`output.jsPath` is not support in legacy mode.");
125
+ import_utils.logger.warn("`output.jsPath` is not support in legacy mode.");
128
126
  }
129
127
  return finalConfig;
130
128
  };
@@ -138,7 +136,7 @@ const createConfigByBuildConfig = async (legacyUserConfig) => {
138
136
  var _legacyUserConfig_output_path;
139
137
  const legacyPath = (_legacyUserConfig_output_path = (_legacyUserConfig_output2 = legacyUserConfig.output) === null || _legacyUserConfig_output2 === void 0 ? void 0 : _legacyUserConfig_output2.path) !== null && _legacyUserConfig_output_path !== void 0 ? _legacyUserConfig_output_path : "dist";
140
138
  var _config_outputPath;
141
- newConfig.outDir = _path.default.join(legacyPath, (_config_outputPath = config.outputPath) !== null && _config_outputPath !== void 0 ? _config_outputPath : "./");
139
+ newConfig.outDir = import_path.default.join(legacyPath, (_config_outputPath = config.outputPath) !== null && _config_outputPath !== void 0 ? _config_outputPath : "./");
142
140
  newConfig.asset = {
143
141
  path: (_legacyUserConfig_output1 = legacyUserConfig.output) === null || _legacyUserConfig_output1 === void 0 ? void 0 : _legacyUserConfig_output1.assetsPath
144
142
  };
@@ -159,10 +157,7 @@ const createConfigByBuildConfig = async (legacyUserConfig) => {
159
157
  };
160
158
  }
161
159
  if (config.tsconfig) {
162
- newConfig.dts = {
163
- ...typeof newConfig.dts === "object" ? newConfig.dts : {},
164
- tsconfigPath: config.tsconfig
165
- };
160
+ newConfig.tsconfig = config.tsconfig;
166
161
  }
167
162
  if (!config.enableDts) {
168
163
  newConfig.dts = false;
@@ -189,7 +184,7 @@ const createConfigByBuildConfig = async (legacyUserConfig) => {
189
184
  var _bundlelessOptions_sourceDir;
190
185
  newConfig.sourceDir = (_bundlelessOptions_sourceDir = bundlelessOptions.sourceDir) !== null && _bundlelessOptions_sourceDir !== void 0 ? _bundlelessOptions_sourceDir : "./src";
191
186
  if (bundlelessOptions.style) {
192
- _utils.logger.warn("bundlelessOptions.style is not support in legacy mode. Please check migrate documentation. By default, the style will be compiled.");
187
+ import_utils.logger.warn("bundlelessOptions.style is not support in legacy mode. Please check migrate documentation. By default, the style will be compiled.");
193
188
  }
194
189
  if ((_bundlelessOptions_static = bundlelessOptions.static) === null || _bundlelessOptions_static === void 0 ? void 0 : _bundlelessOptions_static.path) {
195
190
  var _bundlelessOptions_static1;
@@ -199,10 +194,10 @@ const createConfigByBuildConfig = async (legacyUserConfig) => {
199
194
  }
200
195
  }
201
196
  if ((_legacyUserConfig_output4 = legacyUserConfig.output) === null || _legacyUserConfig_output4 === void 0 ? void 0 : _legacyUserConfig_output4.importStyle) {
202
- _utils.logger.warn("`output.importStyle` is not support in legacy mode. Please check migrate documentation. By default, the style will be compiled");
197
+ import_utils.logger.warn("`output.importStyle` is not support in legacy mode. Please check migrate documentation. By default, the style will be compiled");
203
198
  }
204
199
  if ((_legacyUserConfig_output5 = legacyUserConfig.output) === null || _legacyUserConfig_output5 === void 0 ? void 0 : _legacyUserConfig_output5.jsPath) {
205
- _utils.logger.warn("`output.jsPath` is not support in legacy mode.");
200
+ import_utils.logger.warn("`output.jsPath` is not support in legacy mode.");
206
201
  }
207
202
  if (legacyUserConfig.tools) {
208
203
  transformToolsToBuildConfig(newConfig, legacyUserConfig);
@@ -228,10 +223,10 @@ const createConfigByBuildConfig = async (legacyUserConfig) => {
228
223
  if (legacyUserConfig.tools) {
229
224
  const legacyTools = legacyUserConfig.tools;
230
225
  if (legacyTools.babel) {
231
- _utils.logger.warn("`tools.babel` is not support in legacy mode. Please check migrate documentation.");
226
+ import_utils.logger.warn("`tools.babel` is not support in legacy mode. Please check migrate documentation.");
232
227
  }
233
228
  if (legacyTools.lodash) {
234
- _utils.logger.warn("`tools.lodash` is not support in legacy mode. Please check migrate documentation.");
229
+ import_utils.logger.warn("`tools.lodash` is not support in legacy mode. Please check migrate documentation.");
235
230
  }
236
231
  if (legacyTools.jest) {
237
232
  finalConfig.testing = {
@@ -334,7 +329,7 @@ const createConfigByPackageMode = async (legacyUserConfig) => {
334
329
  var _legacyUserConfig_output;
335
330
  const finalConfig = await commonTransformAndLog(legacyUserConfig);
336
331
  const packageMode = legacyUserConfig.output.packageMode;
337
- const buildConfigs = _legacypreset.legacyPresets[packageMode];
332
+ const buildConfigs = import_legacy_preset.legacyPresets[packageMode];
338
333
  for (const buildConfig of buildConfigs) {
339
334
  transformSourceToBuildConfig(buildConfig, legacyUserConfig);
340
335
  transformToolsToBuildConfig(buildConfig, legacyUserConfig);
@@ -355,7 +350,7 @@ const createConfigByPackageMode = async (legacyUserConfig) => {
355
350
  const createConfigByDefault = async (legacyUserConfig) => {
356
351
  var _legacyUserConfig_output;
357
352
  const finalConfig = await commonTransformAndLog(legacyUserConfig);
358
- const buildConfigs = _legacypreset.legacyPresets["universal-js"];
353
+ const buildConfigs = import_legacy_preset.legacyPresets["universal-js"];
359
354
  for (const buildConfig of buildConfigs) {
360
355
  transformSourceToBuildConfig(buildConfig, legacyUserConfig);
361
356
  transformToolsToBuildConfig(buildConfig, legacyUserConfig);
@@ -390,5 +385,16 @@ const createUserConfigFromLegacy = async (config) => {
390
385
  }
391
386
  return createConfigByDefault(config);
392
387
  };
393
-
394
- //# sourceMappingURL=transformLegacyConfig.js.map
388
+ // Annotate the CommonJS export names for ESM import in node:
389
+ 0 && (module.exports = {
390
+ commonTransformAndLog,
391
+ createConfigByBuildConfig,
392
+ createConfigByBuildPreset,
393
+ createConfigByDefault,
394
+ createConfigByPackageFields,
395
+ createConfigByPackageMode,
396
+ createUserConfigFromLegacy,
397
+ transformOutputToBuildConfig,
398
+ transformSourceToBuildConfig,
399
+ transformToolsToBuildConfig
400
+ });
@@ -1,3 +1,3 @@
1
1
  import type { PartialBuildConfig, PartialBaseBuildConfig } from '../types';
2
- export declare const validPartialBuildConfig: (config: PartialBuildConfig) => void;
3
- export declare const validBuildTypeAndFormat: (config: PartialBaseBuildConfig) => void;
2
+ export declare const validPartialBuildConfig: (config: PartialBuildConfig, appDirectory: string) => void;
3
+ export declare const validBuildConfig: (config: PartialBaseBuildConfig, appDirectory: string) => void;
@@ -1,32 +1,49 @@
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
- validPartialBuildConfig: function() {
14
- return validPartialBuildConfig;
15
- },
16
- validBuildTypeAndFormat: function() {
17
- return validBuildTypeAndFormat;
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 valid_exports = {};
30
+ __export(valid_exports, {
31
+ validBuildConfig: () => validBuildConfig,
32
+ validPartialBuildConfig: () => validPartialBuildConfig
19
33
  });
20
- const validPartialBuildConfig = (config) => {
34
+ module.exports = __toCommonJS(valid_exports);
35
+ var import_path = __toESM(require("path"));
36
+ var import_utils = require("@modern-js/utils");
37
+ const validPartialBuildConfig = (config, appDirectory) => {
21
38
  if (Array.isArray(config)) {
22
39
  for (const c of config) {
23
- validBuildTypeAndFormat(c);
40
+ validBuildConfig(c, appDirectory);
24
41
  }
25
42
  } else {
26
- validBuildTypeAndFormat(config);
43
+ validBuildConfig(config, appDirectory);
27
44
  }
28
45
  };
29
- const validBuildTypeAndFormat = (config) => {
46
+ const validBuildConfig = (config, appDirectory) => {
30
47
  var _config_format;
31
48
  if (config.buildType === "bundleless" && [
32
49
  "iife",
@@ -34,6 +51,12 @@ const validBuildTypeAndFormat = (config) => {
34
51
  ].includes((_config_format = config.format) !== null && _config_format !== void 0 ? _config_format : "")) {
35
52
  throw new Error(`when buildType is bundleless, the format must be equal to one of the allowed values: (cjs, esm)`);
36
53
  }
54
+ if (config.tsconfig && !import_utils.fs.existsSync(import_path.default.resolve(appDirectory, config.tsconfig))) {
55
+ throw new Error(`${config.tsconfig} does not exist in your project`);
56
+ }
37
57
  };
38
-
39
- //# sourceMappingURL=valid.js.map
58
+ // Annotate the CommonJS export names for ESM import in node:
59
+ 0 && (module.exports = {
60
+ validBuildConfig,
61
+ validPartialBuildConfig
62
+ });
@@ -1,2 +1,6 @@
1
1
  import type { BaseBuildConfig } from '../types';
2
- export declare const getDefaultBuildConfig: () => Readonly<BaseBuildConfig>;
2
+ export declare const getDefaultBuildConfig: () => Readonly<BaseBuildConfig>;
3
+ /**
4
+ * supports require js plugin in less file
5
+ */
6
+ export declare const cssExtensions: string[];