@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.
- package/dist/build.js +43 -16
- package/dist/builder/build.d.ts +1 -10
- package/dist/builder/build.js +96 -208
- package/dist/builder/clear.d.ts +1 -4
- package/dist/builder/clear.js +32 -28
- package/dist/builder/copy.js +75 -60
- package/dist/builder/dts/index.js +27 -19
- package/dist/builder/dts/rollup.d.ts +6 -14
- package/dist/builder/dts/rollup.js +60 -37
- package/dist/builder/dts/tsc.d.ts +3 -2
- package/dist/builder/dts/tsc.js +50 -37
- package/dist/builder/esbuild/adapter.d.ts +3 -0
- package/dist/builder/esbuild/adapter.js +275 -0
- package/dist/builder/esbuild/hook.d.ts +4 -0
- package/dist/builder/esbuild/hook.js +103 -0
- package/dist/builder/esbuild/index.d.ts +35 -0
- package/dist/builder/esbuild/index.js +268 -0
- package/dist/builder/esbuild/resolve.d.ts +17 -0
- package/dist/builder/esbuild/resolve.js +125 -0
- package/dist/builder/esbuild/sourcemap.d.ts +16 -0
- package/dist/builder/esbuild/sourcemap.js +86 -0
- package/dist/builder/esbuild/transform.d.ts +7 -0
- package/dist/builder/esbuild/transform.js +45 -0
- package/dist/builder/esbuild/watch.d.ts +2 -0
- package/dist/builder/esbuild/watch.js +115 -0
- package/dist/builder/esbuild/write-file.d.ts +2 -0
- package/dist/builder/esbuild/write-file.js +89 -0
- package/dist/builder/feature/asset.d.ts +19 -0
- package/dist/builder/feature/asset.js +149 -0
- package/dist/builder/feature/format-cjs.d.ts +5 -0
- package/dist/builder/feature/format-cjs.js +53 -0
- package/dist/builder/feature/index.d.ts +2 -0
- package/dist/builder/feature/index.js +74 -0
- package/dist/builder/feature/json.d.ts +5 -0
- package/dist/builder/feature/json.js +47 -0
- package/dist/builder/feature/redirect.d.ts +5 -0
- package/dist/builder/feature/redirect.js +217 -0
- package/dist/builder/feature/style/index.d.ts +5 -0
- package/dist/builder/feature/style/index.js +94 -0
- package/dist/builder/feature/style/lessAliasPlugin.d.ts +12 -0
- package/dist/builder/feature/style/lessAliasPlugin.js +70 -0
- package/dist/builder/feature/style/lessRender.d.ts +2 -0
- package/dist/builder/feature/style/lessRender.js +64 -0
- package/dist/builder/feature/style/postcssTransformer.d.ts +6 -0
- package/dist/builder/feature/style/postcssTransformer.js +95 -0
- package/dist/builder/feature/style/postcssUrlPlugin.d.ts +6 -0
- package/dist/builder/feature/style/postcssUrlPlugin.js +58 -0
- package/dist/builder/feature/style/sassRender.d.ts +2 -0
- package/dist/builder/feature/style/sassRender.js +85 -0
- package/dist/builder/feature/style/transformStyle.d.ts +13 -0
- package/dist/builder/feature/style/transformStyle.js +101 -0
- package/dist/builder/feature/style/utils.d.ts +18 -0
- package/dist/builder/feature/style/utils.js +124 -0
- package/dist/builder/feature/swc.d.ts +9 -0
- package/dist/builder/feature/swc.js +170 -0
- package/dist/builder/feature/terser.d.ts +5 -0
- package/dist/builder/feature/terser.js +83 -0
- package/dist/builder/index.d.ts +1 -0
- package/dist/builder/index.js +59 -28
- package/dist/builder/platform.js +38 -23
- package/dist/cli.js +58 -29
- package/dist/command.js +62 -38
- package/dist/config/defineConfig.js +25 -17
- package/dist/config/legacySchema.js +35 -32
- package/dist/config/merge.d.ts +1 -0
- package/dist/config/merge.js +69 -36
- package/dist/config/normalize.d.ts +1 -0
- package/dist/config/normalize.js +63 -46
- package/dist/config/schema.d.ts +48 -0
- package/dist/config/schema.js +53 -34
- package/dist/config/transformLegacyConfig.js +67 -61
- package/dist/config/valid.d.ts +2 -2
- package/dist/config/valid.js +44 -21
- package/dist/constants/build.d.ts +5 -1
- package/dist/constants/build.js +88 -46
- package/dist/constants/color.js +27 -20
- package/dist/constants/dts.js +27 -20
- package/dist/constants/file.d.ts +2 -2
- package/dist/constants/file.js +48 -25
- package/dist/constants/legacy-preset.js +45 -32
- package/dist/constants/loader.d.ts +2 -0
- package/dist/constants/loader.js +53 -0
- package/dist/constants/log.d.ts +0 -8
- package/dist/constants/log.js +27 -41
- package/dist/constants/preset.js +55 -62
- package/dist/debug.d.ts +4 -0
- package/dist/debug.js +37 -0
- package/dist/dev.js +42 -25
- package/dist/error.js +49 -42
- package/dist/hooks/build.d.ts +1 -2
- package/dist/hooks/build.js +36 -28
- package/dist/hooks/dev.js +32 -17
- package/dist/hooks/index.d.ts +1 -1
- package/dist/hooks/index.js +31 -16
- package/dist/hooks/misc.d.ts +5 -2
- package/dist/hooks/misc.js +31 -12
- package/dist/index.d.ts +2 -1
- package/dist/index.js +39 -32
- package/dist/locale/en.js +32 -17
- package/dist/locale/index.d.ts +2 -1
- package/dist/locale/index.js +31 -24
- package/dist/locale/zh.js +32 -17
- package/dist/plugins.js +28 -13
- package/dist/types/color.js +15 -5
- package/dist/types/command.d.ts +3 -3
- package/dist/types/command.js +15 -5
- package/dist/types/config/copy.js +15 -5
- package/dist/types/config/dev.js +15 -5
- package/dist/types/config/index.d.ts +87 -52
- package/dist/types/config/index.js +24 -6
- package/dist/types/config/style.d.ts +58 -6
- package/dist/types/config/style.js +15 -5
- package/dist/types/context.js +15 -5
- package/dist/types/dts.d.ts +14 -3
- package/dist/types/dts.js +15 -5
- package/dist/types/esbuild.d.ts +107 -0
- package/dist/types/esbuild.js +32 -0
- package/dist/types/hooks.js +15 -5
- package/dist/types/index.d.ts +1 -0
- package/dist/types/index.js +32 -11
- package/dist/types/legacyConfig/index.js +15 -5
- package/dist/types/legacyConfig/output.d.ts +4 -4
- package/dist/types/legacyConfig/output.js +15 -5
- package/dist/types/legacyConfig/source.js +15 -5
- package/dist/types/legacyConfig/tools.js +15 -5
- package/dist/utils/assert.d.ts +5 -0
- package/dist/utils/assert.js +50 -0
- package/dist/utils/builder.d.ts +10 -14
- package/dist/utils/builder.js +59 -59
- package/dist/utils/common.d.ts +1 -1
- package/dist/utils/common.js +25 -17
- package/dist/utils/dts.d.ts +26 -9
- package/dist/utils/dts.js +98 -64
- package/dist/utils/hash.d.ts +2 -0
- package/dist/utils/hash.js +31 -0
- package/dist/utils/index.d.ts +11 -0
- package/dist/utils/index.js +42 -0
- package/dist/utils/input.js +47 -24
- package/dist/utils/log.d.ts +1 -2
- package/dist/utils/log.js +36 -20
- package/dist/utils/map.d.ts +13 -0
- package/dist/utils/map.js +58 -0
- package/dist/utils/onExit.js +35 -11
- package/dist/utils/print.d.ts +2 -2
- package/dist/utils/print.js +52 -49
- package/dist/utils/style.d.ts +5 -23
- package/dist/utils/style.js +57 -37
- package/dist/utils/tspath.js +114 -0
- package/package.json +64 -50
- package/vitest.config.ts +20 -0
- package/dist/build.js.map +0 -1
- package/dist/builder/build.js.map +0 -1
- package/dist/builder/clear.js.map +0 -1
- package/dist/builder/copy.js.map +0 -1
- package/dist/builder/dts/index.js.map +0 -1
- package/dist/builder/dts/rollup.js.map +0 -1
- package/dist/builder/dts/tsc.js.map +0 -1
- package/dist/builder/index.js.map +0 -1
- package/dist/builder/platform.js.map +0 -1
- package/dist/cli.js.map +0 -1
- package/dist/command.js.map +0 -1
- package/dist/config/defineConfig.js.map +0 -1
- package/dist/config/legacySchema.js.map +0 -1
- package/dist/config/merge.js.map +0 -1
- package/dist/config/normalize.js.map +0 -1
- package/dist/config/schema.js.map +0 -1
- package/dist/config/transformLegacyConfig.js.map +0 -1
- package/dist/config/valid.js.map +0 -1
- package/dist/constants/build.js.map +0 -1
- package/dist/constants/color.js.map +0 -1
- package/dist/constants/dts.js.map +0 -1
- package/dist/constants/file.js.map +0 -1
- package/dist/constants/legacy-preset.js.map +0 -1
- package/dist/constants/log.js.map +0 -1
- package/dist/constants/preset.js.map +0 -1
- package/dist/dev.js.map +0 -1
- package/dist/error.js.map +0 -1
- package/dist/hooks/build.js.map +0 -1
- package/dist/hooks/dev.js.map +0 -1
- package/dist/hooks/index.js.map +0 -1
- package/dist/hooks/misc.js.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/locale/en.js.map +0 -1
- package/dist/locale/index.js.map +0 -1
- package/dist/locale/zh.js.map +0 -1
- package/dist/plugins.js.map +0 -1
- package/dist/types/color.js.map +0 -1
- package/dist/types/command.js.map +0 -1
- package/dist/types/config/copy.js.map +0 -1
- package/dist/types/config/dev.js.map +0 -1
- package/dist/types/config/index.js.map +0 -1
- package/dist/types/config/style.js.map +0 -1
- package/dist/types/context.js.map +0 -1
- package/dist/types/dts.js.map +0 -1
- package/dist/types/hooks.js.map +0 -1
- package/dist/types/index.js.map +0 -1
- package/dist/types/legacyConfig/index.js.map +0 -1
- package/dist/types/legacyConfig/output.js.map +0 -1
- package/dist/types/legacyConfig/source.js.map +0 -1
- package/dist/types/legacyConfig/tools.js.map +0 -1
- package/dist/types/utils.d.ts +0 -5
- package/dist/types/utils.js +0 -4
- package/dist/utils/builder.js.map +0 -1
- package/dist/utils/common.js.map +0 -1
- package/dist/utils/context.d.ts +0 -7
- package/dist/utils/context.js +0 -23
- package/dist/utils/context.js.map +0 -1
- package/dist/utils/dts.js.map +0 -1
- package/dist/utils/input.js.map +0 -1
- package/dist/utils/language.d.ts +0 -1
- package/dist/utils/language.js +0 -22
- package/dist/utils/language.js.map +0 -1
- package/dist/utils/libuild-plugin.d.ts +0 -3
- package/dist/utils/libuild-plugin.js +0 -31
- package/dist/utils/libuild-plugin.js.map +0 -1
- package/dist/utils/log.js.map +0 -1
- package/dist/utils/onExit.js.map +0 -1
- package/dist/utils/path.d.ts +0 -1
- package/dist/utils/path.js +0 -19
- package/dist/utils/path.js.map +0 -1
- package/dist/utils/print.js.map +0 -1
- package/dist/utils/style.js.map +0 -1
- package/dist/utils/tspathsTransform.js +0 -91
- package/dist/utils/tspathsTransform.js.map +0 -1
- /package/dist/utils/{tspathsTransform.d.ts → tspath.d.ts} +0 -0
package/dist/config/schema.d.ts
CHANGED
|
@@ -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
|
};
|
package/dist/config/schema.js
CHANGED
|
@@ -1,38 +1,33 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
Object.defineProperty
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
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
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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.
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
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
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
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
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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 =
|
|
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.
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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 =
|
|
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 =
|
|
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
|
-
|
|
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
|
+
});
|
package/dist/config/valid.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import type { PartialBuildConfig, PartialBaseBuildConfig } from '../types';
|
|
2
|
-
export declare const validPartialBuildConfig: (config: PartialBuildConfig) => void;
|
|
3
|
-
export declare const
|
|
2
|
+
export declare const validPartialBuildConfig: (config: PartialBuildConfig, appDirectory: string) => void;
|
|
3
|
+
export declare const validBuildConfig: (config: PartialBaseBuildConfig, appDirectory: string) => void;
|
package/dist/config/valid.js
CHANGED
|
@@ -1,32 +1,49 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
Object.
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
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
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
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
|
-
|
|
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
|
-
|
|
40
|
+
validBuildConfig(c, appDirectory);
|
|
24
41
|
}
|
|
25
42
|
} else {
|
|
26
|
-
|
|
43
|
+
validBuildConfig(config, appDirectory);
|
|
27
44
|
}
|
|
28
45
|
};
|
|
29
|
-
const
|
|
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
|
-
|
|
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[];
|