@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
  134. package/dist/types/utils.js.map +0 -1
@@ -1,69 +1,34 @@
1
- var __create = Object.create;
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __getProtoOf = Object.getPrototypeOf;
6
- var __hasOwnProp = Object.prototype.hasOwnProperty;
7
- var __export = (target, all) => {
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", {
3
+ value: true
4
+ });
5
+ function _export(target, all) {
8
6
  for (var name in all)
9
- __defProp(target, name, { get: all[name], enumerable: true });
10
- };
11
- var __copyProps = (to, from, except, desc) => {
12
- if (from && typeof from === "object" || typeof from === "function") {
13
- for (let key of __getOwnPropNames(from))
14
- if (!__hasOwnProp.call(to, key) && key !== except)
15
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
16
- }
17
- return to;
18
- };
19
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
20
- // If the importer is in node compatibility mode or this is not an ESM
21
- // file that has been converted to a CommonJS file using a Babel-
22
- // compatible transform (i.e. "__esModule" has not been set), then set
23
- // "default" to the CommonJS "module.exports" for node compatibility.
24
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
25
- mod
26
- ));
27
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
28
- var __async = (__this, __arguments, generator) => {
29
- return new Promise((resolve, reject) => {
30
- var fulfilled = (value) => {
31
- try {
32
- step(generator.next(value));
33
- } catch (e) {
34
- reject(e);
35
- }
36
- };
37
- var rejected = (value) => {
38
- try {
39
- step(generator.throw(value));
40
- } catch (e) {
41
- reject(e);
42
- }
43
- };
44
- var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
45
- step((generator = generator.apply(__this, __arguments)).next());
46
- });
47
- };
48
- var libuildPlugins_exports = {};
49
- __export(libuildPlugins_exports, {
50
- externalPlugin: () => externalPlugin,
51
- watchPlugin: () => watchPlugin
7
+ Object.defineProperty(target, name, {
8
+ enumerable: true,
9
+ get: all[name]
10
+ });
11
+ }
12
+ _export(exports, {
13
+ watchPlugin: () => watchPlugin,
14
+ externalPlugin: () => externalPlugin
52
15
  });
53
- module.exports = __toCommonJS(libuildPlugins_exports);
54
- var import_logger = require("@modern-js/utils/logger");
16
+ const _interop_require_wildcard = require("@swc/helpers/_/_interop_require_wildcard");
17
+ const _logger = require("@modern-js/utils/logger");
55
18
  const watchPlugin = (api, config) => {
56
19
  return {
57
20
  name: "watch-plugin",
58
21
  apply(compiler) {
59
- compiler.hooks.watchChange.tap("watch-plugin", () => __async(this, null, function* () {
60
- const { watchSectionTitle } = yield Promise.resolve().then(() => __toESM(require("./log")));
61
- const { SectionTitleStatus } = yield Promise.resolve().then(() => __toESM(require("../constants/log")));
22
+ compiler.hooks.watchChange.tap("watch-plugin", async () => {
23
+ const { watchSectionTitle } = await Promise.resolve().then(() => /* @__PURE__ */ _interop_require_wildcard._(require("./log")));
24
+ const { SectionTitleStatus } = await Promise.resolve().then(() => /* @__PURE__ */ _interop_require_wildcard._(require("../constants/log")));
62
25
  const titleText = `[${config.buildType === "bundle" ? "Bundle" : "Bundleless"}:${config.format}_${config.target}]`;
63
- import_logger.logger.info(yield watchSectionTitle(titleText, SectionTitleStatus.Log));
26
+ _logger.logger.info(await watchSectionTitle(titleText, SectionTitleStatus.Log));
64
27
  const runner = api.useHookRunners();
65
- runner.buildWatchJs({ buildConfig: config });
66
- }));
28
+ runner.buildWatchJs({
29
+ buildConfig: config
30
+ });
31
+ });
67
32
  }
68
33
  };
69
34
  };
@@ -71,18 +36,13 @@ const externalPlugin = (config, options) => {
71
36
  return {
72
37
  name: "external-plugin",
73
38
  apply(compiler) {
74
- compiler.hooks.initialize.tapPromise("external-plugin", () => __async(this, null, function* () {
75
- const { getFinalExternals } = yield Promise.resolve().then(() => __toESM(require("./builder")));
76
- const finalExternals = yield getFinalExternals(config, options);
39
+ compiler.hooks.initialize.tapPromise("external-plugin", async () => {
40
+ const { getFinalExternals } = await Promise.resolve().then(() => /* @__PURE__ */ _interop_require_wildcard._(require("./builder")));
41
+ const finalExternals = await getFinalExternals(config, options);
77
42
  compiler.config.external = finalExternals;
78
- }));
43
+ });
79
44
  }
80
45
  };
81
46
  };
82
- // Annotate the CommonJS export names for ESM import in node:
83
- 0 && (module.exports = {
84
- externalPlugin,
85
- watchPlugin
86
- });
87
47
 
88
48
  //# sourceMappingURL=libuildPlugins.js.map
@@ -1 +1 @@
1
- {"version":3,"file":null,"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,oBAAuB;AAIhB,MAAM,cAAc,CACzB,KACA,WACkB;AAClB,SAAO;AAAA,IACL,MAAM;AAAA,IACN,MAAM,UAAU;AACd,eAAS,MAAM,YAAY,IAAI,gBAAgB,MAAY;AACzD,cAAM,EAAE,kBAAkB,IAAI,MAAM,6CAAO,OAAO;AAClD,cAAM,EAAE,mBAAmB,IAAI,MAAM,6CAAO,kBAAkB;AAC9D,cAAM,YAAY,IAChB,OAAO,cAAc,WAAW,WAAW,gBACzC,OAAO,UAAU,OAAO;AAE5B,6BAAO,KAAK,MAAM,kBAAkB,WAAW,mBAAmB,GAAG,CAAC;AAEtE,cAAM,SAAS,IAAI,eAAe;AAClC,eAAO,aAAa,EAAE,aAAa,OAAO,CAAC;AAAA,MAC7C,EAAC;AAAA,IACH;AAAA,EACF;AACF;AAEO,MAAM,iBAAiB,CAC5B,QACA,YACkB;AAClB,SAAO;AAAA,IACL,MAAM;AAAA,IACN,MAAM,UAAU;AACd,eAAS,MAAM,WAAW,WAAW,mBAAmB,MAAY;AAClE,cAAM,EAAE,kBAAkB,IAAI,MAAM,6CAAO,WAAW;AACtD,cAAM,iBAAiB,MAAM,kBAAkB,QAAQ,OAAO;AAC9D,iBAAS,OAAO,WAAW;AAAA,MAC7B,EAAC;AAAA,IACH;AAAA,EACF;AACF;;;;;;","names":[],"sources":["../../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"]}
1
+ {"version":3,"file":null,"mappings":";;;;;;;;;;;;EAIaA,aAAW,MAAXA;EAuBAC,gBAAc,MAAdA;;;wBA3BU;AAIhB,MAAMD,cAAc,CACzBE,KACAC,WACkB;AAClB,SAAO;IACLC,MAAM;IACNC,MAAMC,UAAU;AACdA,eAASC,MAAMC,YAAYC,IAAI,gBAAgB,YAAY;AACzD,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,YACkB;AAClB,SAAO;IACLnB,MAAM;IACNC,MAAMC,UAAU;AACdA,eAASC,MAAMiB,WAAWC,WAAW,mBAAmB,YAAY;AAClE,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/Users/bytedance/github/targeral/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"]}
package/dist/utils/log.js CHANGED
@@ -1,68 +1,21 @@
1
- var __create = Object.create;
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __getProtoOf = Object.getPrototypeOf;
6
- var __hasOwnProp = Object.prototype.hasOwnProperty;
7
- var __export = (target, all) => {
8
- for (var name in all)
9
- __defProp(target, name, { get: all[name], enumerable: true });
10
- };
11
- var __copyProps = (to, from, except, desc) => {
12
- if (from && typeof from === "object" || typeof from === "function") {
13
- for (let key of __getOwnPropNames(from))
14
- if (!__hasOwnProp.call(to, key) && key !== except)
15
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
16
- }
17
- return to;
18
- };
19
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
20
- // If the importer is in node compatibility mode or this is not an ESM
21
- // file that has been converted to a CommonJS file using a Babel-
22
- // compatible transform (i.e. "__esModule" has not been set), then set
23
- // "default" to the CommonJS "module.exports" for node compatibility.
24
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
25
- mod
26
- ));
27
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
28
- var __async = (__this, __arguments, generator) => {
29
- return new Promise((resolve, reject) => {
30
- var fulfilled = (value) => {
31
- try {
32
- step(generator.next(value));
33
- } catch (e) {
34
- reject(e);
35
- }
36
- };
37
- var rejected = (value) => {
38
- try {
39
- step(generator.throw(value));
40
- } catch (e) {
41
- reject(e);
42
- }
43
- };
44
- var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
45
- step((generator = generator.apply(__this, __arguments)).next());
46
- });
47
- };
48
- var log_exports = {};
49
- __export(log_exports, {
50
- watchSectionTitle: () => watchSectionTitle
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", {
3
+ value: true
51
4
  });
