@absolutejs/absolute 0.19.0-beta.453 → 0.19.0-beta.455
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/ai/index.js +19 -6
- package/dist/ai/index.js.map +4 -4
- package/dist/build.js +14 -2
- package/dist/build.js.map +3 -3
- package/dist/cli/index.js +24 -24
- package/dist/index.js +14 -2
- package/dist/index.js.map +4 -4
- package/dist/src/ai/rag/chat.d.ts +5 -0
- package/dist/src/core/prepare.d.ts +10 -1
- package/dist/types/ai.d.ts +7 -0
- package/dist/vue/components/index.js +7 -5
- package/dist/vue/components/index.js.map +4 -4
- package/dist/vue/index.js +20 -6
- package/dist/vue/index.js.map +5 -5
- package/dist/vue/server.js +14 -2
- package/dist/vue/server.js.map +3 -3
- package/package.json +7 -7
|
@@ -54,6 +54,11 @@ export declare const ragChat: (config: RAGChatPluginConfig) => Elysia<"", {
|
|
|
54
54
|
response: {
|
|
55
55
|
200: Response | {
|
|
56
56
|
capabilities: import("./types").RAGBackendCapabilities | undefined;
|
|
57
|
+
documents: {
|
|
58
|
+
byKind: Record<string, number>;
|
|
59
|
+
chunkCount: number;
|
|
60
|
+
total: number;
|
|
61
|
+
} | undefined;
|
|
57
62
|
ok: boolean;
|
|
58
63
|
status: import("./types").RAGVectorStoreStatus | undefined;
|
|
59
64
|
};
|
|
@@ -1,4 +1,13 @@
|
|
|
1
|
+
import type { AnyElysia, Elysia } from 'elysia';
|
|
1
2
|
export declare const prepare: (configOrPath?: string) => Promise<{
|
|
2
3
|
manifest: Record<string, string>;
|
|
3
|
-
absolutejs: (app:
|
|
4
|
+
absolutejs: <App extends AnyElysia>(app: App) => Elysia<any, any, any, any, any, any, {
|
|
5
|
+
derive: any;
|
|
6
|
+
resolve: any;
|
|
7
|
+
schema: any;
|
|
8
|
+
standaloneSchema: any;
|
|
9
|
+
response: {
|
|
10
|
+
200: Response;
|
|
11
|
+
};
|
|
12
|
+
}>;
|
|
4
13
|
}>;
|
package/dist/types/ai.d.ts
CHANGED
|
@@ -221,10 +221,16 @@ export type RAGIngestResponse = {
|
|
|
221
221
|
documentCount?: number;
|
|
222
222
|
error?: string;
|
|
223
223
|
};
|
|
224
|
+
export type RAGDocumentSummary = {
|
|
225
|
+
total: number;
|
|
226
|
+
chunkCount: number;
|
|
227
|
+
byKind: Record<string, number>;
|
|
228
|
+
};
|
|
224
229
|
export type RAGStatusResponse = {
|
|
225
230
|
ok: true;
|
|
226
231
|
status?: RAGVectorStoreStatus;
|
|
227
232
|
capabilities?: RAGBackendCapabilities;
|
|
233
|
+
documents?: RAGDocumentSummary;
|
|
228
234
|
};
|
|
229
235
|
export type RAGDocumentsResponse = {
|
|
230
236
|
ok: true;
|
|
@@ -594,6 +600,7 @@ export type RAGHTMXWorkflowRenderConfig = {
|
|
|
594
600
|
status?: (input: {
|
|
595
601
|
status?: RAGVectorStoreStatus;
|
|
596
602
|
capabilities?: RAGBackendCapabilities;
|
|
603
|
+
documents?: RAGDocumentSummary;
|
|
597
604
|
}) => string;
|
|
598
605
|
searchResults?: (input: {
|
|
599
606
|
query: string;
|
|
@@ -104,7 +104,8 @@ import {
|
|
|
104
104
|
isVNode,
|
|
105
105
|
onMounted,
|
|
106
106
|
onBeforeUnmount,
|
|
107
|
-
ref
|
|
107
|
+
ref,
|
|
108
|
+
useSSRContext
|
|
108
109
|
} from "vue";
|
|
109
110
|
var renderVueNodesToHtml = async (nodes) => {
|
|
110
111
|
const { createSSRApp, h: createVNode } = await import("vue");
|
|
@@ -208,7 +209,8 @@ var SuspenseSlot = defineComponent({
|
|
|
208
209
|
const hasError = ref(false);
|
|
209
210
|
const hasPatchedDom = ref(readPatchedDomState());
|
|
210
211
|
const usesFrameworkSlots = hasFrameworkSlots(slots.default, slots.fallback, slots.error, props.promise);
|
|
211
|
-
|
|
212
|
+
const isSsrRender = useSSRContext() !== undefined;
|
|
213
|
+
if (isSsrRender) {
|
|
212
214
|
const legacyRegistration = toLegacySuspenseSlotRegistration(props);
|
|
213
215
|
if (!usesFrameworkSlots && legacyRegistration) {
|
|
214
216
|
return registerLegacySuspenseSlot(legacyRegistration);
|
|
@@ -298,7 +300,7 @@ var SuspenseSlot = defineComponent({
|
|
|
298
300
|
}
|
|
299
301
|
});
|
|
300
302
|
// src/vue/components/StreamSlot.ts
|
|
301
|
-
import { defineComponent as defineComponent2, h as h2 } from "vue";
|
|
303
|
+
import { defineComponent as defineComponent2, h as h2, useSSRContext as useSSRContext2 } from "vue";
|
|
302
304
|
var StreamSlot = defineComponent2({
|
|
303
305
|
name: "AbsoluteStreamSlot",
|
|
304
306
|
props: {
|
|
@@ -313,7 +315,7 @@ var StreamSlot = defineComponent2({
|
|
|
313
315
|
timeoutMs: { default: undefined, type: Number }
|
|
314
316
|
},
|
|
315
317
|
setup(props) {
|
|
316
|
-
if (
|
|
318
|
+
if (useSSRContext2() !== undefined) {
|
|
317
319
|
registerStreamingSlot({
|
|
318
320
|
errorHtml: props.errorHtml,
|
|
319
321
|
fallbackHtml: props.fallbackHtml,
|
|
@@ -336,5 +338,5 @@ export {
|
|
|
336
338
|
Image_default as Image
|
|
337
339
|
};
|
|
338
340
|
|
|
339
|
-
//# debugId=
|
|
341
|
+
//# debugId=1FC77558042CC44564756E2164756E21
|
|
340
342
|
//# sourceMappingURL=index.js.map
|
|
@@ -3,10 +3,10 @@
|
|
|
3
3
|
"sources": ["../src/core/streamingSlotRegistrar.ts", "../src/vue/components/SuspenseSlot.ts", "../src/vue/components/StreamSlot.ts"],
|
|
4
4
|
"sourcesContent": [
|
|
5
5
|
"import type { StreamingSlot } from '../utils/streamingSlots';\n\ntype StreamingSlotRegistrar = (slot: StreamingSlot) => void;\n\nconst STREAMING_SLOT_REGISTRAR_KEY = Symbol.for(\n\t'absolutejs.streamingSlotRegistrar'\n);\n\nconst getRegisteredStreamingSlotRegistrar = () => {\n\tconst value = Reflect.get(globalThis, STREAMING_SLOT_REGISTRAR_KEY);\n\tif (typeof value === 'function' || value === null) {\n\t\treturn value;\n\t}\n\n\treturn undefined;\n};\n\nexport const registerStreamingSlot = (slot: StreamingSlot) => {\n\tgetRegisteredStreamingSlotRegistrar()?.(slot);\n};\nexport const setStreamingSlotRegistrar = (\n\tnextRegistrar: StreamingSlotRegistrar | null\n) => {\n\tReflect.set(globalThis, STREAMING_SLOT_REGISTRAR_KEY, nextRegistrar);\n};\n",
|
|
6
|
-
"import {\n\tcloneVNode,\n\tdefineComponent,\n\th,\n\tisVNode,\n\tonMounted,\n\tonBeforeUnmount,\n\tref,\n\ttype Slot,\n\ttype VNodeChild\n} from 'vue';\nimport { registerStreamingSlot } from '../../core/streamingSlotRegistrar';\n\nconst renderVueNodesToHtml = async (nodes: VNodeChild) => {\n\tconst { createSSRApp, h: createVNode } = await import('vue');\n\tconst { renderToString } = await import('vue/server-renderer');\n\n\tconst app = createSSRApp({\n\t\trender: () => createVNode('div', undefined, nodes ?? undefined)\n\t});\n\tconst html = await renderToString(app);\n\n\treturn html.replace(/^<div>|<\\/div>$/g, '');\n};\n\nconst hasFrameworkSlots = (\n\tdefaultSlot: Slot | undefined,\n\tfallbackSlot: Slot | undefined,\n\terrorSlot: Slot | undefined,\n\tpromise: Promise<unknown> | undefined\n) =>\n\tdefaultSlot !== undefined ||\n\tfallbackSlot !== undefined ||\n\terrorSlot !== undefined ||\n\tpromise !== undefined;\n\nconst allowMismatchOnSlotNodes: (nodes: VNodeChild) => VNodeChild = (nodes) => {\n\tif (Array.isArray(nodes)) {\n\t\treturn nodes.map((node) => allowMismatchOnSlotNodes(node));\n\t}\n\tif (isVNode(nodes)) {\n\t\treturn cloneVNode(nodes, {\n\t\t\t'data-allow-mismatch': ''\n\t\t});\n\t}\n\n\treturn nodes;\n};\n\nconst resolveSuspenseValue = async (\n\tresolve: (() => Promise<unknown> | unknown) | undefined,\n\tpromise: Promise<unknown> | undefined\n) => {\n\tif (resolve !== undefined) {\n\t\treturn resolve();\n\t}\n\n\tif (promise !== undefined) {\n\t\treturn promise;\n\t}\n\n\treturn undefined;\n};\n\ntype LegacySuspenseSlotRegistration = {\n\terrorHtml?: string;\n\tfallbackHtml: string;\n\tid: string;\n\tresolve: () => Promise<string> | string;\n\ttimeoutMs?: number;\n};\n\ntype SuspenseSlotProps = {\n\tclassName?: string;\n\terrorHtml?: string;\n\tfallbackHtml: string;\n\tid: string;\n\tpromise?: Promise<unknown>;\n\tresolve?: () => Promise<unknown> | unknown;\n\ttimeoutMs?: number;\n};\n\ntype VueSuspensePayload = {\n\tkind: 'vue-suspense';\n\tstate?: unknown;\n\tvalue?: unknown;\n};\n\nconst isObjectRecord = (value: unknown): value is Record<string, unknown> =>\n\tBoolean(value) && typeof value === 'object';\n\nconst isVueSuspensePayload = (\n\tpayload: unknown\n): payload is VueSuspensePayload => {\n\tif (!isObjectRecord(payload)) {\n\t\treturn false;\n\t}\n\n\treturn payload.kind === 'vue-suspense';\n};\n\nconst hasEventDetailId = (event: Event, id: string) => {\n\tif (!(event instanceof CustomEvent)) {\n\t\treturn false;\n\t}\n\n\tconst { detail } = event;\n\tif (!detail || typeof detail !== 'object') {\n\t\treturn false;\n\t}\n\n\treturn detail.id === id;\n};\n\nconst toLegacySuspenseSlotRegistration = (\n\tprops: SuspenseSlotProps\n): LegacySuspenseSlotRegistration | null => {\n\tif (!props.resolve) {\n\t\treturn null;\n\t}\n\n\treturn {\n\t\terrorHtml: props.errorHtml,\n\t\tfallbackHtml: props.fallbackHtml,\n\t\tid: props.id,\n\t\ttimeoutMs: props.timeoutMs,\n\t\tresolve: async () => {\n\t\t\tconst resolved = await props.resolve?.();\n\n\t\t\treturn typeof resolved === 'string' ? resolved : '';\n\t\t}\n\t};\n};\n\nconst registerLegacySuspenseSlot = (props: LegacySuspenseSlotRegistration) => {\n\tregisterStreamingSlot({\n\t\terrorHtml: props.errorHtml,\n\t\tfallbackHtml: props.fallbackHtml,\n\t\tid: props.id,\n\t\tresolve: props.resolve,\n\t\ttimeoutMs: props.timeoutMs\n\t});\n};\n\nexport const SuspenseSlot = defineComponent({\n\tname: 'AbsoluteSuspenseSlot',\n\tprops: {\n\t\tclassName: { default: undefined, type: String },\n\t\terrorHtml: { default: undefined, type: String },\n\t\tfallbackHtml: { default: '', type: String },\n\t\tid: { required: true, type: String },\n\t\tpromise: {\n\t\t\tdefault: undefined,\n\t\t\ttype: Object\n\t\t},\n\t\tresolve: {\n\t\t\tdefault: undefined,\n\t\t\ttype: Function\n\t\t},\n\t\ttimeoutMs: { default: undefined, type: Number }\n\t},\n\tsetup(props: SuspenseSlotProps, { slots }) {\n\t\tconst readPatchedDomState = () => {\n\t\t\tif (typeof document === 'undefined') return false;\n\t\t\tconst slotNode = document.getElementById(props.id);\n\t\t\tif (!slotNode) return false;\n\n\t\t\treturn (\n\t\t\t\tslotNode.getAttribute('data-absolute-slot-state') === 'resolved'\n\t\t\t);\n\t\t};\n\t\tconst isResolved = ref(false);\n\t\tconst resolvedValue = ref<unknown>(undefined);\n\t\tconst hasError = ref(false);\n\t\tconst hasPatchedDom = ref(readPatchedDomState());\n\t\tconst usesFrameworkSlots = hasFrameworkSlots(\n\t\t\tslots.default,\n\t\t\tslots.fallback,\n\t\t\tslots.error,\n\t\t\tprops.promise\n\t\t);\n\n\t\tif (
|
|
7
|
-
"import { defineComponent, h } from 'vue';\nimport { registerStreamingSlot } from '../../core/streamingSlotRegistrar';\n\ntype StreamSlotProps = {\n\tclassName?: string;\n\terrorHtml?: string;\n\tfallbackHtml: string;\n\tid: string;\n\tresolve: () => Promise<string> | string;\n\ttimeoutMs?: number;\n};\n\nexport const StreamSlot = defineComponent({\n\tname: 'AbsoluteStreamSlot',\n\tprops: {\n\t\tclassName: { default: undefined, type: String },\n\t\terrorHtml: { default: undefined, type: String },\n\t\tfallbackHtml: { default: '', type: String },\n\t\tid: { required: true, type: String },\n\t\tresolve: {\n\t\t\trequired: true,\n\t\t\ttype: Function\n\t\t},\n\t\ttimeoutMs: { default: undefined, type: Number }\n\t},\n\tsetup(props: StreamSlotProps) {\n\t\tif (
|
|
6
|
+
"import {\n\tcloneVNode,\n\tdefineComponent,\n\th,\n\tisVNode,\n\tonMounted,\n\tonBeforeUnmount,\n\tref,\n\tuseSSRContext,\n\ttype Slot,\n\ttype VNodeChild\n} from 'vue';\nimport { registerStreamingSlot } from '../../core/streamingSlotRegistrar';\n\nconst renderVueNodesToHtml = async (nodes: VNodeChild) => {\n\tconst { createSSRApp, h: createVNode } = await import('vue');\n\tconst { renderToString } = await import('vue/server-renderer');\n\n\tconst app = createSSRApp({\n\t\trender: () => createVNode('div', undefined, nodes ?? undefined)\n\t});\n\tconst html = await renderToString(app);\n\n\treturn html.replace(/^<div>|<\\/div>$/g, '');\n};\n\nconst hasFrameworkSlots = (\n\tdefaultSlot: Slot | undefined,\n\tfallbackSlot: Slot | undefined,\n\terrorSlot: Slot | undefined,\n\tpromise: Promise<unknown> | undefined\n) =>\n\tdefaultSlot !== undefined ||\n\tfallbackSlot !== undefined ||\n\terrorSlot !== undefined ||\n\tpromise !== undefined;\n\nconst allowMismatchOnSlotNodes: (nodes: VNodeChild) => VNodeChild = (nodes) => {\n\tif (Array.isArray(nodes)) {\n\t\treturn nodes.map((node) => allowMismatchOnSlotNodes(node));\n\t}\n\tif (isVNode(nodes)) {\n\t\treturn cloneVNode(nodes, {\n\t\t\t'data-allow-mismatch': ''\n\t\t});\n\t}\n\n\treturn nodes;\n};\n\nconst resolveSuspenseValue = async (\n\tresolve: (() => Promise<unknown> | unknown) | undefined,\n\tpromise: Promise<unknown> | undefined\n) => {\n\tif (resolve !== undefined) {\n\t\treturn resolve();\n\t}\n\n\tif (promise !== undefined) {\n\t\treturn promise;\n\t}\n\n\treturn undefined;\n};\n\ntype LegacySuspenseSlotRegistration = {\n\terrorHtml?: string;\n\tfallbackHtml: string;\n\tid: string;\n\tresolve: () => Promise<string> | string;\n\ttimeoutMs?: number;\n};\n\ntype SuspenseSlotProps = {\n\tclassName?: string;\n\terrorHtml?: string;\n\tfallbackHtml: string;\n\tid: string;\n\tpromise?: Promise<unknown>;\n\tresolve?: () => Promise<unknown> | unknown;\n\ttimeoutMs?: number;\n};\n\ntype VueSuspensePayload = {\n\tkind: 'vue-suspense';\n\tstate?: unknown;\n\tvalue?: unknown;\n};\n\nconst isObjectRecord = (value: unknown): value is Record<string, unknown> =>\n\tBoolean(value) && typeof value === 'object';\n\nconst isVueSuspensePayload = (\n\tpayload: unknown\n): payload is VueSuspensePayload => {\n\tif (!isObjectRecord(payload)) {\n\t\treturn false;\n\t}\n\n\treturn payload.kind === 'vue-suspense';\n};\n\nconst hasEventDetailId = (event: Event, id: string) => {\n\tif (!(event instanceof CustomEvent)) {\n\t\treturn false;\n\t}\n\n\tconst { detail } = event;\n\tif (!detail || typeof detail !== 'object') {\n\t\treturn false;\n\t}\n\n\treturn detail.id === id;\n};\n\nconst toLegacySuspenseSlotRegistration = (\n\tprops: SuspenseSlotProps\n): LegacySuspenseSlotRegistration | null => {\n\tif (!props.resolve) {\n\t\treturn null;\n\t}\n\n\treturn {\n\t\terrorHtml: props.errorHtml,\n\t\tfallbackHtml: props.fallbackHtml,\n\t\tid: props.id,\n\t\ttimeoutMs: props.timeoutMs,\n\t\tresolve: async () => {\n\t\t\tconst resolved = await props.resolve?.();\n\n\t\t\treturn typeof resolved === 'string' ? resolved : '';\n\t\t}\n\t};\n};\n\nconst registerLegacySuspenseSlot = (props: LegacySuspenseSlotRegistration) => {\n\tregisterStreamingSlot({\n\t\terrorHtml: props.errorHtml,\n\t\tfallbackHtml: props.fallbackHtml,\n\t\tid: props.id,\n\t\tresolve: props.resolve,\n\t\ttimeoutMs: props.timeoutMs\n\t});\n};\n\nexport const SuspenseSlot = defineComponent({\n\tname: 'AbsoluteSuspenseSlot',\n\tprops: {\n\t\tclassName: { default: undefined, type: String },\n\t\terrorHtml: { default: undefined, type: String },\n\t\tfallbackHtml: { default: '', type: String },\n\t\tid: { required: true, type: String },\n\t\tpromise: {\n\t\t\tdefault: undefined,\n\t\t\ttype: Object\n\t\t},\n\t\tresolve: {\n\t\t\tdefault: undefined,\n\t\t\ttype: Function\n\t\t},\n\t\ttimeoutMs: { default: undefined, type: Number }\n\t},\n\tsetup(props: SuspenseSlotProps, { slots }) {\n\t\tconst readPatchedDomState = () => {\n\t\t\tif (typeof document === 'undefined') return false;\n\t\t\tconst slotNode = document.getElementById(props.id);\n\t\t\tif (!slotNode) return false;\n\n\t\t\treturn (\n\t\t\t\tslotNode.getAttribute('data-absolute-slot-state') === 'resolved'\n\t\t\t);\n\t\t};\n\t\tconst isResolved = ref(false);\n\t\tconst resolvedValue = ref<unknown>(undefined);\n\t\tconst hasError = ref(false);\n\t\tconst hasPatchedDom = ref(readPatchedDomState());\n\t\tconst usesFrameworkSlots = hasFrameworkSlots(\n\t\t\tslots.default,\n\t\t\tslots.fallback,\n\t\t\tslots.error,\n\t\t\tprops.promise\n\t\t);\n\t\tconst isSsrRender = useSSRContext() !== undefined;\n\n\t\tif (isSsrRender) {\n\t\t\tconst legacyRegistration = toLegacySuspenseSlotRegistration(props);\n\t\t\tif (!usesFrameworkSlots && legacyRegistration) {\n\t\t\t\treturn registerLegacySuspenseSlot(legacyRegistration);\n\t\t\t}\n\n\t\t\tregisterStreamingSlot({\n\t\t\t\tid: props.id,\n\t\t\t\ttimeoutMs: props.timeoutMs,\n\t\t\t\tresolve: async () => {\n\t\t\t\t\ttry {\n\t\t\t\t\t\tconst value = await resolveSuspenseValue(\n\t\t\t\t\t\t\tprops.resolve,\n\t\t\t\t\t\t\tprops.promise\n\t\t\t\t\t\t);\n\n\t\t\t\t\t\tconst nodes = allowMismatchOnSlotNodes(\n\t\t\t\t\t\t\tslots.default?.({ value }) ?? []\n\t\t\t\t\t\t);\n\t\t\t\t\t\tconst html = await renderVueNodesToHtml(nodes);\n\n\t\t\t\t\t\treturn {\n\t\t\t\t\t\t\thtml,\n\t\t\t\t\t\t\tkind: 'vue-suspense',\n\t\t\t\t\t\t\tvalue\n\t\t\t\t\t\t};\n\t\t\t\t\t} catch (error) {\n\t\t\t\t\t\tconst errorNodes = slots.error?.({ error });\n\t\t\t\t\t\tif (errorNodes !== undefined)\n\t\t\t\t\t\t\treturn renderVueNodesToHtml(\n\t\t\t\t\t\t\t\tallowMismatchOnSlotNodes(errorNodes)\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\tif (typeof props.errorHtml === 'string')\n\t\t\t\t\t\t\treturn props.errorHtml;\n\n\t\t\t\t\t\tthrow error;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t});\n\t\t}\n\n\t\tif (typeof window !== 'undefined' && usesFrameworkSlots) {\n\t\t\tconst consumers = (window.__ABS_SLOT_CONSUMERS__ =\n\t\t\t\twindow.__ABS_SLOT_CONSUMERS__ ?? {});\n\t\t\tlet runtimeReady = false;\n\t\t\tconsumers[props.id] = (payload) => {\n\t\t\t\tif (!runtimeReady) return false;\n\t\t\t\tif (!isVueSuspensePayload(payload)) {\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\t\t\t\thasError.value = payload.state === 'error';\n\t\t\t\tresolvedValue.value = payload.value;\n\t\t\t\tisResolved.value = payload.state !== 'error';\n\n\t\t\t\treturn true;\n\t\t\t};\n\t\t\tconst handlePatchedDom = (event: Event) => {\n\t\t\t\tif (hasEventDetailId(event, props.id)) {\n\t\t\t\t\thasPatchedDom.value = true;\n\t\t\t\t}\n\t\t\t};\n\t\t\tonMounted(() => {\n\t\t\t\thasPatchedDom.value = readPatchedDomState();\n\t\t\t\twindow.addEventListener(\n\t\t\t\t\t'absolutejs:slot-patch',\n\t\t\t\t\thandlePatchedDom\n\t\t\t\t);\n\t\t\t\truntimeReady = true;\n\t\t\t\twindow.__ABS_SLOT_FLUSH__?.();\n\t\t\t});\n\t\t\tonBeforeUnmount(() => {\n\t\t\t\twindow.removeEventListener(\n\t\t\t\t\t'absolutejs:slot-patch',\n\t\t\t\t\thandlePatchedDom\n\t\t\t\t);\n\t\t\t\tdelete window.__ABS_SLOT_CONSUMERS__?.[props.id];\n\t\t\t});\n\t\t}\n\n\t\tconst resolveSlotChildren = () => {\n\t\t\tif (hasPatchedDom.value) {\n\t\t\t\treturn undefined;\n\t\t\t}\n\n\t\t\tif (hasError.value) {\n\t\t\t\treturn (\n\t\t\t\t\tallowMismatchOnSlotNodes(\n\t\t\t\t\t\tslots.error?.({ error: undefined }) ??\n\t\t\t\t\t\t\tslots.fallback?.() ??\n\t\t\t\t\t\t\tundefined\n\t\t\t\t\t) ?? undefined\n\t\t\t\t);\n\t\t\t}\n\n\t\t\tif (isResolved.value) {\n\t\t\t\treturn (\n\t\t\t\t\tallowMismatchOnSlotNodes(\n\t\t\t\t\t\tslots.default?.({ value: resolvedValue.value }) ??\n\t\t\t\t\t\t\tundefined\n\t\t\t\t\t) ?? undefined\n\t\t\t\t);\n\t\t\t}\n\n\t\t\treturn allowMismatchOnSlotNodes(slots.fallback?.() ?? undefined);\n\t\t};\n\n\t\treturn () => {\n\t\t\tif (!usesFrameworkSlots) {\n\t\t\t\treturn h('div', {\n\t\t\t\t\tclass: props.className,\n\t\t\t\t\t'data-absolute-slot': 'true',\n\t\t\t\t\tid: props.id,\n\t\t\t\t\tinnerHTML: props.fallbackHtml\n\t\t\t\t});\n\t\t\t}\n\n\t\t\treturn h(\n\t\t\t\t'div',\n\t\t\t\t{\n\t\t\t\t\tclass: props.className,\n\t\t\t\t\t'data-absolute-slot': 'true',\n\t\t\t\t\t'data-allow-mismatch': '',\n\t\t\t\t\tid: props.id\n\t\t\t\t},\n\t\t\t\tresolveSlotChildren() ?? undefined\n\t\t\t);\n\t\t};\n\t}\n});\n",
|
|
7
|
+
"import { defineComponent, h, useSSRContext } from 'vue';\nimport { registerStreamingSlot } from '../../core/streamingSlotRegistrar';\n\ntype StreamSlotProps = {\n\tclassName?: string;\n\terrorHtml?: string;\n\tfallbackHtml: string;\n\tid: string;\n\tresolve: () => Promise<string> | string;\n\ttimeoutMs?: number;\n};\n\nexport const StreamSlot = defineComponent({\n\tname: 'AbsoluteStreamSlot',\n\tprops: {\n\t\tclassName: { default: undefined, type: String },\n\t\terrorHtml: { default: undefined, type: String },\n\t\tfallbackHtml: { default: '', type: String },\n\t\tid: { required: true, type: String },\n\t\tresolve: {\n\t\t\trequired: true,\n\t\t\ttype: Function\n\t\t},\n\t\ttimeoutMs: { default: undefined, type: Number }\n\t},\n\tsetup(props: StreamSlotProps) {\n\t\tif (useSSRContext() !== undefined) {\n\t\t\tregisterStreamingSlot({\n\t\t\t\terrorHtml: props.errorHtml,\n\t\t\t\tfallbackHtml: props.fallbackHtml,\n\t\t\t\tid: props.id,\n\t\t\t\tresolve: props.resolve,\n\t\t\t\ttimeoutMs: props.timeoutMs\n\t\t\t});\n\t\t}\n\n\t\treturn () =>\n\t\t\th('div', {\n\t\t\t\tclass: props.className,\n\t\t\t\t'data-absolute-slot': 'true',\n\t\t\t\tid: props.id,\n\t\t\t\tinnerHTML: props.fallbackHtml\n\t\t\t});\n\t}\n});\n"
|
|
8
8
|
],
|
|
9
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAIA,IAAM,+BAA+B,OAAO,IAC3C,mCACD;AAEA,IAAM,sCAAsC,MAAM;AAAA,EACjD,MAAM,QAAQ,QAAQ,IAAI,YAAY,4BAA4B;AAAA,EAClE,IAAI,OAAO,UAAU,cAAc,UAAU,MAAM;AAAA,IAClD,OAAO;AAAA,EACR;AAAA,EAEA;AAAA;AAGM,IAAM,wBAAwB,CAAC,SAAwB;AAAA,EAC7D,oCAAoC,IAAI,IAAI;AAAA;AAEtC,IAAM,4BAA4B,CACxC,kBACI;AAAA,EACJ,QAAQ,IAAI,YAAY,8BAA8B,aAAa;AAAA;;;;;ACvBpE;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;
|
|
10
|
-
"debugId": "
|
|
9
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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AC7B,IAAI,eAAc,MAAM,WAAW;AAAA,MAClC,sBAAsB;AAAA,QACrB,WAAW,MAAM;AAAA,QACjB,cAAc,MAAM;AAAA,QACpB,IAAI,MAAM;AAAA,QACV,SAAS,MAAM;AAAA,QACf,WAAW,MAAM;AAAA,MAClB,CAAC;AAAA,IACF;AAAA,IAEA,OAAO,MACN,GAAE,OAAO;AAAA,MACR,OAAO,MAAM;AAAA,MACb,sBAAsB;AAAA,MACtB,IAAI,MAAM;AAAA,MACV,WAAW,MAAM;AAAA,IAClB,CAAC;AAAA;AAEJ,CAAC;",
|
|
10
|
+
"debugId": "1FC77558042CC44564756E2164756E21",
|
|
11
11
|
"names": []
|
|
12
12
|
}
|
package/dist/vue/index.js
CHANGED
|
@@ -1242,6 +1242,10 @@ var ssrDirty = false, isRecord2 = (value) => typeof value === "object" && value
|
|
|
1242
1242
|
return new Response(html, {
|
|
1243
1243
|
headers: { "Content-Type": "text/html" }
|
|
1244
1244
|
});
|
|
1245
|
+
}, primeVueStream = async (stream) => {
|
|
1246
|
+
const reader = stream.getReader();
|
|
1247
|
+
const firstChunk = await reader.read();
|
|
1248
|
+
return { firstChunk, reader };
|
|
1245
1249
|
}, handleVuePageRequest = async (_PageComponent, pagePath, indexPath, headTag = "<head></head>", ...props) => {
|
|
1246
1250
|
const [maybeProps] = props;
|
|
1247
1251
|
if (ssrDirty) {
|
|
@@ -1274,12 +1278,20 @@ var ssrDirty = false, isRecord2 = (value) => typeof value === "object" && value
|
|
|
1274
1278
|
render: () => h3(resolvedPage.component, maybeProps ?? null)
|
|
1275
1279
|
});
|
|
1276
1280
|
const bodyStream = renderToWebStream(app);
|
|
1281
|
+
const { firstChunk, reader } = await primeVueStream(bodyStream);
|
|
1277
1282
|
const head = `<!DOCTYPE html><html>${headTag}<body><div id="root">`;
|
|
1278
1283
|
const tail = `</div><script>window.__INITIAL_PROPS__=${JSON.stringify(maybeProps ?? {})}</script><script type="module" src="${indexPath}"></script></body></html>`;
|
|
1279
1284
|
const stream = new ReadableStream({
|
|
1280
1285
|
start(controller) {
|
|
1281
1286
|
controller.enqueue(head);
|
|
1282
|
-
|
|
1287
|
+
if (!firstChunk.done) {
|
|
1288
|
+
controller.enqueue(firstChunk.value);
|
|
1289
|
+
}
|
|
1290
|
+
if (firstChunk.done) {
|
|
1291
|
+
controller.enqueue(tail);
|
|
1292
|
+
controller.close();
|
|
1293
|
+
return;
|
|
1294
|
+
}
|
|
1283
1295
|
const pumpLoop = () => {
|
|
1284
1296
|
reader.read().then(({ done, value }) => done ? (controller.enqueue(tail), controller.close()) : (controller.enqueue(value), pumpLoop())).catch((err) => controller.error(err));
|
|
1285
1297
|
};
|
|
@@ -2485,7 +2497,8 @@ import {
|
|
|
2485
2497
|
isVNode,
|
|
2486
2498
|
onMounted,
|
|
2487
2499
|
onBeforeUnmount,
|
|
2488
|
-
ref
|
|
2500
|
+
ref,
|
|
2501
|
+
useSSRContext
|
|
2489
2502
|
} from "vue";
|
|
2490
2503
|
var renderVueNodesToHtml = async (nodes) => {
|
|
2491
2504
|
const { createSSRApp, h: createVNode } = await import("vue");
|
|
@@ -2589,7 +2602,8 @@ var SuspenseSlot = defineComponent({
|
|
|
2589
2602
|
const hasError = ref(false);
|
|
2590
2603
|
const hasPatchedDom = ref(readPatchedDomState());
|
|
2591
2604
|
const usesFrameworkSlots = hasFrameworkSlots(slots.default, slots.fallback, slots.error, props.promise);
|
|
2592
|
-
|
|
2605
|
+
const isSsrRender = useSSRContext() !== undefined;
|
|
2606
|
+
if (isSsrRender) {
|
|
2593
2607
|
const legacyRegistration = toLegacySuspenseSlotRegistration(props);
|
|
2594
2608
|
if (!usesFrameworkSlots && legacyRegistration) {
|
|
2595
2609
|
return registerLegacySuspenseSlot(legacyRegistration);
|
|
@@ -2679,7 +2693,7 @@ var SuspenseSlot = defineComponent({
|
|
|
2679
2693
|
}
|
|
2680
2694
|
});
|
|
2681
2695
|
// src/vue/components/StreamSlot.ts
|
|
2682
|
-
import { defineComponent as defineComponent2, h as h2 } from "vue";
|
|
2696
|
+
import { defineComponent as defineComponent2, h as h2, useSSRContext as useSSRContext2 } from "vue";
|
|
2683
2697
|
var StreamSlot = defineComponent2({
|
|
2684
2698
|
name: "AbsoluteStreamSlot",
|
|
2685
2699
|
props: {
|
|
@@ -2694,7 +2708,7 @@ var StreamSlot = defineComponent2({
|
|
|
2694
2708
|
timeoutMs: { default: undefined, type: Number }
|
|
2695
2709
|
},
|
|
2696
2710
|
setup(props) {
|
|
2697
|
-
if (
|
|
2711
|
+
if (useSSRContext2() !== undefined) {
|
|
2698
2712
|
registerStreamingSlot({
|
|
2699
2713
|
errorHtml: props.errorHtml,
|
|
2700
2714
|
fallbackHtml: props.fallbackHtml,
|
|
@@ -3085,5 +3099,5 @@ export {
|
|
|
3085
3099
|
Image_default as Image
|
|
3086
3100
|
};
|
|
3087
3101
|
|
|
3088
|
-
//# debugId=
|
|
3102
|
+
//# debugId=4A4FF9D8894D072064756E2164756E21
|
|
3089
3103
|
//# sourceMappingURL=index.js.map
|