veryfront 0.1.1146 → 0.1.1148
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/esm/deno.js +1 -1
- package/esm/src/agent/runtime/load-skill-tool.d.ts.map +1 -1
- package/esm/src/agent/runtime/load-skill-tool.js +32 -13
- package/esm/src/discovery/import-rewriter.d.ts +1 -1
- package/esm/src/discovery/import-rewriter.d.ts.map +1 -1
- package/esm/src/discovery/import-rewriter.js +6 -0
- package/esm/src/discovery/runtime-modules-bootstrap.js +2 -0
- package/esm/src/modules/server/module-server.d.ts.map +1 -1
- package/esm/src/modules/server/module-server.js +8 -4
- package/esm/src/rendering/ssr-globals/dom-stubs.d.ts +53 -4
- package/esm/src/rendering/ssr-globals/dom-stubs.d.ts.map +1 -1
- package/esm/src/rendering/ssr-globals/dom-stubs.js +61 -2
- package/esm/src/rendering/ssr-globals/index.d.ts +1 -1
- package/esm/src/rendering/ssr-globals/index.d.ts.map +1 -1
- package/esm/src/rendering/ssr-globals/index.js +25 -8
- package/esm/src/routing/api/module-loader/loader.d.ts +4 -0
- package/esm/src/routing/api/module-loader/loader.d.ts.map +1 -1
- package/esm/src/routing/api/module-loader/loader.js +35 -10
- package/esm/src/server/runtime-handler/index.d.ts.map +1 -1
- package/esm/src/server/runtime-handler/index.js +8 -2
- package/esm/src/server/runtime-handler/request-utils.d.ts +2 -0
- package/esm/src/server/runtime-handler/request-utils.d.ts.map +1 -1
- package/esm/src/server/runtime-handler/request-utils.js +5 -0
- package/esm/src/utils/version-constant.d.ts +1 -1
- package/esm/src/utils/version-constant.js +1 -1
- package/package.json +5 -5
package/esm/deno.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"load-skill-tool.d.ts","sourceRoot":"","sources":["../../../../src/src/agent/runtime/load-skill-tool.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,kCAAkC,CAAC;AACpE,OAAO,KAAK,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;AAC3C,MAAM,MAAM,0BAA0B,GAClC,0BAA0B,GAC1B,mCAAmC,GACnC,2BAA2B,CAAC;AA6XhC,sCAAsC;AACtC,wBAAgB,0BAA0B,CACxC,OAAO,EAAE,2BAA2B,GACnC,IAAI,CAAC,yBAAyB,EAAE,0BAA0B,CAAC,CAmE7D"}
|
|
@@ -61,8 +61,8 @@ function buildUnavailableCurrentRunToolsDelegationNote(availableToolNames) {
|
|
|
61
61
|
}
|
|
62
62
|
export const getRuntimeLoadSkillToolInputSchema = defineSchema((v) => v.object({
|
|
63
63
|
skillId: v.string()
|
|
64
|
-
.regex(/^[a-zA-Z0-9_-]
|
|
65
|
-
.describe('The skill ID to load (e.g., "react-components"
|
|
64
|
+
.regex(/^[a-zA-Z0-9_-]+(?:\.md)?$/, 'skillId must contain only letters, numbers, "_" or "-", with an optional lowercase ".md" suffix')
|
|
65
|
+
.describe('The skill ID to load. A lowercase ".md" suffix is accepted when it is the canonical ID or an unambiguous alias (e.g., "react-components" or "react-components.md").'),
|
|
66
66
|
file: v.string().optional().describe("Optional reference file to load. First load the skill with only skillId, then use file only for a reference path listed by that loaded skill."),
|
|
67
67
|
}));
|
|
68
68
|
/** @deprecated Use getRuntimeLoadSkillToolInputSchema() */
|
|
@@ -192,6 +192,25 @@ function getReferenceableLoadedRuntimeSkillIds(options) {
|
|
|
192
192
|
.filter((skillId) => typeof skillId === "string" && skillId.length > 0)),
|
|
193
193
|
].sort();
|
|
194
194
|
}
|
|
195
|
+
function getRuntimeSkillIdInputValues(skillIds, knownSkillIds) {
|
|
196
|
+
const knownSkillIdSet = new Set(knownSkillIds);
|
|
197
|
+
const values = skillIds.flatMap((skillId) => {
|
|
198
|
+
const alias = `${skillId}.md`;
|
|
199
|
+
return skillId.endsWith(".md") || knownSkillIdSet.has(alias) ? [skillId] : [skillId, alias];
|
|
200
|
+
});
|
|
201
|
+
return values;
|
|
202
|
+
}
|
|
203
|
+
function normalizeRuntimeLoadSkillInputSkillId(options, skillId) {
|
|
204
|
+
const knownSkillIds = getKnownRuntimeSkillIds(options);
|
|
205
|
+
if (knownSkillIds?.includes(skillId)) {
|
|
206
|
+
return skillId;
|
|
207
|
+
}
|
|
208
|
+
const aliasTarget = skillId.endsWith(".md") ? skillId.slice(0, -3) : null;
|
|
209
|
+
if (aliasTarget && (!knownSkillIds || knownSkillIds.includes(aliasTarget))) {
|
|
210
|
+
return aliasTarget;
|
|
211
|
+
}
|
|
212
|
+
return skillId;
|
|
213
|
+
}
|
|
195
214
|
function buildRuntimeLoadSkillInputSchema(options) {
|
|
196
215
|
const knownIds = getKnownRuntimeSkillIds(options);
|
|
197
216
|
if (!knownIds || knownIds.length === 0) {
|
|
@@ -205,39 +224,39 @@ function buildRuntimeLoadSkillInputSchema(options) {
|
|
|
205
224
|
const unloadedIds = knownIds.filter((skillId) => !loadedIdSet.has(skillId));
|
|
206
225
|
if (loadedIds.length > 0 && unloadedIds.length === 0 && referenceableLoadedIds.length === 0) {
|
|
207
226
|
const [firstLoaded, ...restLoaded] = loadedIds;
|
|
208
|
-
const loadedEnumValues = [firstLoaded, ...restLoaded];
|
|
227
|
+
const loadedEnumValues = getRuntimeSkillIdInputValues([firstLoaded, ...restLoaded], knownIds);
|
|
209
228
|
return defineSchema((v) => v.object({
|
|
210
|
-
skillId: v.enum(loadedEnumValues).describe(`Already-loaded skill ID with no advertised reference files. Calling load_skill again is a no-op. Loaded skill IDs: ${
|
|
229
|
+
skillId: v.enum(loadedEnumValues).describe(`Already-loaded skill ID with no advertised reference files. Calling load_skill again is a no-op. Loaded skill IDs: ${loadedEnumValues.join(", ")}`),
|
|
211
230
|
}).strict())();
|
|
212
231
|
}
|
|
213
232
|
if (referenceableLoadedIds.length > 0 && unloadedIds.length === 0) {
|
|
214
233
|
const [firstLoaded, ...restLoaded] = referenceableLoadedIds;
|
|
215
|
-
const loadedEnumValues = [firstLoaded, ...restLoaded];
|
|
234
|
+
const loadedEnumValues = getRuntimeSkillIdInputValues([firstLoaded, ...restLoaded], knownIds);
|
|
216
235
|
return defineSchema((v) => v.object({
|
|
217
|
-
skillId: v.enum(loadedEnumValues).describe(`Already-loaded skill ID. Body reloads are not allowed; use this only with file for listed references. Loaded skill IDs: ${
|
|
236
|
+
skillId: v.enum(loadedEnumValues).describe(`Already-loaded skill ID. Body reloads are not allowed; use this only with file for listed references. Loaded skill IDs: ${loadedEnumValues.join(", ")}`),
|
|
218
237
|
file: v.string().describe("Required reference file to load from an already-loaded skill. Do not call load_skill again for the skill body."),
|
|
219
238
|
}))();
|
|
220
239
|
}
|
|
221
240
|
if (referenceableLoadedIds.length > 0) {
|
|
222
241
|
const [firstUnloaded, ...restUnloaded] = unloadedIds;
|
|
223
|
-
const unloadedEnumValues = [firstUnloaded, ...restUnloaded];
|
|
242
|
+
const unloadedEnumValues = getRuntimeSkillIdInputValues([firstUnloaded, ...restUnloaded], knownIds);
|
|
224
243
|
const [firstLoaded, ...restLoaded] = referenceableLoadedIds;
|
|
225
|
-
const loadedEnumValues = [firstLoaded, ...restLoaded];
|
|
244
|
+
const loadedEnumValues = getRuntimeSkillIdInputValues([firstLoaded, ...restLoaded], knownIds);
|
|
226
245
|
return defineSchema((v) => v.union([
|
|
227
246
|
v.object({
|
|
228
|
-
skillId: v.enum(unloadedEnumValues).describe(`Unloaded skill ID to load. Available unloaded skill IDs: ${
|
|
247
|
+
skillId: v.enum(unloadedEnumValues).describe(`Unloaded skill ID to load. Available unloaded skill IDs: ${unloadedEnumValues.join(", ")}`),
|
|
229
248
|
file: v.string().optional().describe("Optional reference file to load. First load the skill with only skillId, then use file only for a reference path listed by that loaded skill."),
|
|
230
249
|
}),
|
|
231
250
|
v.object({
|
|
232
|
-
skillId: v.enum(loadedEnumValues).describe(`Already-loaded skill ID. Body reloads are not allowed; use this only with file for listed references. Loaded skill IDs: ${
|
|
251
|
+
skillId: v.enum(loadedEnumValues).describe(`Already-loaded skill ID. Body reloads are not allowed; use this only with file for listed references. Loaded skill IDs: ${loadedEnumValues.join(", ")}`),
|
|
233
252
|
file: v.string().describe("Required reference file to load from an already-loaded skill. Do not call load_skill again for the skill body."),
|
|
234
253
|
}),
|
|
235
254
|
]))();
|
|
236
255
|
}
|
|
237
256
|
const [first, ...rest] = unloadedIds;
|
|
238
|
-
const enumValues = [first, ...rest];
|
|
257
|
+
const enumValues = getRuntimeSkillIdInputValues([first, ...rest], knownIds);
|
|
239
258
|
return defineSchema((v) => v.object({
|
|
240
|
-
skillId: v.enum(enumValues).describe(`Unloaded skill ID to load. Available unloaded skill IDs: ${
|
|
259
|
+
skillId: v.enum(enumValues).describe(`Unloaded skill ID to load. Available unloaded skill IDs: ${enumValues.join(", ")}`),
|
|
241
260
|
file: v.string().optional().describe("Optional reference file to load. First load the skill with only skillId, then use file only for a reference path listed by that loaded skill."),
|
|
242
261
|
}))();
|
|
243
262
|
}
|
|
@@ -299,7 +318,7 @@ export function createRuntimeLoadSkillTool(options) {
|
|
|
299
318
|
detail: `Tool "load_skill" input validation failed: ${error instanceof Error ? error.message : String(error)}`,
|
|
300
319
|
});
|
|
301
320
|
}
|
|
302
|
-
skillId = parsed.skillId;
|
|
321
|
+
skillId = normalizeRuntimeLoadSkillInputSkillId(options, parsed.skillId);
|
|
303
322
|
file = parsed.file;
|
|
304
323
|
if (file) {
|
|
305
324
|
return await loadRuntimeSkillReferenceFile(options, skillId, file);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { createFileSystem } from "../platform/compat/fs.js";
|
|
2
|
-
export declare const DISCOVERY_GLOBAL_VERYFRONT_MODULES: readonly ["veryfront/agent", "veryfront/tool", "veryfront/platform", "veryfront/prompt", "veryfront/resource", "veryfront/embedding", "veryfront/knowledge", "veryfront/workflow", "veryfront/eval", "veryfront/metrics", "veryfront/schemas", "veryfront/integrations", "veryfront/chat/uploads"];
|
|
2
|
+
export declare const DISCOVERY_GLOBAL_VERYFRONT_MODULES: readonly ["veryfront/agent", "veryfront/tool", "veryfront/platform", "veryfront/prompt", "veryfront/resource", "veryfront/embedding", "veryfront/knowledge", "veryfront/workflow", "veryfront/eval", "veryfront/metrics", "veryfront/schemas", "veryfront/integrations", "veryfront/middleware", "veryfront/chat/uploads"];
|
|
3
3
|
interface DenoRewriteOptions {
|
|
4
4
|
compiled?: boolean;
|
|
5
5
|
resolveSpecifier?: (specifier: string) => string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"import-rewriter.d.ts","sourceRoot":"","sources":["../../../src/src/discovery/import-rewriter.ts"],"names":[],"mappings":"AAUA,OAAO,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAS5D,eAAO,MAAM,kCAAkC,
|
|
1
|
+
{"version":3,"file":"import-rewriter.d.ts","sourceRoot":"","sources":["../../../src/src/discovery/import-rewriter.ts"],"names":[],"mappings":"AAUA,OAAO,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAS5D,eAAO,MAAM,kCAAkC,4TAqBrC,CAAC;AAEX,UAAU,kBAAkB;IAC1B,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,gBAAgB,CAAC,EAAE,CAAC,SAAS,EAAE,MAAM,KAAK,MAAM,CAAC;CAClD;AAwHD;;;;;GAKG;AACH,wBAAgB,cAAc,CAC5B,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE,MAAM,EACf,OAAO,GAAE,kBAAuB,GAC/B,MAAM,CA2BR;AAeD;;;;;GAKG;AACH,wBAAsB,uBAAuB,CAC3C,IAAI,EAAE,MAAM,EACZ,UAAU,EAAE,MAAM,EAClB,EAAE,EAAE,UAAU,CAAC,OAAO,gBAAgB,CAAC,EACvC,OAAO,EAAE,MAAM,GACd,OAAO,CAAC,MAAM,CAAC,CAyQjB"}
|
|
@@ -22,6 +22,12 @@ export const DISCOVERY_GLOBAL_VERYFRONT_MODULES = [
|
|
|
22
22
|
"veryfront/metrics",
|
|
23
23
|
"veryfront/schemas",
|
|
24
24
|
"veryfront/integrations",
|
|
25
|
+
// API-route middleware helpers (`import { MiddlewarePipeline, cors, … } from
|
|
26
|
+
// "veryfront/middleware"`). Without this, a compiled binary cannot register the
|
|
27
|
+
// module, so its per-subpath shim (`_vf_middleware.mjs`) is empty and any API
|
|
28
|
+
// route using the pipeline 500s with "does not provide an export named
|
|
29
|
+
// 'MiddlewarePipeline'". See veryfront-issue-inbox#217.
|
|
30
|
+
"veryfront/middleware",
|
|
25
31
|
// Server-side chat upload route handler (app/api/uploads/route.ts).
|
|
26
32
|
"veryfront/chat/uploads",
|
|
27
33
|
];
|
|
@@ -10,6 +10,7 @@ import * as evalMod from "../eval/index.js";
|
|
|
10
10
|
import * as metricsMod from "../metrics/index.js";
|
|
11
11
|
import * as schemasMod from "../schemas/index.js";
|
|
12
12
|
import * as integrationsMod from "../integrations/index.js";
|
|
13
|
+
import * as middlewareMod from "../middleware/index.js";
|
|
13
14
|
import * as chatUploadsMod from "../chat/upload-handler.js";
|
|
14
15
|
import { registerDiscoveryRuntimeModules } from "./runtime-modules.js";
|
|
15
16
|
registerDiscoveryRuntimeModules({
|
|
@@ -25,5 +26,6 @@ registerDiscoveryRuntimeModules({
|
|
|
25
26
|
"veryfront/metrics": metricsMod,
|
|
26
27
|
"veryfront/schemas": schemasMod,
|
|
27
28
|
"veryfront/integrations": integrationsMod,
|
|
29
|
+
"veryfront/middleware": middlewareMod,
|
|
28
30
|
"veryfront/chat/uploads": chatUploadsMod,
|
|
29
31
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"module-server.d.ts","sourceRoot":"","sources":["../../../../src/src/modules/server/module-server.ts"],"names":[],"mappings":"AAAA,4EAA4E;AAG5E,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,iCAAiC,CAAC;AA4DtE;;;;;;;;;GASG;AACH,eAAO,MAAM,kBAAkB,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAyDrD,CAAC;AAkEF,MAAM,WAAW,mBAAmB;IAClC,yDAAyD;IACzD,SAAS,EAAE,MAAM,CAAC;IAClB,6BAA6B;IAC7B,UAAU,EAAE,MAAM,CAAC;IACnB,sBAAsB;IACtB,OAAO,EAAE,cAAc,CAAC;IACxB,uBAAuB;IACvB,GAAG,CAAC,EAAE,OAAO,CAAC;IACd,+DAA+D;IAC/D,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,gFAAgF;IAChF,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,mDAAmD;IACnD,MAAM,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACvB,uDAAuD;IACvD,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B;;;OAGG;IACH,iBAAiB,CAAC,EAAE,MAAM,EAAE,CAAC;IAC7B,yDAAyD;IACzD,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,sFAAsF;IACtF,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED,sDAAsD;AACtD,wBAAgB,WAAW,CAAC,GAAG,EAAE,OAAO,EAAE,OAAO,EAAE,mBAAmB,GAAG,OAAO,CAAC,QAAQ,CAAC,CA6czF;
|
|
1
|
+
{"version":3,"file":"module-server.d.ts","sourceRoot":"","sources":["../../../../src/src/modules/server/module-server.ts"],"names":[],"mappings":"AAAA,4EAA4E;AAG5E,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,iCAAiC,CAAC;AA4DtE;;;;;;;;;GASG;AACH,eAAO,MAAM,kBAAkB,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAyDrD,CAAC;AAkEF,MAAM,WAAW,mBAAmB;IAClC,yDAAyD;IACzD,SAAS,EAAE,MAAM,CAAC;IAClB,6BAA6B;IAC7B,UAAU,EAAE,MAAM,CAAC;IACnB,sBAAsB;IACtB,OAAO,EAAE,cAAc,CAAC;IACxB,uBAAuB;IACvB,GAAG,CAAC,EAAE,OAAO,CAAC;IACd,+DAA+D;IAC/D,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,gFAAgF;IAChF,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,mDAAmD;IACnD,MAAM,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACvB,uDAAuD;IACvD,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B;;;OAGG;IACH,iBAAiB,CAAC,EAAE,MAAM,EAAE,CAAC;IAC7B,yDAAyD;IACzD,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,sFAAsF;IACtF,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED,sDAAsD;AACtD,wBAAgB,WAAW,CAAC,GAAG,EAAE,OAAO,EAAE,OAAO,EAAE,mBAAmB,GAAG,OAAO,CAAC,QAAQ,CAAC,CA6czF;AA8UD;;;;;GAKG;AACH,wBAAgB,eAAe,CAAC,GAAG,EAAE,OAAO,GAAG,OAAO,CAGrD;AAiBD;;;;GAIG;AACH,wBAAgB,uBAAuB,CAAC,UAAU,EAAE,MAAM,GAAG,MAAM,CA8BlE"}
|
|
@@ -605,16 +605,17 @@ async function findSourceFile(secureFs, projectDir, basePath, context, requested
|
|
|
605
605
|
".ts",
|
|
606
606
|
".jsx",
|
|
607
607
|
".js",
|
|
608
|
+
".mjs", // Already-compiled ESM (e.g. Panda's generated styled-system/*.mjs)
|
|
608
609
|
".mdx",
|
|
609
610
|
".md", // Regular sources
|
|
610
611
|
];
|
|
611
612
|
logger.debug("findSourceFile called", { projectDir, basePath });
|
|
612
|
-
const knownExtMatch = basePath.match(/\.(json|tsx|ts|jsx|js|mdx|md)(\.src)?$/);
|
|
613
|
-
const requestedExtMatch = requestedModulePath.match(/\.(json|tsx|ts|jsx|js|mdx|md)(\.src)?$/);
|
|
613
|
+
const knownExtMatch = basePath.match(/\.(json|tsx|ts|jsx|js|mjs|mdx|md)(\.src)?$/);
|
|
614
|
+
const requestedExtMatch = requestedModulePath.match(/\.(json|tsx|ts|jsx|js|mjs|mdx|md)(\.src)?$/);
|
|
614
615
|
const hasKnownExt = knownExtMatch !== null;
|
|
615
616
|
const requestedExt = requestedExtMatch?.[1] ?? knownExtMatch?.[1] ?? null;
|
|
616
617
|
const rawBasePathWithoutExt = hasKnownExt
|
|
617
|
-
? basePath.replace(/\.(json|tsx|ts|jsx|js|mdx|md)(\.src)?$/, "")
|
|
618
|
+
? basePath.replace(/\.(json|tsx|ts|jsx|js|mjs|mdx|md)(\.src)?$/, "")
|
|
618
619
|
: basePath;
|
|
619
620
|
let basePathWithoutExt = rawBasePathWithoutExt.replace(/^\/+/, "");
|
|
620
621
|
if (basePathWithoutExt.startsWith("_vf_modules/")) {
|
|
@@ -704,9 +705,12 @@ async function findSourceFile(secureFs, projectDir, basePath, context, requested
|
|
|
704
705
|
/* expected: file may not exist at this path */
|
|
705
706
|
}
|
|
706
707
|
}
|
|
707
|
-
const
|
|
708
|
+
const fallbackExtensions = requestedExt !== null && requestedExt !== "json"
|
|
708
709
|
? extensions.filter((ext) => ext !== ".json")
|
|
709
710
|
: extensions;
|
|
711
|
+
const projectLookupExtensions = requestedExt === "mjs"
|
|
712
|
+
? [".mjs", ...fallbackExtensions.filter((ext) => ext !== ".mjs")]
|
|
713
|
+
: fallbackExtensions;
|
|
710
714
|
// Project file lookups (using secureFs which may go through FSAdapter in proxy mode)
|
|
711
715
|
const projectFilePath = await findFirstExistingFile(secureFs, projectLookupExtensions.map((ext) => join(projectDir, basePathWithoutExt + ext)));
|
|
712
716
|
if (projectFilePath) {
|
|
@@ -5,14 +5,41 @@ declare function createClassListStub(): {
|
|
|
5
5
|
contains: () => false;
|
|
6
6
|
toggle: () => false;
|
|
7
7
|
};
|
|
8
|
+
/**
|
|
9
|
+
* `style` stub — a plain bag (so `el.style.color = "red"` works) that also
|
|
10
|
+
* carries the CSSOM methods libraries call during render (`setProperty`,
|
|
11
|
+
* `getPropertyValue`, `removeProperty`). Without these, any lib that sets a CSS
|
|
12
|
+
* custom property while rendering (Floating UI, Radix Presence, vaul) throws
|
|
13
|
+
* "el.style.setProperty is not a function" on the server.
|
|
14
|
+
*/
|
|
15
|
+
declare function createStyleStub(): {
|
|
16
|
+
setProperty: (propertyName?: string, value?: string, priority?: string) => void;
|
|
17
|
+
getPropertyValue: (propertyName?: string) => string;
|
|
18
|
+
removeProperty: (propertyName?: string) => string;
|
|
19
|
+
item: (index?: number) => string;
|
|
20
|
+
cssText: string;
|
|
21
|
+
length: number;
|
|
22
|
+
[key: string]: unknown;
|
|
23
|
+
};
|
|
8
24
|
export declare function createElementStub(): {
|
|
9
|
-
style:
|
|
25
|
+
style: ReturnType<typeof createStyleStub>;
|
|
10
26
|
classList: ReturnType<typeof createClassListStub>;
|
|
11
27
|
dataset: Record<string, unknown>;
|
|
12
28
|
setAttribute: () => void;
|
|
13
29
|
getAttribute: () => null;
|
|
30
|
+
setAttributeNS: () => void;
|
|
31
|
+
getAttributeNS: () => null;
|
|
14
32
|
removeAttribute: () => void;
|
|
15
33
|
hasAttribute: () => false;
|
|
34
|
+
closest: () => null;
|
|
35
|
+
matches: () => false;
|
|
36
|
+
contains: () => false;
|
|
37
|
+
focus: () => void;
|
|
38
|
+
blur: () => void;
|
|
39
|
+
click: () => void;
|
|
40
|
+
scrollIntoView: () => void;
|
|
41
|
+
getClientRects: () => [];
|
|
42
|
+
remove: () => void;
|
|
16
43
|
appendChild: () => void;
|
|
17
44
|
removeChild: () => void;
|
|
18
45
|
insertBefore: () => void;
|
|
@@ -72,9 +99,13 @@ export declare function createDocumentStub(): {
|
|
|
72
99
|
getElementsByName: () => [];
|
|
73
100
|
documentElement: ReturnType<typeof createElementStub>;
|
|
74
101
|
body: ReturnType<typeof createElementStub>;
|
|
75
|
-
head:
|
|
76
|
-
|
|
77
|
-
|
|
102
|
+
head: ReturnType<typeof createElementStub>;
|
|
103
|
+
activeElement: null;
|
|
104
|
+
hidden: false;
|
|
105
|
+
visibilityState: "visible";
|
|
106
|
+
createDocumentFragment: () => ReturnType<typeof createElementStub>;
|
|
107
|
+
createComment: () => {
|
|
108
|
+
textContent: string;
|
|
78
109
|
};
|
|
79
110
|
readyState: "complete";
|
|
80
111
|
cookie: string;
|
|
@@ -204,9 +235,27 @@ export declare function createWindowStub(): {
|
|
|
204
235
|
URLSearchParams: typeof globalThis.URLSearchParams;
|
|
205
236
|
TextEncoder: typeof globalThis.TextEncoder;
|
|
206
237
|
TextDecoder: typeof globalThis.TextDecoder;
|
|
238
|
+
ResizeObserver: ReturnType<typeof createObserverClass>;
|
|
239
|
+
IntersectionObserver: ReturnType<typeof createObserverClass>;
|
|
240
|
+
MutationObserver: ReturnType<typeof createObserverClass>;
|
|
207
241
|
};
|
|
208
242
|
export declare function createElementClass(name: string): {
|
|
209
243
|
new (): object;
|
|
210
244
|
};
|
|
245
|
+
/**
|
|
246
|
+
* Observer stub class for `ResizeObserver` / `IntersectionObserver` /
|
|
247
|
+
* `MutationObserver`. Libraries that construct one eagerly (at module or render
|
|
248
|
+
* scope, not inside an effect) otherwise throw "ResizeObserver is not defined"
|
|
249
|
+
* during SSR. The instance carries the no-op observe/disconnect surface so a
|
|
250
|
+
* lib that also *calls* those during render doesn't crash either.
|
|
251
|
+
*/
|
|
252
|
+
export declare function createObserverClass(name: string): {
|
|
253
|
+
new (callback?: unknown): {
|
|
254
|
+
observe: () => void;
|
|
255
|
+
unobserve: () => void;
|
|
256
|
+
disconnect: () => void;
|
|
257
|
+
takeRecords: () => [];
|
|
258
|
+
};
|
|
259
|
+
};
|
|
211
260
|
export {};
|
|
212
261
|
//# sourceMappingURL=dom-stubs.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dom-stubs.d.ts","sourceRoot":"","sources":["../../../../src/src/rendering/ssr-globals/dom-stubs.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,OAAO,MAAM,wBAAwB,CAAC;AAalD,iBAAS,mBAAmB,IAAI;IAC9B,GAAG,EAAE,MAAM,IAAI,CAAC;IAChB,MAAM,EAAE,MAAM,IAAI,CAAC;IACnB,QAAQ,EAAE,MAAM,KAAK,CAAC;IACtB,MAAM,EAAE,MAAM,KAAK,CAAC;CACrB,CAOA;AAED,
|
|
1
|
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CAAC;KACvB,CAAC;CACH,CAWA"}
|
|
@@ -17,15 +17,43 @@ function createClassListStub() {
|
|
|
17
17
|
toggle: noopFalse,
|
|
18
18
|
};
|
|
19
19
|
}
|
|
20
|
+
/**
|
|
21
|
+
* `style` stub — a plain bag (so `el.style.color = "red"` works) that also
|
|
22
|
+
* carries the CSSOM methods libraries call during render (`setProperty`,
|
|
23
|
+
* `getPropertyValue`, `removeProperty`). Without these, any lib that sets a CSS
|
|
24
|
+
* custom property while rendering (Floating UI, Radix Presence, vaul) throws
|
|
25
|
+
* "el.style.setProperty is not a function" on the server.
|
|
26
|
+
*/
|
|
27
|
+
function createStyleStub() {
|
|
28
|
+
return {
|
|
29
|
+
setProperty: noop,
|
|
30
|
+
getPropertyValue: () => emptyString,
|
|
31
|
+
removeProperty: () => emptyString,
|
|
32
|
+
item: () => emptyString,
|
|
33
|
+
cssText: emptyString,
|
|
34
|
+
length: 0,
|
|
35
|
+
};
|
|
36
|
+
}
|
|
20
37
|
export function createElementStub() {
|
|
21
38
|
return {
|
|
22
|
-
style:
|
|
39
|
+
style: createStyleStub(),
|
|
23
40
|
classList: createClassListStub(),
|
|
24
41
|
dataset: {},
|
|
25
42
|
setAttribute: noop,
|
|
26
43
|
getAttribute: noopNull,
|
|
44
|
+
setAttributeNS: noop,
|
|
45
|
+
getAttributeNS: noopNull,
|
|
27
46
|
removeAttribute: noop,
|
|
28
47
|
hasAttribute: noopFalse,
|
|
48
|
+
closest: noopNull,
|
|
49
|
+
matches: noopFalse,
|
|
50
|
+
contains: noopFalse,
|
|
51
|
+
focus: noop,
|
|
52
|
+
blur: noop,
|
|
53
|
+
click: noop,
|
|
54
|
+
scrollIntoView: noop,
|
|
55
|
+
getClientRects: noopEmptyArray,
|
|
56
|
+
remove: noop,
|
|
29
57
|
appendChild: noop,
|
|
30
58
|
removeChild: noop,
|
|
31
59
|
insertBefore: noop,
|
|
@@ -88,7 +116,16 @@ export function createDocumentStub() {
|
|
|
88
116
|
// helpers) don't crash on a missing `getAttribute`/`setAttribute`.
|
|
89
117
|
documentElement: createElementStub(),
|
|
90
118
|
body: createElementStub(),
|
|
91
|
-
head
|
|
119
|
+
// head gets the full element stub too, so CSS-in-JS libraries (emotion,
|
|
120
|
+
// styled-components, etc.) that insert <style> tags via
|
|
121
|
+
// `document.head.insertBefore(...)` during SSR don't crash on a missing
|
|
122
|
+
// `insertBefore`.
|
|
123
|
+
head: createElementStub(),
|
|
124
|
+
activeElement: null,
|
|
125
|
+
hidden: false,
|
|
126
|
+
visibilityState: "visible",
|
|
127
|
+
createDocumentFragment: createElementStub,
|
|
128
|
+
createComment: () => ({ textContent: emptyString }),
|
|
92
129
|
readyState: "complete",
|
|
93
130
|
cookie: emptyString,
|
|
94
131
|
domain: emptyString,
|
|
@@ -211,6 +248,9 @@ export function createWindowStub() {
|
|
|
211
248
|
URLSearchParams: globalThis.URLSearchParams,
|
|
212
249
|
TextEncoder: globalThis.TextEncoder,
|
|
213
250
|
TextDecoder: globalThis.TextDecoder,
|
|
251
|
+
ResizeObserver: createObserverClass("ResizeObserver"),
|
|
252
|
+
IntersectionObserver: createObserverClass("IntersectionObserver"),
|
|
253
|
+
MutationObserver: createObserverClass("MutationObserver"),
|
|
214
254
|
};
|
|
215
255
|
}
|
|
216
256
|
export function createElementClass(name) {
|
|
@@ -219,3 +259,22 @@ export function createElementClass(name) {
|
|
|
219
259
|
Object.defineProperty(ElementClass, "name", { value: name });
|
|
220
260
|
return ElementClass;
|
|
221
261
|
}
|
|
262
|
+
/**
|
|
263
|
+
* Observer stub class for `ResizeObserver` / `IntersectionObserver` /
|
|
264
|
+
* `MutationObserver`. Libraries that construct one eagerly (at module or render
|
|
265
|
+
* scope, not inside an effect) otherwise throw "ResizeObserver is not defined"
|
|
266
|
+
* during SSR. The instance carries the no-op observe/disconnect surface so a
|
|
267
|
+
* lib that also *calls* those during render doesn't crash either.
|
|
268
|
+
*/
|
|
269
|
+
export function createObserverClass(name) {
|
|
270
|
+
const ObserverClass = class {
|
|
271
|
+
observe() { }
|
|
272
|
+
unobserve() { }
|
|
273
|
+
disconnect() { }
|
|
274
|
+
takeRecords() {
|
|
275
|
+
return [];
|
|
276
|
+
}
|
|
277
|
+
};
|
|
278
|
+
Object.defineProperty(ObserverClass, "name", { value: name });
|
|
279
|
+
return ObserverClass;
|
|
280
|
+
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export { disableSSRClientOnlyFetching, enableSSRClientOnlyFetching, isSSRGlobalsActive, setSSRServerPort, } from "./context.js";
|
|
2
2
|
export { disableSSRFetchInterception, enableSSRFetchInterception } from "./fetch-interceptor.js";
|
|
3
|
-
export { createDocumentStub, createElementClass, createElementStub, createWindowStub, } from "./dom-stubs.js";
|
|
3
|
+
export { createDocumentStub, createElementClass, createElementStub, createObserverClass, createWindowStub, } from "./dom-stubs.js";
|
|
4
4
|
export declare function setupSSRGlobals(): void;
|
|
5
5
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/src/rendering/ssr-globals/index.ts"],"names":[],"mappings":"AAWA,OAAO,EACL,4BAA4B,EAC5B,2BAA2B,EAC3B,kBAAkB,EAClB,gBAAgB,GACjB,MAAM,cAAc,CAAC;AAEtB,OAAO,EAAE,2BAA2B,EAAE,0BAA0B,EAAE,MAAM,wBAAwB,CAAC;AAEjG,OAAO,EACL,kBAAkB,EAClB,kBAAkB,EAClB,iBAAiB,EACjB,gBAAgB,GACjB,MAAM,gBAAgB,CAAC;AAuBxB,wBAAgB,eAAe,IAAI,IAAI,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/src/rendering/ssr-globals/index.ts"],"names":[],"mappings":"AAWA,OAAO,EACL,4BAA4B,EAC5B,2BAA2B,EAC3B,kBAAkB,EAClB,gBAAgB,GACjB,MAAM,cAAc,CAAC;AAEtB,OAAO,EAAE,2BAA2B,EAAE,0BAA0B,EAAE,MAAM,wBAAwB,CAAC;AAEjG,OAAO,EACL,kBAAkB,EAClB,kBAAkB,EAClB,iBAAiB,EACjB,mBAAmB,EACnB,gBAAgB,GACjB,MAAM,gBAAgB,CAAC;AAuBxB,wBAAgB,eAAe,IAAI,IAAI,CAiDtC"}
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
import * as dntShim from "../../../_dnt.shims.js";
|
|
10
10
|
export { disableSSRClientOnlyFetching, enableSSRClientOnlyFetching, isSSRGlobalsActive, setSSRServerPort, } from "./context.js";
|
|
11
11
|
export { disableSSRFetchInterception, enableSSRFetchInterception } from "./fetch-interceptor.js";
|
|
12
|
-
export { createDocumentStub, createElementClass, createElementStub, createWindowStub, } from "./dom-stubs.js";
|
|
12
|
+
export { createDocumentStub, createElementClass, createElementStub, createObserverClass, createWindowStub, } from "./dom-stubs.js";
|
|
13
13
|
import { isSSRGlobalsActive, markSSRGlobalsInitialized } from "./context.js";
|
|
14
14
|
import { createElementClass, createWindowStub } from "./dom-stubs.js";
|
|
15
15
|
function setGlobal(name, value) {
|
|
@@ -36,6 +36,24 @@ export function setupSSRGlobals() {
|
|
|
36
36
|
if (globalThis.window !== undefined && globalThis.document !== undefined)
|
|
37
37
|
return;
|
|
38
38
|
const windowStub = createWindowStub();
|
|
39
|
+
// DOM constructor stubs. Libraries reach these both as bare globals and as
|
|
40
|
+
// properties of `window` / `ownerDocument.defaultView` (e.g. Headless UI's
|
|
41
|
+
// focus manager reads `window.HTMLElement.prototype`). Create them once and
|
|
42
|
+
// expose them in every place a library might look, and wire document.defaultView
|
|
43
|
+
// back to the window stub so `element.ownerDocument.defaultView` resolves.
|
|
44
|
+
const domConstructors = {
|
|
45
|
+
Element: createElementClass("Element"),
|
|
46
|
+
HTMLElement: createElementClass("HTMLElement"),
|
|
47
|
+
SVGElement: createElementClass("SVGElement"),
|
|
48
|
+
Node: createElementClass("Node"),
|
|
49
|
+
Text: createElementClass("Text"),
|
|
50
|
+
Comment: createElementClass("Comment"),
|
|
51
|
+
DocumentFragment: createElementClass("DocumentFragment"),
|
|
52
|
+
};
|
|
53
|
+
for (const [name, ctor] of Object.entries(domConstructors)) {
|
|
54
|
+
windowStub[name] = ctor;
|
|
55
|
+
}
|
|
56
|
+
windowStub.document.defaultView = windowStub;
|
|
39
57
|
setGlobal("window", windowStub);
|
|
40
58
|
setGlobal("document", windowStub.document);
|
|
41
59
|
setGlobal("navigator", windowStub.navigator);
|
|
@@ -49,12 +67,11 @@ export function setupSSRGlobals() {
|
|
|
49
67
|
setGlobal("cancelAnimationFrame", windowStub.cancelAnimationFrame);
|
|
50
68
|
setGlobal("self", windowStub);
|
|
51
69
|
setGlobal("__VERYFRONT_SSR__", true);
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
setGlobalIfMissing("
|
|
56
|
-
setGlobalIfMissing("
|
|
57
|
-
setGlobalIfMissing("
|
|
58
|
-
setGlobalIfMissing("DocumentFragment", createElementClass("DocumentFragment"));
|
|
70
|
+
for (const [name, ctor] of Object.entries(domConstructors)) {
|
|
71
|
+
setGlobalIfMissing(name, ctor);
|
|
72
|
+
}
|
|
73
|
+
setGlobalIfMissing("ResizeObserver", windowStub.ResizeObserver);
|
|
74
|
+
setGlobalIfMissing("IntersectionObserver", windowStub.IntersectionObserver);
|
|
75
|
+
setGlobalIfMissing("MutationObserver", windowStub.MutationObserver);
|
|
59
76
|
markSSRGlobalsInitialized();
|
|
60
77
|
}
|
|
@@ -7,4 +7,8 @@ export declare function loadHandlerModule(options: LoadModuleOptions): Promise<A
|
|
|
7
7
|
* import specifiers, rather than because the module itself is broken.
|
|
8
8
|
*/
|
|
9
9
|
export declare function isSpecifierResolutionError(error: unknown): boolean;
|
|
10
|
+
export declare function getUserDependencies(allDeps: ReadonlyMap<string, string>, runtime: {
|
|
11
|
+
isDeno: boolean;
|
|
12
|
+
isCompiledBinary: boolean;
|
|
13
|
+
}): Map<string, string>;
|
|
10
14
|
//# sourceMappingURL=loader.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"loader.d.ts","sourceRoot":"","sources":["../../../../../src/src/routing/api/module-loader/loader.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,QAAQ,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAkB9D,OAAO,EACL,iCAAiC,EACjC,gCAAgC,EAChC,uBAAuB,EACvB,0BAA0B,EAC1B,2BAA2B,EAC3B,0CAA0C,EAC1C,qCAAqC,EACrC,6BAA6B,EAC7B,+BAA+B,EAC/B,0BAA0B,GAC3B,MAAM,+BAA+B,CAAC;AAIvC,OAAO,EAAE,wBAAwB,EAAE,MAAM,qBAAqB,CAAC;AAE/D,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,iBAAiB,GAAG,OAAO,CAAC,QAAQ,GAAG,IAAI,CAAC,CAyBtF;AA0DD;;;GAGG;AACH,wBAAgB,0BAA0B,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO,CAIlE"}
|
|
1
|
+
{"version":3,"file":"loader.d.ts","sourceRoot":"","sources":["../../../../../src/src/routing/api/module-loader/loader.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,QAAQ,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAkB9D,OAAO,EACL,iCAAiC,EACjC,gCAAgC,EAChC,uBAAuB,EACvB,0BAA0B,EAC1B,2BAA2B,EAC3B,0CAA0C,EAC1C,qCAAqC,EACrC,6BAA6B,EAC7B,+BAA+B,EAC/B,0BAA0B,GAC3B,MAAM,+BAA+B,CAAC;AAIvC,OAAO,EAAE,wBAAwB,EAAE,MAAM,qBAAqB,CAAC;AAE/D,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,iBAAiB,GAAG,OAAO,CAAC,QAAQ,GAAG,IAAI,CAAC,CAyBtF;AA0DD;;;GAGG;AACH,wBAAgB,0BAA0B,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO,CAIlE;AA4bD,wBAAgB,mBAAmB,CACjC,OAAO,EAAE,WAAW,CAAC,MAAM,EAAE,MAAM,CAAC,EACpC,OAAO,EAAE;IAAE,MAAM,EAAE,OAAO,CAAC;IAAC,gBAAgB,EAAE,OAAO,CAAA;CAAE,GACtD,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAYrB"}
|
|
@@ -304,16 +304,26 @@ function loadAndTranspileModule(modulePath, projectDir, adapter, fs, config) {
|
|
|
304
304
|
// Filter out framework-managed packages from user deps. These are already
|
|
305
305
|
// handled by the framework's own external/rewrite logic and should not be
|
|
306
306
|
// treated as user npm packages.
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
307
|
+
//
|
|
308
|
+
// `zod` is kept as a user dep on Node and the Deno source-run so a
|
|
309
|
+
// handler's own `import { z } from "zod"` is rewritten to a resolvable
|
|
310
|
+
// specifier. Excluding it left a bare `import "zod"` in the temp handler
|
|
311
|
+
// that Deno cannot resolve → "not a dependency and not in import map" → 500.
|
|
312
|
+
// (The Node path already always-resolves zod via
|
|
313
|
+
// getNodeExternalPackagesToResolve, so only the Deno source-run was broken
|
|
314
|
+
// by the exclusion.) zod is still force-externalized below, never bundled.
|
|
315
|
+
//
|
|
316
|
+
// The compiled binary keeps zod excluded — this change is scoped to the
|
|
317
|
+
// runtimes where it is verified. The binary loads framework helpers
|
|
318
|
+
// (createValidatedHandler, MiddlewarePipeline, …) through per-subpath
|
|
319
|
+
// veryfront runtime shims written next to the temp handler, a separate and
|
|
320
|
+
// more constrained resolution path; wiring a user `zod` through it belongs
|
|
321
|
+
// in a dedicated change with its own binary coverage. Leaving the binary
|
|
322
|
+
// branch byte-identical to before keeps that path untouched here.
|
|
323
|
+
const userDeps = getUserDependencies(allDeps, {
|
|
324
|
+
isDeno,
|
|
325
|
+
isCompiledBinary: isDeno && isCompiledBinary(),
|
|
326
|
+
});
|
|
317
327
|
// Always externalize user npm dependencies. The bundled handler is loaded
|
|
318
328
|
// from a temp file and user deps are resolved at runtime:
|
|
319
329
|
// - Node.js: via file:// URLs pointing to node_modules
|
|
@@ -409,6 +419,21 @@ async function readFileWithExtensions(adapter, basePath, extensions, projectDir)
|
|
|
409
419
|
message: `File not found: ${basePath}`,
|
|
410
420
|
}));
|
|
411
421
|
}
|
|
422
|
+
export function getUserDependencies(allDeps, runtime) {
|
|
423
|
+
const frameworkPackages = new Set(["veryfront", "react", "react-dom", "path"]);
|
|
424
|
+
if (runtime.isDeno && runtime.isCompiledBinary)
|
|
425
|
+
frameworkPackages.add("zod");
|
|
426
|
+
const frameworkPrefixes = ["@opentelemetry/", "node:", "veryfront/"];
|
|
427
|
+
const userDeps = new Map();
|
|
428
|
+
for (const [name, version] of allDeps) {
|
|
429
|
+
if (frameworkPackages.has(name))
|
|
430
|
+
continue;
|
|
431
|
+
if (frameworkPrefixes.some((prefix) => name.startsWith(prefix)))
|
|
432
|
+
continue;
|
|
433
|
+
userDeps.set(name, version);
|
|
434
|
+
}
|
|
435
|
+
return userDeps;
|
|
436
|
+
}
|
|
412
437
|
async function loadModuleFromCode(code, projectDir, fs, userDeps = new Map()) {
|
|
413
438
|
const tempDir = await fs.makeTempDir({ prefix: "vf-api-" });
|
|
414
439
|
const tempFile = pathHelper.join(tempDir, "handler.mjs");
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/src/server/runtime-handler/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAGH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,iCAAiC,CAAC;AACtE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAG7D,OAAO,EAAE,aAAa,EAAE,MAAM,iCAAiC,CAAC;AAChE,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AAkCpD,OAAO,EAAE,iBAAiB,EAAE,MAAM,kCAA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;IACzB,oFAAoF;IACpF,aAAa,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACvC,sFAAsF;IACtF,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,oFAAoF;IACpF,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,8FAA8F;IAC9F,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,uGAAuG;IACvG,kBAAkB,CAAC,EAAE,SAAS,GAAG,YAAY,CAAC;CAC/C;AAED,wBAAgB,sBAAsB,CACpC,UAAU,EAAE,MAAM,EAClB,OAAO,EAAE,cAAc,EACvB,IAAI,GAAE,qBAAsC,GAC3C,CAAC,CAAC,GAAG,EAAE,OAAO,KAAK,OAAO,CAAC,QAAQ,CAAC,CAAC,GAAG;IAAE,KAAK,CAAC,EAAE,OAAO,CAAC,IAAI,CAAC,CAAA;CAAE,CA4YnE;AAGD,YAAY,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAC3D,OAAO,EAAE,aAAa,EAAE,MAAM,iCAAiC,CAAC;AAChE,OAAO,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAC"}
|
|
@@ -58,7 +58,7 @@ import { checkRequestIsolation, completeIsolatedRequest, completeIsolatedRequest
|
|
|
58
58
|
import { defaultDiscoveryCache } from "./local-project-discovery.js";
|
|
59
59
|
import { buildMinimalContext } from "./handler-context-builder.js";
|
|
60
60
|
import { handleProjectsRequest, shouldHandleProjectsUI } from "./projects-handler.js";
|
|
61
|
-
import { HTTP_GATEWAY_TIMEOUT, isLightweightPath, isMonitoringPath } from "./request-utils.js";
|
|
61
|
+
import { HTTP_GATEWAY_TIMEOUT, isHMRWebSocketUpgrade, isLightweightPath, isMonitoringPath, } from "./request-utils.js";
|
|
62
62
|
import { withRequestTimeout } from "./timeout-manager.js";
|
|
63
63
|
import { EnvironmentVariableCache, fetchProjectEnvVars, filterRuntimeProjectEnv, runWithProjectEnv, } from "../project-env/index.js";
|
|
64
64
|
import { SCANNER_PATH_PATTERN } from "../../utils/constants/security.js";
|
|
@@ -418,7 +418,13 @@ export function createVeryfrontHandler(projectDir, adapter, opts = { projectDir
|
|
|
418
418
|
return errorToRFC9457Response(noHandlerError, ctx, request);
|
|
419
419
|
};
|
|
420
420
|
const { response, error, settled } = await withRequestTimeout((signal) => {
|
|
421
|
-
|
|
421
|
+
// Deno.upgradeWebSocket requires the exact Request received by
|
|
422
|
+
// Deno.serve. Cloning it to attach the timeout signal lets the
|
|
423
|
+
// handshake return 101, but the upgraded connection immediately
|
|
424
|
+
// closes with an unexpected EOF.
|
|
425
|
+
const timeoutRequest = isHMRWebSocketUpgrade(req, url.pathname)
|
|
426
|
+
? req
|
|
427
|
+
: new Request(req, { signal });
|
|
422
428
|
return runWithRequestProfiling({
|
|
423
429
|
category: profileCategory,
|
|
424
430
|
method: req.method,
|
|
@@ -24,6 +24,8 @@ export declare const LIGHTWEIGHT_PATH_PREFIXES: string[];
|
|
|
24
24
|
export declare function isLightweightPath(pathname: string): boolean;
|
|
25
25
|
/** Check if path is the WebSocket endpoint (long-lived, handled by HMR handler) */
|
|
26
26
|
export declare function isWebSocketPath(pathname: string): boolean;
|
|
27
|
+
/** Check whether a request is the exact HMR WebSocket upgrade that must retain native identity. */
|
|
28
|
+
export declare function isHMRWebSocketUpgrade(request: Request, pathname: string): boolean;
|
|
27
29
|
/**
|
|
28
30
|
* Requests that do not need render-specific enriched context.
|
|
29
31
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"request-utils.d.ts","sourceRoot":"","sources":["../../../../src/src/server/runtime-handler/request-utils.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;
|
|
1
|
+
{"version":3,"file":"request-utils.d.ts","sourceRoot":"","sources":["../../../../src/src/server/runtime-handler/request-utils.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAIH,OAAO,EAAE,oBAAoB,EAAE,MAAM,+BAA+B,CAAC;AAErE,qDAAqD;AACrD,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAkBpD;AAED,sDAAsD;AACtD,eAAO,MAAM,gBAAgB,aAA+C,CAAC;AAQ7E,yFAAyF;AACzF,wBAAgB,iBAAiB,IAAI,MAAM,CAK1C;AAED,OAAO,EAAE,oBAAoB,EAAE,CAAC;AAEhC,sEAAsE;AACtE,eAAO,MAAM,gBAAgB,eAA4B,CAAC;AAE1D,oFAAoF;AACpF,wBAAgB,gBAAgB,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAE1D;AAED,uFAAuF;AACvF,eAAO,MAAM,yBAAyB,UASrC,CAAC;AAEF,mFAAmF;AACnF,wBAAgB,iBAAiB,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAE3D;AAED,mFAAmF;AACnF,wBAAgB,eAAe,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAEzD;AAED,mGAAmG;AACnG,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,GAAG,OAAO,CAEjF;AAED;;;;;GAKG;AACH,wBAAgB,yBAAyB,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAEnE"}
|
|
@@ -7,6 +7,7 @@
|
|
|
7
7
|
* @module server/runtime-handler/request-utils
|
|
8
8
|
*/
|
|
9
9
|
import { getTimeoutFromEnv } from "../../middleware/builtin/timeout.js";
|
|
10
|
+
import { isWebSocketUpgrade } from "../../platform/compat/http/websocket.js";
|
|
10
11
|
import { HTTP_GATEWAY_TIMEOUT } from "../../utils/constants/http.js";
|
|
11
12
|
/** Check if host is a private/internal IP address */
|
|
12
13
|
export function isInternalHost(host) {
|
|
@@ -67,6 +68,10 @@ export function isLightweightPath(pathname) {
|
|
|
67
68
|
export function isWebSocketPath(pathname) {
|
|
68
69
|
return pathname === "/_ws";
|
|
69
70
|
}
|
|
71
|
+
/** Check whether a request is the exact HMR WebSocket upgrade that must retain native identity. */
|
|
72
|
+
export function isHMRWebSocketUpgrade(request, pathname) {
|
|
73
|
+
return isWebSocketPath(pathname) && isWebSocketUpgrade(request);
|
|
74
|
+
}
|
|
70
75
|
/**
|
|
71
76
|
* Requests that do not need render-specific enriched context.
|
|
72
77
|
*
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "veryfront",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.1148",
|
|
4
4
|
"description": "The simplest way to build AI-powered apps",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"react",
|
|
@@ -332,10 +332,10 @@
|
|
|
332
332
|
"@types/react": "19.2.14",
|
|
333
333
|
"@types/react-dom": "19.2.3",
|
|
334
334
|
"ws": "8.21.0",
|
|
335
|
-
"@veryfront/ext-bundler-esbuild": "0.1.
|
|
336
|
-
"@veryfront/ext-content-mdx": "0.1.
|
|
337
|
-
"@veryfront/ext-css-tailwind": "0.1.
|
|
338
|
-
"@veryfront/ext-parser-babel": "0.1.
|
|
335
|
+
"@veryfront/ext-bundler-esbuild": "0.1.1148",
|
|
336
|
+
"@veryfront/ext-content-mdx": "0.1.1148",
|
|
337
|
+
"@veryfront/ext-css-tailwind": "0.1.1148",
|
|
338
|
+
"@veryfront/ext-parser-babel": "0.1.1148"
|
|
339
339
|
},
|
|
340
340
|
"devDependencies": {
|
|
341
341
|
"@types/node": "20.9.0"
|