52
- module.exports = __toCommonJS(log_exports);
53
- var import_log = require("../constants/log");
54
- const watchSectionTitle = (str, status, detailLog) => __async(void 0, null, function* () {
55
- const { chalk } = yield Promise.resolve().then(() => __toESM(require("@modern-js/utils")));
56
- if (status === import_log.SectionTitleStatus.Success) {
5
+ Object.defineProperty(exports, "watchSectionTitle", {
6
+ enumerable: true,
7
+ get: () => watchSectionTitle
8
+ });
9
+ const _interop_require_wildcard = require("@swc/helpers/_/_interop_require_wildcard");
10
+ const _log = require("../constants/log");
11
+ const watchSectionTitle = async (str, status, detailLog) => {
12
+ const { chalk } = await Promise.resolve().then(() => /* @__PURE__ */ _interop_require_wildcard._(require("@modern-js/utils")));
13
+ if (status === _log.SectionTitleStatus.Success) {
57
14
  return `${chalk.gray(str)} ${chalk.green("Successful")}`;
58
- } else if (status === import_log.SectionTitleStatus.Fail) {
15
+ } else if (status === _log.SectionTitleStatus.Fail) {
59
16
  return `${chalk.gray(str)} ${chalk.red("Build Failed")}`;
60
17
  }
61
18
  return `${chalk.gray(str)} ${detailLog ? detailLog : "Log:"}`;
62
- });
63
- // Annotate the CommonJS export names for ESM import in node:
64
- 0 && (module.exports = {
65
- watchSectionTitle
66
- });
19
+ };
67
20
 
68
21
  //# sourceMappingURL=log.js.map
@@ -1 +1 @@
1
- {"version":3,"file":null,"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,iBAAmC;AAE5B,MAAM,oBAAoB,CAC/B,KACA,QACA,cACG;AACH,QAAM,EAAE,MAAM,IAAI,MAAM,6CAAO,kBAAkB;AACjD,MAAI,WAAW,8BAAmB,SAAS;AACzC,WAAO,GAAG,MAAM,KAAK,GAAG,KAAK,MAAM,MAAM,YAAY;AAAA,EACvD,WAAW,WAAW,8BAAmB,MAAM;AAC7C,WAAO,GAAG,MAAM,KAAK,GAAG,KAAK,MAAM,IAAI,cAAc;AAAA,EACvD;AAEA,SAAO,GAAG,MAAM,KAAK,GAAG,KAAK,YAAY,YAAY;AACvD;;;;;","names":[],"sources":["../../src/utils/log.ts"],"sourcesContent":["import { SectionTitleStatus } from '../constants/log';\n\nexport const watchSectionTitle = async (\n str: string,\n status: SectionTitleStatus,\n detailLog?: string,\n) => {\n const { chalk } = await import('@modern-js/utils');\n if (status === SectionTitleStatus.Success) {\n return `${chalk.gray(str)} ${chalk.green('Successful')}`;\n } else if (status === SectionTitleStatus.Fail) {\n return `${chalk.gray(str)} ${chalk.red('Build Failed')}`;\n }\n\n return `${chalk.gray(str)} ${detailLog ? detailLog : 'Log:'}`;\n};\n"]}
1
+ {"version":3,"file":null,"mappings":";;;;+BAEaA;;aAAAA;;;qBAFsB;AAE5B,MAAMA,oBAAoB,OAC/BC,KACAC,QACAC,cACG;AACH,QAAM,EAAEC,MAAK,IAAK,MAAM,iFAAO;AAC/B,MAAIF,WAAWG,wBAAmBC,SAAS;AACzC,WAAO,GAAGF,MAAMG,KAAKN,QAAQG,MAAMI,MAAM;EAC3C,WAAWN,WAAWG,wBAAmBI,MAAM;AAC7C,WAAO,GAAGL,MAAMG,KAAKN,QAAQG,MAAMM,IAAI;EACzC;AAEA,SAAO,GAAGN,MAAMG,KAAKN,QAAQE,YAAYA,YAAY;AACvD;","names":["watchSectionTitle","str","status","detailLog","chalk","SectionTitleStatus","Success","gray","green","Fail","red"],"sources":["../../src/utils/Users/bytedance/github/targeral/modern-js/packages/solutions/module-tools/src/utils/log.ts"],"sourcesContent":["import { SectionTitleStatus } from '../constants/log';\n\nexport const watchSectionTitle = async (\n str: string,\n status: SectionTitleStatus,\n detailLog?: string,\n) => {\n const { chalk } = await import('@modern-js/utils');\n if (status === SectionTitleStatus.Success) {\n return `${chalk.gray(str)} ${chalk.green('Successful')}`;\n } else if (status === SectionTitleStatus.Fail) {\n return `${chalk.gray(str)} ${chalk.red('Build Failed')}`;\n }\n\n return `${chalk.gray(str)} ${detailLog ? detailLog : 'Log:'}`;\n};\n"]}
@@ -1,67 +1,20 @@
1
- var __create = Object.create;
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __getProtoOf = Object.getPrototypeOf;
6
- var __hasOwnProp = Object.prototype.hasOwnProperty;
7
- var __export = (target, all) => {
8
- for (var name in all)
9
- __defProp(target, name, { get: all[name], enumerable: true });
10
- };
11
- var __copyProps = (to, from, except, desc) => {
12
- if (from && typeof from === "object" || typeof from === "function") {
13
- for (let key of __getOwnPropNames(from))
14
- if (!__hasOwnProp.call(to, key) && key !== except)
15
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
16
- }
17
- return to;
18
- };
19
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
20
- // If the importer is in node compatibility mode or this is not an ESM
21
- // file that has been converted to a CommonJS file using a Babel-
22
- // compatible transform (i.e. "__esModule" has not been set), then set
23
- // "default" to the CommonJS "module.exports" for node compatibility.
24
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
25
- mod
26
- ));
27
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
28
- var __async = (__this, __arguments, generator) => {
29
- return new Promise((resolve, reject) => {
30
- var fulfilled = (value) => {
31
- try {
32
- step(generator.next(value));
33
- } catch (e) {
34
- reject(e);
35
- }
36
- };
37
- var rejected = (value) => {
38
- try {
39
- step(generator.throw(value));
40
- } catch (e) {
41
- reject(e);
42
- }
43
- };
44
- var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
45
- step((generator = generator.apply(__this, __arguments)).next());
46
- });
47
- };
48
- var onExit_exports = {};
49
- __export(onExit_exports, {
50
- addExitListener: () => addExitListener
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", {
3
+ value: true
4
+ });
5
+ Object.defineProperty(exports, "addExitListener", {
6
+ enumerable: true,
7
+ get: () => addExitListener
51
8
  });
