@unpackjs/core 1.7.4 → 1.7.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (123) hide show
  1. package/compiled/css-loader/index.js +178 -178
  2. package/compiled/less-loader/index.js +11 -11
  3. package/compiled/line-diff/index.js +4 -4
  4. package/compiled/portfinder/index.js +37 -37
  5. package/compiled/postcss-loader/index.js +261 -256
  6. package/compiled/sass-loader/index.js +18 -18
  7. package/compiled/semver/index.js +188 -170
  8. package/compiled/semver/package.json +1 -1
  9. package/compiled/style-loader/index.js +13 -13
  10. package/compiled/webpack-bundle-analyzer/index.js +198 -198
  11. package/compiled/webpack-merge/index.js +29 -29
  12. package/dist/bundler-config/chunkSplit.cjs +169 -156
  13. package/dist/bundler-config/chunkSplit.d.ts +1 -1
  14. package/dist/bundler-config/chunkSplit.js +125 -134
  15. package/dist/bundler-config/css.cjs +181 -158
  16. package/dist/bundler-config/css.d.ts +1 -1
  17. package/dist/bundler-config/css.js +139 -151
  18. package/dist/bundler-config/experimentCss.cjs +203 -159
  19. package/dist/bundler-config/experimentCss.d.ts +1 -1
  20. package/dist/bundler-config/experimentCss.js +162 -152
  21. package/dist/bundler-config/helper.cjs +82 -78
  22. package/dist/bundler-config/helper.js +36 -55
  23. package/dist/bundler-config/index.cjs +260 -209
  24. package/dist/bundler-config/index.d.ts +1 -1
  25. package/dist/bundler-config/index.d.ts.map +1 -1
  26. package/dist/bundler-config/index.js +209 -182
  27. package/dist/bundler-config/jsMinify.cjs +114 -95
  28. package/dist/bundler-config/jsMinify.js +70 -73
  29. package/dist/colors.cjs +83 -56
  30. package/dist/colors.js +38 -37
  31. package/dist/config.cjs +107 -93
  32. package/dist/config.d.ts +1 -1
  33. package/dist/config.d.ts.map +1 -1
  34. package/dist/config.js +64 -70
  35. package/dist/constants.cjs +62 -62
  36. package/dist/constants.js +20 -38
  37. package/dist/createUnpack.cjs +111 -104
  38. package/dist/createUnpack.js +67 -82
  39. package/dist/global.cjs +36 -0
  40. package/dist/global.d.ts +2 -0
  41. package/dist/global.d.ts.map +1 -0
  42. package/dist/global.js +4 -0
  43. package/dist/index.cjs +174 -51
  44. package/dist/index.d.ts +2 -0
  45. package/dist/index.d.ts.map +1 -1
  46. package/dist/index.js +33 -15
  47. package/dist/lightningcss/cache.cjs +40 -32
  48. package/dist/lightningcss/cache.js +10 -20
  49. package/dist/lightningcss/loader.cjs +56 -53
  50. package/dist/lightningcss/loader.d.ts +1 -1
  51. package/dist/lightningcss/loader.js +25 -34
  52. package/dist/lightningcss/minimizer.cjs +90 -109
  53. package/dist/lightningcss/minimizer.d.ts +1 -1
  54. package/dist/lightningcss/minimizer.js +59 -87
  55. package/dist/logger.cjs +104 -98
  56. package/dist/logger.d.ts +1 -1
  57. package/dist/logger.js +59 -76
  58. package/dist/openBrowser.cjs +104 -81
  59. package/dist/openBrowser.js +56 -52
  60. package/dist/plugin-progress/rspack.cjs +104 -79
  61. package/dist/plugin-progress/rspack.d.ts +1 -1
  62. package/dist/plugin-progress/rspack.js +59 -57
  63. package/dist/plugin-progress/webpack.cjs +111 -89
  64. package/dist/plugin-progress/webpack.d.ts +1 -1
  65. package/dist/plugin-progress/webpack.js +65 -67
  66. package/dist/plugin.cjs +38 -29
  67. package/dist/plugin.js +8 -17
  68. package/dist/prebundleDeps.cjs +327 -337
  69. package/dist/prebundleDeps.d.ts.map +1 -1
  70. package/dist/prebundleDeps.js +278 -324
  71. package/dist/progressBar.cjs +82 -65
  72. package/dist/progressBar.js +38 -43
  73. package/dist/reporter.cjs +135 -120
  74. package/dist/reporter.js +88 -98
  75. package/dist/run/build.cjs +68 -67
  76. package/dist/run/build.d.ts +1 -1
  77. package/dist/run/build.js +24 -45
  78. package/dist/run/dev.cjs +96 -83
  79. package/dist/run/dev.d.ts +1 -1
  80. package/dist/run/dev.d.ts.map +1 -1
  81. package/dist/run/dev.js +50 -61
  82. package/dist/run/index.cjs +74 -21
  83. package/dist/run/index.js +2 -9
  84. package/dist/typed-css-modules/loader.cjs +179 -188
  85. package/dist/typed-css-modules/loader.d.ts +1 -1
  86. package/dist/typed-css-modules/loader.js +118 -151
  87. package/dist/typed-css-modules/plugin.cjs +113 -88
  88. package/dist/typed-css-modules/plugin.d.ts +1 -1
  89. package/dist/typed-css-modules/plugin.js +68 -66
  90. package/dist/typed-css-modules/utils.cjs +43 -42
  91. package/dist/typed-css-modules/utils.d.ts +1 -1
  92. package/dist/typed-css-modules/utils.js +13 -30
  93. package/dist/types/chunkSplit.cjs +19 -15
  94. package/dist/types/chunkSplit.d.ts +2 -10
  95. package/dist/types/chunkSplit.d.ts.map +1 -1
  96. package/dist/types/chunkSplit.js +2 -9
  97. package/dist/types/config.cjs +19 -15
  98. package/dist/types/config.d.ts +1 -5
  99. package/dist/types/config.d.ts.map +1 -1
  100. package/dist/types/config.js +2 -9
  101. package/dist/types/index.cjs +101 -27
  102. package/dist/types/index.js +2 -9
  103. package/dist/types/lightningcss.cjs +19 -15
  104. package/dist/types/lightningcss.js +2 -9
  105. package/dist/types/logger.cjs +43 -34
  106. package/dist/types/logger.js +13 -22
  107. package/dist/types/plugin.cjs +19 -15
  108. package/dist/types/plugin.js +2 -9
  109. package/dist/utils.cjs +280 -304
  110. package/dist/utils.js +195 -241
  111. package/dist/watchFiles.cjs +73 -0
  112. package/dist/watchFiles.d.ts +3 -0
  113. package/dist/watchFiles.d.ts.map +1 -0
  114. package/dist/watchFiles.js +27 -0
  115. package/package.json +14 -17
  116. package/compiled/commander/index.d.ts +0 -971
  117. package/compiled/commander/index.js +0 -2190
  118. package/compiled/commander/license +0 -22
  119. package/compiled/commander/package.json +0 -1
  120. package/dist/bundleRequire.cjs +0 -200
  121. package/dist/bundleRequire.d.ts +0 -5
  122. package/dist/bundleRequire.d.ts.map +0 -1
  123. package/dist/bundleRequire.js +0 -173
