@unpackjs/core 2.1.0 → 2.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/compiled/css-loader/index.js +49 -49
- package/compiled/less-loader/index.js +8 -8
- package/compiled/postcss-loader/index.js +37 -37
- package/compiled/sass-loader/index.js +8 -8
- package/dist/bundler-config/cache.cjs +113 -0
- package/dist/bundler-config/cache.d.ts +7 -0
- package/dist/bundler-config/cache.d.ts.map +1 -0
- package/dist/bundler-config/cache.js +71 -0
- package/dist/bundler-config/chunkSplit.d.ts.map +1 -1
- package/dist/bundler-config/chunkSplit.js +8 -8
- package/dist/bundler-config/css.cjs +15 -16
- package/dist/bundler-config/css.d.ts.map +1 -1
- package/dist/bundler-config/css.js +44 -45
- package/dist/bundler-config/experimentCss.cjs +14 -12
- package/dist/bundler-config/experimentCss.d.ts.map +1 -1
- package/dist/bundler-config/experimentCss.js +39 -37
- 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 +63 -25
- package/dist/bundler-config/index.d.ts.map +1 -1
- package/dist/bundler-config/index.js +103 -65
- package/dist/bundler-config/jsMinify.cjs +9 -11
- package/dist/bundler-config/jsMinify.d.ts +2 -10
- package/dist/bundler-config/jsMinify.d.ts.map +1 -1
- package/dist/bundler-config/jsMinify.js +14 -16
- package/dist/bundler-config/oxlint/.oxlintrc.json +29 -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/{plugin-progress/helper.cjs → bundler-config/progress/helpers.cjs} +24 -11
- package/dist/{plugin-progress/helper.d.ts → bundler-config/progress/helpers.d.ts} +1 -1
- package/dist/bundler-config/progress/helpers.d.ts.map +1 -0
- package/dist/bundler-config/progress/helpers.js +81 -0
- package/dist/{plugin-progress → bundler-config/progress}/rspack.cjs +11 -11
- package/dist/{plugin-progress → bundler-config/progress}/rspack.d.ts +2 -2
- package/dist/bundler-config/progress/rspack.d.ts.map +1 -0
- package/dist/bundler-config/progress/rspack.js +37 -0
- package/dist/{plugin-progress → bundler-config/progress}/webpack.cjs +14 -12
- 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 +4 -5
- package/dist/config.cjs +11 -3
- package/dist/config.d.ts +1 -0
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +25 -21
- package/dist/constants.cjs +21 -17
- package/dist/constants.d.ts +2 -1
- package/dist/constants.d.ts.map +1 -1
- package/dist/constants.js +11 -10
- package/dist/createUnpack.cjs +25 -33
- package/dist/createUnpack.d.ts +9 -4
- package/dist/createUnpack.d.ts.map +1 -1
- package/dist/createUnpack.js +36 -34
- package/dist/fs.cjs +91 -0
- package/dist/fs.d.ts +12 -0
- package/dist/fs.d.ts.map +1 -0
- package/dist/fs.js +34 -0
- package/dist/global.js +1 -1
- package/dist/index.cjs +71 -59
- package/dist/index.d.ts +9 -9
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +12 -47
- package/dist/lightningcss/loader.cjs +0 -2
- package/dist/lightningcss/loader.d.ts.map +1 -1
- package/dist/lightningcss/loader.js +5 -7
- package/dist/lightningcss/minimizer.cjs +14 -17
- package/dist/lightningcss/minimizer.d.ts +2 -2
- package/dist/lightningcss/minimizer.d.ts.map +1 -1
- package/dist/lightningcss/minimizer.js +16 -19
- package/dist/loadEnv.cjs +122 -0
- package/dist/loadEnv.d.ts +64 -0
- package/dist/loadEnv.d.ts.map +1 -0
- package/dist/loadEnv.js +80 -0
- package/dist/loadingAnimation.cjs +76 -0
- package/dist/loadingAnimation.d.ts +9 -0
- package/dist/loadingAnimation.d.ts.map +1 -0
- package/dist/loadingAnimation.js +44 -0
- package/dist/logger.cjs +6 -7
- package/dist/logger.d.ts.map +1 -1
- package/dist/logger.js +14 -14
- package/dist/openBrowser.d.ts.map +1 -1
- package/dist/openBrowser.js +8 -8
- package/dist/plugin.js +1 -1
- package/dist/prebundleDeps.cjs +31 -10
- package/dist/prebundleDeps.d.ts.map +1 -1
- package/dist/prebundleDeps.js +74 -52
- package/dist/progressBar.cjs +5 -12
- package/dist/progressBar.d.ts +2 -0
- package/dist/progressBar.d.ts.map +1 -1
- package/dist/progressBar.js +8 -5
- package/dist/reporter.cjs +15 -11
- package/dist/reporter.d.ts.map +1 -1
- package/dist/reporter.js +28 -23
- package/dist/run/build.cjs +4 -4
- package/dist/run/build.d.ts +1 -1
- package/dist/run/build.d.ts.map +1 -1
- package/dist/run/build.js +11 -11
- package/dist/run/dev.cjs +23 -16
- package/dist/run/dev.d.ts +1 -1
- package/dist/run/dev.d.ts.map +1 -1
- package/dist/run/dev.js +41 -33
- package/dist/run/index.js +1 -1
- package/dist/typed-css-modules/loader.cjs +2 -2
- package/dist/typed-css-modules/loader.d.ts.map +1 -1
- package/dist/typed-css-modules/loader.js +15 -15
- package/dist/typed-css-modules/plugin.cjs +1 -1
- package/dist/typed-css-modules/plugin.js +14 -14
- package/dist/typed-css-modules/utils.d.ts.map +1 -1
- package/dist/typed-css-modules/utils.js +7 -7
- package/dist/types/chunkSplit.js +1 -1
- package/dist/types/config.d.ts +32 -6
- package/dist/types/config.d.ts.map +1 -1
- package/dist/types/config.js +1 -1
- package/dist/types/index.cjs +15 -15
- package/dist/types/index.d.ts +3 -2
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/index.js +3 -3
- package/dist/types/lightningcss.d.ts +2 -2
- package/dist/types/lightningcss.d.ts.map +1 -1
- package/dist/types/lightningcss.js +1 -1
- package/dist/types/logger.js +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/types/plugin.d.ts +2 -2
- package/dist/types/plugin.d.ts.map +1 -1
- package/dist/types/plugin.js +1 -1
- package/dist/utils.cjs +28 -38
- package/dist/utils.d.ts +0 -1
- package/dist/utils.d.ts.map +1 -1
- package/dist/utils.js +19 -25
- package/dist/watchFiles.cjs +1 -1
- package/dist/watchFiles.d.ts +1 -1
- package/dist/watchFiles.d.ts.map +1 -1
- package/dist/watchFiles.js +6 -6
- package/package.json +6 -5
- package/dist/bundler-config/helper.d.ts.map +0 -1
- package/dist/bundler-config/helper.js +0 -39
- package/dist/plugin-progress/helper.d.ts.map +0 -1
- package/dist/plugin-progress/helper.js +0 -67
- package/dist/plugin-progress/rspack.d.ts.map +0 -1
- package/dist/plugin-progress/rspack.js +0 -37
- package/dist/plugin-progress/webpack.d.ts +0 -8
- package/dist/plugin-progress/webpack.d.ts.map +0 -1
- package/dist/plugin-progress/webpack.js +0 -42
|
@@ -4795,19 +4795,19 @@
|
|
|
4795
4795
|
}
|
|
4796
4796
|
});
|
|
4797
4797
|
},
|
|
4798
|
-
|
|
4798
|
+
92: (module, __unused_webpack_exports, __nccwpck_require__) => {
|
|
4799
4799
|
"use strict";
|
|
4800
|
-
const loader = __nccwpck_require__(
|
|
4800
|
+
const loader = __nccwpck_require__(810);
|
|
4801
4801
|
module.exports = loader.default;
|
|
4802
4802
|
},
|
|
4803
|
-
|
|
4803
|
+
810: (__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__(16));
|
|
4808
4808
|
var _path = _interopRequireDefault(__nccwpck_require__(928));
|
|
4809
|
-
var _options = _interopRequireDefault(__nccwpck_require__(
|
|
4810
|
-
var _utils = __nccwpck_require__(
|
|
4809
|
+
var _options = _interopRequireDefault(__nccwpck_require__(815));
|
|
4810
|
+
var _utils = __nccwpck_require__(859);
|
|
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
|
+
859: (__unused_webpack_module, exports, __nccwpck_require__) => {
|
|
4921
4921
|
"use strict";
|
|
4922
4922
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4923
4923
|
exports.errorFactory = errorFactory;
|
|
@@ -5582,7 +5582,7 @@
|
|
|
5582
5582
|
"use strict";
|
|
5583
5583
|
module.exports = require("url");
|
|
5584
5584
|
},
|
|
5585
|
-
|
|
5585
|
+
815: (module) => {
|
|
5586
5586
|
"use strict";
|
|
5587
5587
|
module.exports = JSON.parse(
|
|
5588
5588
|
'{"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}',
|
|
@@ -5612,6 +5612,6 @@
|
|
|
5612
5612
|
}
|
|
5613
5613
|
if (typeof __nccwpck_require__ !== "undefined")
|
|
5614
5614
|
__nccwpck_require__.ab = __dirname + "/";
|
|
5615
|
-
var __webpack_exports__ = __nccwpck_require__(
|
|
5615
|
+
var __webpack_exports__ = __nccwpck_require__(92);
|
|
5616
5616
|
module.exports = __webpack_exports__;
|
|
5617
5617
|
})();
|
|
@@ -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
|
+
applyCacheConfig: ()=>applyCacheConfig
|
|
37
|
+
});
|
|
38
|
+
const external_node_path_namespaceObject = require("node:path");
|
|
39
|
+
var external_node_path_default = /*#__PURE__*/ __webpack_require__.n(external_node_path_namespaceObject);
|
|
40
|
+
const external_config_cjs_namespaceObject = require("../config.cjs");
|
|
41
|
+
const external_fs_cjs_namespaceObject = require("../fs.cjs");
|
|
42
|
+
const external_logger_cjs_namespaceObject = require("../logger.cjs");
|
|
43
|
+
const external_utils_cjs_namespaceObject = require("../utils.cjs");
|
|
44
|
+
async function getBuildDependencies(root, userBuildDependencies, envFilePaths) {
|
|
45
|
+
const rootPackageJson = external_node_path_default().join(root, 'package.json');
|
|
46
|
+
const browserslistConfig = external_node_path_default().join(root, '.browserslistrc');
|
|
47
|
+
const tsconfigPath = external_node_path_default().join(root, 'tsconfig.json');
|
|
48
|
+
const buildDependencies = {};
|
|
49
|
+
if (await (0, external_fs_cjs_namespaceObject.isFileExists)(rootPackageJson)) buildDependencies.packageJson = [
|
|
50
|
+
rootPackageJson
|
|
51
|
+
];
|
|
52
|
+
if (await (0, external_fs_cjs_namespaceObject.isFileExists)(tsconfigPath)) buildDependencies.tsconfig = [
|
|
53
|
+
tsconfigPath
|
|
54
|
+
];
|
|
55
|
+
buildDependencies.unpackConfig = [
|
|
56
|
+
(0, external_config_cjs_namespaceObject.resolveConfigPath)(root)
|
|
57
|
+
];
|
|
58
|
+
if (await (0, external_fs_cjs_namespaceObject.isFileExists)(browserslistConfig)) buildDependencies.browserslistrc = [
|
|
59
|
+
browserslistConfig
|
|
60
|
+
];
|
|
61
|
+
const tailwindExts = [
|
|
62
|
+
'ts',
|
|
63
|
+
'js',
|
|
64
|
+
'cjs',
|
|
65
|
+
'mjs'
|
|
66
|
+
];
|
|
67
|
+
const configs = tailwindExts.map((ext)=>external_node_path_default().join(root, `tailwind.config.${ext}`));
|
|
68
|
+
const tailwindConfig = (0, external_fs_cjs_namespaceObject.findExists)(configs);
|
|
69
|
+
if (tailwindConfig) buildDependencies.tailwindcss = [
|
|
70
|
+
tailwindConfig
|
|
71
|
+
];
|
|
72
|
+
if (envFilePaths && envFilePaths.length > 0) buildDependencies.envFiles = envFilePaths;
|
|
73
|
+
return {
|
|
74
|
+
...buildDependencies,
|
|
75
|
+
userBuildDependencies
|
|
76
|
+
};
|
|
77
|
+
}
|
|
78
|
+
async function applyCacheConfig({ config, unpackConfig, envFilePaths }) {
|
|
79
|
+
if (!unpackConfig.build.cache || (0, external_utils_cjs_namespaceObject.isDevServer)() && unpackConfig.dev.lazyCompilation) return config;
|
|
80
|
+
const cacheConfig = (0, external_utils_cjs_namespaceObject.isPlainObject)(unpackConfig.build.cache) ? unpackConfig.build.cache : {};
|
|
81
|
+
const isRspack = 'rspack' === unpackConfig.bundler;
|
|
82
|
+
const buildDependencies = await getBuildDependencies(unpackConfig.root, cacheConfig.buildDependencies || [], envFilePaths);
|
|
83
|
+
let cacheDirectory = cacheConfig.cacheDirectory;
|
|
84
|
+
if (cacheDirectory) cacheDirectory = external_node_path_default().isAbsolute(cacheDirectory) ? cacheDirectory : external_node_path_default().join(unpackConfig.root, cacheDirectory);
|
|
85
|
+
external_logger_cjs_namespaceObject.logger.info('persistent cache enabled');
|
|
86
|
+
config = isRspack ? (0, external_utils_cjs_namespaceObject.mergeConfig)(config, {
|
|
87
|
+
cache: true,
|
|
88
|
+
experiments: {
|
|
89
|
+
cache: {
|
|
90
|
+
type: 'persistent',
|
|
91
|
+
buildDependencies: Object.values(buildDependencies).flat(),
|
|
92
|
+
storage: {
|
|
93
|
+
type: 'filesystem',
|
|
94
|
+
directory: cacheDirectory
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
}) : (0, external_utils_cjs_namespaceObject.mergeConfig)(config, {
|
|
99
|
+
cache: {
|
|
100
|
+
type: 'filesystem',
|
|
101
|
+
buildDependencies,
|
|
102
|
+
cacheDirectory
|
|
103
|
+
}
|
|
104
|
+
});
|
|
105
|
+
return config;
|
|
106
|
+
}
|
|
107
|
+
exports.applyCacheConfig = __webpack_exports__.applyCacheConfig;
|
|
108
|
+
for(var __webpack_i__ in __webpack_exports__)if (-1 === [
|
|
109
|
+
"applyCacheConfig"
|
|
110
|
+
].indexOf(__webpack_i__)) exports[__webpack_i__] = __webpack_exports__[__webpack_i__];
|
|
111
|
+
Object.defineProperty(exports, '__esModule', {
|
|
112
|
+
value: true
|
|
113
|
+
});
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { BundlerConfiguration, UnpackConfig } from '../types/index';
|
|
2
|
+
export declare function applyCacheConfig({ config, unpackConfig, envFilePaths, }: {
|
|
3
|
+
config: BundlerConfiguration;
|
|
4
|
+
unpackConfig: UnpackConfig;
|
|
5
|
+
envFilePaths?: string[];
|
|
6
|
+
}): Promise<BundlerConfiguration>;
|
|
7
|
+
//# sourceMappingURL=cache.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cache.d.ts","sourceRoot":"","sources":["../../src/bundler-config/cache.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,oBAAoB,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAA;AA6CzE,wBAAsB,gBAAgB,CAAC,EACrC,MAAM,EACN,YAAY,EACZ,YAAY,GACb,EAAE;IACD,MAAM,EAAE,oBAAoB,CAAA;IAC5B,YAAY,EAAE,YAAY,CAAA;IAC1B,YAAY,CAAC,EAAE,MAAM,EAAE,CAAA;CACxB,GAAG,OAAO,CAAC,oBAAoB,CAAC,CA0ChC"}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import 'module';
|
|
2
|
+
/*#__PURE__*/ import.meta.url;
|
|
3
|
+
import node_path from "node:path";
|
|
4
|
+
import { resolveConfigPath } from "../config.js";
|
|
5
|
+
import { findExists, isFileExists } from "../fs.js";
|
|
6
|
+
import { logger } from "../logger.js";
|
|
7
|
+
import { isDevServer, isPlainObject, mergeConfig } from "../utils.js";
|
|
8
|
+
async function getBuildDependencies(root, userBuildDependencies, envFilePaths) {
|
|
9
|
+
const rootPackageJson = node_path.join(root, 'package.json');
|
|
10
|
+
const browserslistConfig = node_path.join(root, '.browserslistrc');
|
|
11
|
+
const tsconfigPath = node_path.join(root, 'tsconfig.json');
|
|
12
|
+
const buildDependencies = {};
|
|
13
|
+
if (await isFileExists(rootPackageJson)) buildDependencies.packageJson = [
|
|
14
|
+
rootPackageJson
|
|
15
|
+
];
|
|
16
|
+
if (await isFileExists(tsconfigPath)) buildDependencies.tsconfig = [
|
|
17
|
+
tsconfigPath
|
|
18
|
+
];
|
|
19
|
+
buildDependencies.unpackConfig = [
|
|
20
|
+
resolveConfigPath(root)
|
|
21
|
+
];
|
|
22
|
+
if (await isFileExists(browserslistConfig)) buildDependencies.browserslistrc = [
|
|
23
|
+
browserslistConfig
|
|
24
|
+
];
|
|
25
|
+
const tailwindExts = [
|
|
26
|
+
'ts',
|
|
27
|
+
'js',
|
|
28
|
+
'cjs',
|
|
29
|
+
'mjs'
|
|
30
|
+
];
|
|
31
|
+
const configs = tailwindExts.map((ext)=>node_path.join(root, `tailwind.config.${ext}`));
|
|
32
|
+
const tailwindConfig = findExists(configs);
|
|
33
|
+
if (tailwindConfig) buildDependencies.tailwindcss = [
|
|
34
|
+
tailwindConfig
|
|
35
|
+
];
|
|
36
|
+
if (envFilePaths && envFilePaths.length > 0) buildDependencies.envFiles = envFilePaths;
|
|
37
|
+
return {
|
|
38
|
+
...buildDependencies,
|
|
39
|
+
userBuildDependencies
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
async function applyCacheConfig({ config, unpackConfig, envFilePaths }) {
|
|
43
|
+
if (!unpackConfig.build.cache || isDevServer() && unpackConfig.dev.lazyCompilation) return config;
|
|
44
|
+
const cacheConfig = isPlainObject(unpackConfig.build.cache) ? unpackConfig.build.cache : {};
|
|
45
|
+
const isRspack = 'rspack' === unpackConfig.bundler;
|
|
46
|
+
const buildDependencies = await getBuildDependencies(unpackConfig.root, cacheConfig.buildDependencies || [], envFilePaths);
|
|
47
|
+
let cacheDirectory = cacheConfig.cacheDirectory;
|
|
48
|
+
if (cacheDirectory) cacheDirectory = node_path.isAbsolute(cacheDirectory) ? cacheDirectory : node_path.join(unpackConfig.root, cacheDirectory);
|
|
49
|
+
logger.info('persistent cache enabled');
|
|
50
|
+
config = isRspack ? mergeConfig(config, {
|
|
51
|
+
cache: true,
|
|
52
|
+
experiments: {
|
|
53
|
+
cache: {
|
|
54
|
+
type: 'persistent',
|
|
55
|
+
buildDependencies: Object.values(buildDependencies).flat(),
|
|
56
|
+
storage: {
|
|
57
|
+
type: 'filesystem',
|
|
58
|
+
directory: cacheDirectory
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
}) : mergeConfig(config, {
|
|
63
|
+
cache: {
|
|
64
|
+
type: 'filesystem',
|
|
65
|
+
buildDependencies,
|
|
66
|
+
cacheDirectory
|
|
67
|
+
}
|
|
68
|
+
});
|
|
69
|
+
return config;
|
|
70
|
+
}
|
|
71
|
+
export { applyCacheConfig };
|
|
@@ -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,qBAAqB,
|
|
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,GAAI,2BAGnC;IACD,MAAM,EAAE,oBAAoB,CAAA;IAC5B,YAAY,EAAE,YAAY,CAAA;CAC3B,KAAG,oBAkBH,CAAA"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import
|
|
1
|
+
import 'module';
|
|
2
2
|
/*#__PURE__*/ import.meta.url;
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
3
|
+
import node_assert from "node:assert";
|
|
4
|
+
import { NODE_MODULES_REGEX } from "../constants.js";
|
|
5
|
+
import { setValueByPath } from "../utils.js";
|
|
6
6
|
function getForceSplittingGroups(forceSplitting, strategy) {
|
|
7
7
|
const cacheGroups = {};
|
|
8
8
|
const pairs = Array.isArray(forceSplitting) ? forceSplitting.map((regexp, index)=>[
|
|
@@ -44,7 +44,7 @@ function splitByExperience(ctx) {
|
|
|
44
44
|
}
|
|
45
45
|
function splitBySize(ctx) {
|
|
46
46
|
const { forceSplittingGroups, defaultConfig, chunkSplit } = ctx;
|
|
47
|
-
(
|
|
47
|
+
node_assert('split-by-size' === chunkSplit.strategy);
|
|
48
48
|
return {
|
|
49
49
|
...defaultConfig,
|
|
50
50
|
minSize: chunkSplit.minSize ?? 0,
|
|
@@ -78,7 +78,7 @@ function splitByModule(ctx) {
|
|
|
78
78
|
...forceSplittingGroups,
|
|
79
79
|
vendors: {
|
|
80
80
|
priority: -9,
|
|
81
|
-
test:
|
|
81
|
+
test: NODE_MODULES_REGEX,
|
|
82
82
|
name (module) {
|
|
83
83
|
return module ? getPackageNameFromModulePath(module.context) : void 0;
|
|
84
84
|
}
|
|
@@ -103,7 +103,7 @@ function singleVendor(ctx) {
|
|
|
103
103
|
const { defaultConfig, forceSplittingGroups } = ctx;
|
|
104
104
|
const singleVendorCacheGroup = {
|
|
105
105
|
singleVendor: {
|
|
106
|
-
test:
|
|
106
|
+
test: NODE_MODULES_REGEX,
|
|
107
107
|
priority: 0,
|
|
108
108
|
chunks: 'all',
|
|
109
109
|
name: 'vendor',
|
|
@@ -140,7 +140,7 @@ const applyChunkSplitConfig = ({ config, unpackConfig })=>{
|
|
|
140
140
|
forceSplittingGroups,
|
|
141
141
|
chunkSplit
|
|
142
142
|
});
|
|
143
|
-
|
|
143
|
+
setValueByPath(config, [
|
|
144
144
|
'optimization',
|
|
145
145
|
'splitChunks'
|
|
146
146
|
], splitChunksOptions);
|
|
@@ -42,11 +42,12 @@ const external_mini_css_extract_plugin_namespaceObject = require("mini-css-extra
|
|
|
42
42
|
var external_mini_css_extract_plugin_default = /*#__PURE__*/ __webpack_require__.n(external_mini_css_extract_plugin_namespaceObject);
|
|
43
43
|
const external_constants_cjs_namespaceObject = require("../constants.cjs");
|
|
44
44
|
const external_utils_cjs_namespaceObject = require("../utils.cjs");
|
|
45
|
-
const
|
|
45
|
+
const external_helpers_cjs_namespaceObject = require("./helpers.cjs");
|
|
46
46
|
function applyCssConfig({ config, unpackConfig }) {
|
|
47
|
-
var _unpackConfig_css,
|
|
47
|
+
var _unpackConfig_css, _unpackConfig_css1, _unpackConfig_build, _unpackConfig_css2, _config_module_rules, _config_module, _config_module_rules1, _config_module1, _unpackConfig_css3, _config_module_rules2, _config_module2;
|
|
48
48
|
const MiniCssExtractPlugin = 'rspack' === unpackConfig.bundler ? core_namespaceObject.rspack.CssExtractRspackPlugin : external_mini_css_extract_plugin_default();
|
|
49
|
-
|
|
49
|
+
const sourceMap = null == (_unpackConfig_css = unpackConfig.css) ? void 0 : _unpackConfig_css.sourceMap;
|
|
50
|
+
let modules = null == (_unpackConfig_css1 = unpackConfig.css) ? void 0 : _unpackConfig_css1.modules;
|
|
50
51
|
if (!(0, external_utils_cjs_namespaceObject.isPlainObject)(modules) && false !== modules) modules = {};
|
|
51
52
|
const getAutoOption = ()=>{
|
|
52
53
|
if (false === modules) return false;
|
|
@@ -59,9 +60,7 @@ function applyCssConfig({ config, unpackConfig }) {
|
|
|
59
60
|
return external_constants_cjs_namespaceObject.CSS_MODULES_REGEX.test(resourcePath);
|
|
60
61
|
};
|
|
61
62
|
};
|
|
62
|
-
const getCommonRules = ({ importLoaders })=>
|
|
63
|
-
var _unpackConfig_css;
|
|
64
|
-
return [
|
|
63
|
+
const getCommonRules = ({ importLoaders })=>[
|
|
65
64
|
(0, external_utils_cjs_namespaceObject.isDevServer)() ? {
|
|
66
65
|
loader: (0, external_utils_cjs_namespaceObject.getCompiledPkgPath)('style-loader')
|
|
67
66
|
} : {
|
|
@@ -86,15 +85,14 @@ function applyCssConfig({ config, unpackConfig }) {
|
|
|
86
85
|
exportLocalsConvention: external_constants_cjs_namespaceObject.EXPORT_LOCALS_CONVENTION,
|
|
87
86
|
namedExport: external_constants_cjs_namespaceObject.CSS_NAMED_EXPORT
|
|
88
87
|
},
|
|
89
|
-
sourceMap
|
|
88
|
+
sourceMap
|
|
90
89
|
}
|
|
91
90
|
}
|
|
92
91
|
].filter(Boolean);
|
|
93
|
-
};
|
|
94
92
|
if (!(0, external_utils_cjs_namespaceObject.isDevServer)()) {
|
|
95
93
|
var _unpackConfig_build1;
|
|
96
94
|
config.plugins.push(new MiniCssExtractPlugin({
|
|
97
|
-
filename: (0,
|
|
95
|
+
filename: (0, external_helpers_cjs_namespaceObject.getOutputFilename)({
|
|
98
96
|
type: 'css',
|
|
99
97
|
hash: null == (_unpackConfig_build1 = unpackConfig.build) ? void 0 : _unpackConfig_build1.filenameHash
|
|
100
98
|
})
|
|
@@ -115,29 +113,30 @@ function applyCssConfig({ config, unpackConfig }) {
|
|
|
115
113
|
options: {
|
|
116
114
|
lessOptions: (0, external_utils_cjs_namespaceObject.mergeConfig)({
|
|
117
115
|
javascriptEnabled: true
|
|
118
|
-
}, (null == (
|
|
116
|
+
}, (null == (_unpackConfig_css2 = unpackConfig.css) ? void 0 : _unpackConfig_css2.less) || {}),
|
|
119
117
|
implementation: (0, external_utils_cjs_namespaceObject.getUserDepPath)(unpackConfig.root, 'less'),
|
|
120
|
-
sourceMap
|
|
118
|
+
sourceMap
|
|
121
119
|
}
|
|
122
120
|
}
|
|
123
121
|
].filter(Boolean)
|
|
124
122
|
});
|
|
125
123
|
const getLightningcssLoader = ()=>{
|
|
126
|
-
var _unpackConfig_css
|
|
124
|
+
var _unpackConfig_css;
|
|
127
125
|
return {
|
|
128
126
|
loader: external_node_path_default().resolve(__dirname, '../lightningcss/loader.cjs'),
|
|
129
127
|
options: (0, external_utils_cjs_namespaceObject.mergeConfig)((null == (_unpackConfig_css = unpackConfig.css) ? void 0 : _unpackConfig_css.lightningcss) || {}, {
|
|
130
|
-
sourceMap
|
|
128
|
+
sourceMap,
|
|
129
|
+
targets: external_constants_cjs_namespaceObject.DEFAULT_LIGHTNINGCSS_TARGET
|
|
131
130
|
})
|
|
132
131
|
};
|
|
133
132
|
};
|
|
134
133
|
const getPostcssLoader = ()=>{
|
|
135
|
-
var _unpackConfig_css
|
|
134
|
+
var _unpackConfig_css;
|
|
136
135
|
return {
|
|
137
136
|
loader: (0, external_utils_cjs_namespaceObject.getCompiledPkgPath)('postcss-loader'),
|
|
138
137
|
options: {
|
|
139
138
|
postcssOptions: null == (_unpackConfig_css = unpackConfig.css) ? void 0 : _unpackConfig_css.postcss,
|
|
140
|
-
sourceMap
|
|
139
|
+
sourceMap
|
|
141
140
|
}
|
|
142
141
|
};
|
|
143
142
|
};
|
|
@@ -169,7 +168,7 @@ function applyCssConfig({ config, unpackConfig }) {
|
|
|
169
168
|
'sass'
|
|
170
169
|
]),
|
|
171
170
|
sassOptions: null == (_unpackConfig_css3 = unpackConfig.css) ? void 0 : _unpackConfig_css3.sass,
|
|
172
|
-
sourceMap
|
|
171
|
+
sourceMap
|
|
173
172
|
}
|
|
174
173
|
}
|
|
175
174
|
]
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"css.d.ts","sourceRoot":"","sources":["../../src/bundler-config/css.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"css.d.ts","sourceRoot":"","sources":["../../src/bundler-config/css.ts"],"names":[],"mappings":"AAWA,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"}
|
|
@@ -2,65 +2,63 @@ import __rslib_shim_module__ from 'module';
|
|
|
2
2
|
const require = /*#__PURE__*/ __rslib_shim_module__.createRequire(import.meta.url);
|
|
3
3
|
import { fileURLToPath as __webpack_fileURLToPath__ } from "node:url";
|
|
4
4
|
import { dirname as __webpack_dirname__ } from "node:path";
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
import
|
|
5
|
+
import node_path from "node:path";
|
|
6
|
+
import { rspack } from "@rspack/core";
|
|
7
|
+
import mini_css_extract_plugin from "mini-css-extract-plugin";
|
|
8
|
+
import { CSS_MODULES_LOCAL_IDENT_NAME, CSS_MODULES_REGEX, CSS_NAMED_EXPORT, DEFAULT_LIGHTNINGCSS_TARGET, EXPORT_LOCALS_CONVENTION, THREAD_OPTIONS } from "../constants.js";
|
|
9
|
+
import { getCompiledPkgPath, getUserDepPath, isDev, isDevServer, isFunction, isPlainObject, isRegExp, mergeConfig } from "../utils.js";
|
|
10
|
+
import { getOutputFilename } from "./helpers.js";
|
|
11
11
|
var css_dirname = __webpack_dirname__(__webpack_fileURLToPath__(import.meta.url));
|
|
12
12
|
function applyCssConfig({ config, unpackConfig }) {
|
|
13
|
-
var _unpackConfig_css,
|
|
14
|
-
const MiniCssExtractPlugin = 'rspack' === unpackConfig.bundler ?
|
|
15
|
-
|
|
16
|
-
|
|
13
|
+
var _unpackConfig_css, _unpackConfig_css1, _unpackConfig_build, _unpackConfig_css2, _config_module_rules, _config_module, _config_module_rules1, _config_module1, _unpackConfig_css3, _config_module_rules2, _config_module2;
|
|
14
|
+
const MiniCssExtractPlugin = 'rspack' === unpackConfig.bundler ? rspack.CssExtractRspackPlugin : mini_css_extract_plugin;
|
|
15
|
+
const sourceMap = null == (_unpackConfig_css = unpackConfig.css) ? void 0 : _unpackConfig_css.sourceMap;
|
|
16
|
+
let modules = null == (_unpackConfig_css1 = unpackConfig.css) ? void 0 : _unpackConfig_css1.modules;
|
|
17
|
+
if (!isPlainObject(modules) && false !== modules) modules = {};
|
|
17
18
|
const getAutoOption = ()=>{
|
|
18
19
|
if (false === modules) return false;
|
|
19
20
|
const auto = modules.auto;
|
|
20
21
|
if (false === auto) return false;
|
|
21
22
|
return (resourcePath)=>{
|
|
22
|
-
if (resourcePath.includes('node_modules')) return
|
|
23
|
-
if (
|
|
24
|
-
if (
|
|
25
|
-
return
|
|
23
|
+
if (resourcePath.includes('node_modules')) return CSS_MODULES_REGEX.test(resourcePath);
|
|
24
|
+
if (isRegExp(auto)) return auto.test(resourcePath);
|
|
25
|
+
if (isFunction(auto)) return auto(resourcePath);
|
|
26
|
+
return CSS_MODULES_REGEX.test(resourcePath);
|
|
26
27
|
};
|
|
27
28
|
};
|
|
28
|
-
const getCommonRules = ({ importLoaders })=>
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
(0, __WEBPACK_EXTERNAL_MODULE__utils_js_db66b9f7__.isDevServer)() ? {
|
|
32
|
-
loader: (0, __WEBPACK_EXTERNAL_MODULE__utils_js_db66b9f7__.getCompiledPkgPath)('style-loader')
|
|
29
|
+
const getCommonRules = ({ importLoaders })=>[
|
|
30
|
+
isDevServer() ? {
|
|
31
|
+
loader: getCompiledPkgPath('style-loader')
|
|
33
32
|
} : {
|
|
34
33
|
loader: MiniCssExtractPlugin.loader,
|
|
35
34
|
options: {
|
|
36
35
|
defaultExport: true
|
|
37
36
|
}
|
|
38
37
|
},
|
|
39
|
-
|
|
40
|
-
loader:
|
|
38
|
+
isDev() && {
|
|
39
|
+
loader: node_path.resolve(css_dirname, '../typed-css-modules/loader.cjs'),
|
|
41
40
|
options: {
|
|
42
41
|
modules
|
|
43
42
|
}
|
|
44
43
|
},
|
|
45
44
|
{
|
|
46
|
-
loader:
|
|
45
|
+
loader: getCompiledPkgPath('css-loader'),
|
|
47
46
|
options: {
|
|
48
47
|
importLoaders,
|
|
49
48
|
modules: {
|
|
50
49
|
auto: getAutoOption(),
|
|
51
|
-
localIdentName: false !== modules && (modules.localIdentName ||
|
|
52
|
-
exportLocalsConvention:
|
|
53
|
-
namedExport:
|
|
50
|
+
localIdentName: false !== modules && (modules.localIdentName || CSS_MODULES_LOCAL_IDENT_NAME),
|
|
51
|
+
exportLocalsConvention: EXPORT_LOCALS_CONVENTION,
|
|
52
|
+
namedExport: CSS_NAMED_EXPORT
|
|
54
53
|
},
|
|
55
|
-
sourceMap
|
|
54
|
+
sourceMap
|
|
56
55
|
}
|
|
57
56
|
}
|
|
58
57
|
].filter(Boolean);
|
|
59
|
-
|
|
60
|
-
if (!(0, __WEBPACK_EXTERNAL_MODULE__utils_js_db66b9f7__.isDevServer)()) {
|
|
58
|
+
if (!isDevServer()) {
|
|
61
59
|
var _unpackConfig_build1;
|
|
62
60
|
config.plugins.push(new MiniCssExtractPlugin({
|
|
63
|
-
filename:
|
|
61
|
+
filename: getOutputFilename({
|
|
64
62
|
type: 'css',
|
|
65
63
|
hash: null == (_unpackConfig_build1 = unpackConfig.build) ? void 0 : _unpackConfig_build1.filenameHash
|
|
66
64
|
})
|
|
@@ -74,36 +72,37 @@ function applyCssConfig({ config, unpackConfig }) {
|
|
|
74
72
|
}),
|
|
75
73
|
(null == (_unpackConfig_build = unpackConfig.build) ? void 0 : _unpackConfig_build.parallel) && {
|
|
76
74
|
loader: require.resolve('thread-loader'),
|
|
77
|
-
options:
|
|
75
|
+
options: THREAD_OPTIONS
|
|
78
76
|
},
|
|
79
77
|
{
|
|
80
|
-
loader:
|
|
78
|
+
loader: getCompiledPkgPath('less-loader'),
|
|
81
79
|
options: {
|
|
82
|
-
lessOptions:
|
|
80
|
+
lessOptions: mergeConfig({
|
|
83
81
|
javascriptEnabled: true
|
|
84
|
-
}, (null == (
|
|
85
|
-
implementation:
|
|
86
|
-
sourceMap
|
|
82
|
+
}, (null == (_unpackConfig_css2 = unpackConfig.css) ? void 0 : _unpackConfig_css2.less) || {}),
|
|
83
|
+
implementation: getUserDepPath(unpackConfig.root, 'less'),
|
|
84
|
+
sourceMap
|
|
87
85
|
}
|
|
88
86
|
}
|
|
89
87
|
].filter(Boolean)
|
|
90
88
|
});
|
|
91
89
|
const getLightningcssLoader = ()=>{
|
|
92
|
-
var _unpackConfig_css
|
|
90
|
+
var _unpackConfig_css;
|
|
93
91
|
return {
|
|
94
|
-
loader:
|
|
95
|
-
options:
|
|
96
|
-
sourceMap
|
|
92
|
+
loader: node_path.resolve(css_dirname, '../lightningcss/loader.cjs'),
|
|
93
|
+
options: mergeConfig((null == (_unpackConfig_css = unpackConfig.css) ? void 0 : _unpackConfig_css.lightningcss) || {}, {
|
|
94
|
+
sourceMap,
|
|
95
|
+
targets: DEFAULT_LIGHTNINGCSS_TARGET
|
|
97
96
|
})
|
|
98
97
|
};
|
|
99
98
|
};
|
|
100
99
|
const getPostcssLoader = ()=>{
|
|
101
|
-
var _unpackConfig_css
|
|
100
|
+
var _unpackConfig_css;
|
|
102
101
|
return {
|
|
103
|
-
loader:
|
|
102
|
+
loader: getCompiledPkgPath('postcss-loader'),
|
|
104
103
|
options: {
|
|
105
104
|
postcssOptions: null == (_unpackConfig_css = unpackConfig.css) ? void 0 : _unpackConfig_css.postcss,
|
|
106
|
-
sourceMap
|
|
105
|
+
sourceMap
|
|
107
106
|
}
|
|
108
107
|
};
|
|
109
108
|
};
|
|
@@ -127,15 +126,15 @@ function applyCssConfig({ config, unpackConfig }) {
|
|
|
127
126
|
importLoaders: 1
|
|
128
127
|
}),
|
|
129
128
|
{
|
|
130
|
-
loader:
|
|
129
|
+
loader: getCompiledPkgPath('sass-loader'),
|
|
131
130
|
options: {
|
|
132
131
|
api: 'modern-compiler',
|
|
133
|
-
implementation:
|
|
132
|
+
implementation: getUserDepPath(unpackConfig.root, [
|
|
134
133
|
'sass-embedded',
|
|
135
134
|
'sass'
|
|
136
135
|
]),
|
|
137
136
|
sassOptions: null == (_unpackConfig_css3 = unpackConfig.css) ? void 0 : _unpackConfig_css3.sass,
|
|
138
|
-
sourceMap
|
|
137
|
+
sourceMap
|
|
139
138
|
}
|
|
140
139
|
}
|
|
141
140
|
]
|