@modern-js/module-tools 2.0.0-beta.4 → 2.0.0-beta.6
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/CHANGELOG.md +124 -0
- package/dist/builder/build.js +54 -50
- package/dist/builder/build.js.map +1 -1
- package/dist/builder/clear.js +16 -23
- package/dist/builder/clear.js.map +1 -1
- package/dist/builder/copy.d.ts +2 -0
- package/dist/builder/copy.js +45 -56
- package/dist/builder/copy.js.map +1 -1
- package/dist/builder/dts/index.js +8 -3
- package/dist/builder/dts/index.js.map +1 -1
- package/dist/builder/dts/rollup.js +39 -52
- package/dist/builder/dts/rollup.js.map +1 -1
- package/dist/builder/dts/tsc.js +28 -35
- package/dist/builder/dts/tsc.js.map +1 -1
- package/dist/builder/index.js +14 -22
- package/dist/builder/index.js.map +1 -1
- package/dist/builder/platform.js +14 -22
- package/dist/builder/platform.js.map +1 -1
- package/dist/cli.js +16 -24
- package/dist/cli.js.map +1 -1
- package/dist/command.js +33 -38
- package/dist/command.js.map +1 -1
- package/dist/config/defineConfig.js +7 -3
- package/dist/config/defineConfig.js.map +1 -1
- package/dist/config/normalize.js +29 -38
- package/dist/config/normalize.js.map +1 -1
- package/dist/config/schema.js +11 -3
- package/dist/config/schema.js.map +1 -1
- package/dist/constants/build-presets.js +39 -22
- package/dist/constants/build-presets.js.map +1 -1
- package/dist/constants/build.js +10 -3
- package/dist/constants/build.js.map +1 -1
- package/dist/constants/colors.js +9 -3
- package/dist/constants/colors.js.map +1 -1
- package/dist/constants/dts.js +10 -3
- package/dist/constants/dts.js.map +1 -1
- package/dist/constants/file.js +9 -3
- package/dist/constants/file.js.map +1 -1
- package/dist/constants/legacy-build-presets.js +12 -3
- package/dist/constants/legacy-build-presets.js.map +1 -1
- package/dist/constants/log.js +10 -3
- package/dist/constants/log.js.map +1 -1
- package/dist/dev.js +18 -24
- package/dist/dev.js.map +1 -1
- package/dist/error.js +12 -3
- package/dist/error.js.map +1 -1
- package/dist/hooks/build.js +7 -3
- package/dist/hooks/build.js.map +1 -1
- package/dist/hooks/dev.js +7 -3
- package/dist/hooks/dev.js.map +1 -1
- package/dist/hooks/index.js +21 -19
- package/dist/hooks/index.js.map +1 -1
- package/dist/hooks/misc.js +7 -3
- package/dist/hooks/misc.js.map +1 -1
- package/dist/index.js +9 -4
- package/dist/index.js.map +1 -1
- package/dist/locale/en.js +7 -3
- package/dist/locale/en.js.map +1 -1
- package/dist/locale/index.js +8 -3
- package/dist/locale/index.js.map +1 -1
- package/dist/locale/zh.js +7 -3
- package/dist/locale/zh.js.map +1 -1
- package/dist/plugins.js +7 -3
- package/dist/plugins.js.map +1 -1
- package/dist/types/color.js +17 -0
- package/dist/types/color.js.map +1 -0
- package/dist/types/command.js +17 -0
- package/dist/types/command.js.map +1 -0
- package/dist/types/config/index.d.ts +2 -5
- package/dist/types/config/index.js +3 -3
- package/dist/types/config/index.js.map +1 -1
- package/dist/types/config/style.js +17 -0
- package/dist/types/config/style.js.map +1 -0
- package/dist/types/context.js +17 -0
- package/dist/types/context.js.map +1 -0
- package/dist/types/copy.js +17 -0
- package/dist/types/copy.js.map +1 -0
- package/dist/types/dts.js +17 -0
- package/dist/types/dts.js.map +1 -0
- package/dist/types/hooks.js +17 -0
- package/dist/types/hooks.js.map +1 -0
- package/dist/types/index.js +7 -7
- package/dist/types/index.js.map +1 -1
- package/dist/types/utils.js +17 -0
- package/dist/types/utils.js.map +1 -0
- package/dist/utils/builder.js +13 -26
- package/dist/utils/builder.js.map +1 -1
- package/dist/utils/config.js +32 -37
- package/dist/utils/config.js.map +1 -1
- package/dist/utils/context.js +14 -22
- package/dist/utils/context.js.map +1 -1
- package/dist/utils/dts.js +39 -50
- package/dist/utils/dts.js.map +1 -1
- package/dist/utils/input.js +19 -30
- package/dist/utils/input.js.map +1 -1
- package/dist/utils/language.js +17 -24
- package/dist/utils/language.js.map +1 -1
- package/dist/utils/libuild-plugins.js +16 -23
- package/dist/utils/libuild-plugins.js.map +1 -1
- package/dist/utils/log.js +15 -23
- package/dist/utils/log.js.map +1 -1
- package/dist/utils/onExit.js +14 -22
- package/dist/utils/onExit.js.map +1 -1
- package/dist/utils/path.js +11 -25
- package/dist/utils/path.js.map +1 -1
- package/dist/utils/style.js +20 -25
- package/dist/utils/style.js.map +1 -1
- package/dist/utils/tspaths-transform.js +7 -3
- package/dist/utils/tspaths-transform.js.map +1 -1
- package/package.json +13 -15
package/dist/cli.js
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
|
+
var __create = Object.create;
|
|
1
2
|
var __defProp = Object.defineProperty;
|
|
2
3
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
4
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
4
6
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
7
|
var __export = (target, all) => {
|
|
6
8
|
for (var name in all)
|
|
@@ -14,32 +16,11 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
14
16
|
}
|
|
15
17
|
return to;
|
|
16
18
|
};
|
|
17
|
-
var
|
|
18
|
-
|
|
19
|
-
__export(stdin_exports, {
|
|
20
|
-
cli: () => cli
|
|
21
|
-
});
|
|
22
|
-
module.exports = __toCommonJS(stdin_exports);
|
|
23
|
-
var import_hooks = require("./hooks");
|
|
24
|
-
var import_plugins = require("./plugins");
|
|
25
|
-
var __create = Object.create;
|
|
26
|
-
var __defProp2 = Object.defineProperty;
|
|
27
|
-
var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor;
|
|
28
|
-
var __getOwnPropNames2 = Object.getOwnPropertyNames;
|
|
29
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
30
|
-
var __hasOwnProp2 = Object.prototype.hasOwnProperty;
|
|
31
|
-
var __copyProps2 = (to, from, except, desc) => {
|
|
32
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
33
|
-
for (let key of __getOwnPropNames2(from))
|
|
34
|
-
if (!__hasOwnProp2.call(to, key) && key !== except)
|
|
35
|
-
__defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable });
|
|
36
|
-
}
|
|
37
|
-
return to;
|
|
38
|
-
};
|
|
39
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps2(
|
|
40
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp2(target, "default", { value: mod, enumerable: true }) : target,
|
|
19
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
20
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
41
21
|
mod
|
|
42
22
|
));
|
|
23
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
43
24
|
var __async = (__this, __arguments, generator) => {
|
|
44
25
|
return new Promise((resolve, reject) => {
|
|
45
26
|
var fulfilled = (value) => {
|
|
@@ -60,6 +41,13 @@ var __async = (__this, __arguments, generator) => {
|
|
|
60
41
|
step((generator = generator.apply(__this, __arguments)).next());
|
|
61
42
|
});
|
|
62
43
|
};
|
|
44
|
+
var cli_exports = {};
|
|
45
|
+
__export(cli_exports, {
|
|
46
|
+
cli: () => cli
|
|
47
|
+
});
|
|
48
|
+
module.exports = __toCommonJS(cli_exports);
|
|
49
|
+
var import_hooks = require("./hooks");
|
|
50
|
+
var import_plugins = require("./plugins");
|
|
63
51
|
const cli = () => ({
|
|
64
52
|
name: "@modern-js/module-tools",
|
|
65
53
|
registerHook: import_hooks.registerHook,
|
|
@@ -99,5 +87,9 @@ const setup = (api) => __async(void 0, null, function* () {
|
|
|
99
87
|
}
|
|
100
88
|
};
|
|
101
89
|
});
|
|
90
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
91
|
+
0 && (module.exports = {
|
|
92
|
+
cli
|
|
93
|
+
});
|
|
102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names":[],"sources":["../src/cli.ts"],"sourcesContent":["import type { CliPlugin } from '@modern-js/core';\nimport type { ModuleTools } from './types';\nimport { registerHook } from './hooks';\nimport { getPlugins } from './plugins';\n\nexport const cli = (): CliPlugin<ModuleTools> => ({\n name: '@modern-js/module-tools',\n registerHook,\n usePlugins: getPlugins(process.argv.slice(2)[0]),\n setup,\n});\n\nconst setup: CliPlugin<ModuleTools>['setup'] = async api => {\n const prepare = async () => {\n const { initLocalLanguage } = await import('./utils/language');\n await initLocalLanguage();\n\n const appContext = api.useAppContext();\n const { fs, dotenv } = await import('@modern-js/utils');\n dotenv.config();\n // remove '/node_modules/.modern-js'\n await fs.emptydir(appContext.internalDirectory);\n\n const hookRunners = api.useHookRunners();\n await hookRunners.addRuntimeExports();\n\n const { addExitListener } = await import('./utils/onExit');\n await addExitListener(async () => {\n await hookRunners.afterDev();\n });\n };\n\n const validateSchema = async () => {\n const { schema } = await import('./config/schema');\n return schema;\n };\n\n return {\n prepare,\n validateSchema,\n async commands({ program }) {\n const { buildCommand, devCommand, newCommand, upgradCommand } =\n await import('./command');\n await buildCommand(program, api);\n await devCommand(program, api);\n await newCommand(program);\n await upgradCommand(program);\n },\n };\n};\n"]}
|
package/dist/command.js
CHANGED
|
@@ -1,43 +1,17 @@
|
|
|
1
|
-
var __defProp = Object.defineProperty;
|
|
2
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
-
var __export = (target, all) => {
|
|
6
|
-
for (var name in all)
|
|
7
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
-
};
|
|
9
|
-
var __copyProps = (to, from, except, desc) => {
|
|
10
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
-
for (let key of __getOwnPropNames(from))
|
|
12
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
-
}
|
|
15
|
-
return to;
|
|
16
|
-
};
|
|
17
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
-
var stdin_exports = {};
|
|
19
|
-
__export(stdin_exports, {
|
|
20
|
-
buildCommand: () => buildCommand,
|
|
21
|
-
devCommand: () => devCommand,
|
|
22
|
-
newCommand: () => newCommand,
|
|
23
|
-
upgradCommand: () => upgradCommand
|
|
24
|
-
});
|
|
25
|
-
module.exports = __toCommonJS(stdin_exports);
|
|
26
|
-
var import_utils = require("@modern-js/utils");
|
|
27
1
|
var __create = Object.create;
|
|
28
|
-
var
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
29
3
|
var __defProps = Object.defineProperties;
|
|
30
|
-
var
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
31
5
|
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
32
|
-
var
|
|
6
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
33
7
|
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
34
8
|
var __getProtoOf = Object.getPrototypeOf;
|
|
35
|
-
var
|
|
9
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
36
10
|
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
37
|
-
var __defNormalProp = (obj, key, value) => key in obj ?
|
|
11
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
38
12
|
var __spreadValues = (a, b) => {
|
|
39
13
|
for (var prop in b || (b = {}))
|
|
40
|
-
if (
|
|
14
|
+
if (__hasOwnProp.call(b, prop))
|
|
41
15
|
__defNormalProp(a, prop, b[prop]);
|
|
42
16
|
if (__getOwnPropSymbols)
|
|
43
17
|
for (var prop of __getOwnPropSymbols(b)) {
|
|
@@ -47,18 +21,23 @@ var __spreadValues = (a, b) => {
|
|
|
47
21
|
return a;
|
|
48
22
|
};
|
|
49
23
|
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
50
|
-
var
|
|
24
|
+
var __export = (target, all) => {
|
|
25
|
+
for (var name in all)
|
|
26
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
27
|
+
};
|
|
28
|
+
var __copyProps = (to, from, except, desc) => {
|
|
51
29
|
if (from && typeof from === "object" || typeof from === "function") {
|
|
52
|
-
for (let key of
|
|
53
|
-
if (!
|
|
54
|
-
|
|
30
|
+
for (let key of __getOwnPropNames(from))
|
|
31
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
32
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
55
33
|
}
|
|
56
34
|
return to;
|
|
57
35
|
};
|
|
58
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {},
|
|
59
|
-
isNodeMode || !mod || !mod.__esModule ?
|
|
36
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
37
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
60
38
|
mod
|
|
61
39
|
));
|
|
40
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
62
41
|
var __async = (__this, __arguments, generator) => {
|
|
63
42
|
return new Promise((resolve, reject) => {
|
|
64
43
|
var fulfilled = (value) => {
|
|
@@ -79,6 +58,15 @@ var __async = (__this, __arguments, generator) => {
|
|
|
79
58
|
step((generator = generator.apply(__this, __arguments)).next());
|
|
80
59
|
});
|
|
81
60
|
};
|
|
61
|
+
var command_exports = {};
|
|
62
|
+
__export(command_exports, {
|
|
63
|
+
buildCommand: () => buildCommand,
|
|
64
|
+
devCommand: () => devCommand,
|
|
65
|
+
newCommand: () => newCommand,
|
|
66
|
+
upgradCommand: () => upgradCommand
|
|
67
|
+
});
|
|
68
|
+
module.exports = __toCommonJS(command_exports);
|
|
69
|
+
var import_utils = require("@modern-js/utils");
|
|
82
70
|
const debug = (0, import_utils.createDebugger)("module-tools");
|
|
83
71
|
const buildCommand = (program, api) => __async(void 0, null, function* () {
|
|
84
72
|
const local = yield Promise.resolve().then(() => __toESM(require("./locale")));
|
|
@@ -165,5 +153,12 @@ const upgradCommand = (program) => __async(void 0, null, function* () {
|
|
|
165
153
|
const { defineCommand } = yield Promise.resolve().then(() => __toESM(require("@modern-js/upgrade")));
|
|
166
154
|
defineCommand(program.command("upgrade"));
|
|
167
155
|
});
|
|
156
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
157
|
+
0 && (module.exports = {
|
|
158
|
+
buildCommand,
|
|
159
|
+
devCommand,
|
|
160
|
+
newCommand,
|
|
161
|
+
upgradCommand
|
|
162
|
+
});
|
|
168
163
|
|
|
169
164
|
//# sourceMappingURL=command.js.map
|
package/dist/command.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"mappings":"
|
|
1
|
+
{"version":3,"file":null,"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,mBAA+B;AAK/B,MAAM,YAAQ,6BAAe,cAAc;AAEpC,MAAM,eAAe,CAC1B,SACA,QACG;AACH,QAAM,QAAQ,MAAM,6CAAO;AAC3B,QAAM,EAAE,oBAAoB,IAAI,MAAM,6CAAO;AAE7C,UACG,QAAQ,OAAO,EACf,MAAM,WAAW,EACjB,YAAY,MAAM,KAAK,EAAE,MAAM,WAAW,QAAQ,MAAM,QAAQ,CAAC,EACjE,OAAO,eAAe,MAAM,KAAK,EAAE,MAAM,WAAW,QAAQ,MAAM,KAAK,CAAC,EACxE;AAA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I,QAAQ,CAAC,EACxE,OAAO,CAAM,YAAW;AACvB,UAAM,EAAE,gBAAgB,IAAI,MAAM,6CAAO;AACzC,UAAM,EAAE,kBAAkB,IAAI,MAAM,6CAAO;AAC3C,UAAM,SAAS,kBAAkB;AAEjC,UAAM,gBAAgB,iCAAK,UAAL,EAAc,OAAO,EAAC;AAAA,EAC9C,EAAC;AACL;AAEO,MAAM,gBAAgB,CAAO,YAAqB;AACvD,QAAM,EAAE,cAAc,IAAI,MAAM,6CAAO;AACvC,gBAAc,QAAQ,QAAQ,SAAS,CAAC;AAC1C;;;;;;;;","names":[],"sources":["../src/command.ts"],"sourcesContent":["import type { Command } from '@modern-js/utils';\nimport { createDebugger } from '@modern-js/utils';\nimport type { PluginAPI } from '@modern-js/core';\nimport type { ModuleTools } from './types';\nimport type { DevCommandOptions, BuildCommandOptions } from './types/command';\n\nconst debug = createDebugger('module-tools');\n\nexport const buildCommand = async (\n program: Command,\n api: PluginAPI<ModuleTools>,\n) => {\n const local = await import('./locale');\n const { defaultTsConfigPath } = await import('./constants/dts');\n\n program\n .command('build')\n .usage('[options]')\n .description(local.i18n.t(local.localeKeys.command.build.describe))\n .option('-w, --watch', local.i18n.t(local.localeKeys.command.build.watch))\n .option(\n '--tsconfig [tsconfig]',\n local.i18n.t(local.localeKeys.command.build.tsconfig),\n defaultTsConfigPath,\n )\n .option(\n '-p, --platform [platform...]',\n local.i18n.t(local.localeKeys.command.build.platform),\n )\n .option('--no-dts', local.i18n.t(local.localeKeys.command.build.dts))\n .option('--no-clear', local.i18n.t(local.localeKeys.command.build.no_clear))\n .option(\n '-c --config <config>',\n local.i18n.t(local.localeKeys.command.build.config),\n )\n .action(async (options: BuildCommandOptions) => {\n const { initModuleContext } = await import('./utils/context');\n const context = await initModuleContext(api);\n if (options.platform) {\n const { buildPlatform } = await import('./builder/platform');\n await buildPlatform(options, api, context);\n return;\n }\n\n const runner = api.useHookRunners();\n\n const { normalizeBuildConfig } = await import('./config/normalize');\n const resolvedBuildConfig = await normalizeBuildConfig(\n api,\n context,\n options,\n );\n\n debug('resolvedBuildConfig', resolvedBuildConfig);\n\n await runner.beforeBuild({ config: resolvedBuildConfig, options });\n const builder = await import('./builder');\n await builder.run(\n { cmdOptions: options, resolvedBuildConfig, context },\n api,\n );\n });\n};\n\nexport const devCommand = async (\n program: Command,\n api: PluginAPI<ModuleTools>,\n) => {\n const local = await import('./locale');\n const runner = api.useHookRunners();\n const devToolMetas = await runner.registerDev();\n\n await runner.beforeDev(devToolMetas);\n\n const devProgram = program\n .command('dev')\n .usage('[options]')\n .description(local.i18n.t(local.localeKeys.command.dev.describe))\n .action(async (options: DevCommandOptions = {}) => {\n const { initModuleContext } = await import('./utils/context');\n const context = await initModuleContext(api);\n const { dev } = await import('./dev');\n await dev(options, devToolMetas, api, context);\n });\n\n for (const meta of devToolMetas) {\n if (!meta.subCommands) {\n continue;\n }\n\n for (const subCmd of meta.subCommands) {\n devProgram\n .command(subCmd)\n .action(async (options: DevCommandOptions = {}) => {\n const { initModuleContext } = await import('./utils/context');\n const context = await initModuleContext(api);\n await runner.beforeDevTask(meta);\n await meta.action(options, { isTsProject: context.isTsProject });\n });\n }\n }\n};\n\nexport const newCommand = async (program: Command) => {\n const local = await import('./locale');\n\n program\n .command('new')\n .usage('[options]')\n .description(local.i18n.t(local.localeKeys.command.new.describe))\n .option(\n '-d, --debug',\n local.i18n.t(local.localeKeys.command.new.debug),\n false,\n )\n .option(\n '-c, --config <config>',\n local.i18n.t(local.localeKeys.command.new.config),\n )\n .option(\n '--dist-tag <tag>',\n local.i18n.t(local.localeKeys.command.new.distTag),\n )\n .option('--registry', local.i18n.t(local.localeKeys.command.new.registry))\n .action(async options => {\n const { ModuleNewAction } = await import('@modern-js/new-action');\n const { getLocaleLanguage } = await import('./utils/language');\n const locale = getLocaleLanguage();\n\n await ModuleNewAction({ ...options, locale });\n });\n};\n\nexport const upgradCommand = async (program: Command) => {\n const { defineCommand } = await import('@modern-js/upgrade');\n defineCommand(program.command('upgrade'));\n};\n"]}
|
|
@@ -15,11 +15,15 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
15
15
|
return to;
|
|
16
16
|
};
|
|
17
17
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
-
var
|
|
19
|
-
__export(
|
|
18
|
+
var defineConfig_exports = {};
|
|
19
|
+
__export(defineConfig_exports, {
|
|
20
20
|
defineConfig: () => defineConfig
|
|
21
21
|
});
|
|
22
|
-
module.exports = __toCommonJS(
|
|
22
|
+
module.exports = __toCommonJS(defineConfig_exports);
|
|
23
23
|
const defineConfig = (config) => config;
|
|
24
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
25
|
+
0 && (module.exports = {
|
|
26
|
+
defineConfig
|
|
27
|
+
});
|
|
24
28
|
|
|
25
29
|
//# sourceMappingURL=defineConfig.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"mappings":";;;;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"mappings":";;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAEO,MAAM,eAAe,CAAC,WAC3B;","names":[],"sources":["../../src/config/defineConfig.ts"],"sourcesContent":["import type { ModuleConfigParams } from '../types';\n\nexport const defineConfig = (config: ModuleConfigParams): ModuleConfigParams =>\n config;\n"]}
|
package/dist/config/normalize.js
CHANGED
|
@@ -21,35 +21,6 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
21
21
|
mod
|
|
22
22
|
));
|
|
23
23
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
24
|
-
var stdin_exports = {};
|
|
25
|
-
__export(stdin_exports, {
|
|
26
|
-
checkConfig: () => checkConfig,
|
|
27
|
-
normalizeBuildConfig: () => normalizeBuildConfig,
|
|
28
|
-
requiredBuildConfig: () => requiredBuildConfig,
|
|
29
|
-
transformBuildConfigToBaseConfigs: () => transformBuildConfigToBaseConfigs,
|
|
30
|
-
transformBuildPresetToBaseConfigs: () => transformBuildPresetToBaseConfigs,
|
|
31
|
-
transformToAbsPath: () => transformToAbsPath
|
|
32
|
-
});
|
|
33
|
-
module.exports = __toCommonJS(stdin_exports);
|
|
34
|
-
var import_path = __toESM(require("path"));
|
|
35
|
-
var __create2 = Object.create;
|
|
36
|
-
var __defProp2 = Object.defineProperty;
|
|
37
|
-
var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor;
|
|
38
|
-
var __getOwnPropNames2 = Object.getOwnPropertyNames;
|
|
39
|
-
var __getProtoOf2 = Object.getPrototypeOf;
|
|
40
|
-
var __hasOwnProp2 = Object.prototype.hasOwnProperty;
|
|
41
|
-
var __copyProps2 = (to, from, except, desc) => {
|
|
42
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
43
|
-
for (let key of __getOwnPropNames2(from))
|
|
44
|
-
if (!__hasOwnProp2.call(to, key) && key !== except)
|
|
45
|
-
__defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable });
|
|
46
|
-
}
|
|
47
|
-
return to;
|
|
48
|
-
};
|
|
49
|
-
var __toESM2 = (mod, isNodeMode, target) => (target = mod != null ? __create2(__getProtoOf2(mod)) : {}, __copyProps2(
|
|
50
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp2(target, "default", { value: mod, enumerable: true }) : target,
|
|
51
|
-
mod
|
|
52
|
-
));
|
|
53
24
|
var __async = (__this, __arguments, generator) => {
|
|
54
25
|
return new Promise((resolve, reject) => {
|
|
55
26
|
var fulfilled = (value) => {
|
|
@@ -70,9 +41,20 @@ var __async = (__this, __arguments, generator) => {
|
|
|
70
41
|
step((generator = generator.apply(__this, __arguments)).next());
|
|
71
42
|
});
|
|
72
43
|
};
|
|
44
|
+
var normalize_exports = {};
|
|
45
|
+
__export(normalize_exports, {
|
|
46
|
+
checkConfig: () => checkConfig,
|
|
47
|
+
normalizeBuildConfig: () => normalizeBuildConfig,
|
|
48
|
+
requiredBuildConfig: () => requiredBuildConfig,
|
|
49
|
+
transformBuildConfigToBaseConfigs: () => transformBuildConfigToBaseConfigs,
|
|
50
|
+
transformBuildPresetToBaseConfigs: () => transformBuildPresetToBaseConfigs,
|
|
51
|
+
transformToAbsPath: () => transformToAbsPath
|
|
52
|
+
});
|
|
53
|
+
module.exports = __toCommonJS(normalize_exports);
|
|
54
|
+
var import_path = __toESM(require("path"));
|
|
73
55
|
const transformBuildPresetToBaseConfigs = (options, preset) => __async(void 0, null, function* () {
|
|
74
|
-
const { BuildInPreset, presetList } = yield Promise.resolve().then(() =>
|
|
75
|
-
const { addInputToPreset } = yield Promise.resolve().then(() =>
|
|
56
|
+
const { BuildInPreset, presetList } = yield Promise.resolve().then(() => __toESM(require("../constants/build-presets")));
|
|
57
|
+
const { addInputToPreset } = yield Promise.resolve().then(() => __toESM(require("../utils/input")));
|
|
76
58
|
if (typeof preset === "function") {
|
|
77
59
|
const partialBuildConfig = yield preset({ preset: BuildInPreset });
|
|
78
60
|
if (!partialBuildConfig) {
|
|
@@ -95,11 +77,11 @@ const transformBuildPresetToBaseConfigs = (options, preset) => __async(void 0, n
|
|
|
95
77
|
);
|
|
96
78
|
});
|
|
97
79
|
const transformBuildConfigToBaseConfigs = (config, options) => __async(void 0, null, function* () {
|
|
98
|
-
const { validPartialBuildConfig } = yield Promise.resolve().then(() =>
|
|
80
|
+
const { validPartialBuildConfig } = yield Promise.resolve().then(() => __toESM(require("../utils/config")));
|
|
99
81
|
validPartialBuildConfig(config);
|
|
100
82
|
const { buildCmdOptions } = options;
|
|
101
|
-
const { ensureArray } = yield Promise.resolve().then(() =>
|
|
102
|
-
const { assignTsConfigPath } = yield Promise.resolve().then(() =>
|
|
83
|
+
const { ensureArray } = yield Promise.resolve().then(() => __toESM(require("@modern-js/utils")));
|
|
84
|
+
const { assignTsConfigPath } = yield Promise.resolve().then(() => __toESM(require("../utils/dts")));
|
|
103
85
|
const partialConfigs = ensureArray(config);
|
|
104
86
|
const configs = yield Promise.all(
|
|
105
87
|
partialConfigs.map((config2) => __async(void 0, null, function* () {
|
|
@@ -112,7 +94,7 @@ const transformBuildConfigToBaseConfigs = (config, options) => __async(void 0, n
|
|
|
112
94
|
return configs;
|
|
113
95
|
});
|
|
114
96
|
const requiredBuildConfig = (partialBuildConfig, context) => __async(void 0, null, function* () {
|
|
115
|
-
const { mergeDefaultBaseConfig } = yield Promise.resolve().then(() =>
|
|
97
|
+
const { mergeDefaultBaseConfig } = yield Promise.resolve().then(() => __toESM(require("../utils/config")));
|
|
116
98
|
const mergedConfig = yield mergeDefaultBaseConfig(
|
|
117
99
|
partialBuildConfig,
|
|
118
100
|
context
|
|
@@ -120,9 +102,9 @@ const requiredBuildConfig = (partialBuildConfig, context) => __async(void 0, nul
|
|
|
120
102
|
return mergedConfig;
|
|
121
103
|
});
|
|
122
104
|
const transformToAbsPath = (baseConfig, options) => __async(void 0, null, function* () {
|
|
123
|
-
const { slash } = yield Promise.resolve().then(() =>
|
|
105
|
+
const { slash } = yield Promise.resolve().then(() => __toESM(require("@modern-js/utils")));
|
|
124
106
|
const newConfig = baseConfig;
|
|
125
|
-
const { normalizeInput } = yield Promise.resolve().then(() =>
|
|
107
|
+
const { normalizeInput } = yield Promise.resolve().then(() => __toESM(require("../utils/input")));
|
|
126
108
|
const { context } = options;
|
|
127
109
|
newConfig.outdir = import_path.default.isAbsolute(newConfig.outdir) ? newConfig.outdir : import_path.default.join(context.appDirectory, newConfig.outdir);
|
|
128
110
|
newConfig.sourceDir = slash(
|
|
@@ -146,7 +128,7 @@ const transformToAbsPath = (baseConfig, options) => __async(void 0, null, functi
|
|
|
146
128
|
const checkConfig = (config) => __async(void 0, null, function* () {
|
|
147
129
|
const { buildConfig, buildPreset } = config;
|
|
148
130
|
if (buildConfig && buildPreset) {
|
|
149
|
-
const { logger } = yield Promise.resolve().then(() =>
|
|
131
|
+
const { logger } = yield Promise.resolve().then(() => __toESM(require("@modern-js/utils")));
|
|
150
132
|
logger.warn(
|
|
151
133
|
`因为同时出现 'buildConfig' 和 'buildPreset' 配置,因此仅 'buildConfig' 配置生效`
|
|
152
134
|
);
|
|
@@ -173,5 +155,14 @@ const normalizeBuildConfig = (api, context, buildCmdOptions) => __async(void 0,
|
|
|
173
155
|
}
|
|
174
156
|
return baseConfigs;
|
|
175
157
|
});
|
|
158
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
159
|
+
0 && (module.exports = {
|
|
160
|
+
checkConfig,
|
|
161
|
+
normalizeBuildConfig,
|
|
162
|
+
requiredBuildConfig,
|
|
163
|
+
transformBuildConfigToBaseConfigs,
|
|
164
|
+
transformBuildPresetToBaseConfigs,
|
|
165
|
+
transformToAbsPath
|
|
166
|
+
});
|
|
176
167
|
|
|
177
168
|
//# sourceMappingURL=normalize.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"mappings":"
|
|
1
|
+
{"version":3,"file":null,"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBAAiB;AAaV,MAAM,oCAAoC,CAC/C,SAIA,WAC+B;AAC/B,QAAM,EAAE,eAAe,WAAW,IAAI,MAAM,6CAC1C;AAEF,QAAM,EAAE,iBAAiB,IAAI,MAAM,6CAAO;AAE1C,MAAI,OAAO,WAAW,YAAY;AAChC,UAAM,qBAAqB,MAAM,OAAO,EAAE,QAAQ,cAAc,CAAC;AAEjE,QAAI,CAAC,oBAAoB;AACvB,YAAM,IAAI;AAAA,QACR;AAAA,MACF;AAAA,IACF;AAEA,WAAO,kCAAkC,oBAAoB,OAAO;AAAA,EACtE;AAEA,QAAM,eAAe,CAAC,MACpB,KAAK;AAEP,MAAI,UAAU,aAAa,MAAM,GAAG;AAClC,WAAO;AAAA,MACL,MAAM,iBAAiB,WAAW,SAAS,QAAQ,OAAO;AAAA,MAC1D;AAAA,IACF;AAAA,E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U,KAAK;AACjB,cAAU,IAAI,WAAW,oBAAK;AAAA,MAC5B,UAAU;AAAA,MACV,UAAU,IAAI;AAAA,IAChB;AACA,cAAU,IAAI,eAAe,oBAAK;AAAA,MAChC,QAAQ;AAAA,MACR,UAAU,IAAI;AAAA,IAChB;AAAA,EACF;AAIA,SAAO;AACT;AAEO,MAAM,cAAc,CAAO,WAA6B;AAC7D,QAAM,EAAE,aAAa,YAAY,IAAI;AACrC,MAAI,eAAe,aAAa;AAC9B,UAAM,EAAE,OAAO,IAAI,MAAM,6CAAO;AAChC,WAAO;AAAA,MACL;AAAA,IACF;AAAA,EACF;AACF;AAEO,MAAM,uBAAuB,CAClC,KACA,SACA,oBAC+B;AAC/B,QAAM,SAAS,IAAI,yBAAyB;AAC5C,QAAM,EAAE,aAAa,YAAY,IAAI;AAErC,QAAM,YAAY,MAAM;AAExB,MAAI;AAGJ,MAAI,aAAa;AACf,kBAAc,MAAM,kCAAkC,aAAa;AAAA,MACjE;AAAA,MACA;AAAA,IACF,CAAC;AAAA,EACH,OAAO;AACL,kBAAc,MAAM;AAAA,MAClB;AAAA,QACE;AAAA,QACA;AAAA,MACF;AAAA,MACA;AAAA,IACF;AAAA,EACF;AAEA,SAAO;AACT;;;;;;;;;;","names":["config"],"sources":["../../src/config/normalize.ts"],"sourcesContent":["import path from 'path';\nimport type { PluginAPI } from '@modern-js/core';\nimport type {\n ModuleUserConfig,\n BaseBuildConfig,\n BuildPreset,\n PartialBuildConfig,\n PartialBaseBuildConfig,\n ModuleContext,\n BuildCommandOptions,\n ModuleTools,\n} from '../types';\n\nexport const transformBuildPresetToBaseConfigs = async (\n options: {\n context: ModuleContext;\n buildCmdOptions: BuildCommandOptions;\n },\n preset?: BuildPreset,\n): Promise<BaseBuildConfig[]> => {\n const { BuildInPreset, presetList } = await import(\n '../constants/build-presets'\n );\n const { addInputToPreset } = await import('../utils/input');\n\n if (typeof preset === 'function') {\n const partialBuildConfig = await preset({ preset: BuildInPreset });\n\n if (!partialBuildConfig) {\n throw new Error(\n 'The `buildPreset` function does not allow no return value',\n );\n }\n\n return transformBuildConfigToBaseConfigs(partialBuildConfig, options);\n }\n\n const inPresetList = (p: string): p is keyof typeof presetList =>\n p in presetList;\n\n if (preset && inPresetList(preset)) {\n return transformBuildConfigToBaseConfigs(\n await addInputToPreset(presetList[preset], options.context),\n options,\n );\n }\n\n // buildConfig and buildPreset is undefined\n return transformBuildConfigToBaseConfigs(\n await addInputToPreset(presetList['base-config'], options.context),\n options,\n );\n};\n\nexport const transformBuildConfigToBaseConfigs = async (\n config: PartialBuildConfig,\n options: {\n buildCmdOptions: BuildCommandOptions;\n context: ModuleContext;\n },\n): Promise<BaseBuildConfig[]> => {\n const { validPartialBuildConfig } = await import('../utils/config');\n validPartialBuildConfig(config);\n const { buildCmdOptions } = options;\n const { ensureArray } = await import('@modern-js/utils');\n const { assignTsConfigPath } = await import('../utils/dts');\n const partialConfigs = ensureArray(config);\n const configs = await Promise.all(\n partialConfigs.map(async config => {\n let newConfig = await requiredBuildConfig(config, options.context);\n newConfig = await assignTsConfigPath(newConfig, buildCmdOptions);\n newConfig = await transformToAbsPath(newConfig, options);\n return newConfig;\n }),\n );\n return configs;\n};\n\nexport const requiredBuildConfig = async (\n partialBuildConfig: PartialBaseBuildConfig,\n context: ModuleContext,\n): Promise<BaseBuildConfig> => {\n const { mergeDefaultBaseConfig } = await import('../utils/config');\n const mergedConfig = await mergeDefaultBaseConfig(\n partialBuildConfig,\n context,\n );\n return mergedConfig;\n};\n\nexport const transformToAbsPath = async (\n baseConfig: BaseBuildConfig,\n options: { context: ModuleContext; buildCmdOptions: BuildCommandOptions },\n) => {\n const { slash } = await import('@modern-js/utils');\n const newConfig = baseConfig;\n const { normalizeInput } = await import('../utils/input');\n const { context } = options;\n\n newConfig.outdir = path.isAbsolute(newConfig.outdir)\n ? newConfig.outdir\n : path.join(context.appDirectory, newConfig.outdir);\n\n newConfig.sourceDir = slash(\n path.resolve(context.appDirectory, baseConfig.sourceDir),\n );\n newConfig.input = await normalizeInput(newConfig, {\n appDirectory: context.appDirectory,\n });\n\n // dts path\n if (newConfig.dts) {\n newConfig.dts.distPath = path.join(\n newConfig.outdir,\n newConfig.dts.distPath,\n );\n newConfig.dts.tsconfigPath = path.join(\n context.appDirectory,\n newConfig.dts.tsconfigPath,\n );\n }\n\n // Maybe need transform 'config.copy'\n\n return newConfig;\n};\n\nexport const checkConfig = async (config: ModuleUserConfig) => {\n const { buildConfig, buildPreset } = config;\n if (buildConfig && buildPreset) {\n const { logger } = await import('@modern-js/utils');\n logger.warn(\n `因为同时出现 'buildConfig' 和 'buildPreset' 配置,因此仅 'buildConfig' 配置生效`,\n );\n }\n};\n\nexport const normalizeBuildConfig = async (\n api: PluginAPI<ModuleTools>,\n context: ModuleContext,\n buildCmdOptions: BuildCommandOptions,\n): Promise<BaseBuildConfig[]> => {\n const config = api.useResolvedConfigContext() as unknown as ModuleUserConfig;\n const { buildConfig, buildPreset } = config;\n\n await checkConfig(config);\n\n let baseConfigs: BaseBuildConfig[];\n\n // buildConfig High priority\n if (buildConfig) {\n baseConfigs = await transformBuildConfigToBaseConfigs(buildConfig, {\n buildCmdOptions,\n context,\n });\n } else {\n baseConfigs = await transformBuildPresetToBaseConfigs(\n {\n context,\n buildCmdOptions,\n },\n buildPreset,\n );\n }\n\n return baseConfigs;\n};\n"]}
|
package/dist/config/schema.js
CHANGED
|
@@ -15,15 +15,15 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
15
15
|
return to;
|
|
16
16
|
};
|
|
17
17
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
-
var
|
|
19
|
-
__export(
|
|
18
|
+
var schema_exports = {};
|
|
19
|
+
__export(schema_exports, {
|
|
20
20
|
buildConfig: () => buildConfig,
|
|
21
21
|
buildPreset: () => buildPreset,
|
|
22
22
|
presets: () => presets,
|
|
23
23
|
schema: () => schema,
|
|
24
24
|
targets: () => targets
|
|
25
25
|
});
|
|
26
|
-
module.exports = __toCommonJS(
|
|
26
|
+
module.exports = __toCommonJS(schema_exports);
|
|
27
27
|
const targets = [
|
|
28
28
|
"es5",
|
|
29
29
|
"es6",
|
|
@@ -203,5 +203,13 @@ const buildPreset = {
|
|
|
203
203
|
}
|
|
204
204
|
};
|
|
205
205
|
const schema = [buildConfig, buildPreset];
|
|
206
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
207
|
+
0 && (module.exports = {
|
|
208
|
+
buildConfig,
|
|
209
|
+
buildPreset,
|
|
210
|
+
presets,
|
|
211
|
+
schema,
|
|
212
|
+
targets
|
|
213
|
+
});
|
|
206
214
|
|
|
207
215
|
//# sourceMappingURL=schema.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"mappings":";;;;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"mappings":";;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAO,MAAM,UAAU;AAAA,EACrB;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EAEA;AACF;AAEO,MAAM,UAAU;AAAA,EACrB;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,GAAG;AAAA,IACD;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF,EAAE,OAAiB,CAAC,KAAK,QAAQ;AAC/B,WAAO,CAAC,GAAG,KAAK,GAAG,QAAQ,IAAI,OAAK,GAAG,OAAO,GAAG,CAAC;AAAA,EACpD,GAAG,CAAC,CAAC;AACP;AACA,MAAM,wBAAwB;AAAA,EAC5B,OAAO;AAAA,IACL,QAAQ,CAAC,UAAU,UAAU;AAAA,EAC/B;AAAA,EACA,OAAO;AAAA,IACL,MAAM;AAAA,EACR;AAAA,EACA,cAAc;AAAA,IACZ,IAAI;AAAA,MACF,MAAM;AAAA,IACR;AAAA,IACA,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,MAAM,EAAE,QAAQ,WAAW;AAAA,EAC7B;AACF;AAEO,MAAM,SAAS,CAAC,aAAa,WAAW;","names":[],"sources":["../../src/config/schema.ts"],"sourcesContent":["export const targets = [\n 'es5',\n 'es6',\n 'es2015',\n 'es2016',\n 'es2017',\n 'es2018',\n 'es2019',\n 'es2020',\n 'es2021',\n 'es2022',\n // The default target is esnext which means that by default, assume all of the latest JavaScript and CSS features are supported.\n 'esnext',\n];\n\nexport const presets = [\n 'npm-library',\n 'npm-library-with-umd',\n 'npm-component',\n 'npm-component-with-umd',\n ...[\n 'npm-library',\n 'npm-library-with-umd',\n 'npm-component',\n 'npm-component-with-umd',\n ].reduce<string[]>((ret, crt) => {\n return [...ret, ...targets.map(t => `${crt}-${t}`)];\n }, []),\n];\nconst buildConfigProperties = {\n alias: {\n typeof: ['object', 'function'],\n },\n asset: {\n type: 'object',\n },\n autoExternal: {\n if: {\n type: 'object',\n },\n then: {\n properties: {\n dependencies: { type: 'boolean' },\n peerDependencies: { type: 'boolean' },\n },\n },\n else: { type: 'boolean' },\n },\n buildType: {\n enum: ['bundle', 'bundleless'],\n },\n copy: {\n type: 'object',\n properties: {\n patterns: {\n type: 'array',\n items: {\n type: 'object',\n properties: {\n from: { type: 'string' },\n to: { type: 'string' },\n context: { type: 'string' },\n globOptions: { type: 'object' },\n },\n },\n },\n options: {\n type: 'object',\n properties: {\n concurrency: {\n type: 'number',\n },\n },\n },\n },\n },\n define: {\n typeof: 'object',\n },\n dts: {\n if: { type: 'object' },\n then: {\n properties: {\n distPath: { type: 'string' },\n tsconfigPath: { type: 'string' },\n },\n },\n else: { type: 'boolean' },\n },\n externals: {\n type: 'array',\n items: {\n anyOf: [\n {\n instanceof: 'RegExp',\n },\n {\n typeof: 'string',\n },\n ],\n },\n },\n format: {\n enum: ['cjs', 'esm', 'iife', 'umd'],\n },\n input: {\n type: ['array', 'object'],\n },\n jsx: {\n enum: ['automatic', 'transform'],\n },\n minify: {\n if: {\n type: 'object',\n },\n else: { enum: ['esbuild', 'terser', false] },\n },\n outdir: { type: 'string' },\n platform: {\n enum: ['node', 'browser'],\n },\n sourceDir: {\n typeof: 'string',\n },\n sourceMap: {\n enum: [true, false, 'inline', 'external'],\n },\n splitting: {\n type: 'boolean',\n },\n style: {\n // TODO: add properties\n type: 'object',\n },\n target: {\n enum: targets,\n },\n umdGlobals: {\n type: 'object',\n },\n umdModuleName: {\n anyOf: [\n {\n instanceof: 'Function',\n },\n {\n typeof: 'string',\n },\n ],\n },\n};\nexport const buildConfig = {\n target: 'buildConfig',\n schema: {\n if: {\n type: 'array',\n },\n then: {\n items: [\n {\n type: 'object',\n properties: buildConfigProperties,\n },\n ],\n },\n else: {\n type: 'object',\n properties: buildConfigProperties,\n },\n },\n};\nexport const buildPreset = {\n target: 'buildPreset',\n schema: {\n if: { type: 'string' },\n then: {\n enum: presets,\n },\n else: { typeof: 'function' },\n },\n};\n\nexport const schema = [buildConfig, buildPreset];\n"]}
|
|
@@ -1,7 +1,24 @@
|
|
|
1
1
|
var __defProp = Object.defineProperty;
|
|
2
|
+
var __defProps = Object.defineProperties;
|
|
2
3
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
3
5
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
4
7
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
9
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
10
|
+
var __spreadValues = (a, b) => {
|
|
11
|
+
for (var prop in b || (b = {}))
|
|
12
|
+
if (__hasOwnProp.call(b, prop))
|
|
13
|
+
__defNormalProp(a, prop, b[prop]);
|
|
14
|
+
if (__getOwnPropSymbols)
|
|
15
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
|
16
|
+
if (__propIsEnum.call(b, prop))
|
|
17
|
+
__defNormalProp(a, prop, b[prop]);
|
|
18
|
+
}
|
|
19
|
+
return a;
|
|
20
|
+
};
|
|
21
|
+
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
5
22
|
var __export = (target, all) => {
|
|
6
23
|
for (var name in all)
|
|
7
24
|
__defProp(target, name, { get: all[name], enumerable: true });
|
|
@@ -15,8 +32,8 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
15
32
|
return to;
|
|
16
33
|
};
|
|
17
34
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
-
var
|
|
19
|
-
__export(
|
|
35
|
+
var build_presets_exports = {};
|
|
36
|
+
__export(build_presets_exports, {
|
|
20
37
|
BuildInPreset: () => BuildInPreset,
|
|
21
38
|
basePresetConfig: () => basePresetConfig,
|
|
22
39
|
componentPreset: () => componentPreset,
|
|
@@ -34,26 +51,7 @@ __export(stdin_exports, {
|
|
|
34
51
|
presetList: () => presetList,
|
|
35
52
|
targets: () => targets
|
|
36
53
|
});
|
|
37
|
-
module.exports = __toCommonJS(
|
|
38
|
-
var __defProp2 = Object.defineProperty;
|
|
39
|
-
var __defProps = Object.defineProperties;
|
|
40
|
-
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
41
|
-
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
42
|
-
var __hasOwnProp2 = Object.prototype.hasOwnProperty;
|
|
43
|
-
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
44
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp2(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
45
|
-
var __spreadValues = (a, b) => {
|
|
46
|
-
for (var prop in b || (b = {}))
|
|
47
|
-
if (__hasOwnProp2.call(b, prop))
|
|
48
|
-
__defNormalProp(a, prop, b[prop]);
|
|
49
|
-
if (__getOwnPropSymbols)
|
|
50
|
-
for (var prop of __getOwnPropSymbols(b)) {
|
|
51
|
-
if (__propIsEnum.call(b, prop))
|
|
52
|
-
__defNormalProp(a, prop, b[prop]);
|
|
53
|
-
}
|
|
54
|
-
return a;
|
|
55
|
-
};
|
|
56
|
-
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
54
|
+
module.exports = __toCommonJS(build_presets_exports);
|
|
57
55
|
const targets = [
|
|
58
56
|
"es5",
|
|
59
57
|
"es6",
|
|
@@ -215,5 +213,24 @@ const BuildInPreset = {
|
|
|
215
213
|
NPM_COMPONENT: npmComponentPresetConfig,
|
|
216
214
|
NPM_COMPONENT_WITH_UMD: npmComponentWithUmdPresetConfig
|
|
217
215
|
};
|
|
216
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
217
|
+
0 && (module.exports = {
|
|
218
|
+
BuildInPreset,
|
|
219
|
+
basePresetConfig,
|
|
220
|
+
componentPreset,
|
|
221
|
+
componentPresetWithTarget,
|
|
222
|
+
componentUmdPreset,
|
|
223
|
+
componentUmdPresetWithTarget,
|
|
224
|
+
libraryPreset,
|
|
225
|
+
libraryPresetWithTarget,
|
|
226
|
+
libraryUmdPreset,
|
|
227
|
+
libraryUmdPresetWithTarget,
|
|
228
|
+
npmComponentPresetConfig,
|
|
229
|
+
npmComponentWithUmdPresetConfig,
|
|
230
|
+
npmLibraryPresetConfig,
|
|
231
|
+
npmLibraryWithUmdPresetConfig,
|
|
232
|
+
presetList,
|
|
233
|
+
targets
|
|
234
|
+
});
|
|
218
235
|
|
|
219
236
|
//# sourceMappingURL=build-presets.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"mappings":"
|
|
1
|
+
{"version":3,"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAA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AAAA,IAChE,YAAU;AACR,aAAO,iCAAK,SAAL,EAAa,OAAO;AAAA,IAC7B;AAAA,EACF;AACA,SAAO;AACT,GAAG,CAAC,CAA0D;AAEvD,MAAM,qBAAqB;AAAA,EAChC,0BAA0B;AAC5B;AACO,MAAM,+BAA+B,QAAQ,OAAO,CAAC,KAAK,WAAW;AAC1E,MAAI,0BAA0B,YAAY,mBACxC,0BACA,IAAI,YAAU;AACd,WAAO,iCAAK,SAAL,EAAa,OAAO;AAAA,EAC7B,CAAC;AACD,SAAO;AACT,GAAG,CAAC,CAAmE;AAEhE,MAAM,aAAa;AAAA,EACxB,eAAe;AAAA,GACZ,gBACA,0BACA,mBACA,6BACA,kBACA,4BACA,qBACA;AAGE,MAAM,gBAAgB;AAAA,EAC3B,aAAa;AAAA,EACb,aAAa;AAAA,EACb,sBAAsB;AAAA,EACtB,eAAe;AAAA,EACf,wBAAwB;AAC1B;","names":[],"sources":["../../src/constants/build-presets.ts"],"sourcesContent":["import type {\n PartialBuildConfig,\n PartialBaseBuildConfig,\n Target,\n} from '../types';\n\nexport const targets: Target[] = [\n 'es5',\n 'es6',\n 'es2015',\n 'es2016',\n 'es2017',\n 'es2018',\n 'es2019',\n 'es2020',\n 'es2021',\n 'es2022',\n 'esnext',\n];\n\nexport const basePresetConfig: PartialBuildConfig = {\n format: 'esm',\n target: 'es6',\n buildType: 'bundle',\n outdir: './dist',\n dts: { distPath: './types' },\n};\n\nexport const npmLibraryPresetConfig: PartialBaseBuildConfig[] = [\n {\n format: 'cjs',\n target: 'es6',\n buildType: 'bundle',\n outdir: './dist/lib',\n dts: false,\n },\n {\n format: 'esm',\n target: 'es6',\n buildType: 'bundle',\n outdir: './dist/es',\n dts: false,\n },\n {\n buildType: 'bundle',\n dts: { only: true, distPath: './types' },\n },\n];\nexport const npmLibraryWithUmdPresetConfig: PartialBaseBuildConfig[] = [\n {\n format: 'cjs',\n target: 'es6',\n buildType: 'bundle',\n outdir: './dist/lib',\n dts: false,\n },\n {\n format: 'esm',\n target: 'es6',\n buildType: 'bundle',\n outdir: './dist/es',\n dts: false,\n },\n {\n format: 'umd',\n target: 'es6',\n buildType: 'bundle',\n outdir: './dist/umd',\n dts: false,\n },\n {\n buildType: 'bundle',\n dts: { only: true, distPath: './types' },\n },\n];\nexport const npmComponentPresetConfig: PartialBaseBuildConfig[] = [\n {\n format: 'cjs',\n target: 'es6',\n buildType: 'bundleless',\n outdir: './dist/lib',\n dts: false,\n },\n {\n format: 'esm',\n target: 'es6',\n buildType: 'bundleless',\n outdir: './dist/es',\n dts: false,\n },\n {\n buildType: 'bundleless',\n outdir: './dist/types',\n dts: { only: true },\n },\n];\nexport const npmComponentWithUmdPresetConfig: PartialBaseBuildConfig[] = [\n {\n format: 'cjs',\n target: 'es6',\n buildType: 'bundleless',\n outdir: './dist/lib',\n dts: false,\n },\n {\n format: 'esm',\n target: 'es6',\n buildType: 'bundleless',\n outdir: './dist/es',\n dts: false,\n },\n {\n format: 'umd',\n target: 'es6',\n buildType: 'bundle',\n outdir: './dist/umd',\n dts: false,\n },\n {\n buildType: 'bundleless',\n dts: { only: true, distPath: './types' },\n },\n];\n\nexport const libraryPreset = { 'npm-library': npmLibraryPresetConfig };\n\nexport const libraryPresetWithTarget = targets.reduce((ret, target) => {\n ret[`npm-library-${target}`] = libraryPreset['npm-library'].map(config => {\n return { ...config, target };\n });\n return ret;\n}, {} as Record<`npm-library-${Target}`, PartialBuildConfig>);\n\nexport const libraryUmdPreset = {\n 'npm-library-with-umd': npmLibraryWithUmdPresetConfig,\n};\nexport const libraryUmdPresetWithTarget = targets.reduce((ret, target) => {\n ret[`npm-library-with-umd-${target}`] = libraryUmdPreset[\n 'npm-library-with-umd'\n ].map(config => {\n return { ...config, target };\n });\n return ret;\n}, {} as Record<`npm-library-with-umd-${Target}`, PartialBuildConfig>);\n\nexport const componentPreset = {\n 'npm-component': npmComponentPresetConfig,\n};\nexport const componentPresetWithTarget = targets.reduce((ret, target) => {\n ret[`npm-component-${target}`] = componentPreset['npm-component'].map(\n config => {\n return { ...config, target };\n },\n );\n return ret;\n}, {} as Record<`npm-component-${Target}`, PartialBuildConfig>);\n\nexport const componentUmdPreset = {\n 'npm-component-with-umd': npmComponentWithUmdPresetConfig,\n};\nexport const componentUmdPresetWithTarget = targets.reduce((ret, target) => {\n ret[`npm-component-with-umd-${target}`] = componentUmdPreset[\n 'npm-component-with-umd'\n ].map(config => {\n return { ...config, target };\n });\n return ret;\n}, {} as Record<`npm-component-with-umd-${Target}`, PartialBuildConfig>);\n\nexport const presetList = {\n 'base-config': basePresetConfig,\n ...libraryPreset,\n ...libraryPresetWithTarget,\n ...libraryUmdPreset,\n ...libraryUmdPresetWithTarget,\n ...componentPreset,\n ...componentPresetWithTarget,\n ...componentUmdPreset,\n ...componentUmdPresetWithTarget,\n};\n\nexport const BuildInPreset = {\n BASE_CONFIG: basePresetConfig,\n NPM_LIBRARY: npmLibraryPresetConfig,\n NPM_LIBRARY_WITH_UMD: npmLibraryWithUmdPresetConfig,\n NPM_COMPONENT: npmComponentPresetConfig,\n NPM_COMPONENT_WITH_UMD: npmComponentWithUmdPresetConfig,\n};\n"]}
|