@modern-js/module-tools 2.33.0 → 2.34.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-flexbugs-fixes/index.js +1 -1
- package/compiled/postcss-font-variant/index.js +1 -1
- package/compiled/postcss-initial/index.js +1 -1
- package/compiled/postcss-media-minmax/index.js +1 -1
- package/compiled/postcss-nesting/index.js +1 -1
- package/compiled/postcss-page-break/index.js +1 -1
- package/compiled/rollup-plugin-dts/index.js +1 -1
- package/dist/command.js +2 -2
- package/dist/command.js.map +1 -1
- package/dist/config/merge.js +7 -6
- package/dist/config/merge.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/dist/plugins.js +2 -0
- package/dist/plugins.js.map +1 -1
- package/dist/utils/input.d.ts +1 -1
- package/dist/utils/input.js +4 -1
- package/dist/utils/input.js.map +1 -1
- package/dist/utils/tspathsTransform.js.map +1 -1
- package/package.json +21 -21
- package/CHANGELOG.md +0 -2963
package/dist/config/merge.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":null,"mappings":";;;;;;;;;;;;EAaaA,wBAAsB;WAAtBA;;EAiJAC,oBAAkB;WAAlBA;;;;uBA9JY;yBASE;uBACI;uBACO;AAE/B,MAAMD,yBAAyB,OACpCE,SACAC;MA0HYD,gBACCA,iBAEPA,iBAEAA;AA7HN,QAAME,iBAAgBC,iCAAqB;AAC3C,QAAM,EAAEC,SAASC,gBAAe,IAAKJ;AACrC,QAAM,EAAEK,mBAAmBC,oBAAoBC,MAAK,IAAK,MAAM,iFAC7D;AAEF,QAAM,EAAEC,qBAAoB,IAAK,MAAM,iFAAO;AAC9C,QAA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ultBaseConfig","isLegacyUserConfig","pConfig","options","defaultConfig","getDefaultBuildConfig","context","buildCmdOptions","applyOptionsChain","ensureAbsolutePath","slash","getDefaultIndexEntry","getStyleConfig","defaultAlias","srcDirectory","mergedAlias","alias","Object","keys","reduce","prev","name","formattedValue","value","startsWith","appDirectory","styleConfig","buildType","sourceDir","metafile","defaultIndexEntry","input","normalizeInput","userDefine","define","memo","JSON","stringify","dts","cmdDts","tsconfig","cmdTsconfigPath","noDts","tsconfigPath","externals","autoExternal","deps","getAllDeps","isObject","dependencies","peerDependencies","map","dep","RegExp","esbuildOptions","asset","format","target","sourceMap","copy","outDir","jsx","platform","splitting","minify","umdGlobals","umdModuleName","sideEffects","style","inject","modules","autoModules","tailwindcss","redirect","externalHelpers","transformImport","transformLodash","sourceType","disableSwcTransform","config","Boolean","legacy"],"sources":["../../src/config/home/runner/work/modern.js/modern.js/packages/solutions/module-tools/src/config/merge.ts"],"sourcesContent":["import { isObject } from '@modern-js/utils';\nimport { ModuleContext } from '../types';\nimport type {\n BaseBuildConfig,\n PartialBaseBuildConfig,\n DTSOptions,\n ModuleLegacyUserConfig,\n BuildCommandOptions,\n} from '../types';\nimport { getAllDeps } from '../utils/builder';\nimport { normalizeInput } from '../utils/input';\nimport { getDefaultBuildConfig } from '../constants/build';\n\nexport const mergeDefaultBaseConfig = async (\n pConfig: PartialBaseBuildConfig,\n options: { context: ModuleContext; buildCmdOptions: BuildCommandOptions },\n): Promise<BaseBuildConfig> => {\n const defaultConfig = getDefaultBuildConfig();\n const { context, buildCmdOptions } = options;\n const { applyOptionsChain, ensureAbsolutePath, slash } = await import(\n '@modern-js/utils'\n );\n const { getDefaultIndexEntry } = await import('../utils/input');\n const { getStyleConfig } = await import('../utils/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 metafile = pConfig.metafile ?? defaultConfig.metafile;\n const defaultIndexEntry =\n buildType === 'bundle' ? await getDefaultIndexEntry(context) : [sourceDir];\n const input = await normalizeInput(\n pConfig.input ?? defaultIndexEntry,\n context.appDirectory,\n );\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 const { dts: cmdDts, tsconfig: cmdTsconfigPath } = buildCmdOptions;\n\n // Impact eslint complexity\n const noDts = cmdDts === false || pConfig.dts === false;\n\n const dts = noDts\n ? false\n : ({\n ...defaultConfig.dts,\n ...pConfig.dts,\n } as DTSOptions);\n\n if (dts) {\n if (cmdTsconfigPath) {\n dts.tsconfigPath = cmdTsconfigPath;\n }\n }\n let externals = pConfig.externals ?? defaultConfig.externals;\n\n const autoExternal = pConfig.autoExternal ?? defaultConfig.autoExternal;\n\n if (autoExternal) {\n const deps = await getAllDeps(\n context.appDirectory,\n isObject(autoExternal)\n ? autoExternal\n : {\n dependencies: true,\n peerDependencies: true,\n },\n );\n externals = [\n ...deps.map(dep => new RegExp(`^${dep}($|\\\\/|\\\\\\\\)`)),\n ...(externals || []),\n ];\n }\n\n const esbuildOptions = pConfig.esbuildOptions ?? defaultConfig.esbuildOptions;\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 ?? defaultConfig.copy,\n outDir: pConfig.outDir ?? defaultConfig.outDir,\n dts,\n jsx: pConfig.jsx ?? defaultConfig.jsx,\n input,\n platform: pConfig.platform ?? defaultConfig.platform,\n splitting: pConfig.splitting ?? defaultConfig.splitting,\n minify: pConfig.minify ?? defaultConfig.minify,\n autoExternal,\n umdGlobals: {\n ...defaultConfig.umdGlobals,\n ...pConfig.umdGlobals,\n },\n umdModuleName: pConfig.umdModuleName ?? defaultConfig.umdModuleName,\n sideEffects: pConfig.sideEffects ?? defaultConfig.sideEffects,\n externals,\n sourceDir,\n alias,\n define,\n metafile,\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:\n pConfig.style?.tailwindcss ?? defaultConfig.style.tailwindcss,\n },\n redirect: {\n ...defaultConfig.redirect,\n ...pConfig.redirect,\n },\n esbuildOptions,\n externalHelpers: pConfig.externalHelpers ?? defaultConfig.externalHelpers,\n transformImport: pConfig.transformImport ?? defaultConfig.transformImport,\n transformLodash: pConfig.transformLodash ?? defaultConfig.transformLodash,\n sourceType: pConfig.sourceType ?? defaultConfig.sourceType,\n disableSwcTransform:\n pConfig.disableSwcTransform ?? defaultConfig.disableSwcTransform,\n };\n};\n\nexport const isLegacyUserConfig = (config: {\n legacy?: boolean;\n}): config is ModuleLegacyUserConfig => Boolean(config.legacy);\n"]}
|
|
1
|
+
{"version":3,"file":null,"mappings":";;;;;;;;;;;;EAaaA,wBAAsB;WAAtBA;;EAmJAC,oBAAkB;WAAlBA;;;;uBAhKY;yBASE;uBACI;uBACO;AAE/B,MAAMD,yBAAyB,OACpCE,SACAC;MAgDUC,QA4EEF,gBACCA,iBAEPA,iBAEAA;AA/HN,QAAMG,iBAAgBC,iCAAqB;AA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E;IAC1DC,aAAY7E,8BAAQ6E,gBAAU,QAAlB7E,uDAAsBG,cAAc0E;IAChDC,sBACE9E,uCAAQ8E,yBAAmB,QAA3B9E,yEAA+BG,cAAc2E;EACjD;AACF;AAEO,MAAM/E,qBAAqB,CAACgF,WAEK/C,QAAQ+C,OAAOC,MAAM;","names":["mergeDefaultBaseConfig","isLegacyUserConfig","pConfig","options","asset","defaultConfig","getDefaultBuildConfig","context","buildCmdOptions","applyOptionsChain","ensureAbsolutePath","slash","getDefaultIndexEntry","getStyleConfig","defaultAlias","srcDirectory","mergedAlias","alias","Object","keys","reduce","prev","name","formattedValue","value","startsWith","appDirectory","styleConfig","buildType","sourceDir","metafile","defaultIndexEntry","input","normalizeInput","Boolean","svgr","userDefine","define","memo","JSON","stringify","dts","cmdDts","tsconfig","cmdTsconfigPath","noDts","tsconfigPath","externals","autoExternal","deps","getAllDeps","isObject","dependencies","peerDependencies","map","dep","RegExp","esbuildOptions","format","target","sourceMap","copy","outDir","jsx","platform","splitting","minify","umdGlobals","umdModuleName","sideEffects","style","inject","modules","autoModules","tailwindcss","redirect","externalHelpers","transformImport","transformLodash","sourceType","disableSwcTransform","config","legacy"],"sources":["../../src/config/home/runner/work/modern.js/modern.js/packages/solutions/module-tools/src/config/merge.ts"],"sourcesContent":["import { isObject } from '@modern-js/utils';\nimport { ModuleContext } from '../types';\nimport type {\n BaseBuildConfig,\n PartialBaseBuildConfig,\n DTSOptions,\n ModuleLegacyUserConfig,\n BuildCommandOptions,\n} from '../types';\nimport { getAllDeps } from '../utils/builder';\nimport { normalizeInput } from '../utils/input';\nimport { getDefaultBuildConfig } from '../constants/build';\n\nexport const mergeDefaultBaseConfig = async (\n pConfig: PartialBaseBuildConfig,\n options: { context: ModuleContext; buildCmdOptions: BuildCommandOptions },\n): Promise<BaseBuildConfig> => {\n const defaultConfig = getDefaultBuildConfig();\n const { context, buildCmdOptions } = options;\n const { applyOptionsChain, ensureAbsolutePath, slash } = await import(\n '@modern-js/utils'\n );\n const { getDefaultIndexEntry } = await import('../utils/input');\n const { getStyleConfig } = await import('../utils/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 metafile = pConfig.metafile ?? defaultConfig.metafile;\n const asset = {\n ...defaultConfig.asset,\n ...pConfig.asset,\n };\n const defaultIndexEntry =\n buildType === 'bundle' ? await getDefaultIndexEntry(context) : [sourceDir];\n const input = await normalizeInput(\n pConfig.input ?? defaultIndexEntry,\n context.appDirectory,\n Boolean(asset?.svgr),\n );\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 const { dts: cmdDts, tsconfig: cmdTsconfigPath } = buildCmdOptions;\n\n // Impact eslint complexity\n const noDts = cmdDts === false || pConfig.dts === false;\n\n const dts = noDts\n ? false\n : ({\n ...defaultConfig.dts,\n ...pConfig.dts,\n } as DTSOptions);\n\n if (dts) {\n if (cmdTsconfigPath) {\n dts.tsconfigPath = cmdTsconfigPath;\n }\n }\n let externals = pConfig.externals ?? defaultConfig.externals;\n\n const autoExternal = pConfig.autoExternal ?? defaultConfig.autoExternal;\n\n if (autoExternal) {\n const deps = await getAllDeps(\n context.appDirectory,\n isObject(autoExternal)\n ? autoExternal\n : {\n dependencies: true,\n peerDependencies: true,\n },\n );\n externals = [\n ...deps.map(dep => new RegExp(`^${dep}($|\\\\/|\\\\\\\\)`)),\n ...(externals || []),\n ];\n }\n\n const esbuildOptions = pConfig.esbuildOptions ?? defaultConfig.esbuildOptions;\n return {\n asset,\n buildType,\n format: pConfig.format ?? defaultConfig.format,\n target: pConfig.target ?? defaultConfig.target,\n sourceMap: pConfig.sourceMap ?? defaultConfig.sourceMap,\n copy: pConfig.copy ?? defaultConfig.copy,\n outDir: pConfig.outDir ?? defaultConfig.outDir,\n dts,\n jsx: pConfig.jsx ?? defaultConfig.jsx,\n input,\n platform: pConfig.platform ?? defaultConfig.platform,\n splitting: pConfig.splitting ?? defaultConfig.splitting,\n minify: pConfig.minify ?? defaultConfig.minify,\n autoExternal,\n umdGlobals: {\n ...defaultConfig.umdGlobals,\n ...pConfig.umdGlobals,\n },\n umdModuleName: pConfig.umdModuleName ?? defaultConfig.umdModuleName,\n sideEffects: pConfig.sideEffects ?? defaultConfig.sideEffects,\n externals,\n sourceDir,\n alias,\n define,\n metafile,\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:\n pConfig.style?.tailwindcss ?? defaultConfig.style.tailwindcss,\n },\n redirect: {\n ...defaultConfig.redirect,\n ...pConfig.redirect,\n },\n esbuildOptions,\n externalHelpers: pConfig.externalHelpers ?? defaultConfig.externalHelpers,\n transformImport: pConfig.transformImport ?? defaultConfig.transformImport,\n transformLodash: pConfig.transformLodash ?? defaultConfig.transformLodash,\n sourceType: pConfig.sourceType ?? defaultConfig.sourceType,\n disableSwcTransform:\n pConfig.disableSwcTransform ?? defaultConfig.disableSwcTransform,\n };\n};\n\nexport const isLegacyUserConfig = (config: {\n legacy?: boolean;\n}): config is ModuleLegacyUserConfig => Boolean(config.legacy);\n"]}
|
package/dist/locale/en.d.ts
CHANGED
package/dist/locale/en.js
CHANGED
|
@@ -15,7 +15,8 @@ const noDevTools = `There are no DevTools available, you can learn about them an
|
|
|
15
15
|
const EN_LOCALE = {
|
|
16
16
|
command: {
|
|
17
17
|
shared: {
|
|
18
|
-
config: "sspecify the configuration file, which can be a relative or absolute path"
|
|
18
|
+
config: "sspecify the configuration file, which can be a relative or absolute path",
|
|
19
|
+
noNeedInstall: "not run install command"
|
|
19
20
|
},
|
|
20
21
|
build: {
|
|
21
22
|
describe: "build the module for production",
|
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,QAAQ;MACNC,QACE;
|
|
1
|
+
{"version":3,"file":null,"mappings":";;;;+BASaA;;;WAAAA;;;uBATS;AAEtB,MAAMC,aAAa;MACbC,aAAMC,UACRD,aAAME,KAAK,gBACX;;AAIG,MAAMJ,YAAY;EACvBK,SAAS;IACPC,QAAQ;MACNC,QACE;MACFC,eAAe;IACjB;IACAC,OAAO;MACLC,UAAU;MACVC,OAAO;MACPC,UAAU;MACVC,WAAW;MACXC,UACE;MACFC,OAAO;MACPC,KAAK;MACLC,SAAS;IACX;IACAC,KAAK;MACHR,UAAU;MACVE,UAAU;IACZ;IACAO,KAAK;MACHT,UAAU;MACVU,OAAO;MACPb,QAAQ;MACRc,SAAS;MACTC,UAAU;MACVC,MAAM;IACR;EACF;EACAC,KAAK;IACHN,KAAK;MACHO,YAAYxB;IACd;IACAyB,gBACE;EACJ;EACAC,QAAQ;IACNC,iBAAiB;QACb1B,aAAME,KAAK;QACXF,aAAM2B,OAAO,8BAA8B3B,aAAM2B,OACnD;;QAGE3B,aAAME,KAAK;QACXF,aAAM2B,OAAO,+BAA+B3B,aAAM2B,OACpD;;QAGE3B,aAAME,KAAK;QACXF,aAAM2B,OAAO,iCAAiC3B,aAAM2B,OACtD;;EAGJ;EACAC,OAAO;IACLd,KAAK;MACHe,cACE;IACJ;IACAC,eACE;EACJ;AACF;","names":["EN_LOCALE","noDevTools","chalk","underline","blue","command","shared","config","noNeedInstall","build","describe","watch","tsconfig","styleOnly","platform","noTsc","dts","noClear","dev","new","debug","distTag","registry","lang","log","noDevtools","buildConfigTip","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 shared: {\n config:\n 'sspecify the configuration file, which can be a relative or absolute path',\n noNeedInstall: 'not run install command',\n },\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 },\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 buildConfigTip:\n 'The configuration file of the current project has both `buildConfig` and `buildPreset` options. However, only the `buildConfig` configuration will take effect. If you need to override the content of `buildPreset`, please use the function type of `buildPreset` (refer to the API documentation for details).',\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
|
@@ -3,6 +3,7 @@ declare const localeKeys: {
|
|
|
3
3
|
command: {
|
|
4
4
|
shared: {
|
|
5
5
|
config: string;
|
|
6
|
+
noNeedInstall: string;
|
|
6
7
|
};
|
|
7
8
|
build: {
|
|
8
9
|
describe: string;
|
|
@@ -46,6 +47,7 @@ declare const localeKeys: {
|
|
|
46
47
|
command: {
|
|
47
48
|
shared: {
|
|
48
49
|
config: string;
|
|
50
|
+
noNeedInstall: string;
|
|
49
51
|
};
|
|
50
52
|
build: {
|
|
51
53
|
describe: string;
|
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,QAAQ;MACNC,QAAQ;
|
|
1
|
+
{"version":3,"file":null,"mappings":";;;;+BASaA;;;WAAAA;;;uBATS;AAEtB,MAAMC,aAAa;MACbC,aAAMC,UACRD,aAAME,KAAK,iBACX;;AAIG,MAAMJ,YAAY;EACvBK,SAAS;IACPC,QAAQ;MACNC,QAAQ;MACRC,eAAe;IACjB;IACAC,OAAO;MACLC,UAAU;MACVC,OAAO;MACPC,UAAU;MACVC,WAAW;MACXC,UACE;MACFC,OAAO;MACPC,KAAK;MACLC,SAAS;IACX;IACAC,KAAK;MACHR,UAAU;MACVE,UAAU;IACZ;IACAO,KAAK;MACHT,UAAU;MACVU,OAAO;MACPb,QAAQ;MACRc,SAAS;MACTC,UAAU;MACVC,MAAM;IACR;EACF;EACAC,KAAK;IACHN,KAAK;MACHO,YAAYxB;IACd;IACAyB,gBACE;EACJ;EACAC,QAAQ;IACNC,iBAAiB;QACb1B,aAAME,KAAK;QACXF,aAAM2B,OAAO,8BAA8B3B,aAAM2B,OACnD;;QAGE3B,aAAME,KAAK;QACXF,aAAM2B,OAAO,+BAA+B3B,aAAM2B,OACpD;;QAGE3B,aAAME,KAAK;QACXF,aAAM2B,OAAO,iCAAiC3B,aAAM2B,OACtD;;EAGJ;EACAC,OAAO;IACLd,KAAK;MACHe,cACE;IACJ;IACAC,eACE;EACJ;AACF;","names":["ZH_LOCALE","noDevTools","chalk","underline","blue","command","shared","config","noNeedInstall","build","describe","watch","tsconfig","styleOnly","platform","noTsc","dts","noClear","dev","new","debug","distTag","registry","lang","log","noDevtools","buildConfigTip","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 shared: {\n config: '指定配置文件路径,可以为相对路径或绝对路径',\n noNeedInstall: '无需安装依赖',\n },\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 },\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 buildConfigTip:\n '当前项目的配置文件中同时设置了 `buildConfig` 和 `buildPreset`,因此仅有 `buildConfig` 配置能够生效。如果你需要覆盖 `buildPreset` 的内容,请使用 `buildPreset` 的函数配置方式(详见 API 文档)。',\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/dist/plugins.js
CHANGED
package/dist/plugins.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":null,"mappings":";;;;+BAIaA;;;WAAAA;;;iCAHmB;4BACL;AAEpB,MAAMA,aAAa,CAACC;AACzB,MAAIC,UAAuB;AAE3B,UAAQD;IACN,KAAK;AACHC,gBAAU;AACV;IACF,KAAK;AACHA,gBAAU;SAACC,2BAAU;;AACrB;IACF,KAAK;IACL,KAAK;IACL,KAAK;AACHD,gBAAU;SAACE,qCAAe;;AAC1B;IACF;AACEF,gBAAU;EACd;AAEA,SAAOA;AACT;","names":["getPlugins","runningCmd","plugins","lintPlugin","changesetPlugin"],"sources":["../src/home/runner/work/modern.js/modern.js/packages/solutions/module-tools/src/plugins.ts"],"sourcesContent":["import type { CliPlugin } from '@modern-js/core';\nimport { changesetPlugin } from '@modern-js/plugin-changeset';\nimport { lintPlugin } from '@modern-js/plugin-lint';\n\nexport const getPlugins = (runningCmd: string) => {\n let plugins: CliPlugin[] = [];\n\n switch (runningCmd) {\n case 'build':\n plugins = [];\n break;\n case 'lint':\n plugins = [lintPlugin()];\n break;\n case 'change':\n case 'release':\n case 'bump':\n plugins = [changesetPlugin()];\n break;\n default:\n plugins = [];\n }\n\n return plugins;\n};\n"]}
|
|
1
|
+
{"version":3,"file":null,"mappings":";;;;+BAIaA;;;WAAAA;;;iCAHmB;4BACL;AAEpB,MAAMA,aAAa,CAACC;AACzB,MAAIC,UAAuB;AAE3B,UAAQD;IACN,KAAK;AACHC,gBAAU;AACV;IACF,KAAK;AACHA,gBAAU;SAACC,2BAAU;;AACrB;IACF,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;AACHD,gBAAU;SAACE,qCAAe;;AAC1B;IACF;AACEF,gBAAU;EACd;AAEA,SAAOA;AACT;","names":["getPlugins","runningCmd","plugins","lintPlugin","changesetPlugin"],"sources":["../src/home/runner/work/modern.js/modern.js/packages/solutions/module-tools/src/plugins.ts"],"sourcesContent":["import type { CliPlugin } from '@modern-js/core';\nimport { changesetPlugin } from '@modern-js/plugin-changeset';\nimport { lintPlugin } from '@modern-js/plugin-lint';\n\nexport const getPlugins = (runningCmd: string) => {\n let plugins: CliPlugin[] = [];\n\n switch (runningCmd) {\n case 'build':\n plugins = [];\n break;\n case 'lint':\n plugins = [lintPlugin()];\n break;\n case 'change':\n case 'release':\n case 'bump':\n case 'pre':\n case 'gen-release-note':\n plugins = [changesetPlugin()];\n break;\n default:\n plugins = [];\n }\n\n return plugins;\n};\n"]}
|
package/dist/utils/input.d.ts
CHANGED
|
@@ -6,6 +6,6 @@ export declare const getDefaultIndexEntry: ({
|
|
|
6
6
|
isTsProject: boolean;
|
|
7
7
|
appDirectory: string;
|
|
8
8
|
}) => Promise<string[]>;
|
|
9
|
-
export declare const normalizeInput: (input: Input, appDirectory: string) => Promise<string[] | {
|
|
9
|
+
export declare const normalizeInput: (input: Input, appDirectory: string, enableSvgr: boolean) => Promise<string[] | {
|
|
10
10
|
[name: string]: string;
|
|
11
11
|
}>;
|
package/dist/utils/input.js
CHANGED
|
@@ -35,7 +35,7 @@ const getDefaultIndexEntry = async ({ isTsProject, appDirectory }) => {
|
|
|
35
35
|
}
|
|
36
36
|
return [];
|
|
37
37
|
};
|
|
38
|
-
const normalizeInput = async (input, appDirectory) => {
|
|
38
|
+
const normalizeInput = async (input, appDirectory, enableSvgr) => {
|
|
39
39
|
const extensions = [
|
|
40
40
|
"js",
|
|
41
41
|
"ts",
|
|
@@ -51,6 +51,9 @@ const normalizeInput = async (input, appDirectory) => {
|
|
|
51
51
|
"less",
|
|
52
52
|
"json"
|
|
53
53
|
];
|
|
54
|
+
if (enableSvgr) {
|
|
55
|
+
extensions.push("svg");
|
|
56
|
+
}
|
|
54
57
|
if ((0, _utils.isArray)(input)) {
|
|
55
58
|
const normalizedInput = await (0, _utils.globby)(input.map(_utils.slash), {
|
|
56
59
|
expandDirectories: {
|
package/dist/utils/input.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":null,"mappings":";;;;;;;;;;;;EAIaA,sBAAoB;WAApBA;;EAoBAC,gBAAc;WAAdA;;;;iEAxBI;uBAC0B;AAGpC,MAAMD,uBAAuB,OAAO,EACzCE,aACAC,aAAY,MAIb;AACC,MAAIC,QAAQF,cAAc,iBAAiB;AAC3C,MAAIG,UAAGC,WAAWC,cAAKC,QAAQL,cAAcC,SAAS;AACpD,WAAO;MAACA;;EACV;AAEAA,UAAQF,cAAc,kBAAkB;AACxC,MAAIG,UAAGC,WAAWC,cAAKC,QAAQL,cAAcC,SAAS;AACpD,WAAO;MAACA;;EACV;AAEA,SAAO;AACT;AAEO,MAAMH,iBAAiB,
|
|
1
|
+
{"version":3,"file":null,"mappings":";;;;;;;;;;;;EAIaA,sBAAoB;WAApBA;;EAoBAC,gBAAc;WAAdA;;;;iEAxBI;uBAC0B;AAGpC,MAAMD,uBAAuB,OAAO,EACzCE,aACAC,aAAY,MAIb;AACC,MAAIC,QAAQF,cAAc,iBAAiB;AAC3C,MAAIG,UAAGC,WAAWC,cAAKC,QAAQL,cAAcC,SAAS;AACpD,WAAO;MAACA;;EACV;AAEAA,UAAQF,cAAc,kBAAkB;AACxC,MAAIG,UAAGC,WAAWC,cAAKC,QAAQL,cAAcC,SAAS;AACpD,WAAO;MAACA;;EACV;AAEA,SAAO;AACT;AAEO,MAAMH,iBAAiB,OAC5BQ,OACAN,cACAO;AAEA,QAAMC,aAAa;IACjB;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;;AAGF,MAAID,YAAY;AACdC,eAAWC,KAAK;EAClB;AAEA,OAAIC,mBAAQJ,QAAQ;AAClB,UAAMK,kBAAkB,OAAMC,kBAAON,MAAMO,IAAIC,YAAK,GAAG;MACrDC,mBAAmB;QACjBP;MACF;MACAQ,QAAQ;QAAC;;MACTC,KAAKjB;IACP;AACA,WAAOW;EACT,OAAO;AACL,WAAOL;EACT;AACF;","names":["getDefaultIndexEntry","normalizeInput","isTsProject","appDirectory","entry","fs","existsSync","path","resolve","input","enableSvgr","extensions","push","isArray","normalizedInput","globby","map","slash","expandDirectories","ignore","cwd"],"sources":["../../src/utils/home/runner/work/modern.js/modern.js/packages/solutions/module-tools/src/utils/input.ts"],"sourcesContent":["import path from 'path';\nimport { fs, globby, isArray, slash } from '@modern-js/utils';\nimport { Input } from '../types';\n\nexport const getDefaultIndexEntry = async ({\n isTsProject,\n appDirectory,\n}: {\n isTsProject: boolean;\n appDirectory: string;\n}) => {\n let entry = isTsProject ? 'src/index.ts' : 'src/index.js';\n if (fs.existsSync(path.resolve(appDirectory, entry))) {\n return [entry];\n }\n\n entry = isTsProject ? 'src/index.tsx' : 'src/index.jsx';\n if (fs.existsSync(path.resolve(appDirectory, entry))) {\n return [entry];\n }\n\n return [];\n};\n\nexport const normalizeInput = async (\n input: Input,\n appDirectory: string,\n enableSvgr: boolean,\n) => {\n const extensions = [\n 'js',\n 'ts',\n 'jsx',\n 'tsx',\n 'mjs',\n 'cjs',\n 'mts',\n 'cts',\n 'css',\n 'sass',\n 'scss',\n 'less',\n 'json',\n ];\n\n if (enableSvgr) {\n extensions.push('svg');\n }\n\n if (isArray(input)) {\n const normalizedInput = await globby(input.map(slash), {\n expandDirectories: {\n extensions,\n },\n ignore: ['**/*.d.ts'],\n cwd: appDirectory,\n });\n return normalizedInput;\n } else {\n return input;\n }\n};\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":null,"mappings":";;;;+BAmHaA;;;WAAAA;;;;;kEAnHS;+BACU;uBACb;oEACK;sEACF;mEACH;qEACgB;sBACN;AAU7B,SAASC,cACPC,UACA,EAAEC,UAAUC,SAASC,MAAK,GAAmB;AAE7C,MAAI,CAACC,OAAEC,gBAAgBL,WAAW;AAChC;EACF;AAEA,QAAMM,aAAaN,SAASO,KAAKC;AACjC,QA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C,KAAK;MACnB/B,MAAMpB;MACNoD,SAASjB,yBAAyB;QAAEnC;QAAUC;QAASC;MAAM;IAC/D;EACF;AACA,SAAOgD;AACT;","names":["transformDtsAlias","mapPathString","nodePath","filename","baseUrl","paths","t","isStringLiteral","sourcePath","node","value","currentFile","matchPath","createMatchPath","result","packageJsonPath","fs","existsSync","undefined","readJSONSync","filePath","dtsAliasExts","relativePath","path","relative","dirname","fileName","basename","normalize","length","replaceString","startsWith","replaceWith","stringLiteral","transformImport","option","get","transformExport","transformSingleFileAlias","sourceCode","readFileSync","ast","parser","parse","sourceType","errorRecovery","plugins","traverse","ImportDeclaration","ExportDeclaration","generator","code","filenames","transformResult","push","content"],"sources":["../../src/utils/home/runner/work/modern.js/modern.js/packages/solutions/module-tools/src/utils/tspathsTransform.ts"],"sourcesContent":["import * as path from 'path';\nimport { createMatchPath } from '@modern-js/utils/tsconfig-paths';\nimport { fs } from '@modern-js/utils';\nimport * as parser from '@babel/parser';\nimport generator from '@babel/generator';\nimport * as t from '@babel/types';\nimport traverse, { NodePath } from '@babel/traverse';\nimport { dtsAliasExts } from '../constants/file';\n// import { defaultTransformedFunctions } from '../constants/dts';\n// import { matchesPattern, isImportCall } from './dts';\n\nexport interface TransformOption {\n filename: string;\n baseUrl: string;\n paths: Record<string, string[] | string>;\n}\n\nfunction mapPathString(\n nodePath: NodePath<
|
|
1
|
+
{"version":3,"file":null,"mappings":";;;;+BAmHaA;;;WAAAA;;;;;kEAnHS;+BACU;uBACb;oEACK;sEACF;mEACH;qEACgB;sBACN;AAU7B,SAASC,cACPC,UACA,EAAEC,UAAUC,SAASC,MAAK,GAAmB;AAE7C,MAAI,CAACC,OAAEC,gBAAgBL,WAAW;AAChC;EACF;AAEA,QAAMM,aAAaN,SAASO,KAAKC;AACjC,QAAMC,cAAcR;AACpB,QAAMS,aAAYC,mCAChBT,SACAC,OACA;IAAC;GAAQ;AAEX,QAAMS,SAASF,UACbJ,YACAO;AACE,QAAI,CAACC,UAAGC,W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apPathString","nodePath","filename","baseUrl","paths","t","isStringLiteral","sourcePath","node","value","currentFile","matchPath","createMatchPath","result","packageJsonPath","fs","existsSync","undefined","readJSONSync","filePath","dtsAliasExts","relativePath","path","relative","dirname","fileName","basename","normalize","length","replaceString","startsWith","replaceWith","stringLiteral","transformImport","option","get","transformExport","transformSingleFileAlias","sourceCode","readFileSync","ast","parser","parse","sourceType","errorRecovery","plugins","traverse","ImportDeclaration","ExportDeclaration","generator","code","filenames","transformResult","push","content"],"sources":["../../src/utils/home/runner/work/modern.js/modern.js/packages/solutions/module-tools/src/utils/tspathsTransform.ts"],"sourcesContent":["import * as path from 'path';\nimport { createMatchPath } from '@modern-js/utils/tsconfig-paths';\nimport { fs } from '@modern-js/utils';\nimport * as parser from '@babel/parser';\nimport generator from '@babel/generator';\nimport * as t from '@babel/types';\nimport traverse, { NodePath } from '@babel/traverse';\nimport { dtsAliasExts } from '../constants/file';\n// import { defaultTransformedFunctions } from '../constants/dts';\n// import { matchesPattern, isImportCall } from './dts';\n\nexport interface TransformOption {\n filename: string;\n baseUrl: string;\n paths: Record<string, string[] | string>;\n}\n\nfunction mapPathString(\n nodePath: NodePath<any>,\n { filename, baseUrl, paths }: TransformOption,\n) {\n if (!t.isStringLiteral(nodePath)) {\n return;\n }\n\n const sourcePath = nodePath.node.value;\n const currentFile = filename;\n const matchPath = createMatchPath(\n baseUrl,\n paths as { [key: string]: Array<string> },\n ['index'],\n );\n const result = matchPath(\n sourcePath,\n packageJsonPath => {\n if (!fs.existsSync(packageJsonPath)) {\n return undefined;\n }\n return fs.readJSONSync(packageJsonPath);\n },\n filePath => fs.existsSync(filePath),\n dtsAliasExts,\n );\n if (result) {\n const relativePath = path.relative(\n path.dirname(currentFile),\n path.dirname(result),\n );\n const fileName = path.basename(result);\n // 如果是同级文件,则返回的是 ''\n const filePath = path.normalize(\n `${relativePath.length === 0 ? '.' : relativePath}/${fileName}`,\n );\n const replaceString = filePath.startsWith('.') ? filePath : `./${filePath}`;\n nodePath.replaceWith(t.stringLiteral(replaceString));\n }\n}\n\n// const transformCall =\n// (option: TransformOption) => (nodePath: NodePath<t.CallExpression>) => {\n// const calleePath = nodePath.get('callee') as NodePath;\n// const isNormalCall = defaultTransformedFunctions.some(pattern =>\n// matchesPattern(calleePath, pattern),\n// );\n// if (isNormalCall || isImportCall(nodePath)) {\n// mapPathString(\n// nodePath.get('arguments.0') as NodePath<t.StringLiteral>,\n// option,\n// );\n// }\n// };\n\nconst transformImport =\n (option: TransformOption) => (nodePath: NodePath<t.ImportDeclaration>) => {\n mapPathString(nodePath.get('source'), option);\n };\n\nconst transformExport =\n (option: TransformOption) => (nodePath: NodePath<t.ExportDeclaration>) => {\n mapPathString(nodePath.get('source') as NodePath<t.StringLiteral>, option);\n };\n\nconst transformSingleFileAlias = ({\n filename,\n baseUrl,\n paths,\n}: TransformOption) => {\n const sourceCode = fs.readFileSync(filename, 'utf-8');\n const ast = parser.parse(sourceCode, {\n sourceType: 'module',\n errorRecovery: true, // 防止typescript不支持的语法出现而报错\n plugins: ['typescript'],\n });\n traverse(ast, {\n // d.ts file content not have callExpression which can be parsed;\n // CallExpression: transformCall({ filename, baseUrl, paths }) as any,\n ImportDeclaration: transformImport({\n filename,\n baseUrl,\n paths,\n }) as any,\n ExportDeclaration: transformExport({\n filename,\n baseUrl,\n paths,\n }) as any,\n });\n return generator(ast).code;\n};\n\ninterface TransformDtsAliasOption {\n filenames?: string[];\n baseUrl: string;\n paths: Record<string, string[] | string>;\n}\nexport const transformDtsAlias = (option: TransformDtsAliasOption) => {\n const { filenames = [], baseUrl, paths } = option;\n const transformResult: { path: string; content: string }[] = [];\n for (const filename of filenames) {\n transformResult.push({\n path: filename,\n content: transformSingleFileAlias({ filename, baseUrl, paths }),\n });\n }\n return transformResult;\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.34.0",
|
|
19
19
|
"bin": {
|
|
20
20
|
"modern": "./bin/modern.js",
|
|
21
21
|
"modern-module": "./bin/modern.js"
|
|
@@ -49,24 +49,24 @@
|
|
|
49
49
|
"node": ">=14.0.0"
|
|
50
50
|
},
|
|
51
51
|
"dependencies": {
|
|
52
|
-
"@babel/parser": "^7.
|
|
53
|
-
"@babel/generator": "^7.
|
|
54
|
-
"@babel/types": "^7.
|
|
55
|
-
"@babel/traverse": "^7.
|
|
52
|
+
"@babel/parser": "^7.22.15",
|
|
53
|
+
"@babel/generator": "^7.22.15",
|
|
54
|
+
"@babel/types": "^7.22.15",
|
|
55
|
+
"@babel/traverse": "^7.22.15",
|
|
56
56
|
"postcss": "8.4.27",
|
|
57
57
|
"@swc/helpers": "0.5.1",
|
|
58
|
-
"@modern-js/core": "2.
|
|
59
|
-
"@modern-js/libuild": "2.
|
|
60
|
-
"@modern-js/libuild-plugin-svgr": "2.
|
|
61
|
-
"@modern-js/libuild-plugin-swc": "2.
|
|
62
|
-
"@modern-js/new-action": "2.
|
|
63
|
-
"@modern-js/plugin": "2.
|
|
64
|
-
"@modern-js/plugin-changeset": "2.
|
|
65
|
-
"@modern-js/plugin-i18n": "2.
|
|
66
|
-
"@modern-js/plugin-lint": "2.
|
|
67
|
-
"@modern-js/types": "2.
|
|
68
|
-
"@modern-js/upgrade": "2.
|
|
69
|
-
"@modern-js/utils": "2.
|
|
58
|
+
"@modern-js/core": "2.34.0",
|
|
59
|
+
"@modern-js/libuild": "2.34.0",
|
|
60
|
+
"@modern-js/libuild-plugin-svgr": "2.34.0",
|
|
61
|
+
"@modern-js/libuild-plugin-swc": "2.34.0",
|
|
62
|
+
"@modern-js/new-action": "2.34.0",
|
|
63
|
+
"@modern-js/plugin": "2.34.0",
|
|
64
|
+
"@modern-js/plugin-changeset": "2.34.0",
|
|
65
|
+
"@modern-js/plugin-i18n": "2.34.0",
|
|
66
|
+
"@modern-js/plugin-lint": "2.34.0",
|
|
67
|
+
"@modern-js/types": "2.34.0",
|
|
68
|
+
"@modern-js/upgrade": "2.34.0",
|
|
69
|
+
"@modern-js/utils": "2.34.0"
|
|
70
70
|
},
|
|
71
71
|
"devDependencies": {
|
|
72
72
|
"@types/babel__generator": "7.6.4",
|
|
@@ -81,10 +81,10 @@
|
|
|
81
81
|
"postcss-alias": "2.0.0",
|
|
82
82
|
"react": "17",
|
|
83
83
|
"typescript": "^5",
|
|
84
|
-
"@modern-js/builder-webpack-provider": "2.
|
|
85
|
-
"@modern-js/self": "npm:@modern-js/module-tools@2.
|
|
86
|
-
"@scripts/build": "2.
|
|
87
|
-
"@scripts/jest-config": "2.
|
|
84
|
+
"@modern-js/builder-webpack-provider": "2.34.0",
|
|
85
|
+
"@modern-js/self": "npm:@modern-js/module-tools@2.34.0",
|
|
86
|
+
"@scripts/build": "2.34.0",
|
|
87
|
+
"@scripts/jest-config": "2.34.0"
|
|
88
88
|
},
|
|
89
89
|
"publishConfig": {
|
|
90
90
|
"registry": "https://registry.npmjs.org/",
|