@modern-js/module-tools 2.15.0 → 2.16.0-beta.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 (134) hide show
  1. package/compiled/postcss-custom-properties/index.js +1 -1
  2. package/compiled/postcss-custom-properties/package.json +1 -1
  3. package/dist/build.js +23 -66
  4. package/dist/build.js.map +1 -1
  5. package/dist/builder/build.js +114 -170
  6. package/dist/builder/build.js.map +1 -1
  7. package/dist/builder/clear.js +23 -65
  8. package/dist/builder/clear.js.map +1 -1
  9. package/dist/builder/copy.js +83 -164
  10. package/dist/builder/copy.js.map +1 -1
  11. package/dist/builder/dts/index.js +15 -28
  12. package/dist/builder/dts/index.js.map +1 -1
  13. package/dist/builder/dts/rollup.js +46 -120
  14. package/dist/builder/dts/rollup.js.map +1 -1
  15. package/dist/builder/dts/tsc.js +82 -141
  16. package/dist/builder/dts/tsc.js.map +1 -1
  17. package/dist/builder/index.js +34 -85
  18. package/dist/builder/index.js.map +1 -1
  19. package/dist/builder/platform.js +40 -93
  20. package/dist/builder/platform.js.map +1 -1
  21. package/dist/cli.js +35 -84
  22. package/dist/cli.js.map +1 -1
  23. package/dist/command.js +56 -136
  24. package/dist/command.js.map +1 -1
  25. package/dist/config/defineConfig.js +13 -42
  26. package/dist/config/defineConfig.js.map +1 -1
  27. package/dist/config/legacySchema.js +96 -52
  28. package/dist/config/legacySchema.js.map +1 -1
  29. package/dist/config/normalize.js +73 -149
  30. package/dist/config/normalize.js.map +1 -1
  31. package/dist/config/schema.d.ts +36 -0
  32. package/dist/config/schema.js +118 -56
  33. package/dist/config/schema.js.map +1 -1
  34. package/dist/config/transformLegacyConfig.js +152 -203
  35. package/dist/config/transformLegacyConfig.js.map +1 -1
  36. package/dist/constants/build.js +15 -27
  37. package/dist/constants/build.js.map +1 -1
  38. package/dist/constants/buildPresets.js +71 -84
  39. package/dist/constants/buildPresets.js.map +1 -1
  40. package/dist/constants/colors.js +28 -30
  41. package/dist/constants/colors.js.map +1 -1
  42. package/dist/constants/dts.js +13 -28
  43. package/dist/constants/dts.js.map +1 -1
  44. package/dist/constants/file.js +27 -30
  45. package/dist/constants/file.js.map +1 -1
  46. package/dist/constants/legacyBuildPresets.js +33 -49
  47. package/dist/constants/legacyBuildPresets.js.map +1 -1
  48. package/dist/constants/log.js +15 -33
  49. package/dist/constants/log.js.map +1 -1
  50. package/dist/dev.js +45 -91
  51. package/dist/dev.js.map +1 -1
  52. package/dist/error.js +37 -54
  53. package/dist/error.js.map +1 -1
  54. package/dist/hooks/build.js +22 -35
  55. package/dist/hooks/build.js.map +1 -1
  56. package/dist/hooks/dev.js +15 -33
  57. package/dist/hooks/dev.js.map +1 -1
  58. package/dist/hooks/index.js +15 -42
  59. package/dist/hooks/index.js.map +1 -1
  60. package/dist/hooks/misc.js +10 -28
  61. package/dist/hooks/misc.js.map +1 -1
  62. package/dist/index.js +21 -35
  63. package/dist/index.js.map +1 -1
  64. package/dist/locale/en.d.ts +7 -2
  65. package/dist/locale/en.js +25 -32
  66. package/dist/locale/en.js.map +1 -1
  67. package/dist/locale/index.d.ts +14 -4
  68. package/dist/locale/index.js +18 -31
  69. package/dist/locale/index.js.map +1 -1
  70. package/dist/locale/zh.d.ts +7 -2
  71. package/dist/locale/zh.js +25 -32
  72. package/dist/locale/zh.js.map +1 -1
  73. package/dist/plugins.js +16 -39
  74. package/dist/plugins.js.map +1 -1
  75. package/dist/types/color.js +4 -15
  76. package/dist/types/color.js.map +1 -1
  77. package/dist/types/command.js +4 -15
  78. package/dist/types/command.js.map +1 -1
  79. package/dist/types/config/index.d.ts +6 -0
  80. package/dist/types/config/index.js +6 -17
  81. package/dist/types/config/index.js.map +1 -1
  82. package/dist/types/config/style.js +4 -15
  83. package/dist/types/config/style.js.map +1 -1
  84. package/dist/types/context.js +4 -15
  85. package/dist/types/context.js.map +1 -1
  86. package/dist/types/copy.js +4 -15
  87. package/dist/types/copy.js.map +1 -1
  88. package/dist/types/dts.js +4 -15
  89. package/dist/types/dts.js.map +1 -1
  90. package/dist/types/hooks.js +4 -15
  91. package/dist/types/hooks.js.map +1 -1
  92. package/dist/types/index.js +11 -22
  93. package/dist/types/index.js.map +1 -1
  94. package/dist/types/legacyConfig/index.js +4 -15
  95. package/dist/types/legacyConfig/index.js.map +1 -1
  96. package/dist/types/legacyConfig/output.js +4 -15
  97. package/dist/types/legacyConfig/output.js.map +1 -1
  98. package/dist/types/legacyConfig/source.js +4 -15
  99. package/dist/types/legacyConfig/source.js.map +1 -1
  100. package/dist/types/legacyConfig/tools.js +4 -15
  101. package/dist/types/legacyConfig/tools.js.map +1 -1
  102. package/dist/types/utils.js +4 -17
  103. package/dist/utils/builder.d.ts +20 -2
  104. package/dist/utils/builder.js +81 -68
  105. package/dist/utils/builder.js.map +1 -1
  106. package/dist/utils/common.js +10 -44
  107. package/dist/utils/common.js.map +1 -1
  108. package/dist/utils/config.js +108 -144
  109. package/dist/utils/config.js.map +1 -1
  110. package/dist/utils/context.js +16 -59
  111. package/dist/utils/context.js.map +1 -1
  112. package/dist/utils/dts.js +69 -146
  113. package/dist/utils/dts.js.map +1 -1
  114. package/dist/utils/input.js +44 -87
  115. package/dist/utils/input.js.map +1 -1
  116. package/dist/utils/language.js +15 -60
  117. package/dist/utils/language.js.map +1 -1
  118. package/dist/utils/libuildPlugins.js +27 -67
  119. package/dist/utils/libuildPlugins.js.map +1 -1
  120. package/dist/utils/log.js +14 -61
  121. package/dist/utils/log.js.map +1 -1
  122. package/dist/utils/onExit.js +14 -61
  123. package/dist/utils/onExit.js.map +1 -1
  124. package/dist/utils/path.js +13 -59
  125. package/dist/utils/path.js.map +1 -1
  126. package/dist/utils/print.js +57 -105
  127. package/dist/utils/print.js.map +1 -1
  128. package/dist/utils/style.js +54 -106
  129. package/dist/utils/style.js.map +1 -1
  130. package/dist/utils/tspathsTransform.js +44 -81
  131. package/dist/utils/tspathsTransform.js.map +1 -1
  132. package/package.json +11 -10
  133. package/scripts/debug-mode.js +23 -21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AM,SAAS;AAAA,EACpB,QAAQ;AAAA,EACR,QAAQ;AAAA,IACN,MAAM;AAAA,EACR;AACF;AAEO,MAAM,SAAS,CAAC,aAAa,aAAa,MAAM;;;;;;;;;;;","names":[],"sources":["../../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};\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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AsB,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/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,149 +1,98 @@
