@octanejs/vite-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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@octanejs/vite-plugin",
3
- "version": "0.1.56",
3
+ "version": "0.1.58",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "engines": {
@@ -47,17 +47,17 @@
47
47
  },
48
48
  "dependencies": {
49
49
  "@ripple-ts/adapter": "^0.4.0",
50
- "@octanejs/app-core": "0.0.52"
50
+ "@octanejs/app-core": "0.0.54"
51
51
  },
52
52
  "peerDependencies": {
53
53
  "vite": "^8.0.16",
54
- "octane": "^0.3.0"
54
+ "octane": "^0.4.0"
55
55
  },
56
56
  "devDependencies": {
57
57
  "@types/jsdom": "30.0.0",
58
58
  "@types/node": "^24.13.3",
59
59
  "playwright": "^1.61.1",
60
60
  "vite": "^8.1.5",
61
- "octane": "0.3.0"
61
+ "octane": "0.4.0"
62
62
  }
63
63
  }
package/src/index.js CHANGED
@@ -265,7 +265,7 @@ function collect_hydrate_module_paths(config) {
265
265
  * it). An explicit `profile` (true or false) always takes precedence over
266
266
  * `devtools`.
267
267
  *
268
- * @param {{ hmr?: boolean, profile?: boolean, devtools?: boolean, strong?: boolean, textTypes?: import('octane/compiler/vite').OctaneVitePluginOptions['textTypes'], knownAttributeSpreads?: import('octane/compiler/vite').OctaneVitePluginOptions['knownAttributeSpreads'], exclude?: string[], requireDirective?: boolean, renderers?: import('@octanejs/app-core').ExperimentalRendererConfigOptions, cssModuleConstants?: import('octane/compiler/vite').OctaneVitePluginOptions['cssModuleConstants'] }} [inlineOptions]
268
+ * @param {{ hmr?: boolean, profile?: boolean, devtools?: boolean, strong?: boolean, textTypes?: import('octane/compiler/vite').OctaneVitePluginOptions['textTypes'], knownAttributeSpreads?: import('octane/compiler/vite').OctaneVitePluginOptions['knownAttributeSpreads'], domBindingFixedProps?: import('octane/compiler/vite').OctaneVitePluginOptions['domBindingFixedProps'], exclude?: string[], requireDirective?: boolean, renderers?: import('@octanejs/app-core').ExperimentalRendererConfigOptions, cssModuleConstants?: import('octane/compiler/vite').OctaneVitePluginOptions['cssModuleConstants'] }} [inlineOptions]
269
269
  * @returns {Plugin[]}
270
270
  */
271
271
  export function octane(inlineOptions = {}) {
@@ -1098,6 +1098,7 @@ export function octane(inlineOptions = {}) {
1098
1098
  * strong?: boolean,
1099
1099
  * textTypes?: import('octane/compiler/vite').OctaneVitePluginOptions['textTypes'],
1100
1100
  * knownAttributeSpreads?: import('octane/compiler/vite').OctaneVitePluginOptions['knownAttributeSpreads'],
1101
+ * domBindingFixedProps?: import('octane/compiler/vite').OctaneVitePluginOptions['domBindingFixedProps'],
1101
1102
  * exclude?: string[],
1102
1103
  * requireDirective?: boolean,
1103
1104
  * renderers?: import('@octanejs/app-core').ExperimentalRendererConfigOptions,
@@ -1120,6 +1121,9 @@ export function octane(inlineOptions = {}) {
1120
1121
  if (inlineOptions.knownAttributeSpreads !== undefined) {
1121
1122
  compilerOptions.knownAttributeSpreads = inlineOptions.knownAttributeSpreads;
1122
1123
  }
1124
+ if (inlineOptions.domBindingFixedProps !== undefined) {
1125
+ compilerOptions.domBindingFixedProps = inlineOptions.domBindingFixedProps;
1126
+ }
1123
1127
  if (inlineOptions.exclude !== undefined) compilerOptions.exclude = inlineOptions.exclude;
1124
1128
  if (inlineOptions.requireDirective !== undefined) {
1125
1129
  compilerOptions.requireDirective = inlineOptions.requireDirective;
@@ -5,6 +5,7 @@ export {
5
5
  injectHydrationEntry,
6
6
  nonceAttribute,
7
7
  prepareStreamingHydrationTemplate,
8
+ serializeRouteData,
8
9
  splitSsrTemplate,
9
10
  validateSsrTemplate,
10
11
  } from '@octanejs/app-core/html';
@@ -9,6 +9,7 @@ import {
9
9
  injectHydrationEntry,
10
10
  nonceAttribute,
11
11
  prepareStreamingHydrationTemplate,
12
+ serializeRouteData,
12
13
  splitSsrTemplate,
13
14
  } from './html-template.js';
14
15
  import {
@@ -146,8 +147,7 @@ export async function handleRenderRoute(
146
147
  // params, the request url, and the optional preHydrate module the client
147
148
  // entry awaits before hydrateRoot. routeIndex stays for debugging /
148
149
  // Phase-2 static maps.
149
- const routeData = JSON.stringify({
150
- ...(clientBuild === undefined ? {} : { clientBuild, streamedSignals }),
150
+ const routeData = serializeRouteData({
151
151
  entry: entryPath,
152
152
  exportName: get_route_entry_export_name(route.entry) ?? null,
153
153
  layout: route.layout ?? null,
@@ -159,8 +159,10 @@ export async function handleRenderRoute(
159
159
  pending: serializeComponentEntry(pendingEntry),
160
160
  catch: serializeComponentEntry(catchEntry),
161
161
  },
162
+ clientBuild,
163
+ streamedSignals,
162
164
  });
163
- const headContent = `<script id="__octane_data" type="application/json"${nonceAttribute(nonce)}>${escapeScript(routeData)}</script>`;
165
+ const headContent = `<script id="__octane_data" type="application/json"${nonceAttribute(nonce)}>${routeData}</script>`;
164
166
 
165
167
  // Load and process index.html template.
166
168
  const templatePath = join(vite.config.root, 'index.html');
@@ -277,15 +279,6 @@ function getRenderRouteIndex(config, route) {
277
279
  return index === -1 ? undefined : index;
278
280
  }
279
281
 
280
- /**
281
- * Escape script content to prevent XSS in the inline JSON data block.
282
- * @param {string} str
283
- * @returns {string}
284
- */
285
- function escapeScript(str) {
286
- return str.replace(/</g, '\\u003c').replace(/>/g, '\\u003e');
287
- }
288
-
289
282
  /**
290
283
  * Generate an error HTML page for development.
291
284
  *
package/types/index.d.ts CHANGED
@@ -21,6 +21,8 @@ export interface OctanePluginOptions {
21
21
  textTypes?: OctaneVitePluginOptions['textTypes'];
22
22
  /** Fixed native attribute factories and optional JSX shorthand providers. */
23
23
  knownAttributeSpreads?: OctaneVitePluginOptions['knownAttributeSpreads'];
24
+ /** Opt in to fixed primitive child props by name; keep text and IDs live for sharing. */
25
+ domBindingFixedProps?: OctaneVitePluginOptions['domBindingFixedProps'];
24
26
  /**
25
27
  * Path fragments the compiler's plain `.ts`/`.js` hook-slotting pass must
26
28
  * skip. Prefer package manifest `octane.hookSlots.manual` declarations.