dinou 9.0.3 → 9.2.0

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.
@@ -1,182 +1,182 @@
1
- // rollup-plugin-server-functions.js
2
- import path from "node:path";
3
- import fs from "node:fs/promises";
4
- import manifestGeneratorPlugin from "./manifest-generator-plugin.js";
5
- import parseExports from "../../core/parse-exports.js";
6
- import { useServerRegex } from "../../constants.js";
7
- import { extractServerFunctions, hasServerFunctions } from "../../core/transform-server-functions.js";
8
-
9
- function serverFunctionsPlugin(manifestData = {}, options = {}) {
10
- const opts =
11
- typeof manifestData === "object" &&
12
- manifestData !== null &&
13
- ("onManifestUpdated" in manifestData || "serverFiles" in manifestData)
14
- ? manifestData
15
- : options;
16
- const serverFiles =
17
- opts.serverFiles || manifestData.serverFiles || options.serverFiles || null;
18
- const root = process.cwd();
19
- const serverFunctions = new Map(); // Collect here: Map<relativePath, Set<exports>>
20
- const sfMtimeCache = new Map(); // Cache by filePath: { mtimeMs, exportsSet }
21
-
22
- function normalizeFsPath(p) {
23
- const resolved = path.resolve(p).replace(/\\/g, "/");
24
- return process.platform === "win32" ? resolved.toLowerCase() : resolved;
25
- }
26
-
27
- return {
28
- name: "server-functions-proxy",
29
- transform(code, id) {
30
- if (id.includes("node_modules") || id.includes("\0")) return null;
31
- if (serverFiles && !serverFiles.has(normalizeFsPath(id))) {
32
- if (!useServerRegex.test(code.trim()) && !hasServerFunctions(code)) return null;
33
- serverFiles.add(normalizeFsPath(id));
34
- } else if (!useServerRegex.test(code.trim()) && !hasServerFunctions(code)) {
35
- return null;
36
- }
37
-
38
- const isModuleLevel = useServerRegex.test(code.trim());
39
- const exports = isModuleLevel ? parseExports(code) : extractServerFunctions(code, id);
40
- if (!exports || exports.length === 0) return null;
41
-
42
- const relativePath = path.relative(root, id).replace(/\\/g, "/");
43
- serverFunctions.set(relativePath, new Set(exports)); // Save exports as a Set for uniqueness
44
-
45
- const fileUrl = `file:///${relativePath}`;
46
-
47
- // Generate a module that exports proxies instead of the real code
48
- let proxyCode = `
49
- import { createServerFunctionProxy } from "/__SERVER_FUNCTION_PROXY__";
50
- `;
51
-
52
- for (const exp of exports) {
53
- const key =
54
- exp === "default" ? `${fileUrl}#default` : `${fileUrl}#${exp}`;
55
- if (exp === "default") {
56
- proxyCode += `export default createServerFunctionProxy(${JSON.stringify(
57
- key
58
- )});\n`;
59
- } else {
60
- proxyCode += `export const ${exp} = createServerFunctionProxy(${JSON.stringify(
61
- key
62
- )});\n`;
63
- }
64
- }
65
-
66
- return {
67
- code: proxyCode,
68
- map: null,
69
- };
70
- },
71
- // 🪄 After manifest exists, replace the placeholder with the final URL
72
- async generateBundle(options, bundle) {
73
- if (serverFiles && serverFiles.size > 0) {
74
- for (const filePath of serverFiles) {
75
- const rel = path.relative(root, filePath).replace(/\\/g, "/");
76
- try {
77
- const stat = await fs.stat(filePath);
78
- const cached = sfMtimeCache.get(filePath);
79
- if (cached && cached.mtimeMs === stat.mtimeMs) {
80
- if (cached.exportsSet) {
81
- serverFunctions.set(rel, cached.exportsSet);
82
- } else {
83
- serverFunctions.delete(rel);
84
- }
85
- continue;
86
- }
87
-
88
- const fileCode = await fs.readFile(filePath, "utf8");
89
- let exports = null;
90
- if (useServerRegex.test(fileCode.trim())) {
91
- exports = parseExports(fileCode);
92
- } else if (hasServerFunctions(fileCode)) {
93
- exports = extractServerFunctions(fileCode, filePath);
94
- }
95
-
96
- if (exports && exports.length > 0) {
97
- const exportsSet = new Set(exports);
98
- serverFunctions.set(rel, exportsSet);
99
- sfMtimeCache.set(filePath, {
100
- mtimeMs: stat.mtimeMs,
101
- exportsSet,
102
- });
103
- } else {
104
- serverFunctions.delete(rel);
105
- sfMtimeCache.set(filePath, {
106
- mtimeMs: stat.mtimeMs,
107
- exportsSet: null,
108
- });
109
- }
110
- } catch (e) {
111
- serverFunctions.delete(rel);
112
- }
113
- }
114
- }
115
-
116
- if (serverFunctions.size === 0) {
117
- if (typeof globalThis !== "undefined") {
118
- globalThis.__DINOU_RAW_SERVER_FUNCTIONS_MANIFEST__ = {};
119
- }
120
- return;
121
- }
122
- const isProd =
123
- process.env.NODE_ENV === "production" &&
124
- process.env.DINOU_DEV !== "true";
125
- const manifest = manifestGeneratorPlugin.manifestData;
126
- const proxyName = manifest["serverFunctionProxy.js"];
127
- if (isProd && !proxyName) {
128
- throw new Error(
129
- "[Dinou] rollup-plugin-server-functions: could not find hashed 'serverFunctionProxy.js' in manifest during production build."
130
- );
131
- }
132
- const hashedPath =
133
- "/" + (proxyName || "serverFunctionProxy.js");
134
-
135
- for (const file of Object.keys(bundle)) {
136
- const chunk = bundle[file];
137
- if (chunk.type === "asset" || !chunk.code) continue;
138
- if (chunk.code.includes("/__SERVER_FUNCTION_PROXY__")) {
139
- chunk.code = chunk.code.replace(
140
- /\/__SERVER_FUNCTION_PROXY__/g,
141
- hashedPath
142
- );
143
- }
144
- }
145
-
146
- // Generate manifest: convert Map to a simple object
147
- const manifestObj = {};
148
- for (const [relPath, exportsSet] of serverFunctions.entries()) {
149
- manifestObj[relPath] = Array.from(exportsSet);
150
- }
151
-
152
- if (typeof globalThis !== "undefined") {
153
- globalThis.__DINOU_RAW_SERVER_FUNCTIONS_MANIFEST__ = manifestObj;
154
- }
155
-
156
- const isDev =
157
- process.env.NODE_ENV !== "production" ||
158
- process.env.DINOU_DEV === "true";
159
- const shouldWriteToDisk =
160
- process.env.DINOU_WRITE_TO_DISK === "false"
161
- ? false
162
- : process.env.DINOU_WRITE_TO_DISK === "true" || !isDev;
163
-
164
- if (shouldWriteToDisk) {
165
- // Write the manifest to the specified folder (e.g. same place as other assets)
166
- const manifestPath = path.join(
167
- ".dinou/server_functions_manifest",
168
- "server-functions-manifest.json"
169
- );
170
- try {
171
- await fs.mkdir(path.dirname(manifestPath), { recursive: true });
172
- await fs.writeFile(manifestPath, JSON.stringify(manifestObj, null, 2));
173
- } catch (err) {
174
- console.error(err);
175
- }
176
- }
177
- },
178
- };
179
- }
180
-
181
- export { serverFunctionsPlugin };
182
- export default serverFunctionsPlugin;
1
+ // rollup-plugin-server-functions.js
2
+ import path from "node:path";
3
+ import fs from "node:fs/promises";
4
+ import manifestGeneratorPlugin from "./manifest-generator-plugin.js";
5
+ import parseExports from "../../core/parse-exports.js";
6
+ import { useServerRegex } from "../../constants.js";
7
+ import { extractServerFunctions, hasServerFunctions } from "../../core/transform-server-functions.js";
8
+
9
+ function serverFunctionsPlugin(manifestData = {}, options = {}) {
10
+ const opts =
11
+ typeof manifestData === "object" &&
12
+ manifestData !== null &&
13
+ ("onManifestUpdated" in manifestData || "serverFiles" in manifestData)
14
+ ? manifestData
15
+ : options;
16
+ const serverFiles =
17
+ opts.serverFiles || manifestData.serverFiles || options.serverFiles || null;
18
+ const root = process.cwd();
19
+ const serverFunctions = new Map(); // Collect here: Map<relativePath, Set<exports>>
20
+ const sfMtimeCache = new Map(); // Cache by filePath: { mtimeMs, exportsSet }
21
+
22
+ function normalizeFsPath(p) {
23
+ const resolved = path.resolve(p).replace(/\\/g, "/");
24
+ return process.platform === "win32" ? resolved.toLowerCase() : resolved;
25
+ }
26
+
27
+ return {
28
+ name: "server-functions-proxy",
29
+ transform(code, id) {
30
+ if (id.includes("node_modules") || id.includes("\0")) return null;
31
+ if (serverFiles && !serverFiles.has(normalizeFsPath(id))) {
32
+ if (!useServerRegex.test(code.trim()) && !hasServerFunctions(code)) return null;
33
+ serverFiles.add(normalizeFsPath(id));
34
+ } else if (!useServerRegex.test(code.trim()) && !hasServerFunctions(code)) {
35
+ return null;
36
+ }
37
+
38
+ const isModuleLevel = useServerRegex.test(code.trim());
39
+ const exports = isModuleLevel ? parseExports(code) : extractServerFunctions(code, id);
40
+ if (!exports || exports.length === 0) return null;
41
+
42
+ const relativePath = path.relative(root, id).replace(/\\/g, "/");
43
+ serverFunctions.set(relativePath, new Set(exports)); // Save exports as a Set for uniqueness
44
+
45
+ const fileUrl = `file:///${relativePath}`;
46
+
47
+ // Generate a module that exports proxies instead of the real code
48
+ let proxyCode = `
49
+ import { createServerFunctionProxy } from "/__SERVER_FUNCTION_PROXY__";
50
+ `;
51
+
52
+ for (const exp of exports) {
53
+ const key =
54
+ exp === "default" ? `${fileUrl}#default` : `${fileUrl}#${exp}`;
55
+ if (exp === "default") {
56
+ proxyCode += `export default createServerFunctionProxy(${JSON.stringify(
57
+ key
58
+ )});\n`;
59
+ } else {
60
+ proxyCode += `export const ${exp} = createServerFunctionProxy(${JSON.stringify(
61
+ key
62
+ )});\n`;
63
+ }
64
+ }
65
+
66
+ return {
67
+ code: proxyCode,
68
+ map: null,
69
+ };
70
+ },
71
+ // 🪄 After manifest exists, replace the placeholder with the final URL
72
+ async generateBundle(options, bundle) {
73
+ if (serverFiles && serverFiles.size > 0) {
74
+ for (const filePath of serverFiles) {
75
+ const rel = path.relative(root, filePath).replace(/\\/g, "/");
76
+ try {
77
+ const stat = await fs.stat(filePath);
78
+ const cached = sfMtimeCache.get(filePath);
79
+ if (cached && cached.mtimeMs === stat.mtimeMs) {
80
+ if (cached.exportsSet) {
81
+ serverFunctions.set(rel, cached.exportsSet);
82
+ } else {
83
+ serverFunctions.delete(rel);
84
+ }
85
+ continue;
86
+ }
87
+
88
+ const fileCode = await fs.readFile(filePath, "utf8");
89
+ let exports = null;
90
+ if (useServerRegex.test(fileCode.trim())) {
91
+ exports = parseExports(fileCode);
92
+ } else if (hasServerFunctions(fileCode)) {
93
+ exports = extractServerFunctions(fileCode, filePath);
94
+ }
95
+
96
+ if (exports && exports.length > 0) {
97
+ const exportsSet = new Set(exports);
98
+ serverFunctions.set(rel, exportsSet);
99
+ sfMtimeCache.set(filePath, {
100
+ mtimeMs: stat.mtimeMs,
101
+ exportsSet,
102
+ });
103
+ } else {
104
+ serverFunctions.delete(rel);
105
+ sfMtimeCache.set(filePath, {
106
+ mtimeMs: stat.mtimeMs,
107
+ exportsSet: null,
108
+ });
109
+ }
110
+ } catch (e) {
111
+ serverFunctions.delete(rel);
112
+ }
113
+ }
114
+ }
115
+
116
+ if (serverFunctions.size === 0) {
117
+ if (typeof globalThis !== "undefined") {
118
+ globalThis.__DINOU_RAW_SERVER_FUNCTIONS_MANIFEST__ = {};
119
+ }
120
+ return;
121
+ }
122
+ const isProd =
123
+ process.env.NODE_ENV === "production" &&
124
+ process.env.DINOU_DEV !== "true";
125
+ const manifest = manifestGeneratorPlugin.manifestData;
126
+ const proxyName = manifest["serverFunctionProxy.js"];
127
+ if (isProd && !proxyName) {
128
+ throw new Error(
129
+ "[Dinou] rollup-plugin-server-functions: could not find hashed 'serverFunctionProxy.js' in manifest during production build."
130
+ );
131
+ }
132
+ const hashedPath =
133
+ "/" + (proxyName || "serverFunctionProxy.js");
134
+
135
+ for (const file of Object.keys(bundle)) {
136
+ const chunk = bundle[file];
137
+ if (chunk.type === "asset" || !chunk.code) continue;
138
+ if (chunk.code.includes("/__SERVER_FUNCTION_PROXY__")) {
139
+ chunk.code = chunk.code.replace(
140
+ /\/__SERVER_FUNCTION_PROXY__/g,
141
+ hashedPath
142
+ );
143
+ }
144
+ }
145
+
146
+ // Generate manifest: convert Map to a simple object
147
+ const manifestObj = {};
148
+ for (const [relPath, exportsSet] of serverFunctions.entries()) {
149
+ manifestObj[relPath] = Array.from(exportsSet);
150
+ }
151
+
152
+ if (typeof globalThis !== "undefined") {
153
+ globalThis.__DINOU_RAW_SERVER_FUNCTIONS_MANIFEST__ = manifestObj;
154
+ }
155
+
156
+ const isDev =
157
+ process.env.NODE_ENV !== "production" ||
158
+ process.env.DINOU_DEV === "true";
159
+ const shouldWriteToDisk =
160
+ process.env.DINOU_WRITE_TO_DISK === "false"
161
+ ? false
162
+ : process.env.DINOU_WRITE_TO_DISK === "true" || !isDev;
163
+
164
+ if (shouldWriteToDisk) {
165
+ // Write the manifest to the specified folder (e.g. same place as other assets)
166
+ const manifestPath = path.join(
167
+ ".dinou/server_functions_manifest",
168
+ "server-functions-manifest.json"
169
+ );
170
+ try {
171
+ await fs.mkdir(path.dirname(manifestPath), { recursive: true });
172
+ await fs.writeFile(manifestPath, JSON.stringify(manifestObj, null, 2));
173
+ } catch (err) {
174
+ console.error(err);
175
+ }
176
+ }
177
+ },
178
+ };
179
+ }
180
+
181
+ export { serverFunctionsPlugin };
182
+ export default serverFunctionsPlugin;
package/dinou/server.d.ts CHANGED
@@ -44,6 +44,8 @@ export declare function revalidateTag(
44
44
  options?: { cascade?: boolean } | "layout"
45
45
  ): Promise<void>;
