@modern-js/module-tools 2.16.0-beta.0 → 2.16.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.
Files changed (52) hide show
  1. package/CHANGELOG.md +38 -0
  2. package/dist/build.js.map +1 -1
  3. package/dist/builder/build.js.map +1 -1
  4. package/dist/builder/clear.js.map +1 -1
  5. package/dist/builder/copy.js.map +1 -1
  6. package/dist/builder/dts/index.js.map +1 -1
  7. package/dist/builder/dts/rollup.js.map +1 -1
  8. package/dist/builder/dts/tsc.js.map +1 -1
  9. package/dist/builder/index.js.map +1 -1
  10. package/dist/builder/platform.js.map +1 -1
  11. package/dist/cli.js.map +1 -1
  12. package/dist/command.js.map +1 -1
  13. package/dist/config/defineConfig.js.map +1 -1
  14. package/dist/config/legacySchema.js.map +1 -1
  15. package/dist/config/normalize.js.map +1 -1
  16. package/dist/config/schema.js.map +1 -1
  17. package/dist/config/transformLegacyConfig.js.map +1 -1
  18. package/dist/constants/build.js.map +1 -1
  19. package/dist/constants/buildPresets.js.map +1 -1
  20. package/dist/constants/colors.js.map +1 -1
  21. package/dist/constants/dts.js.map +1 -1
  22. package/dist/constants/file.js.map +1 -1
  23. package/dist/constants/legacyBuildPresets.js.map +1 -1
  24. package/dist/constants/log.js.map +1 -1
  25. package/dist/dev.js.map +1 -1
  26. package/dist/error.js.map +1 -1
  27. package/dist/hooks/build.js.map +1 -1
  28. package/dist/hooks/dev.js.map +1 -1
  29. package/dist/hooks/index.js.map +1 -1
  30. package/dist/hooks/misc.js.map +1 -1
  31. package/dist/index.js.map +1 -1
  32. package/dist/locale/en.js.map +1 -1
  33. package/dist/locale/index.js.map +1 -1
  34. package/dist/locale/zh.js.map +1 -1
  35. package/dist/plugins.js.map +1 -1
  36. package/dist/types/config/index.js.map +1 -1
  37. package/dist/types/index.js.map +1 -1
  38. package/dist/utils/builder.js.map +1 -1
  39. package/dist/utils/common.js.map +1 -1
  40. package/dist/utils/config.js.map +1 -1
  41. package/dist/utils/context.js.map +1 -1
  42. package/dist/utils/dts.js.map +1 -1
  43. package/dist/utils/input.js.map +1 -1
  44. package/dist/utils/language.js.map +1 -1
  45. package/dist/utils/libuildPlugins.js.map +1 -1
  46. package/dist/utils/log.js.map +1 -1
  47. package/dist/utils/onExit.js.map +1 -1
  48. package/dist/utils/path.js.map +1 -1
  49. package/dist/utils/print.js.map +1 -1
  50. package/dist/utils/style.js.map +1 -1
  51. package/dist/utils/tspathsTransform.js.map +1 -1
  52. package/package.json +18 -14
package/CHANGELOG.md CHANGED
@@ -1,5 +1,43 @@
1
1
  # @modern-js/module-tools
2
2
 
3
+ ## 2.16.0
4
+
5
+ ### Minor Changes
6
+
7
+ - b06f571: feat(module-tools): Replace esbuild-transform with swc-transform for the underlying build, reducing the size of the build product. Added `externalHelpers`, `transformImport` and `disbaleSwcTransform` configurations.
8
+ feat(module-tools): 底层构建使用 swc-transform 替换 esbuild-transform, 减少构建产物体积.新增 `externalHelpers`、`transformImport` 和 `disbaleSwcTransform` 配置.
9
+
10
+ ### Patch Changes
11
+
12
+ - acc0a00: fix: upgrade libuild version to support tailwind in watch mode
13
+ fix: 更新 libuild 版本以支持 tailwindcss 在 watch 模式下生效
14
+ - fd4a8a6: chore(deps): bump postcss-custom-properties to v13.1.5
15
+
16
+ chore(deps): 升级 postcss-custom-properties 到 v13.1.5
17
+
18
+ - 4e876ab: chore: package.json include the monorepo-relative directory
19
+
20
+ chore: 在 package.json 中声明 monorepo 的子路径
21
+
22
+ - 355d36e: feat: adjust create tools and new command option order
23
+
24
+ feat: 调整 create 工具及 new 命令 option 操作顺序
25
+
26
+ - b06f571: chore: update libuild and libuild plugins version to 0.12.0
27
+ chore: 更新 libuild 和 libuild 插件的版本到 0.12.0
28
+ - Updated dependencies [5954330]
29
+ - Updated dependencies [7596520]
30
+ - Updated dependencies [4e876ab]
31
+ - Updated dependencies [6d5219e]
32
+ - @modern-js/utils@2.16.0
33
+ - @modern-js/plugin@2.16.0
34
+ - @modern-js/plugin-changeset@2.16.0
35
+ - @modern-js/new-action@2.16.0
36
+ - @modern-js/plugin-i18n@2.16.0
37
+ - @modern-js/plugin-lint@2.16.0
38
+ - @modern-js/upgrade@2.16.0
39
+ - @modern-js/core@2.16.0
40
+
3
41
  ## 2.15.0
4
42
 
5
43
  ### Patch Changes
