@unpackjs/core 1.5.4 → 1.6.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 (238) hide show
  1. package/bin/openChrome.applescript +94 -0
  2. package/compiled/chokidar/index.d.ts +327 -0
  3. package/compiled/chokidar/index.js +1773 -0
  4. package/compiled/chokidar/license +21 -0
  5. package/compiled/chokidar/package.json +1 -0
  6. package/compiled/commander/index.d.ts +971 -0
  7. package/compiled/commander/index.js +2190 -0
  8. package/compiled/commander/license +22 -0
  9. package/compiled/commander/package.json +1 -0
  10. package/compiled/css-loader/api.js +85 -0
  11. package/compiled/css-loader/getUrl.js +26 -0
  12. package/compiled/css-loader/index.d.ts +1 -0
  13. package/compiled/css-loader/index.js +8004 -0
  14. package/compiled/css-loader/license +20 -0
  15. package/compiled/css-loader/noSourceMaps.js +5 -0
  16. package/compiled/css-loader/package.json +1 -0
  17. package/compiled/css-loader/sourceMaps.js +16 -0
  18. package/compiled/fast-glob/index.d.ts +237 -0
  19. package/compiled/fast-glob/index.js +5726 -0
  20. package/compiled/fast-glob/license +21 -0
  21. package/compiled/fast-glob/package.json +1 -0
  22. package/compiled/less-loader/index.d.ts +1 -0
  23. package/compiled/less-loader/index.js +340 -0
  24. package/compiled/less-loader/license +20 -0
  25. package/compiled/less-loader/package.json +1 -0
  26. package/compiled/line-diff/index.d.ts +1 -0
  27. package/compiled/line-diff/index.js +160 -0
  28. package/compiled/line-diff/license +21 -0
  29. package/compiled/line-diff/package.json +1 -0
  30. package/compiled/log-update/index.d.ts +1 -0
  31. package/compiled/log-update/index.js +1970 -0
  32. package/compiled/log-update/package.json +1 -0
  33. package/compiled/portfinder/index.d.ts +64 -0
  34. package/compiled/portfinder/index.js +3401 -0
  35. package/compiled/portfinder/license +22 -0
  36. package/compiled/portfinder/package.json +1 -0
  37. package/compiled/postcss-loader/index.d.ts +1 -0
  38. package/compiled/postcss-loader/index.js +94945 -0
  39. package/compiled/postcss-loader/license +20 -0
  40. package/compiled/postcss-loader/package.json +1 -0
  41. package/compiled/sass-loader/index.d.ts +961 -0
  42. package/compiled/sass-loader/index.js +5610 -0
  43. package/compiled/sass-loader/index1.js +65 -0
  44. package/compiled/sass-loader/license +20 -0
  45. package/compiled/sass-loader/package.json +1 -0
  46. package/compiled/sass-loader/sass.node.js +12 -0
  47. package/compiled/semver/index.d.ts +1 -0
  48. package/compiled/semver/index.js +1940 -0
  49. package/compiled/semver/license +15 -0
  50. package/compiled/semver/package.json +1 -0
  51. package/compiled/style-loader/index.d.ts +1 -0
  52. package/compiled/style-loader/index.js +370 -0
  53. package/compiled/style-loader/license +20 -0
  54. package/compiled/style-loader/package.json +1 -0
  55. package/compiled/style-loader/runtime/injectStylesIntoLinkTag.js +29 -0
  56. package/compiled/style-loader/runtime/injectStylesIntoStyleTag.js +84 -0
  57. package/compiled/style-loader/runtime/insertBySelector.js +34 -0
  58. package/compiled/style-loader/runtime/insertStyleElement.js +10 -0
  59. package/compiled/style-loader/runtime/isEqualLocals.js +28 -0
  60. package/compiled/style-loader/runtime/isOldIE.js +17 -0
  61. package/compiled/style-loader/runtime/setAttributesWithAttributes.js +13 -0
  62. package/compiled/style-loader/runtime/setAttributesWithAttributesAndNonce.js +9 -0
  63. package/compiled/style-loader/runtime/setAttributesWithoutAttributes.js +10 -0
  64. package/compiled/style-loader/runtime/singletonStyleDomAPI.js +86 -0
  65. package/compiled/style-loader/runtime/styleDomAPI.js +61 -0
  66. package/compiled/style-loader/runtime/styleTagTransform.js +14 -0
  67. package/compiled/webpack-bundle-analyzer/index.d.ts +1 -0
  68. package/compiled/webpack-bundle-analyzer/index.js +13276 -0
  69. package/compiled/webpack-bundle-analyzer/license +20 -0
  70. package/compiled/webpack-bundle-analyzer/package.json +1 -0
  71. package/compiled/webpack-bundle-analyzer/public/viewer.js +16 -0
  72. package/compiled/webpack-bundle-analyzer/public/viewer.js.LICENSE.txt +10 -0
  73. package/compiled/webpack-merge/index.d.ts +31 -0
  74. package/compiled/webpack-merge/index.js +1200 -0
  75. package/compiled/webpack-merge/license +20 -0
  76. package/compiled/webpack-merge/package.json +1 -0
  77. package/dist/bundleRequire.cjs +200 -0
  78. package/dist/bundleRequire.d.ts +5 -0
  79. package/dist/bundleRequire.d.ts.map +1 -0
  80. package/dist/bundleRequire.js +173 -0
  81. package/dist/bundler-config/chunkSplit.cjs +151 -0
  82. package/dist/bundler-config/chunkSplit.d.ts +6 -0
  83. package/dist/bundler-config/chunkSplit.d.ts.map +1 -0
  84. package/dist/bundler-config/chunkSplit.js +127 -0
  85. package/dist/bundler-config/css.cjs +168 -0
  86. package/dist/bundler-config/css.d.ts +6 -0
  87. package/dist/bundler-config/css.d.ts.map +1 -0
  88. package/dist/bundler-config/css.js +158 -0
  89. package/dist/bundler-config/experimentCss.cjs +167 -0
  90. package/dist/bundler-config/experimentCss.d.ts +6 -0
  91. package/dist/bundler-config/experimentCss.d.ts.map +1 -0
  92. package/dist/bundler-config/experimentCss.js +157 -0
  93. package/dist/bundler-config/helper.cjs +81 -0
  94. package/dist/bundler-config/helper.d.ts +8 -0
  95. package/dist/bundler-config/helper.d.ts.map +1 -0
  96. package/dist/bundler-config/helper.js +56 -0
  97. package/dist/bundler-config/index.cjs +206 -0
  98. package/dist/bundler-config/index.d.ts +3 -0
  99. package/dist/bundler-config/index.d.ts.map +1 -0
  100. package/dist/bundler-config/index.js +190 -0
  101. package/dist/colors.cjs +60 -0
  102. package/dist/colors.d.ts +6 -0
  103. package/dist/colors.d.ts.map +1 -0
  104. package/dist/colors.js +40 -0
  105. package/dist/{config/index.cjs → config.cjs} +26 -20
  106. package/dist/{config/index.d.ts → config.d.ts} +4 -3
  107. package/dist/config.d.ts.map +1 -0
  108. package/dist/{config/index.js → config.js} +19 -21
  109. package/dist/constants.cjs +86 -0
  110. package/dist/constants.d.ts +25 -0
  111. package/dist/constants.d.ts.map +1 -0
  112. package/dist/constants.js +61 -0
  113. package/dist/createService.cjs +65 -0
  114. package/dist/createService.d.ts +8 -0
  115. package/dist/createService.d.ts.map +1 -0
  116. package/dist/createService.js +41 -0
  117. package/dist/index.cjs +27 -48
  118. package/dist/index.d.ts +7 -7
  119. package/dist/index.d.ts.map +1 -1
  120. package/dist/index.js +8 -51
  121. package/dist/lightningcss/cache.cjs +36 -0
  122. package/dist/lightningcss/cache.d.ts +2 -0
  123. package/dist/lightningcss/cache.d.ts.map +1 -0
  124. package/dist/lightningcss/cache.js +22 -0
  125. package/dist/lightningcss/index.cjs +21 -0
  126. package/dist/lightningcss/index.d.ts +2 -0
  127. package/dist/lightningcss/index.d.ts.map +1 -0
  128. package/dist/lightningcss/index.js +10 -0
  129. package/dist/lightningcss/loader.cjs +56 -0
  130. package/dist/lightningcss/loader.d.ts +5 -0
  131. package/dist/lightningcss/loader.d.ts.map +1 -0
  132. package/dist/lightningcss/loader.js +36 -0
  133. package/dist/lightningcss/minimizer.cjs +114 -0
  134. package/dist/lightningcss/minimizer.d.ts +11 -0
  135. package/dist/lightningcss/minimizer.d.ts.map +1 -0
  136. package/dist/lightningcss/minimizer.js +90 -0
  137. package/dist/logger.cjs +103 -0
  138. package/dist/logger.d.ts +3 -0
  139. package/dist/logger.d.ts.map +1 -0
  140. package/dist/logger.js +79 -0
  141. package/dist/openBrowser.cjs +85 -0
  142. package/dist/openBrowser.d.ts +2 -0
  143. package/dist/openBrowser.d.ts.map +1 -0
  144. package/dist/openBrowser.js +61 -0
  145. package/dist/plugin-progress/rspack.cjs +74 -0
  146. package/dist/plugin-progress/rspack.d.ts +9 -0
  147. package/dist/plugin-progress/rspack.d.ts.map +1 -0
  148. package/dist/plugin-progress/rspack.js +50 -0
  149. package/dist/plugin-progress/webpack.cjs +84 -0
  150. package/dist/plugin-progress/webpack.d.ts +9 -0
  151. package/dist/plugin-progress/webpack.d.ts.map +1 -0
  152. package/dist/plugin-progress/webpack.js +60 -0
  153. package/dist/plugin.cjs +33 -0
  154. package/dist/plugin.d.ts +3 -0
  155. package/dist/plugin.d.ts.map +1 -0
  156. package/dist/plugin.js +19 -0
  157. package/dist/progressBar.cjs +70 -0
  158. package/dist/progressBar.d.ts +14 -0
  159. package/dist/progressBar.d.ts.map +1 -0
  160. package/dist/progressBar.js +46 -0
  161. package/dist/reporter.cjs +133 -0
  162. package/dist/reporter.d.ts +8 -0
  163. package/dist/reporter.d.ts.map +1 -0
  164. package/dist/reporter.js +109 -0
  165. package/dist/run/build.cjs +77 -0
  166. package/dist/run/build.d.ts +3 -0
  167. package/dist/run/build.d.ts.map +1 -0
  168. package/dist/run/build.js +53 -0
  169. package/dist/run/dev.cjs +107 -0
  170. package/dist/run/dev.d.ts +3 -0
  171. package/dist/run/dev.d.ts.map +1 -0
  172. package/dist/run/dev.js +83 -0
  173. package/dist/run/index.cjs +23 -0
  174. package/dist/run/index.d.ts +3 -0
  175. package/dist/run/index.d.ts.map +1 -0
  176. package/dist/run/index.js +11 -0
  177. package/dist/thread-loader/WorkerError.cjs +41 -0
  178. package/dist/thread-loader/WorkerError.js +31 -0
  179. package/dist/thread-loader/WorkerPool.cjs +407 -0
  180. package/dist/thread-loader/WorkerPool.js +387 -0
  181. package/dist/thread-loader/index.cjs +100 -0
  182. package/dist/thread-loader/index.js +85 -0
  183. package/dist/thread-loader/readBuffer.cjs +55 -0
  184. package/dist/thread-loader/readBuffer.js +45 -0
  185. package/dist/thread-loader/serializer.cjs +46 -0
  186. package/dist/thread-loader/serializer.js +31 -0
  187. package/dist/thread-loader/utils.cjs +84 -0
  188. package/dist/thread-loader/utils.js +60 -0
  189. package/dist/thread-loader/worker.cjs +377 -0
  190. package/dist/thread-loader/worker.js +382 -0
  191. package/dist/thread-loader/workerPools.cjs +57 -0
  192. package/dist/thread-loader/workerPools.js +33 -0
  193. package/dist/typed-css-modules/index.cjs +21 -0
  194. package/dist/typed-css-modules/index.d.ts +2 -0
  195. package/dist/typed-css-modules/index.d.ts.map +1 -0
  196. package/dist/typed-css-modules/index.js +10 -0
  197. package/dist/typed-css-modules/loader.cjs +195 -0
  198. package/dist/typed-css-modules/loader.d.ts +10 -0
  199. package/dist/typed-css-modules/loader.d.ts.map +1 -0
  200. package/dist/typed-css-modules/loader.js +170 -0
  201. package/dist/typed-css-modules/plugin.cjs +96 -0
  202. package/dist/typed-css-modules/plugin.d.ts +16 -0
  203. package/dist/typed-css-modules/plugin.d.ts.map +1 -0
  204. package/dist/typed-css-modules/plugin.js +72 -0
  205. package/dist/typed-css-modules/utils.cjs +45 -0
  206. package/dist/typed-css-modules/utils.d.ts +6 -0
  207. package/dist/typed-css-modules/utils.d.ts.map +1 -0
  208. package/dist/typed-css-modules/utils.js +31 -0
  209. package/dist/types/chunkSplit.cjs +15 -0
  210. package/dist/types/chunkSplit.d.ts +35 -0
  211. package/dist/types/chunkSplit.d.ts.map +1 -0
  212. package/dist/types/chunkSplit.js +9 -0
  213. package/dist/types/config.cjs +15 -0
  214. package/dist/types/config.d.ts +176 -0
  215. package/dist/types/config.d.ts.map +1 -0
  216. package/dist/types/config.js +9 -0
  217. package/dist/types/index.cjs +29 -0
  218. package/dist/types/index.d.ts +16 -0
  219. package/dist/types/index.d.ts.map +1 -0
  220. package/dist/types/index.js +14 -0
  221. package/dist/types/lightningcss.cjs +15 -0
  222. package/dist/types/lightningcss.d.ts +11 -0
  223. package/dist/types/lightningcss.d.ts.map +1 -0
  224. package/dist/types/lightningcss.js +9 -0
  225. package/dist/types/logger.cjs +35 -0
  226. package/dist/types/logger.d.ts +16 -0
  227. package/dist/types/logger.d.ts.map +1 -0
  228. package/dist/types/logger.js +21 -0
  229. package/dist/types/plugin.cjs +15 -0
  230. package/dist/types/plugin.d.ts +18 -0
  231. package/dist/types/plugin.d.ts.map +1 -0
  232. package/dist/types/plugin.js +9 -0
  233. package/dist/utils.cjs +293 -0
  234. package/dist/utils.d.ts +39 -0
  235. package/dist/utils.d.ts.map +1 -0
  236. package/dist/utils.js +242 -0
  237. package/package.json +95 -6
  238. package/dist/config/index.d.ts.map +0 -1
