@unpackjs/core 2.1.0 → 2.3.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 (153) hide show
  1. package/compiled/css-loader/index.js +49 -49
  2. package/compiled/less-loader/index.js +8 -8
  3. package/compiled/postcss-loader/index.js +37 -37
  4. package/compiled/sass-loader/index.js +8 -8
  5. package/dist/bundler-config/cache.cjs +113 -0
  6. package/dist/bundler-config/cache.d.ts +7 -0
  7. package/dist/bundler-config/cache.d.ts.map +1 -0
  8. package/dist/bundler-config/cache.js +71 -0
  9. package/dist/bundler-config/chunkSplit.d.ts.map +1 -1
  10. package/dist/bundler-config/chunkSplit.js +8 -8
  11. package/dist/bundler-config/css.cjs +15 -16
  12. package/dist/bundler-config/css.d.ts.map +1 -1
  13. package/dist/bundler-config/css.js +44 -45
  14. package/dist/bundler-config/experimentCss.cjs +14 -12
  15. package/dist/bundler-config/experimentCss.d.ts.map +1 -1
  16. package/dist/bundler-config/experimentCss.js +39 -37
  17. package/dist/bundler-config/{helper.cjs → helpers.cjs} +2 -2
  18. package/dist/bundler-config/{helper.d.ts → helpers.d.ts} +1 -1
  19. package/dist/bundler-config/helpers.d.ts.map +1 -0
  20. package/dist/bundler-config/helpers.js +39 -0
  21. package/dist/bundler-config/index.cjs +63 -25
  22. package/dist/bundler-config/index.d.ts.map +1 -1
  23. package/dist/bundler-config/index.js +103 -65
  24. package/dist/bundler-config/jsMinify.cjs +9 -11
  25. package/dist/bundler-config/jsMinify.d.ts +2 -10
  26. package/dist/bundler-config/jsMinify.d.ts.map +1 -1
  27. package/dist/bundler-config/jsMinify.js +14 -16
  28. package/dist/bundler-config/oxlint/.oxlintrc.json +29 -0
  29. package/dist/bundler-config/oxlint/plugin.cjs +143 -0
  30. package/dist/bundler-config/oxlint/plugin.d.ts +10 -0
  31. package/dist/bundler-config/oxlint/plugin.d.ts.map +1 -0
  32. package/dist/bundler-config/oxlint/plugin.js +104 -0
  33. package/dist/{plugin-progress/helper.cjs → bundler-config/progress/helpers.cjs} +24 -11
  34. package/dist/{plugin-progress/helper.d.ts → bundler-config/progress/helpers.d.ts} +1 -1
  35. package/dist/bundler-config/progress/helpers.d.ts.map +1 -0
  36. package/dist/bundler-config/progress/helpers.js +81 -0
  37. package/dist/{plugin-progress → bundler-config/progress}/rspack.cjs +11 -11
  38. package/dist/{plugin-progress → bundler-config/progress}/rspack.d.ts +2 -2
  39. package/dist/bundler-config/progress/rspack.d.ts.map +1 -0
  40. package/dist/bundler-config/progress/rspack.js +37 -0
  41. package/dist/{plugin-progress → bundler-config/progress}/webpack.cjs +14 -12
  42. package/dist/bundler-config/progress/webpack.d.ts +9 -0
  43. package/dist/bundler-config/progress/webpack.d.ts.map +1 -0
  44. package/dist/bundler-config/progress/webpack.js +44 -0
  45. package/dist/colors.cjs +3 -4
  46. package/dist/colors.d.ts +1 -2
  47. package/dist/colors.d.ts.map +1 -1
  48. package/dist/colors.js +4 -5
  49. package/dist/config.cjs +11 -3
  50. package/dist/config.d.ts +1 -0
  51. package/dist/config.d.ts.map +1 -1
  52. package/dist/config.js +25 -21
  53. package/dist/constants.cjs +21 -17
  54. package/dist/constants.d.ts +2 -1
  55. package/dist/constants.d.ts.map +1 -1
  56. package/dist/constants.js +11 -10
  57. package/dist/createUnpack.cjs +25 -33
  58. package/dist/createUnpack.d.ts +9 -4
  59. package/dist/createUnpack.d.ts.map +1 -1
  60. package/dist/createUnpack.js +36 -34
  61. package/dist/fs.cjs +91 -0
  62. package/dist/fs.d.ts +12 -0
  63. package/dist/fs.d.ts.map +1 -0
  64. package/dist/fs.js +34 -0
  65. package/dist/global.js +1 -1
  66. package/dist/index.cjs +71 -59
  67. package/dist/index.d.ts +9 -9
  68. package/dist/index.d.ts.map +1 -1
  69. package/dist/index.js +12 -47
  70. package/dist/lightningcss/loader.cjs +0 -2
  71. package/dist/lightningcss/loader.d.ts.map +1 -1
  72. package/dist/lightningcss/loader.js +5 -7
  73. package/dist/lightningcss/minimizer.cjs +14 -17
  74. package/dist/lightningcss/minimizer.d.ts +2 -2
  75. package/dist/lightningcss/minimizer.d.ts.map +1 -1
  76. package/dist/lightningcss/minimizer.js +16 -19
  77. package/dist/loadEnv.cjs +122 -0
  78. package/dist/loadEnv.d.ts +64 -0
  79. package/dist/loadEnv.d.ts.map +1 -0
  80. package/dist/loadEnv.js +80 -0
  81. package/dist/loadingAnimation.cjs +76 -0
  82. package/dist/loadingAnimation.d.ts +9 -0
  83. package/dist/loadingAnimation.d.ts.map +1 -0
  84. package/dist/loadingAnimation.js +44 -0
  85. package/dist/logger.cjs +6 -7
  86. package/dist/logger.d.ts.map +1 -1
  87. package/dist/logger.js +14 -14
  88. package/dist/openBrowser.d.ts.map +1 -1
  89. package/dist/openBrowser.js +8 -8
  90. package/dist/plugin.js +1 -1
  91. package/dist/prebundleDeps.cjs +31 -10
  92. package/dist/prebundleDeps.d.ts.map +1 -1
  93. package/dist/prebundleDeps.js +74 -52
  94. package/dist/progressBar.cjs +5 -12
  95. package/dist/progressBar.d.ts +2 -0
  96. package/dist/progressBar.d.ts.map +1 -1
  97. package/dist/progressBar.js +8 -5
  98. package/dist/reporter.cjs +15 -11
  99. package/dist/reporter.d.ts.map +1 -1
  100. package/dist/reporter.js +28 -23
  101. package/dist/run/build.cjs +4 -4
  102. package/dist/run/build.d.ts +1 -1
  103. package/dist/run/build.d.ts.map +1 -1
  104. package/dist/run/build.js +11 -11
  105. package/dist/run/dev.cjs +23 -16
  106. package/dist/run/dev.d.ts +1 -1
  107. package/dist/run/dev.d.ts.map +1 -1
  108. package/dist/run/dev.js +41 -33
  109. package/dist/run/index.js +1 -1
  110. package/dist/typed-css-modules/loader.cjs +2 -2
  111. package/dist/typed-css-modules/loader.d.ts.map +1 -1
  112. package/dist/typed-css-modules/loader.js +15 -15
  113. package/dist/typed-css-modules/plugin.cjs +1 -1
  114. package/dist/typed-css-modules/plugin.js +14 -14
  115. package/dist/typed-css-modules/utils.d.ts.map +1 -1
  116. package/dist/typed-css-modules/utils.js +7 -7
  117. package/dist/types/chunkSplit.js +1 -1
  118. package/dist/types/config.d.ts +32 -6
  119. package/dist/types/config.d.ts.map +1 -1
  120. package/dist/types/config.js +1 -1
  121. package/dist/types/index.cjs +15 -15
  122. package/dist/types/index.d.ts +3 -2
  123. package/dist/types/index.d.ts.map +1 -1
  124. package/dist/types/index.js +3 -3
  125. package/dist/types/lightningcss.d.ts +2 -2
  126. package/dist/types/lightningcss.d.ts.map +1 -1
  127. package/dist/types/lightningcss.js +1 -1
  128. package/dist/types/logger.js +1 -1
  129. package/dist/types/oxc.cjs +18 -0
  130. package/dist/types/oxc.d.ts +10 -0
  131. package/dist/types/oxc.d.ts.map +1 -0
  132. package/dist/types/oxc.js +2 -0
  133. package/dist/types/plugin.d.ts +2 -2
  134. package/dist/types/plugin.d.ts.map +1 -1
  135. package/dist/types/plugin.js +1 -1
  136. package/dist/utils.cjs +28 -38
  137. package/dist/utils.d.ts +0 -1
  138. package/dist/utils.d.ts.map +1 -1
  139. package/dist/utils.js +19 -25
  140. package/dist/watchFiles.cjs +1 -1
  141. package/dist/watchFiles.d.ts +1 -1
  142. package/dist/watchFiles.d.ts.map +1 -1
  143. package/dist/watchFiles.js +6 -6
  144. package/package.json +6 -5
  145. package/dist/bundler-config/helper.d.ts.map +0 -1
  146. package/dist/bundler-config/helper.js +0 -39
  147. package/dist/plugin-progress/helper.d.ts.map +0 -1
  148. package/dist/plugin-progress/helper.js +0 -67
  149. package/dist/plugin-progress/rspack.d.ts.map +0 -1
  150. package/dist/plugin-progress/rspack.js +0 -37
  151. package/dist/plugin-progress/webpack.d.ts +0 -8
  152. package/dist/plugin-progress/webpack.d.ts.map +0 -1
  153. package/dist/plugin-progress/webpack.js +0 -42
