@unpackjs/core 2.0.0 → 2.2.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.
- package/compiled/css-loader/index.js +46 -46
- package/compiled/less-loader/index.js +8 -8
- package/compiled/postcss-loader/index.js +11 -11
- package/compiled/sass-loader/index.js +8 -8
- package/compiled/style-loader/index.js +10 -10
- package/dist/bundler-config/cache.cjs +105 -0
- package/dist/bundler-config/cache.d.ts +6 -0
- package/dist/bundler-config/cache.d.ts.map +1 -0
- package/dist/bundler-config/cache.js +63 -0
- package/dist/bundler-config/chunkSplit.js +7 -7
- package/dist/bundler-config/css.cjs +4 -3
- package/dist/bundler-config/css.d.ts.map +1 -1
- package/dist/bundler-config/css.js +33 -32
- package/dist/bundler-config/experimentCss.cjs +4 -3
- package/dist/bundler-config/experimentCss.d.ts.map +1 -1
- package/dist/bundler-config/experimentCss.js +29 -28
- package/dist/bundler-config/{helper.cjs → helpers.cjs} +2 -2
- package/dist/bundler-config/{helper.d.ts → helpers.d.ts} +1 -1
- package/dist/bundler-config/helpers.d.ts.map +1 -0
- package/dist/bundler-config/helpers.js +39 -0
- package/dist/bundler-config/index.cjs +26 -17
- package/dist/bundler-config/index.d.ts.map +1 -1
- package/dist/bundler-config/index.js +68 -59
- package/dist/bundler-config/jsMinify.cjs +15 -16
- package/dist/bundler-config/jsMinify.d.ts +3 -11
- package/dist/bundler-config/jsMinify.d.ts.map +1 -1
- package/dist/bundler-config/jsMinify.js +17 -18
- package/dist/bundler-config/oxlint/.oxlintrc.json +30 -0
- package/dist/bundler-config/oxlint/plugin.cjs +143 -0
- package/dist/bundler-config/oxlint/plugin.d.ts +10 -0
- package/dist/bundler-config/oxlint/plugin.d.ts.map +1 -0
- package/dist/bundler-config/oxlint/plugin.js +104 -0
- package/dist/bundler-config/progress/helpers.cjs +112 -0
- package/dist/bundler-config/progress/helpers.d.ts +4 -0
- package/dist/bundler-config/progress/helpers.d.ts.map +1 -0
- package/dist/bundler-config/progress/helpers.js +67 -0
- package/dist/bundler-config/progress/rspack.cjs +69 -0
- package/dist/bundler-config/progress/rspack.d.ts +8 -0
- package/dist/bundler-config/progress/rspack.d.ts.map +1 -0
- package/dist/bundler-config/progress/rspack.js +37 -0
- package/dist/bundler-config/progress/webpack.cjs +86 -0
- package/dist/bundler-config/progress/webpack.d.ts +9 -0
- package/dist/bundler-config/progress/webpack.d.ts.map +1 -0
- package/dist/bundler-config/progress/webpack.js +44 -0
- package/dist/colors.cjs +3 -4
- package/dist/colors.d.ts +1 -2
- package/dist/colors.d.ts.map +1 -1
- package/dist/colors.js +3 -4
- package/dist/config.cjs +5 -2
- package/dist/config.d.ts +1 -0
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +19 -19
- package/dist/constants.cjs +7 -11
- package/dist/constants.d.ts +0 -1
- package/dist/constants.d.ts.map +1 -1
- package/dist/constants.js +3 -4
- package/dist/createUnpack.cjs +2 -12
- package/dist/createUnpack.js +19 -19
- package/dist/fs.cjs +82 -0
- package/dist/fs.d.ts +11 -0
- package/dist/fs.d.ts.map +1 -0
- package/dist/fs.js +28 -0
- package/dist/index.cjs +19 -20
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +6 -42
- package/dist/lightningcss/loader.cjs +0 -2
- package/dist/lightningcss/loader.d.ts.map +1 -1
- package/dist/lightningcss/loader.js +4 -6
- package/dist/lightningcss/minimizer.cjs +7 -9
- package/dist/lightningcss/minimizer.d.ts.map +1 -1
- package/dist/lightningcss/minimizer.js +9 -11
- package/dist/logger.cjs +7 -7
- package/dist/logger.d.ts.map +1 -1
- package/dist/logger.js +12 -11
- package/dist/openBrowser.js +7 -7
- package/dist/prebundleDeps.cjs +5 -5
- package/dist/prebundleDeps.d.ts.map +1 -1
- package/dist/prebundleDeps.js +49 -48
- package/dist/progressBar.cjs +3 -24
- package/dist/progressBar.d.ts +1 -6
- package/dist/progressBar.d.ts.map +1 -1
- package/dist/progressBar.js +5 -16
- package/dist/reporter.cjs +17 -9
- package/dist/reporter.d.ts.map +1 -1
- package/dist/reporter.js +31 -22
- package/dist/run/build.js +8 -8
- package/dist/run/dev.cjs +3 -4
- package/dist/run/dev.d.ts.map +1 -1
- package/dist/run/dev.js +23 -23
- package/dist/typed-css-modules/loader.js +12 -12
- package/dist/typed-css-modules/plugin.cjs +1 -1
- package/dist/typed-css-modules/plugin.js +13 -13
- package/dist/typed-css-modules/utils.js +6 -6
- package/dist/types/config.d.ts +2 -0
- package/dist/types/config.d.ts.map +1 -1
- package/dist/types/oxc.cjs +18 -0
- package/dist/types/oxc.d.ts +10 -0
- package/dist/types/oxc.d.ts.map +1 -0
- package/dist/types/oxc.js +2 -0
- package/dist/utils.cjs +29 -26
- package/dist/utils.d.ts +1 -0
- package/dist/utils.d.ts.map +1 -1
- package/dist/utils.js +18 -17
- package/dist/watchFiles.js +4 -4
- package/package.json +6 -6
- package/dist/bundler-config/helper.d.ts.map +0 -1
- package/dist/bundler-config/helper.js +0 -39
- package/dist/plugin-progress/rspack.cjs +0 -103
- package/dist/plugin-progress/rspack.d.ts +0 -9
- package/dist/plugin-progress/rspack.d.ts.map +0 -1
- package/dist/plugin-progress/rspack.js +0 -60
- package/dist/plugin-progress/webpack.cjs +0 -110
- package/dist/plugin-progress/webpack.d.ts +0 -9
- package/dist/plugin-progress/webpack.d.ts.map +0 -1
- package/dist/plugin-progress/webpack.js +0 -66
|
@@ -0,0 +1,143 @@
|
|
|
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
|
+
OxlintPlugin: ()=>OxlintPlugin
|
|
37
|
+
});
|
|
38
|
+
const external_node_child_process_namespaceObject = require("node:child_process");
|
|
39
|
+
const external_node_path_namespaceObject = require("node:path");
|
|
40
|
+
var external_node_path_default = /*#__PURE__*/ __webpack_require__.n(external_node_path_namespaceObject);
|
|
41
|
+
function _define_property(obj, key, value) {
|
|
42
|
+
if (key in obj) Object.defineProperty(obj, key, {
|
|
43
|
+
value: value,
|
|
44
|
+
enumerable: true,
|
|
45
|
+
configurable: true,
|
|
46
|
+
writable: true
|
|
47
|
+
});
|
|
48
|
+
else obj[key] = value;
|
|
49
|
+
return obj;
|
|
50
|
+
}
|
|
51
|
+
class OxlintPlugin {
|
|
52
|
+
getGitChangedFiles() {
|
|
53
|
+
return new Promise((resolve)=>{
|
|
54
|
+
var _child_stdout;
|
|
55
|
+
const child = (0, external_node_child_process_namespaceObject.spawn)('git', [
|
|
56
|
+
'status',
|
|
57
|
+
'--porcelain'
|
|
58
|
+
], {
|
|
59
|
+
cwd: process.cwd(),
|
|
60
|
+
stdio: 'pipe'
|
|
61
|
+
});
|
|
62
|
+
let output = '';
|
|
63
|
+
null == (_child_stdout = child.stdout) || _child_stdout.on('data', (data)=>{
|
|
64
|
+
output += data.toString();
|
|
65
|
+
});
|
|
66
|
+
child.on('exit', (code)=>{
|
|
67
|
+
if (0 === code) {
|
|
68
|
+
const files = output.trim().split('\n').filter(Boolean).map((line)=>{
|
|
69
|
+
const idx = line.indexOf(' ');
|
|
70
|
+
const status = line.slice(0, idx);
|
|
71
|
+
let filePath = line.slice(idx + 1).trim();
|
|
72
|
+
if (status.includes('D')) return null;
|
|
73
|
+
if (status.startsWith('R') || status.startsWith('C')) filePath = filePath.split(' -> ')[1];
|
|
74
|
+
return filePath;
|
|
75
|
+
}).filter(Boolean).map((file)=>external_node_path_default().resolve(process.cwd(), file));
|
|
76
|
+
resolve(files);
|
|
77
|
+
} else resolve([]);
|
|
78
|
+
});
|
|
79
|
+
child.on('error', ()=>{
|
|
80
|
+
resolve([]);
|
|
81
|
+
});
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
runOxlint(args) {
|
|
85
|
+
var _child_stdout, _child_stderr;
|
|
86
|
+
const cwd = process.cwd();
|
|
87
|
+
const child = (0, external_node_child_process_namespaceObject.spawn)('npx', [
|
|
88
|
+
'--yes',
|
|
89
|
+
...args
|
|
90
|
+
], {
|
|
91
|
+
cwd,
|
|
92
|
+
stdio: 'pipe',
|
|
93
|
+
shell: true,
|
|
94
|
+
env: {
|
|
95
|
+
...process.env,
|
|
96
|
+
FORCE_COLOR: '1'
|
|
97
|
+
}
|
|
98
|
+
});
|
|
99
|
+
let output = '';
|
|
100
|
+
null == (_child_stdout = child.stdout) || _child_stdout.on('data', (data)=>{
|
|
101
|
+
output += data.toString();
|
|
102
|
+
});
|
|
103
|
+
child.on('exit', (code)=>{
|
|
104
|
+
const hasErrors = !output.includes('Found 0 warnings and 0 errors');
|
|
105
|
+
if (hasErrors || 0 !== code) process.stdout.write(output);
|
|
106
|
+
});
|
|
107
|
+
null == (_child_stderr = child.stderr) || _child_stderr.on('data', (data)=>{
|
|
108
|
+
process.stderr.write(data);
|
|
109
|
+
});
|
|
110
|
+
}
|
|
111
|
+
apply(compiler) {
|
|
112
|
+
compiler.hooks.watchRun.tap('OxlintPlugin', ()=>{
|
|
113
|
+
if (this.timeoutId) clearTimeout(this.timeoutId);
|
|
114
|
+
this.timeoutId = setTimeout(()=>{
|
|
115
|
+
const configPath = external_node_path_default().resolve(__dirname, '.oxlintrc.json');
|
|
116
|
+
this.getGitChangedFiles().then((changedFiles)=>{
|
|
117
|
+
if (changedFiles.length > 0) {
|
|
118
|
+
const args = [
|
|
119
|
+
'oxlint',
|
|
120
|
+
'-c',
|
|
121
|
+
configPath,
|
|
122
|
+
...changedFiles,
|
|
123
|
+
'--fix',
|
|
124
|
+
'--fix-suggestions'
|
|
125
|
+
];
|
|
126
|
+
this.runOxlint(args);
|
|
127
|
+
}
|
|
128
|
+
});
|
|
129
|
+
}, this.debounceTime);
|
|
130
|
+
});
|
|
131
|
+
}
|
|
132
|
+
constructor(){
|
|
133
|
+
_define_property(this, "timeoutId", null);
|
|
134
|
+
_define_property(this, "debounceTime", 300);
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
exports.OxlintPlugin = __webpack_exports__.OxlintPlugin;
|
|
138
|
+
for(var __webpack_i__ in __webpack_exports__)if (-1 === [
|
|
139
|
+
"OxlintPlugin"
|
|
140
|
+
].indexOf(__webpack_i__)) exports[__webpack_i__] = __webpack_exports__[__webpack_i__];
|
|
141
|
+
Object.defineProperty(exports, '__esModule', {
|
|
142
|
+
value: true
|
|
143
|
+
});
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { Compiler } from '@rspack/core';
|
|
2
|
+
declare class OxlintPlugin {
|
|
3
|
+
private timeoutId;
|
|
4
|
+
private readonly debounceTime;
|
|
5
|
+
private getGitChangedFiles;
|
|
6
|
+
private runOxlint;
|
|
7
|
+
apply(compiler: Compiler): void;
|
|
8
|
+
}
|
|
9
|
+
export { OxlintPlugin };
|
|
10
|
+
//# sourceMappingURL=plugin.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../../../src/bundler-config/oxlint/plugin.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAA;AAE5C,cAAM,YAAY;IAChB,OAAO,CAAC,SAAS,CAA8B;IAC/C,OAAO,CAAC,QAAQ,CAAC,YAAY,CAAM;IAEnC,OAAO,CAAC,kBAAkB;IAmD1B,OAAO,CAAC,SAAS;IA+BjB,KAAK,CAAC,QAAQ,EAAE,QAAQ,GAAG,IAAI;CAyBhC;AAED,OAAO,EAAE,YAAY,EAAE,CAAA"}
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
import __rslib_shim_module__ from '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 external_node_path_default 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)=>external_node_path_default.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 = external_node_path_default.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", 300);
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
export { OxlintPlugin };
|
|
@@ -0,0 +1,112 @@
|
|
|
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('build started...');
|
|
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
|
+
await (0, external_reporter_cjs_namespaceObject.printFileSize)({
|
|
89
|
+
root,
|
|
90
|
+
stats
|
|
91
|
+
});
|
|
92
|
+
console.log(external_colors_cjs_namespaceObject.colors.green(`\u{2713} 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
|
+
modules.forEach((module)=>{
|
|
97
|
+
const { resource } = module;
|
|
98
|
+
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));
|
|
99
|
+
});
|
|
100
|
+
}
|
|
101
|
+
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)` : ''}`);
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
exports.compileDone = __webpack_exports__.compileDone;
|
|
105
|
+
exports.printDevLog = __webpack_exports__.printDevLog;
|
|
106
|
+
for(var __webpack_i__ in __webpack_exports__)if (-1 === [
|
|
107
|
+
"compileDone",
|
|
108
|
+
"printDevLog"
|
|
109
|
+
].indexOf(__webpack_i__)) exports[__webpack_i__] = __webpack_exports__[__webpack_i__];
|
|
110
|
+
Object.defineProperty(exports, '__esModule', {
|
|
111
|
+
value: true
|
|
112
|
+
});
|
|
@@ -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,iBA2B/E"}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import __rslib_shim_module__ from 'module';
|
|
2
|
+
/*#__PURE__*/ import.meta.url;
|
|
3
|
+
import external_node_path_default, { 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
|
+
console.log(colors.green(`\u{2713} built in ${prettyTime(compileTime)}`));
|
|
56
|
+
} else {
|
|
57
|
+
if (isDebug()) {
|
|
58
|
+
const modules = stats.compilation.modules;
|
|
59
|
+
modules.forEach((module)=>{
|
|
60
|
+
const { resource } = module;
|
|
61
|
+
if (null == resource ? void 0 : resource.includes(external_node_path_default.resolve(root, 'node_modules'))) logger.debug(external_node_path_default.relative(root, resource));
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
logger.ready(`built in ${prettyTime(compileTime)}${isDebug() ? ` (${stats.compilation.modules.size} modules)` : ''}`);
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
export { compileDone, printDevLog };
|
|
@@ -0,0 +1,69 @@
|
|
|
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
|
+
(0, external_helpers_cjs_namespaceObject.printDevLog)(compiler, compiler.options.context);
|
|
49
|
+
});
|
|
50
|
+
compiler.hooks.done.tap(PLUGIN_NAME, async (stats)=>{
|
|
51
|
+
await (0, external_helpers_cjs_namespaceObject.compileDone)(compiler, stats);
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
constructor(){
|
|
55
|
+
super((percentage, msg, ...args)=>{
|
|
56
|
+
(0, external_utils_cjs_namespaceObject.isProd)() && this.progressBar.update({
|
|
57
|
+
current: percentage,
|
|
58
|
+
message: `${msg} ${args.join(' ')}`
|
|
59
|
+
});
|
|
60
|
+
}), _define_property(this, "progressBar", new external_progressBar_cjs_namespaceObject.ProgressBar());
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
exports.ProgressRspackPlugin = __webpack_exports__.ProgressRspackPlugin;
|
|
64
|
+
for(var __webpack_i__ in __webpack_exports__)if (-1 === [
|
|
65
|
+
"ProgressRspackPlugin"
|
|
66
|
+
].indexOf(__webpack_i__)) exports[__webpack_i__] = __webpack_exports__[__webpack_i__];
|
|
67
|
+
Object.defineProperty(exports, '__esModule', {
|
|
68
|
+
value: true
|
|
69
|
+
});
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { type Compiler, rspack } from '@rspack/core';
|
|
2
|
+
import { ProgressBar } from '../../progressBar';
|
|
3
|
+
export declare class ProgressRspackPlugin extends rspack.ProgressPlugin {
|
|
4
|
+
progressBar: ProgressBar;
|
|
5
|
+
constructor();
|
|
6
|
+
apply(compiler: Compiler): void;
|
|
7
|
+
}
|
|
8
|
+
//# sourceMappingURL=rspack.d.ts.map
|
|
@@ -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 __rslib_shim_module__ from '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.done.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 };
|
|
@@ -0,0 +1,86 @@
|
|
|
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
|
+
(0, external_helpers_cjs_namespaceObject.printDevLog)(compiler, compiler.options.context);
|
|
59
|
+
});
|
|
60
|
+
compiler.hooks.done.tap(PLUGIN_NAME, async (stats)=>{
|
|
61
|
+
await (0, external_helpers_cjs_namespaceObject.compileDone)(compiler, stats);
|
|
62
|
+
this.isCompleted = true;
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
constructor(){
|
|
66
|
+
super({
|
|
67
|
+
entries: false,
|
|
68
|
+
dependencies: false,
|
|
69
|
+
activeModules: true,
|
|
70
|
+
handler: (0, external_utils_cjs_namespaceObject.isProd)() ? (percentage, msg, ...args)=>{
|
|
71
|
+
if (this.isCompleted) return;
|
|
72
|
+
this.progressBar.update({
|
|
73
|
+
current: percentage,
|
|
74
|
+
message: `${msg} ${args.join(' ').replace(/(\d+) active /, '')}`
|
|
75
|
+
});
|
|
76
|
+
} : void 0
|
|
77
|
+
}), _define_property(this, "progressBar", new external_progressBar_cjs_namespaceObject.ProgressBar()), _define_property(this, "isCompleted", false);
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
exports.ProgressWebpackPlugin = __webpack_exports__.ProgressWebpackPlugin;
|
|
81
|
+
for(var __webpack_i__ in __webpack_exports__)if (-1 === [
|
|
82
|
+
"ProgressWebpackPlugin"
|
|
83
|
+
].indexOf(__webpack_i__)) exports[__webpack_i__] = __webpack_exports__[__webpack_i__];
|
|
84
|
+
Object.defineProperty(exports, '__esModule', {
|
|
85
|
+
value: true
|
|
86
|
+
});
|
|
@@ -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"}
|