@unpackjs/core 1.7.5 → 1.7.6

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 (122) hide show
  1. package/compiled/css-loader/index.js +180 -178
  2. package/compiled/less-loader/index.js +11 -11
  3. package/compiled/line-diff/index.js +4 -4
  4. package/compiled/portfinder/index.js +37 -37
  5. package/compiled/postcss-loader/index.js +261 -256
  6. package/compiled/sass-loader/index.js +18 -18
  7. package/compiled/semver/index.js +188 -170
  8. package/compiled/semver/package.json +1 -1
  9. package/compiled/style-loader/index.js +13 -13
  10. package/compiled/webpack-bundle-analyzer/index.js +198 -198
  11. package/compiled/webpack-merge/index.js +29 -29
  12. package/dist/bundler-config/chunkSplit.cjs +169 -156
  13. package/dist/bundler-config/chunkSplit.d.ts +1 -1
  14. package/dist/bundler-config/chunkSplit.js +125 -134
  15. package/dist/bundler-config/css.cjs +181 -158
  16. package/dist/bundler-config/css.d.ts +1 -1
  17. package/dist/bundler-config/css.js +139 -151
  18. package/dist/bundler-config/experimentCss.cjs +203 -159
  19. package/dist/bundler-config/experimentCss.d.ts +1 -1
  20. package/dist/bundler-config/experimentCss.js +162 -152
  21. package/dist/bundler-config/helper.cjs +82 -78
  22. package/dist/bundler-config/helper.js +36 -55
  23. package/dist/bundler-config/index.cjs +260 -209
  24. package/dist/bundler-config/index.d.ts +1 -1
  25. package/dist/bundler-config/index.d.ts.map +1 -1
  26. package/dist/bundler-config/index.js +209 -182
  27. package/dist/bundler-config/jsMinify.cjs +114 -95
  28. package/dist/bundler-config/jsMinify.js +70 -73
  29. package/dist/colors.cjs +83 -56
  30. package/dist/colors.js +38 -37
  31. package/dist/config.cjs +107 -93
  32. package/dist/config.d.ts +1 -1
  33. package/dist/config.d.ts.map +1 -1
  34. package/dist/config.js +64 -70
  35. package/dist/constants.cjs +62 -62
  36. package/dist/constants.js +20 -38
  37. package/dist/createUnpack.cjs +111 -104
  38. package/dist/createUnpack.js +67 -82
  39. package/dist/global.cjs +36 -0
  40. package/dist/global.d.ts +2 -0
  41. package/dist/global.d.ts.map +1 -0
  42. package/dist/global.js +4 -0
  43. package/dist/index.cjs +174 -51
  44. package/dist/index.d.ts +2 -0
  45. package/dist/index.d.ts.map +1 -1
  46. package/dist/index.js +33 -15
  47. package/dist/lightningcss/cache.cjs +40 -32
  48. package/dist/lightningcss/cache.js +10 -20
  49. package/dist/lightningcss/loader.cjs +56 -53
  50. package/dist/lightningcss/loader.d.ts +1 -1
  51. package/dist/lightningcss/loader.js +25 -34
  52. package/dist/lightningcss/minimizer.cjs +90 -109
  53. package/dist/lightningcss/minimizer.d.ts +1 -1
  54. package/dist/lightningcss/minimizer.js +59 -87
  55. package/dist/logger.cjs +104 -98
  56. package/dist/logger.d.ts +1 -1
  57. package/dist/logger.js +59 -76
  58. package/dist/openBrowser.cjs +104 -81
  59. package/dist/openBrowser.js +56 -52
  60. package/dist/plugin-progress/rspack.cjs +104 -79
  61. package/dist/plugin-progress/rspack.d.ts +1 -1
  62. package/dist/plugin-progress/rspack.js +59 -57
  63. package/dist/plugin-progress/webpack.cjs +111 -89
  64. package/dist/plugin-progress/webpack.d.ts +1 -1
  65. package/dist/plugin-progress/webpack.js +65 -67
  66. package/dist/plugin.cjs +38 -29
  67. package/dist/plugin.js +8 -17
  68. package/dist/prebundleDeps.cjs +327 -337
  69. package/dist/prebundleDeps.d.ts.map +1 -1
  70. package/dist/prebundleDeps.js +278 -324
  71. package/dist/progressBar.cjs +82 -65
  72. package/dist/progressBar.js +38 -43
  73. package/dist/reporter.cjs +135 -120
  74. package/dist/reporter.js +88 -98
  75. package/dist/run/build.cjs +68 -67
  76. package/dist/run/build.d.ts +1 -1
  77. package/dist/run/build.js +24 -45
  78. package/dist/run/dev.cjs +96 -83
  79. package/dist/run/dev.d.ts +1 -1
  80. package/dist/run/dev.d.ts.map +1 -1
  81. package/dist/run/dev.js +50 -61
  82. package/dist/run/index.cjs +74 -21
  83. package/dist/run/index.js +2 -9
  84. package/dist/typed-css-modules/loader.cjs +179 -188
  85. package/dist/typed-css-modules/loader.d.ts +1 -1
  86. package/dist/typed-css-modules/loader.js +118 -151
  87. package/dist/typed-css-modules/plugin.cjs +113 -88
  88. package/dist/typed-css-modules/plugin.d.ts +1 -1
  89. package/dist/typed-css-modules/plugin.js +68 -66
  90. package/dist/typed-css-modules/utils.cjs +43 -42
  91. package/dist/typed-css-modules/utils.d.ts +1 -1
  92. package/dist/typed-css-modules/utils.js +13 -30
  93. package/dist/types/chunkSplit.cjs +19 -15
  94. package/dist/types/chunkSplit.d.ts +2 -10
  95. package/dist/types/chunkSplit.d.ts.map +1 -1
  96. package/dist/types/chunkSplit.js +2 -9
  97. package/dist/types/config.cjs +19 -15
  98. package/dist/types/config.d.ts +1 -1
  99. package/dist/types/config.js +2 -9
  100. package/dist/types/index.cjs +101 -27
  101. package/dist/types/index.js +2 -9
  102. package/dist/types/lightningcss.cjs +19 -15
  103. package/dist/types/lightningcss.js +2 -9
  104. package/dist/types/logger.cjs +43 -34
  105. package/dist/types/logger.js +13 -22
  106. package/dist/types/plugin.cjs +19 -15
  107. package/dist/types/plugin.js +2 -9
  108. package/dist/utils.cjs +280 -304
  109. package/dist/utils.js +195 -241
  110. package/dist/watchFiles.cjs +73 -0
  111. package/dist/watchFiles.d.ts +3 -0
  112. package/dist/watchFiles.d.ts.map +1 -0
  113. package/dist/watchFiles.js +27 -0
  114. package/package.json +14 -17
  115. package/compiled/commander/index.d.ts +0 -1047
  116. package/compiled/commander/index.js +0 -2428
  117. package/compiled/commander/license +0 -22
  118. package/compiled/commander/package.json +0 -1
  119. package/dist/bundleRequire.cjs +0 -200
  120. package/dist/bundleRequire.d.ts +0 -5
  121. package/dist/bundleRequire.d.ts.map +0 -1
  122. package/dist/bundleRequire.js +0 -173
