@absolutejs/absolute 0.19.0-beta.360 → 0.19.0-beta.362

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.
@@ -86,44 +86,13 @@ import { defineComponent as defineComponent2, h as h2 } from "vue";
86
86
  // src/vue/components/StreamSlot.ts
87
87
  import { defineComponent, h } from "vue";
88
88
 
89
- // src/core/streamingSlotRegistry.ts
90
- var asyncLocalStorage;
91
- var isServerRuntime = () => typeof process !== "undefined" && typeof process.versions?.node === "string";
92
- var ensureAsyncLocalStorage = async () => {
93
- if (typeof asyncLocalStorage !== "undefined")
94
- return asyncLocalStorage;
95
- if (!isServerRuntime()) {
96
- asyncLocalStorage = null;
97
- return asyncLocalStorage;
98
- }
99
- const mod = await import("async_hooks");
100
- asyncLocalStorage = new mod.AsyncLocalStorage;
101
- return asyncLocalStorage;
89
+ // src/core/streamingSlotRegistrar.ts
90
+ var registrar = null;
91
+ var setStreamingSlotRegistrar = (nextRegistrar) => {
92
+ registrar = nextRegistrar;
102
93
  };
103
94
  var registerStreamingSlot = (slot) => {
104
- if (!asyncLocalStorage)
105
- return;
106
- const store = asyncLocalStorage.getStore();
107
- if (!store)
108
- return;
109
- store.set(slot.id, slot);
110
- };
111
- var runWithStreamingSlotRegistry = async (task) => {
112
- const storage = await ensureAsyncLocalStorage();
113
- if (!storage) {
114
- return {
115
- result: await task(),
116
- slots: []
117
- };
118
- }
119
- return storage.run(new Map, async () => {
120
- const result = await task();
121
- const store = storage.getStore();
122
- return {
123
- result,
124
- slots: store ? [...store.values()] : []
125
- };
126
- });
95
+ registrar?.(slot);
127
96
  };
128
97
 
129
98
  // src/vue/components/StreamSlot.ts
@@ -183,5 +152,5 @@ export {
183
152
  Image_default as Image
184
153
  };
185
154
 
186
- //# debugId=21B5124273DC576164756E2164756E21
155
+ //# debugId=57F325425F6054AD64756E2164756E21
187
156
  //# sourceMappingURL=index.js.map
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "version": 3,
3
- "sources": ["../src/vue/components/SuspenseSlot.ts", "../src/vue/components/StreamSlot.ts", "../src/core/streamingSlotRegistry.ts"],
3
+ "sources": ["../src/vue/components/SuspenseSlot.ts", "../src/vue/components/StreamSlot.ts", "../src/core/streamingSlotRegistrar.ts"],
4
4
  "sourcesContent": [
5
5
  "import { defineComponent, h, type PropType } from 'vue';\nimport { StreamSlot } from './StreamSlot';\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\tresolve: {\n\t\t\trequired: true,\n\t\t\ttype: Function as PropType<() => Promise<string> | string>\n\t\t},\n\t\ttimeoutMs: { default: undefined, type: Number }\n\t},\n\tsetup(props) {\n\t\treturn () => h(StreamSlot, props);\n\t}\n});\n",
6
- "import { defineComponent, h, type PropType } from 'vue';\nimport { registerStreamingSlot } from '../../core/streamingSlotRegistry';\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 as PropType<() => Promise<string> | string>\n\t\t},\n\t\ttimeoutMs: { default: undefined, type: Number }\n\t},\n\tsetup(props) {\n\t\tif (typeof window === '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: `slot-${props.id}`,\n\t\t\t\tinnerHTML: props.fallbackHtml\n\t\t\t});\n\t}\n});\n",
7
- "import type { StreamingSlot } from '../utils/streamingSlots';\n\ntype SlotStore = Map<string, StreamingSlot>;\ntype AsyncLocalStorageType =\n\timport('node:async_hooks').AsyncLocalStorage<SlotStore>;\n\nlet asyncLocalStorage: AsyncLocalStorageType | null | undefined;\n\nconst isServerRuntime = () =>\n\ttypeof process !== 'undefined' &&\n\ttypeof process.versions?.node === 'string';\n\nconst ensureAsyncLocalStorage = async () => {\n\tif (typeof asyncLocalStorage !== 'undefined') return asyncLocalStorage;\n\tif (!isServerRuntime()) {\n\t\tasyncLocalStorage = null;\n\n\t\treturn asyncLocalStorage;\n\t}\n\n\tconst mod = await import('node:async_hooks');\n\tasyncLocalStorage = new mod.AsyncLocalStorage<SlotStore>();\n\n\treturn asyncLocalStorage;\n};\n\nexport const registerStreamingSlot = (slot: StreamingSlot) => {\n\tif (!asyncLocalStorage) return;\n\tconst store = asyncLocalStorage.getStore();\n\tif (!store) return;\n\tstore.set(slot.id, slot);\n};\n\nexport const runWithStreamingSlotRegistry = async <T>(\n\ttask: () => Promise<T> | T\n) => {\n\tconst storage = await ensureAsyncLocalStorage();\n\tif (!storage) {\n\t\treturn {\n\t\t\tresult: await task(),\n\t\t\tslots: [] as StreamingSlot[]\n\t\t};\n\t}\n\n\treturn storage.run(new Map<string, StreamingSlot>(), async () => {\n\t\tconst result = await task();\n\t\tconst store = storage.getStore();\n\n\t\treturn {\n\t\t\tresult,\n\t\t\tslots: store ? [...store.values()] : []\n\t\t};\n\t});\n};\n"
6
+ "import { defineComponent, h, type PropType } from 'vue';\nimport { registerStreamingSlot } from '../../core/streamingSlotRegistrar';\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 as PropType<() => Promise<string> | string>\n\t\t},\n\t\ttimeoutMs: { default: undefined, type: Number }\n\t},\n\tsetup(props) {\n\t\tif (typeof window === '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: `slot-${props.id}`,\n\t\t\t\tinnerHTML: props.fallbackHtml\n\t\t\t});\n\t}\n});\n",
7
+ "import type { StreamingSlot } from '../utils/streamingSlots';\n\ntype StreamingSlotRegistrar = (slot: StreamingSlot) => void;\n\nlet registrar: StreamingSlotRegistrar | null = null;\n\nexport const setStreamingSlotRegistrar = (\n\tnextRegistrar: StreamingSlotRegistrar | null\n) => {\n\tregistrar = nextRegistrar;\n};\n\nexport const registerStreamingSlot = (slot: StreamingSlot) => {\n\tregistrar?.(slot);\n};\n"
8
8
  ],
9
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,4BAAS,uBAAiB;;;ACA1B;;;ACMA,IAAI;AAEJ,IAAM,kBAAkB,MACvB,OAAO,YAAY,eACnB,OAAO,QAAQ,UAAU,SAAS;AAEnC,IAAM,0BAA0B,YAAY;AAAA,EAC3C,IAAI,OAAO,sBAAsB;AAAA,IAAa,OAAO;AAAA,EACrD,IAAI,CAAC,gBAAgB,GAAG;AAAA,IACvB,oBAAoB;AAAA,IAEpB,OAAO;AAAA,EACR;AAAA,EAEA,MAAM,MAAM,MAAa;AAAA,EACzB,oBAAoB,IAAI,IAAI;AAAA,EAE5B,OAAO;AAAA;AAGD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MAAM,OAAO;AAAA,IACnC,SAAS;AAAA,MACR,UAAU;AAAA,MACV,MAAM;AAAA,IACP;AAAA,IACA,WAAW,EAAE,SAAS,WAAW,MAAM,OAAO;AAAA,EAC/C;AAAA,EACA,KAAK,CAAC,OAAO;AAAA,IACZ,IAAI,OAAO,WAAW,aAAa;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,EAAE,OAAO;AAAA,MACR,OAAO,MAAM;AAAA,MACb,sBAAsB;AAAA,MACtB,IAAI,QAAQ,MAAM;AAAA,MAClB,WAAW,MAAM;AAAA,IAClB,CAAC;AAAA;AAEJ,CAAC;;;ADhCM,IAAM,eAAe,iBAAgB;AAAA,EAC3C,MAAM;AAAA,EACN,OAAO;AAAA,IACN,WAAW,EAAE,SAAS,WAAW,MAAM,OAAO;AAAA,IAC9C,WAAW,EAAE,SAAS,WAAW,MAAM,OAAO;AAAA,IAC9C,cAAc,EAAE,SAAS,IAAI,MAAM,OAAO;AAAA,IAC1C,IAAI,EAAE,UAAU,MAAM,MAAM,OAAO;AAAA,IACnC,SAAS;AAAA,MACR,UAAU;AAAA,MACV,MAAM;AAAA,IACP;AAAA,IACA,WAAW,EAAE,SAAS,WAAW,MAAM,OAAO;AAAA,EAC/C;AAAA,EACA,KAAK,CAAC,OAAO;AAAA,IACZ,OAAO,MAAM,GAAE,YAAY,KAAK;AAAA;AAElC,CAAC;",
10
+ "debugId": "57F325425F6054AD64756E2164756E21",
11
11
  "names": []
12
12
  }