46
46
 
47
+ import type { RequestContextStore } from "./index";
48
+
47
49
  export type {
48
50
  PPRConfig,
49
51
  RouteSegmentConfig,
@@ -51,6 +53,26 @@ export type {
51
53
  LayoutFunctions,
52
54
  StaticPathItem,
53
55
  StaticPathsResult,
56
+ RequestContextStore,
57
+ ResponseProxy,
58
+ CookieOptions,
59
+ Query,
60
+ Cookies,
61
+ Headers,
62
+ DinouConfig,
63
+ DinouPlugin,
64
+ ServerHookContext,
65
+ NodeMiddleware,
66
+ PageProps,
67
+ LayoutProps,
68
+ ErrorProps,
69
+ RouteParams,
70
+ DinouRoutePattern,
71
+ DinouRoute,
72
+ DinouRouter,
73
+ CleanRoutePath,
74
+ ExtractRouteParams,
75
+ ExtractSegmentParam,
54
76
  } from "./index";
55
77
 
56
78
  export interface DinouCacheSlotProps {
@@ -68,6 +90,23 @@ export interface DinouCacheSlotProps {
68
90
  */
69
91
  export declare function DinouCacheSlot(props: DinouCacheSlotProps): Promise<any>;
70
92
 
93
+ /**
94
+ * Opts the enclosing `<Suspense>` boundary out of becoming a Dynamic PPR Hole
95
+ * when wrapping an async Server Component on a PPR route (`ppr = true`).
96
+ *
97
+ * Call `noDynamic()` synchronously at the top of your async Server Component
98
+ * (before its first `await`) so Dinou resolves its promise at build time and
99
+ * bakes the rendered output directly into the Static Shell (`shell.html`).
100
+ */
101
+ export declare function noDynamic(): void;
102
+
103
+ /**
104
+ * Gets the current request context (req and res proxy) synchronously.
105
+ * Must be called within a Server Component, `getProps`, or a `"use server"` Server Function.
106
+ * @returns The current request context store, or `undefined` if called outside a request scope.
107
+ */
108
+ export declare function getContext(): RequestContextStore | undefined;
109
+
71
110
  // ====================================================================
72
111
  // STORAGE ADAPTER TYPES (ISR / CACHE)
73
112
  // ====================================================================
package/dinou/server.js CHANGED
@@ -1,3 +1,8 @@
1
+ import { getContext } from "./core/request-context.js";
2
+ import { noDynamic } from "./core/no-dynamic.js";
3
+
4
+ export { getContext, noDynamic };
5
+
1
6
  export async function revalidatePath(path, options) {
2
7
  const { revalidatePath: fn } = await import("./core/cache-revalidate.js");
3
8
  return fn(path, options);
@@ -22,6 +27,7 @@ export async function DinouCacheSlot(props) {
22
27
  const { DinouCacheSlot: fn } = await import("./core/cache-slot.js");
23
28
  return fn(props);
24
29
  }
30
+ DinouCacheSlot.$$dinouCacheSlot = true;
25
31
 
26
32
  export {
27
33
  StorageAdapter,
@@ -1,101 +1,101 @@
1
- import path from "node:path";
2
- import { normalizePathCase } from "../../core/path-utils.js";
3
- import parseExports from "../../core/parse-exports.js";
4
- import { useClientRegex, useServerRegex } from "../../constants.js";
5
- import { extractServerFunctions, hasServerFunctions } from "../../core/transform-server-functions.js";
6
-
7
- export default function (source) {
8
- const options = this.getOptions ? this.getOptions() : {};
9
- const trimmed = source.trim();
10
-
11
- if (useClientRegex.test(trimmed)) {
12
- return source;
13
- }
14
-
15
- const norm = path.resolve(this.resourcePath).replace(/\\/g, "/").toLowerCase();
16
-
17
- const isModuleLevel = useServerRegex.test(trimmed);
18
- const hasBodyUseServer = !isModuleLevel && hasServerFunctions(source);
19
-
20
- if (options.serverFiles) {
21
- if (!options.serverFiles.has(norm)) {
22
- if (!isModuleLevel && !hasBodyUseServer) {
23
- return source;
24
- }
25
- options.serverFiles.add(norm);
26
- }
27
- }
28
-
29
- if (!isModuleLevel && !hasBodyUseServer) {
30
- if (options.serverFiles) {
31
- options.serverFiles.delete(norm);
32
- }
33
- return source;
34
- }
35
-
36
- const exports = isModuleLevel
37
- ? parseExports(source)
38
- : extractServerFunctions(source, this.resourcePath);
39
- if (!exports || exports.length === 0) {
40
- if (options.serverFiles) {
41
- options.serverFiles.delete(norm);
42
- }
43
- return source;
44
- }
45
-
46
- // Build IDs
47
- const moduleId = this.resourcePath;
48
- const relativePath = path.relative(
49
- normalizePathCase(process.cwd()),
50
- normalizePathCase(moduleId)
51
- );
52
- const normalizedPath = relativePath.replace(/\\/g, "/");
53
-
54
- const fileUrl = `file:///${normalizedPath}`;
55
-
56
- //
57
- // IMPORTANT: dynamic import instead of static import
58
- //
59
- // Webpack will NOT try to resolve "__SERVER_FUNCTION_PROXY__"
60
- // as a module → it will remain a string → replaced later → browser loads it.
61
-
62
- let proxyCode = `
63
- const loadProxy = new Function('return import("/"+"__SERVER_FUNCTION_PROXY__")');
64
- `;
65
-
66
- for (const exp of exports) {
67
- const key = exp === "default" ? `${fileUrl}#default` : `${fileUrl}#${exp}`;
68
-
69
- if (exp === "default") {
70
- proxyCode += `
71
- export default (...args) =>
72
- loadProxy().then(mod =>
73
- (mod.default ?? mod ?? window.__SERVER_FUNCTION_PROXY_LIB__).createServerFunctionProxy(${JSON.stringify(
74
- key,
75
- )})(...args)
76
- );
77
- `;
78
- } else {
79
- proxyCode += `
80
- export const ${exp} = (...args) =>
81
- loadProxy().then(mod => (mod.default ?? mod ?? window.__SERVER_FUNCTION_PROXY_LIB__).createServerFunctionProxy(${JSON.stringify(
82
- key,
83
- )})(...args)
84
- );
85
- `;
86
- }
87
- }
88
-
89
- // Emit manifest entry
90
- const manifestEntry = {
91
- path: normalizedPath,
92
- exports: exports,
93
- };
94
-
95
- this.emitFile(
96
- `server-functions/${normalizedPath}.json`,
97
- JSON.stringify(manifestEntry, null, 2),
98
- );
99
-
100
- return proxyCode;
101
- };
1
+ import path from "node:path";
2
+ import { normalizePathCase } from "../../core/path-utils.js";
3
+ import parseExports from "../../core/parse-exports.js";
4
+ import { useClientRegex, useServerRegex } from "../../constants.js";
5
+ import { extractServerFunctions, hasServerFunctions } from "../../core/transform-server-functions.js";
6
+
7
+ export default function (source) {
8
+ const options = this.getOptions ? this.getOptions() : {};
9
+ const trimmed = source.trim();
10
+
11
+ if (useClientRegex.test(trimmed)) {
12
+ return source;
13
+ }
14
+
15
+ const norm = path.resolve(this.resourcePath).replace(/\\/g, "/").toLowerCase();
16
+
17
+ const isModuleLevel = useServerRegex.test(trimmed);
18
+ const hasBodyUseServer = !isModuleLevel && hasServerFunctions(source);
19
+
20
+ if (options.serverFiles) {
21
+ if (!options.serverFiles.has(norm)) {
22
+ if (!isModuleLevel && !hasBodyUseServer) {
23
+ return source;
24
+ }
25
+ options.serverFiles.add(norm);
26
+ }
27
+ }
28
+
29
+ if (!isModuleLevel && !hasBodyUseServer) {
30
+ if (options.serverFiles) {
31
+ options.serverFiles.delete(norm);
32
+ }
33
+ return source;
34
+ }
35
+
36
+ const exports = isModuleLevel
37
+ ? parseExports(source)
38
+ : extractServerFunctions(source, this.resourcePath);
39
+ if (!exports || exports.length === 0) {
40
+ if (options.serverFiles) {
41
+ options.serverFiles.delete(norm);
42
+ }
43
+ return source;
44
+ }
45
+
46
+ // Build IDs
47
+ const moduleId = this.resourcePath;
48
+ const relativePath = path.relative(
49
+ normalizePathCase(process.cwd()),
50
+ normalizePathCase(moduleId)
51
+ );
52
+ const normalizedPath = relativePath.replace(/\\/g, "/");
53
+
54
+ const fileUrl = `file:///${normalizedPath}`;
55
+
56
+ //
57
+ // IMPORTANT: dynamic import instead of static import
58
+ //
59
+ // Webpack will NOT try to resolve "__SERVER_FUNCTION_PROXY__"
60
+ // as a module → it will remain a string → replaced later → browser loads it.
61
+
62
+ let proxyCode = `
63
+ const loadProxy = new Function('return import("/"+"__SERVER_FUNCTION_PROXY__")');
64
+ `;
65
+
66
+ for (const exp of exports) {
67
+ const key = exp === "default" ? `${fileUrl}#default` : `${fileUrl}#${exp}`;
68
+
69
+ if (exp === "default") {
70
+ proxyCode += `
71
+ export default (...args) =>
72
+ loadProxy().then(mod =>
73
+ (mod.default ?? mod ?? window.__SERVER_FUNCTION_PROXY_LIB__).createServerFunctionProxy(${JSON.stringify(
74
+ key,
75
+ )})(...args)
76
+ );
77
+ `;
78
+ } else {
79
+ proxyCode += `
80
+ export const ${exp} = (...args) =>
81
+ loadProxy().then(mod => (mod.default ?? mod ?? window.__SERVER_FUNCTION_PROXY_LIB__).createServerFunctionProxy(${JSON.stringify(
82
+ key,
83
+ )})(...args)
84
+ );
85
+ `;
86
+ }
87
+ }
88
+
89
+ // Emit manifest entry
90
+ const manifestEntry = {
91
+ path: normalizedPath,
92
+ exports: exports,
93
+ };
94
+
95
+ this.emitFile(
96
+ `server-functions/${normalizedPath}.json`,
97
+ JSON.stringify(manifestEntry, null, 2),
98
+ );
99
+
100
+ return proxyCode;
101
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dinou",
3
- "version": "9.0.3",
3
+ "version": "9.2.0",
4
4
  "description": "Full-stack React 19 framework with native RSC, Server Functions, progressive streaming, and zero vendor lock-in.",
5
5
  "type": "module",
6
6
  "main": "./dinou/index.js",