@modern-js/module-tools 2.35.0 → 2.36.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-nesting/index.js +2 -2
- package/compiled/postcss-nesting/package.json +1 -1
- package/dist/build.js +43 -16
- package/dist/builder/build.d.ts +1 -10
- package/dist/builder/build.js +96 -208
- package/dist/builder/clear.d.ts +1 -4
- package/dist/builder/clear.js +32 -28
- package/dist/builder/copy.js +79 -64
- package/dist/builder/dts/index.js +27 -19
- package/dist/builder/dts/rollup.d.ts +6 -14
- package/dist/builder/dts/rollup.js +60 -37
- package/dist/builder/dts/tsc.d.ts +3 -2
- package/dist/builder/dts/tsc.js +50 -37
- package/dist/builder/esbuild/adapter.d.ts +3 -0
- package/dist/builder/esbuild/adapter.js +275 -0
- package/dist/builder/esbuild/hook.d.ts +4 -0
- package/dist/builder/esbuild/hook.js +103 -0
- package/dist/builder/esbuild/index.d.ts +35 -0
- package/dist/builder/esbuild/index.js +268 -0
- package/dist/builder/esbuild/resolve.d.ts +17 -0
- package/dist/builder/esbuild/resolve.js +125 -0
- package/dist/builder/esbuild/sourcemap.d.ts +16 -0
- package/dist/builder/esbuild/sourcemap.js +86 -0
- package/dist/builder/esbuild/transform.d.ts +7 -0
- package/dist/builder/esbuild/transform.js +45 -0
- package/dist/builder/esbuild/watch.d.ts +2 -0
- package/dist/builder/esbuild/watch.js +115 -0
- package/dist/builder/esbuild/write-file.d.ts +2 -0
- package/dist/builder/esbuild/write-file.js +89 -0
- package/dist/builder/feature/asset.d.ts +19 -0
- package/dist/builder/feature/asset.js +149 -0
- package/dist/builder/feature/format-cjs.d.ts +5 -0
- package/dist/builder/feature/format-cjs.js +53 -0
- package/dist/builder/feature/index.d.ts +2 -0
- package/dist/builder/feature/index.js +74 -0
- package/dist/builder/feature/json.d.ts +5 -0
- package/dist/builder/feature/json.js +47 -0
- package/dist/builder/feature/redirect.d.ts +5 -0
- package/dist/builder/feature/redirect.js +217 -0
- package/dist/builder/feature/style/index.d.ts +5 -0
- package/dist/builder/feature/style/index.js +94 -0
- package/dist/builder/feature/style/lessAliasPlugin.d.ts +12 -0
- package/dist/builder/feature/style/lessAliasPlugin.js +70 -0
- package/dist/builder/feature/style/lessRender.d.ts +2 -0
- package/dist/builder/feature/style/lessRender.js +64 -0
- package/dist/builder/feature/style/postcssTransformer.d.ts +6 -0
- package/dist/builder/feature/style/postcssTransformer.js +95 -0
- package/dist/builder/feature/style/postcssUrlPlugin.d.ts +6 -0
- package/dist/builder/feature/style/postcssUrlPlugin.js +58 -0
- package/dist/builder/feature/style/sassRender.d.ts +2 -0
- package/dist/builder/feature/style/sassRender.js +85 -0
- package/dist/builder/feature/style/transformStyle.d.ts +13 -0
- package/dist/builder/feature/style/transformStyle.js +101 -0
- package/dist/builder/feature/style/utils.d.ts +18 -0
- package/dist/builder/feature/style/utils.js +124 -0
- package/dist/builder/feature/swc.d.ts +9 -0
- package/dist/builder/feature/swc.js +170 -0
- package/dist/builder/feature/terser.d.ts +5 -0
- package/dist/builder/feature/terser.js +83 -0
- package/dist/builder/index.d.ts +1 -0
- package/dist/builder/index.js +59 -28
- package/dist/builder/platform.js +38 -23
- package/dist/cli.js +58 -29
- package/dist/command.js +62 -38
- package/dist/config/defineConfig.js +25 -17
- package/dist/config/legacySchema.js +35 -32
- package/dist/config/merge.d.ts +1 -0
- package/dist/config/merge.js +69 -36
- package/dist/config/normalize.d.ts +1 -0
- package/dist/config/normalize.js +63 -46
- package/dist/config/schema.d.ts +48 -0
- package/dist/config/schema.js +53 -34
- package/dist/config/transformLegacyConfig.js +67 -61
- package/dist/config/valid.d.ts +2 -2
- package/dist/config/valid.js +44 -21
- package/dist/constants/build.d.ts +5 -1
- package/dist/constants/build.js +88 -46
- package/dist/constants/color.js +27 -20
- package/dist/constants/dts.js +27 -20
- package/dist/constants/file.d.ts +2 -2
- package/dist/constants/file.js +48 -25
- package/dist/constants/legacy-preset.js +45 -32
- package/dist/constants/loader.d.ts +2 -0
- package/dist/constants/loader.js +53 -0
- package/dist/constants/log.d.ts +0 -8
- package/dist/constants/log.js +27 -41
- package/dist/constants/preset.js +55 -62
- package/dist/debug.d.ts +4 -0
- package/dist/debug.js +37 -0
- package/dist/dev.js +42 -25
- package/dist/error.js +49 -42
- package/dist/hooks/build.d.ts +1 -2
- package/dist/hooks/build.js +36 -28
- package/dist/hooks/dev.js +32 -17
- package/dist/hooks/index.d.ts +1 -1
- package/dist/hooks/index.js +31 -16
- package/dist/hooks/misc.d.ts +5 -2
- package/dist/hooks/misc.js +31 -12
- package/dist/index.d.ts +2 -1
- package/dist/index.js +39 -32
- package/dist/locale/en.js +32 -17
- package/dist/locale/index.d.ts +2 -1
- package/dist/locale/index.js +31 -24
- package/dist/locale/zh.js +32 -17
- package/dist/plugins.js +28 -13
- package/dist/types/color.js +15 -5
- package/dist/types/command.d.ts +3 -3
- package/dist/types/command.js +15 -5
- package/dist/types/config/copy.js +15 -5
- package/dist/types/config/dev.js +15 -5
- package/dist/types/config/index.d.ts +87 -52
- package/dist/types/config/index.js +24 -6
- package/dist/types/config/style.d.ts +58 -6
- package/dist/types/config/style.js +15 -5
- package/dist/types/context.js +15 -5
- package/dist/types/dts.d.ts +14 -3
- package/dist/types/dts.js +15 -5
- package/dist/types/esbuild.d.ts +107 -0
- package/dist/types/esbuild.js +32 -0
- package/dist/types/hooks.js +15 -5
- package/dist/types/index.d.ts +1 -0
- package/dist/types/index.js +32 -11
- package/dist/types/legacyConfig/index.js +15 -5
- package/dist/types/legacyConfig/output.d.ts +4 -4
- package/dist/types/legacyConfig/output.js +15 -5
- package/dist/types/legacyConfig/source.js +15 -5
- package/dist/types/legacyConfig/tools.js +15 -5
- package/dist/utils/assert.d.ts +5 -0
- package/dist/utils/assert.js +50 -0
- package/dist/utils/builder.d.ts +10 -14
- package/dist/utils/builder.js +59 -59
- package/dist/utils/common.d.ts +1 -1
- package/dist/utils/common.js +25 -17
- package/dist/utils/dts.d.ts +26 -9
- package/dist/utils/dts.js +100 -66
- package/dist/utils/hash.d.ts +2 -0
- package/dist/utils/hash.js +31 -0
- package/dist/utils/index.d.ts +11 -0
- package/dist/utils/index.js +42 -0
- package/dist/utils/input.js +47 -24
- package/dist/utils/log.d.ts +1 -2
- package/dist/utils/log.js +36 -20
- package/dist/utils/map.d.ts +13 -0
- package/dist/utils/map.js +58 -0
- package/dist/utils/onExit.js +35 -11
- package/dist/utils/print.d.ts +2 -2
- package/dist/utils/print.js +52 -49
- package/dist/utils/style.d.ts +5 -23
- package/dist/utils/style.js +63 -43
- package/dist/utils/tspath.js +114 -0
- package/package.json +64 -50
- package/vitest.config.ts +20 -0
- package/dist/build.js.map +0 -1
- package/dist/builder/build.js.map +0 -1
- package/dist/builder/clear.js.map +0 -1
- package/dist/builder/copy.js.map +0 -1
- package/dist/builder/dts/index.js.map +0 -1
- package/dist/builder/dts/rollup.js.map +0 -1
- package/dist/builder/dts/tsc.js.map +0 -1
- package/dist/builder/index.js.map +0 -1
- package/dist/builder/platform.js.map +0 -1
- package/dist/cli.js.map +0 -1
- package/dist/command.js.map +0 -1
- package/dist/config/defineConfig.js.map +0 -1
- package/dist/config/legacySchema.js.map +0 -1
- package/dist/config/merge.js.map +0 -1
- package/dist/config/normalize.js.map +0 -1
- package/dist/config/schema.js.map +0 -1
- package/dist/config/transformLegacyConfig.js.map +0 -1
- package/dist/config/valid.js.map +0 -1
- package/dist/constants/build.js.map +0 -1
- package/dist/constants/color.js.map +0 -1
- package/dist/constants/dts.js.map +0 -1
- package/dist/constants/file.js.map +0 -1
- package/dist/constants/legacy-preset.js.map +0 -1
- package/dist/constants/log.js.map +0 -1
- package/dist/constants/preset.js.map +0 -1
- package/dist/dev.js.map +0 -1
- package/dist/error.js.map +0 -1
- package/dist/hooks/build.js.map +0 -1
- package/dist/hooks/dev.js.map +0 -1
- package/dist/hooks/index.js.map +0 -1
- package/dist/hooks/misc.js.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/locale/en.js.map +0 -1
- package/dist/locale/index.js.map +0 -1
- package/dist/locale/zh.js.map +0 -1
- package/dist/plugins.js.map +0 -1
- package/dist/types/color.js.map +0 -1
- package/dist/types/command.js.map +0 -1
- package/dist/types/config/copy.js.map +0 -1
- package/dist/types/config/dev.js.map +0 -1
- package/dist/types/config/index.js.map +0 -1
- package/dist/types/config/style.js.map +0 -1
- package/dist/types/context.js.map +0 -1
- package/dist/types/dts.js.map +0 -1
- package/dist/types/hooks.js.map +0 -1
- package/dist/types/index.js.map +0 -1
- package/dist/types/legacyConfig/index.js.map +0 -1
- package/dist/types/legacyConfig/output.js.map +0 -1
- package/dist/types/legacyConfig/source.js.map +0 -1
- package/dist/types/legacyConfig/tools.js.map +0 -1
- package/dist/types/utils.d.ts +0 -5
- package/dist/types/utils.js +0 -4
- package/dist/utils/builder.js.map +0 -1
- package/dist/utils/common.js.map +0 -1
- package/dist/utils/context.d.ts +0 -7
- package/dist/utils/context.js +0 -23
- package/dist/utils/context.js.map +0 -1
- package/dist/utils/dts.js.map +0 -1
- package/dist/utils/input.js.map +0 -1
- package/dist/utils/language.d.ts +0 -1
- package/dist/utils/language.js +0 -22
- package/dist/utils/language.js.map +0 -1
- package/dist/utils/libuild-plugin.d.ts +0 -3
- package/dist/utils/libuild-plugin.js +0 -31
- package/dist/utils/libuild-plugin.js.map +0 -1
- package/dist/utils/log.js.map +0 -1
- package/dist/utils/onExit.js.map +0 -1
- package/dist/utils/path.d.ts +0 -1
- package/dist/utils/path.js +0 -19
- package/dist/utils/path.js.map +0 -1
- package/dist/utils/print.js.map +0 -1
- package/dist/utils/style.js.map +0 -1
- package/dist/utils/tspathsTransform.js +0 -91
- package/dist/utils/tspathsTransform.js.map +0 -1
- /package/dist/utils/{tspathsTransform.d.ts → tspath.d.ts} +0 -0
package/dist/command.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":null,"mappings":";;;;;;;;;;;;EAOaA,cAAY;WAAZA;;EAwBAC,YAAU;WAA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AEC,mBAAWL,QAAQc,OAAOC,MAAM,GACtEP,OACC,qBACAL,aAAKC,EAAEC,mBAAWL,QAAQc,OAAOuB,aAAa;AAGtD;","names":["buildCommand","devCommand","newCommand","upgradeCommand","program","api","command","usage","description","i18n","t","localeKeys","build","describe","option","watch","tsconfig","platform","dts","noClear","shared","config","action","options","context","initModuleContext","runner","useHookRunners","devToolMetas","registerDev","beforeDev","devProgram","dev","meta","subCommands","subCmd","beforeDevTask","isTsProject","new","lang","debug","distTag","registry","noNeedInstall","ModuleNewAction","getLocaleLanguage","locale","defineCommand"],"sources":["../src/home/runner/work/modern.js/modern.js/packages/solutions/module-tools/src/command.ts"],"sourcesContent":["import type { Command } from '@modern-js/utils';\nimport type { PluginAPI } from '@modern-js/core';\nimport type { ModuleTools } from './types';\nimport type { DevCommandOptions, BuildCommandOptions } from './types/command';\nimport { i18n, localeKeys } from './locale';\nimport { initModuleContext } from './utils/context';\n\nexport const buildCommand = async (\n program: Command,\n api: PluginAPI<ModuleTools>,\n) => {\n program\n .command('build')\n .usage('[options]')\n .description(i18n.t(localeKeys.command.build.describe))\n .option('-w, --watch', i18n.t(localeKeys.command.build.watch))\n .option('--tsconfig [tsconfig]', i18n.t(localeKeys.command.build.tsconfig))\n .option(\n '-p, --platform [platform...]',\n i18n.t(localeKeys.command.build.platform),\n )\n .option('--no-dts', i18n.t(localeKeys.command.build.dts))\n .option('--no-clear', i18n.t(localeKeys.command.build.noClear))\n .option('-c --config <config>', i18n.t(localeKeys.command.shared.config))\n .action(async (options: BuildCommandOptions) => {\n const context = await initModuleContext(api);\n const { build } = await import('./build');\n await build(api, options, context);\n });\n};\n\nexport const devCommand = async (\n program: Command,\n api: PluginAPI<ModuleTools>,\n) => {\n const runner = api.useHookRunners();\n const devToolMetas = await runner.registerDev();\n\n await runner.beforeDev(devToolMetas);\n\n const devProgram = program\n .command('dev')\n .usage('[options]')\n .description(i18n.t(localeKeys.command.dev.describe))\n .option('--tsconfig [tsconfig]', i18n.t(localeKeys.command.dev.tsconfig))\n .action(async (options: DevCommandOptions) => {\n const context = await initModuleContext(api);\n const { dev } = await import('./dev');\n await dev(options, devToolMetas, api, context);\n });\n\n for (const meta of devToolMetas) {\n if (!meta.subCommands) {\n continue;\n }\n\n for (const subCmd of meta.subCommands) {\n devProgram.command(subCmd).action(async (options: DevCommandOptions) => {\n const context = await initModuleContext(api);\n\n // TODO: watch build\n // const { ensureFirstBuild, watchBuild } = await import('./dev');\n // await ensureFirstBuild(api, context, options, {\n // disableRunBuild: meta.disableRunBuild ?? false,\n // appDirectory: context.appDirectory,\n // });\n\n await runner.beforeDevTask(meta);\n await meta.action(options, { isTsProject: context.isTsProject });\n // TODO: watch build\n // await watchBuild(api, context, options, {\n // disableRunBuild: meta.disableRunBuild ?? false,\n // appDirectory: context.appDirectory,\n // });\n });\n }\n }\n};\n\nexport const newCommand = async (program: Command) => {\n program\n .command('new')\n .usage('[options]')\n .description(i18n.t(localeKeys.command.new.describe))\n .option(\n '--config-file <configFile>',\n i18n.t(localeKeys.command.shared.config),\n )\n .option('--lang <lang>', i18n.t(localeKeys.command.new.lang))\n .option('-c, --config <config>', i18n.t(localeKeys.command.new.config))\n .option('-d, --debug', i18n.t(localeKeys.command.new.debug), false)\n .option('--dist-tag <tag>', i18n.t(localeKeys.command.new.distTag))\n .option('--registry', i18n.t(localeKeys.command.new.registry))\n .option(\n '--no-need-install',\n i18n.t(localeKeys.command.shared.noNeedInstall),\n )\n .action(async options => {\n const { ModuleNewAction } = await import('@modern-js/new-action');\n const { getLocaleLanguage } = await import(\n '@modern-js/plugin-i18n/language-detector'\n );\n\n const locale = getLocaleLanguage();\n\n await ModuleNewAction({ ...options, locale: options.lang || locale });\n });\n};\n\nexport const upgradeCommand = async (program: Command) => {\n const { defineCommand } = await import('@modern-js/upgrade');\n defineCommand(\n program\n .command('upgrade')\n .option('-c --config <config>', i18n.t(localeKeys.command.shared.config))\n .option(\n '--no-need-install',\n i18n.t(localeKeys.command.shared.noNeedInstall),\n ),\n );\n};\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"mappings":";;;;;;;;;;;;EAGaA,cAAY;WAAZA;;EAOAC,oBAAkB;WAAlBA;;;AAPN,MAAMD,eAAe,CAACE,WAC3BA;AAMK,MAAMD,qBAAqB,CAChCC,YAC4B;EAC5B,GAAGA;EACHC,QAAQ;EACRC,iBAAiB;AACnB;","names":["defineConfig","defineLegacyConfig","config","legacy","autoLoadPlugins"],"sources":["../../src/config/home/runner/work/modern.js/modern.js/packages/solutions/module-tools/src/config/defineConfig.ts"],"sourcesContent":["import type { UserConfigExport } from '@modern-js/core';\nimport type { ModuleConfigParams, ModuleLegacyUserConfig } from '../types';\n\nexport const defineConfig = (config: UserConfigExport<ModuleConfigParams>) =>\n config;\n\n/**\n * @deprecated\n * Using defineConfig first.\n */\nexport const defineLegacyConfig = (\n config: ModuleLegacyUserConfig,\n): ModuleLegacyUserConfig => ({\n ...config,\n legacy: true,\n autoLoadPlugins: true,\n});\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"mappings":";;;;;;;;;;;;EAAaA,SAAO;WAAPA;;EAaAC,SAAO;WAAPA;;EAqGAC,aAAW;WAAXA;;EA6BAC,cAAY;WAAZA;;EAkCAC,cAAY;WAAZA;;EAUAC,aAAW;WAAXA;;EASAC,cAAY;WAAZA;;;AApMN,MAAMN,UAAU;EACrB;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;EAEA;;AAGK,MAAMC,UAAU;EACrB;EACA;EACA;EACA;KACG;IACD;IACA;IACA;IACA;IACAM,OAAiB,CAACC,KAAKC;AACvB,WAAO;SAAID;SAAQR,QAAQU,IAAIC,OAAK,GAAGF,OAAOE,GAAG;;EACnD,GAAG,EAAE;;AAGP,MAAMC,aAAa;EACjBC,QAAQ;IACNC,MAAMd;EACR;EACAe,QAAQ;IACND,MAAM;MAAC;MAAO;MAAO;;EACvB;EACAE,WAAW;IACTF,MAAM;MAAC;MAAM;MAA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;EAE1B;IACEU,QAAQ;IACR4B,QAAQ;MAAE3B,MAAMgC;IAAkB;EACpC;;EAEA;IACEjC,QAAQ;IACR4B,QAAQ;MAAEd,QAAQ;IAAS;EAC7B;;EAEA;IACEd,QAAQ;IACR4B,QAAQ;MAAEd,QAAQ;IAAU;EAC9B;;EAEA;IACEd,QAAQ;IACR4B,QAAQ;MACN3B,MAAM;QAAC;QAAiB;;IAC1B;EACF;;EAEA;IACED,QAAQ;IACR4B,QAAQ;MACNd,QAAQ;MACRoB,SAAS;IACX;EACF;KACG7C;;AAGE,MAAME,eAAe;EAC1B;IACES,QAAQ;IACR4B,QAAQ;;MAEN3B,MAAM;QAAC;QAAW;;IACpB;EACF;;AAGK,MAAMT,cAAc;EACzB;IACEQ,QAAQ;IACR4B,QAAQ;MACNd,QAAQ;QAAC;QAAU;;IACrB;EACF;;AAGK,MAAMrB,eAAe;KAAIF;KAAiBD;KAAiBE;;","names":["targets","presets","buildSchema","outputSchema","sourceSchema","toolsSchema","legacySchema","reduce","ret","crt","map","t","properties","target","enum","format","sourceMap","buildType","bundleOptions","type","getModuleId","instanceof","entry","splitting","externals","items","anyOf","typeof","platform","minify","skipDeps","bundlelessOptions","sourceDir","style","compileMode","path","static","tsconfig","enableDts","dtsOnly","outputPath","schema","if","then","additionalProperties","else","PACKAGE_MODE_LIST","default"],"sources":["../../src/config/home/runner/work/modern.js/modern.js/packages/solutions/module-tools/src/config/legacySchema.ts"],"sourcesContent":["export const targets = [\n 'es5',\n 'es6',\n 'es2015',\n 'es2016',\n 'es2017',\n 'es2018',\n 'es2019',\n 'es2020',\n // The default target is esnext which means that by default, assume all of the latest JavaScript and CSS features are supported.\n 'esnext',\n];\n\nexport const presets = [\n 'npm-library',\n 'npm-library-with-umd',\n 'npm-component',\n 'npm-component-with-umd',\n ...[\n 'npm-library',\n 'npm-library-with-umd',\n 'npm-component',\n 'npm-component-with-umd',\n ].reduce<string[]>((ret, crt) => {\n return [...ret, ...targets.map(t => `${crt}-${t}`)];\n }, []),\n];\n\nconst properties = {\n target: {\n enum: targets,\n },\n format: {\n enum: ['cjs', 'esm', 'umd'],\n },\n sourceMap: {\n enum: [true, false, 'inline', 'external'],\n },\n buildType: {\n enum: ['bundle', 'bundleless'],\n },\n bundleOptions: {\n type: 'object',\n properties: {\n getModuleId: {\n instanceof: 'Function',\n },\n entry: {\n type: 'object',\n },\n splitting: {\n type: 'boolean',\n },\n externals: {\n type: 'array',\n items: {\n anyOf: [\n {\n instanceof: 'RegExp',\n },\n {\n typeof: 'string',\n },\n ],\n },\n },\n platform: {\n enum: ['node', 'browser'],\n },\n minify: {\n enum: ['esbuild', 'terser', false],\n },\n skipDeps: {\n type: 'boolean',\n },\n },\n },\n bundlelessOptions: {\n type: 'object',\n properties: {\n sourceDir: {\n type: 'string',\n },\n style: {\n type: 'object',\n properties: {\n compileMode: {\n enum: ['all', 'only-compiled-code', 'only-source-code', false],\n },\n path: { type: 'string' },\n },\n },\n static: {\n type: 'object',\n properties: {\n path: { type: 'string' },\n },\n },\n },\n },\n\n tsconfig: {\n type: 'string',\n },\n enableDts: {\n type: 'boolean',\n },\n dtsOnly: {\n type: 'boolean',\n },\n\n outputPath: { type: 'string' },\n};\n\nexport const buildSchema = [\n {\n target: 'output.buildConfig',\n schema: {\n if: {\n type: 'array',\n },\n then: {\n items: [{ type: 'object', properties, additionalProperties: false }],\n },\n else: { type: 'object', properties, additionalProperties: false },\n },\n },\n {\n target: 'output.buildPreset',\n schema: {\n enum: presets,\n },\n },\n];\n\nconst PACKAGE_MODE_LIST = [\n 'universal-js',\n 'universal-js-lite',\n 'browser-js',\n 'browser-js-lite',\n 'node-js',\n];\n\nexport const outputSchema = [\n /** packageMode will deprecated */\n {\n target: 'output.packageMode',\n schema: { enum: PACKAGE_MODE_LIST },\n },\n /** packageFields will deprecated */\n {\n target: 'output.packageFields',\n schema: { typeof: 'object' },\n },\n /** enableSourceMap will deprecated */\n {\n target: 'output.enableSourceMap',\n schema: { typeof: 'boolean' },\n },\n /** importStyle will deprecated */\n {\n target: 'output.importStyle',\n schema: {\n enum: ['compiled-code', 'source-code'],\n },\n },\n /** assetsPath will deprecated */\n {\n target: 'output.assetsPath',\n schema: {\n typeof: 'string',\n default: 'styles',\n },\n },\n ...buildSchema,\n];\n\nexport const sourceSchema = [\n {\n target: 'source.jsxTransformRuntime',\n schema: {\n // https://babeljs.io/docs/en/babel-preset-react#runtime\n enum: ['classic', 'automatic'],\n },\n },\n];\n\nexport const toolsSchema = [\n {\n target: 'tools.speedy',\n schema: {\n typeof: ['object', 'function'],\n },\n },\n];\n\nexport const legacySchema = [...sourceSchema, ...outputSchema, ...toolsSchema];\n"]}
|
package/dist/config/merge.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
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;AAC3C,QAAM,EAAEC,SAASC,gBAAe,IAAKL;AACrC,QAAM,EAAEM,mBAAmBC,oBAAoBC,MAAK,IAAK,MAAM,iFAC7D;AAEF,QAAM,EAAEC,qBAAoB,IAAK,MAAM,iFAAO;AAC9C,QAAM,EAAEC,eAAc,IAAK,MAAM,iFAAO;AACxC,QAAMC,eAAe;IACnB,KAAKP,QAAQQ;EACf;AACA,QAAMC,cAAcP,kBAAkBK,cAAcZ,QAAQe,KAAK;AAOjE,QAAMA,QAAQC,OAAOC,KAAKH,aAAaI,OACrC,CAACC,MAAMC;AACL,UAAMC,iBAAiB,CAACC;AACtB,UAAI,OAAOA,WAAU,YAAYA,OAAMC,WAAW,MAAM;AACtD,eAAOd,MAAMD,mBAAmBH,QAAQmB,cAAcF;MACxD;AACA,aAAOA;IACT;AACA,UAAMA,QAAQD,eAAeP,YAAYM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E,yDAAuBG,cAAcgE;IAClDtB;IACAlB;IACAZ;IACAoB;IACAP;IACAwC,OAAO;MACL,GAAG3C;MACH4C,SAAQrE,kDAAQoE,WAAK,QAAbpE,oDAAeqE,YAAM,QAArBrE,2DAAyBG,cAAciE,MAAMC;MACrDC,UAAStE,oDAAQoE,WAAK,QAAbpE,sDAAesE,aAAO,QAAtBtE,6DAA0BG,cAAciE,MAAME;MACvDC,cACEvE,wDAAQoE,WAAK,QAAbpE,sDAAeuE,iBAAW,QAA1BvE,qEAA8BG,cAAciE,MAAMG;MACpDC,cACExE,wDAAQoE,WAAK,QAAbpE,sDAAewE,iBAAW,QAA1BxE,qEAA8BG,cAAciE,MAAMI;IACtD;IACAC,UAAU;MACR,GAAGtE,cAAcsE;MACjB,GAAGzE,QAAQyE;IACb;IACAlB;IACAmB,kBAAiB1E,mCAAQ0E,qBAAe,QAAvB1E,iEAA2BG,cAAcuE;IAC1DC,kBAAiB3E,mCAAQ2E,qBAAe,QAAvB3E,iEAA2BG,cAAcwE;IAC1DC,kBAAiB5E,mCAAQ4E,qBAAe,QAAvB5E,iEAA2BG,cAAcyE;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"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":null,"mappings":";;;;;;;;;;;;EAmBaA,gBAAc;WAAdA;;EAmCAC,aAAW;WAAXA;;EAcAC,sBAAoB;WAApBA;;EAuCAC,oBAAkB;WAAlBA;;;;;iEA3GI;mEAEH;uBACqB;wBAYQ;uBACgB;uBACnB;AAEjC,MAAMH,iBAAiB,OAAOI;AACnC,MAAI,OAAOA,WAAW,YAAY;AAChC,UAAMC,eAAe,CACnBC,YACAC;AAEA,YAAMC,sBAAsBC,uBAAeH;AAC3C,UAAI,CAACE,qBAAqB;AACxB,cAAM,IAAIE,MAAM,KAAKJ,0CAA0C;MACjE;AACA,aAAOE,oBAAoBG,IAAIC;AAC7B,eAAOC,gBAAEC,MAAMF,QAAQL;MACzB;IACF;AAEA,UAAMQ,qBAAqB,MAAMX,OAAO;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zD,MAAIR,UAAUU,KAAK;AACjBV,cAAUU,IAAIC,WAAWN,cAAKC,QAC5BN,UAAUI,QACVJ,UAAUU,IAAIC,QAAQ;AAExBX,cAAUU,IAAIE,eAAeP,cAAKC,QAChCnB,QAAQoB,cACRP,UAAUU,IAAIE,YAAY;EAE9B;AAEA,SAAOZ;AACT;","names":["presetToConfig","mergeConfig","normalizeBuildConfig","transformToAbsPath","preset","extendPreset","presetName","extendConfig","originalBuildConfig","internalPreset","Error","map","config","_","merge","partialBuildConfig","inPresetList","p","presetList","undefined","low","high","ensureArray","Array","isArray","api","context","buildCmdOptions","useConfigContext","isLegacyUserConfig","createUserConfigFromLegacy","buildConfig","buildPreset","configFromPreset","mergedConfig","validPartialBuildConfig","normalizedConfig","Promise","all","newConfig","mergeDefaultBaseConfig","baseConfig","options","outDir","path","resolve","appDirectory","sourceDir","slash","dts","distPath","tsconfigPath"],"sources":["../../src/config/home/runner/work/modern.js/modern.js/packages/solutions/module-tools/src/config/normalize.ts"],"sourcesContent":["import path from 'path';\nimport type { PluginAPI } from '@modern-js/core';\nimport _ from '@modern-js/utils/lodash';\nimport { ensureArray, slash } from '@modern-js/utils';\nimport type {\n ModuleUserConfig,\n ModuleLegacyUserConfig,\n BaseBuildConfig,\n BuildPreset,\n PartialBuildConfig,\n PartialBaseBuildConfig,\n ModuleContext,\n BuildCommandOptions,\n ModuleTools,\n} from '../types';\nimport { internalPreset, presetList } from '../constants/preset';\nimport { isLegacyUserConfig, mergeDefaultBaseConfig } from './merge';\nimport { validPartialBuildConfig } from './valid';\n\nexport const presetToConfig = async (preset?: BuildPreset) => {\n if (typeof preset === 'function') {\n const extendPreset = (\n presetName: keyof typeof internalPreset,\n extendConfig: PartialBaseBuildConfig,\n ) => {\n const originalBuildConfig = internalPreset[presetName];\n if (!originalBuildConfig) {\n throw new Error(`**${presetName}** is not internal buildPreset`);\n }\n return originalBuildConfig.map(config => {\n return _.merge(config, extendConfig);\n });\n };\n\n const partialBuildConfig = await preset({\n preset: internalPreset,\n extendPreset,\n });\n\n if (!partialBuildConfig) {\n throw new Error(\n 'The `buildPreset` function does not allow no return value',\n );\n }\n\n return partialBuildConfig;\n }\n\n const inPresetList = (p: string): p is keyof typeof presetList =>\n p in presetList;\n\n return preset && inPresetList(preset) ? presetList[preset] : undefined;\n};\n\nexport const mergeConfig = (\n low?: PartialBaseBuildConfig[],\n high = {} as PartialBuildConfig,\n): PartialBaseBuildConfig[] => {\n if (!low) {\n return ensureArray(high);\n }\n return Array.isArray(high)\n ? [...low, ...high]\n : low.map(config => {\n return _.merge(config, high);\n });\n};\n\nexport const normalizeBuildConfig = async (\n api: PluginAPI<ModuleTools>,\n context: ModuleContext,\n buildCmdOptions: BuildCommandOptions,\n): Promise<BaseBuildConfig[]> => {\n let config = api.useConfigContext() as unknown as ModuleUserConfig;\n\n if (isLegacyUserConfig(config as { legacy?: boolean })) {\n const { createUserConfigFromLegacy } = await import(\n './transformLegacyConfig'\n );\n config = await createUserConfigFromLegacy(config as ModuleLegacyUserConfig);\n }\n\n const { buildConfig, buildPreset } = config;\n\n const configFromPreset = await presetToConfig(buildPreset);\n\n const mergedConfig = mergeConfig(configFromPreset, buildConfig ?? {});\n\n validPartialBuildConfig(mergedConfig);\n\n const normalizedConfig = await Promise.all(\n mergedConfig.map(async config => {\n let newConfig = await mergeDefaultBaseConfig(config, {\n context,\n buildCmdOptions,\n });\n newConfig = await transformToAbsPath(newConfig, {\n context,\n buildCmdOptions,\n });\n return newConfig;\n }),\n );\n\n return normalizedConfig;\n};\n\nexport const transformToAbsPath = async (\n baseConfig: BaseBuildConfig,\n options: { context: ModuleContext; buildCmdOptions: BuildCommandOptions },\n) => {\n const newConfig = baseConfig;\n const { context } = options;\n\n newConfig.outDir = path.resolve(context.appDirectory, newConfig.outDir);\n\n newConfig.sourceDir = slash(\n path.resolve(context.appDirectory, baseConfig.sourceDir),\n );\n\n // dts path\n if (newConfig.dts) {\n newConfig.dts.distPath = path.resolve(\n newConfig.outDir,\n newConfig.dts.distPath,\n );\n newConfig.dts.tsconfigPath = path.resolve(\n context.appDirectory,\n newConfig.dts.tsconfigPath,\n );\n }\n\n return newConfig;\n};\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":null,"mappings":";;;;;;;;;;;;EAAaA,SAAO;WAAPA;;EAeAC,SAAO;WAAPA;;EAgLAC,aAAW;WAAXA;;EAoBAC,aAAW;WAAXA;;EAWAC,QAAM;WAANA;;EAOAC,QAAM;WAANA;;EACJC,cAAY;WAAZA;;;8BAAoB;AAtOtB,MAAMN,UAAU;EACrB;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;EAEA;;AAGK,MAAMC,UAAU;EACrB;EACA;EACA;EACA;KACG;IACD;IACA;IACA;IACA;IACAM,OAAiB,CAACC,KAAKC;AACvB,WAAO;SAAID;SAAQR,QAAQU,IAAIC,OAAK,GAAGF,OAAOE,GAAG;;EACnD,GAAG,EAAE;EACL;EACA;;AAEF,MAAMC,wBAAwB;EAC5BC,OAAO;IACLC,QAAQ;MAAC;MAAU;;EACrB;EACAC,OAAO;IACLC,MAAM;EACR;EACAC,cAAc;IACZC,IAAI;MACFF,MAAM;IACR;IACAG,MAAM;MACJC,YAAY;QACVC,cAAc;UAAEL,MAAM;QAAU;QAChCM,kBAAkB;UAAEN,MAAM;QAAU;MACtC;IACF;IACAO,MAAM;MAAEP,MAAM;IAAU;EAC1B;EACAQ,WAAW;IACTC,MAAM;MAAC;MAAU;;EACnB;EACAC,MAAM;IACJV,MAAM;IACNI,YAAY;MACVO,UAAU;QACRX,MAAM;QACNY,OAAO;UACLZ,MAAM;UACNI,YAAY;YACVS,MAAM;cAAEb,MAAM;YAAS;YACvBc,IAAI;cAAEd,MAAM;YAAS;YACrBe,SAAS;cAAEf,MAAM;YAAS;YAC1BgB,aAAa;cAAEhB,MAAM;YAAS;UAChC;QACF;MACF;MACAiB,SAAS;QACPjB,MAAM;QACNI,YAAY;UACVc,aAAa;YACXlB,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;MACA;QACE2B,YAAY;MACd;;EAEJ;EACAiB,iBAAiB;IACf5C,MAAM;EACR;EACA6C,iBAAiB;IACf7C,MAAM;EACR;EACA8C,iBAAiB;IACf9C,MAAM;EACR;EACA+C,YAAY;IACVtC,MAAM;MAAC;MAAY;;EACrB;AACF;AACO,MAAMvB,cAAc;EACzBqD,QAAQ;EACRlD,QAAQ;IACNa,IAAI;MACFF,MAAM;IACR;IACAG,MAAM;MACJS,OAAO;QACL;UACEZ,MAAM;UACNI,YAAYR;QACd;;IAEJ;IACAW,MAAM;MACJP,MAAM;MACNI,YAAYR;IACd;EACF;AACF;AACO,MAAMT,cAAc;EACzBoD,QAAQ;EACRlD,QAAQ;IACNa,IAAI;MAAEF,MAAM;IAAS;IACrBG,MAAM;MACJM,MAAMxB;IACR;IACAsB,MAAM;MAAET,QAAQ;IAAW;EAC7B;AACF;AAEO,MAAMV,SAAS;EACpBmD,QAAQ;EACRlD,QAAQ;IACNW,MAAM;EACR;AACF;AAEO,MAAMX,SAAS;EAACH;EAAaC;EAAaC;;","names":["targets","presets","buildConfig","buildPreset","legacy","schema","legacySchema","reduce","ret","crt","map","t","buildConfigProperties","alias","typeof","asset","type","autoExternal","if","then","properties","dependencies","peerDependencies","else","buildType","enum","copy","patterns","items","from","to","context","globOptions","options","concurrency","define","dts","distPath","tsconfigPath","abortOnError","respectExternal","externals","anyOf","instanceof","format","input","jsx","minify","outDir","platform","sourceDir","sourceMap","splitting","style","redirect","target","umdGlobals","esbuildOpitons","umdModuleName","sideEffects","externalHelpers","transformImport","transformLodash","sourceType"],"sources":["../../src/config/home/runner/work/modern.js/modern.js/packages/solutions/module-tools/src/config/schema.ts"],"sourcesContent":["export const targets = [\n 'es5',\n 'es6',\n 'es2015',\n 'es2016',\n 'es2017',\n 'es2018',\n 'es2019',\n 'es2020',\n 'es2021',\n 'es2022',\n // The default target is esnext which means that by default, assume all of the latest JavaScript and CSS features are supported.\n 'esnext',\n];\n\nexport const presets = [\n 'npm-library',\n 'npm-library-with-umd',\n 'npm-component',\n 'npm-component-with-umd',\n ...[\n 'npm-library',\n 'npm-library-with-umd',\n 'npm-component',\n 'npm-component-with-umd',\n ].reduce<string[]>((ret, crt) => {\n return [...ret, ...targets.map(t => `${crt}-${t}`)];\n }, []),\n 'modern-js-node',\n 'modern-js-universal',\n];\nconst buildConfigProperties = {\n alias: {\n typeof: ['object', 'function'],\n },\n asset: {\n type: 'object',\n },\n autoExternal: {\n if: {\n type: 'object',\n },\n then: {\n properties: {\n dependencies: { type: 'boolean' },\n peerDependencies: { type: 'boolean' },\n },\n },\n else: { type: 'boolean' },\n },\n buildType: {\n enum: ['bundle', 'bundleless'],\n },\n copy: {\n type: 'object',\n properties: {\n patterns: {\n type: 'array',\n items: {\n type: 'object',\n properties: {\n from: { type: 'string' },\n to: { type: 'string' },\n context: { type: 'string' },\n globOptions: { type: 'object' },\n },\n },\n },\n options: {\n type: 'object',\n properties: {\n concurrency: {\n type: 'number',\n },\n },\n },\n },\n },\n define: {\n typeof: 'object',\n },\n dts: {\n if: { type: 'object' },\n then: {\n properties: {\n distPath: { type: 'string' },\n tsconfigPath: { type: 'string' },\n abortOnError: { type: 'boolean' },\n respectExternal: {\n type: 'boolean',\n },\n },\n },\n else: { type: 'boolean' },\n },\n externals: {\n type: 'array',\n items: {\n anyOf: [\n {\n instanceof: 'RegExp',\n },\n {\n typeof: 'string',\n },\n ],\n },\n },\n format: {\n enum: ['cjs', 'esm', 'iife', 'umd'],\n },\n input: {\n type: ['array', 'object'],\n },\n jsx: {\n enum: ['automatic', 'transform'],\n },\n minify: {\n if: {\n type: 'object',\n },\n else: { enum: ['esbuild', 'terser', false] },\n },\n outDir: { type: 'string' },\n platform: {\n enum: ['node', 'browser'],\n },\n sourceDir: {\n typeof: 'string',\n },\n sourceMap: {\n enum: [true, false, 'inline', 'external'],\n },\n splitting: {\n type: 'boolean',\n },\n style: {\n // TODO: add properties\n type: 'object',\n },\n redirect: {\n type: 'object',\n },\n target: {\n enum: targets,\n },\n umdGlobals: {\n type: 'object',\n },\n esbuildOpitons: {\n instanceof: 'Function',\n },\n umdModuleName: {\n anyOf: [\n {\n instanceof: 'Function',\n },\n {\n typeof: 'string',\n },\n ],\n },\n sideEffects: {\n anyOf: [\n {\n type: 'array',\n items: {\n instanceof: 'RegExp',\n },\n },\n {\n type: 'boolean',\n },\n {\n instanceof: 'Function',\n },\n ],\n },\n externalHelpers: {\n type: 'boolean',\n },\n transformImport: {\n type: 'array',\n },\n transformLodash: {\n type: 'boolean',\n },\n sourceType: {\n enum: ['commonjs', 'module'],\n },\n};\nexport const buildConfig = {\n target: 'buildConfig',\n schema: {\n if: {\n type: 'array',\n },\n then: {\n items: [\n {\n type: 'object',\n properties: buildConfigProperties,\n },\n ],\n },\n else: {\n type: 'object',\n properties: buildConfigProperties,\n },\n },\n};\nexport const buildPreset = {\n target: 'buildPreset',\n schema: {\n if: { type: 'string' },\n then: {\n enum: presets,\n },\n else: { typeof: 'function' },\n },\n};\n\nexport const legacy = {\n target: 'legacy',\n schema: {\n type: 'boolean',\n },\n};\n\nexport const schema = [buildConfig, buildPreset, legacy];\nexport { legacySchema } from './legacySchema';\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":null,"mappings":";;;;;;;;;;;;EAqBaA,6BAA2B;WAA3BA;;EA2CAC,8BAA4B;WAA5BA;;EA0BAC,8BAA4B;WAA5BA;;EAaAC,uBAAqB;WAArBA;;EAyCAC,2BAAyB;WAAzBA;;EA2IAC,2BAAyB;WAAzBA;;EA4BAC,6BAA2B;WAA3BA;;EA6EAC,2BAAyB;WAAzBA;;EA6BAC,uBAAqB;WAArBA;;EA4BAC,4BAA0B;WAA1BA;;;;iEA5bI;uBACM;8BAWO;AAQvB,MAAMT,8BAA8B,CACzCU,aACAC;AAEA,MAAI,CAACA,iBAAiBC,OAAO;AAC3B;EACF;AACA,QAAMC,cAAcF,iBAAiBC;MAE/BF,oBACEG,mBACAA,mBACOA;AAJfH,cAAYI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,OAAIA,4CAAiB0B,YAAM,QAAvB1B,wEAAyB2E,MAAM;AACjCM,iBAAaL,KAAK;MAChBD,MAAM;QACJE,UAAU7E,iBAAiB0B,OAAOiD;MACpC;IACF;EACF;AACA,SAAO;IACL,GAAG5C;IACHhC,aAAakF;EACf;AACF;AAEO,MAAMnF,6BAA6B,OACxC6C;MAGEA;AADF,QAAM,EAAE5C,aAAagF,aAAaG,eAAeM,YAAW,KAC1D7C,wBAAOjB,YAAM,QAAbiB,6CAAiB,CAAC;AAEpB,MAAI5C,aAAa;AACf,WAAON,0BAA0BkD;EACnC;AAEA,MAAIoC,aAAa;AACf,WAAOrF,0BAA0BiD;EACnC;AAEA,MAAIuC,eAAe;AACjB,WAAOvF,4BAA4BgD;EACrC;AAEA,MAAI6C,aAAa;AACf,WAAO7F,4BAA4BgD;EACrC;AAEA,SAAO9C,sBAAsB8C;AAC/B;","names":["transformToolsToBuildConfig","transformSourceToBuildConfig","transformOutputToBuildConfig","commonTransformAndLog","createConfigByBuildConfig","createConfigByBuildPreset","createConfigByPackageFields","createConfigByPackageMode","createConfigByDefault","createUserConfigFromLegacy","buildConfig","legacyUserConfig","tools","legacyTools","style","less","sass","tailwindcss","postcss","opts","utils","legacyOpts","postcssOptions","plugins","processOptions","legacySource","source","alias","define","envVars","forEach","envVar","process","env","globalVars","jsx","jsxTransformRuntime","output","disableTsChecker","dts","disableSourceMap","sourceMap","finalConfig","designSystem","babel","logger","warn","lodash","jest","testing","importStyle","jsPath","legacyBuildConfig","createBuildConfig","config","newConfig","legacyPath","path","outDir","join","outputPath","asset","assetsPath","buildType","format","target","dtsOnly","only","tsconfig","tsconfigPath","enableDts","bundleOptions","entry","input","splitting","platform","minify","externals","autoExternal","skipDeps","bundlelessOptions","sourceDir","static","Array","isArray","map","copy","push","patterns","legacyBuildPreset","buildPreset","preset","buildConfigs","packageFields","packageFieldsKeys","Object","keys","packageField","packageFieldValue","packageMode","legacyPresets"],"sources":["../../src/config/home/runner/work/modern.js/modern.js/packages/solutions/module-tools/src/config/transformLegacyConfig.ts"],"sourcesContent":["/* eslint-disable max-lines */\nimport path from 'path';\nimport { logger } from '@modern-js/utils';\nimport type {\n ModuleUserConfig,\n ModuleToolsLegacyUserConfig,\n PartialBaseBuildConfig,\n} from '../types';\nimport type { LegacyBaseBuildConfig } from '../types/legacyConfig/output';\nimport {\n PostCSSFunction,\n PostCSSLoaderOptions,\n} from '../types/legacyConfig/tools';\nimport { legacyPresets } from '../constants/legacy-preset';\n\n/**\n * transform `tools` to buildConfig\n * include tools.less/sass/postcss/tailwindcss\n * @param buildConfig PartialBaseBuildConfig\n * @param legacyUserConfig Readonly<ModuleToolsLegacyUserConfig>\n */\nexport const transformToolsToBuildConfig = (\n buildConfig: PartialBaseBuildConfig,\n legacyUserConfig: Readonly<ModuleToolsLegacyUserConfig>,\n) => {\n if (!legacyUserConfig.tools) {\n return;\n }\n const legacyTools = legacyUserConfig.tools;\n buildConfig.style = {\n ...(buildConfig.style ?? {}),\n less: legacyTools.less ?? {},\n sass: legacyTools.sass ?? {},\n tailwindcss: legacyTools.tailwindcss ?? {},\n };\n\n if (legacyTools.postcss) {\n buildConfig.style.postcss =\n typeof legacyTools.postcss === 'function'\n ? (opts, utils) => {\n const legacyOpts: PostCSSLoaderOptions = {\n postcssOptions: {\n plugins: opts.plugins,\n },\n };\n (legacyTools.postcss as PostCSSFunction)(legacyOpts, utils);\n opts.plugins = legacyOpts.postcssOptions?.plugins;\n opts.processOptions = legacyOpts.postcssOptions;\n }\n : {\n plugins: legacyTools.postcss.postcssOptions?.plugins,\n processOptions: legacyTools.postcss.postcssOptions,\n };\n }\n};\n\n/**\n * transform `source` to buildConfig\n *\n * @param buildConfig PartialBaseBuildConfig\n * @param legacyUserConfig Readonly<ModuleToolsLegacyUserConfig>\n *\n * NB: ignore source.designSystem in this function\n */\nexport const transformSourceToBuildConfig = (\n buildConfig: PartialBaseBuildConfig,\n legacyUserConfig: Readonly<ModuleToolsLegacyUserConfig>,\n) => {\n if (!legacyUserConfig.source) {\n return;\n }\n const legacySource = legacyUserConfig.source;\n\n buildConfig.alias = legacySource.alias ?? {};\n\n buildConfig.define = {};\n legacySource.envVars?.forEach(envVar => {\n buildConfig.define![`process.env.${envVar}`] = process.env[\n envVar\n ] as string;\n });\n buildConfig.define = {\n ...buildConfig.define,\n ...legacySource.globalVars,\n };\n\n buildConfig.jsx =\n legacySource.jsxTransformRuntime === 'classic' ? 'transform' : 'automatic';\n};\n\nexport const transformOutputToBuildConfig = (\n buildConfig: PartialBaseBuildConfig,\n legacyUserConfig: Readonly<ModuleToolsLegacyUserConfig>,\n) => {\n if (legacyUserConfig.output?.disableTsChecker) {\n buildConfig.dts = false;\n }\n\n if (legacyUserConfig.output?.disableSourceMap) {\n buildConfig.sourceMap = false;\n }\n};\n\nexport const commonTransformAndLog = async (\n legacyUserConfig: Readonly<ModuleToolsLegacyUserConfig>,\n) => {\n const finalConfig: ModuleUserConfig = {};\n // source.designSystem\n finalConfig.designSystem = legacyUserConfig.source?.designSystem;\n\n if (legacyUserConfig.tools) {\n const legacyTools = legacyUserConfig.tools;\n if (legacyTools.babel) {\n logger.warn(\n '`tools.babel` is not support in legacy mode. Please check migrate documentation.',\n );\n }\n\n if (legacyTools.lodash) {\n logger.warn(\n '`tools.lodash` is not support in legacy mode. Please check migrate documentation.',\n );\n }\n\n if (legacyTools.jest) {\n finalConfig.testing = {\n jest: legacyTools.jest,\n };\n }\n }\n\n if (legacyUserConfig.output?.importStyle) {\n logger.warn(\n '`output.importStyle` is not support in legacy mode. Please check migrate documentation. By default, the style will be compiled',\n );\n }\n\n if (legacyUserConfig.output?.jsPath) {\n logger.warn('`output.jsPath` is not support in legacy mode.');\n }\n\n return finalConfig;\n};\n\nexport const createConfigByBuildConfig = async (\n legacyUserConfig: Readonly<ModuleToolsLegacyUserConfig>,\n): Promise<ModuleUserConfig> => {\n const legacyBuildConfig = legacyUserConfig.output!.buildConfig!;\n\n const createBuildConfig = (config: LegacyBaseBuildConfig) => {\n const newConfig: PartialBaseBuildConfig = {};\n\n transformSourceToBuildConfig(newConfig, legacyUserConfig);\n\n // [legacy config: output] start\n const legacyPath = legacyUserConfig.output?.path ?? 'dist';\n newConfig.outDir = path.join(legacyPath, config.outputPath ?? './');\n\n // `bundlelessOptions.static.path` is a higher priority than `output?.assetsPath`\n newConfig.asset = {\n path: legacyUserConfig.output?.assetsPath,\n };\n\n // `buildConfig.sourceMap` is a higher priority than `output?.disableSourceMap`\n newConfig.sourceMap = !legacyUserConfig.output?.disableSourceMap;\n newConfig.sourceMap = config.sourceMap ?? config.buildType === 'bundle';\n\n newConfig.buildType = config.buildType ?? 'bundleless';\n newConfig.format = config.format ?? 'cjs';\n newConfig.target = config.target ?? 'esnext';\n\n newConfig.dts = legacyUserConfig.output?.disableTsChecker ? false : {};\n if (config.dtsOnly) {\n newConfig.dts = {\n ...(typeof newConfig.dts === 'object' ? newConfig.dts : {}),\n only: true,\n };\n }\n if (config.tsconfig) {\n newConfig.dts = {\n ...(typeof newConfig.dts === 'object' ? newConfig.dts : {}),\n tsconfigPath: config.tsconfig,\n };\n }\n // check enableDts must be last\n if (!config.enableDts) {\n newConfig.dts = false;\n }\n\n if (config.bundleOptions) {\n const { bundleOptions } = config;\n if (bundleOptions.entry) {\n newConfig.input = config.bundleOptions.entry;\n }\n\n newConfig.splitting = bundleOptions.splitting ?? false;\n newConfig.platform = bundleOptions.platform ?? 'node';\n newConfig.minify = bundleOptions.minify ?? false;\n newConfig.externals = bundleOptions.externals ?? [];\n newConfig.autoExternal = bundleOptions.skipDeps ?? true;\n }\n\n if (config.bundlelessOptions) {\n const { bundlelessOptions } = config;\n newConfig.sourceDir = bundlelessOptions.sourceDir ?? './src';\n\n if (bundlelessOptions.style) {\n logger.warn(\n 'bundlelessOptions.style is not support in legacy mode. Please check migrate documentation. By default, the style will be compiled.',\n );\n }\n\n // look the notes about `output?.assetsPath` above\n if (bundlelessOptions.static?.path) {\n newConfig.asset = {\n path: bundlelessOptions.static?.path,\n };\n }\n }\n\n if (legacyUserConfig.output?.importStyle) {\n logger.warn(\n '`output.importStyle` is not support in legacy mode. Please check migrate documentation. By default, the style will be compiled',\n );\n }\n\n if (legacyUserConfig.output?.jsPath) {\n logger.warn('`output.jsPath` is not support in legacy mode.');\n }\n // [legacy config: output] end\n\n if (legacyUserConfig.tools) {\n transformToolsToBuildConfig(newConfig, legacyUserConfig);\n }\n\n return newConfig;\n };\n\n const finalConfig: ModuleUserConfig = {};\n if (Array.isArray(legacyBuildConfig)) {\n finalConfig.buildConfig = legacyBuildConfig.map(config =>\n createBuildConfig(config),\n );\n } else {\n finalConfig.buildConfig = [createBuildConfig(legacyBuildConfig)];\n }\n\n // source.designSystem\n finalConfig.designSystem = legacyUserConfig.source?.designSystem;\n\n // output.copy\n if (legacyUserConfig.output?.copy) {\n finalConfig.buildConfig.push({\n copy: {\n patterns: legacyUserConfig.output.copy,\n },\n });\n }\n\n if (legacyUserConfig.tools) {\n const legacyTools = legacyUserConfig.tools;\n if (legacyTools.babel) {\n logger.warn(\n '`tools.babel` is not support in legacy mode. Please check migrate documentation.',\n );\n }\n\n if (legacyTools.lodash) {\n logger.warn(\n '`tools.lodash` is not support in legacy mode. Please check migrate documentation.',\n );\n }\n\n if (legacyTools.jest) {\n finalConfig.testing = {\n jest: legacyTools.jest,\n };\n }\n }\n\n return finalConfig;\n};\n\nexport const createConfigByBuildPreset = async (\n legacyUserConfig: Readonly<ModuleToolsLegacyUserConfig>,\n): Promise<ModuleUserConfig> => {\n const legacyBuildPreset = legacyUserConfig.output?.buildPreset;\n const finalConfig = await commonTransformAndLog(legacyUserConfig);\n\n return {\n ...finalConfig,\n buildPreset({ preset }) {\n const buildConfigs = preset[legacyBuildPreset ?? 'npm-library'];\n buildConfigs.forEach(buildConfig => {\n transformSourceToBuildConfig(buildConfig, legacyUserConfig);\n transformToolsToBuildConfig(buildConfig, legacyUserConfig);\n transformOutputToBuildConfig(buildConfig, legacyUserConfig);\n });\n // output.copy\n if (legacyUserConfig.output?.copy) {\n buildConfigs.push({\n copy: {\n patterns: legacyUserConfig.output.copy,\n },\n });\n }\n return buildConfigs;\n },\n };\n};\n\nexport const createConfigByPackageFields = async (\n legacyUserConfig: Readonly<ModuleToolsLegacyUserConfig>,\n): Promise<ModuleUserConfig> => {\n const finalConfig = await commonTransformAndLog(legacyUserConfig);\n\n const output = legacyUserConfig.output!;\n const packageFields = output.packageFields!;\n const buildConfigs: PartialBaseBuildConfig[] = [];\n\n const packageFieldsKeys = Object.keys(packageFields) as (\n | 'main'\n | 'jsnext:modern'\n | 'module'\n )[];\n\n for (const packageField of packageFieldsKeys) {\n const packageFieldValue = packageFields[packageField];\n let buildConfig: PartialBaseBuildConfig = {};\n let outDir;\n if (packageField === 'main') {\n outDir = `./${output.path ?? 'dist'}/js/node`;\n } else if (packageField === 'module') {\n outDir = `./${output.path ?? 'dist'}/js/treeshaking`;\n } else {\n outDir = `./${output.path ?? 'dist'}/js/modern`;\n }\n\n if (packageFieldValue === 'CJS+ES6') {\n buildConfig = {\n format: 'cjs',\n target: 'es6',\n outDir,\n };\n } else if (packageFieldValue === 'ESM+ES5') {\n buildConfig = {\n format: 'esm',\n target: 'es5',\n outDir,\n };\n } else if (packageFieldValue === 'ESM+ES6') {\n buildConfig = {\n format: 'esm',\n target: 'es6',\n outDir,\n };\n }\n\n transformSourceToBuildConfig(buildConfig, legacyUserConfig);\n transformToolsToBuildConfig(buildConfig, legacyUserConfig);\n transformOutputToBuildConfig(buildConfig, legacyUserConfig);\n\n buildConfigs.push(buildConfig);\n }\n\n buildConfigs.push({\n buildType: 'bundleless',\n outDir: './dist/types',\n dts: {\n only: true,\n },\n });\n\n // output.copy\n if (legacyUserConfig.output?.copy) {\n buildConfigs.push({\n copy: {\n patterns: legacyUserConfig.output.copy,\n },\n });\n }\n\n return {\n ...finalConfig,\n buildConfig: buildConfigs,\n };\n};\n\nexport const createConfigByPackageMode = async (\n legacyUserConfig: Readonly<ModuleToolsLegacyUserConfig>,\n): Promise<ModuleUserConfig> => {\n const finalConfig = await commonTransformAndLog(legacyUserConfig);\n\n const packageMode = legacyUserConfig.output!.packageMode!;\n const buildConfigs = legacyPresets[packageMode];\n\n for (const buildConfig of buildConfigs) {\n transformSourceToBuildConfig(buildConfig, legacyUserConfig);\n transformToolsToBuildConfig(buildConfig, legacyUserConfig);\n transformOutputToBuildConfig(buildConfig, legacyUserConfig);\n // NB: not process output.path\n }\n\n // output.copy\n if (legacyUserConfig.output?.copy) {\n buildConfigs.push({\n copy: {\n patterns: legacyUserConfig.output.copy,\n },\n });\n }\n return {\n ...finalConfig,\n buildConfig: buildConfigs,\n };\n};\n\nexport const createConfigByDefault = async (\n legacyUserConfig: Readonly<ModuleToolsLegacyUserConfig>,\n): Promise<ModuleUserConfig> => {\n const finalConfig = await commonTransformAndLog(legacyUserConfig);\n\n const buildConfigs = legacyPresets['universal-js'];\n\n for (const buildConfig of buildConfigs) {\n transformSourceToBuildConfig(buildConfig, legacyUserConfig);\n transformToolsToBuildConfig(buildConfig, legacyUserConfig);\n transformOutputToBuildConfig(buildConfig, legacyUserConfig);\n // NB: not process output.path\n }\n\n // output.copy\n if (legacyUserConfig.output?.copy) {\n buildConfigs.push({\n copy: {\n patterns: legacyUserConfig.output.copy,\n },\n });\n }\n return {\n ...finalConfig,\n buildConfig: buildConfigs,\n };\n};\n\nexport const createUserConfigFromLegacy = async (\n config: Readonly<ModuleToolsLegacyUserConfig>,\n): Promise<ModuleUserConfig> => {\n const { buildConfig, buildPreset, packageFields, packageMode } =\n config.output ?? {};\n\n if (buildConfig) {\n return createConfigByBuildConfig(config);\n }\n\n if (buildPreset) {\n return createConfigByBuildPreset(config);\n }\n\n if (packageFields) {\n return createConfigByPackageFields(config);\n }\n\n if (packageMode) {\n return createConfigByPackageFields(config);\n }\n\n return createConfigByDefault(config);\n};\n\n/* eslint-enable max-lines */\n"]}
|
package/dist/config/valid.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"mappings":";;;;;;;;;;;;EAEaA,yBAAuB;WAAvBA;;EAUAC,yBAAuB;WAAvBA;;;AAVN,MAAMD,0BAA0B,CAACE;AACtC,MAAIC,MAAMC,QAAQF,SAAS;AACzB,eAAWG,KAAKH,QAAQ;AACtBD,8BAAwBI;IAC1B;EACF,OAAO;AACLJ,4BAAwBC;EAC1B;AACF;AAEO,MAAMD,0BAA0B,CAACC;MAGXA;AAF3B,MACEA,OAAOI,cAAc,gBACrB;IAAC;IAAQ;IAAOC,UAASL,wBAAOM,YAAM,QAAbN,6CAAiB,KAC1C;AACA,UAAM,IAAIO,MACR,iGAAiG;EAErG;AACF;","names":["validPartialBuildConfig","validBuildTypeAndFormat","config","Array","isArray","c","buildType","includes","format","Error"],"sources":["../../src/config/home/runner/work/modern.js/modern.js/packages/solutions/module-tools/src/config/valid.ts"],"sourcesContent":["import type { PartialBuildConfig, PartialBaseBuildConfig } from '../types';\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"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"mappings":";;;;+BAEaA;;;WAAAA;;;AAAN,MAAMA,wBAAwB;AACnC,SAAOC,OAAOC,OAAwB;IACpCC,WAAW;IACXC,QAAQ;IACRC,QAAQ;IACRC,WAAW;IACXC,MAAM,CAAC;IACPC,QAAQ;IACRC,KAAKR,OAAOC,OAAO;MACjBQ,MAAM;MACNC,UAAU;MACVC,cAAc;MACdC,cAAc;MACdC,iBAAiB;IACnB;IACAC,KAAK;IACLC,OAAO;MAAC;;IACRC,UAAU;IACVC,WAAW;IACXC,WAAW;IACXC,QAAQ;IACRC,cAAc;IACdC,YAAY,CAAC;IACbC,WAAW;IACXC,OAAO,CAAC;IACRC,UAAU;IACVC,eAAeC,UAAQA;IACvBC,QAAQ,CAAC;IACTC,OAAO;MACLC,MAAM;MACNC,OAAO;MACPC,YAAY;MACZC,MAAM;IACR;IACAC,OAAO;MACLC,MAAM,CAAC;MACPC,MAAM,CAAC;MACPC,SAAS,CAAC;MACVC,aAAa,CAAC;MACdC,QAAQ;MACRC,aAAa;MACbC,SAAS,CAAC;IACZ;IACAC,aAAaC;IACbC,UAAU;MACRpB,OAAO;MACPU,OAAO;MACPL,OAAO;IACT;IACAgB,gBAAgBC,OAAKA;IACrBC,iBAAiB;IACjBC,iBAAiB;IACjBC,iBAAiB;IACjBC,YAAY;IACZC,qBAAqB;EACvB;AACF;","names":["getDefaultBuildConfig","Object","freeze","buildType","format","target","sourceMap","copy","outDir","dts","only","distPath","tsconfigPath","abortOnError","respectExternal","jsx","input","platform","splitting","externals","minify","autoExternal","umdGlobals","sourceDir","alias","metafile","umdModuleName","name","define","asset","path","limit","publicPath","svgr","style","less","sass","postcss","tailwindcss","inject","autoModules","modules","sideEffects","undefined","redirect","esbuildOptions","c","externalHelpers","transformImport","transformLodash","sourceType","disableSwcTransform"],"sources":["../../src/constants/home/runner/work/modern.js/modern.js/packages/solutions/module-tools/src/constants/build.ts"],"sourcesContent":["import type { BaseBuildConfig } from '../types';\n\nexport const getDefaultBuildConfig = () => {\n return Object.freeze<BaseBuildConfig>({\n buildType: 'bundle',\n format: 'cjs',\n target: 'es6',\n sourceMap: false,\n copy: {},\n outDir: './dist',\n dts: Object.freeze({\n only: false,\n distPath: './',\n tsconfigPath: './tsconfig.json',\n abortOnError: true,\n respectExternal: true,\n }),\n jsx: 'automatic',\n input: ['src/index.ts'],\n platform: 'node',\n splitting: false,\n externals: [],\n minify: false,\n autoExternal: true,\n umdGlobals: {},\n sourceDir: './src',\n alias: {},\n metafile: false,\n umdModuleName: name => name,\n define: {},\n asset: {\n path: 'assets',\n limit: 14336,\n publicPath: '',\n svgr: false,\n },\n style: {\n less: {},\n sass: {},\n postcss: {},\n tailwindcss: {},\n inject: false,\n autoModules: true,\n modules: {},\n },\n sideEffects: undefined,\n redirect: {\n alias: true,\n style: true,\n asset: true,\n },\n esbuildOptions: c => c,\n externalHelpers: false,\n transformImport: [],\n transformLodash: true,\n sourceType: 'module',\n disableSwcTransform: false,\n });\n};\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"mappings":";;;;;;;;;;;;EAEaA,OAAK;WAALA;;EACAC,MAAI;WAAJA;;EACAC,MAAI;WAAJA;;;AAFN,MAAMF,QAAa;EAAC;EAAI;EAAK;;AAC7B,MAAMC,OAAY;EAAC;EAAI;EAAK;;AAC5B,MAAMC,OAAY;EAAC;EAAI;EAAG;;","names":["green","blue","gray"],"sources":["../../src/constants/home/runner/work/modern.js/modern.js/packages/solutions/module-tools/src/constants/color.ts"],"sourcesContent":["import type { RGB } from '../types/color';\n\nexport const green: RGB = [96, 186, 154];\nexport const blue: RGB = [82, 221, 252];\nexport const gray: RGB = [36, 2, 45];\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"mappings":";;;;;;;;;;;;EAAaA,6BAA2B;WAA3BA;;EAoBAC,eAAa;WAAbA;;EACAC,kBAAgB;WAAhBA;;;AArBN,MAAMF,8BAA8B;EACzC;EACA;EACA;;EAGA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;EAGA;EACA;;AAGK,MAAMC,gBAAgB;AACtB,MAAMC,mBAAmB;","names":["defaultTransformedFunctions","watchDoneText","dtsTempDirectory"],"sources":["../../src/constants/home/runner/work/modern.js/modern.js/packages/solutions/module-tools/src/constants/dts.ts"],"sourcesContent":["export const defaultTransformedFunctions = [\n 'require',\n 'require.resolve',\n 'System.import',\n\n // Jest methods\n 'jest.genMockFromModule',\n 'jest.mock',\n 'jest.unmock',\n 'jest.doMock',\n 'jest.dontMock',\n 'jest.setMock',\n 'jest.requireActual',\n 'jest.requireMock',\n\n // Older Jest methods\n 'require.requireActual',\n 'require.requireMock',\n];\n\nexport const watchDoneText = 'Watching for file changes';\nexport const dtsTempDirectory = 'node_modules/.dts-temp';\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"mappings":";;;;;;;;;;;;EAAaA,WAAS;WAATA;;EACAC,WAAS;WAATA;;EACAC,cAAY;WAAZA;;;AAFN,MAAMF,YAAY;EAAC;EAAQ;EAAQ;;AACnC,MAAMC,YAAY;EAAC;EAAQ;EAAS;EAAS;;AAC7C,MAAMC,eAAe;EAAC;;","names":["assetExts","styleExts","dtsAliasExts"],"sources":["../../src/constants/home/runner/work/modern.js/modern.js/packages/solutions/module-tools/src/constants/file.ts"],"sourcesContent":["export const assetExts = ['.png', '.jpg', '.svg'];\nexport const styleExts = ['.css', '.less', '.sass', '.scss'];\nexport const dtsAliasExts = ['.d.ts'];\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":null,"mappings":";;;;;;;;;;;;EAYaA,mBAAiB;WAAjBA;;EA8BAC,uBAAqB;WAArBA;;EA6BAC,iBAAe;WAAfA;;EA8BAC,qBAAmB;WAAnBA;;EA8BAC,cAAY;WAAZA;;EAuBAC,eAAa;WAAbA;;;;iEA1JI;AAGjB,MAAMC,mCAAmC;EACvCC,UAAU;IACR;MACEC,MAAMC,cAAKC,KAAK,OAAO;MACvBC,SAAS;IACX;;AAEJ;AAEO,MAAMX,oBAAwC;EACnD;IACEY,WAAW;IACXC,QAAQ;IACRC,QAAQ;IACRC,QAAQ;IACRC,MAAMV;IACNW,KAAK;EACP;EACA;IACEL,WAAW;IACXC,QAAQ;IACRC,QAAQ;IACRC,QAAQ;IACRE,KAAK;EACP;EACA;IACEL,WAAW;IACXC,QAAQ;IACRC,QAAQ;IACRC,QAAQ;IACRE,KAAK;EACP;EACA;IACEL,WAAW;IACXK,KAAK;MAAEC,MAAM;IA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AClBH,QAAQ;EACV;;AAGK,MAAMV,gBAAgB;EAC3B,gBAAgBL;EAChBmB,cAAcnB;EACd,qBAAqBC;EACrBmB,mBAAmBnB;EACnB,cAAcC;EACdmB,YAAYnB;EACZ,mBAAmBC;EACnBmB,iBAAiBnB;EACjB,WAAWC;EACXmB,SAASnB;AACX;","names":["universalJsPreset","universalJsLitePreset","browserJsPreset","browserJsLitePreset","nodeJsPreset","legacyPresets","legacyWithSourceCodeToCopyConfig","patterns","from","path","join","context","buildType","format","target","outDir","copy","dts","only","UNIVERSAL_JS","UNIVERSAL_JS_LITE","BROWSER_JS","BROWSER_JS_LITE","NODE_JS"],"sources":["../../src/constants/home/runner/work/modern.js/modern.js/packages/solutions/module-tools/src/constants/legacy-preset.ts"],"sourcesContent":["import path from 'path';\nimport type { PartialBuildConfig } from '../types';\n\nconst legacyWithSourceCodeToCopyConfig = {\n patterns: [\n {\n from: path.join('src', '**/*.{less,sass,scss}'),\n context: 'src',\n },\n ],\n};\n\nexport const universalJsPreset: PartialBuildConfig = [\n {\n buildType: 'bundleless',\n format: 'esm',\n target: 'es5',\n outDir: './dist/js/treeshaking',\n copy: legacyWithSourceCodeToCopyConfig,\n dts: false,\n },\n {\n buildType: 'bundleless',\n format: 'cjs',\n target: 'es6',\n outDir: './dist/js/node',\n dts: false,\n },\n {\n buildType: 'bundleless',\n format: 'esm',\n target: 'es6',\n outDir: './dist/js/modern',\n dts: false,\n },\n {\n buildType: 'bundleless',\n dts: { only: true },\n outDir: './dist/types',\n },\n];\n\nexport const universalJsLitePreset: PartialBuildConfig = [\n {\n buildType: 'bundleless',\n format: 'esm',\n target: 'es5',\n outDir: './dist/js/treeshaking',\n copy: legacyWithSourceCodeToCopyConfig,\n dts: false,\n },\n {\n buildType: 'bundleless',\n format: 'cjs',\n target: 'es6',\n outDir: './dist/js/node',\n dts: false,\n },\n {\n buildType: 'bundleless',\n format: 'esm',\n target: 'es5',\n outDir: './dist/js/modern',\n dts: false,\n },\n {\n buildType: 'bundleless',\n dts: { only: true },\n outDir: './dist/types',\n },\n];\nexport const browserJsPreset: PartialBuildConfig = [\n {\n buildType: 'bundleless',\n format: 'esm',\n target: 'es5',\n outDir: './dist/js/treeshaking',\n copy: legacyWithSourceCodeToCopyConfig,\n dts: false,\n },\n {\n buildType: 'bundleless',\n format: 'esm',\n target: 'es6',\n outDir: './dist/js/node',\n dts: false,\n },\n {\n buildType: 'bundleless',\n format: 'esm',\n target: 'es6',\n outDir: './dist/js/modern',\n dts: false,\n },\n {\n buildType: 'bundleless',\n dts: { only: true },\n outDir: './dist/types',\n },\n];\n\nexport const browserJsLitePreset: PartialBuildConfig = [\n {\n buildType: 'bundleless',\n format: 'esm',\n target: 'es5',\n dts: false,\n outDir: './dist/js/treeshaking',\n copy: legacyWithSourceCodeToCopyConfig,\n },\n {\n buildType: 'bundleless',\n format: 'esm',\n target: 'es5',\n outDir: './dist/js/node',\n dts: false,\n },\n {\n buildType: 'bundleless',\n format: 'esm',\n target: 'es5',\n outDir: './dist/js/modern',\n dts: false,\n },\n {\n buildType: 'bundleless',\n dts: { only: true },\n outDir: './dist/types',\n },\n];\n\nexport const nodeJsPreset: PartialBuildConfig = [\n {\n buildType: 'bundleless',\n format: 'cjs',\n target: 'es6',\n dts: false,\n outDir: './dist/js/node',\n copy: legacyWithSourceCodeToCopyConfig,\n },\n {\n buildType: 'bundleless',\n format: 'esm',\n target: 'es6',\n dts: false,\n outDir: './dist/js/modern',\n },\n {\n buildType: 'bundleless',\n dts: { only: true },\n outDir: './dist/types',\n },\n];\n\nexport const legacyPresets = {\n 'universal-js': universalJsPreset,\n UNIVERSAL_JS: universalJsPreset,\n 'universal-js-lite': universalJsLitePreset,\n UNIVERSAL_JS_LITE: universalJsLitePreset,\n 'browser-js': browserJsPreset,\n BROWSER_JS: browserJsPreset,\n 'browser-js-lite': browserJsLitePreset,\n BROWSER_JS_LITE: browserJsLitePreset,\n 'node-js': nodeJsPreset,\n NODE_JS: nodeJsPreset,\n};\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"mappings":";;;;;;;;;;;;;;;EAMaA,oBAAkB;WAAlBA;;EACAC,wBAAsB;WAAtBA;;EACAC,eAAa;WAAbA;;EACAC,kBAAgB;WAAhBA;;EAEAC,qBAAmB;WAAnBA;;EACAC,qBAAmB;WAAnBA;;;IAZN;UAAKC,qBAAkB;AAAlBA,0CACVC;AADUD,0CAEVE;AAFUF,0CAGVG;GAHUH;AAML,MAAMN,qBAAqB;AAC3B,MAAMC,yBAAyB;AAC/B,MAAMC,gBAAgB;AACtB,MAAMC,mBAAmB;AAEzB,MAAMC,sBAAsB;AAC5B,MAAMC,sBAAsB;","names":["BundleDtsLogPrefix","BundlelessDtsLogPrefix","CopyLogPrefix","buildSuccessText","reportFile1LineText","reportFile2LineText","SectionTitleStatus","Success","Fail","Log"],"sources":["../../src/constants/home/runner/work/modern.js/modern.js/packages/solutions/module-tools/src/constants/log.ts"],"sourcesContent":["export enum SectionTitleStatus {\n Success,\n Fail,\n Log,\n}\n\nexport const BundleDtsLogPrefix = '[Bundle:DTS]';\nexport const BundlelessDtsLogPrefix = '[Bundleless:DTS]';\nexport const CopyLogPrefix = '[Copy]';\nexport const buildSuccessText = 'Build succeed';\n\nexport const reportFile1LineText = 'Bundle Files';\nexport const reportFile2LineText = 'Size';\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"mappings":";;;;;;;;;;;;EAEaA,SAAO;WAAPA;;EAcAC,wBAAsB;WAAtBA;;EAoBAC,+BAA6B;WAA7BA;;EA4BAC,0BAAwB;WAAxBA;;EAqBAC,iCAA+B;WAA/BA;;EA6BAC,eAAa;WAAbA;;EAEAC,yBAAuB;WAAvBA;;EAOAC,kBAAgB;WAAhBA;;EAGAC,4BAA0B;WAA1BA;;EASAC,iBAAe;WAAfA;;EAGAC,2BAAyB;WAAzBA;;EASAC,oBAAkB;WAAlBA;;EAGAC,8BAA4B;WAA5BA;;EASAC,iBAAe;WAA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,MAAM;IACR;IACAF,QAAQ;EACV;;AAGK,MAAMN,uBAAiD;EAC5D;IACEK,WAAW;IACXF,QAAQ;IACRC,QAAQ;IACRG,KAAK;IACLQ,iBAAiB;IACjBT,QAAQ;EACV;EACA;IACED,WAAW;IACXF,QAAQ;IACRC,QAAQ;IACRG,KAAK;IACLQ,iBAAiB;IACjBT,QAAQ;EACV;EACA;IACED,WAAW;IACXF,QAAQ;IACRC,QAAQ;IACRG,KAAK;IACLQ,iBAAiB;IACjBT,QAAQ;EACV;EACA;IACED,WAAW;IACXE,KAAK;MACHC,MAAM;IACR;IACAF,QAAQ;EACV;;AAGK,MAAML,aAAuD;EAClE,GAAGV;EACH,GAAGC;EACH,GAAGC;EACH,GAAGC;EACH,GAAGC;EACH,GAAGC;EACH,GAAGC;EACH,GAAGC;EACH,kBAAkBC;EAClB,uBAAuBC;AACzB;AAEO,MAAME,iBAA2D;EACtEc,aAAa7B;EACb,eAAeA;EACf8B,sBAAsB7B;EACtB,wBAAwBA;EACxB8B,eAAe7B;EACf,iBAAiBA;EACjB8B,wBAAwB7B;EACxB,0BAA0BA;EAC1B,kBAAkBS;EAClB,uBAAuBC;AACzB;","names":["targets","npmLibraryPresetConfig","npmLibraryWithUmdPresetConfig","npmComponentPresetConfig","npmComponentWithUmdPresetConfig","libraryPreset","libraryPresetWithTarget","libraryUmdPreset","libraryUmdPresetWithTarget","componentPreset","componentPresetWithTarget","componentUmdPreset","componentUmdPresetWithTarget","nodeBuildConfig","universalBuildConfig","presetList","internalPreset","format","target","buildType","outDir","dts","only","distPath","platform","reduce","ret","map","config","externalHelpers","NPM_LIBRARY","NPM_LIBRARY_WITH_UMD","NPM_COMPONENT","NPM_COMPONENT_WITH_UMD"],"sources":["../../src/constants/home/runner/work/modern.js/modern.js/packages/solutions/module-tools/src/constants/preset.ts"],"sourcesContent":["import type { PartialBaseBuildConfig, Target } from '../types';\n\nexport const targets: Target[] = [\n 'es5',\n 'es6',\n 'es2015',\n 'es2016',\n 'es2017',\n 'es2018',\n 'es2019',\n 'es2020',\n 'es2021',\n 'es2022',\n 'esnext',\n];\n\nexport const npmLibraryPresetConfig: PartialBaseBuildConfig[] = [\n {\n format: 'cjs',\n target: 'es6',\n buildType: 'bundle',\n outDir: './dist/lib',\n dts: false,\n },\n {\n format: 'esm',\n target: 'es6',\n buildType: 'bundle',\n outDir: './dist/es',\n dts: false,\n },\n {\n buildType: 'bundle',\n dts: { only: true, distPath: './types' },\n },\n];\nexport const npmLibraryWithUmdPresetConfig: PartialBaseBuildConfig[] = [\n {\n format: 'cjs',\n target: 'es6',\n buildType: 'bundle',\n outDir: './dist/lib',\n dts: false,\n },\n {\n format: 'esm',\n target: 'es6',\n buildType: 'bundle',\n outDir: './dist/es',\n dts: false,\n },\n {\n format: 'umd',\n target: 'es6',\n platform: 'browser',\n buildType: 'bundle',\n outDir: './dist/umd',\n dts: false,\n },\n {\n buildType: 'bundle',\n dts: { only: true, distPath: './types' },\n },\n];\nexport const npmComponentPresetConfig: PartialBaseBuildConfig[] = [\n {\n format: 'cjs',\n target: 'es6',\n buildType: 'bundleless',\n outDir: './dist/lib',\n dts: false,\n },\n {\n format: 'esm',\n target: 'es6',\n buildType: 'bundleless',\n outDir: './dist/es',\n dts: false,\n },\n {\n buildType: 'bundleless',\n outDir: './dist/types',\n dts: { only: true },\n },\n];\nexport const npmComponentWithUmdPresetConfig: PartialBaseBuildConfig[] = [\n {\n format: 'cjs',\n target: 'es6',\n buildType: 'bundleless',\n outDir: './dist/lib',\n dts: false,\n },\n {\n format: 'esm',\n target: 'es6',\n buildType: 'bundleless',\n outDir: './dist/es',\n dts: false,\n },\n {\n format: 'umd',\n target: 'es6',\n platform: 'browser',\n buildType: 'bundle',\n outDir: './dist/umd',\n dts: false,\n },\n {\n buildType: 'bundleless',\n dts: { only: true, distPath: './types' },\n },\n];\n\nexport const libraryPreset = { 'npm-library': npmLibraryPresetConfig };\n\nexport const libraryPresetWithTarget = targets.reduce((ret, target) => {\n ret[`npm-library-${target}`] = libraryPreset['npm-library'].map(config => {\n return { ...config, target };\n });\n return ret;\n}, {} as Record<`npm-library-${Target}`, PartialBaseBuildConfig[]>);\n\nexport const libraryUmdPreset = {\n 'npm-library-with-umd': npmLibraryWithUmdPresetConfig,\n};\nexport const libraryUmdPresetWithTarget = targets.reduce((ret, target) => {\n ret[`npm-library-with-umd-${target}`] = libraryUmdPreset[\n 'npm-library-with-umd'\n ].map(config => {\n return { ...config, target };\n });\n return ret;\n}, {} as Record<`npm-library-with-umd-${Target}`, PartialBaseBuildConfig[]>);\n\nexport const componentPreset = {\n 'npm-component': npmComponentPresetConfig,\n};\nexport const componentPresetWithTarget = targets.reduce((ret, target) => {\n ret[`npm-component-${target}`] = componentPreset['npm-component'].map(\n config => {\n return { ...config, target };\n },\n );\n return ret;\n}, {} as Record<`npm-component-${Target}`, PartialBaseBuildConfig[]>);\n\nexport const componentUmdPreset = {\n 'npm-component-with-umd': npmComponentWithUmdPresetConfig,\n};\nexport const componentUmdPresetWithTarget = targets.reduce((ret, target) => {\n ret[`npm-component-with-umd-${target}`] = componentUmdPreset[\n 'npm-component-with-umd'\n ].map(config => {\n return { ...config, target };\n });\n return ret;\n}, {} as Record<`npm-component-with-umd-${Target}`, PartialBaseBuildConfig[]>);\n\nexport const nodeBuildConfig: PartialBaseBuildConfig[] = [\n {\n buildType: 'bundleless',\n format: 'cjs',\n target: 'es2019',\n dts: false,\n externalHelpers: true,\n outDir: './dist/cjs',\n },\n {\n buildType: 'bundleless',\n format: 'esm',\n target: 'es2019',\n dts: false,\n externalHelpers: true,\n outDir: './dist/esm',\n },\n {\n buildType: 'bundleless',\n dts: {\n only: true,\n },\n outDir: './dist/types',\n },\n];\n\nexport const universalBuildConfig: PartialBaseBuildConfig[] = [\n {\n buildType: 'bundleless',\n format: 'cjs',\n target: 'es2019',\n dts: false,\n externalHelpers: true,\n outDir: './dist/cjs',\n },\n {\n buildType: 'bundleless',\n format: 'esm',\n target: 'es5',\n dts: false,\n externalHelpers: true,\n outDir: './dist/esm',\n },\n {\n buildType: 'bundleless',\n format: 'esm',\n target: 'es2019',\n dts: false,\n externalHelpers: true,\n outDir: './dist/esm-node',\n },\n {\n buildType: 'bundleless',\n dts: {\n only: true,\n },\n outDir: './dist/types',\n },\n];\n\nexport const presetList: Record<string, PartialBaseBuildConfig[]> = {\n ...libraryPreset,\n ...libraryPresetWithTarget,\n ...libraryUmdPreset,\n ...libraryUmdPresetWithTarget,\n ...componentPreset,\n ...componentPresetWithTarget,\n ...componentUmdPreset,\n ...componentUmdPresetWithTarget,\n 'modern-js-node': nodeBuildConfig,\n 'modern-js-universal': universalBuildConfig,\n};\n\nexport const internalPreset: Record<string, PartialBaseBuildConfig[]> = {\n NPM_LIBRARY: npmLibraryPresetConfig,\n 'npm-library': npmLibraryPresetConfig,\n NPM_LIBRARY_WITH_UMD: npmLibraryWithUmdPresetConfig,\n 'npm-library-with-umd': npmLibraryWithUmdPresetConfig,\n NPM_COMPONENT: npmComponentPresetConfig,\n 'npm-component': npmComponentPresetConfig,\n NPM_COMPONENT_WITH_UMD: npmComponentWithUmdPresetConfig,\n 'npm-component-with-umd': npmComponentWithUmdPresetConfig,\n 'modern-js-node': nodeBuildConfig,\n 'modern-js-universal': universalBuildConfig,\n};\n"]}
|
package/dist/dev.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":null,"mappings":";;;;;;;;;;;;EAMaA,UAAQ;WAARA;;EAsCAC,KAAG;WAAHA;;;;uBA3C2B;AAKjC,MAAMD,WAAW,OACtBE,OACAC,eACAC,KACAC;AAEA,QAAMC,SAASF,IAAIG,eAAc;AAEjC,QAAMC,YAAYC,aAAMC,IAAI,KAAK,KAAK;AACtC,QAAMC,UAAUT,MACbU,IAAIC,UAAQA,KAAKC,QAAQ,EACzBC,OAAOD,cAAY,OAAOA,aAAa;AAC1C,QAAME,YAAY;IAChB;MACEC,MAAM;MACNC,SAASV,UAAU;MACnBW,MAAM;MACNR;IACF;;AAGF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ices","map","meta","menuItem","filter","questions","name","message","type","newQuestions","beforeDevMenu","result","inquirer","prompt","length","afterDevMenu","devTools","currentDevTool","find","value","choiceDevTool","beforeDevTask","action","isTsProject","options","green","local","noDevToolsLog","noDevTools","i18n","t","localeKeys","log","noDevtools","logger","info","process","exit"],"sources":["../src/home/runner/work/modern.js/modern.js/packages/solutions/module-tools/src/dev.ts"],"sourcesContent":["import type { PluginAPI } from '@modern-js/core';\nimport { chalk, inquirer, logger } from '@modern-js/utils';\nimport type { DevCommandOptions } from './types/command';\nimport type { ModuleContext } from './types/context';\nimport type { DevToolData, ModuleTools } from './types';\n\nexport const showMenu = async (\n metas: DevToolData[],\n devCmdOptions: DevCommandOptions,\n api: PluginAPI<ModuleTools>,\n context: ModuleContext,\n) => {\n const runner = api.useHookRunners();\n\n const menuTitle = chalk.rgb(255, 153, 0);\n const choices = metas\n .map(meta => meta.menuItem)\n .filter(menuItem => typeof menuItem === 'object');\n const questions = [\n {\n name: 'choiceDevTool',\n message: menuTitle('选择调试工具'),\n type: 'list',\n choices,\n },\n ];\n\n const newQuestions = await runner.beforeDevMenu(questions);\n const result: { choiceDevTool: string } = await inquirer.prompt(\n newQuestions.length !== 0 ? newQuestions : questions,\n );\n await runner.afterDevMenu({ result, devTools: metas });\n\n const currentDevTool = metas.find(\n meta => meta.menuItem?.value === result.choiceDevTool,\n );\n if (currentDevTool) {\n await runner.beforeDevTask(currentDevTool);\n await currentDevTool.action(devCmdOptions, {\n isTsProject: context.isTsProject,\n });\n }\n};\n\nexport const dev = async (\n options: DevCommandOptions,\n metas: DevToolData[],\n api: PluginAPI<ModuleTools>,\n context: ModuleContext,\n) => {\n const { green } = await import('./constants/color');\n const runner = api.useHookRunners();\n if (metas.length === 0) {\n const local = await import('./locale');\n const noDevToolsLog = await runner.noDevTools(\n local.i18n.t(local.localeKeys.log.dev.noDevtools),\n );\n\n logger.info(noDevToolsLog);\n // eslint-disable-next-line no-process-exit\n process.exit(0);\n }\n\n if (metas.length === 1) {\n logger.info(\n chalk.rgb(...green)(\n `Only one dev tooling is currently detected as available, run it directly [${\n metas[0].menuItem?.name ?? metas[0].name\n }]`,\n ),\n );\n const meta = metas[0];\n\n await runner.beforeDevTask(meta);\n await meta.action(options, { isTsProject: context.isTsProject });\n } else if (metas.length > 1) {\n await showMenu(metas, options, api, context);\n }\n};\n"]}
|
package/dist/error.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":null,"mappings":";;;;;;;;;;;;EAIaA,cAAY;WAAZA;;EA8BAC,oBAAkB;WAAlBA;;EAkEAC,kBAAgB;WAAhBA;;EAuCAC,kBAAgB;WAAhBA;;EAQAC,iBAAe;WAAfA;;EAUAC,cAAY;WAAZA;;;;uBA7JS;AAIf,MAAML,eAAe,CAC1BM,KACAC,SACAC,OAGI,CAAC,MAAC;AAEN,QAAM,EAAEC,SAAS,KAAKC,MAAK,IAAKF;AAChC,QAAMG,IAAIL,IAAIM;AACd,QAAMC,UAAUJ,OAAOG;AACvB,QAAME,SAASP,UAAUI,IAAIE;AAG7B,MAAIC,WAAW,GAAG;AAChB,YAAQJ,QAAQA,MAAMJ,OAAOA,OAAOG;EACtC;AAGA,MAAIK,SAAS,GAAG;AACd,UAAMC,SAAST,IAAIU,OAAOT,UAAU,GAAG;AACvC,QAAIG,OAAO;AACT,aAAOA,MAAMJ,OAAOS,OAAOE,QAAQX,KAAK,MAAMG;IAChD;AACA,WAAOM,SAASN;EAClB;AAEA,SAAOH;AACT;AAEO,MAAML,2BAA2BiB;EA2BtCC,WAAW;AACT,WAAO,KAAKC,YAAW,EAAGC,KAAK;EACjC;EAEAD,cAAc;AACZ,UAAME,OAAiB;AACvB,UAAM,EAAEC,GAAGC,WAAWC,QAAQC,OAAM,IAAK;AACzC,UAAMC,QAAQ;AACd,UAAMC,QAAQ,KAAK5B,aAAa,GAAGwB,qBAAqBG,QAAQ,GAAG;MACjEjB,OAAOmB,aAAMC,IAAIC;MACjBtB,QAAQ;IACV;AACA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;IACnB;AAEA,WAAOjB;EACT;EA/BAkB,YAAYjB,GAAuBf,MAAgC;AACjE,UAAMe,EAAEkB,OAAO;AALjB,6BAAOjB,aAAP;AAEA,6BAAQD,KAAR;AAKEL,UAAMwB,kBAAkB,MAAM,KAAKF,WAAW;AAE9C,SAAKjB,IAAIA;AACT,SAAKC,YAAYhB,KAAKgB;EACxB;AAyBF;AAEO,MAAMrB,yBAAyBe;EACpCsB,YAAYjB,GAA0C;AACpD,UAAM;;EAAOA,GAAG;AAChBL,UAAMwB,kBAAkB,MAAM,KAAKF,WAAW;AAC9C,SAAKG,OAAO;EACd;AACF;AAEO,MAAMvC,kBAAkB,CAC7BmB;AAEA,MAAIA,aAAatB,sBAAsBsB,aAAarB,kBAAkB;AACpE,WAAO;EACT;AAEA,SAAO;AACT;AAEO,MAAMG,eAAe,CAACkB;AAC3B,MAAIA,EAAEsB,QAAQ;AACZ,WAAO;EACT;AAEA,SAAO;AACT;","names":["padSpaceWith","InternalBuildError","InternalDTSError","ModuleBuildError","isInternalError","isExecaError","str","targetL","opts","endStr","style","l","length","endStrL","resetL","padStr","padEnd","replace","Error","toString","formatError","join","msgs","e","buildType","target","format","textL","title","chalk","red","underline","formatMsg","targetMsg","startLine","endLine","push","blue","bold","stack","constructor","message","captureStackTrace","name","shortMessage","stdout"],"sources":["../src/home/runner/work/modern.js/modern.js/packages/solutions/module-tools/src/error.ts"],"sourcesContent":["import { chalk } from '@modern-js/utils';\nimport type { ExecaError } from '@modern-js/utils';\nimport type { BuildType, Format, Target } from './types';\n\nexport const padSpaceWith = (\n str: string,\n targetL: number,\n opts: {\n endStr?: string;\n style?: (s: string) => string;\n } = {},\n) => {\n const { endStr = '|', style } = opts;\n const l = str.length;\n const endStrL = endStr.length;\n const resetL = targetL - l - endStrL;\n\n // str is 'aaa', targetL is 4, result is 'aaa|'\n if (resetL === 0) {\n return (style ? style(str) : str) + endStr;\n }\n\n // str is 'aaa', targetL is 5, result is 'aaa |'\n if (resetL > 0) {\n const padStr = str.padEnd(targetL - 1, ' ');\n if (style) {\n return style(str) + padStr.replace(str, '') + endStr;\n }\n return padStr + endStr;\n }\n\n return str;\n};\n\nexport class InternalBuildError extends Error {\n public buildType: BuildType;\n\n public target: Target;\n\n public format: Format;\n\n private e: Error;\n\n constructor(\n e: Error,\n opts: {\n buildType: BuildType;\n format: Format;\n target: Target;\n },\n ) {\n super(e.message);\n\n Error.captureStackTrace(this, this.constructor);\n\n this.e = e;\n this.buildType = opts.buildType;\n this.target = opts.target;\n this.format = opts.format;\n }\n\n toString() {\n return this.formatError().join('\\n');\n }\n\n formatError() {\n const msgs: string[] = [];\n const { e, buildType, target, format } = this;\n const textL = 25;\n const title = `│ ${padSpaceWith(`${buildType} failed:`, textL - 2, {\n style: chalk.red.underline,\n endStr: '│',\n })}`;\n const formatMsg = padSpaceWith(`│ - format is \"${format}\"`, textL, {\n endStr: '│',\n });\n const targetMsg = padSpaceWith(`│ - target is \"${target}\"`, textL, {\n endStr: '│',\n });\n const startLine = padSpaceWith('╭'.padEnd(textL - 1, '─'), textL, {\n endStr: '╮',\n });\n const endLine = padSpaceWith('╰'.padEnd(textL - 1, '─'), textL, {\n endStr: '╯',\n });\n msgs.push(\n startLine,\n title,\n formatMsg,\n targetMsg,\n endLine,\n chalk.blue.bold.underline(`\\nDetailed Information: `),\n );\n msgs.push(e.toString());\n msgs.push(e.stack || '');\n\n return msgs;\n }\n}\n\nexport class InternalDTSError extends Error {\n public buildType: BuildType;\n\n private e: Error;\n\n constructor(e: Error | ExecaError, opts: { buildType: BuildType }) {\n super(e.message);\n\n Error.captureStackTrace(this, this.constructor);\n\n this.e = e;\n this.buildType = opts.buildType;\n }\n\n toString() {\n return this.formatError().join('\\n');\n }\n\n formatError() {\n const msgs: string[] = [];\n const { e, buildType } = this;\n msgs.push(chalk.red.bold(`${buildType} DTS failed:`));\n if (isExecaError(e)) {\n /**\n * `shortMeessage` content like:\n * 'Command failed with exit code 2: /Users/github/modern.js/playground/module/node_modules/.bin/tsc -p /Users/github/modern.js/playground/module/node_modules/tsconfig.temp.json --pretty'\n * Don`t need it.\n */\n if (e.stack) {\n msgs.push(e.stack?.replace(`${e.name}: ${e.shortMessage}`, ''));\n }\n } else {\n msgs.push(e.stack!);\n }\n\n return msgs;\n }\n}\n\nexport class ModuleBuildError extends Error {\n constructor(e: InternalBuildError | InternalDTSError) {\n super(`\\n\\n${e}`);\n Error.captureStackTrace(this, this.constructor);\n this.name = 'ModuleBuildError';\n }\n}\n\nexport const isInternalError = (\n e: unknown,\n): e is InternalDTSError | InternalBuildError => {\n if (e instanceof InternalBuildError || e instanceof InternalDTSError) {\n return true;\n }\n\n return false;\n};\n\nexport const isExecaError = (e: any): e is ExecaError => {\n if (e.stdout) {\n return true;\n }\n\n return false;\n};\n"]}
|
package/dist/hooks/build.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":null,"mappings":";;;;;;;;;;;;EAeaA,YAAU;WAAVA;;EAoBAC,iBAAe;WAAfA;;;wBAhCN;AAYA,MAAMD,aAAa;EACxBE,cAAaC,mCAAsB;EAInCC,kBAAiBC,iCAAoB;EACrCC,iBAAgBH,mCAAsB;EACtCI,aAAYJ,mCAAsB;EAClCK,wBAAuBL,mCAAsB;EAI7CM,sBAAqBN,mCAAsB;EAI3CO,gBAAeP,mCAAsB;EACrCQ,qBAAoBR,mCAAsB;AAC5C;AAEO,MAAMF,kBAAkB;EAC7BW,eAAcT,mCAAsB;EACpCU,gBAAeV,mCAAsB;AACvC;","names":["buildHooks","buildWatchHooks","beforeBuild","createParallelWorkflow","beforeBuildTask","createAsyncWaterfall","afterBuildTask","afterBuild","registerBuildPlatform","beforeBuildPlatform","buildPlatform","afterBuildPlatform","buildWatchJs","buildWatchDts"],"sources":["../../src/hooks/home/runner/work/modern.js/modern.js/packages/solutions/module-tools/src/hooks/build.ts"],"sourcesContent":["import {\n createParallelWorkflow,\n createAsyncWaterfall,\n} from '@modern-js/plugin';\nimport type { RegisterBuildPlatformResult } from '@modern-js/core';\nimport { BuildCommandOptions } from '../types';\nimport type { BuildConfig, BaseBuildConfig } from '../types/config';\nimport type {\n BuildTaskResult,\n BuildResult,\n BuildPlatformResult,\n WatchDtsHookContext,\n WatchJsHookContext,\n} from '../types/hooks';\n\nexport const buildHooks = {\n beforeBuild: createParallelWorkflow<\n { config: BuildConfig; cliOptions: BuildCommandOptions },\n void\n >(),\n beforeBuildTask: createAsyncWaterfall<BaseBuildConfig>(),\n afterBuildTask: createParallelWorkflow<BuildTaskResult, void>(),\n afterBuild: createParallelWorkflow<BuildResult, void>(),\n registerBuildPlatform: createParallelWorkflow<\n void,\n RegisterBuildPlatformResult\n >(),\n beforeBuildPlatform: createParallelWorkflow<\n RegisterBuildPlatformResult[],\n void\n >(),\n buildPlatform: createParallelWorkflow<{ platform: string }, void>(),\n afterBuildPlatform: createParallelWorkflow<BuildPlatformResult, void>(),\n};\n\nexport const buildWatchHooks = {\n buildWatchJs: createParallelWorkflow<WatchJsHookContext, void>(),\n buildWatchDts: createParallelWorkflow<WatchDtsHookContext, void>(),\n};\n"]}
|
package/dist/hooks/dev.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":null,"mappings":";;;;+BAOaA;;;WAAAA;;;wBAJN;AAIA,MAAMA,WAAW;EACtBC,cAAaC,mCAAsB;EACnCC,YAAWD,mCAAsB;EACjCE,gBAAeC,iCAAoB;EACnCC,eAAcJ,mCAAsB;EAIpCK,gBAAeL,mCAAsB;EACrCM,WAAUN,mCAAsB;;EAEhCO,aAAYJ,iCAAoB;AAClC;","names":["devHooks","registerDev","createParallelWorkflow","beforeDev","beforeDevMenu","createAsyncWaterfall","afterDevMenu","beforeDevTask","afterDev","noDevTools"],"sources":["../../src/hooks/home/runner/work/modern.js/modern.js/packages/solutions/module-tools/src/hooks/dev.ts"],"sourcesContent":["import {\n createParallelWorkflow,\n createAsyncWaterfall,\n} from '@modern-js/plugin';\nimport type { QuestionCollection } from '@modern-js/utils/compiled/inquirer';\nimport type { DevToolData, PromptResult } from '../types/hooks';\n\nexport const devHooks = {\n registerDev: createParallelWorkflow<void, DevToolData>(),\n beforeDev: createParallelWorkflow<DevToolData[], void>(),\n beforeDevMenu: createAsyncWaterfall<QuestionCollection>(),\n afterDevMenu: createParallelWorkflow<\n { result: PromptResult; devTools: DevToolData[] },\n void\n >(),\n beforeDevTask: createParallelWorkflow<DevToolData, void>(),\n afterDev: createParallelWorkflow<void, void>(),\n // Special and rarely used hooks\n noDevTools: createAsyncWaterfall<string>(),\n};\n"]}
|
package/dist/hooks/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":null,"mappings":";;;;+BAIaA;;;WAAAA;;;uBAJ+B;qBACnB;sBACC;AAEnB,MAAMA,eAAe;EAC1B,GAAGC;EACH,GAAGC;EACH,GAAGC;EACH,GAAGC;AACL;","names":["registerHook","buildHooks","devHooks","miscHooks","buildWatchHooks"],"sources":["../../src/hooks/home/runner/work/modern.js/modern.js/packages/solutions/module-tools/src/hooks/index.ts"],"sourcesContent":["import { buildHooks, buildWatchHooks } from './build';\nimport { devHooks } from './dev';\nimport { miscHooks } from './misc';\n\nexport const registerHook = {\n ...buildHooks,\n ...devHooks,\n ...miscHooks,\n ...buildWatchHooks,\n};\n"]}
|
package/dist/hooks/misc.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":null,"mappings":";;;;+BAGaA;;;WAAAA;;;wBAH6C;AAGnD,MAAMA,YAAY;EACvBC,oBAAmBC,iCAAoB;EACvCC,gBAAeC,gCAAmB;AACpC;","names":["miscHooks","addRuntimeExports","createAsyncWaterfall","modifyLibuild","createAsyncPipeline"],"sources":["../../src/hooks/home/runner/work/modern.js/modern.js/packages/solutions/module-tools/src/hooks/misc.ts"],"sourcesContent":["import { createAsyncPipeline, createAsyncWaterfall } from '@modern-js/plugin';\nimport type { CLIConfig } from '@modern-js/libuild';\n\nexport const miscHooks = {\n addRuntimeExports: createAsyncWaterfall(),\n modifyLibuild: createAsyncPipeline<CLIConfig, CLIConfig>(),\n};\n"]}
|
package/dist/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":null,"mappings":";;;;;;;;;;;;EAESA,cAAY;WAAZA;;EAAcC,oBAAkB;WAAlBA;;EACdC,eAAa;WAAbA;;EAEAC,aAAW;WAAXA;;EACT,SAA2B;WAA3B;;;;qBAN4B;8BAEqB;8BACnB;uBAChB;MAEd,WAAeA;","names":["defineConfig","defineLegacyConfig","legacyPresets","moduleTools"],"sources":["../src/home/runner/work/modern.js/modern.js/packages/solutions/module-tools/src/index.ts"],"sourcesContent":["import { moduleTools } from './cli';\n\nexport { defineConfig, defineLegacyConfig } from './config/defineConfig';\nexport { legacyPresets } from './constants/legacy-preset';\nexport * from './types';\nexport { moduleTools };\nexport default moduleTools;\n"]}
|
package/dist/locale/en.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
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.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":null,"mappings":";;;;;;;;;;;;EAcSA,MAAI;WAAJA;;EAAMC,YAAU;WAAVA;;;uBAdQ;oBAEG;oBACA;AAE1B,MAAMC,aAAsDC,cAAOC,KACjE,0BACAC;AAGF,MAAML,OAAO,IAAIE,WAAWI,KAAI;AAEhC,MAAML,aAAaD,KAAKO,KAAK,MAAM;EAAEC,IAAIC;EAAWC,IAAIC;AAAU;","names":["i18n","localeKeys","i18nPlugin","Import","lazy","require","I18n","init","zh","ZH_LOCALE","en","EN_LOCALE"],"sources":["../../src/locale/home/runner/work/modern.js/modern.js/packages/solutions/module-tools/src/locale/index.ts"],"sourcesContent":["import { Import } from '@modern-js/utils';\n\nimport { ZH_LOCALE } from './zh';\nimport { EN_LOCALE } from './en';\n\nconst i18nPlugin: typeof import('@modern-js/plugin-i18n') = Import.lazy(\n '@modern-js/plugin-i18n',\n require,\n);\n\nconst i18n = new i18nPlugin.I18n();\n\nconst localeKeys = i18n.init('en', { zh: ZH_LOCALE, en: EN_LOCALE });\n\nexport { i18n, localeKeys };\n"]}
|
package/dist/locale/zh.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
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.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
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/types/color.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"mappings":";AACA,OAAO,eAAe,SAAS,cAAc;AAAA,EACzC,OAAO;AACX,CAAC;","names":[],"sources":["../../src/types/color.ts"],"sourcesContent":["\"use strict\";\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"mappings":";AACA,OAAO,eAAe,SAAS,cAAc;AAAA,EACzC,OAAO;AACX,CAAC;","names":[],"sources":["../../src/types/command.ts"],"sourcesContent":["\"use strict\";\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"mappings":";AACA,OAAO,eAAe,SAAS,cAAc;AAAA,EACzC,OAAO;AACX,CAAC;","names":[],"sources":["../../../src/types/config/copy.ts"],"sourcesContent":["\"use strict\";\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"mappings":";AACA,OAAO,eAAe,SAAS,cAAc;AAAA,EACzC,OAAO;AACX,CAAC;","names":[],"sources":["../../../src/types/config/dev.ts"],"sourcesContent":["\"use strict\";\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":null,"mappings":";;;;;uBAkBc;","names":[],"sources":["../../../src/types/config/home/runner/work/modern.js/modern.js/packages/solutions/module-tools/src/types/config/index.ts"],"sourcesContent":["import type {\n UserConfig as LibuildUserConfig,\n Asset as LibuildAsset,\n Style as LibuildStyle,\n} from '@modern-js/libuild';\nimport type { Options } from '@modern-js/libuild-plugin-svgr';\nimport type { ImportItem } from '@modern-js/libuild-plugin-swc';\nimport type { ToolsConfig as WebpackBuilderToolsConfig } from '@modern-js/builder-webpack-provider';\nimport type { TestConfig } from '@modern-js/types';\nimport { internalPreset, presetList } from '../../constants/preset';\nimport type { CopyConfig } from './copy';\nimport type {\n LessConfig,\n SassConfig,\n PostCSSConfig,\n TailwindCSSConfig,\n} from './style';\n\nexport * from './style';\n\nexport type BuildType = 'bundleless' | 'bundle';\n\nexport type Format = 'esm' | 'cjs' | 'umd' | 'iife';\n\nexport type Target =\n | 'es5'\n | 'es6'\n | 'es2015'\n | 'es2016'\n | 'es2017'\n | 'es2018'\n | 'es2019'\n | 'es2020'\n | 'es2021'\n | 'es2022'\n // The default target is esnext which means that by default, assume all of the latest JavaScript and CSS features are supported.\n | 'esnext';\n\nexport type Input = Required<LibuildUserConfig>['input'];\n\nexport type DTSOptions = {\n abortOnError: boolean;\n distPath: string;\n tsconfigPath: string;\n only: boolean;\n /**\n * Only for rollup-plugin-dts, see more in https://github.com/Swatinem/rollup-plugin-dts#what-to-expect.\n * We hope you use external to prevent them(like @types) which come from node_modules from be bundled.\n * However, some types from outside that we don't re-export are also checked by plugin.\n * And a third-party package is uncontrollable, it may cause errors.\n * You can overridden by setting it false to excluded all packages from node_modules.\n * @default true\n */\n respectExternal: boolean;\n};\nexport type DTS = false | Partial<DTSOptions>;\n\nexport interface Asset {\n path?: LibuildAsset['outdir'];\n limit?: LibuildAsset['limit'];\n publicPath?: LibuildAsset['publicPath'];\n svgr?: boolean | Options;\n}\nexport type SourceMap = Required<LibuildUserConfig>['sourceMap'];\nexport type AutoExternal =\n | boolean\n | {\n dependencies?: boolean;\n peerDependencies?: boolean;\n };\nexport type JSX = 'automatic' | 'transform';\nexport type ExternalHelpers = boolean;\n\nexport type AliasOption =\n | Record<string, string>\n | ((aliases: Record<string, string>) => Record<string, string> | void);\n\nexport type BaseBuildConfig = Omit<\n Required<PartialBaseBuildConfig>,\n 'dts' | 'style' | 'alias' | 'sideEffects'\n> & {\n sideEffects: LibuildUserConfig['sideEffects'];\n dts: false | DTSOptions;\n style: Omit<Required<LibuildStyle>, 'cleanCss'> & {\n tailwindcss: TailwindCSSConfig;\n };\n alias: Record<string, string>;\n};\n\nexport type PartialBaseBuildConfig = {\n sourceType?: 'commonjs' | 'module';\n buildType?: 'bundleless' | 'bundle';\n format?: Format;\n target?: Target;\n dts?: DTS;\n sourceMap?: SourceMap;\n sourceDir?: string;\n copy?: CopyConfig;\n asset?: Asset;\n jsx?: JSX;\n outDir?: string;\n alias?: AliasOption;\n input?: Input;\n metafile?: boolean;\n platform?: LibuildUserConfig['platform'];\n splitting?: LibuildUserConfig['splitting'];\n minify?: LibuildUserConfig['minify'];\n externals?: LibuildUserConfig['external'];\n autoExternal?: AutoExternal;\n umdGlobals?: LibuildUserConfig['globals'];\n umdModuleName?: ((chunkName: string) => string) | string | undefined;\n define?: LibuildUserConfig['define'];\n style?: StyleConfig;\n redirect?: LibuildUserConfig['redirect'];\n sideEffects?: LibuildUserConfig['sideEffects'];\n esbuildOptions?: LibuildUserConfig['esbuildOptions'];\n // Related to swc-transform\n externalHelpers?: ExternalHelpers;\n transformImport?: ImportItem[];\n transformLodash?: boolean;\n /**\n * internal configuration\n */\n disableSwcTransform?: boolean;\n};\n\nexport type BuildConfig = BaseBuildConfig | BaseBuildConfig[];\nexport type PartialBuildConfig =\n | PartialBaseBuildConfig\n | PartialBaseBuildConfig[];\n\nexport type BuildPreset =\n | keyof typeof presetList\n | ((options: {\n preset: typeof internalPreset;\n extendPreset: (\n extendPresetName: keyof typeof internalPreset,\n extendBuildConfig: PartialBaseBuildConfig,\n ) => PartialBaseBuildConfig[];\n }) => PartialBaseBuildConfig[] | Promise<PartialBaseBuildConfig[]>);\n\nexport interface StyleConfig {\n less?: LessConfig;\n sass?: SassConfig;\n postcss?: PostCSSConfig;\n autoModules?: LibuildStyle['autoModules'];\n modules?: LibuildStyle['modules'];\n inject?: LibuildStyle['inject'];\n /**\n * The configuration of `tools.tailwindcss` is provided by `tailwindcss` plugin.\n * Please use `yarn new` or `pnpm new` to enable the corresponding capability.\n * @requires `tailwindcss` plugin\n */\n tailwindcss?: TailwindCSSConfig;\n}\n\nexport interface StorybookBuildConfig {\n webpack?: WebpackBuilderToolsConfig['webpack'];\n webpackChain?: WebpackBuilderToolsConfig['webpackChain'];\n}\nexport interface Dev {\n storybook?: StorybookBuildConfig;\n}\n\nexport interface RuntimeUserConfig {\n [name: string]: any;\n}\n\nexport interface ModuleExtraConfig {\n /**\n * @deprecated designSystem is no longer required.\n * If you are using Tailwind CSS, you can now use the `theme` option of Tailwind CSS, they are the same.\n */\n designSystem?: Record<string, any>;\n\n buildConfig?: PartialBuildConfig;\n\n buildPreset?: BuildPreset;\n\n dev?: Dev;\n\n testing?: TestConfig;\n\n runtime?: RuntimeUserConfig;\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"mappings":";AACA,OAAO,eAAe,SAAS,cAAc;AAAA,EACzC,OAAO;AACX,CAAC;","names":[],"sources":["../../../src/types/config/style.ts"],"sourcesContent":["\"use strict\";\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"mappings":";AACA,OAAO,eAAe,SAAS,cAAc;AAAA,EACzC,OAAO;AACX,CAAC;","names":[],"sources":["../../src/types/context.ts"],"sourcesContent":["\"use strict\";\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\n"]}
|
package/dist/types/dts.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"mappings":";AACA,OAAO,eAAe,SAAS,cAAc;AAAA,EACzC,OAAO;AACX,CAAC;","names":[],"sources":["../../src/types/dts.ts"],"sourcesContent":["\"use strict\";\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\n"]}
|
package/dist/types/hooks.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"mappings":";AACA,OAAO,eAAe,SAAS,cAAc;AAAA,EACzC,OAAO;AACX,CAAC;","names":[],"sources":["../../src/types/hooks.ts"],"sourcesContent":["\"use strict\";\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\n"]}
|
package/dist/types/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":null,"mappings":";;;;;uBAQc;uBACA;uBACA;uBACA;uBACA;uBACA;","names":[],"sources":["../../src/types/home/runner/work/modern.js/modern.js/packages/solutions/module-tools/src/types/index.ts"],"sourcesContent":["import type { NormalizedConfig, UserConfig } from '@modern-js/core';\nimport type { ModuleToolsHooks } from './hooks';\nimport type { ModuleExtraConfig } from './config';\nimport type {\n ModuleToolsLegacyUserConfig,\n ModuleToolsLegacyNormalizedConfig,\n} from './legacyConfig';\n\nexport * from './hooks';\nexport * from './command';\nexport * from './config';\nexport * from './legacyConfig';\nexport * from './dts';\nexport * from './context';\nexport type { CliPlugin, IAppContext, PluginAPI } from '@modern-js/core';\n\nexport type ModuleTools = {\n hooks: ModuleToolsHooks;\n userConfig: ModuleExtraConfig;\n normalizedConfig: Required<ModuleExtraConfig>;\n};\nexport type LegacyModuleTools = {\n hooks: ModuleToolsHooks;\n userConfig: ModuleToolsLegacyUserConfig;\n normalizedConfig: ModuleToolsLegacyNormalizedConfig;\n};\n\nexport type ModuleUserConfig = UserConfig<ModuleTools>;\nexport type ModuleLegacyUserConfig = UserConfig<LegacyModuleTools>;\n\nexport type ModuleNormalizedConfig = NormalizedConfig<ModuleTools>;\nexport type ModuleLegacyNormalizedConfig = NormalizedConfig<LegacyModuleTools>;\n\n// params type for defineConfig\nexport type ModuleConfigParams =\n | ModuleUserConfig\n | Promise<ModuleUserConfig>\n | ((env: any) => ModuleUserConfig | Promise<ModuleUserConfig>);\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"mappings":";AACA,OAAO,eAAe,SAAS,cAAc;AAAA,EACzC,OAAO;AACX,CAAC;","names":[],"sources":["../../../src/types/legacyConfig/index.ts"],"sourcesContent":["\"use strict\";\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"mappings":";AACA,OAAO,eAAe,SAAS,cAAc;AAAA,EACzC,OAAO;AACX,CAAC;","names":[],"sources":["../../../src/types/legacyConfig/output.ts"],"sourcesContent":["\"use strict\";\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"mappings":";AACA,OAAO,eAAe,SAAS,cAAc;AAAA,EACzC,OAAO;AACX,CAAC;","names":[],"sources":["../../../src/types/legacyConfig/source.ts"],"sourcesContent":["\"use strict\";\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"mappings":";AACA,OAAO,eAAe,SAAS,cAAc;AAAA,EACzC,OAAO;AACX,CAAC;","names":[],"sources":["../../../src/types/legacyConfig/tools.ts"],"sourcesContent":["\"use strict\";\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\n"]}
|
package/dist/types/utils.d.ts
DELETED
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
export type DeepPartial<T> = T extends Function ? T : T extends Array<infer U> ? DeepPartialArray<U> : T extends object ? DeepPartialObject<T> : T | undefined;
|
|
2
|
-
/** @private */
|
|
3
|
-
export type DeepPartialArray<T> = Array<DeepPartial<T>>;
|
|
4
|
-
/** @private */
|
|
5
|
-
export type DeepPartialObject<T> = { [P in keyof T]?: DeepPartial<T[P]> };
|
package/dist/types/utils.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":null,"mappings":";;;;;;;;;;;;EASaA,YAAU;WAAVA;;EA2CAC,iBAAe;WAAfA;;EAmBAC,4BAA0B;WAA1BA;;EAoCAC,yBAAuB;WAAvBA;;;;;iEA3GI;uBACU;AAQpB,MAAMH,aAAa,OACxBI,cACAC,UAII,CAAC,MAAC;AAEN,MAAI;AACF,UAAMC,OAAOC,KAAKC,MAChBC,UAAGC,aAAaC,cAAKC,QAAQR,cAAc,mBAAmB;AAGhE,QAAIS,OAAiB;AAErB,QAAIR,QAAQS,cAAc;AACxBD,aAAO;WACFA;WACAE,OAAOC,KAAMV,KAAKQ,gBAAkC,CAAC;;IAE5D;AAEA,QAAIT,QAAQY,iBAAiB;AAC3BJ,aAAO;WACFA;WACAE,OAAOC,KAAMV,KAAKW,mBAAqC,CAAC;;IAE/D;AAEA,QAAIZ,QAAQa,kBAAkB;AAC5BL,aAAO;WACFA;WACAE,OAAOC,KAAMV,KAAKY,oBAAsC,CAAC;;IAEhE;AAEA,WAAOL;EACT,SAASM,GAAP;AACAC,kBAAOC,KAAK;AACZ,WAAO;EACT;AACF;AAEO,MAAMpB,kBAAkB,OAAOI;AAIpC,QAAM,EAAED,cAAckB,gBAAe,IAAKjB;AAC1C,MAAIiB,oBAAoB,OAAO;AAC7B;EACF;AACA,QAAMT,OAAO,MAAMb,WAAWI,cAAc;IAC1CU,cAAc;IACdG,iBAAiB;EACnB;AACA,QAAMM,oBAAoB;AAC1B,MAAI,CAACV,KAAKW,SAASD,oBAAoB;AACrC,UAAME,QAAQ,MAAM,iFAAO;AAC3B,UAAM,IAAIC,MAAMD,MAAME,KAAKC,EAAEH,MAAMI,WAAWC,OAAOR,eAAe;EACtE;AACF;AAEO,MAAMpB,6BAA6B,CAAC6B;AAMzC,QAAM,EAAEC,YAAYC,WAAWC,QAAQC,oBAAmB,IACxDJ;AAEF,MAAII,qBAAqB;AACvB,WAAO;EACT;AAMA,MAAIH,eAAe,YAAY;AAC7B,WAAO;EACT;AAEA,MAAIC,cAAc,cAAc;AAC9B,WAAO;EACT;AAEA,MAAIC,WAAW,SAASA,WAAW,QAAQ;AAEzC,WAAO;EACT;AAKA,SAAO;AACT;AAEO,MAAM/B,0BAA0B,CAAC4B;AAOtC,QAAM,EAAEC,YAAYC,WAAWC,QAAQE,QAAQD,oBAAmB,IAChEJ;AAGF,MAAIK,WAAW,OAAO;AACpB,WAAO;EACT;AAGA,MAAID,qBAAqB;AACvB,WAAO;EACT;AAGA,MAAIH,eAAe,YAAY;AAC7B,WAAO;EACT;AAIA,MAAIC,cAAc,YAAYC,WAAW,OAAO;AAC9C,WAAO;EACT;AAEA,SAAO;AACT;","names":["getAllDeps","checkSwcHelpers","matchSwcTransformCondition","matchEs5PluginCondition","appDirectory","options","json","JSON","parse","fs","readFileSync","path","resolve","deps","dependencies","Object","keys","devDependencies","peerDependencies","e","logger","warn","externalHelpers","swcHelpersPkgName","includes","local","Error","i18n","t","localeKeys","errors","condtionOptions","sourceType","buildType","format","disableSwcTransform","target"],"sources":["../../src/utils/home/runner/work/modern.js/modern.js/packages/solutions/module-tools/src/utils/builder.ts"],"sourcesContent":["import path from 'path';\nimport { logger, fs } from '@modern-js/utils';\nimport type {\n ExternalHelpers,\n BuildType,\n Format,\n Target,\n} from '../types/config';\n\nexport const getAllDeps = async <T>(\n appDirectory: string,\n options: {\n dependencies?: boolean;\n devDependencies?: boolean;\n peerDependencies?: boolean;\n } = {},\n) => {\n try {\n const json = JSON.parse(\n fs.readFileSync(path.resolve(appDirectory, './package.json'), 'utf8'),\n );\n\n let deps: string[] = [];\n\n if (options.dependencies) {\n deps = [\n ...deps,\n ...Object.keys((json.dependencies as T | undefined) || {}),\n ];\n }\n\n if (options.devDependencies) {\n deps = [\n ...deps,\n ...Object.keys((json.devDependencies as T | undefined) || {}),\n ];\n }\n\n if (options.peerDependencies) {\n deps = [\n ...deps,\n ...Object.keys((json.peerDependencies as T | undefined) || {}),\n ];\n }\n\n return deps;\n } catch (e) {\n logger.warn('package.json is broken');\n return [];\n }\n};\n\nexport const checkSwcHelpers = async (options: {\n appDirectory: string;\n externalHelpers: ExternalHelpers;\n}) => {\n const { appDirectory, externalHelpers } = options;\n if (externalHelpers === false) {\n return;\n }\n const deps = await getAllDeps(appDirectory, {\n dependencies: true,\n devDependencies: true,\n });\n const swcHelpersPkgName = '@swc/helpers';\n if (!deps.includes(swcHelpersPkgName)) {\n const local = await import('../locale');\n throw new Error(local.i18n.t(local.localeKeys.errors.externalHelpers));\n }\n};\n\nexport const matchSwcTransformCondition = (condtionOptions: {\n sourceType: 'commonjs' | 'module';\n buildType: BuildType;\n format: Format;\n disableSwcTransform?: boolean;\n}) => {\n const { sourceType, buildType, format, disableSwcTransform } =\n condtionOptions;\n\n if (disableSwcTransform) {\n return false;\n }\n\n // 1. source code is esm\n // 2. bundleless\n // 3. bundle and format is esm\n\n if (sourceType === 'commonjs') {\n return false;\n }\n\n if (buildType === 'bundleless') {\n return true;\n }\n\n if (format === 'esm' || format === 'iife') {\n // when format is iife, swc-transform only transform syntax, esbuild transform js format.\n return true;\n }\n\n // bundle only use esbuild-transform in cjs format, because have some limitations\n // eg: treeshaking\n\n return false;\n};\n\nexport const matchEs5PluginCondition = (condtionOptions: {\n sourceType: 'commonjs' | 'module';\n buildType: BuildType;\n format: Format;\n target: Target;\n disableSwcTransform?: boolean;\n}) => {\n const { sourceType, buildType, format, target, disableSwcTransform } =\n condtionOptions;\n\n // dist is es5\n if (target !== 'es5') {\n return false;\n }\n\n // when use disbaleSwcTransform option, we must be use es5Plugin when target is es5\n if (disableSwcTransform) {\n return true;\n }\n\n // only use esbuild-transform, so need es5Plugin\n if (sourceType === 'commonjs') {\n return true;\n }\n\n // when source code is esm and dist is bundle + cjs, we can`t use swc-transform.\n // so we only use esbuild-transform and es5Plugin\n if (buildType === 'bundle' && format === 'cjs') {\n return true;\n }\n\n return false;\n};\n"]}
|
package/dist/utils/common.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"mappings":";;;;;;;;;;;;EAGaA,yBAAuB;WAAvBA;;EAWGC,UAAQ;WAARA;;;AAXT,MAAMD,0BAA0B,CACrCE;AAEA,SAAOA,IAAIC,OAAO,CAACC,GAAGC;AACpB,WAAO;MACL,GAAGD;MACH,CAACC,MAAMC;IACT;EACF,GAAG,CAAC;AACN;AAEO,SAASL,SACdM,KACAC,QAAmB;AAEnB,SAAOC,OAAOC,YACZD,OAAOE,QAAQJ,KAAKK,IAAI,CAAC,CAACP,KAAKQ,WAAW;IAACR;IAAKG,OAAOK;GAAO;AAElE;","names":["transformUndefineObject","mapValue","arr","reduce","o","key","undefined","obj","mapper","Object","fromEntries","entries","map","value"],"sources":["../../src/utils/home/runner/work/modern.js/modern.js/packages/solutions/module-tools/src/utils/common.ts"],"sourcesContent":["/**\n * transform ['a', 'b'] to {a: undefined, b: undefined}\n */\nexport const transformUndefineObject = (\n arr: string[],\n): Record<string, undefined> => {\n return arr.reduce((o, key) => {\n return {\n ...o,\n [key]: undefined,\n };\n }, {});\n};\n\nexport function mapValue<T = any, U = any>(\n obj: Record<string, T>,\n mapper: (x: T) => U,\n): Record<string, U> {\n return Object.fromEntries(\n Object.entries(obj).map(([key, value]) => [key, mapper(value)]),\n );\n}\n"]}
|
package/dist/utils/context.d.ts
DELETED
package/dist/utils/context.js
DELETED
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", {
|
|
3
|
-
value: true
|
|
4
|
-
});
|
|
5
|
-
Object.defineProperty(exports, "initModuleContext", {
|
|
6
|
-
enumerable: true,
|
|
7
|
-
get: function() {
|
|
8
|
-
return initModuleContext;
|
|
9
|
-
}
|
|
10
|
-
});
|
|
11
|
-
const _interop_require_wildcard = require("@swc/helpers/_/_interop_require_wildcard");
|
|
12
|
-
const initModuleContext = async (api) => {
|
|
13
|
-
const { isTypescript } = await Promise.resolve().then(() => /* @__PURE__ */ _interop_require_wildcard._(require("@modern-js/utils")));
|
|
14
|
-
const { appDirectory, srcDirectory } = api.useAppContext();
|
|
15
|
-
const isTsProject = isTypescript(appDirectory);
|
|
16
|
-
return {
|
|
17
|
-
isTsProject,
|
|
18
|
-
appDirectory,
|
|
19
|
-
srcDirectory
|
|
20
|
-
};
|
|
21
|
-
};
|
|
22
|
-
|
|
23
|
-
//# sourceMappingURL=context.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":null,"mappings":";;;;+BAGaA;;;WAAAA;;;;AAAN,MAAMA,oBAAoB,OAAOC;AACtC,QAAM,EAAEC,aAAY,IAAK,MAAM,iFAAO;AACtC,QAAM,EAAEC,cAAcC,aAAY,IAAKH,IAAII,cAAa;AACxD,QAAMC,cAAcJ,aAAaC;AAEjC,SAAO;IAAEG;IAAaH;IAAcC;EAAa;AACnD;","names":["initModuleContext","api","isTypescript","appDirectory","srcDirectory","useAppContext","isTsProject"],"sources":["../../src/utils/home/runner/work/modern.js/modern.js/packages/solutions/module-tools/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.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":null,"mappings":";;;;;;;;;;;;EASaA,oBAAkB;WAAlBA;;EAUAC,mBAAiB;WAAjBA;;EAkEAC,eAAa;WAAbA;;EAyBAC,cAAY;WAAZA;;EA8EAC,uBAAqB;WAArBA;;EA2BAC,yBAAuB;WAAvBA;;;;sBAvN0D;uBACd;AAQlD,MAAML,qBAAqB,OAChCM;AAEA,MAAI,CAACC,UAAGC,WAAWF,eAAe;AAChC,WAAO,CAAC;EACV;AAEA,SAAOG,aAAMC,MAAMH,UAAGI,aAAaL,cAAc;AACnD;AAEO,MAAML,oBAAoB,OAC/BW;MAuBmBC;AArBnB,QAAM,EAAEC,cAAcC,WAAWC,cAAcV,aAAY,IAAKM;AAEhE,QAAMC,eAAe,MAAMb,mBAAmBM;AAC9C,QAAM,EAAEW,iBAAgB,IAAK,MAAM,iFAAO;AAE1C,QAAMC,uBAAsBC,eAC1BL,cACA,GAAGG,qBAAoBG,kBAAM,GAAI;AAEnC,QAAMC,qBAAoBF,eACxBD,sBACAI,mBAASR,cAAcE;AAGzB,QAAMO,oBAAmBJ,eAAKD,sBAAqBM,mBAASlB;AAC5DC,YAAGkB,eAAeF;AAElB,QAAMG,eAAcP,gBAClBG,oBAASK,kBAAQJ,oBAAmBI,kBAAQrB,iBAC5CkB,mBAASD;AAEX,QAAMK,cAAaf,w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D;AAHT,QAAMqD,SAASR,kBAAkB;IAC/BS,WAAWN;IACXO,SAASlD;IACTmD,QAAOxD,oFAAayB,qBAAe,QAA5BzB,kFAA8BwD,WAAK,QAAnCxD,uFAAuC,CAAC;EACjD;AACA,aAAWyD,KAAKJ,QAAQ;AACtB3D,cAAGgE,cAAcD,EAAEvC,MAAMuC,EAAEE,OAAO;EACpC;AAGA,QAAMjE,UAAGkE,UAAUd;AACnB,QAAMpD,UAAGmE,KAAK9B,oBAAoBe;AACpC;AAgDO,MAAMvD,wBAAwB,OACnCuE,OACAnB;AAEA,QAAM,EAAEoB,iBAAgB,IAAK,MAAM,iFAAO;AAC1C,QAAMC,QAAQ,MAAM,iFAAO;AAC3B,QAAM,EAAEC,cAAcC,UAAS,IAAKvB,mDAAW,CAAC;AAChD,MAAImB,iBAAiBpB,OAAO;AAC1B,QAAIuB,cAAc;AAChB,YAAM,IAAIF,iBAAiBD,OAAO;QAChCI;MACF;IACF,OAAO;AACLC,oBAAOC,KACLC,aAAMC,eACJN,MAAMO,KAAKC,EAAER,MAAMS,WAAWC,MAAMC,IAAIV,YAAY;AAGxDE,oBAAOL,MACL,IAAIC,iBAAiBD,OAAO;QAC1BI;MACF;IAEJ;EACF;AACF;AAEO,MAAM1E,0BAA0B,CAACoF,WACtCA,WAAW,YAAYA,WAAW;","names":["getProjectTsconfig","generatorTsConfig","getTscBinPath","resolveAlias","printOrThrowDtsErrors","tsTargetAtOrAboveES2022","tsconfigPath","fs","existsSync","json5","parse","readFileSync","config","userTsconfig","appDirectory","sourceDir","absSourceDir","dtsTempDirectory","tempDistAbsRootPath","join","nanoid","tempDistAbsOurDir","relative","tempTsconfigPath","basename","ensureFileSync","extendsPath","dirname","references","map","reference","path","userTsconfigDir","generatedTsconfigDir","isAbsolute","resolve","resetConfig","extends","compilerOptions","declaration","emitDeclarationOnly","declarationDir","writeJSONSync","generatedTsconfig","tempDistAbsSrcPath","default","findUp","exists","pathExists","tscBinFile","directory","targetFilePath","hasTscBinFile","undefined","cwd","Error","options","watchFilenames","transformDtsAlias","distAbsPath","dtsDistPath","dtsFilenames","length","globby","sync","absolute","result","filenames","baseUrl","paths","r","writeFileSync","content","ensureDir","copy","error","InternalDTSError","local","abortOnError","buildType","logger","warn","chalk","bgYellowBright","i18n","t","localeKeys","warns","dts","target"],"sources":["../../src/utils/home/runner/work/modern.js/modern.js/packages/solutions/module-tools/src/utils/dts.ts"],"sourcesContent":["import { join, dirname, isAbsolute, relative, resolve, basename } from 'path';\nimport { chalk, fs, globby, json5, logger, nanoid } from '@modern-js/utils';\nimport type {\n ITsconfig,\n BundlelessGeneratorDtsConfig,\n BuildType,\n TsTarget,\n} from '../types';\n\nexport const getProjectTsconfig = async (\n tsconfigPath: string,\n): Promise<ITsconfig> => {\n if (!fs.existsSync(tsconfigPath)) {\n return {};\n }\n\n return json5.parse(fs.readFileSync(tsconfigPath, 'utf-8'));\n};\n\nexport const generatorTsConfig = async (\n config: BundlelessGeneratorDtsConfig,\n) => {\n const { appDirectory, sourceDir: absSourceDir, tsconfigPath } = config;\n\n const userTsconfig = await getProjectTsconfig(tsconfigPath);\n const { dtsTempDirectory } = await import('../constants/dts');\n\n const tempDistAbsRootPath = join(\n appDirectory,\n `${dtsTempDirectory}/${nanoid()}`,\n );\n const tempDistAbsOurDir = join(\n tempDistAbsRootPath,\n relative(appDirectory, absSourceDir),\n );\n\n const tempTsconfigPath = join(tempDistAbsRootPath, basename(tsconfigPath));\n fs.ensureFileSync(tempTsconfigPath);\n\n const extendsPath = join(\n relative(dirname(tempTsconfigPath), dirname(tsconfigPath)),\n basename(tempTsconfigPath),\n );\n const references = userTsconfig?.references?.map(reference => {\n const { path } = reference;\n if (path) {\n const userTsconfigDir = dirname(tsconfigPath);\n const generatedTsconfigDir = dirname(tempTsconfigPath);\n return {\n path: isAbsolute(path)\n ? path\n : relative(generatedTsconfigDir, resolve(userTsconfigDir, path)),\n };\n }\n return reference;\n });\n\n const resetConfig: ITsconfig = {\n extends: extendsPath,\n compilerOptions: {\n // Ensure that .d.ts files are created by tsc, but not .js files\n declaration: true,\n emitDeclarationOnly: true,\n // when `outDir` is './dist', `declarationDir` is `./types`\n // tsc will emit:\n // - ./dist/index.js\n // - ./types/index.d.ts\n // we only want to emit declarations\n declarationDir: tempDistAbsOurDir,\n },\n references,\n };\n\n fs.writeJSONSync(tempTsconfigPath, resetConfig);\n\n return {\n userTsconfig,\n generatedTsconfig: {\n tempTsconfigPath,\n tempDistAbsRootPath,\n tempDistAbsSrcPath: tempDistAbsOurDir,\n },\n };\n};\n\nexport const getTscBinPath = async (appDirectory: string) => {\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 = 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 { transformDtsAlias } = await import('./tspathsTransform');\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 // why use `ensureDir` before copy? look this: https://github.com/jprichardson/node-fs-extra/issues/957\n await fs.ensureDir(distAbsPath);\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 printOrThrowDtsErrors = async (\n error: unknown,\n options: { abortOnError?: boolean; buildType: BuildType },\n) => {\n const { InternalDTSError } = await import('../error');\n const local = await import('../locale');\n const { abortOnError, buildType } = options ?? {};\n if (error instanceof Error) {\n if (abortOnError) {\n throw new InternalDTSError(error, {\n buildType,\n });\n } else {\n logger.warn(\n chalk.bgYellowBright(\n local.i18n.t(local.localeKeys.warns.dts.abortOnError),\n ),\n );\n logger.error(\n new InternalDTSError(error, {\n buildType,\n }),\n );\n }\n }\n};\n\nexport const tsTargetAtOrAboveES2022 = (target: TsTarget) =>\n target === 'es2022' || target === 'esnext';\n"]}
|
package/dist/utils/input.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
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"]}
|
package/dist/utils/language.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const initLocalLanguage: () => Promise<typeof import("../locale")>;
|