@unpackjs/core 1.7.0 → 1.7.2
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 +20 -20
- package/compiled/less-loader/index.js +8 -8
- package/compiled/postcss-loader/index.js +127 -1848
- package/compiled/sass-loader/index.js +8 -8
- package/dist/bundler-config/chunkSplit.cjs +3 -3
- package/dist/bundler-config/chunkSplit.d.ts +1 -1
- package/dist/bundler-config/chunkSplit.d.ts.map +1 -1
- package/dist/bundler-config/chunkSplit.js +2 -2
- package/dist/bundler-config/css.cjs +3 -3
- package/dist/bundler-config/css.d.ts +1 -1
- package/dist/bundler-config/css.d.ts.map +1 -1
- package/dist/bundler-config/css.js +2 -2
- package/dist/bundler-config/experimentCss.cjs +3 -3
- package/dist/bundler-config/experimentCss.d.ts +1 -1
- package/dist/bundler-config/experimentCss.d.ts.map +1 -1
- package/dist/bundler-config/experimentCss.js +2 -2
- package/dist/bundler-config/index.cjs +16 -12
- package/dist/bundler-config/index.d.ts.map +1 -1
- package/dist/bundler-config/index.js +19 -15
- package/dist/createUnpack.cjs +2 -2
- package/dist/createUnpack.js +2 -2
- package/dist/index.cjs +2 -2
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/logger.cjs +5 -3
- package/dist/logger.js +5 -3
- package/dist/plugin-progress/rspack.cjs +11 -4
- package/dist/plugin-progress/rspack.d.ts.map +1 -1
- package/dist/plugin-progress/rspack.js +11 -4
- package/dist/plugin-progress/webpack.cjs +11 -4
- package/dist/plugin-progress/webpack.d.ts.map +1 -1
- package/dist/plugin-progress/webpack.js +11 -4
- package/dist/prebundleDeps.cjs +24 -15
- package/dist/prebundleDeps.d.ts.map +1 -1
- package/dist/prebundleDeps.js +26 -16
- package/dist/run/build.cjs +1 -7
- package/dist/run/build.d.ts.map +1 -1
- package/dist/run/build.js +1 -7
- package/dist/run/dev.cjs +1 -1
- package/dist/run/dev.js +1 -1
- package/dist/thread-loader/worker.js +1 -1
- package/dist/types/config.d.ts +1 -2
- package/dist/types/config.d.ts.map +1 -1
- package/dist/types/logger.cjs +1 -0
- package/dist/types/logger.d.ts +2 -1
- package/dist/types/logger.d.ts.map +1 -1
- package/dist/types/logger.js +1 -0
- package/dist/utils.cjs +5 -0
- package/dist/utils.d.ts +1 -0
- package/dist/utils.d.ts.map +1 -1
- package/dist/utils.js +4 -0
- package/package.json +5 -5
|
@@ -4795,19 +4795,19 @@
|
|
|
4795
4795
|
}
|
|
4796
4796
|
});
|
|
4797
4797
|
},
|
|
4798
|
-
|
|
4798
|
+
465: (module, __unused_webpack_exports, __nccwpck_require__) => {
|
|
4799
4799
|
"use strict";
|
|
4800
|
-
const loader = __nccwpck_require__(
|
|
4800
|
+
const loader = __nccwpck_require__(442);
|
|
4801
4801
|
module.exports = loader.default;
|
|
4802
4802
|
},
|
|
4803
|
-
|
|
4803
|
+
442: (__unused_webpack_module, exports, __nccwpck_require__) => {
|
|
4804
4804
|
"use strict";
|
|
4805
4805
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4806
4806
|
exports["default"] = void 0;
|
|
4807
4807
|
var _url = _interopRequireDefault(__nccwpck_require__(310));
|
|
4808
4808
|
var _path = _interopRequireDefault(__nccwpck_require__(17));
|
|
4809
|
-
var _options = _interopRequireDefault(__nccwpck_require__(
|
|
4810
|
-
var _utils = __nccwpck_require__(
|
|
4809
|
+
var _options = _interopRequireDefault(__nccwpck_require__(798));
|
|
4810
|
+
var _utils = __nccwpck_require__(611);
|
|
4811
4811
|
function _interopRequireDefault(e) {
|
|
4812
4812
|
return e && e.__esModule ? e : { default: e };
|
|
4813
4813
|
}
|
|
@@ -4917,7 +4917,7 @@
|
|
|
4917
4917
|
}
|
|
4918
4918
|
var _default = (exports["default"] = loader);
|
|
4919
4919
|
},
|
|
4920
|
-
|
|
4920
|
+
611: (__unused_webpack_module, exports, __nccwpck_require__) => {
|
|
4921
4921
|
"use strict";
|
|
4922
4922
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4923
4923
|
exports.errorFactory = errorFactory;
|
|
@@ -5577,7 +5577,7 @@
|
|
|
5577
5577
|
"use strict";
|
|
5578
5578
|
module.exports = require("url");
|
|
5579
5579
|
},
|
|
5580
|
-
|
|
5580
|
+
798: (module) => {
|
|
5581
5581
|
"use strict";
|
|
5582
5582
|
module.exports = JSON.parse(
|
|
5583
5583
|
'{"title":"Sass Loader options","type":"object","properties":{"implementation":{"description":"The implementation of the sass to be used.","link":"https://github.com/webpack-contrib/sass-loader#implementation","anyOf":[{"type":"string"},{"type":"object"}]},"api":{"description":"Switch between old and modern API for `sass` (`Dart Sass`) and `Sass Embedded` implementations.","link":"https://github.com/webpack-contrib/sass-loader#sassoptions","enum":["legacy","modern","modern-compiler"]},"sassOptions":{"description":"Options for `node-sass` or `sass` (`Dart Sass`) implementation.","link":"https://github.com/webpack-contrib/sass-loader#sassoptions","anyOf":[{"type":"object","additionalProperties":true},{"instanceof":"Function"}]},"additionalData":{"description":"Prepends/Appends `Sass`/`SCSS` code before the actual entry file.","link":"https://github.com/webpack-contrib/sass-loader#additionaldata","anyOf":[{"type":"string"},{"instanceof":"Function"}]},"sourceMap":{"description":"Enables/Disables generation of source maps.","link":"https://github.com/webpack-contrib/sass-loader#sourcemap","type":"boolean"},"webpackImporter":{"description":"Enables/Disables default `webpack` importer.","link":"https://github.com/webpack-contrib/sass-loader#webpackimporter","type":"boolean"},"warnRuleAsWarning":{"description":"Treats the \'@warn\' rule as a webpack warning.","link":"https://github.com/webpack-contrib/sass-loader#warnruleaswarning","type":"boolean"}},"additionalProperties":false}',
|
|
@@ -5607,6 +5607,6 @@
|
|
|
5607
5607
|
}
|
|
5608
5608
|
if (typeof __nccwpck_require__ !== "undefined")
|
|
5609
5609
|
__nccwpck_require__.ab = __dirname + "/";
|
|
5610
|
-
var __webpack_exports__ = __nccwpck_require__(
|
|
5610
|
+
var __webpack_exports__ = __nccwpck_require__(465);
|
|
5611
5611
|
module.exports = __webpack_exports__;
|
|
5612
5612
|
})();
|
|
@@ -27,7 +27,7 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
27
27
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
28
28
|
var chunkSplit_exports = {};
|
|
29
29
|
__export(chunkSplit_exports, {
|
|
30
|
-
|
|
30
|
+
applyChunkSplitConfig: () => applyChunkSplitConfig
|
|
31
31
|
});
|
|
32
32
|
module.exports = __toCommonJS(chunkSplit_exports);
|
|
33
33
|
var import_node_assert = __toESM(require("node:assert"));
|
|
@@ -159,7 +159,7 @@ const SPLIT_STRATEGY_DISPATCHER = {
|
|
|
159
159
|
"all-in-one": allInOne,
|
|
160
160
|
"single-vendor": singleVendor
|
|
161
161
|
};
|
|
162
|
-
const
|
|
162
|
+
const applyChunkSplitConfig = ({
|
|
163
163
|
config,
|
|
164
164
|
unpackConfig
|
|
165
165
|
}) => {
|
|
@@ -183,5 +183,5 @@ const addChunkSplitSupport = ({
|
|
|
183
183
|
};
|
|
184
184
|
// Annotate the CommonJS export names for ESM import in node:
|
|
185
185
|
0 && (module.exports = {
|
|
186
|
-
|
|
186
|
+
applyChunkSplitConfig
|
|
187
187
|
});
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { BundlerConfiguration, UnpackConfig } from '../types/index';
|
|
2
|
-
export declare const
|
|
2
|
+
export declare const applyChunkSplitConfig: ({ config, unpackConfig, }: {
|
|
3
3
|
config: BundlerConfiguration;
|
|
4
4
|
unpackConfig: UnpackConfig;
|
|
5
5
|
}) => BundlerConfiguration;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"chunkSplit.d.ts","sourceRoot":"","sources":["../../src/bundler-config/chunkSplit.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACV,oBAAoB,EAKpB,YAAY,EACb,MAAM,iBAAiB,CAAA;AA4KxB,eAAO,MAAM,
|
|
1
|
+
{"version":3,"file":"chunkSplit.d.ts","sourceRoot":"","sources":["../../src/bundler-config/chunkSplit.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACV,oBAAoB,EAKpB,YAAY,EACb,MAAM,iBAAiB,CAAA;AA4KxB,eAAO,MAAM,qBAAqB,8BAG/B;IACD,MAAM,EAAE,oBAAoB,CAAA;IAC5B,YAAY,EAAE,YAAY,CAAA;CAC3B,KAAG,oBAkBH,CAAA"}
|
|
@@ -136,7 +136,7 @@ const SPLIT_STRATEGY_DISPATCHER = {
|
|
|
136
136
|
"all-in-one": allInOne,
|
|
137
137
|
"single-vendor": singleVendor
|
|
138
138
|
};
|
|
139
|
-
const
|
|
139
|
+
const applyChunkSplitConfig = ({
|
|
140
140
|
config,
|
|
141
141
|
unpackConfig
|
|
142
142
|
}) => {
|
|
@@ -159,5 +159,5 @@ const addChunkSplitSupport = ({
|
|
|
159
159
|
return config;
|
|
160
160
|
};
|
|
161
161
|
export {
|
|
162
|
-
|
|
162
|
+
applyChunkSplitConfig
|
|
163
163
|
};
|
|
@@ -27,7 +27,7 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
27
27
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
28
28
|
var css_exports = {};
|
|
29
29
|
__export(css_exports, {
|
|
30
|
-
|
|
30
|
+
applyCssConfig: () => applyCssConfig
|
|
31
31
|
});
|
|
32
32
|
module.exports = __toCommonJS(css_exports);
|
|
33
33
|
var import_node_path = __toESM(require("node:path"));
|
|
@@ -36,7 +36,7 @@ var import_mini_css_extract_plugin = __toESM(require("mini-css-extract-plugin"))
|
|
|
36
36
|
var import_constants = require("../constants.cjs");
|
|
37
37
|
var import_utils = require("../utils.cjs");
|
|
38
38
|
var import_helper = require("./helper.cjs");
|
|
39
|
-
function
|
|
39
|
+
function applyCssConfig({
|
|
40
40
|
config,
|
|
41
41
|
unpackConfig
|
|
42
42
|
}) {
|
|
@@ -163,5 +163,5 @@ function addCssSupport({
|
|
|
163
163
|
}
|
|
164
164
|
// Annotate the CommonJS export names for ESM import in node:
|
|
165
165
|
0 && (module.exports = {
|
|
166
|
-
|
|
166
|
+
applyCssConfig
|
|
167
167
|
});
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { BundlerConfiguration, UnpackConfig } from '../types/index';
|
|
2
|
-
export declare function
|
|
2
|
+
export declare function applyCssConfig({ config, unpackConfig, }: {
|
|
3
3
|
config: BundlerConfiguration;
|
|
4
4
|
unpackConfig: UnpackConfig;
|
|
5
5
|
}): BundlerConfiguration;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"css.d.ts","sourceRoot":"","sources":["../../src/bundler-config/css.ts"],"names":[],"mappings":"AAUA,OAAO,KAAK,EAAE,oBAAoB,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAA;AAazE,wBAAgB,
|
|
1
|
+
{"version":3,"file":"css.d.ts","sourceRoot":"","sources":["../../src/bundler-config/css.ts"],"names":[],"mappings":"AAUA,OAAO,KAAK,EAAE,oBAAoB,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAA;AAazE,wBAAgB,cAAc,CAAC,EAC7B,MAAM,EACN,YAAY,GACb,EAAE;IACD,MAAM,EAAE,oBAAoB,CAAA;IAC5B,YAAY,EAAE,YAAY,CAAA;CAC3B,GAAG,oBAAoB,CAkIvB"}
|
|
@@ -28,7 +28,7 @@ import {
|
|
|
28
28
|
mergeConfig
|
|
29
29
|
} from "../utils.js";
|
|
30
30
|
import { getOutputFilename } from "./helper.js";
|
|
31
|
-
function
|
|
31
|
+
function applyCssConfig({
|
|
32
32
|
config,
|
|
33
33
|
unpackConfig
|
|
34
34
|
}) {
|
|
@@ -154,5 +154,5 @@ function addCssSupport({
|
|
|
154
154
|
return config;
|
|
155
155
|
}
|
|
156
156
|
export {
|
|
157
|
-
|
|
157
|
+
applyCssConfig
|
|
158
158
|
};
|
|
@@ -27,7 +27,7 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
27
27
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
28
28
|
var experimentCss_exports = {};
|
|
29
29
|
__export(experimentCss_exports, {
|
|
30
|
-
|
|
30
|
+
applyExperimentCssConfig: () => applyExperimentCssConfig
|
|
31
31
|
});
|
|
32
32
|
module.exports = __toCommonJS(experimentCss_exports);
|
|
33
33
|
var import_node_path = __toESM(require("node:path"));
|
|
@@ -35,7 +35,7 @@ var import_constants = require("../constants.cjs");
|
|
|
35
35
|
var import_plugin = require("../typed-css-modules/plugin.cjs");
|
|
36
36
|
var import_utils = require("../utils.cjs");
|
|
37
37
|
var import_helper = require("./helper.cjs");
|
|
38
|
-
function
|
|
38
|
+
function applyExperimentCssConfig({
|
|
39
39
|
config,
|
|
40
40
|
unpackConfig
|
|
41
41
|
}) {
|
|
@@ -162,5 +162,5 @@ function addExperimentCssSupport({
|
|
|
162
162
|
}
|
|
163
163
|
// Annotate the CommonJS export names for ESM import in node:
|
|
164
164
|
0 && (module.exports = {
|
|
165
|
-
|
|
165
|
+
applyExperimentCssConfig
|
|
166
166
|
});
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { BundlerConfiguration, UnpackConfig } from '../types/index';
|
|
2
|
-
export declare function
|
|
2
|
+
export declare function applyExperimentCssConfig({ config, unpackConfig, }: {
|
|
3
3
|
config: BundlerConfiguration;
|
|
4
4
|
unpackConfig: UnpackConfig;
|
|
5
5
|
}): BundlerConfiguration;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"experimentCss.d.ts","sourceRoot":"","sources":["../../src/bundler-config/experimentCss.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,oBAAoB,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAA;AAazE,wBAAgB,
|
|
1
|
+
{"version":3,"file":"experimentCss.d.ts","sourceRoot":"","sources":["../../src/bundler-config/experimentCss.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,oBAAoB,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAA;AAazE,wBAAgB,wBAAwB,CAAC,EACvC,MAAM,EACN,YAAY,GACb,EAAE;IACD,MAAM,EAAE,oBAAoB,CAAA;IAC5B,YAAY,EAAE,YAAY,CAAA;CAC3B,GAAG,oBAAoB,CA6HvB"}
|
|
@@ -27,7 +27,7 @@ import {
|
|
|
27
27
|
setValueByPath
|
|
28
28
|
} from "../utils.js";
|
|
29
29
|
import { getOutputFilename } from "./helper.js";
|
|
30
|
-
function
|
|
30
|
+
function applyExperimentCssConfig({
|
|
31
31
|
config,
|
|
32
32
|
unpackConfig
|
|
33
33
|
}) {
|
|
@@ -153,5 +153,5 @@ function addExperimentCssSupport({
|
|
|
153
153
|
return config;
|
|
154
154
|
}
|
|
155
155
|
export {
|
|
156
|
-
|
|
156
|
+
applyExperimentCssConfig
|
|
157
157
|
};
|
|
@@ -49,11 +49,12 @@ var import_chunkSplit = require("./chunkSplit.cjs");
|
|
|
49
49
|
var import_css = require("./css.cjs");
|
|
50
50
|
var import_experimentCss = require("./experimentCss.cjs");
|
|
51
51
|
var import_helper = require("./helper.cjs");
|
|
52
|
-
const
|
|
52
|
+
const { TsCheckerRspackPlugin } = require("ts-checker-rspack-plugin");
|
|
53
53
|
const BundleAnalyzerPlugin = require("../../compiled/webpack-bundle-analyzer/index.js").BundleAnalyzerPlugin;
|
|
54
54
|
const CopyWebpackPlugin = require("copy-webpack-plugin");
|
|
55
55
|
async function getBundlerConfig(unpackConfig) {
|
|
56
56
|
const isRspack = unpackConfig.bundler === "rspack";
|
|
57
|
+
const HtmlPlugin = isRspack ? import_core.rspack.HtmlRspackPlugin : import_html_webpack_plugin.default;
|
|
57
58
|
const definePlugin = (define) => isRspack ? new import_core.rspack.DefinePlugin(define) : new import_esbuild_loader.EsbuildPlugin({ define, implementation: import_esbuild.default });
|
|
58
59
|
const JS_FILENAME = (0, import_helper.getOutputFilename)({ type: "js", hash: unpackConfig.build?.filenameHash });
|
|
59
60
|
const IgnorePlugin = isRspack ? import_core.rspack.IgnorePlugin : import_webpack2.default.IgnorePlugin;
|
|
@@ -106,13 +107,14 @@ async function getBundlerConfig(unpackConfig) {
|
|
|
106
107
|
},
|
|
107
108
|
plugins: [
|
|
108
109
|
unpackConfig.define && definePlugin(unpackConfig.define),
|
|
109
|
-
!unpackConfig.mpa && new
|
|
110
|
-
template: unpackConfig.html?.template || "",
|
|
111
|
-
|
|
110
|
+
!unpackConfig.mpa && new HtmlPlugin({
|
|
111
|
+
template: unpackConfig.html?.template || (isRspack ? void 0 : ""),
|
|
112
|
+
// @ts-expect-error
|
|
113
|
+
templateContent: unpackConfig.html?.templateContent || (!unpackConfig.html?.template ? import_constants.TEMPLATE_CONTENT : isRspack ? void 0 : false),
|
|
112
114
|
templateParameters: {
|
|
113
115
|
mountId: unpackConfig.html?.mountId,
|
|
114
|
-
title: (0, import_utils.isFunction)(unpackConfig.html?.title) ? unpackConfig.html?.title({ entryName: "index" }) : unpackConfig.html?.title,
|
|
115
|
-
headTag: unpackConfig.html?.headTag,
|
|
116
|
+
title: (0, import_utils.isFunction)(unpackConfig.html?.title) ? unpackConfig.html?.title({ entryName: "index" }) : unpackConfig.html?.title || "",
|
|
117
|
+
headTag: unpackConfig.html?.headTag || "",
|
|
116
118
|
...unpackConfig.html?.templateParameters
|
|
117
119
|
},
|
|
118
120
|
minify: false,
|
|
@@ -124,7 +126,7 @@ async function getBundlerConfig(unpackConfig) {
|
|
|
124
126
|
contextRegExp: /moment$/
|
|
125
127
|
}),
|
|
126
128
|
unpackConfig.build?.copy && new CopyPlugin({ patterns: unpackConfig.build.copy }),
|
|
127
|
-
unpackConfig.build?.typeCheck && (0, import_utils.isDev)() && isTs && new
|
|
129
|
+
unpackConfig.build?.typeCheck && (0, import_utils.isDev)() && isTs && new TsCheckerRspackPlugin({
|
|
128
130
|
typescript: {
|
|
129
131
|
// set 'readonly' to avoid emitting tsbuildinfo, as the generated tsbuildinfo will break fork-ts-checker
|
|
130
132
|
mode: "readonly",
|
|
@@ -180,23 +182,25 @@ async function getBundlerConfig(unpackConfig) {
|
|
|
180
182
|
},
|
|
181
183
|
cache: unpackConfig.build?.cache && unpackConfig.bundler === "webpack" ? {
|
|
182
184
|
type: "filesystem"
|
|
183
|
-
} : void 0
|
|
185
|
+
} : void 0,
|
|
186
|
+
watchOptions: {
|
|
187
|
+
ignored: /[\\/](?:\.git|node_modules)[\\/]/
|
|
188
|
+
}
|
|
184
189
|
};
|
|
185
190
|
if (unpackConfig.experiments?.css)
|
|
186
191
|
import_logger.logger.warn("Experiments.css is not stable yet, please use with caution");
|
|
187
|
-
config = unpackConfig.experiments?.css ? (0, import_experimentCss.
|
|
188
|
-
config = (0, import_chunkSplit.
|
|
192
|
+
config = unpackConfig.experiments?.css ? (0, import_experimentCss.applyExperimentCssConfig)({ config, unpackConfig }) : (0, import_css.applyCssConfig)({ config, unpackConfig });
|
|
193
|
+
config = (0, import_chunkSplit.applyChunkSplitConfig)({ config, unpackConfig });
|
|
189
194
|
for (const plugin of (0, import_plugin.getNormalizedPluginsByHook)("bundlerConfig", unpackConfig.plugins)) {
|
|
190
195
|
config = await plugin.bundlerConfig(config, {
|
|
191
196
|
unpackConfig,
|
|
192
197
|
mergeConfig: import_utils.mergeConfig,
|
|
193
|
-
bundler: import_webpack2.default
|
|
198
|
+
bundler: isRspack ? import_core.rspack : import_webpack2.default
|
|
194
199
|
});
|
|
195
200
|
}
|
|
196
201
|
if (unpackConfig.bundlerConfig) {
|
|
197
202
|
if ((0, import_utils.isFunction)(unpackConfig.bundlerConfig)) {
|
|
198
203
|
config = await unpackConfig.bundlerConfig(config, {
|
|
199
|
-
bundler: unpackConfig.bundler,
|
|
200
204
|
mergeConfig: import_utils.mergeConfig
|
|
201
205
|
});
|
|
202
206
|
} else {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/bundler-config/index.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,oBAAoB,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAA;AAqBzE,wBAAsB,gBAAgB,CAAC,YAAY,EAAE,YAAY,GAAG,OAAO,CAAC,oBAAoB,CAAC,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/bundler-config/index.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,oBAAoB,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAA;AAqBzE,wBAAsB,gBAAgB,CAAC,YAAY,EAAE,YAAY,GAAG,OAAO,CAAC,oBAAoB,CAAC,CAiLhG"}
|
|
@@ -10,9 +10,9 @@ var __filename = /* @__PURE__ */ getFilename();
|
|
|
10
10
|
import fs from "node:fs";
|
|
11
11
|
import path2 from "node:path";
|
|
12
12
|
import { rspack } from "@rspack/core";
|
|
13
|
-
import
|
|
13
|
+
import HtmlWebpackPlugin from "html-webpack-plugin";
|
|
14
14
|
import { isDev, isDevServer, isFunction, isPlainObject, isProd, mergeConfig } from "../utils.js";
|
|
15
|
-
const
|
|
15
|
+
const { TsCheckerRspackPlugin } = require("ts-checker-rspack-plugin");
|
|
16
16
|
const BundleAnalyzerPlugin = require("../../compiled/webpack-bundle-analyzer/index.js").BundleAnalyzerPlugin;
|
|
17
17
|
const CopyWebpackPlugin = require("copy-webpack-plugin");
|
|
18
18
|
import esbuild from "esbuild";
|
|
@@ -25,12 +25,13 @@ import { getNormalizedPluginsByHook } from "../plugin.js";
|
|
|
25
25
|
import { RspackPluginProgress } from "../plugin-progress/rspack.js";
|
|
26
26
|
import { WebpackPluginProgress } from "../plugin-progress/webpack.js";
|
|
27
27
|
import webpack from "webpack";
|
|
28
|
-
import {
|
|
29
|
-
import {
|
|
30
|
-
import {
|
|
28
|
+
import { applyChunkSplitConfig } from "./chunkSplit.js";
|
|
29
|
+
import { applyCssConfig } from "./css.js";
|
|
30
|
+
import { applyExperimentCssConfig } from "./experimentCss.js";
|
|
31
31
|
import { getEntry, getOutputFilename } from "./helper.js";
|
|
32
32
|
async function getBundlerConfig(unpackConfig) {
|
|
33
33
|
const isRspack = unpackConfig.bundler === "rspack";
|
|
34
|
+
const HtmlPlugin = isRspack ? rspack.HtmlRspackPlugin : HtmlWebpackPlugin;
|
|
34
35
|
const definePlugin = (define) => isRspack ? new rspack.DefinePlugin(define) : new EsbuildPlugin({ define, implementation: esbuild });
|
|
35
36
|
const JS_FILENAME = getOutputFilename({ type: "js", hash: unpackConfig.build?.filenameHash });
|
|
36
37
|
const IgnorePlugin = isRspack ? rspack.IgnorePlugin : webpack.IgnorePlugin;
|
|
@@ -84,12 +85,13 @@ async function getBundlerConfig(unpackConfig) {
|
|
|
84
85
|
plugins: [
|
|
85
86
|
unpackConfig.define && definePlugin(unpackConfig.define),
|
|
86
87
|
!unpackConfig.mpa && new HtmlPlugin({
|
|
87
|
-
template: unpackConfig.html?.template || "",
|
|
88
|
-
|
|
88
|
+
template: unpackConfig.html?.template || (isRspack ? void 0 : ""),
|
|
89
|
+
// @ts-expect-error
|
|
90
|
+
templateContent: unpackConfig.html?.templateContent || (!unpackConfig.html?.template ? TEMPLATE_CONTENT : isRspack ? void 0 : false),
|
|
89
91
|
templateParameters: {
|
|
90
92
|
mountId: unpackConfig.html?.mountId,
|
|
91
|
-
title: isFunction(unpackConfig.html?.title) ? unpackConfig.html?.title({ entryName: "index" }) : unpackConfig.html?.title,
|
|
92
|
-
headTag: unpackConfig.html?.headTag,
|
|
93
|
+
title: isFunction(unpackConfig.html?.title) ? unpackConfig.html?.title({ entryName: "index" }) : unpackConfig.html?.title || "",
|
|
94
|
+
headTag: unpackConfig.html?.headTag || "",
|
|
93
95
|
...unpackConfig.html?.templateParameters
|
|
94
96
|
},
|
|
95
97
|
minify: false,
|
|
@@ -101,7 +103,7 @@ async function getBundlerConfig(unpackConfig) {
|
|
|
101
103
|
contextRegExp: /moment$/
|
|
102
104
|
}),
|
|
103
105
|
unpackConfig.build?.copy && new CopyPlugin({ patterns: unpackConfig.build.copy }),
|
|
104
|
-
unpackConfig.build?.typeCheck && isDev() && isTs && new
|
|
106
|
+
unpackConfig.build?.typeCheck && isDev() && isTs && new TsCheckerRspackPlugin({
|
|
105
107
|
typescript: {
|
|
106
108
|
// set 'readonly' to avoid emitting tsbuildinfo, as the generated tsbuildinfo will break fork-ts-checker
|
|
107
109
|
mode: "readonly",
|
|
@@ -157,23 +159,25 @@ async function getBundlerConfig(unpackConfig) {
|
|
|
157
159
|
},
|
|
158
160
|
cache: unpackConfig.build?.cache && unpackConfig.bundler === "webpack" ? {
|
|
159
161
|
type: "filesystem"
|
|
160
|
-
} : void 0
|
|
162
|
+
} : void 0,
|
|
163
|
+
watchOptions: {
|
|
164
|
+
ignored: /[\\/](?:\.git|node_modules)[\\/]/
|
|
165
|
+
}
|
|
161
166
|
};
|
|
162
167
|
if (unpackConfig.experiments?.css)
|
|
163
168
|
logger.warn("Experiments.css is not stable yet, please use with caution");
|
|
164
|
-
config = unpackConfig.experiments?.css ?
|
|
165
|
-
config =
|
|
169
|
+
config = unpackConfig.experiments?.css ? applyExperimentCssConfig({ config, unpackConfig }) : applyCssConfig({ config, unpackConfig });
|
|
170
|
+
config = applyChunkSplitConfig({ config, unpackConfig });
|
|
166
171
|
for (const plugin of getNormalizedPluginsByHook("bundlerConfig", unpackConfig.plugins)) {
|
|
167
172
|
config = await plugin.bundlerConfig(config, {
|
|
168
173
|
unpackConfig,
|
|
169
174
|
mergeConfig,
|
|
170
|
-
bundler: webpack
|
|
175
|
+
bundler: isRspack ? rspack : webpack
|
|
171
176
|
});
|
|
172
177
|
}
|
|
173
178
|
if (unpackConfig.bundlerConfig) {
|
|
174
179
|
if (isFunction(unpackConfig.bundlerConfig)) {
|
|
175
180
|
config = await unpackConfig.bundlerConfig(config, {
|
|
176
|
-
bundler: unpackConfig.bundler,
|
|
177
181
|
mergeConfig
|
|
178
182
|
});
|
|
179
183
|
} else {
|
package/dist/createUnpack.cjs
CHANGED
|
@@ -76,7 +76,7 @@ function createUnpack() {
|
|
|
76
76
|
build: async (unpackConfig) => {
|
|
77
77
|
(0, import_utils.setNodeEnv)("production");
|
|
78
78
|
console.log(
|
|
79
|
-
import_colors.default.rainbow(`unpack v${"1.7.
|
|
79
|
+
import_colors.default.rainbow(`unpack v${"1.7.2"}`),
|
|
80
80
|
import_colors.default.green("building for production...")
|
|
81
81
|
);
|
|
82
82
|
const config = await resolveConfig(unpackConfig);
|
|
@@ -92,7 +92,7 @@ function createUnpack() {
|
|
|
92
92
|
watch: async (unpackConfig) => {
|
|
93
93
|
(0, import_utils.setNodeEnv)("development");
|
|
94
94
|
console.log(
|
|
95
|
-
import_colors.default.rainbow(`unpack v${"1.7.
|
|
95
|
+
import_colors.default.rainbow(`unpack v${"1.7.2"}`),
|
|
96
96
|
import_colors.default.green("building for development...")
|
|
97
97
|
);
|
|
98
98
|
const config = await resolveConfig(unpackConfig);
|
package/dist/createUnpack.js
CHANGED
|
@@ -53,7 +53,7 @@ function createUnpack() {
|
|
|
53
53
|
build: async (unpackConfig) => {
|
|
54
54
|
setNodeEnv("production");
|
|
55
55
|
console.log(
|
|
56
|
-
colors.rainbow(`unpack v${"1.7.
|
|
56
|
+
colors.rainbow(`unpack v${"1.7.2"}`),
|
|
57
57
|
colors.green("building for production...")
|
|
58
58
|
);
|
|
59
59
|
const config = await resolveConfig(unpackConfig);
|
|
@@ -69,7 +69,7 @@ function createUnpack() {
|
|
|
69
69
|
watch: async (unpackConfig) => {
|
|
70
70
|
setNodeEnv("development");
|
|
71
71
|
console.log(
|
|
72
|
-
colors.rainbow(`unpack v${"1.7.
|
|
72
|
+
colors.rainbow(`unpack v${"1.7.2"}`),
|
|
73
73
|
colors.green("building for development...")
|
|
74
74
|
);
|
|
75
75
|
const config = await resolveConfig(unpackConfig);
|
package/dist/index.cjs
CHANGED
|
@@ -28,7 +28,7 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
28
28
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
29
|
var src_exports = {};
|
|
30
30
|
__export(src_exports, {
|
|
31
|
-
|
|
31
|
+
HtmlWebpackPlugin: () => import_html_webpack_plugin.default,
|
|
32
32
|
colors: () => import_colors.default
|
|
33
33
|
});
|
|
34
34
|
module.exports = __toCommonJS(src_exports);
|
|
@@ -42,7 +42,7 @@ var import_colors = __toESM(require("./colors.cjs"));
|
|
|
42
42
|
var import_html_webpack_plugin = __toESM(require("html-webpack-plugin"));
|
|
43
43
|
// Annotate the CommonJS export names for ESM import in node:
|
|
44
44
|
0 && (module.exports = {
|
|
45
|
-
|
|
45
|
+
HtmlWebpackPlugin,
|
|
46
46
|
colors,
|
|
47
47
|
...require("./logger.cjs"),
|
|
48
48
|
...require("./types/index.cjs"),
|
package/dist/index.d.ts
CHANGED
|
@@ -5,5 +5,5 @@ export * from './constants';
|
|
|
5
5
|
export * from './createUnpack';
|
|
6
6
|
export * from './config';
|
|
7
7
|
export { default as colors } from './colors';
|
|
8
|
-
export { default as
|
|
8
|
+
export { default as HtmlWebpackPlugin } from 'html-webpack-plugin';
|
|
9
9
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAA;AACxB,cAAc,eAAe,CAAA;AAC7B,cAAc,SAAS,CAAA;AACvB,cAAc,aAAa,CAAA;AAC3B,cAAc,gBAAgB,CAAA;AAC9B,cAAc,UAAU,CAAA;AACxB,OAAO,EAAE,OAAO,IAAI,MAAM,EAAE,MAAM,UAAU,CAAA;AAC5C,OAAO,EAAE,OAAO,IAAI,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAA;AACxB,cAAc,eAAe,CAAA;AAC7B,cAAc,SAAS,CAAA;AACvB,cAAc,aAAa,CAAA;AAC3B,cAAc,gBAAgB,CAAA;AAC9B,cAAc,UAAU,CAAA;AACxB,OAAO,EAAE,OAAO,IAAI,MAAM,EAAE,MAAM,UAAU,CAAA;AAC5C,OAAO,EAAE,OAAO,IAAI,iBAAiB,EAAE,MAAM,qBAAqB,CAAA"}
|
package/dist/index.js
CHANGED
package/dist/logger.cjs
CHANGED
|
@@ -39,7 +39,8 @@ const prefixes = {
|
|
|
39
39
|
warn: "⚠",
|
|
40
40
|
info: "ℹ",
|
|
41
41
|
ready: "✓",
|
|
42
|
-
event: "»"
|
|
42
|
+
event: "»",
|
|
43
|
+
debug: "⚙"
|
|
43
44
|
};
|
|
44
45
|
const createLogger = () => {
|
|
45
46
|
const log = (type, message, ...args) => {
|
|
@@ -70,9 +71,10 @@ ${import_colors.default.dim(rest.join("\n"))}`;
|
|
|
70
71
|
text = message;
|
|
71
72
|
break;
|
|
72
73
|
}
|
|
74
|
+
if (type === "debug" && process.env.DEBUG !== "unpack")
|
|
75
|
+
return;
|
|
73
76
|
console.log(`${label} ${text}`, ...args);
|
|
74
77
|
};
|
|
75
|
-
const logTypes = ["error", "warn", "info", "ready", "event", "wait"];
|
|
76
78
|
const logger2 = {
|
|
77
79
|
clear: () => {
|
|
78
80
|
const repeatCount = process.stdout.rows - 2;
|
|
@@ -89,7 +91,7 @@ ${import_colors.default.dim(rest.join("\n"))}`;
|
|
|
89
91
|
console.log(msg);
|
|
90
92
|
}
|
|
91
93
|
};
|
|
92
|
-
|
|
94
|
+
Object.keys(prefixes).forEach((type) => {
|
|
93
95
|
logger2[type] = (message, ...args) => {
|
|
94
96
|
log(type, message, ...args);
|
|
95
97
|
};
|
package/dist/logger.js
CHANGED
|
@@ -16,7 +16,8 @@ const prefixes = {
|
|
|
16
16
|
warn: "⚠",
|
|
17
17
|
info: "ℹ",
|
|
18
18
|
ready: "✓",
|
|
19
|
-
event: "»"
|
|
19
|
+
event: "»",
|
|
20
|
+
debug: "⚙"
|
|
20
21
|
};
|
|
21
22
|
const createLogger = () => {
|
|
22
23
|
const log = (type, message, ...args) => {
|
|
@@ -47,9 +48,10 @@ ${colors.dim(rest.join("\n"))}`;
|
|
|
47
48
|
text = message;
|
|
48
49
|
break;
|
|
49
50
|
}
|
|
51
|
+
if (type === "debug" && process.env.DEBUG !== "unpack")
|
|
52
|
+
return;
|
|
50
53
|
console.log(`${label} ${text}`, ...args);
|
|
51
54
|
};
|
|
52
|
-
const logTypes = ["error", "warn", "info", "ready", "event", "wait"];
|
|
53
55
|
const logger2 = {
|
|
54
56
|
clear: () => {
|
|
55
57
|
const repeatCount = process.stdout.rows - 2;
|
|
@@ -66,7 +68,7 @@ ${colors.dim(rest.join("\n"))}`;
|
|
|
66
68
|
console.log(msg);
|
|
67
69
|
}
|
|
68
70
|
};
|
|
69
|
-
|
|
71
|
+
Object.keys(prefixes).forEach((type) => {
|
|
70
72
|
logger2[type] = (message, ...args) => {
|
|
71
73
|
log(type, message, ...args);
|
|
72
74
|
};
|
|
@@ -30,6 +30,7 @@ __export(rspack_exports, {
|
|
|
30
30
|
RspackPluginProgress: () => RspackPluginProgress
|
|
31
31
|
});
|
|
32
32
|
module.exports = __toCommonJS(rspack_exports);
|
|
33
|
+
var import_node_path = __toESM(require("node:path"));
|
|
33
34
|
var import_core = require("@rspack/core");
|
|
34
35
|
var import_colors = __toESM(require("../colors.cjs"));
|
|
35
36
|
var import_logger = require("../logger.cjs");
|
|
@@ -58,14 +59,20 @@ class RspackPluginProgress extends import_core.rspack.ProgressPlugin {
|
|
|
58
59
|
const hrtime = process.hrtime(this.startTime);
|
|
59
60
|
const compileTime = hrtime[0] + hrtime[1] / 1e9;
|
|
60
61
|
this.startTime = void 0;
|
|
62
|
+
const root = compiler.options.context;
|
|
61
63
|
if (!stats.hasErrors()) {
|
|
62
64
|
if ((0, import_utils.isProd)()) {
|
|
63
|
-
await (0, import_reporter.printFileSize)({ root
|
|
65
|
+
await (0, import_reporter.printFileSize)({ root, stats });
|
|
64
66
|
console.log(import_colors.default.green(`✓ built in ${import_colors.default.bold((0, import_utils.prettyTime)(compileTime))}`));
|
|
65
67
|
} else {
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
68
|
+
const modules = stats.compilation.modules;
|
|
69
|
+
modules.forEach((module2) => {
|
|
70
|
+
const { resource } = module2;
|
|
71
|
+
if (resource?.includes(import_node_path.default.resolve(root, "node_modules"))) {
|
|
72
|
+
import_logger.logger.debug(import_node_path.default.relative(root, resource));
|
|
73
|
+
}
|
|
74
|
+
});
|
|
75
|
+
import_logger.logger.ready(`built in ${(0, import_utils.prettyTime)(compileTime)} (${modules.size} modules)`);
|
|
69
76
|
}
|
|
70
77
|
}
|
|
71
78
|
});
|
|
@@ -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":"AACA,OAAO,EAAE,KAAK,QAAQ,EAAE,MAAM,EAAE,MAAM,cAAc,CAAA;AAGpD,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAA;AAK7C,qBAAa,oBAAqB,SAAQ,MAAM,CAAC,cAAc;IAC7D,SAAS,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,CAAY;IACxC,WAAW,cAAoB;;IAO/B,KAAK,CAAC,QAAQ,EAAE,QAAQ,GAAG,IAAI;CA8BhC"}
|
|
@@ -7,6 +7,7 @@ var getFilename = () => fileURLToPath(import.meta.url);
|
|
|
7
7
|
var getDirname = () => path.dirname(getFilename());
|
|
8
8
|
var __dirname = /* @__PURE__ */ getDirname();
|
|
9
9
|
var __filename = /* @__PURE__ */ getFilename();
|
|
10
|
+
import path2 from "node:path";
|
|
10
11
|
import { rspack } from "@rspack/core";
|
|
11
12
|
import colors from "../colors.js";
|
|
12
13
|
import { logger } from "../logger.js";
|
|
@@ -35,14 +36,20 @@ class RspackPluginProgress extends rspack.ProgressPlugin {
|
|
|
35
36
|
const hrtime = process.hrtime(this.startTime);
|
|
36
37
|
const compileTime = hrtime[0] + hrtime[1] / 1e9;
|
|
37
38
|
this.startTime = void 0;
|
|
39
|
+
const root = compiler.options.context;
|
|
38
40
|
if (!stats.hasErrors()) {
|
|
39
41
|
if (isProd()) {
|
|
40
|
-
await printFileSize({ root
|
|
42
|
+
await printFileSize({ root, stats });
|
|
41
43
|
console.log(colors.green(`✓ built in ${colors.bold(prettyTime(compileTime))}`));
|
|
42
44
|
} else {
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
45
|
+
const modules = stats.compilation.modules;
|
|
46
|
+
modules.forEach((module) => {
|
|
47
|
+
const { resource } = module;
|
|
48
|
+
if (resource?.includes(path2.resolve(root, "node_modules"))) {
|
|
49
|
+
logger.debug(path2.relative(root, resource));
|
|
50
|
+
}
|
|
51
|
+
});
|
|
52
|
+
logger.ready(`built in ${prettyTime(compileTime)} (${modules.size} modules)`);
|
|
46
53
|
}
|
|
47
54
|
}
|
|
48
55
|
});
|
|
@@ -30,6 +30,7 @@ __export(webpack_exports, {
|
|
|
30
30
|
WebpackPluginProgress: () => WebpackPluginProgress
|
|
31
31
|
});
|
|
32
32
|
module.exports = __toCommonJS(webpack_exports);
|
|
33
|
+
var import_node_path = __toESM(require("node:path"));
|
|
33
34
|
var import_colors = __toESM(require("../colors.cjs"));
|
|
34
35
|
var import_logger = require("../logger.cjs");
|
|
35
36
|
var import_progressBar = require("../progressBar.cjs");
|
|
@@ -68,14 +69,20 @@ class WebpackPluginProgress extends import_webpack.default.ProgressPlugin {
|
|
|
68
69
|
const hrtime = process.hrtime(this.startTime);
|
|
69
70
|
const compileTime = hrtime[0] + hrtime[1] / 1e9;
|
|
70
71
|
this.startTime = void 0;
|
|
72
|
+
const root = compiler.options.context;
|
|
71
73
|
if (!stats.hasErrors()) {
|
|
72
74
|
if ((0, import_utils.isProd)()) {
|
|
73
|
-
await (0, import_reporter.printFileSize)({ root
|
|
75
|
+
await (0, import_reporter.printFileSize)({ root, stats });
|
|
74
76
|
console.log(import_colors.default.green(`✓ built in ${import_colors.default.bold((0, import_utils.prettyTime)(compileTime))}`));
|
|
75
77
|
} else {
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
78
|
+
const modules = stats.compilation.modules;
|
|
79
|
+
modules.forEach((module2) => {
|
|
80
|
+
const { resource } = module2;
|
|
81
|
+
if (resource?.includes(import_node_path.default.resolve(root, "node_modules"))) {
|
|
82
|
+
import_logger.logger.debug(import_node_path.default.relative(root, resource));
|
|
83
|
+
}
|
|
84
|
+
});
|
|
85
|
+
import_logger.logger.ready(`built in ${(0, import_utils.prettyTime)(compileTime)} (${modules.size} modules)`);
|
|
79
86
|
}
|
|
80
87
|
}
|
|
81
88
|
});
|