@octanejs/vite-plugin 0.2.0 → 0.2.1

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.
Files changed (2) hide show
  1. package/package.json +4 -4
  2. package/src/index.js +29 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@octanejs/vite-plugin",
3
- "version": "0.2.0",
3
+ "version": "0.2.1",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "engines": {
@@ -47,11 +47,11 @@
47
47
  },
48
48
  "dependencies": {
49
49
  "@ripple-ts/adapter": "^0.4.0",
50
- "@octanejs/app-core": "0.1.0"
50
+ "@octanejs/app-core": "0.1.1"
51
51
  },
52
52
  "peerDependencies": {
53
53
  "vite": "^8.0.16",
54
- "octane": "^0.8.0"
54
+ "octane": "^0.9.0"
55
55
  },
56
56
  "devDependencies": {
57
57
  "@types/jsdom": "30.0.0",
@@ -59,6 +59,6 @@
59
59
  "playwright": "^1.61.1",
60
60
  "playwright-webkit": "1.63.0",
61
61
  "vite": "^8.1.5",
62
- "octane": "0.8.0"
62
+ "octane": "0.9.0"
63
63
  }
64
64
  }
package/src/index.js CHANGED
@@ -233,6 +233,16 @@ function has_islands_route(config) {
233
233
  );
234
234
  }
235
235
 
236
+ /**
237
+ * Every rendered document of this app is an islands-only page.
238
+ * @param {ResolvedOctaneConfig | null} config
239
+ * @returns {boolean}
240
+ */
241
+ function has_only_islands_routes(config) {
242
+ const routes = config?.router.routes.filter((route) => route.type === 'render') ?? [];
243
+ return routes.length > 0 && routes.every((route) => route.hydrate === 'islands');
244
+ }
245
+
236
246
  /**
237
247
  * Check every islands-only route's shell for client work. The shell's modules
238
248
  * never load in the browser, so every component it renders outside its
@@ -595,8 +605,27 @@ export function octane(inlineOptions = {}) {
595
605
  return { relative: true };
596
606
  }
597
607
  };
608
+ // Only the renderer consumes the signal Action frame. Islands-only
609
+ // documents load signals without it, so this condition moves the
610
+ // frame and its candidate producers from the signal modules into the
611
+ // renderer (octane's action-capability.ts). Either placement is
612
+ // complete; it chooses which pages pay, so mixed apps keep the default.
613
+ /** @type {UserConfig['resolve']} */
614
+ let resolve;
615
+ if (has_only_islands_routes(buildOctaneConfig)) {
616
+ const { defaultClientConditions } = await import('vite');
617
+ // Vite concatenates plugin conditions onto the user's own, and
618
+ // replaces its defaults only when none were configured.
619
+ resolve = {
620
+ conditions: [
621
+ ...(userConfig.resolve?.conditions ? [] : defaultClientConditions),
622
+ 'octane-islands',
623
+ ],
624
+ };
625
+ }
598
626
  return {
599
627
  ...base,
628
+ ...(resolve ? { resolve } : null),
600
629
  build: buildConfig,
601
630
  experimental: {
602
631
  ...userConfig.experimental,