@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.
- package/dist/build.js +43 -16
- package/dist/builder/build.d.ts +0 -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 +286 -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 +18 -0
- package/dist/builder/esbuild/resolve.js +140 -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 +223 -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 +130 -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.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.js +69 -36
- 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.d.ts +4 -4
- 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 +61 -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/constants/file.js
CHANGED
|
@@ -1,30 +1,28 @@
|
|
|
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 assetExts;
|
|
15
|
-
},
|
|
16
|
-
styleExts: function() {
|
|
17
|
-
return styleExts;
|
|
18
|
-
},
|
|
19
|
-
dtsAliasExts: function() {
|
|
20
|
-
return dtsAliasExts;
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
21
15
|
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var file_exports = {};
|
|
20
|
+
__export(file_exports, {
|
|
21
|
+
assetExt: () => assetExt,
|
|
22
|
+
dtsAliasExts: () => dtsAliasExts,
|
|
23
|
+
styleExts: () => styleExts
|
|
22
24
|
});
|
|
23
|
-
|
|
24
|
-
".png",
|
|
25
|
-
".jpg",
|
|
26
|
-
".svg"
|
|
27
|
-
];
|
|
25
|
+
module.exports = __toCommonJS(file_exports);
|
|
28
26
|
const styleExts = [
|
|
29
27
|
".css",
|
|
30
28
|
".less",
|
|
@@ -34,5 +32,30 @@ const styleExts = [
|
|
|
34
32
|
const dtsAliasExts = [
|
|
35
33
|
".d.ts"
|
|
36
34
|
];
|
|
37
|
-
|
|
38
|
-
|
|
35
|
+
const assetExt = [
|
|
36
|
+
".svg",
|
|
37
|
+
".png",
|
|
38
|
+
".jpg",
|
|
39
|
+
".jpeg",
|
|
40
|
+
".gif",
|
|
41
|
+
".webp",
|
|
42
|
+
".ttf",
|
|
43
|
+
".otf",
|
|
44
|
+
".woff",
|
|
45
|
+
".woff2",
|
|
46
|
+
".eot",
|
|
47
|
+
".mp3",
|
|
48
|
+
".mp4",
|
|
49
|
+
".webm",
|
|
50
|
+
".ogg",
|
|
51
|
+
".wav",
|
|
52
|
+
".flac",
|
|
53
|
+
".aac",
|
|
54
|
+
".mov"
|
|
55
|
+
];
|
|
56
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
57
|
+
0 && (module.exports = {
|
|
58
|
+
assetExt,
|
|
59
|
+
dtsAliasExts,
|
|
60
|
+
styleExts
|
|
61
|
+
});
|
|
@@ -1,40 +1,46 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
Object.
|
|
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 universalJsPreset;
|
|
15
|
-
},
|
|
16
|
-
universalJsLitePreset: function() {
|
|
17
|
-
return universalJsLitePreset;
|
|
18
|
-
},
|
|
19
|
-
browserJsPreset: function() {
|
|
20
|
-
return browserJsPreset;
|
|
21
|
-
},
|
|
22
|
-
browserJsLitePreset: function() {
|
|
23
|
-
return browserJsLitePreset;
|
|
24
|
-
},
|
|
25
|
-
nodeJsPreset: function() {
|
|
26
|
-
return nodeJsPreset;
|
|
27
|
-
},
|
|
28
|
-
legacyPresets: function() {
|
|
29
|
-
return legacyPresets;
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
30
17
|
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
28
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
+
var legacy_preset_exports = {};
|
|
30
|
+
__export(legacy_preset_exports, {
|
|
31
|
+
browserJsLitePreset: () => browserJsLitePreset,
|
|
32
|
+
browserJsPreset: () => browserJsPreset,
|
|
33
|
+
legacyPresets: () => legacyPresets,
|
|
34
|
+
nodeJsPreset: () => nodeJsPreset,
|
|
35
|
+
universalJsLitePreset: () => universalJsLitePreset,
|
|
36
|
+
universalJsPreset: () => universalJsPreset
|
|
31
37
|
});
|
|
32
|
-
|
|
33
|
-
|
|
38
|
+
module.exports = __toCommonJS(legacy_preset_exports);
|
|
39
|
+
var import_path = __toESM(require("path"));
|
|
34
40
|
const legacyWithSourceCodeToCopyConfig = {
|
|
35
41
|
patterns: [
|
|
36
42
|
{
|
|
37
|
-
from:
|
|
43
|
+
from: import_path.default.join("src", "**/*.{less,sass,scss}"),
|
|
38
44
|
context: "src"
|
|
39
45
|
}
|
|
40
46
|
]
|
|
@@ -199,5 +205,12 @@ const legacyPresets = {
|
|
|
199
205
|
"node-js": nodeJsPreset,
|
|
200
206
|
NODE_JS: nodeJsPreset
|
|
201
207
|
};
|
|
202
|
-
|
|
203
|
-
|
|
208
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
209
|
+
0 && (module.exports = {
|
|
210
|
+
browserJsLitePreset,
|
|
211
|
+
browserJsPreset,
|
|
212
|
+
legacyPresets,
|
|
213
|
+
nodeJsPreset,
|
|
214
|
+
universalJsLitePreset,
|
|
215
|
+
universalJsPreset
|
|
216
|
+
});
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var loader_exports = {};
|
|
20
|
+
__export(loader_exports, {
|
|
21
|
+
loaderMap: () => loaderMap
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(loader_exports);
|
|
24
|
+
const loaderMap = {
|
|
25
|
+
".aac": "file",
|
|
26
|
+
".css": "file",
|
|
27
|
+
".eot": "file",
|
|
28
|
+
".flac": "file",
|
|
29
|
+
".gif": "file",
|
|
30
|
+
".jpeg": "file",
|
|
31
|
+
".jpg": "file",
|
|
32
|
+
".mp3": "file",
|
|
33
|
+
".mp4": "file",
|
|
34
|
+
".ogg": "file",
|
|
35
|
+
".otf": "file",
|
|
36
|
+
".png": "file",
|
|
37
|
+
".svg": "file",
|
|
38
|
+
".ttf": "file",
|
|
39
|
+
".wav": "file",
|
|
40
|
+
".webm": "file",
|
|
41
|
+
".webp": "file",
|
|
42
|
+
".woff": "file",
|
|
43
|
+
".woff2": "file",
|
|
44
|
+
".jsx": "jsx",
|
|
45
|
+
".tsx": "tsx",
|
|
46
|
+
".ts": "ts",
|
|
47
|
+
".js": "js",
|
|
48
|
+
".json": "json"
|
|
49
|
+
};
|
|
50
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
51
|
+
0 && (module.exports = {
|
|
52
|
+
loaderMap
|
|
53
|
+
});
|
package/dist/constants/log.d.ts
CHANGED
|
@@ -1,11 +1,3 @@
|
|
|
1
|
-
export declare enum SectionTitleStatus {
|
|
2
|
-
Success = 0,
|
|
3
|
-
Fail = 1,
|
|
4
|
-
Log = 2,
|
|
5
|
-
}
|
|
6
|
-
export declare const BundleDtsLogPrefix = "[Bundle:DTS]";
|
|
7
|
-
export declare const BundlelessDtsLogPrefix = "[Bundleless:DTS]";
|
|
8
|
-
export declare const CopyLogPrefix = "[Copy]";
|
|
9
1
|
export declare const buildSuccessText = "Build succeed";
|
|
10
2
|
export declare const reportFile1LineText = "Bundle Files";
|
|
11
3
|
export declare const reportFile2LineText = "Size";
|
package/dist/constants/log.js
CHANGED
|
@@ -1,48 +1,34 @@
|
|
|
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 SectionTitleStatus;
|
|
15
|
-
},
|
|
16
|
-
BundleDtsLogPrefix: function() {
|
|
17
|
-
return BundleDtsLogPrefix;
|
|
18
|
-
},
|
|
19
|
-
BundlelessDtsLogPrefix: function() {
|
|
20
|
-
return BundlelessDtsLogPrefix;
|
|
21
|
-
},
|
|
22
|
-
CopyLogPrefix: function() {
|
|
23
|
-
return CopyLogPrefix;
|
|
24
|
-
},
|
|
25
|
-
buildSuccessText: function() {
|
|
26
|
-
return buildSuccessText;
|
|
27
|
-
},
|
|
28
|
-
reportFile1LineText: function() {
|
|
29
|
-
return reportFile1LineText;
|
|
30
|
-
},
|
|
31
|
-
reportFile2LineText: function() {
|
|
32
|
-
return reportFile2LineText;
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
33
15
|
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var log_exports = {};
|
|
20
|
+
__export(log_exports, {
|
|
21
|
+
buildSuccessText: () => buildSuccessText,
|
|
22
|
+
reportFile1LineText: () => reportFile1LineText,
|
|
23
|
+
reportFile2LineText: () => reportFile2LineText
|
|
34
24
|
});
|
|
35
|
-
|
|
36
|
-
(function(SectionTitleStatus2) {
|
|
37
|
-
SectionTitleStatus2[SectionTitleStatus2["Success"] = 0] = "Success";
|
|
38
|
-
SectionTitleStatus2[SectionTitleStatus2["Fail"] = 1] = "Fail";
|
|
39
|
-
SectionTitleStatus2[SectionTitleStatus2["Log"] = 2] = "Log";
|
|
40
|
-
})(SectionTitleStatus || (SectionTitleStatus = {}));
|
|
41
|
-
const BundleDtsLogPrefix = "[Bundle:DTS]";
|
|
42
|
-
const BundlelessDtsLogPrefix = "[Bundleless:DTS]";
|
|
43
|
-
const CopyLogPrefix = "[Copy]";
|
|
25
|
+
module.exports = __toCommonJS(log_exports);
|
|
44
26
|
const buildSuccessText = "Build succeed";
|
|
45
27
|
const reportFile1LineText = "Bundle Files";
|
|
46
28
|
const reportFile2LineText = "Size";
|
|
47
|
-
|
|
48
|
-
|
|
29
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
30
|
+
0 && (module.exports = {
|
|
31
|
+
buildSuccessText,
|
|
32
|
+
reportFile1LineText,
|
|
33
|
+
reportFile2LineText
|
|
34
|
+
});
|
|
@@ -7,19 +7,19 @@ export declare const npmComponentWithUmdPresetConfig: PartialBaseBuildConfig[];
|
|
|
7
7
|
export declare const libraryPreset: {
|
|
8
8
|
'npm-library': PartialBaseBuildConfig[];
|
|
9
9
|
};
|
|
10
|
-
export declare const libraryPresetWithTarget: Record<"npm-library-
|
|
10
|
+
export declare const libraryPresetWithTarget: Record<"npm-library-es6" | "npm-library-esnext" | "npm-library-es5" | "npm-library-es2015" | "npm-library-es2016" | "npm-library-es2017" | "npm-library-es2018" | "npm-library-es2019" | "npm-library-es2020" | "npm-library-es2021" | "npm-library-es2022", PartialBaseBuildConfig[]>;
|
|
11
11
|
export declare const libraryUmdPreset: {
|
|
12
12
|
'npm-library-with-umd': PartialBaseBuildConfig[];
|
|
13
13
|
};
|
|
14
|
-
export declare const libraryUmdPresetWithTarget: Record<"npm-library-with-umd-
|
|
14
|
+
export declare const libraryUmdPresetWithTarget: Record<"npm-library-with-umd-es6" | "npm-library-with-umd-esnext" | "npm-library-with-umd-es5" | "npm-library-with-umd-es2015" | "npm-library-with-umd-es2016" | "npm-library-with-umd-es2017" | "npm-library-with-umd-es2018" | "npm-library-with-umd-es2019" | "npm-library-with-umd-es2020" | "npm-library-with-umd-es2021" | "npm-library-with-umd-es2022", PartialBaseBuildConfig[]>;
|
|
15
15
|
export declare const componentPreset: {
|
|
16
16
|
'npm-component': PartialBaseBuildConfig[];
|
|
17
17
|
};
|
|
18
|
-
export declare const componentPresetWithTarget: Record<"npm-component-
|
|
18
|
+
export declare const componentPresetWithTarget: Record<"npm-component-es6" | "npm-component-esnext" | "npm-component-es5" | "npm-component-es2015" | "npm-component-es2016" | "npm-component-es2017" | "npm-component-es2018" | "npm-component-es2019" | "npm-component-es2020" | "npm-component-es2021" | "npm-component-es2022", PartialBaseBuildConfig[]>;
|
|
19
19
|
export declare const componentUmdPreset: {
|
|
20
20
|
'npm-component-with-umd': PartialBaseBuildConfig[];
|
|
21
21
|
};
|
|
22
|
-
export declare const componentUmdPresetWithTarget: Record<"npm-component-with-umd-
|
|
22
|
+
export declare const componentUmdPresetWithTarget: Record<"npm-component-with-umd-es6" | "npm-component-with-umd-esnext" | "npm-component-with-umd-es5" | "npm-component-with-umd-es2015" | "npm-component-with-umd-es2016" | "npm-component-with-umd-es2017" | "npm-component-with-umd-es2018" | "npm-component-with-umd-es2019" | "npm-component-with-umd-es2020" | "npm-component-with-umd-es2021" | "npm-component-with-umd-es2022", PartialBaseBuildConfig[]>;
|
|
23
23
|
export declare const nodeBuildConfig: PartialBaseBuildConfig[];
|
|
24
24
|
export declare const universalBuildConfig: PartialBaseBuildConfig[];
|
|
25
25
|
export declare const presetList: Record<string, PartialBaseBuildConfig[]>;
|
package/dist/constants/preset.js
CHANGED
|
@@ -1,67 +1,42 @@
|
|
|
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
|
-
npmLibraryPresetConfig: function() {
|
|
17
|
-
return npmLibraryPresetConfig;
|
|
18
|
-
},
|
|
19
|
-
npmLibraryWithUmdPresetConfig: function() {
|
|
20
|
-
return npmLibraryWithUmdPresetConfig;
|
|
21
|
-
},
|
|
22
|
-
npmComponentPresetConfig: function() {
|
|
23
|
-
return npmComponentPresetConfig;
|
|
24
|
-
},
|
|
25
|
-
npmComponentWithUmdPresetConfig: function() {
|
|
26
|
-
return npmComponentWithUmdPresetConfig;
|
|
27
|
-
},
|
|
28
|
-
libraryPreset: function() {
|
|
29
|
-
return libraryPreset;
|
|
30
|
-
},
|
|
31
|
-
libraryPresetWithTarget: function() {
|
|
32
|
-
return libraryPresetWithTarget;
|
|
33
|
-
},
|
|
34
|
-
libraryUmdPreset: function() {
|
|
35
|
-
return libraryUmdPreset;
|
|
36
|
-
},
|
|
37
|
-
libraryUmdPresetWithTarget: function() {
|
|
38
|
-
return libraryUmdPresetWithTarget;
|
|
39
|
-
},
|
|
40
|
-
componentPreset: function() {
|
|
41
|
-
return componentPreset;
|
|
42
|
-
},
|
|
43
|
-
componentPresetWithTarget: function() {
|
|
44
|
-
return componentPresetWithTarget;
|
|
45
|
-
},
|
|
46
|
-
componentUmdPreset: function() {
|
|
47
|
-
return componentUmdPreset;
|
|
48
|
-
},
|
|
49
|
-
componentUmdPresetWithTarget: function() {
|
|
50
|
-
return componentUmdPresetWithTarget;
|
|
51
|
-
},
|
|
52
|
-
nodeBuildConfig: function() {
|
|
53
|
-
return nodeBuildConfig;
|
|
54
|
-
},
|
|
55
|
-
universalBuildConfig: function() {
|
|
56
|
-
return universalBuildConfig;
|
|
57
|
-
},
|
|
58
|
-
presetList: function() {
|
|
59
|
-
return presetList;
|
|
60
|
-
},
|
|
61
|
-
internalPreset: function() {
|
|
62
|
-
return internalPreset;
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
63
15
|
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var preset_exports = {};
|
|
20
|
+
__export(preset_exports, {
|
|
21
|
+
componentPreset: () => componentPreset,
|
|
22
|
+
componentPresetWithTarget: () => componentPresetWithTarget,
|
|
23
|
+
componentUmdPreset: () => componentUmdPreset,
|
|
24
|
+
componentUmdPresetWithTarget: () => componentUmdPresetWithTarget,
|
|
25
|
+
internalPreset: () => internalPreset,
|
|
26
|
+
libraryPreset: () => libraryPreset,
|
|
27
|
+
libraryPresetWithTarget: () => libraryPresetWithTarget,
|
|
28
|
+
libraryUmdPreset: () => libraryUmdPreset,
|
|
29
|
+
libraryUmdPresetWithTarget: () => libraryUmdPresetWithTarget,
|
|
30
|
+
nodeBuildConfig: () => nodeBuildConfig,
|
|
31
|
+
npmComponentPresetConfig: () => npmComponentPresetConfig,
|
|
32
|
+
npmComponentWithUmdPresetConfig: () => npmComponentWithUmdPresetConfig,
|
|
33
|
+
npmLibraryPresetConfig: () => npmLibraryPresetConfig,
|
|
34
|
+
npmLibraryWithUmdPresetConfig: () => npmLibraryWithUmdPresetConfig,
|
|
35
|
+
presetList: () => presetList,
|
|
36
|
+
targets: () => targets,
|
|
37
|
+
universalBuildConfig: () => universalBuildConfig
|
|
64
38
|
});
|
|
39
|
+
module.exports = __toCommonJS(preset_exports);
|
|
65
40
|
const targets = [
|
|
66
41
|
"es5",
|
|
67
42
|
"es6",
|
|
@@ -313,5 +288,23 @@ const internalPreset = {
|
|
|
313
288
|
"modern-js-node": nodeBuildConfig,
|
|
314
289
|
"modern-js-universal": universalBuildConfig
|
|
315
290
|
};
|
|
316
|
-
|
|
317
|
-
|
|
291
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
292
|
+
0 && (module.exports = {
|
|
293
|
+
componentPreset,
|
|
294
|
+
componentPresetWithTarget,
|
|
295
|
+
componentUmdPreset,
|
|
296
|
+
componentUmdPresetWithTarget,
|
|
297
|
+
internalPreset,
|
|
298
|
+
libraryPreset,
|
|
299
|
+
libraryPresetWithTarget,
|
|
300
|
+
libraryUmdPreset,
|
|
301
|
+
libraryUmdPresetWithTarget,
|
|
302
|
+
nodeBuildConfig,
|
|
303
|
+
npmComponentPresetConfig,
|
|
304
|
+
npmComponentWithUmdPresetConfig,
|
|
305
|
+
npmLibraryPresetConfig,
|
|
306
|
+
npmLibraryWithUmdPresetConfig,
|
|
307
|
+
presetList,
|
|
308
|
+
targets,
|
|
309
|
+
universalBuildConfig
|
|
310
|
+
});
|
package/dist/debug.d.ts
ADDED
package/dist/debug.js
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var debug_exports = {};
|
|
20
|
+
__export(debug_exports, {
|
|
21
|
+
debug: () => debug,
|
|
22
|
+
debugResolve: () => debugResolve,
|
|
23
|
+
label: () => label
|
|
24
|
+
});
|
|
25
|
+
module.exports = __toCommonJS(debug_exports);
|
|
26
|
+
var import_utils = require("@modern-js/utils");
|
|
27
|
+
const debug = (0, import_utils.debug)("module");
|
|
28
|
+
const label = (info) => {
|
|
29
|
+
return import_utils.chalk.blue(`[${info.toUpperCase()}]`);
|
|
30
|
+
};
|
|
31
|
+
const debugResolve = (0, import_utils.debug)("module:resolve");
|
|
32
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
33
|
+
0 && (module.exports = {
|
|
34
|
+
debug,
|
|
35
|
+
debugResolve,
|
|
36
|
+
label
|
|
37
|
+
});
|
package/dist/dev.js
CHANGED
|
@@ -1,27 +1,41 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
Object.
|
|
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 showMenu;
|
|
15
|
-
},
|
|
16
|
-
dev: function() {
|
|
17
|
-
return dev;
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
18
17
|
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
28
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
+
var dev_exports = {};
|
|
30
|
+
__export(dev_exports, {
|
|
31
|
+
dev: () => dev,
|
|
32
|
+
showMenu: () => showMenu
|
|
19
33
|
});
|
|
20
|
-
|
|
21
|
-
|
|
34
|
+
module.exports = __toCommonJS(dev_exports);
|
|
35
|
+
var import_utils = require("@modern-js/utils");
|
|
22
36
|
const showMenu = async (metas, devCmdOptions, api, context) => {
|
|
23
37
|
const runner = api.useHookRunners();
|
|
24
|
-
const menuTitle =
|
|
38
|
+
const menuTitle = import_utils.chalk.rgb(255, 153, 0);
|
|
25
39
|
const choices = metas.map((meta) => meta.menuItem).filter((menuItem) => typeof menuItem === "object");
|
|
26
40
|
const questions = [
|
|
27
41
|
{
|
|
@@ -32,7 +46,7 @@ const showMenu = async (metas, devCmdOptions, api, context) => {
|
|
|
32
46
|
}
|
|
33
47
|
];
|
|
34
48
|
const newQuestions = await runner.beforeDevMenu(questions);
|
|
35
|
-
const result = await
|
|
49
|
+
const result = await import_utils.inquirer.prompt(newQuestions.length !== 0 ? newQuestions : questions);
|
|
36
50
|
await runner.afterDevMenu({
|
|
37
51
|
result,
|
|
38
52
|
devTools: metas
|
|
@@ -49,18 +63,18 @@ const showMenu = async (metas, devCmdOptions, api, context) => {
|
|
|
49
63
|
}
|
|
50
64
|
};
|
|
51
65
|
const dev = async (options, metas, api, context) => {
|
|
52
|
-
const { green } = await Promise.resolve().then(() =>
|
|
66
|
+
const { green } = await Promise.resolve().then(() => __toESM(require("./constants/color")));
|
|
53
67
|
const runner = api.useHookRunners();
|
|
54
68
|
if (metas.length === 0) {
|
|
55
|
-
const local = await Promise.resolve().then(() =>
|
|
69
|
+
const local = await Promise.resolve().then(() => __toESM(require("./locale")));
|
|
56
70
|
const noDevToolsLog = await runner.noDevTools(local.i18n.t(local.localeKeys.log.dev.noDevtools));
|
|
57
|
-
|
|
71
|
+
import_utils.logger.info(noDevToolsLog);
|
|
58
72
|
process.exit(0);
|
|
59
73
|
}
|
|
60
74
|
if (metas.length === 1) {
|
|
61
75
|
var _metas__menuItem;
|
|
62
76
|
var _metas__menuItem_name;
|
|
63
|
-
|
|
77
|
+
import_utils.logger.info(import_utils.chalk.rgb(...green)(`Only one dev tooling is currently detected as available, run it directly [${(_metas__menuItem_name = (_metas__menuItem = metas[0].menuItem) === null || _metas__menuItem === void 0 ? void 0 : _metas__menuItem.name) !== null && _metas__menuItem_name !== void 0 ? _metas__menuItem_name : metas[0].name}]`));
|
|
64
78
|
const meta = metas[0];
|
|
65
79
|
await runner.beforeDevTask(meta);
|
|
66
80
|
await meta.action(options, {
|
|
@@ -70,5 +84,8 @@ const dev = async (options, metas, api, context) => {
|
|
|
70
84
|
await showMenu(metas, options, api, context);
|
|
71
85
|
}
|
|
72
86
|
};
|
|
73
|
-
|
|
74
|
-
|
|
87
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
88
|
+
0 && (module.exports = {
|
|
89
|
+
dev,
|
|
90
|
+
showMenu
|
|
91
|
+
});
|