@modern-js/module-tools 2.31.2 → 2.32.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 (95) hide show
  1. package/CHANGELOG.md +29 -0
  2. package/LICENSE +1 -1
  3. package/dist/builder/build.js +18 -23
  4. package/dist/builder/build.js.map +1 -1
  5. package/dist/builder/clear.js +6 -9
  6. package/dist/builder/clear.js.map +1 -1
  7. package/dist/builder/copy.d.ts +2 -1
  8. package/dist/builder/copy.js +19 -22
  9. package/dist/builder/copy.js.map +1 -1
  10. package/dist/builder/dts/rollup.d.ts +3 -1
  11. package/dist/builder/dts/rollup.js +14 -13
  12. package/dist/builder/dts/rollup.js.map +1 -1
  13. package/dist/builder/dts/tsc.js +16 -22
  14. package/dist/builder/dts/tsc.js.map +1 -1
  15. package/dist/builder/index.js +14 -14
  16. package/dist/builder/index.js.map +1 -1
  17. package/dist/builder/platform.js +14 -16
  18. package/dist/builder/platform.js.map +1 -1
  19. package/dist/cli.js +16 -16
  20. package/dist/cli.js.map +1 -1
  21. package/dist/command.js +9 -16
  22. package/dist/command.js.map +1 -1
  23. package/dist/config/merge.d.ts +9 -0
  24. package/dist/{utils/config.js → config/merge.js} +45 -53
  25. package/dist/config/merge.js.map +1 -0
  26. package/dist/config/normalize.d.ts +5 -13
  27. package/dist/config/normalize.js +54 -90
  28. package/dist/config/normalize.js.map +1 -1
  29. package/dist/config/schema.d.ts +12 -0
  30. package/dist/config/schema.js +3 -0
  31. package/dist/config/schema.js.map +1 -1
  32. package/dist/config/transformLegacyConfig.js +13 -16
  33. package/dist/config/transformLegacyConfig.js.map +1 -1
  34. package/dist/config/valid.d.ts +3 -0
  35. package/dist/config/valid.js +39 -0
  36. package/dist/config/valid.js.map +1 -0
  37. package/dist/constants/build.d.ts +1 -1
  38. package/dist/constants/build.js +61 -58
  39. package/dist/constants/build.js.map +1 -1
  40. package/dist/constants/{colors.js → color.js} +1 -1
  41. package/dist/constants/{colors.js.map → color.js.map} +1 -1
  42. package/dist/constants/dts.d.ts +0 -1
  43. package/dist/constants/dts.js +0 -4
  44. package/dist/constants/dts.js.map +1 -1
  45. package/dist/constants/{legacyBuildPresets.js → legacy-preset.js} +1 -1
  46. package/dist/constants/legacy-preset.js.map +1 -0
  47. package/dist/constants/preset.d.ts +26 -0
  48. package/dist/constants/{buildPresets.js → preset.js} +4 -18
  49. package/dist/constants/preset.js.map +1 -0
  50. package/dist/dev.js +6 -8
  51. package/dist/dev.js.map +1 -1
  52. package/dist/index.d.ts +1 -1
  53. package/dist/index.js +2 -2
  54. package/dist/index.js.map +1 -1
  55. package/dist/types/command.d.ts +2 -2
  56. package/dist/types/config/copy.js.map +1 -0
  57. package/dist/types/config/dev.d.ts +8 -0
  58. package/dist/types/config/dev.js +6 -0
  59. package/dist/types/config/dev.js.map +1 -0
  60. package/dist/types/config/index.d.ts +6 -5
  61. package/dist/types/config/index.js.map +1 -1
  62. package/dist/types/index.d.ts +3 -3
  63. package/dist/types/index.js.map +1 -1
  64. package/dist/utils/builder.d.ts +1 -4
  65. package/dist/utils/builder.js +3 -29
  66. package/dist/utils/builder.js.map +1 -1
  67. package/dist/utils/common.d.ts +2 -1
  68. package/dist/utils/common.js +18 -3
  69. package/dist/utils/common.js.map +1 -1
  70. package/dist/utils/dts.d.ts +1 -2
  71. package/dist/utils/dts.js +11 -32
  72. package/dist/utils/dts.js.map +1 -1
  73. package/dist/utils/input.d.ts +4 -10
  74. package/dist/utils/input.js +36 -60
  75. package/dist/utils/input.js.map +1 -1
  76. package/dist/utils/{libuildPlugins.d.ts → libuild-plugin.d.ts} +1 -4
  77. package/dist/utils/{libuildPlugins.js → libuild-plugin.js} +4 -25
  78. package/dist/utils/libuild-plugin.js.map +1 -0
  79. package/dist/utils/print.js +1 -3
  80. package/dist/utils/print.js.map +1 -1
  81. package/dist/utils/style.js +14 -19
  82. package/dist/utils/style.js.map +1 -1
  83. package/package.json +20 -17
  84. package/dist/constants/buildPresets.d.ts +0 -91
  85. package/dist/constants/buildPresets.js.map +0 -1
  86. package/dist/constants/legacyBuildPresets.js.map +0 -1
  87. package/dist/types/copy.js.map +0 -1
  88. package/dist/utils/config.d.ts +0 -9
  89. package/dist/utils/config.js.map +0 -1
  90. package/dist/utils/libuildPlugins.js.map +0 -1
  91. package/scripts/debug-mode.js +0 -48
  92. /package/dist/constants/{colors.d.ts → color.d.ts} +0 -0
  93. /package/dist/constants/{legacyBuildPresets.d.ts → legacy-preset.d.ts} +0 -0
  94. /package/dist/types/{copy.d.ts → config/copy.d.ts} +0 -0
  95. /package/dist/types/{copy.js → config/copy.js} +0 -0
@@ -10,15 +10,6 @@ function _export(target, all) {
10
10
  });
11
11
  }
