@veryfront/ext-content-mdx 0.1.1183 → 0.1.1185
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.d.ts +4 -1
- package/esm/deno.js +11 -6
- package/esm/src/extensions/websocket/index.d.ts +3 -0
- package/esm/src/extensions/websocket/index.d.ts.map +1 -0
- package/esm/src/extensions/websocket/index.js +2 -0
- package/esm/src/extensions/websocket/node-websocket-server-provider.d.ts +51 -0
- package/esm/src/extensions/websocket/node-websocket-server-provider.d.ts.map +1 -0
- package/esm/src/extensions/websocket/node-websocket-server-provider.js +146 -0
- package/esm/src/platform/adapters/base.d.ts +17 -0
- package/esm/src/platform/adapters/base.d.ts.map +1 -1
- package/esm/src/platform/adapters/base.js +54 -5
- package/esm/src/platform/compat/path/basic-operations.d.ts +1 -1
- package/esm/src/platform/compat/path/basic-operations.d.ts.map +1 -1
- package/esm/src/platform/compat/path/basic-operations.js +24 -44
- package/esm/src/platform/compat/path/index.d.ts +1 -0
- package/esm/src/platform/compat/path/index.d.ts.map +1 -1
- package/esm/src/platform/compat/path/index.js +1 -0
- package/esm/src/platform/compat/path/parse-format.d.ts.map +1 -1
- package/esm/src/platform/compat/path/parse-format.js +26 -20
- package/esm/src/platform/compat/path/portable.d.ts +16 -0
- package/esm/src/platform/compat/path/portable.d.ts.map +1 -0
- package/esm/src/platform/compat/path/portable.js +307 -0
- package/esm/src/platform/compat/path/posix.d.ts +14 -0
- package/esm/src/platform/compat/path/posix.d.ts.map +1 -0
- package/esm/src/platform/compat/path/posix.js +206 -0
- package/esm/src/platform/compat/path/resolution.d.ts +1 -1
- package/esm/src/platform/compat/path/resolution.d.ts.map +1 -1
- package/esm/src/platform/compat/path/resolution.js +28 -112
- package/esm/src/platform/compat/path/runtime.d.ts +2 -1
- package/esm/src/platform/compat/path/runtime.d.ts.map +1 -1
- package/esm/src/platform/compat/path/runtime.js +5 -0
- package/esm/src/platform/compat/path/types.d.ts +5 -1
- package/esm/src/platform/compat/path/types.d.ts.map +1 -1
- package/esm/src/platform/compat/path/url-conversion.d.ts +10 -0
- package/esm/src/platform/compat/path/url-conversion.d.ts.map +1 -1
- package/esm/src/platform/compat/path/url-conversion.js +63 -41
- package/esm/src/utils/version-constant.d.ts +1 -1
- package/esm/src/utils/version-constant.js +1 -1
- package/package.json +2 -2
package/esm/deno.d.ts
CHANGED
|
@@ -35,6 +35,7 @@ declare namespace _default {
|
|
|
35
35
|
"./channels/invoke": string;
|
|
36
36
|
"./tool": string;
|
|
37
37
|
"./workflow": string;
|
|
38
|
+
"./workflow/blob": string;
|
|
38
39
|
"./workflow/worker": string;
|
|
39
40
|
"./workflow/claude-code": string;
|
|
40
41
|
"./workflow/claude-code/react": string;
|
|
@@ -50,6 +51,7 @@ declare namespace _default {
|
|
|
50
51
|
"./webhook": string;
|
|
51
52
|
"./mcp": string;
|
|
52
53
|
"./middleware": string;
|
|
54
|
+
"./errors": string;
|
|
53
55
|
"./observability": string;
|
|
54
56
|
"./observability/sentry": string;
|
|
55
57
|
"./observability/otlp-setup": string;
|
|
@@ -81,6 +83,7 @@ declare namespace _default {
|
|
|
81
83
|
"./extensions/sandbox": string;
|
|
82
84
|
"./extensions/schema": string;
|
|
83
85
|
"./extensions/observability": string;
|
|
86
|
+
"./extensions/websocket": string;
|
|
84
87
|
"./testing": string;
|
|
85
88
|
"./testing/assert": string;
|
|
86
89
|
"./testing/bdd": string;
|
|
@@ -240,6 +243,7 @@ declare namespace _default {
|
|
|
240
243
|
"#veryfront/trigger/": string;
|
|
241
244
|
"#veryfront/server": string;
|
|
242
245
|
"#veryfront/server/project-env": string;
|
|
246
|
+
"#veryfront/extensions/websocket": string;
|
|
243
247
|
"#veryfront/testing": string;
|
|
244
248
|
"#veryfront/testing/assert": string;
|
|
245
249
|
"#veryfront/testing/bdd": string;
|
|
@@ -323,7 +327,6 @@ declare namespace _default {
|
|
|
323
327
|
"react/jsx-dev-runtime": string;
|
|
324
328
|
"veryfront/schemas": string;
|
|
325
329
|
"veryfront/chat/message-prep": string;
|
|
326
|
-
"#dnt": string;
|
|
327
330
|
};
|
|
328
331
|
export namespace compilerOptions {
|
|
329
332
|
let jsx: string;
|
package/esm/deno.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export default {
|
|
2
2
|
"name": "veryfront",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.1185",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"nodeModulesDir": "auto",
|
|
6
6
|
"minimumDependencyAge": {
|
|
@@ -44,9 +44,12 @@ export default {
|
|
|
44
44
|
"./extensions/ext-llm-google",
|
|
45
45
|
"./extensions/ext-llm-openai",
|
|
46
46
|
"./extensions/ext-auth-jwt",
|
|
47
|
+
"./extensions/ext-blob-gcs",
|
|
48
|
+
"./extensions/ext-blob-s3",
|
|
47
49
|
"./extensions/ext-bundler-esbuild",
|
|
48
50
|
"./extensions/ext-cache-redis",
|
|
49
51
|
"./extensions/ext-css-tailwind",
|
|
52
|
+
"./extensions/ext-node-websocket-ws",
|
|
50
53
|
"./extensions/ext-document-kreuzberg",
|
|
51
54
|
"./extensions/ext-db-sqlite",
|
|
52
55
|
"./extensions/ext-parser-babel",
|
|
@@ -68,8 +71,7 @@ export default {
|
|
|
68
71
|
"data/",
|
|
69
72
|
".deno_cache/",
|
|
70
73
|
"cli/templates/files/",
|
|
71
|
-
"cli/templates/integrations/"
|
|
72
|
-
"extensions/"
|
|
74
|
+
"cli/templates/integrations/"
|
|
73
75
|
],
|
|
74
76
|
"exports": {
|
|
75
77
|
".": "./src/index.ts",
|
|
@@ -96,6 +98,7 @@ export default {
|
|
|
96
98
|
"./channels/invoke": "./src/channels/invoke.ts",
|
|
97
99
|
"./tool": "./src/tool/index.ts",
|
|
98
100
|
"./workflow": "./src/workflow/index.ts",
|
|
101
|
+
"./workflow/blob": "./src/workflow/blob/index.ts",
|
|
99
102
|
"./workflow/worker": "./src/workflow/worker/index.ts",
|
|
100
103
|
"./workflow/claude-code": "./src/workflow/claude-code/index.ts",
|
|
101
104
|
"./workflow/claude-code/react": "./src/workflow/claude-code/react/index.ts",
|
|
@@ -111,6 +114,7 @@ export default {
|
|
|
111
114
|
"./webhook": "./src/webhook/index.ts",
|
|
112
115
|
"./mcp": "./src/mcp/index.ts",
|
|
113
116
|
"./middleware": "./src/middleware/index.ts",
|
|
117
|
+
"./errors": "./src/errors/index.ts",
|
|
114
118
|
"./observability": "./src/observability/index.ts",
|
|
115
119
|
"./observability/sentry": "./src/observability/sentry.ts",
|
|
116
120
|
"./observability/otlp-setup": "./src/observability/tracing/otlp-setup.ts",
|
|
@@ -142,6 +146,7 @@ export default {
|
|
|
142
146
|
"./extensions/sandbox": "./src/extensions/sandbox/index.ts",
|
|
143
147
|
"./extensions/schema": "./src/extensions/schema/index.ts",
|
|
144
148
|
"./extensions/observability": "./src/extensions/observability/index.ts",
|
|
149
|
+
"./extensions/websocket": "./src/extensions/websocket/index.ts",
|
|
145
150
|
"./testing": "./src/testing/index.ts",
|
|
146
151
|
"./testing/assert": "./src/testing/assert.ts",
|
|
147
152
|
"./testing/bdd": "./src/testing/bdd.ts",
|
|
@@ -301,6 +306,7 @@ export default {
|
|
|
301
306
|
"#veryfront/trigger/": "./src/trigger/",
|
|
302
307
|
"#veryfront/server": "./src/server/index.ts",
|
|
303
308
|
"#veryfront/server/project-env": "./src/server/project-env/index.ts",
|
|
309
|
+
"#veryfront/extensions/websocket": "./src/extensions/websocket/index.ts",
|
|
304
310
|
"#veryfront/testing": "./src/testing/index.ts",
|
|
305
311
|
"#veryfront/testing/assert": "./src/testing/assert.ts",
|
|
306
312
|
"#veryfront/testing/bdd": "./src/testing/bdd.ts",
|
|
@@ -383,8 +389,7 @@ export default {
|
|
|
383
389
|
"react/jsx-runtime": "./react/jsx-runtime.ts",
|
|
384
390
|
"react/jsx-dev-runtime": "./react/jsx-dev-runtime.ts",
|
|
385
391
|
"veryfront/schemas": "./src/schemas/index.ts",
|
|
386
|
-
"veryfront/chat/message-prep": "./src/chat/message-prep.ts"
|
|
387
|
-
"#dnt": "jsr:@deno/dnt@0.42.3"
|
|
392
|
+
"veryfront/chat/message-prep": "./src/chat/message-prep.ts"
|
|
388
393
|
},
|
|
389
394
|
"compilerOptions": {
|
|
390
395
|
"jsx": "react-jsx",
|
|
@@ -411,7 +416,7 @@ export default {
|
|
|
411
416
|
"production": "deno task generate && deno run --allow-read --allow-write --allow-net --allow-env --allow-run --allow-sys --unstable-worker-options --unstable-net cli/main.ts serve --mode=production",
|
|
412
417
|
"build:prepare": "deno run -A scripts/build/generate-integrations-module.ts && deno task generate && deno run -A scripts/build/prepare-framework-sources.ts",
|
|
413
418
|
"build": "deno task build:prepare && deno run -A scripts/build/compile-binary.ts --output ./bin/veryfront",
|
|
414
|
-
"build:npm": "deno run -A scripts/build/generate-integrations-module.ts && deno task generate && deno run -A scripts/build/build-npm-dnt.ts",
|
|
419
|
+
"build:npm": "deno run -A scripts/build/generate-integrations-module.ts && deno task generate && deno run --config=scripts/test.deno.json --frozen -A scripts/build/build-npm-dnt.ts",
|
|
415
420
|
"release": "deno run -A scripts/release.ts",
|
|
416
421
|
"test": "deno task generate && DENO_TESTING=1 VF_DISABLE_LRU_INTERVAL=1 SSR_TRANSFORM_PER_PROJECT_LIMIT=0 REVALIDATION_PER_PROJECT_LIMIT=0 NODE_ENV=production LOG_FORMAT=text deno test --preload=src/schemas/_test-setup.ts --no-check --parallel --allow-all '--ignore=tests/e2e,tests/integration/compiled-binary-e2e.test.ts' --unstable-worker-options --unstable-net",
|
|
417
422
|
"test:unit": "deno task generate && DENO_TESTING=1 VF_DISABLE_LRU_INTERVAL=1 SSR_TRANSFORM_PER_PROJECT_LIMIT=0 REVALIDATION_PER_PROJECT_LIMIT=0 NODE_ENV=production LOG_FORMAT=text deno test --preload=src/schemas/_test-setup.ts --no-check --parallel --allow-all --v8-flags=--max-old-space-size=8192 '--ignore=tests,src/workflow/__tests__' --unstable-worker-options --unstable-net $(find src cli -name '*.test.ts*' ! -name '*.integration.test.ts*')",
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
/** Contracts for extension-owned Node.js WebSocket implementations. */
|
|
2
|
+
export { captureNodeWebSocketServer, createNodeWebSocketServerProvider, NODE_WEBSOCKET_SERVER_PROVIDER_MISSING_MESSAGE, NODE_WEBSOCKET_SERVER_PROVIDER_PACKAGE, type NodeWebSocketConnection, type NodeWebSocketMessageData, type NodeWebSocketServer, type NodeWebSocketServerOptions, type NodeWebSocketServerProvider, NodeWebSocketServerProviderName, snapshotNodeWebSocketServerProvider, } from "./node-websocket-server-provider.js";
|
|
3
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/src/extensions/websocket/index.ts"],"names":[],"mappings":"AAAA,uEAAuE;AAEvE,OAAO,EACL,0BAA0B,EAC1B,iCAAiC,EACjC,8CAA8C,EAC9C,sCAAsC,EACtC,KAAK,uBAAuB,EAC5B,KAAK,wBAAwB,EAC7B,KAAK,mBAAmB,EACxB,KAAK,0BAA0B,EAC/B,KAAK,2BAA2B,EAChC,+BAA+B,EAC/B,mCAAmC,GACpC,MAAM,qCAAqC,CAAC"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
/** Contracts for extension-owned Node.js WebSocket implementations. */
|
|
2
|
+
export { captureNodeWebSocketServer, createNodeWebSocketServerProvider, NODE_WEBSOCKET_SERVER_PROVIDER_MISSING_MESSAGE, NODE_WEBSOCKET_SERVER_PROVIDER_PACKAGE, NodeWebSocketServerProviderName, snapshotNodeWebSocketServerProvider, } from "./node-websocket-server-provider.js";
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Dependency-free contract for Node.js WebSocket server implementations.
|
|
3
|
+
*
|
|
4
|
+
* Core owns HTTP upgrade authorization and lifecycle. An explicitly composed
|
|
5
|
+
* extension owns the protocol implementation used to complete an authorized
|
|
6
|
+
* upgrade on an existing Node socket.
|
|
7
|
+
*/
|
|
8
|
+
export declare const NodeWebSocketServerProviderName = "NodeWebSocketServerProvider";
|
|
9
|
+
export declare const NODE_WEBSOCKET_SERVER_PROVIDER_PACKAGE = "@veryfront/ext-node-websocket-ws";
|
|
10
|
+
export declare const NODE_WEBSOCKET_SERVER_PROVIDER_MISSING_MESSAGE = "Node.js WebSocket upgrades require an explicitly enabled @veryfront/ext-node-websocket-ws extension.";
|
|
11
|
+
export type NodeWebSocketMessageData = ArrayBuffer | ArrayBufferView | readonly ArrayBufferView[];
|
|
12
|
+
/** Minimal connection surface consumed by core's runtime-neutral adapter. */
|
|
13
|
+
export interface NodeWebSocketConnection extends EventTarget {
|
|
14
|
+
on(event: "open", listener: () => void): this;
|
|
15
|
+
on(event: "message", listener: (data: NodeWebSocketMessageData, isBinary: boolean) => void): this;
|
|
16
|
+
on(event: "close", listener: (code?: number, reason?: ArrayBufferView | string) => void): this;
|
|
17
|
+
on(event: "error", listener: (error: Error) => void): this;
|
|
18
|
+
send(data: string | ArrayBuffer): void;
|
|
19
|
+
close(code?: number, reason?: string): void;
|
|
20
|
+
terminate?(): void;
|
|
21
|
+
}
|
|
22
|
+
/** Exact no-server options supplied by core for an existing HTTP listener. */
|
|
23
|
+
export interface NodeWebSocketServerOptions {
|
|
24
|
+
readonly noServer: true;
|
|
25
|
+
readonly handleProtocols: (protocols: ReadonlySet<string>, request: object) => string | false;
|
|
26
|
+
}
|
|
27
|
+
/** Minimal server surface used by upgrade and shutdown ownership. */
|
|
28
|
+
export interface NodeWebSocketServer {
|
|
29
|
+
readonly clients?: Iterable<NodeWebSocketConnection>;
|
|
30
|
+
on(event: "headers", listener: (headers: string[], request: unknown) => void): this;
|
|
31
|
+
close(callback?: (error?: Error) => void): void;
|
|
32
|
+
handleUpgrade(request: unknown, socket: unknown, head: unknown, callback: (socket: NodeWebSocketConnection) => void): void;
|
|
33
|
+
emit(event: string, socket: NodeWebSocketConnection, request: unknown): void;
|
|
34
|
+
}
|
|
35
|
+
export interface NodeWebSocketServerProvider {
|
|
36
|
+
readonly createServer: (options: NodeWebSocketServerOptions) => NodeWebSocketServer;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Capture one server instance without retaining mutable method lookups. The
|
|
40
|
+
* underlying implementation remains the receiver because protocol engines
|
|
41
|
+
* legitimately keep mutable transport state on their instance.
|
|
42
|
+
*/
|
|
43
|
+
export declare function captureNodeWebSocketServer(value: unknown): Readonly<NodeWebSocketServer>;
|
|
44
|
+
/**
|
|
45
|
+
* Capture a provider generation without retaining its mutable registration
|
|
46
|
+
* object or invoking extension-owned accessors.
|
|
47
|
+
*/
|
|
48
|
+
export declare function snapshotNodeWebSocketServerProvider(value: unknown): Readonly<NodeWebSocketServerProvider>;
|
|
49
|
+
/** Create immutable registration metadata from a standalone factory. */
|
|
50
|
+
export declare function createNodeWebSocketServerProvider(createServer: (options: NodeWebSocketServerOptions) => NodeWebSocketServer): Readonly<NodeWebSocketServerProvider>;
|
|
51
|
+
//# sourceMappingURL=node-websocket-server-provider.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"node-websocket-server-provider.d.ts","sourceRoot":"","sources":["../../../../src/src/extensions/websocket/node-websocket-server-provider.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAIH,eAAO,MAAM,+BAA+B,gCAAgC,CAAC;AAC7E,eAAO,MAAM,sCAAsC,qCAAqC,CAAC;AACzF,eAAO,MAAM,8CAA8C,yGACsD,CAAC;AAIlH,MAAM,MAAM,wBAAwB,GAChC,WAAW,GACX,eAAe,GACf,SAAS,eAAe,EAAE,CAAC;AAE/B,6EAA6E;AAC7E,MAAM,WAAW,uBAAwB,SAAQ,WAAW;IAC1D,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,IAAI,GAAG,IAAI,CAAC;IAC9C,EAAE,CACA,KAAK,EAAE,SAAS,EAChB,QAAQ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AE,uBAAuB,KAAK,IAAI,GAClD,IAAI,CAAC;IACR,IAAI,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,uBAAuB,EAAE,OAAO,EAAE,OAAO,GAAG,IAAI,CAAC;CAC9E;AAED,MAAM,WAAW,2BAA2B;IAC1C,QAAQ,CAAC,YAAY,EAAE,CACrB,OAAO,EAAE,0BAA0B,KAChC,mBAAmB,CAAC;CAC1B;AAmED;;;;GAIG;AACH,wBAAgB,0BAA0B,CACxC,KAAK,EAAE,OAAO,GACb,QAAQ,CAAC,mBAAmB,CAAC,CAgC/B;AASD;;;GAGG;AACH,wBAAgB,mCAAmC,CACjD,KAAK,EAAE,OAAO,GACb,QAAQ,CAAC,2BAA2B,CAAC,CAqCvC;AAED,wEAAwE;AACxE,wBAAgB,iCAAiC,CAC/C,YAAY,EAAE,CACZ,OAAO,EAAE,0BAA0B,KAChC,mBAAmB,GACvB,QAAQ,CAAC,2BAA2B,CAAC,CAEvC"}
|
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Dependency-free contract for Node.js WebSocket server implementations.
|
|
3
|
+
*
|
|
4
|
+
* Core owns HTTP upgrade authorization and lifecycle. An explicitly composed
|
|
5
|
+
* extension owns the protocol implementation used to complete an authorized
|
|
6
|
+
* upgrade on an existing Node socket.
|
|
7
|
+
*/
|
|
8
|
+
import { types as nodeUtilTypes } from "node:util";
|
|
9
|
+
export const NodeWebSocketServerProviderName = "NodeWebSocketServerProvider";
|
|
10
|
+
export const NODE_WEBSOCKET_SERVER_PROVIDER_PACKAGE = "@veryfront/ext-node-websocket-ws";
|
|
11
|
+
export const NODE_WEBSOCKET_SERVER_PROVIDER_MISSING_MESSAGE = `Node.js WebSocket upgrades require an explicitly enabled ${NODE_WEBSOCKET_SERVER_PROVIDER_PACKAGE} extension.`;
|
|
12
|
+
const isProxy = nodeUtilTypes.isProxy;
|
|
13
|
+
function serverInspectionError(cause) {
|
|
14
|
+
return new TypeError("Node WebSocket server must expose data-function on, close, handleUpgrade, and emit methods", cause === undefined ? undefined : { cause });
|
|
15
|
+
}
|
|
16
|
+
function captureServerMethod(server, name) {
|
|
17
|
+
try {
|
|
18
|
+
let owner = server;
|
|
19
|
+
while (owner !== null) {
|
|
20
|
+
if (isProxy(owner))
|
|
21
|
+
throw serverInspectionError();
|
|
22
|
+
const descriptor = Object.getOwnPropertyDescriptor(owner, name);
|
|
23
|
+
if (descriptor !== undefined) {
|
|
24
|
+
if (!("value" in descriptor) || typeof descriptor.value !== "function") {
|
|
25
|
+
throw serverInspectionError();
|
|
26
|
+
}
|
|
27
|
+
return descriptor.value;
|
|
28
|
+
}
|
|
29
|
+
owner = Object.getPrototypeOf(owner);
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
catch (cause) {
|
|
33
|
+
if (cause instanceof TypeError && cause.message.startsWith("Node WebSocket")) {
|
|
34
|
+
throw cause;
|
|
35
|
+
}
|
|
36
|
+
throw serverInspectionError(cause);
|
|
37
|
+
}
|
|
38
|
+
throw serverInspectionError();
|
|
39
|
+
}
|
|
40
|
+
function captureServerClients(server) {
|
|
41
|
+
try {
|
|
42
|
+
let owner = server;
|
|
43
|
+
while (owner !== null) {
|
|
44
|
+
if (isProxy(owner))
|
|
45
|
+
throw serverInspectionError();
|
|
46
|
+
const descriptor = Object.getOwnPropertyDescriptor(owner, "clients");
|
|
47
|
+
if (descriptor !== undefined) {
|
|
48
|
+
if (!("value" in descriptor))
|
|
49
|
+
throw serverInspectionError();
|
|
50
|
+
const clients = descriptor.value;
|
|
51
|
+
if (clients === undefined)
|
|
52
|
+
return undefined;
|
|
53
|
+
if ((typeof clients !== "object" && typeof clients !== "function") ||
|
|
54
|
+
clients === null || isProxy(clients) ||
|
|
55
|
+
typeof clients[Symbol.iterator] !== "function") {
|
|
56
|
+
throw serverInspectionError();
|
|
57
|
+
}
|
|
58
|
+
return clients;
|
|
59
|
+
}
|
|
60
|
+
owner = Object.getPrototypeOf(owner);
|
|
61
|
+
}
|
|
62
|
+
return undefined;
|
|
63
|
+
}
|
|
64
|
+
catch (cause) {
|
|
65
|
+
if (cause instanceof TypeError && cause.message.startsWith("Node WebSocket")) {
|
|
66
|
+
throw cause;
|
|
67
|
+
}
|
|
68
|
+
throw serverInspectionError(cause);
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* Capture one server instance without retaining mutable method lookups. The
|
|
73
|
+
* underlying implementation remains the receiver because protocol engines
|
|
74
|
+
* legitimately keep mutable transport state on their instance.
|
|
75
|
+
*/
|
|
76
|
+
export function captureNodeWebSocketServer(value) {
|
|
77
|
+
if (typeof value !== "object" || value === null || isProxy(value)) {
|
|
78
|
+
throw serverInspectionError();
|
|
79
|
+
}
|
|
80
|
+
const on = captureServerMethod(value, "on");
|
|
81
|
+
const close = captureServerMethod(value, "close");
|
|
82
|
+
const handleUpgrade = captureServerMethod(value, "handleUpgrade");
|
|
83
|
+
const emit = captureServerMethod(value, "emit");
|
|
84
|
+
const clients = captureServerClients(value);
|
|
85
|
+
const captured = Object.freeze({
|
|
86
|
+
...(clients === undefined ? {} : { clients }),
|
|
87
|
+
on(event, listener) {
|
|
88
|
+
Reflect.apply(on, value, [event, listener]);
|
|
89
|
+
return captured;
|
|
90
|
+
},
|
|
91
|
+
close(callback) {
|
|
92
|
+
Reflect.apply(close, value, callback === undefined ? [] : [callback]);
|
|
93
|
+
},
|
|
94
|
+
handleUpgrade(request, socket, head, callback) {
|
|
95
|
+
Reflect.apply(handleUpgrade, value, [request, socket, head, callback]);
|
|
96
|
+
},
|
|
97
|
+
emit(event, socket, request) {
|
|
98
|
+
Reflect.apply(emit, value, [event, socket, request]);
|
|
99
|
+
},
|
|
100
|
+
});
|
|
101
|
+
return captured;
|
|
102
|
+
}
|
|
103
|
+
function providerInspectionError(cause) {
|
|
104
|
+
return new TypeError("Node WebSocket server provider must be a plain object with one enumerable createServer data property", cause === undefined ? undefined : { cause });
|
|
105
|
+
}
|
|
106
|
+
/**
|
|
107
|
+
* Capture a provider generation without retaining its mutable registration
|
|
108
|
+
* object or invoking extension-owned accessors.
|
|
109
|
+
*/
|
|
110
|
+
export function snapshotNodeWebSocketServerProvider(value) {
|
|
111
|
+
if (typeof value !== "object" || value === null || Array.isArray(value)) {
|
|
112
|
+
throw providerInspectionError();
|
|
113
|
+
}
|
|
114
|
+
let prototype;
|
|
115
|
+
let descriptors;
|
|
116
|
+
try {
|
|
117
|
+
if (isProxy(value))
|
|
118
|
+
throw providerInspectionError();
|
|
119
|
+
prototype = Object.getPrototypeOf(value);
|
|
120
|
+
descriptors = Object.getOwnPropertyDescriptors(value);
|
|
121
|
+
}
|
|
122
|
+
catch (cause) {
|
|
123
|
+
if (cause instanceof TypeError && cause.message.startsWith("Node WebSocket")) {
|
|
124
|
+
throw cause;
|
|
125
|
+
}
|
|
126
|
+
throw providerInspectionError(cause);
|
|
127
|
+
}
|
|
128
|
+
const keys = Reflect.ownKeys(descriptors);
|
|
129
|
+
const descriptor = descriptors.createServer;
|
|
130
|
+
if ((prototype !== Object.prototype && prototype !== null) ||
|
|
131
|
+
keys.length !== 1 || keys[0] !== "createServer" ||
|
|
132
|
+
!descriptor?.enumerable || !("value" in descriptor) ||
|
|
133
|
+
typeof descriptor.value !== "function") {
|
|
134
|
+
throw providerInspectionError();
|
|
135
|
+
}
|
|
136
|
+
const createServer = descriptor.value;
|
|
137
|
+
return Object.freeze({
|
|
138
|
+
createServer(options) {
|
|
139
|
+
return Reflect.apply(createServer, undefined, [options]);
|
|
140
|
+
},
|
|
141
|
+
});
|
|
142
|
+
}
|
|
143
|
+
/** Create immutable registration metadata from a standalone factory. */
|
|
144
|
+
export function createNodeWebSocketServerProvider(createServer) {
|
|
145
|
+
return snapshotNodeWebSocketServerProvider({ createServer });
|
|
146
|
+
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
/***********************
|
|
2
2
|
* Runtime identifier for platform-specific code paths
|
|
3
3
|
***********************/
|
|
4
|
+
import type { NodeWebSocketServerProvider } from "veryfront/extensions/websocket";
|
|
4
5
|
export type RuntimeId = "deno" | "node" | "bun" | "cloudflare" | "memory";
|
|
5
6
|
/**
|
|
6
7
|
* Core runtime adapter interface
|
|
@@ -72,6 +73,10 @@ export interface WebSocketConnection {
|
|
|
72
73
|
removeEventListener(type: string, listener: EventListener): void;
|
|
73
74
|
}
|
|
74
75
|
declare const WEBSOCKET_UPGRADE_RESPONSE_KIND = "websocket-upgrade";
|
|
76
|
+
/**
|
|
77
|
+
* Explicit upgrade signal used when a runtime cannot construct a native
|
|
78
|
+
* `Response` with status 101.
|
|
79
|
+
*/
|
|
75
80
|
export interface WebSocketUpgradeResponse {
|
|
76
81
|
readonly kind: typeof WEBSOCKET_UPGRADE_RESPONSE_KIND;
|
|
77
82
|
readonly status: 101;
|
|
@@ -96,6 +101,18 @@ export interface ServeOptions {
|
|
|
96
101
|
hostname: string;
|
|
97
102
|
port: number;
|
|
98
103
|
}) => void;
|
|
104
|
+
/**
|
|
105
|
+
* Node.js only. Called synchronously for each raw HTTP listener `error` event
|
|
106
|
+
* emitted after `onListen` returns. Returned promises are observed only for
|
|
107
|
+
* rejection and are not awaited by the listener or shutdown.
|
|
108
|
+
*/
|
|
109
|
+
onRuntimeError?: (error: Error) => void | Promise<void>;
|
|
110
|
+
/**
|
|
111
|
+
* Node.js only. Explicitly selected implementation for completing approved
|
|
112
|
+
* WebSocket upgrades. When absent, HTTP serving remains available and every
|
|
113
|
+
* Node WebSocket upgrade fails closed.
|
|
114
|
+
*/
|
|
115
|
+
nodeWebSocketServerProvider?: Readonly<NodeWebSocketServerProvider>;
|
|
99
116
|
}
|
|
100
117
|
export interface Server {
|
|
101
118
|
stop(): Promise<void>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"base.d.ts","sourceRoot":"","sources":["../../../../src/src/platform/adapters/base.ts"],"names":[],"mappings":"AAAA;;yBAEyB;AACzB,MAAM,MAAM,SAAS,GAAG,MAAM,GAAG,MAAM,GA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AM,WAAW,eAAe;IAC9B,IAAI,EAAE,cAAc,CAAC;IACrB,KAAK,EAAE,MAAM,EAAE,CAAC;CACjB;AAED,MAAM,WAAW,WAAY,SAAQ,aAAa,CAAC,eAAe,CAAC;IACjE,KAAK,IAAI,IAAI,CAAC;IACd;;;;;OAKG;IACH,IAAI,CAAC,EAAE,OAAO,CAAC,IAAI,CAAC,CAAC;CACtB;AAED,MAAM,WAAW,YAAY;IAC3B,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG;QAAE,MAAM,EAAE,OAAO,CAAC;QAAC,WAAW,EAAE,OAAO,CAAA;KAAE,CAAC;IAClE,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAAC;CACpC;AAED;;GAEG;AACH,MAAM,WAAW,cAAc;IAC7B,GAAG,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAAC;IACzC,GAAG,CACD,GAAG,EAAE,MAAM,EACX,KAAK,EAAE,MAAM,EACb,OAAO,CAAC,EAAE;QAAE,aAAa,CAAC,EAAE,MAAM,CAAA;KAAE,GACnC,OAAO,CAAC,IAAI,CAAC,CAAC;IACjB,MAAM,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACnC,IAAI,CAAC,MAAM,CAAC,EAAE,MAAM,GAAG,aAAa,CAAC,MAAM,CAAC,CAAC;CAC9C;AAED;;GAEG;AACH,MAAM,WAAW,kBAAkB;IACjC,KAAK,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,EAAE,EAAE,OAAO,CAAC,EAAE,YAAY,GAAG,WAAW,CAAC;CACtE"}
|
|
@@ -1,15 +1,64 @@
|
|
|
1
1
|
const WEBSOCKET_UPGRADE_RESPONSE_KIND = "websocket-upgrade";
|
|
2
2
|
export function createWebSocketUpgradeResponse(input = {}) {
|
|
3
|
-
return {
|
|
3
|
+
return Object.freeze({
|
|
4
4
|
kind: WEBSOCKET_UPGRADE_RESPONSE_KIND,
|
|
5
5
|
status: 101,
|
|
6
6
|
statusText: input.statusText ?? "Switching Protocols",
|
|
7
7
|
headers: new Headers(input.headers),
|
|
8
8
|
body: null,
|
|
9
|
-
};
|
|
9
|
+
});
|
|
10
|
+
}
|
|
11
|
+
// A Proxy can synthesize a fresh prototype for every getPrototypeOf trap.
|
|
12
|
+
// Bound each structural field lookup so an upgrade discriminator can never
|
|
13
|
+
// turn into attacker-controlled, unbounded traversal.
|
|
14
|
+
const MAX_UPGRADE_RESPONSE_PROTOTYPE_DEPTH = 16;
|
|
15
|
+
const headersGet = Headers.prototype.get;
|
|
16
|
+
function readDataProperty(value, key) {
|
|
17
|
+
const visited = new Set();
|
|
18
|
+
let current = value;
|
|
19
|
+
try {
|
|
20
|
+
for (let depth = 0; current !== null && depth < MAX_UPGRADE_RESPONSE_PROTOTYPE_DEPTH; depth++) {
|
|
21
|
+
if (visited.has(current))
|
|
22
|
+
return { readable: false };
|
|
23
|
+
visited.add(current);
|
|
24
|
+
const descriptor = Reflect.getOwnPropertyDescriptor(current, key);
|
|
25
|
+
if (descriptor) {
|
|
26
|
+
return "value" in descriptor
|
|
27
|
+
? { readable: true, value: descriptor.value }
|
|
28
|
+
: { readable: false };
|
|
29
|
+
}
|
|
30
|
+
current = Reflect.getPrototypeOf(current);
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
catch {
|
|
34
|
+
return { readable: false };
|
|
35
|
+
}
|
|
36
|
+
return current === null ? { readable: true, value: undefined } : { readable: false };
|
|
10
37
|
}
|
|
11
38
|
export function isWebSocketUpgradeResponse(value) {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
39
|
+
if (typeof value !== "object" || value === null)
|
|
40
|
+
return false;
|
|
41
|
+
const kind = readDataProperty(value, "kind");
|
|
42
|
+
if (!kind.readable || kind.value !== WEBSOCKET_UPGRADE_RESPONSE_KIND)
|
|
43
|
+
return false;
|
|
44
|
+
const status = readDataProperty(value, "status");
|
|
45
|
+
if (!status.readable || status.value !== 101)
|
|
46
|
+
return false;
|
|
47
|
+
const statusText = readDataProperty(value, "statusText");
|
|
48
|
+
if (!statusText.readable || typeof statusText.value !== "string")
|
|
49
|
+
return false;
|
|
50
|
+
const headers = readDataProperty(value, "headers");
|
|
51
|
+
if (!headers.readable || typeof headers.value !== "object" || headers.value === null) {
|
|
52
|
+
return false;
|
|
53
|
+
}
|
|
54
|
+
try {
|
|
55
|
+
// Verify the native Headers internal slot without consulting hostile
|
|
56
|
+
// properties or Symbol.hasInstance hooks.
|
|
57
|
+
Reflect.apply(headersGet, headers.value, ["upgrade"]);
|
|
58
|
+
}
|
|
59
|
+
catch {
|
|
60
|
+
return false;
|
|
61
|
+
}
|
|
62
|
+
const body = readDataProperty(value, "body");
|
|
63
|
+
return body.readable && body.value === null;
|
|
15
64
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"basic-operations.d.ts","sourceRoot":"","sources":["../../../../../src/src/platform/compat/path/basic-operations.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"basic-operations.d.ts","sourceRoot":"","sources":["../../../../../src/src/platform/compat/path/basic-operations.ts"],"names":[],"mappings":"AAgBA,yEAAyE;AACzE,wBAAgB,IAAI,CAAC,GAAG,KAAK,EAAE,MAAM,EAAE,GAAG,MAAM,CAQ/C;AAED,wCAAwC;AACxC,wBAAgB,OAAO,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAI5C;AAED,oCAAoC;AACpC,wBAAgB,QAAQ,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,CAAC,EAAE,MAAM,GAAG,MAAM,CAK3D;AAED,4CAA4C;AAC5C,wBAAgB,OAAO,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAI5C"}
|
|
@@ -1,56 +1,36 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import { hasWindowsLikePath, portableBasename, portableDirname, portableExtname, portableJoin, removeTrailingSeparatorsExceptRoot, runtimeUsesWindowsPaths, toPortableSeparators, } from "./portable.js";
|
|
2
|
+
import { getNativePathImplementation } from "./runtime.js";
|
|
3
|
+
function usesWindowsFlavor(paths) {
|
|
4
|
+
return runtimeUsesWindowsPaths() || paths.some(hasWindowsLikePath);
|
|
4
5
|
}
|
|
5
|
-
/**
|
|
6
|
-
function normSep(p) {
|
|
7
|
-
return p.includes("\\") ? p.replace(/\\/g, "/") : p;
|
|
8
|
-
}
|
|
9
|
-
/** Join path segments. */
|
|
6
|
+
/** Join and normalize path segments using their detected path flavor. */
|
|
10
7
|
export function join(...paths) {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
.
|
|
17
|
-
|
|
8
|
+
if (paths.every((path) => path.length === 0))
|
|
9
|
+
return "/";
|
|
10
|
+
const windows = usesWindowsFlavor(paths);
|
|
11
|
+
const pathApi = getNativePathImplementation(windows);
|
|
12
|
+
const joined = pathApi
|
|
13
|
+
? toPortableSeparators(pathApi.join(...paths))
|
|
14
|
+
: portableJoin(paths, windows);
|
|
15
|
+
return removeTrailingSeparatorsExceptRoot(joined, windows);
|
|
18
16
|
}
|
|
19
17
|
/** Return the parent directory path. */
|
|
20
18
|
export function dirname(path) {
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
const lastSlash = p.lastIndexOf("/");
|
|
25
|
-
if (lastSlash === -1)
|
|
26
|
-
return ".";
|
|
27
|
-
if (lastSlash === 0)
|
|
28
|
-
return "/";
|
|
29
|
-
return p.slice(0, lastSlash);
|
|
19
|
+
const windows = usesWindowsFlavor([path]);
|
|
20
|
+
const pathApi = getNativePathImplementation(windows);
|
|
21
|
+
return pathApi ? toPortableSeparators(pathApi.dirname(path)) : portableDirname(path, windows);
|
|
30
22
|
}
|
|
31
23
|
/** Return the last path segment. */
|
|
32
24
|
export function basename(path, ext) {
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
while (normalizedPath.length > 1 && normalizedPath.endsWith("/")) {
|
|
39
|
-
normalizedPath = normalizedPath.slice(0, -1);
|
|
40
|
-
}
|
|
41
|
-
const lastSlash = normalizedPath.lastIndexOf("/");
|
|
42
|
-
let base = lastSlash === -1 ? normalizedPath : normalizedPath.slice(lastSlash + 1);
|
|
43
|
-
if (ext && base.endsWith(ext))
|
|
44
|
-
base = base.slice(0, -ext.length);
|
|
45
|
-
return base;
|
|
25
|
+
const windows = usesWindowsFlavor([path]);
|
|
26
|
+
const pathApi = getNativePathImplementation(windows);
|
|
27
|
+
if (!pathApi)
|
|
28
|
+
return portableBasename(path, ext, windows);
|
|
29
|
+
return ext === undefined ? pathApi.basename(path) : pathApi.basename(path, ext);
|
|
46
30
|
}
|
|
47
31
|
/** Return the file extension for a path. */
|
|
48
32
|
export function extname(path) {
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
const lastDot = base.lastIndexOf(".");
|
|
53
|
-
if (lastDot <= 0)
|
|
54
|
-
return "";
|
|
55
|
-
return base.slice(lastDot);
|
|
33
|
+
const windows = usesWindowsFlavor([path]);
|
|
34
|
+
const pathApi = getNativePathImplementation(windows);
|
|
35
|
+
return pathApi?.extname(path) ?? portableExtname(path, windows);
|
|
56
36
|
}
|
|
@@ -8,6 +8,7 @@ export { delimiter, hasNodePath, isDeno, nodePath, sep, sep as SEPARATOR } from
|
|
|
8
8
|
export { basename, dirname, extname, join } from "./basic-operations.js";
|
|
9
9
|
export { isAbsolute, normalize, relative, resolve } from "./resolution.js";
|
|
10
10
|
export { format, parse } from "./parse-format.js";
|
|
11
|
+
export { posix, type PosixPath } from "./posix.js";
|
|
11
12
|
export { fromFileUrl, toFileUrl } from "./url-conversion.js";
|
|
12
13
|
export { validatePathSecurity } from "./security.js";
|
|
13
14
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/src/platform/compat/path/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,YAAY,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAE7D,OAAO,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,EAAE,QAAQ,EAAE,GAAG,EAAE,GAAG,IAAI,SAAS,EAAE,MAAM,cAAc,CAAC;AAE/F,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,uBAAuB,CAAC;AACzE,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAC;AAC3E,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAClD,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAC7D,OAAO,EAAE,oBAAoB,EAAE,MAAM,eAAe,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/src/platform/compat/path/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,YAAY,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAE7D,OAAO,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,EAAE,QAAQ,EAAE,GAAG,EAAE,GAAG,IAAI,SAAS,EAAE,MAAM,cAAc,CAAC;AAE/F,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,uBAAuB,CAAC;AACzE,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAC;AAC3E,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAClD,OAAO,EAAE,KAAK,EAAE,KAAK,SAAS,EAAE,MAAM,YAAY,CAAC;AACnD,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAC7D,OAAO,EAAE,oBAAoB,EAAE,MAAM,eAAe,CAAC"}
|
|
@@ -7,5 +7,6 @@ export { delimiter, hasNodePath, isDeno, nodePath, sep, sep as SEPARATOR } from
|
|
|
7
7
|
export { basename, dirname, extname, join } from "./basic-operations.js";
|
|
8
8
|
export { isAbsolute, normalize, relative, resolve } from "./resolution.js";
|
|
9
9
|
export { format, parse } from "./parse-format.js";
|
|
10
|
+
export { posix } from "./posix.js";
|
|
10
11
|
export { fromFileUrl, toFileUrl } from "./url-conversion.js";
|
|
11
12
|
export { validatePathSecurity } from "./security.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"parse-format.d.ts","sourceRoot":"","sources":["../../../../../src/src/platform/compat/path/parse-format.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"parse-format.d.ts","sourceRoot":"","sources":["../../../../../src/src/platform/compat/path/parse-format.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAU7C,wBAAgB,KAAK,CAAC,IAAI,EAAE,MAAM,GAAG,UAAU,CAa9C;AAED,wBAAgB,MAAM,CAAC,UAAU,EAAE,UAAU,GAAG,MAAM,CAerD"}
|