package/dist/build.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":null,"mappings":";;;;+BAMaA;;aAAAA;;;uBALkB;AAG/B,MAAMC,SAAQC,0BAAe;AAEtB,MAAMF,QAAQ,OACnBG,KACAC,SACAC,YACG;AACH,MAAID,QAAQE,UAAU;AACpB,UAAM,EAAEC,cAAa,IAAK,MAAM,iFAAO;AACvC,UAAMA,cAAcH,SAASD,KAAKE;AAClC;EACF;AAEA,QAAMG,SAASL,IAAIM,eAAc;AAEjC,QAAM,EAAEC,qBAAoB,IAAK,MAAM,iFAAO;AAC9C,QAAMC,sBAAsB,MAAMD,qBAAqBP,KAAKE,SAASD;AAErEH,QAAM,uBAAuBU;AAE7B,QAAMH,OAAOI,YAAY;IACvBC,QAAQF;IACRG,YAAYV;EACd;AACA,QAAMW,UAAU,MAAM,iFAAO;AAC7B,QAAMA,QAAQC,IAAI;IAAEC,YAAYb;IAASO;IAAqBN;EAAQ,GAAGF;AAC3E;","names":["build","debug","createDebugger","api","options","context","platform","buildPlatform","runner","useHookRunners","normalizeBuildConfig","resolvedBuildConfig","beforeBuild","config","cliOptions","builder","run","cmdOptions"],"sources":["../src/Users/bytedance/github/targeral/modern-js/packages/solutions/module-tools/src/build.ts"],"sourcesContent":["import type { PluginAPI } from '@modern-js/core';\nimport { createDebugger } from '@modern-js/utils';\nimport type { ModuleTools, ModuleContext, BuildCommandOptions } from './types';\n\nconst debug = createDebugger('module-tools');\n\nexport const build = async (\n api: PluginAPI<ModuleTools>,\n options: BuildCommandOptions,\n context: ModuleContext,\n) => {\n if (options.platform) {\n const { buildPlatform } = await import('./builder/platform');\n await buildPlatform(options, api, context);\n return;\n }\n\n const runner = api.useHookRunners();\n\n const { normalizeBuildConfig } = await import('./config/normalize');\n const resolvedBuildConfig = await normalizeBuildConfig(api, context, options);\n\n debug('resolvedBuildConfig', resolvedBuildConfig);\n\n await runner.beforeBuild({\n config: resolvedBuildConfig,\n cliOptions: options,\n });\n const builder = await import('./builder');\n await builder.run({ cmdOptions: options, resolvedBuildConfig, context }, api);\n};\n"]}
1
+ {"version":3,"file":null,"mappings":";;;;+BAMaA;;aAAAA;;;uBALkB;AAG/B,MAAMC,SAAQC,0BAAe;AAEtB,MAAMF,QAAQ,OACnBG,KACAC,SACAC,YACG;AACH,MAAID,QAAQE,UAAU;AACpB,UAAM,EAAEC,cAAa,IAAK,MAAM,iFAAO;AACvC,UAAMA,cAAcH,SAASD,KAAKE;AAClC;EACF;AAEA,QAAMG,SAASL,IAAIM,eAAc;AAEjC,QAAM,EAAEC,qBAAoB,IAAK,MAAM,iFAAO;AAC9C,QAAMC,sBAAsB,MAAMD,qBAAqBP,KAAKE,SAASD;AAErEH,QAAM,uBAAuBU;AAE7B,QAAMH,OAAOI,YAAY;IACvBC,QAAQF;IACRG,YAAYV;EACd;AACA,QAAMW,UAAU,MAAM,iFAAO;AAC7B,QAAMA,QAAQC,IAAI;IAAEC,YAAYb;IAASO;IAAqBN;EAAQ,GAAGF;AAC3E;","names":["build","debug","createDebugger","api","options","context","platform","buildPlatform","runner","useHookRunners","normalizeBuildConfig","resolvedBuildConfig","beforeBuild","config","cliOptions","builder","run","cmdOptions"],"sources":["../src/home/runner/work/modern.js/modern.js/packages/solutions/module-tools/src/build.ts"],"sourcesContent":["import type { PluginAPI } from '@modern-js/core';\nimport { createDebugger } from '@modern-js/utils';\nimport type { ModuleTools, ModuleContext, BuildCommandOptions } from './types';\n\nconst debug = createDebugger('module-tools');\n\nexport const build = async (\n api: PluginAPI<ModuleTools>,\n options: BuildCommandOptions,\n context: ModuleContext,\n) => {\n if (options.platform) {\n const { buildPlatform } = await import('./builder/platform');\n await buildPlatform(options, api, context);\n return;\n }\n\n const runner = api.useHookRunners();\n\n const { normalizeBuildConfig } = await import('./config/normalize');\n const resolvedBuildConfig = await normalizeBuildConfig(api, context, options);\n\n debug('resolvedBuildConfig', resolvedBuildConfig);\n\n await runner.beforeBuild({\n config: resolvedBuildConfig,\n cliOptions: options,\n });\n const builder = await import('./builder');\n await builder.run({ cmdOptions: options, resolvedBuildConfig, context }, api);\n};\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":null,"mappings":";;;;;;;;;;;;EAYaA,cAAY,MAAZA;EAqBAC,kBAAgB,MAAhBA;EAyBAC,kBAAgB,MAAhBA;EAmBAC,cAAY,MAAZA;EAsCAC,UAAQ,MAARA;;;sBAnHQ;wBACE;AAWhB,MAAMJ,eAAe,OAC1BK,SAKAC,QACG;AACH,QAAM,EAAEC,aAAaC,SAASC,gBAAe,IAAKJ;AAClD,QAAM,EAAEK,cAAcC,YAAW,IAAKH;AAEtC,QAAM,EAAEI,SAAQ,IAAK,MAAM,iFAAO;AAClC,QAAMA,SAASL,aAAa;IAAEG;IAAcG,OAAOJ,gBAAgBI;EAAM;AAEzE,MAAIF,aAAa;AACf,UAAMV,iBAAiBI,SAASC;EAClC,OAAO;AACL,UAAMJ,iBAAiBG,SAASC;EAClC;AACF;AAEO,MAAML,mBAAmB,OAC9BI,SAKAC,QACG;AACH,QAAM,EAAEC,aAAaE,gBAAe,IAAKJ;AACzC,QAAMS,MAAML,gBAAgBK,MAAMP,YAAYO,MAAM;AACpD,QAAMC,eAAeR,YAAYO,MAAMP,YAAYO,IAAIE,OAAO;MAChDP;AAAd,QAAMI,SAAQJ,yCAAgBI,WAAK,QAArBJ,6DAAyB;AAEvC,MAAIK,QAAQ,OAAO;AAEjB,KAACC,gBAAiB,MAAMX,SAASG,aAAaD,KAAK;MAAEO;IAAM;EAC7D,OAAO;AACL,UAAMI,QAAQH,IAAIE,OAAO;MAACb;QAAgB;MAACC;MAAUD;;AACrD,UAAM,EAAEe,SAASC,KAAI,IAAK,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BD,GAAG;MAC9B3E;MACAE;MACAf;IACF;EACF;AACF;","names":["runBuildTask","buildInTsProject","buildInJsProject","generatorDts","buildLib","options","api","buildConfig","context","buildCmdOptions","appDirectory","isTsProject","copyTask","watch","dts","skipBuildLib","only","tasks","default","pMap","task","config","runRollup","runTsc","buildType","input","sourceDir","alias","useAppContext","tsconfigPath","distPath","abortOnError","getFinalExternals","finalExternals","distDir","externals","distAbsPath","target","sourceMap","format","outDir","asset","jsx","platform","splitting","minify","umdGlobals","umdModuleName","define","style","autoExternal","metafile","sideEffects","redirect","esbuildOptions","externalHelpers","transformImport","sourceType","disableSwcTransform","slash","root","outdir","assetOutDir","path","less","sass","postcss","inject","modules","autoModules","umdPlugin","swcTransformPlugin","es5Plugin","checkSwcHelpers","matchEs5PluginCondition","matchSwcTransformCondition","getProjectTsconfig","join","userTsconfig","plugins","push","pluginImport","Boolean","emitDecoratorMetadata","compilerOptions","svgr","svgrPlugin","watchPlugin","externalPlugin","resolve","globals","external","bundle","outbase","Libuilder","addOutputChunk","runner","useHookRunners","modifiedBuildConfig","modifyLibuild","onLast","c","builder","create","build","outputChunk","watchSectionTitle","SectionTitleStatus","titleText","logger","info","Success","e","InternalBuildError"],"sources":["../../src/builder/Users/bytedance/github/targeral/modern-js/packages/solutions/module-tools/src/builder/build.ts"],"sourcesContent":["import { join } from 'path';\nimport { logger } from '@modern-js/utils/logger';\nimport type { CLIConfig } from '@modern-js/libuild';\nimport type {\n BuildCommandOptions,\n BaseBuildConfig,\n ModuleTools,\n PluginAPI,\n DTSOptions,\n ModuleContext,\n} from '../types';\n\nexport const runBuildTask = async (\n options: {\n buildConfig: BaseBuildConfig;\n buildCmdOptions: BuildCommandOptions;\n context: ModuleContext;\n },\n api: PluginAPI<ModuleTools>,\n) => {\n const { buildConfig, context, buildCmdOptions } = options;\n const { appDirectory, isTsProject } = context;\n\n const { copyTask } = await import('./copy');\n await copyTask(buildConfig, { appDirectory, watch: buildCmdOptions.watch });\n\n if (isTsProject) {\n await buildInTsProject(options, api);\n } else {\n await buildInJsProject(options, api);\n }\n};\n\nexport const buildInTsProject = async (\n options: {\n buildConfig: BaseBuildConfig;\n buildCmdOptions: BuildCommandOptions;\n context: ModuleContext;\n },\n api: PluginAPI<ModuleTools>,\n) => {\n const { buildConfig, buildCmdOptions } = options;\n const dts = buildCmdOptions.dts ? buildConfig.dts : false;\n const skipBuildLib = buildConfig.dts ? buildConfig.dts.only : false;\n const watch = buildCmdOptions.watch ?? false;\n\n if (dts === false) {\n // --no-dts and buildConfig is `{ dts: { only: true } }`, then skip.\n !skipBuildLib && (await buildLib(buildConfig, api, { watch }));\n } else {\n const tasks = dts.only ? [generatorDts] : [buildLib, generatorDts];\n const { default: pMap } = await import('../../compiled/p-map');\n await pMap(tasks, async task => {\n await task(buildConfig, api as any, { watch, dts });\n });\n }\n};\n\nexport const buildInJsProject = async (\n options: {\n buildConfig: BaseBuildConfig;\n buildCmdOptions: BuildCommandOptions;\n context: ModuleContext;\n },\n api: PluginAPI<ModuleTools>,\n) => {\n const { buildConfig, buildCmdOptions } = options;\n const dts = buildCmdOptions.dts ? buildConfig.dts : false;\n const watch = buildCmdOptions.watch ?? false;\n\n if (dts !== false && dts.only) {\n return;\n }\n\n await buildLib(buildConfig, api, { watch });\n};\n\nexport const generatorDts = async (\n config: BaseBuildConfig,\n api: PluginAPI<ModuleTools>,\n options: {\n watch: boolean;\n dts: DTSOptions;\n },\n) => {\n const { runRollup, runTsc } = await import('./dts');\n const { watch, dts } = options;\n const { buildType, input, sourceDir, alias } = config;\n const { appDirectory } = api.useAppContext();\n const { tsconfigPath, distPath, abortOnError } = dts;\n if (buildType === 'bundle') {\n const { getFinalExternals } = await import('../utils/builder');\n const finalExternals = await getFinalExternals(config, { appDirectory });\n\n await runRollup(api, {\n distDir: distPath,\n watch,\n externals: finalExternals,\n input,\n tsconfigPath,\n abortOnError,\n });\n } else {\n await runTsc(api, {\n appDirectory,\n alias,\n distAbsPath: distPath,\n watch,\n tsconfigPath,\n sourceDir,\n abortOnError,\n });\n }\n};\n\nexport const buildLib = async (\n config: BaseBuildConfig,\n api: PluginAPI<ModuleTools>,\n options: {\n watch: boolean;\n },\n) => {\n const { watch } = options;\n const {\n target,\n buildType,\n sourceMap,\n format,\n outDir: distPath,\n asset,\n jsx,\n input,\n platform,\n splitting,\n minify,\n sourceDir,\n umdGlobals,\n umdModuleName,\n define,\n alias,\n style,\n externals,\n autoExternal,\n dts,\n metafile,\n sideEffects,\n redirect,\n esbuildOptions,\n externalHelpers,\n transformImport,\n sourceType,\n disableSwcTransform,\n } = config;\n const { appDirectory } = api.useAppContext();\n const { slash } = await import('@modern-js/utils');\n const root = slash(appDirectory);\n const outdir = slash(distPath);\n const assetOutDir = asset.path ? slash(asset.path) : asset.path;\n const { less, sass, postcss, inject, modules, autoModules } = style;\n\n // support swc-transform, umd and emitDecoratorMetadata by swc\n const { umdPlugin, swcTransformPlugin, es5Plugin } = await import(\n '@modern-js/libuild-plugin-swc'\n );\n const {\n checkSwcHelpers,\n matchEs5PluginCondition,\n matchSwcTransformCondition,\n } = await import('../utils/builder');\n\n const { getProjectTsconfig } = await import('./dts/tsc');\n const tsconfigPath = dts\n ? dts.tsconfigPath\n : join(appDirectory, './tsconfig.json');\n const userTsconfig = await getProjectTsconfig(tsconfigPath);\n\n const plugins = [];\n\n if (\n matchSwcTransformCondition({\n sourceType,\n buildType,\n format,\n disableSwcTransform,\n })\n ) {\n plugins.push(\n swcTransformPlugin({\n pluginImport: transformImport,\n externalHelpers: Boolean(externalHelpers),\n emitDecoratorMetadata:\n userTsconfig?.compilerOptions?.emitDecoratorMetadata,\n }),\n );\n } else if (\n matchEs5PluginCondition({\n sourceType,\n buildType,\n format,\n target,\n disableSwcTransform,\n })\n ) {\n plugins.push(es5Plugin());\n }\n\n if (format === 'umd') {\n plugins.push(umdPlugin(umdModuleName));\n }\n\n await checkSwcHelpers({ appDirectory, externalHelpers });\n\n // support svgr\n if (asset.svgr) {\n const { svgrPlugin } = await import('@modern-js/libuild-plugin-svgr');\n const options = typeof asset.svgr === 'boolean' ? {} : asset.svgr;\n plugins.push(svgrPlugin(options));\n }\n\n // adapt module tools\n const { watchPlugin, externalPlugin } = await import(\n '../utils/libuildPlugins'\n );\n plugins.push(watchPlugin(api, config));\n plugins.push(externalPlugin(config, { appDirectory }));\n\n const buildConfig: CLIConfig = {\n root,\n watch,\n target,\n sourceMap,\n format,\n outdir,\n define,\n style: {\n less,\n sass,\n postcss,\n inject,\n modules,\n autoModules,\n },\n resolve: {\n alias,\n },\n asset: {\n ...asset,\n outdir: assetOutDir,\n },\n plugins,\n jsx,\n input,\n platform,\n splitting,\n minify,\n sourceDir,\n metafile: metafile && buildType === 'bundle',\n globals: umdGlobals,\n external: externals,\n autoExternal,\n redirect,\n bundle: buildType === 'bundle',\n sideEffects,\n // outbase for [dir]/[name]\n outbase: sourceDir,\n esbuildOptions,\n };\n\n try {\n const { Libuilder } = await import('@modern-js/libuild');\n const { addOutputChunk } = await import('../utils/print');\n const runner = api.useHookRunners();\n const modifiedBuildConfig = await runner.modifyLibuild(buildConfig, {\n onLast: c => c,\n });\n\n const builder = await Libuilder.create(modifiedBuildConfig);\n await builder.build();\n addOutputChunk(builder.outputChunk, root, buildType === 'bundle');\n\n if (watch) {\n const { watchSectionTitle } = await import('../utils/log');\n const { SectionTitleStatus } = await import('../constants/log');\n const titleText = `[${\n buildType === 'bundle' ? 'Bundle' : 'Bundleless'\n }: ${format}_${target}]`;\n\n logger.info(\n await watchSectionTitle(titleText, SectionTitleStatus.Success),\n );\n }\n } catch (e: any) {\n const { InternalBuildError } = await import('../error');\n throw new InternalBuildError(e, {\n target,\n format,\n buildType,\n });\n }\n};\n"]}
1
+ {"version":3,"file":null,"mappings":";;;;;;;;;;;;EAYaA,cAAY,MAAZA;EAqBAC,kBAAgB,MAAhBA;EAyBAC,kBAAgB,MAAhBA;EAmBAC,cAAY,MAAZA;EAsCAC,UAAQ,MAARA;;;sBAnHQ;wBACE;AAWhB,MAA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B,cAAc;IACpCkE,SAAS5C;IACT6C,UAAUxD;IACVe;IACAG;IACAuC,QAAQpE,cAAc;IACtB4B;;IAEAyC,SAASnE;IACT4B;EACF;AAEA,MAAI;AACF,UAAM,EAAEwC,UAAS,IAAK,MAAM,iFAAO;AACnC,UAAM,EAAEC,eAAc,IAAK,MAAM,iFAAO;AACxC,UAAMC,SAAS1F,IAAI2F,eAAc;AACjC,UAAMC,sBAAsB,MAAMF,OAAOG,cAAc5F,aAAa;MAClE6F,QAAQC,OAAKA;IACf;AAEA,UAAMC,UAAU,MAAMR,UAAUS,OAAOL;AACvC,UAAMI,QAAQE,MAAK;AACnBT,mBAAeO,QAAQG,aAAa7C,MAAMpC,cAAc;AAExD,QAAIX,OAAO;AACT,YAAM,EAAE6F,kBAAiB,IAAK,MAAM,iFAAO;AAC3C,YAAM,EAAEC,mBAAkB,IAAK,MAAM,iFAAO;AAC5C,YAAMC,YAAY,IAChBpF,cAAc,WAAW,WAAW,iBACjCe,UAAUF;AAEfwE,qBAAOC,KACL,MAAMJ,kBAAkBE,WAAWD,mBAAmBI,OAAO;IAEjE;EACF,SAASC,GAAP;AACA,UAAM,EAAEC,mBAAkB,IAAK,MAAM,iFAAO;AAC5C,UAAM,IAAIA,mBAAmBD,GAAG;MAC9B3E;MACAE;MACAf;IACF;EACF;AACF;","names":["runBuildTask","buildInTsProject","buildInJsProject","generatorDts","buildLib","options","api","buildConfig","context","buildCmdOptions","appDirectory","isTsProject","copyTask","watch","dts","skipBuildLib","only","tasks","default","pMap","task","config","runRollup","runTsc","buildType","input","sourceDir","alias","useAppContext","tsconfigPath","distPath","abortOnError","getFinalExternals","finalExternals","distDir","externals","distAbsPath","target","sourceMap","format","outDir","asset","jsx","platform","splitting","minify","umdGlobals","umdModuleName","define","style","autoExternal","metafile","sideEffects","redirect","esbuildOptions","externalHelpers","transformImport","sourceType","disableSwcTransform","slash","root","outdir","assetOutDir","path","less","sass","postcss","inject","modules","autoModules","umdPlugin","swcTransformPlugin","es5Plugin","checkSwcHelpers","matchEs5PluginCondition","matchSwcTransformCondition","getProjectTsconfig","join","userTsconfig","plugins","push","pluginImport","Boolean","emitDecoratorMetadata","compilerOptions","svgr","svgrPlugin","watchPlugin","externalPlugin","resolve","globals","external","bundle","outbase","Libuilder","addOutputChunk","runner","useHookRunners","modifiedBuildConfig","modifyLibuild","onLast","c","builder","create","build","outputChunk","watchSectionTitle","SectionTitleStatus","titleText","logger","info","Success","e","InternalBuildError"],"sources":["../../src/builder/home/runner/work/modern.js/modern.js/packages/solutions/module-tools/src/builder/build.ts"],"sourcesContent":["import { join } from 'path';\nimport { logger } from '@modern-js/utils/logger';\nimport type { CLIConfig } from '@modern-js/libuild';\nimport type {\n BuildCommandOptions,\n BaseBuildConfig,\n ModuleTools,\n PluginAPI,\n DTSOptions,\n ModuleContext,\n} from '../types';\n\nexport const runBuildTask = async (\n options: {\n buildConfig: BaseBuildConfig;\n buildCmdOptions: BuildCommandOptions;\n context: ModuleContext;\n },\n api: PluginAPI<ModuleTools>,\n) => {\n const { buildConfig, context, buildCmdOptions } = options;\n const { appDirectory, isTsProject } = context;\n\n const { copyTask } = await import('./copy');\n await copyTask(buildConfig, { appDirectory, watch: buildCmdOptions.watch });\n\n if (isTsProject) {\n await buildInTsProject(options, api);\n } else {\n await buildInJsProject(options, api);\n }\n};\n\nexport const buildInTsProject = async (\n options: {\n buildConfig: BaseBuildConfig;\n buildCmdOptions: BuildCommandOptions;\n context: ModuleContext;\n },\n api: PluginAPI<ModuleTools>,\n) => {\n const { buildConfig, buildCmdOptions } = options;\n const dts = buildCmdOptions.dts ? buildConfig.dts : false;\n const skipBuildLib = buildConfig.dts ? buildConfig.dts.only : false;\n const watch = buildCmdOptions.watch ?? false;\n\n if (dts === false) {\n // --no-dts and buildConfig is `{ dts: { only: true } }`, then skip.\n !skipBuildLib && (await buildLib(buildConfig, api, { watch }));\n } else {\n const tasks = dts.only ? [generatorDts] : [buildLib, generatorDts];\n const { default: pMap } = await import('../../compiled/p-map');\n await pMap(tasks, async task => {\n await task(buildConfig, api as any, { watch, dts });\n });\n }\n};\n\nexport const buildInJsProject = async (\n options: {\n buildConfig: BaseBuildConfig;\n buildCmdOptions: BuildCommandOptions;\n context: ModuleContext;\n },\n api: PluginAPI<ModuleTools>,\n) => {\n const { buildConfig, buildCmdOptions } = options;\n const dts = buildCmdOptions.dts ? buildConfig.dts : false;\n const watch = buildCmdOptions.watch ?? false;\n\n if (dts !== false && dts.only) {\n return;\n }\n\n await buildLib(buildConfig, api, { watch });\n};\n\nexport const generatorDts = async (\n config: BaseBuildConfig,\n api: PluginAPI<ModuleTools>,\n options: {\n watch: boolean;\n dts: DTSOptions;\n },\n) => {\n const { runRollup, runTsc } = await import('./dts');\n const { watch, dts } = options;\n const { buildType, input, sourceDir, alias } = config;\n const { appDirectory } = api.useAppContext();\n const { tsconfigPath, distPath, abortOnError } = dts;\n if (buildType === 'bundle') {\n const { getFinalExternals } = await import('../utils/builder');\n const finalExternals = await getFinalExternals(config, { appDirectory });\n\n await runRollup(api, {\n distDir: distPath,\n watch,\n externals: finalExternals,\n input,\n tsconfigPath,\n abortOnError,\n });\n } else {\n await runTsc(api, {\n appDirectory,\n alias,\n distAbsPath: distPath,\n watch,\n tsconfigPath,\n sourceDir,\n abortOnError,\n });\n }\n};\n\nexport const buildLib = async (\n config: BaseBuildConfig,\n api: PluginAPI<ModuleTools>,\n options: {\n watch: boolean;\n },\n) => {\n const { watch } = options;\n const {\n target,\n buildType,\n sourceMap,\n format,\n outDir: distPath,\n asset,\n jsx,\n input,\n platform,\n splitting,\n minify,\n sourceDir,\n umdGlobals,\n umdModuleName,\n define,\n alias,\n style,\n externals,\n autoExternal,\n dts,\n metafile,\n sideEffects,\n redirect,\n esbuildOptions,\n externalHelpers,\n transformImport,\n sourceType,\n disableSwcTransform,\n } = config;\n const { appDirectory } = api.useAppContext();\n const { slash } = await import('@modern-js/utils');\n const root = slash(appDirectory);\n const outdir = slash(distPath);\n const assetOutDir = asset.path ? slash(asset.path) : asset.path;\n const { less, sass, postcss, inject, modules, autoModules } = style;\n\n // support swc-transform, umd and emitDecoratorMetadata by swc\n const { umdPlugin, swcTransformPlugin, es5Plugin } = await import(\n '@modern-js/libuild-plugin-swc'\n );\n const {\n checkSwcHelpers,\n matchEs5PluginCondition,\n matchSwcTransformCondition,\n } = await import('../utils/builder');\n\n const { getProjectTsconfig } = await import('./dts/tsc');\n const tsconfigPath = dts\n ? dts.tsconfigPath\n : join(appDirectory, './tsconfig.json');\n const userTsconfig = await getProjectTsconfig(tsconfigPath);\n\n const plugins = [];\n\n if (\n matchSwcTransformCondition({\n sourceType,\n buildType,\n format,\n disableSwcTransform,\n })\n ) {\n plugins.push(\n swcTransformPlugin({\n pluginImport: transformImport,\n externalHelpers: Boolean(externalHelpers),\n emitDecoratorMetadata:\n userTsconfig?.compilerOptions?.emitDecoratorMetadata,\n }),\n );\n } else if (\n matchEs5PluginCondition({\n sourceType,\n buildType,\n format,\n target,\n disableSwcTransform,\n })\n ) {\n plugins.push(es5Plugin());\n }\n\n if (format === 'umd') {\n plugins.push(umdPlugin(umdModuleName));\n }\n\n await checkSwcHelpers({ appDirectory, externalHelpers });\n\n // support svgr\n if (asset.svgr) {\n const { svgrPlugin } = await import('@modern-js/libuild-plugin-svgr');\n const options = typeof asset.svgr === 'boolean' ? {} : asset.svgr;\n plugins.push(svgrPlugin(options));\n }\n\n // adapt module tools\n const { watchPlugin, externalPlugin } = await import(\n '../utils/libuildPlugins'\n );\n plugins.push(watchPlugin(api, config));\n plugins.push(externalPlugin(config, { appDirectory }));\n\n const buildConfig: CLIConfig = {\n root,\n watch,\n target,\n sourceMap,\n format,\n outdir,\n define,\n style: {\n less,\n sass,\n postcss,\n inject,\n modules,\n autoModules,\n },\n resolve: {\n alias,\n },\n asset: {\n ...asset,\n outdir: assetOutDir,\n },\n plugins,\n jsx,\n input,\n platform,\n splitting,\n minify,\n sourceDir,\n metafile: metafile && buildType === 'bundle',\n globals: umdGlobals,\n external: externals,\n autoExternal,\n redirect,\n bundle: buildType === 'bundle',\n sideEffects,\n // outbase for [dir]/[name]\n outbase: sourceDir,\n esbuildOptions,\n };\n\n try {\n const { Libuilder } = await import('@modern-js/libuild');\n const { addOutputChunk } = await import('../utils/print');\n const runner = api.useHookRunners();\n const modifiedBuildConfig = await runner.modifyLibuild(buildConfig, {\n onLast: c => c,\n });\n\n const builder = await Libuilder.create(modifiedBuildConfig);\n await builder.build();\n addOutputChunk(builder.outputChunk, root, buildType === 'bundle');\n\n if (watch) {\n const { watchSectionTitle } = await import('../utils/log');\n const { SectionTitleStatus } = await import('../constants/log');\n const titleText = `[${\n buildType === 'bundle' ? 'Bundle' : 'Bundleless'\n }: ${format}_${target}]`;\n\n logger.info(\n await watchSectionTitle(titleText, SectionTitleStatus.Success),\n );\n }\n } catch (e: any) {\n const { InternalBuildError } = await import('../error');\n throw new InternalBuildError(e, {\n target,\n format,\n buildType,\n });\n }\n};\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":null,"mappings":";;;;;;;;;;;;EAEaA,cAAY,MAAZA;EAMAC,uBAAqB,MAArBA;;;AANN,MAAMD,eAAe,YAAY;AACtC,QAAM,EAAEE,GAAE,IAAK,MAAM,iFAAO;AAC5B,QAAM,EAAEC,iBAAgB,IAAK,MAAM,iFAAO;AAC1C,QAAMD,GAAGE,OAAOD;AAClB;AAEO,MAAMF,wBAAwB,OACnCI,SACAC,YACG;AACH,QAAM,EAAEJ,GAAE,IAAK,MAAM,iFAAO;AAE5B,MAAII,SAAS;AACX;EACF;AAEA,aAAWC,UAAUF,SAAS;AAC5B,UAAMH,GAAGE,OAAOG,OAAOC,MAAM;EAC/B;AACF;","names":["clearDtsTemp","clearBuildConfigPaths","fs","dtsTempDirectory","remove","configs","noClear","config","outDir"],"sources":["../../src/builder/Users/bytedance/github/targeral/modern-js/packages/solutions/module-tools/src/builder/clear.ts"],"sourcesContent":["import type { BaseBuildConfig } from '../types';\n\nexport const clearDtsTemp = async () => {\n const { fs } = await import('@modern-js/utils');\n const { dtsTempDirectory } = await import('../constants/dts');\n await fs.remove(dtsTempDirectory);\n};\n\nexport const clearBuildConfigPaths = async (\n configs: BaseBuildConfig[],\n noClear: boolean,\n) => {\n const { fs } = await import('@modern-js/utils');\n\n if (noClear) {\n return;\n }\n\n for (const config of configs) {\n await fs.remove(config.outDir);\n }\n};\n"]}
1
+ {"version":3,"file":null,"mappings":";;;;;;;;;;;;EAEaA,cAAY,MAAZA;EAMAC,uBAAqB,MAArBA;;;AANN,MAAMD,eAAe,YAAY;AACtC,QAAM,EAAEE,GAAE,IAAK,MAAM,iFAAO;AAC5B,QAAM,EAAEC,iBAAgB,IAAK,MAAM,iFAAO;AAC1C,QAAMD,GAAGE,OAAOD;AAClB;AAEO,MAAMF,wBAAwB,OACnCI,SACAC,YACG;AACH,QAAM,EAAEJ,GAAE,IAAK,MAAM,iFAAO;AAE5B,MAAII,SAAS;AACX;EACF;AAEA,aAAWC,UAAUF,SAAS;AAC5B,UAAMH,GAAGE,OAAOG,OAAOC,MAAM;EAC/B;AACF;","names":["clearDtsTemp","clearBuildConfigPaths","fs","dtsTempDirectory","remove","configs","noClear","config","outDir"],"sources":["../../src/builder/home/runner/work/modern.js/modern.js/packages/solutions/module-tools/src/builder/clear.ts"],"sourcesContent":["import type { BaseBuildConfig } from '../types';\n\nexport const clearDtsTemp = async () => {\n const { fs } = await import('@modern-js/utils');\n const { dtsTempDirectory } = await import('../constants/dts');\n await fs.remove(dtsTempDirectory);\n};\n\nexport const clearBuildConfigPaths = async (\n configs: BaseBuildConfig[],\n noClear: boolean,\n) => {\n const { fs } = await import('@modern-js/utils');\n\n if (noClear) {\n return;\n }\n\n for (const config of configs) {\n await fs.remove(config.outDir);\n }\n};\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":null,"mappings":";;;;;;;;;;;;EAOaA,aAAW,MAAXA;EAyIAC,gBAAc,MAAdA;EAyDAC,UAAQ,MAARA;;;;iEAzMI;wBACM;AAIvB,MAAMC,W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AAK,MAAM,iFAAO;AACvC,QAAMsC,eAAcrB,0FAAYrD,aAAO,QAAnBqD,8DAAqBqB,gBAAe;AACxD,MAAI;AACF,UAAMtC,KACJiB,WAAWmB,UACX,OAAMG,eAAc;UAGAtB;AAFlB,YAAM3D,YAAYiF,YAAY;QAC5B,GAAG3E;QACHO,iBAAgB8C,kCAAWrD,aAAO,QAAlBqD,gEAAoB9C;QACpCyC,QAAQuB,YAAYvB;QACpBjC,gBAAgBwD,YAAYK;MAC9B;IACF,GACA;MAAEF;IAAY;EAElB,SAASG,GAAP;AACA,QAAIA,aAAaC,OAAO;AACtBxB,qBAAO/B,MAAM,eAAesD,EAAEE,SAAS;IACzC;EACF;AACA,MAAI/E,QAAQiD,OAAO;AACjB,UAAMtD,eAAeK,SAASqD;EAChC;AACF;","names":["runPatterns","watchCopyFiles","copyTask","watchMap","Map","pattern","options","fs","fastGlob","globby","default","normalizePath","appDirectory","enableCopySync","from","globOptions","targetPattern","normalizedFrom","path","normalize","defaultAbsContext","defaultContext","context","isAbsolute","join","absoluteFrom","resolve","stats","stat","error","fromType","isDirectory","isFile","glob","posix","escapePath","dot","dirname","globEntries","followSymbolicLinks","cwd","objectMode","pMap","globEntry","dirent","to","toType","extname","slice","sep","relativeFrom","relative","filename","absoluteTo","outDir","watch","set","copySync","copy","copyConfig","logger","createDebugger","debug","SectionTitleStatus","CopyLogPrefix","watchSectionTitle","watchList","Array","keys","changedFilePath","changeType","result","get","formatFilePath","remove","log","Log","buildConfig","patterns","length","concurrency","copyOption","sourceDir","e","Error","message"],"sources":["../../src/builder/Users/bytedance/github/targeral/modern-js/packages/solutions/module-tools/src/builder/copy.ts"],"sourcesContent":["import path from 'path';\nimport { logger } from '@modern-js/utils/logger';\nimport type { CopyOptions, CopyPattern } from '../types/copy';\nimport type { BaseBuildConfig } from '../types/config';\n\nconst watchMap = new Map<string, string>();\n\nexport const runPatterns = async (\n pattern: CopyPattern,\n options: {\n appDirectory: string;\n enableCopySync?: boolean;\n outDir: string;\n defaultContext: string;\n watch?: boolean;\n },\n) => {\n const { fs, fastGlob, globby } = await import('@modern-js/utils');\n const { default: normalizePath } = await import(\n '../../compiled/normalize-path'\n );\n const { appDirectory, enableCopySync = false } = options;\n const { from, globOptions = {} } = pattern;\n const targetPattern: CopyPattern = { ...pattern };\n const normalizedFrom = path.normalize(from);\n const defaultAbsContext = options.defaultContext;\n\n // when context is relative path\n if (typeof pattern.context === 'string') {\n targetPattern.context = path.isAbsolute(pattern.context)\n ? pattern.context\n : path.join(appDirectory, pattern.context);\n } else {\n targetPattern.context = defaultAbsContext;\n }\n\n let absoluteFrom;\n if (path.isAbsolute(normalizedFrom)) {\n absoluteFrom = normalizedFrom;\n } else {\n absoluteFrom = path.resolve(targetPattern.context, normalizedFrom);\n }\n\n let stats;\n try {\n stats = await fs.stat(absoluteFrom);\n } catch (error) {\n // Do Nothing\n }\n\n let fromType: 'file' | 'dir' | 'glob';\n if (stats) {\n if (stats.isDirectory()) {\n fromType = 'dir';\n } else if (stats.isFile()) {\n fromType = 'file';\n } else {\n fromType = 'glob';\n }\n } else {\n fromType = 'glob';\n }\n\n let glob;\n\n switch (fromType) {\n case 'dir':\n targetPattern.context = absoluteFrom;\n glob = path.posix.join(\n fastGlob.escapePath(normalizePath(path.resolve(absoluteFrom))),\n '**/*',\n );\n absoluteFrom = path.join(absoluteFrom, '**/*');\n\n if (typeof globOptions.dot === 'undefined') {\n globOptions.dot = true;\n }\n break;\n case 'file':\n targetPattern.context = path.dirname(absoluteFrom);\n glob = fastGlob.escapePath(normalizePath(path.resolve(absoluteFrom)));\n\n if (typeof globOptions.dot === 'undefined') {\n globOptions.dot = true;\n }\n break;\n case 'glob':\n default: {\n glob = path.isAbsolute(from)\n ? from\n : path.posix.join(\n fastGlob.escapePath(\n normalizePath(\n path.resolve(targetPattern.context ?? appDirectory),\n ),\n ),\n from,\n );\n }\n }\n\n const globEntries = await globby(glob, {\n ...{ followSymbolicLinks: true },\n ...(targetPattern.globOptions || {}),\n cwd: targetPattern.context,\n objectMode: true,\n });\n const { default: pMap } = await import('../../compiled/p-map');\n pMap(globEntries, async globEntry => {\n if (!globEntry.dirent.isFile()) {\n return;\n }\n\n const from = globEntry.path;\n const absoluteFrom = path.resolve(targetPattern.context!, from);\n const to = path.normalize(\n typeof targetPattern.to !== 'undefined' ? targetPattern.to : '',\n );\n const toType =\n path.extname(to) === '' || to.slice(-1) === path.sep ? 'dir' : 'file';\n\n const relativeFrom = path.relative(\n targetPattern.context ?? defaultAbsContext,\n absoluteFrom,\n );\n\n const filename = toType === 'dir' ? path.join(to, relativeFrom) : to;\n\n const absoluteTo = path.isAbsolute(filename)\n ? filename\n : path.join(options.outDir, filename);\n\n if (options.watch) {\n watchMap.set(absoluteFrom, absoluteTo);\n }\n\n if (enableCopySync) {\n fs.copySync(absoluteFrom, absoluteTo);\n } else {\n await fs.copy(absoluteFrom, absoluteTo);\n }\n });\n};\n\nexport const watchCopyFiles = async (\n options: {\n appDirectory: string;\n },\n copyConfig: CopyOptions,\n) => {\n const { watch, fs, logger, createDebugger } = await import(\n '@modern-js/utils'\n );\n const debug = createDebugger('module-tools:copy-watch');\n\n debug('watchMap', watchMap);\n\n const { SectionTitleStatus, CopyLogPrefix } = await import(\n '../constants/log'\n );\n const { watchSectionTitle } = await import('../utils/log');\n const watchList = Array.from(watchMap.keys());\n\n debug('watchList', watchList);\n\n watch(watchList, async ({ changedFilePath, changeType }) => {\n const result = watchMap.get(changedFilePath);\n if (!result) {\n return;\n }\n\n const formatFilePath = path.relative(options.appDirectory, changedFilePath);\n\n if (changeType === 'unlink') {\n fs.remove(result);\n logger.log(\n await watchSectionTitle(\n CopyLogPrefix,\n SectionTitleStatus.Log,\n `${formatFilePath} removed`,\n ),\n );\n return;\n }\n\n if (copyConfig?.options?.enableCopySync) {\n fs.copySync(changedFilePath, result);\n } else {\n await fs.copy(changedFilePath, result);\n }\n\n logger.log(\n await watchSectionTitle(\n CopyLogPrefix,\n SectionTitleStatus.Log,\n `${formatFilePath} changed`,\n ),\n );\n });\n};\n\nexport const copyTask = async (\n buildConfig: BaseBuildConfig,\n options: {\n appDirectory: string;\n watch?: boolean;\n },\n) => {\n const copyConfig = buildConfig.copy;\n\n if (!copyConfig.patterns || copyConfig.patterns.length === 0) {\n return;\n }\n\n const { default: pMap } = await import('../../compiled/p-map');\n const concurrency = copyConfig?.options?.concurrency || 100;\n try {\n await pMap(\n copyConfig.patterns,\n async copyOption => {\n await runPatterns(copyOption, {\n ...options,\n enableCopySync: copyConfig.options?.enableCopySync,\n outDir: buildConfig.outDir,\n defaultContext: buildConfig.sourceDir,\n });\n },\n { concurrency },\n );\n } catch (e) {\n if (e instanceof Error) {\n logger.error(`copy error: ${e.message}`);\n }\n }\n if (options.watch) {\n await watchCopyFiles(options, copyConfig);\n }\n};\n"]}
1
+ {"version":3,"file":null,"mappings":";;;;;;;;;;;;EAOaA,aAAW,MAAXA;EAyIAC,gBAAc,MAAdA;EAyDAC,UAAQ,MAARA;;;;iEAzMI;wBACM;AAIvB,MAAMC,WAAW,oBAAIC;AAEd,MAAMJ,cAAc,OACzBK,SACAC,YAOG;AACH,QAAM,EAAEC,IAAIC,UAAUC,OAAM,IAAK,MAAM,iFAAO;AAC9C,QAAM,EAAEC,SAASC,cAAa,IAAK,MAAM,iFACvC;AAEF,QAAM,EAAEC,cAAcC,iBAAiB,MAAK,IAAKP;AACjD,QAAM,EAAEQ,MAAMC,cAAc,CAAC,EAAC,IAAKV;AACnC,QAAMW,gBAA6B;IAAE,GAAGX;EAAQ;AAChD,QAAMY,iBAAiBC,cAAKC,UAAUL;AACtC,QAAMM,oBAAoBd,QAAQe;AAGlC,MAAI,OAAOhB,QAAQiB,YAAY,UAAU;AACvCN,kBAAcM,UAAUJ,cAAKK,WAAWlB,QAAQiB,OAAO,IACnDjB,QAAQiB,UACRJ,cAAKM,KAAKZ,cAAcP,QAAQiB,OAAO;EAC7C,OAAO;AACLN,kBAAcM,UAAUF;EAC1B;AAEA,MAAIK;AAC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AAC5B,QAAI,CAACE,QAAQ;AACX;IACF;AAEA,UAAME,iBAAiBvD,cAAKiC,SAAS7C,QAAQM,cAAcyD;AAE3D,QAAIC,eAAe,UAAU;AAC3B/D,SAAGmE,OAAOH;AACVX,aAAOe,IACL,MAAMV,kBACJD,eACAD,mBAAmBa,KACnB,GAAGH,wBAAwB;AAG/B;IACF;AAEA,QAAId,0FAAYrD,aAAO,QAAnBqD,8DAAqB9C,gBAAgB;AACvCN,SAAGkD,SAASY,iBAAiBE;IAC/B,OAAO;AACL,YAAMhE,GAAGmD,KAAKW,iBAAiBE;IACjC;AAEAX,WAAOe,IACL,MAAMV,kBACJD,eACAD,mBAAmBa,KACnB,GAAGH,wBAAwB;EAGjC;AACF;AAEO,MAAMvE,WAAW,OACtB2E,aACAvE,YAIG;MAQiBqD;AAPpB,QAAMA,aAAakB,YAAYnB;AAE/B,MAAI,CAACC,WAAWmB,YAAYnB,WAAWmB,SAASC,WAAW,GAAG;AAC5D;EACF;AAEA,QAAM,EAAErE,SAASgC,KAAI,IAAK,MAAM,iFAAO;AACvC,QAAMsC,eAAcrB,0FAAYrD,aAAO,QAAnBqD,8DAAqBqB,gBAAe;AACxD,MAAI;AACF,UAAMtC,KACJiB,WAAWmB,UACX,OAAMG,eAAc;UAGAtB;AAFlB,YAAM3D,YAAYiF,YAAY;QAC5B,GAAG3E;QACHO,iBAAgB8C,kCAAWrD,aAAO,QAAlBqD,gEAAoB9C;QACpCyC,QAAQuB,YAAYvB;QACpBjC,gBAAgBwD,YAAYK;MAC9B;IACF,GACA;MAAEF;IAAY;EAElB,SAASG,GAAP;AACA,QAAIA,aAAaC,OAAO;AACtBxB,qBAAO/B,MAAM,eAAesD,EAAEE,SAAS;IACzC;EACF;AACA,MAAI/E,QAAQiD,OAAO;AACjB,UAAMtD,eAAeK,SAASqD;EAChC;AACF;","names":["runPatterns","watchCopyFiles","copyTask","watchMap","Map","pattern","options","fs","fastGlob","globby","default","normalizePath","appDirectory","enableCopySync","from","globOptions","targetPattern","normalizedFrom","path","normalize","defaultAbsContext","defaultContext","context","isAbsolute","join","absoluteFrom","resolve","stats","stat","error","fromType","isDirectory","isFile","glob","posix","escapePath","dot","dirname","globEntries","followSymbolicLinks","cwd","objectMode","pMap","globEntry","dirent","to","toType","extname","slice","sep","relativeFrom","relative","filename","absoluteTo","outDir","watch","set","copySync","copy","copyConfig","logger","createDebugger","debug","SectionTitleStatus","CopyLogPrefix","watchSectionTitle","watchList","Array","keys","changedFilePath","changeType","result","get","formatFilePath","remove","log","Log","buildConfig","patterns","length","concurrency","copyOption","sourceDir","e","Error","message"],"sources":["../../src/builder/home/runner/work/modern.js/modern.js/packages/solutions/module-tools/src/builder/copy.ts"],"sourcesContent":["import path from 'path';\nimport { logger } from '@modern-js/utils/logger';\nimport type { CopyOptions, CopyPattern } from '../types/copy';\nimport type { BaseBuildConfig } from '../types/config';\n\nconst watchMap = new Map<string, string>();\n\nexport const runPatterns = async (\n pattern: CopyPattern,\n options: {\n appDirectory: string;\n enableCopySync?: boolean;\n outDir: string;\n defaultContext: string;\n watch?: boolean;\n },\n) => {\n const { fs, fastGlob, globby } = await import('@modern-js/utils');\n const { default: normalizePath } = await import(\n '../../compiled/normalize-path'\n );\n const { appDirectory, enableCopySync = false } = options;\n const { from, globOptions = {} } = pattern;\n const targetPattern: CopyPattern = { ...pattern };\n const normalizedFrom = path.normalize(from);\n const defaultAbsContext = options.defaultContext;\n\n // when context is relative path\n if (typeof pattern.context === 'string') {\n targetPattern.context = path.isAbsolute(pattern.context)\n ? pattern.context\n : path.join(appDirectory, pattern.context);\n } else {\n targetPattern.context = defaultAbsContext;\n }\n\n let absoluteFrom;\n if (path.isAbsolute(normalizedFrom)) {\n absoluteFrom = normalizedFrom;\n } else {\n absoluteFrom = path.resolve(targetPattern.context, normalizedFrom);\n }\n\n let stats;\n try {\n stats = await fs.stat(absoluteFrom);\n } catch (error) {\n // Do Nothing\n }\n\n let fromType: 'file' | 'dir' | 'glob';\n if (stats) {\n if (stats.isDirectory()) {\n fromType = 'dir';\n } else if (stats.isFile()) {\n fromType = 'file';\n } else {\n fromType = 'glob';\n }\n } else {\n fromType = 'glob';\n }\n\n let glob;\n\n switch (fromType) {\n case 'dir':\n targetPattern.context = absoluteFrom;\n glob = path.posix.join(\n fastGlob.escapePath(normalizePath(path.resolve(absoluteFrom))),\n '**/*',\n );\n absoluteFrom = path.join(absoluteFrom, '**/*');\n\n if (typeof globOptions.dot === 'undefined') {\n globOptions.dot = true;\n }\n break;\n case 'file':\n targetPattern.context = path.dirname(absoluteFrom);\n glob = fastGlob.escapePath(normalizePath(path.resolve(absoluteFrom)));\n\n if (typeof globOptions.dot === 'undefined') {\n globOptions.dot = true;\n }\n break;\n case 'glob':\n default: {\n glob = path.isAbsolute(from)\n ? from\n : path.posix.join(\n fastGlob.escapePath(\n normalizePath(\n path.resolve(targetPattern.context ?? appDirectory),\n ),\n ),\n from,\n );\n }\n }\n\n const globEntries = await globby(glob, {\n ...{ followSymbolicLinks: true },\n ...(targetPattern.globOptions || {}),\n cwd: targetPattern.context,\n objectMode: true,\n });\n const { default: pMap } = await import('../../compiled/p-map');\n pMap(globEntries, async globEntry => {\n if (!globEntry.dirent.isFile()) {\n return;\n }\n\n const from = globEntry.path;\n const absoluteFrom = path.resolve(targetPattern.context!, from);\n const to = path.normalize(\n typeof targetPattern.to !== 'undefined' ? targetPattern.to : '',\n );\n const toType =\n path.extname(to) === '' || to.slice(-1) === path.sep ? 'dir' : 'file';\n\n const relativeFrom = path.relative(\n targetPattern.context ?? defaultAbsContext,\n absoluteFrom,\n );\n\n const filename = toType === 'dir' ? path.join(to, relativeFrom) : to;\n\n const absoluteTo = path.isAbsolute(filename)\n ? filename\n : path.join(options.outDir, filename);\n\n if (options.watch) {\n watchMap.set(absoluteFrom, absoluteTo);\n }\n\n if (enableCopySync) {\n fs.copySync(absoluteFrom, absoluteTo);\n } else {\n await fs.copy(absoluteFrom, absoluteTo);\n }\n });\n};\n\nexport const watchCopyFiles = async (\n options: {\n appDirectory: string;\n },\n copyConfig: CopyOptions,\n) => {\n const { watch, fs, logger, createDebugger } = await import(\n '@modern-js/utils'\n );\n const debug = createDebugger('module-tools:copy-watch');\n\n debug('watchMap', watchMap);\n\n const { SectionTitleStatus, CopyLogPrefix } = await import(\n '../constants/log'\n );\n const { watchSectionTitle } = await import('../utils/log');\n const watchList = Array.from(watchMap.keys());\n\n debug('watchList', watchList);\n\n watch(watchList, async ({ changedFilePath, changeType }) => {\n const result = watchMap.get(changedFilePath);\n if (!result) {\n return;\n }\n\n const formatFilePath = path.relative(options.appDirectory, changedFilePath);\n\n if (changeType === 'unlink') {\n fs.remove(result);\n logger.log(\n await watchSectionTitle(\n CopyLogPrefix,\n SectionTitleStatus.Log,\n `${formatFilePath} removed`,\n ),\n );\n return;\n }\n\n if (copyConfig?.options?.enableCopySync) {\n fs.copySync(changedFilePath, result);\n } else {\n await fs.copy(changedFilePath, result);\n }\n\n logger.log(\n await watchSectionTitle(\n CopyLogPrefix,\n SectionTitleStatus.Log,\n `${formatFilePath} changed`,\n ),\n );\n });\n};\n\nexport const copyTask = async (\n buildConfig: BaseBuildConfig,\n options: {\n appDirectory: string;\n watch?: boolean;\n },\n) => {\n const copyConfig = buildConfig.copy;\n\n if (!copyConfig.patterns || copyConfig.patterns.length === 0) {\n return;\n }\n\n const { default: pMap } = await import('../../compiled/p-map');\n const concurrency = copyConfig?.options?.concurrency || 100;\n try {\n await pMap(\n copyConfig.patterns,\n async copyOption => {\n await runPatterns(copyOption, {\n ...options,\n enableCopySync: copyConfig.options?.enableCopySync,\n outDir: buildConfig.outDir,\n defaultContext: buildConfig.sourceDir,\n });\n },\n { concurrency },\n );\n } catch (e) {\n if (e instanceof Error) {\n logger.error(`copy error: ${e.message}`);\n }\n }\n if (options.watch) {\n await watchCopyFiles(options, copyConfig);\n }\n};\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":null,"mappings":";;;;;;;;;;;;EAASA,WAAS,MAATA;EACAC,QAAM,MAANA;;wBADiB;qBACH;","names":["runRollup","runTsc"],"sources":["../../../src/builder/dts/Users/bytedance/github/targeral/modern-js/packages/solutions/module-tools/src/builder/dts/index.ts"],"sourcesContent":["export { runRollup } from './rollup';\nexport { runTsc } from './tsc';\n"]}
1
+ {"version":3,"file":null,"mappings":";;;;;;;;;;;;EAASA,WAAS,MAATA;EACAC,QAAM,MAANA;;wBADiB;qBACH;","names":["runRollup","runTsc"],"sources":["../../../src/builder/dts/home/runner/work/modern.js/modern.js/packages/solutions/module-tools/src/builder/dts/index.ts"],"sourcesContent":["export { runRollup } from './rollup';\nexport { runTsc } from './tsc';\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":null,"mappings":";;;;+BA0BaA;;aAAAA;;;;iEA1BI;wBACM;AAyBhB,MAAMA,YAAY,OACvBC,KACA,EACEC,SACAC,cACAC,WACAC,OACAC,OACAC,eAAe,KAAI,MAElB;AACH,QAAMC,cAAsB;IAC1BC,MAAM;IACNC,KAAKC,IAAI;AACP,UAAI,CAAC,kCAAkCC,KAAKD,KAAK;AAC/C,eAAO;MACT;AACA,aAAO;IACT;EACF;AACA,QAAME,KAAK,MAAM,iFAAO;AACxB,QAAMC,aAAaD,GAAGE,eAAeZ,cAAcU,GAAGG,IAAIC,QAAQ;AAClE,QAAM,EAAEC,QAAO,IAAKL,GAAGM,2BACrBL,WAAWM,QACXP,GAAGG,KACH;AAGF,QAAM,EAAEK,SAASC,WAAU,IAAK,MAAM,iFACpC;AAEF,QAAM,EAAED,SAASE,UAAS,IAAK,MAAM,iFACnC;AAEF,QAAM,EAAEC,wBAAuB,IAAK,MAAM,iFAAO;AAEjD,QAAMC,UAAUC,cAAKC,WAAWT,QAAQO,WAAW,OAC/CP,QAAQO,UACRC,cAAKE,KAAKF,cAAKG,QAAQ1B,eAAee,QAAQO,WAAW;AAC7D,QAAMK,uBAAuB;IAC3B;IACA;IACA;IACA;;AAGF,QAAMC,cAA4B;IAChC1B;IACA2B,UAAU5B;IACV6B,SAAS;M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1CL,qBAAeE,cAAcE,cAAczB,aAAaC,GAAG;AAC3D,aAAOqB;IACT,SAASK,GAAP;AACA,YAAM,EAAEC,sBAAqB,IAAK,MAAM,iFAAO;AAC/C,YAAMA,sBAAsBD,GAAG;QAAEvE;QAAc+D,WAAW;MAAS;AACnE,aAAO;IACT;EACF;AACF;","names":["runRollup","api","distDir","tsconfigPath","externals","input","watch","abortOnError","ignoreFiles","name","load","id","test","ts","configFile","readConfigFile","sys","readFile","options","parseJsonConfigFileContent","config","default","jsonPlugin","dtsPlugin","transformUndefineObject","baseUrl","path","isAbsolute","join","dirname","ignoreCompileOptions","inputConfig","external","plugins","respectExternal","compilerOptions","declarationMap","skipLibCheck","preserveSymlinks","composite","declaration","noEmit","emitDeclarationOnly","noEmitOnError","checkJs","target","ScriptTarget","ESNext","tsconfig","filter","Boolean","outputConfig","dir","format","exports","watchSectionTitle","SectionTitleStatus","BundleDtsLogPrefix","runner","useHookRunners","watcher","output","on","event","code","logger","info","Log","Success","buildWatchDts","buildType","rollup","addRollupChunk","bundle","rollupOutput","write","appDirectory","useAppContext","e","printOrThrowDtsErrors"],"sources":["../../../src/builder/dts/Users/bytedance/github/targeral/modern-js/packages/solutions/module-tools/src/builder/dts/rollup.ts"],"sourcesContent":["import path from 'path';\nimport { logger } from '@modern-js/utils/logger';\nimport type {\n InputOptions,\n OutputOptions,\n Plugin,\n RollupWatcher,\n} from '../../../compiled/rollup';\nimport type {\n BaseBuildConfig,\n Input,\n PluginAPI,\n ModuleTools,\n} from '../../types';\n\nexport type { RollupWatcher };\n\ntype Config = {\n distDir: string;\n tsconfigPath: string;\n externals: BaseBuildConfig['externals'];\n input: Input;\n watch: boolean;\n abortOnError?: boolean;\n};\n\nexport const runRollup = async (\n api: PluginAPI<ModuleTools>,\n {\n distDir,\n tsconfigPath,\n externals,\n input,\n watch,\n abortOnError = true,\n }: Config,\n) => {\n const ignoreFiles: Plugin = {\n name: 'ignore-files',\n load(id) {\n if (!/\\.(js|jsx|ts|tsx|json|cts|mts)$/.test(id)) {\n return '';\n }\n return null;\n },\n };\n const ts = await import('typescript');\n const configFile = ts.readConfigFile(tsconfigPath, ts.sys.readFile);\n const { options } = ts.parseJsonConfigFileContent(\n configFile.config,\n ts.sys,\n './',\n );\n\n const { default: jsonPlugin } = await import(\n '../../../compiled/@rollup/plugin-json'\n );\n const { default: dtsPlugin } = await import(\n '../../../compiled/rollup-plugin-dts'\n );\n const { transformUndefineObject } = await import('../../utils/common');\n\n const baseUrl = path.isAbsolute(options.baseUrl || '.')\n ? options.baseUrl\n : path.join(path.dirname(tsconfigPath), options.baseUrl || '.');\n const ignoreCompileOptions = [\n 'incremental',\n 'tsBuildInfoFile',\n 'sourceMap',\n 'inlineSources',\n ];\n\n const inputConfig: InputOptions = {\n input,\n external: externals,\n plugins: [\n jsonPlugin(),\n ignoreFiles,\n dtsPlugin({\n // use external to prevent them which come from node_modules from be bundled.\n respectExternal: true,\n compilerOptions: {\n declarationMap: false,\n skipLibCheck: true,\n // https://github.com/Swatinem/rollup-plugin-dts/issues/143,\n // but it will cause error when bundle ts which import another ts file.\n preserveSymlinks: false,\n ...options,\n // https://github.com/Swatinem/rollup-plugin-dts/issues/127\n composite: false,\n // isAbsolute\n baseUrl,\n // Ensure \".d.ts\" modules are generated\n declaration: true,\n // Skip \".js\" generation\n noEmit: false,\n emitDeclarationOnly: true,\n // Skip code generation when error occurs\n noEmitOnError: true,\n // Avoid extra work\n checkJs: false,\n // Ensure we can parse the latest code\n target: ts.ScriptTarget.ESNext,\n ...transformUndefineObject(ignoreCompileOptions),\n },\n tsconfig: tsconfigPath,\n }),\n ].filter(Boolean),\n };\n const outputConfig: OutputOptions = {\n dir: distDir,\n format: 'esm',\n exports: 'named',\n };\n if (watch) {\n const { watch } = await import('../../../compiled/rollup');\n const { watchSectionTitle } = await import('../../utils/log');\n const { SectionTitleStatus, BundleDtsLogPrefix } = await import(\n '../../constants/log'\n );\n const runner = api.useHookRunners();\n const watcher = watch({\n ...inputConfig,\n plugins: inputConfig.plugins,\n output: outputConfig,\n }).on('event', async event => {\n if (event.code === 'START') {\n logger.info(\n await watchSectionTitle(BundleDtsLogPrefix, SectionTitleStatus.Log),\n );\n } else if (event.code === 'BUNDLE_END') {\n logger.info(\n await watchSectionTitle(\n BundleDtsLogPrefix,\n SectionTitleStatus.Success,\n ),\n );\n runner.buildWatchDts({ buildType: 'bundle' });\n } else if (event.code === 'ERROR') {\n // this is dts rollup plugin bug, error not complete message\n }\n });\n return watcher;\n } else {\n try {\n const { rollup } = await import('../../../compiled/rollup');\n const { addRollupChunk } = await import('../../utils/print');\n const bundle = await rollup(inputConfig);\n const rollupOutput = await bundle.write(outputConfig);\n const { appDirectory } = api.useAppContext();\n addRollupChunk(rollupOutput, appDirectory, outputConfig.dir!);\n return bundle;\n } catch (e) {\n const { printOrThrowDtsErrors } = await import('../../utils/dts');\n await printOrThrowDtsErrors(e, { abortOnError, buildType: 'bundle' });\n return null;\n }\n }\n};\n"]}
1
+ {"version":3,"file":null,"mappings":";;;;+BA0BaA;;aAAAA;;;;iEA1BI;wBACM;AAyBhB,MAAMA,YAAY,OACvBC,KACA,EACEC,SACAC,cACAC,WACAC,OACAC,OACAC,eAAe,KAAI,MAElB;AACH,QAAMC,cAAsB;IAC1BC,MAAM;IACNC,KAAKC,IAAI;AACP,UAAI,CAAC,kCAAkCC,KAAKD,KAAK;AAC/C,eAAO;MACT;AACA,aAAO;IACT;EACF;AACA,QAAME,KAAK,MAAM,iFAAO;AACxB,QAAMC,aAAaD,GAAGE,eAAeZ,cAAcU,GAAGG,IAAIC,QAAQ;AAClE,QAAM,EAAEC,QAAO,IAAKL,GAAGM,2BACrBL,WAAWM,QACXP,GAAGG,KACH;AAGF,QAAM,EAAEK,SAASC,WAAU,IAAK,MAAM,iFACpC;AAEF,QAAM,EAAED,SAASE,UAAS,IAAK,MAAM,iFACnC;AAEF,QAAM,EAAEC,wBAAuB,IAAK,MAAM,iFAAO;AAEjD,QAAMC,UAAUC,cAAK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AM,IAAK,MAAM,iFAAO;AAChC,YAAM,EAAEC,eAAc,IAAK,MAAM,iFAAO;AACxC,YAAMC,SAAS,MAAMF,OAAOxC;AAC5B,YAAM2C,eAAe,MAAMD,OAAOE,MAAMxB;AACxC,YAAM,EAAEyB,aAAY,IAAK3E,IAAI4E,cAAa;AAC1CL,qBAAeE,cAAcE,cAAczB,aAAaC,GAAG;AAC3D,aAAOqB;IACT,SAASK,GAAP;AACA,YAAM,EAAEC,sBAAqB,IAAK,MAAM,iFAAO;AAC/C,YAAMA,sBAAsBD,GAAG;QAAEvE;QAAc+D,WAAW;MAAS;AACnE,aAAO;IACT;EACF;AACF;","names":["runRollup","api","distDir","tsconfigPath","externals","input","watch","abortOnError","ignoreFiles","name","load","id","test","ts","configFile","readConfigFile","sys","readFile","options","parseJsonConfigFileContent","config","default","jsonPlugin","dtsPlugin","transformUndefineObject","baseUrl","path","isAbsolute","join","dirname","ignoreCompileOptions","inputConfig","external","plugins","respectExternal","compilerOptions","declarationMap","skipLibCheck","preserveSymlinks","composite","declaration","noEmit","emitDeclarationOnly","noEmitOnError","checkJs","target","ScriptTarget","ESNext","tsconfig","filter","Boolean","outputConfig","dir","format","exports","watchSectionTitle","SectionTitleStatus","BundleDtsLogPrefix","runner","useHookRunners","watcher","output","on","event","code","logger","info","Log","Success","buildWatchDts","buildType","rollup","addRollupChunk","bundle","rollupOutput","write","appDirectory","useAppContext","e","printOrThrowDtsErrors"],"sources":["../../../src/builder/dts/home/runner/work/modern.js/modern.js/packages/solutions/module-tools/src/builder/dts/rollup.ts"],"sourcesContent":["import path from 'path';\nimport { logger } from '@modern-js/utils/logger';\nimport type {\n InputOptions,\n OutputOptions,\n Plugin,\n RollupWatcher,\n} from '../../../compiled/rollup';\nimport type {\n BaseBuildConfig,\n Input,\n PluginAPI,\n ModuleTools,\n} from '../../types';\n\nexport type { RollupWatcher };\n\ntype Config = {\n distDir: string;\n tsconfigPath: string;\n externals: BaseBuildConfig['externals'];\n input: Input;\n watch: boolean;\n abortOnError?: boolean;\n};\n\nexport const runRollup = async (\n api: PluginAPI<ModuleTools>,\n {\n distDir,\n tsconfigPath,\n externals,\n input,\n watch,\n abortOnError = true,\n }: Config,\n) => {\n const ignoreFiles: Plugin = {\n name: 'ignore-files',\n load(id) {\n if (!/\\.(js|jsx|ts|tsx|json|cts|mts)$/.test(id)) {\n return '';\n }\n return null;\n },\n };\n const ts = await import('typescript');\n const configFile = ts.readConfigFile(tsconfigPath, ts.sys.readFile);\n const { options } = ts.parseJsonConfigFileContent(\n configFile.config,\n ts.sys,\n './',\n );\n\n const { default: jsonPlugin } = await import(\n '../../../compiled/@rollup/plugin-json'\n );\n const { default: dtsPlugin } = await import(\n '../../../compiled/rollup-plugin-dts'\n );\n const { transformUndefineObject } = await import('../../utils/common');\n\n const baseUrl = path.isAbsolute(options.baseUrl || '.')\n ? options.baseUrl\n : path.join(path.dirname(tsconfigPath), options.baseUrl || '.');\n const ignoreCompileOptions = [\n 'incremental',\n 'tsBuildInfoFile',\n 'sourceMap',\n 'inlineSources',\n ];\n\n const inputConfig: InputOptions = {\n input,\n external: externals,\n plugins: [\n jsonPlugin(),\n ignoreFiles,\n dtsPlugin({\n // use external to prevent them which come from node_modules from be bundled.\n respectExternal: true,\n compilerOptions: {\n declarationMap: false,\n skipLibCheck: true,\n // https://github.com/Swatinem/rollup-plugin-dts/issues/143,\n // but it will cause error when bundle ts which import another ts file.\n preserveSymlinks: false,\n ...options,\n // https://github.com/Swatinem/rollup-plugin-dts/issues/127\n composite: false,\n // isAbsolute\n baseUrl,\n // Ensure \".d.ts\" modules are generated\n declaration: true,\n // Skip \".js\" generation\n noEmit: false,\n emitDeclarationOnly: true,\n // Skip code generation when error occurs\n noEmitOnError: true,\n // Avoid extra work\n checkJs: false,\n // Ensure we can parse the latest code\n target: ts.ScriptTarget.ESNext,\n ...transformUndefineObject(ignoreCompileOptions),\n },\n tsconfig: tsconfigPath,\n }),\n ].filter(Boolean),\n };\n const outputConfig: OutputOptions = {\n dir: distDir,\n format: 'esm',\n exports: 'named',\n };\n if (watch) {\n const { watch } = await import('../../../compiled/rollup');\n const { watchSectionTitle } = await import('../../utils/log');\n const { SectionTitleStatus, BundleDtsLogPrefix } = await import(\n '../../constants/log'\n );\n const runner = api.useHookRunners();\n const watcher = watch({\n ...inputConfig,\n plugins: inputConfig.plugins,\n output: outputConfig,\n }).on('event', async event => {\n if (event.code === 'START') {\n logger.info(\n await watchSectionTitle(BundleDtsLogPrefix, SectionTitleStatus.Log),\n );\n } else if (event.code === 'BUNDLE_END') {\n logger.info(\n await watchSectionTitle(\n BundleDtsLogPrefix,\n SectionTitleStatus.Success,\n ),\n );\n runner.buildWatchDts({ buildType: 'bundle' });\n } else if (event.code === 'ERROR') {\n // this is dts rollup plugin bug, error not complete message\n }\n });\n return watcher;\n } else {\n try {\n const { rollup } = await import('../../../compiled/rollup');\n const { addRollupChunk } = await import('../../utils/print');\n const bundle = await rollup(inputConfig);\n const rollupOutput = await bundle.write(outputConfig);\n const { appDirectory } = api.useAppContext();\n addRollupChunk(rollupOutput, appDirectory, outputConfig.dir!);\n return bundle;\n } catch (e) {\n const { printOrThrowDtsErrors } = await import('../../utils/dts');\n await printOrThrowDtsErrors(e, { abortOnError, buildType: 'bundle' });\n return null;\n }\n }\n};\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":null,"mappings":";;;;;;;;;;;;EASaA,oBAAkB,MAAlBA;EA2GAC,QAAM,MAANA;;;uBAnHU;AAQhB,MAAMD,qBAAqB,OAChCE,iBACuB;AACvB,QAAM,EAAEC,OAAOC,GAAE,IAAK,MAAM,iFAAO;AACnC,MAAI,CAACA,GAAGC,WAAWH,eAAe;AAChC,WAAO,CAAC;EACV;AAEA,SAAOC,MAAMG,MAAMF,GAAGG,aAAaL,cAAc;AACnD;AAEA,MAAMM,aAAa,OACjBC,eACAC,YAIG;MAaHD,uBAYAA,wBAGAA;AA3BA,QAAM,EAAEE,QAAQ,OAAOC,UAAU,YAAYC,OAAS,I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YAAM,EAAEoC,aAAY,IAAK,MAAM,iFAAO;AACtC,YAAMA,aAAahB,QAAQ;QAAE,GAAGQ;QAAQD;MAAa;AACrDO,aAAOG,cAAc;QAAEC,WAAW;MAAa;IACjD;EACF;AAEA,MAAI;AACF,UAAMzC;EACR,SAAS0C,GAAP;AACA,UAAMhB,sBAAsBgB,GAAG;MAAEb;MAAcY,WAAW;IAAa;EACzE;AAEA,SAAO;IAAE,GAAGV;IAAQD;EAAa;AACnC;AAEO,MAAMtC,SAAS,OACpB8B,KACAC,WACG;AACH,QAAM,EAAEgB,aAAY,IAAK,MAAM,iFAAO;AACtC,QAAM,EAAEI,YAAW,IAAK,MAAM,iFAAO;AACrC,QAAMZ,SAAS,MAAMV,aAAaC,KAAKC;AACvC,QAAMgB,aAAahB,QAAQQ;AAC3B,QAAMY,YAAYpB,OAAOqB,aAAarB,OAAOK,YAAY;AAC3D;","names":["getProjectTsconfig","runTsc","tsconfigPath","json5","fs","existsSync","parse","readFileSync","resolveLog","childProgress","options","watch","watchFn","undefined","SectionTitleStatus","BundlelessDtsLogPrefix","watchSectionTitle","watchDoneText","stdout","on","data","logger","info","Log","toString","includes","error","message","stderr","chunk","generatorDts","api","config","execa","generatorTsConfig","printOrThrowDtsErrors","getTscBinPath","appDirectory","abortOnError","userTsconfig","result","tscBinFile","watchParams","tempTsconfigPath","stdio","cwd","runner","useHookRunners","resolveAlias","buildWatchDts","buildType","e","addDtsFiles","distAbsPath"],"sources":["../../../src/builder/dts/Users/bytedance/github/targeral/modern-js/packages/solutions/module-tools/src/builder/dts/tsc.ts"],"sourcesContent":["import type { ChildProcess } from 'child_process';\nimport { logger } from '@modern-js/utils';\nimport type {\n BundlelessGeneratorDtsConfig,\n ITsconfig,\n PluginAPI,\n ModuleTools,\n} from '../../types';\n\nexport const getProjectTsconfig = async (\n tsconfigPath: string,\n): Promise<ITsconfig> => {\n const { json5, fs } = await import('@modern-js/utils');\n if (!fs.existsSync(tsconfigPath)) {\n return {};\n }\n\n return json5.parse(fs.readFileSync(tsconfigPath, 'utf-8'));\n};\n\nconst resolveLog = async (\n childProgress: ChildProcess,\n options: {\n watch: boolean;\n watchFn: () => Promise<void>;\n },\n) => {\n const { watch = false, watchFn = async () => undefined } = options;\n const { SectionTitleStatus, BundlelessDtsLogPrefix } = await import(\n '../../constants/log'\n );\n const { watchSectionTitle } = await import('../../utils/log');\n const { watchDoneText } = await import('../../constants/dts');\n\n /**\n * tsc 所有的log信息都是从stdout data 事件中获取\n * 正常模式下,如果有报错信息,交给 resolveLog 后面的逻辑来处理\n * watch 模式下,则使用这里的信息\n */\n childProgress.stdout?.on('data', async data => {\n if (watch) {\n logger.info(\n await watchSectionTitle(BundlelessDtsLogPrefix, SectionTitleStatus.Log),\n );\n logger.info(data.toString());\n if (data.toString().includes(watchDoneText)) {\n await watchFn();\n }\n }\n });\n // 正常以下内容都不会触发,因为tsc 不会产生以下类型的log信息,不过防止意外情况\n childProgress.stdout?.on('error', error => {\n logger.error(error.message);\n });\n childProgress.stderr?.on('data', chunk => {\n logger.error(chunk.toString());\n });\n};\n\nconst generatorDts = async (\n api: PluginAPI<ModuleTools>,\n config: BundlelessGeneratorDtsConfig,\n) => {\n const { execa } = await import('@modern-js/utils');\n const { generatorTsConfig, printOrThrowDtsErrors } = await import(\n '../../utils/dts'\n );\n const { getTscBinPath } = await import('../../utils/dts');\n const {\n tsconfigPath,\n appDirectory,\n watch = false,\n abortOnError = true,\n } = config;\n const userTsconfig = await getProjectTsconfig(tsconfigPath);\n const result = await generatorTsConfig(config);\n\n const tscBinFile = await getTscBinPath(appDirectory);\n\n const watchParams = watch ? ['-w'] : [];\n const childProgress = execa(\n tscBinFile,\n [\n '-p',\n result.tempTsconfigPath,\n /* Required parameter, use it stdout have color */\n '--pretty',\n // https://github.com/microsoft/TypeScript/issues/21824\n '--preserveWatchOutput',\n ...watchParams,\n ],\n {\n stdio: 'pipe',\n cwd: appDirectory,\n },\n );\n\n const runner = api.useHookRunners();\n resolveLog(childProgress, {\n watch,\n watchFn: async () => {\n const { resolveAlias } = await import('../../utils/dts');\n await resolveAlias(config, { ...result, userTsconfig });\n runner.buildWatchDts({ buildType: 'bundleless' });\n },\n });\n\n try {\n await childProgress;\n } catch (e) {\n await printOrThrowDtsErrors(e, { abortOnError, buildType: 'bundleless' });\n }\n\n return { ...result, userTsconfig };\n};\n\nexport const runTsc = async (\n api: PluginAPI<ModuleTools>,\n config: BundlelessGeneratorDtsConfig,\n) => {\n const { resolveAlias } = await import('../../utils/dts');\n const { addDtsFiles } = await import('../../utils/print');\n const result = await generatorDts(api, config);\n await resolveAlias(config, result);\n await addDtsFiles(config.distAbsPath, config.appDirectory);\n};\n"]}
1
+ {"version":3,"file":null,"mappings":";;;;;;;;;;;;EASaA,oBAAkB,MAAlBA;EA2GAC,QAAM,MAANA;;;uBAnHU;AAQhB,MAAMD,qBAAqB,OAChCE,iBACuB;AACvB,QAAM,EAAEC,OAAOC,GAAE,IAAK,MAAM,iFAAO;AACnC,MAAI,CAACA,GAAGC,WAAWH,eAAe;AAChC,WAAO,CAAC;EACV;AAEA,SAAOC,MAAMG,MAAMF,GAAGG,aAAaL,cAAc;AACnD;AAEA,MAAMM,aAAa,OACjBC,eACAC,YAIG;MAaHD,uBAYAA,wBAGAA;AA3BA,QAAM,EAAEE,QAAQ,OAAOC,UAAU,YAAYC,OAAS,IAAKH;AAC3D,QAAM,EAAEI,oBAAoBC,uBAAsB,IAAK,MAAM,iFAC3D;AAEF,QAAM,EAAEC,kBAAiB,IAAK,MAAM,iFAAO;AAC3C,QAAM,EAAEC,cAAa,IAAK,MAAM,iFAAO;AAOvCR,yCAAcS,YAAM,QAApBT,kEAAsBU,GAAG,QAAQ,OAAMC,SAAQ;AAC7C,QAAIT,OAAO;AACTU,oBAAOC,KACL,MAAMN,kBAAkBD,wBAAwBD,mBAAmBS,GAAG;AAExEF,oBAAOC,KAAKF,KAAKI,SAAQ;AACzB,UAAIJ,KAAKI,SAAQ,EAAGC,SAASR,gBAAg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,EAAEI,YAAW,IAAK,MAAM,iFAAO;AACrC,QAAMZ,SAAS,MAAMV,aAAaC,KAAKC;AACvC,QAAMgB,aAAahB,QAAQQ;AAC3B,QAAMY,YAAYpB,OAAOqB,aAAarB,OAAOK,YAAY;AAC3D;","names":["getProjectTsconfig","runTsc","tsconfigPath","json5","fs","existsSync","parse","readFileSync","resolveLog","childProgress","options","watch","watchFn","undefined","SectionTitleStatus","BundlelessDtsLogPrefix","watchSectionTitle","watchDoneText","stdout","on","data","logger","info","Log","toString","includes","error","message","stderr","chunk","generatorDts","api","config","execa","generatorTsConfig","printOrThrowDtsErrors","getTscBinPath","appDirectory","abortOnError","userTsconfig","result","tscBinFile","watchParams","tempTsconfigPath","stdio","cwd","runner","useHookRunners","resolveAlias","buildWatchDts","buildType","e","addDtsFiles","distAbsPath"],"sources":["../../../src/builder/dts/home/runner/work/modern.js/modern.js/packages/solutions/module-tools/src/builder/dts/tsc.ts"],"sourcesContent":["import type { ChildProcess } from 'child_process';\nimport { logger } from '@modern-js/utils';\nimport type {\n BundlelessGeneratorDtsConfig,\n ITsconfig,\n PluginAPI,\n ModuleTools,\n} from '../../types';\n\nexport const getProjectTsconfig = async (\n tsconfigPath: string,\n): Promise<ITsconfig> => {\n const { json5, fs } = await import('@modern-js/utils');\n if (!fs.existsSync(tsconfigPath)) {\n return {};\n }\n\n return json5.parse(fs.readFileSync(tsconfigPath, 'utf-8'));\n};\n\nconst resolveLog = async (\n childProgress: ChildProcess,\n options: {\n watch: boolean;\n watchFn: () => Promise<void>;\n },\n) => {\n const { watch = false, watchFn = async () => undefined } = options;\n const { SectionTitleStatus, BundlelessDtsLogPrefix } = await import(\n '../../constants/log'\n );\n const { watchSectionTitle } = await import('../../utils/log');\n const { watchDoneText } = await import('../../constants/dts');\n\n /**\n * tsc 所有的log信息都是从stdout data 事件中获取\n * 正常模式下,如果有报错信息,交给 resolveLog 后面的逻辑来处理\n * watch 模式下,则使用这里的信息\n */\n childProgress.stdout?.on('data', async data => {\n if (watch) {\n logger.info(\n await watchSectionTitle(BundlelessDtsLogPrefix, SectionTitleStatus.Log),\n );\n logger.info(data.toString());\n if (data.toString().includes(watchDoneText)) {\n await watchFn();\n }\n }\n });\n // 正常以下内容都不会触发,因为tsc 不会产生以下类型的log信息,不过防止意外情况\n childProgress.stdout?.on('error', error => {\n logger.error(error.message);\n });\n childProgress.stderr?.on('data', chunk => {\n logger.error(chunk.toString());\n });\n};\n\nconst generatorDts = async (\n api: PluginAPI<ModuleTools>,\n config: BundlelessGeneratorDtsConfig,\n) => {\n const { execa } = await import('@modern-js/utils');\n const { generatorTsConfig, printOrThrowDtsErrors } = await import(\n '../../utils/dts'\n );\n const { getTscBinPath } = await import('../../utils/dts');\n const {\n tsconfigPath,\n appDirectory,\n watch = false,\n abortOnError = true,\n } = config;\n const userTsconfig = await getProjectTsconfig(tsconfigPath);\n const result = await generatorTsConfig(config);\n\n const tscBinFile = await getTscBinPath(appDirectory);\n\n const watchParams = watch ? ['-w'] : [];\n const childProgress = execa(\n tscBinFile,\n [\n '-p',\n result.tempTsconfigPath,\n /* Required parameter, use it stdout have color */\n '--pretty',\n // https://github.com/microsoft/TypeScript/issues/21824\n '--preserveWatchOutput',\n ...watchParams,\n ],\n {\n stdio: 'pipe',\n cwd: appDirectory,\n },\n );\n\n const runner = api.useHookRunners();\n resolveLog(childProgress, {\n watch,\n watchFn: async () => {\n const { resolveAlias } = await import('../../utils/dts');\n await resolveAlias(config, { ...result, userTsconfig });\n runner.buildWatchDts({ buildType: 'bundleless' });\n },\n });\n\n try {\n await childProgress;\n } catch (e) {\n await printOrThrowDtsErrors(e, { abortOnError, buildType: 'bundleless' });\n }\n\n return { ...result, userTsconfig };\n};\n\nexport const runTsc = async (\n api: PluginAPI<ModuleTools>,\n config: BundlelessGeneratorDtsConfig,\n) => {\n const { resolveAlias } = await import('../../utils/dts');\n const { addDtsFiles } = await import('../../utils/print');\n const result = await generatorDts(api, config);\n await resolveAlias(config, result);\n await addDtsFiles(config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3B,OAAO4B,WAAW;IACtBR,QAAQ;IACRL,QAAQlB;IACRgC,gBAAgB9B;IAChBG;EACF;AACF;","names":["run","options","api","chalk","resolvedBuildConfig","context","cmdOptions","runner","useHookRunners","totalDuration","length","Date","now","runBuildTask","default","pMap","clearBuildConfigPaths","clearDtsTemp","clear","watch","logger","info","config","buildConfig","beforeBuildTask","buildCmdOptions","afterBuildTask","status","e","isInternalError","ModuleBuildError","printFileSize","printSucceed","warn","yellow","afterBuild","commandOptions"],"sources":["../../src/builder/Users/bytedance/github/targeral/modern-js/packages/solutions/module-tools/src/builder/index.ts"],"sourcesContent":["import type { PluginAPI } from '@modern-js/core';\nimport { logger } from '@modern-js/utils/logger';\nimport type { ModuleContext } from '../types/context';\nimport type {\n BuildCommandOptions,\n BaseBuildConfig,\n ModuleTools,\n} from '../types';\n\nexport const run = async (\n options: {\n cmdOptions: BuildCommandOptions;\n resolvedBuildConfig: BaseBuildConfig[];\n context: ModuleContext;\n },\n api: PluginAPI<ModuleTools>,\n) => {\n const { chalk } = await import('@modern-js/utils');\n const { resolvedBuildConfig, context, cmdOptions } = options;\n const runner = api.useHookRunners();\n\n let totalDuration = 0;\n\n if (resolvedBuildConfig.length !== 0) {\n totalDuration = Date.now();\n\n const { runBuildTask } = await import('./build');\n const { default: pMap } = await import('../../compiled/p-map');\n\n const { clearBuildConfigPaths, clearDtsTemp } = await import('./clear');\n await clearBuildConfigPaths(resolvedBuildConfig, !cmdOptions.clear);\n await clearDtsTemp();\n\n if (cmdOptions.watch) {\n logger.info('Start build in watch mode...\\n');\n }\n\n try {\n await pMap(resolvedBuildConfig, async config => {\n const buildConfig = await runner.beforeBuildTask(config);\n\n await runBuildTask(\n {\n buildConfig,\n buildCmdOptions: cmdOptions,\n context,\n },\n api,\n );\n await runner.afterBuildTask({ status: 'success', config });\n });\n } catch (e) {\n const { isInternalError, ModuleBuildError } = await import('../error');\n if (isInternalError(e)) {\n throw new ModuleBuildError(e);\n } else {\n throw e;\n }\n }\n totalDuration = Date.now() - totalDuration;\n if (!cmdOptions.watch) {\n const { printFileSize, printSucceed } = await import('../utils/print');\n printSucceed(totalDuration);\n printFileSize();\n }\n } else {\n logger.warn(\n chalk.yellow(\n `No build configuration found! Please configure \\`buildConfig\\` or \\`buildPreset\\``,\n ),\n );\n }\n\n await runner.afterBuild({\n status: 'success',\n config: resolvedBuildConfig,\n commandOptions: cmdOptions,\n totalDuration,\n });\n};\n"]}
1
+ {"version":3,"file":null,"mappings":";;;;+BASaA;;aAAAA;;;wBARU;AAQhB,MAAMA,MAAM,OACjBC,SAKAC,QACG;AACH,QAAM,EAAEC,MAAK,IAAK,MAAM,iFAAO;AAC/B,QAAM,EAAEC,qBAAqBC,SAASC,WAAU,IAAKL;AACrD,QAAMM,SAASL,IAAIM,eAAc;AAEjC,MAAIC,gBAAgB;AAEpB,MAAIL,oBAAoBM,WAAW,GAAG;AACpCD,oBAAgBE,KAAKC,IAAG;AAExB,UAAM,EAAEC,aAAY,IAAK,MAAM,iFAAO;AACtC,UAAM,EAAEC,SAASC,KAAI,IAAK,MAAM,iFAAO;AAEvC,UAAM,EAAEC,uBAAuBC,aAAY,IAAK,MAAM,iFAAO;AAC7D,UAAMD,sBAAsBZ,qBAAqB,CAACE,WAAWY,KAAK;AAClE,UAAMD;AAEN,QAAIX,WAAWa,OAAO;AACpBC,qBAAOC,KAAK;IACd;AAEA,QAAI;AACF,YAAMN,KAAKX,qBAAqB,OAAMkB,WAAU;AAC9C,cAAMC,cAAc,MAAMhB,OAAOiB,gBAAgBF;AAEjD,cAAMT,aACJ;UACEU;UACAE,iBAAiBnB;UACjBD;QACF,GACAH;AAEF,cAAMK,OAAOmB,eAAe;UAAEC,QAAQ;UAAWL;QAAO;MAC1D;IACF,SAASM,GAAP;AACA,YAAM,EAAEC,iBAAiBC,iBAAgB,IAAK,MAAM,iFAAO;AAC3D,UAAID,gBAAgBD,IAAI;AACtB,cAAM,IAAIE,iBAAiBF;MAC7B,OAAO;AACL,cAAMA;MACR;IACF;AACAnB,oBAAgBE,KAAKC,IAAG,IAAKH;AAC7B,QAAI,CAACH,WAAWa,OAAO;AACrB,YAAM,EAAEY,eAAeC,aAAY,IAAK,MAAM,iFAAO;AACrDA,mBAAavB;AACbsB;IACF;EACF,OAAO;AACLX,mBAAOa,KACL9B,MAAM+B,OACJ,mFAAmF;EAGzF;AAEA,QAAM3B,OAAO4B,WAAW;IACtBR,QAAQ;IACRL,QAAQlB;IACRgC,gBAAgB9B;IAChBG;EACF;AACF;","names":["run","options","api","chalk","resolvedBuildConfig","context","cmdOptions","runner","useHookRunners","totalDuration","length","Date","now","runBuildTask","default","pMap","clearBuildConfigPaths","clearDtsTemp","clear","watch","logger","info","config","buildConfig","beforeBuildTask","buildCmdOptions","afterBuildTask","status","e","isInternalError","ModuleBuildError","printFileSize","printSucceed","warn","yellow","afterBuild","commandOptions"],"sources":["../../src/builder/home/runner/work/modern.js/modern.js/packages/solutions/module-tools/src/builder/index.ts"],"sourcesContent":["import type { PluginAPI } from '@modern-js/core';\nimport { logger } from '@modern-js/utils/logger';\nimport type { ModuleContext } from '../types/context';\nimport type {\n BuildCommandOptions,\n BaseBuildConfig,\n ModuleTools,\n} from '../types';\n\nexport const run = async (\n options: {\n cmdOptions: BuildCommandOptions;\n resolvedBuildConfig: BaseBuildConfig[];\n context: ModuleContext;\n },\n api: PluginAPI<ModuleTools>,\n) => {\n const { chalk } = await import('@modern-js/utils');\n const { resolvedBuildConfig, context, cmdOptions } = options;\n const runner = api.useHookRunners();\n\n let totalDuration = 0;\n\n if (resolvedBuildConfig.length !== 0) {\n totalDuration = Date.now();\n\n const { runBuildTask } = await import('./build');\n const { default: pMap } = await import('../../compiled/p-map');\n\n const { clearBuildConfigPaths, clearDtsTemp } = await import('./clear');\n await clearBuildConfigPaths(resolvedBuildConfig, !cmdOptions.clear);\n await clearDtsTemp();\n\n if (cmdOptions.watch) {\n logger.info('Start build in watch mode...\\n');\n }\n\n try {\n await pMap(resolvedBuildConfig, async config => {\n const buildConfig = await runner.beforeBuildTask(config);\n\n await runBuildTask(\n {\n buildConfig,\n buildCmdOptions: cmdOptions,\n context,\n },\n api,\n );\n await runner.afterBuildTask({ status: 'success', config });\n });\n } catch (e) {\n const { isInternalError, ModuleBuildError } = await import('../error');\n if (isInternalError(e)) {\n throw new ModuleBuildError(e);\n } else {\n throw e;\n }\n }\n totalDuration = Date.now() - totalDuration;\n if (!cmdOptions.watch) {\n const { printFileSize, printSucceed } = await import('../utils/print');\n printSucceed(totalDuration);\n printFileSize();\n }\n } else {\n logger.warn(\n chalk.yellow(\n `No build configuration found! Please configure \\`buildConfig\\` or \\`buildPreset\\``,\n ),\n );\n }\n\n await runner.afterBuild({\n status: 'success',\n config: resolvedBuildConfig,\n commandOptions: cmdOptions,\n totalDuration,\n });\n};\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":null,"mappings":";;;;+BAKaA;;aAAAA;;;wBAJU;AAIhB,MAAMA,gBAAgB,OAC3BC,SACAC,KACAC,YACG;AACH,QAAM,EAAEC,MAAK,IAAK,MAAM,iFAAO;AAC/B,QAAM,EAAEC,MAAMC,KAAI,IAAK,MAAM,iFAAO;AACpC,QAAMC,SAASL,IAAIM,eAAc;AACjC,QAAMC,mBAAmB,MAAMF,OAAOG,sBAAqB;AAC3D,MAAID,iBAAiBE,WAAW,GAAG;AACjC,QAAIV,QAAQW,aAAa,MAAM;AAC7BC,qBAAOC,KAAK;IACd,WACEC,MAAMC,QAAQf,QAAQW,QAAQ,KAC9BX,QAAQW,SAASD,WAAW,GAC5B;AACAE,qBAAOC,KACL,iCAAiCb,QAAQW,SAAS,WAAW;IAEjE,WAAWG,MAAMC,QAAQf,QAAQW,QAAQ,KAAKX,QAAQW,SAASD,SAAS,GAAG;AACzEE,qBAAOC,KACL,gCAAgCb,QAAQW,SAASK,KAAK,YAAY;IAEtE,OAAO;AACLJ,qBAAOC,KAAK,oBAAoBI,KAAKC,UAAUlB,QAAQW,QAAQ;IACjE;AAEA;EACF;AAEA,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,cAAMqB,eAAexB,iBAAiBqB,KAAKC,aAAW;AACpD,cAAIhB,MAAMC,QAAQe,QAAQnB,QAAQ,GAAG;AACnC,mBAAOmB,QAAQnB,SAASoB,SAASpB;UACnC;AAEA,iBAAOmB,QAAQnB,aAAaA;QAC9B;AAEA,YAAI,CAACqB,cAAc;AACjBpB,yBAAOC,KAAK,QAAQF,2CAA2C;AAC/D;QACF;AAEAC,uBAAOC,KACLV,MAAMoB,UAAUC,IAAG,GAAIpB,MAAM,YAAYO,uBAAuB;AAGlE,cAAML,OAAOP,cAAc;UAAEY;QAAS;AACtC,cAAMqB,aAAaP,MAAMd,UAAU;UACjCe,aAAaxB,QAAQwB;QACvB;AAEAd,uBAAOC,KAAKV,MAAMqB,IAAG,GAAInB,MAAM,aAAaM,gBAAgB;MAC9D;IACF;EACF,SAASsB,GAAP;AACA,QAAIA,aAAaC,OAAO;AACtBd,iBAAWa;IACb,OAAO;AACLb,iBAAWe,OAAOF;IACpB;EACF;AAEA,QAAM3B,OAAO8B,mBAAmB;IAC9BC,QAAQjB,aAAa,OAAO,YAAY;IACxCkB,SAASlB;EACX;AACF;","names":["buildPlatform","options","api","context","chalk","blue","gray","runner","useHookRunners","platformBuilders","registerBuildPlatform","length","platform","logger","info","Array","isArray","join","JSON","stringify","beforeBuildPlatform","errorMsg","platformBuilder","currentPlatform","underline","rgb","build","isTsProject","targetPlatform","selectPlatformBuilder","find","builder","includes","foundBuilder","e","Error","String","afterBuildPlatform","status","message"],"sources":["../../src/builder/Users/bytedance/github/targeral/modern-js/packages/solutions/module-tools/src/builder/platform.ts"],"sourcesContent":["import { PluginAPI } from '@modern-js/core';\nimport { logger } from '@modern-js/utils/logger';\nimport { ModuleContext } from '../types/context';\nimport { BuildCommandOptions, ModuleTools } from '../types';\n\nexport const buildPlatform = async (\n options: BuildCommandOptions,\n api: PluginAPI<ModuleTools>,\n context: ModuleContext,\n) => {\n const { chalk } = await import('@modern-js/utils');\n const { blue, gray } = await import('../constants/colors');\n const runner = api.useHookRunners();\n const platformBuilders = await runner.registerBuildPlatform();\n if (platformBuilders.length === 0) {\n if (options.platform === true) {\n logger.info('No executable platform build tasks');\n } else if (\n Array.isArray(options.platform) &&\n options.platform.length === 1\n ) {\n logger.info(\n `No build tasks with platform \"${options.platform[0]}\" found`,\n );\n } else if (Array.isArray(options.platform) && options.platform.length > 1) {\n logger.info(\n `No build tasks with platform ${options.platform.join(',')} found`,\n );\n } else {\n logger.info('Unknown platform', JSON.stringify(options.platform));\n }\n\n return;\n }\n\n await runner.beforeBuildPlatform(platformBuilders);\n let errorMsg: string | Error | null = null;\n try {\n if (options.platform === true) {\n for (const platformBuilder of platformBuilders) {\n const currentPlatform = Array.isArray(platformBuilder.platform)\n ? platformBuilder.platform[0]\n : platformBuilder.platform;\n\n logger.info(\n chalk.underline.rgb(...blue)(\n `Running [${currentPlatform}] build task:`,\n ),\n );\n\n await runner.buildPlatform({ platform: currentPlatform });\n await platformBuilder.build(currentPlatform, {\n isTsProject: context.isTsProject,\n });\n\n logger.info(chalk.rgb(...gray)(`Done for [${currentPlatform}] task`));\n }\n } else if (\n Array.isArray(options.platform) &&\n options.platform.length === 1\n ) {\n const targetPlatform = options.platform[0];\n const selectPlatformBuilder = platformBuilders.find(builder => {\n if (Array.isArray(builder.platform)) {\n return builder.platform.includes(targetPlatform);\n }\n\n return builder.platform === targetPlatform;\n });\n\n if (!selectPlatformBuilder) {\n logger.info(`The specified \"${targetPlatform}\" build does not exist`);\n return;\n }\n\n logger.info(\n chalk.underline.rgb(...blue)(`Running [${targetPlatform}] build task:`),\n );\n\n await runner.buildPlatform({ platform: targetPlatform });\n await selectPlatformBuilder.build(targetPlatform, {\n isTsProject: context.isTsProject,\n });\n\n logger.info(chalk.rgb(...gray)(`Done for [${targetPlatform}] task`));\n } else if (Array.isArray(options.platform) && options.platform.length > 1) {\n for (const platform of options.platform) {\n const foundBuilder = platformBuilders.find(builder => {\n if (Array.isArray(builder.platform)) {\n return builder.platform.includes(platform);\n }\n\n return builder.platform === platform;\n });\n\n if (!foundBuilder) {\n logger.info(`skip ${platform} build, because it does not exist`);\n continue;\n }\n\n logger.info(\n chalk.underline.rgb(...blue)(`Running [${platform}] build task:`),\n );\n\n await runner.buildPlatform({ platform });\n await foundBuilder.build(platform, {\n isTsProject: context.isTsProject,\n });\n\n logger.info(chalk.rgb(...gray)(`Done for [${platform}] task`));\n }\n }\n } catch (e) {\n if (e instanceof Error) {\n errorMsg = e;\n } else {\n errorMsg = String(e);\n }\n }\n\n await runner.afterBuildPlatform({\n status: errorMsg === null ? 'success' : 'fail',\n message: errorMsg,\n });\n};\n"]}
1
+ {"version":3,"file":null,"mappings":";;;;+BAKaA;;aAAAA;;;wBAJU;AAIhB,MAAMA,gBAAgB,OAC3BC,SACAC,KACAC,YACG;AACH,QAAM,EAAEC,MAAK,IAAK,MAAM,iFAAO;AAC/B,QAAM,EAAEC,MAAMC,KAAI,IAAK,MAAM,iFAAO;AACpC,QAAMC,SAASL,IAAIM,eAAc;AACjC,QAAMC,mBAAmB,MAAMF,OAAOG,sBAAqB;AAC3D,MAAID,iBAAiBE,WAAW,GAAG;AACjC,QAAIV,QAAQW,aAAa,MAAM;AAC7BC,qBAAOC,KAAK;IACd,WACEC,MAAMC,QAAQf,QAAQW,QAAQ,KAC9BX,QAAQW,SAASD,WAAW,GAC5B;AACAE,qBAAOC,KACL,iCAAiCb,QAAQW,SAAS,WAAW;IAEjE,WAAWG,MAAMC,QAAQf,QAAQW,QAAQ,KAAKX,QAAQW,SAASD,SAAS,GAAG;AACzEE,qBAAOC,KACL,gCAAgCb,QAAQW,SAASK,KAAK,YAAY;IAEtE,OAAO;AACLJ,qBAAOC,KAAK,oBAAoBI,KAAKC,UAAUlB,QAAQW,QAAQ;IACjE;AAEA;EACF;AAEA,QAAML,OAAOa,oBAAoBX;AACjC,MAAIY,WAAkC;AACtC,MAAI;AACF,QAAIpB,QAAQW,aAAa,MAAM;AAC7B,iBAAWU,mBAAmBb,kBAAkB;AAC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ASpB;UACnC;AAEA,iBAAOmB,QAAQnB,aAAaA;QAC9B;AAEA,YAAI,CAACqB,cAAc;AACjBpB,yBAAOC,KAAK,QAAQF,2CAA2C;AAC/D;QACF;AAEAC,uBAAOC,KACLV,MAAMoB,UAAUC,IAAG,GAAIpB,MAAM,YAAYO,uBAAuB;AAGlE,cAAML,OAAOP,cAAc;UAAEY;QAAS;AACtC,cAAMqB,aAAaP,MAAMd,UAAU;UACjCe,aAAaxB,QAAQwB;QACvB;AAEAd,uBAAOC,KAAKV,MAAMqB,IAAG,GAAInB,MAAM,aAAaM,gBAAgB;MAC9D;IACF;EACF,SAASsB,GAAP;AACA,QAAIA,aAAaC,OAAO;AACtBd,iBAAWa;IACb,OAAO;AACLb,iBAAWe,OAAOF;IACpB;EACF;AAEA,QAAM3B,OAAO8B,mBAAmB;IAC9BC,QAAQjB,aAAa,OAAO,YAAY;IACxCkB,SAASlB;EACX;AACF;","names":["buildPlatform","options","api","context","chalk","blue","gray","runner","useHookRunners","platformBuilders","registerBuildPlatform","length","platform","logger","info","Array","isArray","join","JSON","stringify","beforeBuildPlatform","errorMsg","platformBuilder","currentPlatform","underline","rgb","build","isTsProject","targetPlatform","selectPlatformBuilder","find","builder","includes","foundBuilder","e","Error","String","afterBuildPlatform","status","message"],"sources":["../../src/builder/home/runner/work/modern.js/modern.js/packages/solutions/module-tools/src/builder/platform.ts"],"sourcesContent":["import { PluginAPI } from '@modern-js/core';\nimport { logger } from '@modern-js/utils/logger';\nimport { ModuleContext } from '../types/context';\nimport { BuildCommandOptions, ModuleTools } from '../types';\n\nexport const buildPlatform = async (\n options: BuildCommandOptions,\n api: PluginAPI<ModuleTools>,\n context: ModuleContext,\n) => {\n const { chalk } = await import('@modern-js/utils');\n const { blue, gray } = await import('../constants/colors');\n const runner = api.useHookRunners();\n const platformBuilders = await runner.registerBuildPlatform();\n if (platformBuilders.length === 0) {\n if (options.platform === true) {\n logger.info('No executable platform build tasks');\n } else if (\n Array.isArray(options.platform) &&\n options.platform.length === 1\n ) {\n logger.info(\n `No build tasks with platform \"${options.platform[0]}\" found`,\n );\n } else if (Array.isArray(options.platform) && options.platform.length > 1) {\n logger.info(\n `No build tasks with platform ${options.platform.join(',')} found`,\n );\n } else {\n logger.info('Unknown platform', JSON.stringify(options.platform));\n }\n\n return;\n }\n\n await runner.beforeBuildPlatform(platformBuilders);\n let errorMsg: string | Error | null = null;\n try {\n if (options.platform === true) {\n for (const platformBuilder of platformBuilders) {\n const currentPlatform = Array.isArray(platformBuilder.platform)\n ? platformBuilder.platform[0]\n : platformBuilder.platform;\n\n logger.info(\n chalk.underline.rgb(...blue)(\n `Running [${currentPlatform}] build task:`,\n ),\n );\n\n await runner.buildPlatform({ platform: currentPlatform });\n await platformBuilder.build(currentPlatform, {\n isTsProject: context.isTsProject,\n });\n\n logger.info(chalk.rgb(...gray)(`Done for [${currentPlatform}] task`));\n }\n } else if (\n Array.isArray(options.platform) &&\n options.platform.length === 1\n ) {\n const targetPlatform = options.platform[0];\n const selectPlatformBuilder = platformBuilders.find(builder => {\n if (Array.isArray(builder.platform)) {\n return builder.platform.includes(targetPlatform);\n }\n\n return builder.platform === targetPlatform;\n });\n\n if (!selectPlatformBuilder) {\n logger.info(`The specified \"${targetPlatform}\" build does not exist`);\n return;\n }\n\n logger.info(\n chalk.underline.rgb(...blue)(`Running [${targetPlatform}] build task:`),\n );\n\n await runner.buildPlatform({ platform: targetPlatform });\n await selectPlatformBuilder.build(targetPlatform, {\n isTsProject: context.isTsProject,\n });\n\n logger.info(chalk.rgb(...gray)(`Done for [${targetPlatform}] task`));\n } else if (Array.isArray(options.platform) && options.platform.length > 1) {\n for (const platform of options.platform) {\n const foundBuilder = platformBuilders.find(builder => {\n if (Array.isArray(builder.platform)) {\n return builder.platform.includes(platform);\n }\n\n return builder.platform === platform;\n });\n\n if (!foundBuilder) {\n logger.info(`skip ${platform} build, because it does not exist`);\n continue;\n }\n\n logger.info(\n chalk.underline.rgb(...blue)(`Running [${platform}] build task:`),\n );\n\n await runner.buildPlatform({ platform });\n await foundBuilder.build(platform, {\n isTsProject: context.isTsProject,\n });\n\n logger.info(chalk.rgb(...gray)(`Done for [${platform}] task`));\n }\n }\n } catch (e) {\n if (e instanceof Error) {\n errorMsg = e;\n } else {\n errorMsg = String(e);\n }\n }\n\n await runner.afterBuildPlatform({\n status: errorMsg === null ? 'success' : 'fail',\n message: errorMsg,\n });\n};\n"]}
package/dist/cli.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":null,"mappings":";;;;+BAKaA;;aAAAA;;;uBAHgB;yBACF;AAEpB,MAAMA,MAAM,OAA+B;EAChDC,MAAM;EACNC;EACAC,aAAYC,wBAAWC,QAAQC,KAAKC,MAAM,GAAG,EAAE;EAC/CC;AACF;AAEA,MAAMA,QAAyC,OAAMC,QAAO;AAC1D,QAAMC,UAAU,YAAY;AAC1B,UAAM,EAAEC,kBAAiB,IAAK,MAAM,iFAAO;AAC3C,UAAMA;AAEN,UAAMC,aAAaH,IAAII,cAAa;AACpC,UAAM,EAAEC,IAAIC,OAAM,IAAK,MAAM,iFAAO;AACpCA,WAAOC,OAAM;AAEb,UAAMF,GAAGG,SAASL,WAAWM,iBAAiB;AAE9C,UAAMC,cAAcV,IAAIW,eAAc;AACtC,UAAMD,YAAYE,kBAAiB;AAEnC,UAAM,EAAEC,gBAAe,IAAK,MAAM,iFAAO;AACzC,UAAMA,gBAAgB,YAAY;AAChC,YAAMH,YAAYI,SAAQ;IAC5B;EACF;AAEA,QAAMC,iBAAiB,YAAY;AACjC,UAAM,EAAEC,QAAQC,aAAY,IAAK,MAAM,iFAAO;AAC9C,UAAM,EAAEC,mBAAkB,IAAK,MAAM,iFAAO;AAC5C,UAAMC,aAAanB,IAAIoB,iBAAgB;AACvC,WAAOF,mBAAmBC,cACtBF,eACAD;EACN;AAEA,SAAO;IACLf;IACAc;IACA,MAAMM,SAAS,EAAEC,QAAO,GAAI;AAC1B,YAAM,EAAEC,cAAcC,YAAYC,YAAYC,cAAa,IACzD,MAAM,iFAAO;AACf,YAAMH,aAAaD,SAAStB;AAC5B,YAAMwB,WAAWF,SAAStB;AAC1B,YAAMyB,WAAWH;AACjB,YAAMI,cAAcJ;IACtB;EACF;AACF;","names":["cli","name","registerHook","usePlugins","getPlugins","process","argv","slice","setup","api","prepare","initLocalLanguage","appContext","useAppContext","fs","dotenv","config","emptydir","internalDirectory","hookRunners","useHookRunners","addRuntimeExports","addExitListener","afterDev","validateSchema","schema","legacySchema","isLegacyUserConfig","userConfig","useConfigContext","commands","program","buildCommand","devCommand","newCommand","upgradCommand"],"sources":["../src/Users/bytedance/github/targeral/modern-js/packages/solutions/module-tools/src/cli.ts"],"sourcesContent":["import type { CliPlugin } from '@modern-js/core';\nimport type { ModuleTools } from './types';\nimport { registerHook } from './hooks';\nimport { getPlugins } from './plugins';\n\nexport const cli = (): CliPlugin<ModuleTools> => ({\n name: '@modern-js/module-tools',\n registerHook,\n usePlugins: getPlugins(process.argv.slice(2)[0]),\n setup,\n});\n\nconst setup: CliPlugin<ModuleTools>['setup'] = async api => {\n const prepare = async () => {\n const { initLocalLanguage } = await import('./utils/language');\n await initLocalLanguage();\n\n const appContext = api.useAppContext();\n const { fs, dotenv } = await import('@modern-js/utils');\n dotenv.config();\n // remove '/node_modules/.modern-js'\n await fs.emptydir(appContext.internalDirectory);\n\n const hookRunners = api.useHookRunners();\n await hookRunners.addRuntimeExports();\n\n const { addExitListener } = await import('./utils/onExit');\n await addExitListener(async () => {\n await hookRunners.afterDev();\n });\n };\n\n const validateSchema = async () => {\n const { schema, legacySchema } = await import('./config/schema');\n const { isLegacyUserConfig } = await import('./utils/config');\n const userConfig = api.useConfigContext();\n return isLegacyUserConfig(userConfig as { legacy?: boolean })\n ? legacySchema\n : schema;\n };\n\n return {\n prepare,\n validateSchema,\n async commands({ program }) {\n const { buildCommand, devCommand, newCommand, upgradCommand } =\n await import('./command');\n await buildCommand(program, api);\n await devCommand(program, api);\n await newCommand(program);\n await upgradCommand(program);\n },\n };\n};\n"]}
1
+ {"version":3,"file":null,"mappings":";;;;+BAKaA;;aAAAA;;;uBAHgB;yBACF;AAEpB,MAAMA,MAAM,OAA+B;EAChDC,MAAM;EACNC;EACAC,aAAYC,wBAAWC,QAAQC,KAAKC,MAAM,GAAG,EAAE;EAC/CC;AACF;AAEA,MAAMA,QAAyC,OAAMC,QAAO;AAC1D,QAAMC,UAAU,YAAY;AAC1B,UAAM,EAAEC,kBAAiB,IAAK,MAAM,iFAAO;AAC3C,UAAMA;AAEN,UAAMC,aAAaH,IAAII,cAAa;AACpC,UAAM,EAAEC,IAAIC,OAAM,IAAK,MAAM,iFAAO;AACpCA,WAAOC,OAAM;AAEb,UAAMF,GAAGG,SAASL,WAAWM,iBAAiB;AAE9C,UAAMC,cAAcV,IAAIW,eAAc;AACtC,UAAMD,YAAYE,kBAAiB;AAEnC,UAAM,EAAEC,gBAAe,IAAK,MAAM,iFAAO;AACzC,UAAMA,gBAAgB,YAAY;AAChC,YAAMH,YAAYI,SAAQ;IAC5B;EACF;AAEA,QAAMC,iBAAiB,YAAY;AACjC,UAAM,EAAEC,QAAQC,aAAY,IAAK,MAAM,iFAAO;AAC9C,UAAM,EAAEC,mBAAkB,IAAK,MAAM,iFAAO;AAC5C,UAAMC,aAAanB,IAAIoB,iBAAgB;AACvC,WAAOF,mBAAmBC,cACtBF,eACAD;EACN;AAEA,SAAO;IACLf;IACAc;IACA,MAAMM,SAAS,EAAEC,QAAO,GAAI;AAC1B,YAAM,EAAEC,cAAcC,YAAYC,YAAYC,cAAa,IACzD,MAAM,iFAAO;AACf,YAAMH,aAAaD,SAAStB;AAC5B,YAAMwB,WAAWF,SAAStB;AAC1B,YAAMyB,WAAWH;AACjB,YAAMI,cAAcJ;IACtB;EACF;AACF;","names":["cli","name","registerHook","usePlugins","getPlugins","process","argv","slice","setup","api","prepare","initLocalLanguage","appContext","useAppContext","fs","dotenv","config","emptydir","internalDirectory","hookRunners","useHookRunners","addRuntimeExports","addExitListener","afterDev","validateSchema","schema","legacySchema","isLegacyUserConfig","userConfig","useConfigContext","commands","program","buildCommand","devCommand","newCommand","upgradCommand"],"sources":["../src/home/runner/work/modern.js/modern.js/packages/solutions/module-tools/src/cli.ts"],"sourcesContent":["import type { CliPlugin } from '@modern-js/core';\nimport type { ModuleTools } from './types';\nimport { registerHook } from './hooks';\nimport { getPlugins } from './plugins';\n\nexport const cli = (): CliPlugin<ModuleTools> => ({\n name: '@modern-js/module-tools',\n registerHook,\n usePlugins: getPlugins(process.argv.slice(2)[0]),\n setup,\n});\n\nconst setup: CliPlugin<ModuleTools>['setup'] = async api => {\n const prepare = async () => {\n const { initLocalLanguage } = await import('./utils/language');\n await initLocalLanguage();\n\n const appContext = api.useAppContext();\n const { fs, dotenv } = await import('@modern-js/utils');\n dotenv.config();\n // remove '/node_modules/.modern-js'\n await fs.emptydir(appContext.internalDirectory);\n\n const hookRunners = api.useHookRunners();\n await hookRunners.addRuntimeExports();\n\n const { addExitListener } = await import('./utils/onExit');\n await addExitListener(async () => {\n await hookRunners.afterDev();\n });\n };\n\n const validateSchema = async () => {\n const { schema, legacySchema } = await import('./config/schema');\n const { isLegacyUserConfig } = await import('./utils/config');\n const userConfig = api.useConfigContext();\n return isLegacyUserConfig(userConfig as { legacy?: boolean })\n ? legacySchema\n : schema;\n };\n\n return {\n prepare,\n validateSchema,\n async commands({ program }) {\n const { buildCommand, devCommand, newCommand, upgradCommand } =\n await import('./command');\n await buildCommand(program, api);\n await devCommand(program, api);\n await newCommand(program);\n await upgradCommand(program);\n },\n };\n};\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":null,"mappings":";;;;;;;;;;;;EAKaA,cAAY,MAAZA;EAmCAC,YAAU,MAAVA;EAwDAC,YAAU,MAAVA;EAkCAC,eAAa,MAAbA;;;AA7HN,MAAMH,eAAe,OAC1BI,SACAC,QACG;AACH,QAAMC,QAAQ,MAAM,iFAAO;AAC3B,QAAM,EAAEC,oBAAmB,IAAK,MAAM,iFAAO;AAE7CH,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C,kBAAiB,IAAK,MAAM,iFAClC;AAGF,UAAMC,SAASD;AAEf,UAAMD,gBAAgB;MAAE,GAAGpB;MAASsB,QAAQtB,QAAQgB,QAAQM;IAAO;EACrE;AACJ;AAEO,MAAM3C,gBAAgB,OAAOC,YAAqB;AACvD,QAAM,EAAE2C,cAAa,IAAK,MAAM,iFAAO;AACvCA,gBAAc3C,QAAQI,QAAQ;AAChC;","names":["buildCommand","devCommand","newCommand","upgradCommand","program","api","local","defaultTsConfigPath","command","usage","description","i18n","t","localeKeys","build","describe","option","watch","tsconfig","platform","dts","noClear","config","action","options","initModuleContext","context","runner","useHookRunners","devToolMetas","registerDev","beforeDev","devProgram","dev","meta","subCommands","subCmd","beforeDevTask","isTsProject","new","lang","debug","distTag","registry","ModuleNewAction","getLocaleLanguage","locale","defineCommand"],"sources":["../src/Users/bytedance/github/targeral/modern-js/packages/solutions/module-tools/src/command.ts"],"sourcesContent":["import type { Command } from '@modern-js/utils';\nimport type { PluginAPI } from '@modern-js/core';\nimport type { ModuleTools } from './types';\nimport type { DevCommandOptions, BuildCommandOptions } from './types/command';\n\nexport const buildCommand = async (\n program: Command,\n api: PluginAPI<ModuleTools>,\n) => {\n const local = await import('./locale');\n const { defaultTsConfigPath } = await import('./constants/dts');\n\n program\n .command('build')\n .usage('[options]')\n .description(local.i18n.t(local.localeKeys.command.build.describe))\n .option('-w, --watch', local.i18n.t(local.localeKeys.command.build.watch))\n .option(\n '--tsconfig [tsconfig]',\n local.i18n.t(local.localeKeys.command.build.tsconfig),\n defaultTsConfigPath,\n )\n .option(\n '-p, --platform [platform...]',\n local.i18n.t(local.localeKeys.command.build.platform),\n )\n .option('--no-dts', local.i18n.t(local.localeKeys.command.build.dts))\n .option('--no-clear', local.i18n.t(local.localeKeys.command.build.noClear))\n .option(\n '-c --config <config>',\n local.i18n.t(local.localeKeys.command.build.config),\n )\n .action(async (options: BuildCommandOptions) => {\n const { initModuleContext } = await import('./utils/context');\n const context = await initModuleContext(api);\n const { build } = await import('./build');\n await build(api, options, context);\n });\n};\n\nexport const devCommand = async (\n program: Command,\n api: PluginAPI<ModuleTools>,\n) => {\n const local = await import('./locale');\n const { defaultTsConfigPath } = await import('./constants/dts');\n const runner = api.useHookRunners();\n const devToolMetas = await runner.registerDev();\n\n await runner.beforeDev(devToolMetas);\n\n const devProgram = program\n .command('dev')\n .usage('[options]')\n .description(local.i18n.t(local.localeKeys.command.dev.describe))\n .option(\n '--tsconfig [tsconfig]',\n local.i18n.t(local.localeKeys.command.dev.tsconfig),\n defaultTsConfigPath,\n )\n .action(async (options: DevCommandOptions) => {\n const { initModuleContext } = await import('./utils/context');\n const context = await initModuleContext(api);\n const { dev } = await import('./dev');\n await dev(options, devToolMetas, api, context);\n });\n\n for (const meta of devToolMetas) {\n if (!meta.subCommands) {\n continue;\n }\n\n for (const subCmd of meta.subCommands) {\n devProgram.command(subCmd).action(async (options: DevCommandOptions) => {\n const { initModuleContext } = await import('./utils/context');\n const context = await initModuleContext(api);\n\n // TODO: watch build\n // const { ensureFirstBuild, watchBuild } = await import('./dev');\n // await ensureFirstBuild(api, context, options, {\n // disableRunBuild: meta.disableRunBuild ?? false,\n // appDirectory: context.appDirectory,\n // });\n\n await runner.beforeDevTask(meta);\n await meta.action(options, { isTsProject: context.isTsProject });\n // TODO: watch build\n // await watchBuild(api, context, options, {\n // disableRunBuild: meta.disableRunBuild ?? false,\n // appDirectory: context.appDirectory,\n // });\n });\n }\n }\n};\n\nexport const newCommand = async (program: Command) => {\n const local = await import('./locale');\n\n program\n .command('new')\n .usage('[options]')\n .description(local.i18n.t(local.localeKeys.command.new.describe))\n .option('--lang <lang>', local.i18n.t(local.localeKeys.command.new.lang))\n .option(\n '-c, --config <config>',\n local.i18n.t(local.localeKeys.command.new.config),\n )\n .option(\n '-d, --debug',\n local.i18n.t(local.localeKeys.command.new.debug),\n false,\n )\n .option(\n '--dist-tag <tag>',\n local.i18n.t(local.localeKeys.command.new.distTag),\n )\n .option('--registry', local.i18n.t(local.localeKeys.command.new.registry))\n .action(async options => {\n const { ModuleNewAction } = await import('@modern-js/new-action');\n const { getLocaleLanguage } = await import(\n '@modern-js/plugin-i18n/language-detector'\n );\n\n const locale = getLocaleLanguage();\n\n await ModuleNewAction({ ...options, locale: options.lang || locale });\n });\n};\n\nexport const upgradCommand = async (program: Command) => {\n const { defineCommand } = await import('@modern-js/upgrade');\n defineCommand(program.command('upgrade'));\n};\n"]}
1
+ {"version":3,"file":null,"mappings":";;;;;;;;;;;;EAKaA,cAAY,MAAZA;EAmCAC,YAAU,MAAVA;EAwDAC,YAAU,MAAVA;EAkCAC,eAAa,MAAbA;;;AA7HN,MAAMH,eAAe,OAC1BI,SACAC,QACG;AACH,QAAMC,QAAQ,MAAM,iFAAO;AAC3B,QAAM,EAAEC,oBAAmB,IAAK,MAAM,iFAAO;AAE7CH,UACGI,QAAQ,SACRC,MAAM,aACNC,YAAYJ,MAAMK,KAAKC,EAAEN,MAAMO,WAAWL,QAAQM,MAAMC,QAAQ,GAChEC,OAAO,eAAeV,MAAMK,KAAKC,EAAEN,MAAMO,WAAWL,QAAQM,MAAMG,KAAK,GACvED,OACC,yBACAV,MAAMK,KAAKC,EAAEN,MAAMO,WAAWL,QAAQM,MAAMI,QAAQ,GACpDX,qBAEDS,OACC,gCACAV,MAAMK,KAAKC,EAAEN,MAAMO,WAAWL,QAAQM,MAAMK,QAAQ,GAErDH,OAAO,YAAYV,MAAMK,KAAKC,EAAEN,MAAMO,WAAWL,QAAQM,MAAMM,GAAG,GAClEJ,OAAO,cAAcV,MAAMK,KAAKC,EAAEN,MAAMO,WAAWL,QAAQM,MAAMO,OAAO,GACxEL,OACC,wBACAV,MAAMK,KAAKC,EAAEN,MAAMO,WAAWL,QAAQM,MAAMQ,MAAM,GAEnDC,OAAO,OAAOC,YAAiC;AAC9C,UAAM,EAAEC,kBAAiB,IAAK,MAAM,iFAAO;AAC3C,UAAMC,UAAU,MAAMD,kBAAkBpB;AACxC,UAAM,EAAES,MAAK,IA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B,IAAIxB,QAAQ,GAC9DC,OAAO,iBAAiBV,MAAMK,KAAKC,EAAEN,MAAMO,WAAWL,QAAQ+B,IAAIC,IAAI,GACtExB,OACC,yBACAV,MAAMK,KAAKC,EAAEN,MAAMO,WAAWL,QAAQ+B,IAAIjB,MAAM,GAEjDN,OACC,eACAV,MAAMK,KAAKC,EAAEN,MAAMO,WAAWL,QAAQ+B,IAAIE,KAAK,GAC/C,KAAK,EAENzB,OACC,oBACAV,MAAMK,KAAKC,EAAEN,MAAMO,WAAWL,QAAQ+B,IAAIG,OAAO,GAElD1B,OAAO,cAAcV,MAAMK,KAAKC,EAAEN,MAAMO,WAAWL,QAAQ+B,IAAII,QAAQ,GACvEpB,OAAO,OAAMC,YAAW;AACvB,UAAM,EAAEoB,gBAAe,IAAK,MAAM,iFAAO;AACzC,UAAM,EAAEC,kBAAiB,IAAK,MAAM,iFAClC;AAGF,UAAMC,SAASD;AAEf,UAAMD,gBAAgB;MAAE,GAAGpB;MAASsB,QAAQtB,QAAQgB,QAAQM;IAAO;EACrE;AACJ;AAEO,MAAM3C,gBAAgB,OAAOC,YAAqB;AACvD,QAAM,EAAE2C,cAAa,IAAK,MAAM,iFAAO;AACvCA,gBAAc3C,QAAQI,QAAQ;AAChC;","names":["buildCommand","devCommand","newCommand","upgradCommand","program","api","local","defaultTsConfigPath","command","usage","description","i18n","t","localeKeys","build","describe","option","watch","tsconfig","platform","dts","noClear","config","action","options","initModuleContext","context","runner","useHookRunners","devToolMetas","registerDev","beforeDev","devProgram","dev","meta","subCommands","subCmd","beforeDevTask","isTsProject","new","lang","debug","distTag","registry","ModuleNewAction","getLocaleLanguage","locale","defineCommand"],"sources":["../src/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';\n\nexport const buildCommand = async (\n program: Command,\n api: PluginAPI<ModuleTools>,\n) => {\n const local = await import('./locale');\n const { defaultTsConfigPath } = await import('./constants/dts');\n\n program\n .command('build')\n .usage('[options]')\n .description(local.i18n.t(local.localeKeys.command.build.describe))\n .option('-w, --watch', local.i18n.t(local.localeKeys.command.build.watch))\n .option(\n '--tsconfig [tsconfig]',\n local.i18n.t(local.localeKeys.command.build.tsconfig),\n defaultTsConfigPath,\n )\n .option(\n '-p, --platform [platform...]',\n local.i18n.t(local.localeKeys.command.build.platform),\n )\n .option('--no-dts', local.i18n.t(local.localeKeys.command.build.dts))\n .option('--no-clear', local.i18n.t(local.localeKeys.command.build.noClear))\n .option(\n '-c --config <config>',\n local.i18n.t(local.localeKeys.command.build.config),\n )\n .action(async (options: BuildCommandOptions) => {\n const { initModuleContext } = await import('./utils/context');\n const context = await initModuleContext(api);\n const { build } = await import('./build');\n await build(api, options, context);\n });\n};\n\nexport const devCommand = async (\n program: Command,\n api: PluginAPI<ModuleTools>,\n) => {\n const local = await import('./locale');\n const { defaultTsConfigPath } = await import('./constants/dts');\n const runner = api.useHookRunners();\n const devToolMetas = await runner.registerDev();\n\n await runner.beforeDev(devToolMetas);\n\n const devProgram = program\n .command('dev')\n .usage('[options]')\n .description(local.i18n.t(local.localeKeys.command.dev.describe))\n .option(\n '--tsconfig [tsconfig]',\n local.i18n.t(local.localeKeys.command.dev.tsconfig),\n defaultTsConfigPath,\n )\n .action(async (options: DevCommandOptions) => {\n const { initModuleContext } = await import('./utils/context');\n const context = await initModuleContext(api);\n const { dev } = await import('./dev');\n await dev(options, devToolMetas, api, context);\n });\n\n for (const meta of devToolMetas) {\n if (!meta.subCommands) {\n continue;\n }\n\n for (const subCmd of meta.subCommands) {\n devProgram.command(subCmd).action(async (options: DevCommandOptions) => {\n const { initModuleContext } = await import('./utils/context');\n const context = await initModuleContext(api);\n\n // TODO: watch build\n // const { ensureFirstBuild, watchBuild } = await import('./dev');\n // await ensureFirstBuild(api, context, options, {\n // disableRunBuild: meta.disableRunBuild ?? false,\n // appDirectory: context.appDirectory,\n // });\n\n await runner.beforeDevTask(meta);\n await meta.action(options, { isTsProject: context.isTsProject });\n // TODO: watch build\n // await watchBuild(api, context, options, {\n // disableRunBuild: meta.disableRunBuild ?? false,\n // appDirectory: context.appDirectory,\n // });\n });\n }\n }\n};\n\nexport const newCommand = async (program: Command) => {\n const local = await import('./locale');\n\n program\n .command('new')\n .usage('[options]')\n .description(local.i18n.t(local.localeKeys.command.new.describe))\n .option('--lang <lang>', local.i18n.t(local.localeKeys.command.new.lang))\n .option(\n '-c, --config <config>',\n local.i18n.t(local.localeKeys.command.new.config),\n )\n .option(\n '-d, --debug',\n local.i18n.t(local.localeKeys.command.new.debug),\n false,\n )\n .option(\n '--dist-tag <tag>',\n local.i18n.t(local.localeKeys.command.new.distTag),\n )\n .option('--registry', local.i18n.t(local.localeKeys.command.new.registry))\n .action(async options => {\n const { ModuleNewAction } = await import('@modern-js/new-action');\n const { getLocaleLanguage } = await import(\n '@modern-js/plugin-i18n/language-detector'\n );\n\n const locale = getLocaleLanguage();\n\n await ModuleNewAction({ ...options, locale: options.lang || locale });\n });\n};\n\nexport const upgradCommand = async (program: Command) => {\n const { defineCommand } = await import('@modern-js/upgrade');\n defineCommand(program.command('upgrade'));\n};\n"]}
@@ -1 +1 @@
1
- {"version":3,"mappings":";;;;;;;;;;;;EAGaA,cAAY,MAAZA;EAOAC,oBAAkB,MAAlBA;;AAPN,MAAMD,eAAe,CAACE,WAC3BA;AAMK,MAAMD,qBAAqB,CAChCC,YAC4B;EAC5B,GAAGA;EACHC,QAAQ;EACRC,iBAAiB;AACnB;","names":["defineConfig","defineLegacyConfig","config","legacy","autoLoadPlugins"],"sources":["../../src/config/Users/bytedance/github/targeral/modern-js/packages/solutions/module-tools/src/config/defineConfig.ts"],"sourcesContent":["import type { UserConfigExport } from '@modern-js/core';\nimport type { ModuleConfigParams, ModuleLegacyUserConfig } from '../types';\n\nexport const defineConfig = (config: UserConfigExport<ModuleConfigParams>) =>\n config;\n\n/**\n * @deprecated\n * Using defineConfig first.\n */\nexport const defineLegacyConfig = (\n config: ModuleLegacyUserConfig,\n): ModuleLegacyUserConfig => ({\n ...config,\n legacy: true,\n autoLoadPlugins: true,\n});\n"]}
1
+ {"version":3,"mappings":";;;;;;;;;;;;EAGaA,cAAY,MAAZA;EAOAC,oBAAkB,MAAlBA;;AAPN,MAAMD,eAAe,CAACE,WAC3BA;AAMK,MAAMD,qBAAqB,CAChCC,YAC4B;EAC5B,GAAGA;EACHC,QAAQ;EACRC,iBAAiB;AACnB;","names":["defineConfig","defineLegacyConfig","config","legacy","autoLoadPlugins"],"sources":["../../src/config/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 +1 @@
1
- {"version":3,"mappings":";;;;;;;;;;;;EAAaA,SAAO,MAAPA;EAaAC,SAAO,MAAPA;EAqGAC,aAAW,MAAXA;EA6BAC,cAAY,MAAZA;EAkCAC,cAAY,MAAZA;EAUAC,aAAW,MAAXA;EASAC,cAAY,MAAZA;;AApMN,MAAMN,UAAU;EACrB;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;EAEA;;AAGK,MAAMC,UAAU;EACrB;EACA;EACA;EACA;KACG;IACD;IACA;IACA;IACA;IACAM,OAAiB,CAACC,KAAKC,QAAQ;AAC/B,WAAO;SAAID;SAAQR,QAAQU,IAAIC,OAAK,GAAGF,OAAOE,GAAG;;EACnD,GAAG,EAAE;;AAGP,MAAMC,aAAa;EACjBC,QAAQ;IACNC,MAAMd;EACR;EACAe,QAAQ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;EACF;;AAGF,MAAM6C,oBAAoB;EACxB;EACA;EACA;EACA;EACA;;AAGK,MAAM3C,eAAe;;EAE1B;IACEU,QAAQ;IACR4B,QAAQ;MAAE3B,MAAMgC;IAAkB;EACpC;;EAEA;IACEjC,QAAQ;IACR4B,QAAQ;MAAEd,QAAQ;IAAS;EAC7B;;EAEA;IACEd,QAAQ;IACR4B,QAAQ;MAAEd,QAAQ;IAAU;EAC9B;;EAEA;IACEd,QAAQ;IACR4B,QAAQ;MACN3B,MAAM;QAAC;QAAiB;;IAC1B;EACF;;EAEA;IACED,QAAQ;IACR4B,QAAQ;MACNd,QAAQ;MACRoB,SAAS;IACX;EACF;KACG7C;;AAGE,MAAME,eAAe;EAC1B;IACES,QAAQ;IACR4B,QAAQ;;MAEN3B,MAAM;QAAC;QAAW;;IACpB;EACF;;AAGK,MAAMT,cAAc;EACzB;IACEQ,QAAQ;IACR4B,QAAQ;MACNd,QAAQ;QAAC;QAAU;;IACrB;EACF;;AAGK,MAAMrB,eAAe;KAAIF;KAAiBD;KAAiBE;;","names":["targets","presets","buildSchema","outputSchema","sourceSchema","toolsSchema","legacySchema","reduce","ret","crt","map","t","properties","target","enum","format","sourceMap","buildType","bundleOptions","type","getModuleId","instanceof","entry","splitting","externals","items","anyOf","typeof","platform","minify","skipDeps","bundlelessOptions","sourceDir","style","compileMode","path","static","tsconfig","enableDts","dtsOnly","outputPath","schema","if","then","additionalProperties","else","PACKAGE_MODE_LIST","default"],"sources":["../../src/config/Users/bytedance/github/targeral/modern-js/packages/solutions/module-tools/src/config/legacySchema.ts"],"sourcesContent":["export const targets = [\n 'es5',\n 'es6',\n 'es2015',\n 'es2016',\n 'es2017',\n 'es2018',\n 'es2019',\n 'es2020',\n // The default target is esnext which means that by default, assume all of the latest JavaScript and CSS features are supported.\n 'esnext',\n];\n\nexport const presets = [\n 'npm-library',\n 'npm-library-with-umd',\n 'npm-component',\n 'npm-component-with-umd',\n ...[\n 'npm-library',\n 'npm-library-with-umd',\n 'npm-component',\n 'npm-component-with-umd',\n ].reduce<string[]>((ret, crt) => {\n return [...ret, ...targets.map(t => `${crt}-${t}`)];\n }, []),\n];\n\nconst properties = {\n target: {\n enum: targets,\n },\n format: {\n enum: ['cjs', 'esm', 'umd'],\n },\n sourceMap: {\n enum: [true, false, 'inline', 'external'],\n },\n buildType: {\n enum: ['bundle', 'bundleless'],\n },\n bundleOptions: {\n type: 'object',\n properties: {\n getModuleId: {\n instanceof: 'Function',\n },\n entry: {\n type: 'object',\n },\n splitting: {\n type: 'boolean',\n },\n externals: {\n type: 'array',\n items: {\n anyOf: [\n {\n instanceof: 'RegExp',\n },\n {\n typeof: 'string',\n },\n ],\n },\n },\n platform: {\n enum: ['node', 'browser'],\n },\n minify: {\n enum: ['esbuild', 'terser', false],\n },\n skipDeps: {\n type: 'boolean',\n },\n },\n },\n bundlelessOptions: {\n type: 'object',\n properties: {\n sourceDir: {\n type: 'string',\n },\n style: {\n type: 'object',\n properties: {\n compileMode: {\n enum: ['all', 'only-compiled-code', 'only-source-code', false],\n },\n path: { type: 'string' },\n },\n },\n static: {\n type: 'object',\n properties: {\n path: { type: 'string' },\n },\n },\n },\n },\n\n tsconfig: {\n type: 'string',\n },\n enableDts: {\n type: 'boolean',\n },\n dtsOnly: {\n type: 'boolean',\n },\n\n outputPath: { type: 'string' },\n};\n\nexport const buildSchema = [\n {\n target: 'output.buildConfig',\n schema: {\n if: {\n type: 'array',\n },\n then: {\n items: [{ type: 'object', properties, additionalProperties: false }],\n },\n else: { type: 'object', properties, additionalProperties: false },\n },\n },\n {\n target: 'output.buildPreset',\n schema: {\n enum: presets,\n },\n },\n];\n\nconst PACKAGE_MODE_LIST = [\n 'universal-js',\n 'universal-js-lite',\n 'browser-js',\n 'browser-js-lite',\n 'node-js',\n];\n\nexport const outputSchema = [\n /** packageMode will deprecated */\n {\n target: 'output.packageMode',\n schema: { enum: PACKAGE_MODE_LIST },\n },\n /** packageFields will deprecated */\n {\n target: 'output.packageFields',\n schema: { typeof: 'object' },\n },\n /** enableSourceMap will deprecated */\n {\n target: 'output.enableSourceMap',\n schema: { typeof: 'boolean' },\n },\n /** importStyle will deprecated */\n {\n target: 'output.importStyle',\n schema: {\n enum: ['compiled-code', 'source-code'],\n },\n },\n /** assetsPath will deprecated */\n {\n target: 'output.assetsPath',\n schema: {\n typeof: 'string',\n default: 'styles',\n },\n },\n ...buildSchema,\n];\n\nexport const sourceSchema = [\n {\n target: 'source.jsxTransformRuntime',\n schema: {\n // https://babeljs.io/docs/en/babel-preset-react#runtime\n enum: ['classic', 'automatic'],\n },\n },\n];\n\nexport const toolsSchema = [\n {\n target: 'tools.speedy',\n schema: {\n typeof: ['object', 'function'],\n },\n },\n];\n\nexport const legacySchema = [...sourceSchema, ...outputSchema, ...toolsSchema];\n"]}
1
+ {"version":3,"mappings":";;;;;;;;;;;;EAAaA,SAAO,MAAPA;EAaAC,SAAO,MAAPA;EAqGAC,aAAW,MAAXA;EA6BAC,cAAY,MAAZA;EAkCAC,cAAY,MAAZA;EAUAC,aAAW,MAAXA;EASAC,cAAY,MAAZA;;AApMN,MAAMN,UAAU;EACrB;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;EAEA;;AAGK,MAAMC,UAAU;EACrB;EACA;EACA;EACA;KACG;IACD;IACA;IACA;IACA;IACAM,OAAiB,CAACC,KAAKC,QAAQ;AAC/B,WAAO;SAAID;SAAQR,QAAQU,IAAIC,OAAK,GAAGF,OAAOE,GAAG;;EACnD,GAAG,EAAE;;AAGP,MAAMC,aAAa;EACjBC,QAAQ;IACNC,MAAMd;EACR;EACAe,QAAQ;IACND,MAAM;MAAC;MAAO;MAAO;;EACvB;EACAE,WAAW;IACTF,MAAM;MAAC;MAAM;MAAO;MAAU;;EAChC;EACAG,WAAW;IACTH,MAAM;MAAC;MAAU;;EACnB;EACAI,eAAe;IACbC,MAAM;IACNP,YAAY;MACVQ,aAAa;QACXC,YAAY;MACd;MACAC,OAAO;QACLH,MAAM;MACR;MACAI,WAAW;Q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AEd,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"]}
@@ -1 +1 @@
1
- {"version":3,"file":null,"mappings":";;;;;;;;;;;;EAcaA,mCAAiC,MAAjCA;EA8DAC,mCAAiC,MAAjCA;EAwBAC,qBAAmB,MAAnBA;EAYAC,oBAAkB,MAAlBA;EAqCAC,aAAW,MAAXA;EAUAC,sBAAoB,MAApBA;;;;iEA/JI;AAcV,MAAML,oCAAoC,OAC/CM,SAIAC,WAC+B;AAC/B,QAAM,EAAEC,eAAeC,WAAU,IAAK,MAAM,iFAC1C;AAEF,QAAM,EAAEC,iBAAgB,IAAK,MAAM,iFAAO;AAE1C,MAAI,OAAOH,WAAW,YAAY;AAChC,UAAMI,eAAe,CACnBC,YACAC,iBACG;AACH,YAAMC,sBAAsBN,cAAcI;AAC1C,UAAIG,MAAMC,QAAQF,sBAAsB;AACtC,eAAOA,oBAAoBG,IAAIC,YAAU;AACvC,iBAAO;YACL,GAAGA;YACH,GAAGL;UACL;QACF;MACF,WAAWC,qBAAqB;AAC9B,eAAO;UACL,GAAGA;UACH,GAAGD;QACL;MACF;AAEA,aAAOA;IACT;AACA,UAAMM,qBAAqB,MAAMZ,OAAO;MACtCA,QAAQC;MACRG;IACF;AAEA,QAAI,CAACQ,oBAAoB;AACvB,YAAM,IAAIC,MACR;IAEJ;AAEA,WAAOnB,kCAAkCkB,oBAAoBb;EAC/D;AAEA,QAAMe,eAAe,CAACC,MACpBA,KAAKb;AAEP,MAAIF,UAAUc,aAAad,SAAS;AAClC,WAAON,kCACL,MAAMS,iBAAiBD,WAAWF,SAASD,QAAQiB,OAAO,GAC1DjB;EAEJ;AAGA,SAAOL,kCA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N,UAAUc,IAAIC,QAAQ;AAExBf,cAAUc,IAAIE,eAAeT,cAAKE,KAChClB,QAAQmB,cACRV,UAAUc,IAAIE,YAAY;EAE9B;AAIA,SAAOhB;AACT;AAEO,MAAM5B,cAAc,OAAOc,WAA6B;AAC7D,QAAM,EAAE+B,aAAaC,YAAW,IAAKhC;AACrC,MAAI+B,eAAeC,aAAa;AAC9B,UAAM,EAAEC,OAAM,IAAK,MAAM,iFAAO;AAChCA,WAAOC,KACL,gEAAgE;EAEpE;AACF;AAEO,MAAM/C,uBAAuB,OAClCgD,KACA9B,SACAE,oBAC+B;AAC/B,QAAM,EAAE6B,mBAAkB,IAAK,MAAM,iFAAO;AAC5C,MAAIpC,SAASmC,IAAIE,iBAAgB;AAEjC,MAAID,mBAAmBpC,SAAiC;AACtD,UAAM,EAAEsC,2BAA0B,IAAK,MAAM,iFAC3C;AAEFtC,aAAS,MAAMsC,2BAA2BtC;EAC5C;AAEA,QAAM,EAAE+B,aAAaC,YAAW,IAAKhC;AAErC,QAAMd,YAAYc;AAElB,MAAIuC;AAGJ,MAAIR,aAAa;AACfQ,kBAAc,MAAMxD,kCAAkCgD,aAAa;MACjExB;MACAF;IACF;EACF,OAAO;AACLkC,kBAAc,MAAMzD,kCAClB;MACEuB;MACAE;IACF,GACAyB;EAEJ;AAEA,SAAOO;AACT;","names":["transformBuildPresetToBaseConfigs","transformBuildConfigToBaseConfigs","requiredBuildConfig","transformToAbsPath","checkConfig","normalizeBuildConfig","options","preset","BuildInPreset","presetList","addInputToPreset","extendPreset","presetName","extendConfig","originalBuildConfig","Array","isArray","map","config","partialBuildConfig","Error","inPresetList","p","context","validPartialBuildConfig","buildCmdOptions","ensureArray","assignTsConfigPath","partialConfigs","configs","Promise","all","newConfig","mergeDefaultBaseConfig","mergedConfig","baseConfig","slash","normalizeInput","outDir","path","isAbsolute","join","appDirectory","sourceDir","resolve","input","dts","distPath","tsconfigPath","buildConfig","buildPreset","logger","warn","api","isLegacyUserConfig","useConfigContext","createUserConfigFromLegacy","baseConfigs"],"sources":["../../src/config/Users/bytedance/github/targeral/modern-js/packages/solutions/module-tools/src/config/normalize.ts"],"sourcesContent":["import path from 'path';\nimport type { PluginAPI } from '@modern-js/core';\nimport type {\n ModuleUserConfig,\n ModuleLegacyUserConfig,\n BaseBuildConfig,\n BuildPreset,\n PartialBuildConfig,\n PartialBaseBuildConfig,\n ModuleContext,\n BuildCommandOptions,\n ModuleTools,\n} from '../types';\n\nexport const transformBuildPresetToBaseConfigs = async (\n options: {\n context: ModuleContext;\n buildCmdOptions: BuildCommandOptions;\n },\n preset?: BuildPreset,\n): Promise<BaseBuildConfig[]> => {\n const { BuildInPreset, presetList } = await import(\n '../constants/buildPresets'\n );\n const { addInputToPreset } = await import('../utils/input');\n\n if (typeof preset === 'function') {\n const extendPreset = (\n presetName: keyof typeof BuildInPreset,\n extendConfig: PartialBaseBuildConfig,\n ) => {\n const originalBuildConfig = BuildInPreset[presetName];\n if (Array.isArray(originalBuildConfig)) {\n return originalBuildConfig.map(config => {\n return {\n ...config,\n ...extendConfig,\n };\n });\n } else if (originalBuildConfig) {\n return {\n ...originalBuildConfig,\n ...extendConfig,\n };\n }\n\n return extendConfig;\n };\n const partialBuildConfig = await preset({\n preset: BuildInPreset,\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 transformBuildConfigToBaseConfigs(partialBuildConfig, options);\n }\n\n const inPresetList = (p: string): p is keyof typeof presetList =>\n p in presetList;\n\n if (preset && inPresetList(preset)) {\n return transformBuildConfigToBaseConfigs(\n await addInputToPreset(presetList[preset], options.context),\n options,\n );\n }\n\n // buildConfig and buildPreset is undefined\n return transformBuildConfigToBaseConfigs({}, options);\n};\n\nexport const transformBuildConfigToBaseConfigs = async (\n config: PartialBuildConfig,\n options: {\n buildCmdOptions: BuildCommandOptions;\n context: ModuleContext;\n },\n): Promise<BaseBuildConfig[]> => {\n const { validPartialBuildConfig } = await import('../utils/config');\n validPartialBuildConfig(config);\n const { buildCmdOptions } = options;\n const { ensureArray } = await import('@modern-js/utils');\n const { assignTsConfigPath } = await import('../utils/dts');\n const partialConfigs = ensureArray(config);\n const configs = await Promise.all(\n partialConfigs.map(async config => {\n let newConfig = await requiredBuildConfig(config, options.context);\n newConfig = await assignTsConfigPath(newConfig, buildCmdOptions);\n newConfig = await transformToAbsPath(newConfig, options);\n return newConfig;\n }),\n );\n return configs;\n};\n\nexport const requiredBuildConfig = async (\n partialBuildConfig: PartialBaseBuildConfig,\n context: ModuleContext,\n): Promise<BaseBuildConfig> => {\n const { mergeDefaultBaseConfig } = await import('../utils/config');\n const mergedConfig = await mergeDefaultBaseConfig(\n partialBuildConfig,\n context,\n );\n return mergedConfig;\n};\n\nexport const transformToAbsPath = async (\n baseConfig: BaseBuildConfig,\n options: { context: ModuleContext; buildCmdOptions: BuildCommandOptions },\n) => {\n const { slash } = await import('@modern-js/utils');\n const newConfig = baseConfig;\n const { normalizeInput } = await import('../utils/input');\n const { context } = options;\n\n newConfig.outDir = path.isAbsolute(newConfig.outDir)\n ? newConfig.outDir\n : path.join(context.appDirectory, newConfig.outDir);\n\n newConfig.sourceDir = slash(\n path.resolve(context.appDirectory, baseConfig.sourceDir),\n );\n newConfig.input = await normalizeInput(newConfig, {\n appDirectory: context.appDirectory,\n });\n\n // dts path\n if (newConfig.dts) {\n newConfig.dts.distPath = path.join(\n newConfig.outDir,\n newConfig.dts.distPath,\n );\n newConfig.dts.tsconfigPath = path.join(\n context.appDirectory,\n newConfig.dts.tsconfigPath,\n );\n }\n\n // Maybe need transform 'config.copy'\n\n return newConfig;\n};\n\nexport const checkConfig = async (config: ModuleUserConfig) => {\n const { buildConfig, buildPreset } = config;\n if (buildConfig && buildPreset) {\n const { logger } = await import('@modern-js/utils');\n logger.warn(\n `因为同时出现 'buildConfig' 和 'buildPreset' 配置,因此仅 'buildConfig' 配置生效`,\n );\n }\n};\n\nexport const normalizeBuildConfig = async (\n api: PluginAPI<ModuleTools>,\n context: ModuleContext,\n buildCmdOptions: BuildCommandOptions,\n): Promise<BaseBuildConfig[]> => {\n const { isLegacyUserConfig } = await import('../utils/config');\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 await checkConfig(config);\n\n let baseConfigs: BaseBuildConfig[];\n\n // buildConfig High priority\n if (buildConfig) {\n baseConfigs = await transformBuildConfigToBaseConfigs(buildConfig, {\n buildCmdOptions,\n context,\n });\n } else {\n baseConfigs = await transformBuildPresetToBaseConfigs(\n {\n context,\n buildCmdOptions,\n },\n buildPreset,\n );\n }\n\n return baseConfigs;\n};\n"]}
1
+ {"version":3,"file":null,"mappings":";;;;;;;;;;;;EAcaA,mCAAiC,MAAjCA;EA8DAC,mCAAiC,MAAjCA;EAwBAC,qBAAmB,MAAnBA;EAYAC,oBAAkB,MAAlBA;EAqCAC,aAAW,MAAXA;EAUAC,sBAAoB,MAApBA;;;;iEA/JI;AAcV,MAAML,oCAAoC,OAC/CM,SAIAC,WAC+B;AAC/B,QAAM,EAAEC,eAAeC,WAAU,IAAK,MAAM,iFAC1C;AAEF,QAAM,EAAEC,iBAAgB,IAAK,MAAM,iFAAO;AAE1C,MAAI,OAAOH,WAAW,YAAY;AAChC,UAAMI,eAAe,CACnBC,YACAC,iBACG;AACH,YAAMC,sBAAsBN,cAAcI;AAC1C,UAAIG,MAAMC,QAAQF,sBAAsB;AACtC,eAAOA,oBAAoBG,IAAIC,YAAU;AACvC,iBAAO;YACL,GAAGA;YACH,GAAGL;UACL;QACF;MACF,WAAWC,qBAAqB;AAC9B,eAAO;UACL,GAAGA;UACH,GAAGD;QACL;MACF;AAEA,aAAOA;IACT;AACA,UAAMM,qBAAqB,MAAMZ,OAAO;MACtCA,QAAQC;MACRG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cAAKE,KAAKlB,QAAQmB,cAAcV,UAAUM,MAAM;AAEpDN,YAAUW,YAAYP,MACpBG,cAAKK,QAAQrB,QAAQmB,cAAcP,WAAWQ,SAAS;AAEzDX,YAAUa,QAAQ,MAAMR,eAAeL,WAAW;IAChDU,cAAcnB,QAAQmB;EACxB;AAGA,MAAIV,UAAUc,KAAK;AACjBd,cAAUc,IAAIC,WAAWR,cAAKE,KAC5BT,UAAUM,QACVN,UAAUc,IAAIC,QAAQ;AAExBf,cAAUc,IAAIE,eAAeT,cAAKE,KAChClB,QAAQmB,cACRV,UAAUc,IAAIE,YAAY;EAE9B;AAIA,SAAOhB;AACT;AAEO,MAAM5B,cAAc,OAAOc,WAA6B;AAC7D,QAAM,EAAE+B,aAAaC,YAAW,IAAKhC;AACrC,MAAI+B,eAAeC,aAAa;AAC9B,UAAM,EAAEC,OAAM,IAAK,MAAM,iFAAO;AAChCA,WAAOC,KACL,gEAAgE;EAEpE;AACF;AAEO,MAAM/C,uBAAuB,OAClCgD,KACA9B,SACAE,oBAC+B;AAC/B,QAAM,EAAE6B,mBAAkB,IAAK,MAAM,iFAAO;AAC5C,MAAIpC,SAASmC,IAAIE,iBAAgB;AAEjC,MAAID,mBAAmBpC,SAAiC;AACtD,UAAM,EAAEsC,2BAA0B,IAAK,MAAM,iFAC3C;AAEFtC,aAAS,MAAMsC,2BAA2BtC;EAC5C;AAEA,QAAM,EAAE+B,aAAaC,YAAW,IAAKhC;AAErC,QAAMd,YAAYc;AAElB,MAAIuC;AAGJ,MAAIR,aAAa;AACfQ,kBAAc,MAAMxD,kCAAkCgD,aAAa;MACjExB;MACAF;IACF;EACF,OAAO;AACLkC,kBAAc,MAAMzD,kCAClB;MACEuB;MACAE;IACF,GACAyB;EAEJ;AAEA,SAAOO;AACT;","names":["transformBuildPresetToBaseConfigs","transformBuildConfigToBaseConfigs","requiredBuildConfig","transformToAbsPath","checkConfig","normalizeBuildConfig","options","preset","BuildInPreset","presetList","addInputToPreset","extendPreset","presetName","extendConfig","originalBuildConfig","Array","isArray","map","config","partialBuildConfig","Error","inPresetList","p","context","validPartialBuildConfig","buildCmdOptions","ensureArray","assignTsConfigPath","partialConfigs","configs","Promise","all","newConfig","mergeDefaultBaseConfig","mergedConfig","baseConfig","slash","normalizeInput","outDir","path","isAbsolute","join","appDirectory","sourceDir","resolve","input","dts","distPath","tsconfigPath","buildConfig","buildPreset","logger","warn","api","isLegacyUserConfig","useConfigContext","createUserConfigFromLegacy","baseConfigs"],"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 type {\n ModuleUserConfig,\n ModuleLegacyUserConfig,\n BaseBuildConfig,\n BuildPreset,\n PartialBuildConfig,\n PartialBaseBuildConfig,\n ModuleContext,\n BuildCommandOptions,\n ModuleTools,\n} from '../types';\n\nexport const transformBuildPresetToBaseConfigs = async (\n options: {\n context: ModuleContext;\n buildCmdOptions: BuildCommandOptions;\n },\n preset?: BuildPreset,\n): Promise<BaseBuildConfig[]> => {\n const { BuildInPreset, presetList } = await import(\n '../constants/buildPresets'\n );\n const { addInputToPreset } = await import('../utils/input');\n\n if (typeof preset === 'function') {\n const extendPreset = (\n presetName: keyof typeof BuildInPreset,\n extendConfig: PartialBaseBuildConfig,\n ) => {\n const originalBuildConfig = BuildInPreset[presetName];\n if (Array.isArray(originalBuildConfig)) {\n return originalBuildConfig.map(config => {\n return {\n ...config,\n ...extendConfig,\n };\n });\n } else if (originalBuildConfig) {\n return {\n ...originalBuildConfig,\n ...extendConfig,\n };\n }\n\n return extendConfig;\n };\n const partialBuildConfig = await preset({\n preset: BuildInPreset,\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 transformBuildConfigToBaseConfigs(partialBuildConfig, options);\n }\n\n const inPresetList = (p: string): p is keyof typeof presetList =>\n p in presetList;\n\n if (preset && inPresetList(preset)) {\n return transformBuildConfigToBaseConfigs(\n await addInputToPreset(presetList[preset], options.context),\n options,\n );\n }\n\n // buildConfig and buildPreset is undefined\n return transformBuildConfigToBaseConfigs({}, options);\n};\n\nexport const transformBuildConfigToBaseConfigs = async (\n config: PartialBuildConfig,\n options: {\n buildCmdOptions: BuildCommandOptions;\n context: ModuleContext;\n },\n): Promise<BaseBuildConfig[]> => {\n const { validPartialBuildConfig } = await import('../utils/config');\n validPartialBuildConfig(config);\n const { buildCmdOptions } = options;\n const { ensureArray } = await import('@modern-js/utils');\n const { assignTsConfigPath } = await import('../utils/dts');\n const partialConfigs = ensureArray(config);\n const configs = await Promise.all(\n partialConfigs.map(async config => {\n let newConfig = await requiredBuildConfig(config, options.context);\n newConfig = await assignTsConfigPath(newConfig, buildCmdOptions);\n newConfig = await transformToAbsPath(newConfig, options);\n return newConfig;\n }),\n );\n return configs;\n};\n\nexport const requiredBuildConfig = async (\n partialBuildConfig: PartialBaseBuildConfig,\n context: ModuleContext,\n): Promise<BaseBuildConfig> => {\n const { mergeDefaultBaseConfig } = await import('../utils/config');\n const mergedConfig = await mergeDefaultBaseConfig(\n partialBuildConfig,\n context,\n );\n return mergedConfig;\n};\n\nexport const transformToAbsPath = async (\n baseConfig: BaseBuildConfig,\n options: { context: ModuleContext; buildCmdOptions: BuildCommandOptions },\n) => {\n const { slash } = await import('@modern-js/utils');\n const newConfig = baseConfig;\n const { normalizeInput } = await import('../utils/input');\n const { context } = options;\n\n newConfig.outDir = path.isAbsolute(newConfig.outDir)\n ? newConfig.outDir\n : path.join(context.appDirectory, newConfig.outDir);\n\n newConfig.sourceDir = slash(\n path.resolve(context.appDirectory, baseConfig.sourceDir),\n );\n newConfig.input = await normalizeInput(newConfig, {\n appDirectory: context.appDirectory,\n });\n\n // dts path\n if (newConfig.dts) {\n newConfig.dts.distPath = path.join(\n newConfig.outDir,\n newConfig.dts.distPath,\n );\n newConfig.dts.tsconfigPath = path.join(\n context.appDirectory,\n newConfig.dts.tsconfigPath,\n );\n }\n\n // Maybe need transform 'config.copy'\n\n return newConfig;\n};\n\nexport const checkConfig = async (config: ModuleUserConfig) => {\n const { buildConfig, buildPreset } = config;\n if (buildConfig && buildPreset) {\n const { logger } = await import('@modern-js/utils');\n logger.warn(\n `因为同时出现 'buildConfig' 和 'buildPreset' 配置,因此仅 'buildConfig' 配置生效`,\n );\n }\n};\n\nexport const normalizeBuildConfig = async (\n api: PluginAPI<ModuleTools>,\n context: ModuleContext,\n buildCmdOptions: BuildCommandOptions,\n): Promise<BaseBuildConfig[]> => {\n const { isLegacyUserConfig } = await import('../utils/config');\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 await checkConfig(config);\n\n let baseConfigs: BaseBuildConfig[];\n\n // buildConfig High priority\n if (buildConfig) {\n baseConfigs = await transformBuildConfigToBaseConfigs(buildConfig, {\n buildCmdOptions,\n context,\n });\n } else {\n baseConfigs = await transformBuildPresetToBaseConfigs(\n {\n context,\n buildCmdOptions,\n },\n buildPreset,\n );\n }\n\n return baseConfigs;\n};\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":null,"mappings":";;;;;;;;;;;;EAAaA,SAAO,MAAPA;EAeAC,SAAO,MAAPA;EA0KAC,aAAW,MAAXA;EAoBAC,aAAW,MAAXA;EAWAC,QAAM,MAANA;EAOAC,QAAM,MAANA;EACJC,cAAY,MAAZA;;8BAAoB;AAhOtB,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,QAAQ;AAC/B,WAAO;SAAID;SAAQR,QAAQU,IAAIC,OAA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X,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","externals","anyOf","instanceof","format","input","jsx","minify","outDir","platform","sourceDir","sourceMap","splitting","style","redirect","target","umdGlobals","esbuildOpitons","umdModuleName","sideEffects","externalHelpers","transformImport","sourceType"],"sources":["../../src/config/Users/bytedance/github/targeral/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 },\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 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
+ {"version":3,"file":null,"mappings":";;;;;;;;;;;;EAAaA,SAAO,MAAPA;EAeAC,SAAO,MAAPA;EA0KAC,aAAW,MAAXA;EAoBAC,aAAW,MAAXA;EAWAC,QAAM,MAANA;EAOAC,QAAM,MAANA;EACJC,cAAY,MAAZA;;8BAAoB;AAhOtB,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,QAAQ;AAC/B,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,MAAM;UACR;QACF;MACF;IACF;EACF;EACAmB,QAAQ;IACNrB,QAAQ;EACV;EACAsB,KAAK;IACHlB,IAAI;MAAEF,MAAM;I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;EACrB;AACF;AACO,MAAMvB,cAAc;EACzBoD,QAAQ;EACRjD,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;EACzBmD,QAAQ;EACRjD,QAAQ;IACNa,IAAI;MAAEF,MAAM;IAAS;IACrBG,MAAM;MACJM,MAAMxB;IACR;IACAsB,MAAM;MAAET,QAAQ;IAAW;EAC7B;AACF;AAEO,MAAMV,SAAS;EACpBkD,QAAQ;EACRjD,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","externals","anyOf","instanceof","format","input","jsx","minify","outDir","platform","sourceDir","sourceMap","splitting","style","redirect","target","umdGlobals","esbuildOpitons","umdModuleName","sideEffects","externalHelpers","transformImport","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 },\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 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"]}