inital commit

This commit is contained in:
2026-01-01 15:25:19 +05:30
commit f0ae49465a
36361 changed files with 4894111 additions and 0 deletions

View File

@@ -0,0 +1,29 @@
'use client';
import { jsx as _jsx } from "react/jsx-runtime";
import { Suspense, use } from 'react';
export const AsyncMetadata = typeof window === 'undefined' ? require('./server-inserted-metadata').ServerInsertMetadata : require('./browser-resolved-metadata').BrowserResolvedMetadata;
function MetadataOutlet(param) {
let { promise } = param;
const { error, digest } = use(promise);
if (error) {
if (digest) {
// The error will lose its original digest after passing from server layer to client layer
// We recover the digest property here to override the React created one if original digest exists.
;
error.digest = digest;
}
throw error;
}
return null;
}
export function AsyncMetadataOutlet(param) {
let { promise } = param;
return /*#__PURE__*/ _jsx(Suspense, {
fallback: null,
children: /*#__PURE__*/ _jsx(MetadataOutlet, {
promise: promise
})
});
}
//# sourceMappingURL=async-metadata.js.map

View File

@@ -0,0 +1 @@
{"version":3,"sources":["../../../../src/client/components/metadata/async-metadata.tsx"],"sourcesContent":["'use client'\n\nimport { Suspense, use } from 'react'\nimport type { StreamingMetadataResolvedState } from './types'\n\nexport const AsyncMetadata =\n typeof window === 'undefined'\n ? (\n require('./server-inserted-metadata') as typeof import('./server-inserted-metadata')\n ).ServerInsertMetadata\n : (\n require('./browser-resolved-metadata') as typeof import('./browser-resolved-metadata')\n ).BrowserResolvedMetadata\n\nfunction MetadataOutlet({\n promise,\n}: {\n promise: Promise<StreamingMetadataResolvedState>\n}) {\n const { error, digest } = use(promise)\n if (error) {\n if (digest) {\n // The error will lose its original digest after passing from server layer to client layer\n // We recover the digest property here to override the React created one if original digest exists.\n ;(error as any).digest = digest\n }\n throw error\n }\n return null\n}\n\nexport function AsyncMetadataOutlet({\n promise,\n}: {\n promise: Promise<StreamingMetadataResolvedState>\n}) {\n return (\n <Suspense fallback={null}>\n <MetadataOutlet promise={promise} />\n </Suspense>\n )\n}\n"],"names":["Suspense","use","AsyncMetadata","window","require","ServerInsertMetadata","BrowserResolvedMetadata","MetadataOutlet","promise","error","digest","AsyncMetadataOutlet","fallback"],"mappings":"AAAA;;AAEA,SAASA,QAAQ,EAAEC,GAAG,QAAQ,QAAO;AAGrC,OAAO,MAAMC,gBACX,OAAOC,WAAW,cACd,AACEC,QAAQ,8BACRC,oBAAoB,GACtB,AACED,QAAQ,+BACRE,uBAAuB,CAAA;AAE/B,SAASC,eAAe,KAIvB;IAJuB,IAAA,EACtBC,OAAO,EAGR,GAJuB;IAKtB,MAAM,EAAEC,KAAK,EAAEC,MAAM,EAAE,GAAGT,IAAIO;IAC9B,IAAIC,OAAO;QACT,IAAIC,QAAQ;YACV,2FAA2F;YAC3F,mGAAmG;;YACjGD,MAAcC,MAAM,GAAGA;QAC3B;QACA,MAAMD;IACR;IACA,OAAO;AACT;AAEA,OAAO,SAASE,oBAAoB,KAInC;IAJmC,IAAA,EAClCH,OAAO,EAGR,GAJmC;IAKlC,qBACE,KAACR;QAASY,UAAU;kBAClB,cAAA,KAACL;YAAeC,SAASA;;;AAG/B"}

View File

@@ -0,0 +1,11 @@
import { use } from 'react';
export function BrowserResolvedMetadata(param) {
let { promise } = param;
const { metadata, error } = use(promise);
// If there's metadata error on client, discard the browser metadata
// and let metadata outlet deal with the error. This will avoid the duplication metadata.
if (error) return null;
return metadata;
}
//# sourceMappingURL=browser-resolved-metadata.js.map

View File