1
- var __create = Object.create;
2
- var __defProp = Object.defineProperty;
3
- var __defProps = Object.defineProperties;
4
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
- var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
6
- var __getOwnPropNames = Object.getOwnPropertyNames;
7
- var __getOwnPropSymbols = Object.getOwnPropertySymbols;
8
- var __getProtoOf = Object.getPrototypeOf;
9
- var __hasOwnProp = Object.prototype.hasOwnProperty;
10
- var __propIsEnum = Object.prototype.propertyIsEnumerable;
11
- var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
12
- var __spreadValues = (a, b) => {
13
- for (var prop in b || (b = {}))
14
- if (__hasOwnProp.call(b, prop))
15
- __defNormalProp(a, prop, b[prop]);
16
- if (__getOwnPropSymbols)
17
- for (var prop of __getOwnPropSymbols(b)) {
18
- if (__propIsEnum.call(b, prop))
19
- __defNormalProp(a, prop, b[prop]);
20
- }
21
- return a;
22
- };
23
- var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
24
- var __export = (target, all) => {
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", {
3
+ value: true
4
+ });
5
+ function _export(target, all) {
25
6
  for (var name in all)
26
- __defProp(target, name, { get: all[name], enumerable: true });
27
- };
28
- var __copyProps = (to, from, except, desc) => {
29
- if (from && typeof from === "object" || typeof from === "function") {
30
- for (let key of __getOwnPropNames(from))
31
- if (!__hasOwnProp.call(to, key) && key !== except)
32
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
33
- }
34
- return to;
35
- };
36
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
37
- // If the importer is in node compatibility mode or this is not an ESM
38
- // file that has been converted to a CommonJS file using a Babel-
39
- // compatible transform (i.e. "__esModule" has not been set), then set
40
- // "default" to the CommonJS "module.exports" for node compatibility.
41
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
42
- mod
43
- ));
44
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
45
- var __async = (__this, __arguments, generator) => {
46
- return new Promise((resolve, reject) => {
47
- var fulfilled = (value) => {
48
- try {
49
- step(generator.next(value));
50
- } catch (e) {
51
- reject(e);
52
- }
53
- };
54
- var rejected = (value) => {
55
- try {
56
- step(generator.throw(value));
57
- } catch (e) {
58
- reject(e);
59
- }
60
- };
61
- var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
62
- step((generator = generator.apply(__this, __arguments)).next());
63
- });
64
- };
65
- var transformLegacyConfig_exports = {};
66
- __export(transformLegacyConfig_exports, {
7
+ Object.defineProperty(target, name, {
8
+ enumerable: true,
9
+ get: all[name]
10
+ });
11
+ }
12
+ _export(exports, {
13
+ transformToolsToBuildConfig: () => transformToolsToBuildConfig,
14
+ transformSourceToBuildConfig: () => transformSourceToBuildConfig,
15
+ transformOutputToBuildConfig: () => transformOutputToBuildConfig,
67
16
  commonTransformAndLog: () => commonTransformAndLog,
68
17
  createConfigByBuildConfig: () => createConfigByBuildConfig,
69
18
  createConfigByBuildPreset: () => createConfigByBuildPreset,
70
- createConfigByDefault: () => createConfigByDefault,
71
19
  createConfigByPackageFields: () => createConfigByPackageFields,
72
20
  createConfigByPackageMode: () => createConfigByPackageMode,
73
- createUserConfigFromLegacy: () => createUserConfigFromLegacy,
74
- transformOutputToBuildConfig: () => transformOutputToBuildConfig,
75
- transformSourceToBuildConfig: () => transformSourceToBuildConfig,
76
- transformToolsToBuildConfig: () => transformToolsToBuildConfig
21
+ createConfigByDefault: () => createConfigByDefault,
22
+ createUserConfigFromLegacy: () => createUserConfigFromLegacy
77
23
  });
78
- module.exports = __toCommonJS(transformLegacyConfig_exports);
79
- var import_path = __toESM(require("path"));
24
+ const _interop_require_default = require("@swc/helpers/_/_interop_require_default");
25
+ const _interop_require_wildcard = require("@swc/helpers/_/_interop_require_wildcard");
26
+ const _path = /* @__PURE__ */ _interop_require_default._(require("path"));
80
27
  const transformToolsToBuildConfig = (buildConfig, legacyUserConfig) => {
81
- var _a, _b, _c, _d, _e;
82
28
  if (!legacyUserConfig.tools) {
83
29
  return;
84
30
  }
85
31
  const legacyTools = legacyUserConfig.tools;
86
- buildConfig.style = __spreadProps(__spreadValues({}, (_a = buildConfig.style) != null ? _a : {}), {
87
- less: (_b = legacyTools.less) != null ? _b : {},
88
- sass: (_c = legacyTools.sass) != null ? _c : {},
89
- tailwindcss: (_d = legacyTools.tailwindcss) != null ? _d : {}
90
- });
32
+ var _buildConfig_style, _legacyTools_less, _legacyTools_sass, _legacyTools_tailwindcss;
33
+ buildConfig.style = {
34
+ ...(_buildConfig_style = buildConfig.style) !== null && _buildConfig_style !== void 0 ? _buildConfig_style : {},
35
+ less: (_legacyTools_less = legacyTools.less) !== null && _legacyTools_less !== void 0 ? _legacyTools_less : {},
36
+ sass: (_legacyTools_sass = legacyTools.sass) !== null && _legacyTools_sass !== void 0 ? _legacyTools_sass : {},
37
+ tailwindcss: (_legacyTools_tailwindcss = legacyTools.tailwindcss) !== null && _legacyTools_tailwindcss !== void 0 ? _legacyTools_tailwindcss : {}
38
+ };
91
39
  if (legacyTools.postcss) {
40
+ var _legacyTools_postcss_postcssOptions;
92
41
  buildConfig.style.postcss = typeof legacyTools.postcss === "function" ? (opts, utils) => {
93
- var _a2;
42
+ var _legacyOpts_postcssOptions;
94
43
  const legacyOpts = {
95
44
  postcssOptions: {
96
45
  plugins: opts.plugins
97
46
  }
98
47
  };
99
48
  legacyTools.postcss(legacyOpts, utils);
100
- opts.plugins = (_a2 = legacyOpts.postcssOptions) == null ? void 0 : _a2.plugins;
49
+ opts.plugins = (_legacyOpts_postcssOptions = legacyOpts.postcssOptions) === null || _legacyOpts_postcssOptions === void 0 ? void 0 : _legacyOpts_postcssOptions.plugins;
101
50
  opts.processOptions = legacyOpts.postcssOptions;
102
51
  } : {
103
- plugins: (_e = legacyTools.postcss.postcssOptions) == null ? void 0 : _e.plugins,
52
+ plugins: (_legacyTools_postcss_postcssOptions = legacyTools.postcss.postcssOptions) === null || _legacyTools_postcss_postcssOptions === void 0 ? void 0 : _legacyTools_postcss_postcssOptions.plugins,
104
53
  processOptions: legacyTools.postcss.postcssOptions
105
54
  };
106
55
  }
107
56
  };
108
57
  const transformSourceToBuildConfig = (buildConfig, legacyUserConfig) => {
109
- var _a, _b;
58
+ var _legacySource_envVars;
110
59
  if (!legacyUserConfig.source) {
111
60
  return;
112
61
  }
113
62
  const legacySource = legacyUserConfig.source;
114
- buildConfig.alias = (_a = legacySource.alias) != null ? _a : {};
63
+ var _legacySource_alias;
64
+ buildConfig.alias = (_legacySource_alias = legacySource.alias) !== null && _legacySource_alias !== void 0 ? _legacySource_alias : {};
115
65
  buildConfig.define = {};
116
- (_b = legacySource.envVars) == null ? void 0 : _b.forEach((envVar) => {
66
+ (_legacySource_envVars = legacySource.envVars) === null || _legacySource_envVars === void 0 ? void 0 : _legacySource_envVars.forEach((envVar) => {
117
67
  buildConfig.define[`process.env.${envVar}`] = process.env[envVar];
118
68
  });
119
- buildConfig.define = __spreadValues(__spreadValues({}, buildConfig.define), legacySource.globalVars);
69
+ buildConfig.define = {
70
+ ...buildConfig.define,
71
+ ...legacySource.globalVars
72
+ };
120
73
  buildConfig.jsx = legacySource.jsxTransformRuntime === "classic" ? "transform" : "automatic";
121
74
  };
122
75
  const transformOutputToBuildConfig = (buildConfig, legacyUserConfig) => {
123
- var _a, _b;
124
- if ((_a = legacyUserConfig.output) == null ? void 0 : _a.disableTsChecker) {
76
+ var _legacyUserConfig_output, _legacyUserConfig_output1;
77
+ if ((_legacyUserConfig_output = legacyUserConfig.output) === null || _legacyUserConfig_output === void 0 ? void 0 : _legacyUserConfig_output.disableTsChecker) {
125
78
  buildConfig.dts = false;
126
79
  }
127
- if ((_b = legacyUserConfig.output) == null ? void 0 : _b.disableSourceMap) {
80
+ if ((_legacyUserConfig_output1 = legacyUserConfig.output) === null || _legacyUserConfig_output1 === void 0 ? void 0 : _legacyUserConfig_output1.disableSourceMap) {
128
81
  buildConfig.sourceMap = false;
129
82
  }
130
83
  };
131
- const commonTransformAndLog = (legacyUserConfig) => __async(void 0, null, function* () {
132
- var _a, _b, _c;
133
- const { logger } = yield Promise.resolve().then(() => __toESM(require("@modern-js/utils")));
84
+ const commonTransformAndLog = async (legacyUserConfig) => {
85
+ var _legacyUserConfig_source, _legacyUserConfig_output, _legacyUserConfig_output1;
86
+ const { logger } = await Promise.resolve().then(() => /* @__PURE__ */ _interop_require_wildcard._(require("@modern-js/utils")));
134
87
  const finalConfig = {};
135
- finalConfig.designSystem = (_a = legacyUserConfig.source) == null ? void 0 : _a.designSystem;
88
+ finalConfig.designSystem = (_legacyUserConfig_source = legacyUserConfig.source) === null || _legacyUserConfig_source === void 0 ? void 0 : _legacyUserConfig_source.designSystem;
136
89
  if (legacyUserConfig.tools) {
137
90
  const legacyTools = legacyUserConfig.tools;
138
91
  if (legacyTools.babel) {
139
- logger.warn(
140
- "`tools.babel` is not support in legacy mode. Please check migrate documentation."
141
- );
92
+ logger.warn("`tools.babel` is not support in legacy mode. Please check migrate documentation.");
142
93
  }
143
94
  if (legacyTools.lodash) {
144
- logger.warn(
145
- "`tools.lodash` is not support in legacy mode. Please check migrate documentation."
146
- );
95
+ logger.warn("`tools.lodash` is not support in legacy mode. Please check migrate documentation.");
147
96
  }
148
97
  if (legacyTools.jest) {
149
98
  finalConfig.testing = {
@@ -151,44 +100,50 @@ const commonTransformAndLog = (legacyUserConfig) => __async(void 0, null, functi
151
100
  };
152
101
  }
153
102
  }
154
- if ((_b = legacyUserConfig.output) == null ? void 0 : _b.importStyle) {
155
- logger.warn(
156
- "`output.importStyle` is not support in legacy mode. Please check migrate documentation. By default, the style will be compiled"
157
- );
103
+ if ((_legacyUserConfig_output = legacyUserConfig.output) === null || _legacyUserConfig_output === void 0 ? void 0 : _legacyUserConfig_output.importStyle) {
104
+ logger.warn("`output.importStyle` is not support in legacy mode. Please check migrate documentation. By default, the style will be compiled");
158
105
  }
159
- if ((_c = legacyUserConfig.output) == null ? void 0 : _c.jsPath) {
106
+ if ((_legacyUserConfig_output1 = legacyUserConfig.output) === null || _legacyUserConfig_output1 === void 0 ? void 0 : _legacyUserConfig_output1.jsPath) {
160
107
  logger.warn("`output.jsPath` is not support in legacy mode.");
161
108
  }
162
109
  return finalConfig;
163
- });
164
- const createConfigByBuildConfig = (legacyUserConfig) => __async(void 0, null, function* () {
165
- var _a, _b;
166
- const { logger } = yield Promise.resolve().then(() => __toESM(require("@modern-js/utils")));
110
+ };
111
+ const createConfigByBuildConfig = async (legacyUserConfig) => {
112
+ var _legacyUserConfig_source, _legacyUserConfig_output;
113
+ const { logger } = await Promise.resolve().then(() => /* @__PURE__ */ _interop_require_wildcard._(require("@modern-js/utils")));
167
114
  const legacyBuildConfig = legacyUserConfig.output.buildConfig;
168
115
  const createBuildConfig = (config) => {
169
- var _a2, _b2, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t;
116
+ var _legacyUserConfig_output2, _legacyUserConfig_output1, _legacyUserConfig_output22, _legacyUserConfig_output3, _legacyUserConfig_output4, _legacyUserConfig_output5;
170
117
  const newConfig = {};
171
118
  transformSourceToBuildConfig(newConfig, legacyUserConfig);
172
- const legacyPath = (_b2 = (_a2 = legacyUserConfig.output) == null ? void 0 : _a2.path) != null ? _b2 : "dist";
173
- newConfig.outDir = import_path.default.join(legacyPath, (_c = config.outputPath) != null ? _c : "./");
119
+ var _legacyUserConfig_output_path;
120
+ const legacyPath = (_legacyUserConfig_output_path = (_legacyUserConfig_output2 = legacyUserConfig.output) === null || _legacyUserConfig_output2 === void 0 ? void 0 : _legacyUserConfig_output2.path) !== null && _legacyUserConfig_output_path !== void 0 ? _legacyUserConfig_output_path : "dist";
121
+ var _config_outputPath;
122
+ newConfig.outDir = _path.default.join(legacyPath, (_config_outputPath = config.outputPath) !== null && _config_outputPath !== void 0 ? _config_outputPath : "./");
174
123
  newConfig.asset = {
175
- path: (_d = legacyUserConfig.output) == null ? void 0 : _d.assetsPath
124
+ path: (_legacyUserConfig_output1 = legacyUserConfig.output) === null || _legacyUserConfig_output1 === void 0 ? void 0 : _legacyUserConfig_output1.assetsPath
176
125
  };
177
- newConfig.sourceMap = !((_e = legacyUserConfig.output) == null ? void 0 : _e.disableSourceMap);
178
- newConfig.sourceMap = (_f = config.sourceMap) != null ? _f : config.buildType === "bundle";
179
- newConfig.buildType = (_g = config.buildType) != null ? _g : "bundleless";
180
- newConfig.format = (_h = config.format) != null ? _h : "cjs";
181
- newConfig.target = (_i = config.target) != null ? _i : "esnext";
182
- newConfig.dts = ((_j = legacyUserConfig.output) == null ? void 0 : _j.disableTsChecker) ? false : {};
126
+ newConfig.sourceMap = !((_legacyUserConfig_output22 = legacyUserConfig.output) === null || _legacyUserConfig_output22 === void 0 ? void 0 : _legacyUserConfig_output22.disableSourceMap);
127
+ var _config_sourceMap;
128
+ newConfig.sourceMap = (_config_sourceMap = config.sourceMap) !== null && _config_sourceMap !== void 0 ? _config_sourceMap : config.buildType === "bundle";
129
+ var _config_buildType;
130
+ newConfig.buildType = (_config_buildType = config.buildType) !== null && _config_buildType !== void 0 ? _config_buildType : "bundleless";
131
+ var _config_format;
132
+ newConfig.format = (_config_format = config.format) !== null && _config_format !== void 0 ? _config_format : "cjs";
133
+ var _config_target;
134
+ newConfig.target = (_config_target = config.target) !== null && _config_target !== void 0 ? _config_target : "esnext";
135
+ newConfig.dts = ((_legacyUserConfig_output3 = legacyUserConfig.output) === null || _legacyUserConfig_output3 === void 0 ? void 0 : _legacyUserConfig_output3.disableTsChecker) ? false : {};
183
136
  if (config.dtsOnly) {
184
- newConfig.dts = __spreadProps(__spreadValues({}, typeof newConfig.dts === "object" ? newConfig.dts : {}), {
137
+ newConfig.dts = {
138
+ ...typeof newConfig.dts === "object" ? newConfig.dts : {},
185
139
  only: true
186
- });
140
+ };
187
141
  }
188
142
  if (config.tsconfig) {
189
- newConfig.dts = __spreadProps(__spreadValues({}, typeof newConfig.dts === "object" ? newConfig.dts : {}), {
143
+ newConfig.dts = {
144
+ ...typeof newConfig.dts === "object" ? newConfig.dts : {},
190
145
  tsconfigPath: config.tsconfig
191
- });
146
+ };
192
147
  }
193
148
  if (!config.enableDts) {
194
149
  newConfig.dts = false;
@@ -198,32 +153,36 @@ const createConfigByBuildConfig = (legacyUserConfig) => __async(void 0, null, fu
198
153
  if (bundleOptions.entry) {
199
154
  newConfig.input = config.bundleOptions.entry;
200
155
  }
201
- newConfig.splitting = (_k = bundleOptions.splitting) != null ? _k : false;
202
- newConfig.platform = (_l = bundleOptions.platform) != null ? _l : "node";
203
- newConfig.minify = (_m = bundleOptions.minify) != null ? _m : false;
204
- newConfig.externals = (_n = bundleOptions.externals) != null ? _n : [];
205
- newConfig.autoExternal = (_o = bundleOptions.skipDeps) != null ? _o : true;
156
+ var _bundleOptions_splitting;
157
+ newConfig.splitting = (_bundleOptions_splitting = bundleOptions.splitting) !== null && _bundleOptions_splitting !== void 0 ? _bundleOptions_splitting : false;
158
+ var _bundleOptions_platform;
159
+ newConfig.platform = (_bundleOptions_platform = bundleOptions.platform) !== null && _bundleOptions_platform !== void 0 ? _bundleOptions_platform : "node";
160
+ var _bundleOptions_minify;
161
+ newConfig.minify = (_bundleOptions_minify = bundleOptions.minify) !== null && _bundleOptions_minify !== void 0 ? _bundleOptions_minify : false;
162
+ var _bundleOptions_externals;
163
+ newConfig.externals = (_bundleOptions_externals = bundleOptions.externals) !== null && _bundleOptions_externals !== void 0 ? _bundleOptions_externals : [];
164
+ var _bundleOptions_skipDeps;
165
+ newConfig.autoExternal = (_bundleOptions_skipDeps = bundleOptions.skipDeps) !== null && _bundleOptions_skipDeps !== void 0 ? _bundleOptions_skipDeps : true;
206
166
  }
207
167
  if (config.bundlelessOptions) {
168
+ var _bundlelessOptions_static;
208
169
  const { bundlelessOptions } = config;
209
- newConfig.sourceDir = (_p = bundlelessOptions.sourceDir) != null ? _p : "./src";
170
+ var _bundlelessOptions_sourceDir;
171
+ newConfig.sourceDir = (_bundlelessOptions_sourceDir = bundlelessOptions.sourceDir) !== null && _bundlelessOptions_sourceDir !== void 0 ? _bundlelessOptions_sourceDir : "./src";
210
172
  if (bundlelessOptions.style) {
211
- logger.warn(
212
- "bundlelessOptions.style is not support in legacy mode. Please check migrate documentation. By default, the style will be compiled."
213
- );
173
+ logger.warn("bundlelessOptions.style is not support in legacy mode. Please check migrate documentation. By default, the style will be compiled.");
214
174
  }
215
- if ((_q = bundlelessOptions.static) == null ? void 0 : _q.path) {
175
+ if ((_bundlelessOptions_static = bundlelessOptions.static) === null || _bundlelessOptions_static === void 0 ? void 0 : _bundlelessOptions_static.path) {
176
+ var _bundlelessOptions_static1;
216
177
  newConfig.asset = {
217
- path: (_r = bundlelessOptions.static) == null ? void 0 : _r.path
178
+ path: (_bundlelessOptions_static1 = bundlelessOptions.static) === null || _bundlelessOptions_static1 === void 0 ? void 0 : _bundlelessOptions_static1.path
218
179
  };
219
180
  }
220
181
  }
221
- if ((_s = legacyUserConfig.output) == null ? void 0 : _s.importStyle) {
222
- logger.warn(
223
- "`output.importStyle` is not support in legacy mode. Please check migrate documentation. By default, the style will be compiled"
224
- );
182
+ if ((_legacyUserConfig_output4 = legacyUserConfig.output) === null || _legacyUserConfig_output4 === void 0 ? void 0 : _legacyUserConfig_output4.importStyle) {
183
+ logger.warn("`output.importStyle` is not support in legacy mode. Please check migrate documentation. By default, the style will be compiled");
225
184
  }
226
- if ((_t = legacyUserConfig.output) == null ? void 0 : _t.jsPath) {
185
+ if ((_legacyUserConfig_output5 = legacyUserConfig.output) === null || _legacyUserConfig_output5 === void 0 ? void 0 : _legacyUserConfig_output5.jsPath) {
227
186
  logger.warn("`output.jsPath` is not support in legacy mode.");
228
187
  }
229
188
  if (legacyUserConfig.tools) {
@@ -233,14 +192,14 @@ const createConfigByBuildConfig = (legacyUserConfig) => __async(void 0, null, fu
233
192
  };
234
193
  const finalConfig = {};
235
194
  if (Array.isArray(legacyBuildConfig)) {
236
- finalConfig.buildConfig = legacyBuildConfig.map(
237
- (config) => createBuildConfig(config)
238
- );
195
+ finalConfig.buildConfig = legacyBuildConfig.map((config) => createBuildConfig(config));
239
196
  } else {
240
- finalConfig.buildConfig = [createBuildConfig(legacyBuildConfig)];
197
+ finalConfig.buildConfig = [
198
+ createBuildConfig(legacyBuildConfig)
199
+ ];
241
200
  }
242
- finalConfig.designSystem = (_a = legacyUserConfig.source) == null ? void 0 : _a.designSystem;
243
- if ((_b = legacyUserConfig.output) == null ? void 0 : _b.copy) {
201
+ finalConfig.designSystem = (_legacyUserConfig_source = legacyUserConfig.source) === null || _legacyUserConfig_source === void 0 ? void 0 : _legacyUserConfig_source.designSystem;
202
+ if ((_legacyUserConfig_output = legacyUserConfig.output) === null || _legacyUserConfig_output === void 0 ? void 0 : _legacyUserConfig_output.copy) {
244
203
  finalConfig.buildConfig.push({
245
204
  copy: {
246
205
  patterns: legacyUserConfig.output.copy
@@ -250,14 +209,10 @@ const createConfigByBuildConfig = (legacyUserConfig) => __async(void 0, null, fu
250
209
  if (legacyUserConfig.tools) {
251
210
  const legacyTools = legacyUserConfig.tools;
252
211
  if (legacyTools.babel) {
253
- logger.warn(
254
- "`tools.babel` is not support in legacy mode. Please check migrate documentation."
255
- );
212
+ logger.warn("`tools.babel` is not support in legacy mode. Please check migrate documentation.");
256
213
  }
257
214
  if (legacyTools.lodash) {
258
- logger.warn(
259
- "`tools.lodash` is not support in legacy mode. Please check migrate documentation."
260
- );
215
+ logger.warn("`tools.lodash` is not support in legacy mode. Please check migrate documentation.");
261
216
  }
262
217
  if (legacyTools.jest) {
263
218
  finalConfig.testing = {
@@ -266,21 +221,22 @@ const createConfigByBuildConfig = (legacyUserConfig) => __async(void 0, null, fu
266
221
  }
267
222
  }
268
223
  return finalConfig;
269
- });
270
- const createConfigByBuildPreset = (legacyUserConfig) => __async(void 0, null, function* () {
271
- var _a;
272
- const legacyBuildPreset = (_a = legacyUserConfig.output) == null ? void 0 : _a.buildPreset;
273
- const finalConfig = yield commonTransformAndLog(legacyUserConfig);
274
- return __spreadProps(__spreadValues({}, finalConfig), {
224
+ };
225
+ const createConfigByBuildPreset = async (legacyUserConfig) => {
226
+ var _legacyUserConfig_output;
227
+ const legacyBuildPreset = (_legacyUserConfig_output = legacyUserConfig.output) === null || _legacyUserConfig_output === void 0 ? void 0 : _legacyUserConfig_output.buildPreset;
228
+ const finalConfig = await commonTransformAndLog(legacyUserConfig);
229
+ return {
230
+ ...finalConfig,
275
231
  buildPreset({ preset }) {
276
- var _a2;
277
- const buildConfigs = preset[legacyBuildPreset != null ? legacyBuildPreset : "npm-library"];
232
+ var _legacyUserConfig_output2;
233
+ const buildConfigs = preset[legacyBuildPreset !== null && legacyBuildPreset !== void 0 ? legacyBuildPreset : "npm-library"];
278
234
  buildConfigs.forEach((buildConfig) => {
279
235
  transformSourceToBuildConfig(buildConfig, legacyUserConfig);
280
236
  transformToolsToBuildConfig(buildConfig, legacyUserConfig);
281
237
  transformOutputToBuildConfig(buildConfig, legacyUserConfig);
282
238
  });
283
- if ((_a2 = legacyUserConfig.output) == null ? void 0 : _a2.copy) {
239
+ if ((_legacyUserConfig_output2 = legacyUserConfig.output) === null || _legacyUserConfig_output2 === void 0 ? void 0 : _legacyUserConfig_output2.copy) {
284
240
  buildConfigs.push({
285
241
  copy: {
286
242
  patterns: legacyUserConfig.output.copy
@@ -289,11 +245,11 @@ const createConfigByBuildPreset = (legacyUserConfig) => __async(void 0, null, fu
289
245
  }
290
246
  return buildConfigs;
291
247
  }
292
- });
293
- });
294
- const createConfigByPackageFields = (legacyUserConfig) => __async(void 0, null, function* () {
295
- var _a, _b, _c, _d;
296
- const finalConfig = yield commonTransformAndLog(legacyUserConfig);
248
+ };
249
+ };
250
+ const createConfigByPackageFields = async (legacyUserConfig) => {
251
+ var _legacyUserConfig_output;
252
+ const finalConfig = await commonTransformAndLog(legacyUserConfig);
297
253
  const output = legacyUserConfig.output;
298
254
  const packageFields = output.packageFields;
299
255
  const buildConfigs = [];
@@ -303,11 +259,14 @@ const createConfigByPackageFields = (legacyUserConfig) => __async(void 0, null,
303
259
  let buildConfig = {};
304
260
  let outDir;
305
261
  if (packageField === "main") {
306
- outDir = `./${(_a = output.path) != null ? _a : "dist"}/js/node`;
262
+ var _output_path;
263
+ outDir = `./${(_output_path = output.path) !== null && _output_path !== void 0 ? _output_path : "dist"}/js/node`;
307
264
  } else if (packageField === "module") {
308
- outDir = `./${(_b = output.path) != null ? _b : "dist"}/js/treeshaking`;
265
+ var _output_path1;
266
+ outDir = `./${(_output_path1 = output.path) !== null && _output_path1 !== void 0 ? _output_path1 : "dist"}/js/treeshaking`;
309
267
  } else {
310
- outDir = `./${(_c = output.path) != null ? _c : "dist"}/js/modern`;
268
+ var _output_path2;
269
+ outDir = `./${(_output_path2 = output.path) !== null && _output_path2 !== void 0 ? _output_path2 : "dist"}/js/modern`;
311
270
  }
312
271
  if (packageFieldValue === "CJS+ES6") {
313
272
  buildConfig = {
@@ -340,21 +299,22 @@ const createConfigByPackageFields = (legacyUserConfig) => __async(void 0, null,
340
299
  only: true
341
300
  }
342
301
  });
343
- if ((_d = legacyUserConfig.output) == null ? void 0 : _d.copy) {
302
+ if ((_legacyUserConfig_output = legacyUserConfig.output) === null || _legacyUserConfig_output === void 0 ? void 0 : _legacyUserConfig_output.copy) {
344
303
  buildConfigs.push({
345
304
  copy: {
346
305
  patterns: legacyUserConfig.output.copy
347
306
  }
348
307
  });
349
308
  }
350
- return __spreadProps(__spreadValues({}, finalConfig), {
309
+ return {
310
+ ...finalConfig,
351
311
  buildConfig: buildConfigs
352
- });
353
- });
354
- const createConfigByPackageMode = (legacyUserConfig) => __async(void 0, null, function* () {
355
- var _a;
356
- const finalConfig = yield commonTransformAndLog(legacyUserConfig);
357
- const { legacyPresets } = yield Promise.resolve().then(() => __toESM(require("../constants/legacyBuildPresets")));
312
+ };
313
+ };
314
+ const createConfigByPackageMode = async (legacyUserConfig) => {
315
+ var _legacyUserConfig_output;
316
+ const finalConfig = await commonTransformAndLog(legacyUserConfig);
317
+ const { legacyPresets } = await Promise.resolve().then(() => /* @__PURE__ */ _interop_require_wildcard._(require("../constants/legacyBuildPresets")));
358
318
  const packageMode = legacyUserConfig.output.packageMode;
359
319
  const buildConfigs = legacyPresets[packageMode];
360
320
  for (const buildConfig of buildConfigs) {
@@ -362,41 +322,43 @@ const createConfigByPackageMode = (legacyUserConfig) => __async(void 0, null, fu
362
322
  transformToolsToBuildConfig(buildConfig, legacyUserConfig);
363
323
  transformOutputToBuildConfig(buildConfig, legacyUserConfig);
364
324
  }
365
- if ((_a = legacyUserConfig.output) == null ? void 0 : _a.copy) {
325
+ if ((_legacyUserConfig_output = legacyUserConfig.output) === null || _legacyUserConfig_output === void 0 ? void 0 : _legacyUserConfig_output.copy) {
366
326
  buildConfigs.push({
367
327
  copy: {
368
328
  patterns: legacyUserConfig.output.copy
369
329
  }
370
330
  });
371
331
  }
372
- return __spreadProps(__spreadValues({}, finalConfig), {
332
+ return {
333
+ ...finalConfig,
373
334
  buildConfig: buildConfigs
374
- });
375
- });
376
- const createConfigByDefault = (legacyUserConfig) => __async(void 0, null, function* () {
377
- var _a;
378
- const finalConfig = yield commonTransformAndLog(legacyUserConfig);
379
- const { legacyPresets } = yield Promise.resolve().then(() => __toESM(require("../constants/legacyBuildPresets")));
335
+ };
336
+ };
337
+ const createConfigByDefault = async (legacyUserConfig) => {
338
+ var _legacyUserConfig_output;
339
+ const finalConfig = await commonTransformAndLog(legacyUserConfig);
340
+ const { legacyPresets } = await Promise.resolve().then(() => /* @__PURE__ */ _interop_require_wildcard._(require("../constants/legacyBuildPresets")));
380
341
  const buildConfigs = legacyPresets["universal-js"];
381
342
  for (const buildConfig of buildConfigs) {
382
343
  transformSourceToBuildConfig(buildConfig, legacyUserConfig);
383
344
  transformToolsToBuildConfig(buildConfig, legacyUserConfig);
384
345
  transformOutputToBuildConfig(buildConfig, legacyUserConfig);
385
346
  }
386
- if ((_a = legacyUserConfig.output) == null ? void 0 : _a.copy) {
347
+ if ((_legacyUserConfig_output = legacyUserConfig.output) === null || _legacyUserConfig_output === void 0 ? void 0 : _legacyUserConfig_output.copy) {
387
348
  buildConfigs.push({
388
349
  copy: {
389
350
  patterns: legacyUserConfig.output.copy
390
351
  }
391
352
  });
392
353
  }
393
- return __spreadProps(__spreadValues({}, finalConfig), {
354
+ return {
355
+ ...finalConfig,
394
356
  buildConfig: buildConfigs
395
- });
396
- });
397
- const createUserConfigFromLegacy = (config) => __async(void 0, null, function* () {
398
- var _a;
399
- const { buildConfig, buildPreset, packageFields, packageMode } = (_a = config.output) != null ? _a : {};
357
+ };
358
+ };
359
+ const createUserConfigFromLegacy = async (config) => {
360
+ var _config_output;
361
+ const { buildConfig, buildPreset, packageFields, packageMode } = (_config_output = config.output) !== null && _config_output !== void 0 ? _config_output : {};
400
362
  if (buildConfig) {
401
363
  return createConfigByBuildConfig(config);
402
364
  }
@@ -410,19 +372,6 @@ const createUserConfigFromLegacy = (config) => __async(void 0, null, function* (
410
372
  return createConfigByPackageFields(config);
411
373
  }
412
374
  return createConfigByDefault(config);
413
- });
414
- // Annotate the CommonJS export names for ESM import in node:
415
- 0 && (module.exports = {
416
- commonTransformAndLog,
417
- createConfigByBuildConfig,
418
- createConfigByBuildPreset,
419
- createConfigByDefault,
420
- createConfigByPackageFields,
421
- createConfigByPackageMode,
422
- createUserConfigFromLegacy,
423
- transformOutputToBuildConfig,
424
- transformSourceToBuildConfig,
425
- transformToolsToBuildConfig
426
- });
375
+ };
427
376
 
428
377
  //# sourceMappingURL=transformLegacyConfig.js.map