@unpackjs/core 2.4.1 → 2.4.3

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 (199) hide show
  1. package/compiled/sass-loader/index.d.ts +1 -961
  2. package/compiled/sass-loader/index.js +8 -8
  3. package/compiled/sass-loader/index1.js +4 -2
  4. package/dist/index.cjs +2028 -196
  5. package/dist/index.js +1876 -39
  6. package/dist/lightningcssLoader.mjs +18 -0
  7. package/dist/typedCssModulesLoader.mjs +139 -0
  8. package/{dist → dist-types}/bundler-config/cache.d.ts +1 -1
  9. package/dist-types/bundler-config/cache.d.ts.map +1 -0
  10. package/{dist → dist-types}/bundler-config/chunkSplit.d.ts +1 -1
  11. package/dist-types/bundler-config/chunkSplit.d.ts.map +1 -0
  12. package/{dist → dist-types}/bundler-config/css.d.ts +1 -1
  13. package/dist-types/bundler-config/css.d.ts.map +1 -0
  14. package/{dist → dist-types}/bundler-config/experimentCss.d.ts +1 -1
  15. package/dist-types/bundler-config/experimentCss.d.ts.map +1 -0
  16. package/{dist → dist-types}/bundler-config/index.d.ts +1 -1
  17. package/dist-types/bundler-config/index.d.ts.map +1 -0
  18. package/{dist/lightningcss/loader.d.ts → dist-types/bundler-config/loaders/lightningcssLoader.d.ts} +2 -2
  19. package/dist-types/bundler-config/loaders/lightningcssLoader.d.ts.map +1 -0
  20. package/dist-types/bundler-config/loaders/typedCssModulesLoader.d.ts +6 -0
  21. package/dist-types/bundler-config/loaders/typedCssModulesLoader.d.ts.map +1 -0
  22. package/{dist/bundler-config → dist-types/bundler-config/plugins}/jsMinify.d.ts +1 -1
  23. package/dist-types/bundler-config/plugins/jsMinify.d.ts.map +1 -0
  24. package/{dist/lightningcss/minimizer.d.ts → dist-types/bundler-config/plugins/lightningcssMinify.d.ts} +2 -3
  25. package/dist-types/bundler-config/plugins/lightningcssMinify.d.ts.map +1 -0
  26. package/{dist/bundler-config/oxlint/plugin.d.ts → dist-types/bundler-config/plugins/oxlint/index.d.ts} +1 -1
  27. package/dist-types/bundler-config/plugins/oxlint/index.d.ts.map +1 -0
  28. package/dist-types/bundler-config/plugins/progress/helpers.d.ts.map +1 -0
  29. package/{dist/bundler-config → dist-types/bundler-config/plugins}/progress/rspack.d.ts +1 -1
  30. package/dist-types/bundler-config/plugins/progress/rspack.d.ts.map +1 -0
  31. package/{dist/bundler-config → dist-types/bundler-config/plugins}/progress/webpack.d.ts +1 -1
  32. package/dist-types/bundler-config/plugins/progress/webpack.d.ts.map +1 -0
  33. package/{dist/typed-css-modules/plugin.d.ts → dist-types/bundler-config/plugins/typedCssModules.d.ts} +2 -2
  34. package/dist-types/bundler-config/plugins/typedCssModules.d.ts.map +1 -0
  35. package/{dist → dist-types}/config.d.ts +1 -1
  36. package/dist-types/config.d.ts.map +1 -0
  37. package/{dist → dist-types}/createUnpack.d.ts +1 -1
  38. package/{dist → dist-types}/createUnpack.d.ts.map +1 -1
  39. package/{dist → dist-types}/index.d.ts +1 -1
  40. package/{dist → dist-types}/index.d.ts.map +1 -1
  41. package/dist-types/logger.d.ts +3 -0
  42. package/{dist → dist-types}/logger.d.ts.map +1 -1
  43. package/{dist → dist-types}/plugin.d.ts +1 -1
  44. package/{dist → dist-types}/plugin.d.ts.map +1 -1
  45. package/dist-types/run/build.d.ts +3 -0
  46. package/{dist → dist-types}/run/build.d.ts.map +1 -1
  47. package/{dist → dist-types}/run/dev.d.ts +1 -1
  48. package/{dist → dist-types}/run/dev.d.ts.map +1 -1
  49. package/{dist → dist-types}/types/config.d.ts +2 -2
  50. package/dist-types/types/config.d.ts.map +1 -0
  51. package/{dist → dist-types}/types/index.d.ts +1 -0
  52. package/{dist → dist-types}/types/index.d.ts.map +1 -1
  53. package/{dist → dist-types}/utils.d.ts +5 -1
  54. package/dist-types/utils.d.ts.map +1 -0
  55. package/package.json +7 -38
  56. package/dist/bundler-config/cache.cjs +0 -114
  57. package/dist/bundler-config/cache.d.ts.map +0 -1
  58. package/dist/bundler-config/cache.js +0 -72
  59. package/dist/bundler-config/chunkSplit.cjs +0 -192
  60. package/dist/bundler-config/chunkSplit.d.ts.map +0 -1
  61. package/dist/bundler-config/chunkSplit.js +0 -150
  62. package/dist/bundler-config/css.cjs +0 -189
  63. package/dist/bundler-config/css.d.ts.map +0 -1
  64. package/dist/bundler-config/css.js +0 -149
  65. package/dist/bundler-config/experimentCss.cjs +0 -214
  66. package/dist/bundler-config/experimentCss.d.ts.map +0 -1
  67. package/dist/bundler-config/experimentCss.js +0 -175
  68. package/dist/bundler-config/helpers.cjs +0 -77
  69. package/dist/bundler-config/helpers.js +0 -31
  70. package/dist/bundler-config/index.cjs +0 -309
  71. package/dist/bundler-config/index.d.ts.map +0 -1
  72. package/dist/bundler-config/index.js +0 -262
  73. package/dist/bundler-config/jsMinify.cjs +0 -113
  74. package/dist/bundler-config/jsMinify.d.ts.map +0 -1
  75. package/dist/bundler-config/jsMinify.js +0 -71
  76. package/dist/bundler-config/oxlint/plugin.cjs +0 -143
  77. package/dist/bundler-config/oxlint/plugin.d.ts.map +0 -1
  78. package/dist/bundler-config/oxlint/plugin.js +0 -104
  79. package/dist/bundler-config/progress/helpers.cjs +0 -126
  80. package/dist/bundler-config/progress/helpers.d.ts.map +0 -1
  81. package/dist/bundler-config/progress/helpers.js +0 -81
  82. package/dist/bundler-config/progress/rspack.cjs +0 -70
  83. package/dist/bundler-config/progress/rspack.d.ts.map +0 -1
  84. package/dist/bundler-config/progress/rspack.js +0 -38
  85. package/dist/bundler-config/progress/webpack.cjs +0 -87
  86. package/dist/bundler-config/progress/webpack.d.ts.map +0 -1
  87. package/dist/bundler-config/progress/webpack.js +0 -45
  88. package/dist/colors.cjs +0 -82
  89. package/dist/colors.js +0 -40
  90. package/dist/config.cjs +0 -148
  91. package/dist/config.d.ts.map +0 -1
  92. package/dist/config.js +0 -101
  93. package/dist/constants.cjs +0 -122
  94. package/dist/constants.js +0 -51
  95. package/dist/createUnpack.cjs +0 -107
  96. package/dist/createUnpack.js +0 -75
  97. package/dist/fs.cjs +0 -91
  98. package/dist/fs.js +0 -34
  99. package/dist/global.cjs +0 -36
  100. package/dist/global.js +0 -4
  101. package/dist/lightningcss/loader.cjs +0 -57
  102. package/dist/lightningcss/loader.d.ts.map +0 -1
  103. package/dist/lightningcss/loader.js +0 -25
  104. package/dist/lightningcss/minimizer.cjs +0 -94
  105. package/dist/lightningcss/minimizer.d.ts.map +0 -1
  106. package/dist/lightningcss/minimizer.js +0 -59
  107. package/dist/loadEnv.cjs +0 -122
  108. package/dist/loadEnv.js +0 -80
  109. package/dist/loadingAnimation.cjs +0 -76
  110. package/dist/loadingAnimation.js +0 -44
  111. package/dist/logger.cjs +0 -116
  112. package/dist/logger.d.ts +0 -3
  113. package/dist/logger.js +0 -74
  114. package/dist/openBrowser.cjs +0 -89
  115. package/dist/openBrowser.js +0 -49
  116. package/dist/plugin.cjs +0 -42
  117. package/dist/plugin.js +0 -10
  118. package/dist/prebundleDeps.cjs +0 -349
  119. package/dist/prebundleDeps.js +0 -303
  120. package/dist/progressBar.cjs +0 -66
  121. package/dist/progressBar.js +0 -34
  122. package/dist/reporter.cjs +0 -164
  123. package/dist/reporter.js +0 -120
  124. package/dist/run/build.cjs +0 -68
  125. package/dist/run/build.d.ts +0 -3
  126. package/dist/run/build.js +0 -26
  127. package/dist/run/dev.cjs +0 -118
  128. package/dist/run/dev.js +0 -75
  129. package/dist/run/index.cjs +0 -69
  130. package/dist/run/index.js +0 -4
  131. package/dist/typed-css-modules/loader.cjs +0 -141
  132. package/dist/typed-css-modules/loader.d.ts +0 -8
  133. package/dist/typed-css-modules/loader.d.ts.map +0 -1
  134. package/dist/typed-css-modules/loader.js +0 -92
  135. package/dist/typed-css-modules/plugin.cjs +0 -118
  136. package/dist/typed-css-modules/plugin.d.ts.map +0 -1
  137. package/dist/typed-css-modules/plugin.js +0 -75
  138. package/dist/typed-css-modules/utils.cjs +0 -46
  139. package/dist/typed-css-modules/utils.d.ts +0 -6
  140. package/dist/typed-css-modules/utils.d.ts.map +0 -1
  141. package/dist/typed-css-modules/utils.js +0 -14
  142. package/dist/types/chunkSplit.cjs +0 -18
  143. package/dist/types/chunkSplit.js +0 -2
  144. package/dist/types/config.cjs +0 -18
  145. package/dist/types/config.d.ts.map +0 -1
  146. package/dist/types/config.js +0 -2
  147. package/dist/types/index.cjs +0 -96
  148. package/dist/types/index.js +0 -7
  149. package/dist/types/lightningcss.cjs +0 -18
  150. package/dist/types/lightningcss.js +0 -2
  151. package/dist/types/logger.cjs +0 -45
  152. package/dist/types/logger.js +0 -13
  153. package/dist/types/oxc.cjs +0 -18
  154. package/dist/types/oxc.js +0 -2
  155. package/dist/types/plugin.cjs +0 -18
  156. package/dist/types/plugin.js +0 -2
  157. package/dist/utils.cjs +0 -346
  158. package/dist/utils.d.ts.map +0 -1
  159. package/dist/utils.js +0 -204
  160. package/dist/watchFiles.cjs +0 -69
  161. package/dist/watchFiles.js +0 -27
  162. /package/dist/{bundler-config/oxlint/.oxlintrc.json → .oxlintrc.json} +0 -0
  163. /package/{dist → dist-types}/bundler-config/helpers.d.ts +0 -0
  164. /package/{dist → dist-types}/bundler-config/helpers.d.ts.map +0 -0
  165. /package/{dist/bundler-config → dist-types/bundler-config/plugins}/progress/helpers.d.ts +0 -0
  166. /package/{dist → dist-types}/colors.d.ts +0 -0
  167. /package/{dist → dist-types}/colors.d.ts.map +0 -0
  168. /package/{dist → dist-types}/constants.d.ts +0 -0
  169. /package/{dist → dist-types}/constants.d.ts.map +0 -0
  170. /package/{dist → dist-types}/fs.d.ts +0 -0
  171. /package/{dist → dist-types}/fs.d.ts.map +0 -0
  172. /package/{dist → dist-types}/global.d.ts +0 -0
  173. /package/{dist → dist-types}/global.d.ts.map +0 -0
  174. /package/{dist → dist-types}/loadEnv.d.ts +0 -0
  175. /package/{dist → dist-types}/loadEnv.d.ts.map +0 -0
  176. /package/{dist → dist-types}/loadingAnimation.d.ts +0 -0
  177. /package/{dist → dist-types}/loadingAnimation.d.ts.map +0 -0
  178. /package/{dist → dist-types}/openBrowser.d.ts +0 -0
  179. /package/{dist → dist-types}/openBrowser.d.ts.map +0 -0
  180. /package/{dist → dist-types}/prebundleDeps.d.ts +0 -0
  181. /package/{dist → dist-types}/prebundleDeps.d.ts.map +0 -0
  182. /package/{dist → dist-types}/progressBar.d.ts +0 -0
  183. /package/{dist → dist-types}/progressBar.d.ts.map +0 -0
  184. /package/{dist → dist-types}/reporter.d.ts +0 -0
  185. /package/{dist → dist-types}/reporter.d.ts.map +0 -0
  186. /package/{dist → dist-types}/run/index.d.ts +0 -0
  187. /package/{dist → dist-types}/run/index.d.ts.map +0 -0
  188. /package/{dist → dist-types}/types/chunkSplit.d.ts +0 -0
  189. /package/{dist → dist-types}/types/chunkSplit.d.ts.map +0 -0
  190. /package/{dist → dist-types}/types/lightningcss.d.ts +0 -0
  191. /package/{dist → dist-types}/types/lightningcss.d.ts.map +0 -0
  192. /package/{dist → dist-types}/types/logger.d.ts +0 -0
  193. /package/{dist → dist-types}/types/logger.d.ts.map +0 -0
  194. /package/{dist → dist-types}/types/oxc.d.ts +0 -0
  195. /package/{dist → dist-types}/types/oxc.d.ts.map +0 -0
  196. /package/{dist → dist-types}/types/plugin.d.ts +0 -0
  197. /package/{dist → dist-types}/types/plugin.d.ts.map +0 -0
  198. /package/{dist → dist-types}/watchFiles.d.ts +0 -0
  199. /package/{dist → dist-types}/watchFiles.d.ts.map +0 -0