@@ -0,0 +1 @@
{"version":3,"sources":["../../../../src/client/components/metadata/browser-resolved-metadata.tsx"],"sourcesContent":["import { use } from 'react'\nimport type { StreamingMetadataResolvedState } from './types'\n\nexport function BrowserResolvedMetadata({\n promise,\n}: {\n promise: Promise<StreamingMetadataResolvedState>\n}) {\n const { metadata, error } = use(promise)\n // If there's metadata error on client, discard the browser metadata\n // and let metadata outlet deal with the error. This will avoid the duplication metadata.\n if (error) return null\n return metadata\n}\n"],"names":["use","BrowserResolvedMetadata","promise","metadata","error"],"mappings":"AAAA,SAASA,GAAG,QAAQ,QAAO;AAG3B,OAAO,SAASC,wBAAwB,KAIvC;IAJuC,IAAA,EACtCC,OAAO,EAGR,GAJuC;IAKtC,MAAM,EAAEC,QAAQ,EAAEC,KAAK,EAAE,GAAGJ,IAAIE;IAChC,oEAAoE;IACpE,yFAAyF;IACzF,IAAIE,OAAO,OAAO;IAClB,OAAOD;AACT"}

View File

@@ -0,0 +1,29 @@
'use client';
import { METADATA_BOUNDARY_NAME, VIEWPORT_BOUNDARY_NAME, OUTLET_BOUNDARY_NAME } from '../../../lib/metadata/metadata-constants';
// We use a namespace object to allow us to recover the name of the function
// at runtime even when production bundling/minification is used.
const NameSpace = {
[METADATA_BOUNDARY_NAME]: function(param) {
let { children } = param;
return children;
},
[VIEWPORT_BOUNDARY_NAME]: function(param) {
let { children } = param;
return children;
},
[OUTLET_BOUNDARY_NAME]: function(param) {
let { children } = param;
return children;
}
};
export const MetadataBoundary = // We use slice(0) to trick the bundler into not inlining/minifying the function
// so it retains the name inferred from the namespace object
NameSpace[METADATA_BOUNDARY_NAME.slice(0)];
export const ViewportBoundary = // We use slice(0) to trick the bundler into not inlining/minifying the function
// so it retains the name inferred from the namespace object
NameSpace[VIEWPORT_BOUNDARY_NAME.slice(0)];
export const OutletBoundary = // We use slice(0) to trick the bundler into not inlining/minifying the function
// so it retains the name inferred from the namespace object
NameSpace[OUTLET_BOUNDARY_NAME.slice(0)];
//# sourceMappingURL=metadata-boundary.js.map

View File

@@ -0,0 +1 @@
{"version":3,"sources":["../../../../src/client/components/metadata/metadata-boundary.tsx"],"sourcesContent":["'use client'\n\nimport {\n METADATA_BOUNDARY_NAME,\n VIEWPORT_BOUNDARY_NAME,\n OUTLET_BOUNDARY_NAME,\n} from '../../../lib/metadata/metadata-constants'\n\n// We use a namespace object to allow us to recover the name of the function\n// at runtime even when production bundling/minification is used.\nconst NameSpace = {\n [METADATA_BOUNDARY_NAME]: function ({\n children,\n }: {\n children: React.ReactNode\n }) {\n return children\n },\n [VIEWPORT_BOUNDARY_NAME]: function ({\n children,\n }: {\n children: React.ReactNode\n }) {\n return children\n },\n [OUTLET_BOUNDARY_NAME]: function ({\n children,\n }: {\n children: React.ReactNode\n }) {\n return children\n },\n}\n\nexport const MetadataBoundary =\n // We use slice(0) to trick the bundler into not inlining/minifying the function\n // so it retains the name inferred from the namespace object\n NameSpace[METADATA_BOUNDARY_NAME.slice(0) as typeof METADATA_BOUNDARY_NAME]\n\nexport const ViewportBoundary =\n // We use slice(0) to trick the bundler into not inlining/minifying the function\n // so it retains the name inferred from the namespace object\n NameSpace[VIEWPORT_BOUNDARY_NAME.slice(0) as typeof VIEWPORT_BOUNDARY_NAME]\n\nexport const OutletBoundary =\n // We use slice(0) to trick the bundler into not inlining/minifying the function\n // so it retains the name inferred from the namespace object\n NameSpace[OUTLET_BOUNDARY_NAME.slice(0) as typeof OUTLET_BOUNDARY_NAME]\n"],"names":["METADATA_BOUNDARY_NAME","VIEWPORT_BOUNDARY_NAME","OUTLET_BOUNDARY_NAME","NameSpace","children","MetadataBoundary","slice","ViewportBoundary","OutletBoundary"],"mappings":"AAAA;AAEA,SACEA,sBAAsB,EACtBC,sBAAsB,EACtBC,oBAAoB,QACf,2CAA0C;AAEjD,4EAA4E;AAC5E,iEAAiE;AACjE,MAAMC,YAAY;IAChB,CAACH,uBAAuB,EAAE,SAAU,KAInC;QAJmC,IAAA,EAClCI,QAAQ,EAGT,GAJmC;QAKlC,OAAOA;IACT;IACA,CAACH,uBAAuB,EAAE,SAAU,KAInC;QAJmC,IAAA,EAClCG,QAAQ,EAGT,GAJmC;QAKlC,OAAOA;IACT;IACA,CAACF,qBAAqB,EAAE,SAAU,KAIjC;QAJiC,IAAA,EAChCE,QAAQ,EAGT,GAJiC;QAKhC,OAAOA;IACT;AACF;AAEA,OAAO,MAAMC,mBACX,gFAAgF;AAChF,4DAA4D;AAC5DF,SAAS,CAACH,uBAAuBM,KAAK,CAAC,GAAoC,CAAA;AAE7E,OAAO,MAAMC,mBACX,gFAAgF;AAChF,4DAA4D;AAC5DJ,SAAS,CAACF,uBAAuBK,KAAK,CAAC,GAAoC,CAAA;AAE7E,OAAO,MAAME,iBACX,gFAAgF;AAChF,4DAA4D;AAC5DL,SAAS,CAACD,qBAAqBI,KAAK,CAAC,GAAkC,CAAA"}