@@ -0,0 +1,104 @@
1
+ import 'module';
2
+ /*#__PURE__*/ import.meta.url;
3
+ import { fileURLToPath as __webpack_fileURLToPath__ } from "node:url";
4
+ import { dirname as __webpack_dirname__ } from "node:path";
5
+ import { spawn } from "node:child_process";
6
+ import node_path from "node:path";
7
+ var plugin_dirname = __webpack_dirname__(__webpack_fileURLToPath__(import.meta.url));
8
+ function _define_property(obj, key, value) {
9
+ if (key in obj) Object.defineProperty(obj, key, {
10
+ value: value,
11
+ enumerable: true,
12
+ configurable: true,
13
+ writable: true
14
+ });
15
+ else obj[key] = value;
16
+ return obj;
17
+ }
18
+ class OxlintPlugin {
19
+ getGitChangedFiles() {
20
+ return new Promise((resolve)=>{
21
+ var _child_stdout;
22
+ const child = spawn('git', [
23
+ 'status',
24
+ '--porcelain'
25
+ ], {
26
+ cwd: process.cwd(),
27
+ stdio: 'pipe'
28
+ });
29
+ let output = '';
30
+ null == (_child_stdout = child.stdout) || _child_stdout.on('data', (data)=>{
31
+ output += data.toString();
32
+ });
33
+ child.on('exit', (code)=>{
34
+ if (0 === code) {
35
+ const files = output.trim().split('\n').filter(Boolean).map((line)=>{
36
+ const idx = line.indexOf(' ');
37
+ const status = line.slice(0, idx);
38
+ let filePath = line.slice(idx + 1).trim();
39
+ if (status.includes('D')) return null;
40
+ if (status.startsWith('R') || status.startsWith('C')) filePath = filePath.split(' -> ')[1];
41
+ return filePath;
42
+ }).filter(Boolean).map((file)=>node_path.resolve(process.cwd(), file));
43
+ resolve(files);
44
+ } else resolve([]);
45
+ });
46
+ child.on('error', ()=>{
47
+ resolve([]);
48
+ });
49
+ });
50
+ }
51
+ runOxlint(args) {
52
+ var _child_stdout, _child_stderr;
53
+ const cwd = process.cwd();
54
+ const child = spawn('npx', [
55
+ '--yes',
56
+ ...args
57
+ ], {
58
+ cwd,
59
+ stdio: 'pipe',
60
+ shell: true,
61
+ env: {
62
+ ...process.env,
63
+ FORCE_COLOR: '1'
64
+ }
65
+ });
66
+ let output = '';
67
+ null == (_child_stdout = child.stdout) || _child_stdout.on('data', (data)=>{
68
+ output += data.toString();
69
+ });
70
+ child.on('exit', (code)=>{
71
+ const hasErrors = !output.includes('Found 0 warnings and 0 errors');
72
+ if (hasErrors || 0 !== code) process.stdout.write(output);
73
+ });
74
+ null == (_child_stderr = child.stderr) || _child_stderr.on('data', (data)=>{
75
+ process.stderr.write(data);
76
+ });
77
+ }
78
+ apply(compiler) {
79
+ compiler.hooks.watchRun.tap('OxlintPlugin', ()=>{
80
+ if (this.timeoutId) clearTimeout(this.timeoutId);
81
+ this.timeoutId = setTimeout(()=>{
82
+ const configPath = node_path.resolve(plugin_dirname, '.oxlintrc.json');
83
+ this.getGitChangedFiles().then((changedFiles)=>{
84
+ if (changedFiles.length > 0) {
85
+ const args = [
86
+ 'oxlint',
87
+ '-c',
88
+ configPath,
89
+ ...changedFiles,
90
+ '--fix',
91
+ '--fix-suggestions'
92
+ ];
93
+ this.runOxlint(args);
94
+ }
95
+ });
96
+ }, this.debounceTime);
97
+ });
98
+ }
99
+ constructor(){
100
+ _define_property(this, "timeoutId", null);
101
+ _define_property(this, "debounceTime", 200);
102
+ }
103
+ }
104
+ export { OxlintPlugin };
@@ -33,16 +33,15 @@ var __webpack_require__ = {};
33
33
  var __webpack_exports__ = {};
