@bleedingdev/modern-js-builder 3.9.0-ultramodern.17 → 3.9.0-ultramodern.18
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/plugins/rscConfig.js +1 -4
- package/dist/cjs/shared/parseCommonConfig.js +17 -3
- package/dist/esm/plugins/rscConfig.mjs +1 -4
- package/dist/esm/shared/parseCommonConfig.mjs +18 -4
- package/dist/esm-node/plugins/rscConfig.mjs +1 -4
- package/dist/esm-node/shared/parseCommonConfig.mjs +18 -4
- package/dist/types/types.d.ts +3 -0
- package/package.json +3 -3
|
@@ -46,9 +46,7 @@ var external_path_default = /*#__PURE__*/ __webpack_require__.n(external_path_na
|
|
|
46
46
|
const ASYNC_STORAGE_PATTERN = /universal[/\\]async_storage/;
|
|
47
47
|
const SERVER_LOADER_ENTRY_PATTERN = /[/\\](?:server-loader-combined|route-server-loaders)\.js$/;
|
|
48
48
|
const RENDER_RSC_SOURCE_PATTERN = /render[/\\].*[/\\]server[/\\]rsc/;
|
|
49
|
-
const RENDER_RSC_RSLIB_ENTRY_PATTERN = /render[/\\]dist[/\\]esm[/\\]rsc(
|
|
50
|
-
const RENDER_RSC_RUNTIME = '@modern-js/render/rsc';
|
|
51
|
-
const RENDER_RSC_WORKER_RUNTIME = '@modern-js/render/rsc-worker';
|
|
49
|
+
const RENDER_RSC_RSLIB_ENTRY_PATTERN = /render[/\\]dist[/\\]esm[/\\]rsc(?:\.edge)?\.mjs$/;
|
|
52
50
|
const RSC_COMMON_LAYER = 'rsc-common';
|
|
53
51
|
const ENTRY_NAME_VAR = '__MODERN_JS_ENTRY_NAME';
|
|
54
52
|
const ROUTE_DATA_FILE_PATTERN = /[/\\]routes[/\\](?:.*[/\\])?(?:layout|page|\$)\.(?:loader|data)\.[tj]sx?(?:\?.*)?$/;
|
|
@@ -73,7 +71,6 @@ function pluginRscConfig() {
|
|
|
73
71
|
api.modifyBundlerChain({
|
|
74
72
|
handler: (chain, { isServer })=>{
|
|
75
73
|
if (isServer) {
|
|
76
|
-
chain.resolve.alias.set(`${RENDER_RSC_RUNTIME}$`, RENDER_RSC_WORKER_RUNTIME);
|
|
77
74
|
let emptyModulePath;
|
|
78
75
|
try {
|
|
79
76
|
emptyModulePath = require.resolve('../shared/rsc/rscEmptyModule');
|
|
@@ -185,9 +185,23 @@ async function parseCommonConfig(builderConfig, options) {
|
|
|
185
185
|
const { pluginSourceBuild } = await import("@rsbuild/plugin-source-build");
|
|
186
186
|
rsbuildPlugins.push(pluginSourceBuild(true === sourceBuild ? {} : sourceBuild));
|
|
187
187
|
}
|
|
188
|
-
rsbuildPlugins.push((0, plugin_react_namespaceObject.pluginReact)(
|
|
189
|
-
|
|
190
|
-
|
|
188
|
+
rsbuildPlugins.push((0, plugin_react_namespaceObject.pluginReact)());
|
|
189
|
+
if (!options?.disableReactCompiler && void 0 !== reactCompiler) rsbuildPlugins.push({
|
|
190
|
+
name: 'builder:react-compiler',
|
|
191
|
+
setup (api) {
|
|
192
|
+
api.modifyEnvironmentConfig((config, { name, mergeEnvironmentConfig })=>'web' === config.output.target && name !== external_utils_js_namespaceObject.SERVICE_WORKER_ENVIRONMENT_NAME ? mergeEnvironmentConfig({
|
|
193
|
+
tools: {
|
|
194
|
+
swc: {
|
|
195
|
+
jsc: {
|
|
196
|
+
transform: {
|
|
197
|
+
reactCompiler
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
}, config) : config);
|
|
203
|
+
}
|
|
204
|
+
});
|
|
191
205
|
if (!disableSvgr) {
|
|
192
206
|
const { pluginSvgr } = await import("@rsbuild/plugin-svgr");
|
|
193
207
|
rsbuildPlugins.push(pluginSvgr({
|
|
@@ -2,9 +2,7 @@ import path from "path";
|
|
|
2
2
|
const ASYNC_STORAGE_PATTERN = /universal[/\\]async_storage/;
|
|
3
3
|
const SERVER_LOADER_ENTRY_PATTERN = /[/\\](?:server-loader-combined|route-server-loaders)\.js$/;
|
|
4
4
|
const RENDER_RSC_SOURCE_PATTERN = /render[/\\].*[/\\]server[/\\]rsc/;
|
|
5
|
-
const RENDER_RSC_RSLIB_ENTRY_PATTERN = /render[/\\]dist[/\\]esm[/\\]rsc(
|
|
6
|
-
const RENDER_RSC_RUNTIME = '@modern-js/render/rsc';
|
|
7
|
-
const RENDER_RSC_WORKER_RUNTIME = '@modern-js/render/rsc-worker';
|
|
5
|
+
const RENDER_RSC_RSLIB_ENTRY_PATTERN = /render[/\\]dist[/\\]esm[/\\]rsc(?:\.edge)?\.mjs$/;
|
|
8
6
|
const RSC_COMMON_LAYER = 'rsc-common';
|
|
9
7
|
const ENTRY_NAME_VAR = '__MODERN_JS_ENTRY_NAME';
|
|
10
8
|
const ROUTE_DATA_FILE_PATTERN = /[/\\]routes[/\\](?:.*[/\\])?(?:layout|page|\$)\.(?:loader|data)\.[tj]sx?(?:\?.*)?$/;
|
|
@@ -29,7 +27,6 @@ function pluginRscConfig() {
|
|
|
29
27
|
api.modifyBundlerChain({
|
|
30
28
|
handler: (chain, { isServer })=>{
|
|
31
29
|
if (isServer) {
|
|
32
|
-
chain.resolve.alias.set(`${RENDER_RSC_RUNTIME}$`, RENDER_RSC_WORKER_RUNTIME);
|
|
33
30
|
let emptyModulePath;
|
|
34
31
|
try {
|
|
35
32
|
emptyModulePath = require.resolve('../shared/rsc/rscEmptyModule');
|
|
@@ -11,7 +11,7 @@ import { pluginHtmlMinifierTerser } from "../plugins/htmlMinify.mjs";
|
|
|
11
11
|
import { pluginRuntimeChunk } from "../plugins/runtimeChunk.mjs";
|
|
12
12
|
import { transformToRsbuildServerOptions } from "./devServer.mjs";
|
|
13
13
|
import { withTsgoDefaults } from "./tsgo.mjs";
|
|
14
|
-
import { NODE_MODULES_REGEX } from "./utils.mjs";
|
|
14
|
+
import { NODE_MODULES_REGEX, SERVICE_WORKER_ENVIRONMENT_NAME } from "./utils.mjs";
|
|
15
15
|
const CSS_MODULES_REGEX = /\.modules?\.\w+$/i;
|
|
16
16
|
const GLOBAL_CSS_REGEX = /\.global\.\w+$/;
|
|
17
17
|
const DEFAULT_CSS_MINIFIER_OPTIONS = {
|
|
@@ -152,9 +152,23 @@ async function parseCommonConfig(builderConfig, options) {
|
|
|
152
152
|
const { pluginSourceBuild } = await import("@rsbuild/plugin-source-build");
|
|
153
153
|
rsbuildPlugins.push(pluginSourceBuild(true === sourceBuild ? {} : sourceBuild));
|
|
154
154
|
}
|
|
155
|
-
rsbuildPlugins.push(pluginReact(
|
|
156
|
-
|
|
157
|
-
|
|
155
|
+
rsbuildPlugins.push(pluginReact());
|
|
156
|
+
if (!options?.disableReactCompiler && void 0 !== reactCompiler) rsbuildPlugins.push({
|
|
157
|
+
name: 'builder:react-compiler',
|
|
158
|
+
setup (api) {
|
|
159
|
+
api.modifyEnvironmentConfig((config, { name, mergeEnvironmentConfig })=>'web' === config.output.target && name !== SERVICE_WORKER_ENVIRONMENT_NAME ? mergeEnvironmentConfig({
|
|
160
|
+
tools: {
|
|
161
|
+
swc: {
|
|
162
|
+
jsc: {
|
|
163
|
+
transform: {
|
|
164
|
+
reactCompiler
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
}, config) : config);
|
|
170
|
+
}
|
|
171
|
+
});
|
|
158
172
|
if (!disableSvgr) {
|
|
159
173
|
const { pluginSvgr } = await import("@rsbuild/plugin-svgr");
|
|
160
174
|
rsbuildPlugins.push(pluginSvgr({
|
|
@@ -7,9 +7,7 @@ var __rspack_import_meta_dirname__ = __rspack_dirname(__rspack_fileURLToPath(imp
|
|
|
7
7
|
const ASYNC_STORAGE_PATTERN = /universal[/\\]async_storage/;
|
|
8
8
|
const SERVER_LOADER_ENTRY_PATTERN = /[/\\](?:server-loader-combined|route-server-loaders)\.js$/;
|
|
9
9
|
const RENDER_RSC_SOURCE_PATTERN = /render[/\\].*[/\\]server[/\\]rsc/;
|
|
10
|
-
const RENDER_RSC_RSLIB_ENTRY_PATTERN = /render[/\\]dist[/\\]esm[/\\]rsc(
|
|
11
|
-
const RENDER_RSC_RUNTIME = '@modern-js/render/rsc';
|
|
12
|
-
const RENDER_RSC_WORKER_RUNTIME = '@modern-js/render/rsc-worker';
|
|
10
|
+
const RENDER_RSC_RSLIB_ENTRY_PATTERN = /render[/\\]dist[/\\]esm[/\\]rsc(?:\.edge)?\.mjs$/;
|
|
13
11
|
const RSC_COMMON_LAYER = 'rsc-common';
|
|
14
12
|
const ENTRY_NAME_VAR = '__MODERN_JS_ENTRY_NAME';
|
|
15
13
|
const ROUTE_DATA_FILE_PATTERN = /[/\\]routes[/\\](?:.*[/\\])?(?:layout|page|\$)\.(?:loader|data)\.[tj]sx?(?:\?.*)?$/;
|
|
@@ -34,7 +32,6 @@ function pluginRscConfig() {
|
|
|
34
32
|
api.modifyBundlerChain({
|
|
35
33
|
handler: (chain, { isServer })=>{
|
|
36
34
|
if (isServer) {
|
|
37
|
-
chain.resolve.alias.set(`${RENDER_RSC_RUNTIME}$`, RENDER_RSC_WORKER_RUNTIME);
|
|
38
35
|
let emptyModulePath;
|
|
39
36
|
try {
|
|
40
37
|
emptyModulePath = require.resolve('../shared/rsc/rscEmptyModule');
|
|
@@ -12,7 +12,7 @@ import { pluginHtmlMinifierTerser } from "../plugins/htmlMinify.mjs";
|
|
|
12
12
|
import { pluginRuntimeChunk } from "../plugins/runtimeChunk.mjs";
|
|
13
13
|
import { transformToRsbuildServerOptions } from "./devServer.mjs";
|
|
14
14
|
import { withTsgoDefaults } from "./tsgo.mjs";
|
|
15
|
-
import { NODE_MODULES_REGEX } from "./utils.mjs";
|
|
15
|
+
import { NODE_MODULES_REGEX, SERVICE_WORKER_ENVIRONMENT_NAME } from "./utils.mjs";
|
|
16
16
|
const CSS_MODULES_REGEX = /\.modules?\.\w+$/i;
|
|
17
17
|
const GLOBAL_CSS_REGEX = /\.global\.\w+$/;
|
|
18
18
|
const DEFAULT_CSS_MINIFIER_OPTIONS = {
|
|
@@ -153,9 +153,23 @@ async function parseCommonConfig(builderConfig, options) {
|
|
|
153
153
|
const { pluginSourceBuild } = await import("@rsbuild/plugin-source-build");
|
|
154
154
|
rsbuildPlugins.push(pluginSourceBuild(true === sourceBuild ? {} : sourceBuild));
|
|
155
155
|
}
|
|
156
|
-
rsbuildPlugins.push(pluginReact(
|
|
157
|
-
|
|
158
|
-
|
|
156
|
+
rsbuildPlugins.push(pluginReact());
|
|
157
|
+
if (!options?.disableReactCompiler && void 0 !== reactCompiler) rsbuildPlugins.push({
|
|
158
|
+
name: 'builder:react-compiler',
|
|
159
|
+
setup (api) {
|
|
160
|
+
api.modifyEnvironmentConfig((config, { name, mergeEnvironmentConfig })=>'web' === config.output.target && name !== SERVICE_WORKER_ENVIRONMENT_NAME ? mergeEnvironmentConfig({
|
|
161
|
+
tools: {
|
|
162
|
+
swc: {
|
|
163
|
+
jsc: {
|
|
164
|
+
transform: {
|
|
165
|
+
reactCompiler
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
}, config) : config);
|
|
171
|
+
}
|
|
172
|
+
});
|
|
159
173
|
if (!disableSvgr) {
|
|
160
174
|
const { pluginSvgr } = await import("@rsbuild/plugin-svgr");
|
|
161
175
|
rsbuildPlugins.push(pluginSvgr({
|
package/dist/types/types.d.ts
CHANGED
|
@@ -150,6 +150,9 @@ export type BuilderExtraConfig = {
|
|
|
150
150
|
* The transform is enabled by default through Rsbuild's SWC integration.
|
|
151
151
|
* Set this to `false` to disable it.
|
|
152
152
|
*
|
|
153
|
+
* Only browser environments (`output.target: 'web'`) are compiled;
|
|
154
|
+
* `node` and `web-worker` (SSR, BFF) environments never are.
|
|
155
|
+
*
|
|
153
156
|
* For React 17 or 18, install `react-compiler-runtime` and set the
|
|
154
157
|
* matching target version, for example `{ target: '18' }`.
|
|
155
158
|
*/
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bleedingdev/modern-js-builder",
|
|
3
|
-
"version": "3.9.0-ultramodern.
|
|
3
|
+
"version": "3.9.0-ultramodern.18",
|
|
4
4
|
"description": "A builder for Modern.js",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
],
|
|
28
28
|
"dependencies": {
|
|
29
29
|
"@jridgewell/trace-mapping": "^0.3.31",
|
|
30
|
-
"@modern-js/utils": "npm:@bleedingdev/modern-js-utils@3.9.0-ultramodern.
|
|
30
|
+
"@modern-js/utils": "npm:@bleedingdev/modern-js-utils@3.9.0-ultramodern.18",
|
|
31
31
|
"@rsbuild/core": "2.2.9",
|
|
32
32
|
"@rsbuild/plugin-assets-retry": "2.0.2",
|
|
33
33
|
"@rsbuild/plugin-check-syntax": "2.0.1",
|
|
@@ -61,7 +61,7 @@
|
|
|
61
61
|
"ts-deepmerge": "8.0.0"
|
|
62
62
|
},
|
|
63
63
|
"devDependencies": {
|
|
64
|
-
"@modern-js/types": "npm:@bleedingdev/modern-js-types@3.9.0-ultramodern.
|
|
64
|
+
"@modern-js/types": "npm:@bleedingdev/modern-js-types@3.9.0-ultramodern.18",
|
|
65
65
|
"@rsdoctor/rspack-plugin": "^1.6.4",
|
|
66
66
|
"@rslib/core": "1.0.2",
|
|
67
67
|
"@scripts/rstest-config": "2.66.0",
|