@unpackjs/core 2.0.0 → 2.1.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/index.cjs +1 -3
- package/dist/bundler-config/index.d.ts.map +1 -1
- package/dist/bundler-config/index.js +1 -3
- package/dist/bundler-config/jsMinify.cjs +16 -17
- package/dist/bundler-config/jsMinify.d.ts +6 -6
- package/dist/bundler-config/jsMinify.d.ts.map +1 -1
- package/dist/bundler-config/jsMinify.js +16 -17
- package/dist/constants.cjs +2 -6
- package/dist/constants.d.ts +0 -1
- package/dist/constants.d.ts.map +1 -1
- package/dist/constants.js +1 -2
- package/dist/createUnpack.cjs +2 -2
- package/dist/createUnpack.js +2 -2
- package/dist/index.cjs +2 -2
- package/dist/logger.cjs +2 -1
- package/dist/logger.d.ts.map +1 -1
- package/dist/logger.js +2 -1
- package/dist/plugin-progress/helper.cjs +113 -0
- package/dist/plugin-progress/helper.d.ts +4 -0
- package/dist/plugin-progress/helper.d.ts.map +1 -0
- package/dist/plugin-progress/helper.js +67 -0
- package/dist/plugin-progress/rspack.cjs +5 -39
- package/dist/plugin-progress/rspack.d.ts +0 -1
- package/dist/plugin-progress/rspack.d.ts.map +1 -1
- package/dist/plugin-progress/rspack.js +5 -28
- package/dist/plugin-progress/webpack.cjs +5 -31
- package/dist/plugin-progress/webpack.d.ts +0 -1
- package/dist/plugin-progress/webpack.d.ts.map +1 -1
- package/dist/plugin-progress/webpack.js +5 -29
- package/dist/progressBar.cjs +3 -14
- package/dist/progressBar.d.ts +1 -6
- package/dist/progressBar.d.ts.map +1 -1
- package/dist/progressBar.js +3 -14
- package/dist/reporter.cjs +6 -0
- package/dist/reporter.d.ts.map +1 -1
- package/dist/reporter.js +6 -0
- package/dist/run/dev.cjs +1 -1
- package/dist/run/dev.js +1 -1
- package/dist/utils.cjs +5 -1
- package/dist/utils.d.ts +1 -0
- package/dist/utils.d.ts.map +1 -1
- package/dist/utils.js +2 -1
- package/package.json +5 -5
|
@@ -35,7 +35,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
35
35
|
__webpack_require__.d(__webpack_exports__, {
|
|
36
36
|
JsMinifyPlugin: ()=>JsMinifyPlugin
|
|
37
37
|
});
|
|
38
|
-
const
|
|
38
|
+
const external_oxc_minify_namespaceObject = require("oxc-minify");
|
|
39
39
|
const external_webpack_namespaceObject = require("webpack");
|
|
40
40
|
var external_webpack_default = /*#__PURE__*/ __webpack_require__.n(external_webpack_namespaceObject);
|
|
41
41
|
function _define_property(obj, key, value) {
|
|
@@ -53,15 +53,15 @@ const isJsFile = /\.[cm]?js(\?.*)?$/i;
|
|
|
53
53
|
const PLUGIN_NAME = 'JsMinifyPlugin';
|
|
54
54
|
class JsMinifyPlugin {
|
|
55
55
|
apply(compiler) {
|
|
56
|
-
const { implementation, ...
|
|
56
|
+
const { implementation, ...minifyOptions } = this.options;
|
|
57
57
|
const meta = JSON.stringify({
|
|
58
58
|
name: PLUGIN_NAME,
|
|
59
|
-
version: "2.
|
|
60
|
-
options:
|
|
59
|
+
version: "2.1.0",
|
|
60
|
+
options: minifyOptions
|
|
61
61
|
});
|
|
62
62
|
compiler.hooks.compilation.tap(PLUGIN_NAME, (compilation)=>{
|
|
63
63
|
compilation.hooks.chunkHash.tap(PLUGIN_NAME, (_, hash)=>hash.update(meta));
|
|
64
|
-
compilation.hooks.processAssets.
|
|
64
|
+
compilation.hooks.processAssets.tap({
|
|
65
65
|
name: PLUGIN_NAME,
|
|
66
66
|
stage: compiler.webpack.Compilation.PROCESS_ASSETS_STAGE_OPTIMIZE_SIZE,
|
|
67
67
|
additionalAssets: true
|
|
@@ -71,22 +71,21 @@ class JsMinifyPlugin {
|
|
|
71
71
|
});
|
|
72
72
|
});
|
|
73
73
|
}
|
|
74
|
-
|
|
74
|
+
transformAssets(compilation) {
|
|
75
75
|
const { options: { devtool } } = compilation.compiler;
|
|
76
76
|
const sourceMap = !!devtool && devtool.includes('source-map');
|
|
77
77
|
const assets = compilation.getAssets().filter((asset)=>!asset.info.minimized && isJsFile.test(asset.name));
|
|
78
|
-
const { implementation, ...
|
|
79
|
-
|
|
78
|
+
const { implementation, ...minifyOptions } = this.options;
|
|
79
|
+
assets.map((asset)=>{
|
|
80
80
|
const { source, map } = asset.source.sourceAndMap();
|
|
81
|
-
const
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
sourcemap: sourceMap
|
|
85
|
-
sourcefile: asset.name
|
|
81
|
+
const { name } = asset;
|
|
82
|
+
const output = this.minify(name, Buffer.isBuffer(source) ? source.toString() : source, {
|
|
83
|
+
...minifyOptions,
|
|
84
|
+
sourcemap: sourceMap
|
|
86
85
|
});
|
|
87
86
|
let newMap;
|
|
88
87
|
if (output.map) {
|
|
89
|
-
newMap = JSON.parse(output.map);
|
|
88
|
+
newMap = 'string' == typeof output.map ? JSON.parse(output.map) : output.map;
|
|
90
89
|
newMap.sources = [
|
|
91
90
|
asset.name
|
|
92
91
|
];
|
|
@@ -97,13 +96,13 @@ class JsMinifyPlugin {
|
|
|
97
96
|
minimized: true
|
|
98
97
|
};
|
|
99
98
|
compilation.updateAsset(asset.name, newSource, newInfo);
|
|
100
|
-
})
|
|
99
|
+
});
|
|
101
100
|
}
|
|
102
101
|
constructor(options = {}){
|
|
103
102
|
_define_property(this, "options", {});
|
|
104
|
-
_define_property(this, "
|
|
103
|
+
_define_property(this, "minify", void 0);
|
|
105
104
|
const { implementation } = options;
|
|
106
|
-
this.
|
|
105
|
+
this.minify = (null == implementation ? void 0 : implementation.minify) ?? external_oxc_minify_namespaceObject.minify;
|
|
107
106
|
this.options = options;
|
|
108
107
|
}
|
|
109
108
|
}
|
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import { type
|
|
1
|
+
import { type MinifyOptions, minify } from 'oxc-minify';
|
|
2
2
|
import webpack from 'webpack';
|
|
3
3
|
type Implementation = {
|
|
4
|
-
|
|
4
|
+
minify: typeof minify;
|
|
5
5
|
};
|
|
6
|
-
export type
|
|
7
|
-
/** Pass a custom
|
|
6
|
+
export type OxcMinifyPluginOptions = MinifyOptions & {
|
|
7
|
+
/** Pass a custom oxc-minify implementation */
|
|
8
8
|
implementation?: Implementation;
|
|
9
9
|
};
|
|
10
10
|
export declare class JsMinifyPlugin {
|
|
11
11
|
private readonly options;
|
|
12
|
-
private readonly
|
|
13
|
-
constructor(options?:
|
|
12
|
+
private readonly minify;
|
|
13
|
+
constructor(options?: OxcMinifyPluginOptions);
|
|
14
14
|
apply(compiler: webpack.Compiler): void;
|
|
15
15
|
private transformAssets;
|
|
16
16
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"jsMinify.d.ts","sourceRoot":"","sources":["../../src/bundler-config/jsMinify.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,
|
|
1
|
+
{"version":3,"file":"jsMinify.d.ts","sourceRoot":"","sources":["../../src/bundler-config/jsMinify.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,aAAa,EAAE,MAAM,EAAE,MAAM,YAAY,CAAA;AACvD,OAAO,OAAO,MAAM,SAAS,CAAA;AAK7B,KAAK,cAAc,GAAG;IACpB,MAAM,EAAE,OAAO,MAAM,CAAA;CACtB,CAAA;AAED,MAAM,MAAM,sBAAsB,GAAG,aAAa,GAAG;IACnD,8CAA8C;IAC9C,cAAc,CAAC,EAAE,cAAc,CAAA;CAChC,CAAA;AAGD,qBAAa,cAAc;IACzB,OAAO,CAAC,QAAQ,CAAC,OAAO,CAA6B;IACrD,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAe;gBAE1B,OAAO,GAAE,sBAA2B;IAMhD,KAAK,CAAC,QAAQ,EAAE,OAAO,CAAC,QAAQ;IA2BhC,OAAO,CAAC,eAAe;CA+BxB"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import __rslib_shim_module__ from 'module';
|
|
2
2
|
/*#__PURE__*/ import.meta.url;
|
|
3
|
-
import * as
|
|
3
|
+
import * as __WEBPACK_EXTERNAL_MODULE_oxc_minify_dbe80c9f__ from "oxc-minify";
|
|
4
4
|
import * as __WEBPACK_EXTERNAL_MODULE_webpack__ from "webpack";
|
|
5
5
|
function _define_property(obj, key, value) {
|
|
6
6
|
if (key in obj) Object.defineProperty(obj, key, {
|
|
@@ -17,15 +17,15 @@ const isJsFile = /\.[cm]?js(\?.*)?$/i;
|
|
|
17
17
|
const PLUGIN_NAME = 'JsMinifyPlugin';
|
|
18
18
|
class JsMinifyPlugin {
|
|
19
19
|
apply(compiler) {
|
|
20
|
-
const { implementation, ...
|
|
20
|
+
const { implementation, ...minifyOptions } = this.options;
|
|
21
21
|
const meta = JSON.stringify({
|
|
22
22
|
name: PLUGIN_NAME,
|
|
23
|
-
version: "2.
|
|
24
|
-
options:
|
|
23
|
+
version: "2.1.0",
|
|
24
|
+
options: minifyOptions
|
|
25
25
|
});
|
|
26
26
|
compiler.hooks.compilation.tap(PLUGIN_NAME, (compilation)=>{
|
|
27
27
|
compilation.hooks.chunkHash.tap(PLUGIN_NAME, (_, hash)=>hash.update(meta));
|
|
28
|
-
compilation.hooks.processAssets.
|
|
28
|
+
compilation.hooks.processAssets.tap({
|
|
29
29
|
name: PLUGIN_NAME,
|
|
30
30
|
stage: compiler.webpack.Compilation.PROCESS_ASSETS_STAGE_OPTIMIZE_SIZE,
|
|
31
31
|
additionalAssets: true
|
|
@@ -35,22 +35,21 @@ class JsMinifyPlugin {
|
|
|
35
35
|
});
|
|
36
36
|
});
|
|
37
37
|
}
|
|
38
|
-
|
|
38
|
+
transformAssets(compilation) {
|
|
39
39
|
const { options: { devtool } } = compilation.compiler;
|
|
40
40
|
const sourceMap = !!devtool && devtool.includes('source-map');
|
|
41
41
|
const assets = compilation.getAssets().filter((asset)=>!asset.info.minimized && isJsFile.test(asset.name));
|
|
42
|
-
const { implementation, ...
|
|
43
|
-
|
|
42
|
+
const { implementation, ...minifyOptions } = this.options;
|
|
43
|
+
assets.map((asset)=>{
|
|
44
44
|
const { source, map } = asset.source.sourceAndMap();
|
|
45
|
-
const
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
sourcemap: sourceMap
|
|
49
|
-
sourcefile: asset.name
|
|
45
|
+
const { name } = asset;
|
|
46
|
+
const output = this.minify(name, Buffer.isBuffer(source) ? source.toString() : source, {
|
|
47
|
+
...minifyOptions,
|
|
48
|
+
sourcemap: sourceMap
|
|
50
49
|
});
|
|
51
50
|
let newMap;
|
|
52
51
|
if (output.map) {
|
|
53
|
-
newMap = JSON.parse(output.map);
|
|
52
|
+
newMap = 'string' == typeof output.map ? JSON.parse(output.map) : output.map;
|
|
54
53
|
newMap.sources = [
|
|
55
54
|
asset.name
|
|
56
55
|
];
|
|
@@ -61,13 +60,13 @@ class JsMinifyPlugin {
|
|
|
61
60
|
minimized: true
|
|
62
61
|
};
|
|
63
62
|
compilation.updateAsset(asset.name, newSource, newInfo);
|
|
64
|
-
})
|
|
63
|
+
});
|
|
65
64
|
}
|
|
66
65
|
constructor(options = {}){
|
|
67
66
|
_define_property(this, "options", {});
|
|
68
|
-
_define_property(this, "
|
|
67
|
+
_define_property(this, "minify", void 0);
|
|
69
68
|
const { implementation } = options;
|
|
70
|
-
this.
|
|
69
|
+
this.minify = (null == implementation ? void 0 : implementation.minify) ?? __WEBPACK_EXTERNAL_MODULE_oxc_minify_dbe80c9f__.minify;
|
|
71
70
|
this.options = options;
|
|
72
71
|
}
|
|
73
72
|
}
|
package/dist/constants.cjs
CHANGED
|
@@ -25,16 +25,15 @@ var __webpack_exports__ = {};
|
|
|
25
25
|
__webpack_require__.r(__webpack_exports__);
|
|
26
26
|
__webpack_require__.d(__webpack_exports__, {
|
|
27
27
|
PROD_DEFAULT_FILENAME: ()=>PROD_DEFAULT_FILENAME,
|
|
28
|
-
TEMPLATE_CONTENT: ()=>TEMPLATE_CONTENT,
|
|
29
|
-
DEFAULT_DEV_HOST: ()=>DEFAULT_DEV_HOST,
|
|
30
28
|
TEMP_DIR: ()=>TEMP_DIR,
|
|
29
|
+
DEFAULT_DEV_HOST: ()=>DEFAULT_DEV_HOST,
|
|
31
30
|
THREAD_OPTIONS: ()=>THREAD_OPTIONS,
|
|
32
31
|
EXPORT_LOCALS_CONVENTION: ()=>EXPORT_LOCALS_CONVENTION,
|
|
33
32
|
CSS_NAMED_EXPORT: ()=>CSS_NAMED_EXPORT,
|
|
34
33
|
CSS_MODULES_LOCAL_IDENT_NAME: ()=>CSS_MODULES_LOCAL_IDENT_NAME,
|
|
35
34
|
CSS_MODULES_REGEX: ()=>CSS_MODULES_REGEX,
|
|
36
35
|
DEV_DEFAULT_FILENAME: ()=>DEV_DEFAULT_FILENAME,
|
|
37
|
-
|
|
36
|
+
TEMPLATE_CONTENT: ()=>TEMPLATE_CONTENT,
|
|
38
37
|
LIGHTNINGCSS_TARGET: ()=>LIGHTNINGCSS_TARGET,
|
|
39
38
|
DEFAULT_BROWSERSLIST: ()=>DEFAULT_BROWSERSLIST,
|
|
40
39
|
NODE_MODULES_REGEX: ()=>NODE_MODULES_REGEX
|
|
@@ -64,7 +63,6 @@ const DEFAULT_BROWSERSLIST = [
|
|
|
64
63
|
'firefox >= 78',
|
|
65
64
|
'safari >= 14'
|
|
66
65
|
];
|
|
67
|
-
const ESBUILD_TARGET = DEFAULT_BROWSERSLIST.map((item)=>item.replace(' >= ', ''));
|
|
68
66
|
const LIGHTNINGCSS_TARGET = (0, external_lightningcss_namespaceObject.browserslistToTargets)(DEFAULT_BROWSERSLIST.map((item)=>item.replace(' >= ', ' ')));
|
|
69
67
|
const TEMPLATE_CONTENT = ({ title = '', headTag = '', mountId })=>`<!DOCTYPE html>
|
|
70
68
|
<html lang="en">
|
|
@@ -89,7 +87,6 @@ exports.CSS_NAMED_EXPORT = __webpack_exports__.CSS_NAMED_EXPORT;
|
|
|
89
87
|
exports.DEFAULT_BROWSERSLIST = __webpack_exports__.DEFAULT_BROWSERSLIST;
|
|
90
88
|
exports.DEFAULT_DEV_HOST = __webpack_exports__.DEFAULT_DEV_HOST;
|
|
91
89
|
exports.DEV_DEFAULT_FILENAME = __webpack_exports__.DEV_DEFAULT_FILENAME;
|
|
92
|
-
exports.ESBUILD_TARGET = __webpack_exports__.ESBUILD_TARGET;
|
|
93
90
|
exports.EXPORT_LOCALS_CONVENTION = __webpack_exports__.EXPORT_LOCALS_CONVENTION;
|
|
94
91
|
exports.LIGHTNINGCSS_TARGET = __webpack_exports__.LIGHTNINGCSS_TARGET;
|
|
95
92
|
exports.NODE_MODULES_REGEX = __webpack_exports__.NODE_MODULES_REGEX;
|
|
@@ -104,7 +101,6 @@ for(var __webpack_i__ in __webpack_exports__)if (-1 === [
|
|
|
104
101
|
"DEFAULT_BROWSERSLIST",
|
|
105
102
|
"DEFAULT_DEV_HOST",
|
|
106
103
|
"DEV_DEFAULT_FILENAME",
|
|
107
|
-
"ESBUILD_TARGET",
|
|
108
104
|
"EXPORT_LOCALS_CONVENTION",
|
|
109
105
|
"LIGHTNINGCSS_TARGET",
|
|
110
106
|
"NODE_MODULES_REGEX",
|
package/dist/constants.d.ts
CHANGED
|
@@ -17,7 +17,6 @@ export declare const THREAD_OPTIONS: {
|
|
|
17
17
|
};
|
|
18
18
|
export declare const DEFAULT_DEV_HOST = "0.0.0.0";
|
|
19
19
|
export declare const DEFAULT_BROWSERSLIST: string[];
|
|
20
|
-
export declare const ESBUILD_TARGET: string[];
|
|
21
20
|
export declare const LIGHTNINGCSS_TARGET: import("lightningcss").Targets;
|
|
22
21
|
export declare const TEMPLATE_CONTENT: ({ title, headTag, mountId }: {
|
|
23
22
|
title?: string;
|
package/dist/constants.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,4BAA4B,oCAAoC,CAAA;AAC7E,eAAO,MAAM,iBAAiB,QAAoB,CAAA;AAClD,eAAO,MAAM,oBAAoB;;;CAGhC,CAAA;AACD,eAAO,MAAM,qBAAqB;;;CAGjC,CAAA;AACD,eAAO,MAAM,wBAAwB,oBAAoB,CAAA;AACzD,eAAO,MAAM,QAAQ,yBAAyB,CAAA;AAC9C,eAAO,MAAM,kBAAkB,QAA2B,CAAA;AAC1D,eAAO,MAAM,gBAAgB,QAAQ,CAAA;AACrC,eAAO,MAAM,cAAc;;CAE1B,CAAA;AACD,eAAO,MAAM,gBAAgB,YAAY,CAAA;AACzC,eAAO,MAAM,oBAAoB,EAAE,MAAM,EAKxC,CAAA;
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,4BAA4B,oCAAoC,CAAA;AAC7E,eAAO,MAAM,iBAAiB,QAAoB,CAAA;AAClD,eAAO,MAAM,oBAAoB;;;CAGhC,CAAA;AACD,eAAO,MAAM,qBAAqB;;;CAGjC,CAAA;AACD,eAAO,MAAM,wBAAwB,oBAAoB,CAAA;AACzD,eAAO,MAAM,QAAQ,yBAAyB,CAAA;AAC9C,eAAO,MAAM,kBAAkB,QAA2B,CAAA;AAC1D,eAAO,MAAM,gBAAgB,QAAQ,CAAA;AACrC,eAAO,MAAM,cAAc;;CAE1B,CAAA;AACD,eAAO,MAAM,gBAAgB,YAAY,CAAA;AACzC,eAAO,MAAM,oBAAoB,EAAE,MAAM,EAKxC,CAAA;AAED,eAAO,MAAM,mBAAmB,gCAE/B,CAAA;AAED,eAAO,MAAM,gBAAgB;;;;YAkB5B,CAAA"}
|
package/dist/constants.js
CHANGED
|
@@ -25,7 +25,6 @@ const DEFAULT_BROWSERSLIST = [
|
|
|
25
25
|
'firefox >= 78',
|
|
26
26
|
'safari >= 14'
|
|
27
27
|
];
|
|
28
|
-
const ESBUILD_TARGET = DEFAULT_BROWSERSLIST.map((item)=>item.replace(' >= ', ''));
|
|
29
28
|
const LIGHTNINGCSS_TARGET = (0, __WEBPACK_EXTERNAL_MODULE_lightningcss__.browserslistToTargets)(DEFAULT_BROWSERSLIST.map((item)=>item.replace(' >= ', ' ')));
|
|
30
29
|
const TEMPLATE_CONTENT = ({ title = '', headTag = '', mountId })=>`<!DOCTYPE html>
|
|
31
30
|
<html lang="en">
|
|
@@ -44,4 +43,4 @@ const TEMPLATE_CONTENT = ({ title = '', headTag = '', mountId })=>`<!DOCTYPE htm
|
|
|
44
43
|
</body>
|
|
45
44
|
|
|
46
45
|
</html>`;
|
|
47
|
-
export { CSS_MODULES_LOCAL_IDENT_NAME, CSS_MODULES_REGEX, CSS_NAMED_EXPORT, DEFAULT_BROWSERSLIST, DEFAULT_DEV_HOST, DEV_DEFAULT_FILENAME,
|
|
46
|
+
export { CSS_MODULES_LOCAL_IDENT_NAME, CSS_MODULES_REGEX, CSS_NAMED_EXPORT, DEFAULT_BROWSERSLIST, DEFAULT_DEV_HOST, DEV_DEFAULT_FILENAME, EXPORT_LOCALS_CONVENTION, LIGHTNINGCSS_TARGET, NODE_MODULES_REGEX, PROD_DEFAULT_FILENAME, TEMPLATE_CONTENT, TEMP_DIR, THREAD_OPTIONS };
|
package/dist/createUnpack.cjs
CHANGED
|
@@ -86,7 +86,7 @@ function createUnpack() {
|
|
|
86
86
|
return {
|
|
87
87
|
build: async (unpackConfig)=>{
|
|
88
88
|
(0, external_utils_cjs_namespaceObject.setNodeEnv)('production');
|
|
89
|
-
console.log(external_colors_cjs_default().rainbow("unpack v2.
|
|
89
|
+
console.log(external_colors_cjs_default().rainbow("unpack v2.1.0"), external_colors_cjs_default().green('building for production...'));
|
|
90
90
|
const config = await resolveConfig(unpackConfig);
|
|
91
91
|
(0, index_cjs_namespaceObject.bundlerBuild)(config);
|
|
92
92
|
},
|
|
@@ -99,7 +99,7 @@ function createUnpack() {
|
|
|
99
99
|
},
|
|
100
100
|
watch: async (unpackConfig)=>{
|
|
101
101
|
(0, external_utils_cjs_namespaceObject.setNodeEnv)('development');
|
|
102
|
-
console.log(external_colors_cjs_default().rainbow("unpack v2.
|
|
102
|
+
console.log(external_colors_cjs_default().rainbow("unpack v2.1.0"), external_colors_cjs_default().green('building for development...'));
|
|
103
103
|
const config = await resolveConfig(unpackConfig);
|
|
104
104
|
(0, index_cjs_namespaceObject.bundlerBuild)(config);
|
|
105
105
|
}
|
package/dist/createUnpack.js
CHANGED
|
@@ -50,7 +50,7 @@ function createUnpack() {
|
|
|
50
50
|
return {
|
|
51
51
|
build: async (unpackConfig)=>{
|
|
52
52
|
(0, __WEBPACK_EXTERNAL_MODULE__utils_js_d88b7fe1__.setNodeEnv)('production');
|
|
53
|
-
console.log(__WEBPACK_EXTERNAL_MODULE__colors_js_b738ede3__["default"].rainbow("unpack v2.
|
|
53
|
+
console.log(__WEBPACK_EXTERNAL_MODULE__colors_js_b738ede3__["default"].rainbow("unpack v2.1.0"), __WEBPACK_EXTERNAL_MODULE__colors_js_b738ede3__["default"].green('building for production...'));
|
|
54
54
|
const config = await resolveConfig(unpackConfig);
|
|
55
55
|
(0, __WEBPACK_EXTERNAL_MODULE__run_index_js_f05de1fb__.bundlerBuild)(config);
|
|
56
56
|
},
|
|
@@ -63,7 +63,7 @@ function createUnpack() {
|
|
|
63
63
|
},
|
|
64
64
|
watch: async (unpackConfig)=>{
|
|
65
65
|
(0, __WEBPACK_EXTERNAL_MODULE__utils_js_d88b7fe1__.setNodeEnv)('development');
|
|
66
|
-
console.log(__WEBPACK_EXTERNAL_MODULE__colors_js_b738ede3__["default"].rainbow("unpack v2.
|
|
66
|
+
console.log(__WEBPACK_EXTERNAL_MODULE__colors_js_b738ede3__["default"].rainbow("unpack v2.1.0"), __WEBPACK_EXTERNAL_MODULE__colors_js_b738ede3__["default"].green('building for development...'));
|
|
67
67
|
const config = await resolveConfig(unpackConfig);
|
|
68
68
|
(0, __WEBPACK_EXTERNAL_MODULE__run_index_js_f05de1fb__.bundlerBuild)(config);
|
|
69
69
|
}
|
package/dist/index.cjs
CHANGED
|
@@ -18,7 +18,7 @@ var __webpack_modules__ = {
|
|
|
18
18
|
"./logger": function(module) {
|
|
19
19
|
module.exports = require("./logger.cjs");
|
|
20
20
|
},
|
|
21
|
-
"
|
|
21
|
+
"./types/index": function(module) {
|
|
22
22
|
module.exports = require("./types/index.cjs");
|
|
23
23
|
},
|
|
24
24
|
"./utils": function(module) {
|
|
@@ -101,7 +101,7 @@ var __webpack_exports__ = {};
|
|
|
101
101
|
return _logger__WEBPACK_IMPORTED_MODULE_2__[key];
|
|
102
102
|
}).bind(0, __WEBPACK_IMPORT_KEY__);
|
|
103
103
|
__webpack_require__.d(__webpack_exports__, __WEBPACK_REEXPORT_OBJECT__);
|
|
104
|
-
var _types_index__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__("
|
|
104
|
+
var _types_index__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__("./types/index");
|
|
105
105
|
var __WEBPACK_REEXPORT_OBJECT__ = {};
|
|
106
106
|
for(var __WEBPACK_IMPORT_KEY__ in _types_index__WEBPACK_IMPORTED_MODULE_3__)if ([
|
|
107
107
|
"default",
|
package/dist/logger.cjs
CHANGED
|
@@ -40,6 +40,7 @@ var external_node_readline_default = /*#__PURE__*/ __webpack_require__.n(externa
|
|
|
40
40
|
const external_colors_cjs_namespaceObject = require("./colors.cjs");
|
|
41
41
|
var external_colors_cjs_default = /*#__PURE__*/ __webpack_require__.n(external_colors_cjs_namespaceObject);
|
|
42
42
|
const index_cjs_namespaceObject = require("./types/index.cjs");
|
|
43
|
+
const external_utils_cjs_namespaceObject = require("./utils.cjs");
|
|
43
44
|
const prefixes = {
|
|
44
45
|
wait: "\u25CB",
|
|
45
46
|
error: "\u2A2F",
|
|
@@ -72,7 +73,7 @@ const createLogger = ()=>{
|
|
|
72
73
|
text = message;
|
|
73
74
|
break;
|
|
74
75
|
}
|
|
75
|
-
if ('debug' === type &&
|
|
76
|
+
if ('debug' === type && !(0, external_utils_cjs_namespaceObject.isDebug)()) return;
|
|
76
77
|
console.log(`${label} ${text}`, ...args);
|
|
77
78
|
};
|
|
78
79
|
const logger = {
|
package/dist/logger.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"logger.d.ts","sourceRoot":"","sources":["../src/logger.ts"],"names":[],"mappings":"AAEA,OAAO,EAA0B,KAAK,MAAM,EAAE,MAAM,iBAAiB,CAAA;
|
|
1
|
+
{"version":3,"file":"logger.d.ts","sourceRoot":"","sources":["../src/logger.ts"],"names":[],"mappings":"AAEA,OAAO,EAA0B,KAAK,MAAM,EAAE,MAAM,iBAAiB,CAAA;AA2ErE,eAAO,MAAM,MAAM,QAAiB,CAAA"}
|
package/dist/logger.js
CHANGED
|
@@ -3,6 +3,7 @@ import __rslib_shim_module__ from 'module';
|
|
|
3
3
|
import * as __WEBPACK_EXTERNAL_MODULE_node_readline_91c31510__ from "node:readline";
|
|
4
4
|
import * as __WEBPACK_EXTERNAL_MODULE__colors_js_b738ede3__ from "./colors.js";
|
|
5
5
|
import * as __WEBPACK_EXTERNAL_MODULE__types_index_js_63ede62f__ from "./types/index.js";
|
|
6
|
+
import * as __WEBPACK_EXTERNAL_MODULE__utils_js_d88b7fe1__ from "./utils.js";
|
|
6
7
|
const prefixes = {
|
|
7
8
|
wait: "\u25CB",
|
|
8
9
|
error: "\u2A2F",
|
|
@@ -35,7 +36,7 @@ const createLogger = ()=>{
|
|
|
35
36
|
text = message;
|
|
36
37
|
break;
|
|
37
38
|
}
|
|
38
|
-
if ('debug' === type &&
|
|
39
|
+
if ('debug' === type && !(0, __WEBPACK_EXTERNAL_MODULE__utils_js_d88b7fe1__.isDebug)()) return;
|
|
39
40
|
console.log(`${label} ${text}`, ...args);
|
|
40
41
|
};
|
|
41
42
|
const logger = {
|
|
@@ -0,0 +1,113 @@
|
|
|
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
|
+
printDevLog: ()=>printDevLog,
|
|
37
|
+
compileDone: ()=>compileDone
|
|
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
|
+
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");
|
|
46
|
+
function cutPath(originalFilePath, root) {
|
|
47
|
+
const prefix = root.endsWith(external_node_path_namespaceObject.sep) ? root : root + external_node_path_namespaceObject.sep;
|
|
48
|
+
let filePath = originalFilePath;
|
|
49
|
+
if (filePath.startsWith(prefix)) filePath = filePath.slice(prefix.length);
|
|
50
|
+
const parts = filePath.split(external_node_path_namespaceObject.sep).filter(Boolean);
|
|
51
|
+
return parts.length > 3 ? parts.slice(-3).join(external_node_path_namespaceObject.sep) : parts.join(external_node_path_namespaceObject.sep);
|
|
52
|
+
}
|
|
53
|
+
function isLikelyFile(filePath) {
|
|
54
|
+
const lastSegment = filePath.split(external_node_path_namespaceObject.sep).pop() || '';
|
|
55
|
+
return lastSegment.includes('.');
|
|
56
|
+
}
|
|
57
|
+
function formatFileList(paths, rootPath) {
|
|
58
|
+
let files = paths.filter(isLikelyFile);
|
|
59
|
+
if (0 === files.length) files = [
|
|
60
|
+
paths[0]
|
|
61
|
+
];
|
|
62
|
+
const fileInfo = files.slice(0, 1).map((file)=>cutPath(file, rootPath)).join(', ');
|
|
63
|
+
if (files.length > 1) return `${fileInfo} and ${files.length - 1} more`;
|
|
64
|
+
return fileInfo;
|
|
65
|
+
}
|
|
66
|
+
function printDevLog(compiler, root) {
|
|
67
|
+
const changedFiles = compiler.modifiedFiles ? Array.from(compiler.modifiedFiles) : null;
|
|
68
|
+
if (null == changedFiles ? void 0 : changedFiles.length) {
|
|
69
|
+
const fileInfo = formatFileList(changedFiles, root);
|
|
70
|
+
external_logger_cjs_namespaceObject.logger.wait(`building ${external_colors_cjs_default().dim(fileInfo)}`);
|
|
71
|
+
return;
|
|
72
|
+
}
|
|
73
|
+
const removedFiles = compiler.removedFiles ? Array.from(compiler.removedFiles) : null;
|
|
74
|
+
if (null == removedFiles ? void 0 : removedFiles.length) {
|
|
75
|
+
const fileInfo = formatFileList(removedFiles, root);
|
|
76
|
+
external_logger_cjs_namespaceObject.logger.wait(`building ${external_colors_cjs_default().dim(`removed ${fileInfo}`)}`);
|
|
77
|
+
return;
|
|
78
|
+
}
|
|
79
|
+
external_logger_cjs_namespaceObject.logger.wait('build started...');
|
|
80
|
+
}
|
|
81
|
+
async function compileDone(compiler, stats) {
|
|
82
|
+
const statsJson = stats.toJson({
|
|
83
|
+
preset: 'errors-only',
|
|
84
|
+
timings: true
|
|
85
|
+
});
|
|
86
|
+
const compileTime = statsJson.time / 1000;
|
|
87
|
+
const root = compiler.options.context;
|
|
88
|
+
if (!stats.hasErrors()) if ((0, external_utils_cjs_namespaceObject.isProd)()) {
|
|
89
|
+
await (0, external_reporter_cjs_namespaceObject.printFileSize)({
|
|
90
|
+
root,
|
|
91
|
+
stats
|
|
92
|
+
});
|
|
93
|
+
console.log(external_colors_cjs_default().green(`\u{2713} built in ${external_colors_cjs_default().bold((0, external_utils_cjs_namespaceObject.prettyTime)(compileTime))}`));
|
|
94
|
+
} else {
|
|
95
|
+
if ((0, external_utils_cjs_namespaceObject.isDebug)()) {
|
|
96
|
+
const modules = stats.compilation.modules;
|
|
97
|
+
modules.forEach((module)=>{
|
|
98
|
+
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
|
+
});
|
|
101
|
+
}
|
|
102
|
+
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
|
+
}
|
|
104
|
+
}
|
|
105
|
+
exports.compileDone = __webpack_exports__.compileDone;
|
|
106
|
+
exports.printDevLog = __webpack_exports__.printDevLog;
|
|
107
|
+
for(var __webpack_i__ in __webpack_exports__)if (-1 === [
|
|
108
|
+
"compileDone",
|
|
109
|
+
"printDevLog"
|
|
110
|
+
].indexOf(__webpack_i__)) exports[__webpack_i__] = __webpack_exports__[__webpack_i__];
|
|
111
|
+
Object.defineProperty(exports, '__esModule', {
|
|
112
|
+
value: true
|
|
113
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"helper.d.ts","sourceRoot":"","sources":["../../src/plugin-progress/helper.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 * as __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__ from "node:path";
|
|
4
|
+
import * as __WEBPACK_EXTERNAL_MODULE__colors_js_1d4535d6__ from "../colors.js";
|
|
5
|
+
import * as __WEBPACK_EXTERNAL_MODULE__logger_js_ff791b17__ from "../logger.js";
|
|
6
|
+
import * as __WEBPACK_EXTERNAL_MODULE__reporter_js_32fd284b__ from "../reporter.js";
|
|
7
|
+
import * as __WEBPACK_EXTERNAL_MODULE__utils_js_db66b9f7__ from "../utils.js";
|
|
8
|
+
function cutPath(originalFilePath, root) {
|
|
9
|
+
const prefix = root.endsWith(__WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__.sep) ? root : root + __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__.sep;
|
|
10
|
+
let filePath = originalFilePath;
|
|
11
|
+
if (filePath.startsWith(prefix)) filePath = filePath.slice(prefix.length);
|
|
12
|
+
const parts = filePath.split(__WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__.sep).filter(Boolean);
|
|
13
|
+
return parts.length > 3 ? parts.slice(-3).join(__WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__.sep) : parts.join(__WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__.sep);
|
|
14
|
+
}
|
|
15
|
+
function isLikelyFile(filePath) {
|
|
16
|
+
const lastSegment = filePath.split(__WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__.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
|
+
__WEBPACK_EXTERNAL_MODULE__logger_js_ff791b17__.logger.wait(`building ${__WEBPACK_EXTERNAL_MODULE__colors_js_1d4535d6__["default"].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
|
+
__WEBPACK_EXTERNAL_MODULE__logger_js_ff791b17__.logger.wait(`building ${__WEBPACK_EXTERNAL_MODULE__colors_js_1d4535d6__["default"].dim(`removed ${fileInfo}`)}`);
|
|
39
|
+
return;
|
|
40
|
+
}
|
|
41
|
+
__WEBPACK_EXTERNAL_MODULE__logger_js_ff791b17__.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 ((0, __WEBPACK_EXTERNAL_MODULE__utils_js_db66b9f7__.isProd)()) {
|
|
51
|
+
await (0, __WEBPACK_EXTERNAL_MODULE__reporter_js_32fd284b__.printFileSize)({
|
|
52
|
+
root,
|
|
53
|
+
stats
|
|
54
|
+
});
|
|
55
|
+
console.log(__WEBPACK_EXTERNAL_MODULE__colors_js_1d4535d6__["default"].green(`\u{2713} built in ${__WEBPACK_EXTERNAL_MODULE__colors_js_1d4535d6__["default"].bold((0, __WEBPACK_EXTERNAL_MODULE__utils_js_db66b9f7__.prettyTime)(compileTime))}`));
|
|
56
|
+
} else {
|
|
57
|
+
if ((0, __WEBPACK_EXTERNAL_MODULE__utils_js_db66b9f7__.isDebug)()) {
|
|
58
|
+
const modules = stats.compilation.modules;
|
|
59
|
+
modules.forEach((module)=>{
|
|
60
|
+
const { resource } = module;
|
|
61
|
+
if (null == resource ? void 0 : resource.includes(__WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__["default"].resolve(root, 'node_modules'))) __WEBPACK_EXTERNAL_MODULE__logger_js_ff791b17__.logger.debug(__WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__["default"].relative(root, resource));
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
__WEBPACK_EXTERNAL_MODULE__logger_js_ff791b17__.logger.ready(`built in ${(0, __WEBPACK_EXTERNAL_MODULE__utils_js_db66b9f7__.prettyTime)(compileTime)}${(0, __WEBPACK_EXTERNAL_MODULE__utils_js_db66b9f7__.isDebug)() ? ` (${stats.compilation.modules.size} modules)` : ''}`);
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
export { compileDone, printDevLog };
|
|
@@ -1,14 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
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
3
|
(()=>{
|
|
13
4
|
__webpack_require__.d = (exports1, definition)=>{
|
|
14
5
|
for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
|
|
@@ -35,15 +26,10 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
35
26
|
__webpack_require__.d(__webpack_exports__, {
|
|
36
27
|
RspackPluginProgress: ()=>RspackPluginProgress
|
|
37
28
|
});
|
|
38
|
-
const external_node_path_namespaceObject = require("node:path");
|
|
39
|
-
var external_node_path_default = /*#__PURE__*/ __webpack_require__.n(external_node_path_namespaceObject);
|
|
40
29
|
const core_namespaceObject = require("@rspack/core");
|
|
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
30
|
const external_progressBar_cjs_namespaceObject = require("../progressBar.cjs");
|
|
45
|
-
const external_reporter_cjs_namespaceObject = require("../reporter.cjs");
|
|
46
31
|
const external_utils_cjs_namespaceObject = require("../utils.cjs");
|
|
32
|
+
const external_helper_cjs_namespaceObject = require("./helper.cjs");
|
|
47
33
|
function _define_property(obj, key, value) {
|
|
48
34
|
if (key in obj) Object.defineProperty(obj, key, {
|
|
49
35
|
value: value,
|
|
@@ -58,31 +44,11 @@ const PLUGIN_NAME = 'PluginProgress';
|
|
|
58
44
|
class RspackPluginProgress extends core_namespaceObject.rspack.ProgressPlugin {
|
|
59
45
|
apply(compiler) {
|
|
60
46
|
super.apply(compiler);
|
|
61
|
-
compiler.hooks.
|
|
62
|
-
|
|
63
|
-
(0, external_utils_cjs_namespaceObject.isProd)() || external_logger_cjs_namespaceObject.logger.wait('building...');
|
|
47
|
+
compiler.hooks.watchRun.tap(PLUGIN_NAME, ()=>{
|
|
48
|
+
(0, external_helper_cjs_namespaceObject.printDevLog)(compiler, compiler.options.context);
|
|
64
49
|
});
|
|
65
50
|
compiler.hooks.done.tap(PLUGIN_NAME, async (stats)=>{
|
|
66
|
-
|
|
67
|
-
(0, external_utils_cjs_namespaceObject.isProd)() && this.progressBar.done();
|
|
68
|
-
const hrtime = process.hrtime(this.startTime);
|
|
69
|
-
const compileTime = hrtime[0] + hrtime[1] / 1e9;
|
|
70
|
-
this.startTime = void 0;
|
|
71
|
-
const root = compiler.options.context;
|
|
72
|
-
if (!stats.hasErrors()) if ((0, external_utils_cjs_namespaceObject.isProd)()) {
|
|
73
|
-
await (0, external_reporter_cjs_namespaceObject.printFileSize)({
|
|
74
|
-
root,
|
|
75
|
-
stats
|
|
76
|
-
});
|
|
77
|
-
console.log(external_colors_cjs_default().green(`\u{2713} built in ${external_colors_cjs_default().bold((0, external_utils_cjs_namespaceObject.prettyTime)(compileTime))}`));
|
|
78
|
-
} else {
|
|
79
|
-
const modules = stats.compilation.modules;
|
|
80
|
-
modules.forEach((module)=>{
|
|
81
|
-
const { resource } = module;
|
|
82
|
-
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));
|
|
83
|
-
});
|
|
84
|
-
external_logger_cjs_namespaceObject.logger.ready(`built in ${(0, external_utils_cjs_namespaceObject.prettyTime)(compileTime)} (${modules.size} modules)`);
|
|
85
|
-
}
|
|
51
|
+
await (0, external_helper_cjs_namespaceObject.compileDone)(compiler, stats);
|
|
86
52
|
});
|
|
87
53
|
}
|
|
88
54
|
constructor(){
|
|
@@ -91,7 +57,7 @@ class RspackPluginProgress extends core_namespaceObject.rspack.ProgressPlugin {
|
|
|
91
57
|
current: percentage,
|
|
92
58
|
message: `${msg} ${args.join(' ')}`
|
|
93
59
|
});
|
|
94
|
-
}), _define_property(this, "
|
|
60
|
+
}), _define_property(this, "progressBar", new external_progressBar_cjs_namespaceObject.ProgressBar());
|
|
95
61
|
}
|
|
96
62
|
}
|
|
97
63
|
exports.RspackPluginProgress = __webpack_exports__.RspackPluginProgress;
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { type Compiler, rspack } from '@rspack/core';
|
|
2
2
|
import { ProgressBar } from '../progressBar';
|
|
3
3
|
export declare class RspackPluginProgress extends rspack.ProgressPlugin {
|
|
4
|
-
startTime?: [number, number];
|
|
5
4
|
progressBar: ProgressBar;
|
|
6
5
|
constructor();
|
|
7
6
|
apply(compiler: Compiler): void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rspack.d.ts","sourceRoot":"","sources":["../../src/plugin-progress/rspack.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"rspack.d.ts","sourceRoot":"","sources":["../../src/plugin-progress/rspack.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,QAAQ,EAAE,MAAM,EAAE,MAAM,cAAc,CAAA;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"}
|