@modern-js/module-tools 2.15.0 → 2.16.0-beta.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/compiled/postcss-custom-properties/index.js +1 -1
- package/compiled/postcss-custom-properties/package.json +1 -1
- package/dist/build.js +23 -66
- package/dist/build.js.map +1 -1
- package/dist/builder/build.js +114 -170
- package/dist/builder/build.js.map +1 -1
- package/dist/builder/clear.js +23 -65
- package/dist/builder/clear.js.map +1 -1
- package/dist/builder/copy.js +83 -164
- package/dist/builder/copy.js.map +1 -1
- package/dist/builder/dts/index.js +15 -28
- package/dist/builder/dts/index.js.map +1 -1
- package/dist/builder/dts/rollup.js +46 -120
- package/dist/builder/dts/rollup.js.map +1 -1
- package/dist/builder/dts/tsc.js +82 -141
- package/dist/builder/dts/tsc.js.map +1 -1
- package/dist/builder/index.js +34 -85
- package/dist/builder/index.js.map +1 -1
- package/dist/builder/platform.js +40 -93
- package/dist/builder/platform.js.map +1 -1
- package/dist/cli.js +35 -84
- package/dist/cli.js.map +1 -1
- package/dist/command.js +56 -136
- package/dist/command.js.map +1 -1
- package/dist/config/defineConfig.js +13 -42
- package/dist/config/defineConfig.js.map +1 -1
- package/dist/config/legacySchema.js +96 -52
- package/dist/config/legacySchema.js.map +1 -1
- package/dist/config/normalize.js +73 -149
- package/dist/config/normalize.js.map +1 -1
- package/dist/config/schema.d.ts +36 -0
- package/dist/config/schema.js +118 -56
- package/dist/config/schema.js.map +1 -1
- package/dist/config/transformLegacyConfig.js +152 -203
- package/dist/config/transformLegacyConfig.js.map +1 -1
- package/dist/constants/build.js +15 -27
- package/dist/constants/build.js.map +1 -1
- package/dist/constants/buildPresets.js +71 -84
- package/dist/constants/buildPresets.js.map +1 -1
- package/dist/constants/colors.js +28 -30
- package/dist/constants/colors.js.map +1 -1
- package/dist/constants/dts.js +13 -28
- package/dist/constants/dts.js.map +1 -1
- package/dist/constants/file.js +27 -30
- package/dist/constants/file.js.map +1 -1
- package/dist/constants/legacyBuildPresets.js +33 -49
- package/dist/constants/legacyBuildPresets.js.map +1 -1
- package/dist/constants/log.js +15 -33
- package/dist/constants/log.js.map +1 -1
- package/dist/dev.js +45 -91
- package/dist/dev.js.map +1 -1
- package/dist/error.js +37 -54
- package/dist/error.js.map +1 -1
- package/dist/hooks/build.js +22 -35
- package/dist/hooks/build.js.map +1 -1
- package/dist/hooks/dev.js +15 -33
- package/dist/hooks/dev.js.map +1 -1
- package/dist/hooks/index.js +15 -42
- package/dist/hooks/index.js.map +1 -1
- package/dist/hooks/misc.js +10 -28
- package/dist/hooks/misc.js.map +1 -1
- package/dist/index.js +21 -35
- package/dist/index.js.map +1 -1
- package/dist/locale/en.d.ts +7 -2
- package/dist/locale/en.js +25 -32
- package/dist/locale/en.js.map +1 -1
- package/dist/locale/index.d.ts +14 -4
- package/dist/locale/index.js +18 -31
- package/dist/locale/index.js.map +1 -1
- package/dist/locale/zh.d.ts +7 -2
- package/dist/locale/zh.js +25 -32
- package/dist/locale/zh.js.map +1 -1
- package/dist/plugins.js +16 -39
- package/dist/plugins.js.map +1 -1
- package/dist/types/color.js +4 -15
- package/dist/types/color.js.map +1 -1
- package/dist/types/command.js +4 -15
- package/dist/types/command.js.map +1 -1
- package/dist/types/config/index.d.ts +6 -0
- package/dist/types/config/index.js +6 -17
- package/dist/types/config/index.js.map +1 -1
- package/dist/types/config/style.js +4 -15
- package/dist/types/config/style.js.map +1 -1
- package/dist/types/context.js +4 -15
- package/dist/types/context.js.map +1 -1
- package/dist/types/copy.js +4 -15
- package/dist/types/copy.js.map +1 -1
- package/dist/types/dts.js +4 -15
- package/dist/types/dts.js.map +1 -1
- package/dist/types/hooks.js +4 -15
- package/dist/types/hooks.js.map +1 -1
- package/dist/types/index.js +11 -22
- package/dist/types/index.js.map +1 -1
- package/dist/types/legacyConfig/index.js +4 -15
- package/dist/types/legacyConfig/index.js.map +1 -1
- package/dist/types/legacyConfig/output.js +4 -15
- package/dist/types/legacyConfig/output.js.map +1 -1
- package/dist/types/legacyConfig/source.js +4 -15
- package/dist/types/legacyConfig/source.js.map +1 -1
- package/dist/types/legacyConfig/tools.js +4 -15
- package/dist/types/legacyConfig/tools.js.map +1 -1
- package/dist/types/utils.js +4 -17
- package/dist/utils/builder.d.ts +20 -2
- package/dist/utils/builder.js +81 -68
- package/dist/utils/builder.js.map +1 -1
- package/dist/utils/common.js +10 -44
- package/dist/utils/common.js.map +1 -1
- package/dist/utils/config.js +108 -144
- package/dist/utils/config.js.map +1 -1
- package/dist/utils/context.js +16 -59
- package/dist/utils/context.js.map +1 -1
- package/dist/utils/dts.js +69 -146
- package/dist/utils/dts.js.map +1 -1
- package/dist/utils/input.js +44 -87
- package/dist/utils/input.js.map +1 -1
- package/dist/utils/language.js +15 -60
- package/dist/utils/language.js.map +1 -1
- package/dist/utils/libuildPlugins.js +27 -67
- package/dist/utils/libuildPlugins.js.map +1 -1
- package/dist/utils/log.js +14 -61
- package/dist/utils/log.js.map +1 -1
- package/dist/utils/onExit.js +14 -61
- package/dist/utils/onExit.js.map +1 -1
- package/dist/utils/path.js +13 -59
- package/dist/utils/path.js.map +1 -1
- package/dist/utils/print.js +57 -105
- package/dist/utils/print.js.map +1 -1
- package/dist/utils/style.js +54 -106
- package/dist/utils/style.js.map +1 -1
- package/dist/utils/tspathsTransform.js +44 -81
- package/dist/utils/tspathsTransform.js.map +1 -1
- package/package.json +11 -10
- package/scripts/debug-mode.js +23 -21
- package/dist/types/utils.js.map +0 -1
package/dist/command.js
CHANGED
|
@@ -1,154 +1,74 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
7
|
-
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
8
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
9
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
10
|
-
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
11
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
12
|
-
var __spreadValues = (a, b) => {
|
|
13
|
-
for (var prop in b || (b = {}))
|
|
14
|
-
if (__hasOwnProp.call(b, prop))
|
|
15
|
-
__defNormalProp(a, prop, b[prop]);
|
|
16
|
-
if (__getOwnPropSymbols)
|
|
17
|
-
for (var prop of __getOwnPropSymbols(b)) {
|
|
18
|
-
if (__propIsEnum.call(b, prop))
|
|
19
|
-
__defNormalProp(a, prop, b[prop]);
|
|
20
|
-
}
|
|
21
|
-
return a;
|
|
22
|
-
};
|
|
23
|
-
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
24
|
-
var __export = (target, all) => {
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
function _export(target, all) {
|
|
25
6
|
for (var name in all)
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
33
|
-
}
|
|
34
|
-
return to;
|
|
35
|
-
};
|
|
36
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
37
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
38
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
39
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
40
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
41
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
42
|
-
mod
|
|
43
|
-
));
|
|
44
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
45
|
-
var __async = (__this, __arguments, generator) => {
|
|
46
|
-
return new Promise((resolve, reject) => {
|
|
47
|
-
var fulfilled = (value) => {
|
|
48
|
-
try {
|
|
49
|
-
step(generator.next(value));
|
|
50
|
-
} catch (e) {
|
|
51
|
-
reject(e);
|
|
52
|
-
}
|
|
53
|
-
};
|
|
54
|
-
var rejected = (value) => {
|
|
55
|
-
try {
|
|
56
|
-
step(generator.throw(value));
|
|
57
|
-
} catch (e) {
|
|
58
|
-
reject(e);
|
|
59
|
-
}
|
|
60
|
-
};
|
|
61
|
-
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
|
|
62
|
-
step((generator = generator.apply(__this, __arguments)).next());
|
|
63
|
-
});
|
|
64
|
-
};
|
|
65
|
-
var command_exports = {};
|
|
66
|
-
__export(command_exports, {
|
|
7
|
+
Object.defineProperty(target, name, {
|
|
8
|
+
enumerable: true,
|
|
9
|
+
get: all[name]
|
|
10
|
+
});
|
|
11
|
+
}
|
|
12
|
+
_export(exports, {
|
|
67
13
|
buildCommand: () => buildCommand,
|
|
68
14
|
devCommand: () => devCommand,
|
|
69
15
|
newCommand: () => newCommand,
|
|
70
16
|
upgradCommand: () => upgradCommand
|
|
71
17
|
});
|
|
72
|
-
|
|
73
|
-
const buildCommand = (program, api) =>
|
|
74
|
-
const local =
|
|
75
|
-
const { defaultTsConfigPath } =
|
|
76
|
-
program.command("build").usage("[options]").description(local.i18n.t(local.localeKeys.command.build.describe)).option("-w, --watch", local.i18n.t(local.localeKeys.command.build.watch)).option(
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
).action((options) => __async(void 0, null, function* () {
|
|
87
|
-
const { initModuleContext } = yield Promise.resolve().then(() => __toESM(require("./utils/context")));
|
|
88
|
-
const context = yield initModuleContext(api);
|
|
89
|
-
const { build } = yield Promise.resolve().then(() => __toESM(require("./build")));
|
|
90
|
-
yield build(api, options, context);
|
|
91
|
-
}));
|
|
92
|
-
});
|
|
93
|
-
const devCommand = (program, api) => __async(void 0, null, function* () {
|
|
94
|
-
const local = yield Promise.resolve().then(() => __toESM(require("./locale")));
|
|
95
|
-
const { defaultTsConfigPath } = yield Promise.resolve().then(() => __toESM(require("./constants/dts")));
|
|
18
|
+
const _interop_require_wildcard = require("@swc/helpers/_/_interop_require_wildcard");
|
|
19
|
+
const buildCommand = async (program, api) => {
|
|
20
|
+
const local = await Promise.resolve().then(() => /* @__PURE__ */ _interop_require_wildcard._(require("./locale")));
|
|
21
|
+
const { defaultTsConfigPath } = await Promise.resolve().then(() => /* @__PURE__ */ _interop_require_wildcard._(require("./constants/dts")));
|
|
22
|
+
program.command("build").usage("[options]").description(local.i18n.t(local.localeKeys.command.build.describe)).option("-w, --watch", local.i18n.t(local.localeKeys.command.build.watch)).option("--tsconfig [tsconfig]", local.i18n.t(local.localeKeys.command.build.tsconfig), defaultTsConfigPath).option("-p, --platform [platform...]", local.i18n.t(local.localeKeys.command.build.platform)).option("--no-dts", local.i18n.t(local.localeKeys.command.build.dts)).option("--no-clear", local.i18n.t(local.localeKeys.command.build.noClear)).option("-c --config <config>", local.i18n.t(local.localeKeys.command.build.config)).action(async (options) => {
|
|
23
|
+
const { initModuleContext } = await Promise.resolve().then(() => /* @__PURE__ */ _interop_require_wildcard._(require("./utils/context")));
|
|
24
|
+
const context = await initModuleContext(api);
|
|
25
|
+
const { build } = await Promise.resolve().then(() => /* @__PURE__ */ _interop_require_wildcard._(require("./build")));
|
|
26
|
+
await build(api, options, context);
|
|
27
|
+
});
|
|
28
|
+
};
|
|
29
|
+
const devCommand = async (program, api) => {
|
|
30
|
+
const local = await Promise.resolve().then(() => /* @__PURE__ */ _interop_require_wildcard._(require("./locale")));
|
|
31
|
+
const { defaultTsConfigPath } = await Promise.resolve().then(() => /* @__PURE__ */ _interop_require_wildcard._(require("./constants/dts")));
|
|
96
32
|
const runner = api.useHookRunners();
|
|
97
|
-
const devToolMetas =
|
|
98
|
-
|
|
99
|
-
const devProgram = program.command("dev").usage("[options]").description(local.i18n.t(local.localeKeys.command.dev.describe)).option(
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
const context = yield initModuleContext(api);
|
|
106
|
-
const { dev } = yield Promise.resolve().then(() => __toESM(require("./dev")));
|
|
107
|
-
yield dev(options, devToolMetas, api, context);
|
|
108
|
-
}));
|
|
33
|
+
const devToolMetas = await runner.registerDev();
|
|
34
|
+
await runner.beforeDev(devToolMetas);
|
|
35
|
+
const devProgram = program.command("dev").usage("[options]").description(local.i18n.t(local.localeKeys.command.dev.describe)).option("--tsconfig [tsconfig]", local.i18n.t(local.localeKeys.command.dev.tsconfig), defaultTsConfigPath).action(async (options) => {
|
|
36
|
+
const { initModuleContext } = await Promise.resolve().then(() => /* @__PURE__ */ _interop_require_wildcard._(require("./utils/context")));
|
|
37
|
+
const context = await initModuleContext(api);
|
|
38
|
+
const { dev } = await Promise.resolve().then(() => /* @__PURE__ */ _interop_require_wildcard._(require("./dev")));
|
|
39
|
+
await dev(options, devToolMetas, api, context);
|
|
40
|
+
});
|
|
109
41
|
for (const meta of devToolMetas) {
|
|
110
42
|
if (!meta.subCommands) {
|
|
111
43
|
continue;
|
|
112
44
|
}
|
|
113
45
|
for (const subCmd of meta.subCommands) {
|
|
114
|
-
devProgram.command(subCmd).action((options) =>
|
|
115
|
-
const { initModuleContext } =
|
|
116
|
-
const context =
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
46
|
+
devProgram.command(subCmd).action(async (options) => {
|
|
47
|
+
const { initModuleContext } = await Promise.resolve().then(() => /* @__PURE__ */ _interop_require_wildcard._(require("./utils/context")));
|
|
48
|
+
const context = await initModuleContext(api);
|
|
49
|
+
await runner.beforeDevTask(meta);
|
|
50
|
+
await meta.action(options, {
|
|
51
|
+
isTsProject: context.isTsProject
|
|
52
|
+
});
|
|
53
|
+
});
|
|
120
54
|
}
|
|
121
55
|
}
|
|
122
|
-
}
|
|
123
|
-
const newCommand = (program) =>
|
|
124
|
-
const local =
|
|
125
|
-
program.command("new").usage("[options]").description(local.i18n.t(local.localeKeys.command.new.describe)).option(
|
|
126
|
-
"-
|
|
127
|
-
|
|
128
|
-
false
|
|
129
|
-
).option(
|
|
130
|
-
"-c, --config <config>",
|
|
131
|
-
local.i18n.t(local.localeKeys.command.new.config)
|
|
132
|
-
).option(
|
|
133
|
-
"--dist-tag <tag>",
|
|
134
|
-
local.i18n.t(local.localeKeys.command.new.distTag)
|
|
135
|
-
).option("--lang <lang>", local.i18n.t(local.localeKeys.command.new.lang)).option("--registry", local.i18n.t(local.localeKeys.command.new.registry)).action((options) => __async(void 0, null, function* () {
|
|
136
|
-
const { ModuleNewAction } = yield Promise.resolve().then(() => __toESM(require("@modern-js/new-action")));
|
|
137
|
-
const { getLocaleLanguage } = yield Promise.resolve().then(() => __toESM(require("@modern-js/plugin-i18n/language-detector")));
|
|
56
|
+
};
|
|
57
|
+
const newCommand = async (program) => {
|
|
58
|
+
const local = await Promise.resolve().then(() => /* @__PURE__ */ _interop_require_wildcard._(require("./locale")));
|
|
59
|
+
program.command("new").usage("[options]").description(local.i18n.t(local.localeKeys.command.new.describe)).option("--lang <lang>", local.i18n.t(local.localeKeys.command.new.lang)).option("-c, --config <config>", local.i18n.t(local.localeKeys.command.new.config)).option("-d, --debug", local.i18n.t(local.localeKeys.command.new.debug), false).option("--dist-tag <tag>", local.i18n.t(local.localeKeys.command.new.distTag)).option("--registry", local.i18n.t(local.localeKeys.command.new.registry)).action(async (options) => {
|
|
60
|
+
const { ModuleNewAction } = await Promise.resolve().then(() => /* @__PURE__ */ _interop_require_wildcard._(require("@modern-js/new-action")));
|
|
61
|
+
const { getLocaleLanguage } = await Promise.resolve().then(() => /* @__PURE__ */ _interop_require_wildcard._(require("@modern-js/plugin-i18n/language-detector")));
|
|
138
62
|
const locale = getLocaleLanguage();
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
63
|
+
await ModuleNewAction({
|
|
64
|
+
...options,
|
|
65
|
+
locale: options.lang || locale
|
|
66
|
+
});
|
|
67
|
+
});
|
|
68
|
+
};
|
|
69
|
+
const upgradCommand = async (program) => {
|
|
70
|
+
const { defineCommand } = await Promise.resolve().then(() => /* @__PURE__ */ _interop_require_wildcard._(require("@modern-js/upgrade")));
|
|
144
71
|
defineCommand(program.command("upgrade"));
|
|
145
|
-
}
|
|
146
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
147
|
-
0 && (module.exports = {
|
|
148
|
-
buildCommand,
|
|
149
|
-
devCommand,
|
|
150
|
-
newCommand,
|
|
151
|
-
upgradCommand
|
|
152
|
-
});
|
|
72
|
+
};
|
|
153
73
|
|
|
154
74
|
//# sourceMappingURL=command.js.map
|
package/dist/command.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":null,"mappings":"
|
|
1
|
+
{"version":3,"file":null,"mappings":"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","names":["buildCommand","devCommand","newCommand","upgradCommand","program","api","local","defaultTsConfigPath","command","usage","description","i18n","t","localeKeys","build","describe","option","watch","tsconfig","platform","dts","noClear","config","action","options","initModuleContext","context","runner","useHookRunners","devToolMetas","registerDev","beforeDev","devProgram","dev","meta","subCommands","subCmd","beforeDevTask","isTsProject","new","lang","debug","distTag","registry","ModuleNewAction","getLocaleLanguage","locale","defineCommand"],"sources":["../src/Users/bytedance/github/targeral/modern-js/packages/solutions/module-tools/src/command.ts"],"sourcesContent":["import type { Command } from '@modern-js/utils';\nimport type { PluginAPI } from '@modern-js/core';\nimport type { ModuleTools } from './types';\nimport type { DevCommandOptions, BuildCommandOptions } from './types/command';\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.noClear))\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 const { build } = await import('./build');\n await build(api, options, context);\n });\n};\n\nexport const devCommand = async (\n program: Command,\n api: PluginAPI<ModuleTools>,\n) => {\n const local = await import('./locale');\n const { defaultTsConfigPath } = await import('./constants/dts');\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 .option(\n '--tsconfig [tsconfig]',\n local.i18n.t(local.localeKeys.command.dev.tsconfig),\n defaultTsConfigPath,\n )\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.command(subCmd).action(async (options: DevCommandOptions) => {\n const { initModuleContext } = await import('./utils/context');\n const context = await initModuleContext(api);\n\n // TODO: watch build\n // const { ensureFirstBuild, watchBuild } = await import('./dev');\n // await ensureFirstBuild(api, context, options, {\n // disableRunBuild: meta.disableRunBuild ?? false,\n // appDirectory: context.appDirectory,\n // });\n\n await runner.beforeDevTask(meta);\n await meta.action(options, { isTsProject: context.isTsProject });\n // TODO: watch build\n // await watchBuild(api, context, options, {\n // disableRunBuild: meta.disableRunBuild ?? false,\n // appDirectory: context.appDirectory,\n // });\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('--lang <lang>', local.i18n.t(local.localeKeys.command.new.lang))\n .option(\n '-c, --config <config>',\n local.i18n.t(local.localeKeys.command.new.config),\n )\n .option(\n '-d, --debug',\n local.i18n.t(local.localeKeys.command.new.debug),\n false,\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(\n '@modern-js/plugin-i18n/language-detector'\n );\n\n const locale = getLocaleLanguage();\n\n await ModuleNewAction({ ...options, locale: options.lang || 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"]}
|
|
@@ -1,52 +1,23 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
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));
|
|
22
|
-
var __export = (target, all) => {
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
function _export(target, all) {
|
|
23
6
|
for (var name in all)
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
31
|
-
}
|
|
32
|
-
return to;
|
|
33
|
-
};
|
|
34
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
35
|
-
var defineConfig_exports = {};
|
|
36
|
-
__export(defineConfig_exports, {
|
|
7
|
+
Object.defineProperty(target, name, {
|
|
8
|
+
enumerable: true,
|
|
9
|
+
get: all[name]
|
|
10
|
+
});
|
|
11
|
+
}
|
|
12
|
+
_export(exports, {
|
|
37
13
|
defineConfig: () => defineConfig,
|
|
38
14
|
defineLegacyConfig: () => defineLegacyConfig
|
|
39
15
|
});
|
|
40
|
-
module.exports = __toCommonJS(defineConfig_exports);
|
|
41
16
|
const defineConfig = (config) => config;
|
|
42
|
-
const defineLegacyConfig = (config) =>
|
|
17
|
+
const defineLegacyConfig = (config) => ({
|
|
18
|
+
...config,
|
|
43
19
|
legacy: true,
|
|
44
20
|
autoLoadPlugins: true
|
|
45
21
|
});
|
|
46
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
47
|
-
0 && (module.exports = {
|
|
48
|
-
defineConfig,
|
|
49
|
-
defineLegacyConfig
|
|
50
|
-
});
|
|
51
22
|
|
|
52
23
|
//# sourceMappingURL=defineConfig.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"mappings":"
|
|
1
|
+
{"version":3,"mappings":";;;;;;;;;;;;EAGaA,cAAY,MAAZA;EAOAC,oBAAkB,MAAlBA;;AAPN,MAAMD,eAAe,CAACE,WAC3BA;AAMK,MAAMD,qBAAqB,CAChCC,YAC4B;EAC5B,GAAGA;EACHC,QAAQ;EACRC,iBAAiB;AACnB;","names":["defineConfig","defineLegacyConfig","config","legacy","autoLoadPlugins"],"sources":["../../src/config/Users/bytedance/github/targeral/modern-js/packages/solutions/module-tools/src/config/defineConfig.ts"],"sourcesContent":["import type { UserConfigExport } from '@modern-js/core';\nimport type { ModuleConfigParams, ModuleLegacyUserConfig } from '../types';\n\nexport const defineConfig = (config: UserConfigExport<ModuleConfigParams>) =>\n config;\n\n/**\n * @deprecated\n * Using defineConfig first.\n */\nexport const defineLegacyConfig = (\n config: ModuleLegacyUserConfig,\n): ModuleLegacyUserConfig => ({\n ...config,\n legacy: true,\n autoLoadPlugins: true,\n});\n"]}
|
|
@@ -1,31 +1,23 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
function _export(target, all) {
|
|
6
6
|
for (var name in all)
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
return to;
|
|
16
|
-
};
|
|
17
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
-
var legacySchema_exports = {};
|
|
19
|
-
__export(legacySchema_exports, {
|
|
7
|
+
Object.defineProperty(target, name, {
|
|
8
|
+
enumerable: true,
|
|
9
|
+
get: all[name]
|
|
10
|
+
});
|
|
11
|
+
}
|
|
12
|
+
_export(exports, {
|
|
13
|
+
targets: () => targets,
|
|
14
|
+
presets: () => presets,
|
|
20
15
|
buildSchema: () => buildSchema,
|
|
21
|
-
legacySchema: () => legacySchema,
|
|
22
16
|
outputSchema: () => outputSchema,
|
|
23
|
-
presets: () => presets,
|
|
24
17
|
sourceSchema: () => sourceSchema,
|
|
25
|
-
|
|
26
|
-
|
|
18
|
+
toolsSchema: () => toolsSchema,
|
|
19
|
+
legacySchema: () => legacySchema
|
|
27
20
|
});
|
|
28
|
-
module.exports = __toCommonJS(legacySchema_exports);
|
|
29
21
|
const targets = [
|
|
30
22
|
"es5",
|
|
31
23
|
"es6",
|
|
@@ -49,7 +41,10 @@ const presets = [
|
|
|
49
41
|
"npm-component",
|
|
50
42
|
"npm-component-with-umd"
|
|
51
43
|
].reduce((ret, crt) => {
|
|
52
|
-
return [
|
|
44
|
+
return [
|
|
45
|
+
...ret,
|
|
46
|
+
...targets.map((t) => `${crt}-${t}`)
|
|
47
|
+
];
|
|
53
48
|
}, [])
|
|
54
49
|
];
|
|
55
50
|
const properties = {
|
|
@@ -57,13 +52,25 @@ const properties = {
|
|
|
57
52
|
enum: targets
|
|
58
53
|
},
|
|
59
54
|
format: {
|
|
60
|
-
enum: [
|
|
55
|
+
enum: [
|
|
56
|
+
"cjs",
|
|
57
|
+
"esm",
|
|
58
|
+
"umd"
|
|
59
|
+
]
|
|
61
60
|
},
|
|
62
61
|
sourceMap: {
|
|
63
|
-
enum: [
|
|
62
|
+
enum: [
|
|
63
|
+
true,
|
|
64
|
+
false,
|
|
65
|
+
"inline",
|
|
66
|
+
"external"
|
|
67
|
+
]
|
|
64
68
|
},
|
|
65
69
|
buildType: {
|
|
66
|
-
enum: [
|
|
70
|
+
enum: [
|
|
71
|
+
"bundle",
|
|
72
|
+
"bundleless"
|
|
73
|
+
]
|
|
67
74
|
},
|
|
68
75
|
bundleOptions: {
|
|
69
76
|
type: "object",
|
|
@@ -91,10 +98,17 @@ const properties = {
|
|
|
91
98
|
}
|
|
92
99
|
},
|
|
93
100
|
platform: {
|
|
94
|
-
enum: [
|
|
101
|
+
enum: [
|
|
102
|
+
"node",
|
|
103
|
+
"browser"
|
|
104
|
+
]
|
|
95
105
|
},
|
|
96
106
|
minify: {
|
|
97
|
-
enum: [
|
|
107
|
+
enum: [
|
|
108
|
+
"esbuild",
|
|
109
|
+
"terser",
|
|
110
|
+
false
|
|
111
|
+
]
|
|
98
112
|
},
|
|
99
113
|
skipDeps: {
|
|
100
114
|
type: "boolean"
|
|
@@ -111,15 +125,24 @@ const properties = {
|
|
|
111
125
|
type: "object",
|
|
112
126
|
properties: {
|
|
113
127
|
compileMode: {
|
|
114
|
-
enum: [
|
|
128
|
+
enum: [
|
|
129
|
+
"all",
|
|
130
|
+
"only-compiled-code",
|
|
131
|
+
"only-source-code",
|
|
132
|
+
false
|
|
133
|
+
]
|
|
115
134
|
},
|
|
116
|
-
path: {
|
|
135
|
+
path: {
|
|
136
|
+
type: "string"
|
|
137
|
+
}
|
|
117
138
|
}
|
|
118
139
|
},
|
|
119
140
|
static: {
|
|
120
141
|
type: "object",
|
|
121
142
|
properties: {
|
|
122
|
-
path: {
|
|
143
|
+
path: {
|
|
144
|
+
type: "string"
|
|
145
|
+
}
|
|
123
146
|
}
|
|
124
147
|
}
|
|
125
148
|
}
|
|
@@ -133,7 +156,9 @@ const properties = {
|
|
|
133
156
|
dtsOnly: {
|
|
134
157
|
type: "boolean"
|
|
135
158
|
},
|
|
136
|
-
outputPath: {
|
|
159
|
+
outputPath: {
|
|
160
|
+
type: "string"
|
|
161
|
+
}
|
|
137
162
|
};
|
|
138
163
|
const buildSchema = [
|
|
139
164
|
{
|
|
@@ -143,9 +168,19 @@ const buildSchema = [
|
|
|
143
168
|
type: "array"
|
|
144
169
|
},
|
|
145
170
|
then: {
|
|
146
|
-
items: [
|
|
171
|
+
items: [
|
|
172
|
+
{
|
|
173
|
+
type: "object",
|
|
174
|
+
properties,
|
|
175
|
+
additionalProperties: false
|
|
176
|
+
}
|
|
177
|
+
]
|
|
147
178
|
},
|
|
148
|
-
else: {
|
|
179
|
+
else: {
|
|
180
|
+
type: "object",
|
|
181
|
+
properties,
|
|
182
|
+
additionalProperties: false
|
|
183
|
+
}
|
|
149
184
|
}
|
|
150
185
|
},
|
|
151
186
|
{
|
|
@@ -166,23 +201,32 @@ const outputSchema = [
|
|
|
166
201
|
/** packageMode will deprecated */
|
|
167
202
|
{
|
|
168
203
|
target: "output.packageMode",
|
|
169
|
-
schema: {
|
|
204
|
+
schema: {
|
|
205
|
+
enum: PACKAGE_MODE_LIST
|
|
206
|
+
}
|
|
170
207
|
},
|
|
171
208
|
/** packageFields will deprecated */
|
|
172
209
|
{
|
|
173
210
|
target: "output.packageFields",
|
|
174
|
-
schema: {
|
|
211
|
+
schema: {
|
|
212
|
+
typeof: "object"
|
|
213
|
+
}
|
|
175
214
|
},
|
|
176
215
|
/** enableSourceMap will deprecated */
|
|
177
216
|
{
|
|
178
217
|
target: "output.enableSourceMap",
|
|
179
|
-
schema: {
|
|
218
|
+
schema: {
|
|
219
|
+
typeof: "boolean"
|
|
220
|
+
}
|
|
180
221
|
},
|
|
181
222
|
/** importStyle will deprecated */
|
|
182
223
|
{
|
|
183
224
|
target: "output.importStyle",
|
|
184
225
|
schema: {
|
|
185
|
-
enum: [
|
|
226
|
+
enum: [
|
|
227
|
+
"compiled-code",
|
|
228
|
+
"source-code"
|
|
229
|
+
]
|
|
186
230
|
}
|
|
187
231
|
},
|
|
188
232
|
/** assetsPath will deprecated */
|
|
@@ -200,7 +244,10 @@ const sourceSchema = [
|
|
|
200
244
|
target: "source.jsxTransformRuntime",
|
|
201
245
|
schema: {
|
|
202
246
|
// https://babeljs.io/docs/en/babel-preset-react#runtime
|
|
203
|
-
enum: [
|
|
247
|
+
enum: [
|
|
248
|
+
"classic",
|
|
249
|
+
"automatic"
|
|
250
|
+
]
|
|
204
251
|
}
|
|
205
252
|
}
|
|
206
253
|
];
|
|
@@ -208,20 +255,17 @@ const toolsSchema = [
|
|
|
208
255
|
{
|
|
209
256
|
target: "tools.speedy",
|
|
210
257
|
schema: {
|
|
211
|
-
typeof: [
|
|
258
|
+
typeof: [
|
|
259
|
+
"object",
|
|
260
|
+
"function"
|
|
261
|
+
]
|
|
212
262
|
}
|
|
213
263
|
}
|
|
214
264
|
];
|
|
215
|
-
const legacySchema = [
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
outputSchema,
|
|
221
|
-
presets,
|
|
222
|
-
sourceSchema,
|
|
223
|
-
targets,
|
|
224
|
-
toolsSchema
|
|
225
|
-
});
|
|
265
|
+
const legacySchema = [
|
|
266
|
+
...sourceSchema,
|
|
267
|
+
...outputSchema,
|
|
268
|
+
...toolsSchema
|
|
269
|
+
];
|
|
226
270
|
|
|
227
271
|
//# sourceMappingURL=legacySchema.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"mappings":"
|
|
1
|
+
{"version":3,"mappings":";;;;;;;;;;;;EAAaA,SAAO,MAAPA;EAaAC,SAAO,MAAPA;EAqGAC,aAAW,MAAXA;EA6BAC,cAAY,MAAZA;EAkCAC,cAAY,MAAZA;EAUAC,aAAW,MAAXA;EASAC,cAAY,MAAZA;;AApMN,MAAMN,UAAU;EACrB;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;EAEA;;AAGK,MAAMC,UAAU;EACrB;EACA;EACA;EACA;KACG;IACD;IACA;IACA;IACA;IACAM,OAAiB,CAACC,KAAKC,QAAQ;AAC/B,WAAO;SAAID;SAAQR,QAAQU,IAAIC,OAAK,GAAGF,OAAOE,GAAG;;EACnD,GAAG,EAAE;;AAGP,MAAMC,aAAa;EACjBC,QAAQ;IACNC,MAAMd;EACR;EACAe,QAAQ;IACND,MAAM;MAAC;MAAO;MAAO;;EACvB;EACAE,WAAW;IACTF,MAAM;MAAC;MAAM;MAAO;MAAU;;EAChC;EACAG,WAAW;IACTH,MAAM;MAAC;MAAU;;EACnB;EACAI,eAAe;IACbC,MAAM;IACNP,YAAY;MACVQ,aAAa;QACXC,YAAY;MACd;MACAC,OAAO;QACLH,MAAM;MACR;MACAI,WAAW;QACTJ,MAAM;MACR;MACAK,WAAW;QACTL,MAAM;QACNM,OAAO;UACLC,OAAO;YACL;cACEL,YAAY;YACd;YACA;cACEM,QAAQ;YACV;;QAEJ;MACF;MACAC,UAAU;QACRd,MAAM;UAAC;UAAQ;;MACjB;MACAe,QAAQ;QACNf,MAAM;UAAC;UAAW;UAAU;;MAC9B;MACAgB,UAAU;QACRX,MAAM;MACR;IACF;EACF;EACAY,mBAAmB;IACjBZ,MAAM;IACNP,YAAY;MACVoB,WAAW;QACTb,MAAM;MACR;MACAc,OAAO;QACLd,MAAM;QACNP,YAAY;UACVsB,aAAa;YACXpB,MAAM;cAAC;cAAO;cAAsB;cAAoB;;UAC1D;UACAqB,MAAM;YAAEhB,MAAM;UAAS;QACzB;MACF;MACAiB,QAAQ;QACNjB,MAAM;QACNP,YAAY;UACVuB,MAAM;YAAEhB,MAAM;UAAS;QACzB;MACF;IACF;EACF;EAEAkB,UAAU;IACRlB,MAAM;EACR;EACAmB,WAAW;IACTnB,MAAM;EACR;EACAoB,SAAS;IACPpB,MAAM;EACR;EAEAqB,YAAY;IAAErB,MAAM;EAAS;AAC/B;AAEO,MAAMjB,cAAc;EACzB;IACEW,QAAQ;IACR4B,QAAQ;MACNC,IAAI;QACFvB,MAAM;MACR;MACAwB,MAAM;QACJlB,OAAO;UAAC;YAAEN,MAAM;YAAUP;YAAYgC,sBAAsB;UAAM;;MACpE;MACAC,MAAM;QAAE1B,MAAM;QAAUP;QAAYgC,sBAAsB;MAAM;IAClE;EACF;EACA;IACE/B,QAAQ;IACR4B,QAAQ;MACN3B,MAAMb;IACR;EACF;;AAGF,MAAM6C,oBAAoB;EACxB;EACA;EACA;EACA;EACA;;AAGK,MAAM3C,eAAe;;EAE1B;IACEU,QAAQ;IACR4B,QAAQ;MAAE3B,MAAMgC;IAAkB;EACpC;;EAEA;IACEjC,QAAQ;IACR4B,QAAQ;MAAEd,QAAQ;IAAS;EAC7B;;EAEA;IACEd,QAAQ;IACR4B,QAAQ;MAAEd,QAAQ;IAAU;EAC9B;;EAEA;IACEd,QAAQ;IACR4B,QAAQ;MACN3B,MAAM;QAAC;QAAiB;;IAC1B;EACF;;EAEA;IACED,QAAQ;IACR4B,QAAQ;MACNd,QAAQ;MACRoB,SAAS;IACX;EACF;KACG7C;;AAGE,MAAME,eAAe;EAC1B;IACES,QAAQ;IACR4B,QAAQ;;MAEN3B,MAAM;QAAC;QAAW;;IACpB;EACF;;AAGK,MAAMT,cAAc;EACzB;IACEQ,QAAQ;IACR4B,QAAQ;MACNd,QAAQ;QAAC;QAAU;;IACrB;EACF;;AAGK,MAAMrB,eAAe;KAAIF;KAAiBD;KAAiBE;;","names":["targets","presets","buildSchema","outputSchema","sourceSchema","toolsSchema","legacySchema","reduce","ret","crt","map","t","properties","target","enum","format","sourceMap","buildType","bundleOptions","type","getModuleId","instanceof","entry","splitting","externals","items","anyOf","typeof","platform","minify","skipDeps","bundlelessOptions","sourceDir","style","compileMode","path","static","tsconfig","enableDts","dtsOnly","outputPath","schema","if","then","additionalProperties","else","PACKAGE_MODE_LIST","default"],"sources":["../../src/config/Users/bytedance/github/targeral/modern-js/packages/solutions/module-tools/src/config/legacySchema.ts"],"sourcesContent":["export const targets = [\n 'es5',\n 'es6',\n 'es2015',\n 'es2016',\n 'es2017',\n 'es2018',\n 'es2019',\n 'es2020',\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];\n\nconst properties = {\n target: {\n enum: targets,\n },\n format: {\n enum: ['cjs', 'esm', 'umd'],\n },\n sourceMap: {\n enum: [true, false, 'inline', 'external'],\n },\n buildType: {\n enum: ['bundle', 'bundleless'],\n },\n bundleOptions: {\n type: 'object',\n properties: {\n getModuleId: {\n instanceof: 'Function',\n },\n entry: {\n type: 'object',\n },\n splitting: {\n 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 platform: {\n enum: ['node', 'browser'],\n },\n minify: {\n enum: ['esbuild', 'terser', false],\n },\n skipDeps: {\n type: 'boolean',\n },\n },\n },\n bundlelessOptions: {\n type: 'object',\n properties: {\n sourceDir: {\n type: 'string',\n },\n style: {\n type: 'object',\n properties: {\n compileMode: {\n enum: ['all', 'only-compiled-code', 'only-source-code', false],\n },\n path: { type: 'string' },\n },\n },\n static: {\n type: 'object',\n properties: {\n path: { type: 'string' },\n },\n },\n },\n },\n\n tsconfig: {\n type: 'string',\n },\n enableDts: {\n type: 'boolean',\n },\n dtsOnly: {\n type: 'boolean',\n },\n\n outputPath: { type: 'string' },\n};\n\nexport const buildSchema = [\n {\n target: 'output.buildConfig',\n schema: {\n if: {\n type: 'array',\n },\n then: {\n items: [{ type: 'object', properties, additionalProperties: false }],\n },\n else: { type: 'object', properties, additionalProperties: false },\n },\n },\n {\n target: 'output.buildPreset',\n schema: {\n enum: presets,\n },\n },\n];\n\nconst PACKAGE_MODE_LIST = [\n 'universal-js',\n 'universal-js-lite',\n 'browser-js',\n 'browser-js-lite',\n 'node-js',\n];\n\nexport const outputSchema = [\n /** packageMode will deprecated */\n {\n target: 'output.packageMode',\n schema: { enum: PACKAGE_MODE_LIST },\n },\n /** packageFields will deprecated */\n {\n target: 'output.packageFields',\n schema: { typeof: 'object' },\n },\n /** enableSourceMap will deprecated */\n {\n target: 'output.enableSourceMap',\n schema: { typeof: 'boolean' },\n },\n /** importStyle will deprecated */\n {\n target: 'output.importStyle',\n schema: {\n enum: ['compiled-code', 'source-code'],\n },\n },\n /** assetsPath will deprecated */\n {\n target: 'output.assetsPath',\n schema: {\n typeof: 'string',\n default: 'styles',\n },\n },\n ...buildSchema,\n];\n\nexport const sourceSchema = [\n {\n target: 'source.jsxTransformRuntime',\n schema: {\n // https://babeljs.io/docs/en/babel-preset-react#runtime\n enum: ['classic', 'automatic'],\n },\n },\n];\n\nexport const toolsSchema = [\n {\n target: 'tools.speedy',\n schema: {\n typeof: ['object', 'function'],\n },\n },\n];\n\nexport const legacySchema = [...sourceSchema, ...outputSchema, ...toolsSchema];\n"]}
|