@octanejs/vite-plugin 0.1.1 → 0.1.4

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/CHANGELOG.md CHANGED
@@ -1,5 +1,239 @@
1
1
  # @octanejs/vite-plugin
2
2
 
3
+ ## 0.1.4
4
+
5
+ ### Patch Changes
6
+
7
+ - 6d332ad: octane.config `adapter` is now the full deploy contract `{ name?, adapt?, serve?, runtime? }`: after the production server build, closeBundle runs `adapter.adapt({ root, outDir, clientDir, serverDir, log })` so an adapter package (e.g. `@octanejs/adapter-vercel`) can restructure the output for its platform (SvelteKit-style). All parts are optional and independent — `serve`/`runtime` keep their existing meanings. `@octanejs/adapter-vercel` is registered as a server-only package: client-side imports of it resolve to the browser stub (which now also covers the octane adapter surface, `vercel`/`adapt`) instead of dragging node builtins into the client graph.
8
+ - 8fc8554: Production SSR builds — octane apps now deploy server-rendered instead of SPA-only:
9
+
10
+ - `vite build` produces BOTH bundles: hashed client assets in `{outDir}/client` (with the generated hydrate entry bundled into index.html via a static, Rollup-analyzable import map over the routes' entry/layout/preHydrate modules) and a self-contained SSR server at `{outDir}/server/entry.js` (app + octane bundled, only node builtins external; octane.config.ts is compiled in through a config-surface facade so neither the compiler nor vite ride along). The built index.html moves to `dist/server` — it is the SSR template, and leaving it in the static dir would shadow the handler at `/` on filesystem-first hosts.
11
+ - `createHandler` (`@octanejs/vite-plugin/production`) is implemented: it matches RenderRoutes/ServerRoutes, runs middleware chains, and streams via the same `renderToReadableStream` engine dev SSR uses — the rendered body region and the `#__octane_data` payload are byte-identical to dev, so `hydrateRoot()` adopts production responses unchanged (covered by an end-to-end fixture test). Per-route `<link rel="stylesheet">`/`modulepreload` tags come from the client manifest. `server.render: 'buffered'` in octane.config.ts switches to the await-everything `prerender` for hosts that break streamed responses.
12
+ - The server entry exports `handler` (Web fetch) and `nodeHandler` (Node `(req, res)`, for serverless wrappers such as a Vercel Node function), and auto-boots under `node dist/server/entry.js` — with the adapter's `serve()` when configured, else the new built-in Node server (`@octanejs/vite-plugin/node`) serving the client assets with immutable caching for `/assets/*`.
13
+ - `octane-preview` now runs that entry for real (pre-deploy verification) and accepts `--port`.
14
+
15
+ - 3c56d95: Close the four metaframework gaps the octane website surfaced:
16
+
17
+ - `octane()` now accepts `exclude` and forwards it to the bundled compiler, so monorepo / aliased-to-source setups can skip the hook-slotting pass for hand-slot-forwarding binding sources (pnpm symlinks resolve `@octanejs/*` to `packages/*/src`, which the automatic node_modules skip can't see).
18
+ - The dev SSR middleware skips Vite-owned requests (`/@` namespaces, `/__` internals, node_modules, `?import`-style transform queries, and extension-bearing paths that name a real file under the Vite root/publicDir — dotted page URLs like `/docs/v2.0` still SSR) before route matching, so a catch-all `'/*splat'` RenderRoute can SSR a real not-found page without swallowing `/@vite/client` or `/src/*.ts`. `RenderRoute` also takes a `status` (e.g. 404 for the catch-all) applied to the rendered response.
19
+ - `appType: 'custom'` is now only a default: an explicit user `appType` wins, and `vite preview` is left on Vite's own SPA fallback so it can serve the client build (production SSR serving is still Phase 2).
20
+ - RenderRoute components (and layouts) receive the request `url` (pathname + search) alongside `params`, on the server and on the hydrating client, and the new `router.preHydrate` config names a module whose default export the client entry awaits before `hydrateRoot` — the hook an app-level client router uses to commit its match tree so hydration adopts the server DOM. The generated client entry also hides its dynamic imports from Vite's `?import` query injection so the page/hook share module singletons with statically-imported copies.
21
+
22
+ Dev SSR now streams: RenderRoutes render through `renderToReadableStream` (shell first, suspense boundaries flush out of order behind it) instead of the buffered `prerender`.
23
+
24
+ - Updated dependencies [05fdef8]
25
+ - Updated dependencies [e9ebfbf]
26
+ - Updated dependencies [4ac4c98]
27
+ - Updated dependencies [c2129eb]
28
+ - Updated dependencies [4ac4c98]
29
+ - Updated dependencies [8a44bb5]
30
+ - Updated dependencies [6b0c244]
31
+ - Updated dependencies [d3cf678]
32
+ - Updated dependencies [05fdef8]
33
+ - Updated dependencies [d19d4f3]
34
+ - Updated dependencies [7e84258]
35
+ - Updated dependencies [2f8c6ed]
36
+ - Updated dependencies [8de4584]
37
+ - Updated dependencies [9be6ba5]
38
+ - Updated dependencies [db409de]
39
+ - Updated dependencies [4f3c6c8]
40
+ - Updated dependencies [62c3c4e]
41
+ - Updated dependencies [3c56d95]
42
+ - Updated dependencies [4c5b1d0]
43
+ - Updated dependencies [b732399]
44
+ - Updated dependencies [6d27cb0]
45
+ - Updated dependencies [a3784b1]
46
+ - Updated dependencies [fa77edf]
47
+ - Updated dependencies [f5c9dba]
48
+ - Updated dependencies [12d5410]
49
+ - Updated dependencies [d71f1fc]
50
+ - Updated dependencies [2f8c6ed]
51
+ - Updated dependencies [63e51e8]
52
+ - Updated dependencies [6d3b269]
53
+ - Updated dependencies [b171c6d]
54
+ - Updated dependencies [7f3d9c9]
55
+ - Updated dependencies [820baaf]
56
+ - Updated dependencies [c36cb32]
57
+ - Updated dependencies [c33f409]
58
+ - Updated dependencies [63e51e8]
59
+ - Updated dependencies [8fc8554]
60
+ - Updated dependencies [569daad]
61
+ - Updated dependencies [6b7b727]
62
+ - Updated dependencies [2ce7bc5]
63
+ - Updated dependencies [c6a23f5]
64
+ - Updated dependencies [c93aad5]
65
+ - Updated dependencies [2942afb]
66
+ - Updated dependencies [388b23c]
67
+ - Updated dependencies [352cff1]
68
+ - Updated dependencies [c7989eb]
69
+ - Updated dependencies [dda2854]
70
+ - Updated dependencies [dda2854]
71
+ - Updated dependencies [3a9d855]
72
+ - Updated dependencies [1f85217]
73
+ - octane@0.1.4
74
+
75
+ ## 0.1.3
76
+
77
+ ### Patch Changes
78
+
79
+ - 3431ec3: SSR: the buffered renderers (`renderToString`/`renderToStaticMarkup` in
80
+ `octane/server`, `prerender` in `octane/static`) gain a `RenderOptions` argument:
81
+ `nonce` (CSP nonce stamped on the emitted inline `<style>` tags and the suspense seed
82
+ script — all renderers), plus `signal` (AbortSignal that rejects a suspended render
83
+ when the request dies) and `timeoutMs` (per-render override of the suspense settle
84
+ deadline) on the async `prerender`. `octane/server` now documents which exports are
85
+ the compiler's private ABI and exports the `executeServerFunction` RPC executor the
86
+ vite plugin's dev RPC handler loads via `ssrLoadModule('octane/server')` (previously a
87
+ missing export, so any `module server` call crashed). Wire format is devalue, matching
88
+ `@ripple-ts/adapter`'s client stub: devalue-encoded argument array in, devalue-encoded
89
+ `{ value }` envelope out. See the new `docs/ssr.md` for the full SSR guide and the
90
+ current gaps (streaming, selective hydration, production server build).
91
+ - Updated dependencies [71b5167]
92
+ - Updated dependencies [7b2acbd]
93
+ - Updated dependencies [a000fa2]
94
+ - Updated dependencies [71b5167]
95
+ - Updated dependencies [735f5ca]
96
+ - Updated dependencies [634c4b4]
97
+ - Updated dependencies [1987d47]
98
+ - Updated dependencies [fda2200]
99
+ - Updated dependencies [71b5167]
100
+ - Updated dependencies [fda2200]
101
+ - Updated dependencies [3431ec3]
102
+ - Updated dependencies [3afe217]
103
+ - Updated dependencies [1a1f1db]
104
+ - Updated dependencies [3431ec3]
105
+ - Updated dependencies [5e3858f]
106
+ - Updated dependencies [d2afbbb]
107
+ - Updated dependencies [1987d47]
108
+ - Updated dependencies [eb48930]
109
+ - Updated dependencies [3431ec3]
110
+ - Updated dependencies [87c5bc3]
111
+ - octane@0.1.3
112
+
113
+ ## 0.1.2
114
+
115
+ ### Patch Changes
116
+
117
+ - b3a9191: Rename `hydrate` → `hydrateRoot` and adopt React 18's shape. The hydration entry is now `hydrateRoot(container, <App/>)` — container first — and returns a full `Root` (with `.render()` and `.unmount()`), symmetric with `createRoot`. Previously `hydrate(Component, container, props)` put the component first and returned only `{ unmount }`. After hydration the returned root's `.render()` performs a normal client update against the adopted DOM (no re-hydration). The vite-plugin's generated client entry now imports and calls `hydrateRoot`.
118
+ - 43d940d: Exclude `@octanejs/tanstack-query` from esbuild pre-bundling (optimizeDeps.exclude + ssr.noExternal). It ships a `.tsrx` provider component, so — like `octane` itself — its source must flow through the octane `.tsrx` transform rather than being pre-bundled by esbuild.
119
+ - cb9ad82: Rename the project from `vyre` to `octane`. The runtime now publishes as `octane` and the Vite metaframework plugin as `@octanejs/vite-plugin`. Identifiers inherited from the Ripple fork were also renamed to Octane (e.g. `setIsRippleActEnvironment` → `setIsOctaneActEnvironment`, the metaframework `ripple()` plugin → `octane()`, and the `ripple.config.ts` convention → `octane.config.ts`). References to the upstream Ripple framework and its `@ripple-ts`/`@tsrx` packages are unchanged.
120
+ - fcac573: Unify the server-rendering ABI to props-first, matching the client. A component body is now invoked as `(props, scope, extra)` on the server (it used to be `(scope, props, extra)`). This makes a plain `function Foo(props)` used at a `<Foo/>` site work the same on the server as on the client — including components that return a non-JSX value (a primitive coerced to text, an early return, `null`). SSR markup is unchanged (only the invocation order flipped), so hydration is unaffected. The server layout/page wrappers in the vite-plugin were updated to match.
121
+ - 634fd52: Align the SSR API with React and reshape the render result to `{ html, css }`.
122
+
123
+ The octane-invented `render(Component, props) → { head, body, css }` is replaced by
124
+ React-aligned entry points:
125
+
126
+ - `octane/server` (mirrors `react-dom/server`):
127
+ - `renderToString(element, props?, options?)` — a single synchronous pass; a Suspense
128
+ boundary that suspends renders its `@pending` fallback (no awaiting).
129
+ - `renderToStaticMarkup(element, props?, options?)` — clean, non-hydratable HTML (no block
130
+ or head-adoption markers, no suspense seed script).
131
+ - `octane/static` (NEW subpath, mirrors `react-dom/static`):
132
+ - `prerender(element, props?, options?)` — the await-everything behaviour of the old
133
+ `render()`: all Suspense data resolves and success arms render, returning complete HTML.
134
+
135
+ All three return `{ html, css }`. The separate `head` field is gone — hoisted `<title>`/
136
+ `<meta>`/`<link>` fold into `html` (spliced into `<head>` when the render produced a
137
+ document, else prepended), matching React 19's resource hoisting. `css` remains a distinct
138
+ field (octane has scoped CSS that React core does not). `render` is removed; the vite
139
+ plugin's dev SSR now uses `prerender`.
140
+
141
+ - b3a9191: Fix the generated client hydration entry for routes with a layout. The layout's `children` ComponentBody was emitted with the old scope-first calling convention (`(s) => Component(s, { params })`), but octane's client runtime invokes a function child props-first as `({}, block, extra)` — so the page received the block as its props and rendered without its route data. The closure now calls `Component({ params }, scope, extra)`.
142
+ - Updated dependencies [c19f1aa]
143
+ - Updated dependencies [6983478]
144
+ - Updated dependencies [6983478]
145
+ - Updated dependencies [169c7c6]
146
+ - Updated dependencies [86ae0c5]
147
+ - Updated dependencies [357f841]
148
+ - Updated dependencies [6675ac7]
149
+ - Updated dependencies [f414710]
150
+ - Updated dependencies [894d51c]
151
+ - Updated dependencies [f44fb6b]
152
+ - Updated dependencies [056c441]
153
+ - Updated dependencies [aa9cc6e]
154
+ - Updated dependencies [0f57f20]
155
+ - Updated dependencies [f44fb6b]
156
+ - Updated dependencies [067efa3]
157
+ - Updated dependencies [f0c6c4d]
158
+ - Updated dependencies [dd24fd5]
159
+ - Updated dependencies [524939e]
160
+ - Updated dependencies [e8ee0a8]
161
+ - Updated dependencies [b680431]
162
+ - Updated dependencies [524939e]
163
+ - Updated dependencies [7f8dbc0]
164
+ - Updated dependencies [a13acd1]
165
+ - Updated dependencies [067efa3]
166
+ - Updated dependencies [524939e]
167
+ - Updated dependencies [894d51c]
168
+ - Updated dependencies [894d51c]
169
+ - Updated dependencies [1960647]
170
+ - Updated dependencies [e8ee0a8]
171
+ - Updated dependencies [93e2733]
172
+ - Updated dependencies [149800c]
173
+ - Updated dependencies [6983478]
174
+ - Updated dependencies [6983478]
175
+ - Updated dependencies [6983478]
176
+ - Updated dependencies [169c7c6]
177
+ - Updated dependencies [bbc3275]
178
+ - Updated dependencies [ed6afad]
179
+ - Updated dependencies [40bcb16]
180
+ - Updated dependencies [c842fb7]
181
+ - Updated dependencies [c62efa7]
182
+ - Updated dependencies [524939e]
183
+ - Updated dependencies [b3a9191]
184
+ - Updated dependencies [ffe32c4]
185
+ - Updated dependencies [e1f996b]
186
+ - Updated dependencies [6983478]
187
+ - Updated dependencies [fc36e15]
188
+ - Updated dependencies [524939e]
189
+ - Updated dependencies [405f06e]
190
+ - Updated dependencies [f50c829]
191
+ - Updated dependencies [b3a9191]
192
+ - Updated dependencies [dd24fd5]
193
+ - Updated dependencies [7042056]
194
+ - Updated dependencies [6983478]
195
+ - Updated dependencies [e031a7d]
196
+ - Updated dependencies [86ae0c5]
197
+ - Updated dependencies [a33cdd6]
198
+ - Updated dependencies [067efa3]
199
+ - Updated dependencies [fab1cb0]
200
+ - Updated dependencies [6983478]
201
+ - Updated dependencies [dd24fd5]
202
+ - Updated dependencies [149800c]
203
+ - Updated dependencies [6983478]
204
+ - Updated dependencies [cb9ad82]
205
+ - Updated dependencies [ea6352e]
206
+ - Updated dependencies [1987bd7]
207
+ - Updated dependencies [0c4d5a1]
208
+ - Updated dependencies [dd24fd5]
209
+ - Updated dependencies [fcac573]
210
+ - Updated dependencies [41aa22a]
211
+ - Updated dependencies [c842fb7]
212
+ - Updated dependencies [6983478]
213
+ - Updated dependencies [6983478]
214
+ - Updated dependencies [634fd52]
215
+ - Updated dependencies [149800c]
216
+ - Updated dependencies [aafaaa9]
217
+ - Updated dependencies [1987bd7]
218
+ - Updated dependencies [74cbff9]
219
+ - Updated dependencies [894d51c]
220
+ - Updated dependencies [0040cad]
221
+ - Updated dependencies [a3dce2f]
222
+ - Updated dependencies [3656e32]
223
+ - Updated dependencies [43d940d]
224
+ - Updated dependencies [a032c5c]
225
+ - Updated dependencies [7f8dbc0]
226
+ - Updated dependencies [c71d4f3]
227
+ - Updated dependencies [a3dce2f]
228
+ - Updated dependencies [c2f3f69]
229
+ - Updated dependencies [3656e32]
230
+ - Updated dependencies [1987bd7]
231
+ - Updated dependencies [f42e5b7]
232
+ - Updated dependencies [cc2bca1]
233
+ - Updated dependencies [6983478]
234
+ - Updated dependencies [1987bd7]
235
+ - octane@0.1.2
236
+
3
237
  ## 0.1.1
4
238
 
5
239
  ### Patch Changes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@octanejs/vite-plugin",
3
- "version": "0.1.1",
3
+ "version": "0.1.4",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "description": "Vite metaframework plugin for the octane renderer (dev SSR + routing + hydrate)",
@@ -31,11 +31,16 @@
31
31
  "types": "./types/production.d.ts",
32
32
  "import": "./src/server/production.js",
33
33
  "default": "./src/server/production.js"
34
+ },
35
+ "./node": {
36
+ "types": "./types/node.d.ts",
37
+ "import": "./src/server/node-http.js",
38
+ "default": "./src/server/node-http.js"
34
39
  }
