@voltx/server 0.3.2 → 0.3.3
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 +5 -1
- package/dist/index.d.cts +7 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.js +5 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -330,10 +330,14 @@ function registerSSR(app, vite, options = {}) {
|
|
|
330
330
|
const ssrBundlePath = (0, import_node_path3.resolve)(process.cwd(), "dist/server/entry-server.js");
|
|
331
331
|
const mod = await import(ssrBundlePath);
|
|
332
332
|
render = mod.render;
|
|
333
|
+
} else if (options.loadModule) {
|
|
334
|
+
const mod = await options.loadModule(entryServer);
|
|
335
|
+
render = mod.render;
|
|
333
336
|
} else {
|
|
337
|
+
const absPath = (0, import_node_path3.resolve)(process.cwd(), entryServer);
|
|
334
338
|
const mod = await import(
|
|
335
339
|
/* @vite-ignore */
|
|
336
|
-
|
|
340
|
+
absPath
|
|
337
341
|
);
|
|
338
342
|
render = mod.render;
|
|
339
343
|
}
|
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
|
@@ -294,10 +294,14 @@ function registerSSR(app, vite, options = {}) {
|
|
|
294
294
|
const ssrBundlePath = resolve2(process.cwd(), "dist/server/entry-server.js");
|
|
295
295
|
const mod = await import(ssrBundlePath);
|
|
296
296
|
render = mod.render;
|
|
297
|
+
} else if (options.loadModule) {
|
|
298
|
+
const mod = await options.loadModule(entryServer);
|
|
299
|
+
render = mod.render;
|
|
297
300
|
} else {
|
|
301
|
+
const absPath = resolve2(process.cwd(), entryServer);
|
|
298
302
|
const mod = await import(
|
|
299
303
|
/* @vite-ignore */
|
|
300
|
-
|
|
304
|
+
absPath
|
|
301
305
|
);
|
|
302
306
|
render = mod.render;
|
|
303
307
|
}
|
package/package.json
CHANGED