52
- module.exports = __toCommonJS(onExit_exports);
53
- const addExitListener = (fn) => __async(void 0, null, function* () {
54
- const { default: onExit } = yield Promise.resolve().then(() => __toESM(require("../../compiled/signal-exit")));
55
- onExit((code) => __async(void 0, null, function* () {
9
+ const _interop_require_wildcard = require("@swc/helpers/_/_interop_require_wildcard");
10
+ const addExitListener = async (fn) => {
11
+ const { default: onExit } = await Promise.resolve().then(() => /* @__PURE__ */ _interop_require_wildcard._(require("../../compiled/signal-exit")));
12
+ onExit(async (code) => {
56
13
  if (code === 0) {
57
14
  return;
58
15
  }
59
- yield fn();
60
- }));
61
- });
62
- // Annotate the CommonJS export names for ESM import in node:
63
- 0 && (module.exports = {
64
- addExitListener
65
- });
16
+ await fn();
17
+ });
18
+ };
66
19
 
67
20
  //# sourceMappingURL=onExit.js.map
@@ -1 +1 @@
1
- {"version":3,"file":null,"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAO,MAAM,kBAAkB,CAAO,OAA4B;AAChE,QAAM,EAAE,SAAS,OAAO,IAAI,MAAM,6CAAO,4BAA4B;AAErE,SAAO,CAAM,SAAQ;AACnB,QAAI,SAAS,GAAG;AACd;AAAA,IACF;AAEA,UAAM,GAAG;AAAA,EACX,EAAC;AACH;;;;;","names":[],"sources":["../../src/utils/onExit.ts"],"sourcesContent":["export const addExitListener = async (fn: () => Promise<void>) => {\n const { default: onExit } = await import('../../compiled/signal-exit');\n\n onExit(async code => {\n if (code === 0) {\n return;\n }\n\n await fn();\n });\n};\n"]}
1
+ {"version":3,"file":null,"mappings":";;;;+BAAaA;;aAAAA;;;AAAN,MAAMA,kBAAkB,OAAOC,OAA4B;AAChE,QAAM,EAAEC,SAASC,OAAM,IAAK,MAAM,iFAAO;AAEzCA,SAAO,OAAMC,SAAQ;AACnB,QAAIA,SAAS,GAAG;AACd;IACF;AAEA,UAAMH;EACR;AACF;","names":["addExitListener","fn","default","onExit","code"],"sources":["../../src/utils/Users/bytedance/github/targeral/modern-js/packages/solutions/module-tools/src/utils/onExit.ts"],"sourcesContent":["export const addExitListener = async (fn: () => Promise<void>) => {\n const { default: onExit } = await import('../../compiled/signal-exit');\n\n onExit(async code => {\n if (code === 0) {\n return;\n }\n\n await fn();\n });\n};\n"]}
@@ -1,63 +1,17 @@
1
- var __create = Object.create;
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __getProtoOf = Object.getPrototypeOf;
6
- var __hasOwnProp = Object.prototype.hasOwnProperty;
7
- var __export = (target, all) => {
8
- for (var name in all)
9
- __defProp(target, name, { get: all[name], enumerable: true });
10
- };
11
- var __copyProps = (to, from, except, desc) => {
12
- if (from && typeof from === "object" || typeof from === "function") {
13
- for (let key of __getOwnPropNames(from))
14
- if (!__hasOwnProp.call(to, key) && key !== except)
15
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
16
- }
17
- return to;
18
- };
19
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
20
- // If the importer is in node compatibility mode or this is not an ESM
21
- // file that has been converted to a CommonJS file using a Babel-
22
- // compatible transform (i.e. "__esModule" has not been set), then set
23
- // "default" to the CommonJS "module.exports" for node compatibility.
24
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
25
- mod
26
- ));
27
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
28
- var __async = (__this, __arguments, generator) => {
29
- return new Promise((resolve, reject) => {
30
- var fulfilled = (value) => {
31
- try {
32
- step(generator.next(value));
33
- } catch (e) {
34
- reject(e);
35
- }
36
- };
37
- var rejected = (value) => {
38
- try {
39
- step(generator.throw(value));
40
- } catch (e) {
41
- reject(e);
42
- }
43
- };
44
- var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
45
- step((generator = generator.apply(__this, __arguments)).next());
46
- });
47
- };
48
- var path_exports = {};
49
- __export(path_exports, {
50
- getCompiledPath: () => getCompiledPath
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", {
3
+ value: true
51
4
  });
