@modern-js/builder 2.46.0 → 3.0.0-alpha.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/LICENSE +1 -1
- package/README.md +14 -16
- package/compiled/postcss-load-config/index.d.ts +1 -0
- package/compiled/postcss-load-config/index.js +14 -0
- package/compiled/postcss-load-config/license +20 -0
- package/compiled/postcss-load-config/package.json +1 -0
- package/dist/createBuilder.d.ts +8 -2
- package/dist/createBuilder.js +124 -39
- package/dist/index.d.ts +8 -4
- package/dist/index.js +18 -7
- package/dist/plugins/babel-post.d.ts +5 -0
- package/dist/plugins/{asset.js → babel-post.js} +21 -22
- package/dist/plugins/devtools.d.ts +4 -0
- package/dist/plugins/{devtool.js → devtools.js} +15 -16
- package/dist/plugins/emitRouteFile.d.ts +6 -0
- package/dist/plugins/{cleanOutput.js → emitRouteFile.js} +34 -16
- package/dist/plugins/environmentDefaults.d.ts +3 -0
- package/dist/plugins/environmentDefaults.js +99 -0
- package/dist/plugins/globalVars.d.ts +3 -0
- package/dist/plugins/{moment.js → globalVars.js} +23 -16
- package/dist/plugins/htmlMinify.d.ts +2 -0
- package/dist/plugins/htmlMinify.js +126 -0
- package/dist/plugins/manifest.d.ts +2 -0
- package/dist/plugins/{entry.js → manifest.js} +18 -16
- package/dist/plugins/postcss.d.ts +6 -0
- package/dist/plugins/postcss.js +133 -0
- package/dist/plugins/runtimeChunk.d.ts +2 -0
- package/dist/plugins/runtimeChunk.js +55 -0
- package/dist/rsc/common.d.ts +22 -0
- package/dist/rsc/common.js +174 -0
- package/dist/rsc/plugins/rsbuild-rsc-plugin.d.ts +7 -0
- package/dist/rsc/plugins/rsbuild-rsc-plugin.js +166 -0
- package/dist/rsc/plugins/rspack-rsc-client-plugin.d.ts +14 -0
- package/dist/rsc/plugins/rspack-rsc-client-plugin.js +233 -0
- package/dist/rsc/plugins/rspack-rsc-server-plugin.d.ts +32 -0
- package/dist/rsc/plugins/rspack-rsc-server-plugin.js +290 -0
- package/dist/rsc/rsc-client-loader.d.ts +7 -0
- package/dist/rsc/rsc-client-loader.js +70 -0
- package/dist/rsc/rsc-css-loader.d.ts +2 -0
- package/dist/{plugins/yaml.js → rsc/rsc-css-loader.js} +11 -17
- package/dist/rsc/rsc-server-loader.d.ts +6 -0
- package/dist/rsc/rsc-server-loader.js +95 -0
- package/dist/rsc/rsc-ssr-loader.d.ts +6 -0
- package/dist/rsc/rsc-ssr-loader.js +58 -0
- package/dist/shared/devServer.d.ts +6 -0
- package/dist/shared/devServer.js +83 -0
- package/dist/shared/getCssSupport.d.ts +1 -0
- package/dist/shared/getCssSupport.js +113 -0
- package/dist/shared/manifest.d.ts +2 -0
- package/dist/{plugins/toml.js → shared/manifest.js} +16 -14
- package/dist/shared/parseCommonConfig.d.ts +8 -0
- package/dist/shared/parseCommonConfig.js +232 -0
- package/dist/shared/utils.d.ts +12 -0
- package/dist/shared/utils.js +109 -0
- package/dist/types.d.ts +283 -0
- package/dist/types.js +16 -0
- package/package.json +54 -59
- package/dist/cli/commands.d.ts +0 -2
- package/dist/cli/commands.js +0 -45
- package/dist/cli/config.d.ts +0 -14
- package/dist/cli/config.js +0 -72
- package/dist/cli/index.d.ts +0 -6
- package/dist/cli/index.js +0 -51
- package/dist/cli/provider.d.ts +0 -2
- package/dist/cli/provider.js +0 -73
- package/dist/plugins/antd.d.ts +0 -3
- package/dist/plugins/antd.js +0 -63
- package/dist/plugins/arco.d.ts +0 -2
- package/dist/plugins/arco.js +0 -61
- package/dist/plugins/asset.d.ts +0 -2
- package/dist/plugins/assetsRetry.d.ts +0 -2
- package/dist/plugins/assetsRetry.js +0 -64
- package/dist/plugins/bundleAnalyzer.d.ts +0 -2
- package/dist/plugins/bundleAnalyzer.js +0 -59
- package/dist/plugins/cache.d.ts +0 -2
- package/dist/plugins/cache.js +0 -129
- package/dist/plugins/checkSyntax.d.ts +0 -2
- package/dist/plugins/checkSyntax.js +0 -73
- package/dist/plugins/cleanOutput.d.ts +0 -2
- package/dist/plugins/define.d.ts +0 -2
- package/dist/plugins/define.js +0 -68
- package/dist/plugins/devtool.d.ts +0 -2
- package/dist/plugins/entry.d.ts +0 -2
- package/dist/plugins/externals.d.ts +0 -2
- package/dist/plugins/externals.js +0 -48
- package/dist/plugins/fileSize.d.ts +0 -4
- package/dist/plugins/fileSize.js +0 -164
- package/dist/plugins/html.d.ts +0 -3
- package/dist/plugins/html.js +0 -236
- package/dist/plugins/index.d.ts +0 -2
- package/dist/plugins/index.js +0 -74
- package/dist/plugins/inlineChunk.d.ts +0 -2
- package/dist/plugins/inlineChunk.js +0 -82
- package/dist/plugins/moment.d.ts +0 -2
- package/dist/plugins/networkPerformance.d.ts +0 -2
- package/dist/plugins/networkPerformance.js +0 -54
- package/dist/plugins/nodeAddons.d.ts +0 -2
- package/dist/plugins/nodeAddons.js +0 -73
- package/dist/plugins/performance.d.ts +0 -5
- package/dist/plugins/performance.js +0 -66
- package/dist/plugins/preloadOrPrefetch.d.ts +0 -2
- package/dist/plugins/preloadOrPrefetch.js +0 -57
- package/dist/plugins/rem.d.ts +0 -2
- package/dist/plugins/rem.js +0 -106
- package/dist/plugins/sourceBuild.d.ts +0 -15
- package/dist/plugins/sourceBuild.js +0 -121
- package/dist/plugins/splitChunks.d.ts +0 -4
- package/dist/plugins/splitChunks.js +0 -249
- package/dist/plugins/startUrl.d.ts +0 -3
- package/dist/plugins/startUrl.js +0 -86
- package/dist/plugins/svg.d.ts +0 -2
- package/dist/plugins/svg.js +0 -89
- package/dist/plugins/target.d.ts +0 -2
- package/dist/plugins/target.js +0 -73
- package/dist/plugins/toml.d.ts +0 -2
- package/dist/plugins/tsChecker.d.ts +0 -2
- package/dist/plugins/tsChecker.js +0 -109
- package/dist/plugins/wasm.d.ts +0 -2
- package/dist/plugins/wasm.js +0 -51
- package/dist/plugins/yaml.d.ts +0 -2
- package/vitest.config.ts +0 -19
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
28
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
+
var getCssSupport_exports = {};
|
|
30
|
+
__export(getCssSupport_exports, {
|
|
31
|
+
getCssSupport: () => getCssSupport
|
|
32
|
+
});
|
|
33
|
+
module.exports = __toCommonJS(getCssSupport_exports);
|
|
34
|
+
var import_browserslist = __toESM(require("browserslist"));
|
|
35
|
+
const CSS_FEATURES_BROWSER = {
|
|
36
|
+
customProperties: {
|
|
37
|
+
and_chr: "49",
|
|
38
|
+
and_ff: "31",
|
|
39
|
+
android: "50",
|
|
40
|
+
chrome: "49",
|
|
41
|
+
edge: "15",
|
|
42
|
+
firefox: "31",
|
|
43
|
+
ios_saf: "9.3",
|
|
44
|
+
op_mob: "36",
|
|
45
|
+
opera: "36",
|
|
46
|
+
safari: "9.1",
|
|
47
|
+
samsung: "5.0"
|
|
48
|
+
},
|
|
49
|
+
initial: {
|
|
50
|
+
and_chr: "37",
|
|
51
|
+
and_ff: "27",
|
|
52
|
+
android: "37",
|
|
53
|
+
chrome: "37",
|
|
54
|
+
edge: "79",
|
|
55
|
+
firefox: "27",
|
|
56
|
+
ios_saf: "9.3",
|
|
57
|
+
op_mob: "24",
|
|
58
|
+
opera: "24",
|
|
59
|
+
safari: "9.1",
|
|
60
|
+
samsung: "3.0"
|
|
61
|
+
},
|
|
62
|
+
pageBreak: {
|
|
63
|
+
and_chr: "51",
|
|
64
|
+
and_ff: "92",
|
|
65
|
+
android: "51",
|
|
66
|
+
chrome: "51",
|
|
67
|
+
edge: "12",
|
|
68
|
+
firefox: "92",
|
|
69
|
+
ios_saf: "10",
|
|
70
|
+
op_mob: "37",
|
|
71
|
+
opera: "11.1",
|
|
72
|
+
safari: "10",
|
|
73
|
+
samsung: "5.0"
|
|
74
|
+
},
|
|
75
|
+
fontVariant: {
|
|
76
|
+
and_chr: "18",
|
|
77
|
+
and_ff: "34",
|
|
78
|
+
android: "4.4",
|
|
79
|
+
chrome: "1",
|
|
80
|
+
edge: "12",
|
|
81
|
+
firefox: "34",
|
|
82
|
+
ios_saf: "9.3",
|
|
83
|
+
op_mob: "12",
|
|
84
|
+
opera: "10",
|
|
85
|
+
safari: "9.1",
|
|
86
|
+
samsung: "1.0"
|
|
87
|
+
},
|
|
88
|
+
mediaMinmax: {
|
|
89
|
+
and_chr: "104",
|
|
90
|
+
and_ff: "109",
|
|
91
|
+
android: "104",
|
|
92
|
+
chrome: "104",
|
|
93
|
+
edge: "104",
|
|
94
|
+
firefox: "63",
|
|
95
|
+
opera: "91"
|
|
96
|
+
}
|
|
97
|
+
};
|
|
98
|
+
const getCssFeatureBrowsers = (feature) => {
|
|
99
|
+
const featureBrowsers = CSS_FEATURES_BROWSER[feature];
|
|
100
|
+
return (0, import_browserslist.default)(Object.entries(featureBrowsers).map(([key, value]) => `${key} >= ${value}`));
|
|
101
|
+
};
|
|
102
|
+
const isFeatureSupported = (projectBrowsers, featureBrowsers) => projectBrowsers.every((item) => featureBrowsers.includes(item));
|
|
103
|
+
function getCssSupport(projectBrowserslist) {
|
|
104
|
+
const projectBrowsers = (0, import_browserslist.default)(projectBrowserslist);
|
|
105
|
+
return Object.keys(CSS_FEATURES_BROWSER).reduce((acc, key) => {
|
|
106
|
+
acc[key] = isFeatureSupported(projectBrowsers, getCssFeatureBrowsers(key));
|
|
107
|
+
return acc;
|
|
108
|
+
}, {});
|
|
109
|
+
}
|
|
110
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
111
|
+
0 && (module.exports = {
|
|
112
|
+
getCssSupport
|
|
113
|
+
});
|
|
@@ -16,21 +16,23 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
16
16
|
return to;
|
|
17
17
|
};
|
|
18
18
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
-
var
|
|
20
|
-
__export(
|
|
21
|
-
|
|
22
|
-
});
|
|
23
|
-
module.exports = __toCommonJS(toml_exports);
|
|
24
|
-
var import_builder_shared = require("@modern-js/builder-shared");
|
|
25
|
-
const builderPluginToml = () => ({
|
|
26
|
-
name: "builder-plugin-toml",
|
|
27
|
-
setup(api) {
|
|
28
|
-
api.modifyBundlerChain((chain, { CHAIN_ID }) => {
|
|
29
|
-
chain.module.rule(CHAIN_ID.RULE.TOML).type("javascript/auto").test(/\.toml$/).use(CHAIN_ID.USE.TOML).loader((0, import_builder_shared.getSharedPkgCompiledPath)("toml-loader"));
|
|
30
|
-
});
|
|
31
|
-
}
|
|
19
|
+
var manifest_exports = {};
|
|
20
|
+
__export(manifest_exports, {
|
|
21
|
+
generateManifest: () => generateManifest
|
|
32
22
|
});
|
|
23
|
+
module.exports = __toCommonJS(manifest_exports);
|
|
24
|
+
const generateManifest = (seed, files, entries) => {
|
|
25
|
+
const manifestFiles = files.reduce((manifest, file) => {
|
|
26
|
+
manifest[file.name] = file.path;
|
|
27
|
+
return manifest;
|
|
28
|
+
}, seed);
|
|
29
|
+
const entrypointFiles = Object.keys(entries).reduce((previous, name) => previous.concat(entries[name].filter((fileName) => !fileName.endsWith(".map"))), []);
|
|
30
|
+
return {
|
|
31
|
+
files: manifestFiles,
|
|
32
|
+
entrypoints: entrypointFiles
|
|
33
|
+
};
|
|
34
|
+
};
|
|
33
35
|
// Annotate the CommonJS export names for ESM import in node:
|
|
34
36
|
0 && (module.exports = {
|
|
35
|
-
|
|
37
|
+
generateManifest
|
|
36
38
|
});
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { type RsbuildConfig, type RsbuildPlugin } from '@rsbuild/core';
|
|
2
|
+
import type { BuilderConfig, CreateBuilderCommonOptions } from '../types';
|
|
3
|
+
/** Determine if a file path is a CSS module when disableCssModuleExtension is enabled. */
|
|
4
|
+
export declare const isLooseCssModules: (path: string) => boolean;
|
|
5
|
+
export declare function parseCommonConfig(builderConfig: BuilderConfig, options?: CreateBuilderCommonOptions): Promise<{
|
|
6
|
+
rsbuildConfig: RsbuildConfig;
|
|
7
|
+
rsbuildPlugins: RsbuildPlugin[];
|
|
8
|
+
}>;
|
|
@@ -0,0 +1,232 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
28
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
+
var parseCommonConfig_exports = {};
|
|
30
|
+
__export(parseCommonConfig_exports, {
|
|
31
|
+
isLooseCssModules: () => isLooseCssModules,
|
|
32
|
+
parseCommonConfig: () => parseCommonConfig
|
|
33
|
+
});
|
|
34
|
+
module.exports = __toCommonJS(parseCommonConfig_exports);
|
|
35
|
+
var import_core = require("@rsbuild/core");
|
|
36
|
+
var import_plugin_css_minimizer = require("@rsbuild/plugin-css-minimizer");
|
|
37
|
+
var import_plugin_less = require("@rsbuild/plugin-less");
|
|
38
|
+
var import_plugin_react = require("@rsbuild/plugin-react");
|
|
39
|
+
var import_plugin_sass = require("@rsbuild/plugin-sass");
|
|
40
|
+
var import_devtools = require("../plugins/devtools");
|
|
41
|
+
var import_emitRouteFile = require("../plugins/emitRouteFile");
|
|
42
|
+
var import_environmentDefaults = require("../plugins/environmentDefaults");
|
|
43
|
+
var import_globalVars = require("../plugins/globalVars");
|
|
44
|
+
var import_htmlMinify = require("../plugins/htmlMinify");
|
|
45
|
+
var import_runtimeChunk = require("../plugins/runtimeChunk");
|
|
46
|
+
var import_devServer = require("./devServer");
|
|
47
|
+
var import_utils = require("./utils");
|
|
48
|
+
const CSS_MODULES_REGEX = /\.modules?\.\w+$/i;
|
|
49
|
+
const GLOBAL_CSS_REGEX = /\.global\.\w+$/;
|
|
50
|
+
const isLooseCssModules = (path) => {
|
|
51
|
+
if (import_utils.NODE_MODULES_REGEX.test(path)) {
|
|
52
|
+
return CSS_MODULES_REGEX.test(path);
|
|
53
|
+
}
|
|
54
|
+
return !GLOBAL_CSS_REGEX.test(path);
|
|
55
|
+
};
|
|
56
|
+
function removeUndefinedKey(obj) {
|
|
57
|
+
Object.keys(obj).forEach((key) => {
|
|
58
|
+
if (obj[key] === void 0) {
|
|
59
|
+
delete obj[key];
|
|
60
|
+
}
|
|
61
|
+
});
|
|
62
|
+
return obj;
|
|
63
|
+
}
|
|
64
|
+
async function parseCommonConfig(builderConfig, options) {
|
|
65
|
+
var _builderConfig_output;
|
|
66
|
+
var _rsbuildConfig_tools, _output, _output_distPath, _output1, _extraConfig, _html, _extraConfig1;
|
|
67
|
+
const frameworkConfigPath = options === null || options === void 0 ? void 0 : options.frameworkConfigPath;
|
|
68
|
+
const { plugins: [...plugins] = [], performance: { ...performanceConfig } = {}, output: { enableCssModuleTSDeclaration, disableCssModuleExtension, disableTsChecker, disableSvgr, svgDefaultExport, assetsRetry, enableAssetManifest, sourceMap, convertToRem, polyfill, dataUriLimit = 1e4, distPath = {}, ...outputConfig } = {}, html: { outputStructure, appIcon, ...htmlConfig } = {}, source: { alias, globalVars, transformImport, ...sourceConfig } = {}, dev = {}, server = {}, security: { checkSyntax, sri, ...securityConfig } = {}, tools: { devServer, tsChecker, minifyCss, less, sass, htmlPlugin, autoprefixer, ...toolsConfig } = {}, environments = {}, resolve = {} } = builderConfig;
|
|
69
|
+
const rsbuildConfig = {
|
|
70
|
+
plugins,
|
|
71
|
+
output: {
|
|
72
|
+
polyfill: polyfill === "ua" ? "off" : polyfill,
|
|
73
|
+
dataUriLimit,
|
|
74
|
+
sourceMap,
|
|
75
|
+
...outputConfig
|
|
76
|
+
},
|
|
77
|
+
resolve,
|
|
78
|
+
source: {
|
|
79
|
+
alias,
|
|
80
|
+
...sourceConfig
|
|
81
|
+
},
|
|
82
|
+
performance: performanceConfig,
|
|
83
|
+
html: htmlConfig,
|
|
84
|
+
tools: toolsConfig,
|
|
85
|
+
security: securityConfig,
|
|
86
|
+
environments
|
|
87
|
+
};
|
|
88
|
+
if (typeof alias === "object" && Object.keys(alias).length === 0) {
|
|
89
|
+
var _rsbuildConfig_source;
|
|
90
|
+
(_rsbuildConfig_source = rsbuildConfig.source) === null || _rsbuildConfig_source === void 0 ? true : delete _rsbuildConfig_source.alias;
|
|
91
|
+
}
|
|
92
|
+
rsbuildConfig.tools.htmlPlugin = htmlPlugin;
|
|
93
|
+
var _lightningcssLoader;
|
|
94
|
+
(_lightningcssLoader = (_rsbuildConfig_tools = rsbuildConfig.tools).lightningcssLoader) !== null && _lightningcssLoader !== void 0 ? _lightningcssLoader : _rsbuildConfig_tools.lightningcssLoader = false;
|
|
95
|
+
const { html = {}, output = {}, source = {} } = rsbuildConfig;
|
|
96
|
+
source.transformImport = transformImport === false ? () => [] : transformImport;
|
|
97
|
+
if (!source.decorators) {
|
|
98
|
+
source.decorators = {
|
|
99
|
+
version: "legacy"
|
|
100
|
+
};
|
|
101
|
+
}
|
|
102
|
+
var _charset;
|
|
103
|
+
(_charset = (_output = output).charset) !== null && _charset !== void 0 ? _charset : _output.charset = "ascii";
|
|
104
|
+
if (typeof output.sourceMap !== "boolean") {
|
|
105
|
+
var _output2, _output_sourceMap;
|
|
106
|
+
(_output2 = output).sourceMap || (_output2.sourceMap = {});
|
|
107
|
+
var _css;
|
|
108
|
+
(_css = (_output_sourceMap = output.sourceMap).css) !== null && _css !== void 0 ? _css : _output_sourceMap.css = process.env.NODE_ENV !== "production";
|
|
109
|
+
}
|
|
110
|
+
const { server: _server, worker, ...rsbuildDistPath } = distPath;
|
|
111
|
+
output.distPath = rsbuildDistPath;
|
|
112
|
+
var _html1;
|
|
113
|
+
(_html1 = (_output_distPath = output.distPath).html) !== null && _html1 !== void 0 ? _html1 : _output_distPath.html = "html";
|
|
114
|
+
var _polyfill;
|
|
115
|
+
(_polyfill = (_output1 = output).polyfill) !== null && _polyfill !== void 0 ? _polyfill : _output1.polyfill = "entry";
|
|
116
|
+
if (disableCssModuleExtension) {
|
|
117
|
+
var _output3, _output_cssModules;
|
|
118
|
+
(_output3 = output).cssModules || (_output3.cssModules = {});
|
|
119
|
+
var _auto;
|
|
120
|
+
(_auto = (_output_cssModules = output.cssModules).auto) !== null && _auto !== void 0 ? _auto : _output_cssModules.auto = isLooseCssModules;
|
|
121
|
+
}
|
|
122
|
+
const extraConfig = {};
|
|
123
|
+
(_extraConfig = extraConfig).html || (_extraConfig.html = {});
|
|
124
|
+
extraConfig.html.outputStructure = outputStructure !== null && outputStructure !== void 0 ? outputStructure : "nested";
|
|
125
|
+
var _title;
|
|
126
|
+
(_title = (_html = html).title) !== null && _title !== void 0 ? _title : _html.title = "";
|
|
127
|
+
html.appIcon = appIcon;
|
|
128
|
+
var _tools;
|
|
129
|
+
(_tools = (_extraConfig1 = extraConfig).tools) !== null && _tools !== void 0 ? _tools : _extraConfig1.tools = {};
|
|
130
|
+
if (htmlPlugin !== false) {
|
|
131
|
+
extraConfig.tools.htmlPlugin = (config) => {
|
|
132
|
+
if (typeof config.templateParameters === "function") {
|
|
133
|
+
const originFn = config.templateParameters;
|
|
134
|
+
config.templateParameters = (...args) => {
|
|
135
|
+
const res = originFn(...args);
|
|
136
|
+
return {
|
|
137
|
+
title: config.title,
|
|
138
|
+
meta: void 0,
|
|
139
|
+
...res
|
|
140
|
+
};
|
|
141
|
+
};
|
|
142
|
+
}
|
|
143
|
+
};
|
|
144
|
+
}
|
|
145
|
+
if (!dev.lazyCompilation) {
|
|
146
|
+
dev.lazyCompilation = false;
|
|
147
|
+
}
|
|
148
|
+
const { rsbuildDev, rsbuildServer } = (0, import_devServer.transformToRsbuildServerOptions)(dev || {}, devServer || {}, server || {});
|
|
149
|
+
rsbuildConfig.server = removeUndefinedKey(rsbuildServer);
|
|
150
|
+
rsbuildConfig.dev = removeUndefinedKey(rsbuildDev);
|
|
151
|
+
rsbuildConfig.html = html;
|
|
152
|
+
rsbuildConfig.output = output;
|
|
153
|
+
const rsbuildPlugins = [
|
|
154
|
+
(0, import_globalVars.pluginGlobalVars)(globalVars),
|
|
155
|
+
(0, import_devtools.pluginDevtool)({
|
|
156
|
+
sourceMap
|
|
157
|
+
}),
|
|
158
|
+
(0, import_emitRouteFile.pluginEmitRouteFile)(),
|
|
159
|
+
(0, import_plugin_sass.pluginSass)({
|
|
160
|
+
sassLoaderOptions: sass
|
|
161
|
+
}),
|
|
162
|
+
(0, import_plugin_less.pluginLess)({
|
|
163
|
+
lessLoaderOptions: less
|
|
164
|
+
}),
|
|
165
|
+
(0, import_environmentDefaults.pluginEnvironmentDefaults)(distPath),
|
|
166
|
+
(0, import_htmlMinify.pluginHtmlMinifierTerser)()
|
|
167
|
+
];
|
|
168
|
+
if (checkSyntax) {
|
|
169
|
+
const { pluginCheckSyntax } = await Promise.resolve().then(() => __toESM(require("@rsbuild/plugin-check-syntax")));
|
|
170
|
+
rsbuildPlugins.push(pluginCheckSyntax(typeof checkSyntax === "boolean" ? {} : checkSyntax));
|
|
171
|
+
}
|
|
172
|
+
if (!disableTsChecker) {
|
|
173
|
+
const { pluginTypeCheck } = await Promise.resolve().then(() => __toESM(require("@rsbuild/plugin-type-check")));
|
|
174
|
+
rsbuildPlugins.push(pluginTypeCheck({
|
|
175
|
+
tsCheckerOptions: tsChecker
|
|
176
|
+
}));
|
|
177
|
+
}
|
|
178
|
+
if (convertToRem) {
|
|
179
|
+
const { pluginRem } = await Promise.resolve().then(() => __toESM(require("@rsbuild/plugin-rem")));
|
|
180
|
+
rsbuildPlugins.push(pluginRem(typeof convertToRem === "boolean" ? {} : convertToRem));
|
|
181
|
+
}
|
|
182
|
+
if (enableCssModuleTSDeclaration) {
|
|
183
|
+
const { pluginTypedCSSModules } = await Promise.resolve().then(() => __toESM(require("@rsbuild/plugin-typed-css-modules")));
|
|
184
|
+
rsbuildPlugins.push(pluginTypedCSSModules());
|
|
185
|
+
}
|
|
186
|
+
rsbuildPlugins.push((0, import_runtimeChunk.pluginRuntimeChunk)((_builderConfig_output = builderConfig.output) === null || _builderConfig_output === void 0 ? void 0 : _builderConfig_output.disableInlineRuntimeChunk));
|
|
187
|
+
const { sourceBuild } = builderConfig.experiments || {};
|
|
188
|
+
if (sourceBuild) {
|
|
189
|
+
const { pluginSourceBuild } = await Promise.resolve().then(() => __toESM(require("@rsbuild/plugin-source-build")));
|
|
190
|
+
rsbuildPlugins.push(pluginSourceBuild(sourceBuild === true ? {} : sourceBuild));
|
|
191
|
+
}
|
|
192
|
+
rsbuildPlugins.push((0, import_plugin_react.pluginReact)());
|
|
193
|
+
if (!disableSvgr) {
|
|
194
|
+
const { pluginSvgr } = await Promise.resolve().then(() => __toESM(require("@rsbuild/plugin-svgr")));
|
|
195
|
+
rsbuildPlugins.push(pluginSvgr({
|
|
196
|
+
mixedImport: true,
|
|
197
|
+
svgrOptions: {
|
|
198
|
+
exportType: svgDefaultExport === "component" ? "default" : "named"
|
|
199
|
+
}
|
|
200
|
+
}));
|
|
201
|
+
}
|
|
202
|
+
if (assetsRetry) {
|
|
203
|
+
const { pluginAssetsRetry } = await Promise.resolve().then(() => __toESM(require("@rsbuild/plugin-assets-retry")));
|
|
204
|
+
rsbuildPlugins.push(pluginAssetsRetry(assetsRetry));
|
|
205
|
+
}
|
|
206
|
+
if (frameworkConfigPath && performanceConfig.buildCache !== false) {
|
|
207
|
+
const buildCache = typeof performanceConfig.buildCache === "object" ? performanceConfig.buildCache : {};
|
|
208
|
+
rsbuildConfig.performance.buildCache = {
|
|
209
|
+
...buildCache,
|
|
210
|
+
buildDependencies: [
|
|
211
|
+
frameworkConfigPath,
|
|
212
|
+
...buildCache.buildDependencies || []
|
|
213
|
+
]
|
|
214
|
+
};
|
|
215
|
+
}
|
|
216
|
+
rsbuildPlugins.push((0, import_plugin_css_minimizer.pluginCssMinimizer)({
|
|
217
|
+
pluginOptions: minifyCss
|
|
218
|
+
}));
|
|
219
|
+
if (enableAssetManifest) {
|
|
220
|
+
const { pluginManifest } = await Promise.resolve().then(() => __toESM(require("../plugins/manifest")));
|
|
221
|
+
rsbuildPlugins.push(pluginManifest());
|
|
222
|
+
}
|
|
223
|
+
return {
|
|
224
|
+
rsbuildConfig: (0, import_core.mergeRsbuildConfig)(rsbuildConfig, extraConfig),
|
|
225
|
+
rsbuildPlugins
|
|
226
|
+
};
|
|
227
|
+
}
|
|
228
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
229
|
+
0 && (module.exports = {
|
|
230
|
+
isLooseCssModules,
|
|
231
|
+
parseCommonConfig
|
|
232
|
+
});
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { NormalizedEnvironmentConfig, RsbuildTarget } from '@rsbuild/core';
|
|
2
|
+
export declare const RUNTIME_CHUNK_NAME = "builder-runtime";
|
|
3
|
+
export declare const RUNTIME_CHUNK_REGEX: RegExp;
|
|
4
|
+
export declare const SERVICE_WORKER_ENVIRONMENT_NAME = "workerSSR";
|
|
5
|
+
export declare const NODE_MODULES_REGEX: RegExp;
|
|
6
|
+
export declare const castArray: <T>(arr?: T | T[]) => T[];
|
|
7
|
+
export declare const isHtmlDisabled: (config: NormalizedEnvironmentConfig, target: RsbuildTarget) => boolean;
|
|
8
|
+
export declare function getBrowserslistWithDefault(path: string, config: {
|
|
9
|
+
output?: {
|
|
10
|
+
overrideBrowserslist?: string[];
|
|
11
|
+
};
|
|
12
|
+
}, target: RsbuildTarget): Promise<string[]>;
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
28
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
+
var utils_exports = {};
|
|
30
|
+
__export(utils_exports, {
|
|
31
|
+
NODE_MODULES_REGEX: () => NODE_MODULES_REGEX,
|
|
32
|
+
RUNTIME_CHUNK_NAME: () => RUNTIME_CHUNK_NAME,
|
|
33
|
+
RUNTIME_CHUNK_REGEX: () => RUNTIME_CHUNK_REGEX,
|
|
34
|
+
SERVICE_WORKER_ENVIRONMENT_NAME: () => SERVICE_WORKER_ENVIRONMENT_NAME,
|
|
35
|
+
castArray: () => castArray,
|
|
36
|
+
getBrowserslistWithDefault: () => getBrowserslistWithDefault,
|
|
37
|
+
isHtmlDisabled: () => isHtmlDisabled
|
|
38
|
+
});
|
|
39
|
+
module.exports = __toCommonJS(utils_exports);
|
|
40
|
+
var import_browserslist = __toESM(require("browserslist"));
|
|
41
|
+
const RUNTIME_CHUNK_NAME = "builder-runtime";
|
|
42
|
+
const RUNTIME_CHUNK_REGEX = new RegExp(`${RUNTIME_CHUNK_NAME}([.].+)?\\.js$`);
|
|
43
|
+
const SERVICE_WORKER_ENVIRONMENT_NAME = "workerSSR";
|
|
44
|
+
const NODE_MODULES_REGEX = /[\\/]node_modules[\\/]/;
|
|
45
|
+
const castArray = (arr) => {
|
|
46
|
+
if (arr === void 0) {
|
|
47
|
+
return [];
|
|
48
|
+
}
|
|
49
|
+
return Array.isArray(arr) ? arr : [
|
|
50
|
+
arr
|
|
51
|
+
];
|
|
52
|
+
};
|
|
53
|
+
const browsersListCache = /* @__PURE__ */ new Map();
|
|
54
|
+
async function getBrowserslist(path) {
|
|
55
|
+
const env = process.env.NODE_ENV;
|
|
56
|
+
const cacheKey = `${path}${env}`;
|
|
57
|
+
if (browsersListCache.has(cacheKey)) {
|
|
58
|
+
return browsersListCache.get(cacheKey);
|
|
59
|
+
}
|
|
60
|
+
const result = import_browserslist.default.loadConfig({
|
|
61
|
+
path,
|
|
62
|
+
env
|
|
63
|
+
});
|
|
64
|
+
if (result) {
|
|
65
|
+
browsersListCache.set(cacheKey, result);
|
|
66
|
+
return result;
|
|
67
|
+
}
|
|
68
|
+
return null;
|
|
69
|
+
}
|
|
70
|
+
const isHtmlDisabled = (config, target) => {
|
|
71
|
+
const { htmlPlugin } = config.tools;
|
|
72
|
+
return htmlPlugin === false || Array.isArray(htmlPlugin) && htmlPlugin.includes(false) || target !== "web";
|
|
73
|
+
};
|
|
74
|
+
const DEFAULT_WEB_BROWSERSLIST = [
|
|
75
|
+
"chrome >= 87",
|
|
76
|
+
"edge >= 88",
|
|
77
|
+
"firefox >= 78",
|
|
78
|
+
"safari >= 14"
|
|
79
|
+
];
|
|
80
|
+
const DEFAULT_BROWSERSLIST = {
|
|
81
|
+
web: DEFAULT_WEB_BROWSERSLIST,
|
|
82
|
+
node: [
|
|
83
|
+
"node >= 16"
|
|
84
|
+
],
|
|
85
|
+
"web-worker": DEFAULT_WEB_BROWSERSLIST
|
|
86
|
+
};
|
|
87
|
+
async function getBrowserslistWithDefault(path, config, target) {
|
|
88
|
+
const { overrideBrowserslist: overrides } = (config === null || config === void 0 ? void 0 : config.output) || {};
|
|
89
|
+
if (target === "web" || target === "web-worker") {
|
|
90
|
+
if (overrides) {
|
|
91
|
+
return overrides;
|
|
92
|
+
}
|
|
93
|
+
const browserslistrc = await getBrowserslist(path);
|
|
94
|
+
if (browserslistrc) {
|
|
95
|
+
return browserslistrc;
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
return DEFAULT_BROWSERSLIST[target];
|
|
99
|
+
}
|
|
100
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
101
|
+
0 && (module.exports = {
|
|
102
|
+
NODE_MODULES_REGEX,
|
|
103
|
+
RUNTIME_CHUNK_NAME,
|
|
104
|
+
RUNTIME_CHUNK_REGEX,
|
|
105
|
+
SERVICE_WORKER_ENVIRONMENT_NAME,
|
|
106
|
+
castArray,
|
|
107
|
+
getBrowserslistWithDefault,
|
|
108
|
+
isHtmlDisabled
|
|
109
|
+
});
|