@@ -1,159 +1,150 @@
1
- import { createRequire } from 'node:module';
2
- var require = createRequire(import.meta['url']);
3
-
4
- import path from "path";
5
- import { fileURLToPath } from "url";
6
- var getFilename = () => fileURLToPath(import.meta.url);
7
- var getDirname = () => path.dirname(getFilename());
8
- var __dirname = /* @__PURE__ */ getDirname();
9
- var __filename = /* @__PURE__ */ getFilename();
10
- import assert from "node:assert";
11
- import { NODE_MODULES_REGEX } from "../constants.js";
12
- import { setValueByPath } from "../utils.js";
1
+ import __rslib_shim_module__ from 'module';
2
+ /*#__PURE__*/ import.meta.url;
3
+ import * as __WEBPACK_EXTERNAL_MODULE_node_assert_3e74d44e__ from "node:assert";
4
+ import * as __WEBPACK_EXTERNAL_MODULE__constants_js_59e7fa1b__ from "../constants.js";
5
+ import * as __WEBPACK_EXTERNAL_MODULE__utils_js_db66b9f7__ from "../utils.js";
13
6
  function getForceSplittingGroups(forceSplitting) {
14
- const cacheGroups = {};
15
- const pairs = Array.isArray(forceSplitting) ? forceSplitting.map((regexp, index) => [`force-split-${index}`, regexp]) : Object.entries(forceSplitting);
16
- for (const [key, regexp] of pairs) {
17
- cacheGroups[key] = {
18
- test: regexp,
19
- name: key,
20
- chunks: "all",
21
- priority: 0,
22
- // Ignore minimum size, minimum chunks and maximum requests and always create chunks.
23
- enforce: true
7
+ const cacheGroups = {};
8
+ const pairs = Array.isArray(forceSplitting) ? forceSplitting.map((regexp, index)=>[
9
+ `force-split-${index}`,
10
+ regexp
11
+ ]) : Object.entries(forceSplitting);
12
+ for (const [key, regexp] of pairs)cacheGroups[key] = {
13
+ test: regexp,
14
+ name: key,
15
+ chunks: 'all',
16
+ priority: 0,
17
+ enforce: true
24
18
  };
25
- }
26
- return cacheGroups;
19
+ return cacheGroups;
27
20
  }
28
21
  function splitByExperience(ctx) {
29
- const { defaultConfig, forceSplittingGroups } = ctx;
30
- const experienceCacheGroup = {};
31
- const packageRegExps = {
32
- axios: /node_modules[\\/]axios(-.+)?[\\/]/,
33
- polyfill: /node_modules[\\/](?:tslib|core-js|@swc[\\/]helpers)[\\/]/
34
- };
35
- for (const [name, test] of Object.entries(packageRegExps)) {
36
- const key = `lib-${name}`;
37
- experienceCacheGroup[key] = {
38
- test,
39
- priority: 0,
40
- name: key
22
+ const { defaultConfig, forceSplittingGroups } = ctx;
23
+ const experienceCacheGroup = {};
24
+ const packageRegExps = {
25
+ axios: /node_modules[\\/]axios(-.+)?[\\/]/,
26
+ polyfill: /node_modules[\\/](?:tslib|core-js|@swc[\\/]helpers)[\\/]/
41
27
  };
42
- }
43
- return {
44
- ...defaultConfig,
45
- cacheGroups: {
46
- ...defaultConfig.cacheGroups,
47
- ...experienceCacheGroup,
48
- ...forceSplittingGroups
28
+ for (const [name, test] of Object.entries(packageRegExps)){
29
+ const key = `lib-${name}`;
30
+ experienceCacheGroup[key] = {
31
+ test,
32
+ priority: 0,
33
+ name: key
34
+ };
49
35
  }
50
- };
36
+ return {
37
+ ...defaultConfig,
38
+ cacheGroups: {
39
+ ...defaultConfig.cacheGroups,
40
+ ...experienceCacheGroup,
41
+ ...forceSplittingGroups
42
+ }
43
+ };
51
44
  }
52
45
  function splitBySize(ctx) {
53
- const { forceSplittingGroups, defaultConfig, chunkSplit } = ctx;
54
- assert(chunkSplit.strategy === "split-by-size");
55
- return {
56
- ...defaultConfig,
57
- minSize: chunkSplit.minSize ?? 0,
58
- maxSize: chunkSplit.maxSize ?? Number.POSITIVE_INFINITY,
59
- cacheGroups: {
60
- ...defaultConfig.cacheGroups,
61
- ...forceSplittingGroups
62
- }
63
- };
46
+ const { forceSplittingGroups, defaultConfig, chunkSplit } = ctx;
47
+ (0, __WEBPACK_EXTERNAL_MODULE_node_assert_3e74d44e__["default"])('split-by-size' === chunkSplit.strategy);
48
+ return {
49
+ ...defaultConfig,
50
+ minSize: chunkSplit.minSize ?? 0,
51
+ maxSize: chunkSplit.maxSize ?? Number.POSITIVE_INFINITY,
52
+ cacheGroups: {
53
+ ...defaultConfig.cacheGroups,
54
+ ...forceSplittingGroups
55
+ }
56
+ };
64
57
  }
65
58
  const MODULE_PATH_REGEX = /.*[\\/]node_modules[\\/](?!\.pnpm[\\/])(?:(@[^\\/]+)[\\/])?([^\\/]+)/;
66
59
  function getPackageNameFromModulePath(modulePath) {
67
- const handleModuleContext = modulePath?.match(MODULE_PATH_REGEX);
68
- if (!handleModuleContext) {
69
- return void 0;
70
- }
71
- const [, scope, name] = handleModuleContext;
72
- const packageName = ["npm", (scope ?? "").replace("@", ""), name].filter(Boolean).join(".");
73
- return packageName;
60
+ const handleModuleContext = null == modulePath ? void 0 : modulePath.match(MODULE_PATH_REGEX);
61
+ if (!handleModuleContext) return;
62
+ const [, scope, name] = handleModuleContext;
63
+ const packageName = [
64
+ 'npm',
65
+ (scope ?? '').replace('@', ''),
66
+ name
67
+ ].filter(Boolean).join('.');
68
+ return packageName;
74
69
  }
75
70
  function splitByModule(ctx) {
76
- const { forceSplittingGroups, defaultConfig } = ctx;
77
- return {
78
- ...defaultConfig,
79
- minSize: 0,
80
- maxInitialRequests: Number.POSITIVE_INFINITY,
81
- cacheGroups: {
82
- ...defaultConfig.cacheGroups,
83
- ...forceSplittingGroups,
84
- vendors: {
85
- priority: -9,
86
- test: NODE_MODULES_REGEX,
87
- name(module) {
88
- return module ? getPackageNameFromModulePath(module.context) : void 0;
71
+ const { forceSplittingGroups, defaultConfig } = ctx;
72
+ return {
73
+ ...defaultConfig,
74
+ minSize: 0,
75
+ maxInitialRequests: Number.POSITIVE_INFINITY,
76
+ cacheGroups: {
77
+ ...defaultConfig.cacheGroups,
78
+ ...forceSplittingGroups,
79
+ vendors: {
80
+ priority: -9,
81
+ test: __WEBPACK_EXTERNAL_MODULE__constants_js_59e7fa1b__.NODE_MODULES_REGEX,
82
+ name (module) {
83
+ return module ? getPackageNameFromModulePath(module.context) : void 0;
84
+ }
85
+ }
89
86
  }
90
- }
91
- }
92
- };
87
+ };
93
88
  }
94
89
  function splitCustom(ctx) {
95
- const { forceSplittingGroups, defaultConfig } = ctx;
96
- return {
97
- ...defaultConfig,
98
- cacheGroups: {
99
- ...defaultConfig.cacheGroups,
100
- ...forceSplittingGroups
101
- }
102
- };
90
+ const { forceSplittingGroups, defaultConfig } = ctx;
91
+ return {
92
+ ...defaultConfig,
93
+ cacheGroups: {
94
+ ...defaultConfig.cacheGroups,
95
+ ...forceSplittingGroups
96
+ }
97
+ };
103
98
  }
104
99
  function allInOne(_ctx) {
105
- return false;
100
+ return false;
106
101
  }
107
102
  function singleVendor(ctx) {
108
- const { defaultConfig, forceSplittingGroups } = ctx;
109
- const singleVendorCacheGroup = {
110
- singleVendor: {
111
- test: NODE_MODULES_REGEX,
112
- priority: 0,
113
- chunks: "all",
114
- name: "vendor",
115
- enforce: true
116
- }
117
- };
118
- return {
119
- ...defaultConfig,
120
- cacheGroups: {
121
- ...defaultConfig.cacheGroups,
122
- ...singleVendorCacheGroup,
123
- ...forceSplittingGroups
124
- }
125
- };
103
+ const { defaultConfig, forceSplittingGroups } = ctx;
104
+ const singleVendorCacheGroup = {
105
+ singleVendor: {
106
+ test: __WEBPACK_EXTERNAL_MODULE__constants_js_59e7fa1b__.NODE_MODULES_REGEX,
107
+ priority: 0,
108
+ chunks: 'all',
109
+ name: 'vendor',
110
+ enforce: true
111
+ }
112
+ };
113
+ return {
114
+ ...defaultConfig,
115
+ cacheGroups: {
116
+ ...defaultConfig.cacheGroups,
117
+ ...singleVendorCacheGroup,
118
+ ...forceSplittingGroups
119
+ }
120
+ };
126
121
  }
127
122
  const SPLIT_STRATEGY_DISPATCHER = {
128
- "split-by-experience": splitByExperience,
129
- "split-by-module": splitByModule,
130
- "split-by-size": splitBySize,
131
- custom: splitCustom,
132
- "all-in-one": allInOne,
133
- "single-vendor": singleVendor
123
+ 'split-by-experience': splitByExperience,
124
+ 'split-by-module': splitByModule,
125
+ 'split-by-size': splitBySize,
126
+ custom: splitCustom,
127
+ 'all-in-one': allInOne,
128
+ 'single-vendor': singleVendor
134
129
  };
135
- const applyChunkSplitConfig = ({
136
- config,
137
- unpackConfig
138
- }) => {
139
- const { chunkSplit } = unpackConfig.performance || {};
140
- if (chunkSplit?.strategy) {
141
- let forceSplittingGroups = {};
142
- if (chunkSplit?.forceSplitting) {
143
- forceSplittingGroups = getForceSplittingGroups(chunkSplit.forceSplitting);
130
+ const applyChunkSplitConfig = ({ config, unpackConfig })=>{
131
+ const { chunkSplit } = unpackConfig.performance || {};
132
+ if (null == chunkSplit ? void 0 : chunkSplit.strategy) {
133
+ let forceSplittingGroups = {};
134
+ if (null == chunkSplit ? void 0 : chunkSplit.forceSplitting) forceSplittingGroups = getForceSplittingGroups(chunkSplit.forceSplitting);
135
+ const defaultConfig = {
136
+ chunks: 'all'
137
+ };
138
+ const splitChunksOptions = SPLIT_STRATEGY_DISPATCHER[chunkSplit.strategy]({
139
+ defaultConfig,
140
+ forceSplittingGroups,
141
+ chunkSplit
142
+ });
143
+ (0, __WEBPACK_EXTERNAL_MODULE__utils_js_db66b9f7__.setValueByPath)(config, [
144
+ 'optimization',
145
+ 'splitChunks'
146
+ ], splitChunksOptions);
144
147
  }
145
- const defaultConfig = {
146
- chunks: "all"
147
- };
148
- const splitChunksOptions = SPLIT_STRATEGY_DISPATCHER[chunkSplit.strategy]({
149
- defaultConfig,
150
- forceSplittingGroups,
151
- chunkSplit
152
- });
153
- setValueByPath(config, ["optimization", "splitChunks"], splitChunksOptions);
154
- }
155
- return config;
156
- };
157
- export {
158
- applyChunkSplitConfig
148
+ return config;
159
149
  };
150
+ export { applyChunkSplitConfig };
@@ -1,166 +1,189 @@
1
- var __create = Object.create;
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __getProtoOf = Object.getPrototypeOf;
6
- var __hasOwnProp = Object.prototype.hasOwnProperty;
7
- var __export = (target, all) => {
8
- for (var name in all)
9
- __defProp(target, name, { get: all[name], enumerable: true });
10
- };
11
- var __copyProps = (to, from, except, desc) => {
12
- if (from && typeof from === "object" || typeof from === "function") {
13
- for (let key of __getOwnPropNames(from))
14
- if (!__hasOwnProp.call(to, key) && key !== except)
15
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
16
- }
17
- return to;
18
- };
19
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
20
- // If the importer is in node compatibility mode or this is not an ESM
21
- // file that has been converted to a CommonJS file using a Babel-
22
- // compatible transform (i.e. "__esModule" has not been set), then set
23
- // "default" to the CommonJS "module.exports" for node compatibility.
24
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
25
- mod
26
- ));
27
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
28
- var css_exports = {};
29
- __export(css_exports, {
30
- applyCssConfig: () => applyCssConfig
1
+ "use strict";
2
+ var __webpack_require__ = {};
3
+ (()=>{
4
+ __webpack_require__.n = function(module) {
5
+ var getter = module && module.__esModule ? function() {
6
+ return module['default'];
7
+ } : function() {
8
+ return module;
9
+ };
10
+ __webpack_require__.d(getter, {
11
+ a: getter
12
+ });
13
+ return getter;
14
+ };
15
+ })();
16
+ (()=>{
17
+ __webpack_require__.d = function(exports1, definition) {
18
+ for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
19
+ enumerable: true,
20
+ get: definition[key]
21
+ });
22
+ };
23
+ })();
24
+ (()=>{
25
+ __webpack_require__.o = function(obj, prop) {
26
+ return Object.prototype.hasOwnProperty.call(obj, prop);
27
+ };
28
+ })();
29
+ (()=>{
30
+ __webpack_require__.r = function(exports1) {
31
+ if ('undefined' != typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
32
+ value: 'Module'
33
+ });
34
+ Object.defineProperty(exports1, '__esModule', {
35
+ value: true
36
+ });
37
+ };
38
+ })();
39
+ var __webpack_exports__ = {};
40
+ __webpack_require__.r(__webpack_exports__);
41
+ __webpack_require__.d(__webpack_exports__, {
42
+ applyCssConfig: ()=>applyCssConfig
31
43
  });
32
- module.exports = __toCommonJS(css_exports);
33
- var import_node_path = __toESM(require("node:path"));
34
- var import_core = require("@rspack/core");
35
- var import_mini_css_extract_plugin = __toESM(require("mini-css-extract-plugin"));
36
- var import_constants = require("../constants.cjs");
37
- var import_utils = require("../utils.cjs");
38
- var import_helper = require("./helper.cjs");
39
- function applyCssConfig({
40
- config,
41
- unpackConfig
42
- }) {
43
- const MiniCssExtractPlugin = unpackConfig.bundler === "rspack" ? import_core.rspack.CssExtractRspackPlugin : import_mini_css_extract_plugin.default;
44
- let modules = unpackConfig.css?.modules;
45
- if (!(0, import_utils.isPlainObject)(modules) && modules !== false)
46
- modules = {};
47
- const getAutoOption = () => {
48
- if (modules === false)
49
- return false;
50
- const auto = modules.auto;
51
- if (auto === false)
52
- return false;
53
- return (resourcePath) => {
54
- if (resourcePath.includes("node_modules"))
55
- return import_constants.CSS_MODULES_REGEX.test(resourcePath);
56
- if ((0, import_utils.isRegExp)(auto))
57
- return auto.test(resourcePath);
58
- if ((0, import_utils.isFunction)(auto))
59
- return auto(resourcePath);
60
- return import_constants.CSS_MODULES_REGEX.test(resourcePath);
44
+ const external_node_path_namespaceObject = require("node:path");
45
+ var external_node_path_default = /*#__PURE__*/ __webpack_require__.n(external_node_path_namespaceObject);
46
+ const core_namespaceObject = require("@rspack/core");
47
+ const external_mini_css_extract_plugin_namespaceObject = require("mini-css-extract-plugin");
48
+ var external_mini_css_extract_plugin_default = /*#__PURE__*/ __webpack_require__.n(external_mini_css_extract_plugin_namespaceObject);
49
+ const external_constants_cjs_namespaceObject = require("../constants.cjs");
50
+ const external_utils_cjs_namespaceObject = require("../utils.cjs");
51
+ const external_helper_cjs_namespaceObject = require("./helper.cjs");
52
+ function applyCssConfig({ config, unpackConfig }) {
53
+ var _unpackConfig_css, _unpackConfig_build, _unpackConfig_css1, _unpackConfig_css2, _config_module_rules, _config_module, _config_module_rules1, _config_module1, _unpackConfig_css3, _unpackConfig_css4, _config_module_rules2, _config_module2;
54
+ const MiniCssExtractPlugin = 'rspack' === unpackConfig.bundler ? core_namespaceObject.rspack.CssExtractRspackPlugin : external_mini_css_extract_plugin_default();
55
+ let modules = null === (_unpackConfig_css = unpackConfig.css) || void 0 === _unpackConfig_css ? void 0 : _unpackConfig_css.modules;
56
+ if (!(0, external_utils_cjs_namespaceObject.isPlainObject)(modules) && false !== modules) modules = {};
57
+ const getAutoOption = ()=>{
58
+ if (false === modules) return false;
59
+ const auto = modules.auto;
60
+ if (false === auto) return false;
61
+ return (resourcePath)=>{
62
+ if (resourcePath.includes('node_modules')) return external_constants_cjs_namespaceObject.CSS_MODULES_REGEX.test(resourcePath);
63
+ if ((0, external_utils_cjs_namespaceObject.isRegExp)(auto)) return auto.test(resourcePath);
64
+ if ((0, external_utils_cjs_namespaceObject.isFunction)(auto)) return auto(resourcePath);
65
+ return external_constants_cjs_namespaceObject.CSS_MODULES_REGEX.test(resourcePath);
66
+ };
61
67
  };
62
- };
63
- const getCommonRules = ({ importLoaders }) => [
64
- (0, import_utils.isDevServer)() ? {
65
- loader: (0, import_utils.getCompiledPkgPath)("style-loader")
66
- } : {
67
- loader: MiniCssExtractPlugin.loader,
68
- options: {
69
- defaultExport: true
70
- }
71
- },
72
- (0, import_utils.isDev)() && {
73
- loader: import_node_path.default.resolve(__dirname, "../typed-css-modules/loader.cjs"),
74
- options: {
75
- modules
76
- }
77
- },
78
- {
79
- loader: (0, import_utils.getCompiledPkgPath)("css-loader"),
80
- options: {
81
- importLoaders,
82
- modules: {
83
- auto: getAutoOption(),
84
- localIdentName: modules !== false && (modules.localIdentName || import_constants.CSS_MODULES_LOCAL_IDENT_NAME),
85
- exportLocalsConvention: import_constants.EXPORT_LOCALS_CONVENTION,
86
- namedExport: import_constants.CSS_NAMED_EXPORT
87
- },
88
- sourceMap: unpackConfig.css?.sourceMap
89
- }
90
- }
91
- ].filter(Boolean);
92
- if (!(0, import_utils.isDevServer)()) {
93
- config.plugins.push(
94
- new MiniCssExtractPlugin({
95
- filename: (0, import_helper.getOutputFilename)({ type: "css", hash: unpackConfig.build?.filenameHash })
96
- })
97
- );
98
- }
99
- config.module?.rules?.push({
100
- test: /\.less$/i,
101
- use: [
102
- ...getCommonRules({ importLoaders: 1 }),
103
- unpackConfig.build?.parallel && {
104
- loader: require.resolve("thread-loader"),
105
- options: import_constants.THREAD_OPTIONS
106
- },
107
- {
108
- loader: (0, import_utils.getCompiledPkgPath)("less-loader"),
109
- options: {
110
- lessOptions: (0, import_utils.mergeConfig)(
68
+ const getCommonRules = ({ importLoaders })=>{
69
+ var _unpackConfig_css;
70
+ return [
71
+ (0, external_utils_cjs_namespaceObject.isDevServer)() ? {
72
+ loader: (0, external_utils_cjs_namespaceObject.getCompiledPkgPath)('style-loader')
73
+ } : {
74
+ loader: MiniCssExtractPlugin.loader,
75
+ options: {
76
+ defaultExport: true
77
+ }
78
+ },
79
+ (0, external_utils_cjs_namespaceObject.isDev)() && {
80
+ loader: external_node_path_default().resolve(__dirname, '../typed-css-modules/loader.cjs'),
81
+ options: {
82
+ modules
83
+ }
84
+ },
111
85
  {
112
- javascriptEnabled: true
86
+ loader: (0, external_utils_cjs_namespaceObject.getCompiledPkgPath)('css-loader'),
87
+ options: {
88
+ importLoaders,
89
+ modules: {
90
+ auto: getAutoOption(),
91
+ localIdentName: false !== modules && (modules.localIdentName || external_constants_cjs_namespaceObject.CSS_MODULES_LOCAL_IDENT_NAME),
92
+ exportLocalsConvention: external_constants_cjs_namespaceObject.EXPORT_LOCALS_CONVENTION,
93
+ namedExport: external_constants_cjs_namespaceObject.CSS_NAMED_EXPORT
94
+ },
95
+ sourceMap: null === (_unpackConfig_css = unpackConfig.css) || void 0 === _unpackConfig_css ? void 0 : _unpackConfig_css.sourceMap
96
+ }
97
+ }
98
+ ].filter(Boolean);
99
+ };
100
+ if (!(0, external_utils_cjs_namespaceObject.isDevServer)()) {
101
+ var _unpackConfig_build1;
102
+ config.plugins.push(new MiniCssExtractPlugin({
103
+ filename: (0, external_helper_cjs_namespaceObject.getOutputFilename)({
104
+ type: 'css',
105
+ hash: null === (_unpackConfig_build1 = unpackConfig.build) || void 0 === _unpackConfig_build1 ? void 0 : _unpackConfig_build1.filenameHash
106
+ })
107
+ }));
108
+ }
109
+ null === (_config_module = config.module) || void 0 === _config_module || null === (_config_module_rules = _config_module.rules) || void 0 === _config_module_rules || _config_module_rules.push({
110
+ test: /\.less$/i,
111
+ use: [
112
+ ...getCommonRules({
113
+ importLoaders: 1
114
+ }),
115
+ (null === (_unpackConfig_build = unpackConfig.build) || void 0 === _unpackConfig_build ? void 0 : _unpackConfig_build.parallel) && {
116
+ loader: require.resolve('thread-loader'),
117
+ options: external_constants_cjs_namespaceObject.THREAD_OPTIONS
113
118
  },
114
- unpackConfig.css?.less || {}
115
- ),
116
- implementation: (0, import_utils.getUserDepPath)(unpackConfig.root, "less"),
117
- sourceMap: unpackConfig.css?.sourceMap
118
- }
119
- }
120
- ].filter(Boolean)
121
- });
122
- const getLightningcssLoader = () => {
123
- return {
124
- loader: import_node_path.default.resolve(__dirname, "../lightningcss/loader.cjs"),
125
- options: (0, import_utils.mergeConfig)(unpackConfig.css?.lightningcss || {}, {
126
- sourceMap: unpackConfig.css?.sourceMap
127
- })
119
+ {
120
+ loader: (0, external_utils_cjs_namespaceObject.getCompiledPkgPath)('less-loader'),
121
+ options: {
122
+ lessOptions: (0, external_utils_cjs_namespaceObject.mergeConfig)({
123
+ javascriptEnabled: true
124
+ }, (null === (_unpackConfig_css1 = unpackConfig.css) || void 0 === _unpackConfig_css1 ? void 0 : _unpackConfig_css1.less) || {}),
125
+ implementation: (0, external_utils_cjs_namespaceObject.getUserDepPath)(unpackConfig.root, 'less'),
126
+ sourceMap: null === (_unpackConfig_css2 = unpackConfig.css) || void 0 === _unpackConfig_css2 ? void 0 : _unpackConfig_css2.sourceMap
127
+ }
128
+ }
129
+ ].filter(Boolean)
130
+ });
131
+ const getLightningcssLoader = ()=>{
132
+ var _unpackConfig_css, _unpackConfig_css1;
133
+ return {
134
+ loader: external_node_path_default().resolve(__dirname, '../lightningcss/loader.cjs'),
135
+ options: (0, external_utils_cjs_namespaceObject.mergeConfig)((null === (_unpackConfig_css = unpackConfig.css) || void 0 === _unpackConfig_css ? void 0 : _unpackConfig_css.lightningcss) || {}, {
136
+ sourceMap: null === (_unpackConfig_css1 = unpackConfig.css) || void 0 === _unpackConfig_css1 ? void 0 : _unpackConfig_css1.sourceMap
137
+ })
138
+ };
139
+ };
140
+ const getPostcssLoader = ()=>{
141
+ var _unpackConfig_css, _unpackConfig_css1;
142
+ return {
143
+ loader: (0, external_utils_cjs_namespaceObject.getCompiledPkgPath)('postcss-loader'),
144
+ options: {
145
+ postcssOptions: null === (_unpackConfig_css = unpackConfig.css) || void 0 === _unpackConfig_css ? void 0 : _unpackConfig_css.postcss,
146
+ sourceMap: null === (_unpackConfig_css1 = unpackConfig.css) || void 0 === _unpackConfig_css1 ? void 0 : _unpackConfig_css1.sourceMap
147
+ }
148
+ };
128
149
  };
129
- };
130
- const getPostcssLoader = () => {
131
- return {
132
- loader: (0, import_utils.getCompiledPkgPath)("postcss-loader"),
133
- options: {
134
- postcssOptions: unpackConfig.css?.postcss,
135
- sourceMap: unpackConfig.css?.sourceMap
136
- }
150
+ const getCssLoader = ()=>{
151
+ var _unpackConfig_css;
152
+ return (null === (_unpackConfig_css = unpackConfig.css) || void 0 === _unpackConfig_css ? void 0 : _unpackConfig_css.transformer) === 'lightningcss' ? getLightningcssLoader() : getPostcssLoader();
137
153
  };
138
- };
139
- const getCssLoader = () => {
140
- return unpackConfig.css?.transformer === "lightningcss" ? getLightningcssLoader() : getPostcssLoader();
141
- };
142
- config.module?.rules?.push({
143
- test: /\.css$/i,
144
- use: [...getCommonRules({ importLoaders: 1 }), getCssLoader()]
145
- });
146
- config.module?.rules?.push({
147
- test: /\.s[ac]ss$/i,
148
- use: [
149
- ...getCommonRules({ importLoaders: 1 }),
150
- {
151
- loader: (0, import_utils.getCompiledPkgPath)("sass-loader"),
152
- options: {
153
- api: "modern-compiler",
154
- implementation: (0, import_utils.getUserDepPath)(unpackConfig.root, ["sass-embedded", "sass"]),
155
- sassOptions: unpackConfig.css?.sass,
156
- sourceMap: unpackConfig.css?.sourceMap
157
- }
158
- }
159
- ]
160
- });
161
- return config;
154
+ null === (_config_module1 = config.module) || void 0 === _config_module1 || null === (_config_module_rules1 = _config_module1.rules) || void 0 === _config_module_rules1 || _config_module_rules1.push({
155
+ test: /\.css$/i,
156
+ use: [
157
+ ...getCommonRules({
158
+ importLoaders: 1
159
+ }),
160
+ getCssLoader()
161
+ ]
162
+ });
163
+ null === (_config_module2 = config.module) || void 0 === _config_module2 || null === (_config_module_rules2 = _config_module2.rules) || void 0 === _config_module_rules2 || _config_module_rules2.push({
164
+ test: /\.s[ac]ss$/i,
165
+ use: [
166
+ ...getCommonRules({
167
+ importLoaders: 1
168
+ }),
169
+ {
170
+ loader: (0, external_utils_cjs_namespaceObject.getCompiledPkgPath)('sass-loader'),
171
+ options: {
172
+ api: 'modern-compiler',
173
+ implementation: (0, external_utils_cjs_namespaceObject.getUserDepPath)(unpackConfig.root, [
174
+ 'sass-embedded',
175
+ 'sass'
176
+ ]),
177
+ sassOptions: null === (_unpackConfig_css3 = unpackConfig.css) || void 0 === _unpackConfig_css3 ? void 0 : _unpackConfig_css3.sass,
178
+ sourceMap: null === (_unpackConfig_css4 = unpackConfig.css) || void 0 === _unpackConfig_css4 ? void 0 : _unpackConfig_css4.sourceMap
179
+ }
180
+ }
181
+ ]
182
+ });
183
+ return config;
162
184
  }
163
- // Annotate the CommonJS export names for ESM import in node:
164
- 0 && (module.exports = {
165
- applyCssConfig
185
+ var __webpack_export_target__ = exports;
186
+ for(var __webpack_i__ in __webpack_exports__)__webpack_export_target__[__webpack_i__] = __webpack_exports__[__webpack_i__];
187
+ if (__webpack_exports__.__esModule) Object.defineProperty(__webpack_export_target__, '__esModule', {
188
+ value: true
166
189
  });
@@ -1,4 +1,4 @@
1
- import type { BundlerConfiguration, UnpackConfig } from '../types/index';
1
+ import type { BundlerConfiguration, UnpackConfig } from 'src/types/index';
2
2
  export declare function applyCssConfig({ config, unpackConfig, }: {
3
3
  config: BundlerConfiguration;
4
4
  unpackConfig: UnpackConfig;