@voltx/server 0.3.2 → 0.3.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/dist/index.cjs +15 -5
- package/dist/index.d.cts +7 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.js +15 -5
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -331,11 +331,21 @@ function registerSSR(app, vite, options = {}) {
|
|
|
331
331
|
const mod = await import(ssrBundlePath);
|
|
332
332
|
render = mod.render;
|
|
333
333
|
} else {
|
|
334
|
-
const
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
334
|
+
const viteFromEnv = c.env?.vite;
|
|
335
|
+
if (viteFromEnv) {
|
|
336
|
+
const mod = await viteFromEnv.ssrLoadModule(entryServer);
|
|
337
|
+
render = mod.render;
|
|
338
|
+
} else if (options.loadModule) {
|
|
339
|
+
const mod = await options.loadModule(entryServer);
|
|
340
|
+
render = mod.render;
|
|
341
|
+
} else {
|
|
342
|
+
const absPath = (0, import_node_path3.resolve)(process.cwd(), entryServer);
|
|
343
|
+
const mod = await import(
|
|
344
|
+
/* @vite-ignore */
|
|
345
|
+
absPath
|
|
346
|
+
);
|
|
347
|
+
render = mod.render;
|
|
348
|
+
}
|
|
339
349
|
}
|
|
340
350
|
const appStream = await render(url);
|
|
341
351
|
const publicEnv = getPublicEnv();
|
package/dist/index.d.cts
CHANGED
|
@@ -183,6 +183,13 @@ interface SSROptions {
|
|
|
183
183
|
entryClient?: string;
|
|
184
184
|
/** App title (default: "VoltX App") */
|
|
185
185
|
title?: string;
|
|
186
|
+
/**
|
|
187
|
+
* Custom module loader for dev mode (when no explicit Vite instance is passed).
|
|
188
|
+
* This should be a function that calls `import()` from the caller's module context
|
|
189
|
+
* so that Vite's SSR pipeline can intercept and transform .tsx files.
|
|
190
|
+
* Example: `loadModule: (path) => import(path)`
|
|
191
|
+
*/
|
|
192
|
+
loadModule?: (path: string) => Promise<Record<string, unknown>>;
|
|
186
193
|
}
|
|
187
194
|
/** Vite dev server shape — minimal interface to avoid hard dep on vite */
|
|
188
195
|
interface ViteDevServer {
|
package/dist/index.d.ts
CHANGED
|
@@ -183,6 +183,13 @@ interface SSROptions {
|
|
|
183
183
|
entryClient?: string;
|
|
184
184
|
/** App title (default: "VoltX App") */
|
|
185
185
|
title?: string;
|
|
186
|
+
/**
|
|
187
|
+
* Custom module loader for dev mode (when no explicit Vite instance is passed).
|
|
188
|
+
* This should be a function that calls `import()` from the caller's module context
|
|
189
|
+
* so that Vite's SSR pipeline can intercept and transform .tsx files.
|
|
190
|
+
* Example: `loadModule: (path) => import(path)`
|
|
191
|
+
*/
|
|
192
|
+
loadModule?: (path: string) => Promise<Record<string, unknown>>;
|
|
186
193
|
}
|
|
187
194
|
/** Vite dev server shape — minimal interface to avoid hard dep on vite */
|
|
188
195
|
interface ViteDevServer {
|
package/dist/index.js
CHANGED
|
@@ -295,11 +295,21 @@ function registerSSR(app, vite, options = {}) {
|
|
|
295
295
|
const mod = await import(ssrBundlePath);
|
|
296
296
|
render = mod.render;
|
|
297
297
|
} else {
|
|
298
|
-
const
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
298
|
+
const viteFromEnv = c.env?.vite;
|
|
299
|
+
if (viteFromEnv) {
|
|
300
|
+
const mod = await viteFromEnv.ssrLoadModule(entryServer);
|
|
301
|
+
render = mod.render;
|
|
302
|
+
} else if (options.loadModule) {
|
|
303
|
+
const mod = await options.loadModule(entryServer);
|
|
304
|
+
render = mod.render;
|
|
305
|
+
} else {
|
|
306
|
+
const absPath = resolve2(process.cwd(), entryServer);
|
|
307
|
+
const mod = await import(
|
|
308
|
+
/* @vite-ignore */
|
|
309
|
+
absPath
|
|
310
|
+
);
|
|
311
|
+
render = mod.render;
|
|
312
|
+
}
|
|
303
313
|
}
|
|
304
314
|
const appStream = await render(url);
|
|
305
315
|
const publicEnv = getPublicEnv();
|
package/package.json
CHANGED