@octanejs/rsbuild-plugin 0.1.47 → 0.1.49
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/README.md +12 -0
- package/package.json +4 -5
- package/src/index.js +7 -16
- package/types/index.d.ts +7 -2
package/README.md
CHANGED
|
@@ -133,3 +133,15 @@ The package forwards normalized `compiler.renderers` registry, filename-rule,
|
|
|
133
133
|
and renderer-boundary metadata through the same Rspack compiler path used by
|
|
134
134
|
Vite and direct compilation. This enables the experimental universal client
|
|
135
135
|
target; a concrete Lynx runtime and cross-thread transport remain future work.
|
|
136
|
+
|
|
137
|
+
## Scoped CSS
|
|
138
|
+
|
|
139
|
+
Scoped `<style>` blocks compile to `injectStyle(hash, css)` calls — one per
|
|
140
|
+
style scope, in lexical order — emitted as module-level statements in the
|
|
141
|
+
`web` environment and inside the component body per request in the `node`
|
|
142
|
+
SSR environment, where the render collects them into the response's
|
|
143
|
+
`<style data-octane>` tags. A theme (`export const theme = <style>…</style>`)
|
|
144
|
+
is an ordinary module value, so importing it injects its sheet ahead of the
|
|
145
|
+
importer's own scopes. There is no virtual CSS module and no CSS HMR path:
|
|
146
|
+
editing a block re-evaluates the module like any other source change. No
|
|
147
|
+
CSS-loader configuration is involved.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@octanejs/rsbuild-plugin",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.49",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"engines": {
|
|
@@ -48,8 +48,8 @@
|
|
|
48
48
|
}
|
|
49
49
|
},
|
|
50
50
|
"dependencies": {
|
|
51
|
-
"@octanejs/app-core": "0.0.
|
|
52
|
-
"@octanejs/rspack-plugin": "0.1.
|
|
51
|
+
"@octanejs/app-core": "0.0.50",
|
|
52
|
+
"@octanejs/rspack-plugin": "0.1.49"
|
|
53
53
|
},
|
|
54
54
|
"peerDependencies": {
|
|
55
55
|
"@rsbuild/core": "^2.0.0",
|
|
@@ -61,8 +61,7 @@
|
|
|
61
61
|
"@rspack/core": "^2.1.4",
|
|
62
62
|
"@types/node": "^24.13.3",
|
|
63
63
|
"playwright": "^1.61.1",
|
|
64
|
-
"type-fest": "^5.8.0",
|
|
65
64
|
"vitest": "^4.1.10",
|
|
66
|
-
"octane": "0.2.
|
|
65
|
+
"octane": "0.2.7"
|
|
67
66
|
}
|
|
68
67
|
}
|
package/src/index.js
CHANGED
|
@@ -135,9 +135,8 @@ function hasRoutes(config) {
|
|
|
135
135
|
/**
|
|
136
136
|
* @param {import('@octanejs/app-core').ResolvedOctaneConfig} config
|
|
137
137
|
* @param {boolean | undefined} strongOverride
|
|
138
|
-
* @param {boolean | undefined} nativeReadsOverride
|
|
139
138
|
*/
|
|
140
|
-
function configSignature(config, strongOverride
|
|
139
|
+
function configSignature(config, strongOverride) {
|
|
141
140
|
return JSON.stringify({
|
|
142
141
|
build: config.build,
|
|
143
142
|
routes: config.router.routes.map((route) =>
|
|
@@ -157,7 +156,6 @@ function configSignature(config, strongOverride, nativeReadsOverride) {
|
|
|
157
156
|
compiler: {
|
|
158
157
|
renderers: config.compiler.renderers.signature,
|
|
159
158
|
strong: strongOverride ?? config.compiler.strong,
|
|
160
|
-
nativeReads: nativeReadsOverride ?? config.compiler.nativeReads,
|
|
161
159
|
},
|
|
162
160
|
});
|
|
163
161
|
}
|
|
@@ -237,9 +235,9 @@ function assertRootPublicPaths(config, clientEnvironment) {
|
|
|
237
235
|
* hmr?: boolean,
|
|
238
236
|
* parallel?: boolean | { maxWorkers?: number },
|
|
239
237
|
* cssModuleConstants?: import('@octanejs/rspack-plugin').OctaneRspackPluginOptions['cssModuleConstants'],
|
|
238
|
+
* textTypes?: import('@octanejs/rspack-plugin').OctaneRspackPluginOptions['textTypes'],
|
|
240
239
|
* profile?: boolean,
|
|
241
240
|
* strong?: boolean,
|
|
242
|
-
* nativeReads?: boolean,
|
|
243
241
|
* exclude?: string[],
|
|
244
242
|
* requireDirective?: boolean,
|
|
245
243
|
* clientEnvironment?: string,
|
|
@@ -248,9 +246,6 @@ function assertRootPublicPaths(config, clientEnvironment) {
|
|
|
248
246
|
* @returns {import('@rsbuild/core').RsbuildPlugin}
|
|
249
247
|
*/
|
|
250
248
|
export function pluginOctane(inlineOptions = {}) {
|
|
251
|
-
if (inlineOptions.nativeReads !== undefined && typeof inlineOptions.nativeReads !== 'boolean') {
|
|
252
|
-
throw new TypeError('[@octanejs/rsbuild-plugin] nativeReads must be a boolean.');
|
|
253
|
-
}
|
|
254
249
|
if (inlineOptions.strong !== undefined && typeof inlineOptions.strong !== 'boolean') {
|
|
255
250
|
throw new TypeError('[@octanejs/rsbuild-plugin] `strong` must be a boolean.');
|
|
256
251
|
}
|
|
@@ -272,7 +267,6 @@ export function pluginOctane(inlineOptions = {}) {
|
|
|
272
267
|
: null;
|
|
273
268
|
const initialConfig = initialLoaded?.config ?? null;
|
|
274
269
|
const strong = inlineOptions.strong ?? initialConfig?.compiler.strong;
|
|
275
|
-
const nativeReads = inlineOptions.nativeReads ?? initialConfig?.compiler.nativeReads;
|
|
276
270
|
const appEnabled = hasRoutes(initialConfig);
|
|
277
271
|
const buildTargetPlan =
|
|
278
272
|
initialConfig?.build.target === undefined
|
|
@@ -282,12 +276,11 @@ export function pluginOctane(inlineOptions = {}) {
|
|
|
282
276
|
? createOctaneCompiler({
|
|
283
277
|
root,
|
|
284
278
|
...(strong === undefined ? null : { strong }),
|
|
285
|
-
...(nativeReads === undefined ? null : { nativeReads }),
|
|
286
279
|
})
|
|
287
280
|
: null;
|
|
288
281
|
let currentConfig = initialConfig;
|
|
289
282
|
let lastConfigSignature = initialLoaded
|
|
290
|
-
? configSignature(initialLoaded.config, inlineOptions.strong
|
|
283
|
+
? configSignature(initialLoaded.config, inlineOptions.strong)
|
|
291
284
|
: '';
|
|
292
285
|
let configNeedsReload = false;
|
|
293
286
|
/** @type {import('@rsbuild/core').RsbuildDevServer | null} */
|
|
@@ -335,11 +328,7 @@ export function pluginOctane(inlineOptions = {}) {
|
|
|
335
328
|
throw error;
|
|
336
329
|
}
|
|
337
330
|
registerConfigDependencies(context, loaded);
|
|
338
|
-
const signature = configSignature(
|
|
339
|
-
loaded.config,
|
|
340
|
-
inlineOptions.strong,
|
|
341
|
-
inlineOptions.nativeReads,
|
|
342
|
-
);
|
|
331
|
+
const signature = configSignature(loaded.config, inlineOptions.strong);
|
|
343
332
|
if (lastConfigSignature && signature !== lastConfigSignature) configNeedsReload = true;
|
|
344
333
|
lastConfigSignature = signature;
|
|
345
334
|
currentConfig = loaded.config;
|
|
@@ -567,8 +556,10 @@ export function pluginOctane(inlineOptions = {}) {
|
|
|
567
556
|
...(inlineOptions.cssModuleConstants === undefined
|
|
568
557
|
? null
|
|
569
558
|
: { cssModuleConstants: inlineOptions.cssModuleConstants }),
|
|
559
|
+
...(inlineOptions.textTypes === undefined
|
|
560
|
+
? null
|
|
561
|
+
: { textTypes: inlineOptions.textTypes }),
|
|
570
562
|
...(strong === undefined ? null : { strong }),
|
|
571
|
-
...(nativeReads === undefined ? null : { nativeReads }),
|
|
572
563
|
...(inlineOptions.hmr === undefined ? null : { hmr: inlineOptions.hmr }),
|
|
573
564
|
...(inlineOptions.profile === undefined
|
|
574
565
|
? null
|
package/types/index.d.ts
CHANGED
|
@@ -10,6 +10,13 @@ export {
|
|
|
10
10
|
} from '@octanejs/app-core/config-loader';
|
|
11
11
|
|
|
12
12
|
export interface OctaneRsbuildPluginOptions {
|
|
13
|
+
/**
|
|
14
|
+
* @experimental TypeScript text proofs in one-shot production browser and
|
|
15
|
+
* server builds. Relative tsconfig paths resolve from the project root.
|
|
16
|
+
* Watch/HMR and development builds retain syntax-only classification.
|
|
17
|
+
* Requires the optional TypeScript peer; see the Rspack option for caching.
|
|
18
|
+
*/
|
|
19
|
+
textTypes?: OctaneRspackPluginOptions['textTypes'];
|
|
13
20
|
/**
|
|
14
21
|
* @experimental Fold authenticated JavaScript CSS-module exports in one-shot
|
|
15
22
|
* production builds. Uses the Rspack plugin's exact-source provider contract;
|
|
@@ -33,8 +40,6 @@ export interface OctaneRsbuildPluginOptions {
|
|
|
33
40
|
* in with `"use strong"`.
|
|
34
41
|
*/
|
|
35
42
|
strong?: boolean;
|
|
36
|
-
/** Experimental native signal reads in DOM client/server render scopes. */
|
|
37
|
-
nativeReads?: boolean;
|
|
38
43
|
/**
|
|
39
44
|
* Ad-hoc path fragments skipped by the plain TypeScript/JavaScript
|
|
40
45
|
* hook-slot pass. With `requireDirective`, excluded paths are exempt from
|