52
- module.exports = __toCommonJS(path_exports);
53
- var import_path = __toESM(require("path"));
54
- const getCompiledPath = (packageName) => __async(void 0, null, function* () {
55
- const { slash } = yield Promise.resolve().then(() => __toESM(require("@modern-js/utils")));
56
- return slash(import_path.default.join(__dirname, "../../compiled", packageName));
57
- });
58
- // Annotate the CommonJS export names for ESM import in node:
59
- 0 && (module.exports = {
60
- getCompiledPath
5
+ Object.defineProperty(exports, "getCompiledPath", {
6
+ enumerable: true,
7
+ get: () => getCompiledPath
61
8
  });
9
+ const _interop_require_default = require("@swc/helpers/_/_interop_require_default");
10
+ const _interop_require_wildcard = require("@swc/helpers/_/_interop_require_wildcard");
11
+ const _path = /* @__PURE__ */ _interop_require_default._(require("path"));
12
+ const getCompiledPath = async (packageName) => {
13
+ const { slash } = await Promise.resolve().then(() => /* @__PURE__ */ _interop_require_wildcard._(require("@modern-js/utils")));
14
+ return slash(_path.default.join(__dirname, "../../compiled", packageName));
15
+ };
62
16
 
63
17
  //# sourceMappingURL=path.js.map
@@ -1 +1 @@
1
- {"version":3,"file":null,"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBAAiB;AAEV,MAAM,kBAAkB,CAAO,gBAAwB;AAC5D,QAAM,EAAE,MAAM,IAAI,MAAM,6CAAO,kBAAkB;AACjD,SAAO,MAAM,oBAAK,KAAK,WAAW,kBAAkB,WAAW,CAAC;AAClE;;;;;","names":[],"sources":["../../src/utils/path.ts"],"sourcesContent":["import path from 'path';\n\nexport const getCompiledPath = async (packageName: string) => {\n const { slash } = await import('@modern-js/utils');\n return slash(path.join(__dirname, '../../compiled', packageName));\n};\n"]}
1
+ {"version":3,"file":null,"mappings":";;;;+BAEaA;;aAAAA;;;;iEAFI;AAEV,MAAMA,kBAAkB,OAAOC,gBAAwB;AAC5D,QAAM,EAAEC,MAAK,IAAK,MAAM,iFAAO;AAC/B,SAAOA,MAAMC,cAAKC,KAAKC,WAAW,kBAAkBJ;AACtD;","names":["getCompiledPath","packageName","slash","path","join","__dirname"],"sources":["../../src/utils/Users/bytedance/github/targeral/modern-js/packages/solutions/module-tools/src/utils/path.ts"],"sourcesContent":["import path from 'path';\n\nexport const getCompiledPath = async (packageName: string) => {\n const { slash } = await import('@modern-js/utils');\n return slash(path.join(__dirname, '../../compiled', packageName));\n};\n"]}
@@ -1,71 +1,34 @@
1
- var __create = Object.create;
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __getProtoOf = Object.getPrototypeOf;
6
- var __hasOwnProp = Object.prototype.hasOwnProperty;
7
- var __export = (target, all) => {
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", {
3
+ value: true
4
+ });
5
+ function _export(target, all) {
8
6
  for (var name in all)
9
- __defProp(target, name, { get: all[name], enumerable: true });
10
- };
11
- var __copyProps = (to, from, except, desc) => {
12
- if (from && typeof from === "object" || typeof from === "function") {
13
- for (let key of __getOwnPropNames(from))
14
- if (!__hasOwnProp.call(to, key) && key !== except)
15
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
16
- }
17
- return to;
18
- };
19
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
20
- // If the importer is in node compatibility mode or this is not an ESM
21
- // file that has been converted to a CommonJS file using a Babel-
22
- // compatible transform (i.e. "__esModule" has not been set), then set
23
- // "default" to the CommonJS "module.exports" for node compatibility.
24
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
25
- mod
26
- ));
27
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
28
- var __async = (__this, __arguments, generator) => {
29
- return new Promise((resolve2, reject) => {
30
- var fulfilled = (value) => {
31
- try {
32
- step(generator.next(value));
33
- } catch (e) {
34
- reject(e);
35
- }
36
- };
37
- var rejected = (value) => {
38
- try {
39
- step(generator.throw(value));
40
- } catch (e) {
41
- reject(e);
42
- }
43
- };
44
- var step = (x) => x.done ? resolve2(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
45
- step((generator = generator.apply(__this, __arguments)).next());
46
- });
47
- };
48
- var print_exports = {};
49
- __export(print_exports, {
50
- addDtsFiles: () => addDtsFiles,
51
- addOutputChunk: () => addOutputChunk,
52
- addRollupChunk: () => addRollupChunk,
7
+ Object.defineProperty(target, name, {
8
+ enumerable: true,
9
+ get: all[name]
10
+ });
11
+ }
12
+ _export(exports, {
53
13
  bundleFiles: () => bundleFiles,
54
14
  bundlelessFiles: () => bundlelessFiles,
15
+ addOutputChunk: () => addOutputChunk,
16
+ addRollupChunk: () => addRollupChunk,
17
+ addDtsFiles: () => addDtsFiles,
55
18
  printFileSize: () => printFileSize,
56
19
  printSucceed: () => printSucceed
57
20
  });
58
- module.exports = __toCommonJS(print_exports);
59
- var import_path = require("path");
60
- var import_utils = require("@modern-js/utils");
61
- var import_log = require("../constants/log");
21
+ const _interop_require_wildcard = require("@swc/helpers/_/_interop_require_wildcard");
22
+ const _path = require("path");
23
+ const _utils = require("@modern-js/utils");
24
+ const _log = require("../constants/log");
62
25
  const bundleFiles = [];
63
26
  const bundlelessFiles = [];
64
27
  const addOutputChunk = (outputChunk, appDirectory, isBundle) => {
65
28
  const files = Array.from(outputChunk).map((val) => {
66
29
  const [path, chunk] = val;
67
30
  return {
68
- name: (0, import_path.relative)(appDirectory, path),
31
+ name: (0, _path.relative)(appDirectory, path),
69
32
  size: chunk.contents.length
70
33
  };
71
34
  });
@@ -77,43 +40,49 @@ const addOutputChunk = (outputChunk, appDirectory, isBundle) => {
77
40
  };
78
41
  const addRollupChunk = (rollupOutput, appDirectory, distDir) => {
79
42
  const { output } = rollupOutput;
80
- bundleFiles.push(
81
- ...output.map((o) => {
82
- return {
83
- name: (0, import_path.relative)(appDirectory, (0, import_path.resolve)(distDir, o.fileName)),
84
- // only d.ts, is outputChunk not outputAsset
85
- size: o.code.length
86
- };
87
- })
88
- );
43
+ bundleFiles.push(...output.map((o) => {
44
+ return {
45
+ name: (0, _path.relative)(appDirectory, (0, _path.resolve)(distDir, o.fileName)),
46
+ // only d.ts, is outputChunk not outputAsset
47
+ size: o.code.length
48
+ };
49
+ }));
89
50
  };
90
- const addDtsFiles = (distDir, appDirectory) => __async(void 0, null, function* () {
91
- const { fastGlob, slash } = yield Promise.resolve().then(() => __toESM(require("@modern-js/utils")));
92
- const files = yield fastGlob(`${slash(distDir)}**/*.d.ts`, {
51
+ const addDtsFiles = async (distDir, appDirectory) => {
52
+ const { fastGlob, slash } = await Promise.resolve().then(() => /* @__PURE__ */ _interop_require_wildcard._(require("@modern-js/utils")));
53
+ const files = await fastGlob(`${slash(distDir)}**/*.d.ts`, {
93
54
  stats: true
94
55
  });
95
- bundlelessFiles.push(
96
- ...files.map((file) => {
97
- return {
98
- name: (0, import_path.relative)(appDirectory, file.path),
99
- size: file.stats.size
100
- };
101
- })
102
- );
103
- });
56
+ bundlelessFiles.push(...files.map((file) => {
57
+ return {
58
+ name: (0, _path.relative)(appDirectory, file.path),
59
+ size: file.stats.size
60
+ };
61
+ }));
62
+ };
104
63
  const printFileSize = () => {
105
64
  printBundlelessInfo();
106
65
  printBundleFiles();
107
66
  };
108
67
  const printSucceed = (totalDuration) => {
109
- const time = import_utils.chalk.cyan(`${totalDuration / 1e3}s`);
110
- import_utils.logger.info(`${import_log.buildSuccessText} in ${time}`);
68
+ const time = _utils.chalk.cyan(`${totalDuration / 1e3}s`);
69
+ _utils.logger.info(`${_log.buildSuccessText} in ${time}`);
111
70
  };
112
71
  const prettyBytes = (bytes) => {
113
72
  if (bytes === 0) {
114
73
  return "0 B";
115
74
  }
116
- const unit = ["B", "KB", "MB", "GB", "TB", "PB", "EB", "ZB", "YB"];
75
+ const unit = [
76
+ "B",
77
+ "KB",
78
+ "MB",
79
+ "GB",
80
+ "TB",
81
+ "PB",
82
+ "EB",
83
+ "ZB",
84
+ "YB"
85
+ ];
117
86
  const exp = Math.floor(Math.log(bytes) / Math.log(1024));
118
87
  return `${(bytes / Math.pow(1024, exp)).toFixed(2)} ${unit[exp]}`;
119
88
  };
@@ -121,19 +90,14 @@ const printBundleFiles = () => {
121
90
  if (bundleFiles.length === 0) {
122
91
  return;
123
92
  }
124
- const longestFileLength = bundleFiles.reduce(
125
- (max, str) => Math.max(max, str.name.length),
126
- import_log.reportFile1LineText.length
127
- );
128
- import_utils.logger.info(`Bundle generated ${bundleFiles.length} files
93
+ const longestFileLength = bundleFiles.reduce((max, str) => Math.max(max, str.name.length), _log.reportFile1LineText.length);
94
+ _utils.logger.info(`Bundle generated ${bundleFiles.length} files
129
95
  `);
130
- const headerRow = import_log.reportFile1LineText + " ".repeat(longestFileLength - 10) + import_log.reportFile2LineText;
131
- import_utils.logger.log(import_utils.chalk.bold(import_utils.chalk.green(headerRow)));
96
+ const headerRow = _log.reportFile1LineText + " ".repeat(longestFileLength - 10) + _log.reportFile2LineText;
97
+ _utils.logger.log(_utils.chalk.bold(_utils.chalk.green(headerRow)));
132
98
  bundleFiles.forEach(({ name, size }) => {
133
- const infoRow = `${name}${" ".repeat(
134
- longestFileLength - name.length + 2
135
- )}${prettyBytes(size)}`;
136
- import_utils.logger.log(infoRow);
99
+ const infoRow = `${name}${" ".repeat(longestFileLength - name.length + 2)}${prettyBytes(size)}`;
100
+ _utils.logger.log(infoRow);
137
101
  });
138
102
  };
139
103
  const printBundlelessInfo = () => {
@@ -144,20 +108,8 @@ const printBundlelessInfo = () => {
144
108
  const totalSize = bundlelessFiles.reduce((total, file) => {
145
109
  return total + file.size;
146
110
  }, 0);
147
- const info = `Bundleless generated ${count} files, the total size is ${import_utils.chalk.cyan(
148
- prettyBytes(totalSize)
149
- )}`;
150
- import_utils.logger.info(info);
111
+ const info = `Bundleless generated ${count} files, the total size is ${_utils.chalk.cyan(prettyBytes(totalSize))}`;
112
+ _utils.logger.info(info);
151
113
  };
152
- // Annotate the CommonJS export names for ESM import in node:
153
- 0 && (module.exports = {
154
- addDtsFiles,
155
- addOutputChunk,
156
- addRollupChunk,
157
- bundleFiles,
158
- bundlelessFiles,
159
- printFileSize,
160
- printSucceed
161
- });
162
114
 
163
115
  //# sourceMappingURL=print.js.map