@unpackjs/core 2.1.0 → 2.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/compiled/css-loader/index.js +26 -26
- package/compiled/postcss-loader/index.js +11 -11
- package/dist/bundler-config/cache.cjs +105 -0
- package/dist/bundler-config/cache.d.ts +6 -0
- package/dist/bundler-config/cache.d.ts.map +1 -0
- package/dist/bundler-config/cache.js +63 -0
- package/dist/bundler-config/chunkSplit.js +7 -7
- package/dist/bundler-config/css.cjs +4 -3
- package/dist/bundler-config/css.d.ts.map +1 -1
- package/dist/bundler-config/css.js +33 -32
- package/dist/bundler-config/experimentCss.cjs +4 -3
- package/dist/bundler-config/experimentCss.d.ts.map +1 -1
- package/dist/bundler-config/experimentCss.js +29 -28
- package/dist/bundler-config/{helper.cjs → helpers.cjs} +2 -2
- package/dist/bundler-config/{helper.d.ts → helpers.d.ts} +1 -1
- package/dist/bundler-config/helpers.d.ts.map +1 -0
- package/dist/bundler-config/helpers.js +39 -0
- package/dist/bundler-config/index.cjs +28 -17
- package/dist/bundler-config/index.d.ts.map +1 -1
- package/dist/bundler-config/index.js +69 -58
- package/dist/bundler-config/jsMinify.cjs +3 -3
- package/dist/bundler-config/jsMinify.d.ts +1 -9
- package/dist/bundler-config/jsMinify.d.ts.map +1 -1
- package/dist/bundler-config/jsMinify.js +7 -7
- package/dist/bundler-config/oxlint/.oxlintrc.json +30 -0
- package/dist/bundler-config/oxlint/plugin.cjs +143 -0
- package/dist/bundler-config/oxlint/plugin.d.ts +10 -0
- package/dist/bundler-config/oxlint/plugin.d.ts.map +1 -0
- package/dist/bundler-config/oxlint/plugin.js +104 -0
- package/dist/{plugin-progress/helper.cjs → bundler-config/progress/helpers.cjs} +9 -10
- 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 +67 -0
- package/dist/{plugin-progress → bundler-config/progress}/rspack.cjs +10 -10
- 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 +13 -11
- package/dist/bundler-config/progress/webpack.d.ts +9 -0
- package/dist/bundler-config/progress/webpack.d.ts.map +1 -0
- package/dist/bundler-config/progress/webpack.js +44 -0
- package/dist/colors.cjs +3 -4
- package/dist/colors.d.ts +1 -2
- package/dist/colors.d.ts.map +1 -1
- package/dist/colors.js +3 -4
- package/dist/config.cjs +5 -2
- package/dist/config.d.ts +1 -0
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +19 -19
- package/dist/constants.cjs +8 -8
- package/dist/constants.js +2 -2
- package/dist/createUnpack.cjs +2 -12
- package/dist/createUnpack.js +19 -19
- package/dist/fs.cjs +82 -0
- package/dist/fs.d.ts +11 -0
- package/dist/fs.d.ts.map +1 -0
- package/dist/fs.js +28 -0
- package/dist/index.cjs +17 -18
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +6 -42
- package/dist/lightningcss/loader.cjs +0 -2
- package/dist/lightningcss/loader.d.ts.map +1 -1
- package/dist/lightningcss/loader.js +4 -6
- package/dist/lightningcss/minimizer.cjs +7 -9
- package/dist/lightningcss/minimizer.d.ts.map +1 -1
- package/dist/lightningcss/minimizer.js +9 -11
- package/dist/logger.cjs +5 -6
- package/dist/logger.js +12 -12
- package/dist/openBrowser.js +7 -7
- package/dist/prebundleDeps.cjs +5 -5
- package/dist/prebundleDeps.d.ts.map +1 -1
- package/dist/prebundleDeps.js +49 -48
- package/dist/progressBar.cjs +1 -11
- package/dist/progressBar.js +3 -3
- package/dist/reporter.cjs +11 -9
- package/dist/reporter.d.ts.map +1 -1
- package/dist/reporter.js +25 -22
- package/dist/run/build.js +8 -8
- package/dist/run/dev.cjs +3 -4
- package/dist/run/dev.d.ts.map +1 -1
- package/dist/run/dev.js +23 -23
- package/dist/typed-css-modules/loader.js +12 -12
- package/dist/typed-css-modules/plugin.cjs +1 -1
- package/dist/typed-css-modules/plugin.js +13 -13
- package/dist/typed-css-modules/utils.js +6 -6
- package/dist/types/config.d.ts +2 -0
- package/dist/types/config.d.ts.map +1 -1
- package/dist/types/oxc.cjs +18 -0
- package/dist/types/oxc.d.ts +10 -0
- package/dist/types/oxc.d.ts.map +1 -0
- package/dist/types/oxc.js +2 -0
- package/dist/utils.cjs +26 -27
- package/dist/utils.js +16 -16
- package/dist/watchFiles.js +4 -4
- package/package.json +4 -4
- 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
|
@@ -2,65 +2,65 @@ 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 external_node_path_default from "node:path";
|
|
6
|
+
import { rspack } from "@rspack/core";
|
|
7
|
+
import external_mini_css_extract_plugin_default from "mini-css-extract-plugin";
|
|
8
|
+
import { CSS_MODULES_LOCAL_IDENT_NAME, CSS_MODULES_REGEX, CSS_NAMED_EXPORT, EXPORT_LOCALS_CONVENTION, LIGHTNINGCSS_TARGET, 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
13
|
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;
|
|
14
|
-
const MiniCssExtractPlugin = 'rspack' === unpackConfig.bundler ?
|
|
14
|
+
const MiniCssExtractPlugin = 'rspack' === unpackConfig.bundler ? rspack.CssExtractRspackPlugin : external_mini_css_extract_plugin_default;
|
|
15
15
|
let modules = null == (_unpackConfig_css = unpackConfig.css) ? void 0 : _unpackConfig_css.modules;
|
|
16
|
-
if (!
|
|
16
|
+
if (!isPlainObject(modules) && false !== modules) modules = {};
|
|
17
17
|
const getAutoOption = ()=>{
|
|
18
18
|
if (false === modules) return false;
|
|
19
19
|
const auto = modules.auto;
|
|
20
20
|
if (false === auto) return false;
|
|
21
21
|
return (resourcePath)=>{
|
|
22
|
-
if (resourcePath.includes('node_modules')) return
|
|
23
|
-
if (
|
|
24
|
-
if (
|
|
25
|
-
return
|
|
22
|
+
if (resourcePath.includes('node_modules')) return CSS_MODULES_REGEX.test(resourcePath);
|
|
23
|
+
if (isRegExp(auto)) return auto.test(resourcePath);
|
|
24
|
+
if (isFunction(auto)) return auto(resourcePath);
|
|
25
|
+
return CSS_MODULES_REGEX.test(resourcePath);
|
|
26
26
|
};
|
|
27
27
|
};
|
|
28
28
|
const getCommonRules = ({ importLoaders })=>{
|
|
29
29
|
var _unpackConfig_css;
|
|
30
30
|
return [
|
|
31
|
-
|
|
32
|
-
loader:
|
|
31
|
+
isDevServer() ? {
|
|
32
|
+
loader: getCompiledPkgPath('style-loader')
|
|
33
33
|
} : {
|
|
34
34
|
loader: MiniCssExtractPlugin.loader,
|
|
35
35
|
options: {
|
|
36
36
|
defaultExport: true
|
|
37
37
|
}
|
|
38
38
|
},
|
|
39
|
-
|
|
40
|
-
loader:
|
|
39
|
+
isDev() && {
|
|
40
|
+
loader: external_node_path_default.resolve(css_dirname, '../typed-css-modules/loader.cjs'),
|
|
41
41
|
options: {
|
|
42
42
|
modules
|
|
43
43
|
}
|
|
44
44
|
},
|
|
45
45
|
{
|
|
46
|
-
loader:
|
|
46
|
+
loader: getCompiledPkgPath('css-loader'),
|
|
47
47
|
options: {
|
|
48
48
|
importLoaders,
|
|
49
49
|
modules: {
|
|
50
50
|
auto: getAutoOption(),
|
|
51
|
-
localIdentName: false !== modules && (modules.localIdentName ||
|
|
52
|
-
exportLocalsConvention:
|
|
53
|
-
namedExport:
|
|
51
|
+
localIdentName: false !== modules && (modules.localIdentName || CSS_MODULES_LOCAL_IDENT_NAME),
|
|
52
|
+
exportLocalsConvention: EXPORT_LOCALS_CONVENTION,
|
|
53
|
+
namedExport: CSS_NAMED_EXPORT
|
|
54
54
|
},
|
|
55
55
|
sourceMap: null == (_unpackConfig_css = unpackConfig.css) ? void 0 : _unpackConfig_css.sourceMap
|
|
56
56
|
}
|
|
57
57
|
}
|
|
58
58
|
].filter(Boolean);
|
|
59
59
|
};
|
|
60
|
-
if (!
|
|
60
|
+
if (!isDevServer()) {
|
|
61
61
|
var _unpackConfig_build1;
|
|
62
62
|
config.plugins.push(new MiniCssExtractPlugin({
|
|
63
|
-
filename:
|
|
63
|
+
filename: getOutputFilename({
|
|
64
64
|
type: 'css',
|
|
65
65
|
hash: null == (_unpackConfig_build1 = unpackConfig.build) ? void 0 : _unpackConfig_build1.filenameHash
|
|
66
66
|
})
|
|
@@ -74,15 +74,15 @@ function applyCssConfig({ config, unpackConfig }) {
|
|
|
74
74
|
}),
|
|
75
75
|
(null == (_unpackConfig_build = unpackConfig.build) ? void 0 : _unpackConfig_build.parallel) && {
|
|
76
76
|
loader: require.resolve('thread-loader'),
|
|
77
|
-
options:
|
|
77
|
+
options: THREAD_OPTIONS
|
|
78
78
|
},
|
|
79
79
|
{
|
|
80
|
-
loader:
|
|
80
|
+
loader: getCompiledPkgPath('less-loader'),
|
|
81
81
|
options: {
|
|
82
|
-
lessOptions:
|
|
82
|
+
lessOptions: mergeConfig({
|
|
83
83
|
javascriptEnabled: true
|
|
84
84
|
}, (null == (_unpackConfig_css1 = unpackConfig.css) ? void 0 : _unpackConfig_css1.less) || {}),
|
|
85
|
-
implementation:
|
|
85
|
+
implementation: getUserDepPath(unpackConfig.root, 'less'),
|
|
86
86
|
sourceMap: null == (_unpackConfig_css2 = unpackConfig.css) ? void 0 : _unpackConfig_css2.sourceMap
|
|
87
87
|
}
|
|
88
88
|
}
|
|
@@ -91,16 +91,17 @@ function applyCssConfig({ config, unpackConfig }) {
|
|
|
91
91
|
const getLightningcssLoader = ()=>{
|
|
92
92
|
var _unpackConfig_css, _unpackConfig_css1;
|
|
93
93
|
return {
|
|
94
|
-
loader:
|
|
95
|
-
options:
|
|
96
|
-
sourceMap: null == (_unpackConfig_css1 = unpackConfig.css) ? void 0 : _unpackConfig_css1.sourceMap
|
|
94
|
+
loader: external_node_path_default.resolve(css_dirname, '../lightningcss/loader.cjs'),
|
|
95
|
+
options: mergeConfig((null == (_unpackConfig_css = unpackConfig.css) ? void 0 : _unpackConfig_css.lightningcss) || {}, {
|
|
96
|
+
sourceMap: null == (_unpackConfig_css1 = unpackConfig.css) ? void 0 : _unpackConfig_css1.sourceMap,
|
|
97
|
+
targets: LIGHTNINGCSS_TARGET
|
|
97
98
|
})
|
|
98
99
|
};
|
|
99
100
|
};
|
|
100
101
|
const getPostcssLoader = ()=>{
|
|
101
102
|
var _unpackConfig_css, _unpackConfig_css1;
|
|
102
103
|
return {
|
|
103
|
-
loader:
|
|
104
|
+
loader: getCompiledPkgPath('postcss-loader'),
|
|
104
105
|
options: {
|
|
105
106
|
postcssOptions: null == (_unpackConfig_css = unpackConfig.css) ? void 0 : _unpackConfig_css.postcss,
|
|
106
107
|
sourceMap: null == (_unpackConfig_css1 = unpackConfig.css) ? void 0 : _unpackConfig_css1.sourceMap
|
|
@@ -127,10 +128,10 @@ function applyCssConfig({ config, unpackConfig }) {
|
|
|
127
128
|
importLoaders: 1
|
|
128
129
|
}),
|
|
129
130
|
{
|
|
130
|
-
loader:
|
|
131
|
+
loader: getCompiledPkgPath('sass-loader'),
|
|
131
132
|
options: {
|
|
132
133
|
api: 'modern-compiler',
|
|
133
|
-
implementation:
|
|
134
|
+
implementation: getUserDepPath(unpackConfig.root, [
|
|
134
135
|
'sass-embedded',
|
|
135
136
|
'sass'
|
|
136
137
|
]),
|
|
@@ -40,10 +40,10 @@ var external_node_path_default = /*#__PURE__*/ __webpack_require__.n(external_no
|
|
|
40
40
|
const external_constants_cjs_namespaceObject = require("../constants.cjs");
|
|
41
41
|
const plugin_cjs_namespaceObject = require("../typed-css-modules/plugin.cjs");
|
|
42
42
|
const external_utils_cjs_namespaceObject = require("../utils.cjs");
|
|
43
|
-
const
|
|
43
|
+
const external_helpers_cjs_namespaceObject = require("./helpers.cjs");
|
|
44
44
|
function applyExperimentCssConfig({ config, unpackConfig }) {
|
|
45
45
|
var _unpackConfig_build, _unpackConfig_css, _config_module_rules, _config_module, _config_module_rules1, _config_module1, _config_module_rules2, _config_module2;
|
|
46
|
-
const CSS_FILENAME = (0,
|
|
46
|
+
const CSS_FILENAME = (0, external_helpers_cjs_namespaceObject.getOutputFilename)({
|
|
47
47
|
type: 'css',
|
|
48
48
|
hash: null == (_unpackConfig_build = unpackConfig.build) ? void 0 : _unpackConfig_build.filenameHash
|
|
49
49
|
});
|
|
@@ -130,7 +130,8 @@ function applyExperimentCssConfig({ config, unpackConfig }) {
|
|
|
130
130
|
return {
|
|
131
131
|
loader: external_node_path_default().resolve(__dirname, '../lightningcss/loader.cjs'),
|
|
132
132
|
options: (0, external_utils_cjs_namespaceObject.mergeConfig)((null == (_unpackConfig_css = unpackConfig.css) ? void 0 : _unpackConfig_css.lightningcss) || {}, {
|
|
133
|
-
sourceMap: null == (_unpackConfig_css1 = unpackConfig.css) ? void 0 : _unpackConfig_css1.sourceMap
|
|
133
|
+
sourceMap: null == (_unpackConfig_css1 = unpackConfig.css) ? void 0 : _unpackConfig_css1.sourceMap,
|
|
134
|
+
targets: external_constants_cjs_namespaceObject.LIGHTNINGCSS_TARGET
|
|
134
135
|
})
|
|
135
136
|
};
|
|
136
137
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"experimentCss.d.ts","sourceRoot":"","sources":["../../src/bundler-config/experimentCss.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"experimentCss.d.ts","sourceRoot":"","sources":["../../src/bundler-config/experimentCss.ts"],"names":[],"mappings":"AAUA,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,CAiIvB"}
|
|
@@ -2,41 +2,41 @@ 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
|
|
5
|
+
import external_node_path_default from "node:path";
|
|
6
|
+
import { CSS_MODULES_LOCAL_IDENT_NAME, CSS_MODULES_REGEX, CSS_NAMED_EXPORT, EXPORT_LOCALS_CONVENTION, LIGHTNINGCSS_TARGET, THREAD_OPTIONS } from "../constants.js";
|
|
7
|
+
import { PluginTypedCssModules } from "../typed-css-modules/plugin.js";
|
|
8
|
+
import { getCompiledPkgPath, getUserDepPath, isDev, isFunction, isPlainObject, isRegExp, mergeConfig, setValueByPath } from "../utils.js";
|
|
9
|
+
import { getOutputFilename } from "./helpers.js";
|
|
10
10
|
var experimentCss_dirname = __webpack_dirname__(__webpack_fileURLToPath__(import.meta.url));
|
|
11
11
|
function applyExperimentCssConfig({ config, unpackConfig }) {
|
|
12
12
|
var _unpackConfig_build, _unpackConfig_css, _config_module_rules, _config_module, _config_module_rules1, _config_module1, _config_module_rules2, _config_module2;
|
|
13
|
-
const CSS_FILENAME =
|
|
13
|
+
const CSS_FILENAME = getOutputFilename({
|
|
14
14
|
type: 'css',
|
|
15
15
|
hash: null == (_unpackConfig_build = unpackConfig.build) ? void 0 : _unpackConfig_build.filenameHash
|
|
16
16
|
});
|
|
17
17
|
config.output.cssFilename = CSS_FILENAME;
|
|
18
18
|
config.output.cssChunkFilename = CSS_FILENAME;
|
|
19
|
-
|
|
19
|
+
setValueByPath(config, [
|
|
20
20
|
'experiments',
|
|
21
21
|
'css'
|
|
22
22
|
], true);
|
|
23
23
|
let modules = null == (_unpackConfig_css = unpackConfig.css) ? void 0 : _unpackConfig_css.modules;
|
|
24
|
-
if (!
|
|
24
|
+
if (!isPlainObject(modules) && false !== modules) modules = {};
|
|
25
25
|
if (false !== modules && false !== modules.auto) {
|
|
26
|
-
|
|
26
|
+
setValueByPath(config, [
|
|
27
27
|
'module',
|
|
28
28
|
'parser',
|
|
29
29
|
'css/module'
|
|
30
30
|
], {
|
|
31
|
-
namedExports:
|
|
31
|
+
namedExports: CSS_NAMED_EXPORT
|
|
32
32
|
});
|
|
33
|
-
|
|
33
|
+
setValueByPath(config, [
|
|
34
34
|
'module',
|
|
35
35
|
'generator',
|
|
36
36
|
'css/module'
|
|
37
37
|
], {
|
|
38
|
-
localIdentName: modules.localIdentName ||
|
|
39
|
-
exportsConvention:
|
|
38
|
+
localIdentName: modules.localIdentName || CSS_MODULES_LOCAL_IDENT_NAME,
|
|
39
|
+
exportsConvention: EXPORT_LOCALS_CONVENTION
|
|
40
40
|
});
|
|
41
41
|
}
|
|
42
42
|
const withCssModules = ({ use })=>{
|
|
@@ -45,10 +45,10 @@ function applyExperimentCssConfig({ config, unpackConfig }) {
|
|
|
45
45
|
if (false === auto) return false;
|
|
46
46
|
return {
|
|
47
47
|
test: (resourcePath)=>{
|
|
48
|
-
if (resourcePath.includes('node_modules')) return
|
|
49
|
-
if (
|
|
50
|
-
if (
|
|
51
|
-
return
|
|
48
|
+
if (resourcePath.includes('node_modules')) return CSS_MODULES_REGEX.test(resourcePath);
|
|
49
|
+
if (isRegExp(auto)) return auto.test(resourcePath);
|
|
50
|
+
if (isFunction(auto)) return auto(resourcePath);
|
|
51
|
+
return CSS_MODULES_REGEX.test(resourcePath);
|
|
52
52
|
},
|
|
53
53
|
use,
|
|
54
54
|
type: 'css/module'
|
|
@@ -58,18 +58,18 @@ function applyExperimentCssConfig({ config, unpackConfig }) {
|
|
|
58
58
|
var _unpackConfig_build;
|
|
59
59
|
return (null == (_unpackConfig_build = unpackConfig.build) ? void 0 : _unpackConfig_build.parallel) && {
|
|
60
60
|
loader: require.resolve('thread-loader'),
|
|
61
|
-
options:
|
|
61
|
+
options: THREAD_OPTIONS
|
|
62
62
|
};
|
|
63
63
|
};
|
|
64
64
|
const getLessLoader = ()=>{
|
|
65
65
|
var _unpackConfig_css, _unpackConfig_css1;
|
|
66
66
|
return {
|
|
67
|
-
loader:
|
|
67
|
+
loader: getCompiledPkgPath('less-loader'),
|
|
68
68
|
options: {
|
|
69
|
-
lessOptions:
|
|
69
|
+
lessOptions: mergeConfig({
|
|
70
70
|
javascriptEnabled: true
|
|
71
71
|
}, (null == (_unpackConfig_css = unpackConfig.css) ? void 0 : _unpackConfig_css.less) || {}),
|
|
72
|
-
implementation:
|
|
72
|
+
implementation: getUserDepPath(unpackConfig.root, 'less'),
|
|
73
73
|
sourceMap: null == (_unpackConfig_css1 = unpackConfig.css) ? void 0 : _unpackConfig_css1.sourceMap
|
|
74
74
|
}
|
|
75
75
|
};
|
|
@@ -95,16 +95,17 @@ function applyExperimentCssConfig({ config, unpackConfig }) {
|
|
|
95
95
|
const getLightningcssLoader = ()=>{
|
|
96
96
|
var _unpackConfig_css, _unpackConfig_css1;
|
|
97
97
|
return {
|
|
98
|
-
loader:
|
|
99
|
-
options:
|
|
100
|
-
sourceMap: null == (_unpackConfig_css1 = unpackConfig.css) ? void 0 : _unpackConfig_css1.sourceMap
|
|
98
|
+
loader: external_node_path_default.resolve(experimentCss_dirname, '../lightningcss/loader.cjs'),
|
|
99
|
+
options: mergeConfig((null == (_unpackConfig_css = unpackConfig.css) ? void 0 : _unpackConfig_css.lightningcss) || {}, {
|
|
100
|
+
sourceMap: null == (_unpackConfig_css1 = unpackConfig.css) ? void 0 : _unpackConfig_css1.sourceMap,
|
|
101
|
+
targets: LIGHTNINGCSS_TARGET
|
|
101
102
|
})
|
|
102
103
|
};
|
|
103
104
|
};
|
|
104
105
|
const getPostcssLoader = ()=>{
|
|
105
106
|
var _unpackConfig_css, _unpackConfig_css1;
|
|
106
107
|
return {
|
|
107
|
-
loader:
|
|
108
|
+
loader: getCompiledPkgPath('postcss-loader'),
|
|
108
109
|
options: {
|
|
109
110
|
postcssOptions: null == (_unpackConfig_css = unpackConfig.css) ? void 0 : _unpackConfig_css.postcss,
|
|
110
111
|
sourceMap: null == (_unpackConfig_css1 = unpackConfig.css) ? void 0 : _unpackConfig_css1.sourceMap
|
|
@@ -134,10 +135,10 @@ function applyExperimentCssConfig({ config, unpackConfig }) {
|
|
|
134
135
|
const getSassLoader = ()=>{
|
|
135
136
|
var _unpackConfig_css, _unpackConfig_css1;
|
|
136
137
|
return {
|
|
137
|
-
loader:
|
|
138
|
+
loader: getCompiledPkgPath('sass-loader'),
|
|
138
139
|
options: {
|
|
139
140
|
api: 'modern-compiler',
|
|
140
|
-
implementation:
|
|
141
|
+
implementation: getUserDepPath(unpackConfig.root, [
|
|
141
142
|
'sass-embedded',
|
|
142
143
|
'sass'
|
|
143
144
|
]),
|
|
@@ -162,7 +163,7 @@ function applyExperimentCssConfig({ config, unpackConfig }) {
|
|
|
162
163
|
}
|
|
163
164
|
].filter(Boolean)
|
|
164
165
|
});
|
|
165
|
-
|
|
166
|
+
isDev() && config.plugins.push(new PluginTypedCssModules({
|
|
166
167
|
modules
|
|
167
168
|
}));
|
|
168
169
|
return config;
|
|
@@ -33,8 +33,8 @@ var __webpack_require__ = {};
|
|
|
33
33
|
var __webpack_exports__ = {};
|
|
34
34
|
__webpack_require__.r(__webpack_exports__);
|
|
35
35
|
__webpack_require__.d(__webpack_exports__, {
|
|
36
|
-
|
|
37
|
-
|
|
36
|
+
getEntry: ()=>getEntry,
|
|
37
|
+
getOutputFilename: ()=>getOutputFilename
|
|
38
38
|
});
|
|
39
39
|
const external_node_fs_namespaceObject = require("node:fs");
|
|
40
40
|
var external_node_fs_default = /*#__PURE__*/ __webpack_require__.n(external_node_fs_namespaceObject);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"helpers.d.ts","sourceRoot":"","sources":["../../src/bundler-config/helpers.ts"],"names":[],"mappings":"AAOA,wBAAsB,QAAQ,CAAC,IAAI,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAgBjF;AAED,KAAK,cAAc,GAAG;IACpB,IAAI,EAAE,IAAI,GAAG,KAAK,CAAA;IAClB,IAAI,EAAE,OAAO,CAAA;CACd,CAAA;AACD,eAAO,MAAM,iBAAiB,mBAAoB,cAAc,WAqB/D,CAAA"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import __rslib_shim_module__ from 'module';
|
|
2
|
+
/*#__PURE__*/ import.meta.url;
|
|
3
|
+
import external_node_fs_default from "node:fs";
|
|
4
|
+
import external_node_path_default from "node:path";
|
|
5
|
+
import { isDev } from "../utils.js";
|
|
6
|
+
import { glob } from "tinyglobby";
|
|
7
|
+
import { DEV_DEFAULT_FILENAME, PROD_DEFAULT_FILENAME } from "../constants.js";
|
|
8
|
+
import { logger } from "../logger.js";
|
|
9
|
+
async function getEntry(root, customEntry) {
|
|
10
|
+
let entry;
|
|
11
|
+
if (customEntry) entry = external_node_path_default.resolve(root, customEntry);
|
|
12
|
+
else {
|
|
13
|
+
const files = await glob('(index|Index).{js,ts,jsx,tsx}', {
|
|
14
|
+
cwd: external_node_path_default.join(root, 'src'),
|
|
15
|
+
absolute: true
|
|
16
|
+
});
|
|
17
|
+
entry = files[0];
|
|
18
|
+
}
|
|
19
|
+
if (!external_node_fs_default.existsSync(entry)) {
|
|
20
|
+
logger.error(new Error('could not find entry file'));
|
|
21
|
+
process.exit(1);
|
|
22
|
+
}
|
|
23
|
+
return entry;
|
|
24
|
+
}
|
|
25
|
+
const getOutputFilename = ({ type, hash })=>{
|
|
26
|
+
const mode = isDev() || false === hash ? 'development' : 'production';
|
|
27
|
+
const handles = {
|
|
28
|
+
js: {
|
|
29
|
+
development: ()=>DEV_DEFAULT_FILENAME.js,
|
|
30
|
+
production: ()=>PROD_DEFAULT_FILENAME.js
|
|
31
|
+
},
|
|
32
|
+
css: {
|
|
33
|
+
development: ()=>DEV_DEFAULT_FILENAME.css,
|
|
34
|
+
production: ()=>PROD_DEFAULT_FILENAME.css
|
|
35
|
+
}
|
|
36
|
+
};
|
|
37
|
+
return handles[type][mode]();
|
|
38
|
+
};
|
|
39
|
+
export { getEntry, getOutputFilename };
|
|
@@ -69,24 +69,26 @@ var __webpack_exports__ = {};
|
|
|
69
69
|
const external_constants_cjs_namespaceObject = require("../constants.cjs");
|
|
70
70
|
const minimizer_cjs_namespaceObject = require("../lightningcss/minimizer.cjs");
|
|
71
71
|
const external_plugin_cjs_namespaceObject = require("../plugin.cjs");
|
|
72
|
-
const rspack_cjs_namespaceObject = require("../plugin-progress/rspack.cjs");
|
|
73
|
-
const webpack_cjs_namespaceObject = require("../plugin-progress/webpack.cjs");
|
|
74
72
|
const external_webpack_namespaceObject = require("webpack");
|
|
75
73
|
var external_webpack_default = /*#__PURE__*/ __webpack_require__.n(external_webpack_namespaceObject);
|
|
74
|
+
const external_cache_cjs_namespaceObject = require("./cache.cjs");
|
|
76
75
|
const external_chunkSplit_cjs_namespaceObject = require("./chunkSplit.cjs");
|
|
77
76
|
const external_css_cjs_namespaceObject = require("./css.cjs");
|
|
78
77
|
const external_experimentCss_cjs_namespaceObject = require("./experimentCss.cjs");
|
|
79
|
-
const
|
|
78
|
+
const external_helpers_cjs_namespaceObject = require("./helpers.cjs");
|
|
80
79
|
const external_jsMinify_cjs_namespaceObject = require("./jsMinify.cjs");
|
|
80
|
+
const plugin_cjs_namespaceObject = require("./oxlint/plugin.cjs");
|
|
81
|
+
const rspack_cjs_namespaceObject = require("./progress/rspack.cjs");
|
|
82
|
+
const webpack_cjs_namespaceObject = require("./progress/webpack.cjs");
|
|
81
83
|
const { TsCheckerRspackPlugin } = __webpack_require__("ts-checker-rspack-plugin");
|
|
82
84
|
const BundleAnalyzerPlugin = __webpack_require__("../../compiled/webpack-bundle-analyzer/index.js").BundleAnalyzerPlugin;
|
|
83
85
|
const CopyWebpackPlugin = __webpack_require__("copy-webpack-plugin");
|
|
84
86
|
async function getBundlerConfig(unpackConfig) {
|
|
85
|
-
var _unpackConfig_build, _unpackConfig_build1, _unpackConfig_build2, _unpackConfig_build3, _unpackConfig_build4, _unpackConfig_build5, _unpackConfig_html, _unpackConfig_html1, _unpackConfig_html2, _unpackConfig_html3, _unpackConfig_html4, _unpackConfig_html5, _unpackConfig_html6, _unpackConfig_html7, _unpackConfig_html8, _unpackConfig_performance, _unpackConfig_performance1, _unpackConfig_build6, _unpackConfig_build7, _unpackConfig_resolve, _unpackConfig_resolve1, _unpackConfig_dev, _unpackConfig_build8,
|
|
87
|
+
var _unpackConfig_build, _unpackConfig_build1, _unpackConfig_build2, _minifyOptions_oxc, _unpackConfig_build3, _unpackConfig_build4, _unpackConfig_build5, _unpackConfig_html, _unpackConfig_html1, _unpackConfig_html2, _unpackConfig_html3, _unpackConfig_html4, _unpackConfig_html5, _unpackConfig_html6, _unpackConfig_html7, _unpackConfig_html8, _unpackConfig_performance, _unpackConfig_performance1, _unpackConfig_build6, _unpackConfig_build7, _unpackConfig_resolve, _unpackConfig_resolve1, _unpackConfig_dev, _unpackConfig_build8, _unpackConfig_experiments;
|
|
86
88
|
const isRspack = 'rspack' === unpackConfig.bundler;
|
|
87
89
|
const HtmlPlugin = isRspack ? core_namespaceObject.rspack.HtmlRspackPlugin : external_html_webpack_plugin_default();
|
|
88
90
|
const definePlugin = (define)=>isRspack ? new core_namespaceObject.rspack.DefinePlugin(define) : new (external_webpack_default()).DefinePlugin(define);
|
|
89
|
-
const JS_FILENAME = (0,
|
|
91
|
+
const JS_FILENAME = (0, external_helpers_cjs_namespaceObject.getOutputFilename)({
|
|
90
92
|
type: 'js',
|
|
91
93
|
hash: null == (_unpackConfig_build = unpackConfig.build) ? void 0 : _unpackConfig_build.filenameHash
|
|
92
94
|
});
|
|
@@ -103,13 +105,14 @@ var __webpack_exports__ = {};
|
|
|
103
105
|
}, {}) : {};
|
|
104
106
|
};
|
|
105
107
|
const minifyOptions = (0, external_utils_cjs_namespaceObject.isPlainObject)(null == (_unpackConfig_build1 = unpackConfig.build) ? void 0 : _unpackConfig_build1.minify) ? null == (_unpackConfig_build2 = unpackConfig.build) ? void 0 : _unpackConfig_build2.minify : {};
|
|
106
|
-
const
|
|
108
|
+
const oxcMinifyCompress = (0, external_utils_cjs_namespaceObject.isPlainObject)(null == (_minifyOptions_oxc = minifyOptions.oxc) ? void 0 : _minifyOptions_oxc.compress) ? minifyOptions.oxc.compress : {};
|
|
109
|
+
const ProgressPlugin = isRspack ? rspack_cjs_namespaceObject.ProgressRspackPlugin : webpack_cjs_namespaceObject.ProgressWebpackPlugin;
|
|
107
110
|
const wasmFilename = 'js/[hash].module.wasm';
|
|
108
111
|
let config = {
|
|
109
112
|
context: unpackConfig.root,
|
|
110
113
|
mode: (0, external_utils_cjs_namespaceObject.isDev)() ? 'development' : 'production',
|
|
111
114
|
entry: unpackConfig.mpa ? {} : {
|
|
112
|
-
main: await (0,
|
|
115
|
+
main: await (0, external_helpers_cjs_namespaceObject.getEntry)(unpackConfig.root, unpackConfig.entry)
|
|
113
116
|
},
|
|
114
117
|
stats: 'errors-only',
|
|
115
118
|
output: {
|
|
@@ -197,7 +200,8 @@ var __webpack_exports__ = {};
|
|
|
197
200
|
}
|
|
198
201
|
}
|
|
199
202
|
}),
|
|
200
|
-
new
|
|
203
|
+
new ProgressPlugin(),
|
|
204
|
+
new plugin_cjs_namespaceObject.OxlintPlugin()
|
|
201
205
|
].filter(Boolean),
|
|
202
206
|
externals: unpackConfig.externals,
|
|
203
207
|
resolve: {
|
|
@@ -218,22 +222,25 @@ var __webpack_exports__ = {};
|
|
|
218
222
|
experiments: {
|
|
219
223
|
lazyCompilation: (null == (_unpackConfig_dev = unpackConfig.dev) ? void 0 : _unpackConfig_dev.lazyCompilation) && (0, external_utils_cjs_namespaceObject.isDevServer)(),
|
|
220
224
|
css: false,
|
|
221
|
-
asyncWebAssembly: true
|
|
222
|
-
...isRspack && (0, external_utils_cjs_namespaceObject.isDev)() ? {
|
|
223
|
-
incremental: true
|
|
224
|
-
} : {}
|
|
225
|
+
asyncWebAssembly: true
|
|
225
226
|
},
|
|
226
227
|
optimization: {
|
|
227
228
|
moduleIds: (0, external_utils_cjs_namespaceObject.isDev)() ? 'named' : 'deterministic',
|
|
228
229
|
minimize: Boolean(null == (_unpackConfig_build8 = unpackConfig.build) ? void 0 : _unpackConfig_build8.minify),
|
|
229
230
|
minimizer: [
|
|
230
|
-
new external_jsMinify_cjs_namespaceObject.JsMinifyPlugin(
|
|
231
|
-
|
|
231
|
+
new external_jsMinify_cjs_namespaceObject.JsMinifyPlugin({
|
|
232
|
+
...minifyOptions.oxc,
|
|
233
|
+
compress: {
|
|
234
|
+
target: 'es2015',
|
|
235
|
+
...oxcMinifyCompress
|
|
236
|
+
}
|
|
237
|
+
}),
|
|
238
|
+
new minimizer_cjs_namespaceObject.LightningcssMinifyPlugin({
|
|
239
|
+
targets: external_constants_cjs_namespaceObject.LIGHTNINGCSS_TARGET,
|
|
240
|
+
...minifyOptions.lightningcss
|
|
241
|
+
})
|
|
232
242
|
]
|
|
233
243
|
},
|
|
234
|
-
cache: (null == (_unpackConfig_build9 = unpackConfig.build) ? void 0 : _unpackConfig_build9.cache) && 'webpack' === unpackConfig.bundler ? {
|
|
235
|
-
type: 'filesystem'
|
|
236
|
-
} : void 0,
|
|
237
244
|
watchOptions: {
|
|
238
245
|
ignored: /[\\/](?:\.git|node_modules)[\\/]/
|
|
239
246
|
}
|
|
@@ -249,6 +256,10 @@ var __webpack_exports__ = {};
|
|
|
249
256
|
config,
|
|
250
257
|
unpackConfig
|
|
251
258
|
});
|
|
259
|
+
config = await (0, external_cache_cjs_namespaceObject.applyCacheConfig)({
|
|
260
|
+
config,
|
|
261
|
+
unpackConfig
|
|
262
|
+
});
|
|
252
263
|
for (const plugin of (0, external_plugin_cjs_namespaceObject.getNormalizedPluginsByHook)('bundlerConfig', unpackConfig.plugins))config = await plugin.bundlerConfig(config, {
|
|
253
264
|
unpackConfig,
|
|
254
265
|
mergeConfig: external_utils_cjs_namespaceObject.mergeConfig
|
|
@@ -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;
|
|
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,CAoMhG"}
|