@@ -1,70 +1,87 @@
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 progressBar_exports = {};
29
- __export(progressBar_exports, {
30
- ProgressBar: () => ProgressBar
1
+ "use strict";
2
+ var __webpack_require__ = {};
3
+ (()=>{
4
+ __webpack_require__.n = function(module) {
5
+ var getter = module && module.__esModule ? function() {
6
+ return module['default'];
7
+ } : function() {
8
+ return module;
9
+ };
10
+ __webpack_require__.d(getter, {
11
+ a: getter
12
+ });
13
+ return getter;
14
+ };
15
+ })();
16
+ (()=>{
17
+ __webpack_require__.d = function(exports1, definition) {
18
+ for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
19
+ enumerable: true,
20
+ get: definition[key]
21
+ });
22
+ };
23
+ })();
24
+ (()=>{
25
+ __webpack_require__.o = function(obj, prop) {
26
+ return Object.prototype.hasOwnProperty.call(obj, prop);
27
+ };
28
+ })();
29
+ (()=>{
30
+ __webpack_require__.r = function(exports1) {
31
+ if ('undefined' != typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
32
+ value: 'Module'
33
+ });
34
+ Object.defineProperty(exports1, '__esModule', {
35
+ value: true
36
+ });
37
+ };
38
+ })();
39
+ var __webpack_exports__ = {};
40
+ __webpack_require__.r(__webpack_exports__);
41
+ __webpack_require__.d(__webpack_exports__, {
42
+ ProgressBar: ()=>ProgressBar
31
43
  });
