@teyik0/furin 0.3.0-alpha.1 → 0.4.0-alpha.1
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/adapter/bun.d.ts +1 -1
- package/dist/build/client.d.ts +2 -2
- package/dist/build/entry-template.d.ts +4 -0
- package/dist/build/entry-template.ts +17 -3
- package/dist/build/index.d.ts +1 -1
- package/dist/build/index.js +8288 -6629
- package/dist/build/route-types.d.ts +2 -22
- package/dist/build/shared.d.ts +1 -1
- package/dist/build/ssg-cache.d.ts +1 -1
- package/dist/build/types.d.ts +1 -1
- package/dist/cli/index.js +7862 -6168
- package/dist/client/boundaries.d.ts +2 -0
- package/dist/client/define-route.d.ts +35 -0
- package/dist/client/document.d.ts +26 -0
- package/dist/client/hmr.d.ts +10 -0
- package/dist/client/internal/runtime-types.d.ts +3 -1
- package/dist/client/link.js +1177 -894
- package/dist/client/router/index.d.ts +1 -1
- package/dist/client/router/link-utils.d.ts +9 -0
- package/dist/client/router/search/index.d.ts +3 -7
- package/dist/client/router/types.d.ts +32 -24
- package/dist/client.d.ts +4 -159
- package/dist/client.js +183 -21
- package/dist/config.d.ts +8 -8
- package/dist/config.js +8 -8
- package/dist/define-route.d.ts +1355 -0
- package/dist/furin.d.ts +17 -33
- package/dist/furin.js +13444 -10301
- package/dist/plugin/index.js +953 -244
- package/dist/plugin/route-config-autofix.d.ts +31 -0
- package/dist/plugin/routes.d.ts +27 -0
- package/dist/routes.d.ts +6 -0
- package/dist/routes.js +1 -0
- package/dist/rsc/build/index.d.ts +1 -1
- package/dist/rsc.js +3 -3
- package/dist/server/dev-page-plugin.d.ts +7 -5
- package/dist/server/devtools/instrumentation.d.ts +2 -2
- package/dist/server/devtools/instrumentation.production.d.ts +2 -2
- package/dist/server/devtools/plugin.d.ts +2 -2
- package/dist/server/internal.d.ts +3 -0
- package/dist/server/logger.d.ts +4 -0
- package/dist/server/render/assemble.d.ts +0 -9
- package/dist/server/render/document.d.ts +4 -0
- package/dist/server/render/element.d.ts +2 -1
- package/dist/server/render/index.d.ts +1 -1
- package/dist/server/render/index.ts +0 -1
- package/dist/server/render/isr.d.ts +1 -1
- package/dist/server/render/loaders.d.ts +1 -1
- package/dist/server/render/not-found.d.ts +1 -1
- package/dist/server/render/ppr-route.d.ts +1 -1
- package/dist/server/render/ssg.d.ts +1 -1
- package/dist/server/render/ssr.d.ts +7 -6
- package/dist/server/render/template.d.ts +4 -0
- package/dist/server/router/defined-route.d.ts +24 -0
- package/dist/server/router/hmr.d.ts +16 -8
- package/dist/server/router/patterns.d.ts +6 -0
- package/dist/server/router/plugin.d.ts +4 -3
- package/dist/server/router/schema-merge.d.ts +2 -2
- package/dist/server/router/schemas.d.ts +5 -5
- package/dist/server/router/source-version.d.ts +2 -0
- package/dist/server/router/types.d.ts +1 -0
- package/dist/server/sync/index.js +961 -806
- package/dist/server/sync/postgres/migrate.js +3 -2
- package/dist/shared/await.d.ts +6 -7
- package/dist/shared/elysia-contract.d.ts +41 -0
- package/dist/shared/route-map.d.ts +5 -0
- package/dist/shared/utils/index.d.ts +1 -3
- package/package.json +44 -41
- package/src/adapter/bun.ts +42 -22
- package/src/adapter/package.ts +20 -14
- package/src/adapter/static.ts +4 -3
- package/src/build/client.ts +20 -3
- package/src/build/entry-template.ts +17 -3
- package/src/build/hydrate.ts +98 -28
- package/src/build/index.ts +2 -2
- package/src/build/route-types.ts +19 -114
- package/src/build/shared.ts +1 -1
- package/src/build/ssg-cache.ts +2 -5
- package/src/build/types.ts +1 -1
- package/src/cli/config.ts +3 -3
- package/src/cli/index.ts +7 -7
- package/src/client/boundaries.tsx +9 -1
- package/src/client/define-route.ts +48 -0
- package/src/client/document.tsx +165 -0
- package/src/client/hmr.ts +40 -0
- package/src/client/internal/runtime-types.ts +3 -1
- package/src/client/link.tsx +21 -6
- package/src/client/router/index.ts +1 -0
- package/src/client/router/link-utils.ts +26 -0
- package/src/client/router/provider.tsx +25 -2
- package/src/client/router/search/index.ts +4 -12
- package/src/client/router/types.ts +50 -24
- package/src/client.ts +14 -316
- package/src/config.ts +10 -10
- package/src/define-route.ts +959 -0
- package/src/devtools/devtools-element.js +11 -10
- package/src/furin.ts +303 -53
- package/src/plugin/route-config-autofix.ts +1140 -0
- package/src/plugin/routes.ts +891 -0
- package/src/plugin/transform-client.ts +132 -266
- package/src/plugin/transform-isomorphic.ts +1 -1
- package/src/routes.ts +6 -0
- package/src/rsc/build/index.ts +1 -1
- package/src/server/auto-invalidate/registry.ts +2 -2
- package/src/server/dev-page-plugin.ts +31 -12
- package/src/server/devtools/instrumentation.production.ts +2 -2
- package/src/server/devtools/instrumentation.ts +2 -2
- package/src/server/devtools/plugin.ts +5 -3
- package/src/server/instance.ts +3 -3
- package/src/server/internal.ts +3 -0
- package/src/server/logger.ts +21 -0
- package/src/server/render/assemble.ts +0 -41
- package/src/server/render/document.tsx +25 -0
- package/src/server/render/element.tsx +13 -1
- package/src/server/render/index.ts +0 -1
- package/src/server/render/isr.ts +31 -10
- package/src/server/render/loaders.ts +31 -6
- package/src/server/render/not-found.ts +51 -27
- package/src/server/render/ppr-route.ts +1 -1
- package/src/server/render/ssg.ts +1 -1
- package/src/server/render/ssr.ts +271 -113
- package/src/server/render/template.ts +91 -1
- package/src/server/router/defined-route.ts +110 -0
- package/src/server/router/discovery.ts +129 -29
- package/src/server/router/hmr.ts +111 -40
- package/src/server/router/patterns.ts +40 -12
- package/src/server/router/plugin.ts +63 -46
- package/src/server/router/schema-merge.ts +4 -14
- package/src/server/router/schemas.ts +11 -8
- package/src/server/router/source-version.ts +16 -0
- package/src/server/router/types.ts +2 -0
- package/src/server/sync/postgres/migrate.ts +3 -2
- package/src/server/sync/response.ts +14 -10
- package/src/shared/await.tsx +6 -7
- package/src/shared/elysia-contract.ts +63 -0
- package/src/shared/route-map.ts +37 -0
- package/src/shared/utils/index.ts +2 -20
- package/dist/build/server-routes-entry.d.ts +0 -13
- package/dist/build/server-routes-entry.ts +0 -30
- package/dist/server/router/index.d.ts +0 -7
- package/dist/server/router/index.js +0 -27
- package/dist/server/router/index.ts +0 -28
- package/src/build/server-routes-entry.ts +0 -30
- package/src/server/router/index.ts +0 -28
package/dist/client/link.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// @bun
|
|
2
2
|
// src/client/link.tsx
|
|
3
|
-
import { createElement as
|
|
3
|
+
import { createElement as createElement5, useCallback as useCallback3, useEffect as useEffect2, useRef as useRef2 } from "react";
|
|
4
4
|
|
|
5
5
|
// src/shared/search-params.ts
|
|
6
6
|
function routeSegmentSpecificity(segment) {
|
|
@@ -178,6 +178,18 @@ function isSameOriginFetchResult(input, responseUrl, currentOrigin) {
|
|
|
178
178
|
return false;
|
|
179
179
|
}
|
|
180
180
|
}
|
|
181
|
+
function applyLinkParams(to, params) {
|
|
182
|
+
if (!params) {
|
|
183
|
+
return to;
|
|
184
|
+
}
|
|
185
|
+
let url = to.replaceAll(/:([a-zA-Z0-9_]+)/g, (match, name) => (name in params) ? encodeURIComponent(String(params[name])) : match);
|
|
186
|
+
const wildcard = params["*"];
|
|
187
|
+
if (wildcard !== undefined && url.includes("/*")) {
|
|
188
|
+
const encodedWildcard = String(wildcard).split("/").map(encodeURIComponent).join("/");
|
|
189
|
+
url = url.replace("/*", () => `/${encodedWildcard}`);
|
|
190
|
+
}
|
|
191
|
+
return url;
|
|
192
|
+
}
|
|
181
193
|
function buildHref(to, search, hash, searchDefaults) {
|
|
182
194
|
let url = to;
|
|
183
195
|
if (search && Object.keys(search).length > 0) {
|
|
@@ -314,10 +326,10 @@ function useRouter() {
|
|
|
314
326
|
}
|
|
315
327
|
|
|
316
328
|
// src/client/router/boundary-tree.tsx
|
|
317
|
-
import { createElement } from "react";
|
|
329
|
+
import { createElement as createElement2 } from "react";
|
|
318
330
|
|
|
319
331
|
// src/client/boundaries.tsx
|
|
320
|
-
import { Component, Fragment } from "react";
|
|
332
|
+
import { Component, Fragment as Fragment2 } from "react";
|
|
321
333
|
|
|
322
334
|
// src/shared/digest.ts
|
|
323
335
|
function computeErrorDigest(err) {
|
|
@@ -653,6 +665,144 @@ var DefaultNotFoundFallback = ({ error }) => /* @__PURE__ */ jsxDEV(DefaultNotFo
|
|
|
653
665
|
message: error.message
|
|
654
666
|
}, undefined, false, undefined, this);
|
|
655
667
|
|
|
668
|
+
// src/client/document.tsx
|
|
669
|
+
import { createContext as createContext2, createElement, useContext as useContext2 } from "react";
|
|
670
|
+
import { jsxDEV as jsxDEV2, Fragment } from "react/jsx-dev-runtime";
|
|
671
|
+
var DocumentContext = createContext2(null);
|
|
672
|
+
function serializeJson(value) {
|
|
673
|
+
return JSON.stringify(value).replaceAll("<", "\\u003c").replaceAll(">", "\\u003e").replaceAll("\u2028", "\\u2028").replaceAll("\u2029", "\\u2029");
|
|
674
|
+
}
|
|
675
|
+
function DocumentProvider({
|
|
676
|
+
children,
|
|
677
|
+
value
|
|
678
|
+
}) {
|
|
679
|
+
return /* @__PURE__ */ jsxDEV2(DocumentContext.Provider, {
|
|
680
|
+
value,
|
|
681
|
+
children
|
|
682
|
+
}, undefined, false, undefined, this);
|
|
683
|
+
}
|
|
684
|
+
function useDocumentState() {
|
|
685
|
+
return useContext2(DocumentContext);
|
|
686
|
+
}
|
|
687
|
+
function renderMeta(meta, index) {
|
|
688
|
+
if ("title" in meta) {
|
|
689
|
+
return /* @__PURE__ */ jsxDEV2("title", {
|
|
690
|
+
children: meta.title
|
|
691
|
+
}, `title:${index}`, false, undefined, this);
|
|
692
|
+
}
|
|
693
|
+
if ("script:ld+json" in meta) {
|
|
694
|
+
return /* @__PURE__ */ jsxDEV2("script", {
|
|
695
|
+
dangerouslySetInnerHTML: { __html: serializeJson(meta["script:ld+json"]) },
|
|
696
|
+
type: "application/ld+json"
|
|
697
|
+
}, `json-ld:${index}`, false, undefined, this);
|
|
698
|
+
}
|
|
699
|
+
if ("tagName" in meta) {
|
|
700
|
+
const { tagName, ...attributes } = meta;
|
|
701
|
+
return createElement(tagName, { ...attributes, key: `${tagName}:${index}` });
|
|
702
|
+
}
|
|
703
|
+
return createElement("meta", { ...meta, key: `meta:${index}` });
|
|
704
|
+
}
|
|
705
|
+
function HeadContent() {
|
|
706
|
+
const state = useContext2(DocumentContext);
|
|
707
|
+
if (state === null) {
|
|
708
|
+
throw new Error("[furin] <HeadContent /> must be rendered inside the root layout.");
|
|
709
|
+
}
|
|
710
|
+
return /* @__PURE__ */ jsxDEV2(Fragment, {
|
|
711
|
+
children: [
|
|
712
|
+
/* @__PURE__ */ jsxDEV2("meta", {
|
|
713
|
+
charSet: "utf-8",
|
|
714
|
+
"data-furin-head": ""
|
|
715
|
+
}, undefined, false, undefined, this),
|
|
716
|
+
/* @__PURE__ */ jsxDEV2("meta", {
|
|
717
|
+
content: "width=device-width, initial-scale=1.0",
|
|
718
|
+
name: "viewport"
|
|
719
|
+
}, undefined, false, undefined, this),
|
|
720
|
+
/* @__PURE__ */ jsxDEV2("script", {
|
|
721
|
+
dangerouslySetInnerHTML: {
|
|
722
|
+
__html: 'try{var __t=localStorage.getItem("furin-theme");document.documentElement.classList.add(__t==="light"?"light":"dark")}catch(e){document.documentElement.classList.add("dark")}'
|
|
723
|
+
}
|
|
724
|
+
}, undefined, false, undefined, this),
|
|
725
|
+
state.assets.buildId ? /* @__PURE__ */ jsxDEV2("meta", {
|
|
726
|
+
content: state.assets.buildId,
|
|
727
|
+
name: "furin-build-id"
|
|
728
|
+
}, undefined, false, undefined, this) : null,
|
|
729
|
+
state.assets.staticMode ? /* @__PURE__ */ jsxDEV2("meta", {
|
|
730
|
+
content: "static",
|
|
731
|
+
name: "furin-mode"
|
|
732
|
+
}, undefined, false, undefined, this) : null,
|
|
733
|
+
state.assets.faviconHref ? /* @__PURE__ */ jsxDEV2("link", {
|
|
734
|
+
href: state.assets.faviconHref,
|
|
735
|
+
rel: "icon"
|
|
736
|
+
}, undefined, false, undefined, this) : null,
|
|
737
|
+
state.assets.stylesheets.map((href) => /* @__PURE__ */ jsxDEV2("link", {
|
|
738
|
+
crossOrigin: "",
|
|
739
|
+
href,
|
|
740
|
+
rel: "stylesheet"
|
|
741
|
+
}, href, false, undefined, this)),
|
|
742
|
+
state.head?.meta?.map(renderMeta),
|
|
743
|
+
state.head?.links?.map((link, index) => /* @__PURE__ */ jsxDEV2("link", {
|
|
744
|
+
...link
|
|
745
|
+
}, `${link.rel}:${link.href}:${index}`, false, undefined, this)),
|
|
746
|
+
state.head?.scripts?.map(({ children, ...attributes }, index) => /* @__PURE__ */ jsxDEV2("script", {
|
|
747
|
+
...attributes,
|
|
748
|
+
dangerouslySetInnerHTML: children === undefined ? undefined : { __html: children }
|
|
749
|
+
}, `script:${index}`, false, undefined, this)),
|
|
750
|
+
state.head?.styles?.map(({ children, type }, index) => /* @__PURE__ */ jsxDEV2("style", {
|
|
751
|
+
dangerouslySetInnerHTML: { __html: children },
|
|
752
|
+
type
|
|
753
|
+
}, `style:${index}`, false, undefined, this))
|
|
754
|
+
]
|
|
755
|
+
}, undefined, true, undefined, this);
|
|
756
|
+
}
|
|
757
|
+
function Scripts() {
|
|
758
|
+
const state = useContext2(DocumentContext);
|
|
759
|
+
if (state === null) {
|
|
760
|
+
throw new Error("[furin] <Scripts /> must be rendered inside the root layout.");
|
|
761
|
+
}
|
|
762
|
+
return /* @__PURE__ */ jsxDEV2(Fragment, {
|
|
763
|
+
children: [
|
|
764
|
+
state.syncJson === undefined ? null : /* @__PURE__ */ jsxDEV2("script", {
|
|
765
|
+
dangerouslySetInnerHTML: { __html: state.syncJson },
|
|
766
|
+
id: "__FURIN_SYNC__",
|
|
767
|
+
type: "application/json"
|
|
768
|
+
}, undefined, false, undefined, this),
|
|
769
|
+
state.dataJson === undefined ? null : /* @__PURE__ */ jsxDEV2("script", {
|
|
770
|
+
dangerouslySetInnerHTML: { __html: state.dataJson },
|
|
771
|
+
id: "__FURIN_DATA__",
|
|
772
|
+
type: "application/json"
|
|
773
|
+
}, undefined, false, undefined, this),
|
|
774
|
+
/* @__PURE__ */ jsxDEV2("script", {
|
|
775
|
+
dangerouslySetInnerHTML: { __html: serializeJson(state.head ?? {}) },
|
|
776
|
+
"data-furin-scripts": "",
|
|
777
|
+
id: "__FURIN_HEAD__",
|
|
778
|
+
type: "application/json"
|
|
779
|
+
}, undefined, false, undefined, this),
|
|
780
|
+
state.assets.entryModule === undefined ? null : /* @__PURE__ */ jsxDEV2("script", {
|
|
781
|
+
crossOrigin: "",
|
|
782
|
+
"data-furin-entry": "",
|
|
783
|
+
src: state.assets.entryModule,
|
|
784
|
+
type: "module"
|
|
785
|
+
}, undefined, false, undefined, this)
|
|
786
|
+
]
|
|
787
|
+
}, undefined, true, undefined, this);
|
|
788
|
+
}
|
|
789
|
+
function FurinDocumentFallback({ children }) {
|
|
790
|
+
return /* @__PURE__ */ jsxDEV2("html", {
|
|
791
|
+
lang: "en",
|
|
792
|
+
children: [
|
|
793
|
+
/* @__PURE__ */ jsxDEV2("head", {
|
|
794
|
+
children: /* @__PURE__ */ jsxDEV2(HeadContent, {}, undefined, false, undefined, this)
|
|
795
|
+
}, undefined, false, undefined, this),
|
|
796
|
+
/* @__PURE__ */ jsxDEV2("body", {
|
|
797
|
+
children: [
|
|
798
|
+
children,
|
|
799
|
+
/* @__PURE__ */ jsxDEV2(Scripts, {}, undefined, false, undefined, this)
|
|
800
|
+
]
|
|
801
|
+
}, undefined, true, undefined, this)
|
|
802
|
+
]
|
|
803
|
+
}, undefined, true, undefined, this);
|
|
804
|
+
}
|
|
805
|
+
|
|
656
806
|
// src/client/server-error.ts
|
|
657
807
|
var SERVER_ERROR_BRAND = "FURIN_SERVER_ERROR";
|
|
658
808
|
|
|
@@ -671,7 +821,7 @@ function isFurinServerError(err) {
|
|
|
671
821
|
}
|
|
672
822
|
|
|
673
823
|
// src/client/boundaries.tsx
|
|
674
|
-
import { jsxDEV as
|
|
824
|
+
import { jsxDEV as jsxDEV3 } from "react/jsx-dev-runtime";
|
|
675
825
|
var DEFAULT_ERROR_STATUS = 500;
|
|
676
826
|
var SERVER_RESET_NOOP = () => {};
|
|
677
827
|
function getServerDigest(error) {
|
|
@@ -728,12 +878,15 @@ class FurinErrorBoundary extends Component {
|
|
|
728
878
|
const finalDigest = serverDigest ?? digest ?? this.props.digest ?? computeErrorDigest(error);
|
|
729
879
|
const message = this.props.fallback ? error.message : getPublicErrorMessage(error);
|
|
730
880
|
const status = isFurinServerError(error) ? error.status : DEFAULT_ERROR_STATUS;
|
|
731
|
-
|
|
881
|
+
const fallback = /* @__PURE__ */ jsxDEV3(Fallback, {
|
|
732
882
|
error: { digest: finalDigest, message, status },
|
|
733
883
|
reset: typeof window === "undefined" ? SERVER_RESET_NOOP : this.reset
|
|
734
884
|
}, undefined, false, undefined, this);
|
|
885
|
+
return this.props.document ? /* @__PURE__ */ jsxDEV3(FurinDocumentFallback, {
|
|
886
|
+
children: fallback
|
|
887
|
+
}, undefined, false, undefined, this) : fallback;
|
|
735
888
|
}
|
|
736
|
-
return /* @__PURE__ */
|
|
889
|
+
return /* @__PURE__ */ jsxDEV3(Fragment2, {
|
|
737
890
|
children: this.props.children
|
|
738
891
|
}, epoch, false, undefined, this);
|
|
739
892
|
}
|
|
@@ -756,11 +909,11 @@ class FurinNotFoundBoundary extends Component {
|
|
|
756
909
|
throw error;
|
|
757
910
|
}
|
|
758
911
|
const Fallback = this.props.fallback ?? DefaultNotFoundFallback;
|
|
759
|
-
return /* @__PURE__ */
|
|
912
|
+
return /* @__PURE__ */ jsxDEV3(Fallback, {
|
|
760
913
|
error: { data: error.data, message: error.message }
|
|
761
914
|
}, undefined, false, undefined, this);
|
|
762
915
|
}
|
|
763
|
-
return /* @__PURE__ */
|
|
916
|
+
return /* @__PURE__ */ jsxDEV3(Fragment2, {
|
|
764
917
|
children: this.props.children
|
|
765
918
|
}, epoch, false, undefined, this);
|
|
766
919
|
}
|
|
@@ -771,14 +924,14 @@ function wrapSegmentBoundaries(inner, segment, options) {
|
|
|
771
924
|
}
|
|
772
925
|
let wrapped = inner;
|
|
773
926
|
if (segment.notFound) {
|
|
774
|
-
wrapped = /* @__PURE__ */
|
|
927
|
+
wrapped = /* @__PURE__ */ jsxDEV3(FurinNotFoundBoundary, {
|
|
775
928
|
fallback: segment.notFound,
|
|
776
929
|
resetKey: options?.resetKey,
|
|
777
930
|
children: wrapped
|
|
778
931
|
}, undefined, false, undefined, this);
|
|
779
932
|
}
|
|
780
933
|
if (segment.error) {
|
|
781
|
-
wrapped = /* @__PURE__ */
|
|
934
|
+
wrapped = /* @__PURE__ */ jsxDEV3(FurinErrorBoundary, {
|
|
782
935
|
fallback: segment.error,
|
|
783
936
|
onReset: options?.onReset,
|
|
784
937
|
resetKey: options?.resetKey,
|
|
@@ -789,11 +942,11 @@ function wrapSegmentBoundaries(inner, segment, options) {
|
|
|
789
942
|
}
|
|
790
943
|
|
|
791
944
|
// src/client/router/boundary-tree.tsx
|
|
792
|
-
import { jsxDEV as
|
|
945
|
+
import { jsxDEV as jsxDEV4 } from "react/jsx-dev-runtime";
|
|
793
946
|
function buildRouterTree(context, pageElement, options) {
|
|
794
|
-
return /* @__PURE__ */
|
|
947
|
+
return /* @__PURE__ */ jsxDEV4(RouterContext.Provider, {
|
|
795
948
|
value: context,
|
|
796
|
-
children: /* @__PURE__ */
|
|
949
|
+
children: /* @__PURE__ */ jsxDEV4(FurinErrorBoundary, {
|
|
797
950
|
...options,
|
|
798
951
|
children: pageElement
|
|
799
952
|
}, undefined, false, undefined, this)
|
|
@@ -805,7 +958,7 @@ function RouteErrorThrower({
|
|
|
805
958
|
throw new FurinServerError(error);
|
|
806
959
|
}
|
|
807
960
|
function buildPageElement(match, root, data, options, error) {
|
|
808
|
-
let element = error ?
|
|
961
|
+
let element = error ? createElement2(RouteErrorThrower, { error }) : createElement2(match.component, data);
|
|
809
962
|
const chain = [];
|
|
810
963
|
let current = match.pageRoute;
|
|
811
964
|
while (current) {
|
|
@@ -821,13 +974,13 @@ function buildPageElement(match, root, data, options, error) {
|
|
|
821
974
|
element = wrapSegmentBoundaries(element, byDepth.get(i), options);
|
|
822
975
|
const Layout = chain[i]?.layout;
|
|
823
976
|
if (Layout) {
|
|
824
|
-
element =
|
|
977
|
+
element = createElement2(Layout, { ...data }, element);
|
|
825
978
|
}
|
|
826
979
|
}
|
|
827
980
|
if (root) {
|
|
828
981
|
element = wrapSegmentBoundaries(element, byDepth.get(0), options);
|
|
829
982
|
if (root.layout) {
|
|
830
|
-
element =
|
|
983
|
+
element = createElement2(root.layout, { ...data }, element);
|
|
831
984
|
}
|
|
832
985
|
}
|
|
833
986
|
return element;
|
|
@@ -880,7 +1033,7 @@ function useNavigate() {
|
|
|
880
1033
|
return router.navigate(href, opts);
|
|
881
1034
|
}, [router]);
|
|
882
1035
|
}
|
|
883
|
-
// ../../node_modules/.bun/evlog@2.
|
|
1036
|
+
// ../../node_modules/.bun/evlog@2.28.1+4cac44d0f5802a4d/node_modules/evlog/dist/utils.mjs
|
|
884
1037
|
function formatDuration(ms) {
|
|
885
1038
|
if (ms < 1000)
|
|
886
1039
|
return `${Math.round(ms)}ms`;
|
|
@@ -990,559 +1143,294 @@ function globToRegExp(pattern, separator = "/") {
|
|
|
990
1143
|
}
|
|
991
1144
|
return regex;
|
|
992
1145
|
}
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
var
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
return
|
|
1005
|
-
}
|
|
1006
|
-
function pickString(obj, key) {
|
|
1007
|
-
const val = obj[key];
|
|
1008
|
-
return typeof val === "string" && val.length > 0 ? val : undefined;
|
|
1146
|
+
var _isoDate = /* @__PURE__ */ new Date;
|
|
1147
|
+
var _isoCachedSecond = -1;
|
|
1148
|
+
var _isoCachedPrefix = "";
|
|
1149
|
+
function isoNow() {
|
|
1150
|
+
const now = Date.now();
|
|
1151
|
+
const sec = Math.floor(now / 1000);
|
|
1152
|
+
if (sec !== _isoCachedSecond) {
|
|
1153
|
+
_isoCachedSecond = sec;
|
|
1154
|
+
_isoDate.setTime(now);
|
|
1155
|
+
_isoCachedPrefix = _isoDate.toISOString().slice(0, 19);
|
|
1156
|
+
}
|
|
1157
|
+
return `${_isoCachedPrefix}.${String(now % 1000).padStart(3, "0")}Z`;
|
|
1009
1158
|
}
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1159
|
+
|
|
1160
|
+
// ../../node_modules/.bun/evlog@2.28.1+4cac44d0f5802a4d/node_modules/evlog/dist/redact-C7FmdhwI.mjs
|
|
1161
|
+
var DEFAULT_REPLACEMENT = "[REDACTED]";
|
|
1162
|
+
function normalizeRedactPathPattern(pattern) {
|
|
1163
|
+
if (!pattern.includes("*") && !pattern.includes("."))
|
|
1164
|
+
return `**.${pattern}`;
|
|
1165
|
+
return pattern;
|
|
1013
1166
|
}
|
|
1014
|
-
function
|
|
1167
|
+
function compileRedactPathMatchers(patterns) {
|
|
1168
|
+
if (!patterns?.length)
|
|
1169
|
+
return;
|
|
1170
|
+
const exactPaths = /* @__PURE__ */ new Set;
|
|
1171
|
+
const pathGlobs = [];
|
|
1172
|
+
const keyGlobs = [];
|
|
1173
|
+
const caseInsensitiveLeaves = /* @__PURE__ */ new Set;
|
|
1174
|
+
for (const raw of patterns) {
|
|
1175
|
+
if (!raw.includes("*")) {
|
|
1176
|
+
if (raw.includes("."))
|
|
1177
|
+
exactPaths.add(raw);
|
|
1178
|
+
else
|
|
1179
|
+
addPathGlobPattern(normalizeRedactPathPattern(raw), exactPaths, pathGlobs, caseInsensitiveLeaves);
|
|
1180
|
+
continue;
|
|
1181
|
+
}
|
|
1182
|
+
if (!raw.includes("."))
|
|
1183
|
+
keyGlobs.push(globToRegExp(raw, "."));
|
|
1184
|
+
else
|
|
1185
|
+
addPathGlobPattern(raw, exactPaths, pathGlobs, caseInsensitiveLeaves);
|
|
1186
|
+
}
|
|
1187
|
+
if (exactPaths.size === 0 && pathGlobs.length === 0 && keyGlobs.length === 0 && caseInsensitiveLeaves.size === 0)
|
|
1188
|
+
return;
|
|
1015
1189
|
return {
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1190
|
+
exactPaths,
|
|
1191
|
+
pathGlobs,
|
|
1192
|
+
keyGlobs,
|
|
1193
|
+
caseInsensitiveLeaves
|
|
1020
1194
|
};
|
|
1021
1195
|
}
|
|
1022
|
-
function
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
if (
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
return { message: String(error) };
|
|
1029
|
-
const result = {
|
|
1030
|
-
message: pickString(error, "message") ?? pickString(error, "statusText") ?? pickString(error, "statusMessage") ?? "Unknown error",
|
|
1031
|
-
name: pickString(error, "name"),
|
|
1032
|
-
code: pickString(error, "code"),
|
|
1033
|
-
why: pickString(error, "why"),
|
|
1034
|
-
fix: pickString(error, "fix"),
|
|
1035
|
-
link: pickString(error, "link"),
|
|
1036
|
-
status: pickNumber(error, "status") ?? pickNumber(error, "statusCode"),
|
|
1037
|
-
stack: pickString(error, "stack")
|
|
1038
|
-
};
|
|
1039
|
-
const { data, cause } = error;
|
|
1040
|
-
if (isPlainObject(data)) {
|
|
1041
|
-
const guidance = extractGuidance(data);
|
|
1042
|
-
if (!result.code)
|
|
1043
|
-
result.code = guidance.code;
|
|
1044
|
-
if (!result.why)
|
|
1045
|
-
result.why = guidance.why;
|
|
1046
|
-
if (!result.fix)
|
|
1047
|
-
result.fix = guidance.fix;
|
|
1048
|
-
if (!result.link)
|
|
1049
|
-
result.link = guidance.link;
|
|
1196
|
+
function addPathGlobPattern(pattern, exactPaths, pathGlobs, caseInsensitiveLeaves) {
|
|
1197
|
+
pathGlobs.push(globToRegExp(pattern, "."));
|
|
1198
|
+
const leaf = pattern.match(/^\*\*\.([^.?*]+)$/);
|
|
1199
|
+
if (leaf) {
|
|
1200
|
+
exactPaths.add(leaf[1]);
|
|
1201
|
+
caseInsensitiveLeaves.add(leaf[1].toLowerCase());
|
|
1050
1202
|
}
|
|
1051
|
-
if (cause instanceof Error)
|
|
1052
|
-
result.cause = cause.message;
|
|
1053
|
-
else if (isPlainObject(cause) && pickString(cause, "message"))
|
|
1054
|
-
result.cause = pickString(cause, "message");
|
|
1055
|
-
return result;
|
|
1056
|
-
}
|
|
1057
|
-
function decodeFileUrl(file) {
|
|
1058
|
-
if (file.startsWith("file://"))
|
|
1059
|
-
try {
|
|
1060
|
-
return decodeURIComponent(new URL(file).pathname);
|
|
1061
|
-
} catch {
|
|
1062
|
-
return file.slice(7);
|
|
1063
|
-
}
|
|
1064
|
-
return file;
|
|
1065
|
-
}
|
|
1066
|
-
function isAppPath(file) {
|
|
1067
|
-
const normalized = decodeFileUrl(file).replace(/\\/g, "/");
|
|
1068
|
-
if (normalized.startsWith("node:"))
|
|
1069
|
-
return false;
|
|
1070
|
-
if (SKIP_PATH_RE.test(normalized))
|
|
1071
|
-
return false;
|
|
1072
|
-
if (normalized.includes("/node_modules/"))
|
|
1073
|
-
return false;
|
|
1074
|
-
if (isFrameworkRuntimePath(normalized))
|
|
1075
|
-
return false;
|
|
1076
|
-
return true;
|
|
1077
1203
|
}
|
|
1078
|
-
function
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
if (
|
|
1082
|
-
|
|
1083
|
-
|
|
1204
|
+
function matchesRedactPath(fullPath, leafKey, matchers) {
|
|
1205
|
+
if (matchers.exactPaths.has(fullPath))
|
|
1206
|
+
return true;
|
|
1207
|
+
if (matchers.caseInsensitiveLeaves.has(leafKey.toLowerCase()))
|
|
1208
|
+
return true;
|
|
1209
|
+
for (const glob of matchers.pathGlobs) {
|
|
1210
|
+
glob.lastIndex = 0;
|
|
1211
|
+
if (glob.test(fullPath))
|
|
1212
|
+
return true;
|
|
1084
1213
|
}
|
|
1085
|
-
const
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
return decoded;
|
|
1214
|
+
for (const glob of matchers.keyGlobs) {
|
|
1215
|
+
glob.lastIndex = 0;
|
|
1216
|
+
if (glob.test(leafKey))
|
|
1217
|
+
return true;
|
|
1218
|
+
}
|
|
1219
|
+
return false;
|
|
1092
1220
|
}
|
|
1093
|
-
function
|
|
1094
|
-
if (
|
|
1095
|
-
return
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
if (!trimmed.startsWith("at "))
|
|
1102
|
-
continue;
|
|
1103
|
-
const withFn = trimmed.match(/^at (.+?) \((.+):(\d+):(\d+)\)$/);
|
|
1104
|
-
if (withFn) {
|
|
1105
|
-
const [, fn, file, lineStr, colStr] = withFn;
|
|
1106
|
-
frames.push({
|
|
1107
|
-
raw: trimmed,
|
|
1108
|
-
fn,
|
|
1109
|
-
file,
|
|
1110
|
-
line: Number(lineStr),
|
|
1111
|
-
column: Number(colStr),
|
|
1112
|
-
isApp: isAppPath(file)
|
|
1113
|
-
});
|
|
1114
|
-
continue;
|
|
1221
|
+
function resolveReplacement(replacement, matched, ctx) {
|
|
1222
|
+
if (typeof replacement === "string")
|
|
1223
|
+
return replacement;
|
|
1224
|
+
try {
|
|
1225
|
+
const result = replacement(matched, ctx);
|
|
1226
|
+
if (typeof result !== "string") {
|
|
1227
|
+
console.error(`[evlog] redact replacement returned ${typeof result} for "${ctx.path}", expected string \u2014 using ${DEFAULT_REPLACEMENT}`);
|
|
1228
|
+
return DEFAULT_REPLACEMENT;
|
|
1115
1229
|
}
|
|
1116
|
-
|
|
1117
|
-
|
|
1118
|
-
|
|
1119
|
-
|
|
1120
|
-
|
|
1121
|
-
|
|
1122
|
-
|
|
1123
|
-
|
|
1124
|
-
|
|
1125
|
-
|
|
1126
|
-
|
|
1230
|
+
return result;
|
|
1231
|
+
} catch (err) {
|
|
1232
|
+
console.error(`[evlog] redact replacement failed for "${ctx.path}":`, err);
|
|
1233
|
+
return DEFAULT_REPLACEMENT;
|
|
1234
|
+
}
|
|
1235
|
+
}
|
|
1236
|
+
function redactPathsInTree(obj, matchers, replacement, prefix = "") {
|
|
1237
|
+
if (obj === null || obj === undefined)
|
|
1238
|
+
return;
|
|
1239
|
+
if (Array.isArray(obj)) {
|
|
1240
|
+
for (let i = 0;i < obj.length; i++) {
|
|
1241
|
+
const segment = String(i);
|
|
1242
|
+
const fullPath = prefix ? `${prefix}.${segment}` : segment;
|
|
1243
|
+
redactPathsInTree(obj[i], matchers, replacement, fullPath);
|
|
1127
1244
|
}
|
|
1128
|
-
|
|
1129
|
-
|
|
1130
|
-
|
|
1131
|
-
|
|
1132
|
-
|
|
1133
|
-
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
-
|
|
1137
|
-
|
|
1138
|
-
|
|
1245
|
+
return;
|
|
1246
|
+
}
|
|
1247
|
+
if (typeof obj === "object") {
|
|
1248
|
+
const record = obj;
|
|
1249
|
+
for (const key of redactableKeys(record)) {
|
|
1250
|
+
const fullPath = prefix ? `${prefix}.${key}` : key;
|
|
1251
|
+
if (matchesRedactPath(fullPath, key, matchers))
|
|
1252
|
+
setRedacted(record, key, resolveReplacement(replacement, record[key], {
|
|
1253
|
+
path: fullPath,
|
|
1254
|
+
key
|
|
1255
|
+
}), fullPath);
|
|
1256
|
+
else
|
|
1257
|
+
redactPathsInTree(record[key], matchers, replacement, fullPath);
|
|
1139
1258
|
}
|
|
1140
1259
|
}
|
|
1141
|
-
return frames;
|
|
1142
1260
|
}
|
|
1143
|
-
function
|
|
1144
|
-
|
|
1145
|
-
return normalized.includes("route-modules/") || normalized.includes("webpack://next/") || normalized.includes("/next/dist/") || normalized.includes("/compiled/next-server/");
|
|
1261
|
+
function redactableKeys(record) {
|
|
1262
|
+
return Object.keys(record);
|
|
1146
1263
|
}
|
|
1147
|
-
function
|
|
1148
|
-
if (
|
|
1149
|
-
return
|
|
1150
|
-
|
|
1264
|
+
function setRedacted(record, key, value, path) {
|
|
1265
|
+
if (Reflect.set(record, key, value))
|
|
1266
|
+
return;
|
|
1267
|
+
const desc = Object.getOwnPropertyDescriptor(record, key);
|
|
1268
|
+
if (desc && "value" in desc && desc.configurable) {
|
|
1269
|
+
Object.defineProperty(record, key, {
|
|
1270
|
+
...desc,
|
|
1271
|
+
value
|
|
1272
|
+
});
|
|
1273
|
+
return;
|
|
1274
|
+
}
|
|
1275
|
+
console.warn(`[evlog] redact could not rewrite read-only field "${path}" \u2014 value left as-is`);
|
|
1151
1276
|
}
|
|
1152
|
-
|
|
1153
|
-
|
|
1154
|
-
|
|
1155
|
-
|
|
1156
|
-
|
|
1157
|
-
|
|
1158
|
-
|
|
1277
|
+
var builtinPatterns = {
|
|
1278
|
+
creditCard: {
|
|
1279
|
+
pattern: /\b\d{4}[\s-]?\d{4}[\s-]?\d{4}[\s-]?\d{4}\b/g,
|
|
1280
|
+
mask: (m) => `****${m.replace(/[\s-]/g, "").slice(-4)}`
|
|
1281
|
+
},
|
|
1282
|
+
email: {
|
|
1283
|
+
pattern: /[\w.+-]+@[\w-]+\.[\w.]+/g,
|
|
1284
|
+
mask: (m) => {
|
|
1285
|
+
if (m.indexOf("@") < 1)
|
|
1286
|
+
return "***@***";
|
|
1287
|
+
const tld = m.slice(m.lastIndexOf("."));
|
|
1288
|
+
return `${m[0]}***@***${tld}`;
|
|
1289
|
+
}
|
|
1290
|
+
},
|
|
1291
|
+
ipv4: {
|
|
1292
|
+
pattern: /\b(?!0\.0\.0\.0\b)(?!127\.0\.0\.1\b)\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\b/g,
|
|
1293
|
+
mask: (m) => `***.***.***.${m.split(".").pop()}`
|
|
1294
|
+
},
|
|
1295
|
+
phone: {
|
|
1296
|
+
pattern: /(?:\+\d{1,3}[\s.-]?\(?\d{1,4}\)?|\(\d{1,4}\))(?:[\s.-]?\d{2,4}){2,4}\b/g,
|
|
1297
|
+
mask: (m) => {
|
|
1298
|
+
const digits = m.replace(/[^\d]/g, "");
|
|
1299
|
+
if (m.startsWith("+") && digits.length > 4) {
|
|
1300
|
+
const ccMatch = m.match(/^\+\d{1,3}/);
|
|
1301
|
+
return `${ccMatch ? ccMatch[0] : "+"}******${digits.slice(-2)}`;
|
|
1302
|
+
}
|
|
1303
|
+
if (digits.length > 2)
|
|
1304
|
+
return `${"*".repeat(digits.length - 2)}${digits.slice(-2)}`;
|
|
1305
|
+
return "***";
|
|
1306
|
+
}
|
|
1307
|
+
},
|
|
1308
|
+
jwt: {
|
|
1309
|
+
pattern: /\beyJ[\w-]*\.[\w-]*\.[\w-]*\b/g,
|
|
1310
|
+
mask: () => "eyJ***.***"
|
|
1311
|
+
},
|
|
1312
|
+
bearer: {
|
|
1313
|
+
pattern: /\bBearer\s+[\w\-.~+/]{8,}=*/gi,
|
|
1314
|
+
mask: () => "Bearer ***"
|
|
1315
|
+
},
|
|
1316
|
+
iban: {
|
|
1317
|
+
pattern: /\b[A-Z]{2}\d{2}[\s-]?[\dA-Z]{4}[\s-]?[\dA-Z]{4}[\s-]?[\dA-Z]{4}[\s-]?[\dA-Z]{0,4}[\s-]?[\dA-Z]{0,4}[\s-]?[\dA-Z]{0,4}\b/g,
|
|
1318
|
+
mask: (m) => {
|
|
1319
|
+
const clean = m.replace(/[\s-]/g, "");
|
|
1320
|
+
return `${clean.slice(0, 4)}****${clean.slice(-3)}`;
|
|
1321
|
+
}
|
|
1159
1322
|
}
|
|
1160
|
-
|
|
1161
|
-
|
|
1162
|
-
|
|
1163
|
-
|
|
1164
|
-
|
|
1165
|
-
|
|
1166
|
-
|
|
1167
|
-
|
|
1168
|
-
|
|
1169
|
-
|
|
1323
|
+
};
|
|
1324
|
+
function resolveRedactConfig(input) {
|
|
1325
|
+
if (input === undefined || input === false)
|
|
1326
|
+
return;
|
|
1327
|
+
if (input === true)
|
|
1328
|
+
return { _maskers: allBuiltinMaskers() };
|
|
1329
|
+
if (input.builtins === false)
|
|
1330
|
+
return {
|
|
1331
|
+
...input,
|
|
1332
|
+
_pathMatchers: compileRedactPathMatchers(input.paths)
|
|
1333
|
+
};
|
|
1334
|
+
const maskers = Array.isArray(input.builtins) ? input.builtins.map((name) => builtinPatterns[name]).filter(Boolean).map((b) => [cloneRegex(b.pattern), b.mask]) : allBuiltinMaskers();
|
|
1335
|
+
return {
|
|
1336
|
+
...input,
|
|
1337
|
+
_maskers: maskers,
|
|
1338
|
+
_pathMatchers: compileRedactPathMatchers(input.paths)
|
|
1339
|
+
};
|
|
1170
1340
|
}
|
|
1171
|
-
function
|
|
1172
|
-
|
|
1173
|
-
if (frame.isApp && frame.file && frame.line && !isInternalErrorFrame(frame))
|
|
1174
|
-
return frame;
|
|
1341
|
+
function allBuiltinMaskers() {
|
|
1342
|
+
return Object.values(builtinPatterns).map((b) => [cloneRegex(b.pattern), b.mask]);
|
|
1175
1343
|
}
|
|
1176
|
-
function
|
|
1177
|
-
|
|
1178
|
-
return null;
|
|
1179
|
-
const path = decodeFileUrl(file).replace(/\\/g, "/");
|
|
1180
|
-
if (path.includes(".next/") || path.includes(".nuxt/") || path.includes(".output/"))
|
|
1181
|
-
return null;
|
|
1182
|
-
return snippetReader(file, line, contextLines);
|
|
1344
|
+
function cloneRegex(re) {
|
|
1345
|
+
return new RegExp(re.source, re.flags);
|
|
1183
1346
|
}
|
|
1184
|
-
|
|
1185
|
-
|
|
1186
|
-
|
|
1187
|
-
|
|
1188
|
-
|
|
1189
|
-
|
|
1190
|
-
return `${marker} ${numColor}${String(line).padStart(width, " ")}${colors.reset} ${colors.dim}\u2503${colors.reset} ${colors.dim}${trimmed}${colors.reset}`;
|
|
1347
|
+
var globallyRedacted = Symbol.for("evlog.globallyRedacted");
|
|
1348
|
+
function markGloballyRedacted(event) {
|
|
1349
|
+
Object.defineProperty(event, globallyRedacted, {
|
|
1350
|
+
value: true,
|
|
1351
|
+
enumerable: false,
|
|
1352
|
+
configurable: true
|
|
1191
1353
|
});
|
|
1192
1354
|
}
|
|
1193
|
-
function
|
|
1194
|
-
|
|
1195
|
-
|
|
1196
|
-
|
|
1197
|
-
|
|
1198
|
-
|
|
1199
|
-
|
|
1200
|
-
|
|
1201
|
-
|
|
1202
|
-
const prefix = frame.fn?.startsWith("async") ? "at async " : "at ";
|
|
1203
|
-
const fn = frame.fn?.replace(/^async /, "");
|
|
1204
|
-
if (fn && fn !== "<unknown>" && fn !== loc)
|
|
1205
|
-
return `${prefix}${fn} (${loc})`;
|
|
1206
|
-
return `${prefix}${loc}`;
|
|
1207
|
-
}
|
|
1208
|
-
var GUIDANCE_WRAP_WIDTH = 76;
|
|
1209
|
-
var GUIDANCE_CONTINUATION = " ";
|
|
1210
|
-
function formatGuidanceLine(label, text, labelColor) {
|
|
1211
|
-
const prefix = `${labelColor}${label}:${colors.reset} `;
|
|
1212
|
-
const lines = [];
|
|
1213
|
-
let remaining = text.trim();
|
|
1214
|
-
let first = true;
|
|
1215
|
-
while (remaining.length > 0) {
|
|
1216
|
-
const budget = first ? Math.max(24, GUIDANCE_WRAP_WIDTH - prefix.length) : Math.max(24, GUIDANCE_WRAP_WIDTH - 5);
|
|
1217
|
-
if (remaining.length <= budget) {
|
|
1218
|
-
lines.push(first ? `${prefix}${remaining}` : `${GUIDANCE_CONTINUATION}${remaining}`);
|
|
1219
|
-
break;
|
|
1355
|
+
function cloneForRedaction(event) {
|
|
1356
|
+
try {
|
|
1357
|
+
return structuredClone(event);
|
|
1358
|
+
} catch {
|
|
1359
|
+
try {
|
|
1360
|
+
return JSON.parse(JSON.stringify(event));
|
|
1361
|
+
} catch {
|
|
1362
|
+
console.warn("[cloneForRedaction] Shallow clone used \u2014 nested objects may be mutated by redactPath, redactPatterns, and applyMaskersToTree");
|
|
1363
|
+
return { ...event };
|
|
1220
1364
|
}
|
|
1221
|
-
let split = remaining.lastIndexOf(" ", budget);
|
|
1222
|
-
if (split <= 0)
|
|
1223
|
-
split = budget;
|
|
1224
|
-
const chunk = remaining.slice(0, split).trimEnd();
|
|
1225
|
-
lines.push(first ? `${prefix}${chunk}` : `${GUIDANCE_CONTINUATION}${chunk}`);
|
|
1226
|
-
remaining = remaining.slice(split).trimStart();
|
|
1227
|
-
first = false;
|
|
1228
1365
|
}
|
|
1229
|
-
return lines;
|
|
1230
1366
|
}
|
|
1231
|
-
function
|
|
1232
|
-
const
|
|
1233
|
-
|
|
1234
|
-
|
|
1235
|
-
|
|
1236
|
-
|
|
1237
|
-
|
|
1238
|
-
|
|
1239
|
-
|
|
1240
|
-
const
|
|
1241
|
-
|
|
1242
|
-
|
|
1243
|
-
|
|
1244
|
-
|
|
1245
|
-
|
|
1246
|
-
|
|
1247
|
-
|
|
1248
|
-
|
|
1249
|
-
|
|
1250
|
-
|
|
1251
|
-
|
|
1252
|
-
|
|
1367
|
+
function redactEvent(event, config) {
|
|
1368
|
+
const clone = cloneForRedaction(event);
|
|
1369
|
+
const replacement = config.replacement ?? DEFAULT_REPLACEMENT;
|
|
1370
|
+
if (config.transform)
|
|
1371
|
+
try {
|
|
1372
|
+
config.transform(clone);
|
|
1373
|
+
} catch (err) {
|
|
1374
|
+
console.error("[evlog] redact transform failed:", err);
|
|
1375
|
+
}
|
|
1376
|
+
const pathMatchers = config._pathMatchers ?? compileRedactPathMatchers(config.paths);
|
|
1377
|
+
if (pathMatchers)
|
|
1378
|
+
redactPathsInTree(clone, pathMatchers, replacement);
|
|
1379
|
+
if (config._maskers?.length)
|
|
1380
|
+
applyMaskersToTree(clone, config._maskers);
|
|
1381
|
+
if (config.patterns?.length)
|
|
1382
|
+
redactPatterns(clone, config.patterns, replacement);
|
|
1383
|
+
return clone;
|
|
1384
|
+
}
|
|
1385
|
+
function redactPatterns(obj, patterns, replacement, prefix = "") {
|
|
1386
|
+
if (obj === null || obj === undefined)
|
|
1387
|
+
return;
|
|
1388
|
+
if (Array.isArray(obj)) {
|
|
1389
|
+
for (let i = 0;i < obj.length; i++) {
|
|
1390
|
+
const key = String(i);
|
|
1391
|
+
const fullPath = prefix ? `${prefix}.${key}` : key;
|
|
1392
|
+
if (typeof obj[i] === "string")
|
|
1393
|
+
obj[i] = applyPatterns(obj[i], patterns, replacement, fullPath, key);
|
|
1394
|
+
else if (typeof obj[i] === "object")
|
|
1395
|
+
redactPatterns(obj[i], patterns, replacement, fullPath);
|
|
1396
|
+
}
|
|
1397
|
+
return;
|
|
1253
1398
|
}
|
|
1254
|
-
if (
|
|
1255
|
-
|
|
1256
|
-
|
|
1257
|
-
|
|
1258
|
-
|
|
1259
|
-
|
|
1260
|
-
|
|
1261
|
-
|
|
1262
|
-
|
|
1263
|
-
|
|
1264
|
-
if (normalized.cause && normalized.cause !== normalized.message)
|
|
1265
|
-
children.push(`${colors.dim}Caused by:${colors.reset} ${normalized.cause}`);
|
|
1266
|
-
const hiddenCount = guidanceOnly ? 0 : frames.filter((f) => !f.isApp || isInternalErrorFrame(f)).length;
|
|
1267
|
-
const tailFrames = stackDepth > 0 ? frames.filter((f) => f !== primary && !isInternalErrorFrame(f)).slice(0, stackDepth) : [];
|
|
1268
|
-
if (!guidanceOnly && (hiddenCount > 0 || tailFrames.length > 0)) {
|
|
1269
|
-
pushTreeSpacer(children);
|
|
1270
|
-
if (hiddenCount > 0)
|
|
1271
|
-
children.push(`${colors.gray}stack (${hiddenCount} frame${hiddenCount === 1 ? "" : "s"} hidden in node_modules)${colors.reset}`);
|
|
1272
|
-
else
|
|
1273
|
-
children.push(`${colors.gray}stack${colors.reset}`);
|
|
1274
|
-
for (const frame of tailFrames)
|
|
1275
|
-
children.push(`${colors.gray} ${formatCollapsedFrame(frame, cwd)}${colors.reset}`);
|
|
1399
|
+
if (typeof obj === "object") {
|
|
1400
|
+
const record = obj;
|
|
1401
|
+
for (const key of redactableKeys(record)) {
|
|
1402
|
+
const val = record[key];
|
|
1403
|
+
const fullPath = prefix ? `${prefix}.${key}` : key;
|
|
1404
|
+
if (typeof val === "string")
|
|
1405
|
+
setRedacted(record, key, applyPatterns(val, patterns, replacement, fullPath, key), fullPath);
|
|
1406
|
+
else if (typeof val === "object")
|
|
1407
|
+
redactPatterns(val, patterns, replacement, fullPath);
|
|
1408
|
+
}
|
|
1276
1409
|
}
|
|
1277
|
-
return [{
|
|
1278
|
-
key: "error",
|
|
1279
|
-
value: `${colors.red}${colors.bold}${normalized.message}${colors.reset}`,
|
|
1280
|
-
children: children.length > 0 ? children : undefined
|
|
1281
|
-
}];
|
|
1282
1410
|
}
|
|
1283
|
-
|
|
1284
|
-
|
|
1285
|
-
|
|
1286
|
-
|
|
1287
|
-
|
|
1288
|
-
|
|
1289
|
-
|
|
1290
|
-
|
|
1291
|
-
|
|
1292
|
-
|
|
1293
|
-
|
|
1294
|
-
|
|
1295
|
-
|
|
1296
|
-
|
|
1411
|
+
function applyPatterns(value, patterns, replacement, path, key) {
|
|
1412
|
+
let result = value;
|
|
1413
|
+
for (const pattern of patterns) {
|
|
1414
|
+
if (typeof replacement === "string") {
|
|
1415
|
+
result = result.replace(pattern, replacement);
|
|
1416
|
+
continue;
|
|
1417
|
+
}
|
|
1418
|
+
result = result.replace(pattern, (...args) => {
|
|
1419
|
+
const match = args[0];
|
|
1420
|
+
return resolveReplacement(replacement, match, {
|
|
1421
|
+
path,
|
|
1422
|
+
key,
|
|
1423
|
+
groups: captureGroups(args)
|
|
1424
|
+
});
|
|
1425
|
+
});
|
|
1297
1426
|
}
|
|
1298
|
-
};
|
|
1299
|
-
function finalizePrettyError(partial, frameworkOverlay, pretty, inDev) {
|
|
1300
|
-
const compact = partial.compact ?? (inDev && pretty);
|
|
1301
|
-
const detail = partial.detail ?? (frameworkOverlay ? "guidance" : "full");
|
|
1302
|
-
const stackDepth = detail === "guidance" ? 0 : partial.stackDepth ?? (compact ? 2 : 3);
|
|
1303
|
-
return {
|
|
1304
|
-
snippet: partial.snippet ?? (detail === "full" && pretty && inDev),
|
|
1305
|
-
stackDepth,
|
|
1306
|
-
compact,
|
|
1307
|
-
detail
|
|
1308
|
-
};
|
|
1309
|
-
}
|
|
1310
|
-
function resolveDevTerminal(input = {}) {
|
|
1311
|
-
const pretty = input.pretty ?? isDev();
|
|
1312
|
-
const inDev = isDev();
|
|
1313
|
-
let frameworkOverlay;
|
|
1314
|
-
let prettyError = {};
|
|
1315
|
-
if (typeof input.dev === "string" && input.dev in DEV_PRESETS) {
|
|
1316
|
-
const { frameworkOverlay: presetOverlay, detail } = DEV_PRESETS[input.dev];
|
|
1317
|
-
frameworkOverlay = presetOverlay;
|
|
1318
|
-
prettyError = { detail };
|
|
1319
|
-
} else if (input.dev && typeof input.dev === "object") {
|
|
1320
|
-
const { frameworkOverlay: devOverlay, prettyError: devPrettyError } = input.dev;
|
|
1321
|
-
frameworkOverlay = devOverlay;
|
|
1322
|
-
if (devPrettyError)
|
|
1323
|
-
prettyError = devPrettyError;
|
|
1324
|
-
}
|
|
1325
|
-
if (frameworkOverlay === undefined)
|
|
1326
|
-
frameworkOverlay = !(pretty && inDev);
|
|
1327
|
-
return {
|
|
1328
|
-
frameworkOverlay,
|
|
1329
|
-
prettyError: finalizePrettyError(prettyError, frameworkOverlay, pretty, inDev)
|
|
1330
|
-
};
|
|
1331
|
-
}
|
|
1332
|
-
|
|
1333
|
-
// ../../node_modules/.bun/evlog@2.22.3+6e5ab44a2bca2113/node_modules/evlog/dist/audit-CPODPtOL.mjs
|
|
1334
|
-
var DEFAULT_REPLACEMENT = "[REDACTED]";
|
|
1335
|
-
function normalizeRedactPathPattern(pattern) {
|
|
1336
|
-
if (!pattern.includes("*") && !pattern.includes("."))
|
|
1337
|
-
return `**.${pattern}`;
|
|
1338
|
-
return pattern;
|
|
1339
|
-
}
|
|
1340
|
-
function compileRedactPathMatchers(patterns) {
|
|
1341
|
-
if (!patterns?.length)
|
|
1342
|
-
return;
|
|
1343
|
-
const exactPaths = /* @__PURE__ */ new Set;
|
|
1344
|
-
const pathGlobs = [];
|
|
1345
|
-
const keyGlobs = [];
|
|
1346
|
-
const caseInsensitiveLeaves = /* @__PURE__ */ new Set;
|
|
1347
|
-
for (const raw of patterns) {
|
|
1348
|
-
if (!raw.includes("*")) {
|
|
1349
|
-
if (raw.includes("."))
|
|
1350
|
-
exactPaths.add(raw);
|
|
1351
|
-
else
|
|
1352
|
-
addPathGlobPattern(normalizeRedactPathPattern(raw), exactPaths, pathGlobs, caseInsensitiveLeaves);
|
|
1353
|
-
continue;
|
|
1354
|
-
}
|
|
1355
|
-
if (!raw.includes("."))
|
|
1356
|
-
keyGlobs.push(globToRegExp(raw, "."));
|
|
1357
|
-
else
|
|
1358
|
-
addPathGlobPattern(raw, exactPaths, pathGlobs, caseInsensitiveLeaves);
|
|
1359
|
-
}
|
|
1360
|
-
if (exactPaths.size === 0 && pathGlobs.length === 0 && keyGlobs.length === 0 && caseInsensitiveLeaves.size === 0)
|
|
1361
|
-
return;
|
|
1362
|
-
return {
|
|
1363
|
-
exactPaths,
|
|
1364
|
-
pathGlobs,
|
|
1365
|
-
keyGlobs,
|
|
1366
|
-
caseInsensitiveLeaves
|
|
1367
|
-
};
|
|
1368
|
-
}
|
|
1369
|
-
function addPathGlobPattern(pattern, exactPaths, pathGlobs, caseInsensitiveLeaves) {
|
|
1370
|
-
pathGlobs.push(globToRegExp(pattern, "."));
|
|
1371
|
-
const leaf = pattern.match(/^\*\*\.([^.?*]+)$/);
|
|
1372
|
-
if (leaf) {
|
|
1373
|
-
exactPaths.add(leaf[1]);
|
|
1374
|
-
caseInsensitiveLeaves.add(leaf[1].toLowerCase());
|
|
1375
|
-
}
|
|
1376
|
-
}
|
|
1377
|
-
function matchesRedactPath(fullPath, leafKey, matchers) {
|
|
1378
|
-
if (matchers.exactPaths.has(fullPath))
|
|
1379
|
-
return true;
|
|
1380
|
-
if (matchers.caseInsensitiveLeaves.has(leafKey.toLowerCase()))
|
|
1381
|
-
return true;
|
|
1382
|
-
for (const glob of matchers.pathGlobs) {
|
|
1383
|
-
glob.lastIndex = 0;
|
|
1384
|
-
if (glob.test(fullPath))
|
|
1385
|
-
return true;
|
|
1386
|
-
}
|
|
1387
|
-
for (const glob of matchers.keyGlobs) {
|
|
1388
|
-
glob.lastIndex = 0;
|
|
1389
|
-
if (glob.test(leafKey))
|
|
1390
|
-
return true;
|
|
1391
|
-
}
|
|
1392
|
-
return false;
|
|
1393
|
-
}
|
|
1394
|
-
function redactPathsInTree(obj, matchers, replacement, prefix = "") {
|
|
1395
|
-
if (obj === null || obj === undefined)
|
|
1396
|
-
return;
|
|
1397
|
-
if (Array.isArray(obj)) {
|
|
1398
|
-
for (let i = 0;i < obj.length; i++) {
|
|
1399
|
-
const segment = String(i);
|
|
1400
|
-
const fullPath = prefix ? `${prefix}.${segment}` : segment;
|
|
1401
|
-
redactPathsInTree(obj[i], matchers, replacement, fullPath);
|
|
1402
|
-
}
|
|
1403
|
-
return;
|
|
1404
|
-
}
|
|
1405
|
-
if (typeof obj === "object") {
|
|
1406
|
-
const record = obj;
|
|
1407
|
-
for (const key in record) {
|
|
1408
|
-
const fullPath = prefix ? `${prefix}.${key}` : key;
|
|
1409
|
-
if (matchesRedactPath(fullPath, key, matchers))
|
|
1410
|
-
record[key] = replacement;
|
|
1411
|
-
else
|
|
1412
|
-
redactPathsInTree(record[key], matchers, replacement, fullPath);
|
|
1413
|
-
}
|
|
1414
|
-
}
|
|
1415
|
-
}
|
|
1416
|
-
var builtinPatterns = {
|
|
1417
|
-
creditCard: {
|
|
1418
|
-
pattern: /\b\d{4}[\s-]?\d{4}[\s-]?\d{4}[\s-]?\d{4}\b/g,
|
|
1419
|
-
mask: (m) => `****${m.replace(/[\s-]/g, "").slice(-4)}`
|
|
1420
|
-
},
|
|
1421
|
-
email: {
|
|
1422
|
-
pattern: /[\w.+-]+@[\w-]+\.[\w.]+/g,
|
|
1423
|
-
mask: (m) => {
|
|
1424
|
-
if (m.indexOf("@") < 1)
|
|
1425
|
-
return "***@***";
|
|
1426
|
-
const tld = m.slice(m.lastIndexOf("."));
|
|
1427
|
-
return `${m[0]}***@***${tld}`;
|
|
1428
|
-
}
|
|
1429
|
-
},
|
|
1430
|
-
ipv4: {
|
|
1431
|
-
pattern: /\b(?!0\.0\.0\.0\b)(?!127\.0\.0\.1\b)\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\b/g,
|
|
1432
|
-
mask: (m) => `***.***.***.${m.split(".").pop()}`
|
|
1433
|
-
},
|
|
1434
|
-
phone: {
|
|
1435
|
-
pattern: /(?:\+\d{1,3}[\s.-]?\(?\d{1,4}\)?|\(\d{1,4}\))(?:[\s.-]?\d{2,4}){2,4}\b/g,
|
|
1436
|
-
mask: (m) => {
|
|
1437
|
-
const digits = m.replace(/[^\d]/g, "");
|
|
1438
|
-
if (m.startsWith("+") && digits.length > 4) {
|
|
1439
|
-
const ccMatch = m.match(/^\+\d{1,3}/);
|
|
1440
|
-
return `${ccMatch ? ccMatch[0] : "+"}******${digits.slice(-2)}`;
|
|
1441
|
-
}
|
|
1442
|
-
if (digits.length > 2)
|
|
1443
|
-
return `${"*".repeat(digits.length - 2)}${digits.slice(-2)}`;
|
|
1444
|
-
return "***";
|
|
1445
|
-
}
|
|
1446
|
-
},
|
|
1447
|
-
jwt: {
|
|
1448
|
-
pattern: /\beyJ[\w-]*\.[\w-]*\.[\w-]*\b/g,
|
|
1449
|
-
mask: () => "eyJ***.***"
|
|
1450
|
-
},
|
|
1451
|
-
bearer: {
|
|
1452
|
-
pattern: /\bBearer\s+[\w\-.~+/]{8,}=*/gi,
|
|
1453
|
-
mask: () => "Bearer ***"
|
|
1454
|
-
},
|
|
1455
|
-
iban: {
|
|
1456
|
-
pattern: /\b[A-Z]{2}\d{2}[\s-]?[\dA-Z]{4}[\s-]?[\dA-Z]{4}[\s-]?[\dA-Z]{4}[\s-]?[\dA-Z]{0,4}[\s-]?[\dA-Z]{0,4}[\s-]?[\dA-Z]{0,4}\b/g,
|
|
1457
|
-
mask: (m) => {
|
|
1458
|
-
const clean = m.replace(/[\s-]/g, "");
|
|
1459
|
-
return `${clean.slice(0, 4)}****${clean.slice(-3)}`;
|
|
1460
|
-
}
|
|
1461
|
-
}
|
|
1462
|
-
};
|
|
1463
|
-
function resolveRedactConfig(input) {
|
|
1464
|
-
if (input === undefined || input === false)
|
|
1465
|
-
return;
|
|
1466
|
-
if (input === true)
|
|
1467
|
-
return { _maskers: allBuiltinMaskers() };
|
|
1468
|
-
if (input.builtins === false)
|
|
1469
|
-
return {
|
|
1470
|
-
...input,
|
|
1471
|
-
_pathMatchers: compileRedactPathMatchers(input.paths)
|
|
1472
|
-
};
|
|
1473
|
-
const maskers = Array.isArray(input.builtins) ? input.builtins.map((name) => builtinPatterns[name]).filter(Boolean).map((b) => [cloneRegex(b.pattern), b.mask]) : allBuiltinMaskers();
|
|
1474
|
-
return {
|
|
1475
|
-
...input,
|
|
1476
|
-
_maskers: maskers,
|
|
1477
|
-
_pathMatchers: compileRedactPathMatchers(input.paths)
|
|
1478
|
-
};
|
|
1479
|
-
}
|
|
1480
|
-
function allBuiltinMaskers() {
|
|
1481
|
-
return Object.values(builtinPatterns).map((b) => [cloneRegex(b.pattern), b.mask]);
|
|
1482
|
-
}
|
|
1483
|
-
function cloneRegex(re) {
|
|
1484
|
-
return new RegExp(re.source, re.flags);
|
|
1485
|
-
}
|
|
1486
|
-
var globallyRedacted = Symbol.for("evlog.globallyRedacted");
|
|
1487
|
-
function markGloballyRedacted(event) {
|
|
1488
|
-
Object.defineProperty(event, globallyRedacted, {
|
|
1489
|
-
value: true,
|
|
1490
|
-
enumerable: false,
|
|
1491
|
-
configurable: true
|
|
1492
|
-
});
|
|
1493
|
-
}
|
|
1494
|
-
function cloneForRedaction(event) {
|
|
1495
|
-
try {
|
|
1496
|
-
return structuredClone(event);
|
|
1497
|
-
} catch {
|
|
1498
|
-
try {
|
|
1499
|
-
return JSON.parse(JSON.stringify(event));
|
|
1500
|
-
} catch {
|
|
1501
|
-
console.warn("[cloneForRedaction] Shallow clone used \u2014 nested objects may be mutated by redactPath, redactPatterns, and applyMaskersToTree");
|
|
1502
|
-
return { ...event };
|
|
1503
|
-
}
|
|
1504
|
-
}
|
|
1505
|
-
}
|
|
1506
|
-
function redactEvent(event, config) {
|
|
1507
|
-
const clone = cloneForRedaction(event);
|
|
1508
|
-
const replacement = config.replacement ?? DEFAULT_REPLACEMENT;
|
|
1509
|
-
const pathMatchers = config._pathMatchers ?? compileRedactPathMatchers(config.paths);
|
|
1510
|
-
if (pathMatchers)
|
|
1511
|
-
redactPathsInTree(clone, pathMatchers, replacement);
|
|
1512
|
-
if (config._maskers?.length)
|
|
1513
|
-
applyMaskersToTree(clone, config._maskers);
|
|
1514
|
-
if (config.patterns?.length)
|
|
1515
|
-
redactPatterns(clone, config.patterns, replacement);
|
|
1516
|
-
return clone;
|
|
1517
|
-
}
|
|
1518
|
-
function redactPatterns(obj, patterns, replacement) {
|
|
1519
|
-
if (obj === null || obj === undefined)
|
|
1520
|
-
return;
|
|
1521
|
-
if (Array.isArray(obj)) {
|
|
1522
|
-
for (let i = 0;i < obj.length; i++)
|
|
1523
|
-
if (typeof obj[i] === "string")
|
|
1524
|
-
obj[i] = applyPatterns(obj[i], patterns, replacement);
|
|
1525
|
-
else if (typeof obj[i] === "object")
|
|
1526
|
-
redactPatterns(obj[i], patterns, replacement);
|
|
1527
|
-
return;
|
|
1528
|
-
}
|
|
1529
|
-
if (typeof obj === "object") {
|
|
1530
|
-
const record = obj;
|
|
1531
|
-
for (const key in record) {
|
|
1532
|
-
const val = record[key];
|
|
1533
|
-
if (typeof val === "string")
|
|
1534
|
-
record[key] = applyPatterns(val, patterns, replacement);
|
|
1535
|
-
else if (typeof val === "object")
|
|
1536
|
-
redactPatterns(val, patterns, replacement);
|
|
1537
|
-
}
|
|
1538
|
-
}
|
|
1539
|
-
}
|
|
1540
|
-
function applyPatterns(value, patterns, replacement) {
|
|
1541
|
-
let result = value;
|
|
1542
|
-
for (const pattern of patterns)
|
|
1543
|
-
result = result.replace(pattern, replacement);
|
|
1544
1427
|
return result;
|
|
1545
1428
|
}
|
|
1429
|
+
function captureGroups(args) {
|
|
1430
|
+
const last = args.at(-1);
|
|
1431
|
+
const trailing = typeof last === "object" && last !== null ? 3 : 2;
|
|
1432
|
+
return args.slice(1, Math.max(1, args.length - trailing));
|
|
1433
|
+
}
|
|
1546
1434
|
function applyMaskersToTree(obj, maskers) {
|
|
1547
1435
|
if (obj === null || obj === undefined)
|
|
1548
1436
|
return;
|
|
@@ -1556,10 +1444,10 @@ function applyMaskersToTree(obj, maskers) {
|
|
|
1556
1444
|
}
|
|
1557
1445
|
if (typeof obj === "object") {
|
|
1558
1446
|
const record = obj;
|
|
1559
|
-
for (const key
|
|
1447
|
+
for (const key of redactableKeys(record)) {
|
|
1560
1448
|
const val = record[key];
|
|
1561
1449
|
if (typeof val === "string")
|
|
1562
|
-
record
|
|
1450
|
+
setRedacted(record, key, applyMaskers(val, maskers), key);
|
|
1563
1451
|
else if (typeof val === "object")
|
|
1564
1452
|
applyMaskersToTree(val, maskers);
|
|
1565
1453
|
}
|
|
@@ -1571,6 +1459,8 @@ function applyMaskers(value, maskers) {
|
|
|
1571
1459
|
result = result.replace(pattern, mask);
|
|
1572
1460
|
return result;
|
|
1573
1461
|
}
|
|
1462
|
+
|
|
1463
|
+
// ../../node_modules/.bun/evlog@2.28.1+4cac44d0f5802a4d/node_modules/evlog/dist/globalRegistry-Bh3bIGwA.mjs
|
|
1574
1464
|
function logPluginError(name, hook, err) {
|
|
1575
1465
|
console.error(`[evlog/${name}] ${hook} failed:`, err);
|
|
1576
1466
|
}
|
|
@@ -1678,10 +1568,408 @@ function createPluginRunner(plugins = []) {
|
|
|
1678
1568
|
}
|
|
1679
1569
|
};
|
|
1680
1570
|
}
|
|
1681
|
-
var emptyRunner = createPluginRunner([]);
|
|
1682
|
-
function getEmptyPluginRunner() {
|
|
1683
|
-
return emptyRunner;
|
|
1571
|
+
var emptyRunner = createPluginRunner([]);
|
|
1572
|
+
function getEmptyPluginRunner() {
|
|
1573
|
+
return emptyRunner;
|
|
1574
|
+
}
|
|
1575
|
+
var EVLOG_MAJOR = 2;
|
|
1576
|
+
var REGISTRY_KEY = Symbol.for(`evlog.registry.v${EVLOG_MAJOR}`);
|
|
1577
|
+
var MAJORS_KEY = Symbol.for("evlog.majors");
|
|
1578
|
+
function createConfig() {
|
|
1579
|
+
return {
|
|
1580
|
+
env: {
|
|
1581
|
+
service: "app",
|
|
1582
|
+
environment: "development"
|
|
1583
|
+
},
|
|
1584
|
+
pretty: isDev(),
|
|
1585
|
+
prettyError: {
|
|
1586
|
+
snippet: isDev(),
|
|
1587
|
+
stackDepth: 2,
|
|
1588
|
+
compact: isDev(),
|
|
1589
|
+
detail: "full"
|
|
1590
|
+
},
|
|
1591
|
+
sampling: {},
|
|
1592
|
+
stringify: true,
|
|
1593
|
+
drain: undefined,
|
|
1594
|
+
redact: undefined,
|
|
1595
|
+
enabled: true,
|
|
1596
|
+
silent: false,
|
|
1597
|
+
minLevel: "debug",
|
|
1598
|
+
locked: false,
|
|
1599
|
+
initialized: false,
|
|
1600
|
+
pluginRunner: getEmptyPluginRunner()
|
|
1601
|
+
};
|
|
1602
|
+
}
|
|
1603
|
+
function warnOnMultiMajor(host) {
|
|
1604
|
+
const majors = host[MAJORS_KEY] ??= /* @__PURE__ */ new Set;
|
|
1605
|
+
if (majors.has(EVLOG_MAJOR))
|
|
1606
|
+
return;
|
|
1607
|
+
majors.add(EVLOG_MAJOR);
|
|
1608
|
+
if (majors.size > 1)
|
|
1609
|
+
console.warn(`[evlog] Multiple major versions of evlog are loaded in this process (${[...majors].map((m) => `${m}.x`).join(", ")}). They cannot share request scope or logger configuration: events emitted through the other copy will be undrained and unredacted, and useLogger() may throw. Deduplicate evlog to a single major.`);
|
|
1610
|
+
}
|
|
1611
|
+
function getRegistry() {
|
|
1612
|
+
const host = globalThis;
|
|
1613
|
+
warnOnMultiMajor(host);
|
|
1614
|
+
return host[REGISTRY_KEY] ??= {
|
|
1615
|
+
config: createConfig(),
|
|
1616
|
+
storages: /* @__PURE__ */ new Map
|
|
1617
|
+
};
|
|
1618
|
+
}
|
|
1619
|
+
var globalConfig = getRegistry().config;
|
|
1620
|
+
|
|
1621
|
+
// ../../node_modules/.bun/evlog@2.28.1+4cac44d0f5802a4d/node_modules/evlog/dist/pretty-error-DTIHxnBN.mjs
|
|
1622
|
+
var snippetReader = null;
|
|
1623
|
+
var PRETTY_ERROR_TREE_SPACER = "__EVLOG_TREE_SPACER__";
|
|
1624
|
+
function pushTreeSpacer(children) {
|
|
1625
|
+
children.push(PRETTY_ERROR_TREE_SPACER);
|
|
1626
|
+
}
|
|
1627
|
+
var SKIP_PATH_RE = /(?:^|[/\\])(?:node_modules|\.nuxt|\.next|\.output)(?:[/\\]|$)/;
|
|
1628
|
+
var SKIP_FRAME_PATH_RE = /(?:^|[/\\])(?:packages[/\\]evlog|evlog[/\\](?:dist|src))(?:[/\\]|$)/;
|
|
1629
|
+
var SKIP_FRAME_FN_RE = /^(?:createError|EvlogError|new EvlogError)$/;
|
|
1630
|
+
function isPlainObject(val) {
|
|
1631
|
+
return val !== null && typeof val === "object" && !Array.isArray(val);
|
|
1632
|
+
}
|
|
1633
|
+
function pickString(obj, key) {
|
|
1634
|
+
const val = obj[key];
|
|
1635
|
+
return typeof val === "string" && val.length > 0 ? val : undefined;
|
|
1636
|
+
}
|
|
1637
|
+
function pickNumber(obj, key) {
|
|
1638
|
+
const val = obj[key];
|
|
1639
|
+
return typeof val === "number" ? val : undefined;
|
|
1640
|
+
}
|
|
1641
|
+
function extractGuidance(data) {
|
|
1642
|
+
return {
|
|
1643
|
+
code: pickString(data, "code"),
|
|
1644
|
+
why: pickString(data, "why"),
|
|
1645
|
+
fix: pickString(data, "fix"),
|
|
1646
|
+
link: pickString(data, "link")
|
|
1647
|
+
};
|
|
1648
|
+
}
|
|
1649
|
+
function normalizeErrorContext(error) {
|
|
1650
|
+
if (error === null || error === undefined)
|
|
1651
|
+
return null;
|
|
1652
|
+
if (typeof error === "string")
|
|
1653
|
+
return { message: error };
|
|
1654
|
+
if (!isPlainObject(error))
|
|
1655
|
+
return { message: String(error) };
|
|
1656
|
+
const result = {
|
|
1657
|
+
message: pickString(error, "message") ?? pickString(error, "statusText") ?? pickString(error, "statusMessage") ?? "Unknown error",
|
|
1658
|
+
name: pickString(error, "name"),
|
|
1659
|
+
code: pickString(error, "code"),
|
|
1660
|
+
why: pickString(error, "why"),
|
|
1661
|
+
fix: pickString(error, "fix"),
|
|
1662
|
+
link: pickString(error, "link"),
|
|
1663
|
+
status: pickNumber(error, "status") ?? pickNumber(error, "statusCode"),
|
|
1664
|
+
stack: pickString(error, "stack")
|
|
1665
|
+
};
|
|
1666
|
+
const { data, cause } = error;
|
|
1667
|
+
if (isPlainObject(data)) {
|
|
1668
|
+
const guidance = extractGuidance(data);
|
|
1669
|
+
if (!result.code)
|
|
1670
|
+
result.code = guidance.code;
|
|
1671
|
+
if (!result.why)
|
|
1672
|
+
result.why = guidance.why;
|
|
1673
|
+
if (!result.fix)
|
|
1674
|
+
result.fix = guidance.fix;
|
|
1675
|
+
if (!result.link)
|
|
1676
|
+
result.link = guidance.link;
|
|
1677
|
+
}
|
|
1678
|
+
if (cause instanceof Error)
|
|
1679
|
+
result.cause = cause.message;
|
|
1680
|
+
else if (isPlainObject(cause) && pickString(cause, "message"))
|
|
1681
|
+
result.cause = pickString(cause, "message");
|
|
1682
|
+
return result;
|
|
1683
|
+
}
|
|
1684
|
+
function decodeFileUrl(file) {
|
|
1685
|
+
if (file.startsWith("file://"))
|
|
1686
|
+
try {
|
|
1687
|
+
return decodeURIComponent(new URL(file).pathname);
|
|
1688
|
+
} catch {
|
|
1689
|
+
return file.slice(7);
|
|
1690
|
+
}
|
|
1691
|
+
return file;
|
|
1692
|
+
}
|
|
1693
|
+
function isAppPath(file) {
|
|
1694
|
+
const normalized = decodeFileUrl(file).replace(/\\/g, "/");
|
|
1695
|
+
if (normalized.startsWith("node:"))
|
|
1696
|
+
return false;
|
|
1697
|
+
if (SKIP_PATH_RE.test(normalized))
|
|
1698
|
+
return false;
|
|
1699
|
+
if (normalized.includes("/node_modules/"))
|
|
1700
|
+
return false;
|
|
1701
|
+
if (isFrameworkRuntimePath(normalized))
|
|
1702
|
+
return false;
|
|
1703
|
+
return true;
|
|
1704
|
+
}
|
|
1705
|
+
function formatDisplayPath(file, cwd) {
|
|
1706
|
+
const decoded = decodeFileUrl(file).replace(/\\/g, "/");
|
|
1707
|
+
const cwdNorm = cwd.replace(/\\/g, "/").replace(/\/$/, "");
|
|
1708
|
+
if (cwdNorm && decoded.startsWith(`${cwdNorm}/`)) {
|
|
1709
|
+
const rel = decoded.slice(cwdNorm.length + 1);
|
|
1710
|
+
return rel.startsWith("./") ? rel.slice(2) : rel;
|
|
1711
|
+
}
|
|
1712
|
+
const serverIdx = decoded.indexOf("/server/");
|
|
1713
|
+
if (serverIdx >= 0)
|
|
1714
|
+
return decoded.slice(serverIdx + 1);
|
|
1715
|
+
const srcIdx = decoded.indexOf("/src/");
|
|
1716
|
+
if (srcIdx >= 0)
|
|
1717
|
+
return decoded.slice(srcIdx + 1);
|
|
1718
|
+
return decoded;
|
|
1719
|
+
}
|
|
1720
|
+
function parseStackFrames(stack) {
|
|
1721
|
+
if (!stack)
|
|
1722
|
+
return [];
|
|
1723
|
+
const lines = stack.split(`
|
|
1724
|
+
`);
|
|
1725
|
+
const frames = [];
|
|
1726
|
+
for (const line of lines) {
|
|
1727
|
+
const trimmed = line.trim();
|
|
1728
|
+
if (!trimmed.startsWith("at "))
|
|
1729
|
+
continue;
|
|
1730
|
+
const withFn = trimmed.match(/^at (.+?) \((.+):(\d+):(\d+)\)$/);
|
|
1731
|
+
if (withFn) {
|
|
1732
|
+
const [, fn, file, lineStr, colStr] = withFn;
|
|
1733
|
+
frames.push({
|
|
1734
|
+
raw: trimmed,
|
|
1735
|
+
fn,
|
|
1736
|
+
file,
|
|
1737
|
+
line: Number(lineStr),
|
|
1738
|
+
column: Number(colStr),
|
|
1739
|
+
isApp: isAppPath(file)
|
|
1740
|
+
});
|
|
1741
|
+
continue;
|
|
1742
|
+
}
|
|
1743
|
+
const withoutFn = trimmed.match(/^at (.+):(\d+):(\d+)$/);
|
|
1744
|
+
if (withoutFn) {
|
|
1745
|
+
const [, file, lineStr, colStr] = withoutFn;
|
|
1746
|
+
frames.push({
|
|
1747
|
+
raw: trimmed,
|
|
1748
|
+
file,
|
|
1749
|
+
line: Number(lineStr),
|
|
1750
|
+
column: Number(colStr),
|
|
1751
|
+
isApp: isAppPath(file)
|
|
1752
|
+
});
|
|
1753
|
+
continue;
|
|
1754
|
+
}
|
|
1755
|
+
const asyncFn = trimmed.match(/^at async (.+?) \((.+):(\d+):(\d+)\)$/);
|
|
1756
|
+
if (asyncFn) {
|
|
1757
|
+
const [, fn, file, lineStr, colStr] = asyncFn;
|
|
1758
|
+
frames.push({
|
|
1759
|
+
raw: trimmed,
|
|
1760
|
+
fn: `async ${fn}`,
|
|
1761
|
+
file,
|
|
1762
|
+
line: Number(lineStr),
|
|
1763
|
+
column: Number(colStr),
|
|
1764
|
+
isApp: isAppPath(file)
|
|
1765
|
+
});
|
|
1766
|
+
}
|
|
1767
|
+
}
|
|
1768
|
+
return frames;
|
|
1769
|
+
}
|
|
1770
|
+
function isFrameworkRuntimePath(path) {
|
|
1771
|
+
const normalized = path.replace(/\\/g, "/");
|
|
1772
|
+
return normalized.includes("route-modules/") || normalized.includes("webpack://next/") || normalized.includes("/next/dist/") || normalized.includes("/compiled/next-server/");
|
|
1773
|
+
}
|
|
1774
|
+
function isFrameworkRuntimeFrame(frame) {
|
|
1775
|
+
if (!frame.file)
|
|
1776
|
+
return false;
|
|
1777
|
+
return isFrameworkRuntimePath(decodeFileUrl(frame.file));
|
|
1778
|
+
}
|
|
1779
|
+
function isInternalErrorFrame(frame) {
|
|
1780
|
+
if (isFrameworkRuntimeFrame(frame))
|
|
1781
|
+
return true;
|
|
1782
|
+
if (frame.fn) {
|
|
1783
|
+
const fn = frame.fn.replace(/^async /, "");
|
|
1784
|
+
if (SKIP_FRAME_FN_RE.test(fn))
|
|
1785
|
+
return true;
|
|
1786
|
+
}
|
|
1787
|
+
if (!frame.file)
|
|
1788
|
+
return true;
|
|
1789
|
+
const path = decodeFileUrl(frame.file).replace(/\\/g, "/");
|
|
1790
|
+
if (SKIP_FRAME_PATH_RE.test(path))
|
|
1791
|
+
return true;
|
|
1792
|
+
if (path.includes(".nuxt/"))
|
|
1793
|
+
return true;
|
|
1794
|
+
if (path.includes(".next/"))
|
|
1795
|
+
return true;
|
|
1796
|
+
return false;
|
|
1797
|
+
}
|
|
1798
|
+
function pickPrimaryFrame(frames) {
|
|
1799
|
+
for (const frame of frames)
|
|
1800
|
+
if (frame.isApp && frame.file && frame.line && !isInternalErrorFrame(frame))
|
|
1801
|
+
return frame;
|
|
1802
|
+
}
|
|
1803
|
+
function readCodeSnippet(file, line, contextLines = 2) {
|
|
1804
|
+
if (!isDev() || isBrowser() || !snippetReader)
|
|
1805
|
+
return null;
|
|
1806
|
+
const path = decodeFileUrl(file).replace(/\\/g, "/");
|
|
1807
|
+
if (path.includes(".next/") || path.includes(".nuxt/") || path.includes(".output/"))
|
|
1808
|
+
return null;
|
|
1809
|
+
return snippetReader(file, line, contextLines);
|
|
1810
|
+
}
|
|
1811
|
+
function formatSnippetLines(snippet) {
|
|
1812
|
+
const width = String(snippet[snippet.length - 1]?.line ?? 0).length;
|
|
1813
|
+
return snippet.map(({ line, content, isErrorLine }) => {
|
|
1814
|
+
const marker = isErrorLine ? `${colors.red}\u276F${colors.reset}` : `${colors.dim} ${colors.reset}`;
|
|
1815
|
+
const numColor = isErrorLine ? colors.red : colors.gray;
|
|
1816
|
+
const trimmed = content.length > 120 ? `${content.slice(0, 117)}\u2026` : content;
|
|
1817
|
+
return `${marker} ${numColor}${String(line).padStart(width, " ")}${colors.reset} ${colors.dim}\u2503${colors.reset} ${colors.dim}${trimmed}${colors.reset}`;
|
|
1818
|
+
});
|
|
1819
|
+
}
|
|
1820
|
+
function formatFrameLocation(frame, cwd) {
|
|
1821
|
+
const file = frame.file ? formatDisplayPath(frame.file, cwd) : "unknown";
|
|
1822
|
+
const loc = frame.line ? `${file}:${frame.line}` : file;
|
|
1823
|
+
const fn = frame.fn && frame.fn !== "<unknown>" ? frame.fn : undefined;
|
|
1824
|
+
return fn ? `at ${fn} (${loc})` : `at ${loc}`;
|
|
1825
|
+
}
|
|
1826
|
+
function formatCollapsedFrame(frame, cwd) {
|
|
1827
|
+
const file = frame.file ? formatDisplayPath(frame.file, cwd) : "unknown";
|
|
1828
|
+
const loc = frame.line ? `${file}:${frame.line}` : file;
|
|
1829
|
+
const prefix = frame.fn?.startsWith("async") ? "at async " : "at ";
|
|
1830
|
+
const fn = frame.fn?.replace(/^async /, "");
|
|
1831
|
+
if (fn && fn !== "<unknown>" && fn !== loc)
|
|
1832
|
+
return `${prefix}${fn} (${loc})`;
|
|
1833
|
+
return `${prefix}${loc}`;
|
|
1834
|
+
}
|
|
1835
|
+
var GUIDANCE_WRAP_WIDTH = 76;
|
|
1836
|
+
var GUIDANCE_CONTINUATION = " ";
|
|
1837
|
+
function formatGuidanceLine(label, text, labelColor) {
|
|
1838
|
+
const prefix = `${labelColor}${label}:${colors.reset} `;
|
|
1839
|
+
const lines = [];
|
|
1840
|
+
let remaining = text.trim();
|
|
1841
|
+
let first = true;
|
|
1842
|
+
while (remaining.length > 0) {
|
|
1843
|
+
const budget = first ? Math.max(24, GUIDANCE_WRAP_WIDTH - prefix.length) : Math.max(24, GUIDANCE_WRAP_WIDTH - 5);
|
|
1844
|
+
if (remaining.length <= budget) {
|
|
1845
|
+
lines.push(first ? `${prefix}${remaining}` : `${GUIDANCE_CONTINUATION}${remaining}`);
|
|
1846
|
+
break;
|
|
1847
|
+
}
|
|
1848
|
+
let split = remaining.lastIndexOf(" ", budget);
|
|
1849
|
+
if (split <= 0)
|
|
1850
|
+
split = budget;
|
|
1851
|
+
const chunk = remaining.slice(0, split).trimEnd();
|
|
1852
|
+
lines.push(first ? `${prefix}${chunk}` : `${GUIDANCE_CONTINUATION}${chunk}`);
|
|
1853
|
+
remaining = remaining.slice(split).trimStart();
|
|
1854
|
+
first = false;
|
|
1855
|
+
}
|
|
1856
|
+
return lines;
|
|
1857
|
+
}
|
|
1858
|
+
function buildErrorEntries(error, options = {}) {
|
|
1859
|
+
const normalized = normalizeErrorContext(error);
|
|
1860
|
+
if (!normalized)
|
|
1861
|
+
return [];
|
|
1862
|
+
const cwd = options.cwd ?? (typeof process !== "undefined" && typeof process.cwd === "function" ? process.cwd() : ".");
|
|
1863
|
+
const compact = options.compact ?? isDev();
|
|
1864
|
+
const guidanceOnly = (options.detail ?? "full") === "guidance";
|
|
1865
|
+
const showFrames = !guidanceOnly && !isBrowser() && (options.snippet ?? isDev());
|
|
1866
|
+
const stackDepth = guidanceOnly ? 0 : options.stackDepth ?? (compact ? 2 : 3);
|
|
1867
|
+
const snippetContextLines = compact ? 1 : 2;
|
|
1868
|
+
const children = [];
|
|
1869
|
+
const frames = guidanceOnly ? [] : parseStackFrames(normalized.stack);
|
|
1870
|
+
const primary = guidanceOnly ? undefined : pickPrimaryFrame(frames);
|
|
1871
|
+
if (!guidanceOnly && primary?.file && primary.line) {
|
|
1872
|
+
pushTreeSpacer(children);
|
|
1873
|
+
if (showFrames) {
|
|
1874
|
+
const snippet = readCodeSnippet(primary.file, primary.line, snippetContextLines);
|
|
1875
|
+
children.push(`${colors.dim} ${formatFrameLocation(primary, cwd)}${colors.reset}`);
|
|
1876
|
+
if (snippet)
|
|
1877
|
+
children.push(...formatSnippetLines(snippet));
|
|
1878
|
+
} else
|
|
1879
|
+
children.push(`${colors.dim} ${formatFrameLocation(primary, cwd)}${colors.reset}`);
|
|
1880
|
+
}
|
|
1881
|
+
if (normalized.code)
|
|
1882
|
+
children.push(`${colors.dim}Code:${colors.reset} ${normalized.code}`);
|
|
1883
|
+
if (Boolean(normalized.why || normalized.fix || normalized.link))
|
|
1884
|
+
pushTreeSpacer(children);
|
|
1885
|
+
if (normalized.why)
|
|
1886
|
+
children.push(...formatGuidanceLine("Why", normalized.why, colors.yellow));
|
|
1887
|
+
if (normalized.fix)
|
|
1888
|
+
children.push(...formatGuidanceLine("Fix", normalized.fix, colors.cyan));
|
|
1889
|
+
if (normalized.link)
|
|
1890
|
+
children.push(`${colors.dim}More:${colors.reset} ${normalized.link}`);
|
|
1891
|
+
if (normalized.cause && normalized.cause !== normalized.message)
|
|
1892
|
+
children.push(`${colors.dim}Caused by:${colors.reset} ${normalized.cause}`);
|
|
1893
|
+
const hiddenCount = guidanceOnly ? 0 : frames.filter((f) => !f.isApp || isInternalErrorFrame(f)).length;
|
|
1894
|
+
const tailFrames = stackDepth > 0 ? frames.filter((f) => f !== primary && !isInternalErrorFrame(f)).slice(0, stackDepth) : [];
|
|
1895
|
+
if (!guidanceOnly && (hiddenCount > 0 || tailFrames.length > 0)) {
|
|
1896
|
+
pushTreeSpacer(children);
|
|
1897
|
+
if (hiddenCount > 0)
|
|
1898
|
+
children.push(`${colors.gray}stack (${hiddenCount} frame${hiddenCount === 1 ? "" : "s"} hidden in node_modules)${colors.reset}`);
|
|
1899
|
+
else
|
|
1900
|
+
children.push(`${colors.gray}stack${colors.reset}`);
|
|
1901
|
+
for (const frame of tailFrames)
|
|
1902
|
+
children.push(`${colors.gray} ${formatCollapsedFrame(frame, cwd)}${colors.reset}`);
|
|
1903
|
+
}
|
|
1904
|
+
return [{
|
|
1905
|
+
key: "error",
|
|
1906
|
+
value: `${colors.red}${colors.bold}${normalized.message}${colors.reset}`,
|
|
1907
|
+
children: children.length > 0 ? children : undefined
|
|
1908
|
+
}];
|
|
1909
|
+
}
|
|
1910
|
+
|
|
1911
|
+
// ../../node_modules/.bun/evlog@2.28.1+4cac44d0f5802a4d/node_modules/evlog/dist/dev-terminal-Brarc6vc.mjs
|
|
1912
|
+
var DEV_PRESETS = {
|
|
1913
|
+
evlog: {
|
|
1914
|
+
frameworkOverlay: false,
|
|
1915
|
+
detail: "full"
|
|
1916
|
+
},
|
|
1917
|
+
nitro: {
|
|
1918
|
+
frameworkOverlay: true,
|
|
1919
|
+
detail: "guidance"
|
|
1920
|
+
},
|
|
1921
|
+
both: {
|
|
1922
|
+
frameworkOverlay: true,
|
|
1923
|
+
detail: "full"
|
|
1924
|
+
}
|
|
1925
|
+
};
|
|
1926
|
+
function finalizePrettyError(partial, frameworkOverlay, pretty, inDev) {
|
|
1927
|
+
const compact = partial.compact ?? (inDev && pretty);
|
|
1928
|
+
const detail = partial.detail ?? (frameworkOverlay ? "guidance" : "full");
|
|
1929
|
+
const stackDepth = detail === "guidance" ? 0 : partial.stackDepth ?? (compact ? 2 : 3);
|
|
1930
|
+
return {
|
|
1931
|
+
snippet: partial.snippet ?? (detail === "full" && pretty && inDev),
|
|
1932
|
+
stackDepth,
|
|
1933
|
+
compact,
|
|
1934
|
+
detail
|
|
1935
|
+
};
|
|
1936
|
+
}
|
|
1937
|
+
function resolveDevTerminal(input = {}) {
|
|
1938
|
+
const pretty = input.pretty ?? isDev();
|
|
1939
|
+
const inDev = isDev();
|
|
1940
|
+
let frameworkOverlay;
|
|
1941
|
+
let prettyError = {};
|
|
1942
|
+
if (typeof input.dev === "string" && input.dev in DEV_PRESETS) {
|
|
1943
|
+
const { frameworkOverlay: presetOverlay, detail } = DEV_PRESETS[input.dev];
|
|
1944
|
+
frameworkOverlay = presetOverlay;
|
|
1945
|
+
prettyError = { detail };
|
|
1946
|
+
} else if (input.dev && typeof input.dev === "object") {
|
|
1947
|
+
const { frameworkOverlay: devOverlay, prettyError: devPrettyError } = input.dev;
|
|
1948
|
+
frameworkOverlay = devOverlay;
|
|
1949
|
+
if (devPrettyError)
|
|
1950
|
+
prettyError = devPrettyError;
|
|
1951
|
+
}
|
|
1952
|
+
if (frameworkOverlay === undefined)
|
|
1953
|
+
frameworkOverlay = !(pretty && inDev);
|
|
1954
|
+
return {
|
|
1955
|
+
frameworkOverlay,
|
|
1956
|
+
prettyError: finalizePrettyError(prettyError, frameworkOverlay, pretty, inDev)
|
|
1957
|
+
};
|
|
1958
|
+
}
|
|
1959
|
+
|
|
1960
|
+
// ../../node_modules/.bun/evlog@2.28.1+4cac44d0f5802a4d/node_modules/evlog/dist/wideEventChannel-BUDW48oP.mjs
|
|
1961
|
+
var publisher = null;
|
|
1962
|
+
function publishWideEvent(event) {
|
|
1963
|
+
if (!publisher)
|
|
1964
|
+
return;
|
|
1965
|
+
try {
|
|
1966
|
+
publisher(event);
|
|
1967
|
+
} catch (err) {
|
|
1968
|
+
console.error("[evlog] diagnostics channel publish failed:", err);
|
|
1969
|
+
}
|
|
1684
1970
|
}
|
|
1971
|
+
|
|
1972
|
+
// ../../node_modules/.bun/evlog@2.28.1+4cac44d0f5802a4d/node_modules/evlog/dist/audit-CW8wdQDm.mjs
|
|
1685
1973
|
var nativeStdoutWrite = typeof process !== "undefined" && typeof process.stdout?.write === "function" ? process.stdout.write.bind(process.stdout) : undefined;
|
|
1686
1974
|
function writePrettyStdout(text) {
|
|
1687
1975
|
(globalThis.__evlogNativeStdoutWrite ?? nativeStdoutWrite)?.(text);
|
|
@@ -1689,59 +1977,35 @@ function writePrettyStdout(text) {
|
|
|
1689
1977
|
function isPlainObject$1(val) {
|
|
1690
1978
|
return val !== null && typeof val === "object" && !Array.isArray(val);
|
|
1691
1979
|
}
|
|
1692
|
-
var
|
|
1693
|
-
function isoNow() {
|
|
1694
|
-
_tsDate.setTime(Date.now());
|
|
1695
|
-
return _tsDate.toISOString();
|
|
1696
|
-
}
|
|
1697
|
-
var globalEnv = {
|
|
1698
|
-
service: "app",
|
|
1699
|
-
environment: "development"
|
|
1700
|
-
};
|
|
1701
|
-
var globalPretty = isDev();
|
|
1702
|
-
var globalPrettyError = {
|
|
1703
|
-
snippet: isDev(),
|
|
1704
|
-
stackDepth: 2,
|
|
1705
|
-
compact: isDev(),
|
|
1706
|
-
detail: "full"
|
|
1707
|
-
};
|
|
1708
|
-
var globalSampling = {};
|
|
1709
|
-
var globalStringify = true;
|
|
1710
|
-
var globalDrain;
|
|
1711
|
-
var globalRedact;
|
|
1712
|
-
var globalEnabled = true;
|
|
1713
|
-
var globalSilent = false;
|
|
1714
|
-
var globalMinLevel = "debug";
|
|
1715
|
-
var _loggerInitialized = false;
|
|
1716
|
-
var globalPluginRunner = getEmptyPluginRunner();
|
|
1980
|
+
var state = globalConfig;
|
|
1717
1981
|
function initLogger(config = {}) {
|
|
1718
|
-
|
|
1982
|
+
state.enabled = config.enabled ?? true;
|
|
1719
1983
|
const detected = detectEnvironment();
|
|
1720
|
-
|
|
1984
|
+
state.env = {
|
|
1721
1985
|
service: config.env?.service ?? detected.service ?? "app",
|
|
1722
1986
|
environment: config.env?.environment ?? detected.environment ?? "development",
|
|
1723
1987
|
version: config.env?.version ?? detected.version,
|
|
1724
1988
|
commitHash: config.env?.commitHash ?? detected.commitHash,
|
|
1725
1989
|
region: config.env?.region ?? detected.region
|
|
1726
1990
|
};
|
|
1727
|
-
|
|
1728
|
-
|
|
1729
|
-
|
|
1730
|
-
|
|
1731
|
-
|
|
1732
|
-
|
|
1733
|
-
|
|
1734
|
-
|
|
1735
|
-
|
|
1736
|
-
if (
|
|
1737
|
-
|
|
1738
|
-
const hasAnyDrain = !!
|
|
1739
|
-
if (
|
|
1991
|
+
state.pretty = config.pretty ?? isDev();
|
|
1992
|
+
state.prettyError = resolveDevTerminal(config).prettyError;
|
|
1993
|
+
state.sampling = config.sampling ?? {};
|
|
1994
|
+
state.stringify = config.stringify ?? true;
|
|
1995
|
+
state.drain = config.drain;
|
|
1996
|
+
state.redact = resolveRedactConfig(config.redact ?? !isDev());
|
|
1997
|
+
state.silent = config.silent ?? false;
|
|
1998
|
+
state.minLevel = config.minLevel ?? "debug";
|
|
1999
|
+
state.pluginRunner = config.plugins?.length ? createPluginRunner(config.plugins) : getEmptyPluginRunner();
|
|
2000
|
+
if (state.pluginRunner.plugins.length > 0)
|
|
2001
|
+
state.pluginRunner.runSetup({ env: { ...state.env } });
|
|
2002
|
+
const hasAnyDrain = !!state.drain || state.pluginRunner.hasDrain;
|
|
2003
|
+
if (state.silent && !hasAnyDrain && !config._suppressDrainWarning)
|
|
1740
2004
|
console.warn("[evlog] silent mode is enabled but no drain is configured. Events will be built and sampled but not output anywhere. Set a drain via initLogger({ drain }) or a framework hook (evlog:drain).");
|
|
1741
|
-
|
|
2005
|
+
state.initialized = true;
|
|
1742
2006
|
}
|
|
1743
2007
|
function shouldSample(level) {
|
|
1744
|
-
const { rates } =
|
|
2008
|
+
const { rates } = state.sampling;
|
|
1745
2009
|
if (!rates)
|
|
1746
2010
|
return true;
|
|
1747
2011
|
const percentage = level === "error" && rates.error === undefined ? 100 : rates[level] ?? 100;
|
|
@@ -1753,10 +2017,10 @@ function shouldSample(level) {
|
|
|
1753
2017
|
}
|
|
1754
2018
|
function emitWideEvent(level, event, options = {}) {
|
|
1755
2019
|
const { deferDrain = false, ownsEvent = false, waitUntil } = options;
|
|
1756
|
-
if (!
|
|
2020
|
+
if (!state.enabled)
|
|
1757
2021
|
return null;
|
|
1758
2022
|
if (!ownsEvent) {
|
|
1759
|
-
if (!isLevelEnabled(level,
|
|
2023
|
+
if (!isLevelEnabled(level, state.minLevel))
|
|
1760
2024
|
return null;
|
|
1761
2025
|
if (!shouldSample(level))
|
|
1762
2026
|
return null;
|
|
@@ -1766,57 +2030,58 @@ function emitWideEvent(level, event, options = {}) {
|
|
|
1766
2030
|
event.timestamp = isoNow();
|
|
1767
2031
|
event.level = level;
|
|
1768
2032
|
if (event.service === undefined)
|
|
1769
|
-
event.service =
|
|
2033
|
+
event.service = state.env.service;
|
|
1770
2034
|
if (event.environment === undefined)
|
|
1771
|
-
event.environment =
|
|
1772
|
-
if (
|
|
1773
|
-
event.version =
|
|
1774
|
-
if (
|
|
1775
|
-
event.commitHash =
|
|
1776
|
-
if (
|
|
1777
|
-
event.region =
|
|
2035
|
+
event.environment = state.env.environment;
|
|
2036
|
+
if (state.env.version !== undefined && event.version === undefined)
|
|
2037
|
+
event.version = state.env.version;
|
|
2038
|
+
if (state.env.commitHash !== undefined && event.commitHash === undefined)
|
|
2039
|
+
event.commitHash = state.env.commitHash;
|
|
2040
|
+
if (state.env.region !== undefined && event.region === undefined)
|
|
2041
|
+
event.region = state.env.region;
|
|
1778
2042
|
formatted = event;
|
|
1779
2043
|
} else
|
|
1780
2044
|
formatted = {
|
|
1781
2045
|
timestamp: isoNow(),
|
|
1782
2046
|
level,
|
|
1783
|
-
...
|
|
2047
|
+
...state.env,
|
|
1784
2048
|
...event
|
|
1785
2049
|
};
|
|
1786
2050
|
finalizeAudit(formatted);
|
|
1787
|
-
if (
|
|
1788
|
-
formatted = redactEvent(formatted,
|
|
2051
|
+
if (state.redact) {
|
|
2052
|
+
formatted = redactEvent(formatted, state.redact);
|
|
1789
2053
|
markGloballyRedacted(formatted);
|
|
1790
2054
|
}
|
|
1791
|
-
if (!
|
|
1792
|
-
if (
|
|
2055
|
+
if (!state.silent)
|
|
2056
|
+
if (state.pretty)
|
|
1793
2057
|
prettyPrintWideEvent(formatted);
|
|
1794
|
-
else if (
|
|
2058
|
+
else if (state.stringify)
|
|
1795
2059
|
console[getConsoleMethod(level)](JSON.stringify(formatted));
|
|
1796
2060
|
else
|
|
1797
2061
|
console[getConsoleMethod(level)](formatted);
|
|
1798
2062
|
if (!deferDrain) {
|
|
2063
|
+
publishWideEvent(formatted);
|
|
1799
2064
|
const drainPromises = [];
|
|
1800
|
-
if (
|
|
2065
|
+
if (state.drain)
|
|
1801
2066
|
drainPromises.push((async () => {
|
|
1802
2067
|
try {
|
|
1803
|
-
await
|
|
2068
|
+
await state.drain({ event: formatted });
|
|
1804
2069
|
} catch (err) {
|
|
1805
2070
|
console.error("[evlog] drain failed:", err);
|
|
1806
2071
|
}
|
|
1807
2072
|
})());
|
|
1808
|
-
if (
|
|
1809
|
-
drainPromises.push(
|
|
2073
|
+
if (state.pluginRunner.hasDrain)
|
|
2074
|
+
drainPromises.push(state.pluginRunner.runDrain({ event: formatted }));
|
|
1810
2075
|
if (drainPromises.length > 0 && waitUntil)
|
|
1811
2076
|
waitUntil(Promise.all(drainPromises));
|
|
1812
2077
|
}
|
|
1813
2078
|
return formatted;
|
|
1814
2079
|
}
|
|
1815
2080
|
function emitTaggedLog(level, tag, message) {
|
|
1816
|
-
if (!
|
|
2081
|
+
if (!state.enabled)
|
|
1817
2082
|
return;
|
|
1818
|
-
if (
|
|
1819
|
-
if (!isLevelEnabled(level,
|
|
2083
|
+
if (state.pretty && !state.silent) {
|
|
2084
|
+
if (!isLevelEnabled(level, state.minLevel))
|
|
1820
2085
|
return;
|
|
1821
2086
|
if (!shouldSample(level))
|
|
1822
2087
|
return;
|
|
@@ -2131,6 +2396,7 @@ function prettyPrintWideEvent(event) {
|
|
|
2131
2396
|
parts.push(` ${colors.dim}in ${rest.duration}${colors.reset}`);
|
|
2132
2397
|
delete rest.duration;
|
|
2133
2398
|
}
|
|
2399
|
+
delete rest.durationMs;
|
|
2134
2400
|
writeLine(parts.join(""), ...styles);
|
|
2135
2401
|
const aiData = isPlainObject$1(rest.ai) ? rest.ai : undefined;
|
|
2136
2402
|
if (aiData)
|
|
@@ -2140,7 +2406,7 @@ function prettyPrintWideEvent(event) {
|
|
|
2140
2406
|
delete rest.error;
|
|
2141
2407
|
const restEntries = Object.entries(rest).filter(([_, v]) => v !== undefined);
|
|
2142
2408
|
const aiEntries = aiData ? buildAIEntries(aiData) : [];
|
|
2143
|
-
const errorEntries = errorData !== undefined ? buildErrorEntries(errorData,
|
|
2409
|
+
const errorEntries = errorData !== undefined ? buildErrorEntries(errorData, state.prettyError) : [];
|
|
2144
2410
|
const contextEntries = [...restEntries.map(([key, value]) => ({
|
|
2145
2411
|
key,
|
|
2146
2412
|
value: formatValue(value)
|
|
@@ -2293,8 +2559,7 @@ function finalizeAudit(event) {
|
|
|
2293
2559
|
// src/client/router/provider.tsx
|
|
2294
2560
|
import { useCallback as useCallback2, useEffect, useLayoutEffect, useMemo, useRef, useState } from "react";
|
|
2295
2561
|
|
|
2296
|
-
// ../../node_modules/.bun/seroval@1.5
|
|
2297
|
-
var ALL_ENABLED = 1 | 2 | 4 | 8 | 16 | 32;
|
|
2562
|
+
// ../../node_modules/.bun/seroval@1.6.5/node_modules/seroval/dist/dev/index.js
|
|
2298
2563
|
var SYM_ASYNC_ITERATOR = Symbol.asyncIterator;
|
|
2299
2564
|
var SYM_HAS_INSTANCE = Symbol.hasInstance;
|
|
2300
2565
|
var SYM_IS_CONCAT_SPREADABLE = Symbol.isConcatSpreadable;
|
|
@@ -2338,16 +2603,15 @@ var SYMBOL_REF = {
|
|
|
2338
2603
|
[11]: SYM_TO_STRING_TAG,
|
|
2339
2604
|
[12]: SYM_UNSCOPABLES
|
|
2340
2605
|
};
|
|
2341
|
-
var NIL = undefined;
|
|
2342
2606
|
var CONSTANT_VAL = {
|
|
2343
2607
|
[2]: true,
|
|
2344
2608
|
[3]: false,
|
|
2345
|
-
[1]:
|
|
2609
|
+
[1]: undefined,
|
|
2346
2610
|
[0]: null,
|
|
2347
2611
|
[4]: -0,
|
|
2348
2612
|
[5]: Number.POSITIVE_INFINITY,
|
|
2349
2613
|
[6]: Number.NEGATIVE_INFINITY,
|
|
2350
|
-
[7]:
|
|
2614
|
+
[7]: NaN
|
|
2351
2615
|
};
|
|
2352
2616
|
var ERROR_CONSTRUCTOR = {
|
|
2353
2617
|
[0]: Error,
|
|
@@ -2382,7 +2646,7 @@ function serializeChar(str) {
|
|
|
2382
2646
|
case "\u2029":
|
|
2383
2647
|
return "\\u2029";
|
|
2384
2648
|
default:
|
|
2385
|
-
return
|
|
2649
|
+
return;
|
|
2386
2650
|
}
|
|
2387
2651
|
}
|
|
2388
2652
|
function serializeString(str) {
|
|
@@ -2396,11 +2660,10 @@ function serializeString(str) {
|
|
|
2396
2660
|
lastPos = i + 1;
|
|
2397
2661
|
}
|
|
2398
2662
|
}
|
|
2399
|
-
if (lastPos === 0)
|
|
2663
|
+
if (lastPos === 0)
|
|
2400
2664
|
result = str;
|
|
2401
|
-
|
|
2665
|
+
else
|
|
2402
2666
|
result += str.slice(lastPos);
|
|
2403
|
-
}
|
|
2404
2667
|
return result;
|
|
2405
2668
|
}
|
|
2406
2669
|
function deserializeReplacer(str) {
|
|
@@ -2433,51 +2696,9 @@ function deserializeReplacer(str) {
|
|
|
2433
2696
|
function deserializeString(str) {
|
|
2434
2697
|
return str.replace(/(\\\\|\\"|\\n|\\r|\\b|\\t|\\f|\\u2028|\\u2029|\\x3C)/g, deserializeReplacer);
|
|
2435
2698
|
}
|
|
2436
|
-
var REFERENCES_KEY = "__SEROVAL_REFS__";
|
|
2437
|
-
var GLOBAL_CONTEXT_REFERENCES = "$R";
|
|
2438
|
-
var GLOBAL_CONTEXT_R = `self.${GLOBAL_CONTEXT_REFERENCES}`;
|
|
2439
|
-
var INV_REFERENCE = /* @__PURE__ */ new Map;
|
|
2440
|
-
function hasReference(id) {
|
|
2441
|
-
return INV_REFERENCE.has(id);
|
|
2442
|
-
}
|
|
2443
|
-
function getReference(id) {
|
|
2444
|
-
if (hasReference(id)) {
|
|
2445
|
-
return INV_REFERENCE.get(id);
|
|
2446
|
-
}
|
|
2447
|
-
throw new SerovalMissingReferenceForIdError(id);
|
|
2448
|
-
}
|
|
2449
|
-
if (typeof globalThis !== "undefined") {
|
|
2450
|
-
Object.defineProperty(globalThis, REFERENCES_KEY, {
|
|
2451
|
-
value: INV_REFERENCE,
|
|
2452
|
-
configurable: true,
|
|
2453
|
-
writable: false,
|
|
2454
|
-
enumerable: false
|
|
2455
|
-
});
|
|
2456
|
-
} else if (typeof window !== "undefined") {
|
|
2457
|
-
Object.defineProperty(window, REFERENCES_KEY, {
|
|
2458
|
-
value: INV_REFERENCE,
|
|
2459
|
-
configurable: true,
|
|
2460
|
-
writable: false,
|
|
2461
|
-
enumerable: false
|
|
2462
|
-
});
|
|
2463
|
-
} else if (typeof self !== "undefined") {
|
|
2464
|
-
Object.defineProperty(self, REFERENCES_KEY, {
|
|
2465
|
-
value: INV_REFERENCE,
|
|
2466
|
-
configurable: true,
|
|
2467
|
-
writable: false,
|
|
2468
|
-
enumerable: false
|
|
2469
|
-
});
|
|
2470
|
-
} else if (typeof global !== "undefined") {
|
|
2471
|
-
Object.defineProperty(global, REFERENCES_KEY, {
|
|
2472
|
-
value: INV_REFERENCE,
|
|
2473
|
-
configurable: true,
|
|
2474
|
-
writable: false,
|
|
2475
|
-
enumerable: false
|
|
2476
|
-
});
|
|
2477
|
-
}
|
|
2478
2699
|
var { toString: objectToString } = Object.prototype;
|
|
2479
2700
|
function getErrorMessageDev(type, cause) {
|
|
2480
|
-
if (cause instanceof Error)
|
|
2701
|
+
if (cause instanceof Error)
|
|
2481
2702
|
return `Seroval caught an error during the ${type} process.
|
|
2482
2703
|
|
|
2483
2704
|
${cause.name}
|
|
@@ -2485,7 +2706,6 @@ ${cause.message}
|
|
|
2485
2706
|
|
|
2486
2707
|
- For more information, please check the "cause" property of this error.
|
|
2487
2708
|
- If you believe this is an error in Seroval, please submit an issue at https://github.com/lxsmnsyc/seroval/issues/new`;
|
|
2488
|
-
}
|
|
2489
2709
|
return `Seroval caught an error during the ${type} process.
|
|
2490
2710
|
|
|
2491
2711
|
"${objectToString.call(cause)}"
|
|
@@ -2539,6 +2759,44 @@ var SerovalDepthLimitError = class extends Error {
|
|
|
2539
2759
|
super("Depth limit of " + limit + " reached");
|
|
2540
2760
|
}
|
|
2541
2761
|
};
|
|
2762
|
+
var REFERENCES_KEY = "__SEROVAL_REFS__";
|
|
2763
|
+
var INV_REFERENCE = /* @__PURE__ */ new Map;
|
|
2764
|
+
function hasReference(id) {
|
|
2765
|
+
return INV_REFERENCE.has(id);
|
|
2766
|
+
}
|
|
2767
|
+
function getReference(id) {
|
|
2768
|
+
if (hasReference(id))
|
|
2769
|
+
return INV_REFERENCE.get(id);
|
|
2770
|
+
throw new SerovalMissingReferenceForIdError(id);
|
|
2771
|
+
}
|
|
2772
|
+
if (typeof globalThis !== "undefined")
|
|
2773
|
+
Object.defineProperty(globalThis, REFERENCES_KEY, {
|
|
2774
|
+
value: INV_REFERENCE,
|
|
2775
|
+
configurable: true,
|
|
2776
|
+
writable: false,
|
|
2777
|
+
enumerable: false
|
|
2778
|
+
});
|
|
2779
|
+
else if (typeof window !== "undefined")
|
|
2780
|
+
Object.defineProperty(window, REFERENCES_KEY, {
|
|
2781
|
+
value: INV_REFERENCE,
|
|
2782
|
+
configurable: true,
|
|
2783
|
+
writable: false,
|
|
2784
|
+
enumerable: false
|
|
2785
|
+
});
|
|
2786
|
+
else if (typeof self !== "undefined")
|
|
2787
|
+
Object.defineProperty(self, REFERENCES_KEY, {
|
|
2788
|
+
value: INV_REFERENCE,
|
|
2789
|
+
configurable: true,
|
|
2790
|
+
writable: false,
|
|
2791
|
+
enumerable: false
|
|
2792
|
+
});
|
|
2793
|
+
else if (typeof global !== "undefined")
|
|
2794
|
+
Object.defineProperty(global, REFERENCES_KEY, {
|
|
2795
|
+
value: INV_REFERENCE,
|
|
2796
|
+
configurable: true,
|
|
2797
|
+
writable: false,
|
|
2798
|
+
enumerable: false
|
|
2799
|
+
});
|
|
2542
2800
|
var PROMISE_CONSTRUCTOR = () => {
|
|
2543
2801
|
const resolver = {
|
|
2544
2802
|
p: 0,
|
|
@@ -2557,58 +2815,59 @@ var STREAM_CONSTRUCTOR = () => {
|
|
|
2557
2815
|
let alive = true;
|
|
2558
2816
|
let success = false;
|
|
2559
2817
|
let count = 0;
|
|
2560
|
-
const
|
|
2561
|
-
|
|
2562
|
-
|
|
2563
|
-
listeners[x]
|
|
2564
|
-
|
|
2565
|
-
}
|
|
2566
|
-
|
|
2567
|
-
|
|
2568
|
-
|
|
2569
|
-
|
|
2570
|
-
|
|
2571
|
-
|
|
2572
|
-
|
|
2573
|
-
listener.next(current);
|
|
2818
|
+
const internal = {
|
|
2819
|
+
flush(value, mode, x) {
|
|
2820
|
+
for (x = 0;x < count; x++)
|
|
2821
|
+
if (listeners[x])
|
|
2822
|
+
listeners[x][mode](value);
|
|
2823
|
+
},
|
|
2824
|
+
up(listener, x, z, current) {
|
|
2825
|
+
for (x = 0, z = buffer.length;x < z; x++) {
|
|
2826
|
+
current = buffer[x];
|
|
2827
|
+
if (!alive && x === z - 1)
|
|
2828
|
+
listener[success ? "return" : "throw"](current);
|
|
2829
|
+
else
|
|
2830
|
+
listener.next(current);
|
|
2574
2831
|
}
|
|
2575
|
-
}
|
|
2576
|
-
|
|
2577
|
-
const on = (listener, temp) => {
|
|
2578
|
-
if (alive) {
|
|
2579
|
-
temp = count++;
|
|
2580
|
-
listeners[temp] = listener;
|
|
2581
|
-
}
|
|
2582
|
-
up(listener);
|
|
2583
|
-
return () => {
|
|
2832
|
+
},
|
|
2833
|
+
on(listener, temp) {
|
|
2584
2834
|
if (alive) {
|
|
2585
|
-
|
|
2586
|
-
listeners[
|
|
2835
|
+
temp = count++;
|
|
2836
|
+
listeners[temp] = listener;
|
|
2587
2837
|
}
|
|
2588
|
-
|
|
2838
|
+
internal.up(listener);
|
|
2839
|
+
return () => {
|
|
2840
|
+
if (alive) {
|
|
2841
|
+
listeners[temp] = listeners[count];
|
|
2842
|
+
listeners[count--] = undefined;
|
|
2843
|
+
}
|
|
2844
|
+
};
|
|
2845
|
+
}
|
|
2589
2846
|
};
|
|
2590
2847
|
return {
|
|
2591
2848
|
__SEROVAL_STREAM__: true,
|
|
2592
|
-
on
|
|
2593
|
-
|
|
2849
|
+
on(listener) {
|
|
2850
|
+
return internal.on(listener);
|
|
2851
|
+
},
|
|
2852
|
+
next(value) {
|
|
2594
2853
|
if (alive) {
|
|
2595
2854
|
buffer.push(value);
|
|
2596
|
-
flush(value, "next");
|
|
2855
|
+
internal.flush(value, "next");
|
|
2597
2856
|
}
|
|
2598
2857
|
},
|
|
2599
|
-
throw
|
|
2858
|
+
throw(value) {
|
|
2600
2859
|
if (alive) {
|
|
2601
2860
|
buffer.push(value);
|
|
2602
|
-
flush(value, "throw");
|
|
2861
|
+
internal.flush(value, "throw");
|
|
2603
2862
|
alive = false;
|
|
2604
2863
|
success = false;
|
|
2605
2864
|
listeners.length = 0;
|
|
2606
2865
|
}
|
|
2607
2866
|
},
|
|
2608
|
-
return
|
|
2867
|
+
return(value) {
|
|
2609
2868
|
if (alive) {
|
|
2610
2869
|
buffer.push(value);
|
|
2611
|
-
flush(value, "return");
|
|
2870
|
+
internal.flush(value, "return");
|
|
2612
2871
|
alive = false;
|
|
2613
2872
|
success = true;
|
|
2614
2873
|
listeners.length = 0;
|
|
@@ -2619,19 +2878,19 @@ var STREAM_CONSTRUCTOR = () => {
|
|
|
2619
2878
|
var ITERATOR_CONSTRUCTOR = (symbol) => (sequence) => () => {
|
|
2620
2879
|
let index = 0;
|
|
2621
2880
|
const instance = {
|
|
2622
|
-
[symbol]
|
|
2623
|
-
|
|
2624
|
-
|
|
2881
|
+
[symbol]() {
|
|
2882
|
+
return instance;
|
|
2883
|
+
},
|
|
2884
|
+
next() {
|
|
2885
|
+
if (index > sequence.d)
|
|
2625
2886
|
return {
|
|
2626
2887
|
done: true,
|
|
2627
2888
|
value: undefined
|
|
2628
2889
|
};
|
|
2629
|
-
}
|
|
2630
2890
|
const currentIndex = index++;
|
|
2631
2891
|
const data = sequence.v[currentIndex];
|
|
2632
|
-
if (currentIndex === sequence.t)
|
|
2892
|
+
if (currentIndex === sequence.t)
|
|
2633
2893
|
throw data;
|
|
2634
|
-
}
|
|
2635
2894
|
return {
|
|
2636
2895
|
done: currentIndex === sequence.d,
|
|
2637
2896
|
value: data
|
|
@@ -2646,74 +2905,75 @@ var ASYNC_ITERATOR_CONSTRUCTOR = (symbol, createPromise) => (stream) => () => {
|
|
|
2646
2905
|
let isThrow = false;
|
|
2647
2906
|
const buffer = [];
|
|
2648
2907
|
const pending = [];
|
|
2649
|
-
const
|
|
2650
|
-
for (;i < len; i++)
|
|
2908
|
+
const internal = { finalize(i = 0, len = pending.length) {
|
|
2909
|
+
for (;i < len; i++)
|
|
2651
2910
|
pending[i].s({
|
|
2652
2911
|
done: true,
|
|
2653
2912
|
value: undefined
|
|
2654
2913
|
});
|
|
2655
|
-
|
|
2656
|
-
};
|
|
2914
|
+
} };
|
|
2657
2915
|
stream.on({
|
|
2658
|
-
next
|
|
2916
|
+
next(value) {
|
|
2659
2917
|
const temp = pending.shift();
|
|
2660
|
-
if (temp)
|
|
2661
|
-
temp.s({
|
|
2662
|
-
|
|
2918
|
+
if (temp)
|
|
2919
|
+
temp.s({
|
|
2920
|
+
done: false,
|
|
2921
|
+
value
|
|
2922
|
+
});
|
|
2663
2923
|
buffer.push(value);
|
|
2664
2924
|
},
|
|
2665
|
-
throw
|
|
2925
|
+
throw(value) {
|
|
2666
2926
|
const temp = pending.shift();
|
|
2667
|
-
if (temp)
|
|
2927
|
+
if (temp)
|
|
2668
2928
|
temp.f(value);
|
|
2669
|
-
|
|
2670
|
-
finalize();
|
|
2929
|
+
internal.finalize();
|
|
2671
2930
|
doneAt = buffer.length;
|
|
2672
2931
|
isThrow = true;
|
|
2673
2932
|
buffer.push(value);
|
|
2674
2933
|
},
|
|
2675
|
-
return
|
|
2934
|
+
return(value) {
|
|
2676
2935
|
const temp = pending.shift();
|
|
2677
|
-
if (temp)
|
|
2678
|
-
temp.s({
|
|
2679
|
-
|
|
2680
|
-
|
|
2936
|
+
if (temp)
|
|
2937
|
+
temp.s({
|
|
2938
|
+
done: true,
|
|
2939
|
+
value
|
|
2940
|
+
});
|
|
2941
|
+
internal.finalize();
|
|
2681
2942
|
doneAt = buffer.length;
|
|
2682
2943
|
buffer.push(value);
|
|
2683
2944
|
}
|
|
2684
2945
|
});
|
|
2685
2946
|
const instance = {
|
|
2686
|
-
[symbol]
|
|
2687
|
-
|
|
2947
|
+
[symbol]() {
|
|
2948
|
+
return instance;
|
|
2949
|
+
},
|
|
2950
|
+
next() {
|
|
2688
2951
|
if (doneAt === -1) {
|
|
2689
|
-
const
|
|
2690
|
-
if (
|
|
2952
|
+
const index = count++;
|
|
2953
|
+
if (index >= buffer.length) {
|
|
2691
2954
|
const temp = createPromise();
|
|
2692
2955
|
pending.push(temp);
|
|
2693
2956
|
return temp.p;
|
|
2694
2957
|
}
|
|
2695
2958
|
return {
|
|
2696
2959
|
done: false,
|
|
2697
|
-
value: buffer[
|
|
2960
|
+
value: buffer[index]
|
|
2698
2961
|
};
|
|
2699
2962
|
}
|
|
2700
|
-
if (count > doneAt)
|
|
2963
|
+
if (count > doneAt)
|
|
2701
2964
|
return {
|
|
2702
2965
|
done: true,
|
|
2703
2966
|
value: undefined
|
|
2704
2967
|
};
|
|
2705
|
-
}
|
|
2706
2968
|
const index = count++;
|
|
2707
2969
|
const value = buffer[index];
|
|
2708
|
-
if (index !== doneAt)
|
|
2970
|
+
if (index !== doneAt)
|
|
2709
2971
|
return {
|
|
2710
2972
|
done: false,
|
|
2711
2973
|
value
|
|
2712
2974
|
};
|
|
2713
|
-
|
|
2714
|
-
if (isThrow) {
|
|
2975
|
+
if (isThrow)
|
|
2715
2976
|
throw value;
|
|
2716
|
-
}
|
|
2717
2977
|
return {
|
|
2718
2978
|
done: true,
|
|
2719
2979
|
value
|
|
@@ -2726,9 +2986,8 @@ var ARRAY_BUFFER_CONSTRUCTOR = (b64) => {
|
|
|
2726
2986
|
const decoded = atob(b64);
|
|
2727
2987
|
const length = decoded.length;
|
|
2728
2988
|
const arr = new Uint8Array(length);
|
|
2729
|
-
for (let i = 0;i < length; i++)
|
|
2989
|
+
for (let i = 0;i < length; i++)
|
|
2730
2990
|
arr[i] = decoded.charCodeAt(i);
|
|
2731
|
-
}
|
|
2732
2991
|
return arr.buffer;
|
|
2733
2992
|
};
|
|
2734
2993
|
function createSequence(values, throwAt, doneAt) {
|
|
@@ -2755,9 +3014,8 @@ function dedupePlugins(deduped, plugins) {
|
|
|
2755
3014
|
const current = plugins[i];
|
|
2756
3015
|
if (!deduped.has(current)) {
|
|
2757
3016
|
deduped.add(current);
|
|
2758
|
-
if (current.extends)
|
|
3017
|
+
if (current.extends)
|
|
2759
3018
|
dedupePlugins(deduped, current.extends);
|
|
2760
|
-
}
|
|
2761
3019
|
}
|
|
2762
3020
|
}
|
|
2763
3021
|
}
|
|
@@ -2767,7 +3025,6 @@ function resolvePlugins(plugins) {
|
|
|
2767
3025
|
dedupePlugins(deduped, plugins);
|
|
2768
3026
|
return [...deduped];
|
|
2769
3027
|
}
|
|
2770
|
-
return;
|
|
2771
3028
|
}
|
|
2772
3029
|
function getTypedArrayConstructor(name) {
|
|
2773
3030
|
switch (name) {
|
|
@@ -2839,18 +3096,15 @@ function applyObjectFlag(obj, flag) {
|
|
|
2839
3096
|
}
|
|
2840
3097
|
var DEFAULT_DEPTH_LIMIT = 1000;
|
|
2841
3098
|
function createBaseDeserializerContext(mode, options) {
|
|
2842
|
-
var
|
|
3099
|
+
var _options$features;
|
|
2843
3100
|
const refs = options.refs || /* @__PURE__ */ new Map;
|
|
2844
|
-
if (!("types" in refs))
|
|
2845
|
-
Object.assign(refs, {
|
|
2846
|
-
types: /* @__PURE__ */ new Map
|
|
2847
|
-
});
|
|
2848
|
-
}
|
|
3101
|
+
if (!("types" in refs))
|
|
3102
|
+
Object.assign(refs, { types: /* @__PURE__ */ new Map });
|
|
2849
3103
|
return {
|
|
2850
3104
|
mode,
|
|
2851
3105
|
plugins: options.plugins,
|
|
2852
3106
|
refs,
|
|
2853
|
-
features: (
|
|
3107
|
+
features: (_options$features = options.features) !== null && _options$features !== undefined ? _options$features : 127 ^ (options.disabledFeatures || 0),
|
|
2854
3108
|
depthLimit: options.depthLimit || DEFAULT_DEPTH_LIMIT
|
|
2855
3109
|
};
|
|
2856
3110
|
}
|
|
@@ -2858,7 +3112,7 @@ function createCrossDeserializerContext(options) {
|
|
|
2858
3112
|
return {
|
|
2859
3113
|
mode: 2,
|
|
2860
3114
|
base: createBaseDeserializerContext(2, options),
|
|
2861
|
-
child:
|
|
3115
|
+
child: undefined
|
|
2862
3116
|
};
|
|
2863
3117
|
}
|
|
2864
3118
|
var DeserializePluginContext = class {
|
|
@@ -2867,25 +3121,25 @@ var DeserializePluginContext = class {
|
|
|
2867
3121
|
this.depth = depth;
|
|
2868
3122
|
}
|
|
2869
3123
|
deserialize(node) {
|
|
2870
|
-
return deserialize(this._p, this.depth, node);
|
|
3124
|
+
return deserialize$1(this._p, this.depth, node);
|
|
2871
3125
|
}
|
|
2872
3126
|
};
|
|
2873
3127
|
function guardIndexedValue(ctx, id) {
|
|
2874
|
-
if (id < 0 || !Number.isFinite(id) || !Number.isInteger(id))
|
|
3128
|
+
if (id < 0 || !Number.isFinite(id) || !Number.isInteger(id))
|
|
2875
3129
|
throw new SerovalMalformedNodeError({
|
|
2876
3130
|
t: 4,
|
|
2877
3131
|
i: id
|
|
2878
3132
|
});
|
|
2879
|
-
|
|
2880
|
-
if (ctx.refs.has(id)) {
|
|
3133
|
+
if (ctx.refs.has(id))
|
|
2881
3134
|
throw new Error("Conflicted ref id: " + id);
|
|
2882
|
-
|
|
3135
|
+
}
|
|
3136
|
+
function isThennable(value) {
|
|
3137
|
+
return !!value && typeof value === "object" && "then" in value && typeof value.then === "function";
|
|
2883
3138
|
}
|
|
2884
3139
|
function assignIndexedValueVanilla(ctx, id, value) {
|
|
2885
3140
|
guardIndexedValue(ctx.base, id);
|
|
2886
|
-
if (ctx.state.marked.has(id))
|
|
3141
|
+
if (ctx.state.marked.has(id))
|
|
2887
3142
|
ctx.base.refs.set(id, value);
|
|
2888
|
-
}
|
|
2889
3143
|
return value;
|
|
2890
3144
|
}
|
|
2891
3145
|
function assignIndexedValueCross(ctx, id, value) {
|
|
@@ -2893,56 +3147,52 @@ function assignIndexedValueCross(ctx, id, value) {
|
|
|
2893
3147
|
ctx.base.refs.set(id, value);
|
|
2894
3148
|
return value;
|
|
2895
3149
|
}
|
|
2896
|
-
function assignIndexedValue(ctx, id, value) {
|
|
3150
|
+
function assignIndexedValue$1(ctx, id, value) {
|
|
2897
3151
|
return ctx.mode === 1 ? assignIndexedValueVanilla(ctx, id, value) : assignIndexedValueCross(ctx, id, value);
|
|
2898
3152
|
}
|
|
2899
3153
|
function deserializeKnownValue(node, record, key) {
|
|
2900
|
-
if (Object.hasOwn(record, key))
|
|
3154
|
+
if (Object.hasOwn(record, key))
|
|
2901
3155
|
return record[key];
|
|
2902
|
-
}
|
|
2903
3156
|
throw new SerovalMalformedNodeError(node);
|
|
2904
3157
|
}
|
|
2905
3158
|
function deserializeReference(ctx, node) {
|
|
2906
|
-
return assignIndexedValue(ctx, node.i, getReference(deserializeString(node.s)));
|
|
3159
|
+
return assignIndexedValue$1(ctx, node.i, getReference(deserializeString(node.s)));
|
|
2907
3160
|
}
|
|
2908
3161
|
function deserializeArray(ctx, depth, node) {
|
|
2909
3162
|
const items = node.a;
|
|
2910
3163
|
const len = items.length;
|
|
2911
|
-
const result = assignIndexedValue(ctx, node.i, new Array(len));
|
|
3164
|
+
const result = assignIndexedValue$1(ctx, node.i, new Array(len));
|
|
2912
3165
|
for (let i = 0, item;i < len; i++) {
|
|
2913
3166
|
item = items[i];
|
|
2914
|
-
if (item)
|
|
2915
|
-
result[i] = deserialize(ctx, depth, item);
|
|
2916
|
-
}
|
|
3167
|
+
if (item)
|
|
3168
|
+
result[i] = deserialize$1(ctx, depth, item);
|
|
2917
3169
|
}
|
|
2918
3170
|
applyObjectFlag(result, node.o);
|
|
2919
3171
|
return result;
|
|
2920
3172
|
}
|
|
2921
3173
|
function assignStringProperty(object, key, value) {
|
|
2922
|
-
if (isValidKey(key))
|
|
3174
|
+
if (isValidKey(key))
|
|
2923
3175
|
object[key] = value;
|
|
2924
|
-
|
|
3176
|
+
else
|
|
2925
3177
|
Object.defineProperty(object, key, {
|
|
2926
3178
|
value,
|
|
2927
3179
|
configurable: true,
|
|
2928
3180
|
enumerable: true,
|
|
2929
3181
|
writable: true
|
|
2930
3182
|
});
|
|
2931
|
-
}
|
|
2932
3183
|
}
|
|
2933
3184
|
function assignProperty(ctx, depth, object, key, value) {
|
|
2934
|
-
if (typeof key === "string")
|
|
2935
|
-
assignStringProperty(object, deserializeString(key), deserialize(ctx, depth, value));
|
|
2936
|
-
|
|
2937
|
-
const actual = deserialize(ctx, depth, key);
|
|
3185
|
+
if (typeof key === "string")
|
|
3186
|
+
assignStringProperty(object, deserializeString(key), deserialize$1(ctx, depth, value));
|
|
3187
|
+
else {
|
|
3188
|
+
const actual = deserialize$1(ctx, depth, key);
|
|
2938
3189
|
switch (typeof actual) {
|
|
2939
3190
|
case "string":
|
|
2940
|
-
assignStringProperty(object, actual, deserialize(ctx, depth, value));
|
|
3191
|
+
assignStringProperty(object, actual, deserialize$1(ctx, depth, value));
|
|
2941
3192
|
break;
|
|
2942
3193
|
case "symbol":
|
|
2943
|
-
if (isValidSymbol(actual))
|
|
2944
|
-
object[actual] = deserialize(ctx, depth, value);
|
|
2945
|
-
}
|
|
3194
|
+
if (isValidSymbol(actual))
|
|
3195
|
+
object[actual] = deserialize$1(ctx, depth, value);
|
|
2946
3196
|
break;
|
|
2947
3197
|
default:
|
|
2948
3198
|
throw new SerovalMalformedNodeError(key);
|
|
@@ -2953,80 +3203,105 @@ function assignNodeType(ctx, id, type) {
|
|
|
2953
3203
|
ctx.base.refs.types.set(id, type);
|
|
2954
3204
|
}
|
|
2955
3205
|
function validateNodeType(ctx, node, id, type) {
|
|
2956
|
-
if (ctx.base.refs.types.get(id) !== type)
|
|
3206
|
+
if (ctx.base.refs.types.get(id) !== type)
|
|
2957
3207
|
throw new SerovalMalformedNodeError(node);
|
|
2958
|
-
}
|
|
2959
3208
|
}
|
|
2960
3209
|
function deserializeProperties(ctx, depth, node, result) {
|
|
2961
3210
|
const keys = node.k;
|
|
2962
|
-
|
|
2963
|
-
|
|
2964
|
-
for (let i = 0, vals = node.v, len2 = keys.length;i < len2; i++) {
|
|
3211
|
+
if (keys.length > 0)
|
|
3212
|
+
for (let i = 0, vals = node.v, len = keys.length;i < len; i++)
|
|
2965
3213
|
assignProperty(ctx, depth, result, keys[i], vals[i]);
|
|
2966
|
-
}
|
|
2967
|
-
}
|
|
2968
3214
|
return result;
|
|
2969
3215
|
}
|
|
2970
3216
|
function deserializeObject(ctx, depth, node) {
|
|
2971
|
-
const result = assignIndexedValue(ctx, node.i, node.t === 10 ? {} :
|
|
3217
|
+
const result = assignIndexedValue$1(ctx, node.i, node.t === 10 ? {} : Object.create(null));
|
|
2972
3218
|
deserializeProperties(ctx, depth, node.p, result);
|
|
2973
3219
|
applyObjectFlag(result, node.o);
|
|
2974
3220
|
return result;
|
|
2975
3221
|
}
|
|
2976
3222
|
function deserializeDate(ctx, node) {
|
|
2977
|
-
return assignIndexedValue(ctx, node.i, new Date(node.s));
|
|
3223
|
+
return assignIndexedValue$1(ctx, node.i, new Date(node.s));
|
|
3224
|
+
}
|
|
3225
|
+
function deserializeTemporal(ctx, node) {
|
|
3226
|
+
if (!(ctx.base.features & 64))
|
|
3227
|
+
throw new SerovalUnsupportedNodeError(node);
|
|
3228
|
+
let value;
|
|
3229
|
+
switch (node.c) {
|
|
3230
|
+
case 0:
|
|
3231
|
+
value = Temporal.Instant.from(node.s);
|
|
3232
|
+
break;
|
|
3233
|
+
case 1:
|
|
3234
|
+
value = Temporal.Duration.from(node.s);
|
|
3235
|
+
break;
|
|
3236
|
+
case 2:
|
|
3237
|
+
value = Temporal.PlainDate.from(node.s);
|
|
3238
|
+
break;
|
|
3239
|
+
case 3:
|
|
3240
|
+
value = Temporal.PlainDateTime.from(node.s);
|
|
3241
|
+
break;
|
|
3242
|
+
case 4:
|
|
3243
|
+
value = Temporal.PlainMonthDay.from(node.s);
|
|
3244
|
+
break;
|
|
3245
|
+
case 5:
|
|
3246
|
+
value = Temporal.PlainTime.from(node.s);
|
|
3247
|
+
break;
|
|
3248
|
+
case 6:
|
|
3249
|
+
value = Temporal.PlainYearMonth.from(node.s);
|
|
3250
|
+
break;
|
|
3251
|
+
case 7:
|
|
3252
|
+
value = Temporal.ZonedDateTime.from(node.s);
|
|
3253
|
+
break;
|
|
3254
|
+
default:
|
|
3255
|
+
throw new SerovalMalformedNodeError(node);
|
|
3256
|
+
}
|
|
3257
|
+
return assignIndexedValue$1(ctx, node.i, value);
|
|
2978
3258
|
}
|
|
2979
3259
|
function deserializeRegExp(ctx, node) {
|
|
2980
3260
|
if (ctx.base.features & 32) {
|
|
2981
3261
|
const source = deserializeString(node.c);
|
|
2982
|
-
if (source.length > MAX_REGEXP_SOURCE_LENGTH)
|
|
3262
|
+
if (source.length > MAX_REGEXP_SOURCE_LENGTH)
|
|
2983
3263
|
throw new SerovalMalformedNodeError(node);
|
|
2984
|
-
|
|
2985
|
-
return assignIndexedValue(ctx, node.i, new RegExp(source, node.m));
|
|
3264
|
+
return assignIndexedValue$1(ctx, node.i, new RegExp(source, node.m));
|
|
2986
3265
|
}
|
|
2987
3266
|
throw new SerovalUnsupportedNodeError(node);
|
|
2988
3267
|
}
|
|
2989
3268
|
function deserializeSet(ctx, depth, node) {
|
|
2990
|
-
const result = assignIndexedValue(ctx, node.i, /* @__PURE__ */ new Set);
|
|
2991
|
-
for (let i = 0, items = node.a, len = items.length;i < len; i++)
|
|
2992
|
-
result.add(deserialize(ctx, depth, items[i]));
|
|
2993
|
-
}
|
|
3269
|
+
const result = assignIndexedValue$1(ctx, node.i, /* @__PURE__ */ new Set);
|
|
3270
|
+
for (let i = 0, items = node.a, len = items.length;i < len; i++)
|
|
3271
|
+
result.add(deserialize$1(ctx, depth, items[i]));
|
|
2994
3272
|
return result;
|
|
2995
3273
|
}
|
|
2996
3274
|
function deserializeMap(ctx, depth, node) {
|
|
2997
|
-
const result = assignIndexedValue(ctx, node.i, /* @__PURE__ */ new Map);
|
|
2998
|
-
for (let i = 0, keys = node.e.k, vals = node.e.v, len = keys.length;i < len; i++)
|
|
2999
|
-
result.set(deserialize(ctx, depth, keys[i]), deserialize(ctx, depth, vals[i]));
|
|
3000
|
-
}
|
|
3275
|
+
const result = assignIndexedValue$1(ctx, node.i, /* @__PURE__ */ new Map);
|
|
3276
|
+
for (let i = 0, keys = node.e.k, vals = node.e.v, len = keys.length;i < len; i++)
|
|
3277
|
+
result.set(deserialize$1(ctx, depth, keys[i]), deserialize$1(ctx, depth, vals[i]));
|
|
3001
3278
|
return result;
|
|
3002
3279
|
}
|
|
3003
3280
|
function deserializeArrayBuffer(ctx, node) {
|
|
3004
|
-
if (node.s.length > MAX_BASE64_LENGTH)
|
|
3281
|
+
if (node.s.length > MAX_BASE64_LENGTH)
|
|
3005
3282
|
throw new SerovalMalformedNodeError(node);
|
|
3006
|
-
|
|
3007
|
-
const result = assignIndexedValue(ctx, node.i, ARRAY_BUFFER_CONSTRUCTOR(deserializeString(node.s)));
|
|
3008
|
-
return result;
|
|
3283
|
+
return assignIndexedValue$1(ctx, node.i, ARRAY_BUFFER_CONSTRUCTOR(deserializeString(node.s)));
|
|
3009
3284
|
}
|
|
3010
3285
|
function deserializeTypedArray(ctx, depth, node) {
|
|
3011
|
-
var
|
|
3286
|
+
var _node$b;
|
|
3012
3287
|
const construct = getTypedArrayConstructor(node.c);
|
|
3013
|
-
const source = deserialize(ctx, depth, node.f);
|
|
3014
|
-
|
|
3015
|
-
if (offset < 0 || offset > source.byteLength) {
|
|
3288
|
+
const source = deserialize$1(ctx, depth, node.f);
|
|
3289
|
+
if (!(source instanceof ArrayBuffer))
|
|
3016
3290
|
throw new SerovalMalformedNodeError(node);
|
|
3017
|
-
|
|
3018
|
-
|
|
3019
|
-
|
|
3291
|
+
const offset = (_node$b = node.b) !== null && _node$b !== undefined ? _node$b : 0;
|
|
3292
|
+
if (offset < 0 || offset > source.byteLength || node.l > MAX_BASE64_LENGTH)
|
|
3293
|
+
throw new SerovalMalformedNodeError(node);
|
|
3294
|
+
return assignIndexedValue$1(ctx, node.i, new construct(source, offset, node.l));
|
|
3020
3295
|
}
|
|
3021
3296
|
function deserializeDataView(ctx, depth, node) {
|
|
3022
|
-
var
|
|
3023
|
-
const source = deserialize(ctx, depth, node.f);
|
|
3024
|
-
|
|
3025
|
-
if (offset < 0 || offset > source.byteLength) {
|
|
3297
|
+
var _node$b2;
|
|
3298
|
+
const source = deserialize$1(ctx, depth, node.f);
|
|
3299
|
+
if (!(source instanceof ArrayBuffer))
|
|
3026
3300
|
throw new SerovalMalformedNodeError(node);
|
|
3027
|
-
|
|
3028
|
-
|
|
3029
|
-
|
|
3301
|
+
const offset = (_node$b2 = node.b) !== null && _node$b2 !== undefined ? _node$b2 : 0;
|
|
3302
|
+
if (offset < 0 || offset > source.byteLength || node.l > MAX_BASE64_LENGTH)
|
|
3303
|
+
throw new SerovalMalformedNodeError(node);
|
|
3304
|
+
return assignIndexedValue$1(ctx, node.i, new DataView(source, offset, node.l));
|
|
3030
3305
|
}
|
|
3031
3306
|
function deserializeDictionary(ctx, depth, node, result) {
|
|
3032
3307
|
if (node.p) {
|
|
@@ -3036,27 +3311,26 @@ function deserializeDictionary(ctx, depth, node, result) {
|
|
|
3036
3311
|
return result;
|
|
3037
3312
|
}
|
|
3038
3313
|
function deserializeAggregateError(ctx, depth, node) {
|
|
3039
|
-
|
|
3040
|
-
return deserializeDictionary(ctx, depth, node, result);
|
|
3314
|
+
return deserializeDictionary(ctx, depth, node, assignIndexedValue$1(ctx, node.i, new AggregateError([], deserializeString(node.m))));
|
|
3041
3315
|
}
|
|
3042
3316
|
function deserializeError(ctx, depth, node) {
|
|
3043
3317
|
const construct = deserializeKnownValue(node, ERROR_CONSTRUCTOR, node.s);
|
|
3044
|
-
|
|
3045
|
-
return deserializeDictionary(ctx, depth, node, result);
|
|
3318
|
+
return deserializeDictionary(ctx, depth, node, assignIndexedValue$1(ctx, node.i, new construct(deserializeString(node.m))));
|
|
3046
3319
|
}
|
|
3047
3320
|
function deserializePromise(ctx, depth, node) {
|
|
3048
3321
|
const deferred = PROMISE_CONSTRUCTOR();
|
|
3049
|
-
const result = assignIndexedValue(ctx, node.i, deferred.p);
|
|
3050
|
-
const deserialized = deserialize(ctx, depth, node.f);
|
|
3051
|
-
if (
|
|
3322
|
+
const result = assignIndexedValue$1(ctx, node.i, deferred.p);
|
|
3323
|
+
const deserialized = deserialize$1(ctx, depth, node.f);
|
|
3324
|
+
if (isThennable(deserialized))
|
|
3325
|
+
throw new SerovalMalformedNodeError(node.f);
|
|
3326
|
+
if (node.s)
|
|
3052
3327
|
deferred.s(deserialized);
|
|
3053
|
-
|
|
3328
|
+
else
|
|
3054
3329
|
deferred.f(deserialized);
|
|
3055
|
-
}
|
|
3056
3330
|
return result;
|
|
3057
3331
|
}
|
|
3058
3332
|
function deserializeBoxed(ctx, depth, node) {
|
|
3059
|
-
return assignIndexedValue(ctx, node.i, Object(deserialize(ctx, depth, node.f)));
|
|
3333
|
+
return assignIndexedValue$1(ctx, node.i, Object(deserialize$1(ctx, depth, node.f)));
|
|
3060
3334
|
}
|
|
3061
3335
|
function deserializePlugin(ctx, depth, node) {
|
|
3062
3336
|
const currentPlugins = ctx.base.plugins;
|
|
@@ -3064,66 +3338,64 @@ function deserializePlugin(ctx, depth, node) {
|
|
|
3064
3338
|
const tag = deserializeString(node.c);
|
|
3065
3339
|
for (let i = 0, len = currentPlugins.length;i < len; i++) {
|
|
3066
3340
|
const plugin = currentPlugins[i];
|
|
3067
|
-
if (plugin.tag === tag)
|
|
3068
|
-
return assignIndexedValue(ctx, node.i, plugin.deserialize(node.s, new DeserializePluginContext(ctx, depth), {
|
|
3069
|
-
id: node.i
|
|
3070
|
-
}));
|
|
3071
|
-
}
|
|
3341
|
+
if (plugin.tag === tag)
|
|
3342
|
+
return assignIndexedValue$1(ctx, node.i, plugin.deserialize(node.s, new DeserializePluginContext(ctx, depth), { id: node.i }));
|
|
3072
3343
|
}
|
|
3073
3344
|
}
|
|
3074
3345
|
throw new SerovalMissingPluginError(node.c);
|
|
3075
3346
|
}
|
|
3076
3347
|
function deserializePromiseConstructor(ctx, node) {
|
|
3077
|
-
const value = assignIndexedValue(ctx, node.i, assignIndexedValue(ctx, node.s, PROMISE_CONSTRUCTOR()).p);
|
|
3348
|
+
const value = assignIndexedValue$1(ctx, node.i, assignIndexedValue$1(ctx, node.s, PROMISE_CONSTRUCTOR()).p);
|
|
3078
3349
|
assignNodeType(ctx, node.s, 22);
|
|
3079
3350
|
return value;
|
|
3080
3351
|
}
|
|
3081
|
-
function
|
|
3082
|
-
const deferred = ctx.base.refs.get(node.i);
|
|
3083
|
-
if (deferred) {
|
|
3084
|
-
validateNodeType(ctx, node, node.i, 22);
|
|
3085
|
-
deferred.s(deserialize(ctx, depth, node.a[1]));
|
|
3086
|
-
return NIL;
|
|
3087
|
-
}
|
|
3088
|
-
throw new SerovalMissingInstanceError("Promise");
|
|
3089
|
-
}
|
|
3090
|
-
function deserializePromiseReject(ctx, depth, node) {
|
|
3352
|
+
function deserializePromiseFulfill(ctx, depth, node) {
|
|
3091
3353
|
const deferred = ctx.base.refs.get(node.i);
|
|
3092
3354
|
if (deferred) {
|
|
3093
3355
|
validateNodeType(ctx, node, node.i, 22);
|
|
3094
|
-
|
|
3095
|
-
|
|
3356
|
+
const deserialized = deserialize$1(ctx, depth, node.a[1]);
|
|
3357
|
+
if (isThennable(deserialized))
|
|
3358
|
+
throw new SerovalMalformedNodeError(node.a[1]);
|
|
3359
|
+
if (node.t === 23)
|
|
3360
|
+
deferred.s(deserialized);
|
|
3361
|
+
else
|
|
3362
|
+
deferred.f(deserialized);
|
|
3363
|
+
return;
|
|
3096
3364
|
}
|
|
3097
3365
|
throw new SerovalMissingInstanceError("Promise");
|
|
3098
3366
|
}
|
|
3099
3367
|
function deserializeIteratorFactoryInstance(ctx, depth, node) {
|
|
3100
|
-
deserialize(ctx, depth, node.a[0]);
|
|
3101
|
-
const source = deserialize(ctx, depth, node.a[1]);
|
|
3368
|
+
deserialize$1(ctx, depth, node.a[0]);
|
|
3369
|
+
const source = deserialize$1(ctx, depth, node.a[1]);
|
|
3370
|
+
validateNodeType(ctx, node, node.a[1].i, 35);
|
|
3371
|
+
if (!source)
|
|
3372
|
+
throw new SerovalMalformedNodeError(node.a[1]);
|
|
3102
3373
|
return sequenceToIterator(source);
|
|
3103
3374
|
}
|
|
3104
3375
|
function deserializeAsyncIteratorFactoryInstance(ctx, depth, node) {
|
|
3105
|
-
deserialize(ctx, depth, node.a[0]);
|
|
3106
|
-
const source = deserialize(ctx, depth, node.a[1]);
|
|
3376
|
+
deserialize$1(ctx, depth, node.a[0]);
|
|
3377
|
+
const source = deserialize$1(ctx, depth, node.a[1]);
|
|
3378
|
+
validateNodeType(ctx, node, node.a[1].i, 31);
|
|
3379
|
+
if (!source)
|
|
3380
|
+
throw new SerovalMalformedNodeError(node.a[1]);
|
|
3107
3381
|
return streamToAsyncIterable(source);
|
|
3108
3382
|
}
|
|
3109
3383
|
function deserializeStreamConstructor(ctx, depth, node) {
|
|
3110
|
-
const result = assignIndexedValue(ctx, node.i, createStream());
|
|
3384
|
+
const result = assignIndexedValue$1(ctx, node.i, createStream());
|
|
3111
3385
|
assignNodeType(ctx, node.i, 31);
|
|
3112
3386
|
const items = node.a;
|
|
3113
3387
|
const len = items.length;
|
|
3114
|
-
if (len)
|
|
3115
|
-
for (let i = 0;i < len; i++)
|
|
3116
|
-
deserialize(ctx, depth, items[i]);
|
|
3117
|
-
}
|
|
3118
|
-
}
|
|
3388
|
+
if (len)
|
|
3389
|
+
for (let i = 0;i < len; i++)
|
|
3390
|
+
deserialize$1(ctx, depth, items[i]);
|
|
3119
3391
|
return result;
|
|
3120
3392
|
}
|
|
3121
3393
|
function deserializeStreamNext(ctx, depth, node) {
|
|
3122
3394
|
const deferred = ctx.base.refs.get(node.i);
|
|
3123
3395
|
if (deferred) {
|
|
3124
3396
|
validateNodeType(ctx, node, node.i, 31);
|
|
3125
|
-
deferred.next(deserialize(ctx, depth, node.f));
|
|
3126
|
-
return
|
|
3397
|
+
deferred.next(deserialize$1(ctx, depth, node.f));
|
|
3398
|
+
return;
|
|
3127
3399
|
}
|
|
3128
3400
|
throw new SerovalMissingInstanceError("Stream");
|
|
3129
3401
|
}
|
|
@@ -3131,8 +3403,8 @@ function deserializeStreamThrow(ctx, depth, node) {
|
|
|
3131
3403
|
const deferred = ctx.base.refs.get(node.i);
|
|
3132
3404
|
if (deferred) {
|
|
3133
3405
|
validateNodeType(ctx, node, node.i, 31);
|
|
3134
|
-
deferred.throw(deserialize(ctx, depth, node.f));
|
|
3135
|
-
return
|
|
3406
|
+
deferred.throw(deserialize$1(ctx, depth, node.f));
|
|
3407
|
+
return;
|
|
3136
3408
|
}
|
|
3137
3409
|
throw new SerovalMissingInstanceError("Stream");
|
|
3138
3410
|
}
|
|
@@ -3140,30 +3412,27 @@ function deserializeStreamReturn(ctx, depth, node) {
|
|
|
3140
3412
|
const deferred = ctx.base.refs.get(node.i);
|
|
3141
3413
|
if (deferred) {
|
|
3142
3414
|
validateNodeType(ctx, node, node.i, 31);
|
|
3143
|
-
deferred.return(deserialize(ctx, depth, node.f));
|
|
3144
|
-
return
|
|
3415
|
+
deferred.return(deserialize$1(ctx, depth, node.f));
|
|
3416
|
+
return;
|
|
3145
3417
|
}
|
|
3146
3418
|
throw new SerovalMissingInstanceError("Stream");
|
|
3147
3419
|
}
|
|
3148
3420
|
function deserializeIteratorFactory(ctx, depth, node) {
|
|
3149
|
-
deserialize(ctx, depth, node.f);
|
|
3150
|
-
return NIL;
|
|
3421
|
+
deserialize$1(ctx, depth, node.f);
|
|
3151
3422
|
}
|
|
3152
3423
|
function deserializeAsyncIteratorFactory(ctx, depth, node) {
|
|
3153
|
-
deserialize(ctx, depth, node.a[1]);
|
|
3154
|
-
return NIL;
|
|
3424
|
+
deserialize$1(ctx, depth, node.a[1]);
|
|
3155
3425
|
}
|
|
3156
3426
|
function deserializeSequence(ctx, depth, node) {
|
|
3157
|
-
const result = assignIndexedValue(ctx, node.i, createSequence([], node.s, node.l));
|
|
3158
|
-
|
|
3159
|
-
|
|
3160
|
-
|
|
3427
|
+
const result = assignIndexedValue$1(ctx, node.i, createSequence([], node.s, node.l));
|
|
3428
|
+
assignNodeType(ctx, node.i, 35);
|
|
3429
|
+
for (let i = 0, len = node.a.length;i < len; i++)
|
|
3430
|
+
result.v[i] = deserialize$1(ctx, depth, node.a[i]);
|
|
3161
3431
|
return result;
|
|
3162
3432
|
}
|
|
3163
|
-
function deserialize(ctx, depth, node) {
|
|
3164
|
-
if (depth > ctx.base.depthLimit)
|
|
3433
|
+
function deserialize$1(ctx, depth, node) {
|
|
3434
|
+
if (depth > ctx.base.depthLimit)
|
|
3165
3435
|
throw new SerovalDepthLimitError(ctx.base.depthLimit);
|
|
3166
|
-
}
|
|
3167
3436
|
depth += 1;
|
|
3168
3437
|
switch (node.t) {
|
|
3169
3438
|
case 2:
|
|
@@ -3173,9 +3442,8 @@ function deserialize(ctx, depth, node) {
|
|
|
3173
3442
|
case 1:
|
|
3174
3443
|
return deserializeString(String(node.s));
|
|
3175
3444
|
case 3:
|
|
3176
|
-
if (String(node.s).length > MAX_BIGINT_LENGTH)
|
|
3445
|
+
if (String(node.s).length > MAX_BIGINT_LENGTH)
|
|
3177
3446
|
throw new SerovalMalformedNodeError(node);
|
|
3178
|
-
}
|
|
3179
3447
|
return BigInt(node.s);
|
|
3180
3448
|
case 4:
|
|
3181
3449
|
return ctx.base.refs.get(node.i);
|
|
@@ -3216,9 +3484,8 @@ function deserialize(ctx, depth, node) {
|
|
|
3216
3484
|
case 22:
|
|
3217
3485
|
return deserializePromiseConstructor(ctx, node);
|
|
3218
3486
|
case 23:
|
|
3219
|
-
return deserializePromiseResolve(ctx, depth, node);
|
|
3220
3487
|
case 24:
|
|
3221
|
-
return
|
|
3488
|
+
return deserializePromiseFulfill(ctx, depth, node);
|
|
3222
3489
|
case 28:
|
|
3223
3490
|
return deserializeIteratorFactoryInstance(ctx, depth, node);
|
|
3224
3491
|
case 30:
|
|
@@ -3237,38 +3504,34 @@ function deserialize(ctx, depth, node) {
|
|
|
3237
3504
|
return deserializeAsyncIteratorFactory(ctx, depth, node);
|
|
3238
3505
|
case 35:
|
|
3239
3506
|
return deserializeSequence(ctx, depth, node);
|
|
3507
|
+
case 36:
|
|
3508
|
+
return deserializeTemporal(ctx, node);
|
|
3240
3509
|
default:
|
|
3241
3510
|
throw new SerovalUnsupportedNodeError(node);
|
|
3242
3511
|
}
|
|
3243
3512
|
}
|
|
3244
3513
|
function deserializeTop(ctx, node) {
|
|
3245
3514
|
try {
|
|
3246
|
-
return deserialize(ctx, 0, node);
|
|
3515
|
+
return deserialize$1(ctx, 0, node);
|
|
3247
3516
|
} catch (error) {
|
|
3248
3517
|
throw new SerovalDeserializationError(error);
|
|
3249
3518
|
}
|
|
3250
3519
|
}
|
|
3251
|
-
var REF_START_CHARS = "hjkmoquxzABCDEFGHIJKLNPQRTUVWXYZ$_";
|
|
3252
|
-
var REF_START_CHARS_LEN = REF_START_CHARS.length;
|
|
3253
|
-
var REF_CHARS = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789$_";
|
|
3254
|
-
var REF_CHARS_LEN = REF_CHARS.length;
|
|
3255
3520
|
function fromCrossJSON(source, options) {
|
|
3256
|
-
|
|
3257
|
-
|
|
3258
|
-
plugins,
|
|
3521
|
+
return deserializeTop(createCrossDeserializerContext({
|
|
3522
|
+
plugins: resolvePlugins(options.plugins),
|
|
3259
3523
|
refs: options.refs,
|
|
3260
3524
|
features: options.features,
|
|
3261
3525
|
disabledFeatures: options.disabledFeatures,
|
|
3262
3526
|
depthLimit: options.depthLimit
|
|
3263
|
-
});
|
|
3264
|
-
return deserializeTop(ctx, source);
|
|
3527
|
+
}), source);
|
|
3265
3528
|
}
|
|
3266
3529
|
|
|
3267
3530
|
// src/rsc/shared.tsx
|
|
3268
3531
|
import {
|
|
3269
3532
|
Children,
|
|
3270
3533
|
cloneElement,
|
|
3271
|
-
createElement as
|
|
3534
|
+
createElement as createElement3,
|
|
3272
3535
|
isValidElement,
|
|
3273
3536
|
use
|
|
3274
3537
|
} from "react";
|
|
@@ -3301,7 +3564,7 @@ function decodeFlightBytes(bytes) {
|
|
|
3301
3564
|
}));
|
|
3302
3565
|
}
|
|
3303
3566
|
function createRenderableSource(state) {
|
|
3304
|
-
const element =
|
|
3567
|
+
const element = createElement3(RscNode, { state });
|
|
3305
3568
|
return new Proxy(element, {
|
|
3306
3569
|
get(target, property, receiver) {
|
|
3307
3570
|
if (property === RSC_SOURCE) {
|
|
@@ -3711,7 +3974,7 @@ function isAbortError(error) {
|
|
|
3711
3974
|
}
|
|
3712
3975
|
|
|
3713
3976
|
// src/client/router/search-store.ts
|
|
3714
|
-
import { createContext as
|
|
3977
|
+
import { createContext as createContext3 } from "react";
|
|
3715
3978
|
function searchSnapshotChanged(a, b) {
|
|
3716
3979
|
return a.currentHref !== b.currentHref || a.navigate !== b.navigate || a.search !== b.search || a.searchRoutes !== b.searchRoutes;
|
|
3717
3980
|
}
|
|
@@ -3769,10 +4032,10 @@ var FALLBACK_SEARCH_STORE = createSearchStore({
|
|
|
3769
4032
|
search: {},
|
|
3770
4033
|
searchRoutes: []
|
|
3771
4034
|
});
|
|
3772
|
-
var SearchStoreContext =
|
|
4035
|
+
var SearchStoreContext = createContext3(null);
|
|
3773
4036
|
|
|
3774
4037
|
// src/client/router/spa-response.ts
|
|
3775
|
-
import { createElement as
|
|
4038
|
+
import { createElement as createElement4 } from "react";
|
|
3776
4039
|
function isFurinErrorPayload(value) {
|
|
3777
4040
|
if (!value || typeof value !== "object") {
|
|
3778
4041
|
return false;
|
|
@@ -3807,10 +4070,10 @@ function pickDeepestNotFound(boundaries) {
|
|
|
3807
4070
|
}
|
|
3808
4071
|
}
|
|
3809
4072
|
}
|
|
3810
|
-
var DefaultClientNotFoundFallback = ({ error }) =>
|
|
4073
|
+
var DefaultClientNotFoundFallback = ({ error }) => createElement4(DefaultNotFoundScreen, { message: error.message });
|
|
3811
4074
|
function buildNotFoundPageElement(boundaries, error) {
|
|
3812
4075
|
const Fallback = pickDeepestNotFound(boundaries) ?? DefaultClientNotFoundFallback;
|
|
3813
|
-
return
|
|
4076
|
+
return createElement4(Fallback, { error });
|
|
3814
4077
|
}
|
|
3815
4078
|
async function parsePageResponse(res, basePath) {
|
|
3816
4079
|
let finalHref;
|
|
@@ -3913,7 +4176,7 @@ function createSyncCatchUp(options) {
|
|
|
3913
4176
|
}
|
|
3914
4177
|
|
|
3915
4178
|
// src/client/router/provider.tsx
|
|
3916
|
-
import { jsxDEV as
|
|
4179
|
+
import { jsxDEV as jsxDEV5 } from "react/jsx-dev-runtime";
|
|
3917
4180
|
var EMPTY_SEARCH = {};
|
|
3918
4181
|
function getHistoryStateObject() {
|
|
3919
4182
|
const value = history.state;
|
|
@@ -3946,8 +4209,10 @@ function RouterProvider({
|
|
|
3946
4209
|
prefetchCacheSize,
|
|
3947
4210
|
syncStream
|
|
3948
4211
|
}) {
|
|
4212
|
+
const initialDocumentState = useDocumentState();
|
|
3949
4213
|
const [state, setState] = useState(() => ({
|
|
3950
4214
|
data: initialData,
|
|
4215
|
+
head: initialDocumentState?.head,
|
|
3951
4216
|
match: initialMatch,
|
|
3952
4217
|
notFound: initialNotFound
|
|
3953
4218
|
}));
|
|
@@ -4025,6 +4290,7 @@ function RouterProvider({
|
|
|
4025
4290
|
}
|
|
4026
4291
|
const { syncData, deferredPromises } = parsed;
|
|
4027
4292
|
const {
|
|
4293
|
+
__furinHead,
|
|
4028
4294
|
__furinStatus,
|
|
4029
4295
|
__furinNotFound,
|
|
4030
4296
|
__furinRedirect,
|
|
@@ -4046,6 +4312,7 @@ function RouterProvider({
|
|
|
4046
4312
|
data: {},
|
|
4047
4313
|
error: __furinError,
|
|
4048
4314
|
finalHref,
|
|
4315
|
+
head: __furinHead,
|
|
4049
4316
|
match: loadedMatch,
|
|
4050
4317
|
title
|
|
4051
4318
|
};
|
|
@@ -4059,6 +4326,7 @@ function RouterProvider({
|
|
|
4059
4326
|
return {
|
|
4060
4327
|
data,
|
|
4061
4328
|
finalHref,
|
|
4329
|
+
head: __furinHead,
|
|
4062
4330
|
match: loadedMatch,
|
|
4063
4331
|
notFound,
|
|
4064
4332
|
title
|
|
@@ -4067,7 +4335,7 @@ function RouterProvider({
|
|
|
4067
4335
|
if (finalHref) {
|
|
4068
4336
|
return { data, finalHref, match: null, title };
|
|
4069
4337
|
}
|
|
4070
|
-
return { data, finalHref, match: loadedMatch, title };
|
|
4338
|
+
return { data, finalHref, head: __furinHead, match: loadedMatch, title };
|
|
4071
4339
|
} catch (err) {
|
|
4072
4340
|
if (!isAbortError(err)) {
|
|
4073
4341
|
_log.error({
|
|
@@ -4500,7 +4768,7 @@ function RouterProvider({
|
|
|
4500
4768
|
resetKey: currentHref
|
|
4501
4769
|
}, state.error);
|
|
4502
4770
|
}
|
|
4503
|
-
|
|
4771
|
+
const routerTree = /* @__PURE__ */ jsxDEV5(SearchStoreContext.Provider, {
|
|
4504
4772
|
value: searchStore,
|
|
4505
4773
|
children: buildRouterTree({
|
|
4506
4774
|
basePath,
|
|
@@ -4517,6 +4785,7 @@ function RouterProvider({
|
|
|
4517
4785
|
searchRoutes: routes
|
|
4518
4786
|
}, pageElement, {
|
|
4519
4787
|
digest: initialDigest,
|
|
4788
|
+
document: initialDocumentState !== null,
|
|
4520
4789
|
onReset: () => {
|
|
4521
4790
|
refresh(undefined).catch((err) => {
|
|
4522
4791
|
_log.error({ action: "boundary_reset_failed", error: String(err) });
|
|
@@ -4525,19 +4794,31 @@ function RouterProvider({
|
|
|
4525
4794
|
resetKey: currentHref
|
|
4526
4795
|
})
|
|
4527
4796
|
}, undefined, false, undefined, this);
|
|
4797
|
+
if (initialDocumentState === null) {
|
|
4798
|
+
return routerTree;
|
|
4799
|
+
}
|
|
4800
|
+
return /* @__PURE__ */ jsxDEV5(DocumentProvider, {
|
|
4801
|
+
value: {
|
|
4802
|
+
...initialDocumentState,
|
|
4803
|
+
head: state.head
|
|
4804
|
+
},
|
|
4805
|
+
children: routerTree
|
|
4806
|
+
}, undefined, false, undefined, this);
|
|
4528
4807
|
}
|
|
4529
4808
|
// src/client/link.tsx
|
|
4530
4809
|
function computeLinkView({
|
|
4531
4810
|
to,
|
|
4811
|
+
params,
|
|
4532
4812
|
search,
|
|
4533
4813
|
hash,
|
|
4534
4814
|
children,
|
|
4535
4815
|
activeProps,
|
|
4536
4816
|
inactiveProps
|
|
4537
4817
|
}, router2) {
|
|
4538
|
-
const
|
|
4539
|
-
const
|
|
4540
|
-
const
|
|
4818
|
+
const resolvedTo = applyLinkParams(to, params);
|
|
4819
|
+
const searchDefaults = findSearchDefaultsForRouteTarget(resolvedTo, router2.searchRoutes);
|
|
4820
|
+
const logicalHref = buildHref(resolvedTo, search, hash, searchDefaults);
|
|
4821
|
+
const logicalHrefWithoutHash = buildHref(resolvedTo, search, undefined, searchDefaults);
|
|
4541
4822
|
const isAbsolute = logicalHref.startsWith("http://") || logicalHref.startsWith("https://") || logicalHref.startsWith("//");
|
|
4542
4823
|
const candidateHref = isAbsolute ? logicalHref : router2.basePath + logicalHref;
|
|
4543
4824
|
const href = navigationHrefPolicy(candidateHref, undefined) === "blocked" ? "#" : candidateHref;
|
|
@@ -4554,6 +4835,7 @@ function isSameOriginUrl(url) {
|
|
|
4554
4835
|
}
|
|
4555
4836
|
function LinkInteractive({
|
|
4556
4837
|
to,
|
|
4838
|
+
params,
|
|
4557
4839
|
search,
|
|
4558
4840
|
hash,
|
|
4559
4841
|
preload,
|
|
@@ -4575,7 +4857,7 @@ function LinkInteractive({
|
|
|
4575
4857
|
const router2 = useRouter();
|
|
4576
4858
|
const anchorRef = useRef2(null);
|
|
4577
4859
|
const intentTimerRef = useRef2(null);
|
|
4578
|
-
const { logicalHref, href, isActive, resolvedChildren, extraProps } = computeLinkView({ activeProps, children, hash, inactiveProps, search, to }, router2);
|
|
4860
|
+
const { logicalHref, href, isActive, resolvedChildren, extraProps } = computeLinkView({ activeProps, children, hash, inactiveProps, params, search, to }, router2);
|
|
4579
4861
|
const effectivePreload = preload ?? router2.defaultPreload;
|
|
4580
4862
|
const effectiveDelay = preloadDelay ?? router2.defaultPreloadDelay;
|
|
4581
4863
|
const effectiveStaleTime = preloadStaleTime ?? router2.defaultPreloadStaleTime;
|
|
@@ -4655,7 +4937,7 @@ function LinkInteractive({
|
|
|
4655
4937
|
triggerPrefetch();
|
|
4656
4938
|
}
|
|
4657
4939
|
};
|
|
4658
|
-
return
|
|
4940
|
+
return createElement5("a", {
|
|
4659
4941
|
"data-furin-link": true,
|
|
4660
4942
|
href,
|
|
4661
4943
|
onClick: handleClick,
|
|
@@ -4687,6 +4969,7 @@ function renderLinkElement(props, router2) {
|
|
|
4687
4969
|
const { href, isActive, resolvedChildren, extraProps } = computeLinkView(props, router2);
|
|
4688
4970
|
const {
|
|
4689
4971
|
to: _to,
|
|
4972
|
+
params: _params,
|
|
4690
4973
|
search: _search,
|
|
4691
4974
|
hash: _hash,
|
|
4692
4975
|
children: _children,
|
|
@@ -4705,7 +4988,7 @@ function renderLinkElement(props, router2) {
|
|
|
4705
4988
|
href: _href,
|
|
4706
4989
|
...anchorProps
|
|
4707
4990
|
} = props;
|
|
4708
|
-
return
|
|
4991
|
+
return createElement5("a", {
|
|
4709
4992
|
"data-furin-link": true,
|
|
4710
4993
|
href,
|
|
4711
4994
|
...isActive ? { "data-status": "active" } : {},
|
|
@@ -4716,11 +4999,11 @@ function renderLinkElement(props, router2) {
|
|
|
4716
4999
|
}
|
|
4717
5000
|
function Link(props) {
|
|
4718
5001
|
if (typeof window === "undefined") {
|
|
4719
|
-
return
|
|
5002
|
+
return createElement5(RouterContext.Consumer, {
|
|
4720
5003
|
children: (routerCtx) => renderLinkElement(props, routerCtx ?? SSR_FALLBACK_ROUTER)
|
|
4721
5004
|
});
|
|
4722
5005
|
}
|
|
4723
|
-
return
|
|
5006
|
+
return createElement5(LinkInteractive, props);
|
|
4724
5007
|
}
|
|
4725
5008
|
export {
|
|
4726
5009
|
CLIENT_FALLBACK_ROUTER,
|