35
40
  },
36
41
  "dependencies": {
37
- "@ripple-ts/adapter": "^0.3.84",
38
- "octane": "0.1.1"
42
+ "@ripple-ts/adapter": "^0.3.86",
43
+ "octane": "0.1.4"
39
44
  },
40
45
  "devDependencies": {
41
46
  "@types/node": "^24.3.0",
@@ -1,13 +1,13 @@
1
1
  #!/usr/bin/env node
2
+ // @ts-check
2
3
 
3
4
  /**
4
5
  * octane-preview — Start the production SSR server.
5
6
  *
6
- * Loads octane.config.ts, reads `build.outDir`,
7
- * and spawns `node {outDir}/server/entry.js`.
8
- *
9
- * NOTE: the server entry it spawns is produced by the Phase 2 production
10
- * build. Until then this validates existence and errors clearly.
7
+ * Loads octane.config.ts, reads `build.outDir`, and spawns
8
+ * `node {outDir}/server/entry.js` — the self-contained server bundle
9
+ * `vite build` produced. This is the pre-deploy verification step: the exact
10
+ * handler + static assets a production host runs, on localhost.
11
11
  */
12
12
 
13
13
  import { spawn } from 'node:child_process';
@@ -18,6 +18,20 @@ import { ENTRY_FILENAME } from '../constants.js';
18
18
 
19
19
  const projectRoot = process.cwd();
20
20
 
21
+ // `--port <n>` / `-p <n>` sets the port (else $PORT, else the entry's 3000
22
+ // default). `--strictPort` is accepted for `vite preview` muscle-memory and
23
+ // ignored — the port is always exact (the entry never probes for a free one).
24
+ /** @type {string | undefined} */
25
+ let portArg;
26
+ const args = process.argv.slice(2);
27
+ for (let i = 0; i < args.length; i++) {
28
+ if (args[i] === '--port' || args[i] === '-p') {
29
+ portArg = args[++i];
30
+ } else if (args[i].startsWith('--port=')) {
31
+ portArg = args[i].slice('--port='.length);
32
+ }
33
+ }
34
+
21
35
  try {
22
36
  const config = await loadOctaneConfig(projectRoot);
23
37
  const outDir = config.build.outDir;
@@ -34,6 +48,7 @@ try {
34
48
  const child = spawn(process.execPath, [entryPath], {
35
49
  stdio: 'inherit',
36
50
  cwd: projectRoot,
51
+ env: portArg ? { ...process.env, PORT: portArg } : process.env,
37
52
  });
38
53
 
39
54
  child.on('close', (code) => {
@@ -0,0 +1,31 @@
1
+ // @ts-check
2
+ /**
3
+ * Config-surface facade for the PRODUCTION server bundle.
4
+ *
5
+ * octane.config.ts imports `RenderRoute` / `ServerRoute` / `defineConfig` from
6
+ * '@octanejs/vite-plugin'. The real package entry (`src/index.js`) also pulls
7
+ * in the octane compiler, the dev-SSR middleware, and a dynamic `import('vite')`
8
+ * — none of which belong in dist/server/entry.js. The SSR sub-build therefore
9
+ * aliases the BARE '@octanejs/vite-plugin' specifier to this module, which
10
+ * re-exports only what a config file can legitimately use. Subpath imports
11
+ * ('@octanejs/vite-plugin/production', '/node') are not affected by the alias.
12
+ */
13
+
14
+ export { RenderRoute, ServerRoute } from './routes.js';
15
+ export { resolveOctaneConfig } from './resolve-config.js';
16
+
17
+ // Mirrors src/index.js — enforce types / DX only.
18
+ export function defineConfig(/** @type {any} */ options) {
19
+ return options;
20
+ }
21
+
22
+ /**
23
+ * The plugin factory must never run inside the built server: the sub-build
24
+ * aliases it away precisely because it drags the compiler + vite along.
25
+ * @returns {never}
26
+ */
27
+ export function octane() {
28
+ throw new Error(
29
+ '[@octanejs/vite-plugin] octane() is a Vite plugin — it cannot run inside the production server bundle.',
30
+ );
31
+ }
package/src/constants.js CHANGED
@@ -1,2 +1,3 @@
1
+ // @ts-check
1
2
  export const DEFAULT_OUTDIR = 'dist';
2
3
  export const ENTRY_FILENAME = 'entry.js';