32
- module.exports = __toCommonJS(progressBar_exports);
33
- var import_colors = __toESM(require("./colors.cjs"));
34
- var import_utils = require("./utils.cjs");
44
+ const external_colors_cjs_namespaceObject = require("./colors.cjs");
45
+ var external_colors_cjs_default = /*#__PURE__*/ __webpack_require__.n(external_colors_cjs_namespaceObject);
46
+ const external_utils_cjs_namespaceObject = require("./utils.cjs");
47
+ function _define_property(obj, key, value) {
48
+ if (key in obj) Object.defineProperty(obj, key, {
49
+ value: value,
50
+ enumerable: true,
51
+ configurable: true,
52
+ writable: true
53
+ });
54
+ else obj[key] = value;
55
+ return obj;
56
+ }
35
57
  class ProgressBar {
36
- constructor() {
37
- this.options = {
38
- width: 25,
39
- prefix: "",
40
- char: "▨",
41
- color: "green"
42
- };
43
- }
44
- update({ current: originalCurrent, message = "" }) {
45
- const { columns: terminalWidth } = process.stdout;
46
- const messageWidth = terminalWidth - this.options.width - this.options.prefix.length - 8;
47
- let current = originalCurrent;
48
- if (originalCurrent >= 0.98) {
49
- current = 1;
58
+ update({ current: originalCurrent, message = '' }) {
59
+ const { columns: terminalWidth } = process.stdout;
60
+ const messageWidth = terminalWidth - this.options.width - this.options.prefix.length - 8;
61
+ let current = originalCurrent;
62
+ if (originalCurrent >= 0.98) current = 1;
63
+ const doneWidth = Math.floor(current * this.options.width);
64
+ const undoneWidth = this.options.width - doneWidth;
65
+ const done = external_colors_cjs_default()[this.options.color](this.options.char).repeat(doneWidth);
66
+ const undone = external_colors_cjs_default().dim(this.options.char).repeat(undoneWidth);
67
+ const bar = `${done}${undone}`;
68
+ const prefix = this.options.prefix ? `${external_colors_cjs_default().bold(this.options.prefix)} ` : '';
69
+ (0, external_utils_cjs_namespaceObject.logUpdate)(`${prefix}${bar} (${Math.floor(100 * current)}%) ${external_colors_cjs_default().dim(message.slice(0, messageWidth).padEnd(messageWidth, ' '))}`);
70
+ }
71
+ done() {
72
+ console.log();
73
+ }
74
+ constructor(){
75
+ _define_property(this, "options", {
76
+ width: 25,
77
+ prefix: '',
78
+ char: '▨',
79
+ color: 'green'
80
+ });
50
81
  }
51
- const doneWidth = Math.floor(current * this.options.width);
52
- const undoneWidth = this.options.width - doneWidth;
53
- const done = import_colors.default[this.options.color](this.options.char).repeat(doneWidth);
54
- const undone = import_colors.default.dim(this.options.char).repeat(undoneWidth);
55
- const bar = `${done}${undone}`;
56
- const prefix = this.options.prefix ? `${import_colors.default.bold(this.options.prefix)} ` : "";
57
- (0, import_utils.logUpdate)(
58
- `${prefix}${bar} (${Math.floor(
59
- current * 100
60
- )}%) ${import_colors.default.dim(message.slice(0, messageWidth).padEnd(messageWidth, " "))}`
61
- );
62
- }
63
- done() {
64
- console.log();
65
- }
66
82
  }
67
- // Annotate the CommonJS export names for ESM import in node:
68
- 0 && (module.exports = {
69
- ProgressBar
83
+ var __webpack_export_target__ = exports;
84
+ for(var __webpack_i__ in __webpack_exports__)__webpack_export_target__[__webpack_i__] = __webpack_exports__[__webpack_i__];
85
+ if (__webpack_exports__.__esModule) Object.defineProperty(__webpack_export_target__, '__esModule', {
86
+ value: true
70
87
  });
@@ -1,46 +1,41 @@
1
- import { createRequire } from 'node:module';
2
- var require = createRequire(import.meta['url']);
3
-
4
- import path from "path";
5
- import { fileURLToPath } from "url";
6
- var getFilename = () => fileURLToPath(import.meta.url);
7
- var getDirname = () => path.dirname(getFilename());
8
- var __dirname = /* @__PURE__ */ getDirname();
9
- var __filename = /* @__PURE__ */ getFilename();
10
- import colors from "./colors.js";
11
- import { logUpdate } from "./utils.js";
1
+ import __rslib_shim_module__ from 'module';
2
+ /*#__PURE__*/ import.meta.url;
3
+ import * as __WEBPACK_EXTERNAL_MODULE__colors_js_b738ede3__ from "./colors.js";
4
+ import * as __WEBPACK_EXTERNAL_MODULE__utils_js_d88b7fe1__ from "./utils.js";
5
+ function _define_property(obj, key, value) {
6
+ if (key in obj) Object.defineProperty(obj, key, {
7
+ value: value,
8
+ enumerable: true,
9
+ configurable: true,
10
+ writable: true
11
+ });
12
+ else obj[key] = value;
13
+ return obj;
14
+ }
12
15
  class ProgressBar {
13
- constructor() {
14
- this.options = {
15
- width: 25,
16
- prefix: "",
17
- char: "▨",
18
- color: "green"
19
- };
20
- }
21
- update({ current: originalCurrent, message = "" }) {
22
- const { columns: terminalWidth } = process.stdout;
23
- const messageWidth = terminalWidth - this.options.width - this.options.prefix.length - 8;
24
- let current = originalCurrent;
25
- if (originalCurrent >= 0.98) {
26
- current = 1;
16
+ update({ current: originalCurrent, message = '' }) {
17
+ const { columns: terminalWidth } = process.stdout;
18
+ const messageWidth = terminalWidth - this.options.width - this.options.prefix.length - 8;
19
+ let current = originalCurrent;
20
+ if (originalCurrent >= 0.98) current = 1;
21
+ const doneWidth = Math.floor(current * this.options.width);
22
+ const undoneWidth = this.options.width - doneWidth;
23
+ const done = __WEBPACK_EXTERNAL_MODULE__colors_js_b738ede3__["default"][this.options.color](this.options.char).repeat(doneWidth);
24
+ const undone = __WEBPACK_EXTERNAL_MODULE__colors_js_b738ede3__["default"].dim(this.options.char).repeat(undoneWidth);
25
+ const bar = `${done}${undone}`;
26
+ const prefix = this.options.prefix ? `${__WEBPACK_EXTERNAL_MODULE__colors_js_b738ede3__["default"].bold(this.options.prefix)} ` : '';
27
+ (0, __WEBPACK_EXTERNAL_MODULE__utils_js_d88b7fe1__.logUpdate)(`${prefix}${bar} (${Math.floor(100 * current)}%) ${__WEBPACK_EXTERNAL_MODULE__colors_js_b738ede3__["default"].dim(message.slice(0, messageWidth).padEnd(messageWidth, ' '))}`);
28
+ }
29
+ done() {
30
+ console.log();
31
+ }
32
+ constructor(){
33
+ _define_property(this, "options", {
34
+ width: 25,
35
+ prefix: '',
36
+ char: '▨',
37
+ color: 'green'
38
+ });
27
39
  }
28
- const doneWidth = Math.floor(current * this.options.width);
29
- const undoneWidth = this.options.width - doneWidth;
30
- const done = colors[this.options.color](this.options.char).repeat(doneWidth);
31
- const undone = colors.dim(this.options.char).repeat(undoneWidth);
32
- const bar = `${done}${undone}`;
33
- const prefix = this.options.prefix ? `${colors.bold(this.options.prefix)} ` : "";
34
- logUpdate(
35
- `${prefix}${bar} (${Math.floor(
36
- current * 100
37
- )}%) ${colors.dim(message.slice(0, messageWidth).padEnd(messageWidth, " "))}`
38
- );
39
- }
40
- done() {
41
- console.log();
42
- }
43
40
  }
44
- export {
45
- ProgressBar
46
- };
41
+ export { ProgressBar };
package/dist/reporter.cjs CHANGED
@@ -1,133 +1,148 @@
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 reporter_exports = {};
29
- __export(reporter_exports, {
30
- printFileSize: () => printFileSize
1
+ "use strict";
2
+ var __webpack_require__ = {};
3
+ (()=>{
4
+ __webpack_require__.n = function(module) {
5
+ var getter = module && module.__esModule ? function() {
6
+ return module['default'];
7
+ } : function() {
8
+ return module;
9
+ };
10
+ __webpack_require__.d(getter, {
11
+ a: getter
12
+ });
13
+ return getter;
14
+ };
15
+ })();
16
+ (()=>{
17
+ __webpack_require__.d = function(exports1, definition) {
18
+ for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
19
+ enumerable: true,
20
+ get: definition[key]
21
+ });
22
+ };
23
+ })();
24
+ (()=>{
25
+ __webpack_require__.o = function(obj, prop) {
26
+ return Object.prototype.hasOwnProperty.call(obj, prop);
27
+ };
28
+ })();
29
+ (()=>{
30
+ __webpack_require__.r = function(exports1) {
31
+ if ('undefined' != typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
32
+ value: 'Module'
33
+ });
34
+ Object.defineProperty(exports1, '__esModule', {
35
+ value: true
36
+ });
37
+ };
38
+ })();
39
+ var __webpack_exports__ = {};
40
+ __webpack_require__.r(__webpack_exports__);
41
+ __webpack_require__.d(__webpack_exports__, {
42
+ printFileSize: ()=>printFileSize
31
43
  });
32
- module.exports = __toCommonJS(reporter_exports);
33
- var import_node_fs = __toESM(require("node:fs"));
34
- var import_node_path = __toESM(require("node:path"));
35
- var import_node_util = require("node:util");
36
- var import_node_zlib = __toESM(require("node:zlib"));
37
- var import_colors = __toESM(require("./colors.cjs"));
44
+ const external_node_fs_namespaceObject = require("node:fs");
45
+ var external_node_fs_default = /*#__PURE__*/ __webpack_require__.n(external_node_fs_namespaceObject);
46
+ const external_node_path_namespaceObject = require("node:path");
47
+ var external_node_path_default = /*#__PURE__*/ __webpack_require__.n(external_node_path_namespaceObject);
48
+ const external_node_util_namespaceObject = require("node:util");
49
+ const external_node_zlib_namespaceObject = require("node:zlib");
50
+ var external_node_zlib_default = /*#__PURE__*/ __webpack_require__.n(external_node_zlib_namespaceObject);
51
+ const external_colors_cjs_namespaceObject = require("./colors.cjs");
52
+ var external_colors_cjs_default = /*#__PURE__*/ __webpack_require__.n(external_colors_cjs_namespaceObject);
38
53
  const chunkGroups = [
39
- { type: "HTML", color: "green", chunks: [] },
40
- { type: "CSS", color: "magenta", chunks: [] },
41
- { type: "JS", color: "cyan", chunks: [] }
54
+ {
55
+ type: 'HTML',
56
+ color: 'green',
57
+ chunks: []
58
+ },
59
+ {
60
+ type: 'CSS',
61
+ color: 'magenta',
62
+ chunks: []
63
+ },
64
+ {
65
+ type: 'JS',
66
+ color: 'cyan',
67
+ chunks: []
68
+ }
42
69
  ];
43
- const chunkGroupMap = chunkGroups.reduce(
44
- (acc, cur) => {
70
+ const chunkGroupMap = chunkGroups.reduce((acc, cur)=>{
45
71
  acc[cur.type] = cur;
46
72
  return acc;
47
- },
48
- {}
49
- );
73
+ }, {});
50
74
  const chunkSizeLimit = 500;
51
- const gzip = (0, import_node_util.promisify)(import_node_zlib.default.gzip);
52
- const numberFormatter = new Intl.NumberFormat("en", {
53
- maximumFractionDigits: 2,
54
- minimumFractionDigits: 2
75
+ const gzip = (0, external_node_util_namespaceObject.promisify)(external_node_zlib_default().gzip);
76
+ const numberFormatter = new Intl.NumberFormat('en', {
77
+ maximumFractionDigits: 2,
78
+ minimumFractionDigits: 2
55
79
  });
56
- const displaySize = (bytes) => {
57
- return `${numberFormatter.format(bytes / 1e3)} kB`;
58
- };
80
+ const displaySize = (bytes)=>`${numberFormatter.format(bytes / 1000)} kB`;
59
81
  async function getCompressedSize(content) {
60
- const data = await gzip(content);
61
- return data.length;
82
+ const data = await gzip(content);
83
+ return data.length;
62
84
  }
63
85
  async function printFileSize({ root, stats }) {
64
- const distPath = stats.compilation.outputOptions.path;
65
- const distFolder = import_node_path.default.relative(root, distPath);
66
- const origin = stats.toJson({
67
- all: false,
68
- assets: true,
69
- cachedAssets: true,
70
- groupAssetsByInfo: false,
71
- groupAssetsByPath: false,
72
- groupAssetsByChunk: false,
73
- groupAssetsByExtension: false,
74
- groupAssetsByEmitStatus: false
75
- });
76
- let longest = 0;
77
- let biggestSize = 0;
78
- let biggestCompressSize = 0;
79
- await Promise.all(
80
- origin.assets.map(async (asset) => {
81
- const content = await import_node_fs.default.promises.readFile(import_node_path.default.join(distPath, asset.name));
82
- const size = content.length;
83
- const compressedSize = await getCompressedSize(content);
84
- const chunk = {
85
- name: import_node_path.default.basename(asset.name),
86
- path: `${distFolder}/${asset.name}`,
87
- size,
88
- compressedSize
89
- };
90
- if (chunk.path.length > longest) {
91
- longest = chunk.path.length;
92
- }
93
- if (size > biggestSize)
94
- biggestSize = size;
95
- if (compressedSize > biggestCompressSize)
96
- biggestCompressSize = compressedSize;
97
- const ext = import_node_path.default.extname(asset.name);
98
- switch (ext) {
99
- case ".html":
100
- chunkGroupMap.HTML.chunks.push(chunk);
101
- break;
102
- case ".css":
103
- chunkGroupMap.CSS.chunks.push(chunk);
104
- break;
105
- case ".js":
106
- chunkGroupMap.JS.chunks.push(chunk);
107
- break;
108
- default:
109
- break;
110
- }
111
- })
112
- );
113
- const sizePad = displaySize(biggestSize).length;
114
- const compressPad = displaySize(biggestCompressSize).length;
115
- chunkGroups.forEach((group) => {
116
- group.chunks.sort((a, b) => a.size - b.size).forEach((chunk) => {
117
- const isLarge = group.type === "JS" && chunk.size / 1e3 > chunkSizeLimit;
118
- const sizeColor = isLarge ? "yellow" : "dim";
119
- const relativeOutDir = import_node_path.default.dirname(chunk.path) + "/";
120
- let log = import_colors.default.dim(relativeOutDir);
121
- log += import_colors.default[group.color](chunk.name.padEnd(longest + 2 - relativeOutDir.length));
122
- log += import_colors.default[sizeColor](import_colors.default.bold(displaySize(chunk.size).padStart(sizePad)));
123
- if (chunk.compressedSize) {
124
- log += import_colors.default.dim(` │ gzip: ${displaySize(chunk.compressedSize).padStart(compressPad)}`);
125
- }
126
- console.log(log);
86
+ const distPath = stats.compilation.outputOptions.path;
87
+ const distFolder = external_node_path_default().relative(root, distPath);
88
+ const origin = stats.toJson({
89
+ all: false,
90
+ assets: true,
91
+ cachedAssets: true,
92
+ groupAssetsByInfo: false,
93
+ groupAssetsByPath: false,
94
+ groupAssetsByChunk: false,
95
+ groupAssetsByExtension: false,
96
+ groupAssetsByEmitStatus: false
97
+ });
98
+ let longest = 0;
99
+ let biggestSize = 0;
100
+ let biggestCompressSize = 0;
101
+ await Promise.all(origin.assets.map(async (asset)=>{
102
+ const content = await external_node_fs_default().promises.readFile(external_node_path_default().join(distPath, asset.name));
103
+ const size = content.length;
104
+ const compressedSize = await getCompressedSize(content);
105
+ const chunk = {
106
+ name: external_node_path_default().basename(asset.name),
107
+ path: `${distFolder}/${asset.name}`,
108
+ size,
109
+ compressedSize
110
+ };
111
+ if (chunk.path.length > longest) longest = chunk.path.length;
112
+ if (size > biggestSize) biggestSize = size;
113
+ if (compressedSize > biggestCompressSize) biggestCompressSize = compressedSize;
114
+ const ext = external_node_path_default().extname(asset.name);
115
+ switch(ext){
116
+ case '.html':
117
+ chunkGroupMap.HTML.chunks.push(chunk);
118
+ break;
119
+ case '.css':
120
+ chunkGroupMap.CSS.chunks.push(chunk);
121
+ break;
122
+ case '.js':
123
+ chunkGroupMap.JS.chunks.push(chunk);
124
+ break;
125
+ default:
126
+ break;
127
+ }
128
+ }));
129
+ const sizePad = displaySize(biggestSize).length;
130
+ const compressPad = displaySize(biggestCompressSize).length;
131
+ chunkGroups.forEach((group)=>{
132
+ group.chunks.sort((a, b)=>a.size - b.size).forEach((chunk)=>{
133
+ const isLarge = 'JS' === group.type && chunk.size / 1000 > chunkSizeLimit;
134
+ const sizeColor = isLarge ? 'yellow' : 'dim';
135
+ const relativeOutDir = external_node_path_default().dirname(chunk.path) + '/';
136
+ let log = external_colors_cjs_default().dim(relativeOutDir);
137
+ log += external_colors_cjs_default()[group.color](chunk.name.padEnd(longest + 2 - relativeOutDir.length));
138
+ log += external_colors_cjs_default()[sizeColor](external_colors_cjs_default().bold(displaySize(chunk.size).padStart(sizePad)));
139
+ if (chunk.compressedSize) log += external_colors_cjs_default().dim(` gzip: ${displaySize(chunk.compressedSize).padStart(compressPad)}`);
140
+ console.log(log);
141
+ });
127
142
  });
128
- });
129
143
  }
130
- // Annotate the CommonJS export names for ESM import in node:
131
- 0 && (module.exports = {
132
- printFileSize
144
+ var __webpack_export_target__ = exports;
145
+ for(var __webpack_i__ in __webpack_exports__)__webpack_export_target__[__webpack_i__] = __webpack_exports__[__webpack_i__];
146
+ if (__webpack_exports__.__esModule) Object.defineProperty(__webpack_export_target__, '__esModule', {
147
+ value: true
133
148
  });