View File

@@ -0,0 +1,20 @@
import { use, useContext } from 'react';
import { ServerInsertedMetadataContext } from '../../../shared/lib/server-inserted-metadata.shared-runtime';
// Receives a metadata resolver setter from the context, and will pass the metadata resolving promise to
// the context where we gonna use it to resolve the metadata, and render as string to append in <body>.
const useServerInsertedMetadata = (metadataResolver)=>{
const setMetadataResolver = useContext(ServerInsertedMetadataContext);
if (setMetadataResolver) {
setMetadataResolver(metadataResolver);
}
};
export function ServerInsertMetadata(param) {
let { promise } = param;
// Apply use() to the metadata promise to suspend the rendering in SSR.
const { metadata } = use(promise);
// Insert metadata into the HTML stream through the `useServerInsertedMetadata`
useServerInsertedMetadata(()=>metadata);
return null;
}
//# sourceMappingURL=server-inserted-metadata.js.map

View File

@@ -0,0 +1 @@
{"version":3,"sources":["../../../../src/client/components/metadata/server-inserted-metadata.tsx"],"sourcesContent":["import { use, useContext } from 'react'\nimport {\n type MetadataResolver,\n ServerInsertedMetadataContext,\n} from '../../../shared/lib/server-inserted-metadata.shared-runtime'\nimport type { StreamingMetadataResolvedState } from './types'\n\n// Receives a metadata resolver setter from the context, and will pass the metadata resolving promise to\n// the context where we gonna use it to resolve the metadata, and render as string to append in <body>.\nconst useServerInsertedMetadata = (metadataResolver: MetadataResolver) => {\n const setMetadataResolver = useContext(ServerInsertedMetadataContext)\n\n if (setMetadataResolver) {\n setMetadataResolver(metadataResolver)\n }\n}\n\nexport function ServerInsertMetadata({\n promise,\n}: {\n promise: Promise<StreamingMetadataResolvedState>\n}) {\n // Apply use() to the metadata promise to suspend the rendering in SSR.\n const { metadata } = use(promise)\n // Insert metadata into the HTML stream through the `useServerInsertedMetadata`\n useServerInsertedMetadata(() => metadata)\n\n return null\n}\n"],"names":["use","useContext","ServerInsertedMetadataContext","useServerInsertedMetadata","metadataResolver","setMetadataResolver","ServerInsertMetadata","promise","metadata"],"mappings":"AAAA,SAASA,GAAG,EAAEC,UAAU,QAAQ,QAAO;AACvC,SAEEC,6BAA6B,QACxB,8DAA6D;AAGpE,wGAAwG;AACxG,uGAAuG;AACvG,MAAMC,4BAA4B,CAACC;IACjC,MAAMC,sBAAsBJ,WAAWC;IAEvC,IAAIG,qBAAqB;QACvBA,oBAAoBD;IACtB;AACF;AAEA,OAAO,SAASE,qBAAqB,KAIpC;IAJoC,IAAA,EACnCC,OAAO,EAGR,GAJoC;IAKnC,uEAAuE;IACvE,MAAM,EAAEC,QAAQ,EAAE,GAAGR,IAAIO;IACzB,+EAA+E;IAC/EJ,0BAA0B,IAAMK;IAEhC,OAAO;AACT"}

View File

@@ -0,0 +1,3 @@
export { };
//# sourceMappingURL=types.js.map

View File

@@ -0,0 +1 @@
{"version":3,"sources":["../../../../src/client/components/metadata/types.ts"],"sourcesContent":["export type StreamingMetadataResolvedState = {\n metadata: React.ReactNode\n error: unknown | null\n digest: string | undefined\n}\n"],"names":[],"mappings":"AAAA,WAIC"}