@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/utils/config.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"mappings":"
|
|
1
|
+
{"version":3,"file":null,"mappings":"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","names":["value"],"sources":["../../src/utils/config.ts"],"sourcesContent":["import { ModuleContext } from '../types';\nimport type {\n BaseBuildConfig,\n PartialBuildConfig,\n PartialBaseBuildConfig,\n DTSOptions,\n} from '../types/config';\n\nexport const validPartialBuildConfig = (config: PartialBuildConfig) => {\n if (Array.isArray(config)) {\n for (const c of config) {\n validBuildTypeAndFormat(c);\n }\n } else {\n validBuildTypeAndFormat(config);\n }\n};\n\nexport const validBuildTypeAndFormat = (config: PartialBaseBuildConfig) => {\n if (\n config.buildType === 'bundleless' &&\n ['iife', 'umd'].includes(config.format ?? '')\n ) {\n throw new Error(\n `when buildType is bundleless, the format must be equal to one of the allowed values: (cjs, esm)`,\n );\n }\n};\n\nexport const mergeDefaultBaseConfig = async (\n pConfig: PartialBaseBuildConfig,\n context: ModuleContext,\n): Promise<BaseBuildConfig> => {\n const { defaultBuildConfig: defaultConfig } = await import(\n '../constants/build'\n );\n const { cloneDeep } = await import('@modern-js/utils/lodash');\n const { applyOptionsChain, ensureAbsolutePath, slash } = await import(\n '@modern-js/utils'\n );\n const { getDefaultIndexEntry } = await import('./input');\n const { getStyleConfig } = await import('./style');\n const defaultAlias = {\n '@': context.srcDirectory,\n };\n const mergedAlias = applyOptionsChain(defaultAlias, pConfig.alias);\n\n /**\n * Format alias value:\n * - Relative paths need to be turned into absolute paths.\n * - Absolute paths or a package name are not processed.\n */\n const alias = Object.keys(mergedAlias).reduce<Record<string, string>>(\n (prev, name) => {\n const formattedValue = (value: string) => {\n if (typeof value === 'string' && value.startsWith('.')) {\n return slash(ensureAbsolutePath(context.appDirectory, value));\n }\n return value;\n };\n const value = formattedValue(mergedAlias[name]);\n\n prev[name] = value;\n return prev;\n },\n {},\n );\n\n const styleConfig = await getStyleConfig(pConfig);\n const buildType = pConfig.buildType ?? defaultConfig.buildType;\n const sourceDir = pConfig.sourceDir ?? defaultConfig.sourceDir;\n const input =\n buildType === 'bundle' ? await getDefaultIndexEntry(context) : [sourceDir];\n const userDefine = pConfig.define ?? {};\n const define = {\n ...defaultConfig.define,\n ...Object.keys(userDefine).reduce<Record<string, string>>((memo, name) => {\n memo[name] = JSON.stringify(userDefine[name]!);\n return memo;\n }, {}),\n };\n return {\n asset: {\n ...defaultConfig.asset,\n ...pConfig.asset,\n },\n buildType,\n format: pConfig.format ?? defaultConfig.format,\n target: pConfig.target ?? defaultConfig.target,\n sourceMap: pConfig.sourceMap ?? defaultConfig.sourceMap,\n copy: pConfig.copy ?? cloneDeep(defaultConfig.copy),\n outdir: pConfig.outdir ?? defaultConfig.outdir,\n dts: await getDtsConfig(pConfig.dts, defaultConfig.dts as DTSOptions),\n jsx: pConfig.jsx ?? defaultConfig.jsx,\n input: pConfig.input ?? cloneDeep(input),\n platform: pConfig.platform ?? defaultConfig.platform,\n splitting: pConfig.splitting ?? defaultConfig.splitting,\n minify: pConfig.minify ?? defaultConfig.minify,\n autoExternal: pConfig.autoExternal ?? defaultConfig.autoExternal,\n umdGlobals: {\n ...defaultConfig.umdGlobals,\n ...pConfig.umdGlobals,\n },\n umdModuleName: pConfig.umdModuleName ?? defaultConfig.umdModuleName,\n externals: pConfig.externals ?? defaultConfig.externals,\n sourceDir,\n alias,\n define,\n style: {\n ...styleConfig,\n inject: pConfig.style?.inject ?? defaultConfig.style.inject,\n modules: pConfig.style?.modules ?? defaultConfig.style.modules,\n autoModules:\n pConfig.style?.autoModules ?? defaultConfig.style.autoModules,\n tailwindCss: defaultConfig.style.tailwindCss,\n },\n };\n};\n\nexport const getDtsConfig = async (\n userDTS: PartialBaseBuildConfig['dts'],\n defaultDTS: Required<DTSOptions>,\n) => {\n const { cloneDeep, isUndefined, isObject } = await import(\n '@modern-js/utils/lodash'\n );\n\n if (isUndefined(userDTS)) {\n return cloneDeep(defaultDTS);\n }\n\n if (isObject(userDTS)) {\n return {\n ...defaultDTS,\n ...userDTS,\n };\n }\n\n return userDTS;\n};\n"]}
|
package/dist/utils/context.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,30 +16,11 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
14
16
|
}
|
|
15
17
|
return to;
|
|
16
18
|
};
|
|
17
|
-
var
|
|
18
|
-
|
|
19
|
-
__export(stdin_exports, {
|
|
20
|
-
initModuleContext: () => initModuleContext
|
|
21
|
-
});
|
|
22
|
-
module.exports = __toCommonJS(stdin_exports);
|
|
23
|
-
var __create = Object.create;
|
|
24
|
-
var __defProp2 = Object.defineProperty;
|
|
25
|
-
var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor;
|
|
26
|
-
var __getOwnPropNames2 = Object.getOwnPropertyNames;
|
|
27
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
28
|
-
var __hasOwnProp2 = Object.prototype.hasOwnProperty;
|
|
29
|
-
var __copyProps2 = (to, from, except, desc) => {
|
|
30
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
31
|
-
for (let key of __getOwnPropNames2(from))
|
|
32
|
-
if (!__hasOwnProp2.call(to, key) && key !== except)
|
|
33
|
-
__defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable });
|
|
34
|
-
}
|
|
35
|
-
return to;
|
|
36
|
-
};
|
|
37
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps2(
|
|
38
|
-
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,
|
|
39
21
|
mod
|
|
40
22
|
));
|
|
23
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
41
24
|
var __async = (__this, __arguments, generator) => {
|
|
42
25
|
return new Promise((resolve, reject) => {
|
|
43
26
|
var fulfilled = (value) => {
|
|
@@ -58,11 +41,20 @@ var __async = (__this, __arguments, generator) => {
|
|
|
58
41
|
step((generator = generator.apply(__this, __arguments)).next());
|
|
59
42
|
});
|
|
60
43
|
};
|
|
44
|
+
var context_exports = {};
|
|
45
|
+
__export(context_exports, {
|
|
46
|
+
initModuleContext: () => initModuleContext
|
|
47
|
+
});
|
|
48
|
+
module.exports = __toCommonJS(context_exports);
|
|
61
49
|
const initModuleContext = (api) => __async(void 0, null, function* () {
|
|
62
50
|
const { isTypescript } = yield Promise.resolve().then(() => __toESM(require("@modern-js/utils")));
|
|
63
51
|
const { appDirectory, srcDirectory } = api.useAppContext();
|
|
64
52
|
const isTsProject = isTypescript(appDirectory);
|
|
65
53
|
return { isTsProject, appDirectory, srcDirectory };
|
|
66
54
|
});
|
|
55
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
56
|
+
0 && (module.exports = {
|
|
57
|
+
initModuleContext
|
|
58
|
+
});
|
|
67
59
|
|
|
68
60
|
//# sourceMappingURL=context.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"mappings":"
|
|
1
|
+
{"version":3,"file":null,"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGO,MAAM,oBAAoB,CAAO,QAAgC;AACtE,QAAM,EAAE,aAAa,IAAI,MAAM,6CAAO;AACtC,QAAM,EAAE,cAAc,aAAa,IAAI,IAAI,cAAc;AACzD,QAAM,cAAc,aAAa,YAAY;AAE7C,SAAO,EAAE,aAAa,cAAc,aAAa;AACnD;;;;;","names":[],"sources":["../../src/utils/context.ts"],"sourcesContent":["import type { PluginAPI } from '@modern-js/core';\nimport type { ModuleTools } from '../types';\n\nexport const initModuleContext = async (api: PluginAPI<ModuleTools>) => {\n const { isTypescript } = await import('@modern-js/utils');\n const { appDirectory, srcDirectory } = api.useAppContext();\n const isTsProject = isTypescript(appDirectory);\n\n return { isTsProject, appDirectory, srcDirectory };\n};\n"]}
|
package/dist/utils/dts.js
CHANGED
|
@@ -1,49 +1,17 @@
|
|
|
1
1
|
var __create = Object.create;
|
|
2
2
|
var __defProp = Object.defineProperty;
|
|
3
|
+
var __defProps = Object.defineProperties;
|
|
3
4
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
4
6
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
7
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
5
8
|
var __getProtoOf = Object.getPrototypeOf;
|
|
6
9
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
-
var __export = (target, all) => {
|
|
8
|
-
for (var name in all)
|
|
9
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
-
};
|
|
11
|
-
var __copyProps = (to, from, except, desc) => {
|
|
12
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
-
for (let key of __getOwnPropNames(from))
|
|
14
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
-
}
|
|
17
|
-
return to;
|
|
18
|
-
};
|
|
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,
|
|
21
|
-
mod
|
|
22
|
-
));
|
|
23
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
24
|
-
var stdin_exports = {};
|
|
25
|
-
__export(stdin_exports, {
|
|
26
|
-
assignTsConfigPath: () => assignTsConfigPath,
|
|
27
|
-
generatorTsConfig: () => generatorTsConfig,
|
|
28
|
-
getTscBinPath: () => getTscBinPath,
|
|
29
|
-
resolveAlias: () => resolveAlias
|
|
30
|
-
});
|
|
31
|
-
module.exports = __toCommonJS(stdin_exports);
|
|
32
|
-
var import_path = __toESM(require("path"));
|
|
33
|
-
var __create2 = Object.create;
|
|
34
|
-
var __defProp2 = Object.defineProperty;
|
|
35
|
-
var __defProps = Object.defineProperties;
|
|
36
|
-
var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor;
|
|
37
|
-
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
38
|
-
var __getOwnPropNames2 = Object.getOwnPropertyNames;
|
|
39
|
-
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
40
|
-
var __getProtoOf2 = Object.getPrototypeOf;
|
|
41
|
-
var __hasOwnProp2 = Object.prototype.hasOwnProperty;
|
|
42
10
|
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
43
|
-
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;
|
|
44
12
|
var __spreadValues = (a, b) => {
|
|
45
13
|
for (var prop in b || (b = {}))
|
|
46
|
-
if (
|
|
14
|
+
if (__hasOwnProp.call(b, prop))
|
|
47
15
|
__defNormalProp(a, prop, b[prop]);
|
|
48
16
|
if (__getOwnPropSymbols)
|
|
49
17
|
for (var prop of __getOwnPropSymbols(b)) {
|
|
@@ -53,18 +21,23 @@ var __spreadValues = (a, b) => {
|
|
|
53
21
|
return a;
|
|
54
22
|
};
|
|
55
23
|
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
56
|
-
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) => {
|
|
57
29
|
if (from && typeof from === "object" || typeof from === "function") {
|
|
58
|
-
for (let key of
|
|
59
|
-
if (!
|
|
60
|
-
|
|
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 });
|
|
61
33
|
}
|
|
62
34
|
return to;
|
|
63
35
|
};
|
|
64
|
-
var
|
|
65
|
-
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,
|
|
66
38
|
mod
|
|
67
39
|
));
|
|
40
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
68
41
|
var __async = (__this, __arguments, generator) => {
|
|
69
42
|
return new Promise((resolve, reject) => {
|
|
70
43
|
var fulfilled = (value) => {
|
|
@@ -85,10 +58,19 @@ var __async = (__this, __arguments, generator) => {
|
|
|
85
58
|
step((generator = generator.apply(__this, __arguments)).next());
|
|
86
59
|
});
|
|
87
60
|
};
|
|
61
|
+
var dts_exports = {};
|
|
62
|
+
__export(dts_exports, {
|
|
63
|
+
assignTsConfigPath: () => assignTsConfigPath,
|
|
64
|
+
generatorTsConfig: () => generatorTsConfig,
|
|
65
|
+
getTscBinPath: () => getTscBinPath,
|
|
66
|
+
resolveAlias: () => resolveAlias
|
|
67
|
+
});
|
|
68
|
+
module.exports = __toCommonJS(dts_exports);
|
|
69
|
+
var import_path = __toESM(require("path"));
|
|
88
70
|
const generatorTsConfig = (projectTsconfig, config) => __async(void 0, null, function* () {
|
|
89
71
|
var _a, _b, _c;
|
|
90
|
-
const { fs, lodash, nanoid } = yield Promise.resolve().then(() =>
|
|
91
|
-
const { dtsTempDirectory } = yield Promise.resolve().then(() =>
|
|
72
|
+
const { fs, lodash, nanoid } = yield Promise.resolve().then(() => __toESM(require("@modern-js/utils")));
|
|
73
|
+
const { dtsTempDirectory } = yield Promise.resolve().then(() => __toESM(require("../constants/dts")));
|
|
92
74
|
const {
|
|
93
75
|
appDirectory,
|
|
94
76
|
sourceDir: absSourceDir,
|
|
@@ -142,8 +124,8 @@ const generatorTsConfig = (projectTsconfig, config) => __async(void 0, null, fun
|
|
|
142
124
|
return { tempTsconfigPath, tempDistAbsRootPath, tempDistAbsSrcPath };
|
|
143
125
|
});
|
|
144
126
|
const getTscBinPath = (appDirectory) => __async(void 0, null, function* () {
|
|
145
|
-
const { fs } = yield Promise.resolve().then(() =>
|
|
146
|
-
const { default: findUp, exists: pathExists } = yield Promise.resolve().then(() =>
|
|
127
|
+
const { fs } = yield Promise.resolve().then(() => __toESM(require("@modern-js/utils")));
|
|
128
|
+
const { default: findUp, exists: pathExists } = yield Promise.resolve().then(() => __toESM(require("../../compiled/find-up")));
|
|
147
129
|
const tscBinFile = yield findUp(
|
|
148
130
|
(directory) => __async(void 0, null, function* () {
|
|
149
131
|
const targetFilePath = import_path.default.join(directory, "./node_modules/.bin/tsc");
|
|
@@ -165,8 +147,8 @@ const getTscBinPath = (appDirectory) => __async(void 0, null, function* () {
|
|
|
165
147
|
const resolveAlias = (_0, _1, ..._2) => __async(void 0, [_0, _1, ..._2], function* (config, options, watchFilenames = []) {
|
|
166
148
|
var _a, _b;
|
|
167
149
|
const { userTsconfig, tempDistAbsSrcPath, tempDistAbsRootPath } = options;
|
|
168
|
-
const { globby, fs } = yield Promise.resolve().then(() =>
|
|
169
|
-
const { transformDtsAlias } = yield Promise.resolve().then(() =>
|
|
150
|
+
const { globby, fs } = yield Promise.resolve().then(() => __toESM(require("@modern-js/utils")));
|
|
151
|
+
const { transformDtsAlias } = yield Promise.resolve().then(() => __toESM(require("./tspaths-transform")));
|
|
170
152
|
const { distAbsPath } = config;
|
|
171
153
|
const dtsDistPath = `${tempDistAbsSrcPath}/**/*.d.ts`;
|
|
172
154
|
const dtsFilenames = watchFilenames.length > 0 ? watchFilenames : globby.sync(dtsDistPath, { absolute: true });
|
|
@@ -182,7 +164,7 @@ const resolveAlias = (_0, _1, ..._2) => __async(void 0, [_0, _1, ..._2], functio
|
|
|
182
164
|
});
|
|
183
165
|
const assignTsConfigPath = (config, options) => __async(void 0, null, function* () {
|
|
184
166
|
var _a;
|
|
185
|
-
const { defaultTsConfigPath } = yield Promise.resolve().then(() =>
|
|
167
|
+
const { defaultTsConfigPath } = yield Promise.resolve().then(() => __toESM(require("../constants/dts")));
|
|
186
168
|
if (typeof options.tsconfig === "string" && options.tsconfig !== defaultTsConfigPath) {
|
|
187
169
|
config.dts = __spreadProps(__spreadValues({
|
|
188
170
|
only: false,
|
|
@@ -193,5 +175,12 @@ const assignTsConfigPath = (config, options) => __async(void 0, null, function*
|
|
|
193
175
|
}
|
|
194
176
|
return config;
|
|
195
177
|
});
|
|
178
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
179
|
+
0 && (module.exports = {
|
|
180
|
+
assignTsConfigPath,
|
|
181
|
+
generatorTsConfig,
|
|
182
|
+
getTscBinPath,
|
|
183
|
+
resolveAlias
|
|
184
|
+
});
|
|
196
185
|
|
|
197
186
|
//# sourceMappingURL=dts.js.map
|
package/dist/utils/dts.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"mappings":"
|
|
1
|
+
{"version":3,"file":null,"mappings":"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","names":[],"sources":["../../src/utils/dts.ts"],"sourcesContent":["import path from 'path';\n// import type { NodePath } from '../../compiled/@babel/traverse';\n// import type * as tt from '../../compiled/@babel/types';\n// import t from '../../compiled/@babel/types';\nimport type {\n ITsconfig,\n BundlelessGeneratorDtsConfig,\n BuildCommandOptions,\n BaseBuildConfig,\n // AliasOption,\n} from '../types';\n\nexport const generatorTsConfig = async (\n projectTsconfig: ITsconfig,\n config: BundlelessGeneratorDtsConfig,\n) => {\n const { fs, lodash, nanoid } = await import('@modern-js/utils');\n const { dtsTempDirectory } = await import('../constants/dts');\n\n const {\n appDirectory,\n sourceDir: absSourceDir,\n distAbsPath,\n tsconfigPath,\n } = config;\n const tempDistAbsRootPath = path.join(\n appDirectory,\n `${dtsTempDirectory}/${nanoid()}`,\n );\n const tempDistAbsSrcPath = path.join(\n tempDistAbsRootPath,\n path.relative(appDirectory, absSourceDir),\n );\n\n const rootDir = path.relative(tempDistAbsRootPath, appDirectory);\n const baseUrl = projectTsconfig.compilerOptions?.baseUrl\n ? path.join(appDirectory, projectTsconfig.compilerOptions?.baseUrl)\n : appDirectory;\n // if include = ['src'], final include should be ['../src']\n const include = [path.relative(tempDistAbsRootPath, absSourceDir)];\n\n const resetConfig: ITsconfig = {\n compilerOptions: {\n ...projectTsconfig?.compilerOptions,\n rootDir,\n baseUrl,\n // Ensure that .d.ts files are created by tsc, but not .js files\n declaration: true,\n emitDeclarationOnly: true,\n outDir: tempDistAbsRootPath,\n },\n include,\n exclude: projectTsconfig.exclude ?? [],\n };\n\n // extends: '../tsconfig.json'\n if (projectTsconfig.extends) {\n resetConfig.extends = projectTsconfig.extends.startsWith('.')\n ? path.join(\n path.relative(`${distAbsPath}/tsconfig.json`, tsconfigPath),\n projectTsconfig.extends,\n )\n : projectTsconfig.extends;\n }\n\n const recommendOption = {\n // Ensure that Babel can safely transpile files in the TypeScript project\n compilerOptions: {\n isolatedModules: true,\n },\n };\n\n const tempTsconfigPath = path.join(tempDistAbsRootPath, `tsconfig.json`);\n fs.ensureFileSync(tempTsconfigPath);\n\n const deepMerge = lodash.merge;\n fs.writeJSONSync(\n tempTsconfigPath,\n deepMerge(\n recommendOption,\n projectTsconfig,\n // 此处是必须要覆盖用户默认配置\n resetConfig,\n ),\n );\n\n return { tempTsconfigPath, tempDistAbsRootPath, tempDistAbsSrcPath };\n};\n\nexport const getTscBinPath = async (appDirectory: string) => {\n const { fs } = await import('@modern-js/utils');\n const { default: findUp, exists: pathExists } = await import(\n '../../compiled/find-up'\n );\n const tscBinFile = await findUp(\n async (directory: string) => {\n const targetFilePath = path.join(directory, './node_modules/.bin/tsc');\n const hasTscBinFile = await pathExists(targetFilePath);\n if (hasTscBinFile) {\n return targetFilePath;\n }\n return undefined;\n },\n { cwd: appDirectory },\n );\n\n if (!tscBinFile || !fs.existsSync(tscBinFile)) {\n throw new Error(\n 'Failed to excute the `tsc` command, please check if `typescript` is installed correctly in the current directory.',\n );\n }\n\n return tscBinFile;\n};\n\nexport const resolveAlias = async (\n config: BundlelessGeneratorDtsConfig,\n options: {\n userTsconfig: ITsconfig;\n tempTsconfigPath: string;\n tempDistAbsRootPath: string;\n tempDistAbsSrcPath: string;\n },\n watchFilenames: string[] = [],\n) => {\n const { userTsconfig, tempDistAbsSrcPath, tempDistAbsRootPath } = options;\n const { globby, fs } = await import('@modern-js/utils');\n const { transformDtsAlias } = await import('./tspaths-transform');\n const { distAbsPath } = config;\n const dtsDistPath = `${tempDistAbsSrcPath}/**/*.d.ts`;\n const dtsFilenames =\n watchFilenames.length > 0\n ? watchFilenames\n : globby.sync(dtsDistPath, { absolute: true });\n const result = transformDtsAlias({\n filenames: dtsFilenames,\n baseUrl: tempDistAbsRootPath,\n paths: userTsconfig.compilerOptions?.paths ?? {},\n });\n for (const r of result) {\n fs.writeFileSync(r.path, r.content);\n }\n\n await fs.copy(tempDistAbsSrcPath, distAbsPath);\n};\n\n// export const matchesPattern = (calleePath: NodePath, pattern: string) => {\n// const { node } = calleePath;\n\n// if (t.isMemberExpression(node)) {\n// return calleePath.matchesPattern(pattern);\n// }\n\n// if (!t.isIdentifier(node) || pattern.includes('.')) {\n// return false;\n// }\n\n// const name = pattern.split('.')[0];\n\n// return node.name === name;\n// };\n\n// export const isImportCall = (calleePath: NodePath<tt.CallExpression>) => {\n// return t.isImport(calleePath.node.callee);\n// };\n\n// export const verifyTsConfigPaths = async (\n// tsconfigAbsPath: string,\n// userAliases?: AliasOption,\n// ) => {\n// const { readTsConfigByFile, chalk } = await import('@modern-js/utils');\n// if (!userAliases) {\n// return;\n// }\n\n// const paths = Object.keys(\n// readTsConfigByFile(tsconfigAbsPath).compilerOptions?.paths || {},\n// ).map(key => key.replace(/\\/\\*$/, ''));\n\n// Object.keys(userAliases).forEach(name => {\n// if (paths.includes(name)) {\n// throw new Error(\n// chalk.red(\n// `It looks like you have configured the alias ${chalk.bold(\n// name,\n// )} in both the modern.config file and tsconfig.json.\\n Please remove the configuration in modern.config file and just keep the configuration in tsconfig.json.`,\n// ),\n// );\n// }\n// });\n// };\n\nexport const assignTsConfigPath = async (\n config: BaseBuildConfig,\n options: BuildCommandOptions,\n) => {\n const { defaultTsConfigPath } = await import('../constants/dts');\n\n // user run `build --tsconfig './tsconfig.build.json'`\n if (\n typeof options.tsconfig === 'string' &&\n options.tsconfig !== defaultTsConfigPath\n ) {\n config.dts = {\n only: false,\n distPath: './',\n ...(config.dts ?? {}),\n tsconfigPath: options.tsconfig,\n };\n }\n\n return config;\n};\n"]}
|
package/dist/utils/input.js
CHANGED
|
@@ -21,33 +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
|
-
addInputToPreset: () => addInputToPreset,
|
|
27
|
-
getAbsInput: () => getAbsInput,
|
|
28
|
-
getDefaultIndexEntry: () => getDefaultIndexEntry,
|
|
29
|
-
normalizeInput: () => normalizeInput
|
|
30
|
-
});
|
|
31
|
-
module.exports = __toCommonJS(stdin_exports);
|
|
32
|
-
var import_path = __toESM(require("path"));
|
|
33
|
-
var __create2 = Object.create;
|
|
34
|
-
var __defProp2 = Object.defineProperty;
|
|
35
|
-
var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor;
|
|
36
|
-
var __getOwnPropNames2 = Object.getOwnPropertyNames;
|
|
37
|
-
var __getProtoOf2 = Object.getPrototypeOf;
|
|
38
|
-
var __hasOwnProp2 = Object.prototype.hasOwnProperty;
|
|
39
|
-
var __copyProps2 = (to, from, except, desc) => {
|
|
40
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
41
|
-
for (let key of __getOwnPropNames2(from))
|
|
42
|
-
if (!__hasOwnProp2.call(to, key) && key !== except)
|
|
43
|
-
__defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable });
|
|
44
|
-
}
|
|
45
|
-
return to;
|
|
46
|
-
};
|
|
47
|
-
var __toESM2 = (mod, isNodeMode, target) => (target = mod != null ? __create2(__getProtoOf2(mod)) : {}, __copyProps2(
|
|
48
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp2(target, "default", { value: mod, enumerable: true }) : target,
|
|
49
|
-
mod
|
|
50
|
-
));
|
|
51
24
|
var __async = (__this, __arguments, generator) => {
|
|
52
25
|
return new Promise((resolve, reject) => {
|
|
53
26
|
var fulfilled = (value) => {
|
|
@@ -68,8 +41,17 @@ var __async = (__this, __arguments, generator) => {
|
|
|
68
41
|
step((generator = generator.apply(__this, __arguments)).next());
|
|
69
42
|
});
|
|
70
43
|
};
|
|
44
|
+
var input_exports = {};
|
|
45
|
+
__export(input_exports, {
|
|
46
|
+
addInputToPreset: () => addInputToPreset,
|
|
47
|
+
getAbsInput: () => getAbsInput,
|
|
48
|
+
getDefaultIndexEntry: () => getDefaultIndexEntry,
|
|
49
|
+
normalizeInput: () => normalizeInput
|
|
50
|
+
});
|
|
51
|
+
module.exports = __toCommonJS(input_exports);
|
|
52
|
+
var import_path = __toESM(require("path"));
|
|
71
53
|
const getAbsInput = (entry, options) => __async(void 0, null, function* () {
|
|
72
|
-
const { slash } = yield Promise.resolve().then(() =>
|
|
54
|
+
const { slash } = yield Promise.resolve().then(() => __toESM(require("@modern-js/utils")));
|
|
73
55
|
const { appDirectory } = options;
|
|
74
56
|
if (Array.isArray(entry)) {
|
|
75
57
|
return entry.map(
|
|
@@ -102,7 +84,7 @@ const getDefaultIndexEntry = (_0) => __async(void 0, [_0], function* ({
|
|
|
102
84
|
isTsProject,
|
|
103
85
|
appDirectory
|
|
104
86
|
}) {
|
|
105
|
-
const { fs } = yield Promise.resolve().then(() =>
|
|
87
|
+
const { fs } = yield Promise.resolve().then(() => __toESM(require("@modern-js/utils")));
|
|
106
88
|
let entry = isTsProject ? import_path.default.join(appDirectory, "./src/index.ts") : import_path.default.join(appDirectory, "./src/index.js");
|
|
107
89
|
if (fs.existsSync(entry)) {
|
|
108
90
|
return [`./${import_path.default.relative(appDirectory, entry)}`];
|
|
@@ -115,10 +97,17 @@ const getDefaultIndexEntry = (_0) => __async(void 0, [_0], function* ({
|
|
|
115
97
|
});
|
|
116
98
|
const normalizeInput = (baseConfig, options) => __async(void 0, null, function* () {
|
|
117
99
|
if (baseConfig.buildType === "bundleless" && !baseConfig.input) {
|
|
118
|
-
const { slash } = yield Promise.resolve().then(() =>
|
|
100
|
+
const { slash } = yield Promise.resolve().then(() => __toESM(require("@modern-js/utils")));
|
|
119
101
|
return [slash(baseConfig.sourceDir)];
|
|
120
102
|
}
|
|
121
103
|
return getAbsInput(baseConfig.input, options);
|
|
122
104
|
});
|
|
105
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
106
|
+
0 && (module.exports = {
|
|
107
|
+
addInputToPreset,
|
|
108
|
+
getAbsInput,
|
|
109
|
+
getDefaultIndexEntry,
|
|
110
|
+
normalizeInput
|
|
111
|
+
});
|
|
123
112
|
|
|
124
113
|
//# sourceMappingURL=input.js.map
|
package/dist/utils/input.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"mappings":"
|
|
1
|
+
{"version":3,"file":null,"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBAAiB;AAYV,MAAM,cAAc,CAAO,OAAc,YAA0B;AACxE,QAAM,EAAE,MAAM,IAAI,MAAM,6CAAO;AAC/B,QAAM,EAAE,aAAa,IAAI;AAEzB,MAAI,MAAM,QAAQ,KAAK,GAAG;AACxB,WAAO,MAAM;AAAA,MAAI,OACf,oBAAK,WAAW,CAAC,IAAI,MAAM,CAAC,IAAI,MAAM,oBAAK,KAAK,cAAc,CAAC,CAAC;AAAA,IAClE;AAAA,EACF;AAEA,QAAM,WAAmC,CAAC;AAC1C,aAAW,OAAO,OAAO,KAAK,KAAK,GAAG;AACpC,aAAS,OAAO,oBAAK,WAAW,MAAM,IAAI,IACtC,MAAM,MAAM,IAAI,IAChB,MAAM,oBAAK,KAAK,cAAc,MAAM,IAAI,CAAC;AAAA,EAC/C;AACA,SAAO;AACT;AAEO,MAAM,mBAAmB,CAC9B,QACA,YACG;AACH,MAAI,MAAM,QAAQ,MAAM,GAAG;AACzB,eAAW,KAAK,QAAQ;AACtB,UAAI,EAAE,cAAc,UAAU;AAC5B,UAAE,QAAQ,MAAM,qBAAqB,OAAO;AAAA,MAC9C,WAAW,EAAE,cAAc,cAAc;AACvC,UAAE,YAAY;AAAA,MAChB;AAAA,IACF;AAAA,EACF,WAAW,OAAO,cAAc,UAAU;AACxC,WAAO,QAAQ,MAAM,qBAAqB,OAAO;AAAA,EACnD,WAAW,OAAO,cAAc,cAAc;AAC5C,WAAO,YAAY;AAAA,EACrB;AAEA,SAAO;AACT;AAEO,MAAM,uBAAuB,CAAO,OAMrC,iBANqC,KAMrC,WANqC;AAAA,EACzC;AAAA,EACA;AACF,GAGM;AACJ,QAAM,EAAE,GAAG,IAAI,MAAM,6CAAO;AAC5B,MAAI,QAAQ,cACR,oBAAK,KAAK,cAAc,gBAAgB,IACxC,oBAAK,KAAK,cAAc,gBAAgB;AAC5C,MAAI,GAAG,WAAW,KAAK,GAAG;AACxB,WAAO,CAAC,KAAK,oBAAK,SAAS,cAAc,KAAK,GAAG;AAAA,EACnD;AAEA,UAAQ,cACJ,oBAAK,KAAK,cAAc,iBAAiB,IACzC,oBAAK,KAAK,cAAc,iBAAiB;AAC7C,MAAI,GAAG,WAAW,KAAK,GAAG;AACxB,WAAO,CAAC,KAAK,oBAAK,SAAS,cAAc,KAAK,GAAG;AAAA,EACnD;AAEA,SAAO,CAAC;AACV;AAEO,MAAM,iBAAiB,CAC5B,YACA,YACG;AACH,MAAI,WAAW,cAAc,gBAAgB,CAAC,WAAW,OAAO;AAC9D,UAAM,EAAE,MAAM,IAAI,MAAM,6CAAO;AAC/B,WAAO,CAAC,MAAM,WAAW,SAAS,CAAC;AAAA,EACrC;AACA,SAAO,YAAY,WAAW,OAAO,OAAO;AAC9C;;;;;;;;","names":[],"sources":["../../src/utils/input.ts"],"sourcesContent":["import path from 'path';\nimport { ModuleContext } from '../types';\nimport type {\n Input,\n BaseBuildConfig,\n PartialBuildConfig,\n} from '../types/config';\n\ninterface EntryOptions {\n appDirectory: string;\n}\n\nexport const getAbsInput = async (entry: Input, options: EntryOptions) => {\n const { slash } = await import('@modern-js/utils');\n const { appDirectory } = options;\n\n if (Array.isArray(entry)) {\n return entry.map(p =>\n path.isAbsolute(p) ? slash(p) : slash(path.join(appDirectory, p)),\n );\n }\n\n const newEntry: Record<string, string> = {};\n for (const key of Object.keys(entry)) {\n newEntry[key] = path.isAbsolute(entry[key])\n ? slash(entry[key])\n : slash(path.join(appDirectory, entry[key]));\n }\n return newEntry;\n};\n\nexport const addInputToPreset = async (\n config: PartialBuildConfig,\n context: ModuleContext,\n) => {\n if (Array.isArray(config)) {\n for (const c of config) {\n if (c.buildType === 'bundle') {\n c.input = await getDefaultIndexEntry(context);\n } else if (c.buildType === 'bundleless') {\n c.sourceDir = './src';\n }\n }\n } else if (config.buildType === 'bundle') {\n config.input = await getDefaultIndexEntry(context);\n } else if (config.buildType === 'bundleless') {\n config.sourceDir = './src';\n }\n\n return config;\n};\n\nexport const getDefaultIndexEntry = async ({\n isTsProject,\n appDirectory,\n}: {\n isTsProject: boolean;\n appDirectory: string;\n}) => {\n const { fs } = await import('@modern-js/utils');\n let entry = isTsProject\n ? path.join(appDirectory, './src/index.ts')\n : path.join(appDirectory, './src/index.js');\n if (fs.existsSync(entry)) {\n return [`./${path.relative(appDirectory, entry)}`];\n }\n\n entry = isTsProject\n ? path.join(appDirectory, './src/index.tsx')\n : path.join(appDirectory, './src/index.jsx');\n if (fs.existsSync(entry)) {\n return [`./${path.relative(appDirectory, entry)}`];\n }\n\n return [];\n};\n\nexport const normalizeInput = async (\n baseConfig: BaseBuildConfig,\n options: EntryOptions,\n) => {\n if (baseConfig.buildType === 'bundleless' && !baseConfig.input) {\n const { slash } = await import('@modern-js/utils');\n return [slash(baseConfig.sourceDir)];\n }\n return getAbsInput(baseConfig.input, options);\n};\n"]}
|
package/dist/utils/language.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
|
-
getLocaleLanguage: () => getLocaleLanguage,
|
|
21
|
-
initLocalLanguage: () => initLocalLanguage
|
|
22
|
-
});
|
|
23
|
-
module.exports = __toCommonJS(stdin_exports);
|
|
24
|
-
var import_utils = require("@modern-js/utils");
|
|
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 language_exports = {};
|
|
45
|
+
__export(language_exports, {
|
|
46
|
+
getLocaleLanguage: () => getLocaleLanguage,
|
|
47
|
+
initLocalLanguage: () => initLocalLanguage
|
|
48
|
+
});
|
|
49
|
+
module.exports = __toCommonJS(language_exports);
|
|
50
|
+
var import_utils = require("@modern-js/utils");
|
|
63
51
|
const i18n = import_utils.Import.lazy("@modern-js/plugin-i18n/language-detector", require);
|
|
64
52
|
function getLocaleLanguage() {
|
|
65
53
|
const detector = new i18n.I18CLILanguageDetector();
|
|
@@ -71,5 +59,10 @@ const initLocalLanguage = () => __async(void 0, null, function* () {
|
|
|
71
59
|
local.i18n.changeLanguage({ locale });
|
|
72
60
|
return local;
|
|
73
61
|
});
|
|
62
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
63
|
+
0 && (module.exports = {
|
|
64
|
+
getLocaleLanguage,
|
|
65
|
+
initLocalLanguage
|
|
66
|
+
});
|
|
74
67
|
|
|
75
68
|
//# sourceMappingURL=language.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"mappings":"
|
|
1
|
+
{"version":3,"file":null,"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAAuB;AAEvB,MAAM,OACJ,oBAAO,KAAK,4CAA4C,OAAO;AAE1D,SAAS,oBAAoB;AAClC,QAAM,WAAW,IAAI,KAAK,uBAAuB;AACjD,SAAO,SAAS,OAAO;AACzB;AAEO,MAAM,oBAAoB,MAAY;AAC3C,QAAM,QAAQ,MAAM,6CAAO;AAC3B,QAAM,SAAS,kBAAkB;AACjC,QAAM,KAAK,eAAe,EAAE,OAAO,CAAC;AACpC,SAAO;AACT;;;;;;","names":[],"sources":["../../src/utils/language.ts"],"sourcesContent":["import { Import } from '@modern-js/utils';\n\nconst i18n: typeof import('@modern-js/plugin-i18n/language-detector') =\n Import.lazy('@modern-js/plugin-i18n/language-detector', require);\n\nexport function getLocaleLanguage() {\n const detector = new i18n.I18CLILanguageDetector();\n return detector.detect();\n}\n\nexport const initLocalLanguage = async () => {\n const local = await import('../locale');\n const locale = getLocaleLanguage();\n local.i18n.changeLanguage({ locale });\n return local;\n};\n"]}
|
|
@@ -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,31 +16,11 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
14
16
|
}
|
|
15
17
|
return to;
|
|
16
18
|
};
|
|
17
|
-
var
|
|
18
|
-
|
|
19
|
-
__export(stdin_exports, {
|
|
20
|
-
externalPlugin: () => externalPlugin,
|
|
21
|
-
watchPlugin: () => watchPlugin
|
|
22
|
-
});
|
|
23
|
-
module.exports = __toCommonJS(stdin_exports);
|
|
24
|
-
var __create = Object.create;
|
|
25
|
-
var __defProp2 = Object.defineProperty;
|
|
26
|
-
var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor;
|
|
27
|
-
var __getOwnPropNames2 = Object.getOwnPropertyNames;
|
|
28
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
29
|
-
var __hasOwnProp2 = Object.prototype.hasOwnProperty;
|
|
30
|
-
var __copyProps2 = (to, from, except, desc) => {
|
|
31
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
32
|
-
for (let key of __getOwnPropNames2(from))
|
|
33
|
-
if (!__hasOwnProp2.call(to, key) && key !== except)
|
|
34
|
-
__defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable });
|
|
35
|
-
}
|
|
36
|
-
return to;
|
|
37
|
-
};
|
|
38
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps2(
|
|
39
|
-
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,
|
|
40
21
|
mod
|
|
41
22
|
));
|
|
23
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
42
24
|
var __async = (__this, __arguments, generator) => {
|
|
43
25
|
return new Promise((resolve, reject) => {
|
|
44
26
|
var fulfilled = (value) => {
|
|
@@ -59,6 +41,12 @@ var __async = (__this, __arguments, generator) => {
|
|
|
59
41
|
step((generator = generator.apply(__this, __arguments)).next());
|
|
60
42
|
});
|
|
61
43
|
};
|
|
44
|
+
var libuild_plugins_exports = {};
|
|
45
|
+
__export(libuild_plugins_exports, {
|
|
46
|
+
externalPlugin: () => externalPlugin,
|
|
47
|
+
watchPlugin: () => watchPlugin
|
|
48
|
+
});
|
|
49
|
+
module.exports = __toCommonJS(libuild_plugins_exports);
|
|
62
50
|
const watchPlugin = (config) => {
|
|
63
51
|
return {
|
|
64
52
|
name: "watch-plugin",
|
|
@@ -86,5 +74,10 @@ const externalPlugin = (config, options) => {
|
|
|
86
74
|
}
|
|
87
75
|
};
|
|
88
76
|
};
|
|
77
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
78
|
+
0 && (module.exports = {
|
|
79
|
+
externalPlugin,
|
|
80
|
+
watchPlugin
|
|
81
|
+
});
|
|
89
82
|
|
|
90
83
|
//# sourceMappingURL=libuild-plugins.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"mappings":"
|
|
1
|
+
{"version":3,"file":null,"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAGO,MAAM,cAAc,CAAC,WAA2C;AACrE,SAAO;AAAA,IACL,MAAM;AAAA,IACN,MAAM,UAAU;AACd,eAAS,MAAM,YAAY,IAAI,gBAAgB,MAAY;AACzD,cAAM,EAAE,kBAAkB,IAAI,MAAM,6CAAO;AAC3C,cAAM,EAAE,mBAAmB,IAAI,MAAM,6CAAO;AAC5C,cAAM,YAAY,IAChB,OAAO,cAAc,WAAW,WAAW,gBACzC,OAAO,UAAU,OAAO;AAC5B,gBAAQ;AAAA,UACN,MAAM,kBAAkB,WAAW,mBAAmB,GAAG;AAAA,QAC3D;AAAA,MACF,EAAC;AAAA,IACH;AAAA,EACF;AACF;AAEO,MAAM,iBAAiB,CAC5B,QACA,YACkB;AAClB,SAAO;AAAA,IACL,MAAM;AAAA,IACN,MAAM,UAAU;AACd,eAAS,MAAM,WAAW,WAAW,mBAAmB,MAAY;AAClE,cAAM,EAAE,kBAAkB,IAAI,MAAM,6CAAO;AAC3C,cAAM,iBAAiB,MAAM,kBAAkB,QAAQ,OAAO;AAC9D,iBAAS,OAAO,WAAW;AAAA,MAC7B,EAAC;AAAA,IACH;AAAA,EACF;AACF;;;;;;","names":[],"sources":["../../src/utils/libuild-plugins.ts"],"sourcesContent":["import type { LibuildPlugin } from '@modern-js/libuild';\nimport type { BaseBuildConfig } from '../types';\n\nexport const watchPlugin = (config: BaseBuildConfig): LibuildPlugin => {\n return {\n name: 'watch-plugin',\n apply(compiler) {\n compiler.hooks.watchChange.tap('watch-plugin', async () => {\n const { watchSectionTitle } = await import('./log');\n const { SectionTitleStatus } = await import('../constants/log');\n const titleText = `[${\n config.buildType === 'bundle' ? 'Bundle' : 'Bundleless'\n }:${config.format}_${config.target}]`;\n console.info(\n await watchSectionTitle(titleText, SectionTitleStatus.Log),\n );\n });\n },\n };\n};\n\nexport const externalPlugin = (\n config: BaseBuildConfig,\n options: { appDirectory: string },\n): LibuildPlugin => {\n return {\n name: 'external-plugin',\n apply(compiler) {\n compiler.hooks.initialize.tapPromise('external-plugin', async () => {\n const { getFinalExternals } = await import('./builder');\n const finalExternals = await getFinalExternals(config, options);\n compiler.config.external = finalExternals;\n });\n },\n };\n};\n"]}
|
package/dist/utils/log.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,31 +16,11 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
14
16
|
}
|
|
15
17
|
return to;
|
|
16
18
|
};
|
|
17
|
-
var
|
|
18
|
-
|
|
19
|
-
__export(stdin_exports, {
|
|
20
|
-
watchSectionTitle: () => watchSectionTitle
|
|
21
|
-
});
|
|
22
|
-
module.exports = __toCommonJS(stdin_exports);
|
|
23
|
-
var import_log = require("../constants/log");
|
|
24
|
-
var __create = Object.create;
|
|
25
|
-
var __defProp2 = Object.defineProperty;
|
|
26
|
-
var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor;
|
|
27
|
-
var __getOwnPropNames2 = Object.getOwnPropertyNames;
|
|
28
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
29
|
-
var __hasOwnProp2 = Object.prototype.hasOwnProperty;
|
|
30
|
-
var __copyProps2 = (to, from, except, desc) => {
|
|
31
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
32
|
-
for (let key of __getOwnPropNames2(from))
|
|
33
|
-
if (!__hasOwnProp2.call(to, key) && key !== except)
|
|
34
|
-
__defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable });
|
|
35
|
-
}
|
|
36
|
-
return to;
|
|
37
|
-
};
|
|
38
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps2(
|
|
39
|
-
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,
|
|
40
21
|
mod
|
|
41
22
|
));
|
|
23
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
42
24
|
var __async = (__this, __arguments, generator) => {
|
|
43
25
|
return new Promise((resolve, reject) => {
|
|
44
26
|
var fulfilled = (value) => {
|
|
@@ -59,6 +41,12 @@ var __async = (__this, __arguments, generator) => {
|
|
|
59
41
|
step((generator = generator.apply(__this, __arguments)).next());
|
|
60
42
|
});
|
|
61
43
|
};
|
|
44
|
+
var log_exports = {};
|
|
45
|
+
__export(log_exports, {
|
|
46
|
+
watchSectionTitle: () => watchSectionTitle
|
|
47
|
+
});
|
|
48
|
+
module.exports = __toCommonJS(log_exports);
|
|
49
|
+
var import_log = require("../constants/log");
|
|
62
50
|
const watchSectionTitle = (str, status) => __async(void 0, null, function* () {
|
|
63
51
|
const { chalk } = yield Promise.resolve().then(() => __toESM(require("@modern-js/utils")));
|
|
64
52
|
if (status === import_log.SectionTitleStatus.Success) {
|
|
@@ -72,5 +60,9 @@ const watchSectionTitle = (str, status) => __async(void 0, null, function* () {
|
|
|
72
60
|
}
|
|
73
61
|
return `${chalk.bgWhite.gray.underline(str)} ${chalk.blue.underline("Log")}`;
|
|
74
62
|
});
|
|
63
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
64
|
+
0 && (module.exports = {
|
|
65
|
+
watchSectionTitle
|
|
66
|
+
});
|
|
75
67
|
|
|
76
68
|
//# sourceMappingURL=log.js.map
|