@@ -0,0 +1,85 @@
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 openBrowser_exports = {};
29
+ __export(openBrowser_exports, {
30
+ openBrowser: () => openBrowser
31
+ });
32
+ module.exports = __toCommonJS(openBrowser_exports);
33
+ var import_node_child_process = require("node:child_process");
34
+ var import_node_path = __toESM(require("node:path"));
35
+ var import_logger = require("./logger.cjs");
36
+ const open = require("open");
37
+ async function openBrowser(url) {
38
+ const supportedChromiumBrowsers = [
39
+ "Google Chrome Canary",
40
+ "Google Chrome Dev",
41
+ "Google Chrome Beta",
42
+ "Google Chrome",
43
+ "Microsoft Edge",
44
+ "Brave Browser",
45
+ "Vivaldi",
46
+ "Chromium"
47
+ ];
48
+ if (process.platform === "darwin") {
49
+ try {
50
+ const ps = await execAsync("ps cax");
51
+ const openedBrowser = supportedChromiumBrowsers.find((b) => ps.includes(b));
52
+ if (openedBrowser) {
53
+ await execAsync(`osascript openChrome.applescript "${encodeURI(url)}" "${openedBrowser}"`, {
54
+ cwd: import_node_path.default.join(__dirname, "../bin")
55
+ });
56
+ return true;
57
+ }
58
+ } catch (err) {
59
+ import_logger.logger.error(err);
60
+ }
61
+ }
62
+ try {
63
+ open(url).catch(() => {
64
+ });
65
+ return true;
66
+ } catch (err) {
67
+ import_logger.logger.error(err);
68
+ return false;
69
+ }
70
+ }
71
+ function execAsync(command, options) {
72
+ return new Promise((resolve, reject) => {
73
+ (0, import_node_child_process.exec)(command, options, (error, stdout) => {
74
+ if (error) {
75
+ reject(error);
76
+ } else {
77
+ resolve(stdout.toString());
78
+ }
79
+ });
80
+ });
81
+ }
82
+ // Annotate the CommonJS export names for ESM import in node:
83
+ 0 && (module.exports = {
84
+ openBrowser
85
+ });
@@ -0,0 +1,2 @@
1
+ export declare function openBrowser(url: string): Promise<boolean>;
2
+ //# sourceMappingURL=openBrowser.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"openBrowser.d.ts","sourceRoot":"","sources":["../src/openBrowser.ts"],"names":[],"mappings":"AAKA,wBAAsB,WAAW,CAAC,GAAG,EAAE,MAAM,oBAkC5C"}
@@ -0,0 +1,61 @@
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 { exec } from "node:child_process";
11
+ import path2 from "node:path";
12
+ import { logger } from "./logger.js";
13
+ const open = require("open");
14
+ async function openBrowser(url) {
15
+ const supportedChromiumBrowsers = [
16
+ "Google Chrome Canary",
17
+ "Google Chrome Dev",
18
+ "Google Chrome Beta",
19
+ "Google Chrome",
20
+ "Microsoft Edge",
21
+ "Brave Browser",
22
+ "Vivaldi",
23
+ "Chromium"
24
+ ];
25
+ if (process.platform === "darwin") {
26
+ try {
27
+ const ps = await execAsync("ps cax");
28
+ const openedBrowser = supportedChromiumBrowsers.find((b) => ps.includes(b));
29
+ if (openedBrowser) {
30
+ await execAsync(`osascript openChrome.applescript "${encodeURI(url)}" "${openedBrowser}"`, {
31
+ cwd: path2.join(__dirname, "../bin")
32
+ });
33
+ return true;
34
+ }
35
+ } catch (err) {
36
+ logger.error(err);
37
+ }
38
+ }
39
+ try {
40
+ open(url).catch(() => {
41
+ });
42
+ return true;
43
+ } catch (err) {
44
+ logger.error(err);
45
+ return false;
46
+ }
47
+ }
48
+ function execAsync(command, options) {
49
+ return new Promise((resolve, reject) => {
50
+ exec(command, options, (error, stdout) => {
51
+ if (error) {
52
+ reject(error);
53
+ } else {
54
+ resolve(stdout.toString());
55
+ }
56
+ });
57
+ });
58
+ }
59
+ export {
60
+ openBrowser
61
+ };
@@ -0,0 +1,74 @@
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 rspack_exports = {};
29
+ __export(rspack_exports, {
30
+ RspackPluginProgress: () => RspackPluginProgress
31
+ });
32
+ module.exports = __toCommonJS(rspack_exports);
33
+ var import_core = require("@rspack/core");
34
+ var import_colors = __toESM(require("../colors.cjs"));
35
+ var import_logger = require("../logger.cjs");
36
+ var import_progressBar = require("../progressBar.cjs");
37
+ var import_reporter = require("../reporter.cjs");
38
+ var import_utils = require("../utils.cjs");
39
+ const PLUGIN_NAME = "PluginProgress";
40
+ class RspackPluginProgress extends import_core.rspack.ProgressPlugin {
41
+ constructor() {
42
+ super((percentage, msg, ...args) => {
43
+ (0, import_utils.isProd)() && this.progressBar.update({ current: percentage, message: `${msg} ${args.join(" ")}` });
44
+ });
45
+ this.startTime = void 0;
46
+ this.progressBar = new import_progressBar.ProgressBar();
47
+ }
48
+ apply(compiler) {
49
+ super.apply(compiler);
50
+ compiler.hooks.compile.tap(PLUGIN_NAME, () => {
51
+ this.startTime = process.hrtime();
52
+ !(0, import_utils.isProd)() && import_logger.logger.wait("building...");
53
+ });
54
+ compiler.hooks.done.tap(PLUGIN_NAME, async (stats) => {
55
+ if (this.startTime) {
56
+ const hrtime = process.hrtime(this.startTime);
57
+ const compileTime = hrtime[0] + hrtime[1] / 1e9;
58
+ this.startTime = void 0;
59
+ if (!stats.hasErrors()) {
60
+ if ((0, import_utils.isProd)()) {
61
+ await (0, import_reporter.printFileSize)({ stats });
62
+ console.log(import_colors.default.green(`✓ built in ${import_colors.default.bold((0, import_utils.prettyTime)(compileTime))}`));
63
+ } else {
64
+ import_logger.logger.ready(`built in ${import_colors.default.bold((0, import_utils.prettyTime)(compileTime))}`);
65
+ }
66
+ }
67
+ }
68
+ });
69
+ }
70
+ }
71
+ // Annotate the CommonJS export names for ESM import in node:
72
+ 0 && (module.exports = {
73
+ RspackPluginProgress
74
+ });
@@ -0,0 +1,9 @@
1
+ import { type Compiler, rspack } from '@rspack/core';
2
+ import { ProgressBar } from '../progressBar';
3
+ export declare class RspackPluginProgress extends rspack.ProgressPlugin {
4
+ startTime?: [number, number];
5
+ progressBar: ProgressBar;
6
+ constructor();
7
+ apply(compiler: Compiler): void;
8
+ }
9
+ //# sourceMappingURL=rspack.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"rspack.d.ts","sourceRoot":"","sources":["../../src/plugin-progress/rspack.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,QAAQ,EAAE,MAAM,EAAE,MAAM,cAAc,CAAA;AAGpD,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAA;AAK7C,qBAAa,oBAAqB,SAAQ,MAAM,CAAC,cAAc;IAC7D,SAAS,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,CAAY;IACxC,WAAW,cAAoB;;IAO/B,KAAK,CAAC,QAAQ,EAAE,QAAQ,GAAG,IAAI;CAsBhC"}
@@ -0,0 +1,50 @@
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 { rspack } from "@rspack/core";
11
+ import colors from "../colors.js";
12
+ import { logger } from "../logger.js";
13
+ import { ProgressBar } from "../progressBar.js";
14
+ import { printFileSize } from "../reporter.js";
15
+ import { isProd, prettyTime } from "../utils.js";
16
+ const PLUGIN_NAME = "PluginProgress";
17
+ class RspackPluginProgress extends rspack.ProgressPlugin {
18
+ constructor() {
19
+ super((percentage, msg, ...args) => {
20
+ isProd() && this.progressBar.update({ current: percentage, message: `${msg} ${args.join(" ")}` });
21
+ });
22
+ this.startTime = void 0;
23
+ this.progressBar = new ProgressBar();
24
+ }
25
+ apply(compiler) {
26
+ super.apply(compiler);
27
+ compiler.hooks.compile.tap(PLUGIN_NAME, () => {
28
+ this.startTime = process.hrtime();
29
+ !isProd() && logger.wait("building...");
30
+ });
31
+ compiler.hooks.done.tap(PLUGIN_NAME, async (stats) => {
32
+ if (this.startTime) {
33
+ const hrtime = process.hrtime(this.startTime);
34
+ const compileTime = hrtime[0] + hrtime[1] / 1e9;
35
+ this.startTime = void 0;
36
+ if (!stats.hasErrors()) {
37
+ if (isProd()) {
38
+ await printFileSize({ stats });
39
+ console.log(colors.green(`✓ built in ${colors.bold(prettyTime(compileTime))}`));
40
+ } else {
41
+ logger.ready(`built in ${colors.bold(prettyTime(compileTime))}`);
42
+ }
43
+ }
44
+ }
45
+ });
46
+ }
47
+ }
48
+ export {
49
+ RspackPluginProgress
50
+ };
@@ -0,0 +1,84 @@
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 webpack_exports = {};
29
+ __export(webpack_exports, {
30
+ WebpackPluginProgress: () => WebpackPluginProgress
31
+ });
32
+ module.exports = __toCommonJS(webpack_exports);
33
+ var import_colors = __toESM(require("../colors.cjs"));
34
+ var import_logger = require("../logger.cjs");
35
+ var import_progressBar = require("../progressBar.cjs");
36
+ var import_reporter = require("../reporter.cjs");
37
+ var import_utils = require("../utils.cjs");
38
+ var import_webpack = __toESM(require("webpack"));
39
+ const PLUGIN_NAME = "PluginProgress";
40
+ class WebpackPluginProgress extends import_webpack.default.ProgressPlugin {
41
+ constructor() {
42
+ super({
43
+ entries: false,
44
+ dependencies: false,
45
+ activeModules: true,
46
+ handler: (0, import_utils.isProd)() ? (percentage, msg, ...args) => {
47
+ if (!this.startTime)
48
+ return;
49
+ this.progressBar.update({
50
+ current: percentage,
51
+ message: `${msg} ${args.join(" ").replace(/(\d+) active /, "")}`
52
+ });
53
+ } : void 0
54
+ });
55
+ this.startTime = void 0;
56
+ this.progressBar = new import_progressBar.ProgressBar();
57
+ }
58
+ apply(compiler) {
59
+ super.apply(compiler);
60
+ compiler.hooks.compile.tap(PLUGIN_NAME, () => {
61
+ this.startTime = process.hrtime();
62
+ !(0, import_utils.isProd)() && import_logger.logger.wait("building...");
63
+ });
64
+ compiler.hooks.done.tap(PLUGIN_NAME, async (stats) => {
65
+ if (this.startTime) {
66
+ const hrtime = process.hrtime(this.startTime);
67
+ const compileTime = hrtime[0] + hrtime[1] / 1e9;
68
+ this.startTime = void 0;
69
+ if (!stats.hasErrors()) {
70
+ if ((0, import_utils.isProd)()) {
71
+ await (0, import_reporter.printFileSize)({ stats });
72
+ console.log(import_colors.default.green(`✓ built in ${import_colors.default.bold((0, import_utils.prettyTime)(compileTime))}`));
73
+ } else {
74
+ import_logger.logger.ready(`built in ${import_colors.default.bold((0, import_utils.prettyTime)(compileTime))}`);
75
+ }
76
+ }
77
+ }
78
+ });
79
+ }
80
+ }
81
+ // Annotate the CommonJS export names for ESM import in node:
82
+ 0 && (module.exports = {
83
+ WebpackPluginProgress
84
+ });
@@ -0,0 +1,9 @@
1
+ import { ProgressBar } from '../progressBar';
2
+ import webpack from 'webpack';
3
+ export declare class WebpackPluginProgress extends webpack.ProgressPlugin {
4
+ startTime?: [number, number];
5
+ progressBar: ProgressBar;
6
+ constructor();
7
+ apply(compiler: webpack.Compiler): void;
8
+ }
9
+ //# sourceMappingURL=webpack.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"webpack.d.ts","sourceRoot":"","sources":["../../src/plugin-progress/webpack.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAA;AAG7C,OAAO,OAAO,MAAM,SAAS,CAAA;AAG7B,qBAAa,qBAAsB,SAAQ,OAAO,CAAC,cAAc;IAC/D,SAAS,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,CAAY;IACxC,WAAW,cAAoB;;IAiB/B,KAAK,CAAC,QAAQ,EAAE,OAAO,CAAC,QAAQ,GAAG,IAAI;CAsBxC"}
@@ -0,0 +1,60 @@
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 { logger } from "../logger.js";
12
+ import { ProgressBar } from "../progressBar.js";
13
+ import { printFileSize } from "../reporter.js";
14
+ import { isProd, prettyTime } from "../utils.js";
15
+ import webpack from "webpack";
16
+ const PLUGIN_NAME = "PluginProgress";
17
+ class WebpackPluginProgress extends webpack.ProgressPlugin {
18
+ constructor() {
19
+ super({
20
+ entries: false,
21
+ dependencies: false,
22
+ activeModules: true,
23
+ handler: isProd() ? (percentage, msg, ...args) => {
24
+ if (!this.startTime)
25
+ return;
26
+ this.progressBar.update({
27
+ current: percentage,
28
+ message: `${msg} ${args.join(" ").replace(/(\d+) active /, "")}`
29
+ });
30
+ } : void 0
31
+ });
32
+ this.startTime = void 0;
33
+ this.progressBar = new ProgressBar();
34
+ }
35
+ apply(compiler) {
36
+ super.apply(compiler);
37
+ compiler.hooks.compile.tap(PLUGIN_NAME, () => {
38
+ this.startTime = process.hrtime();
39
+ !isProd() && logger.wait("building...");
40
+ });
41
+ compiler.hooks.done.tap(PLUGIN_NAME, async (stats) => {
42
+ if (this.startTime) {
43
+ const hrtime = process.hrtime(this.startTime);
44
+ const compileTime = hrtime[0] + hrtime[1] / 1e9;
45
+ this.startTime = void 0;
46
+ if (!stats.hasErrors()) {
47
+ if (isProd()) {
48
+ await printFileSize({ stats });
49
+ console.log(colors.green(`✓ built in ${colors.bold(prettyTime(compileTime))}`));
50
+ } else {
51
+ logger.ready(`built in ${colors.bold(prettyTime(compileTime))}`);
52
+ }
53
+ }
54
+ }
55
+ });
56
+ }
57
+ }
58
+ export {
59
+ WebpackPluginProgress
60
+ };
@@ -0,0 +1,33 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __export = (target, all) => {
6
+ for (var name in all)
7
+ __defProp(target, name, { get: all[name], enumerable: true });
8
+ };
9
+ var __copyProps = (to, from, except, desc) => {
10
+ if (from && typeof from === "object" || typeof from === "function") {
11
+ for (let key of __getOwnPropNames(from))
12
+ if (!__hasOwnProp.call(to, key) && key !== except)
13
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
+ }
15
+ return to;
16
+ };
17
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
+ var plugin_exports = {};
19
+ __export(plugin_exports, {
20
+ getNormalizedPluginsByHook: () => getNormalizedPluginsByHook
21
+ });
22
+ module.exports = __toCommonJS(plugin_exports);
23
+ function getNormalizedPluginsByHook(hook, plugins) {
24
+ const pluginMap = /* @__PURE__ */ new Map();
25
+ plugins?.forEach((plugin) => {
26
+ plugin[hook] && pluginMap.set(plugin.name, plugin);
27
+ });
28
+ return Array.from(pluginMap.values());
29
+ }
30
+ // Annotate the CommonJS export names for ESM import in node:
31
+ 0 && (module.exports = {
32
+ getNormalizedPluginsByHook
33
+ });
@@ -0,0 +1,3 @@
1
+ import type { UnpackPlugin, UnpackPluginHook } from './types/index';
2
+ export declare function getNormalizedPluginsByHook(hook: UnpackPluginHook, plugins: UnpackPlugin[]): UnpackPlugin[];
3
+ //# sourceMappingURL=plugin.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../src/plugin.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAA;AAEnE,wBAAgB,0BAA0B,CAAC,IAAI,EAAE,gBAAgB,EAAE,OAAO,EAAE,YAAY,EAAE,kBAOzF"}
package/dist/plugin.js ADDED
@@ -0,0 +1,19 @@
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
+ function getNormalizedPluginsByHook(hook, plugins) {
11
+ const pluginMap = /* @__PURE__ */ new Map();
12
+ plugins?.forEach((plugin) => {
13
+ plugin[hook] && pluginMap.set(plugin.name, plugin);
14
+ });
15
+ return Array.from(pluginMap.values());
16
+ }
17
+ export {
18
+ getNormalizedPluginsByHook
19
+ };
@@ -0,0 +1,70 @@
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
31
+ });
32
+ module.exports = __toCommonJS(progressBar_exports);
33
+ var import_colors = __toESM(require("./colors.cjs"));
34
+ const logUpdate = require("../compiled/log-update/index.js");
35
+ 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 - 7;
47
+ let current = originalCurrent;
48
+ if (originalCurrent >= 0.98) {
49
+ current = 1;
50
+ }
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
+ logUpdate(
58
+ `${prefix}${bar} (${Math.floor(
59
+ current * 100
60
+ )}%) ${import_colors.default.dim(message.slice(0, messageWidth))}`
61
+ );
62
+ }
63
+ done() {
64
+ logUpdate.done();
65
+ }
66
+ }
67
+ // Annotate the CommonJS export names for ESM import in node:
68
+ 0 && (module.exports = {
69
+ ProgressBar
70
+ });
@@ -0,0 +1,14 @@
1
+ export declare class ProgressBar {
2
+ options: {
3
+ width: number;
4
+ prefix: string;
5
+ char: string;
6
+ color: string;
7
+ };
8
+ update({ current: originalCurrent, message }: {
9
+ current: number;
10
+ message?: string;
11
+ }): void;
12
+ done(): void;
13
+ }
14
+ //# sourceMappingURL=progressBar.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"progressBar.d.ts","sourceRoot":"","sources":["../src/progressBar.ts"],"names":[],"mappings":"AAGA,qBAAa,WAAW;IACtB,OAAO;;;;;MAKN;IACD,MAAM,CAAC,EAAE,OAAO,EAAE,eAAe,EAAE,OAAY,EAAE,EAAE;QAAE,OAAO,EAAE,MAAM,CAAC;QAAC,OAAO,CAAC,EAAE,MAAM,CAAA;KAAE;IAmBxF,IAAI;CAGL"}
@@ -0,0 +1,46 @@
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
+ const logUpdate = require("../compiled/log-update/index.js");
12
+ 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 - 7;
24
+ let current = originalCurrent;
25
+ if (originalCurrent >= 0.98) {
26
+ current = 1;
27
+ }
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))}`
38
+ );
39
+ }
40
+ done() {
41
+ logUpdate.done();
42
+ }
43
+ }
44
+ export {
45
+ ProgressBar
46
+ };