@modern-js/module-tools 2.23.1 → 2.24.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/CHANGELOG.md +21 -0
- package/dist/builder/clear.d.ts +4 -1
- package/dist/builder/clear.js +9 -2
- package/dist/builder/clear.js.map +1 -1
- package/dist/builder/dts/rollup.js +2 -1
- package/dist/builder/dts/rollup.js.map +1 -1
- package/dist/builder/index.js +4 -1
- package/dist/builder/index.js.map +1 -1
- package/dist/locale/en.d.ts +1 -0
- package/dist/locale/en.js +2 -1
- package/dist/locale/en.js.map +1 -1
- package/dist/locale/index.d.ts +2 -0
- package/dist/locale/zh.d.ts +1 -0
- package/dist/locale/zh.js +2 -1
- package/dist/locale/zh.js.map +1 -1
- package/package.json +16 -16
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,26 @@
|
|
|
1
1
|
# @modern-js/module-tools
|
|
2
2
|
|
|
3
|
+
## 2.24.0
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 53ba418: chore: upgrade libuild and libuild plugins version to 0.13.1
|
|
8
|
+
chore: 升级 libuild 和 libuild 插件版本到 0.13.1
|
|
9
|
+
- 3b82675: feat: Auto delete build product by checking if outdir is project root path
|
|
10
|
+
feat: 根据 outDir 是否是项目根目录决定是否自动删除产物目录
|
|
11
|
+
- 7073297: fix: close declarationMap when bundle dts
|
|
12
|
+
fix: 打包 dts 时关闭 declarationMap
|
|
13
|
+
- Updated dependencies [c882fbd]
|
|
14
|
+
- Updated dependencies [4a82c3b]
|
|
15
|
+
- @modern-js/utils@2.24.0
|
|
16
|
+
- @modern-js/core@2.24.0
|
|
17
|
+
- @modern-js/plugin-changeset@2.24.0
|
|
18
|
+
- @modern-js/plugin-i18n@2.24.0
|
|
19
|
+
- @modern-js/plugin-lint@2.24.0
|
|
20
|
+
- @modern-js/new-action@2.24.0
|
|
21
|
+
- @modern-js/plugin@2.24.0
|
|
22
|
+
- @modern-js/upgrade@2.24.0
|
|
23
|
+
|
|
3
24
|
## 2.23.1
|
|
4
25
|
|
|
5
26
|
### Patch Changes
|
package/dist/builder/clear.d.ts
CHANGED
|
@@ -1,3 +1,6 @@
|
|
|
1
1
|
import type { BaseBuildConfig } from '../types';
|
|
2
2
|
export declare const clearDtsTemp: () => Promise<void>;
|
|
3
|
-
export declare const clearBuildConfigPaths: (configs: BaseBuildConfig[],
|
|
3
|
+
export declare const clearBuildConfigPaths: (configs: BaseBuildConfig[], options?: {
|
|
4
|
+
noClear?: boolean;
|
|
5
|
+
projectAbsRootPath?: string;
|
|
6
|
+
}) => Promise<void>;
|
package/dist/builder/clear.js
CHANGED
|
@@ -23,13 +23,20 @@ const clearDtsTemp = async () => {
|
|
|
23
23
|
const { dtsTempDirectory } = await Promise.resolve().then(() => /* @__PURE__ */ _interop_require_wildcard._(require("../constants/dts")));
|
|
24
24
|
await fs.remove(dtsTempDirectory);
|
|
25
25
|
};
|
|
26
|
-
const clearBuildConfigPaths = async (configs,
|
|
26
|
+
const clearBuildConfigPaths = async (configs, options) => {
|
|
27
|
+
const { noClear = false, projectAbsRootPath = process.cwd() } = options !== null && options !== void 0 ? options : {};
|
|
27
28
|
const { fs } = await Promise.resolve().then(() => /* @__PURE__ */ _interop_require_wildcard._(require("@modern-js/utils")));
|
|
28
29
|
if (noClear) {
|
|
29
30
|
return;
|
|
30
31
|
}
|
|
31
32
|
for (const config of configs) {
|
|
32
|
-
|
|
33
|
+
if (projectAbsRootPath === config.outDir) {
|
|
34
|
+
const { logger, chalk } = await Promise.resolve().then(() => /* @__PURE__ */ _interop_require_wildcard._(require("@modern-js/utils")));
|
|
35
|
+
const local = await Promise.resolve().then(() => /* @__PURE__ */ _interop_require_wildcard._(require("../locale")));
|
|
36
|
+
logger.warn(chalk.bgYellowBright(local.i18n.t(local.localeKeys.warns.clearRootPath)));
|
|
37
|
+
} else {
|
|
38
|
+
await fs.remove(config.outDir);
|
|
39
|
+
}
|
|
33
40
|
}
|
|
34
41
|
};
|
|
35
42
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":null,"mappings":";;;;;;;;;;;;EAEaA,cAAY;WAAZA;;EAMAC,uBAAqB;WAArBA;;;;AANN,MAAMD,eAAe,YAAY;AACtC,QAAM,EAAEE,GAAE,IAAK,MAAM,iFAAO;AAC5B,QAAM,EAAEC,iBAAgB,IAAK,MAAM,iFAAO;AAC1C,QAAMD,GAAGE,OAAOD;AAClB;AAEO,MAAMF,wBAAwB,OACnCI,SACAC,
|
|
1
|
+
{"version":3,"file":null,"mappings":";;;;;;;;;;;;EAEaA,cAAY;WAAZA;;EAMAC,uBAAqB;WAArBA;;;;AANN,MAAMD,eAAe,YAAY;AACtC,QAAM,EAAEE,GAAE,IAAK,MAAM,iFAAO;AAC5B,QAAM,EAAEC,iBAAgB,IAAK,MAAM,iFAAO;AAC1C,QAAMD,GAAGE,OAAOD;AAClB;AAEO,MAAMF,wBAAwB,OACnCI,SACAC,YAIG;AACH,QAAM,EAAEC,UAAU,OAAOC,qBAAqBC,QAAQC,IAAG,EAAE,IAAKJ,mDAAW,CAAC;AAC5E,QAAM,EAAEJ,GAAE,IAAK,MAAM,iFAAO;AAE5B,MAAIK,SAAS;AACX;EACF;AAEA,aAAWI,UAAUN,SAAS;AAC5B,QAAIG,uBAAuBG,OAAOC,QAAQ;AACxC,YAAM,EAAEC,QAAQC,MAAK,IAAK,MAAM,iFAAO;AACvC,YAAMC,QAAQ,MAAM,iFAAO;AAC3BF,aAAOG,KACLF,MAAMG,eACJF,MAAMG,KAAKC,EAAEJ,MAAMK,WAAWC,MAAMC,aAAa;IAGvD,OAAO;AACL,YAAMpB,GAAGE,OAAOO,OAAOC,MAAM;IAC/B;EACF;AACF;","names":["clearDtsTemp","clearBuildConfigPaths","fs","dtsTempDirectory","remove","configs","options","noClear","projectAbsRootPath","process","cwd","config","outDir","logger","chalk","local","warn","bgYellowBright","i18n","t","localeKeys","warns","clearRootPath"],"sources":["../../src/builder/home/runner/work/modern.js/modern.js/packages/solutions/module-tools/src/builder/clear.ts"],"sourcesContent":["import type { BaseBuildConfig } from '../types';\n\nexport const clearDtsTemp = async () => {\n const { fs } = await import('@modern-js/utils');\n const { dtsTempDirectory } = await import('../constants/dts');\n await fs.remove(dtsTempDirectory);\n};\n\nexport const clearBuildConfigPaths = async (\n configs: BaseBuildConfig[],\n options?: {\n noClear?: boolean;\n projectAbsRootPath?: string;\n },\n) => {\n const { noClear = false, projectAbsRootPath = process.cwd() } = options ?? {};\n const { fs } = await import('@modern-js/utils');\n\n if (noClear) {\n return;\n }\n\n for (const config of configs) {\n if (projectAbsRootPath === config.outDir) {\n const { logger, chalk } = await import('@modern-js/utils');\n const local = await import('../locale');\n logger.warn(\n chalk.bgYellowBright(\n local.i18n.t(local.localeKeys.warns.clearRootPath),\n ),\n );\n } else {\n await fs.remove(config.outDir);\n }\n }\n};\n"]}
|
|
@@ -44,7 +44,6 @@ const runRollup = async (api, { distDir, tsconfigPath, externals, input, watch,
|
|
|
44
44
|
dtsPlugin({
|
|
45
45
|
respectExternal,
|
|
46
46
|
compilerOptions: {
|
|
47
|
-
declarationMap: false,
|
|
48
47
|
skipLibCheck: true,
|
|
49
48
|
// https://github.com/Swatinem/rollup-plugin-dts/issues/143,
|
|
50
49
|
// but it will cause error when bundle ts which import another ts file.
|
|
@@ -52,6 +51,8 @@ const runRollup = async (api, { distDir, tsconfigPath, externals, input, watch,
|
|
|
52
51
|
...options,
|
|
53
52
|
// https://github.com/Swatinem/rollup-plugin-dts/issues/127
|
|
54
53
|
composite: false,
|
|
54
|
+
// https://github.com/Swatinem/rollup-plugin-dts/issues/113
|
|
55
|
+
declarationMap: false,
|
|
55
56
|
// isAbsolute
|
|
56
57
|
baseUrl,
|
|
57
58
|
// Ensure ".d.ts" modules are generated
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":null,"mappings":";;;;+BA2BaA;;;WAAAA;;;;;iEA3BI;wBACM;AA0BhB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,cAAc;AACtCC,uBAAOC,KACL,MAAMX,kBACJE,oBACAD,mBAAmBY,OAAO;AAG9BV,eAAOW,cAAc;UAAEC,WAAW;QAAS;MAC7C,WAAWP,MAAMC,SAAS,SAAS;MAEnC;IACF;AACA,WAAOJ;EACT,OAAO;AACL,QAAI;AACF,YAAM,EAAEW,OAAM,IAAK,MAAM,iFAAO;AAChC,YAAM,EAAEC,eAAc,IAAK,MAAM,iFAAO;AACxC,YAAMC,SAAS,MAAMF,OAAOvC;AAC5B,YAAM0C,eAAe,MAAMD,OAAOE,MAAMxB;AACxC,YAAM,EAAEyB,aAAY,IAAK3E,IAAI4E,cAAa;AAC1CL,qBAAeE,cAAcE,cAAczB,aAAaC,GAAG;AAC3D,aAAOqB;IACT,SAASK,GAAP;AACA,YAAM,EAAEC,sBAAqB,IAAK,MAAM,iFAAO;AAC/C,YAAMA,sBAAsBD,GAAG;QAAEvE;QAAc+D,WAAW;MAAS;AACnE,aAAO;IACT;EACF;AACF;","names":["runRollup","api","distDir","tsconfigPath","externals","input","watch","abortOnError","respectExternal","ignoreFiles","name","load","id","test","ts","configFile","readConfigFile","sys","readFile","options","parseJsonConfigFileContent","config","default","jsonPlugin","dtsPlugin","transformUndefineObject","baseUrl","path","isAbsolute","join","dirname","ignoreCompileOptions","inputConfig","external","plugins","compilerOptions","skipLibCheck","preserveSymlinks","composite","declarationMap","declaration","noEmit","emitDeclarationOnly","noEmitOnError","checkJs","target","ScriptTarget","ESNext","tsconfig","filter","Boolean","outputConfig","dir","format","exports","watchSectionTitle","SectionTitleStatus","BundleDtsLogPrefix","runner","useHookRunners","watcher","output","on","event","code","logger","info","Log","Success","buildWatchDts","buildType","rollup","addRollupChunk","bundle","rollupOutput","write","appDirectory","useAppContext","e","printOrThrowDtsErrors"],"sources":["../../../src/builder/dts/home/runner/work/modern.js/modern.js/packages/solutions/module-tools/src/builder/dts/rollup.ts"],"sourcesContent":["import path from 'path';\nimport { logger } from '@modern-js/utils/logger';\nimport type {\n InputOptions,\n OutputOptions,\n Plugin,\n RollupWatcher,\n} from '../../../compiled/rollup';\nimport type {\n BaseBuildConfig,\n Input,\n PluginAPI,\n ModuleTools,\n} from '../../types';\n\nexport type { RollupWatcher };\n\ntype Config = {\n distDir: string;\n tsconfigPath: string;\n externals: BaseBuildConfig['externals'];\n input: Input;\n watch: boolean;\n abortOnError: boolean;\n respectExternal: boolean;\n};\n\nexport const runRollup = async (\n api: PluginAPI<ModuleTools>,\n {\n distDir,\n tsconfigPath,\n externals,\n input,\n watch,\n abortOnError,\n respectExternal,\n }: Config,\n) => {\n const ignoreFiles: Plugin = {\n name: 'ignore-files',\n load(id) {\n if (!/\\.(js|jsx|ts|tsx|json|cts|mts)$/.test(id)) {\n return '';\n }\n return null;\n },\n };\n const ts = await import('typescript');\n const configFile = ts.readConfigFile(tsconfigPath, ts.sys.readFile);\n const { options } = ts.parseJsonConfigFileContent(\n configFile.config,\n ts.sys,\n './',\n );\n\n const { default: jsonPlugin } = await import(\n '../../../compiled/@rollup/plugin-json'\n );\n const { default: dtsPlugin } = await import(\n '../../../compiled/rollup-plugin-dts'\n );\n const { transformUndefineObject } = await import('../../utils/common');\n\n const baseUrl = path.isAbsolute(options.baseUrl || '.')\n ? options.baseUrl\n : path.join(path.dirname(tsconfigPath), options.baseUrl || '.');\n const ignoreCompileOptions = [\n 'incremental',\n 'tsBuildInfoFile',\n 'sourceMap',\n 'inlineSources',\n ];\n\n const inputConfig: InputOptions = {\n input,\n external: externals,\n plugins: [\n jsonPlugin(),\n ignoreFiles,\n dtsPlugin({\n respectExternal,\n compilerOptions: {\n skipLibCheck: true,\n // https://github.com/Swatinem/rollup-plugin-dts/issues/143,\n // but it will cause error when bundle ts which import another ts file.\n preserveSymlinks: false,\n ...options,\n // https://github.com/Swatinem/rollup-plugin-dts/issues/127\n composite: false,\n // https://github.com/Swatinem/rollup-plugin-dts/issues/113\n declarationMap: false,\n // isAbsolute\n baseUrl,\n // Ensure \".d.ts\" modules are generated\n declaration: true,\n // Skip \".js\" generation\n noEmit: false,\n emitDeclarationOnly: true,\n // Skip code generation when error occurs\n noEmitOnError: true,\n // Avoid extra work\n checkJs: false,\n // Ensure we can parse the latest code\n target: ts.ScriptTarget.ESNext,\n ...transformUndefineObject(ignoreCompileOptions),\n },\n tsconfig: tsconfigPath,\n }),\n ].filter(Boolean),\n };\n const outputConfig: OutputOptions = {\n dir: distDir,\n format: 'esm',\n exports: 'named',\n };\n if (watch) {\n const { watch } = await import('../../../compiled/rollup');\n const { watchSectionTitle } = await import('../../utils/log');\n const { SectionTitleStatus, BundleDtsLogPrefix } = await import(\n '../../constants/log'\n );\n const runner = api.useHookRunners();\n const watcher = watch({\n ...inputConfig,\n plugins: inputConfig.plugins,\n output: outputConfig,\n }).on('event', async event => {\n if (event.code === 'START') {\n logger.info(\n await watchSectionTitle(BundleDtsLogPrefix, SectionTitleStatus.Log),\n );\n } else if (event.code === 'BUNDLE_END') {\n logger.info(\n await watchSectionTitle(\n BundleDtsLogPrefix,\n SectionTitleStatus.Success,\n ),\n );\n runner.buildWatchDts({ buildType: 'bundle' });\n } else if (event.code === 'ERROR') {\n // this is dts rollup plugin bug, error not complete message\n }\n });\n return watcher;\n } else {\n try {\n const { rollup } = await import('../../../compiled/rollup');\n const { addRollupChunk } = await import('../../utils/print');\n const bundle = await rollup(inputConfig);\n const rollupOutput = await bundle.write(outputConfig);\n const { appDirectory } = api.useAppContext();\n addRollupChunk(rollupOutput, appDirectory, outputConfig.dir!);\n return bundle;\n } catch (e) {\n const { printOrThrowDtsErrors } = await import('../../utils/dts');\n await printOrThrowDtsErrors(e, { abortOnError, buildType: 'bundle' });\n return null;\n }\n }\n};\n"]}
|
package/dist/builder/index.js
CHANGED
|
@@ -20,7 +20,10 @@ const run = async (options, api) => {
|
|
|
20
20
|
const { runBuildTask } = await Promise.resolve().then(() => /* @__PURE__ */ _interop_require_wildcard._(require("./build")));
|
|
21
21
|
const { default: pMap } = await Promise.resolve().then(() => /* @__PURE__ */ _interop_require_wildcard._(require("../../compiled/p-map")));
|
|
22
22
|
const { clearBuildConfigPaths, clearDtsTemp } = await Promise.resolve().then(() => /* @__PURE__ */ _interop_require_wildcard._(require("./clear")));
|
|
23
|
-
await clearBuildConfigPaths(resolvedBuildConfig,
|
|
23
|
+
await clearBuildConfigPaths(resolvedBuildConfig, {
|
|
24
|
+
noClear: !cmdOptions.clear,
|
|
25
|
+
projectAbsRootPath: context.appDirectory
|
|
26
|
+
});
|
|
24
27
|
await clearDtsTemp();
|
|
25
28
|
if (cmdOptions.watch) {
|
|
26
29
|
_logger.logger.info("Start build in watch mode...\n");
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":null,"mappings":";;;;+BASaA;;;WAAAA;;;;wBARU;AAQhB,MAAMA,MAAM,OACjBC,SAKAC,QACG;AACH,QAAM,EAAEC,MAAK,IAAK,MAAM,iFAAO;AAC/B,QAAM,EAAEC,qBAAqBC,SAASC,WAAU,IAAKL;AACrD,QAAMM,SAASL,IAAIM,eAAc;AAEjC,MAAIC,gBAAgB;AAEpB,MAAIL,oBAAoBM,WAAW,GAAG;AACpCD,oBAAgBE,KAAKC,IAAG;AAExB,UAAM,EAAEC,aAAY,IAAK,MAAM,iFAAO;AACtC,UAAM,EAAEC,SAASC,KAAI,IAAK,MAAM,iFAAO;AAEvC,UAAM,EAAEC,uBAAuBC,aAAY,IAAK,MAAM,iFAAO;AAC7D,UAAMD,sBAAsBZ,qBAAqB,
|
|
1
|
+
{"version":3,"file":null,"mappings":";;;;+BASaA;;;WAAAA;;;;wBARU;AAQhB,MAAMA,MAAM,OACjBC,SAKAC,QACG;AACH,QAAM,EAAEC,MAAK,IAAK,MAAM,iFAAO;AAC/B,QAAM,EAAEC,qBAAqBC,SAASC,WAAU,IAAKL;AACrD,QAAMM,SAASL,IAAIM,eAAc;AAEjC,MAAIC,gBAAgB;AAEpB,MAAIL,oBAAoBM,WAAW,GAAG;AACpCD,oBAAgBE,KAAKC,IAAG;AAExB,UAAM,EAAEC,aAAY,IAAK,MAAM,iFAAO;AACtC,UAAM,EAAEC,SAASC,KAAI,IAAK,MAAM,iFAAO;AAEvC,UAAM,EAAEC,uBAAuBC,aAAY,IAAK,MAAM,iFAAO;AAC7D,UAAMD,sBAAsBZ,qBAAqB;MAC/Cc,SAAS,CAACZ,WAAWa;MACrBC,oBAAoBf,QAAQgB;IAC9B;AACA,UAAMJ;AAEN,QAAIX,WAAWgB,OAAO;AACpBC,qBAAOC,KAAK;IACd;AAEA,QAAI;AACF,YAAMT,KAAKX,qBAAqB,OAAMqB,WAAU;AAC9C,cAAMC,cAAc,MAAMnB,OAAOoB,gBAAgBF;AAEjD,cAAMZ,aACJ;UACEa;UACAE,iBAAiBtB;UACjBD;QACF,GACAH;AAEF,cAAMK,OAAOsB,eAAe;UAAEC,QAAQ;UAAWL;QAAO;MAC1D;IACF,SAASM,GAAP;AACA,YAAM,EAAEC,iBAAiBC,iBAAgB,IAAK,MAAM,iFAAO;AAC3D,UAAID,gBAAgBD,IAAI;AACtB,cAAM,IAAIE,iBAAiBF;MAC7B,OAAO;AACL,cAAMA;MACR;IACF;AACAtB,oBAAgBE,KAAKC,IAAG,IAAKH;AAC7B,QAAI,CAACH,WAAWgB,OAAO;AACrB,YAAM,EAAEY,eAAeC,aAAY,IAAK,MAAM,iFAAO;AACrDA,mBAAa1B;AACbyB;IACF;EACF,OAAO;AACLX,mBAAOa,KACLjC,MAAMkC,OACJ,mFAAmF;EAGzF;AAEA,QAAM9B,OAAO+B,WAAW;IACtBR,QAAQ;IACRL,QAAQrB;IACRmC,gBAAgBjC;IAChBG;EACF;AACF;","names":["run","options","api","chalk","resolvedBuildConfig","context","cmdOptions","runner","useHookRunners","totalDuration","length","Date","now","runBuildTask","default","pMap","clearBuildConfigPaths","clearDtsTemp","noClear","clear","projectAbsRootPath","appDirectory","watch","logger","info","config","buildConfig","beforeBuildTask","buildCmdOptions","afterBuildTask","status","e","isInternalError","ModuleBuildError","printFileSize","printSucceed","warn","yellow","afterBuild","commandOptions"],"sources":["../../src/builder/home/runner/work/modern.js/modern.js/packages/solutions/module-tools/src/builder/index.ts"],"sourcesContent":["import type { PluginAPI } from '@modern-js/core';\nimport { logger } from '@modern-js/utils/logger';\nimport type { ModuleContext } from '../types/context';\nimport type {\n BuildCommandOptions,\n BaseBuildConfig,\n ModuleTools,\n} from '../types';\n\nexport const run = async (\n options: {\n cmdOptions: BuildCommandOptions;\n resolvedBuildConfig: BaseBuildConfig[];\n context: ModuleContext;\n },\n api: PluginAPI<ModuleTools>,\n) => {\n const { chalk } = await import('@modern-js/utils');\n const { resolvedBuildConfig, context, cmdOptions } = options;\n const runner = api.useHookRunners();\n\n let totalDuration = 0;\n\n if (resolvedBuildConfig.length !== 0) {\n totalDuration = Date.now();\n\n const { runBuildTask } = await import('./build');\n const { default: pMap } = await import('../../compiled/p-map');\n\n const { clearBuildConfigPaths, clearDtsTemp } = await import('./clear');\n await clearBuildConfigPaths(resolvedBuildConfig, {\n noClear: !cmdOptions.clear,\n projectAbsRootPath: context.appDirectory,\n });\n await clearDtsTemp();\n\n if (cmdOptions.watch) {\n logger.info('Start build in watch mode...\\n');\n }\n\n try {\n await pMap(resolvedBuildConfig, async config => {\n const buildConfig = await runner.beforeBuildTask(config);\n\n await runBuildTask(\n {\n buildConfig,\n buildCmdOptions: cmdOptions,\n context,\n },\n api,\n );\n await runner.afterBuildTask({ status: 'success', config });\n });\n } catch (e) {\n const { isInternalError, ModuleBuildError } = await import('../error');\n if (isInternalError(e)) {\n throw new ModuleBuildError(e);\n } else {\n throw e;\n }\n }\n totalDuration = Date.now() - totalDuration;\n if (!cmdOptions.watch) {\n const { printFileSize, printSucceed } = await import('../utils/print');\n printSucceed(totalDuration);\n printFileSize();\n }\n } else {\n logger.warn(\n chalk.yellow(\n `No build configuration found! Please configure \\`buildConfig\\` or \\`buildPreset\\``,\n ),\n );\n }\n\n await runner.afterBuild({\n status: 'success',\n config: resolvedBuildConfig,\n commandOptions: cmdOptions,\n totalDuration,\n });\n};\n"]}
|
package/dist/locale/en.d.ts
CHANGED
package/dist/locale/en.js
CHANGED
|
@@ -58,7 +58,8 @@ const EN_LOCALE = {
|
|
|
58
58
|
warns: {
|
|
59
59
|
dts: {
|
|
60
60
|
abortOnError: "With the `dts.abortOnError` configuration currently turned off, type errors do not cause build failures, but they do not guarantee proper type file output"
|
|
61
|
-
}
|
|
61
|
+
},
|
|
62
|
+
clearRootPath: "It is detected that the outDir in the configuration is the same as the current project directory, and the current product directory will not be automatically deleted."
|
|
62
63
|
}
|
|
63
64
|
};
|
|
64
65
|
|
package/dist/locale/en.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":null,"mappings":";;;;+BASaA;;;WAAAA;;;uBATS;AAEtB,MAAMC,aAAa;MACbC,aAAMC,UACRD,aAAME,KAAK,gBACX;;AAIG,MAAMJ,YAAY;EACvBK,SAAS;IACPC,OAAO;MACLC,UAAU;MACVC,OAAO;MACPC,UAAU;MACVC,WAAW;MACXC,UACE;MACFC,OAAO;MACPC,KAAK;MACLC,SAAS;MACTC,QAAQ;IACV;IACAC,KAAK;MACHT,UAAU;MACVE,UAAU;IACZ;IACAQ,KAAK;MACHV,UAAU;MACVW,OAAO;MACPH,QAAQ;MACRI,SAAS;MACTC,UAAU;MACVC,MAAM;IACR;EACF;EACAC,KAAK;IACHN,KAAK;MACHO,YAAYtB;IACd;EACF;EACAuB,QAAQ;IACNC,iBAAiB;QACbvB,aAAME,KAAK;QACXF,aAAMwB,OAAO,8BAA8BxB,aAAMwB,OACnD;;QAGExB,aAAME,KAAK;QACXF,aAAMwB,OAAO,+BAA+BxB,aAAMwB,OACpD;;QAGExB,aAAME,KAAK;QACXF,aAAMwB,OAAO,iCAAiCxB,aAAMwB,OACtD;;EAGJ;EACAC,OAAO;IACLd,KAAK;MACHe,cACE;IACJ;
|
|
1
|
+
{"version":3,"file":null,"mappings":";;;;+BASaA;;;WAAAA;;;uBATS;AAEtB,MAAMC,aAAa;MACbC,aAAMC,UACRD,aAAME,KAAK,gBACX;;AAIG,MAAMJ,YAAY;EACvBK,SAAS;IACPC,OAAO;MACLC,UAAU;MACVC,OAAO;MACPC,UAAU;MACVC,WAAW;MACXC,UACE;MACFC,OAAO;MACPC,KAAK;MACLC,SAAS;MACTC,QAAQ;IACV;IACAC,KAAK;MACHT,UAAU;MACVE,UAAU;IACZ;IACAQ,KAAK;MACHV,UAAU;MACVW,OAAO;MACPH,QAAQ;MACRI,SAAS;MACTC,UAAU;MACVC,MAAM;IACR;EACF;EACAC,KAAK;IACHN,KAAK;MACHO,YAAYtB;IACd;EACF;EACAuB,QAAQ;IACNC,iBAAiB;QACbvB,aAAME,KAAK;QACXF,aAAMwB,OAAO,8BAA8BxB,aAAMwB,OACnD;;QAGExB,aAAME,KAAK;QACXF,aAAMwB,OAAO,+BAA+BxB,aAAMwB,OACpD;;QAGExB,aAAME,KAAK;QACXF,aAAMwB,OAAO,iCAAiCxB,aAAMwB,OACtD;;EAGJ;EACAC,OAAO;IACLd,KAAK;MACHe,cACE;IACJ;IACAC,eACE;EACJ;AACF;","names":["EN_LOCALE","noDevTools","chalk","underline","blue","command","build","describe","watch","tsconfig","styleOnly","platform","noTsc","dts","noClear","config","dev","new","debug","distTag","registry","lang","log","noDevtools","errors","externalHelpers","yellow","warns","abortOnError","clearRootPath"],"sources":["../../src/locale/home/runner/work/modern.js/modern.js/packages/solutions/module-tools/src/locale/en.ts"],"sourcesContent":["import { chalk } from '@modern-js/utils';\n\nconst noDevTools = `There are no DevTools available, you can learn about them and choose to use them by following the link options.\n - ${chalk.underline(\n chalk.blue('[Storybook]'),\n 'https://modernjs.dev/module-tools/guide/basic/using-storybook.html',\n )}\n`;\n\nexport const EN_LOCALE = {\n command: {\n build: {\n describe: 'build the module for production',\n watch: 'building module in watch mode',\n tsconfig: 'Specify a path to the tsconfig.json file',\n styleOnly: 'only build style',\n platform:\n 'build the specified task or all tasks, If exist. (tasks: \"storybook\", \"docs\")',\n noTsc: 'close tsc compiler to emit d.ts (Deprecated)',\n dts: 'Turn on dts generation and type checking',\n noClear: 'disable auto clear dist dir',\n config: 'specify config file',\n },\n dev: {\n describe: 'run and debug the module',\n tsconfig: 'Specify a path to the tsconfig.json file',\n },\n new: {\n describe: 'enable optional features',\n debug: 'using debug mode to log something',\n config: 'set default generator config(json string)',\n distTag: `use specified tag version for it's generator`,\n registry: 'set npm registry url to run npm command',\n lang: 'set new command language(en or zh)',\n },\n },\n log: {\n dev: {\n noDevtools: noDevTools,\n },\n },\n errors: {\n externalHelpers: `The 'externalHelpers' configuration is currently enabled, but the \"@swc/helpers\" dependency declaration was not found. This will cause issues with the build output.Use the following for installation:\n ${chalk.blue('Package Manager is npm:')}\n ${chalk.yellow('`npm i @swc/helpers`')} Or ${chalk.yellow(\n '`npm i @swc/helpers -D`',\n )}\n\n ${chalk.blue('Package Manager is pnpm:')}\n ${chalk.yellow('`pnpm i @swc/helpers`')} Or ${chalk.yellow(\n '`pnpm i @swc/helpers -D`',\n )}\n\n ${chalk.blue('Package Manager is yarn:')}\n ${chalk.yellow('`yarn add @swc/helpers`')} Or ${chalk.yellow(\n '`yarn add @swc/helpers -D`',\n )}\n `,\n },\n warns: {\n dts: {\n abortOnError:\n 'With the `dts.abortOnError` configuration currently turned off, type errors do not cause build failures, but they do not guarantee proper type file output',\n },\n clearRootPath:\n 'It is detected that the outDir in the configuration is the same as the current project directory, and the current product directory will not be automatically deleted.',\n },\n};\n"]}
|
package/dist/locale/index.d.ts
CHANGED
|
@@ -37,6 +37,7 @@ declare const localeKeys: {
|
|
|
37
37
|
dts: {
|
|
38
38
|
abortOnError: string;
|
|
39
39
|
};
|
|
40
|
+
clearRootPath: string;
|
|
40
41
|
};
|
|
41
42
|
} | {
|
|
42
43
|
command: {
|
|
@@ -76,6 +77,7 @@ declare const localeKeys: {
|
|
|
76
77
|
dts: {
|
|
77
78
|
abortOnError: string;
|
|
78
79
|
};
|
|
80
|
+
clearRootPath: string;
|
|
79
81
|
};
|
|
80
82
|
};
|
|
81
83
|
export { i18n, localeKeys };
|
package/dist/locale/zh.d.ts
CHANGED
package/dist/locale/zh.js
CHANGED
package/dist/locale/zh.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":null,"mappings":";;;;+BASaA;;;WAAAA;;;uBATS;AAEtB,MAAMC,aAAa;MACbC,aAAMC,UACRD,aAAME,KAAK,iBACX;;AAIG,MAAMJ,YAAY;EACvBK,SAAS;IACPC,OAAO;MACLC,UAAU;MACVC,OAAO;MACPC,UAAU;MACVC,WAAW;MACXC,UACE;MACFC,OAAO;MACPC,KAAK;MACLC,SAAS;MACTC,QAAQ;IACV;IACAC,KAAK;MACHT,UAAU;MACVE,UAAU;IACZ;IACAQ,KAAK;MACHV,UAAU;MACVW,OAAO;MACPH,QAAQ;MACRI,SAAS;MACTC,UAAU;MACVC,MAAM;IACR;EACF;EACAC,KAAK;IACHN,KAAK;MACHO,YAAYtB;IACd;EACF;EACAuB,QAAQ;IACNC,iBAAiB;QACbvB,aAAME,KAAK;QACXF,aAAMwB,OAAO,8BAA8BxB,aAAMwB,OACnD;;QAGExB,aAAME,KAAK;QACXF,aAAMwB,OAAO,+BAA+BxB,aAAMwB,OACpD;;QAGExB,aAAME,KAAK;QACXF,aAAMwB,OAAO,iCAAiCxB,aAAMwB,OACtD;;EAGJ;EACAC,OAAO;IACLd,KAAK;MACHe,cACE;IACJ;
|
|
1
|
+
{"version":3,"file":null,"mappings":";;;;+BASaA;;;WAAAA;;;uBATS;AAEtB,MAAMC,aAAa;MACbC,aAAMC,UACRD,aAAME,KAAK,iBACX;;AAIG,MAAMJ,YAAY;EACvBK,SAAS;IACPC,OAAO;MACLC,UAAU;MACVC,OAAO;MACPC,UAAU;MACVC,WAAW;MACXC,UACE;MACFC,OAAO;MACPC,KAAK;MACLC,SAAS;MACTC,QAAQ;IACV;IACAC,KAAK;MACHT,UAAU;MACVE,UAAU;IACZ;IACAQ,KAAK;MACHV,UAAU;MACVW,OAAO;MACPH,QAAQ;MACRI,SAAS;MACTC,UAAU;MACVC,MAAM;IACR;EACF;EACAC,KAAK;IACHN,KAAK;MACHO,YAAYtB;IACd;EACF;EACAuB,QAAQ;IACNC,iBAAiB;QACbvB,aAAME,KAAK;QACXF,aAAMwB,OAAO,8BAA8BxB,aAAMwB,OACnD;;QAGExB,aAAME,KAAK;QACXF,aAAMwB,OAAO,+BAA+BxB,aAAMwB,OACpD;;QAGExB,aAAME,KAAK;QACXF,aAAMwB,OAAO,iCAAiCxB,aAAMwB,OACtD;;EAGJ;EACAC,OAAO;IACLd,KAAK;MACHe,cACE;IACJ;IACAC,eACE;EACJ;AACF;","names":["ZH_LOCALE","noDevTools","chalk","underline","blue","command","build","describe","watch","tsconfig","styleOnly","platform","noTsc","dts","noClear","config","dev","new","debug","distTag","registry","lang","log","noDevtools","errors","externalHelpers","yellow","warns","abortOnError","clearRootPath"],"sources":["../../src/locale/home/runner/work/modern.js/modern.js/packages/solutions/module-tools/src/locale/zh.ts"],"sourcesContent":["import { chalk } from '@modern-js/utils';\n\nconst noDevTools = `暂无可用的 DevTools,你可以通过以下选项以及对应的链接来了解如何使用。\n - ${chalk.underline(\n chalk.blue('[Storybook]:'),\n 'https://modernjs.dev/module-tools/guide/basic/using-storybook.html',\n )}\n`;\n\nexport const ZH_LOCALE = {\n command: {\n build: {\n describe: '构建生产环境产物',\n watch: '使用 Watch 模式构建模块',\n tsconfig: '指定 tsconfig.json 文件的路径',\n styleOnly: '只构建样式文件',\n platform:\n '如果存在的话,执行指定的构建任务或者全部构建任务. (构建任务包括: \"storybook\", \"文档\")',\n noTsc: '关闭 tsc 编译(废弃)',\n dts: '开启 dts 文件的生成以及类型检查',\n noClear: '不清理产物目录',\n config: '指定配置文件路径,可以为相对路径或绝对路径',\n },\n dev: {\n describe: '运行和调试模块',\n tsconfig: '指定 tsconfig.json 文件的路径',\n },\n new: {\n describe: '启用可选功能',\n debug: '开启 Debug 模式,打印调试日志信息',\n config: '生成器运行默认配置(JSON 字符串)',\n distTag: '生成器使用特殊的 npm Tag 版本',\n registry: '生成器运行过程中定制 npm Registry',\n lang: '设置 new 命令执行语言(zh 或者 en)',\n },\n },\n log: {\n dev: {\n noDevtools: noDevTools,\n },\n },\n errors: {\n externalHelpers: `当前开启了 'externalHelpers' 配置,未找到 \"@swc/helpers\" 依赖声明,构建产物会存在问题。使用下面的方式进行安装:\n ${chalk.blue('Package Manager is npm:')}\n ${chalk.yellow('`npm i @swc/helpers`')} Or ${chalk.yellow(\n '`npm i @swc/helpers -D`',\n )}\n\n ${chalk.blue('Package Manager is pnpm:')}\n ${chalk.yellow('`pnpm i @swc/helpers`')} Or ${chalk.yellow(\n '`pnpm i @swc/helpers -D`',\n )}\n\n ${chalk.blue('Package Manager is yarn:')}\n ${chalk.yellow('`yarn add @swc/helpers`')} Or ${chalk.yellow(\n '`yarn add @swc/helpers -D`',\n )}\n `,\n },\n warns: {\n dts: {\n abortOnError:\n '当前关闭了 `dts.abortOnError` 配置,类型错误不会导致构建失败,但无法保证类型文件正常输出',\n },\n clearRootPath:\n '检测到配置中 outDir 与当前项目目录相同,不会自动删除当前产物目录',\n },\n};\n"]}
|
package/package.json
CHANGED
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
"module-tools",
|
|
16
16
|
"lib-tools"
|
|
17
17
|
],
|
|
18
|
-
"version": "2.
|
|
18
|
+
"version": "2.24.0",
|
|
19
19
|
"bin": {
|
|
20
20
|
"modern": "./bin/modern.js",
|
|
21
21
|
"modern-module": "./bin/modern.js"
|
|
@@ -44,19 +44,19 @@
|
|
|
44
44
|
"@babel/generator": "^7.21.5",
|
|
45
45
|
"@babel/types": "^7.21.5",
|
|
46
46
|
"@babel/traverse": "^7.21.5",
|
|
47
|
-
"@modern-js/libuild": "0.13.
|
|
48
|
-
"@modern-js/libuild-plugin-svgr": "0.13.
|
|
49
|
-
"@modern-js/libuild-plugin-swc": "0.13.
|
|
47
|
+
"@modern-js/libuild": "0.13.1",
|
|
48
|
+
"@modern-js/libuild-plugin-svgr": "0.13.1",
|
|
49
|
+
"@modern-js/libuild-plugin-swc": "0.13.1",
|
|
50
50
|
"postcss": "8.4.6",
|
|
51
51
|
"@swc/helpers": "0.5.1",
|
|
52
|
-
"@modern-js/core": "2.
|
|
53
|
-
"@modern-js/new-action": "2.
|
|
54
|
-
"@modern-js/plugin": "2.
|
|
55
|
-
"@modern-js/plugin-changeset": "2.
|
|
56
|
-
"@modern-js/plugin-i18n": "2.
|
|
57
|
-
"@modern-js/plugin-lint": "2.
|
|
58
|
-
"@modern-js/upgrade": "2.
|
|
59
|
-
"@modern-js/utils": "2.
|
|
52
|
+
"@modern-js/core": "2.24.0",
|
|
53
|
+
"@modern-js/new-action": "2.24.0",
|
|
54
|
+
"@modern-js/plugin": "2.24.0",
|
|
55
|
+
"@modern-js/plugin-changeset": "2.24.0",
|
|
56
|
+
"@modern-js/plugin-i18n": "2.24.0",
|
|
57
|
+
"@modern-js/plugin-lint": "2.24.0",
|
|
58
|
+
"@modern-js/upgrade": "2.24.0",
|
|
59
|
+
"@modern-js/utils": "2.24.0"
|
|
60
60
|
},
|
|
61
61
|
"devDependencies": {
|
|
62
62
|
"@types/babel__generator": "7.6.4",
|
|
@@ -71,10 +71,10 @@
|
|
|
71
71
|
"postcss-alias": "2.0.0",
|
|
72
72
|
"react": "17",
|
|
73
73
|
"typescript": "^5",
|
|
74
|
-
"@modern-js/builder-webpack-provider": "2.
|
|
75
|
-
"@modern-js/self": "npm:@modern-js/module-tools@2.
|
|
76
|
-
"@scripts/
|
|
77
|
-
"@scripts/
|
|
74
|
+
"@modern-js/builder-webpack-provider": "2.24.0",
|
|
75
|
+
"@modern-js/self": "npm:@modern-js/module-tools@2.24.0",
|
|
76
|
+
"@scripts/build": "2.24.0",
|
|
77
|
+
"@scripts/jest-config": "2.24.0"
|
|
78
78
|
},
|
|
79
79
|
"publishConfig": {
|
|
80
80
|
"registry": "https://registry.npmjs.org/",
|