34
34
  __webpack_require__.r(__webpack_exports__);
35
35
  __webpack_require__.d(__webpack_exports__, {
36
- printDevLog: ()=>printDevLog,
37
- compileDone: ()=>compileDone
36
+ compileDone: ()=>compileDone,
37
+ printDevLog: ()=>printDevLog
38
38
  });
39
39
  const external_node_path_namespaceObject = require("node:path");
40
40
  var external_node_path_default = /*#__PURE__*/ __webpack_require__.n(external_node_path_namespaceObject);
41
- const external_colors_cjs_namespaceObject = require("../colors.cjs");
42
- var external_colors_cjs_default = /*#__PURE__*/ __webpack_require__.n(external_colors_cjs_namespaceObject);
43
- const external_logger_cjs_namespaceObject = require("../logger.cjs");
44
- const external_reporter_cjs_namespaceObject = require("../reporter.cjs");
45
- const external_utils_cjs_namespaceObject = require("../utils.cjs");
41
+ const external_colors_cjs_namespaceObject = require("../../colors.cjs");
42
+ const external_logger_cjs_namespaceObject = require("../../logger.cjs");
43
+ const external_reporter_cjs_namespaceObject = require("../../reporter.cjs");
44
+ const external_utils_cjs_namespaceObject = require("../../utils.cjs");
46
45
  function cutPath(originalFilePath, root) {
47
46
  const prefix = root.endsWith(external_node_path_namespaceObject.sep) ? root : root + external_node_path_namespaceObject.sep;
48
47
  let filePath = originalFilePath;
@@ -67,13 +66,13 @@ function printDevLog(compiler, root) {
67
66
  const changedFiles = compiler.modifiedFiles ? Array.from(compiler.modifiedFiles) : null;
68
67
  if (null == changedFiles ? void 0 : changedFiles.length) {
69
68
  const fileInfo = formatFileList(changedFiles, root);
70
- external_logger_cjs_namespaceObject.logger.wait(`building ${external_colors_cjs_default().dim(fileInfo)}`);
69
+ external_logger_cjs_namespaceObject.logger.wait(`building ${external_colors_cjs_namespaceObject.colors.dim(fileInfo)}`);
71
70
  return;
72
71
  }
73
72
  const removedFiles = compiler.removedFiles ? Array.from(compiler.removedFiles) : null;
74
73
  if (null == removedFiles ? void 0 : removedFiles.length) {
75
74
  const fileInfo = formatFileList(removedFiles, root);
76
- external_logger_cjs_namespaceObject.logger.wait(`building ${external_colors_cjs_default().dim(`removed ${fileInfo}`)}`);
75
+ external_logger_cjs_namespaceObject.logger.wait(`building ${external_colors_cjs_namespaceObject.colors.dim(`removed ${fileInfo}`)}`);
77
76
  return;
78
77
  }
79
78
  external_logger_cjs_namespaceObject.logger.wait('build started...');
@@ -90,14 +89,28 @@ async function compileDone(compiler, stats) {
90
89
  root,
91
90
  stats
92
91
  });
93
- console.log(external_colors_cjs_default().green(`\u{2713} built in ${external_colors_cjs_default().bold((0, external_utils_cjs_namespaceObject.prettyTime)(compileTime))}`));
92
+ external_logger_cjs_namespaceObject.logger.ready(external_colors_cjs_namespaceObject.colors.green(`built in ${(0, external_utils_cjs_namespaceObject.prettyTime)(compileTime)}`));
94
93
  } else {
95
94
  if ((0, external_utils_cjs_namespaceObject.isDebug)()) {
96
95
  const modules = stats.compilation.modules;
96
+ const nodeModulesStats = new Map();
97
+ const nodeModulesPath = external_node_path_default().resolve(root, 'node_modules');
97
98
  modules.forEach((module)=>{
98
99
  const { resource } = module;
99
- if (null == resource ? void 0 : resource.includes(external_node_path_default().resolve(root, 'node_modules'))) external_logger_cjs_namespaceObject.logger.debug(external_node_path_default().relative(root, resource));
100
+ if (null == resource ? void 0 : resource.includes(nodeModulesPath)) {
101
+ const relativePath = external_node_path_default().relative(nodeModulesPath, resource);
102
+ const pathParts = relativePath.split(external_node_path_namespaceObject.sep);
103
+ let packageName;
104
+ packageName = pathParts[0].startsWith('@') ? `${pathParts[0]}/${pathParts[1]}` : pathParts[0];
105
+ if (packageName) nodeModulesStats.set(packageName, (nodeModulesStats.get(packageName) || 0) + 1);
106
+ }
100
107
  });
108
+ if (nodeModulesStats.size > 0) {
109
+ const sortedStats = Array.from(nodeModulesStats.entries()).sort((a, b)=>a[1] - b[1]);
110
+ sortedStats.forEach(([packageName, count])=>{
111
+ external_logger_cjs_namespaceObject.logger.debug(`${external_colors_cjs_namespaceObject.colors.cyan(packageName)}: ${external_colors_cjs_namespaceObject.colors.yellow(count)} modules`);
112
+ });
113
+ }
101
114
  }
102
115
  external_logger_cjs_namespaceObject.logger.ready(`built in ${(0, external_utils_cjs_namespaceObject.prettyTime)(compileTime)}${(0, external_utils_cjs_namespaceObject.isDebug)() ? ` (${stats.compilation.modules.size} modules)` : ''}`);
103
116
  }
