@farm.js/plugin 0.1.51-beta.3 → 0.1.61
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.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/middleware/index.d.ts +1 -8
- package/dist/middleware/index.d.ts.map +1 -1
- package/dist/middleware/index.js +10 -16
- package/dist/middleware/matching.d.ts +2 -4
- package/dist/middleware/matching.d.ts.map +1 -1
- package/dist/middleware/matching.js +47 -7
- package/dist/rsc/entries/client.d.ts.map +1 -1
- package/dist/rsc/entries/client.js +9 -22
- package/dist/rsc/entries/rsc.d.ts.map +1 -1
- package/dist/rsc/entries/rsc.js +40 -533
- package/dist/rsc/entries/ssr.d.ts.map +1 -1
- package/dist/rsc/entries/ssr.js +6 -7
- package/dist/rsc/index.d.ts +2 -35
- package/dist/rsc/index.d.ts.map +1 -1
- package/dist/rsc/index.js +290 -238
- package/dist/rsc/middleware-config-module.d.ts +0 -3
- package/dist/rsc/middleware-config-module.d.ts.map +1 -1
- package/dist/rsc/middleware-config-module.js +28 -41
- package/dist/rsc/nitro-build.d.ts.map +1 -1
- package/dist/rsc/nitro-build.js +81 -259
- package/dist/rsc/server-fn-transform.d.ts +5 -1
- package/dist/rsc/server-fn-transform.d.ts.map +1 -1
- package/dist/rsc/server-fn-transform.js +338 -3
- package/dist/rsc/types.d.ts +0 -28
- package/dist/rsc/types.d.ts.map +1 -1
- package/dist/rsc/vite-plugin-nitro.d.ts +0 -2
- package/dist/rsc/vite-plugin-nitro.d.ts.map +1 -1
- package/dist/rsc/vite-plugin-nitro.js +2 -12
- package/package.json +3 -3
- package/dist/rsc/client-sourcemaps.d.ts +0 -13
- package/dist/rsc/client-sourcemaps.d.ts.map +0 -1
- package/dist/rsc/client-sourcemaps.js +0 -52
- package/dist/rsc/document-layouts.d.ts +0 -16
- package/dist/rsc/document-layouts.d.ts.map +0 -1
- package/dist/rsc/document-layouts.js +0 -82
|
@@ -1,3 +1,338 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
const SERVER_FUNCTION_FACTORY_IMPORT_RE = /\bimport\s+(?:type\s+)?(?:[A-Za-z_$][\w$]*\s*,\s*)?(\{[^}]*\})\s+from\s*["']@farm.js\/core(?:\/(?:server-fn|server-query))?["']\s*;?/g;
|
|
2
|
+
const EXPORT_SERVER_FUNCTION_FACTORY_RE = /\bexport\s+(?:const|let|var)\s+([A-Za-z_$][\w$]*)\s*=\s*([A-Za-z_$][\w$]*)\s*(?:<[^<>]*(?:<[^<>]*>[^<>]*)*>)?\s*\(/g;
|
|
3
|
+
const EXPORT_DEFAULT_SERVER_FUNCTION_FACTORY_RE = /\bexport\s+default\s+([A-Za-z_$][\w$]*)\s*(?:<[^<>]*(?:<[^<>]*>[^<>]*)*>)?\s*\(/g;
|
|
4
|
+
// Any assignment counts as a declaration, not only `const x = factory(...)`:
|
|
5
|
+
// splitting `let save; save = createServerFn(...)` must not hide the binding
|
|
6
|
+
// from the fail-closed export checks below.
|
|
7
|
+
const SERVER_FUNCTION_DECLARATION_RE = /(?<![.\w$])([A-Za-z_$][\w$]*)\s*=\s*([A-Za-z_$][\w$]*)\s*(?:<[^<>]*(?:<[^<>]*>[^<>]*)*>)?\s*\(/g;
|
|
8
|
+
const LOCAL_EXPORT_CLAUSE_RE = /\bexport\s*\{([^}]*)\}/g;
|
|
9
|
+
const EXPORT_DEFAULT_ALIAS_RE = /\bexport\s+default\s+([A-Za-z_$][\w$]*)\s*(?:;|(?=[\r\n])|$)/g;
|
|
10
|
+
const EXPORT_BINDING_ALIAS_RE = /\bexport\s+(?:const|let|var)\s+([A-Za-z_$][\w$]*)\s*=\s*([A-Za-z_$][\w$]*)\s*(?:;|(?=[,\r\n])|$)/g;
|
|
11
|
+
const MODULE_EXT_RE = /\.[cm]?[jt]sx?$/;
|
|
12
|
+
const DECLARATION_RE = /(^|\n)\s*["']([^"']+)["']\s*;?/g;
|
|
13
|
+
export function transformFarmServerFns(code, id) {
|
|
14
|
+
if (!isTransformableModule(id) ||
|
|
15
|
+
(!code.includes("createServerFn") && !code.includes("createServerQuery"))) {
|
|
16
|
+
return null;
|
|
17
|
+
}
|
|
18
|
+
const factoryNames = findServerFunctionFactoryImportNames(code);
|
|
19
|
+
if (factoryNames.size === 0)
|
|
20
|
+
return null;
|
|
21
|
+
const reExport = findServerFnReExport(code, factoryNames);
|
|
22
|
+
if (reExport) {
|
|
23
|
+
const factoryName = reExport.factory === "fn" ? "createServerFn" : "createServerQuery";
|
|
24
|
+
const escape = reExport.form === "clause"
|
|
25
|
+
? "with an export clause"
|
|
26
|
+
: reExport.form === "default"
|
|
27
|
+
? "as the default export"
|
|
28
|
+
: "through another exported binding";
|
|
29
|
+
const inlineForm = reExport.form === "default"
|
|
30
|
+
? `export default ${factoryName}(...)`
|
|
31
|
+
: `export const ${reExport.exportName} = ${factoryName}(...)`;
|
|
32
|
+
throw new Error(`Server function "${reExport.localName}" cannot be re-exported ${escape}. ` +
|
|
33
|
+
`Export it inline instead: ${inlineForm}.`);
|
|
34
|
+
}
|
|
35
|
+
const replacements = findServerFnExportReplacements(code, factoryNames);
|
|
36
|
+
if (replacements.length === 0)
|
|
37
|
+
return null;
|
|
38
|
+
if (hasModuleDirective(code, "use client")) {
|
|
39
|
+
throw new Error("createServerFn and createServerQuery exports must live in a server module. Move them out of the 'use client' file.");
|
|
40
|
+
}
|
|
41
|
+
let output = code;
|
|
42
|
+
for (const replacement of [...replacements].sort((a, b) => b.start - a.start)) {
|
|
43
|
+
output = output.slice(0, replacement.start) + replacement.code + output.slice(replacement.end);
|
|
44
|
+
}
|
|
45
|
+
if (!hasModuleDirective(output, "use server")) {
|
|
46
|
+
output = `"use server";\n${output}`;
|
|
47
|
+
}
|
|
48
|
+
return {
|
|
49
|
+
code: output,
|
|
50
|
+
exports: replacements.map((replacement) => replacement.exportName),
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
function isTransformableModule(id) {
|
|
54
|
+
const cleanId = id.split("?", 1)[0];
|
|
55
|
+
return MODULE_EXT_RE.test(cleanId) && !/\.d\.[cm]?ts$/.test(cleanId);
|
|
56
|
+
}
|
|
57
|
+
function findServerFunctionFactoryImportNames(code) {
|
|
58
|
+
const names = new Map();
|
|
59
|
+
for (const match of code.matchAll(SERVER_FUNCTION_FACTORY_IMPORT_RE)) {
|
|
60
|
+
const importClause = match[1] ?? "";
|
|
61
|
+
const namedStart = importClause.indexOf("{");
|
|
62
|
+
const namedEnd = importClause.lastIndexOf("}");
|
|
63
|
+
if (namedStart === -1 || namedEnd === -1 || namedEnd <= namedStart)
|
|
64
|
+
continue;
|
|
65
|
+
const namedImports = importClause.slice(namedStart + 1, namedEnd).split(",");
|
|
66
|
+
for (const specifier of namedImports) {
|
|
67
|
+
const normalized = specifier.trim().replace(/^type\s+/, "");
|
|
68
|
+
const specifierMatch = normalized.match(/^(createServerFn|createServerQuery)(?:\s+as\s+([A-Za-z_$][\w$]*))?$/);
|
|
69
|
+
if (specifierMatch) {
|
|
70
|
+
const factory = specifierMatch[1];
|
|
71
|
+
names.set(specifierMatch[2] ?? factory, factory === "createServerFn" ? "fn" : "query");
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
return names;
|
|
76
|
+
}
|
|
77
|
+
function findServerFnReExport(code, factoryNames) {
|
|
78
|
+
// Comments and string contents must not hide or fake an export: a comment
|
|
79
|
+
// inside `export { /* … */ save }` previously made the specifier unparsable
|
|
80
|
+
// and the module shipped untransformed.
|
|
81
|
+
const scannable = stripCommentsAndStrings(code);
|
|
82
|
+
const declarations = new Map();
|
|
83
|
+
for (const match of scannable.matchAll(SERVER_FUNCTION_DECLARATION_RE)) {
|
|
84
|
+
const localName = match[1];
|
|
85
|
+
const factoryName = match[2];
|
|
86
|
+
const factory = factoryName ? factoryNames.get(factoryName) : undefined;
|
|
87
|
+
if (localName && factory)
|
|
88
|
+
declarations.set(localName, factory);
|
|
89
|
+
}
|
|
90
|
+
if (declarations.size === 0)
|
|
91
|
+
return null;
|
|
92
|
+
for (const match of scannable.matchAll(LOCAL_EXPORT_CLAUSE_RE)) {
|
|
93
|
+
const clause = match[1] ?? "";
|
|
94
|
+
const clauseEnd = (match.index ?? 0) + match[0].length;
|
|
95
|
+
if (scannable.slice(clauseEnd).trimStart().startsWith("from"))
|
|
96
|
+
continue;
|
|
97
|
+
for (const specifier of clause.split(",")) {
|
|
98
|
+
const parts = specifier.trim().split(/\s+as\s+/);
|
|
99
|
+
const localName = parts[0]?.trim();
|
|
100
|
+
if (!localName || !declarations.has(localName))
|
|
101
|
+
continue;
|
|
102
|
+
return {
|
|
103
|
+
localName,
|
|
104
|
+
exportName: parts[1]?.trim() || localName,
|
|
105
|
+
factory: declarations.get(localName),
|
|
106
|
+
form: "clause",
|
|
107
|
+
};
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
// `export default save;` — the export-default replacement only recognizes a
|
|
111
|
+
// direct factory call, so a bare identifier slipped through untransformed.
|
|
112
|
+
for (const match of scannable.matchAll(EXPORT_DEFAULT_ALIAS_RE)) {
|
|
113
|
+
const localName = match[1];
|
|
114
|
+
if (!localName || !declarations.has(localName))
|
|
115
|
+
continue;
|
|
116
|
+
return {
|
|
117
|
+
localName,
|
|
118
|
+
exportName: "default",
|
|
119
|
+
factory: declarations.get(localName),
|
|
120
|
+
form: "default",
|
|
121
|
+
};
|
|
122
|
+
}
|
|
123
|
+
// `export const persist = save;` — same escape through a renamed binding.
|
|
124
|
+
for (const match of scannable.matchAll(EXPORT_BINDING_ALIAS_RE)) {
|
|
125
|
+
const exportName = match[1];
|
|
126
|
+
const localName = match[2];
|
|
127
|
+
if (!exportName || !localName || !declarations.has(localName))
|
|
128
|
+
continue;
|
|
129
|
+
return {
|
|
130
|
+
localName,
|
|
131
|
+
exportName,
|
|
132
|
+
factory: declarations.get(localName),
|
|
133
|
+
form: "binding",
|
|
134
|
+
};
|
|
135
|
+
}
|
|
136
|
+
return null;
|
|
137
|
+
}
|
|
138
|
+
/**
|
|
139
|
+
* Blank out comments and string/template contents, preserving length, so the
|
|
140
|
+
* export scans above see only real syntax. Quotes themselves are kept; the
|
|
141
|
+
* characters between them become spaces.
|
|
142
|
+
*/
|
|
143
|
+
function stripCommentsAndStrings(code) {
|
|
144
|
+
const output = code.split("");
|
|
145
|
+
let quote = null;
|
|
146
|
+
let lineComment = false;
|
|
147
|
+
let blockComment = false;
|
|
148
|
+
let escaped = false;
|
|
149
|
+
for (let index = 0; index < code.length; index++) {
|
|
150
|
+
const char = code[index];
|
|
151
|
+
const next = code[index + 1];
|
|
152
|
+
if (lineComment) {
|
|
153
|
+
if (char === "\n" || char === "\r")
|
|
154
|
+
lineComment = false;
|
|
155
|
+
else
|
|
156
|
+
output[index] = " ";
|
|
157
|
+
continue;
|
|
158
|
+
}
|
|
159
|
+
if (blockComment) {
|
|
160
|
+
if (char === "*" && next === "/") {
|
|
161
|
+
blockComment = false;
|
|
162
|
+
output[index] = " ";
|
|
163
|
+
output[index + 1] = " ";
|
|
164
|
+
index++;
|
|
165
|
+
}
|
|
166
|
+
else if (char !== "\n") {
|
|
167
|
+
output[index] = " ";
|
|
168
|
+
}
|
|
169
|
+
continue;
|
|
170
|
+
}
|
|
171
|
+
if (quote) {
|
|
172
|
+
if (escaped) {
|
|
173
|
+
escaped = false;
|
|
174
|
+
output[index] = " ";
|
|
175
|
+
continue;
|
|
176
|
+
}
|
|
177
|
+
if (char === "\\") {
|
|
178
|
+
escaped = true;
|
|
179
|
+
output[index] = " ";
|
|
180
|
+
continue;
|
|
181
|
+
}
|
|
182
|
+
if (char === quote) {
|
|
183
|
+
quote = null;
|
|
184
|
+
continue;
|
|
185
|
+
}
|
|
186
|
+
if (char !== "\n")
|
|
187
|
+
output[index] = " ";
|
|
188
|
+
continue;
|
|
189
|
+
}
|
|
190
|
+
if (char === "/" && next === "/") {
|
|
191
|
+
lineComment = true;
|
|
192
|
+
output[index] = " ";
|
|
193
|
+
continue;
|
|
194
|
+
}
|
|
195
|
+
if (char === "/" && next === "*") {
|
|
196
|
+
blockComment = true;
|
|
197
|
+
output[index] = " ";
|
|
198
|
+
continue;
|
|
199
|
+
}
|
|
200
|
+
if (char === "'" || char === '"' || char === "`") {
|
|
201
|
+
quote = char;
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
return output.join("");
|
|
205
|
+
}
|
|
206
|
+
function findServerFnExportReplacements(code, factoryNames) {
|
|
207
|
+
const replacements = [];
|
|
208
|
+
for (const match of code.matchAll(EXPORT_SERVER_FUNCTION_FACTORY_RE)) {
|
|
209
|
+
const exportName = match[1];
|
|
210
|
+
const calleeName = match[2];
|
|
211
|
+
const factory = calleeName ? factoryNames.get(calleeName) : undefined;
|
|
212
|
+
if (!exportName || !calleeName || !factory)
|
|
213
|
+
continue;
|
|
214
|
+
const openParenIndex = (match.index ?? 0) + match[0].length - 1;
|
|
215
|
+
const callEnd = findMatchingParen(code, openParenIndex);
|
|
216
|
+
if (callEnd === -1)
|
|
217
|
+
continue;
|
|
218
|
+
let declarationEnd = callEnd + 1;
|
|
219
|
+
while (/\s/.test(code[declarationEnd] ?? ""))
|
|
220
|
+
declarationEnd++;
|
|
221
|
+
if (code[declarationEnd] === ";")
|
|
222
|
+
declarationEnd++;
|
|
223
|
+
const calleeIndex = code.indexOf(calleeName, match.index);
|
|
224
|
+
const callExpression = code.slice(calleeIndex, callEnd + 1);
|
|
225
|
+
const privateName = `$$farm_server_${factory}_${exportName}`;
|
|
226
|
+
replacements.push({
|
|
227
|
+
start: match.index ?? 0,
|
|
228
|
+
end: declarationEnd,
|
|
229
|
+
exportName,
|
|
230
|
+
code: `const ${privateName} = ${callExpression};\nexport async function ${exportName}(input) {\n return ${privateName}(input);\n}\n${copyServerFunctionDescriptor(exportName, privateName)}`,
|
|
231
|
+
});
|
|
232
|
+
}
|
|
233
|
+
// `export default createServerFn(...)` needs the same treatment. Without it the
|
|
234
|
+
// module gets no "use server" directive and its handler ships to the client.
|
|
235
|
+
for (const match of code.matchAll(EXPORT_DEFAULT_SERVER_FUNCTION_FACTORY_RE)) {
|
|
236
|
+
const calleeName = match[1];
|
|
237
|
+
const factory = calleeName ? factoryNames.get(calleeName) : undefined;
|
|
238
|
+
if (!calleeName || !factory)
|
|
239
|
+
continue;
|
|
240
|
+
const openParenIndex = (match.index ?? 0) + match[0].length - 1;
|
|
241
|
+
const callEnd = findMatchingParen(code, openParenIndex);
|
|
242
|
+
if (callEnd === -1)
|
|
243
|
+
continue;
|
|
244
|
+
let declarationEnd = callEnd + 1;
|
|
245
|
+
while (/\s/.test(code[declarationEnd] ?? ""))
|
|
246
|
+
declarationEnd++;
|
|
247
|
+
if (code[declarationEnd] === ";")
|
|
248
|
+
declarationEnd++;
|
|
249
|
+
const calleeIndex = code.indexOf(calleeName, match.index);
|
|
250
|
+
const callExpression = code.slice(calleeIndex, callEnd + 1);
|
|
251
|
+
const privateName = `$$farm_server_${factory}_default`;
|
|
252
|
+
replacements.push({
|
|
253
|
+
start: match.index ?? 0,
|
|
254
|
+
end: declarationEnd,
|
|
255
|
+
exportName: "default",
|
|
256
|
+
code: `const ${privateName} = ${callExpression};\nexport default async function ${privateName}_export(input) {\n return ${privateName}(input);\n}\n${copyServerFunctionDescriptor(`${privateName}_export`, privateName)}`,
|
|
257
|
+
});
|
|
258
|
+
}
|
|
259
|
+
return replacements;
|
|
260
|
+
}
|
|
261
|
+
/**
|
|
262
|
+
* The exported wrapper replaces the factory's function, so it would lose the internal descriptor
|
|
263
|
+
* that MCP and other non-browser callers read. Copy only that descriptor: the other server
|
|
264
|
+
* function markers stay on the private binding, as before.
|
|
265
|
+
*/
|
|
266
|
+
function copyServerFunctionDescriptor(target, source) {
|
|
267
|
+
const key = 'Symbol.for("farm.server-function.descriptor")';
|
|
268
|
+
return `Object.defineProperty(${target}, ${key}, { value: ${source}[${key}] });`;
|
|
269
|
+
}
|
|
270
|
+
function hasModuleDirective(code, directive) {
|
|
271
|
+
for (const match of code.matchAll(DECLARATION_RE)) {
|
|
272
|
+
const value = match[2];
|
|
273
|
+
if (value === directive)
|
|
274
|
+
return true;
|
|
275
|
+
if (value !== "use strict" && value !== "use client" && value !== "use server")
|
|
276
|
+
return false;
|
|
277
|
+
}
|
|
278
|
+
return false;
|
|
279
|
+
}
|
|
280
|
+
function findMatchingParen(code, openParenIndex) {
|
|
281
|
+
let depth = 0;
|
|
282
|
+
let quote = null;
|
|
283
|
+
let lineComment = false;
|
|
284
|
+
let blockComment = false;
|
|
285
|
+
let escaped = false;
|
|
286
|
+
for (let index = openParenIndex; index < code.length; index++) {
|
|
287
|
+
const char = code[index];
|
|
288
|
+
const next = code[index + 1];
|
|
289
|
+
if (lineComment) {
|
|
290
|
+
if (char === "\n" || char === "\r")
|
|
291
|
+
lineComment = false;
|
|
292
|
+
continue;
|
|
293
|
+
}
|
|
294
|
+
if (blockComment) {
|
|
295
|
+
if (char === "*" && next === "/") {
|
|
296
|
+
blockComment = false;
|
|
297
|
+
index++;
|
|
298
|
+
}
|
|
299
|
+
continue;
|
|
300
|
+
}
|
|
301
|
+
if (quote) {
|
|
302
|
+
if (escaped) {
|
|
303
|
+
escaped = false;
|
|
304
|
+
continue;
|
|
305
|
+
}
|
|
306
|
+
if (char === "\\") {
|
|
307
|
+
escaped = true;
|
|
308
|
+
continue;
|
|
309
|
+
}
|
|
310
|
+
if (char === quote) {
|
|
311
|
+
quote = null;
|
|
312
|
+
}
|
|
313
|
+
continue;
|
|
314
|
+
}
|
|
315
|
+
if (char === "/" && next === "/") {
|
|
316
|
+
lineComment = true;
|
|
317
|
+
index++;
|
|
318
|
+
continue;
|
|
319
|
+
}
|
|
320
|
+
if (char === "/" && next === "*") {
|
|
321
|
+
blockComment = true;
|
|
322
|
+
index++;
|
|
323
|
+
continue;
|
|
324
|
+
}
|
|
325
|
+
if (char === "'" || char === '"' || char === "`") {
|
|
326
|
+
quote = char;
|
|
327
|
+
continue;
|
|
328
|
+
}
|
|
329
|
+
if (char === "(")
|
|
330
|
+
depth++;
|
|
331
|
+
if (char === ")") {
|
|
332
|
+
depth--;
|
|
333
|
+
if (depth === 0)
|
|
334
|
+
return index;
|
|
335
|
+
}
|
|
336
|
+
}
|
|
337
|
+
return -1;
|
|
338
|
+
}
|
package/dist/rsc/types.d.ts
CHANGED
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import type { FarmMarkdownResolvedConfig } from "@farm.js/core/markdown";
|
|
2
|
-
import type { ResolvedFarmLlmsTxtConfig } from "@farm.js/core/internal/production-runtime";
|
|
3
1
|
import type { ResolvedFarmI18nConfig } from "@farm.js/core/i18n";
|
|
4
2
|
import type { FarmServerActionsConfig, ResolvedFarmServerActionsConfig } from "@farm.js/core/server-action-security";
|
|
5
3
|
/**
|
|
@@ -69,26 +67,6 @@ export interface EntryContext {
|
|
|
69
67
|
base: string;
|
|
70
68
|
glob: string;
|
|
71
69
|
}>;
|
|
72
|
-
/**
|
|
73
|
-
* Route-relative keys of the layouts that render the `<html>` document themselves
|
|
74
|
-
* (`/layout.tsx`). Below such a root layout the app owns the document, as in Next.js.
|
|
75
|
-
*/
|
|
76
|
-
documentLayouts?: string[];
|
|
77
|
-
/**
|
|
78
|
-
* Route-relative page keys to their parsed rendering directive (`"use ssg"`) and whether the
|
|
79
|
-
* page's source reads request state. The prerender pass merges these with module exports.
|
|
80
|
-
*/
|
|
81
|
-
pageRenderingDirectives?: Record<string, unknown>;
|
|
82
|
-
/**
|
|
83
|
-
* The resolved `images` config, its public half for `<Image>`, and the optimizer the server
|
|
84
|
-
* mounts at `images.path` (`none` when Image keeps original URLs).
|
|
85
|
-
*/
|
|
86
|
-
images?: {
|
|
87
|
-
config: unknown;
|
|
88
|
-
public: unknown;
|
|
89
|
-
path: string;
|
|
90
|
-
runtime: "none" | "node" | "cloudflare";
|
|
91
|
-
};
|
|
92
70
|
/** Whether server actions are enabled */
|
|
93
71
|
actionsEnabled: boolean;
|
|
94
72
|
/** Normalized server action request security policy. */
|
|
@@ -114,12 +92,6 @@ export interface EntryContext {
|
|
|
114
92
|
* Farm's normal config merge order.
|
|
115
93
|
*/
|
|
116
94
|
middlewareConfigPaths?: string[];
|
|
117
|
-
/** Modules that export `{ mcp }`, read from the app's config files, in layer order. */
|
|
118
|
-
mcpConfigPaths?: string[];
|
|
119
|
-
/** Resolved Markdown mirror settings (core's `md`): `.md` pages and `Accept: text/markdown`. */
|
|
120
|
-
markdown?: FarmMarkdownResolvedConfig;
|
|
121
|
-
/** Resolved `agent.llmsTxt`: the generated `/llms.txt` and `/llms-full.txt`. */
|
|
122
|
-
llmsTxt?: ResolvedFarmLlmsTxtConfig;
|
|
123
95
|
/** Whether debug mode is enabled */
|
|
124
96
|
debug: boolean;
|
|
125
97
|
/** True only for the Vite serve command, never for a production build. */
|
package/dist/rsc/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/rsc/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/rsc/types.ts"],"names":[],"mappings":"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"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"vite-plugin-nitro.d.ts","sourceRoot":"","sources":["../../src/rsc/vite-plugin-nitro.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AAEH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,MAAM,CAAC;AAenC,MAAM,WAAW,kBAAkB;IACjC,MAAM,CAAC,EAAE;QACP,eAAe,CAAC,EAAE,MAAM,CAAC;QACzB,4DAA4D;QAC5D,SAAS,CAAC,EAAE,MAAM,CAAC;KACpB,CAAC;IACF,MAAM,CAAC,EAAE;QACP,MAAM,CAAC,EAAE,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"vite-plugin-nitro.d.ts","sourceRoot":"","sources":["../../src/rsc/vite-plugin-nitro.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AAEH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,MAAM,CAAC;AAenC,MAAM,WAAW,kBAAkB;IACjC,MAAM,CAAC,EAAE;QACP,eAAe,CAAC,EAAE,MAAM,CAAC;QACzB,4DAA4D;QAC5D,SAAS,CAAC,EAAE,MAAM,CAAC;KACpB,CAAC;IACF,MAAM,CAAC,EAAE;QACP,MAAM,CAAC,EAAE,MAAM,CAAC;KACjB,CAAC;IACF,kEAAkE;IAClE,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAID,MAAM,CAAC,OAAO,UAAU,KAAK,CAAC,OAAO,GAAE,kBAAuB,GAAG,MAAM,CAqEtE;AAED,kFAAkF;AAClF,wBAAsB,oBAAoB,IAAI,OAAO,CAAC,IAAI,CAAC,CAkC1D"}
|
|
@@ -48,18 +48,10 @@ export default function nitro(options = {}) {
|
|
|
48
48
|
delete globalThis.__FARM_NITRO_SERVER_BUNDLE;
|
|
49
49
|
delete globalThis.__FARM_NITRO_PATHS;
|
|
50
50
|
delete globalThis.__FARM_NITRO_BUILD_PROMISE;
|
|
51
|
-
// The server entries are always index.js, which the Nitro step loads: Vite names an ESM
|
|
52
|
-
// server entry index.mjs when the app's package.json is not "type": "module". The Nitro
|
|
53
|
-
// output's package.json is "type": "module", so .js loads as ESM there.
|
|
54
|
-
const serverOutput = { output: { entryFileNames: "[name].js" } };
|
|
55
51
|
return {
|
|
56
52
|
environments: {
|
|
57
|
-
rsc: {
|
|
58
|
-
|
|
59
|
-
},
|
|
60
|
-
ssr: {
|
|
61
|
-
build: { outDir: path.join(NITRO_VITE_DIST, "ssr"), rolldownOptions: serverOutput },
|
|
62
|
-
},
|
|
53
|
+
rsc: { build: { outDir: path.join(NITRO_VITE_DIST, "rsc") } },
|
|
54
|
+
ssr: { build: { outDir: path.join(NITRO_VITE_DIST, "ssr") } },
|
|
63
55
|
client: { build: { outDir: path.join(NITRO_VITE_DIST, "client") } },
|
|
64
56
|
},
|
|
65
57
|
};
|
|
@@ -96,7 +88,6 @@ export default function nitro(options = {}) {
|
|
|
96
88
|
clientOutDir,
|
|
97
89
|
serverEntryName,
|
|
98
90
|
preset: options.config?.preset ?? process.env.NITRO_PRESET ?? "vercel",
|
|
99
|
-
outputDir: options.config?.outputDir,
|
|
100
91
|
clientAssetsDir,
|
|
101
92
|
};
|
|
102
93
|
}
|
|
@@ -153,6 +144,5 @@ async function runCapturedNitroBuild(paths, bundle) {
|
|
|
153
144
|
ssrPath: resolveRscBuildOutputPath(root, paths.ssrOutDir, "index.js"),
|
|
154
145
|
assetsDir: paths.clientAssetsDir ?? "assets",
|
|
155
146
|
preset,
|
|
156
|
-
outputDir: paths.outputDir,
|
|
157
147
|
});
|
|
158
148
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@farm.js/plugin",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.61",
|
|
4
4
|
"description": "Official plugins for Farm.js framework",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Farm.js Team",
|
|
@@ -63,7 +63,7 @@
|
|
|
63
63
|
"nitro": "3.0.260903-beta",
|
|
64
64
|
"picocolors": "^1.0.0",
|
|
65
65
|
"rsc-html-stream": "^0.0.4",
|
|
66
|
-
"@farm.js/core": "0.1.
|
|
66
|
+
"@farm.js/core": "0.1.61"
|
|
67
67
|
},
|
|
68
68
|
"devDependencies": {
|
|
69
69
|
"@types/node": "^22.20.5",
|
|
@@ -84,7 +84,7 @@
|
|
|
84
84
|
"react-dom": "19.2.8",
|
|
85
85
|
"react-server-dom-webpack": "19.2.8",
|
|
86
86
|
"vite": ">=6.0.0",
|
|
87
|
-
"@farm.js/core": "0.1.
|
|
87
|
+
"@farm.js/core": "0.1.61"
|
|
88
88
|
},
|
|
89
89
|
"peerDependenciesMeta": {
|
|
90
90
|
"@vitejs/plugin-rsc": {
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import type { Plugin } from "vite";
|
|
2
|
-
/** Where an RSC build keeps client source maps, beside (not inside) the public client output. */
|
|
3
|
-
export declare const RSC_CLIENT_SOURCEMAPS_DIR = "client-sourcemaps";
|
|
4
|
-
/**
|
|
5
|
-
* Keep the client environment's source maps out of the public output, as core
|
|
6
|
-
* client builds do. A client map carries the original source of every module
|
|
7
|
-
* in a chunk, including code stripped from the client JS, such as
|
|
8
|
-
* `createServerOnlyFn` bodies. Any enabled `build.sourcemap` becomes
|
|
9
|
-
* `"hidden"` (the JS names no map), and the maps are moved beside the client
|
|
10
|
-
* output.
|
|
11
|
-
*/
|
|
12
|
-
export declare function rscPrivateClientSourcemaps(environmentName?: string): Plugin;
|
|
13
|
-
//# sourceMappingURL=client-sourcemaps.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"client-sourcemaps.d.ts","sourceRoot":"","sources":["../../src/rsc/client-sourcemaps.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,MAAM,CAAC;AAEnC,iGAAiG;AACjG,eAAO,MAAM,yBAAyB,sBAAsB,CAAC;AAI7D;;;;;;;GAOG;AACH,wBAAgB,0BAA0B,CAAC,eAAe,SAAW,GAAG,MAAM,CAqC7E"}
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
import fs from "node:fs/promises";
|
|
2
|
-
import path from "node:path";
|
|
3
|
-
/** Where an RSC build keeps client source maps, beside (not inside) the public client output. */
|
|
4
|
-
export const RSC_CLIENT_SOURCEMAPS_DIR = "client-sourcemaps";
|
|
5
|
-
/**
|
|
6
|
-
* Keep the client environment's source maps out of the public output, as core
|
|
7
|
-
* client builds do. A client map carries the original source of every module
|
|
8
|
-
* in a chunk, including code stripped from the client JS, such as
|
|
9
|
-
* `createServerOnlyFn` bodies. Any enabled `build.sourcemap` becomes
|
|
10
|
-
* `"hidden"` (the JS names no map), and the maps are moved beside the client
|
|
11
|
-
* output.
|
|
12
|
-
*/
|
|
13
|
-
export function rscPrivateClientSourcemaps(environmentName = "client") {
|
|
14
|
-
let maps = [];
|
|
15
|
-
let mapsDir;
|
|
16
|
-
const isClient = (environment) => environment?.name === environmentName;
|
|
17
|
-
return {
|
|
18
|
-
name: "@farm.js/plugin/rsc:private-client-sourcemaps",
|
|
19
|
-
enforce: "post",
|
|
20
|
-
apply: "build",
|
|
21
|
-
configEnvironment(name, config) {
|
|
22
|
-
if (name !== environmentName || !config.build?.sourcemap)
|
|
23
|
-
return;
|
|
24
|
-
return { build: { sourcemap: "hidden" } };
|
|
25
|
-
},
|
|
26
|
-
generateBundle(outputOptions, bundle) {
|
|
27
|
-
if (!isClient(this.environment))
|
|
28
|
-
return;
|
|
29
|
-
maps = [];
|
|
30
|
-
mapsDir = outputOptions.dir
|
|
31
|
-
? path.join(path.dirname(outputOptions.dir), RSC_CLIENT_SOURCEMAPS_DIR)
|
|
32
|
-
: undefined;
|
|
33
|
-
for (const [fileName, output] of Object.entries(bundle)) {
|
|
34
|
-
if (output.type !== "asset" || !fileName.endsWith(".map"))
|
|
35
|
-
continue;
|
|
36
|
-
maps.push([fileName, output.source ?? ""]);
|
|
37
|
-
delete bundle[fileName];
|
|
38
|
-
}
|
|
39
|
-
},
|
|
40
|
-
async writeBundle() {
|
|
41
|
-
if (!isClient(this.environment) || !mapsDir)
|
|
42
|
-
return;
|
|
43
|
-
await fs.rm(mapsDir, { recursive: true, force: true });
|
|
44
|
-
for (const [fileName, source] of maps) {
|
|
45
|
-
const target = path.join(mapsDir, fileName);
|
|
46
|
-
await fs.mkdir(path.dirname(target), { recursive: true });
|
|
47
|
-
await fs.writeFile(target, source);
|
|
48
|
-
}
|
|
49
|
-
maps = [];
|
|
50
|
-
},
|
|
51
|
-
};
|
|
52
|
-
}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Whether a layout module renders the whole `<html>` document, following re-exports of its default
|
|
3
|
-
* export a few modules deep (`export { default } from "../site/app/layout"`).
|
|
4
|
-
*/
|
|
5
|
-
export declare function layoutRendersDocument(file: string, depth?: number): Promise<boolean>;
|
|
6
|
-
/**
|
|
7
|
-
* Files below `routesDir` whose name passes `test`, as route-relative keys (`/layout.tsx`,
|
|
8
|
-
* `/(docs)/layout.tsx`): the keys the RSC entry gives its merged route module maps.
|
|
9
|
-
*/
|
|
10
|
-
export declare function findRouteFiles(routesDir: string, test: (name: string) => boolean): Promise<Array<{
|
|
11
|
-
key: string;
|
|
12
|
-
file: string;
|
|
13
|
-
}>>;
|
|
14
|
-
/** The layouts below `routesDir` that render the `<html>` document themselves. */
|
|
15
|
-
export declare function findDocumentLayouts(routesDir: string): Promise<string[]>;
|
|
16
|
-
//# sourceMappingURL=document-layouts.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"document-layouts.d.ts","sourceRoot":"","sources":["../../src/rsc/document-layouts.ts"],"names":[],"mappings":"AA2BA;;;GAGG;AACH,wBAAsB,qBAAqB,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,SAAI,GAAG,OAAO,CAAC,OAAO,CAAC,CAYrF;AAED;;;GAGG;AACH,wBAAsB,cAAc,CAClC,SAAS,EAAE,MAAM,EACjB,IAAI,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,GAC9B,OAAO,CAAC,KAAK,CAAC;IAAE,GAAG,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,CAAC,CAAC,CAuB/C;AAED,kFAAkF;AAClF,wBAAsB,mBAAmB,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,CAI9E"}
|
|
@@ -1,82 +0,0 @@
|
|
|
1
|
-
import { promises as fs } from "node:fs";
|
|
2
|
-
import path from "node:path";
|
|
3
|
-
const LAYOUT_FILE = /^layout\.(tsx|jsx|ts|js)$/;
|
|
4
|
-
const SOURCE_EXTENSIONS = [".tsx", ".ts", ".jsx", ".js"];
|
|
5
|
-
const RENDERS_HTML = /<html[\s>]/;
|
|
6
|
-
// `export { default } from "./x"` and `export { Layout as default } from "./x"`.
|
|
7
|
-
const DEFAULT_REEXPORT = /export\s*\{[^}]*\b(?:default|[\w$]+\s+as\s+default)\b[^}]*\}\s*from\s*["'](\.{1,2}\/[^"']+)["']/;
|
|
8
|
-
async function resolveRelativeModule(fromFile, specifier) {
|
|
9
|
-
const base = path.resolve(path.dirname(fromFile), specifier);
|
|
10
|
-
const candidates = [
|
|
11
|
-
base,
|
|
12
|
-
...SOURCE_EXTENSIONS.map((extension) => base + extension),
|
|
13
|
-
...SOURCE_EXTENSIONS.map((extension) => path.join(base, "index" + extension)),
|
|
14
|
-
];
|
|
15
|
-
for (const candidate of candidates) {
|
|
16
|
-
try {
|
|
17
|
-
if ((await fs.stat(candidate)).isFile())
|
|
18
|
-
return candidate;
|
|
19
|
-
}
|
|
20
|
-
catch {
|
|
21
|
-
// try the next candidate
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
return null;
|
|
25
|
-
}
|
|
26
|
-
/**
|
|
27
|
-
* Whether a layout module renders the whole `<html>` document, following re-exports of its default
|
|
28
|
-
* export a few modules deep (`export { default } from "../site/app/layout"`).
|
|
29
|
-
*/
|
|
30
|
-
export async function layoutRendersDocument(file, depth = 0) {
|
|
31
|
-
let source;
|
|
32
|
-
try {
|
|
33
|
-
source = await fs.readFile(file, "utf8");
|
|
34
|
-
}
|
|
35
|
-
catch {
|
|
36
|
-
return false;
|
|
37
|
-
}
|
|
38
|
-
if (RENDERS_HTML.test(source))
|
|
39
|
-
return true;
|
|
40
|
-
const reexport = DEFAULT_REEXPORT.exec(source);
|
|
41
|
-
if (!reexport || depth >= 4)
|
|
42
|
-
return false;
|
|
43
|
-
const target = await resolveRelativeModule(file, reexport[1]);
|
|
44
|
-
return target ? layoutRendersDocument(target, depth + 1) : false;
|
|
45
|
-
}
|
|
46
|
-
/**
|
|
47
|
-
* Files below `routesDir` whose name passes `test`, as route-relative keys (`/layout.tsx`,
|
|
48
|
-
* `/(docs)/layout.tsx`): the keys the RSC entry gives its merged route module maps.
|
|
49
|
-
*/
|
|
50
|
-
export async function findRouteFiles(routesDir, test) {
|
|
51
|
-
const found = [];
|
|
52
|
-
const walk = async (dir) => {
|
|
53
|
-
let entries;
|
|
54
|
-
try {
|
|
55
|
-
entries = await fs.readdir(dir, { withFileTypes: true });
|
|
56
|
-
}
|
|
57
|
-
catch {
|
|
58
|
-
return;
|
|
59
|
-
}
|
|
60
|
-
for (const entry of entries) {
|
|
61
|
-
const full = path.join(dir, entry.name);
|
|
62
|
-
if (entry.isDirectory()) {
|
|
63
|
-
if (entry.name !== "node_modules" && !entry.name.startsWith("."))
|
|
64
|
-
await walk(full);
|
|
65
|
-
}
|
|
66
|
-
else if (test(entry.name)) {
|
|
67
|
-
found.push({
|
|
68
|
-
key: "/" + path.relative(routesDir, full).split(path.sep).join("/"),
|
|
69
|
-
file: full,
|
|
70
|
-
});
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
};
|
|
74
|
-
await walk(routesDir);
|
|
75
|
-
return found.sort((left, right) => (left.key < right.key ? -1 : left.key > right.key ? 1 : 0));
|
|
76
|
-
}
|
|
77
|
-
/** The layouts below `routesDir` that render the `<html>` document themselves. */
|
|
78
|
-
export async function findDocumentLayouts(routesDir) {
|
|
79
|
-
const layouts = await findRouteFiles(routesDir, (name) => LAYOUT_FILE.test(name));
|
|
80
|
-
const owners = await Promise.all(layouts.map(({ file }) => layoutRendersDocument(file)));
|
|
81
|
-
return layouts.filter((_, index) => owners[index]).map(({ key }) => key);
|
|
82
|
-
}
|