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