@octanejs/vite-plugin 0.1.5 → 0.1.6
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 +16 -4
- package/src/config-entry.js +15 -0
- package/src/constants.js +1 -3
- package/src/index.js +74 -24
- package/src/load-config.js +61 -81
- package/src/project-codegen.js +10 -218
- package/src/resolve-config.js +1 -171
- package/src/routes.js +1 -133
- package/src/server/component-wrappers.js +5 -56
- package/src/server/html-stream.js +1 -0
- package/src/server/html-template.js +9 -0
- package/src/server/middleware.js +1 -127
- package/src/server/node-http.js +1 -188
- package/src/server/production.js +1 -286
- package/src/server/render-route.js +66 -41
- package/src/server/router.js +1 -123
- package/src/server/server-route.js +1 -47
- package/src/server/virtual-entry.js +1 -184
- package/types/index.d.ts +30 -260
- package/types/node.d.ts +1 -31
- package/types/production.d.ts +1 -71
- package/CHANGELOG.md +0 -254
- package/tests/_fixtures/app/index.html +0 -11
- package/tests/_fixtures/app/octane.config.ts +0 -14
- package/tests/_fixtures/app/package.json +0 -7
- package/tests/_fixtures/app/src/Layout.tsrx +0 -6
- package/tests/_fixtures/app/src/Page.tsrx +0 -17
- package/tests/_fixtures/app/vite.config.ts +0 -12
- package/tests/handler.test.ts +0 -134
- package/tests/plugin.test.ts +0 -155
- package/tests/production.test.ts +0 -157
- package/tsconfig.typecheck.json +0 -18
package/types/index.d.ts
CHANGED
|
@@ -1,278 +1,48 @@
|
|
|
1
|
-
import type { Plugin,
|
|
2
|
-
import type {
|
|
1
|
+
import type { Plugin, ViteDevServer } from 'vite';
|
|
2
|
+
import type {
|
|
3
|
+
ConfigModuleRunner,
|
|
4
|
+
LoadedOctaneConfig,
|
|
5
|
+
OctaneConfigOptions,
|
|
6
|
+
ResolvedOctaneConfig,
|
|
7
|
+
} from '@octanejs/app-core';
|
|
3
8
|
|
|
4
|
-
|
|
5
|
-
// Plugin exports
|
|
6
|
-
// ============================================================================
|
|
9
|
+
export * from '@octanejs/app-core';
|
|
7
10
|
|
|
8
11
|
export interface OctanePluginOptions {
|
|
9
12
|
/** Override the client HMR default (on in serve mode, off for SSR). */
|
|
10
13
|
hmr?: boolean;
|
|
11
14
|
/**
|
|
12
15
|
* Path fragments the compiler's plain `.ts`/`.js` hook-slotting pass must
|
|
13
|
-
* skip
|
|
14
|
-
* double-slotted. Published bindings live in node_modules and are skipped
|
|
15
|
-
* automatically; set this for monorepo / aliased-to-source setups where
|
|
16
|
-
* pnpm symlinks resolve `@octanejs/*` imports to `packages/*\/src` paths
|
|
17
|
-
* (e.g. `['/packages/tanstack-router/src/']`).
|
|
16
|
+
* skip. Prefer package manifest `octane.hookSlots.manual` declarations.
|
|
18
17
|
*/
|
|
19
18
|
exclude?: string[];
|
|
20
19
|
}
|
|
21
20
|
|
|
22
|
-
/**
|
|
23
|
-
* The octane metaframework plugin. Returns an array:
|
|
24
|
-
* `[octane(), metaPlugin]` — the first compiles `.tsrx`, the second owns
|
|
25
|
-
* config / routing / dev SSR / hydrate.
|
|
26
|
-
*/
|
|
21
|
+
/** The Octane compiler plugin plus Vite app/metaframework integration. */
|
|
27
22
|
export function octane(options?: OctanePluginOptions): Plugin[];
|
|
28
23
|
|
|
29
|
-
/**
|
|
30
|
-
* Is this a request the Vite dev server owns (module / asset / internal
|
|
31
|
-
* namespace / transform query), as opposed to a page navigation? The dev SSR
|
|
32
|
-
* middleware uses it so a catch-all RenderRoute never swallows Vite requests.
|
|
33
|
-
*
|
|
34
|
-
* `fileRoots` (the Vite root + publicDir) gate the file-extension heuristic:
|
|
35
|
-
* an extension-bearing path is only Vite's when it names a real file under
|
|
36
|
-
* one of them, so page URLs like `/docs/v2.0` still SSR. Without `fileRoots`
|
|
37
|
-
* any extension counts (conservative).
|
|
38
|
-
*/
|
|
24
|
+
/** Return whether a dev request belongs to Vite rather than an app route. */
|
|
39
25
|
export function isViteOwnedUrl(url: URL, fileRoots?: string[]): boolean;
|
|
40
|
-
|
|
26
|
+
|
|
27
|
+
export interface ViteLoadConfigOptions {
|
|
28
|
+
vite?: ViteDevServer;
|
|
29
|
+
moduleRunner?: ConfigModuleRunner | ConfigModuleRunner['loadModule'];
|
|
30
|
+
requireAdapter?: boolean;
|
|
31
|
+
configFile?: string;
|
|
32
|
+
cacheDir?: string;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export function getOctaneConfigPath(projectRoot: string, configFile?: string): string;
|
|
36
|
+
export function octaneConfigExists(projectRoot: string, configFile?: string): boolean;
|
|
37
|
+
export function loadOctaneConfig(
|
|
38
|
+
projectRoot: string,
|
|
39
|
+
options?: ViteLoadConfigOptions,
|
|
40
|
+
): Promise<ResolvedOctaneConfig>;
|
|
41
|
+
export function loadOctaneConfigWithMetadata(
|
|
42
|
+
projectRoot: string,
|
|
43
|
+
options?: ViteLoadConfigOptions,
|
|
44
|
+
): Promise<LoadedOctaneConfig>;
|
|
41
45
|
export function resolveOctaneConfig(
|
|
42
46
|
raw: OctaneConfigOptions,
|
|
43
47
|
options?: { requireAdapter?: boolean },
|
|
44
48
|
): ResolvedOctaneConfig;
|
|
45
|
-
export function getOctaneConfigPath(projectRoot: string): string;
|
|
46
|
-
export function octaneConfigExists(projectRoot: string): boolean;
|
|
47
|
-
export function loadOctaneConfig(
|
|
48
|
-
projectRoot: string,
|
|
49
|
-
options?: { vite?: ViteDevServer; requireAdapter?: boolean },
|
|
50
|
-
): Promise<ResolvedOctaneConfig>;
|
|
51
|
-
|
|
52
|
-
// ============================================================================
|
|
53
|
-
// Route classes
|
|
54
|
-
// ============================================================================
|
|
55
|
-
|
|
56
|
-
export class RenderRoute {
|
|
57
|
-
readonly type: 'render';
|
|
58
|
-
path: string;
|
|
59
|
-
entry: RenderRouteEntry;
|
|
60
|
-
layout?: string;
|
|
61
|
-
before: Middleware[];
|
|
62
|
-
status?: number;
|
|
63
|
-
constructor(options: RenderRouteOptions);
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
export class ServerRoute {
|
|
67
|
-
readonly type: 'server';
|
|
68
|
-
path: string;
|
|
69
|
-
methods: string[];
|
|
70
|
-
handler: RouteHandler;
|
|
71
|
-
before: Middleware[];
|
|
72
|
-
after: Middleware[];
|
|
73
|
-
constructor(options: ServerRouteOptions);
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
export type Route = RenderRoute | ServerRoute;
|
|
77
|
-
|
|
78
|
-
// ============================================================================
|
|
79
|
-
// Route options
|
|
80
|
-
// ============================================================================
|
|
81
|
-
|
|
82
|
-
export interface RenderRouteOptions {
|
|
83
|
-
/** URL path pattern (e.g., '/', '/posts/:id', '/docs/*slug') */
|
|
84
|
-
path: string;
|
|
85
|
-
/** Path to the component entry file, optionally with a preferred named export */
|
|
86
|
-
entry: RenderRouteEntry;
|
|
87
|
-
/** Path to the layout component (wraps the entry) */
|
|
88
|
-
layout?: string;
|
|
89
|
-
/** Middleware to run before rendering */
|
|
90
|
-
before?: Middleware[];
|
|
91
|
-
/**
|
|
92
|
-
* HTTP status for the rendered response (default 200). Set 404 on a
|
|
93
|
-
* catch-all route so the SSR'd not-found page reports its real status.
|
|
94
|
-
*/
|
|
95
|
-
status?: number;
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
export interface ServerRouteOptions {
|
|
99
|
-
/** URL path pattern (e.g., '/api/hello', '/api/posts/:id') */
|
|
100
|
-
path: string;
|
|
101
|
-
/** HTTP methods to handle (default: ['GET']) */
|
|
102
|
-
methods?: string[];
|
|
103
|
-
/** Request handler that returns a Response */
|
|
104
|
-
handler: RouteHandler;
|
|
105
|
-
/** Middleware to run before the handler */
|
|
106
|
-
before?: Middleware[];
|
|
107
|
-
/** Middleware to run after the handler */
|
|
108
|
-
after?: Middleware[];
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
// ============================================================================
|
|
112
|
-
// Context and middleware
|
|
113
|
-
// ============================================================================
|
|
114
|
-
|
|
115
|
-
export interface Context {
|
|
116
|
-
/** The incoming Request object */
|
|
117
|
-
request: Request;
|
|
118
|
-
/** URL parameters extracted from the route pattern */
|
|
119
|
-
params: Record<string, string>;
|
|
120
|
-
/** Parsed URL object */
|
|
121
|
-
url: URL;
|
|
122
|
-
/** Shared state for passing data between middlewares */
|
|
123
|
-
state: Map<string, unknown>;
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
export type NextFunction = () => Promise<Response>;
|
|
127
|
-
export type Middleware = (context: Context, next: NextFunction) => Response | Promise<Response>;
|
|
128
|
-
export type RouteHandler = (context: Context) => Response | Promise<Response>;
|
|
129
|
-
|
|
130
|
-
// ============================================================================
|
|
131
|
-
// Configuration
|
|
132
|
-
// ============================================================================
|
|
133
|
-
|
|
134
|
-
export type Component<T = Record<string, any>> = (
|
|
135
|
-
scope: any,
|
|
136
|
-
props: T,
|
|
137
|
-
extra?: any,
|
|
138
|
-
) => string | void;
|
|
139
|
-
|
|
140
|
-
export type RenderRouteEntry = string | readonly [exportName: string, path: string];
|
|
141
|
-
|
|
142
|
-
/**
|
|
143
|
-
* Props every RenderRoute component (and layout) receives: the route params
|
|
144
|
-
* and the request `url` (pathname + search, origin-free — the client hydrate
|
|
145
|
-
* entry re-renders with the identical string).
|
|
146
|
-
*/
|
|
147
|
-
export interface RenderRouteProps {
|
|
148
|
-
params: Record<string, string>;
|
|
149
|
-
url: string;
|
|
150
|
-
}
|
|
151
|
-
|
|
152
|
-
/**
|
|
153
|
-
* The app hook run by the client hydrate entry BEFORE `hydrateRoot` (config
|
|
154
|
-
* `router.preHydrate`): commit client-side state the server already resolved —
|
|
155
|
-
* typically a client router loading its match tree — so the first hydration
|
|
156
|
-
* pass adopts the same tree the server rendered.
|
|
157
|
-
*/
|
|
158
|
-
export type PreHydrateHook = (info: {
|
|
159
|
-
url: string;
|
|
160
|
-
params: Record<string, string>;
|
|
161
|
-
}) => void | Promise<void>;
|
|
162
|
-
|
|
163
|
-
export interface RootBoundaryOptions {
|
|
164
|
-
pending?: Component<Record<string, never>>;
|
|
165
|
-
catch?: Component<{ error: unknown; reset: () => void }>;
|
|
166
|
-
}
|
|
167
|
-
|
|
168
|
-
export interface OctaneConfigOptions {
|
|
169
|
-
build?: {
|
|
170
|
-
/** Output directory for the production build. @default 'dist' */
|
|
171
|
-
outDir?: string;
|
|
172
|
-
minify?: boolean;
|
|
173
|
-
target?: BuildEnvironmentOptions['target'];
|
|
174
|
-
};
|
|
175
|
-
adapter?: OctaneAdapter;
|
|
176
|
-
router?: {
|
|
177
|
-
routes: Route[];
|
|
178
|
-
/**
|
|
179
|
-
* Vite-root path (e.g. '/src/pre-hydrate.ts') of a module whose default
|
|
180
|
-
* export is a {@link PreHydrateHook}. The client hydrate entry imports it
|
|
181
|
-
* and awaits the hook before calling `hydrateRoot`.
|
|
182
|
-
*/
|
|
183
|
-
preHydrate?: string;
|
|
184
|
-
};
|
|
185
|
-
/** Global root pending/catch UI used by client and SSR render roots */
|
|
186
|
-
rootBoundary?: RootBoundaryOptions;
|
|
187
|
-
/** Global middlewares applied to all routes */
|
|
188
|
-
middlewares?: Middleware[];
|
|
189
|
-
platform?: {
|
|
190
|
-
env: Record<string, string>;
|
|
191
|
-
};
|
|
192
|
-
server?: {
|
|
193
|
-
/**
|
|
194
|
-
* Trust `X-Forwarded-Proto` / `X-Forwarded-Host` when deriving the
|
|
195
|
-
* request origin. Enable only behind a trusted reverse proxy.
|
|
196
|
-
* @default false
|
|
197
|
-
*/
|
|
198
|
-
trustProxy?: boolean;
|
|
199
|
-
/**
|
|
200
|
-
* Production SSR mode: 'streaming' (default) flushes the shell at
|
|
201
|
-
* first await and streams suspense segments out-of-order (same engine
|
|
202
|
-
* as dev SSR); 'buffered' awaits everything (`prerender`) and sends
|
|
203
|
-
* one document — for hosts that break streamed responses.
|
|
204
|
-
* @default 'streaming'
|
|
205
|
-
*/
|
|
206
|
-
render?: 'streaming' | 'buffered';
|
|
207
|
-
};
|
|
208
|
-
}
|
|
209
|
-
|
|
210
|
-
/**
|
|
211
|
-
* Resolved configuration with all defaults applied.
|
|
212
|
-
*/
|
|
213
|
-
export interface ResolvedOctaneConfig {
|
|
214
|
-
build: {
|
|
215
|
-
/** @default 'dist' */
|
|
216
|
-
outDir: string;
|
|
217
|
-
minify?: boolean;
|
|
218
|
-
target?: BuildEnvironmentOptions['target'];
|
|
219
|
-
};
|
|
220
|
-
adapter?: OctaneAdapter;
|
|
221
|
-
router: {
|
|
222
|
-
routes: Route[];
|
|
223
|
-
preHydrate?: string;
|
|
224
|
-
};
|
|
225
|
-
rootBoundary: RootBoundaryOptions;
|
|
226
|
-
/** @default [] */
|
|
227
|
-
middlewares: Middleware[];
|
|
228
|
-
platform: {
|
|
229
|
-
/** @default {} */
|
|
230
|
-
env: Record<string, string>;
|
|
231
|
-
};
|
|
232
|
-
server: {
|
|
233
|
-
/** @default false */
|
|
234
|
-
trustProxy: boolean;
|
|
235
|
-
/** @default 'streaming' */
|
|
236
|
-
render: 'streaming' | 'buffered';
|
|
237
|
-
};
|
|
238
|
-
}
|
|
239
|
-
|
|
240
|
-
/**
|
|
241
|
-
* The build context @octanejs/vite-plugin passes to an adapter's `adapt()`
|
|
242
|
-
* after `vite build` produced both bundles.
|
|
243
|
-
*/
|
|
244
|
-
export interface AdaptContext {
|
|
245
|
-
/** Absolute project root (the Vite root). */
|
|
246
|
-
root: string;
|
|
247
|
-
/** The config `build.outDir` (relative to root, e.g. 'dist'). */
|
|
248
|
-
outDir: string;
|
|
249
|
-
/** Absolute path of the static client bundle ({outDir}/client). */
|
|
250
|
-
clientDir: string;
|
|
251
|
-
/** Absolute path of the server bundle ({outDir}/server, contains entry.js). */
|
|
252
|
-
serverDir: string;
|
|
253
|
-
/** Prefixed build logger. */
|
|
254
|
-
log: (message: string) => void;
|
|
255
|
-
}
|
|
256
|
-
|
|
257
|
-
/**
|
|
258
|
-
* The octane.config.ts `adapter` contract. All parts are optional and
|
|
259
|
-
* independent:
|
|
260
|
-
*
|
|
261
|
-
* - `adapt(ctx)` — post-build hook: restructure dist/client + dist/server for
|
|
262
|
-
* a deployment target (e.g. @octanejs/adapter-vercel emits `.vercel/output`).
|
|
263
|
-
* - `serve(handler, opts)` — replaces the generated server entry's built-in
|
|
264
|
-
* Node boot when running `node dist/server/entry.js` / `octane-preview`.
|
|
265
|
-
* - `runtime` — platform primitives (hashing, async context) replacing the
|
|
266
|
-
* entry's Node defaults; needed on non-Node runtimes.
|
|
267
|
-
*/
|
|
268
|
-
export interface OctaneAdapter {
|
|
269
|
-
name?: string;
|
|
270
|
-
adapt?: (ctx: AdaptContext) => void | Promise<void>;
|
|
271
|
-
serve?: AdapterServeFunction;
|
|
272
|
-
runtime?: RuntimePrimitives;
|
|
273
|
-
}
|
|
274
|
-
|
|
275
|
-
export type AdapterServeFunction = (
|
|
276
|
-
handler: (request: Request, platform?: unknown) => Response | Promise<Response>,
|
|
277
|
-
options?: Record<string, unknown>,
|
|
278
|
-
) => { listen: (port?: number) => unknown; close: () => void };
|
package/types/node.d.ts
CHANGED
|
@@ -1,31 +1 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
/** Convert a Node.js IncomingMessage to a Web Request. */
|
|
4
|
-
export function nodeRequestToWebRequest(nodeRequest: IncomingMessage): Request;
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* Pipe a Web Response to a Node.js ServerResponse, streaming chunk-by-chunk
|
|
8
|
-
* (a streaming SSR body flushes as it renders).
|
|
9
|
-
*/
|
|
10
|
-
export function sendWebResponse(nodeResponse: ServerResponse, webResponse: Response): Promise<void>;
|
|
11
|
-
|
|
12
|
-
/**
|
|
13
|
-
* Serve a static file from `staticDir` when the request path maps to one.
|
|
14
|
-
* `/assets/*` (hash-named build output) gets immutable caching; other files
|
|
15
|
-
* revalidate. Returns true when the request was handled.
|
|
16
|
-
*/
|
|
17
|
-
export function serveStaticFile(
|
|
18
|
-
req: IncomingMessage,
|
|
19
|
-
res: ServerResponse,
|
|
20
|
-
staticDir: string,
|
|
21
|
-
): boolean;
|
|
22
|
-
|
|
23
|
-
/**
|
|
24
|
-
* Minimal production HTTP server: static files from `staticDir` first (the
|
|
25
|
-
* built client assets), then the fetch-style SSR handler. The default boot for
|
|
26
|
-
* `node dist/server/entry.js` when octane.config.ts has no adapter.
|
|
27
|
-
*/
|
|
28
|
-
export function createNodeServer(
|
|
29
|
-
handler: (request: Request) => Response | Promise<Response>,
|
|
30
|
-
options?: { staticDir?: string },
|
|
31
|
-
): { listen: (port?: number) => Server; close: () => void };
|
|
1
|
+
export * from '@octanejs/app-core/node';
|
package/types/production.d.ts
CHANGED
|
@@ -1,71 +1 @@
|
|
|
1
|
-
|
|
2
|
-
import type {
|
|
3
|
-
Route,
|
|
4
|
-
Middleware,
|
|
5
|
-
ResolvedOctaneConfig,
|
|
6
|
-
OctaneConfigOptions,
|
|
7
|
-
RootBoundaryOptions,
|
|
8
|
-
} from '@octanejs/vite-plugin';
|
|
9
|
-
import type { RenderResult, StreamOptions, RenderOptions } from 'octane/server';
|
|
10
|
-
|
|
11
|
-
export function resolveOctaneConfig(
|
|
12
|
-
raw: OctaneConfigOptions,
|
|
13
|
-
options?: { requireAdapter?: boolean },
|
|
14
|
-
): ResolvedOctaneConfig;
|
|
15
|
-
|
|
16
|
-
export interface ClientAssetEntry {
|
|
17
|
-
/** Path to the built JS file (relative to the client output dir) */
|
|
18
|
-
js: string;
|
|
19
|
-
/** Paths to the built CSS files (relative to the client output dir) */
|
|
20
|
-
css: string[];
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
export interface ServerManifest {
|
|
24
|
-
routes: Route[];
|
|
25
|
-
/** RenderRoute entry module path → module namespace (export picked per-route) */
|
|
26
|
-
components: Record<string, Record<string, unknown>>;
|
|
27
|
-
/** Layout module path → module namespace */
|
|
28
|
-
layouts: Record<string, Record<string, unknown>>;
|
|
29
|
-
middlewares: Middleware[];
|
|
30
|
-
/** Trust X-Forwarded-* headers when deriving origin for RPC fetch */
|
|
31
|
-
trustProxy?: boolean;
|
|
32
|
-
/** 'streaming' (default) renders via renderToReadableStream; 'buffered' awaits everything via prerender */
|
|
33
|
-
render?: 'streaming' | 'buffered';
|
|
34
|
-
rootBoundary?: RootBoundaryOptions;
|
|
35
|
-
/** config `router.preHydrate`, serialized into #__octane_data for the client entry */
|
|
36
|
-
preHydrate?: string | null;
|
|
37
|
-
/** Map of entry path → `module server` namespace for RPC support */
|
|
38
|
-
rpcModules?: Record<string, Record<string, Function>>;
|
|
39
|
-
/** Platform primitives (adapter's, or the generated entry's Node defaults) */
|
|
40
|
-
runtime?: RuntimePrimitives;
|
|
41
|
-
/** Route entry module path → built client asset paths (preload tags) */
|
|
42
|
-
clientAssets?: Record<string, ClientAssetEntry>;
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
export interface HandlerOptions {
|
|
46
|
-
/** `renderToReadableStream` from 'octane/server' (the streaming engine dev SSR uses) */
|
|
47
|
-
renderToReadableStream: (
|
|
48
|
-
component: Function,
|
|
49
|
-
props?: unknown,
|
|
50
|
-
options?: StreamOptions,
|
|
51
|
-
) => Promise<ReadableStream<Uint8Array>>;
|
|
52
|
-
/** `prerender` from 'octane/static' (the buffered await-everything fallback) */
|
|
53
|
-
prerender: (
|
|
54
|
-
component: Function,
|
|
55
|
-
props?: unknown,
|
|
56
|
-
options?: RenderOptions,
|
|
57
|
-
) => Promise<RenderResult>;
|
|
58
|
-
/** The BUILT dist client index.html (moved to dist/server by the build) */
|
|
59
|
-
htmlTemplate: string;
|
|
60
|
-
/** RPC executor from 'octane/server' */
|
|
61
|
-
executeServerFunction: (fn: Function, body: string) => Promise<string>;
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
/**
|
|
65
|
-
* Production fetch-handler factory. Mirrors the dev middleware's render path
|
|
66
|
-
* byte-for-byte in everything hydration can see (see server/production.js).
|
|
67
|
-
*/
|
|
68
|
-
export function createHandler(
|
|
69
|
-
manifest: ServerManifest,
|
|
70
|
-
options: HandlerOptions,
|
|
71
|
-
): (request: Request) => Promise<Response>;
|
|
1
|
+
export * from '@octanejs/app-core/production';
|
package/CHANGELOG.md
DELETED
|
@@ -1,254 +0,0 @@
|
|
|
1
|
-
# @octanejs/vite-plugin
|
|
2
|
-
|
|
3
|
-
## 0.1.5
|
|
4
|
-
|
|
5
|
-
### Patch Changes
|
|
6
|
-
|
|
7
|
-
- Updated dependencies [940ae5a]
|
|
8
|
-
- Updated dependencies [6fceaf3]
|
|
9
|
-
- Updated dependencies [62da8cc]
|
|
10
|
-
- Updated dependencies [e737057]
|
|
11
|
-
- octane@0.1.5
|
|
12
|
-
|
|
13
|
-
## 0.1.4
|
|
14
|
-
|
|
15
|
-
### Patch Changes
|
|
16
|
-
|
|
17
|
-
- 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.
|
|
18
|
-
- 8fc8554: Production SSR builds — octane apps now deploy server-rendered instead of SPA-only:
|
|
19
|
-
|
|
20
|
-
- `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.
|
|
21
|
-
- `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.
|
|
22
|
-
- 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/*`.
|
|
23
|
-
- `octane-preview` now runs that entry for real (pre-deploy verification) and accepts `--port`.
|
|
24
|
-
|
|
25
|
-
- 3c56d95: Close the four metaframework gaps the octane website surfaced:
|
|
26
|
-
|
|
27
|
-
- `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).
|
|
28
|
-
- 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.
|
|
29
|
-
- `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).
|
|
30
|
-
- 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.
|
|
31
|
-
|
|
32
|
-
Dev SSR now streams: RenderRoutes render through `renderToReadableStream` (shell first, suspense boundaries flush out of order behind it) instead of the buffered `prerender`.
|
|
33
|
-
|
|
34
|
-
- Updated dependencies [05fdef8]
|
|
35
|
-
- Updated dependencies [e9ebfbf]
|
|
36
|
-
- Updated dependencies [4ac4c98]
|
|
37
|
-
- Updated dependencies [c2129eb]
|
|
38
|
-
- Updated dependencies [4ac4c98]
|
|
39
|
-
- Updated dependencies [8a44bb5]
|
|
40
|
-
- Updated dependencies [6b0c244]
|
|
41
|
-
- Updated dependencies [d3cf678]
|
|
42
|
-
- Updated dependencies [05fdef8]
|
|
43
|
-
- Updated dependencies [d19d4f3]
|
|
44
|
-
- Updated dependencies [7e84258]
|
|
45
|
-
- Updated dependencies [2f8c6ed]
|
|
46
|
-
- Updated dependencies [8de4584]
|
|
47
|
-
- Updated dependencies [9be6ba5]
|
|
48
|
-
- Updated dependencies [db409de]
|
|
49
|
-
- Updated dependencies [4f3c6c8]
|
|
50
|
-
- Updated dependencies [62c3c4e]
|
|
51
|
-
- Updated dependencies [3c56d95]
|
|
52
|
-
- Updated dependencies [4c5b1d0]
|
|
53
|
-
- Updated dependencies [b732399]
|
|
54
|
-
- Updated dependencies [6d27cb0]
|
|
55
|
-
- Updated dependencies [a3784b1]
|
|
56
|
-
- Updated dependencies [fa77edf]
|
|
57
|
-
- Updated dependencies [f5c9dba]
|
|
58
|
-
- Updated dependencies [12d5410]
|
|
59
|
-
- Updated dependencies [d71f1fc]
|
|
60
|
-
- Updated dependencies [2f8c6ed]
|
|
61
|
-
- Updated dependencies [63e51e8]
|
|
62
|
-
- Updated dependencies [6d3b269]
|
|
63
|
-
- Updated dependencies [b171c6d]
|
|
64
|
-
- Updated dependencies [7f3d9c9]
|
|
65
|
-
- Updated dependencies [820baaf]
|
|
66
|
-
- Updated dependencies [c36cb32]
|
|
67
|
-
- Updated dependencies [c33f409]
|
|
68
|
-
- Updated dependencies [63e51e8]
|
|
69
|
-
- Updated dependencies [8fc8554]
|
|
70
|
-
- Updated dependencies [569daad]
|
|
71
|
-
- Updated dependencies [6b7b727]
|
|
72
|
-
- Updated dependencies [2ce7bc5]
|
|
73
|
-
- Updated dependencies [c6a23f5]
|
|
74
|
-
- Updated dependencies [c93aad5]
|
|
75
|
-
- Updated dependencies [2942afb]
|
|
76
|
-
- Updated dependencies [388b23c]
|
|
77
|
-
- Updated dependencies [352cff1]
|
|
78
|
-
- Updated dependencies [c7989eb]
|
|
79
|
-
- Updated dependencies [dda2854]
|
|
80
|
-
- Updated dependencies [dda2854]
|
|
81
|
-
- Updated dependencies [3a9d855]
|
|
82
|
-
- Updated dependencies [1f85217]
|
|
83
|
-
- octane@0.1.4
|
|
84
|
-
|
|
85
|
-
## 0.1.3
|
|
86
|
-
|
|
87
|
-
### Patch Changes
|
|
88
|
-
|
|
89
|
-
- 3431ec3: SSR: the buffered renderers (`renderToString`/`renderToStaticMarkup` in
|
|
90
|
-
`octane/server`, `prerender` in `octane/static`) gain a `RenderOptions` argument:
|
|
91
|
-
`nonce` (CSP nonce stamped on the emitted inline `<style>` tags and the suspense seed
|
|
92
|
-
script — all renderers), plus `signal` (AbortSignal that rejects a suspended render
|
|
93
|
-
when the request dies) and `timeoutMs` (per-render override of the suspense settle
|
|
94
|
-
deadline) on the async `prerender`. `octane/server` now documents which exports are
|
|
95
|
-
the compiler's private ABI and exports the `executeServerFunction` RPC executor the
|
|
96
|
-
vite plugin's dev RPC handler loads via `ssrLoadModule('octane/server')` (previously a
|
|
97
|
-
missing export, so any `module server` call crashed). Wire format is devalue, matching
|
|
98
|
-
`@ripple-ts/adapter`'s client stub: devalue-encoded argument array in, devalue-encoded
|
|
99
|
-
`{ value }` envelope out. See the new `docs/ssr.md` for the full SSR guide and the
|
|
100
|
-
current gaps (streaming, selective hydration, production server build).
|
|
101
|
-
- Updated dependencies [71b5167]
|
|
102
|
-
- Updated dependencies [7b2acbd]
|
|
103
|
-
- Updated dependencies [a000fa2]
|
|
104
|
-
- Updated dependencies [71b5167]
|
|
105
|
-
- Updated dependencies [735f5ca]
|
|
106
|
-
- Updated dependencies [634c4b4]
|
|
107
|
-
- Updated dependencies [1987d47]
|
|
108
|
-
- Updated dependencies [fda2200]
|
|
109
|
-
- Updated dependencies [71b5167]
|
|
110
|
-
- Updated dependencies [fda2200]
|
|
111
|
-
- Updated dependencies [3431ec3]
|
|
112
|
-
- Updated dependencies [3afe217]
|
|
113
|
-
- Updated dependencies [1a1f1db]
|
|
114
|
-
- Updated dependencies [3431ec3]
|
|
115
|
-
- Updated dependencies [5e3858f]
|
|
116
|
-
- Updated dependencies [d2afbbb]
|
|
117
|
-
- Updated dependencies [1987d47]
|
|
118
|
-
- Updated dependencies [eb48930]
|
|
119
|
-
- Updated dependencies [3431ec3]
|
|
120
|
-
- Updated dependencies [87c5bc3]
|
|
121
|
-
- octane@0.1.3
|
|
122
|
-
|
|
123
|
-
## 0.1.2
|
|
124
|
-
|
|
125
|
-
### Patch Changes
|
|
126
|
-
|
|
127
|
-
- 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`.
|
|
128
|
-
- 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.
|
|
129
|
-
- 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.
|
|
130
|
-
- 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.
|
|
131
|
-
- 634fd52: Align the SSR API with React and reshape the render result to `{ html, css }`.
|
|
132
|
-
|
|
133
|
-
The octane-invented `render(Component, props) → { head, body, css }` is replaced by
|
|
134
|
-
React-aligned entry points:
|
|
135
|
-
|
|
136
|
-
- `octane/server` (mirrors `react-dom/server`):
|
|
137
|
-
- `renderToString(element, props?, options?)` — a single synchronous pass; a Suspense
|
|
138
|
-
boundary that suspends renders its `@pending` fallback (no awaiting).
|
|
139
|
-
- `renderToStaticMarkup(element, props?, options?)` — clean, non-hydratable HTML (no block
|
|
140
|
-
or head-adoption markers, no suspense seed script).
|
|
141
|
-
- `octane/static` (NEW subpath, mirrors `react-dom/static`):
|
|
142
|
-
- `prerender(element, props?, options?)` — the await-everything behaviour of the old
|
|
143
|
-
`render()`: all Suspense data resolves and success arms render, returning complete HTML.
|
|
144
|
-
|
|
145
|
-
All three return `{ html, css }`. The separate `head` field is gone — hoisted `<title>`/
|
|
146
|
-
`<meta>`/`<link>` fold into `html` (spliced into `<head>` when the render produced a
|
|
147
|
-
document, else prepended), matching React 19's resource hoisting. `css` remains a distinct
|
|
148
|
-
field (octane has scoped CSS that React core does not). `render` is removed; the vite
|
|
149
|
-
plugin's dev SSR now uses `prerender`.
|
|
150
|
-
|
|
151
|
-
- 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)`.
|
|
152
|
-
- Updated dependencies [c19f1aa]
|
|
153
|
-
- Updated dependencies [6983478]
|
|
154
|
-
- Updated dependencies [6983478]
|
|
155
|
-
- Updated dependencies [169c7c6]
|
|
156
|
-
- Updated dependencies [86ae0c5]
|
|
157
|
-
- Updated dependencies [357f841]
|
|
158
|
-
- Updated dependencies [6675ac7]
|
|
159
|
-
- Updated dependencies [f414710]
|
|
160
|
-
- Updated dependencies [894d51c]
|
|
161
|
-
- Updated dependencies [f44fb6b]
|
|
162
|
-
- Updated dependencies [056c441]
|
|
163
|
-
- Updated dependencies [aa9cc6e]
|
|
164
|
-
- Updated dependencies [0f57f20]
|
|
165
|
-
- Updated dependencies [f44fb6b]
|
|
166
|
-
- Updated dependencies [067efa3]
|
|
167
|
-
- Updated dependencies [f0c6c4d]
|
|
168
|
-
- Updated dependencies [dd24fd5]
|
|
169
|
-
- Updated dependencies [524939e]
|
|
170
|
-
- Updated dependencies [e8ee0a8]
|
|
171
|
-
- Updated dependencies [b680431]
|
|
172
|
-
- Updated dependencies [524939e]
|
|
173
|
-
- Updated dependencies [7f8dbc0]
|
|
174
|
-
- Updated dependencies [a13acd1]
|
|
175
|
-
- Updated dependencies [067efa3]
|
|
176
|
-
- Updated dependencies [524939e]
|
|
177
|
-
- Updated dependencies [894d51c]
|
|
178
|
-
- Updated dependencies [894d51c]
|
|
179
|
-
- Updated dependencies [1960647]
|
|
180
|
-
- Updated dependencies [e8ee0a8]
|
|
181
|
-
- Updated dependencies [93e2733]
|
|
182
|
-
- Updated dependencies [149800c]
|
|
183
|
-
- Updated dependencies [6983478]
|
|
184
|
-
- Updated dependencies [6983478]
|
|
185
|
-
- Updated dependencies [6983478]
|
|
186
|
-
- Updated dependencies [169c7c6]
|
|
187
|
-
- Updated dependencies [bbc3275]
|
|
188
|
-
- Updated dependencies [ed6afad]
|
|
189
|
-
- Updated dependencies [40bcb16]
|
|
190
|
-
- Updated dependencies [c842fb7]
|
|
191
|
-
- Updated dependencies [c62efa7]
|
|
192
|
-
- Updated dependencies [524939e]
|
|
193
|
-
- Updated dependencies [b3a9191]
|
|
194
|
-
- Updated dependencies [ffe32c4]
|
|
195
|
-
- Updated dependencies [e1f996b]
|
|
196
|
-
- Updated dependencies [6983478]
|
|
197
|
-
- Updated dependencies [fc36e15]
|
|
198
|
-
- Updated dependencies [524939e]
|
|
199
|
-
- Updated dependencies [405f06e]
|
|
200
|
-
- Updated dependencies [f50c829]
|
|
201
|
-
- Updated dependencies [b3a9191]
|
|
202
|
-
- Updated dependencies [dd24fd5]
|
|
203
|
-
- Updated dependencies [7042056]
|
|
204
|
-
- Updated dependencies [6983478]
|
|
205
|
-
- Updated dependencies [e031a7d]
|
|
206
|
-
- Updated dependencies [86ae0c5]
|
|
207
|
-
- Updated dependencies [a33cdd6]
|
|
208
|
-
- Updated dependencies [067efa3]
|
|
209
|
-
- Updated dependencies [fab1cb0]
|
|
210
|
-
- Updated dependencies [6983478]
|
|
211
|
-
- Updated dependencies [dd24fd5]
|
|
212
|
-
- Updated dependencies [149800c]
|
|
213
|
-
- Updated dependencies [6983478]
|
|
214
|
-
- Updated dependencies [cb9ad82]
|
|
215
|
-
- Updated dependencies [ea6352e]
|
|
216
|
-
- Updated dependencies [1987bd7]
|
|
217
|
-
- Updated dependencies [0c4d5a1]
|
|
218
|
-
- Updated dependencies [dd24fd5]
|
|
219
|
-
- Updated dependencies [fcac573]
|
|
220
|
-
- Updated dependencies [41aa22a]
|
|
221
|
-
- Updated dependencies [c842fb7]
|
|
222
|
-
- Updated dependencies [6983478]
|
|
223
|
-
- Updated dependencies [6983478]
|
|
224
|
-
- Updated dependencies [634fd52]
|
|
225
|
-
- Updated dependencies [149800c]
|
|
226
|
-
- Updated dependencies [aafaaa9]
|
|
227
|
-
- Updated dependencies [1987bd7]
|
|
228
|
-
- Updated dependencies [74cbff9]
|
|
229
|
-
- Updated dependencies [894d51c]
|
|
230
|
-
- Updated dependencies [0040cad]
|
|
231
|
-
- Updated dependencies [a3dce2f]
|
|
232
|
-
- Updated dependencies [3656e32]
|
|
233
|
-
- Updated dependencies [43d940d]
|
|
234
|
-
- Updated dependencies [a032c5c]
|
|
235
|
-
- Updated dependencies [7f8dbc0]
|
|
236
|
-
- Updated dependencies [c71d4f3]
|
|
237
|
-
- Updated dependencies [a3dce2f]
|
|
238
|
-
- Updated dependencies [c2f3f69]
|
|
239
|
-
- Updated dependencies [3656e32]
|
|
240
|
-
- Updated dependencies [1987bd7]
|
|
241
|
-
- Updated dependencies [f42e5b7]
|
|
242
|
-
- Updated dependencies [cc2bca1]
|
|
243
|
-
- Updated dependencies [6983478]
|
|
244
|
-
- Updated dependencies [1987bd7]
|
|
245
|
-
- octane@0.1.2
|
|
246
|
-
|
|
247
|
-
## 0.1.1
|
|
248
|
-
|
|
249
|
-
### Patch Changes
|
|
250
|
-
|
|
251
|
-
- [#1](https://github.com/octanejs/octane/pull/1) [`dcdf237`](https://github.com/octanejs/octane/commit/dcdf2375ce3a8a2e00b1e1de04f65c2529fd287e) Thanks [@trueadm](https://github.com/trueadm)! - 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.
|
|
252
|
-
|
|
253
|
-
- Updated dependencies [[`dcdf237`](https://github.com/octanejs/octane/commit/dcdf2375ce3a8a2e00b1e1de04f65c2529fd287e)]:
|
|
254
|
-
- octane@0.1.1
|