12
12
  _export(exports, {
13
- joinPathWithPrefix: function() {
14
- return joinPathWithPrefix;
15
- },
16
- getAbsInput: function() {
17
- return getAbsInput;
18
- },
19
- addInputToPreset: function() {
20
- return addInputToPreset;
21
- },
22
13
  getDefaultIndexEntry: function() {
23
14
  return getDefaultIndexEntry;
24
15
  },
@@ -27,68 +18,53 @@ _export(exports, {
27
18
  }
28
19
  });
29
20
  const _interop_require_default = require("@swc/helpers/_/_interop_require_default");
30
- const _interop_require_wildcard = require("@swc/helpers/_/_interop_require_wildcard");
31
21
  const _path = /* @__PURE__ */ _interop_require_default._(require("path"));
32
- const joinPathWithPrefix = (flag) => (p1, globPath) => {
33
- const haveFlag = globPath.trim().startsWith(flag);
34
- if (haveFlag) {
35
- return `${flag}${_path.default.join(p1, globPath.replace(flag, ""))}`;
36
- }
37
- return _path.default.join(p1, globPath);
38
- };
39
- const getAbsInput = async (entry, options) => {
40
- const { slash } = await Promise.resolve().then(() => /* @__PURE__ */ _interop_require_wildcard._(require("@modern-js/utils")));
41
- const { appDirectory } = options;
42
- const resolvePathWithNoMatchFlag = joinPathWithPrefix("!");
43
- if (Array.isArray(entry)) {
44
- return entry.map((p) => _path.default.isAbsolute(p) ? slash(p) : slash(resolvePathWithNoMatchFlag(appDirectory, p)));
45
- }
46
- const newEntry = {};
47
- for (const key of Object.keys(entry)) {
48
- newEntry[key] = _path.default.isAbsolute(entry[key]) ? slash(entry[key]) : slash(resolvePathWithNoMatchFlag(appDirectory, entry[key]));
49
- }
50
- return newEntry;
51
- };
52
- const addInputToPreset = async (config, context) => {
53
- if (Array.isArray(config)) {
54
- for (const c of config) {
55
- if (c.buildType === "bundle") {
56
- c.input = await getDefaultIndexEntry(context);
57
- } else if (c.buildType === "bundleless") {
58
- c.sourceDir = "./src";
59
- }
60
- }
61
- } else if (config.buildType === "bundle") {
62
- config.input = await getDefaultIndexEntry(context);
63
- } else if (config.buildType === "bundleless") {
64
- config.sourceDir = "./src";
65
- }
66
- return config;
67
- };
22
+ const _utils = require("@modern-js/utils");
68
23
  const getDefaultIndexEntry = async ({ isTsProject, appDirectory }) => {
69
- const { fs } = await Promise.resolve().then(() => /* @__PURE__ */ _interop_require_wildcard._(require("@modern-js/utils")));
70
- let entry = isTsProject ? _path.default.join(appDirectory, "./src/index.ts") : _path.default.join(appDirectory, "./src/index.js");
71
- if (fs.existsSync(entry)) {
24
+ let entry = isTsProject ? "src/index.ts" : "src/index.js";
25
+ if (_utils.fs.existsSync(_path.default.resolve(appDirectory, entry))) {
72
26
  return [
73
- `./${_path.default.relative(appDirectory, entry)}`
27
+ entry
74
28
  ];
75
29
  }
76
- entry = isTsProject ? _path.default.join(appDirectory, "./src/index.tsx") : _path.default.join(appDirectory, "./src/index.jsx");
77
- if (fs.existsSync(entry)) {
30
+ entry = isTsProject ? "src/index.tsx" : "src/index.jsx";
31
+ if (_utils.fs.existsSync(_path.default.resolve(appDirectory, entry))) {
78
32
  return [
79
- `./${_path.default.relative(appDirectory, entry)}`
33
+ entry
80
34
  ];
81
35
  }
82
36
  return [];
83
37
  };
84
- const normalizeInput = async (baseConfig, options) => {
85
- if (baseConfig.buildType === "bundleless" && !baseConfig.input) {
86
- const { slash } = await Promise.resolve().then(() => /* @__PURE__ */ _interop_require_wildcard._(require("@modern-js/utils")));
87
- return [
88
- slash(baseConfig.sourceDir)
89
- ];
38
+ const normalizeInput = async (input, appDirectory) => {
39
+ const extensions = [
40
+ "js",
41
+ "ts",
42
+ "jsx",
43
+ "tsx",
44
+ "mjs",
45
+ "cjs",
46
+ "mts",
47
+ "cts",
48
+ "css",
49
+ "sass",
50
+ "scss",
51
+ "less",
52
+ "json"
53
+ ];
54
+ if ((0, _utils.isArray)(input)) {
55
+ const normalizedInput = await (0, _utils.globby)(input.map(_utils.slash), {
56
+ expandDirectories: {
57
+ extensions
58
+ },
59
+ ignore: [
60
+ "**/*.d.ts"
61
+ ],
62
+ cwd: appDirectory
63
+ });
64
+ return normalizedInput;
65
+ } else {
66
+ return input;
90
67
  }
91
- return getAbsInput(baseConfig.input, options);
92
68
  };
93
69
 
94
70
  //# sourceMappingURL=input.js.map
@@ -1 +1 @@
1
- {"version":3,"file":null,"mappings":";;;;;;;;;;;;EAYaA,oBAAkB;WAAlBA;;EAUAC,aAAW;WAAXA;;EAsBAC,kBAAgB;WAAhBA;;EAqBAC,sBAAoB;WAApBA;;EAyBAC,gBAAc;WAAdA;;;;;iEA1FI;AAYV,MAAMJ,qBACX,CAACK,SAAiB,CAACC,IAAYC;AAC7B,QAAMC,WAAWD,SAASE,KAAI,EAAGC,WAAWL;AAC5C,MAAIG,UAAU;AACZ,WAAO,GAAGH,OAAOM,cAAKC,KAAKN,IAAIC,SAASM,QAAQR,MAAM;EACxD;AAEA,SAAOM,cAAKC,KAAKN,IAAIC;AACvB;AAEK,MAAMN,cAAc,OAAOa,OAAcC;AAC9C,QAAM,EAAEC,MAAK,IAAK,MAAM,iFAAO;AAC/B,QAAM,EAAEC,aAAY,IAAKF;AACzB,QAAMG,6BAA6BlB,mBAAmB;AAEtD,MAAImB,MAAMC,QAAQN,QAAQ;AACxB,WAAOA,MAAMO,IAAIC,OACfX,cAAKY,WAAWD,KACZN,MAAMM,KACNN,MAAME,2BAA2BD,cAAcK;EAEvD;AAEA,QAAME,WAAmC,CAAC;AAC1C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C,YAAYqC,WAAWN,OAAOjB;AACvC;","names":["joinPathWithPrefix","getAbsInput","addInputToPreset","getDefaultIndexEntry","normalizeInput","flag","p1","globPath","haveFlag","trim","startsWith","path","join","replace","entry","options","slash","appDirectory","resolvePathWithNoMatchFlag","Array","isArray","map","p","isAbsolute","newEntry","key","Object","keys","config","context","c","buildType","input","sourceDir","isTsProject","fs","existsSync","relative","baseConfig"],"sources":["../../src/utils/home/runner/work/modern.js/modern.js/packages/solutions/module-tools/src/utils/input.ts"],"sourcesContent":["import path from 'path';\nimport { ModuleContext } from '../types';\nimport type {\n Input,\n BaseBuildConfig,\n PartialBuildConfig,\n} from '../types/config';\n\ninterface EntryOptions {\n appDirectory: string;\n}\n\nexport const joinPathWithPrefix =\n (flag: string) => (p1: string, globPath: string) => {\n const haveFlag = globPath.trim().startsWith(flag);\n if (haveFlag) {\n return `${flag}${path.join(p1, globPath.replace(flag, ''))}`;\n }\n\n return path.join(p1, globPath);\n };\n\nexport const getAbsInput = async (entry: Input, options: EntryOptions) => {\n const { slash } = await import('@modern-js/utils');\n const { appDirectory } = options;\n const resolvePathWithNoMatchFlag = joinPathWithPrefix('!');\n\n if (Array.isArray(entry)) {\n return entry.map(p =>\n path.isAbsolute(p)\n ? slash(p)\n : slash(resolvePathWithNoMatchFlag(appDirectory, p)),\n );\n }\n\n const newEntry: Record<string, string> = {};\n for (const key of Object.keys(entry)) {\n newEntry[key] = path.isAbsolute(entry[key])\n ? slash(entry[key])\n : slash(resolvePathWithNoMatchFlag(appDirectory, entry[key]));\n }\n return newEntry;\n};\n\nexport const addInputToPreset = async (\n config: PartialBuildConfig,\n context: ModuleContext,\n) => {\n if (Array.isArray(config)) {\n for (const c of config) {\n if (c.buildType === 'bundle') {\n c.input = await getDefaultIndexEntry(context);\n } else if (c.buildType === 'bundleless') {\n c.sourceDir = './src';\n }\n }\n } else if (config.buildType === 'bundle') {\n config.input = await getDefaultIndexEntry(context);\n } else if (config.buildType === 'bundleless') {\n config.sourceDir = './src';\n }\n\n return config;\n};\n\nexport const getDefaultIndexEntry = async ({\n isTsProject,\n appDirectory,\n}: {\n isTsProject: boolean;\n appDirectory: string;\n}) => {\n const { fs } = await import('@modern-js/utils');\n let entry = isTsProject\n ? path.join(appDirectory, './src/index.ts')\n : path.join(appDirectory, './src/index.js');\n if (fs.existsSync(entry)) {\n return [`./${path.relative(appDirectory, entry)}`];\n }\n\n entry = isTsProject\n ? path.join(appDirectory, './src/index.tsx')\n : path.join(appDirectory, './src/index.jsx');\n if (fs.existsSync(entry)) {\n return [`./${path.relative(appDirectory, entry)}`];\n }\n\n return [];\n};\n\nexport const normalizeInput = async (\n baseConfig: BaseBuildConfig,\n options: EntryOptions,\n) => {\n if (baseConfig.buildType === 'bundleless' && !baseConfig.input) {\n const { slash } = await import('@modern-js/utils');\n return [slash(baseConfig.sourceDir)];\n }\n return getAbsInput(baseConfig.input, options);\n};\n"]}
1
+ {"version":3,"file":null,"mappings":";;;;;;;;;;;;EAIaA,sBAAoB;WAApBA;;EAoBAC,gBAAc;WAAdA;;;;iEAxBI;uBAC0B;AAGpC,MAAMD,uBAAuB,OAAO,EACzCE,aACAC,aAAY,MAIb;AACC,MAAIC,QAAQF,cAAc,iBAAiB;AAC3C,MAAIG,UAAGC,WAAWC,cAAKC,QAAQL,cAAcC,SAAS;AACpD,WAAO;MAACA;;EACV;AAEAA,UAAQF,cAAc,kBAAkB;AACxC,MAAIG,UAAGC,WAAWC,cAAKC,QAAQL,cAAcC,SAAS;AACpD,WAAO;MAACA;;EACV;AAEA,SAAO;AACT;AAEO,MAAMH,iBAAiB,OAAOQ,OAAcN;AACjD,QAAMO,aAAa;IACjB;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;;AAGF,OAAIC,mBAAQF,QAAQ;AAClB,UAAMG,kBAAkB,OAAMC,kBAAOJ,MAAMK,IAAIC,YAAK,GAAG;MACrDC,mBAAmB;QACjBN;MACF;MACAO,QAAQ;QAAC;;MACTC,KAAKf;IACP;AACA,WAAOS;EACT,OAAO;AACL,WAAOH;EACT;AACF;","names":["getDefaultIndexEntry","normalizeInput","isTsProject","appDirectory","entry","fs","existsSync","path","resolve","input","extensions","isArray","normalizedInput","globby","map","slash","expandDirectories","ignore","cwd"],"sources":["../../src/utils/home/runner/work/modern.js/modern.js/packages/solutions/module-tools/src/utils/input.ts"],"sourcesContent":["import path from 'path';\nimport { fs, globby, isArray, slash } from '@modern-js/utils';\nimport { Input } from '../types';\n\nexport const getDefaultIndexEntry = async ({\n isTsProject,\n appDirectory,\n}: {\n isTsProject: boolean;\n appDirectory: string;\n}) => {\n let entry = isTsProject ? 'src/index.ts' : 'src/index.js';\n if (fs.existsSync(path.resolve(appDirectory, entry))) {\n return [entry];\n }\n\n entry = isTsProject ? 'src/index.tsx' : 'src/index.jsx';\n if (fs.existsSync(path.resolve(appDirectory, entry))) {\n return [entry];\n }\n\n return [];\n};\n\nexport const normalizeInput = async (input: Input, appDirectory: string) => {\n const extensions = [\n 'js',\n 'ts',\n 'jsx',\n 'tsx',\n 'mjs',\n 'cjs',\n 'mts',\n 'cts',\n 'css',\n 'sass',\n 'scss',\n 'less',\n 'json',\n ];\n\n if (isArray(input)) {\n const normalizedInput = await globby(input.map(slash), {\n expandDirectories: {\n extensions,\n },\n ignore: ['**/*.d.ts'],\n cwd: appDirectory,\n });\n return normalizedInput;\n } else {\n return input;\n }\n};\n"]}
@@ -1,6 +1,3 @@
1
1
  import type { LibuildPlugin } from '@modern-js/libuild';
2
2
  import type { BaseBuildConfig, PluginAPI, ModuleTools } from '../types';
3
- export declare const watchPlugin: (api: PluginAPI<ModuleTools>, config: BaseBuildConfig) => LibuildPlugin;
4
- export declare const externalPlugin: (config: BaseBuildConfig, options: {
5
- appDirectory: string;
6
- }) => LibuildPlugin;
3
+ export declare const watchPlugin: (api: PluginAPI<ModuleTools>, config: BaseBuildConfig) => LibuildPlugin;
@@ -2,19 +2,10 @@
2
2
  Object.defineProperty(exports, "__esModule", {
3
3
  value: true
4
4
  });
5
- function _export(target, all) {
6
- for (var name in all)
7
- Object.defineProperty(target, name, {
8
- enumerable: true,
9
- get: all[name]
10
- });
11
- }
12
- _export(exports, {
13
- watchPlugin: function() {
5
+ Object.defineProperty(exports, "watchPlugin", {
6
+ enumerable: true,
7
+ get: function() {
14
8
  return watchPlugin;
15
- },
16
- externalPlugin: function() {
17
- return externalPlugin;
18
9
  }
19
10
  });
20
11
  const _interop_require_wildcard = require("@swc/helpers/_/_interop_require_wildcard");
@@ -36,17 +27,5 @@ const watchPlugin = (api, config) => {
36
27
  }
37
28
  };
38
29
  };
39
- const externalPlugin = (config, options) => {
40
- return {
41
- name: "external-plugin",
42
- apply(compiler) {
43
- compiler.hooks.initialize.tapPromise("external-plugin", async () => {
44
- const { getFinalExternals } = await Promise.resolve().then(() => /* @__PURE__ */ _interop_require_wildcard._(require("./builder")));
45
- const finalExternals = await getFinalExternals(config, options);
46
- compiler.config.external = finalExternals;
47
- });
48
- }
49
- };
50
- };
51
30
 
52
- //# sourceMappingURL=libuildPlugins.js.map
31
+ //# sourceMappingURL=libuild-plugin.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":null,"mappings":";;;;+BAIaA;;;WAAAA;;;;wBAJU;AAIhB,MAAMA,cAAc,CACzBC,KACAC;AAEA,SAAO;IACLC,MAAM;IACNC,MAAMC,UAAQ;AACZA,eAASC,MAAMC,YAAYC,IAAI,gBAAgB;AAC7C,cAAM,EAAEC,kBAAiB,IAAK,MAAM,iFAAO;AAC3C,cAAM,EAAEC,mBAAkB,IAAK,MAAM,iFAAO;AAC5C,cAAMC,YAAY,IAChBT,OAAOU,cAAc,WAAW,WAAW,gBACzCV,OAAOW,UAAUX,OAAOY;AAE5BC,uBAAOC,KAAK,MAAMP,kBAAkBE,WAAWD,mBAAmBO,GAAG;AAErE,cAAMC,SAASjB,IAAIkB,eAAc;AACjCD,eAAOE,aAAa;UAAEC,aAAanB;QAAO;MAC5C;IACF;EACF;AACF;","names":["watchPlugin","api","config","name","apply","compiler","hooks","watchChange","tap","watchSectionTitle","SectionTitleStatus","titleText","buildType","format","target","logger","info","Log","runner","useHookRunners","buildWatchJs","buildConfig"],"sources":["../../src/utils/home/runner/work/modern.js/modern.js/packages/solutions/module-tools/src/utils/libuild-plugin.ts"],"sourcesContent":["import { logger } from '@modern-js/utils/logger';\nimport type { LibuildPlugin } from '@modern-js/libuild';\nimport type { BaseBuildConfig, PluginAPI, ModuleTools } from '../types';\n\nexport const watchPlugin = (\n api: PluginAPI<ModuleTools>,\n config: BaseBuildConfig,\n): LibuildPlugin => {\n return {\n name: 'watch-plugin',\n apply(compiler) {\n compiler.hooks.watchChange.tap('watch-plugin', async () => {\n const { watchSectionTitle } = await import('./log');\n const { SectionTitleStatus } = await import('../constants/log');\n const titleText = `[${\n config.buildType === 'bundle' ? 'Bundle' : 'Bundleless'\n }:${config.format}_${config.target}]`;\n\n logger.info(await watchSectionTitle(titleText, SectionTitleStatus.Log));\n\n const runner = api.useHookRunners();\n runner.buildWatchJs({ buildConfig: config });\n });\n },\n };\n};\n"]}
@@ -32,7 +32,6 @@ _export(exports, {
32
32
  return printSucceed;
33
33
  }
34
34
  });
35
- const _interop_require_wildcard = require("@swc/helpers/_/_interop_require_wildcard");
36
35
  const _path = require("path");
37
36
  const _utils = require("@modern-js/utils");
38
37
  const _log = require("../constants/log");
@@ -63,8 +62,7 @@ const addRollupChunk = (rollupOutput, appDirectory, distDir) => {
63
62
  }));
64
63
  };
65
64
  const addDtsFiles = async (distDir, appDirectory) => {
66
- const { fastGlob, slash } = await Promise.resolve().then(() => /* @__PURE__ */ _interop_require_wildcard._(require("@modern-js/utils")));
67
- const files = await fastGlob(`${slash(distDir)}**/*.d.ts`, {
65
+ const files = await (0, _utils.fastGlob)(`${(0, _utils.slash)(distDir)}/**/*.d.ts`, {
68
66
  stats: true
69
67
  });
70
68
  bundlelessFiles.push(...files.map((file) => {
@@ -1 +1 @@
1
- {"version":3,"file":null,"mappings":";;;;;;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DtsFiles","printFileSize","printSucceed","outputChunk","appDirectory","isBundle","files","Array","from","map","val","path","chunk","name","relative","size","contents","length","push","rollupOutput","distDir","output","o","resolve","fileName","code","fastGlob","slash","stats","file","printBundlelessInfo","printBundleFiles","totalDuration","time","chalk","cyan","logger","info","buildSuccessText","prettyBytes","bytes","unit","exp","Math","floor","log","pow","toFixed","longestFileLength","reduce","max","str","reportFile1LineText","headerRow","repeat","reportFile2LineText","bold","green","forEach","infoRow","count","totalSize","total"],"sources":["../../src/utils/home/runner/work/modern.js/modern.js/packages/solutions/module-tools/src/utils/print.ts"],"sourcesContent":["import { relative, resolve } from 'path';\nimport type { ILibuilder } from '@modern-js/libuild';\nimport { chalk, logger } from '@modern-js/utils';\nimport type {\n RollupOutput,\n OutputChunk,\n} from '../../compiled/rollup/types/rollup';\nimport {\n buildSuccessText,\n reportFile1LineText,\n reportFile2LineText,\n} from '../constants/log';\n\ntype Files = {\n name: string;\n size: number;\n};\n\nexport const bundleFiles: Files[] = [];\n\nexport const bundlelessFiles: Files[] = [];\n\nexport const addOutputChunk = (\n outputChunk: ILibuilder['outputChunk'],\n appDirectory: string,\n isBundle: boolean,\n) => {\n const files = Array.from(outputChunk).map(val => {\n const [path, chunk] = val;\n return {\n name: relative(appDirectory, path),\n size: chunk.contents.length,\n };\n });\n if (isBundle) {\n bundleFiles.push(...files);\n } else {\n bundlelessFiles.push(...files);\n }\n};\n\nexport const addRollupChunk = (\n rollupOutput: RollupOutput,\n appDirectory: string,\n distDir: string,\n) => {\n const { output } = rollupOutput;\n bundleFiles.push(\n ...output.map(o => {\n return {\n name: relative(appDirectory, resolve(distDir, o.fileName)),\n // only d.ts, is outputChunk not outputAsset\n size: (o as OutputChunk).code.length,\n };\n }),\n );\n};\n\nexport const addDtsFiles = async (distDir: string, appDirectory: string) => {\n const { fastGlob, slash } = await import('@modern-js/utils');\n const files = await fastGlob(`${slash(distDir)}**/*.d.ts`, {\n stats: true,\n });\n bundlelessFiles.push(\n ...files.map(file => {\n return {\n name: relative(appDirectory, file.path),\n size: file.stats.size,\n };\n }),\n );\n};\n\nexport const printFileSize = () => {\n printBundlelessInfo();\n printBundleFiles();\n};\n\nexport const printSucceed = (totalDuration: number) => {\n const time = chalk.cyan(`${totalDuration / 1000}s`);\n logger.info(`${buildSuccessText} in ${time}`);\n};\n\nconst prettyBytes = (bytes: number) => {\n if (bytes === 0) {\n return '0 B';\n }\n const unit = ['B', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB'];\n const exp = Math.floor(Math.log(bytes) / Math.log(1024));\n return `${(bytes / Math.pow(1024, exp)).toFixed(2)} ${unit[exp]}`;\n};\n\nconst printBundleFiles = () => {\n if (bundleFiles.length === 0) {\n return;\n }\n const longestFileLength = bundleFiles.reduce(\n (max, str) => Math.max(max, str.name.length),\n reportFile1LineText.length,\n );\n\n logger.info(`Bundle generated ${bundleFiles.length} files\\n`);\n\n const headerRow =\n reportFile1LineText +\n ' '.repeat(longestFileLength - 10) +\n reportFile2LineText;\n logger.log(chalk.bold(chalk.green(headerRow)));\n\n bundleFiles.forEach(({ name, size }) => {\n const infoRow = `${name}${' '.repeat(\n longestFileLength - name.length + 2,\n )}${prettyBytes(size)}`;\n logger.log(infoRow);\n });\n};\n\nconst printBundlelessInfo = () => {\n if (bundlelessFiles.length === 0) {\n return;\n }\n\n const count = bundlelessFiles.length;\n const totalSize = bundlelessFiles.reduce((total, file) => {\n return total + file.size;\n }, 0);\n const info = `Bundleless generated ${count} files, the total size is ${chalk.cyan(\n prettyBytes(totalSize),\n )}`;\n logger.info(info);\n};\n"]}
1
+ {"version":3,"file":null,"mappings":";;;;;;;;;;;;EAkBaA,aAAW;WAAXA;;EAEAC,iBAAe;WAAfA;;EAEAC,gBAAc;WAAdA;;EAmBAC,gBAAc;WAAdA;;EAiBAC,aAAW;WAAXA;;EAcAC,eAAa;WAAbA;;EAKAC,cAAY;WAAZA;;;sBA7EqB;uBAEa;qBASxC;AAOA,MAAMN,cAAuB;A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SAAO,IAAIL,QAAQG,KAAKG,IAAI,MAAMJ,MAAMK,QAAQ,MAAMN,KAAKC;AAC7D;AAEA,MAAMX,mBAAmB;AACvB,MAAInC,YAAYqB,WAAW,GAAG;AAC5B;EACF;AACA,QAAM+B,oBAAoBpD,YAAYqD,OACpC,CAACC,KAAKC,QAAQR,KAAKO,IAAIA,KAAKC,IAAItC,KAAKI,MAAM,GAC3CmC,yBAAoBnC,MAAM;AAG5BmB,gBAAOC,KAAK,oBAAoBzC,YAAYqB;CAAgB;AAE5D,QAAMoC,YACJD,2BACA,IAAIE,OAAON,oBAAoB,MAC/BO;AACFnB,gBAAOS,IAAIX,aAAMsB,KAAKtB,aAAMuB,MAAMJ;AAElCzD,cAAY8D,QAAQ,CAAC,EAAE7C,MAAME,KAAI,MAAE;AACjC,UAAM4C,UAAU,GAAG9C,OAAO,IAAIyC,OAC5BN,oBAAoBnC,KAAKI,SAAS,KAChCsB,YAAYxB;AAChBqB,kBAAOS,IAAIc;EACb;AACF;AAEA,MAAM7B,sBAAsB;AAC1B,MAAIjC,gBAAgBoB,WAAW,GAAG;AAChC;EACF;AAEA,QAAM2C,QAAQ/D,gBAAgBoB;AAC9B,QAAM4C,YAAYhE,gBAAgBoD,OAAO,CAACa,OAAOjC;AAC/C,WAAOiC,QAAQjC,KAAKd;EACtB,GAAG;AACH,QAAMsB,OAAO,wBAAwBuB,kCAAkC1B,aAAMC,KAC3EI,YAAYsB;AAEdzB,gBAAOC,KAAKA;AACd;","names":["bundleFiles","bundlelessFiles","addOutputChunk","addRollupChunk","addDtsFiles","printFileSize","printSucceed","outputChunk","appDirectory","isBundle","files","Array","from","map","val","path","chunk","name","relative","size","contents","length","push","rollupOutput","distDir","output","o","resolve","fileName","code","fastGlob","slash","stats","file","printBundlelessInfo","printBundleFiles","totalDuration","time","chalk","cyan","logger","info","buildSuccessText","prettyBytes","bytes","unit","exp","Math","floor","log","pow","toFixed","longestFileLength","reduce","max","str","reportFile1LineText","headerRow","repeat","reportFile2LineText","bold","green","forEach","infoRow","count","totalSize","total"],"sources":["../../src/utils/home/runner/work/modern.js/modern.js/packages/solutions/module-tools/src/utils/print.ts"],"sourcesContent":["import { relative, resolve } from 'path';\nimport type { ILibuilder } from '@modern-js/libuild';\nimport { chalk, logger, fastGlob, slash } from '@modern-js/utils';\nimport type {\n RollupOutput,\n OutputChunk,\n} from '../../compiled/rollup/types/rollup';\nimport {\n buildSuccessText,\n reportFile1LineText,\n reportFile2LineText,\n} from '../constants/log';\n\ntype Files = {\n name: string;\n size: number;\n};\n\nexport const bundleFiles: Files[] = [];\n\nexport const bundlelessFiles: Files[] = [];\n\nexport const addOutputChunk = (\n outputChunk: ILibuilder['outputChunk'],\n appDirectory: string,\n isBundle: boolean,\n) => {\n const files = Array.from(outputChunk).map(val => {\n const [path, chunk] = val;\n return {\n name: relative(appDirectory, path),\n size: chunk.contents.length,\n };\n });\n if (isBundle) {\n bundleFiles.push(...files);\n } else {\n bundlelessFiles.push(...files);\n }\n};\n\nexport const addRollupChunk = (\n rollupOutput: RollupOutput,\n appDirectory: string,\n distDir: string,\n) => {\n const { output } = rollupOutput;\n bundleFiles.push(\n ...output.map(o => {\n return {\n name: relative(appDirectory, resolve(distDir, o.fileName)),\n // only d.ts, is outputChunk not outputAsset\n size: (o as OutputChunk).code.length,\n };\n }),\n );\n};\n\nexport const addDtsFiles = async (distDir: string, appDirectory: string) => {\n const files = await fastGlob(`${slash(distDir)}/**/*.d.ts`, {\n stats: true,\n });\n bundlelessFiles.push(\n ...files.map(file => {\n return {\n name: relative(appDirectory, file.path),\n size: file.stats.size,\n };\n }),\n );\n};\n\nexport const printFileSize = () => {\n printBundlelessInfo();\n printBundleFiles();\n};\n\nexport const printSucceed = (totalDuration: number) => {\n const time = chalk.cyan(`${totalDuration / 1000}s`);\n logger.info(`${buildSuccessText} in ${time}`);\n};\n\nconst prettyBytes = (bytes: number) => {\n if (bytes === 0) {\n return '0 B';\n }\n const unit = ['B', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB'];\n const exp = Math.floor(Math.log(bytes) / Math.log(1024));\n return `${(bytes / Math.pow(1024, exp)).toFixed(2)} ${unit[exp]}`;\n};\n\nconst printBundleFiles = () => {\n if (bundleFiles.length === 0) {\n return;\n }\n const longestFileLength = bundleFiles.reduce(\n (max, str) => Math.max(max, str.name.length),\n reportFile1LineText.length,\n );\n\n logger.info(`Bundle generated ${bundleFiles.length} files\\n`);\n\n const headerRow =\n reportFile1LineText +\n ' '.repeat(longestFileLength - 10) +\n reportFile2LineText;\n logger.log(chalk.bold(chalk.green(headerRow)));\n\n bundleFiles.forEach(({ name, size }) => {\n const infoRow = `${name}${' '.repeat(\n longestFileLength - name.length + 2,\n )}${prettyBytes(size)}`;\n logger.log(infoRow);\n });\n};\n\nconst printBundlelessInfo = () => {\n if (bundlelessFiles.length === 0) {\n return;\n }\n\n const count = bundlelessFiles.length;\n const totalSize = bundlelessFiles.reduce((total, file) => {\n return total + file.size;\n }, 0);\n const info = `Bundleless generated ${count} files, the total size is ${chalk.cyan(\n prettyBytes(totalSize),\n )}`;\n logger.info(info);\n};\n"]}
@@ -23,32 +23,27 @@ _export(exports, {
23
23
  return getStyleConfig;
24
24
  }
25
25
  });
26
- const _interop_require_wildcard = require("@swc/helpers/_/_interop_require_wildcard");
26
+ const _utils = require("@modern-js/utils");
27
+ const _path = require("./path");
27
28
  const getLessConfig = async (config) => {
28
29
  var _config_style, _config;
29
- const { applyOptionsChain } = await Promise.resolve().then(() => /* @__PURE__ */ _interop_require_wildcard._(require("@modern-js/utils")));
30
- const { getCompiledPath } = await Promise.resolve().then(() => /* @__PURE__ */ _interop_require_wildcard._(require("./path")));
31
- const mergedOptions = applyOptionsChain({
30
+ const mergedOptions = (0, _utils.applyOptionsChain)({
32
31
  lessOptions: {
33
32
  javascriptEnabled: true
34
33
  },
35
- implementation: await getCompiledPath("less")
34
+ implementation: await (0, _path.getCompiledPath)("less")
36
35
  }, ((_config = config) === null || _config === void 0 ? void 0 : (_config_style = _config.style) === null || _config_style === void 0 ? void 0 : _config_style.less) || {});
37
36
  return mergedOptions;
38
37
  };
39
38
  const getSassConfig = async (config) => {
40
39
  var _config_style, _config;
41
- const { applyOptionsChain } = await Promise.resolve().then(() => /* @__PURE__ */ _interop_require_wildcard._(require("@modern-js/utils")));
42
- const { getCompiledPath } = await Promise.resolve().then(() => /* @__PURE__ */ _interop_require_wildcard._(require("./path")));
43
- const mergedOptions = applyOptionsChain({
44
- implementation: await getCompiledPath("sass")
40
+ const mergedOptions = (0, _utils.applyOptionsChain)({
41
+ implementation: await (0, _path.getCompiledPath)("sass")
45
42
  }, ((_config = config) === null || _config === void 0 ? void 0 : (_config_style = _config.style) === null || _config_style === void 0 ? void 0 : _config_style.sass) || {});
46
43
  return mergedOptions;
47
44
  };
48
45
  const getPostcssConfig = async (config) => {
49
46
  var _config_style, _config;
50
- const { applyOptionsChain } = await Promise.resolve().then(() => /* @__PURE__ */ _interop_require_wildcard._(require("@modern-js/utils")));
51
- const { getCompiledPath } = await Promise.resolve().then(() => /* @__PURE__ */ _interop_require_wildcard._(require("./path")));
52
47
  const extraPlugins = [];
53
48
  const utils = {
54
49
  addPlugins(plugins) {
@@ -61,19 +56,19 @@ const getPostcssConfig = async (config) => {
61
56
  };
62
57
  const targetLegacyBrowsers = config.target === "es5";
63
58
  const getLegacyPostCSSPlugins = async () => [
64
- require(await getCompiledPath("postcss-custom-properties")),
65
- require(await getCompiledPath("postcss-initial")),
66
- require(await getCompiledPath("postcss-page-break")),
67
- require(await getCompiledPath("postcss-font-variant"))
59
+ require(await (0, _path.getCompiledPath)("postcss-custom-properties")),
60
+ require(await (0, _path.getCompiledPath)("postcss-initial")),
61
+ require(await (0, _path.getCompiledPath)("postcss-page-break")),
62
+ require(await (0, _path.getCompiledPath)("postcss-font-variant"))
68
63
  ];
69
- const mergedConfig = applyOptionsChain({
64
+ const mergedConfig = (0, _utils.applyOptionsChain)({
70
65
  // TODO: when schema support redefine
71
66
  // $$tools: 'module-tools',
72
67
  plugins: [
73
68
  ...targetLegacyBrowsers ? await getLegacyPostCSSPlugins() : [],
74
- require(await getCompiledPath("postcss-flexbugs-fixes")),
75
- require(await getCompiledPath("postcss-media-minmax")),
76
- require(await getCompiledPath("postcss-nesting"))
69
+ require(await (0, _path.getCompiledPath)("postcss-flexbugs-fixes")),
70
+ require(await (0, _path.getCompiledPath)("postcss-media-minmax")),
71
+ require(await (0, _path.getCompiledPath)("postcss-nesting"))
77
72
  ].filter(Boolean)
78
73
  }, ((_config = config) === null || _config === void 0 ? void 0 : (_config_style = _config.style) === null || _config_style === void 0 ? void 0 : _config_style.postcss) || {}, utils);
79
74
  if (extraPlugins.length) {
@@ -1 +1 @@
1
- {"version":3,"file":null,"mappings":";;;;;;;;;;;;EASaA,eAAa;WAAbA;;EAeAC,eAAa;WAAbA;;EAcAC,kBAAgB;WAAhBA;;EA+CAC,gBAAc;WAAdA;;;;AA5EN,MAAMH,gBAAgB,OAAOI;MAShCA;AARF,QAAM,EAAEC,kBAAiB,IAAK,MAAM,iFAAO;AAC3C,QAAM,EAAEC,gBAAe,IAAK,MAAM,iFAAO;AAEzC,QAAMC,gBAAgBF,kBACpB;IACEG,aAAa;MAAEC,mBAAmB;IAAK;IACvCC,gBAAgB,MAAMJ,gBAAgB;EACxC,KACAF,qFAAQO,WAAK,QAAbP,kDAAeQ,SAAQ,CAAC;AAG1B,SAAOL;AACT;AAEO,MAAMN,gBAAgB,OAAOG;MAQhCA;AAPF,QAAM,EAAEC,kBAAiB,IAAK,MAAM,iFAAO;AAC3C,QAAM,EAAEC,gBAAe,IAAK,MAAM,iFAAO;AAEzC,QAAMC,gBAAgBF,kBACpB;IACEK,gBAAgB,MAAMJ,gBAAgB;EACxC,KACAF,qFAAQO,WAAK,QAAbP,kDAAeS,SAAQ,CAAC;AAG1B,SAAON;AACT;AAEO,MAAML,mBAAmB,OAAOE;MAqCnCA;AApCF,QAAM,EAAEC,kBAAiB,IAAK,MAAM,iFAAO;AAC3C,QAAM,EAAEC,gBAAe,IAAK,MAAM,iFAAO;AACzC,QAAMQ,eAAiC;AAEvC,QAAMC,QAAQ;IACZC,WAAWC,SAA0C;AACnD,UAAIC,MAAMC,QAAQF,UAAU;AAC1BH,qBAAaM,KAAI,GAAIH;MACvB,OAAO;AACLH,qBAAaM,KAAKH;MACpB;IACF;EACF;AAEA,QAAMI,uBAAuBjB,OAAOkB,WAAW;AAC/C,QAAMC,0BAA0B,YAAY;IAC1CC,QAAQ,MAAMlB,gBAAgB;IAC9BkB,QAAQ,MAAMlB,gBAAgB;IAC9BkB,QAAQ,MAAMlB,gBAAgB;IAC9BkB,QAAQ,MAAMlB,gBAAgB;;AAGhC,QAAMmB,eAAepB,kBAInB;;;IAGEY,SAAS;SACHI,uBAAuB,MAAME,4BAA4B;MAC7DC,QAAQ,MAAMlB,gBAAgB;MAC9BkB,QAAQ,MAAMlB,gBAAgB;MAC9BkB,QAAQ,MAAMlB,gBAAgB;MAC9BoB,OAAOC;EACX,KACAvB,qFAAQO,WAAK,QAAbP,kDAAewB,YAAW,CAAC,GAC3Bb;AAEF,MAAID,aAAae,QAAQ;AACvBJ,iBAAaR,QAASG,KAAI,GAAIN;EAChC;AAEA,SAAOW;AACT;AAEO,MAAMtB,iBAAiB,OAAOC;AACnC,QAAM0B,gBAAgB,MAAM5B,iBAAiBE;AAC7C,QAAM2B,aAAa,MAAM/B,cAAcI;AACvC,QAAM4B,aAAa,MAAM/B,cAAcG;AACvC,SAAO;IACLQ,MAAMmB;IACNlB,MAAMmB;IACNJ,SAASE;EACX;AACF;","names":["getLessConfig","getSassConfig","getPostcssConfig","getStyleConfig","config","applyOptionsChain","getCompiledPath","mergedOptions","lessOptions","javascriptEnabled","implementation","style","less","sass","extraPlugins","utils","addPlugins","plugins","Array","isArray","push","targetLegacyBrowsers","target","getLegacyPostCSSPlugins","require","mergedConfig","filter","Boolean","postcss","length","postcssConfig","lessConfig","sassConfig"],"sources":["../../src/utils/home/runner/work/modern.js/modern.js/packages/solutions/module-tools/src/utils/style.ts"],"sourcesContent":["import type { AcceptedPlugin } from 'postcss';\nimport type { PostcssOptions } from '@modern-js/libuild';\nimport type {\n PartialBaseBuildConfig,\n PostCSSConfigUtils,\n LessOptions,\n SassOptions,\n} from '../types';\n\nexport const getLessConfig = async (config: PartialBaseBuildConfig) => {\n const { applyOptionsChain } = await import('@modern-js/utils');\n const { getCompiledPath } = await import('./path');\n\n const mergedOptions = applyOptionsChain<LessOptions, never>(\n {\n lessOptions: { javascriptEnabled: true },\n implementation: await getCompiledPath('less'),\n },\n config?.style?.less || {},\n );\n\n return mergedOptions;\n};\n\nexport const getSassConfig = async (config: PartialBaseBuildConfig) => {\n const { applyOptionsChain } = await import('@modern-js/utils');\n const { getCompiledPath } = await import('./path');\n\n const mergedOptions = applyOptionsChain<SassOptions, never>(\n {\n implementation: await getCompiledPath('sass'),\n },\n config?.style?.sass || {},\n );\n\n return mergedOptions;\n};\n\nexport const getPostcssConfig = async (config: PartialBaseBuildConfig) => {\n const { applyOptionsChain } = await import('@modern-js/utils');\n const { getCompiledPath } = await import('./path');\n const extraPlugins: AcceptedPlugin[] = [];\n\n const utils = {\n addPlugins(plugins: AcceptedPlugin | AcceptedPlugin[]) {\n if (Array.isArray(plugins)) {\n extraPlugins.push(...plugins);\n } else {\n extraPlugins.push(plugins);\n }\n },\n };\n\n const targetLegacyBrowsers = config.target === 'es5';\n const getLegacyPostCSSPlugins = async () => [\n require(await getCompiledPath('postcss-custom-properties')),\n require(await getCompiledPath('postcss-initial')),\n require(await getCompiledPath('postcss-page-break')),\n require(await getCompiledPath('postcss-font-variant')),\n ];\n\n const mergedConfig = applyOptionsChain<\n PostcssOptions & { $$tools?: string },\n PostCSSConfigUtils\n >(\n {\n // TODO: when schema support redefine\n // $$tools: 'module-tools',\n plugins: [\n ...(targetLegacyBrowsers ? await getLegacyPostCSSPlugins() : []),\n require(await getCompiledPath('postcss-flexbugs-fixes')),\n require(await getCompiledPath('postcss-media-minmax')),\n require(await getCompiledPath('postcss-nesting')),\n ].filter(Boolean),\n },\n config?.style?.postcss || {},\n utils,\n );\n if (extraPlugins.length) {\n mergedConfig.plugins!.push(...extraPlugins);\n }\n\n return mergedConfig;\n};\n\nexport const getStyleConfig = async (config: PartialBaseBuildConfig) => {\n const postcssConfig = await getPostcssConfig(config);\n const lessConfig = await getLessConfig(config);\n const sassConfig = await getSassConfig(config);\n return {\n less: lessConfig,\n sass: sassConfig,\n postcss: postcssConfig,\n };\n};\n"]}
1
+ {"version":3,"file":null,"mappings":";;;;;;;;;;;;EAWaA,eAAa;WAAbA;;EAYAC,eAAa;WAAbA;;EAWAC,kBAAgB;WAAhBA;;EA6CAC,gBAAc;WAAdA;;;uBA7EqB;sBAOF;AAEzB,MAAMH,gBAAgB,OAAOI;MAMhCA;AALF,QAAMC,iBAAgBC,6BACpB;IACEC,aAAa;MAAEC,mBAAmB;IAAK;IACvCC,gBAAgB,OAAMC,0BAAgB;EACxC,KACAN,qFAAQO,WAAK,QAAbP,kDAAeQ,SAAQ,CAAC;AAG1B,SAAOP;AACT;AAEO,MAAMJ,gBAAgB,OAAOG;MAKhCA;AAJF,QAAMC,iBAAgBC,6BACpB;IACEG,gBAAgB,OAAMC,0BAAgB;EACxC,KACAN,qFAAQO,WAAK,QAAbP,kDAAeS,SAAQ,CAAC;AAG1B,SAAOR;AACT;AAEO,MAAMH,mBAAmB,OAAOE;MAmCnCA;AAlCF,QAAMU,eAAiC;AAEvC,QAAMC,QAAQ;IACZC,WAAWC,SAA0C;AACnD,UAAIC,MAAMC,QAAQF,UAAU;AAC1BH,qBAAaM,KAAI,GAAIH;MACvB,OAAO;AACLH,qBAAaM,KAAKH;MACpB;IACF;EACF;AAEA,QAAMI,uBAAuBjB,OAAOkB,WAAW;AAC/C,QAAMC,0BAA0B,YAAY;IAC1CC,QAAQ,OAAMd,0BAAgB;IAC9Bc,QAAQ,OAAMd,0BAAgB;IAC9Bc,QAAQ,OAAMd,0BAAgB;IAC9Bc,QAAQ,OAAMd,0BAAgB;;AAGhC,QAAMe,gBAAenB,6BAInB;;;IAGEW,SAAS;SACHI,uBAAuB,MAAME,4BAA4B;MAC7DC,QAAQ,OAAMd,0BAAgB;MAC9Bc,QAAQ,OAAMd,0BAAgB;MAC9Bc,QAAQ,OAAMd,0BAAgB;MAC9BgB,OAAOC;EACX,KACAvB,qFAAQO,WAAK,QAAbP,kDAAewB,YAAW,CAAC,GAC3Bb;AAEF,MAAID,aAAae,QAAQ;AACvBJ,iBAAaR,QAASG,KAAI,GAAIN;EAChC;AAEA,SAAOW;AACT;AAEO,MAAMtB,iBAAiB,OAAOC;AACnC,QAAM0B,gBAAgB,MAAM5B,iBAAiBE;AAC7C,QAAM2B,aAAa,MAAM/B,cAAcI;AACvC,QAAM4B,aAAa,MAAM/B,cAAcG;AACvC,SAAO;IACLQ,MAAMmB;IACNlB,MAAMmB;IACNJ,SAASE;EACX;AACF;","names":["getLessConfig","getSassConfig","getPostcssConfig","getStyleConfig","config","mergedOptions","applyOptionsChain","lessOptions","javascriptEnabled","implementation","getCompiledPath","style","less","sass","extraPlugins","utils","addPlugins","plugins","Array","isArray","push","targetLegacyBrowsers","target","getLegacyPostCSSPlugins","require","mergedConfig","filter","Boolean","postcss","length","postcssConfig","lessConfig","sassConfig"],"sources":["../../src/utils/home/runner/work/modern.js/modern.js/packages/solutions/module-tools/src/utils/style.ts"],"sourcesContent":["import type { AcceptedPlugin } from 'postcss';\nimport type { PostcssOptions } from '@modern-js/libuild';\nimport { applyOptionsChain } from '@modern-js/utils';\nimport type {\n PartialBaseBuildConfig,\n PostCSSConfigUtils,\n LessOptions,\n SassOptions,\n} from '../types';\nimport { getCompiledPath } from './path';\n\nexport const getLessConfig = async (config: PartialBaseBuildConfig) => {\n const mergedOptions = applyOptionsChain<LessOptions, never>(\n {\n lessOptions: { javascriptEnabled: true },\n implementation: await getCompiledPath('less'),\n },\n config?.style?.less || {},\n );\n\n return mergedOptions;\n};\n\nexport const getSassConfig = async (config: PartialBaseBuildConfig) => {\n const mergedOptions = applyOptionsChain<SassOptions, never>(\n {\n implementation: await getCompiledPath('sass'),\n },\n config?.style?.sass || {},\n );\n\n return mergedOptions;\n};\n\nexport const getPostcssConfig = async (config: PartialBaseBuildConfig) => {\n const extraPlugins: AcceptedPlugin[] = [];\n\n const utils = {\n addPlugins(plugins: AcceptedPlugin | AcceptedPlugin[]) {\n if (Array.isArray(plugins)) {\n extraPlugins.push(...plugins);\n } else {\n extraPlugins.push(plugins);\n }\n },\n };\n\n const targetLegacyBrowsers = config.target === 'es5';\n const getLegacyPostCSSPlugins = async () => [\n require(await getCompiledPath('postcss-custom-properties')),\n require(await getCompiledPath('postcss-initial')),\n require(await getCompiledPath('postcss-page-break')),\n require(await getCompiledPath('postcss-font-variant')),\n ];\n\n const mergedConfig = applyOptionsChain<\n PostcssOptions & { $$tools?: string },\n PostCSSConfigUtils\n >(\n {\n // TODO: when schema support redefine\n // $$tools: 'module-tools',\n plugins: [\n ...(targetLegacyBrowsers ? await getLegacyPostCSSPlugins() : []),\n require(await getCompiledPath('postcss-flexbugs-fixes')),\n require(await getCompiledPath('postcss-media-minmax')),\n require(await getCompiledPath('postcss-nesting')),\n ].filter(Boolean),\n },\n config?.style?.postcss || {},\n utils,\n );\n if (extraPlugins.length) {\n mergedConfig.plugins!.push(...extraPlugins);\n }\n\n return mergedConfig;\n};\n\nexport const getStyleConfig = async (config: PartialBaseBuildConfig) => {\n const postcssConfig = await getPostcssConfig(config);\n const lessConfig = await getLessConfig(config);\n const sassConfig = await getSassConfig(config);\n return {\n less: lessConfig,\n sass: sassConfig,\n postcss: postcssConfig,\n };\n};\n"]}
package/package.json CHANGED
@@ -15,7 +15,7 @@
15
15
  "module-tools",
16
16
  "lib-tools"
17
17
  ],
18
- "version": "2.31.2",
18
+ "version": "2.32.0",
19
19
  "bin": {
20
20
  "modern": "./bin/modern.js",
21
21
  "modern-module": "./bin/modern.js"
@@ -45,6 +45,9 @@
45
45
  ]
46
46
  }
47
47
  },
48
+ "engines": {
49
+ "node": ">=14.0.0"
50
+ },
48
51
  "dependencies": {
49
52
  "@babel/parser": "^7.21.8",
50
53
  "@babel/generator": "^7.21.5",
@@ -52,18 +55,18 @@
52
55
  "@babel/traverse": "^7.21.5",
53
56
  "postcss": "8.4.27",
54
57
  "@swc/helpers": "0.5.1",
55
- "@modern-js/core": "2.31.2",
56
- "@modern-js/libuild": "2.31.2",
57
- "@modern-js/libuild-plugin-svgr": "2.31.2",
58
- "@modern-js/libuild-plugin-swc": "2.31.2",
59
- "@modern-js/new-action": "2.31.2",
60
- "@modern-js/plugin": "2.31.2",
61
- "@modern-js/plugin-changeset": "2.31.2",
62
- "@modern-js/plugin-i18n": "2.31.2",
63
- "@modern-js/plugin-lint": "2.31.2",
64
- "@modern-js/types": "2.31.2",
65
- "@modern-js/upgrade": "2.31.2",
66
- "@modern-js/utils": "2.31.2"
58
+ "@modern-js/core": "2.32.0",
59
+ "@modern-js/libuild": "2.32.0",
60
+ "@modern-js/libuild-plugin-svgr": "2.32.0",
61
+ "@modern-js/libuild-plugin-swc": "2.32.0",
62
+ "@modern-js/plugin": "2.32.0",
63
+ "@modern-js/plugin-changeset": "2.32.0",
64
+ "@modern-js/plugin-i18n": "2.32.0",
65
+ "@modern-js/plugin-lint": "2.32.0",
66
+ "@modern-js/types": "2.32.0",
67
+ "@modern-js/upgrade": "2.32.0",
68
+ "@modern-js/utils": "2.32.0",
69
+ "@modern-js/new-action": "2.32.0"
67
70
  },
68
71
  "devDependencies": {
69
72
  "@types/babel__generator": "7.6.4",
@@ -78,10 +81,10 @@
78
81
  "postcss-alias": "2.0.0",
79
82
  "react": "17",
80
83
  "typescript": "^5",
81
- "@modern-js/builder-webpack-provider": "2.31.2",
82
- "@modern-js/self": "npm:@modern-js/module-tools@2.31.2",
83
- "@scripts/build": "2.31.1",
84
- "@scripts/jest-config": "2.31.1"
84
+ "@modern-js/builder-webpack-provider": "2.32.0",
85
+ "@modern-js/self": "npm:@modern-js/module-tools@2.32.0",
86
+ "@scripts/jest-config": "2.32.0",
87
+ "@scripts/build": "2.32.0"
85
88
  },
86
89
  "publishConfig": {
87
90
  "registry": "https://registry.npmjs.org/",
@@ -1,91 +0,0 @@
1
- import type { PartialBuildConfig, PartialBaseBuildConfig, Target } from '../types';
2
- export declare const targets: Target[];
3
- export declare const basePresetConfig: PartialBuildConfig;
4
- export declare const npmLibraryPresetConfig: PartialBaseBuildConfig[];
5
- export declare const npmLibraryWithUmdPresetConfig: PartialBaseBuildConfig[];
6
- export declare const npmComponentPresetConfig: PartialBaseBuildConfig[];
7
- export declare const npmComponentWithUmdPresetConfig: PartialBaseBuildConfig[];
8
- export declare const libraryPreset: {
9
- 'npm-library': PartialBaseBuildConfig[];
10
- };
11
- export declare const libraryPresetWithTarget: Record<"npm-library-es5" | "npm-library-es6" | "npm-library-esnext" | "npm-library-es2015" | "npm-library-es2016" | "npm-library-es2017" | "npm-library-es2018" | "npm-library-es2019" | "npm-library-es2020" | "npm-library-es2021" | "npm-library-es2022", PartialBuildConfig>;
12
- export declare const libraryUmdPreset: {
13
- 'npm-library-with-umd': PartialBaseBuildConfig[];
14
- };
15
- export declare const libraryUmdPresetWithTarget: Record<"npm-library-with-umd-es5" | "npm-library-with-umd-es6" | "npm-library-with-umd-esnext" | "npm-library-with-umd-es2015" | "npm-library-with-umd-es2016" | "npm-library-with-umd-es2017" | "npm-library-with-umd-es2018" | "npm-library-with-umd-es2019" | "npm-library-with-umd-es2020" | "npm-library-with-umd-es2021" | "npm-library-with-umd-es2022", PartialBuildConfig>;
16
- export declare const componentPreset: {
17
- 'npm-component': PartialBaseBuildConfig[];
18
- };
19
- export declare const componentPresetWithTarget: Record<"npm-component-es5" | "npm-component-es6" | "npm-component-esnext" | "npm-component-es2015" | "npm-component-es2016" | "npm-component-es2017" | "npm-component-es2018" | "npm-component-es2019" | "npm-component-es2020" | "npm-component-es2021" | "npm-component-es2022", PartialBuildConfig>;
20
- export declare const componentUmdPreset: {
21
- 'npm-component-with-umd': PartialBaseBuildConfig[];
22
- };
23
- export declare const componentUmdPresetWithTarget: Record<"npm-component-with-umd-es5" | "npm-component-with-umd-es6" | "npm-component-with-umd-esnext" | "npm-component-with-umd-es2015" | "npm-component-with-umd-es2016" | "npm-component-with-umd-es2017" | "npm-component-with-umd-es2018" | "npm-component-with-umd-es2019" | "npm-component-with-umd-es2020" | "npm-component-with-umd-es2021" | "npm-component-with-umd-es2022", PartialBuildConfig>;
24
- export declare const nodeBuildConfig: PartialBaseBuildConfig[];
25
- export declare const universalBuildConfig: PartialBaseBuildConfig[];
26
- export declare const presetList: {
27
- 'modern-js-node': PartialBaseBuildConfig[];
28
- 'modern-js-universal': PartialBaseBuildConfig[];
29
- "npm-component-with-umd-es5": PartialBuildConfig;
30
- "npm-component-with-umd-es6": PartialBuildConfig;
31
- "npm-component-with-umd-esnext": PartialBuildConfig;
32
- "npm-component-with-umd-es2015": PartialBuildConfig;
33
- "npm-component-with-umd-es2016": PartialBuildConfig;
34
- "npm-component-with-umd-es2017": PartialBuildConfig;
35
- "npm-component-with-umd-es2018": PartialBuildConfig;
36
- "npm-component-with-umd-es2019": PartialBuildConfig;
37
- "npm-component-with-umd-es2020": PartialBuildConfig;
38
- "npm-component-with-umd-es2021": PartialBuildConfig;
39
- "npm-component-with-umd-es2022": PartialBuildConfig;
40
- 'npm-component-with-umd': PartialBaseBuildConfig[];
41
- "npm-component-es5": PartialBuildConfig;
42
- "npm-component-es6": PartialBuildConfig;
43
- "npm-component-esnext": PartialBuildConfig;
44
- "npm-component-es2015": PartialBuildConfig;
45
- "npm-component-es2016": PartialBuildConfig;
46
- "npm-component-es2017": PartialBuildConfig;
47
- "npm-component-es2018": PartialBuildConfig;
48
- "npm-component-es2019": PartialBuildConfig;
49
- "npm-component-es2020": PartialBuildConfig;
50
- "npm-component-es2021": PartialBuildConfig;
51
- "npm-component-es2022": PartialBuildConfig;
52
- 'npm-component': PartialBaseBuildConfig[];
53
- "npm-library-with-umd-es5": PartialBuildConfig;
54
- "npm-library-with-umd-es6": PartialBuildConfig;
55
- "npm-library-with-umd-esnext": PartialBuildConfig;
56
- "npm-library-with-umd-es2015": PartialBuildConfig;
57
- "npm-library-with-umd-es2016": PartialBuildConfig;
58
- "npm-library-with-umd-es2017": PartialBuildConfig;
59
- "npm-library-with-umd-es2018": PartialBuildConfig;
60
- "npm-library-with-umd-es2019": PartialBuildConfig;
61
- "npm-library-with-umd-es2020": PartialBuildConfig;
62
- "npm-library-with-umd-es2021": PartialBuildConfig;
63
- "npm-library-with-umd-es2022": PartialBuildConfig;
64
- 'npm-library-with-umd': PartialBaseBuildConfig[];
65
- "npm-library-es5": PartialBuildConfig;
66
- "npm-library-es6": PartialBuildConfig;
67
- "npm-library-esnext": PartialBuildConfig;
68
- "npm-library-es2015": PartialBuildConfig;
69
- "npm-library-es2016": PartialBuildConfig;
70
- "npm-library-es2017": PartialBuildConfig;
71
- "npm-library-es2018": PartialBuildConfig;
72
- "npm-library-es2019": PartialBuildConfig;
73
- "npm-library-es2020": PartialBuildConfig;
74
- "npm-library-es2021": PartialBuildConfig;
75
- "npm-library-es2022": PartialBuildConfig;
76
- 'npm-library': PartialBaseBuildConfig[];
77
- };
78
- export declare const BuildInPreset: {
79
- BASE_CONFIG: PartialBaseBuildConfig;
80
- 'base-config': PartialBaseBuildConfig;
81
- NPM_LIBRARY: PartialBaseBuildConfig[];
82
- 'npm-library': PartialBaseBuildConfig[];
83
- NPM_LIBRARY_WITH_UMD: PartialBaseBuildConfig[];
84
- 'npm-library-with-umd': PartialBaseBuildConfig[];
85
- NPM_COMPONENT: PartialBaseBuildConfig[];
86
- 'npm-component': PartialBaseBuildConfig[];
87
- NPM_COMPONENT_WITH_UMD: PartialBaseBuildConfig[];
88
- 'npm-component-with-umd': PartialBaseBuildConfig[];
89
- 'modern-js-node': PartialBaseBuildConfig[];
90
- 'modern-js-universal': PartialBaseBuildConfig[];
91
- };
@@ -1 +0,0 @@
1
- {"version":3,"mappings":";;;;;;;;;;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BC;AACzB;","names":["targets","basePresetConfig","npmLibraryPresetConfig","npmLibraryWithUmdPresetConfig","npmComponentPresetConfig","npmComponentWithUmdPresetConfig","libraryPreset","libraryPresetWithTarget","libraryUmdPreset","libraryUmdPresetWithTarget","componentPreset","componentPresetWithTarget","componentUmdPreset","componentUmdPresetWithTarget","nodeBuildConfig","universalBuildConfig","presetList","BuildInPreset","format","target","buildType","outDir","dts","distPath","only","platform","reduce","ret","map","config","externalHelpers","BASE_CONFIG","NPM_LIBRARY","NPM_LIBRARY_WITH_UMD","NPM_COMPONENT","NPM_COMPONENT_WITH_UMD"],"sources":["../../src/constants/home/runner/work/modern.js/modern.js/packages/solutions/module-tools/src/constants/buildPresets.ts"],"sourcesContent":["import type {\n PartialBuildConfig,\n PartialBaseBuildConfig,\n Target,\n} from '../types';\n\nexport const targets: Target[] = [\n 'es5',\n 'es6',\n 'es2015',\n 'es2016',\n 'es2017',\n 'es2018',\n 'es2019',\n 'es2020',\n 'es2021',\n 'es2022',\n 'esnext',\n];\n\nexport const basePresetConfig: PartialBuildConfig = {\n format: 'esm',\n target: 'es6',\n buildType: 'bundle',\n outDir: './dist',\n dts: { distPath: './types' },\n};\n\nexport const npmLibraryPresetConfig: PartialBaseBuildConfig[] = [\n {\n format: 'cjs',\n target: 'es6',\n buildType: 'bundle',\n outDir: './dist/lib',\n dts: false,\n },\n {\n format: 'esm',\n target: 'es6',\n buildType: 'bundle',\n outDir: './dist/es',\n dts: false,\n },\n {\n buildType: 'bundle',\n dts: { only: true, distPath: './types' },\n },\n];\nexport const npmLibraryWithUmdPresetConfig: PartialBaseBuildConfig[] = [\n {\n format: 'cjs',\n target: 'es6',\n buildType: 'bundle',\n outDir: './dist/lib',\n dts: false,\n },\n {\n format: 'esm',\n target: 'es6',\n buildType: 'bundle',\n outDir: './dist/es',\n dts: false,\n },\n {\n format: 'umd',\n target: 'es6',\n platform: 'browser',\n buildType: 'bundle',\n outDir: './dist/umd',\n dts: false,\n },\n {\n buildType: 'bundle',\n dts: { only: true, distPath: './types' },\n },\n];\nexport const npmComponentPresetConfig: PartialBaseBuildConfig[] = [\n {\n format: 'cjs',\n target: 'es6',\n buildType: 'bundleless',\n outDir: './dist/lib',\n dts: false,\n },\n {\n format: 'esm',\n target: 'es6',\n buildType: 'bundleless',\n outDir: './dist/es',\n dts: false,\n },\n {\n buildType: 'bundleless',\n outDir: './dist/types',\n dts: { only: true },\n },\n];\nexport const npmComponentWithUmdPresetConfig: PartialBaseBuildConfig[] = [\n {\n format: 'cjs',\n target: 'es6',\n buildType: 'bundleless',\n outDir: './dist/lib',\n dts: false,\n },\n {\n format: 'esm',\n target: 'es6',\n buildType: 'bundleless',\n outDir: './dist/es',\n dts: false,\n },\n {\n format: 'umd',\n target: 'es6',\n platform: 'browser',\n buildType: 'bundle',\n outDir: './dist/umd',\n dts: false,\n },\n {\n buildType: 'bundleless',\n dts: { only: true, distPath: './types' },\n },\n];\n\nexport const libraryPreset = { 'npm-library': npmLibraryPresetConfig };\n\nexport const libraryPresetWithTarget = targets.reduce((ret, target) => {\n ret[`npm-library-${target}`] = libraryPreset['npm-library'].map(config => {\n return { ...config, target };\n });\n return ret;\n}, {} as Record<`npm-library-${Target}`, PartialBuildConfig>);\n\nexport const libraryUmdPreset = {\n 'npm-library-with-umd': npmLibraryWithUmdPresetConfig,\n};\nexport const libraryUmdPresetWithTarget = targets.reduce((ret, target) => {\n ret[`npm-library-with-umd-${target}`] = libraryUmdPreset[\n 'npm-library-with-umd'\n ].map(config => {\n return { ...config, target };\n });\n return ret;\n}, {} as Record<`npm-library-with-umd-${Target}`, PartialBuildConfig>);\n\nexport const componentPreset = {\n 'npm-component': npmComponentPresetConfig,\n};\nexport const componentPresetWithTarget = targets.reduce((ret, target) => {\n ret[`npm-component-${target}`] = componentPreset['npm-component'].map(\n config => {\n return { ...config, target };\n },\n );\n return ret;\n}, {} as Record<`npm-component-${Target}`, PartialBuildConfig>);\n\nexport const componentUmdPreset = {\n 'npm-component-with-umd': npmComponentWithUmdPresetConfig,\n};\nexport const componentUmdPresetWithTarget = targets.reduce((ret, target) => {\n ret[`npm-component-with-umd-${target}`] = componentUmdPreset[\n 'npm-component-with-umd'\n ].map(config => {\n return { ...config, target };\n });\n return ret;\n}, {} as Record<`npm-component-with-umd-${Target}`, PartialBuildConfig>);\n\nexport const nodeBuildConfig: PartialBaseBuildConfig[] = [\n {\n buildType: 'bundleless',\n format: 'cjs',\n target: 'es2019',\n dts: false,\n externalHelpers: true,\n outDir: './dist/cjs',\n },\n {\n buildType: 'bundleless',\n format: 'esm',\n target: 'es2019',\n dts: false,\n externalHelpers: true,\n outDir: './dist/esm',\n },\n {\n buildType: 'bundleless',\n dts: {\n only: true,\n },\n outDir: './dist/types',\n },\n];\n\nexport const universalBuildConfig: PartialBaseBuildConfig[] = [\n {\n buildType: 'bundleless',\n format: 'cjs',\n target: 'es2019',\n dts: false,\n externalHelpers: true,\n outDir: './dist/cjs',\n },\n {\n buildType: 'bundleless',\n format: 'esm',\n target: 'es5',\n dts: false,\n externalHelpers: true,\n outDir: './dist/esm',\n },\n {\n buildType: 'bundleless',\n format: 'esm',\n target: 'es2019',\n dts: false,\n externalHelpers: true,\n outDir: './dist/esm-node',\n },\n {\n buildType: 'bundleless',\n dts: {\n only: true,\n },\n outDir: './dist/types',\n },\n];\n\nexport const presetList = {\n ...libraryPreset,\n ...libraryPresetWithTarget,\n ...libraryUmdPreset,\n ...libraryUmdPresetWithTarget,\n ...componentPreset,\n ...componentPresetWithTarget,\n ...componentUmdPreset,\n ...componentUmdPresetWithTarget,\n 'modern-js-node': nodeBuildConfig,\n 'modern-js-universal': universalBuildConfig,\n};\n\nexport const BuildInPreset = {\n BASE_CONFIG: basePresetConfig,\n 'base-config': basePresetConfig,\n NPM_LIBRARY: npmLibraryPresetConfig,\n 'npm-library': npmLibraryPresetConfig,\n NPM_LIBRARY_WITH_UMD: npmLibraryWithUmdPresetConfig,\n 'npm-library-with-umd': npmLibraryWithUmdPresetConfig,\n NPM_COMPONENT: npmComponentPresetConfig,\n 'npm-component': npmComponentPresetConfig,\n NPM_COMPONENT_WITH_UMD: npmComponentWithUmdPresetConfig,\n 'npm-component-with-umd': npmComponentWithUmdPresetConfig,\n 'modern-js-node': nodeBuildConfig,\n 'modern-js-universal': universalBuildConfig,\n};\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"file":null,"mappings":";;;;;;;;;;;;EAYaA,mBAAiB;WAAjBA;;EA8BAC,uBAAqB;WAArBA;;EA6BAC,iBAAe;WAAfA;;EA8BAC,qBAAmB;WAAnBA;;EA8BAC,cAAY;WAAZA;;EAuBAC,eAAa;WAAbA;;;;iEA1JI;AAGjB,MAAMC,mCAAmC;EACvCC,UAAU;IACR;MACEC,MAAMC,cAAKC,KAAK,OAAO;MACvBC,SAAS;IACX;;AAEJ;AAEO,MAAMX,oBAAwC;EACnD;IACEY,WAAW;IACXC,QAAQ;IACRC,QAAQ;IACRC,QAAQ;IACRC,MAAMV;IACNW,KAAK;EACP;EACA;IACEL,WAAW;IACXC,QAAQ;IACRC,QAAQ;IACRC,QAAQ;IACRE,KAAK;EACP;EACA;IACEL,WAAW;IACXC,QAAQ;IACRC,QAAQ;IACRC,QAAQ;IACRE,KAAK;EACP;EACA;IACEL,WAAW;IACXK,KAAK;MAAEC,MAAM;IAAK;IAClBH,QAAQ;EACV;;AAGK,MAAMd,wBAA4C;EACvD;IACEW,WAAW;IACXC,QAAQ;IACRC,QAAQ;IACRC,QAAQ;IACRC,MAAMV;IACNW,KAAK;EACP;EACA;IACEL,WAAW;IACXC,QAAQ;IACRC,QAAQ;IACRC,QAAQ;IACRE,KAAK;EACP;EACA;IACEL,WAAW;IACXC,QAAQ;IACRC,QAAQ;IACRC,QAAQ;IACRE,KAAK;EACP;EACA;IACEL,WAAW;IACXK,KAAK;MAAEC,MAAM;IAAK;IAClBH,QAAQ;EACV;;AAEK,MAAMb,kBAAsC;EACjD;IACEU,WAAW;IACXC,QAAQ;IACRC,QAAQ;IACRC,QAAQ;IACRC,MAAMV;IACNW,KAAK;EACP;EACA;IACEL,WAAW;IACXC,QAAQ;IACRC,QAAQ;IACRC,QAAQ;IACRE,KAAK;EACP;EACA;IACEL,WAAW;IACXC,QAAQ;IACRC,QAAQ;IACRC,QAAQ;IACRE,KAAK;EACP;EACA;IACEL,WAAW;IACXK,KAAK;MAAEC,MAAM;IAAK;IAClBH,QAAQ;EACV;;AAGK,MAAMZ,sBAA0C;EACrD;IACES,WAAW;IACXC,QAAQ;IACRC,QAAQ;IACRG,KAAK;IACLF,QAAQ;IACRC,MAAMV;EACR;EACA;IACEM,WAAW;IACXC,QAAQ;IACRC,QAAQ;IACRC,QAAQ;IACRE,KAAK;EACP;EACA;IACEL,WAAW;IACXC,QAAQ;IACRC,QAAQ;IACRC,QAAQ;IACRE,KAAK;EACP;EACA;IACEL,WAAW;IACXK,KAAK;MAAEC,MAAM;IAAK;IAClBH,QAAQ;EACV;;AAGK,MAAMX,eAAmC;EAC9C;IACEQ,WAAW;IACXC,QAAQ;IACRC,QAAQ;IACRG,KAAK;IACLF,QAAQ;IACRC,MAAMV;EACR;EACA;IACEM,WAAW;IACXC,QAAQ;IACRC,QAAQ;IACRG,KAAK;IACLF,QAAQ;EACV;EACA;IACEH,WAAW;IACXK,KAAK;MAAEC,MAAM;IAAK;IAClBH,QAAQ;EACV;;AAGK,MAAMV,gBAAgB;EAC3B,gBAAgBL;EAChBmB,cAAcnB;EACd,qBAAqBC;EACrBmB,mBAAmBnB;EACnB,cAAcC;EACdmB,YAAYnB;EACZ,mBAAmBC;EACnBmB,iBAAiBnB;EACjB,WAAWC;EACXmB,SAASnB;AACX;","names":["universalJsPreset","universalJsLitePreset","browserJsPreset","browserJsLitePreset","nodeJsPreset","legacyPresets","legacyWithSourceCodeToCopyConfig","patterns","from","path","join","context","buildType","format","target","outDir","copy","dts","only","UNIVERSAL_JS","UNIVERSAL_JS_LITE","BROWSER_JS","BROWSER_JS_LITE","NODE_JS"],"sources":["../../src/constants/home/runner/work/modern.js/modern.js/packages/solutions/module-tools/src/constants/legacyBuildPresets.ts"],"sourcesContent":["import path from 'path';\nimport type { PartialBuildConfig } from '../types';\n\nconst legacyWithSourceCodeToCopyConfig = {\n patterns: [\n {\n from: path.join('src', '**/*.{less,sass,scss}'),\n context: 'src',\n },\n ],\n};\n\nexport const universalJsPreset: PartialBuildConfig = [\n {\n buildType: 'bundleless',\n format: 'esm',\n target: 'es5',\n outDir: './dist/js/treeshaking',\n copy: legacyWithSourceCodeToCopyConfig,\n dts: false,\n },\n {\n buildType: 'bundleless',\n format: 'cjs',\n target: 'es6',\n outDir: './dist/js/node',\n dts: false,\n },\n {\n buildType: 'bundleless',\n format: 'esm',\n target: 'es6',\n outDir: './dist/js/modern',\n dts: false,\n },\n {\n buildType: 'bundleless',\n dts: { only: true },\n outDir: './dist/types',\n },\n];\n\nexport const universalJsLitePreset: PartialBuildConfig = [\n {\n buildType: 'bundleless',\n format: 'esm',\n target: 'es5',\n outDir: './dist/js/treeshaking',\n copy: legacyWithSourceCodeToCopyConfig,\n dts: false,\n },\n {\n buildType: 'bundleless',\n format: 'cjs',\n target: 'es6',\n outDir: './dist/js/node',\n dts: false,\n },\n {\n buildType: 'bundleless',\n format: 'esm',\n target: 'es5',\n outDir: './dist/js/modern',\n dts: false,\n },\n {\n buildType: 'bundleless',\n dts: { only: true },\n outDir: './dist/types',\n },\n];\nexport const browserJsPreset: PartialBuildConfig = [\n {\n buildType: 'bundleless',\n format: 'esm',\n target: 'es5',\n outDir: './dist/js/treeshaking',\n copy: legacyWithSourceCodeToCopyConfig,\n dts: false,\n },\n {\n buildType: 'bundleless',\n format: 'esm',\n target: 'es6',\n outDir: './dist/js/node',\n dts: false,\n },\n {\n buildType: 'bundleless',\n format: 'esm',\n target: 'es6',\n outDir: './dist/js/modern',\n dts: false,\n },\n {\n buildType: 'bundleless',\n dts: { only: true },\n outDir: './dist/types',\n },\n];\n\nexport const browserJsLitePreset: PartialBuildConfig = [\n {\n buildType: 'bundleless',\n format: 'esm',\n target: 'es5',\n dts: false,\n outDir: './dist/js/treeshaking',\n copy: legacyWithSourceCodeToCopyConfig,\n },\n {\n buildType: 'bundleless',\n format: 'esm',\n target: 'es5',\n outDir: './dist/js/node',\n dts: false,\n },\n {\n buildType: 'bundleless',\n format: 'esm',\n target: 'es5',\n outDir: './dist/js/modern',\n dts: false,\n },\n {\n buildType: 'bundleless',\n dts: { only: true },\n outDir: './dist/types',\n },\n];\n\nexport const nodeJsPreset: PartialBuildConfig = [\n {\n buildType: 'bundleless',\n format: 'cjs',\n target: 'es6',\n dts: false,\n outDir: './dist/js/node',\n copy: legacyWithSourceCodeToCopyConfig,\n },\n {\n buildType: 'bundleless',\n format: 'esm',\n target: 'es6',\n dts: false,\n outDir: './dist/js/modern',\n },\n {\n buildType: 'bundleless',\n dts: { only: true },\n outDir: './dist/types',\n },\n];\n\nexport const legacyPresets = {\n 'universal-js': universalJsPreset,\n UNIVERSAL_JS: universalJsPreset,\n 'universal-js-lite': universalJsLitePreset,\n UNIVERSAL_JS_LITE: universalJsLitePreset,\n 'browser-js': browserJsPreset,\n BROWSER_JS: browserJsPreset,\n 'browser-js-lite': browserJsLitePreset,\n BROWSER_JS_LITE: browserJsLitePreset,\n 'node-js': nodeJsPreset,\n NODE_JS: nodeJsPreset,\n};\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"mappings":";AACA,OAAO,eAAe,SAAS,cAAc;AAAA,EACzC,OAAO;AACX,CAAC;","names":[],"sources":["../../src/types/copy.ts"],"sourcesContent":["\"use strict\";\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\n"]}
@@ -1,9 +0,0 @@
1
- import { ModuleContext } from '../types';
2
- import type { BaseBuildConfig, PartialBuildConfig, PartialBaseBuildConfig, DTSOptions, ModuleLegacyUserConfig } from '../types';
3
- export declare const validPartialBuildConfig: (config: PartialBuildConfig) => void;
4
- export declare const validBuildTypeAndFormat: (config: PartialBaseBuildConfig) => void;
5
- export declare const mergeDefaultBaseConfig: (pConfig: PartialBaseBuildConfig, context: ModuleContext) => Promise<BaseBuildConfig>;
6
- export declare const getDtsConfig: (userDTS: PartialBaseBuildConfig['dts'], defaultDTS: Required<DTSOptions>) => Promise<false | Required<DTSOptions>>;
7
- export declare const isLegacyUserConfig: (config: {
8
- legacy?: boolean;
9
- }) => config is ModuleLegacyUserConfig;
@@ -1 +0,0 @@
1
- {"version":3,"file":null,"mappings":";;;;;;;;;;;;EASaA,yBAAuB;WAAvBA;;EAUAC,yBAAuB;WAAvBA;;EAWAC,wBAAsB;WAAtBA;;EAyGAC,cAAY;WAAZA;;EAsBAC,oBAAkB;WAAlBA;;;;AApJN,MAAMJ,0BAA0B,CAACK;AACtC,MAAIC,MAAMC,QAAQF,SAAS;AACzB,eAAWG,KAAKH,QAAQ;AACtBJ,8BAAwBO;IAC1B;EACF,OAAO;AACLP,4BAAwBI;EAC1B;AACF;AAEO,MAAMJ,0BAA0B,CAACI;MAGXA;AAF3B,MACEA,OAAOI,cAAc,gBACrB;IAAC;IAAQ;IAAOC,UAASL,wBAAOM,YAAM,QAAbN,6CAAiB,KAC1C;AACA,UAAM,IAAIO,MACR,iGAAiG;EAErG;AACF;AAEO,MAAMV,yBAAyB,OACpCW,SACAC;MAmFYD,gBACCA,iBAEPA,iBAEAA;AAtFN,QAAM,EAAEE,oBAAoBC,cAAa,IAAK,MAAM,iFAClD;AAEF,QAAM,EAAEC,UAAS,IAAK,MAAM,iFAAO;AACnC,QAAM,EAAEC,mBAAmBC,oBAAoBC,MAAK,IAAK,MAAM,iFAC7D;AAEF,QAAM,EAAEC,qBAAoB,IAAK,MAAM,iFAAO;AAC9C,QAAM,EAAEC,eAAc,IAAK,MAAM,iFAAO;AACxC,QAAMC,eAAe;IACnB,KAAKT,QAAQU;EACf;AACA,QAAMC,cAAcP,kBAAkBK,cAAcV,QAAQa,KAAK;AAOjE,QAAMA,QAAQC,OAAOC,KAAKH,aAAaI,OACrC,CAACC,MAAMC;AACL,UAAMC,iBAAiB,CAACC;AAC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A8BG,cAAc6C,MAAMI;IACtD;IACAC,UAAU;MACR,GAAGlD,cAAckD;MACjB,GAAGrD,QAAQqD;IACb;IACArB;IACAsB,kBAAiBtD,mCAAQsD,qBAAe,QAAvBtD,iEAA2BG,cAAcmD;IAC1DC,kBAAiBvD,mCAAQuD,qBAAe,QAAvBvD,iEAA2BG,cAAcoD;IAC1DC,aAAYxD,8BAAQwD,gBAAU,QAAlBxD,uDAAsBG,cAAcqD;IAChDC,sBACEzD,uCAAQyD,yBAAmB,QAA3BzD,yEAA+BG,cAAcsD;EACjD;AACF;AAEO,MAAMnE,eAAe,OAC1BoE,SACAC;AAEA,QAAM,EAAEvD,WAAWwD,aAAaC,SAAQ,IAAK,MAAM,iFACjD;AAGF,MAAID,YAAYF,UAAU;AACxB,WAAOtD,UAAUuD;EACnB;AAEA,MAAIE,SAASH,UAAU;AACrB,WAAO;MACL,GAAGC;MACH,GAAGD;IACL;EACF;AAEA,SAAOA;AACT;AAEO,MAAMnE,qBAAqB,CAACC,WAEKsE,QAAQtE,OAAOuE,MAAM;","names":["validPartialBuildConfig","validBuildTypeAndFormat","mergeDefaultBaseConfig","getDtsConfig","isLegacyUserConfig","config","Array","isArray","c","buildType","includes","format","Error","pConfig","context","defaultBuildConfig","defaultConfig","cloneDeep","applyOptionsChain","ensureAbsolutePath","slash","getDefaultIndexEntry","getStyleConfig","defaultAlias","srcDirectory","mergedAlias","alias","Object","keys","reduce","prev","name","formattedValue","value","startsWith","appDirectory","styleConfig","sourceDir","metafile","input","userDefine","define","memo","JSON","stringify","esbuildOptions","asset","target","sourceMap","copy","outDir","dts","jsx","platform","splitting","minify","autoExternal","umdGlobals","umdModuleName","sideEffects","externals","style","inject","modules","autoModules","tailwindcss","redirect","externalHelpers","transformImport","sourceType","disableSwcTransform","userDTS","defaultDTS","isUndefined","isObject","Boolean","legacy"],"sources":["../../src/utils/home/runner/work/modern.js/modern.js/packages/solutions/module-tools/src/utils/config.ts"],"sourcesContent":["import { ModuleContext } from '../types';\nimport type {\n BaseBuildConfig,\n PartialBuildConfig,\n PartialBaseBuildConfig,\n DTSOptions,\n ModuleLegacyUserConfig,\n} from '../types';\n\nexport const validPartialBuildConfig = (config: PartialBuildConfig) => {\n if (Array.isArray(config)) {\n for (const c of config) {\n validBuildTypeAndFormat(c);\n }\n } else {\n validBuildTypeAndFormat(config);\n }\n};\n\nexport const validBuildTypeAndFormat = (config: PartialBaseBuildConfig) => {\n if (\n config.buildType === 'bundleless' &&\n ['iife', 'umd'].includes(config.format ?? '')\n ) {\n throw new Error(\n `when buildType is bundleless, the format must be equal to one of the allowed values: (cjs, esm)`,\n );\n }\n};\n\nexport const mergeDefaultBaseConfig = async (\n pConfig: PartialBaseBuildConfig,\n context: ModuleContext,\n): Promise<BaseBuildConfig> => {\n const { defaultBuildConfig: defaultConfig } = await import(\n '../constants/build'\n );\n const { cloneDeep } = await import('@modern-js/utils/lodash');\n const { applyOptionsChain, ensureAbsolutePath, slash } = await import(\n '@modern-js/utils'\n );\n const { getDefaultIndexEntry } = await import('./input');\n const { getStyleConfig } = await import('./style');\n const defaultAlias = {\n '@': context.srcDirectory,\n };\n const mergedAlias = applyOptionsChain(defaultAlias, pConfig.alias);\n\n /**\n * Format alias value:\n * - Relative paths need to be turned into absolute paths.\n * - Absolute paths or a package name are not processed.\n */\n const alias = Object.keys(mergedAlias).reduce<Record<string, string>>(\n (prev, name) => {\n const formattedValue = (value: string) => {\n if (typeof value === 'string' && value.startsWith('.')) {\n return slash(ensureAbsolutePath(context.appDirectory, value));\n }\n return value;\n };\n const value = formattedValue(mergedAlias[name]);\n\n prev[name] = value;\n return prev;\n },\n {},\n );\n\n const styleConfig = await getStyleConfig(pConfig);\n const buildType = pConfig.buildType ?? defaultConfig.buildType;\n const sourceDir = pConfig.sourceDir ?? defaultConfig.sourceDir;\n const metafile = pConfig.metafile ?? defaultConfig.metafile;\n const input =\n buildType === 'bundle' ? await getDefaultIndexEntry(context) : [sourceDir];\n const userDefine = pConfig.define ?? {};\n const define = {\n ...defaultConfig.define,\n ...Object.keys(userDefine).reduce<Record<string, string>>((memo, name) => {\n memo[name] = JSON.stringify(userDefine[name]!);\n return memo;\n }, {}),\n };\n const esbuildOptions = pConfig.esbuildOptions ?? defaultConfig.esbuildOptions;\n return {\n asset: {\n ...defaultConfig.asset,\n ...pConfig.asset,\n },\n buildType,\n format: pConfig.format ?? defaultConfig.format,\n target: pConfig.target ?? defaultConfig.target,\n sourceMap: pConfig.sourceMap ?? defaultConfig.sourceMap,\n copy: pConfig.copy ?? cloneDeep(defaultConfig.copy),\n outDir: pConfig.outDir ?? defaultConfig.outDir,\n dts: await getDtsConfig(pConfig.dts, defaultConfig.dts as DTSOptions),\n jsx: pConfig.jsx ?? defaultConfig.jsx,\n input: pConfig.input ?? cloneDeep(input),\n platform: pConfig.platform ?? defaultConfig.platform,\n splitting: pConfig.splitting ?? defaultConfig.splitting,\n minify: pConfig.minify ?? defaultConfig.minify,\n autoExternal: pConfig.autoExternal ?? defaultConfig.autoExternal,\n umdGlobals: {\n ...defaultConfig.umdGlobals,\n ...pConfig.umdGlobals,\n },\n umdModuleName: pConfig.umdModuleName ?? defaultConfig.umdModuleName,\n sideEffects: pConfig.sideEffects ?? defaultConfig.sideEffects,\n externals: pConfig.externals ?? defaultConfig.externals,\n sourceDir,\n alias,\n define,\n metafile,\n style: {\n ...styleConfig,\n inject: pConfig.style?.inject ?? defaultConfig.style.inject,\n modules: pConfig.style?.modules ?? defaultConfig.style.modules,\n autoModules:\n pConfig.style?.autoModules ?? defaultConfig.style.autoModules,\n tailwindcss:\n pConfig.style?.tailwindcss ?? defaultConfig.style.tailwindcss,\n },\n redirect: {\n ...defaultConfig.redirect,\n ...pConfig.redirect,\n },\n esbuildOptions,\n externalHelpers: pConfig.externalHelpers ?? defaultConfig.externalHelpers,\n transformImport: pConfig.transformImport ?? defaultConfig.transformImport,\n sourceType: pConfig.sourceType ?? defaultConfig.sourceType,\n disableSwcTransform:\n pConfig.disableSwcTransform ?? defaultConfig.disableSwcTransform,\n };\n};\n\nexport const getDtsConfig = async (\n userDTS: PartialBaseBuildConfig['dts'],\n defaultDTS: Required<DTSOptions>,\n) => {\n const { cloneDeep, isUndefined, isObject } = await import(\n '@modern-js/utils/lodash'\n );\n\n if (isUndefined(userDTS)) {\n return cloneDeep(defaultDTS);\n }\n\n if (isObject(userDTS)) {\n return {\n ...defaultDTS,\n ...userDTS,\n };\n }\n\n return userDTS;\n};\n\nexport const isLegacyUserConfig = (config: {\n legacy?: boolean;\n}): config is ModuleLegacyUserConfig => Boolean(config.legacy);\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"file":null,"mappings":";;;;;;;;;;;;EAIaA,aAAW;WAAXA;;EAuBAC,gBAAc;WAAdA;;;;wBA3BU;AAIhB,MAAMD,cAAc,CACzBE,KACAC;AAEA,SAAO;IACLC,MAAM;IACNC,MAAMC,UAAQ;AACZA,eAASC,MAAMC,YAAYC,IAAI,gBAAgB;AAC7C,cAAM,EAAEC,kBAAiB,IAAK,MAAM,iFAAO;AAC3C,cAAM,EAAEC,mBAAkB,IAAK,MAAM,iFAAO;AAC5C,cAAMC,YAAY,IAChBT,OAAOU,cAAc,WAAW,WAAW,gBACzCV,OAAOW,UAAUX,OAAOY;AAE5BC,uBAAOC,KAAK,MAAMP,kBAAkBE,WAAWD,mBAAmBO,GAAG;AAErE,cAAMC,SAASjB,IAAIkB,eAAc;AACjCD,eAAOE,aAAa;UAAEC,aAAanB;QAAO;MAC5C;IACF;EACF;AACF;AAEO,MAAMF,iBAAiB,CAC5BE,QACAoB;AAEA,SAAO;IACLnB,MAAM;IACNC,MAAMC,UAAQ;AACZA,eAASC,MAAMiB,WAAWC,WAAW,mBAAmB;AACtD,cAAM,EAAEC,kBAAiB,IAAK,MAAM,iFAAO;AAC3C,cAAMC,iBAAiB,MAAMD,kBAAkBvB,QAAQoB;AACvDjB,iBAASH,OAAOyB,WAAWD;MAC7B;IACF;EACF;AACF;","names":["watchPlugin","externalPlugin","api","config","name","apply","compiler","hooks","watchChange","tap","watchSectionTitle","SectionTitleStatus","titleText","buildType","format","target","logger","info","Log","runner","useHookRunners","buildWatchJs","buildConfig","options","initialize","tapPromise","getFinalExternals","finalExternals","external"],"sources":["../../src/utils/home/runner/work/modern.js/modern.js/packages/solutions/module-tools/src/utils/libuildPlugins.ts"],"sourcesContent":["import { logger } from '@modern-js/utils/logger';\nimport type { LibuildPlugin } from '@modern-js/libuild';\nimport type { BaseBuildConfig, PluginAPI, ModuleTools } from '../types';\n\nexport const watchPlugin = (\n api: PluginAPI<ModuleTools>,\n config: BaseBuildConfig,\n): LibuildPlugin => {\n return {\n name: 'watch-plugin',\n apply(compiler) {\n compiler.hooks.watchChange.tap('watch-plugin', async () => {\n const { watchSectionTitle } = await import('./log');\n const { SectionTitleStatus } = await import('../constants/log');\n const titleText = `[${\n config.buildType === 'bundle' ? 'Bundle' : 'Bundleless'\n }:${config.format}_${config.target}]`;\n\n logger.info(await watchSectionTitle(titleText, SectionTitleStatus.Log));\n\n const runner = api.useHookRunners();\n runner.buildWatchJs({ buildConfig: config });\n });\n },\n };\n};\n\nexport const externalPlugin = (\n config: BaseBuildConfig,\n options: { appDirectory: string },\n): LibuildPlugin => {\n return {\n name: 'external-plugin',\n apply(compiler) {\n compiler.hooks.initialize.tapPromise('external-plugin', async () => {\n const { getFinalExternals } = await import('./builder');\n const finalExternals = await getFinalExternals(config, options);\n compiler.config.external = finalExternals;\n });\n },\n };\n};\n"]}