@octanejs/rsbuild-plugin 0.1.56 → 0.1.58
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/package.json +5 -5
- package/src/dev-server.js +4 -4
- package/src/index.js +18 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@octanejs/rsbuild-plugin",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.58",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"engines": {
|
|
@@ -48,12 +48,12 @@
|
|
|
48
48
|
}
|
|
49
49
|
},
|
|
50
50
|
"dependencies": {
|
|
51
|
-
"@octanejs/app-core": "0.0
|
|
52
|
-
"@octanejs/rspack-plugin": "0.1.
|
|
51
|
+
"@octanejs/app-core": "0.1.0",
|
|
52
|
+
"@octanejs/rspack-plugin": "0.1.56"
|
|
53
53
|
},
|
|
54
54
|
"peerDependencies": {
|
|
55
55
|
"@rsbuild/core": "^2.0.0",
|
|
56
|
-
"octane": "^0.
|
|
56
|
+
"octane": "^0.8.0"
|
|
57
57
|
},
|
|
58
58
|
"devDependencies": {
|
|
59
59
|
"@rsbuild/core": "^2.1.6",
|
|
@@ -62,6 +62,6 @@
|
|
|
62
62
|
"@types/node": "^24.13.3",
|
|
63
63
|
"playwright": "^1.61.1",
|
|
64
64
|
"vitest": "^4.1.10",
|
|
65
|
-
"octane": "0.
|
|
65
|
+
"octane": "0.8.0"
|
|
66
66
|
}
|
|
67
67
|
}
|
package/src/dev-server.js
CHANGED
|
@@ -150,10 +150,10 @@ export function createOctaneDevMiddleware(options) {
|
|
|
150
150
|
await sendWebResponse(response, webResponse);
|
|
151
151
|
} catch (error) {
|
|
152
152
|
options.logError?.('Dev SSR request failed', error);
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
153
|
+
// sendWebResponse already aborted a response whose headers were sent.
|
|
154
|
+
if (response.headersSent) return;
|
|
155
|
+
response.statusCode = 500;
|
|
156
|
+
response.setHeader('Content-Type', 'text/plain; charset=utf-8');
|
|
157
157
|
response.end('Internal Server Error');
|
|
158
158
|
}
|
|
159
159
|
};
|
package/src/index.js
CHANGED
|
@@ -135,6 +135,21 @@ function hasRoutes(config) {
|
|
|
135
135
|
return (config?.router.routes.length ?? 0) > 0;
|
|
136
136
|
}
|
|
137
137
|
|
|
138
|
+
/**
|
|
139
|
+
* The renderer-free islands entry and its shell checks exist only in the Vite
|
|
140
|
+
* integration so far. Refuse the route option rather than hydrating the shell.
|
|
141
|
+
* @param {import('@octanejs/app-core').ResolvedOctaneConfig | null} config
|
|
142
|
+
*/
|
|
143
|
+
function assertSupportedHydration(config) {
|
|
144
|
+
const route = config?.router.routes.find(
|
|
145
|
+
(candidate) => candidate.type === 'render' && candidate.hydrate === 'islands',
|
|
146
|
+
);
|
|
147
|
+
if (route)
|
|
148
|
+
throw new Error(
|
|
149
|
+
`[@octanejs/rsbuild-plugin] RenderRoute ${JSON.stringify(route.path)} uses hydrate: 'islands', which this integration does not support yet. Use @octanejs/vite-plugin or remove the option.`,
|
|
150
|
+
);
|
|
151
|
+
}
|
|
152
|
+
|
|
138
153
|
/**
|
|
139
154
|
* @param {import('@octanejs/app-core').ResolvedOctaneConfig} config
|
|
140
155
|
* @param {boolean | undefined} strongOverride
|
|
@@ -150,6 +165,7 @@ function configSignature(config, strongOverride) {
|
|
|
150
165
|
entry: route.entry,
|
|
151
166
|
layout: route.layout,
|
|
152
167
|
status: route.status,
|
|
168
|
+
hydrate: route.hydrate,
|
|
153
169
|
}
|
|
154
170
|
: { type: route.type, path: route.path, methods: route.methods },
|
|
155
171
|
),
|
|
@@ -269,6 +285,7 @@ export function pluginOctane(inlineOptions = {}) {
|
|
|
269
285
|
})
|
|
270
286
|
: null;
|
|
271
287
|
const initialConfig = initialLoaded?.config ?? null;
|
|
288
|
+
assertSupportedHydration(initialConfig);
|
|
272
289
|
const strong = inlineOptions.strong ?? initialConfig?.compiler.strong;
|
|
273
290
|
const appEnabled = hasRoutes(initialConfig);
|
|
274
291
|
const buildTargetPlan =
|
|
@@ -331,6 +348,7 @@ export function pluginOctane(inlineOptions = {}) {
|
|
|
331
348
|
throw error;
|
|
332
349
|
}
|
|
333
350
|
registerConfigDependencies(context, loaded);
|
|
351
|
+
assertSupportedHydration(loaded.config);
|
|
334
352
|
const signature = configSignature(loaded.config, inlineOptions.strong);
|
|
335
353
|
if (lastConfigSignature && signature !== lastConfigSignature) configNeedsReload = true;
|
|
336
354
|
lastConfigSignature = signature;
|