package/dist/vue/index.js CHANGED
@@ -1575,44 +1575,13 @@ import { defineComponent as defineComponent2, h as h2 } from "vue";
1575
1575
  // src/vue/components/StreamSlot.ts
1576
1576
  import { defineComponent, h } from "vue";
1577
1577
 
1578
- // src/core/streamingSlotRegistry.ts
1579
- var asyncLocalStorage;
1580
- var isServerRuntime = () => typeof process !== "undefined" && typeof process.versions?.node === "string";
1581
- var ensureAsyncLocalStorage = async () => {
1582
- if (typeof asyncLocalStorage !== "undefined")
1583
- return asyncLocalStorage;
1584
- if (!isServerRuntime()) {
1585
- asyncLocalStorage = null;
1586
- return asyncLocalStorage;
1587
- }
1588
- const mod = await import("async_hooks");
1589
- asyncLocalStorage = new mod.AsyncLocalStorage;
1590
- return asyncLocalStorage;
1578
+ // src/core/streamingSlotRegistrar.ts
1579
+ var registrar = null;
1580
+ var setStreamingSlotRegistrar = (nextRegistrar) => {
1581
+ registrar = nextRegistrar;
1591
1582
  };
1592
1583
  var registerStreamingSlot = (slot) => {
1593
- if (!asyncLocalStorage)
1594
- return;
1595
- const store = asyncLocalStorage.getStore();
1596
- if (!store)
1597
- return;
1598
- store.set(slot.id, slot);
1599
- };
1600
- var runWithStreamingSlotRegistry = async (task) => {
1601
- const storage = await ensureAsyncLocalStorage();
1602
- if (!storage) {
1603
- return {
1604
- result: await task(),
1605
- slots: []
1606
- };
1607
- }
1608
- return storage.run(new Map, async () => {
1609
- const result = await task();
1610
- const store = storage.getStore();
1611
- return {
1612
- result,
1613
- slots: store ? [...store.values()] : []
1614
- };
1615
- });
1584
+ registrar?.(slot);
1616
1585
  };
1617
1586
 
1618
1587
  // src/vue/components/StreamSlot.ts
@@ -2155,6 +2124,47 @@ var appendStreamingSlotPatchesToStream = (stream, slots = [], {
2155
2124
  });
2156
2125
  };