@@ -1,104 +0,0 @@
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 };
@@ -1,126 +0,0 @@
1
- "use strict";
2
- var __webpack_require__ = {};
3
- (()=>{
4
- __webpack_require__.n = (module)=>{
5
- var getter = module && module.__esModule ? ()=>module['default'] : ()=>module;
6
- __webpack_require__.d(getter, {
7
- a: getter
8
- });
9
- return getter;
10
- };
11
- })();
12
- (()=>{
13
- __webpack_require__.d = (exports1, definition)=>{
14
- for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
15
- enumerable: true,
16
- get: definition[key]
17
- });
18
- };
19
- })();
20
- (()=>{
21
- __webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
22
- })();
23
- (()=>{
24
- __webpack_require__.r = (exports1)=>{
25
- if ('undefined' != typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
26
- value: 'Module'
27
- });
28
- Object.defineProperty(exports1, '__esModule', {
29
- value: true
30
- });
31
- };
32
- })();
33
- var __webpack_exports__ = {};
34
- __webpack_require__.r(__webpack_exports__);
35
- __webpack_require__.d(__webpack_exports__, {
36
- compileDone: ()=>compileDone,
37
- printDevLog: ()=>printDevLog
38
- });
39
- const external_node_path_namespaceObject = require("node:path");
40
- var external_node_path_default = /*#__PURE__*/ __webpack_require__.n(external_node_path_namespaceObject);
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");
45
- function cutPath(originalFilePath, root) {
46
- const prefix = root.endsWith(external_node_path_namespaceObject.sep) ? root : root + external_node_path_namespaceObject.sep;
47
- let filePath = originalFilePath;
48
- if (filePath.startsWith(prefix)) filePath = filePath.slice(prefix.length);
49
- const parts = filePath.split(external_node_path_namespaceObject.sep).filter(Boolean);
50
- return parts.length > 3 ? parts.slice(-3).join(external_node_path_namespaceObject.sep) : parts.join(external_node_path_namespaceObject.sep);
51
- }
52
- function isLikelyFile(filePath) {
53
- const lastSegment = filePath.split(external_node_path_namespaceObject.sep).pop() || '';
54
- return lastSegment.includes('.');
55
- }
56
- function formatFileList(paths, rootPath) {
57
- let files = paths.filter(isLikelyFile);
58
- if (0 === files.length) files = [
59
- paths[0]
60
- ];
61
- const fileInfo = files.slice(0, 1).map((file)=>cutPath(file, rootPath)).join(', ');
62
- if (files.length > 1) return `${fileInfo} and ${files.length - 1} more`;
63
- return fileInfo;
64
- }
65
- function printDevLog(compiler, root) {
66
- const changedFiles = compiler.modifiedFiles ? Array.from(compiler.modifiedFiles) : null;
67
- if (null == changedFiles ? void 0 : changedFiles.length) {
68
- const fileInfo = formatFileList(changedFiles, root);
69
- external_logger_cjs_namespaceObject.logger.wait(`building ${external_colors_cjs_namespaceObject.colors.dim(fileInfo)}`);
70
- return;
71
- }
72
- const removedFiles = compiler.removedFiles ? Array.from(compiler.removedFiles) : null;
73
- if (null == removedFiles ? void 0 : removedFiles.length) {
74
- const fileInfo = formatFileList(removedFiles, root);
75
- external_logger_cjs_namespaceObject.logger.wait(`building ${external_colors_cjs_namespaceObject.colors.dim(`removed ${fileInfo}`)}`);
76
- return;
77
- }
78
- external_logger_cjs_namespaceObject.logger.wait('building...');
79
- }
80
- async function compileDone(compiler, stats) {
81
- const statsJson = stats.toJson({
82
- preset: 'errors-only',
83
- timings: true
84
- });
85
- const compileTime = statsJson.time / 1000;
86
- const root = compiler.options.context;
87
- if (!stats.hasErrors()) if ((0, external_utils_cjs_namespaceObject.isProd)()) {
88
- (0, external_utils_cjs_namespaceObject.isCI)() || await (0, external_reporter_cjs_namespaceObject.printFileSize)({
89
- root,
90
- stats
91
- });
92
- external_logger_cjs_namespaceObject.logger.ready(external_colors_cjs_namespaceObject.colors.green(`built in ${(0, external_utils_cjs_namespaceObject.prettyTime)(compileTime)}`));
93
- } else {
94
- if ((0, external_utils_cjs_namespaceObject.isDebug)()) {
95
- const modules = stats.compilation.modules;
96
- const nodeModulesStats = new Map();
97
- const nodeModulesPath = external_node_path_default().resolve(root, 'node_modules');
98
- modules.forEach((module)=>{
99
- const { resource } = module;
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 = '.pnpm' === pathParts[0] && pathParts.length >= 4 ? pathParts[3].startsWith('@') ? `${pathParts[3]}/${pathParts[4]}` : pathParts[3] : pathParts[0].startsWith('@') ? `${pathParts[0]}/${pathParts[1]}` : pathParts[0];
105
- if (packageName) nodeModulesStats.set(packageName, (nodeModulesStats.get(packageName) || 0) + 1);
106
- }
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
- }
114
- }
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)` : ''}`);
116
- }
117
- }
118
- exports.compileDone = __webpack_exports__.compileDone;
119
- exports.printDevLog = __webpack_exports__.printDevLog;
120
- for(var __webpack_i__ in __webpack_exports__)if (-1 === [
121
- "compileDone",
122
- "printDevLog"
123
- ].indexOf(__webpack_i__)) exports[__webpack_i__] = __webpack_exports__[__webpack_i__];
124
- Object.defineProperty(exports, '__esModule', {
125
- value: true
126
- });
@@ -1 +0,0 @@
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,QAclE;AAED,wBAAsB,WAAW,CAAC,QAAQ,EAAE,MAAM,CAAC,QAAQ,EAAE,KAAK,EAAE,MAAM,CAAC,KAAK,iBA4D/E"}
@@ -1,81 +0,0 @@
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 { isCI, 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('building...');
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
- isCI() || 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 = '.pnpm' === pathParts[0] && pathParts.length >= 4 ? pathParts[3].startsWith('@') ? `${pathParts[3]}/${pathParts[4]}` : pathParts[3] : 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 };
@@ -1,70 +0,0 @@
1
- "use strict";
2
- var __webpack_require__ = {};
3
- (()=>{
4
- __webpack_require__.d = (exports1, definition)=>{
5
- for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
6
- enumerable: true,
7
- get: definition[key]
8
- });
9
- };
10
- })();
11
- (()=>{
12
- __webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
13
- })();
14
- (()=>{
15
- __webpack_require__.r = (exports1)=>{
16
- if ('undefined' != typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
17
- value: 'Module'
18
- });
19
- Object.defineProperty(exports1, '__esModule', {
20
- value: true
21
- });
22
- };
23
- })();
24
- var __webpack_exports__ = {};
25
- __webpack_require__.r(__webpack_exports__);
26
- __webpack_require__.d(__webpack_exports__, {
27
- ProgressRspackPlugin: ()=>ProgressRspackPlugin
28
- });
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_helpers_cjs_namespaceObject = require("./helpers.cjs");
33
- function _define_property(obj, key, value) {
34
- if (key in obj) Object.defineProperty(obj, key, {
35
- value: value,
36
- enumerable: true,
37
- configurable: true,
38
- writable: true
39
- });
40
- else obj[key] = value;
41
- return obj;
42
- }
43
- const PLUGIN_NAME = 'ProgressPlugin';
44
- class ProgressRspackPlugin extends core_namespaceObject.rspack.ProgressPlugin {
45
- apply(compiler) {
46
- super.apply(compiler);
47
- compiler.hooks.watchRun.tap(PLUGIN_NAME, ()=>{
48
- if ((0, external_utils_cjs_namespaceObject.isDevServer)() && !global.__unpack_dev_server_started) return;
49
- (0, external_helpers_cjs_namespaceObject.printDevLog)(compiler, compiler.options.context);
50
- });
51
- compiler.hooks.afterDone.tap(PLUGIN_NAME, async (stats)=>{
52
- await (0, external_helpers_cjs_namespaceObject.compileDone)(compiler, stats);
53
- });
54
- }
55
- constructor(){
56
- super((percentage, msg, ...args)=>{
57
- (0, external_utils_cjs_namespaceObject.isProd)() && this.progressBar.update({
58
- current: percentage,
59
- message: `${msg} ${args.join(' ')}`
60
- });
61
- }), _define_property(this, "progressBar", new external_progressBar_cjs_namespaceObject.ProgressBar());
62
- }
63
- }
64
- exports.ProgressRspackPlugin = __webpack_exports__.ProgressRspackPlugin;
65
- for(var __webpack_i__ in __webpack_exports__)if (-1 === [
66
- "ProgressRspackPlugin"
67
- ].indexOf(__webpack_i__)) exports[__webpack_i__] = __webpack_exports__[__webpack_i__];
68
- Object.defineProperty(exports, '__esModule', {
69
- value: true
70
- });
@@ -1 +0,0 @@
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;CAUhC"}
@@ -1,38 +0,0 @@
1
- import 'module';
2
- /*#__PURE__*/ import.meta.url;
3
- import { rspack } from "@rspack/core";
4
- import { ProgressBar } from "../../progressBar.js";
5
- import { isDevServer, 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
- if (isDevServer() && !global.__unpack_dev_server_started) return;
23
- printDevLog(compiler, compiler.options.context);
24
- });
25
- compiler.hooks.afterDone.tap(PLUGIN_NAME, async (stats)=>{
26
- await compileDone(compiler, stats);
27
- });
28
- }
29
- constructor(){
30
- super((percentage, msg, ...args)=>{
31
- isProd() && this.progressBar.update({
32
- current: percentage,
33
- message: `${msg} ${args.join(' ')}`
34
- });
35
- }), _define_property(this, "progressBar", new ProgressBar());
36
- }
37
- }
38
- export { ProgressRspackPlugin };
@@ -1,87 +0,0 @@
1
- "use strict";
2
- var __webpack_require__ = {};
3
- (()=>{
4
- __webpack_require__.n = (module)=>{
5
- var getter = module && module.__esModule ? ()=>module['default'] : ()=>module;
6
- __webpack_require__.d(getter, {
7
- a: getter
8
- });
9
- return getter;
10
- };
11
- })();
12
- (()=>{
13
- __webpack_require__.d = (exports1, definition)=>{
14
- for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
15
- enumerable: true,
16
- get: definition[key]
17
- });
18
- };
19
- })();
20
- (()=>{
21
- __webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
22
- })();
23
- (()=>{
24
- __webpack_require__.r = (exports1)=>{
25
- if ('undefined' != typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
26
- value: 'Module'
27
- });
28
- Object.defineProperty(exports1, '__esModule', {
29
- value: true
30
- });
31
- };
32
- })();
33
- var __webpack_exports__ = {};
34
- __webpack_require__.r(__webpack_exports__);
35
- __webpack_require__.d(__webpack_exports__, {
36
- ProgressWebpackPlugin: ()=>ProgressWebpackPlugin
37
- });
38
- const external_progressBar_cjs_namespaceObject = require("../../progressBar.cjs");
39
- const external_utils_cjs_namespaceObject = require("../../utils.cjs");
40
- const external_webpack_namespaceObject = require("webpack");
41
- var external_webpack_default = /*#__PURE__*/ __webpack_require__.n(external_webpack_namespaceObject);
42
- const external_helpers_cjs_namespaceObject = require("./helpers.cjs");
43
- function _define_property(obj, key, value) {
44
- if (key in obj) Object.defineProperty(obj, key, {
45
- value: value,
46
- enumerable: true,
47
- configurable: true,
48
- writable: true
49
- });
50
- else obj[key] = value;
51
- return obj;
52
- }
53
- const PLUGIN_NAME = 'ProgressPlugin';
54
- class ProgressWebpackPlugin extends external_webpack_default().ProgressPlugin {
55
- apply(compiler) {
56
- super.apply(compiler);
57
- compiler.hooks.watchRun.tap(PLUGIN_NAME, ()=>{
58
- if ((0, external_utils_cjs_namespaceObject.isDevServer)() && !global.__unpack_dev_server_started) return;
59
- (0, external_helpers_cjs_namespaceObject.printDevLog)(compiler, compiler.options.context);
60
- });
61
- compiler.hooks.afterDone.tap(PLUGIN_NAME, async (stats)=>{
62
- this.isCompleted = true;
63
- await (0, external_helpers_cjs_namespaceObject.compileDone)(compiler, stats);
64
- });
65
- }
66
- constructor(){
67
- super({
68
- entries: false,
69
- dependencies: false,
70
- activeModules: true,
71
- handler: (0, external_utils_cjs_namespaceObject.isProd)() ? (percentage, msg, ...args)=>{
72
- if (this.isCompleted) return;
73
- this.progressBar.update({
74
- current: percentage,
75
- message: `${msg} ${args.join(' ').replace(/(\d+) active /, '')}`
76
- });
77
- } : void 0
78
- }), _define_property(this, "progressBar", new external_progressBar_cjs_namespaceObject.ProgressBar()), _define_property(this, "isCompleted", false);
79
- }
80
- }
81
- exports.ProgressWebpackPlugin = __webpack_exports__.ProgressWebpackPlugin;
82
- for(var __webpack_i__ in __webpack_exports__)if (-1 === [
83
- "ProgressWebpackPlugin"
84
- ].indexOf(__webpack_i__)) exports[__webpack_i__] = __webpack_exports__[__webpack_i__];
85
- Object.defineProperty(exports, '__esModule', {
86
- value: true
87
- });
@@ -1 +0,0 @@
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;CAaxC"}
@@ -1,45 +0,0 @@
1
- import 'module';
2
- /*#__PURE__*/ import.meta.url;
3
- import { ProgressBar } from "../../progressBar.js";
4
- import { isDevServer, 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
- if (isDevServer() && !global.__unpack_dev_server_started) return;
23
- printDevLog(compiler, compiler.options.context);
24
- });
25
- compiler.hooks.afterDone.tap(PLUGIN_NAME, async (stats)=>{
26
- this.isCompleted = true;
27
- await compileDone(compiler, stats);
28
- });
29
- }
30
- constructor(){
31
- super({
32
- entries: false,
33
- dependencies: false,
34
- activeModules: true,
35
- handler: isProd() ? (percentage, msg, ...args)=>{
36
- if (this.isCompleted) return;
37
- this.progressBar.update({
38
- current: percentage,
39
- message: `${msg} ${args.join(' ').replace(/(\d+) active /, '')}`
40
- });
41
- } : void 0
42
- }), _define_property(this, "progressBar", new ProgressBar()), _define_property(this, "isCompleted", false);
43
- }
44
- }
45
- export { ProgressWebpackPlugin };
package/dist/colors.cjs DELETED
@@ -1,82 +0,0 @@
1
- "use strict";
2
- var __webpack_require__ = {};
3
- (()=>{
4
- __webpack_require__.n = (module)=>{
5
- var getter = module && module.__esModule ? ()=>module['default'] : ()=>module;
6
- __webpack_require__.d(getter, {
7
- a: getter
8
- });
9
- return getter;
10
- };
11
- })();
12
- (()=>{
13
- __webpack_require__.d = (exports1, definition)=>{
14
- for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
15
- enumerable: true,
16
- get: definition[key]
17
- });
18
- };
19
- })();
20
- (()=>{
21
- __webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
22
- })();
23
- (()=>{
24
- __webpack_require__.r = (exports1)=>{
25
- if ('undefined' != typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
26
- value: 'Module'
27
- });
28
- Object.defineProperty(exports1, '__esModule', {
29
- value: true
30
- });
31
- };
32
- })();
33
- var __webpack_exports__ = {};
34
- __webpack_require__.r(__webpack_exports__);
35
- __webpack_require__.d(__webpack_exports__, {
36
- colors: ()=>colors
37
- });
38
- const external_picocolors_namespaceObject = require("picocolors");
39
- var external_picocolors_default = /*#__PURE__*/ __webpack_require__.n(external_picocolors_namespaceObject);
40
- const colors = {
41
- ...external_picocolors_default(),
42
- rainbow: (input)=>{
43
- const startColor = [
44
- 97,
45
- 193,
46
- 198
47
- ];
48
- const endColor = [
49
- 48,
50
- 112,
51
- 198
52
- ];
53
- const isWord = (char)=>!/[\s\n]/.test(char);
54
- const chars = [
55
- ...input
56
- ];
57
- const steps = chars.filter(isWord).length;
58
- let r = startColor[0];
59
- let g = startColor[1];
60
- let b = startColor[2];
61
- const rStep = (endColor[0] - r) / steps;
62
- const gStep = (endColor[1] - g) / steps;
63
- const bStep = (endColor[2] - b) / steps;
64
- let output = '';
65
- for (const char of chars){
66
- if (isWord(char)) {
67
- r += rStep;
68
- g += gStep;
69
- b += bStep;
70
- }
71
- output += `\x1b[38;2;${Math.round(r)};${Math.round(g)};${Math.round(b)}m${char}\x1b[39m`;
72
- }
73
- return output;
74
- }
75
- };
76
- exports.colors = __webpack_exports__.colors;
77
- for(var __webpack_i__ in __webpack_exports__)if (-1 === [
78
- "colors"
79
- ].indexOf(__webpack_i__)) exports[__webpack_i__] = __webpack_exports__[__webpack_i__];
80
- Object.defineProperty(exports, '__esModule', {
81
- value: true
82
- });