@@ -1,4 +1,4 @@
1
1
  import type * as Rspack from '@rspack/core';
2
2
  export declare function printDevLog(compiler: Rspack.Compiler, root: string): void;
3
3
  export declare function compileDone(compiler: Rspack.Compiler, stats: Rspack.Stats): Promise<void>;
4
- //# sourceMappingURL=helper.d.ts.map
4
+ //# sourceMappingURL=helpers.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"helpers.d.ts","sourceRoot":"","sources":["../../../src/bundler-config/progress/helpers.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,KAAK,MAAM,MAAM,cAAc,CAAA;AA4C3C,wBAAgB,WAAW,CAAC,QAAQ,EAAE,MAAM,CAAC,QAAQ,EAAE,IAAI,EAAE,MAAM,QAgBlE;AAED,wBAAsB,WAAW,CAAC,QAAQ,EAAE,MAAM,CAAC,QAAQ,EAAE,KAAK,EAAE,MAAM,CAAC,KAAK,iBA+C/E"}
@@ -0,0 +1,81 @@
1
+ import 'module';
2
+ /*#__PURE__*/ import.meta.url;
3
+ import node_path, { sep } from "node:path";
4
+ import { colors } from "../../colors.js";
5
+ import { logger } from "../../logger.js";
6
+ import { printFileSize } from "../../reporter.js";
7
+ import { isDebug, isProd, prettyTime } from "../../utils.js";
8
+ function cutPath(originalFilePath, root) {
9
+ const prefix = root.endsWith(sep) ? root : root + sep;
10
+ let filePath = originalFilePath;
11
+ if (filePath.startsWith(prefix)) filePath = filePath.slice(prefix.length);
12
+ const parts = filePath.split(sep).filter(Boolean);
13
+ return parts.length > 3 ? parts.slice(-3).join(sep) : parts.join(sep);
14
+ }
15
+ function isLikelyFile(filePath) {
16
+ const lastSegment = filePath.split(sep).pop() || '';
17
+ return lastSegment.includes('.');
18
+ }
19
+ function formatFileList(paths, rootPath) {
20
+ let files = paths.filter(isLikelyFile);
21
+ if (0 === files.length) files = [
22
+ paths[0]
23
+ ];
24
+ const fileInfo = files.slice(0, 1).map((file)=>cutPath(file, rootPath)).join(', ');
25
+ if (files.length > 1) return `${fileInfo} and ${files.length - 1} more`;
26
+ return fileInfo;
27
+ }
28
+ function printDevLog(compiler, root) {
29
+ const changedFiles = compiler.modifiedFiles ? Array.from(compiler.modifiedFiles) : null;
30
+ if (null == changedFiles ? void 0 : changedFiles.length) {
31
+ const fileInfo = formatFileList(changedFiles, root);
32
+ logger.wait(`building ${colors.dim(fileInfo)}`);
33
+ return;
34
+ }
35
+ const removedFiles = compiler.removedFiles ? Array.from(compiler.removedFiles) : null;
36
+ if (null == removedFiles ? void 0 : removedFiles.length) {
37
+ const fileInfo = formatFileList(removedFiles, root);
38
+ logger.wait(`building ${colors.dim(`removed ${fileInfo}`)}`);
39
+ return;
40
+ }
41
+ logger.wait('build started...');
42
+ }
43
+ async function compileDone(compiler, stats) {
44
+ const statsJson = stats.toJson({
45
+ preset: 'errors-only',
46
+ timings: true
47
+ });
48
+ const compileTime = statsJson.time / 1000;
49
+ const root = compiler.options.context;
50
+ if (!stats.hasErrors()) if (isProd()) {
51
+ await printFileSize({
52
+ root,
53
+ stats
54
+ });
55
+ logger.ready(colors.green(`built in ${prettyTime(compileTime)}`));
56
+ } else {
57
+ if (isDebug()) {
58
+ const modules = stats.compilation.modules;
59
+ const nodeModulesStats = new Map();
60
+ const nodeModulesPath = node_path.resolve(root, 'node_modules');
61
+ modules.forEach((module)=>{
62
+ const { resource } = module;
63
+ if (null == resource ? void 0 : resource.includes(nodeModulesPath)) {
64
+ const relativePath = node_path.relative(nodeModulesPath, resource);
65
+ const pathParts = relativePath.split(sep);
66
+ let packageName;
67
+ packageName = pathParts[0].startsWith('@') ? `${pathParts[0]}/${pathParts[1]}` : pathParts[0];
68
+ if (packageName) nodeModulesStats.set(packageName, (nodeModulesStats.get(packageName) || 0) + 1);
69
+ }
70
+ });
71
+ if (nodeModulesStats.size > 0) {
72
+ const sortedStats = Array.from(nodeModulesStats.entries()).sort((a, b)=>a[1] - b[1]);
73
+ sortedStats.forEach(([packageName, count])=>{
74
+ logger.debug(`${colors.cyan(packageName)}: ${colors.yellow(count)} modules`);
75
+ });
76
+ }
77
+ }
78
+ logger.ready(`built in ${prettyTime(compileTime)}${isDebug() ? ` (${stats.compilation.modules.size} modules)` : ''}`);
79
+ }
80
+ }
81
+ export { compileDone, printDevLog };
@@ -24,12 +24,12 @@ var __webpack_require__ = {};
24
24
  var __webpack_exports__ = {};