2157
2126
 
2127
+ // src/core/streamingSlotRegistry.ts
2128
+ var asyncLocalStorage;
2129
+ var isServerRuntime = () => typeof process !== "undefined" && typeof process.versions?.node === "string";
2130
+ var ensureAsyncLocalStorage = async () => {
2131
+ if (typeof asyncLocalStorage !== "undefined")
2132
+ return asyncLocalStorage;
2133
+ if (!isServerRuntime()) {
2134
+ asyncLocalStorage = null;
2135
+ return asyncLocalStorage;
2136
+ }
2137
+ const mod = await import("async_hooks");
2138
+ asyncLocalStorage = new mod.AsyncLocalStorage;
2139
+ return asyncLocalStorage;
2140
+ };
2141
+ var registerStreamingSlot2 = (slot) => {
2142
+ if (!asyncLocalStorage)
2143
+ return;
2144
+ const store = asyncLocalStorage.getStore();
2145
+ if (!store)
2146
+ return;
2147
+ store.set(slot.id, slot);
2148
+ };
2149
+ setStreamingSlotRegistrar(registerStreamingSlot2);
2150
+ var runWithStreamingSlotRegistry = async (task) => {
2151
+ const storage = await ensureAsyncLocalStorage();
2152
+ if (!storage) {
2153
+ return {
2154
+ result: await task(),
2155
+ slots: []
2156
+ };
2157
+ }
2158
+ return storage.run(new Map, async () => {
2159
+ const result = await task();
2160
+ const store = storage.getStore();
2161
+ return {
2162
+ result,
2163
+ slots: store ? [...store.values()] : []
2164
+ };
2165
+ });
2166
+ };
2167
+
2158
2168
  // src/core/responseEnhancers.ts
2159
2169
  var toResponse = async (responseLike) => await responseLike;
2160
2170
  var cloneHeaders = (response) => {
@@ -2519,5 +2529,5 @@ export {
2519
2529
  Image_default as Image
2520
2530
  };
2521
2531
 
2522
- //# debugId=F7A7CCEBEBF2E66A64756E2164756E21
2532
+ //# debugId=8F79CE2746C9940964756E2164756E21
2523
2533
  //# sourceMappingURL=index.js.map