@modern-js/builder 3.5.0 → 3.7.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/dist/cjs/shared/parseCommonConfig.js +4 -2
- package/dist/esm/shared/parseCommonConfig.mjs +4 -2
- package/dist/esm-node/plugins/rscConfig.mjs +2 -2
- package/dist/esm-node/shared/parseCommonConfig.mjs +4 -2
- package/dist/esm-node/shared/rsc/rscClientBrowserFallback.mjs +2 -2
- package/dist/types/types.d.ts +7 -0
- package/package.json +7 -7
|
@@ -58,7 +58,7 @@ function removeUndefinedKey(obj) {
|
|
|
58
58
|
}
|
|
59
59
|
async function parseCommonConfig(builderConfig, options) {
|
|
60
60
|
const frameworkConfigPath = options?.frameworkConfigPath;
|
|
61
|
-
const { plugins: [...plugins] = [], splitChunks, performance: { ...performanceConfig } = {}, output: { module = false, enableCssModuleTSDeclaration, disableCssModuleExtension, disableTsChecker, disableSvgr, svgDefaultExport, assetsRetry, enableAssetManifest, sourceMap, convertToRem, polyfill, dataUriLimit = 10000, 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;
|
|
61
|
+
const { plugins: [...plugins] = [], splitChunks, performance: { ...performanceConfig } = {}, output: { module = false, enableCssModuleTSDeclaration, disableCssModuleExtension, disableTsChecker, disableSvgr, svgDefaultExport, assetsRetry, enableAssetManifest, sourceMap, convertToRem, polyfill, dataUriLimit = 10000, distPath = {}, ...outputConfig } = {}, html: { outputStructure, appIcon, ...htmlConfig } = {}, source: { alias, globalVars, transformImport, reactCompiler, ...sourceConfig } = {}, dev = {}, server = {}, security: { checkSyntax, sri, ...securityConfig } = {}, tools: { devServer, tsChecker, minifyCss, less, sass, htmlPlugin, autoprefixer, ...toolsConfig } = {}, environments = {}, resolve = {} } = builderConfig;
|
|
62
62
|
let combinedAlias;
|
|
63
63
|
if (alias || resolve.alias) combinedAlias = [].concat(alias ?? []).concat(resolve.alias ?? []);
|
|
64
64
|
const rsbuildConfig = {
|
|
@@ -173,7 +173,9 @@ async function parseCommonConfig(builderConfig, options) {
|
|
|
173
173
|
const { pluginSourceBuild } = await import("@rsbuild/plugin-source-build");
|
|
174
174
|
rsbuildPlugins.push(pluginSourceBuild(true === sourceBuild ? {} : sourceBuild));
|
|
175
175
|
}
|
|
176
|
-
rsbuildPlugins.push((0, plugin_react_namespaceObject.pluginReact)(
|
|
176
|
+
rsbuildPlugins.push((0, plugin_react_namespaceObject.pluginReact)(void 0 !== reactCompiler ? {
|
|
177
|
+
reactCompiler
|
|
178
|
+
} : {}));
|
|
177
179
|
if (!disableSvgr) {
|
|
178
180
|
const { pluginSvgr } = await import("@rsbuild/plugin-svgr");
|
|
179
181
|
rsbuildPlugins.push(pluginSvgr({
|
|
@@ -25,7 +25,7 @@ function removeUndefinedKey(obj) {
|
|
|
25
25
|
}
|
|
26
26
|
async function parseCommonConfig(builderConfig, options) {
|
|
27
27
|
const frameworkConfigPath = options?.frameworkConfigPath;
|
|
28
|
-
const { plugins: [...plugins] = [], splitChunks, performance: { ...performanceConfig } = {}, output: { module = false, enableCssModuleTSDeclaration, disableCssModuleExtension, disableTsChecker, disableSvgr, svgDefaultExport, assetsRetry, enableAssetManifest, sourceMap, convertToRem, polyfill, dataUriLimit = 10000, 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;
|
|
28
|
+
const { plugins: [...plugins] = [], splitChunks, performance: { ...performanceConfig } = {}, output: { module = false, enableCssModuleTSDeclaration, disableCssModuleExtension, disableTsChecker, disableSvgr, svgDefaultExport, assetsRetry, enableAssetManifest, sourceMap, convertToRem, polyfill, dataUriLimit = 10000, distPath = {}, ...outputConfig } = {}, html: { outputStructure, appIcon, ...htmlConfig } = {}, source: { alias, globalVars, transformImport, reactCompiler, ...sourceConfig } = {}, dev = {}, server = {}, security: { checkSyntax, sri, ...securityConfig } = {}, tools: { devServer, tsChecker, minifyCss, less, sass, htmlPlugin, autoprefixer, ...toolsConfig } = {}, environments = {}, resolve = {} } = builderConfig;
|
|
29
29
|
let combinedAlias;
|
|
30
30
|
if (alias || resolve.alias) combinedAlias = [].concat(alias ?? []).concat(resolve.alias ?? []);
|
|
31
31
|
const rsbuildConfig = {
|
|
@@ -140,7 +140,9 @@ async function parseCommonConfig(builderConfig, options) {
|
|
|
140
140
|
const { pluginSourceBuild } = await import("@rsbuild/plugin-source-build");
|
|
141
141
|
rsbuildPlugins.push(pluginSourceBuild(true === sourceBuild ? {} : sourceBuild));
|
|
142
142
|
}
|
|
143
|
-
rsbuildPlugins.push(pluginReact(
|
|
143
|
+
rsbuildPlugins.push(pluginReact(void 0 !== reactCompiler ? {
|
|
144
|
+
reactCompiler
|
|
145
|
+
} : {}));
|
|
144
146
|
if (!disableSvgr) {
|
|
145
147
|
const { pluginSvgr } = await import("@rsbuild/plugin-svgr");
|
|
146
148
|
rsbuildPlugins.push(pluginSvgr({
|
|
@@ -3,7 +3,7 @@ const require = /*#__PURE__*/ __rslib_shim_module__.createRequire(/*#__PURE__*/
|
|
|
3
3
|
import path from "path";
|
|
4
4
|
import { fileURLToPath as __rspack_fileURLToPath } from "node:url";
|
|
5
5
|
import { dirname as __rspack_dirname } from "node:path";
|
|
6
|
-
var
|
|
6
|
+
var __rspack_import_meta_dirname__ = __rspack_dirname(__rspack_fileURLToPath(import.meta.url));
|
|
7
7
|
const ASYNC_STORAGE_PATTERN = /universal[/\\]async_storage/;
|
|
8
8
|
const RSC_COMMON_LAYER = 'rsc-common';
|
|
9
9
|
const ENTRY_NAME_VAR = '__MODERN_JS_ENTRY_NAME';
|
|
@@ -35,7 +35,7 @@ function pluginRscConfig() {
|
|
|
35
35
|
try {
|
|
36
36
|
loaderPath = require.resolve('../shared/rsc/rsc-server-entry-loader');
|
|
37
37
|
} catch {
|
|
38
|
-
loaderPath = path.resolve(
|
|
38
|
+
loaderPath = path.resolve(__rspack_import_meta_dirname__, '../shared/rsc/rsc-server-entry-loader');
|
|
39
39
|
}
|
|
40
40
|
chain.module.rule('rsc-server-entry').test(/\.(tsx?|jsx?)$/).resource(combinedPattern).exclude.add(/node_modules/).end().use('rsc-server-entry-loader').loader(loaderPath).end();
|
|
41
41
|
}
|
|
@@ -26,7 +26,7 @@ function removeUndefinedKey(obj) {
|
|
|
26
26
|
}
|
|
27
27
|
async function parseCommonConfig(builderConfig, options) {
|
|
28
28
|
const frameworkConfigPath = options?.frameworkConfigPath;
|
|
29
|
-
const { plugins: [...plugins] = [], splitChunks, performance: { ...performanceConfig } = {}, output: { module = false, enableCssModuleTSDeclaration, disableCssModuleExtension, disableTsChecker, disableSvgr, svgDefaultExport, assetsRetry, enableAssetManifest, sourceMap, convertToRem, polyfill, dataUriLimit = 10000, 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;
|
|
29
|
+
const { plugins: [...plugins] = [], splitChunks, performance: { ...performanceConfig } = {}, output: { module = false, enableCssModuleTSDeclaration, disableCssModuleExtension, disableTsChecker, disableSvgr, svgDefaultExport, assetsRetry, enableAssetManifest, sourceMap, convertToRem, polyfill, dataUriLimit = 10000, distPath = {}, ...outputConfig } = {}, html: { outputStructure, appIcon, ...htmlConfig } = {}, source: { alias, globalVars, transformImport, reactCompiler, ...sourceConfig } = {}, dev = {}, server = {}, security: { checkSyntax, sri, ...securityConfig } = {}, tools: { devServer, tsChecker, minifyCss, less, sass, htmlPlugin, autoprefixer, ...toolsConfig } = {}, environments = {}, resolve = {} } = builderConfig;
|
|
30
30
|
let combinedAlias;
|
|
31
31
|
if (alias || resolve.alias) combinedAlias = [].concat(alias ?? []).concat(resolve.alias ?? []);
|
|
32
32
|
const rsbuildConfig = {
|
|
@@ -141,7 +141,9 @@ async function parseCommonConfig(builderConfig, options) {
|
|
|
141
141
|
const { pluginSourceBuild } = await import("@rsbuild/plugin-source-build");
|
|
142
142
|
rsbuildPlugins.push(pluginSourceBuild(true === sourceBuild ? {} : sourceBuild));
|
|
143
143
|
}
|
|
144
|
-
rsbuildPlugins.push(pluginReact(
|
|
144
|
+
rsbuildPlugins.push(pluginReact(void 0 !== reactCompiler ? {
|
|
145
|
+
reactCompiler
|
|
146
|
+
} : {}));
|
|
145
147
|
if (!disableSvgr) {
|
|
146
148
|
const { pluginSvgr } = await import("@rsbuild/plugin-svgr");
|
|
147
149
|
rsbuildPlugins.push(pluginSvgr({
|
|
@@ -3,7 +3,7 @@ const require = /*#__PURE__*/ __rslib_shim_module__.createRequire(/*#__PURE__*/
|
|
|
3
3
|
import path from "path";
|
|
4
4
|
import { fileURLToPath as __rspack_fileURLToPath } from "node:url";
|
|
5
5
|
import { dirname as __rspack_dirname } from "node:path";
|
|
6
|
-
var
|
|
6
|
+
var __rspack_import_meta_dirname__ = __rspack_dirname(__rspack_fileURLToPath(import.meta.url));
|
|
7
7
|
function rscClientBrowserFallbackPlugin() {
|
|
8
8
|
return {
|
|
9
9
|
name: 'builder:rsc-client-browser-fallback',
|
|
@@ -12,7 +12,7 @@ function rscClientBrowserFallbackPlugin() {
|
|
|
12
12
|
try {
|
|
13
13
|
emptyModulePath = require.resolve('./rscEmptyModule');
|
|
14
14
|
} catch {
|
|
15
|
-
emptyModulePath = path.resolve(
|
|
15
|
+
emptyModulePath = path.resolve(__rspack_import_meta_dirname__, 'rscEmptyModule');
|
|
16
16
|
}
|
|
17
17
|
api.modifyRspackConfig((config)=>{
|
|
18
18
|
config.resolve ??= {};
|
package/dist/types/types.d.ts
CHANGED
|
@@ -4,6 +4,7 @@ import type { PluginAssetsRetryOptions } from '@rsbuild/plugin-assets-retry';
|
|
|
4
4
|
import type { PluginCheckSyntaxOptions } from '@rsbuild/plugin-check-syntax';
|
|
5
5
|
import type { PluginCssMinimizerOptions } from '@rsbuild/plugin-css-minimizer';
|
|
6
6
|
import type { PluginLessOptions } from '@rsbuild/plugin-less';
|
|
7
|
+
import type { PluginReactOptions } from '@rsbuild/plugin-react';
|
|
7
8
|
import type { PluginRemOptions } from '@rsbuild/plugin-rem';
|
|
8
9
|
import type { PluginSassOptions } from '@rsbuild/plugin-sass';
|
|
9
10
|
import type { PluginSourceBuildOptions } from '@rsbuild/plugin-source-build';
|
|
@@ -138,6 +139,12 @@ export type BuilderExtraConfig = {
|
|
|
138
139
|
* Define global variables. It can replace expressions like `process.env.FOO` in your code after compile.
|
|
139
140
|
*/
|
|
140
141
|
globalVars?: ChainedGlobalVars;
|
|
142
|
+
/**
|
|
143
|
+
* Enable or configure React Compiler, powered by the Rust-based implementation
|
|
144
|
+
* built into Rspack's `builtin:swc-loader` (`jsc.transform.reactCompiler`).
|
|
145
|
+
* @default undefined (disabled)
|
|
146
|
+
*/
|
|
147
|
+
reactCompiler?: PluginReactOptions['reactCompiler'];
|
|
141
148
|
};
|
|
142
149
|
output?: {
|
|
143
150
|
/**
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@modern-js/builder",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.7.0",
|
|
4
4
|
"description": "A builder for Modern.js",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
"@rsbuild/plugin-check-syntax": "2.0.0",
|
|
32
32
|
"@rsbuild/plugin-css-minimizer": "2.0.1",
|
|
33
33
|
"@rsbuild/plugin-less": "1.6.4",
|
|
34
|
-
"@rsbuild/plugin-react": "2.0
|
|
34
|
+
"@rsbuild/plugin-react": "2.1.0",
|
|
35
35
|
"@rsbuild/plugin-rem": "1.0.6",
|
|
36
36
|
"@rsbuild/plugin-sass": "1.5.3",
|
|
37
37
|
"@rsbuild/plugin-source-build": "1.0.6",
|
|
@@ -41,12 +41,12 @@
|
|
|
41
41
|
"@swc/core": "1.15.41",
|
|
42
42
|
"@swc/helpers": "^0.5.17",
|
|
43
43
|
"autoprefixer": "10.4.27",
|
|
44
|
-
"browserslist": "4.28.
|
|
44
|
+
"browserslist": "4.28.4",
|
|
45
45
|
"core-js": "^3.48.0",
|
|
46
46
|
"cssnano": "6.1.2",
|
|
47
47
|
"html-minifier-terser": "^7.2.0",
|
|
48
48
|
"lodash": "^4.18.1",
|
|
49
|
-
"postcss": "^8.5.
|
|
49
|
+
"postcss": "^8.5.16",
|
|
50
50
|
"postcss-custom-properties": "13.3.12",
|
|
51
51
|
"postcss-flexbugs-fixes": "5.0.2",
|
|
52
52
|
"postcss-font-variant": "5.0.0",
|
|
@@ -57,17 +57,17 @@
|
|
|
57
57
|
"rsbuild-plugin-rsc": "0.1.1",
|
|
58
58
|
"rspack-manifest-plugin": "5.2.2",
|
|
59
59
|
"ts-deepmerge": "7.0.3",
|
|
60
|
-
"@modern-js/utils": "3.
|
|
60
|
+
"@modern-js/utils": "3.7.0"
|
|
61
61
|
},
|
|
62
62
|
"devDependencies": {
|
|
63
|
-
"@rslib/core": "0.23.
|
|
63
|
+
"@rslib/core": "0.23.2",
|
|
64
64
|
"@types/html-minifier-terser": "^7.0.2",
|
|
65
65
|
"@types/lodash": "^4.17.24",
|
|
66
66
|
"react": "^19.2.7",
|
|
67
67
|
"terser": "^5.48.0",
|
|
68
68
|
"typescript": "^5.3.0",
|
|
69
69
|
"@modern-js/rslib": "2.68.10",
|
|
70
|
-
"@modern-js/types": "3.
|
|
70
|
+
"@modern-js/types": "3.7.0",
|
|
71
71
|
"@scripts/rstest-config": "2.66.0"
|
|
72
72
|
},
|
|
73
73
|
"publishConfig": {
|