25
25
  __webpack_require__.r(__webpack_exports__);
26
26
  __webpack_require__.d(__webpack_exports__, {
27
- RspackPluginProgress: ()=>RspackPluginProgress
27
+ ProgressRspackPlugin: ()=>ProgressRspackPlugin
28
28
  });
29
29
  const core_namespaceObject = require("@rspack/core");
30
- const external_progressBar_cjs_namespaceObject = require("../progressBar.cjs");
31
- const external_utils_cjs_namespaceObject = require("../utils.cjs");
32
- const external_helper_cjs_namespaceObject = require("./helper.cjs");
30
+ const external_progressBar_cjs_namespaceObject = require("../../progressBar.cjs");
31
+ const external_utils_cjs_namespaceObject = require("../../utils.cjs");
32
+ const external_helpers_cjs_namespaceObject = require("./helpers.cjs");
33
33
  function _define_property(obj, key, value) {
34
34
  if (key in obj) Object.defineProperty(obj, key, {
35
35
  value: value,
@@ -40,15 +40,15 @@ function _define_property(obj, key, value) {
40
40
  else obj[key] = value;
41
41
  return obj;
42
42
  }
43
- const PLUGIN_NAME = 'PluginProgress';
44
- class RspackPluginProgress extends core_namespaceObject.rspack.ProgressPlugin {
43
+ const PLUGIN_NAME = 'ProgressPlugin';
44
+ class ProgressRspackPlugin extends core_namespaceObject.rspack.ProgressPlugin {
45
45
  apply(compiler) {
46
46
  super.apply(compiler);
47
47
  compiler.hooks.watchRun.tap(PLUGIN_NAME, ()=>{
48
- (0, external_helper_cjs_namespaceObject.printDevLog)(compiler, compiler.options.context);
48
+ (0, external_helpers_cjs_namespaceObject.printDevLog)(compiler, compiler.options.context);
49
49
  });
50
- compiler.hooks.done.tap(PLUGIN_NAME, async (stats)=>{
51
- await (0, external_helper_cjs_namespaceObject.compileDone)(compiler, stats);
50
+ compiler.hooks.afterDone.tap(PLUGIN_NAME, async (stats)=>{
51
+ await (0, external_helpers_cjs_namespaceObject.compileDone)(compiler, stats);
52
52
  });
53
53
  }
54
54
  constructor(){
@@ -60,9 +60,9 @@ class RspackPluginProgress extends core_namespaceObject.rspack.ProgressPlugin {
60
60
  }), _define_property(this, "progressBar", new external_progressBar_cjs_namespaceObject.ProgressBar());
61
61
  }
62
62
  }
63
- exports.RspackPluginProgress = __webpack_exports__.RspackPluginProgress;
63
+ exports.ProgressRspackPlugin = __webpack_exports__.ProgressRspackPlugin;
64
64
  for(var __webpack_i__ in __webpack_exports__)if (-1 === [
65
- "RspackPluginProgress"
65
+ "ProgressRspackPlugin"
66
66
  ].indexOf(__webpack_i__)) exports[__webpack_i__] = __webpack_exports__[__webpack_i__];
67
67
  Object.defineProperty(exports, '__esModule', {
68
68
  value: true
@@ -1,6 +1,6 @@
1
1
  import { type Compiler, rspack } from '@rspack/core';
2
- import { ProgressBar } from '../progressBar';
3
- export declare class RspackPluginProgress extends rspack.ProgressPlugin {
2
+ import { ProgressBar } from '../../progressBar';
3
+ export declare class ProgressRspackPlugin extends rspack.ProgressPlugin {
4
4
  progressBar: ProgressBar;
5
5
  constructor();
6
6
  apply(compiler: Compiler): void;
@@ -0,0 +1 @@
1
+ {"version":3,"file":"rspack.d.ts","sourceRoot":"","sources":["../../../src/bundler-config/progress/rspack.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,QAAQ,EAAE,MAAM,EAAE,MAAM,cAAc,CAAA;AACpD,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAA;AAK7C,qBAAa,oBAAqB,SAAQ,MAAM,CAAC,cAAc;IAC7D,WAAW,cAAoB;;IAO/B,KAAK,CAAC,QAAQ,EAAE,QAAQ,GAAG,IAAI;CAShC"}
@@ -0,0 +1,37 @@
1
+ import 'module';
2
+ /*#__PURE__*/ import.meta.url;
3
+ import { rspack } from "@rspack/core";
4
+ import { ProgressBar } from "../../progressBar.js";
5
+ import { isProd } from "../../utils.js";
6
+ import { compileDone, printDevLog } from "./helpers.js";
7
+ function _define_property(obj, key, value) {
8
+ if (key in obj) Object.defineProperty(obj, key, {
9
+ value: value,
10
+ enumerable: true,
11
+ configurable: true,
12
+ writable: true
13
+ });
14
+ else obj[key] = value;
15
+ return obj;
16
+ }
17
+ const PLUGIN_NAME = 'ProgressPlugin';
18
+ class ProgressRspackPlugin extends rspack.ProgressPlugin {
19
+ apply(compiler) {
20
+ super.apply(compiler);
21
+ compiler.hooks.watchRun.tap(PLUGIN_NAME, ()=>{
22
+ printDevLog(compiler, compiler.options.context);
23
+ });
24
+ compiler.hooks.afterDone.tap(PLUGIN_NAME, async (stats)=>{
25
+ await compileDone(compiler, stats);
26
+ });
27
+ }
28
+ constructor(){
29
+ super((percentage, msg, ...args)=>{
30
+ isProd() && this.progressBar.update({
31
+ current: percentage,
32
+ message: `${msg} ${args.join(' ')}`
33
+ });
34
+ }), _define_property(this, "progressBar", new ProgressBar());
35
+ }
36
+ }
37
+ export { ProgressRspackPlugin };
@@ -33,13 +33,13 @@ var __webpack_require__ = {};
33
33
  var __webpack_exports__ = {};
34
34
  __webpack_require__.r(__webpack_exports__);
35
35
  __webpack_require__.d(__webpack_exports__, {
36
- WebpackPluginProgress: ()=>WebpackPluginProgress
36
+ ProgressWebpackPlugin: ()=>ProgressWebpackPlugin
37
37
  });
38
- const external_progressBar_cjs_namespaceObject = require("../progressBar.cjs");
39
- const external_utils_cjs_namespaceObject = require("../utils.cjs");
38
+ const external_progressBar_cjs_namespaceObject = require("../../progressBar.cjs");
39
+ const external_utils_cjs_namespaceObject = require("../../utils.cjs");
40
40
  const external_webpack_namespaceObject = require("webpack");
41
41
  var external_webpack_default = /*#__PURE__*/ __webpack_require__.n(external_webpack_namespaceObject);
42
- const external_helper_cjs_namespaceObject = require("./helper.cjs");
42
+ const external_helpers_cjs_namespaceObject = require("./helpers.cjs");
43
43
  function _define_property(obj, key, value) {
44
44
  if (key in obj) Object.defineProperty(obj, key, {
45
45
  value: value,
@@ -50,15 +50,16 @@ function _define_property(obj, key, value) {
50
50
  else obj[key] = value;
51
51
  return obj;
52
52
  }
53
- const PLUGIN_NAME = 'PluginProgress';
54
- class WebpackPluginProgress extends external_webpack_default().ProgressPlugin {
53
+ const PLUGIN_NAME = 'ProgressPlugin';
54
+ class ProgressWebpackPlugin extends external_webpack_default().ProgressPlugin {
55
55
  apply(compiler) {
56
56
  super.apply(compiler);
57
57
  compiler.hooks.watchRun.tap(PLUGIN_NAME, ()=>{
58
- (0, external_helper_cjs_namespaceObject.printDevLog)(compiler, compiler.options.context);
58
+ (0, external_helpers_cjs_namespaceObject.printDevLog)(compiler, compiler.options.context);
59
59
  });
60
- compiler.hooks.done.tap(PLUGIN_NAME, async (stats)=>{
61
- await (0, external_helper_cjs_namespaceObject.compileDone)(compiler, stats);
60
+ compiler.hooks.afterDone.tap(PLUGIN_NAME, async (stats)=>{
61
+ this.isCompleted = true;
62
+ await (0, external_helpers_cjs_namespaceObject.compileDone)(compiler, stats);
62
63
  });
63
64
  }
64
65
  constructor(){
@@ -67,17 +68,18 @@ class WebpackPluginProgress extends external_webpack_default().ProgressPlugin {
67
68
  dependencies: false,
68
69
  activeModules: true,
69
70
  handler: (0, external_utils_cjs_namespaceObject.isProd)() ? (percentage, msg, ...args)=>{
71
+ if (this.isCompleted) return;
70
72
  this.progressBar.update({
71
73
  current: percentage,
72
74
  message: `${msg} ${args.join(' ').replace(/(\d+) active /, '')}`
73
75
  });
74
76
  } : void 0
75
- }), _define_property(this, "progressBar", new external_progressBar_cjs_namespaceObject.ProgressBar());
77
+ }), _define_property(this, "progressBar", new external_progressBar_cjs_namespaceObject.ProgressBar()), _define_property(this, "isCompleted", false);
76
78
  }
77
79
  }
78
- exports.WebpackPluginProgress = __webpack_exports__.WebpackPluginProgress;
80
+ exports.ProgressWebpackPlugin = __webpack_exports__.ProgressWebpackPlugin;
79
81
  for(var __webpack_i__ in __webpack_exports__)if (-1 === [
80
- "WebpackPluginProgress"
82
+ "ProgressWebpackPlugin"
81
83
  ].indexOf(__webpack_i__)) exports[__webpack_i__] = __webpack_exports__[__webpack_i__];
82
84
  Object.defineProperty(exports, '__esModule', {
83
85
  value: true
@@ -0,0 +1,9 @@
1
+ import { ProgressBar } from '../../progressBar';
2
+ import webpack from 'webpack';
3
+ export declare class ProgressWebpackPlugin extends webpack.ProgressPlugin {
4
+ progressBar: ProgressBar;
5
+ private isCompleted;
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/bundler-config/progress/webpack.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAA;AAE7C,OAAO,OAAO,MAAM,SAAS,CAAA;AAI7B,qBAAa,qBAAsB,SAAQ,OAAO,CAAC,cAAc;IAC/D,WAAW,cAAoB;IAC/B,OAAO,CAAC,WAAW,CAAQ;;IAiB3B,KAAK,CAAC,QAAQ,EAAE,OAAO,CAAC,QAAQ,GAAG,IAAI;CAYxC"}
@@ -0,0 +1,44 @@
1
+ import 'module';
2
+ /*#__PURE__*/ import.meta.url;
3
+ import { ProgressBar } from "../../progressBar.js";
4
+ import { isProd } from "../../utils.js";
5
+ import webpack from "webpack";
6
+ import { compileDone, printDevLog } from "./helpers.js";
7
+ function _define_property(obj, key, value) {
8
+ if (key in obj) Object.defineProperty(obj, key, {
9
+ value: value,
10
+ enumerable: true,
11
+ configurable: true,
12
+ writable: true
13
+ });
14
+ else obj[key] = value;
15
+ return obj;
16
+ }
17
+ const PLUGIN_NAME = 'ProgressPlugin';
18
+ class ProgressWebpackPlugin extends webpack.ProgressPlugin {
19
+ apply(compiler) {
20
+ super.apply(compiler);
21
+ compiler.hooks.watchRun.tap(PLUGIN_NAME, ()=>{
22
+ printDevLog(compiler, compiler.options.context);
23
+ });
24
+ compiler.hooks.afterDone.tap(PLUGIN_NAME, async (stats)=>{
25
+ this.isCompleted = true;
26
+ await compileDone(compiler, stats);
27
+ });
28
+ }
29
+ constructor(){
30
+ super({
31
+ entries: false,
32
+ dependencies: false,
33
+ activeModules: true,
34
+ handler: isProd() ? (percentage, msg, ...args)=>{
35
+ if (this.isCompleted) return;
36
+ this.progressBar.update({
37
+ current: percentage,
38
+ message: `${msg} ${args.join(' ').replace(/(\d+) active /, '')}`
39
+ });
40
+ } : void 0
41
+ }), _define_property(this, "progressBar", new ProgressBar()), _define_property(this, "isCompleted", false);
42
+ }
43
+ }
44
+ export { ProgressWebpackPlugin };
package/dist/colors.cjs CHANGED
@@ -33,7 +33,7 @@ var __webpack_require__ = {};
33
33
  var __webpack_exports__ = {};
34
34
  __webpack_require__.r(__webpack_exports__);
35
35
  __webpack_require__.d(__webpack_exports__, {
36
- default: ()=>src_colors
36
+ colors: ()=>colors
37
37
  });
38
38
  const external_picocolors_namespaceObject = require("picocolors");
39
39
  var external_picocolors_default = /*#__PURE__*/ __webpack_require__.n(external_picocolors_namespaceObject);
@@ -73,10 +73,9 @@ const colors = {
73
73
  return output;
74
74
  }
75
75
  };
76
- const src_colors = colors;
77
- exports["default"] = __webpack_exports__["default"];
76
+ exports.colors = __webpack_exports__.colors;
78
77
  for(var __webpack_i__ in __webpack_exports__)if (-1 === [
79
- "default"
78
+ "colors"
80
79
  ].indexOf(__webpack_i__)) exports[__webpack_i__] = __webpack_exports__[__webpack_i__];
81
80
  Object.defineProperty(exports, '__esModule', {
82
81
  value: true
package/dist/colors.d.ts CHANGED
@@ -1,6 +1,5 @@
1
1
  import type { Colors } from 'picocolors/types';
2
- declare const colors: Colors & {
2
+ export declare const colors: Colors & {
3
3
  rainbow: (input: string) => string;
4
4
  };
5
- export default colors;
6
5
  //# sourceMappingURL=colors.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"colors.d.ts","sourceRoot":"","sources":["../src/colors.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAA;AAE9C,QAAA,MAAM,MAAM,EAAE,MAAM,GAAG;IAAE,OAAO,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,MAAM,CAAA;CAyB1D,CAAA;AACD,eAAe,MAAM,CAAA"}
1
+ {"version":3,"file":"colors.d.ts","sourceRoot":"","sources":["../src/colors.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAA;AAE9C,eAAO,MAAM,MAAM,EAAE,MAAM,GAAG;IAAE,OAAO,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,MAAM,CAAA;CAyBjE,CAAA"}
package/dist/colors.js CHANGED
@@ -1,8 +1,8 @@
1
- import __rslib_shim_module__ from 'module';
1
+ import 'module';
2
2
  /*#__PURE__*/ import.meta.url;
3
- import * as __WEBPACK_EXTERNAL_MODULE_picocolors__ from "picocolors";
3
+ import picocolors from "picocolors";
4
4
  const colors = {
5
- ...__WEBPACK_EXTERNAL_MODULE_picocolors__["default"],
5
+ ...picocolors,
6
6
  rainbow: (input)=>{
7
7
  const startColor = [
8
8
  48,
@@ -37,5 +37,4 @@ const colors = {
37
37
  return output;
38
38
  }
39
39
  };
40
- const src_colors = colors;
41
- export { src_colors as default };
40
+ export { colors };
package/dist/config.cjs CHANGED
@@ -33,12 +33,14 @@ var __webpack_require__ = {};
33
33
  var __webpack_exports__ = {};
34
34
  __webpack_require__.r(__webpack_exports__);
35
35
  __webpack_require__.d(__webpack_exports__, {
36
+ defineConfig: ()=>defineConfig,
36
37
  loadConfig: ()=>loadConfig,
37
- defineConfig: ()=>defineConfig
38
+ resolveConfigPath: ()=>resolveConfigPath
38
39
  });
39
40
  const external_node_fs_namespaceObject = require("node:fs");
40
41
  var external_node_fs_default = /*#__PURE__*/ __webpack_require__.n(external_node_fs_namespaceObject);
41
42
  const external_node_path_namespaceObject = require("node:path");
43
+ var external_node_path_default = /*#__PURE__*/ __webpack_require__.n(external_node_path_namespaceObject);
42
44
  const external_jiti_namespaceObject = require("jiti");
43
45
  const external_logger_cjs_namespaceObject = require("./logger.cjs");
44
46
  const external_utils_cjs_namespaceObject = require("./utils.cjs");
@@ -48,7 +50,8 @@ async function loadConfig({ cliOptions, command }) {
48
50
  (0, external_utils_cjs_namespaceObject.setNodeEnv)('development');
49
51
  (0, external_utils_cjs_namespaceObject.setDevServer)(true);
50
52
  }
51
- const configPath = resolveConfigPath(process.cwd(), null == cliOptions ? void 0 : cliOptions.config);
53
+ const root = (null == cliOptions ? void 0 : cliOptions.root) ? external_node_path_default().resolve(cliOptions.root) : process.cwd();
54
+ const configPath = resolveConfigPath(root, null == cliOptions ? void 0 : cliOptions.config);
52
55
  let userConfig = {};
53
56
  if (configPath) {
54
57
  const jiti = (0, external_jiti_namespaceObject.createJiti)(__filename, {
@@ -83,6 +86,9 @@ async function loadConfig({ cliOptions, command }) {
83
86
  'performance',
84
87
  'bundleAnalyze'
85
88
  ], cliOptions.analyze);
89
+ if (null == cliOptions ? void 0 : cliOptions.root) (0, external_utils_cjs_namespaceObject.setValueByPath)(userConfig, [
90
+ 'root'
91
+ ], root);
86
92
  return userConfig;
87
93
  }
88
94
  function defineConfig(config) {
@@ -110,9 +116,11 @@ function resolveConfigPath(root, customConfig) {
110
116
  }
111
117
  exports.defineConfig = __webpack_exports__.defineConfig;
112
118
  exports.loadConfig = __webpack_exports__.loadConfig;
119
+ exports.resolveConfigPath = __webpack_exports__.resolveConfigPath;
113
120
  for(var __webpack_i__ in __webpack_exports__)if (-1 === [
114
121
  "defineConfig",
115
- "loadConfig"
122
+ "loadConfig",
123
+ "resolveConfigPath"
116
124
  ].indexOf(__webpack_i__)) exports[__webpack_i__] = __webpack_exports__[__webpack_i__];
117
125
  Object.defineProperty(exports, '__esModule', {
118
126
  value: true
package/dist/config.d.ts CHANGED
@@ -14,4 +14,5 @@ export declare function defineConfig(config: UnpackConfig): UnpackConfig;
14
14
  export declare function defineConfig(config: UnpackConfigSyncFn): UnpackConfigSyncFn;
15
15
  export declare function defineConfig(config: UnpackConfigAsyncFn): UnpackConfigAsyncFn;
16
16
  export declare function defineConfig(config: UnpackConfigExport): UnpackConfigExport;
17
+ export declare function resolveConfigPath(root: string, customConfig?: string): string;
17
18
  //# sourceMappingURL=config.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,UAAU,EAAE,OAAO,EAAE,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAA;AAIjF,wBAAsB,UAAU,CAAC,EAC/B,UAAU,EACV,OAAO,GACR,EAAE;IACD,UAAU,CAAC,EAAE,UAAU,CAAA;IACvB,OAAO,EAAE,OAAO,CAAA;CACjB,GAAG,OAAO,CAAC,YAAY,CAAC,CAmCxB;AAED,MAAM,MAAM,YAAY,GAAG;IACzB,GAAG,EAAE,OAAO,CAAA;IACZ,OAAO,EAAE,OAAO,CAAA;CACjB,CAAA;AAED,MAAM,MAAM,mBAAmB,GAAG,CAAC,MAAM,EAAE,YAAY,KAAK,OAAO,CAAC,YAAY,CAAC,CAAA;AACjF,MAAM,MAAM,kBAAkB,GAAG,CAAC,MAAM,EAAE,YAAY,KAAK,YAAY,CAAA;AACvE,MAAM,MAAM,kBAAkB,GAAG,YAAY,GAAG,kBAAkB,GAAG,mBAAmB,CAAA;AACxF,wBAAgB,YAAY,CAAC,MAAM,EAAE,YAAY,GAAG,YAAY,CAAA;AAChE,wBAAgB,YAAY,CAAC,MAAM,EAAE,kBAAkB,GAAG,kBAAkB,CAAA;AAC5E,wBAAgB,YAAY,CAAC,MAAM,EAAE,mBAAmB,GAAG,mBAAmB,CAAA;AAC9E,wBAAgB,YAAY,CAAC,MAAM,EAAE,kBAAkB,GAAG,kBAAkB,CAAA"}
1
+ {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,UAAU,EAAE,OAAO,EAAE,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAA;AAIjF,wBAAsB,UAAU,CAAC,EAC/B,UAAU,EACV,OAAO,GACR,EAAE;IACD,UAAU,CAAC,EAAE,UAAU,CAAA;IACvB,OAAO,EAAE,OAAO,CAAA;CACjB,GAAG,OAAO,CAAC,YAAY,CAAC,CAsCxB;AAED,MAAM,MAAM,YAAY,GAAG;IACzB,GAAG,EAAE,OAAO,CAAA;IACZ,OAAO,EAAE,OAAO,CAAA;CACjB,CAAA;AAED,MAAM,MAAM,mBAAmB,GAAG,CAAC,MAAM,EAAE,YAAY,KAAK,OAAO,CAAC,YAAY,CAAC,CAAA;AACjF,MAAM,MAAM,kBAAkB,GAAG,CAAC,MAAM,EAAE,YAAY,KAAK,YAAY,CAAA;AACvE,MAAM,MAAM,kBAAkB,GAAG,YAAY,GAAG,kBAAkB,GAAG,mBAAmB,CAAA;AACxF,wBAAgB,YAAY,CAAC,MAAM,EAAE,YAAY,GAAG,YAAY,CAAA;AAChE,wBAAgB,YAAY,CAAC,MAAM,EAAE,kBAAkB,GAAG,kBAAkB,CAAA;AAC5E,wBAAgB,YAAY,CAAC,MAAM,EAAE,mBAAmB,GAAG,mBAAmB,CAAA;AAC9E,wBAAgB,YAAY,CAAC,MAAM,EAAE,kBAAkB,GAAG,kBAAkB,CAAA;AAK5E,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,MAAM,EAAE,YAAY,CAAC,EAAE,MAAM,UAuBpE"}