veryfront 0.0.63 → 0.0.65
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/ai/client.js +27 -0
- package/dist/ai/client.js.map +3 -3
- package/dist/ai/components.js +27 -0
- package/dist/ai/components.js.map +3 -3
- package/dist/ai/dev.js +27 -0
- package/dist/ai/dev.js.map +3 -3
- package/dist/ai/index.js +56 -29
- package/dist/ai/index.js.map +3 -3
- package/dist/ai/primitives.js +27 -0
- package/dist/ai/primitives.js.map +3 -3
- package/dist/ai/production.js +27 -0
- package/dist/ai/production.js.map +3 -3
- package/dist/ai/react.js +27 -0
- package/dist/ai/react.js.map +3 -3
- package/dist/ai/workflow-react.js +27 -0
- package/dist/ai/workflow-react.js.map +3 -3
- package/dist/ai/workflow.js +54 -25
- package/dist/ai/workflow.js.map +3 -3
- package/dist/cli.js +263 -3016
- package/dist/components.js +589 -226
- package/dist/components.js.map +4 -4
- package/dist/config.js +96 -25
- package/dist/config.js.map +3 -3
- package/dist/data.js +54 -25
- package/dist/data.js.map +3 -3
- package/dist/index.js +791 -232
- package/dist/index.js.map +4 -4
- package/dist/oauth/handlers.js +28 -1
- package/dist/oauth/handlers.js.map +3 -3
- package/dist/oauth/index.js +28 -1
- package/dist/oauth/index.js.map +3 -3
- package/dist/oauth/providers.js +28 -1
- package/dist/oauth/providers.js.map +3 -3
- package/dist/oauth/token-store.js +27 -0
- package/dist/oauth/token-store.js.map +3 -3
- package/package.json +1 -1
package/dist/components.js
CHANGED
|
@@ -38,6 +38,39 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
38
38
|
mod
|
|
39
39
|
));
|
|
40
40
|
|
|
41
|
+
// src/_shims/deno-env.ts
|
|
42
|
+
var denoEnvShim;
|
|
43
|
+
var init_deno_env = __esm({
|
|
44
|
+
"src/_shims/deno-env.ts"() {
|
|
45
|
+
"use strict";
|
|
46
|
+
denoEnvShim = {
|
|
47
|
+
get(key) {
|
|
48
|
+
return process.env[key];
|
|
49
|
+
},
|
|
50
|
+
set(key, value) {
|
|
51
|
+
process.env[key] = value;
|
|
52
|
+
},
|
|
53
|
+
delete(key) {
|
|
54
|
+
delete process.env[key];
|
|
55
|
+
},
|
|
56
|
+
has(key) {
|
|
57
|
+
return key in process.env;
|
|
58
|
+
},
|
|
59
|
+
toObject() {
|
|
60
|
+
return { ...process.env };
|
|
61
|
+
}
|
|
62
|
+
};
|
|
63
|
+
if (typeof globalThis.Deno === "undefined") {
|
|
64
|
+
globalThis.Deno = {
|
|
65
|
+
env: denoEnvShim,
|
|
66
|
+
cwd: () => process.cwd()
|
|
67
|
+
};
|
|
68
|
+
} else if (typeof globalThis.Deno.env === "undefined") {
|
|
69
|
+
globalThis.Deno.env = denoEnvShim;
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
});
|
|
73
|
+
|
|
41
74
|
// src/core/utils/runtime-guards.ts
|
|
42
75
|
function hasDenoRuntime(global) {
|
|
43
76
|
return typeof global === "object" && global !== null && "Deno" in global && typeof global.Deno?.env?.get === "function";
|
|
@@ -51,6 +84,7 @@ function hasBunRuntime(global) {
|
|
|
51
84
|
var init_runtime_guards = __esm({
|
|
52
85
|
"src/core/utils/runtime-guards.ts"() {
|
|
53
86
|
"use strict";
|
|
87
|
+
init_deno_env();
|
|
54
88
|
}
|
|
55
89
|
});
|
|
56
90
|
|
|
@@ -83,6 +117,7 @@ function isDevelopmentEnvironment() {
|
|
|
83
117
|
var init_env = __esm({
|
|
84
118
|
"src/core/utils/logger/env.ts"() {
|
|
85
119
|
"use strict";
|
|
120
|
+
init_deno_env();
|
|
86
121
|
init_runtime_guards();
|
|
87
122
|
}
|
|
88
123
|
});
|
|
@@ -132,6 +167,7 @@ var LogLevel, originalConsole, cachedLogLevel, ConsoleLogger, getDefaultLevel, t
|
|
|
132
167
|
var init_logger = __esm({
|
|
133
168
|
"src/core/utils/logger/logger.ts"() {
|
|
134
169
|
"use strict";
|
|
170
|
+
init_deno_env();
|
|
135
171
|
init_env();
|
|
136
172
|
LogLevel = /* @__PURE__ */ ((LogLevel2) => {
|
|
137
173
|
LogLevel2[LogLevel2["DEBUG"] = 0] = "DEBUG";
|
|
@@ -215,6 +251,7 @@ var init_logger = __esm({
|
|
|
215
251
|
var init_logger2 = __esm({
|
|
216
252
|
"src/core/utils/logger/index.ts"() {
|
|
217
253
|
"use strict";
|
|
254
|
+
init_deno_env();
|
|
218
255
|
init_logger();
|
|
219
256
|
init_env();
|
|
220
257
|
}
|
|
@@ -225,6 +262,7 @@ var DEFAULT_BUILD_CONCURRENCY, IMAGE_OPTIMIZATION;
|
|
|
225
262
|
var init_build = __esm({
|
|
226
263
|
"src/core/utils/constants/build.ts"() {
|
|
227
264
|
"use strict";
|
|
265
|
+
init_deno_env();
|
|
228
266
|
DEFAULT_BUILD_CONCURRENCY = 4;
|
|
229
267
|
IMAGE_OPTIMIZATION = {
|
|
230
268
|
DEFAULT_SIZES: [640, 750, 828, 1080, 1200, 1920, 2048, 3840],
|
|
@@ -238,6 +276,7 @@ var SECONDS_PER_MINUTE, MINUTES_PER_HOUR, HOURS_PER_DAY, MS_PER_SECOND, DEFAULT_
|
|
|
238
276
|
var init_cache = __esm({
|
|
239
277
|
"src/core/utils/constants/cache.ts"() {
|
|
240
278
|
"use strict";
|
|
279
|
+
init_deno_env();
|
|
241
280
|
SECONDS_PER_MINUTE = 60;
|
|
242
281
|
MINUTES_PER_HOUR = 60;
|
|
243
282
|
HOURS_PER_DAY = 24;
|
|
@@ -279,14 +318,14 @@ var init_deno = __esm({
|
|
|
279
318
|
"deno.json"() {
|
|
280
319
|
deno_default = {
|
|
281
320
|
name: "veryfront",
|
|
282
|
-
version: "0.0.
|
|
321
|
+
version: "0.0.65",
|
|
322
|
+
nodeModulesDir: "auto",
|
|
283
323
|
exclude: [
|
|
284
324
|
"npm/",
|
|
285
325
|
"dist/",
|
|
286
326
|
"coverage/",
|
|
287
327
|
"scripts/",
|
|
288
328
|
"examples/",
|
|
289
|
-
"tests/",
|
|
290
329
|
"src/cli/templates/files/",
|
|
291
330
|
"src/cli/templates/integrations/"
|
|
292
331
|
],
|
|
@@ -370,34 +409,36 @@ var init_deno = __esm({
|
|
|
370
409
|
"react-dom/client": "https://esm.sh/react-dom@18.3.1/client",
|
|
371
410
|
"react/jsx-runtime": "https://esm.sh/react@18.3.1/jsx-runtime",
|
|
372
411
|
"react/jsx-dev-runtime": "https://esm.sh/react@18.3.1/jsx-dev-runtime",
|
|
373
|
-
"@mdx-js/mdx": "
|
|
374
|
-
"@mdx-js/react": "
|
|
375
|
-
"unist-util-visit": "
|
|
376
|
-
"mdast-util-to-string": "
|
|
377
|
-
"github-slugger": "
|
|
378
|
-
"remark-gfm": "
|
|
379
|
-
"remark-frontmatter": "
|
|
380
|
-
"rehype-highlight": "
|
|
381
|
-
"rehype-slug": "
|
|
412
|
+
"@mdx-js/mdx": "npm:@mdx-js/mdx@3.0.0",
|
|
413
|
+
"@mdx-js/react": "npm:@mdx-js/react@3.0.0",
|
|
414
|
+
"unist-util-visit": "npm:unist-util-visit@5.0.0",
|
|
415
|
+
"mdast-util-to-string": "npm:mdast-util-to-string@4.0.0",
|
|
416
|
+
"github-slugger": "npm:github-slugger@2.0.0",
|
|
417
|
+
"remark-gfm": "npm:remark-gfm@4.0.1",
|
|
418
|
+
"remark-frontmatter": "npm:remark-frontmatter@5.0.0",
|
|
419
|
+
"rehype-highlight": "npm:rehype-highlight@7.0.2",
|
|
420
|
+
"rehype-slug": "npm:rehype-slug@6.0.0",
|
|
382
421
|
esbuild: "https://deno.land/x/esbuild@v0.20.1/wasm.js",
|
|
383
422
|
"esbuild/mod.js": "https://deno.land/x/esbuild@v0.20.1/mod.js",
|
|
384
|
-
"es-module-lexer": "
|
|
385
|
-
zod: "
|
|
386
|
-
"mime-types": "
|
|
387
|
-
mdast: "
|
|
388
|
-
hast: "
|
|
389
|
-
unist: "
|
|
390
|
-
unified: "
|
|
391
|
-
ai: "https://esm.sh/ai@5.0.
|
|
392
|
-
"ai/react": "https://esm.sh/@ai-sdk/react@2.0.
|
|
393
|
-
"@ai-sdk/react": "https://esm.sh/@ai-sdk/react@2.0.
|
|
394
|
-
"@ai-sdk/openai": "https://esm.sh/@ai-sdk/openai@2.0.
|
|
395
|
-
"@ai-sdk/anthropic": "https://esm.sh/@ai-sdk/anthropic@2.0.
|
|
423
|
+
"es-module-lexer": "npm:es-module-lexer@1.5.0",
|
|
424
|
+
zod: "npm:zod@3.23.8",
|
|
425
|
+
"mime-types": "npm:mime-types@2.1.35",
|
|
426
|
+
mdast: "npm:@types/mdast@4.0.3",
|
|
427
|
+
hast: "npm:@types/hast@3.0.3",
|
|
428
|
+
unist: "npm:@types/unist@3.0.2",
|
|
429
|
+
unified: "npm:unified@11.0.5",
|
|
430
|
+
ai: "https://esm.sh/ai@5.0.108?deps=react@18.3.1,react-dom@18.3.1",
|
|
431
|
+
"ai/react": "https://esm.sh/@ai-sdk/react@2.0.109?deps=react@18.3.1,react-dom@18.3.1",
|
|
432
|
+
"@ai-sdk/react": "https://esm.sh/@ai-sdk/react@2.0.109?deps=react@18.3.1,react-dom@18.3.1",
|
|
433
|
+
"@ai-sdk/openai": "https://esm.sh/@ai-sdk/openai@2.0.80",
|
|
434
|
+
"@ai-sdk/anthropic": "https://esm.sh/@ai-sdk/anthropic@2.0.54",
|
|
396
435
|
unocss: "https://esm.sh/unocss@0.59.0",
|
|
397
436
|
"@unocss/core": "https://esm.sh/@unocss/core@0.59.0",
|
|
398
437
|
"@unocss/preset-wind": "https://esm.sh/@unocss/preset-wind@0.59.0",
|
|
399
438
|
redis: "npm:redis",
|
|
400
|
-
pg: "npm:pg"
|
|
439
|
+
pg: "npm:pg",
|
|
440
|
+
"@opentelemetry/api": "npm:@opentelemetry/api@1",
|
|
441
|
+
"@opentelemetry/core": "npm:@opentelemetry/core@1"
|
|
401
442
|
},
|
|
402
443
|
compilerOptions: {
|
|
403
444
|
jsx: "react-jsx",
|
|
@@ -489,6 +530,7 @@ var isDeno, isNode, isBun, isCloudflare;
|
|
|
489
530
|
var init_runtime = __esm({
|
|
490
531
|
"src/platform/compat/runtime.ts"() {
|
|
491
532
|
"use strict";
|
|
533
|
+
init_deno_env();
|
|
492
534
|
isDeno = typeof Deno !== "undefined";
|
|
493
535
|
isNode = typeof globalThis.process !== "undefined" && globalThis.process?.versions?.node !== void 0;
|
|
494
536
|
isBun = typeof globalThis.Bun !== "undefined";
|
|
@@ -508,7 +550,7 @@ function cwd() {
|
|
|
508
550
|
}
|
|
509
551
|
function getEnv(key) {
|
|
510
552
|
if (isDeno) {
|
|
511
|
-
return
|
|
553
|
+
return Deno.env.get(key);
|
|
512
554
|
}
|
|
513
555
|
if (hasNodeProcess2) {
|
|
514
556
|
return nodeProcess.env[key];
|
|
@@ -528,6 +570,7 @@ var nodeProcess, hasNodeProcess2;
|
|
|
528
570
|
var init_process = __esm({
|
|
529
571
|
"src/platform/compat/process.ts"() {
|
|
530
572
|
"use strict";
|
|
573
|
+
init_deno_env();
|
|
531
574
|
init_runtime();
|
|
532
575
|
nodeProcess = globalThis.process;
|
|
533
576
|
hasNodeProcess2 = !!nodeProcess?.versions?.node;
|
|
@@ -539,6 +582,7 @@ var VERSION;
|
|
|
539
582
|
var init_version = __esm({
|
|
540
583
|
"src/core/utils/version.ts"() {
|
|
541
584
|
"use strict";
|
|
585
|
+
init_deno_env();
|
|
542
586
|
init_deno();
|
|
543
587
|
init_process();
|
|
544
588
|
VERSION = getEnv("VERYFRONT_VERSION") || (typeof deno_default.version === "string" ? deno_default.version : "0.0.0");
|
|
@@ -584,6 +628,7 @@ var ESM_CDN_BASE, JSDELIVR_CDN_BASE, DENO_STD_BASE, REACT_VERSION_17, REACT_VERS
|
|
|
584
628
|
var init_cdn = __esm({
|
|
585
629
|
"src/core/utils/constants/cdn.ts"() {
|
|
586
630
|
"use strict";
|
|
631
|
+
init_deno_env();
|
|
587
632
|
init_version();
|
|
588
633
|
ESM_CDN_BASE = "https://esm.sh";
|
|
589
634
|
JSDELIVR_CDN_BASE = "https://cdn.jsdelivr.net";
|
|
@@ -620,6 +665,7 @@ var ENV_VARS;
|
|
|
620
665
|
var init_env2 = __esm({
|
|
621
666
|
"src/core/utils/constants/env.ts"() {
|
|
622
667
|
"use strict";
|
|
668
|
+
init_deno_env();
|
|
623
669
|
ENV_VARS = {
|
|
624
670
|
DEBUG: "VERYFRONT_DEBUG",
|
|
625
671
|
DEEP_INSPECT: "VERYFRONT_DEEP_INSPECT",
|
|
@@ -635,6 +681,7 @@ var HASH_SEED_DJB2, HASH_SEED_FNV1A;
|
|
|
635
681
|
var init_hash = __esm({
|
|
636
682
|
"src/core/utils/constants/hash.ts"() {
|
|
637
683
|
"use strict";
|
|
684
|
+
init_deno_env();
|
|
638
685
|
HASH_SEED_DJB2 = 5381;
|
|
639
686
|
HASH_SEED_FNV1A = 2166136261;
|
|
640
687
|
}
|
|
@@ -645,6 +692,7 @@ var KB_IN_BYTES, HTTP_MODULE_FETCH_TIMEOUT_MS, HMR_RECONNECT_DELAY_MS, HMR_RELOA
|
|
|
645
692
|
var init_http = __esm({
|
|
646
693
|
"src/core/utils/constants/http.ts"() {
|
|
647
694
|
"use strict";
|
|
695
|
+
init_deno_env();
|
|
648
696
|
init_cache();
|
|
649
697
|
KB_IN_BYTES = 1024;
|
|
650
698
|
HTTP_MODULE_FETCH_TIMEOUT_MS = 2500;
|
|
@@ -710,6 +758,7 @@ var HMR_MAX_MESSAGE_SIZE_BYTES, HMR_MAX_MESSAGES_PER_MINUTE, HMR_CLIENT_RELOAD_D
|
|
|
710
758
|
var init_hmr = __esm({
|
|
711
759
|
"src/core/utils/constants/hmr.ts"() {
|
|
712
760
|
"use strict";
|
|
761
|
+
init_deno_env();
|
|
713
762
|
init_http();
|
|
714
763
|
HMR_MAX_MESSAGE_SIZE_BYTES = 1024 * KB_IN_BYTES;
|
|
715
764
|
HMR_MAX_MESSAGES_PER_MINUTE = 100;
|
|
@@ -734,6 +783,7 @@ var Z_INDEX_DEV_INDICATOR, Z_INDEX_ERROR_OVERLAY, BREAKPOINT_SM, BREAKPOINT_MD,
|
|
|
734
783
|
var init_html = __esm({
|
|
735
784
|
"src/core/utils/constants/html.ts"() {
|
|
736
785
|
"use strict";
|
|
786
|
+
init_deno_env();
|
|
737
787
|
Z_INDEX_DEV_INDICATOR = 9998;
|
|
738
788
|
Z_INDEX_ERROR_OVERLAY = 9999;
|
|
739
789
|
BREAKPOINT_SM = 640;
|
|
@@ -748,6 +798,7 @@ var init_html = __esm({
|
|
|
748
798
|
var DEFAULT_DEV_SERVER_PORT, DEFAULT_REDIS_PORT, DEFAULT_API_SERVER_PORT, DEFAULT_PREVIEW_SERVER_PORT, DEFAULT_METRICS_PORT, BYTES_PER_KB, BYTES_PER_MB, DEFAULT_IMAGE_THUMBNAIL_SIZE, DEFAULT_IMAGE_SMALL_SIZE, DEFAULT_IMAGE_LARGE_SIZE, RESPONSIVE_IMAGE_WIDTH_XS, RESPONSIVE_IMAGE_WIDTH_SM, RESPONSIVE_IMAGE_WIDTH_MD, RESPONSIVE_IMAGE_WIDTH_LG, RESPONSIVE_IMAGE_WIDTHS, MAX_CHUNK_SIZE_KB, MIN_PORT, MAX_PORT, DEFAULT_SERVER_PORT;
|
|
749
799
|
var init_network = __esm({
|
|
750
800
|
"src/core/utils/constants/network.ts"() {
|
|
801
|
+
init_deno_env();
|
|
751
802
|
DEFAULT_DEV_SERVER_PORT = 3e3;
|
|
752
803
|
DEFAULT_REDIS_PORT = 6379;
|
|
753
804
|
DEFAULT_API_SERVER_PORT = 8080;
|
|
@@ -780,6 +831,7 @@ var MAX_PATH_TRAVERSAL_DEPTH, FORBIDDEN_PATH_PATTERNS, DIRECTORY_TRAVERSAL_PATTE
|
|
|
780
831
|
var init_security = __esm({
|
|
781
832
|
"src/core/utils/constants/security.ts"() {
|
|
782
833
|
"use strict";
|
|
834
|
+
init_deno_env();
|
|
783
835
|
MAX_PATH_TRAVERSAL_DEPTH = 10;
|
|
784
836
|
FORBIDDEN_PATH_PATTERNS = [
|
|
785
837
|
/\0/
|
|
@@ -796,6 +848,7 @@ var init_security = __esm({
|
|
|
796
848
|
var DEFAULT_PORT;
|
|
797
849
|
var init_defaults = __esm({
|
|
798
850
|
"src/core/config/defaults.ts"() {
|
|
851
|
+
init_deno_env();
|
|
799
852
|
DEFAULT_PORT = 3e3;
|
|
800
853
|
}
|
|
801
854
|
});
|
|
@@ -817,6 +870,7 @@ var DEFAULT_DASHBOARD_PORT, INTERNAL_PREFIX, INTERNAL_PATH_PREFIXES, INTERNAL_EN
|
|
|
817
870
|
var init_server = __esm({
|
|
818
871
|
"src/core/utils/constants/server.ts"() {
|
|
819
872
|
"use strict";
|
|
873
|
+
init_deno_env();
|
|
820
874
|
init_defaults();
|
|
821
875
|
DEFAULT_DASHBOARD_PORT = 3002;
|
|
822
876
|
INTERNAL_PREFIX = "/_veryfront";
|
|
@@ -902,6 +956,7 @@ var init_server = __esm({
|
|
|
902
956
|
var init_constants = __esm({
|
|
903
957
|
"src/core/utils/constants/index.ts"() {
|
|
904
958
|
"use strict";
|
|
959
|
+
init_deno_env();
|
|
905
960
|
init_build();
|
|
906
961
|
init_cache();
|
|
907
962
|
init_cdn();
|
|
@@ -921,6 +976,7 @@ var PATHS, VERYFRONT_PATHS, FILE_EXTENSIONS;
|
|
|
921
976
|
var init_paths = __esm({
|
|
922
977
|
"src/core/utils/paths.ts"() {
|
|
923
978
|
"use strict";
|
|
979
|
+
init_deno_env();
|
|
924
980
|
init_server();
|
|
925
981
|
PATHS = {
|
|
926
982
|
PAGES_DIR: "pages",
|
|
@@ -984,6 +1040,7 @@ async function shortHash(content) {
|
|
|
984
1040
|
var init_hash_utils = __esm({
|
|
985
1041
|
"src/core/utils/hash-utils.ts"() {
|
|
986
1042
|
"use strict";
|
|
1043
|
+
init_deno_env();
|
|
987
1044
|
}
|
|
988
1045
|
});
|
|
989
1046
|
|
|
@@ -1029,6 +1086,7 @@ var MemoCache;
|
|
|
1029
1086
|
var init_memoize = __esm({
|
|
1030
1087
|
"src/core/utils/memoize.ts"() {
|
|
1031
1088
|
"use strict";
|
|
1089
|
+
init_deno_env();
|
|
1032
1090
|
MemoCache = class {
|
|
1033
1091
|
constructor() {
|
|
1034
1092
|
this.cache = /* @__PURE__ */ new Map();
|
|
@@ -1103,6 +1161,7 @@ function fromBase64Url(encoded) {
|
|
|
1103
1161
|
var init_path_utils = __esm({
|
|
1104
1162
|
"src/core/utils/path-utils.ts"() {
|
|
1105
1163
|
"use strict";
|
|
1164
|
+
init_deno_env();
|
|
1106
1165
|
init_logger();
|
|
1107
1166
|
}
|
|
1108
1167
|
});
|
|
@@ -1196,6 +1255,7 @@ function truncateString(str, maxLength) {
|
|
|
1196
1255
|
var init_format_utils = __esm({
|
|
1197
1256
|
"src/core/utils/format-utils.ts"() {
|
|
1198
1257
|
"use strict";
|
|
1258
|
+
init_deno_env();
|
|
1199
1259
|
init_logger();
|
|
1200
1260
|
}
|
|
1201
1261
|
});
|
|
@@ -1214,6 +1274,7 @@ var InMemoryBundleManifestStore, manifestStore;
|
|
|
1214
1274
|
var init_bundle_manifest = __esm({
|
|
1215
1275
|
"src/core/utils/bundle-manifest.ts"() {
|
|
1216
1276
|
"use strict";
|
|
1277
|
+
init_deno_env();
|
|
1217
1278
|
init_logger2();
|
|
1218
1279
|
init_hash_utils();
|
|
1219
1280
|
InMemoryBundleManifestStore = class {
|
|
@@ -1418,6 +1479,7 @@ async function warmupBundleManifest(store, keys) {
|
|
|
1418
1479
|
var init_bundle_manifest_init = __esm({
|
|
1419
1480
|
"src/core/utils/bundle-manifest-init.ts"() {
|
|
1420
1481
|
"use strict";
|
|
1482
|
+
init_deno_env();
|
|
1421
1483
|
init_logger2();
|
|
1422
1484
|
init_bundle_manifest();
|
|
1423
1485
|
init_cache();
|
|
@@ -1434,6 +1496,7 @@ function isRSCEnabled(config) {
|
|
|
1434
1496
|
var init_feature_flags = __esm({
|
|
1435
1497
|
"src/core/utils/feature-flags.ts"() {
|
|
1436
1498
|
"use strict";
|
|
1499
|
+
init_deno_env();
|
|
1437
1500
|
init_process();
|
|
1438
1501
|
}
|
|
1439
1502
|
});
|
|
@@ -1452,6 +1515,7 @@ function isCompiledBinary() {
|
|
|
1452
1515
|
var init_platform = __esm({
|
|
1453
1516
|
"src/core/utils/platform.ts"() {
|
|
1454
1517
|
"use strict";
|
|
1518
|
+
init_deno_env();
|
|
1455
1519
|
init_runtime();
|
|
1456
1520
|
init_process();
|
|
1457
1521
|
}
|
|
@@ -1678,6 +1742,7 @@ __export(utils_exports, {
|
|
|
1678
1742
|
});
|
|
1679
1743
|
var init_utils = __esm({
|
|
1680
1744
|
"src/core/utils/index.ts"() {
|
|
1745
|
+
init_deno_env();
|
|
1681
1746
|
init_runtime_guards();
|
|
1682
1747
|
init_logger2();
|
|
1683
1748
|
init_constants();
|
|
@@ -1711,6 +1776,7 @@ function toError(veryfrontError) {
|
|
|
1711
1776
|
var init_veryfront_error = __esm({
|
|
1712
1777
|
"src/core/errors/veryfront-error.ts"() {
|
|
1713
1778
|
"use strict";
|
|
1779
|
+
init_deno_env();
|
|
1714
1780
|
}
|
|
1715
1781
|
});
|
|
1716
1782
|
|
|
@@ -1720,6 +1786,7 @@ var corsSchema, veryfrontConfigSchema;
|
|
|
1720
1786
|
var init_schema = __esm({
|
|
1721
1787
|
"src/core/config/schema.ts"() {
|
|
1722
1788
|
"use strict";
|
|
1789
|
+
init_deno_env();
|
|
1723
1790
|
init_veryfront_error();
|
|
1724
1791
|
corsSchema = z.union([z.boolean(), z.object({ origin: z.string().optional() }).strict()]);
|
|
1725
1792
|
veryfrontConfigSchema = z.object({
|
|
@@ -1867,6 +1934,7 @@ var DEFAULT_CONFIG;
|
|
|
1867
1934
|
var init_loader = __esm({
|
|
1868
1935
|
"src/core/config/loader.ts"() {
|
|
1869
1936
|
"use strict";
|
|
1937
|
+
init_deno_env();
|
|
1870
1938
|
init_schema();
|
|
1871
1939
|
init_logger();
|
|
1872
1940
|
init_cdn();
|
|
@@ -1927,6 +1995,7 @@ var init_loader = __esm({
|
|
|
1927
1995
|
var init_define_config = __esm({
|
|
1928
1996
|
"src/core/config/define-config.ts"() {
|
|
1929
1997
|
"use strict";
|
|
1998
|
+
init_deno_env();
|
|
1930
1999
|
init_veryfront_error();
|
|
1931
2000
|
init_process();
|
|
1932
2001
|
}
|
|
@@ -1936,12 +2005,14 @@ var init_define_config = __esm({
|
|
|
1936
2005
|
var init_network_defaults = __esm({
|
|
1937
2006
|
"src/core/config/network-defaults.ts"() {
|
|
1938
2007
|
"use strict";
|
|
2008
|
+
init_deno_env();
|
|
1939
2009
|
}
|
|
1940
2010
|
});
|
|
1941
2011
|
|
|
1942
2012
|
// src/core/config/index.ts
|
|
1943
2013
|
var init_config = __esm({
|
|
1944
2014
|
"src/core/config/index.ts"() {
|
|
2015
|
+
init_deno_env();
|
|
1945
2016
|
init_loader();
|
|
1946
2017
|
init_define_config();
|
|
1947
2018
|
init_schema();
|
|
@@ -1960,6 +2031,7 @@ var DenoFileSystemAdapter, DenoEnvironmentAdapter, DenoServerAdapter, DenoShellA
|
|
|
1960
2031
|
var init_deno2 = __esm({
|
|
1961
2032
|
"src/platform/adapters/deno.ts"() {
|
|
1962
2033
|
"use strict";
|
|
2034
|
+
init_deno_env();
|
|
1963
2035
|
init_veryfront_error();
|
|
1964
2036
|
init_config();
|
|
1965
2037
|
init_utils();
|
|
@@ -2086,7 +2158,7 @@ var init_deno2 = __esm({
|
|
|
2086
2158
|
};
|
|
2087
2159
|
DenoEnvironmentAdapter = class {
|
|
2088
2160
|
get(key) {
|
|
2089
|
-
return
|
|
2161
|
+
return Deno.env.get(key);
|
|
2090
2162
|
}
|
|
2091
2163
|
set(key, value) {
|
|
2092
2164
|
Deno.env.set(key, value);
|
|
@@ -2282,6 +2354,7 @@ function createFileWatcher(iterator, cleanup) {
|
|
|
2282
2354
|
var init_shared_watcher = __esm({
|
|
2283
2355
|
"src/platform/adapters/shared-watcher.ts"() {
|
|
2284
2356
|
"use strict";
|
|
2357
|
+
init_deno_env();
|
|
2285
2358
|
}
|
|
2286
2359
|
});
|
|
2287
2360
|
|
|
@@ -2290,6 +2363,7 @@ var NodeFileSystemAdapter;
|
|
|
2290
2363
|
var init_filesystem_adapter = __esm({
|
|
2291
2364
|
"src/platform/adapters/node/filesystem-adapter.ts"() {
|
|
2292
2365
|
"use strict";
|
|
2366
|
+
init_deno_env();
|
|
2293
2367
|
init_shared_watcher();
|
|
2294
2368
|
init_utils();
|
|
2295
2369
|
NodeFileSystemAdapter = class {
|
|
@@ -2417,6 +2491,7 @@ var NodeEnvironmentAdapter;
|
|
|
2417
2491
|
var init_environment_adapter = __esm({
|
|
2418
2492
|
"src/platform/adapters/node/environment-adapter.ts"() {
|
|
2419
2493
|
"use strict";
|
|
2494
|
+
init_deno_env();
|
|
2420
2495
|
NodeEnvironmentAdapter = class {
|
|
2421
2496
|
get(key) {
|
|
2422
2497
|
return process2.env[key];
|
|
@@ -2431,119 +2506,20 @@ var init_environment_adapter = __esm({
|
|
|
2431
2506
|
}
|
|
2432
2507
|
});
|
|
2433
2508
|
|
|
2434
|
-
//
|
|
2435
|
-
var require_stream = __commonJS({
|
|
2436
|
-
"../../../../node_modules/ws/lib/stream.js"(exports, module) {
|
|
2437
|
-
"use strict";
|
|
2438
|
-
var { Duplex } = __require2("stream");
|
|
2439
|
-
function emitClose(stream) {
|
|
2440
|
-
stream.emit("close");
|
|
2441
|
-
}
|
|
2442
|
-
function duplexOnEnd() {
|
|
2443
|
-
if (!this.destroyed && this._writableState.finished) {
|
|
2444
|
-
this.destroy();
|
|
2445
|
-
}
|
|
2446
|
-
}
|
|
2447
|
-
function duplexOnError(err) {
|
|
2448
|
-
this.removeListener("error", duplexOnError);
|
|
2449
|
-
this.destroy();
|
|
2450
|
-
if (this.listenerCount("error") === 0) {
|
|
2451
|
-
this.emit("error", err);
|
|
2452
|
-
}
|
|
2453
|
-
}
|
|
2454
|
-
function createWebSocketStream2(ws, options) {
|
|
2455
|
-
let terminateOnDestroy = true;
|
|
2456
|
-
const duplex = new Duplex({
|
|
2457
|
-
...options,
|
|
2458
|
-
autoDestroy: false,
|
|
2459
|
-
emitClose: false,
|
|
2460
|
-
objectMode: false,
|
|
2461
|
-
writableObjectMode: false
|
|
2462
|
-
});
|
|
2463
|
-
ws.on("message", function message(msg, isBinary) {
|
|
2464
|
-
const data = !isBinary && duplex._readableState.objectMode ? msg.toString() : msg;
|
|
2465
|
-
if (!duplex.push(data))
|
|
2466
|
-
ws.pause();
|
|
2467
|
-
});
|
|
2468
|
-
ws.once("error", function error(err) {
|
|
2469
|
-
if (duplex.destroyed)
|
|
2470
|
-
return;
|
|
2471
|
-
terminateOnDestroy = false;
|
|
2472
|
-
duplex.destroy(err);
|
|
2473
|
-
});
|
|
2474
|
-
ws.once("close", function close() {
|
|
2475
|
-
if (duplex.destroyed)
|
|
2476
|
-
return;
|
|
2477
|
-
duplex.push(null);
|
|
2478
|
-
});
|
|
2479
|
-
duplex._destroy = function(err, callback) {
|
|
2480
|
-
if (ws.readyState === ws.CLOSED) {
|
|
2481
|
-
callback(err);
|
|
2482
|
-
process.nextTick(emitClose, duplex);
|
|
2483
|
-
return;
|
|
2484
|
-
}
|
|
2485
|
-
let called = false;
|
|
2486
|
-
ws.once("error", function error(err2) {
|
|
2487
|
-
called = true;
|
|
2488
|
-
callback(err2);
|
|
2489
|
-
});
|
|
2490
|
-
ws.once("close", function close() {
|
|
2491
|
-
if (!called)
|
|
2492
|
-
callback(err);
|
|
2493
|
-
process.nextTick(emitClose, duplex);
|
|
2494
|
-
});
|
|
2495
|
-
if (terminateOnDestroy)
|
|
2496
|
-
ws.terminate();
|
|
2497
|
-
};
|
|
2498
|
-
duplex._final = function(callback) {
|
|
2499
|
-
if (ws.readyState === ws.CONNECTING) {
|
|
2500
|
-
ws.once("open", function open() {
|
|
2501
|
-
duplex._final(callback);
|
|
2502
|
-
});
|
|
2503
|
-
return;
|
|
2504
|
-
}
|
|
2505
|
-
if (ws._socket === null)
|
|
2506
|
-
return;
|
|
2507
|
-
if (ws._socket._writableState.finished) {
|
|
2508
|
-
callback();
|
|
2509
|
-
if (duplex._readableState.endEmitted)
|
|
2510
|
-
duplex.destroy();
|
|
2511
|
-
} else {
|
|
2512
|
-
ws._socket.once("finish", function finish() {
|
|
2513
|
-
callback();
|
|
2514
|
-
});
|
|
2515
|
-
ws.close();
|
|
2516
|
-
}
|
|
2517
|
-
};
|
|
2518
|
-
duplex._read = function() {
|
|
2519
|
-
if (ws.isPaused)
|
|
2520
|
-
ws.resume();
|
|
2521
|
-
};
|
|
2522
|
-
duplex._write = function(chunk, encoding, callback) {
|
|
2523
|
-
if (ws.readyState === ws.CONNECTING) {
|
|
2524
|
-
ws.once("open", function open() {
|
|
2525
|
-
duplex._write(chunk, encoding, callback);
|
|
2526
|
-
});
|
|
2527
|
-
return;
|
|
2528
|
-
}
|
|
2529
|
-
ws.send(chunk, callback);
|
|
2530
|
-
};
|
|
2531
|
-
duplex.on("end", duplexOnEnd);
|
|
2532
|
-
duplex.on("error", duplexOnError);
|
|
2533
|
-
return duplex;
|
|
2534
|
-
}
|
|
2535
|
-
module.exports = createWebSocketStream2;
|
|
2536
|
-
}
|
|
2537
|
-
});
|
|
2538
|
-
|
|
2539
|
-
// ../../../../node_modules/ws/lib/constants.js
|
|
2509
|
+
// ../node_modules/ws/lib/constants.js
|
|
2540
2510
|
var require_constants = __commonJS({
|
|
2541
|
-
"
|
|
2511
|
+
"../node_modules/ws/lib/constants.js"(exports, module) {
|
|
2542
2512
|
"use strict";
|
|
2513
|
+
init_deno_env();
|
|
2514
|
+
var BINARY_TYPES = ["nodebuffer", "arraybuffer", "fragments"];
|
|
2515
|
+
var hasBlob = typeof Blob !== "undefined";
|
|
2516
|
+
if (hasBlob)
|
|
2517
|
+
BINARY_TYPES.push("blob");
|
|
2543
2518
|
module.exports = {
|
|
2544
|
-
BINARY_TYPES
|
|
2519
|
+
BINARY_TYPES,
|
|
2545
2520
|
EMPTY_BUFFER: Buffer.alloc(0),
|
|
2546
2521
|
GUID: "258EAFA5-E914-47DA-95CA-C5AB0DC85B11",
|
|
2522
|
+
hasBlob,
|
|
2547
2523
|
kForOnEventAttribute: Symbol("kIsForOnEventAttribute"),
|
|
2548
2524
|
kListener: Symbol("kListener"),
|
|
2549
2525
|
kStatusCode: Symbol("status-code"),
|
|
@@ -2554,10 +2530,11 @@ var require_constants = __commonJS({
|
|
|
2554
2530
|
}
|
|
2555
2531
|
});
|
|
2556
2532
|
|
|
2557
|
-
//
|
|
2533
|
+
// ../node_modules/ws/lib/buffer-util.js
|
|
2558
2534
|
var require_buffer_util = __commonJS({
|
|
2559
|
-
"
|
|
2535
|
+
"../node_modules/ws/lib/buffer-util.js"(exports, module) {
|
|
2560
2536
|
"use strict";
|
|
2537
|
+
init_deno_env();
|
|
2561
2538
|
var { EMPTY_BUFFER } = require_constants();
|
|
2562
2539
|
var FastBuffer = Buffer[Symbol.species];
|
|
2563
2540
|
function concat(list, totalLength) {
|
|
@@ -2636,10 +2613,11 @@ var require_buffer_util = __commonJS({
|
|
|
2636
2613
|
}
|
|
2637
2614
|
});
|
|
2638
2615
|
|
|
2639
|
-
//
|
|
2616
|
+
// ../node_modules/ws/lib/limiter.js
|
|
2640
2617
|
var require_limiter = __commonJS({
|
|
2641
|
-
"
|
|
2618
|
+
"../node_modules/ws/lib/limiter.js"(exports, module) {
|
|
2642
2619
|
"use strict";
|
|
2620
|
+
init_deno_env();
|
|
2643
2621
|
var kDone = Symbol("kDone");
|
|
2644
2622
|
var kRun = Symbol("kRun");
|
|
2645
2623
|
var Limiter = class {
|
|
@@ -2687,10 +2665,11 @@ var require_limiter = __commonJS({
|
|
|
2687
2665
|
}
|
|
2688
2666
|
});
|
|
2689
2667
|
|
|
2690
|
-
//
|
|
2668
|
+
// ../node_modules/ws/lib/permessage-deflate.js
|
|
2691
2669
|
var require_permessage_deflate = __commonJS({
|
|
2692
|
-
"
|
|
2670
|
+
"../node_modules/ws/lib/permessage-deflate.js"(exports, module) {
|
|
2693
2671
|
"use strict";
|
|
2672
|
+
init_deno_env();
|
|
2694
2673
|
var zlib = __require2("zlib");
|
|
2695
2674
|
var bufferUtil = require_buffer_util();
|
|
2696
2675
|
var Limiter = require_limiter();
|
|
@@ -3061,17 +3040,23 @@ var require_permessage_deflate = __commonJS({
|
|
|
3061
3040
|
}
|
|
3062
3041
|
function inflateOnError(err) {
|
|
3063
3042
|
this[kPerMessageDeflate]._inflate = null;
|
|
3043
|
+
if (this[kError]) {
|
|
3044
|
+
this[kCallback](this[kError]);
|
|
3045
|
+
return;
|
|
3046
|
+
}
|
|
3064
3047
|
err[kStatusCode] = 1007;
|
|
3065
3048
|
this[kCallback](err);
|
|
3066
3049
|
}
|
|
3067
3050
|
}
|
|
3068
3051
|
});
|
|
3069
3052
|
|
|
3070
|
-
//
|
|
3053
|
+
// ../node_modules/ws/lib/validation.js
|
|
3071
3054
|
var require_validation = __commonJS({
|
|
3072
|
-
"
|
|
3055
|
+
"../node_modules/ws/lib/validation.js"(exports, module) {
|
|
3073
3056
|
"use strict";
|
|
3057
|
+
init_deno_env();
|
|
3074
3058
|
var { isUtf8 } = __require2("buffer");
|
|
3059
|
+
var { hasBlob } = require_constants();
|
|
3075
3060
|
var tokenChars = [
|
|
3076
3061
|
0,
|
|
3077
3062
|
0,
|
|
@@ -3242,7 +3227,11 @@ var require_validation = __commonJS({
|
|
|
3242
3227
|
}
|
|
3243
3228
|
return true;
|
|
3244
3229
|
}
|
|
3230
|
+
function isBlob(value) {
|
|
3231
|
+
return hasBlob && typeof value === "object" && typeof value.arrayBuffer === "function" && typeof value.type === "string" && typeof value.stream === "function" && (value[Symbol.toStringTag] === "Blob" || value[Symbol.toStringTag] === "File");
|
|
3232
|
+
}
|
|
3245
3233
|
module.exports = {
|
|
3234
|
+
isBlob,
|
|
3246
3235
|
isValidStatusCode,
|
|
3247
3236
|
isValidUTF8: _isValidUTF8,
|
|
3248
3237
|
tokenChars
|
|
@@ -3263,10 +3252,11 @@ var require_validation = __commonJS({
|
|
|
3263
3252
|
}
|
|
3264
3253
|
});
|
|
3265
3254
|
|
|
3266
|
-
//
|
|
3255
|
+
// ../node_modules/ws/lib/receiver.js
|
|
3267
3256
|
var require_receiver = __commonJS({
|
|
3268
|
-
"
|
|
3257
|
+
"../node_modules/ws/lib/receiver.js"(exports, module) {
|
|
3269
3258
|
"use strict";
|
|
3259
|
+
init_deno_env();
|
|
3270
3260
|
var { Writable } = __require2("stream");
|
|
3271
3261
|
var PerMessageDeflate = require_permessage_deflate();
|
|
3272
3262
|
var {
|
|
@@ -3735,6 +3725,8 @@ var require_receiver = __commonJS({
|
|
|
3735
3725
|
data = concat(fragments, messageLength);
|
|
3736
3726
|
} else if (this._binaryType === "arraybuffer") {
|
|
3737
3727
|
data = toArrayBuffer(concat(fragments, messageLength));
|
|
3728
|
+
} else if (this._binaryType === "blob") {
|
|
3729
|
+
data = new Blob(fragments);
|
|
3738
3730
|
} else {
|
|
3739
3731
|
data = fragments;
|
|
3740
3732
|
}
|
|
@@ -3864,18 +3856,25 @@ var require_receiver = __commonJS({
|
|
|
3864
3856
|
}
|
|
3865
3857
|
});
|
|
3866
3858
|
|
|
3867
|
-
//
|
|
3859
|
+
// ../node_modules/ws/lib/sender.js
|
|
3868
3860
|
var require_sender = __commonJS({
|
|
3869
|
-
"
|
|
3861
|
+
"../node_modules/ws/lib/sender.js"(exports, module) {
|
|
3870
3862
|
"use strict";
|
|
3863
|
+
init_deno_env();
|
|
3871
3864
|
var { Duplex } = __require2("stream");
|
|
3872
3865
|
var { randomFillSync } = __require2("crypto");
|
|
3873
3866
|
var PerMessageDeflate = require_permessage_deflate();
|
|
3874
|
-
var { EMPTY_BUFFER } = require_constants();
|
|
3875
|
-
var { isValidStatusCode } = require_validation();
|
|
3867
|
+
var { EMPTY_BUFFER, kWebSocket, NOOP } = require_constants();
|
|
3868
|
+
var { isBlob, isValidStatusCode } = require_validation();
|
|
3876
3869
|
var { mask: applyMask, toBuffer } = require_buffer_util();
|
|
3877
3870
|
var kByteLength = Symbol("kByteLength");
|
|
3878
3871
|
var maskBuffer = Buffer.alloc(4);
|
|
3872
|
+
var RANDOM_POOL_SIZE = 8 * 1024;
|
|
3873
|
+
var randomPool;
|
|
3874
|
+
var randomPoolPointer = RANDOM_POOL_SIZE;
|
|
3875
|
+
var DEFAULT = 0;
|
|
3876
|
+
var DEFLATING = 1;
|
|
3877
|
+
var GET_BLOB_DATA = 2;
|
|
3879
3878
|
var Sender2 = class _Sender {
|
|
3880
3879
|
/**
|
|
3881
3880
|
* Creates a Sender instance.
|
|
@@ -3895,8 +3894,10 @@ var require_sender = __commonJS({
|
|
|
3895
3894
|
this._firstFragment = true;
|
|
3896
3895
|
this._compress = false;
|
|
3897
3896
|
this._bufferedBytes = 0;
|
|
3898
|
-
this._deflating = false;
|
|
3899
3897
|
this._queue = [];
|
|
3898
|
+
this._state = DEFAULT;
|
|
3899
|
+
this.onerror = NOOP;
|
|
3900
|
+
this[kWebSocket] = void 0;
|
|
3900
3901
|
}
|
|
3901
3902
|
/**
|
|
3902
3903
|
* Frames a piece of data according to the HyBi WebSocket protocol.
|
|
@@ -3929,7 +3930,17 @@ var require_sender = __commonJS({
|
|
|
3929
3930
|
if (options.generateMask) {
|
|
3930
3931
|
options.generateMask(mask);
|
|
3931
3932
|
} else {
|
|
3932
|
-
|
|
3933
|
+
if (randomPoolPointer === RANDOM_POOL_SIZE) {
|
|
3934
|
+
if (randomPool === void 0) {
|
|
3935
|
+
randomPool = Buffer.alloc(RANDOM_POOL_SIZE);
|
|
3936
|
+
}
|
|
3937
|
+
randomFillSync(randomPool, 0, RANDOM_POOL_SIZE);
|
|
3938
|
+
randomPoolPointer = 0;
|
|
3939
|
+
}
|
|
3940
|
+
mask[0] = randomPool[randomPoolPointer++];
|
|
3941
|
+
mask[1] = randomPool[randomPoolPointer++];
|
|
3942
|
+
mask[2] = randomPool[randomPoolPointer++];
|
|
3943
|
+
mask[3] = randomPool[randomPoolPointer++];
|
|
3933
3944
|
}
|
|
3934
3945
|
skipMasking = (mask[0] | mask[1] | mask[2] | mask[3]) === 0;
|
|
3935
3946
|
offset = 6;
|
|
@@ -4022,7 +4033,7 @@ var require_sender = __commonJS({
|
|
|
4022
4033
|
readOnly: false,
|
|
4023
4034
|
rsv1: false
|
|
4024
4035
|
};
|
|
4025
|
-
if (this.
|
|
4036
|
+
if (this._state !== DEFAULT) {
|
|
4026
4037
|
this.enqueue([this.dispatch, buf, false, options, cb]);
|
|
4027
4038
|
} else {
|
|
4028
4039
|
this.sendFrame(_Sender.frame(buf, options), cb);
|
|
@@ -4042,6 +4053,9 @@ var require_sender = __commonJS({
|
|
|
4042
4053
|
if (typeof data === "string") {
|
|
4043
4054
|
byteLength = Buffer.byteLength(data);
|
|
4044
4055
|
readOnly = false;
|
|
4056
|
+
} else if (isBlob(data)) {
|
|
4057
|
+
byteLength = data.size;
|
|
4058
|
+
readOnly = false;
|
|
4045
4059
|
} else {
|
|
4046
4060
|
data = toBuffer(data);
|
|
4047
4061
|
byteLength = data.length;
|
|
@@ -4060,7 +4074,13 @@ var require_sender = __commonJS({
|
|
|
4060
4074
|
readOnly,
|
|
4061
4075
|
rsv1: false
|
|
4062
4076
|
};
|
|
4063
|
-
if (
|
|
4077
|
+
if (isBlob(data)) {
|
|
4078
|
+
if (this._state !== DEFAULT) {
|
|
4079
|
+
this.enqueue([this.getBlobData, data, false, options, cb]);
|
|
4080
|
+
} else {
|
|
4081
|
+
this.getBlobData(data, false, options, cb);
|
|
4082
|
+
}
|
|
4083
|
+
} else if (this._state !== DEFAULT) {
|
|
4064
4084
|
this.enqueue([this.dispatch, data, false, options, cb]);
|
|
4065
4085
|
} else {
|
|
4066
4086
|
this.sendFrame(_Sender.frame(data, options), cb);
|
|
@@ -4080,6 +4100,9 @@ var require_sender = __commonJS({
|
|
|
4080
4100
|
if (typeof data === "string") {
|
|
4081
4101
|
byteLength = Buffer.byteLength(data);
|
|
4082
4102
|
readOnly = false;
|
|
4103
|
+
} else if (isBlob(data)) {
|
|
4104
|
+
byteLength = data.size;
|
|
4105
|
+
readOnly = false;
|
|
4083
4106
|
} else {
|
|
4084
4107
|
data = toBuffer(data);
|
|
4085
4108
|
byteLength = data.length;
|
|
@@ -4098,7 +4121,13 @@ var require_sender = __commonJS({
|
|
|
4098
4121
|
readOnly,
|
|
4099
4122
|
rsv1: false
|
|
4100
4123
|
};
|
|
4101
|
-
if (
|
|
4124
|
+
if (isBlob(data)) {
|
|
4125
|
+
if (this._state !== DEFAULT) {
|
|
4126
|
+
this.enqueue([this.getBlobData, data, false, options, cb]);
|
|
4127
|
+
} else {
|
|
4128
|
+
this.getBlobData(data, false, options, cb);
|
|
4129
|
+
}
|
|
4130
|
+
} else if (this._state !== DEFAULT) {
|
|
4102
4131
|
this.enqueue([this.dispatch, data, false, options, cb]);
|
|
4103
4132
|
} else {
|
|
4104
4133
|
this.sendFrame(_Sender.frame(data, options), cb);
|
|
@@ -4129,6 +4158,9 @@ var require_sender = __commonJS({
|
|
|
4129
4158
|
if (typeof data === "string") {
|
|
4130
4159
|
byteLength = Buffer.byteLength(data);
|
|
4131
4160
|
readOnly = false;
|
|
4161
|
+
} else if (isBlob(data)) {
|
|
4162
|
+
byteLength = data.size;
|
|
4163
|
+
readOnly = false;
|
|
4132
4164
|
} else {
|
|
4133
4165
|
data = toBuffer(data);
|
|
4134
4166
|
byteLength = data.length;
|
|
@@ -4146,38 +4178,75 @@ var require_sender = __commonJS({
|
|
|
4146
4178
|
}
|
|
4147
4179
|
if (options.fin)
|
|
4148
4180
|
this._firstFragment = true;
|
|
4149
|
-
|
|
4150
|
-
|
|
4151
|
-
|
|
4152
|
-
|
|
4153
|
-
|
|
4154
|
-
|
|
4155
|
-
|
|
4156
|
-
|
|
4157
|
-
|
|
4158
|
-
|
|
4159
|
-
|
|
4160
|
-
if (this.
|
|
4161
|
-
this.enqueue([this.
|
|
4181
|
+
const opts = {
|
|
4182
|
+
[kByteLength]: byteLength,
|
|
4183
|
+
fin: options.fin,
|
|
4184
|
+
generateMask: this._generateMask,
|
|
4185
|
+
mask: options.mask,
|
|
4186
|
+
maskBuffer: this._maskBuffer,
|
|
4187
|
+
opcode,
|
|
4188
|
+
readOnly,
|
|
4189
|
+
rsv1
|
|
4190
|
+
};
|
|
4191
|
+
if (isBlob(data)) {
|
|
4192
|
+
if (this._state !== DEFAULT) {
|
|
4193
|
+
this.enqueue([this.getBlobData, data, this._compress, opts, cb]);
|
|
4162
4194
|
} else {
|
|
4163
|
-
this.
|
|
4195
|
+
this.getBlobData(data, this._compress, opts, cb);
|
|
4164
4196
|
}
|
|
4197
|
+
} else if (this._state !== DEFAULT) {
|
|
4198
|
+
this.enqueue([this.dispatch, data, this._compress, opts, cb]);
|
|
4165
4199
|
} else {
|
|
4166
|
-
this.
|
|
4167
|
-
_Sender.frame(data, {
|
|
4168
|
-
[kByteLength]: byteLength,
|
|
4169
|
-
fin: options.fin,
|
|
4170
|
-
generateMask: this._generateMask,
|
|
4171
|
-
mask: options.mask,
|
|
4172
|
-
maskBuffer: this._maskBuffer,
|
|
4173
|
-
opcode,
|
|
4174
|
-
readOnly,
|
|
4175
|
-
rsv1: false
|
|
4176
|
-
}),
|
|
4177
|
-
cb
|
|
4178
|
-
);
|
|
4200
|
+
this.dispatch(data, this._compress, opts, cb);
|
|
4179
4201
|
}
|
|
4180
4202
|
}
|
|
4203
|
+
/**
|
|
4204
|
+
* Gets the contents of a blob as binary data.
|
|
4205
|
+
*
|
|
4206
|
+
* @param {Blob} blob The blob
|
|
4207
|
+
* @param {Boolean} [compress=false] Specifies whether or not to compress
|
|
4208
|
+
* the data
|
|
4209
|
+
* @param {Object} options Options object
|
|
4210
|
+
* @param {Boolean} [options.fin=false] Specifies whether or not to set the
|
|
4211
|
+
* FIN bit
|
|
4212
|
+
* @param {Function} [options.generateMask] The function used to generate the
|
|
4213
|
+
* masking key
|
|
4214
|
+
* @param {Boolean} [options.mask=false] Specifies whether or not to mask
|
|
4215
|
+
* `data`
|
|
4216
|
+
* @param {Buffer} [options.maskBuffer] The buffer used to store the masking
|
|
4217
|
+
* key
|
|
4218
|
+
* @param {Number} options.opcode The opcode
|
|
4219
|
+
* @param {Boolean} [options.readOnly=false] Specifies whether `data` can be
|
|
4220
|
+
* modified
|
|
4221
|
+
* @param {Boolean} [options.rsv1=false] Specifies whether or not to set the
|
|
4222
|
+
* RSV1 bit
|
|
4223
|
+
* @param {Function} [cb] Callback
|
|
4224
|
+
* @private
|
|
4225
|
+
*/
|
|
4226
|
+
getBlobData(blob, compress, options, cb) {
|
|
4227
|
+
this._bufferedBytes += options[kByteLength];
|
|
4228
|
+
this._state = GET_BLOB_DATA;
|
|
4229
|
+
blob.arrayBuffer().then((arrayBuffer) => {
|
|
4230
|
+
if (this._socket.destroyed) {
|
|
4231
|
+
const err = new Error(
|
|
4232
|
+
"The socket was closed while the blob was being read"
|
|
4233
|
+
);
|
|
4234
|
+
process.nextTick(callCallbacks, this, err, cb);
|
|
4235
|
+
return;
|
|
4236
|
+
}
|
|
4237
|
+
this._bufferedBytes -= options[kByteLength];
|
|
4238
|
+
const data = toBuffer(arrayBuffer);
|
|
4239
|
+
if (!compress) {
|
|
4240
|
+
this._state = DEFAULT;
|
|
4241
|
+
this.sendFrame(_Sender.frame(data, options), cb);
|
|
4242
|
+
this.dequeue();
|
|
4243
|
+
} else {
|
|
4244
|
+
this.dispatch(data, compress, options, cb);
|
|
4245
|
+
}
|
|
4246
|
+
}).catch((err) => {
|
|
4247
|
+
process.nextTick(onError, this, err, cb);
|
|
4248
|
+
});
|
|
4249
|
+
}
|
|
4181
4250
|
/**
|
|
4182
4251
|
* Dispatches a message.
|
|
4183
4252
|
*
|
|
@@ -4208,24 +4277,17 @@ var require_sender = __commonJS({
|
|
|
4208
4277
|
}
|
|
4209
4278
|
const perMessageDeflate = this._extensions[PerMessageDeflate.extensionName];
|
|
4210
4279
|
this._bufferedBytes += options[kByteLength];
|
|
4211
|
-
this.
|
|
4280
|
+
this._state = DEFLATING;
|
|
4212
4281
|
perMessageDeflate.compress(data, options.fin, (_, buf) => {
|
|
4213
4282
|
if (this._socket.destroyed) {
|
|
4214
4283
|
const err = new Error(
|
|
4215
4284
|
"The socket was closed while data was being compressed"
|
|
4216
4285
|
);
|
|
4217
|
-
|
|
4218
|
-
cb(err);
|
|
4219
|
-
for (let i = 0; i < this._queue.length; i++) {
|
|
4220
|
-
const params = this._queue[i];
|
|
4221
|
-
const callback = params[params.length - 1];
|
|
4222
|
-
if (typeof callback === "function")
|
|
4223
|
-
callback(err);
|
|
4224
|
-
}
|
|
4286
|
+
callCallbacks(this, err, cb);
|
|
4225
4287
|
return;
|
|
4226
4288
|
}
|
|
4227
4289
|
this._bufferedBytes -= options[kByteLength];
|
|
4228
|
-
this.
|
|
4290
|
+
this._state = DEFAULT;
|
|
4229
4291
|
options.readOnly = false;
|
|
4230
4292
|
this.sendFrame(_Sender.frame(buf, options), cb);
|
|
4231
4293
|
this.dequeue();
|
|
@@ -4237,7 +4299,7 @@ var require_sender = __commonJS({
|
|
|
4237
4299
|
* @private
|
|
4238
4300
|
*/
|
|
4239
4301
|
dequeue() {
|
|
4240
|
-
while (
|
|
4302
|
+
while (this._state === DEFAULT && this._queue.length) {
|
|
4241
4303
|
const params = this._queue.shift();
|
|
4242
4304
|
this._bufferedBytes -= params[3][kByteLength];
|
|
4243
4305
|
Reflect.apply(params[0], this, params.slice(1));
|
|
@@ -4256,7 +4318,7 @@ var require_sender = __commonJS({
|
|
|
4256
4318
|
/**
|
|
4257
4319
|
* Sends a frame.
|
|
4258
4320
|
*
|
|
4259
|
-
* @param {Buffer[]} list The frame to send
|
|
4321
|
+
* @param {(Buffer | String)[]} list The frame to send
|
|
4260
4322
|
* @param {Function} [cb] Callback
|
|
4261
4323
|
* @private
|
|
4262
4324
|
*/
|
|
@@ -4272,13 +4334,28 @@ var require_sender = __commonJS({
|
|
|
4272
4334
|
}
|
|
4273
4335
|
};
|
|
4274
4336
|
module.exports = Sender2;
|
|
4337
|
+
function callCallbacks(sender, err, cb) {
|
|
4338
|
+
if (typeof cb === "function")
|
|
4339
|
+
cb(err);
|
|
4340
|
+
for (let i = 0; i < sender._queue.length; i++) {
|
|
4341
|
+
const params = sender._queue[i];
|
|
4342
|
+
const callback = params[params.length - 1];
|
|
4343
|
+
if (typeof callback === "function")
|
|
4344
|
+
callback(err);
|
|
4345
|
+
}
|
|
4346
|
+
}
|
|
4347
|
+
function onError(sender, err, cb) {
|
|
4348
|
+
callCallbacks(sender, err, cb);
|
|
4349
|
+
sender.onerror(err);
|
|
4350
|
+
}
|
|
4275
4351
|
}
|
|
4276
4352
|
});
|
|
4277
4353
|
|
|
4278
|
-
//
|
|
4354
|
+
// ../node_modules/ws/lib/event-target.js
|
|
4279
4355
|
var require_event_target = __commonJS({
|
|
4280
|
-
"
|
|
4356
|
+
"../node_modules/ws/lib/event-target.js"(exports, module) {
|
|
4281
4357
|
"use strict";
|
|
4358
|
+
init_deno_env();
|
|
4282
4359
|
var { kForOnEventAttribute, kListener } = require_constants();
|
|
4283
4360
|
var kCode = Symbol("kCode");
|
|
4284
4361
|
var kData = Symbol("kData");
|
|
@@ -4504,10 +4581,11 @@ var require_event_target = __commonJS({
|
|
|
4504
4581
|
}
|
|
4505
4582
|
});
|
|
4506
4583
|
|
|
4507
|
-
//
|
|
4584
|
+
// ../node_modules/ws/lib/extension.js
|
|
4508
4585
|
var require_extension = __commonJS({
|
|
4509
|
-
"
|
|
4586
|
+
"../node_modules/ws/lib/extension.js"(exports, module) {
|
|
4510
4587
|
"use strict";
|
|
4588
|
+
init_deno_env();
|
|
4511
4589
|
var { tokenChars } = require_validation();
|
|
4512
4590
|
function push(dest, name, elem) {
|
|
4513
4591
|
if (dest[name] === void 0)
|
|
@@ -4674,10 +4752,11 @@ var require_extension = __commonJS({
|
|
|
4674
4752
|
}
|
|
4675
4753
|
});
|
|
4676
4754
|
|
|
4677
|
-
//
|
|
4755
|
+
// ../node_modules/ws/lib/websocket.js
|
|
4678
4756
|
var require_websocket = __commonJS({
|
|
4679
|
-
"
|
|
4757
|
+
"../node_modules/ws/lib/websocket.js"(exports, module) {
|
|
4680
4758
|
"use strict";
|
|
4759
|
+
init_deno_env();
|
|
4681
4760
|
var EventEmitter = __require2("events");
|
|
4682
4761
|
var https = __require2("https");
|
|
4683
4762
|
var http = __require2("http");
|
|
@@ -4689,6 +4768,7 @@ var require_websocket = __commonJS({
|
|
|
4689
4768
|
var PerMessageDeflate = require_permessage_deflate();
|
|
4690
4769
|
var Receiver2 = require_receiver();
|
|
4691
4770
|
var Sender2 = require_sender();
|
|
4771
|
+
var { isBlob } = require_validation();
|
|
4692
4772
|
var {
|
|
4693
4773
|
BINARY_TYPES,
|
|
4694
4774
|
EMPTY_BUFFER,
|
|
@@ -4725,6 +4805,7 @@ var require_websocket = __commonJS({
|
|
|
4725
4805
|
this._closeFrameSent = false;
|
|
4726
4806
|
this._closeMessage = EMPTY_BUFFER;
|
|
4727
4807
|
this._closeTimer = null;
|
|
4808
|
+
this._errorEmitted = false;
|
|
4728
4809
|
this._extensions = {};
|
|
4729
4810
|
this._paused = false;
|
|
4730
4811
|
this._protocol = "";
|
|
@@ -4753,9 +4834,8 @@ var require_websocket = __commonJS({
|
|
|
4753
4834
|
}
|
|
4754
4835
|
}
|
|
4755
4836
|
/**
|
|
4756
|
-
*
|
|
4757
|
-
*
|
|
4758
|
-
* type).
|
|
4837
|
+
* For historical reasons, the custom "nodebuffer" type is used by the default
|
|
4838
|
+
* instead of "blob".
|
|
4759
4839
|
*
|
|
4760
4840
|
* @type {String}
|
|
4761
4841
|
*/
|
|
@@ -4860,10 +4940,12 @@ var require_websocket = __commonJS({
|
|
|
4860
4940
|
maxPayload: options.maxPayload,
|
|
4861
4941
|
skipUTF8Validation: options.skipUTF8Validation
|
|
4862
4942
|
});
|
|
4863
|
-
|
|
4943
|
+
const sender = new Sender2(socket, this._extensions, options.generateMask);
|
|
4864
4944
|
this._receiver = receiver;
|
|
4945
|
+
this._sender = sender;
|
|
4865
4946
|
this._socket = socket;
|
|
4866
4947
|
receiver[kWebSocket] = this;
|
|
4948
|
+
sender[kWebSocket] = this;
|
|
4867
4949
|
socket[kWebSocket] = this;
|
|
4868
4950
|
receiver.on("conclude", receiverOnConclude);
|
|
4869
4951
|
receiver.on("drain", receiverOnDrain);
|
|
@@ -4871,6 +4953,7 @@ var require_websocket = __commonJS({
|
|
|
4871
4953
|
receiver.on("message", receiverOnMessage);
|
|
4872
4954
|
receiver.on("ping", receiverOnPing);
|
|
4873
4955
|
receiver.on("pong", receiverOnPong);
|
|
4956
|
+
sender.onerror = senderOnError;
|
|
4874
4957
|
if (socket.setTimeout)
|
|
4875
4958
|
socket.setTimeout(0);
|
|
4876
4959
|
if (socket.setNoDelay)
|
|
@@ -4945,10 +5028,7 @@ var require_websocket = __commonJS({
|
|
|
4945
5028
|
this._socket.end();
|
|
4946
5029
|
}
|
|
4947
5030
|
});
|
|
4948
|
-
this
|
|
4949
|
-
this._socket.destroy.bind(this._socket),
|
|
4950
|
-
closeTimeout
|
|
4951
|
-
);
|
|
5031
|
+
setCloseTimer(this);
|
|
4952
5032
|
}
|
|
4953
5033
|
/**
|
|
4954
5034
|
* Pause the socket.
|
|
@@ -5210,7 +5290,7 @@ var require_websocket = __commonJS({
|
|
|
5210
5290
|
const isIpcUrl = parsedUrl.protocol === "ws+unix:";
|
|
5211
5291
|
let invalidUrlMessage;
|
|
5212
5292
|
if (parsedUrl.protocol !== "ws:" && !isSecure && !isIpcUrl) {
|
|
5213
|
-
invalidUrlMessage = `The URL's protocol must be one of "ws:", "wss:", "http:", "https", or "ws+unix:"`;
|
|
5293
|
+
invalidUrlMessage = `The URL's protocol must be one of "ws:", "wss:", "http:", "https:", or "ws+unix:"`;
|
|
5214
5294
|
} else if (isIpcUrl && !parsedUrl.pathname) {
|
|
5215
5295
|
invalidUrlMessage = "The URL's pathname is empty";
|
|
5216
5296
|
} else if (parsedUrl.hash) {
|
|
@@ -5354,7 +5434,8 @@ var require_websocket = __commonJS({
|
|
|
5354
5434
|
if (websocket.readyState !== WebSocket2.CONNECTING)
|
|
5355
5435
|
return;
|
|
5356
5436
|
req = websocket._req = null;
|
|
5357
|
-
|
|
5437
|
+
const upgrade = res.headers.upgrade;
|
|
5438
|
+
if (upgrade === void 0 || upgrade.toLowerCase() !== "websocket") {
|
|
5358
5439
|
abortHandshake(websocket, socket, "Invalid Upgrade header");
|
|
5359
5440
|
return;
|
|
5360
5441
|
}
|
|
@@ -5425,6 +5506,7 @@ var require_websocket = __commonJS({
|
|
|
5425
5506
|
}
|
|
5426
5507
|
function emitErrorAndClose(websocket, err) {
|
|
5427
5508
|
websocket._readyState = WebSocket2.CLOSING;
|
|
5509
|
+
websocket._errorEmitted = true;
|
|
5428
5510
|
websocket.emit("error", err);
|
|
5429
5511
|
websocket.emitClose();
|
|
5430
5512
|
}
|
|
@@ -5458,7 +5540,7 @@ var require_websocket = __commonJS({
|
|
|
5458
5540
|
}
|
|
5459
5541
|
function sendAfterClose(websocket, data, cb) {
|
|
5460
5542
|
if (data) {
|
|
5461
|
-
const length = toBuffer(data).length;
|
|
5543
|
+
const length = isBlob(data) ? data.size : toBuffer(data).length;
|
|
5462
5544
|
if (websocket._socket)
|
|
5463
5545
|
websocket._sender._bufferedBytes += length;
|
|
5464
5546
|
else
|
|
@@ -5497,7 +5579,10 @@ var require_websocket = __commonJS({
|
|
|
5497
5579
|
process.nextTick(resume, websocket._socket);
|
|
5498
5580
|
websocket.close(err[kStatusCode]);
|
|
5499
5581
|
}
|
|
5500
|
-
websocket.
|
|
5582
|
+
if (!websocket._errorEmitted) {
|
|
5583
|
+
websocket._errorEmitted = true;
|
|
5584
|
+
websocket.emit("error", err);
|
|
5585
|
+
}
|
|
5501
5586
|
}
|
|
5502
5587
|
function receiverOnFinish() {
|
|
5503
5588
|
this[kWebSocket].emitClose();
|
|
@@ -5517,6 +5602,26 @@ var require_websocket = __commonJS({
|
|
|
5517
5602
|
function resume(stream) {
|
|
5518
5603
|
stream.resume();
|
|
5519
5604
|
}
|
|
5605
|
+
function senderOnError(err) {
|
|
5606
|
+
const websocket = this[kWebSocket];
|
|
5607
|
+
if (websocket.readyState === WebSocket2.CLOSED)
|
|
5608
|
+
return;
|
|
5609
|
+
if (websocket.readyState === WebSocket2.OPEN) {
|
|
5610
|
+
websocket._readyState = WebSocket2.CLOSING;
|
|
5611
|
+
setCloseTimer(websocket);
|
|
5612
|
+
}
|
|
5613
|
+
this._socket.end();
|
|
5614
|
+
if (!websocket._errorEmitted) {
|
|
5615
|
+
websocket._errorEmitted = true;
|
|
5616
|
+
websocket.emit("error", err);
|
|
5617
|
+
}
|
|
5618
|
+
}
|
|
5619
|
+
function setCloseTimer(websocket) {
|
|
5620
|
+
websocket._closeTimer = setTimeout(
|
|
5621
|
+
websocket._socket.destroy.bind(websocket._socket),
|
|
5622
|
+
closeTimeout
|
|
5623
|
+
);
|
|
5624
|
+
}
|
|
5520
5625
|
function socketOnClose() {
|
|
5521
5626
|
const websocket = this[kWebSocket];
|
|
5522
5627
|
this.removeListener("close", socketOnClose);
|
|
@@ -5560,10 +5665,118 @@ var require_websocket = __commonJS({
|
|
|
5560
5665
|
}
|
|
5561
5666
|
});
|
|
5562
5667
|
|
|
5563
|
-
//
|
|
5668
|
+
// ../node_modules/ws/lib/stream.js
|
|
5669
|
+
var require_stream = __commonJS({
|
|
5670
|
+
"../node_modules/ws/lib/stream.js"(exports, module) {
|
|
5671
|
+
"use strict";
|
|
5672
|
+
init_deno_env();
|
|
5673
|
+
var WebSocket2 = require_websocket();
|
|
5674
|
+
var { Duplex } = __require2("stream");
|
|
5675
|
+
function emitClose(stream) {
|
|
5676
|
+
stream.emit("close");
|
|
5677
|
+
}
|
|
5678
|
+
function duplexOnEnd() {
|
|
5679
|
+
if (!this.destroyed && this._writableState.finished) {
|
|
5680
|
+
this.destroy();
|
|
5681
|
+
}
|
|
5682
|
+
}
|
|
5683
|
+
function duplexOnError(err) {
|
|
5684
|
+
this.removeListener("error", duplexOnError);
|
|
5685
|
+
this.destroy();
|
|
5686
|
+
if (this.listenerCount("error") === 0) {
|
|
5687
|
+
this.emit("error", err);
|
|
5688
|
+
}
|
|
5689
|
+
}
|
|
5690
|
+
function createWebSocketStream2(ws, options) {
|
|
5691
|
+
let terminateOnDestroy = true;
|
|
5692
|
+
const duplex = new Duplex({
|
|
5693
|
+
...options,
|
|
5694
|
+
autoDestroy: false,
|
|
5695
|
+
emitClose: false,
|
|
5696
|
+
objectMode: false,
|
|
5697
|
+
writableObjectMode: false
|
|
5698
|
+
});
|
|
5699
|
+
ws.on("message", function message(msg, isBinary) {
|
|
5700
|
+
const data = !isBinary && duplex._readableState.objectMode ? msg.toString() : msg;
|
|
5701
|
+
if (!duplex.push(data))
|
|
5702
|
+
ws.pause();
|
|
5703
|
+
});
|
|
5704
|
+
ws.once("error", function error(err) {
|
|
5705
|
+
if (duplex.destroyed)
|
|
5706
|
+
return;
|
|
5707
|
+
terminateOnDestroy = false;
|
|
5708
|
+
duplex.destroy(err);
|
|
5709
|
+
});
|
|
5710
|
+
ws.once("close", function close() {
|
|
5711
|
+
if (duplex.destroyed)
|
|
5712
|
+
return;
|
|
5713
|
+
duplex.push(null);
|
|
5714
|
+
});
|
|
5715
|
+
duplex._destroy = function(err, callback) {
|
|
5716
|
+
if (ws.readyState === ws.CLOSED) {
|
|
5717
|
+
callback(err);
|
|
5718
|
+
process.nextTick(emitClose, duplex);
|
|
5719
|
+
return;
|
|
5720
|
+
}
|
|
5721
|
+
let called = false;
|
|
5722
|
+
ws.once("error", function error(err2) {
|
|
5723
|
+
called = true;
|
|
5724
|
+
callback(err2);
|
|
5725
|
+
});
|
|
5726
|
+
ws.once("close", function close() {
|
|
5727
|
+
if (!called)
|
|
5728
|
+
callback(err);
|
|
5729
|
+
process.nextTick(emitClose, duplex);
|
|
5730
|
+
});
|
|
5731
|
+
if (terminateOnDestroy)
|
|
5732
|
+
ws.terminate();
|
|
5733
|
+
};
|
|
5734
|
+
duplex._final = function(callback) {
|
|
5735
|
+
if (ws.readyState === ws.CONNECTING) {
|
|
5736
|
+
ws.once("open", function open() {
|
|
5737
|
+
duplex._final(callback);
|
|
5738
|
+
});
|
|
5739
|
+
return;
|
|
5740
|
+
}
|
|
5741
|
+
if (ws._socket === null)
|
|
5742
|
+
return;
|
|
5743
|
+
if (ws._socket._writableState.finished) {
|
|
5744
|
+
callback();
|
|
5745
|
+
if (duplex._readableState.endEmitted)
|
|
5746
|
+
duplex.destroy();
|
|
5747
|
+
} else {
|
|
5748
|
+
ws._socket.once("finish", function finish() {
|
|
5749
|
+
callback();
|
|
5750
|
+
});
|
|
5751
|
+
ws.close();
|
|
5752
|
+
}
|
|
5753
|
+
};
|
|
5754
|
+
duplex._read = function() {
|
|
5755
|
+
if (ws.isPaused)
|
|
5756
|
+
ws.resume();
|
|
5757
|
+
};
|
|
5758
|
+
duplex._write = function(chunk, encoding, callback) {
|
|
5759
|
+
if (ws.readyState === ws.CONNECTING) {
|
|
5760
|
+
ws.once("open", function open() {
|
|
5761
|
+
duplex._write(chunk, encoding, callback);
|
|
5762
|
+
});
|
|
5763
|
+
return;
|
|
5764
|
+
}
|
|
5765
|
+
ws.send(chunk, callback);
|
|
5766
|
+
};
|
|
5767
|
+
duplex.on("end", duplexOnEnd);
|
|
5768
|
+
duplex.on("error", duplexOnError);
|
|
5769
|
+
return duplex;
|
|
5770
|
+
}
|
|
5771
|
+
module.exports = createWebSocketStream2;
|
|
5772
|
+
}
|
|
5773
|
+
});
|
|
5774
|
+
|
|
5775
|
+
// ../node_modules/ws/lib/subprotocol.js
|
|
5564
5776
|
var require_subprotocol = __commonJS({
|
|
5565
|
-
"
|
|
5777
|
+
"../node_modules/ws/lib/subprotocol.js"(exports, module) {
|
|
5566
5778
|
"use strict";
|
|
5779
|
+
init_deno_env();
|
|
5567
5780
|
var { tokenChars } = require_validation();
|
|
5568
5781
|
function parse(header) {
|
|
5569
5782
|
const protocols = /* @__PURE__ */ new Set();
|
|
@@ -5608,10 +5821,11 @@ var require_subprotocol = __commonJS({
|
|
|
5608
5821
|
}
|
|
5609
5822
|
});
|
|
5610
5823
|
|
|
5611
|
-
//
|
|
5824
|
+
// ../node_modules/ws/lib/websocket-server.js
|
|
5612
5825
|
var require_websocket_server = __commonJS({
|
|
5613
|
-
"
|
|
5826
|
+
"../node_modules/ws/lib/websocket-server.js"(exports, module) {
|
|
5614
5827
|
"use strict";
|
|
5828
|
+
init_deno_env();
|
|
5615
5829
|
var EventEmitter = __require2("events");
|
|
5616
5830
|
var http = __require2("http");
|
|
5617
5831
|
var { Duplex } = __require2("stream");
|
|
@@ -5810,25 +6024,28 @@ var require_websocket_server = __commonJS({
|
|
|
5810
6024
|
handleUpgrade(req, socket, head, cb) {
|
|
5811
6025
|
socket.on("error", socketOnError);
|
|
5812
6026
|
const key = req.headers["sec-websocket-key"];
|
|
6027
|
+
const upgrade = req.headers.upgrade;
|
|
5813
6028
|
const version = +req.headers["sec-websocket-version"];
|
|
5814
6029
|
if (req.method !== "GET") {
|
|
5815
6030
|
const message = "Invalid HTTP method";
|
|
5816
6031
|
abortHandshakeOrEmitwsClientError(this, req, socket, 405, message);
|
|
5817
6032
|
return;
|
|
5818
6033
|
}
|
|
5819
|
-
if (
|
|
6034
|
+
if (upgrade === void 0 || upgrade.toLowerCase() !== "websocket") {
|
|
5820
6035
|
const message = "Invalid Upgrade header";
|
|
5821
6036
|
abortHandshakeOrEmitwsClientError(this, req, socket, 400, message);
|
|
5822
6037
|
return;
|
|
5823
6038
|
}
|
|
5824
|
-
if (
|
|
6039
|
+
if (key === void 0 || !keyRegex.test(key)) {
|
|
5825
6040
|
const message = "Missing or invalid Sec-WebSocket-Key header";
|
|
5826
6041
|
abortHandshakeOrEmitwsClientError(this, req, socket, 400, message);
|
|
5827
6042
|
return;
|
|
5828
6043
|
}
|
|
5829
|
-
if (version !==
|
|
6044
|
+
if (version !== 13 && version !== 8) {
|
|
5830
6045
|
const message = "Missing or invalid Sec-WebSocket-Version header";
|
|
5831
|
-
abortHandshakeOrEmitwsClientError(this, req, socket, 400, message
|
|
6046
|
+
abortHandshakeOrEmitwsClientError(this, req, socket, 400, message, {
|
|
6047
|
+
"Sec-WebSocket-Version": "13, 8"
|
|
6048
|
+
});
|
|
5832
6049
|
return;
|
|
5833
6050
|
}
|
|
5834
6051
|
if (!this.shouldHandle(req)) {
|
|
@@ -5991,19 +6208,19 @@ var require_websocket_server = __commonJS({
|
|
|
5991
6208
|
` + Object.keys(headers).map((h) => `${h}: ${headers[h]}`).join("\r\n") + "\r\n\r\n" + message
|
|
5992
6209
|
);
|
|
5993
6210
|
}
|
|
5994
|
-
function abortHandshakeOrEmitwsClientError(server, req, socket, code, message) {
|
|
6211
|
+
function abortHandshakeOrEmitwsClientError(server, req, socket, code, message, headers) {
|
|
5995
6212
|
if (server.listenerCount("wsClientError")) {
|
|
5996
6213
|
const err = new Error(message);
|
|
5997
6214
|
Error.captureStackTrace(err, abortHandshakeOrEmitwsClientError);
|
|
5998
6215
|
server.emit("wsClientError", err, socket, req);
|
|
5999
6216
|
} else {
|
|
6000
|
-
abortHandshake(socket, code, message);
|
|
6217
|
+
abortHandshake(socket, code, message, headers);
|
|
6001
6218
|
}
|
|
6002
6219
|
}
|
|
6003
6220
|
}
|
|
6004
6221
|
});
|
|
6005
6222
|
|
|
6006
|
-
//
|
|
6223
|
+
// ../node_modules/ws/wrapper.mjs
|
|
6007
6224
|
var wrapper_exports = {};
|
|
6008
6225
|
__export(wrapper_exports, {
|
|
6009
6226
|
Receiver: () => import_receiver.default,
|
|
@@ -6015,7 +6232,8 @@ __export(wrapper_exports, {
|
|
|
6015
6232
|
});
|
|
6016
6233
|
var import_stream, import_receiver, import_sender, import_websocket, import_websocket_server, wrapper_default;
|
|
6017
6234
|
var init_wrapper = __esm({
|
|
6018
|
-
"
|
|
6235
|
+
"../node_modules/ws/wrapper.mjs"() {
|
|
6236
|
+
init_deno_env();
|
|
6019
6237
|
import_stream = __toESM(require_stream(), 1);
|
|
6020
6238
|
import_receiver = __toESM(require_receiver(), 1);
|
|
6021
6239
|
import_sender = __toESM(require_sender(), 1);
|
|
@@ -6132,6 +6350,7 @@ var pendingWebSocketUpgrades, wsServer, NodeServer;
|
|
|
6132
6350
|
var init_http_server = __esm({
|
|
6133
6351
|
"src/platform/adapters/node/http-server.ts"() {
|
|
6134
6352
|
"use strict";
|
|
6353
|
+
init_deno_env();
|
|
6135
6354
|
init_config();
|
|
6136
6355
|
pendingWebSocketUpgrades = /* @__PURE__ */ new Map();
|
|
6137
6356
|
wsServer = null;
|
|
@@ -6163,6 +6382,7 @@ var NodeServerAdapter, NodeWebSocket;
|
|
|
6163
6382
|
var init_websocket_adapter = __esm({
|
|
6164
6383
|
"src/platform/adapters/node/websocket-adapter.ts"() {
|
|
6165
6384
|
"use strict";
|
|
6385
|
+
init_deno_env();
|
|
6166
6386
|
init_veryfront_error();
|
|
6167
6387
|
init_utils();
|
|
6168
6388
|
init_http_server();
|
|
@@ -6319,6 +6539,7 @@ var NodeAdapter, nodeAdapter;
|
|
|
6319
6539
|
var init_adapter = __esm({
|
|
6320
6540
|
"src/platform/adapters/node/adapter.ts"() {
|
|
6321
6541
|
"use strict";
|
|
6542
|
+
init_deno_env();
|
|
6322
6543
|
init_filesystem_adapter();
|
|
6323
6544
|
init_environment_adapter();
|
|
6324
6545
|
init_websocket_adapter();
|
|
@@ -6366,6 +6587,7 @@ var init_adapter = __esm({
|
|
|
6366
6587
|
var init_node = __esm({
|
|
6367
6588
|
"src/platform/adapters/node/index.ts"() {
|
|
6368
6589
|
"use strict";
|
|
6590
|
+
init_deno_env();
|
|
6369
6591
|
init_adapter();
|
|
6370
6592
|
init_filesystem_adapter();
|
|
6371
6593
|
init_environment_adapter();
|
|
@@ -6389,6 +6611,7 @@ __export(node_exports, {
|
|
|
6389
6611
|
var init_node2 = __esm({
|
|
6390
6612
|
"src/platform/adapters/node.ts"() {
|
|
6391
6613
|
"use strict";
|
|
6614
|
+
init_deno_env();
|
|
6392
6615
|
init_node();
|
|
6393
6616
|
}
|
|
6394
6617
|
});
|
|
@@ -6398,6 +6621,7 @@ var VeryfrontError;
|
|
|
6398
6621
|
var init_types = __esm({
|
|
6399
6622
|
"src/core/errors/types.ts"() {
|
|
6400
6623
|
"use strict";
|
|
6624
|
+
init_deno_env();
|
|
6401
6625
|
VeryfrontError = class extends Error {
|
|
6402
6626
|
constructor(message, code, context) {
|
|
6403
6627
|
super(message);
|
|
@@ -6413,6 +6637,7 @@ var init_types = __esm({
|
|
|
6413
6637
|
var init_agent_errors = __esm({
|
|
6414
6638
|
"src/core/errors/agent-errors.ts"() {
|
|
6415
6639
|
"use strict";
|
|
6640
|
+
init_deno_env();
|
|
6416
6641
|
init_types();
|
|
6417
6642
|
}
|
|
6418
6643
|
});
|
|
@@ -6421,6 +6646,7 @@ var init_agent_errors = __esm({
|
|
|
6421
6646
|
var init_build_errors = __esm({
|
|
6422
6647
|
"src/core/errors/build-errors.ts"() {
|
|
6423
6648
|
"use strict";
|
|
6649
|
+
init_deno_env();
|
|
6424
6650
|
init_types();
|
|
6425
6651
|
}
|
|
6426
6652
|
});
|
|
@@ -6429,6 +6655,7 @@ var init_build_errors = __esm({
|
|
|
6429
6655
|
var init_runtime_errors = __esm({
|
|
6430
6656
|
"src/core/errors/runtime-errors.ts"() {
|
|
6431
6657
|
"use strict";
|
|
6658
|
+
init_deno_env();
|
|
6432
6659
|
init_types();
|
|
6433
6660
|
}
|
|
6434
6661
|
});
|
|
@@ -6438,6 +6665,7 @@ var FileSystemError;
|
|
|
6438
6665
|
var init_system_errors = __esm({
|
|
6439
6666
|
"src/core/errors/system-errors.ts"() {
|
|
6440
6667
|
"use strict";
|
|
6668
|
+
init_deno_env();
|
|
6441
6669
|
init_types();
|
|
6442
6670
|
FileSystemError = class extends VeryfrontError {
|
|
6443
6671
|
constructor(message, context) {
|
|
@@ -6452,6 +6680,7 @@ var init_system_errors = __esm({
|
|
|
6452
6680
|
var init_error_handlers = __esm({
|
|
6453
6681
|
"src/core/errors/error-handlers.ts"() {
|
|
6454
6682
|
"use strict";
|
|
6683
|
+
init_deno_env();
|
|
6455
6684
|
init_logger();
|
|
6456
6685
|
init_types();
|
|
6457
6686
|
}
|
|
@@ -6465,6 +6694,7 @@ var ErrorCode2;
|
|
|
6465
6694
|
var init_error_codes = __esm({
|
|
6466
6695
|
"src/core/errors/error-codes.ts"() {
|
|
6467
6696
|
"use strict";
|
|
6697
|
+
init_deno_env();
|
|
6468
6698
|
ErrorCode2 = {
|
|
6469
6699
|
CONFIG_NOT_FOUND: "VF001",
|
|
6470
6700
|
CONFIG_INVALID: "VF002",
|
|
@@ -6542,6 +6772,7 @@ function createSimpleError(code, title, message, steps) {
|
|
|
6542
6772
|
var init_factory = __esm({
|
|
6543
6773
|
"src/core/errors/catalog/factory.ts"() {
|
|
6544
6774
|
"use strict";
|
|
6775
|
+
init_deno_env();
|
|
6545
6776
|
init_error_codes();
|
|
6546
6777
|
}
|
|
6547
6778
|
});
|
|
@@ -6551,6 +6782,7 @@ var CONFIG_ERROR_CATALOG;
|
|
|
6551
6782
|
var init_config_errors = __esm({
|
|
6552
6783
|
"src/core/errors/catalog/config-errors.ts"() {
|
|
6553
6784
|
"use strict";
|
|
6785
|
+
init_deno_env();
|
|
6554
6786
|
init_error_codes();
|
|
6555
6787
|
init_factory();
|
|
6556
6788
|
CONFIG_ERROR_CATALOG = {
|
|
@@ -6657,6 +6889,7 @@ var BUILD_ERROR_CATALOG;
|
|
|
6657
6889
|
var init_build_errors2 = __esm({
|
|
6658
6890
|
"src/core/errors/catalog/build-errors.ts"() {
|
|
6659
6891
|
"use strict";
|
|
6892
|
+
init_deno_env();
|
|
6660
6893
|
init_error_codes();
|
|
6661
6894
|
init_factory();
|
|
6662
6895
|
BUILD_ERROR_CATALOG = {
|
|
@@ -6748,6 +6981,7 @@ var RUNTIME_ERROR_CATALOG;
|
|
|
6748
6981
|
var init_runtime_errors2 = __esm({
|
|
6749
6982
|
"src/core/errors/catalog/runtime-errors.ts"() {
|
|
6750
6983
|
"use strict";
|
|
6984
|
+
init_deno_env();
|
|
6751
6985
|
init_error_codes();
|
|
6752
6986
|
init_factory();
|
|
6753
6987
|
RUNTIME_ERROR_CATALOG = {
|
|
@@ -6845,6 +7079,7 @@ var ROUTE_ERROR_CATALOG;
|
|
|
6845
7079
|
var init_route_errors = __esm({
|
|
6846
7080
|
"src/core/errors/catalog/route-errors.ts"() {
|
|
6847
7081
|
"use strict";
|
|
7082
|
+
init_deno_env();
|
|
6848
7083
|
init_error_codes();
|
|
6849
7084
|
init_factory();
|
|
6850
7085
|
ROUTE_ERROR_CATALOG = {
|
|
@@ -6920,6 +7155,7 @@ var MODULE_ERROR_CATALOG;
|
|
|
6920
7155
|
var init_module_errors = __esm({
|
|
6921
7156
|
"src/core/errors/catalog/module-errors.ts"() {
|
|
6922
7157
|
"use strict";
|
|
7158
|
+
init_deno_env();
|
|
6923
7159
|
init_error_codes();
|
|
6924
7160
|
init_factory();
|
|
6925
7161
|
MODULE_ERROR_CATALOG = {
|
|
@@ -7008,6 +7244,7 @@ var SERVER_ERROR_CATALOG;
|
|
|
7008
7244
|
var init_server_errors = __esm({
|
|
7009
7245
|
"src/core/errors/catalog/server-errors.ts"() {
|
|
7010
7246
|
"use strict";
|
|
7247
|
+
init_deno_env();
|
|
7011
7248
|
init_error_codes();
|
|
7012
7249
|
init_factory();
|
|
7013
7250
|
SERVER_ERROR_CATALOG = {
|
|
@@ -7083,6 +7320,7 @@ var RSC_ERROR_CATALOG;
|
|
|
7083
7320
|
var init_rsc_errors = __esm({
|
|
7084
7321
|
"src/core/errors/catalog/rsc-errors.ts"() {
|
|
7085
7322
|
"use strict";
|
|
7323
|
+
init_deno_env();
|
|
7086
7324
|
init_error_codes();
|
|
7087
7325
|
init_factory();
|
|
7088
7326
|
RSC_ERROR_CATALOG = {
|
|
@@ -7170,6 +7408,7 @@ var DEV_ERROR_CATALOG;
|
|
|
7170
7408
|
var init_dev_errors = __esm({
|
|
7171
7409
|
"src/core/errors/catalog/dev-errors.ts"() {
|
|
7172
7410
|
"use strict";
|
|
7411
|
+
init_deno_env();
|
|
7173
7412
|
init_error_codes();
|
|
7174
7413
|
init_factory();
|
|
7175
7414
|
DEV_ERROR_CATALOG = {
|
|
@@ -7222,6 +7461,7 @@ var DEPLOYMENT_ERROR_CATALOG;
|
|
|
7222
7461
|
var init_deployment_errors = __esm({
|
|
7223
7462
|
"src/core/errors/catalog/deployment-errors.ts"() {
|
|
7224
7463
|
"use strict";
|
|
7464
|
+
init_deno_env();
|
|
7225
7465
|
init_error_codes();
|
|
7226
7466
|
init_factory();
|
|
7227
7467
|
DEPLOYMENT_ERROR_CATALOG = {
|
|
@@ -7274,6 +7514,7 @@ var GENERAL_ERROR_CATALOG;
|
|
|
7274
7514
|
var init_general_errors = __esm({
|
|
7275
7515
|
"src/core/errors/catalog/general-errors.ts"() {
|
|
7276
7516
|
"use strict";
|
|
7517
|
+
init_deno_env();
|
|
7277
7518
|
init_error_codes();
|
|
7278
7519
|
init_factory();
|
|
7279
7520
|
GENERAL_ERROR_CATALOG = {
|
|
@@ -7337,6 +7578,7 @@ var ERROR_CATALOG;
|
|
|
7337
7578
|
var init_catalog = __esm({
|
|
7338
7579
|
"src/core/errors/catalog/index.ts"() {
|
|
7339
7580
|
"use strict";
|
|
7581
|
+
init_deno_env();
|
|
7340
7582
|
init_config_errors();
|
|
7341
7583
|
init_build_errors2();
|
|
7342
7584
|
init_runtime_errors2();
|
|
@@ -7367,6 +7609,7 @@ var init_catalog = __esm({
|
|
|
7367
7609
|
var init_error_catalog = __esm({
|
|
7368
7610
|
"src/core/errors/user-friendly/error-catalog.ts"() {
|
|
7369
7611
|
"use strict";
|
|
7612
|
+
init_deno_env();
|
|
7370
7613
|
}
|
|
7371
7614
|
});
|
|
7372
7615
|
|
|
@@ -7374,6 +7617,7 @@ var init_error_catalog = __esm({
|
|
|
7374
7617
|
var ansi, red, green, yellow, blue, magenta, cyan, white, gray, bold, dim, italic, underline, strikethrough, reset;
|
|
7375
7618
|
var init_ansi = __esm({
|
|
7376
7619
|
"src/platform/compat/console/ansi.ts"() {
|
|
7620
|
+
init_deno_env();
|
|
7377
7621
|
ansi = (open, close) => (text) => `\x1B[${open}m${text}\x1B[${close}m`;
|
|
7378
7622
|
red = ansi(31, 39);
|
|
7379
7623
|
green = ansi(32, 39);
|
|
@@ -7415,6 +7659,7 @@ var colors;
|
|
|
7415
7659
|
var init_deno3 = __esm({
|
|
7416
7660
|
"src/platform/compat/console/deno.ts"() {
|
|
7417
7661
|
"use strict";
|
|
7662
|
+
init_deno_env();
|
|
7418
7663
|
init_ansi();
|
|
7419
7664
|
colors = {
|
|
7420
7665
|
red,
|
|
@@ -7470,6 +7715,7 @@ var pc, lazyColor, colors2, red2, green2, yellow2, blue2, cyan2, magenta2, white
|
|
|
7470
7715
|
var init_node3 = __esm({
|
|
7471
7716
|
"src/platform/compat/console/node.ts"() {
|
|
7472
7717
|
"use strict";
|
|
7718
|
+
init_deno_env();
|
|
7473
7719
|
pc = null;
|
|
7474
7720
|
lazyColor = (fn) => (s) => pc?.[fn]?.(s) ?? s;
|
|
7475
7721
|
colors2 = {
|
|
@@ -7525,6 +7771,7 @@ async function loadColors() {
|
|
|
7525
7771
|
var noOp, fallbackColors, _colors, colorsPromise;
|
|
7526
7772
|
var init_console = __esm({
|
|
7527
7773
|
"src/platform/compat/console/index.ts"() {
|
|
7774
|
+
init_deno_env();
|
|
7528
7775
|
init_runtime();
|
|
7529
7776
|
noOp = (text) => text;
|
|
7530
7777
|
fallbackColors = {
|
|
@@ -7552,6 +7799,7 @@ var init_console = __esm({
|
|
|
7552
7799
|
var init_error_identifier = __esm({
|
|
7553
7800
|
"src/core/errors/user-friendly/error-identifier.ts"() {
|
|
7554
7801
|
"use strict";
|
|
7802
|
+
init_deno_env();
|
|
7555
7803
|
}
|
|
7556
7804
|
});
|
|
7557
7805
|
|
|
@@ -7559,6 +7807,7 @@ var init_error_identifier = __esm({
|
|
|
7559
7807
|
var init_error_formatter = __esm({
|
|
7560
7808
|
"src/core/errors/user-friendly/error-formatter.ts"() {
|
|
7561
7809
|
"use strict";
|
|
7810
|
+
init_deno_env();
|
|
7562
7811
|
init_console();
|
|
7563
7812
|
init_error_catalog();
|
|
7564
7813
|
init_error_identifier();
|
|
@@ -7569,6 +7818,7 @@ var init_error_formatter = __esm({
|
|
|
7569
7818
|
var init_error_wrapper = __esm({
|
|
7570
7819
|
"src/core/errors/user-friendly/error-wrapper.ts"() {
|
|
7571
7820
|
"use strict";
|
|
7821
|
+
init_deno_env();
|
|
7572
7822
|
init_console();
|
|
7573
7823
|
init_process();
|
|
7574
7824
|
init_logger();
|
|
@@ -7580,6 +7830,7 @@ var init_error_wrapper = __esm({
|
|
|
7580
7830
|
var init_user_friendly = __esm({
|
|
7581
7831
|
"src/core/errors/user-friendly/index.ts"() {
|
|
7582
7832
|
"use strict";
|
|
7833
|
+
init_deno_env();
|
|
7583
7834
|
init_error_catalog();
|
|
7584
7835
|
init_error_formatter();
|
|
7585
7836
|
init_error_identifier();
|
|
@@ -7590,6 +7841,7 @@ var init_user_friendly = __esm({
|
|
|
7590
7841
|
// src/core/errors/index.ts
|
|
7591
7842
|
var init_errors = __esm({
|
|
7592
7843
|
"src/core/errors/index.ts"() {
|
|
7844
|
+
init_deno_env();
|
|
7593
7845
|
init_types();
|
|
7594
7846
|
init_agent_errors();
|
|
7595
7847
|
init_build_errors();
|
|
@@ -7606,6 +7858,7 @@ var BunFileSystemAdapter;
|
|
|
7606
7858
|
var init_filesystem_adapter2 = __esm({
|
|
7607
7859
|
"src/platform/adapters/bun/filesystem-adapter.ts"() {
|
|
7608
7860
|
"use strict";
|
|
7861
|
+
init_deno_env();
|
|
7609
7862
|
init_errors();
|
|
7610
7863
|
init_veryfront_error();
|
|
7611
7864
|
init_shared_watcher();
|
|
@@ -7763,6 +8016,7 @@ var BunEnvironmentAdapter;
|
|
|
7763
8016
|
var init_environment_adapter2 = __esm({
|
|
7764
8017
|
"src/platform/adapters/bun/environment-adapter.ts"() {
|
|
7765
8018
|
"use strict";
|
|
8019
|
+
init_deno_env();
|
|
7766
8020
|
BunEnvironmentAdapter = class {
|
|
7767
8021
|
get(key) {
|
|
7768
8022
|
return Bun.env[key];
|
|
@@ -7782,6 +8036,7 @@ var BunServerAdapter, BunWebSocket;
|
|
|
7782
8036
|
var init_websocket_adapter2 = __esm({
|
|
7783
8037
|
"src/platform/adapters/bun/websocket-adapter.ts"() {
|
|
7784
8038
|
"use strict";
|
|
8039
|
+
init_deno_env();
|
|
7785
8040
|
init_veryfront_error();
|
|
7786
8041
|
BunServerAdapter = class {
|
|
7787
8042
|
upgradeWebSocket(request) {
|
|
@@ -7855,6 +8110,7 @@ var BunServer;
|
|
|
7855
8110
|
var init_http_server2 = __esm({
|
|
7856
8111
|
"src/platform/adapters/bun/http-server.ts"() {
|
|
7857
8112
|
"use strict";
|
|
8113
|
+
init_deno_env();
|
|
7858
8114
|
init_config();
|
|
7859
8115
|
init_utils();
|
|
7860
8116
|
BunServer = class {
|
|
@@ -7879,6 +8135,7 @@ var BunAdapter, bunAdapter;
|
|
|
7879
8135
|
var init_adapter2 = __esm({
|
|
7880
8136
|
"src/platform/adapters/bun/adapter.ts"() {
|
|
7881
8137
|
"use strict";
|
|
8138
|
+
init_deno_env();
|
|
7882
8139
|
init_filesystem_adapter2();
|
|
7883
8140
|
init_environment_adapter2();
|
|
7884
8141
|
init_websocket_adapter2();
|
|
@@ -7925,6 +8182,7 @@ var init_adapter2 = __esm({
|
|
|
7925
8182
|
var init_bun = __esm({
|
|
7926
8183
|
"src/platform/adapters/bun/index.ts"() {
|
|
7927
8184
|
"use strict";
|
|
8185
|
+
init_deno_env();
|
|
7928
8186
|
init_adapter2();
|
|
7929
8187
|
init_filesystem_adapter2();
|
|
7930
8188
|
init_environment_adapter2();
|
|
@@ -7948,6 +8206,7 @@ __export(bun_exports, {
|
|
|
7948
8206
|
var init_bun2 = __esm({
|
|
7949
8207
|
"src/platform/adapters/bun.ts"() {
|
|
7950
8208
|
"use strict";
|
|
8209
|
+
init_deno_env();
|
|
7951
8210
|
init_bun();
|
|
7952
8211
|
}
|
|
7953
8212
|
});
|
|
@@ -8109,6 +8368,7 @@ function createMockAdapter() {
|
|
|
8109
8368
|
var init_mock = __esm({
|
|
8110
8369
|
"src/platform/adapters/mock.ts"() {
|
|
8111
8370
|
"use strict";
|
|
8371
|
+
init_deno_env();
|
|
8112
8372
|
init_veryfront_error();
|
|
8113
8373
|
}
|
|
8114
8374
|
});
|
|
@@ -8118,6 +8378,7 @@ var AdapterRegistry, runtime;
|
|
|
8118
8378
|
var init_registry = __esm({
|
|
8119
8379
|
"src/platform/adapters/registry.ts"() {
|
|
8120
8380
|
"use strict";
|
|
8381
|
+
init_deno_env();
|
|
8121
8382
|
AdapterRegistry = class {
|
|
8122
8383
|
constructor() {
|
|
8123
8384
|
this.instance = null;
|
|
@@ -8310,6 +8571,7 @@ async function getAdapter() {
|
|
|
8310
8571
|
}
|
|
8311
8572
|
var init_detect = __esm({
|
|
8312
8573
|
"src/platform/adapters/detect.ts"() {
|
|
8574
|
+
init_deno_env();
|
|
8313
8575
|
init_utils();
|
|
8314
8576
|
init_veryfront_error();
|
|
8315
8577
|
init_registry();
|
|
@@ -8319,13 +8581,28 @@ var init_detect = __esm({
|
|
|
8319
8581
|
}
|
|
8320
8582
|
});
|
|
8321
8583
|
|
|
8584
|
+
// src/react/components/index.ts
|
|
8585
|
+
init_deno_env();
|
|
8586
|
+
|
|
8587
|
+
// src/react/components/AppWrapper.tsx
|
|
8588
|
+
init_deno_env();
|
|
8589
|
+
|
|
8322
8590
|
// src/react/components/LayoutComponent.tsx
|
|
8591
|
+
init_deno_env();
|
|
8323
8592
|
import { useMemo, useRef } from "react";
|
|
8324
8593
|
|
|
8325
8594
|
// src/build/transforms/mdx/index.ts
|
|
8595
|
+
init_deno_env();
|
|
8326
8596
|
init_utils();
|
|
8327
8597
|
|
|
8598
|
+
// src/core/utils/lru-wrapper.ts
|
|
8599
|
+
init_deno_env();
|
|
8600
|
+
|
|
8601
|
+
// src/core/utils/cache/stores/memory/lru-cache-adapter.ts
|
|
8602
|
+
init_deno_env();
|
|
8603
|
+
|
|
8328
8604
|
// src/core/utils/cache/stores/memory/lru-list-manager.ts
|
|
8605
|
+
init_deno_env();
|
|
8329
8606
|
var LRUListManager = class {
|
|
8330
8607
|
constructor() {
|
|
8331
8608
|
this.head = null;
|
|
@@ -8378,6 +8655,7 @@ var LRUListManager = class {
|
|
|
8378
8655
|
};
|
|
8379
8656
|
|
|
8380
8657
|
// src/core/utils/cache/eviction/eviction-manager.ts
|
|
8658
|
+
init_deno_env();
|
|
8381
8659
|
var EvictionManager = class {
|
|
8382
8660
|
constructor(options = {}) {
|
|
8383
8661
|
this.onEvict = options.onEvict;
|
|
@@ -8465,7 +8743,11 @@ var EvictionManager = class {
|
|
|
8465
8743
|
}
|
|
8466
8744
|
};
|
|
8467
8745
|
|
|
8746
|
+
// src/core/utils/cache/stores/memory/entry-manager.ts
|
|
8747
|
+
init_deno_env();
|
|
8748
|
+
|
|
8468
8749
|
// src/core/utils/cache/stores/memory/lru-node.ts
|
|
8750
|
+
init_deno_env();
|
|
8469
8751
|
var LRUNode = class {
|
|
8470
8752
|
constructor(key, entry, prev = null, next = null) {
|
|
8471
8753
|
this.key = key;
|
|
@@ -8784,9 +9066,11 @@ init_cache();
|
|
|
8784
9066
|
import React from "react";
|
|
8785
9067
|
|
|
8786
9068
|
// src/build/transforms/mdx/esm-module-loader.ts
|
|
9069
|
+
init_deno_env();
|
|
8787
9070
|
init_utils();
|
|
8788
9071
|
|
|
8789
9072
|
// src/core/utils/cache/keys/namespace.ts
|
|
9073
|
+
init_deno_env();
|
|
8790
9074
|
init_logger();
|
|
8791
9075
|
init_env();
|
|
8792
9076
|
var cacheNamespace = globalThis.__VF_CACHE_NAMESPACE__ || getEnvironmentVariable("VF_CACHE_NAMESPACE");
|
|
@@ -8794,12 +9078,17 @@ function getCacheNamespace() {
|
|
|
8794
9078
|
return cacheNamespace;
|
|
8795
9079
|
}
|
|
8796
9080
|
|
|
9081
|
+
// src/module-system/import-map/index.ts
|
|
9082
|
+
init_deno_env();
|
|
9083
|
+
|
|
8797
9084
|
// src/module-system/import-map/loader.ts
|
|
9085
|
+
init_deno_env();
|
|
8798
9086
|
init_utils();
|
|
8799
9087
|
init_config();
|
|
8800
9088
|
import { dirname, join as join2 } from "node:path";
|
|
8801
9089
|
|
|
8802
9090
|
// src/module-system/import-map/default-import-map.ts
|
|
9091
|
+
init_deno_env();
|
|
8803
9092
|
init_utils();
|
|
8804
9093
|
function getDefaultImportMap() {
|
|
8805
9094
|
const reactVersion = REACT_DEFAULT_VERSION;
|
|
@@ -8809,6 +9098,7 @@ function getDefaultImportMap() {
|
|
|
8809
9098
|
}
|
|
8810
9099
|
|
|
8811
9100
|
// src/module-system/import-map/resolver.ts
|
|
9101
|
+
init_deno_env();
|
|
8812
9102
|
function resolveImport(specifier, importMap, scope) {
|
|
8813
9103
|
if (scope && importMap.scopes?.[scope]?.[specifier]) {
|
|
8814
9104
|
return importMap.scopes[scope][specifier];
|
|
@@ -8833,6 +9123,7 @@ function resolveImport(specifier, importMap, scope) {
|
|
|
8833
9123
|
}
|
|
8834
9124
|
|
|
8835
9125
|
// src/module-system/import-map/transformer.ts
|
|
9126
|
+
init_deno_env();
|
|
8836
9127
|
function transformImportsWithMap(code, importMap, scope, options) {
|
|
8837
9128
|
let transformedCode = code;
|
|
8838
9129
|
transformedCode = transformedCode.replace(
|
|
@@ -8867,10 +9158,14 @@ function transformImportsWithMap(code, importMap, scope, options) {
|
|
|
8867
9158
|
return transformedCode;
|
|
8868
9159
|
}
|
|
8869
9160
|
|
|
9161
|
+
// src/module-system/import-map/merger.ts
|
|
9162
|
+
init_deno_env();
|
|
9163
|
+
|
|
8870
9164
|
// src/build/transforms/mdx/esm-module-loader.ts
|
|
8871
9165
|
init_runtime();
|
|
8872
9166
|
init_process();
|
|
8873
9167
|
import { join as join4 } from "node:path";
|
|
9168
|
+
var IS_TRUE_NODE = isNode && !isDeno;
|
|
8874
9169
|
var LOG_PREFIX_MDX_LOADER = "[mdx-loader]";
|
|
8875
9170
|
var LOG_PREFIX_MDX_RENDERER = "[mdx-renderer]";
|
|
8876
9171
|
var JSX_IMPORT_PATTERN = /import\s+([^'"]+)\s+from\s+['"]file:\/\/([^'"]+\.(jsx|tsx))['"];?/g;
|
|
@@ -8879,6 +9174,57 @@ var HTTP_IMPORT_PATTERN = /['"]https?:\/\/[^'"]+['"]/;
|
|
|
8879
9174
|
var ESBUILD_JSX_FACTORY = "React.createElement";
|
|
8880
9175
|
var ESBUILD_JSX_FRAGMENT = "React.Fragment";
|
|
8881
9176
|
var HTTP_MODULE_FETCH_TIMEOUT_MS2 = 3e4;
|
|
9177
|
+
var _resolvedPaths = {};
|
|
9178
|
+
async function resolveNodePackage(packageSpec) {
|
|
9179
|
+
if (!IS_TRUE_NODE)
|
|
9180
|
+
return null;
|
|
9181
|
+
if (packageSpec in _resolvedPaths)
|
|
9182
|
+
return _resolvedPaths[packageSpec];
|
|
9183
|
+
try {
|
|
9184
|
+
const { createRequire } = await import("node:module");
|
|
9185
|
+
const require2 = createRequire(import.meta.url);
|
|
9186
|
+
const resolved = require2.resolve(packageSpec);
|
|
9187
|
+
_resolvedPaths[packageSpec] = resolved;
|
|
9188
|
+
return resolved;
|
|
9189
|
+
} catch {
|
|
9190
|
+
_resolvedPaths[packageSpec] = null;
|
|
9191
|
+
return null;
|
|
9192
|
+
}
|
|
9193
|
+
}
|
|
9194
|
+
async function transformReactImportsToAbsolute(code) {
|
|
9195
|
+
if (!IS_TRUE_NODE)
|
|
9196
|
+
return code;
|
|
9197
|
+
const reactPath = await resolveNodePackage("react");
|
|
9198
|
+
const reactJsxPath = await resolveNodePackage("react/jsx-runtime");
|
|
9199
|
+
const reactJsxDevPath = await resolveNodePackage("react/jsx-dev-runtime");
|
|
9200
|
+
const reactDomPath = await resolveNodePackage("react-dom");
|
|
9201
|
+
let result = code;
|
|
9202
|
+
if (reactJsxPath) {
|
|
9203
|
+
result = result.replace(
|
|
9204
|
+
/from\s+['"]react\/jsx-runtime['"]/g,
|
|
9205
|
+
`from "file://${reactJsxPath}"`
|
|
9206
|
+
);
|
|
9207
|
+
}
|
|
9208
|
+
if (reactJsxDevPath) {
|
|
9209
|
+
result = result.replace(
|
|
9210
|
+
/from\s+['"]react\/jsx-dev-runtime['"]/g,
|
|
9211
|
+
`from "file://${reactJsxDevPath}"`
|
|
9212
|
+
);
|
|
9213
|
+
}
|
|
9214
|
+
if (reactDomPath) {
|
|
9215
|
+
result = result.replace(
|
|
9216
|
+
/from\s+['"]react-dom['"]/g,
|
|
9217
|
+
`from "file://${reactDomPath}"`
|
|
9218
|
+
);
|
|
9219
|
+
}
|
|
9220
|
+
if (reactPath) {
|
|
9221
|
+
result = result.replace(
|
|
9222
|
+
/from\s+['"]react['"]/g,
|
|
9223
|
+
`from "file://${reactPath}"`
|
|
9224
|
+
);
|
|
9225
|
+
}
|
|
9226
|
+
return result;
|
|
9227
|
+
}
|
|
8882
9228
|
function hashString(input) {
|
|
8883
9229
|
const HASH_SEED_FNV1A2 = 2166136261;
|
|
8884
9230
|
let hash = HASH_SEED_FNV1A2 >>> 0;
|
|
@@ -8953,7 +9299,7 @@ async function loadModuleESM(compiledProgramCode, context) {
|
|
|
8953
9299
|
const { getAdapter: getAdapter2 } = await Promise.resolve().then(() => (init_detect(), detect_exports));
|
|
8954
9300
|
const adapter = await getAdapter2();
|
|
8955
9301
|
if (!context.esmCacheDir) {
|
|
8956
|
-
if (
|
|
9302
|
+
if (IS_TRUE_NODE) {
|
|
8957
9303
|
const projectCacheDir = join4(
|
|
8958
9304
|
cwd(),
|
|
8959
9305
|
"node_modules",
|
|
@@ -8967,8 +9313,8 @@ async function loadModuleESM(compiledProgramCode, context) {
|
|
|
8967
9313
|
}
|
|
8968
9314
|
}
|
|
8969
9315
|
let rewritten;
|
|
8970
|
-
if (
|
|
8971
|
-
rewritten = compiledProgramCode;
|
|
9316
|
+
if (IS_TRUE_NODE) {
|
|
9317
|
+
rewritten = await transformReactImportsToAbsolute(compiledProgramCode);
|
|
8972
9318
|
} else {
|
|
8973
9319
|
rewritten = transformImportsWithMap(
|
|
8974
9320
|
compiledProgramCode,
|
|
@@ -9022,7 +9368,7 @@ ${transformed}`;
|
|
|
9022
9368
|
if (/\bconst\s+MDXLayout\b/.test(rewritten) && !/export\s+\{[^}]*MDXLayout/.test(rewritten)) {
|
|
9023
9369
|
rewritten += "\nexport { MDXLayout as __vfLayout };\n";
|
|
9024
9370
|
}
|
|
9025
|
-
if (
|
|
9371
|
+
if (IS_TRUE_NODE && HTTP_IMPORT_PATTERN.test(rewritten)) {
|
|
9026
9372
|
rendererLogger.info(`${LOG_PREFIX_MDX_LOADER} Bundling HTTP imports via esbuild for Node.js`);
|
|
9027
9373
|
const { build } = await import("esbuild/mod.js");
|
|
9028
9374
|
const tempSourcePath = join4(context.esmCacheDir, `temp-${hashString(rewritten)}.mjs`);
|
|
@@ -9112,12 +9458,15 @@ ${transformed}`;
|
|
|
9112
9458
|
}
|
|
9113
9459
|
|
|
9114
9460
|
// src/build/transforms/mdx/parser.ts
|
|
9461
|
+
init_deno_env();
|
|
9115
9462
|
init_utils();
|
|
9116
9463
|
|
|
9117
9464
|
// src/build/transforms/mdx/module-loader/metadata-extractor.ts
|
|
9465
|
+
init_deno_env();
|
|
9118
9466
|
init_utils();
|
|
9119
9467
|
|
|
9120
9468
|
// src/build/transforms/mdx/module-loader/string-parser.ts
|
|
9469
|
+
init_deno_env();
|
|
9121
9470
|
function extractBalancedBlock(source, startIndex, open, close) {
|
|
9122
9471
|
const closeCh = close || (open === "{" ? "}" : open === "[" ? "]" : ")");
|
|
9123
9472
|
let depth = 0;
|
|
@@ -9272,6 +9621,7 @@ function parseMDXCode(compiledCode) {
|
|
|
9272
9621
|
}
|
|
9273
9622
|
|
|
9274
9623
|
// src/build/transforms/mdx/mdx-cache-adapter.ts
|
|
9624
|
+
init_deno_env();
|
|
9275
9625
|
init_utils();
|
|
9276
9626
|
init_utils();
|
|
9277
9627
|
|
|
@@ -9414,6 +9764,7 @@ function LayoutComponent({
|
|
|
9414
9764
|
}
|
|
9415
9765
|
|
|
9416
9766
|
// src/react/components/ProviderComponent.tsx
|
|
9767
|
+
init_deno_env();
|
|
9417
9768
|
import { useMemo as useMemo2, useRef as useRef2 } from "react";
|
|
9418
9769
|
init_utils();
|
|
9419
9770
|
import { Fragment as Fragment2, jsx as jsx2 } from "react/jsx-runtime";
|
|
@@ -9474,6 +9825,7 @@ function AppWrapper({
|
|
|
9474
9825
|
}
|
|
9475
9826
|
|
|
9476
9827
|
// src/react/components/Head.tsx
|
|
9828
|
+
init_deno_env();
|
|
9477
9829
|
import React2 from "react";
|
|
9478
9830
|
function Head({ children }) {
|
|
9479
9831
|
return React2.createElement(
|
|
@@ -9487,6 +9839,7 @@ function Head({ children }) {
|
|
|
9487
9839
|
}
|
|
9488
9840
|
|
|
9489
9841
|
// src/react/components/Link.tsx
|
|
9842
|
+
init_deno_env();
|
|
9490
9843
|
import { jsx as jsx4 } from "react/jsx-runtime";
|
|
9491
9844
|
function Link({ prefetch = true, children, ...rest }) {
|
|
9492
9845
|
const props = {
|
|
@@ -9497,6 +9850,7 @@ function Link({ prefetch = true, children, ...rest }) {
|
|
|
9497
9850
|
}
|
|
9498
9851
|
|
|
9499
9852
|
// src/react/components/MDXProvider.tsx
|
|
9853
|
+
init_deno_env();
|
|
9500
9854
|
import { createContext, useContext } from "react";
|
|
9501
9855
|
import { jsx as jsx5 } from "react/jsx-runtime";
|
|
9502
9856
|
var MDXContext = createContext({});
|
|
@@ -9511,10 +9865,15 @@ function useMDXComponents(components) {
|
|
|
9511
9865
|
return { ...contextComponents, ...components };
|
|
9512
9866
|
}
|
|
9513
9867
|
|
|
9868
|
+
// src/react/components/optimized-image/index.ts
|
|
9869
|
+
init_deno_env();
|
|
9870
|
+
|
|
9514
9871
|
// src/react/components/optimized-image/OptimizedImage.tsx
|
|
9872
|
+
init_deno_env();
|
|
9515
9873
|
init_utils();
|
|
9516
9874
|
|
|
9517
9875
|
// src/react/components/optimized-image/helpers.ts
|
|
9876
|
+
init_deno_env();
|
|
9518
9877
|
function getOptimizedPath(src, format, size, _quality = 80) {
|
|
9519
9878
|
const basePath = src.replace(/\.[^.]+$/, "");
|
|
9520
9879
|
const optimizedDir = ".veryfront/optimized-images";
|
|
@@ -9590,6 +9949,7 @@ function OptimizedImage({
|
|
|
9590
9949
|
}
|
|
9591
9950
|
|
|
9592
9951
|
// src/react/components/optimized-image/SimpleOptimizedImage.tsx
|
|
9952
|
+
init_deno_env();
|
|
9593
9953
|
init_utils();
|
|
9594
9954
|
import { jsx as jsx7 } from "react/jsx-runtime";
|
|
9595
9955
|
var DEFAULT_SIZES2 = [...RESPONSIVE_IMAGE_WIDTHS];
|
|
@@ -9628,6 +9988,7 @@ function SimpleOptimizedImage({
|
|
|
9628
9988
|
}
|
|
9629
9989
|
|
|
9630
9990
|
// src/react/components/optimized-image/OptimizedBackgroundImage.tsx
|
|
9991
|
+
init_deno_env();
|
|
9631
9992
|
init_network();
|
|
9632
9993
|
import { jsx as jsx8 } from "react/jsx-runtime";
|
|
9633
9994
|
function OptimizedBackgroundImage({
|
|
@@ -9651,6 +10012,7 @@ function OptimizedBackgroundImage({
|
|
|
9651
10012
|
}
|
|
9652
10013
|
|
|
9653
10014
|
// src/react/components/optimized-image/useOptimizedImage.ts
|
|
10015
|
+
init_deno_env();
|
|
9654
10016
|
init_utils();
|
|
9655
10017
|
var DEFAULT_SIZES3 = [...RESPONSIVE_IMAGE_WIDTHS];
|
|
9656
10018
|
var DEFAULT_FORMATS2 = ["avif", "webp", "jpeg"];
|
|
@@ -9675,6 +10037,7 @@ function useOptimizedImage(src, options = {}) {
|
|
|
9675
10037
|
}
|
|
9676
10038
|
|
|
9677
10039
|
// src/react/components/optimized-image/utils.tsx
|
|
10040
|
+
init_deno_env();
|
|
9678
10041
|
import { jsx as jsx9 } from "react/jsx-runtime";
|
|
9679
10042
|
function generateBlurDataURL(width = 10, height = 10, color = "#cccccc") {
|
|
9680
10043
|
const svg = `
|