@absolutejs/absolute 0.19.0-beta.707 → 0.19.0-beta.708

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.
Files changed (61) hide show
  1. package/dist/angular/browser.js +1 -19
  2. package/dist/angular/browser.js.map +3 -3
  3. package/dist/angular/index.js +85 -28
  4. package/dist/angular/index.js.map +4 -4
  5. package/dist/angular/server.js +85 -28
  6. package/dist/angular/server.js.map +4 -4
  7. package/dist/build.js +224 -137
  8. package/dist/build.js.map +10 -10
  9. package/dist/cli/index.js +44 -25
  10. package/dist/client/index.js +85 -28
  11. package/dist/client/index.js.map +4 -4
  12. package/dist/core/streamingSlotRegistrar.js +1 -19
  13. package/dist/core/streamingSlotRegistrar.js.map +2 -2
  14. package/dist/core/streamingSlotRegistry.js +1 -19
  15. package/dist/core/streamingSlotRegistry.js.map +2 -2
  16. package/dist/dev/client/handlers/angular.ts +41 -35
  17. package/dist/dev/client/handlers/angularRuntime.ts +8 -3
  18. package/dist/dev/client/hmrClient.ts +1 -1
  19. package/dist/dev/client/reactRefreshSetup.ts +0 -1
  20. package/dist/index.js +254 -155
  21. package/dist/index.js.map +13 -13
  22. package/dist/islands/browser.js +1 -19
  23. package/dist/islands/browser.js.map +2 -2
  24. package/dist/islands/index.js +75 -19
  25. package/dist/islands/index.js.map +3 -3
  26. package/dist/react/browser.js +1 -19
  27. package/dist/react/browser.js.map +2 -2
  28. package/dist/react/components/index.js +1 -19
  29. package/dist/react/components/index.js.map +3 -3
  30. package/dist/react/hooks/index.js +1 -19
  31. package/dist/react/hooks/index.js.map +2 -2
  32. package/dist/react/index.js +85 -28
  33. package/dist/react/index.js.map +4 -4
  34. package/dist/react/jsxDevRuntimeCompat.js +1 -19
  35. package/dist/react/jsxDevRuntimeCompat.js.map +2 -2
  36. package/dist/react/server.js +11 -28
  37. package/dist/react/server.js.map +3 -3
  38. package/dist/src/client/streamSwap.d.ts +0 -10
  39. package/dist/src/dev/rebuildTrigger.d.ts +1 -1
  40. package/dist/src/svelte/renderToPipeableStream.d.ts +2 -2
  41. package/dist/src/svelte/renderToReadableStream.d.ts +2 -2
  42. package/dist/src/svelte/renderToString.d.ts +2 -2
  43. package/dist/src/vue/components/Image.d.ts +3 -3
  44. package/dist/svelte/browser.js +1 -19
  45. package/dist/svelte/browser.js.map +2 -2
  46. package/dist/svelte/index.js +87 -29
  47. package/dist/svelte/index.js.map +5 -5
  48. package/dist/svelte/server.js +13 -29
  49. package/dist/svelte/server.js.map +4 -4
  50. package/dist/types/globals.d.ts +10 -2
  51. package/dist/vue/browser.js +1 -19
  52. package/dist/vue/browser.js.map +2 -2
  53. package/dist/vue/components/Image.js +1 -19
  54. package/dist/vue/components/Image.js.map +3 -3
  55. package/dist/vue/components/index.js +1 -19
  56. package/dist/vue/components/index.js.map +3 -3
  57. package/dist/vue/index.js +85 -28
  58. package/dist/vue/index.js.map +5 -5
  59. package/dist/vue/server.js +11 -28
  60. package/dist/vue/server.js.map +3 -3
  61. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -3,7 +3,6 @@ var __create = Object.create;
3
3
  var __getProtoOf = Object.getPrototypeOf;
4
4
  var __defProp = Object.defineProperty;
5
5
  var __getOwnPropNames = Object.getOwnPropertyNames;
6
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
7
6
  var __hasOwnProp = Object.prototype.hasOwnProperty;
8
7
  function __accessProp(key) {
9
8
  return this[key];
@@ -30,23 +29,6 @@ var __toESM = (mod, isNodeMode, target) => {
30
29
  cache.set(mod, to);
31
30
  return to;
32
31
  };
33
- var __toCommonJS = (from) => {
34
- var entry = (__moduleCache ??= new WeakMap).get(from), desc;
35
- if (entry)
36
- return entry;
37
- entry = __defProp({}, "__esModule", { value: true });
38
- if (from && typeof from === "object" || typeof from === "function") {
39
- for (var key of __getOwnPropNames(from))
40
- if (!__hasOwnProp.call(entry, key))
41
- __defProp(entry, key, {
42
- get: __accessProp.bind(from, key),
43
- enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
44
- });
45
- }
46
- __moduleCache.set(from, entry);
47
- return entry;
48
- };
49
- var __moduleCache;
50
32
  var __commonJS = (cb, mod) => () => (mod || cb((mod = { exports: {} }).exports, mod), mod.exports);
51
33
  var __returnValue = (v) => v;
52
34
  function __exportSetter(name, newValue) {
@@ -162,14 +144,15 @@ var init_islands = () => {};
162
144
 
163
145
  // src/client/streamSwap.ts
164
146
  var streamSwapRuntime = () => {
147
+ const absoluteWindow = window;
165
148
  const SLOT_PATCH_EVENT = "absolutejs:slot-patch";
166
- if (window.__ABS_SLOT_RUNTIME__ === true)
149
+ if (absoluteWindow.__ABS_SLOT_RUNTIME__ === true)
167
150
  return;
168
- window.__ABS_SLOT_RUNTIME__ = true;
169
- window.__ABS_SLOT_CONSUMERS__ = window.__ABS_SLOT_CONSUMERS__ ?? {};
170
- window.__ABS_SLOT_PENDING__ = window.__ABS_SLOT_PENDING__ ?? {};
171
- const consumers = window.__ABS_SLOT_CONSUMERS__;
172
- const pending = window.__ABS_SLOT_PENDING__;
151
+ absoluteWindow.__ABS_SLOT_RUNTIME__ = true;
152
+ absoluteWindow.__ABS_SLOT_CONSUMERS__ = absoluteWindow.__ABS_SLOT_CONSUMERS__ ?? {};
153
+ absoluteWindow.__ABS_SLOT_PENDING__ = absoluteWindow.__ABS_SLOT_PENDING__ ?? {};
154
+ const consumers = absoluteWindow.__ABS_SLOT_CONSUMERS__;
155
+ const pending = absoluteWindow.__ABS_SLOT_PENDING__;
173
156
  const isObjectRecord3 = (value) => Boolean(value) && typeof value === "object";
174
157
  const isPatchedPendingEntry = (value) => {
175
158
  if (!isObjectRecord3(value))
@@ -177,7 +160,7 @@ var streamSwapRuntime = () => {
177
160
  return value.domPatched === true && "payload" in value;
178
161
  };
179
162
  const unwrapPendingPayload = (value) => isPatchedPendingEntry(value) ? value.payload : value;
180
- const canApplyImmediately = () => window.__ABS_SLOT_HYDRATION_PENDING__ !== true;
163
+ const canApplyImmediately = () => absoluteWindow.__ABS_SLOT_HYDRATION_PENDING__ !== true;
181
164
  const isAngularDeferPayload = (payload) => {
182
165
  if (!isObjectRecord3(payload))
183
166
  return false;
@@ -247,8 +230,8 @@ var streamSwapRuntime = () => {
247
230
  apply(id, pending[id] ?? "");
248
231
  }
249
232
  };
250
- window.__ABS_SLOT_FLUSH__ = flush;
251
- window.__ABS_SLOT_ENQUEUE__ = (id, payload) => {
233
+ absoluteWindow.__ABS_SLOT_FLUSH__ = flush;
234
+ absoluteWindow.__ABS_SLOT_ENQUEUE__ = (id, payload) => {
252
235
  apply(id, payload);
253
236
  };
254
237
  if (typeof MutationObserver === "function") {
@@ -914,6 +897,65 @@ var ensureHead = (doc) => {
914
897
  }
915
898
  const head = doc.createElement("head");
916
899
  doc.documentElement.insertBefore(head, doc.documentElement.firstChild);
900
+ }, SSR_LAYOUT_RECT, layoutPatchApplied = false, patchElementLayout = (doc) => {
901
+ if (layoutPatchApplied || !doc) {
902
+ return;
903
+ }
904
+ let element;
905
+ try {
906
+ element = doc.createElement("div");
907
+ } catch {
908
+ return;
909
+ }
910
+ const proto = Object.getPrototypeOf(element);
911
+ if (!proto)
912
+ return;
913
+ const define = (name, value) => {
914
+ if (typeof proto[name] !== "function") {
915
+ Object.defineProperty(proto, name, {
916
+ configurable: true,
917
+ value,
918
+ writable: true
919
+ });
920
+ }
921
+ };
922
+ define("getBoundingClientRect", function() {
923
+ return { ...SSR_LAYOUT_RECT };
924
+ });
925
+ define("getClientRects", function() {
926
+ return [];
927
+ });
928
+ define("scrollTo", function() {});
929
+ define("scrollBy", function() {});
930
+ define("scrollIntoView", function() {});
931
+ define("focus", function() {});
932
+ define("blur", function() {});
933
+ const numericProps = [
934
+ "clientWidth",
935
+ "clientHeight",
936
+ "clientLeft",
937
+ "clientTop",
938
+ "offsetWidth",
939
+ "offsetHeight",
940
+ "offsetLeft",
941
+ "offsetTop",
942
+ "scrollWidth",
943
+ "scrollHeight",
944
+ "scrollLeft",
945
+ "scrollTop"
946
+ ];
947
+ for (const prop of numericProps) {
948
+ const desc = Object.getOwnPropertyDescriptor(proto, prop);
949
+ if (desc)
950
+ continue;
951
+ Object.defineProperty(proto, prop, {
952
+ configurable: true,
953
+ get() {
954
+ return 0;
955
+ }
956
+ });
957
+ }
958
+ layoutPatchApplied = true;
917
959
  }, applyPatches = async () => {
918
960
  const { \u{275}DominoAdapter } = await import(resolveAngularPackage("@angular/platform-server"));
919
961
  if (!\u{275}DominoAdapter?.prototype) {
@@ -932,18 +974,33 @@ var ensureHead = (doc) => {
932
974
  proto.createHtmlDocument = function() {
933
975
  const doc = origCreateHtmlDocument.call(this);
934
976
  ensureHead(doc);
977
+ patchElementLayout(doc);
935
978
  return doc;
936
979
  };
937
980
  const origGetDefaultDocument = proto.getDefaultDocument;
938
981
  proto.getDefaultDocument = function() {
939
982
  const doc = origGetDefaultDocument.call(this);
940
983
  ensureHead(doc);
984
+ patchElementLayout(doc);
941
985
  return doc;
942
986
  };
943
987
  return true;
944
988
  };
945
989
  var init_angularPatch = __esm(() => {
946
990
  init_resolveAngularPackage();
991
+ SSR_LAYOUT_RECT = Object.freeze({
992
+ bottom: 0,
993
+ height: 0,
994
+ left: 0,
995
+ right: 0,
996
+ top: 0,
997
+ width: 0,
998
+ x: 0,
999
+ y: 0,
1000
+ toJSON() {
1001
+ return this;
1002
+ }
1003
+ });
947
1004
  });
948
1005
 
949
1006
  // src/angular/angularDeps.ts
@@ -22817,7 +22874,7 @@ function isPotentialCssRootFile(id) {
22817
22874
  function idToPath(id) {
22818
22875
  return path.resolve(id.replace(/\?.*$/, ""));
22819
22876
  }
22820
- var __dirname = "/home/alexkahn/abs/absolutejs/node_modules/bun-plugin-tailwind", __filename = "/home/alexkahn/abs/absolutejs/node_modules/bun-plugin-tailwind/index.mjs", __create2, __defProp2, __getOwnPropDesc2, __getOwnPropNames2, __getProtoOf2, __hasOwnProp2, __knownSymbol = (name, symbol) => (symbol = Symbol[name]) ? symbol : Symbol.for("Symbol." + name), __typeError = (msg) => {
22877
+ var __dirname = "/home/alexkahn/abs/absolutejs/node_modules/bun-plugin-tailwind", __filename = "/home/alexkahn/abs/absolutejs/node_modules/bun-plugin-tailwind/index.mjs", __create2, __defProp2, __getOwnPropDesc, __getOwnPropNames2, __getProtoOf2, __hasOwnProp2, __knownSymbol = (name, symbol) => (symbol = Symbol[name]) ? symbol : Symbol.for("Symbol." + name), __typeError = (msg) => {
22821
22878
  throw TypeError(msg);
22822
22879
  }, __require2, __esm2 = (fn, res) => function __init() {
22823
22880
  return fn && (res = (0, fn[__getOwnPropNames2(fn)[0]])(fn = 0)), res;
@@ -22830,10 +22887,10 @@ var __dirname = "/home/alexkahn/abs/absolutejs/node_modules/bun-plugin-tailwind"
22830
22887
  if (from && typeof from === "object" || typeof from === "function") {
22831
22888
  for (let key of __getOwnPropNames2(from))
22832
22889
  if (!__hasOwnProp2.call(to, key) && key !== except)
22833
- __defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable });
22890
+ __defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
22834
22891
  }
22835
22892
  return to;
22836
- }, __toESM2 = (mod, isNodeMode, target) => (target = mod != null ? __create2(__getProtoOf2(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp2(target, "default", { value: mod, enumerable: true }) : target, mod)), __toCommonJS2 = (mod) => __copyProps(__defProp2({}, "__esModule", { value: true }), mod), __using = (stack, value2, async) => {
22893
+ }, __toESM2 = (mod, isNodeMode, target) => (target = mod != null ? __create2(__getProtoOf2(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp2(target, "default", { value: mod, enumerable: true }) : target, mod)), __toCommonJS = (mod) => __copyProps(__defProp2({}, "__esModule", { value: true }), mod), __using = (stack, value2, async) => {
22837
22894
  if (value2 != null) {
22838
22895
  if (typeof value2 !== "object" && typeof value2 !== "function")
22839
22896
  __typeError("Object expected");
@@ -23420,7 +23477,7 @@ var __dirname = "/home/alexkahn/abs/absolutejs/node_modules/bun-plugin-tailwind"
23420
23477
  var init_bun_plugin_tailwind = __esm(() => {
23421
23478
  __create2 = Object.create;
23422
23479
  __defProp2 = Object.defineProperty;
23423
- __getOwnPropDesc2 = Object.getOwnPropertyDescriptor;
23480
+ __getOwnPropDesc = Object.getOwnPropertyDescriptor;
23424
23481
  __getOwnPropNames2 = Object.getOwnPropertyNames;
23425
23482
  __getProtoOf2 = Object.getPrototypeOf;
23426
23483
  __hasOwnProp2 = Object.prototype.hasOwnProperty;
@@ -38341,9 +38398,9 @@ It schedules the call as a new task in the event loop.`);
38341
38398
  });
38342
38399
  require_runtime = __commonJS2({
38343
38400
  "../../node_modules/.pnpm/@napi-rs+wasm-runtime@1.0.5/node_modules/@napi-rs/wasm-runtime/runtime.cjs"(exports, module) {
38344
- var { MessageHandler: MessageHandler2, instantiateNapiModuleSync: instantiateNapiModuleSync2, instantiateNapiModule: instantiateNapiModule2 } = (init_emnapi_core_esm_bundler(), __toCommonJS2(emnapi_core_esm_bundler_exports));
38345
- var { getDefaultContext: getDefaultContext2 } = (init_emnapi_esm_bundler(), __toCommonJS2(emnapi_esm_bundler_exports));
38346
- var { WASI: WASI2 } = (init_wasm_util_esm_bundler(), __toCommonJS2(wasm_util_esm_bundler_exports));
38401
+ var { MessageHandler: MessageHandler2, instantiateNapiModuleSync: instantiateNapiModuleSync2, instantiateNapiModule: instantiateNapiModule2 } = (init_emnapi_core_esm_bundler(), __toCommonJS(emnapi_core_esm_bundler_exports));
38402
+ var { getDefaultContext: getDefaultContext2 } = (init_emnapi_esm_bundler(), __toCommonJS(emnapi_esm_bundler_exports));
38403
+ var { WASI: WASI2 } = (init_wasm_util_esm_bundler(), __toCommonJS(wasm_util_esm_bundler_exports));
38347
38404
  var { createFsProxy, createOnMessage } = require_fs_proxy();
38348
38405
  module.exports = {
38349
38406
  MessageHandler: MessageHandler2,
@@ -42289,7 +42346,8 @@ var SVELTE_PAGE_ROOT_ID = "__absolute_svelte_root__", renderToReadableStream = a
42289
42346
  } = {}) => {
42290
42347
  try {
42291
42348
  const { render } = await import("svelte/server");
42292
- const rendered = typeof props === "undefined" ? await render(component) : await render(component, { props });
42349
+ const renderComponent = render;
42350
+ const rendered = typeof props === "undefined" ? await renderComponent(component) : await renderComponent(component, { props });
42293
42351
  const { head, body } = rendered;
42294
42352
  const nonceAttr = nonce ? ` nonce="${nonce}"` : "";
42295
42353
  const scripts = (bootstrapScriptContent ? `<script${nonceAttr}>${escapeScriptContent(bootstrapScriptContent)}</script>` : "") + bootstrapScripts.map((src) => `<script${nonceAttr} src="${src}"></script>`).join("") + bootstrapModules.map((src) => `<script${nonceAttr} type="module" src="${src}"></script>`).join("");
@@ -46596,6 +46654,68 @@ var init_fileHashTracker = __esm(() => {
46596
46654
  init_constants();
46597
46655
  });
46598
46656
 
46657
+ // src/dev/transformCache.ts
46658
+ var exports_transformCache = {};
46659
+ __export(exports_transformCache, {
46660
+ setTransformed: () => setTransformed,
46661
+ invalidateAll: () => invalidateAll,
46662
+ invalidate: () => invalidate,
46663
+ getTransformed: () => getTransformed,
46664
+ getInvalidationVersion: () => getInvalidationVersion,
46665
+ findNearestComponent: () => findNearestComponent
46666
+ });
46667
+ var cache, importers, getTransformed = (filePath) => cache.get(filePath)?.content, setTransformed = (filePath, content, mtime, imports) => {
46668
+ const resolvedImports = imports ?? [];
46669
+ cache.set(filePath, { content, imports: resolvedImports, mtime });
46670
+ for (const imp of resolvedImports) {
46671
+ const set2 = importers.get(imp) ?? new Set;
46672
+ importers.set(imp, set2);
46673
+ set2.add(filePath);
46674
+ }
46675
+ }, invalidationVersions, isComponentFile = (filePath) => filePath.endsWith(".tsx") || filePath.endsWith(".jsx"), processParents = (parents, queue) => {
46676
+ const component = [...parents].find(isComponentFile);
46677
+ if (component !== undefined)
46678
+ return component;
46679
+ for (const parent of parents)
46680
+ queue.push(parent);
46681
+ return;
46682
+ }, findNearestComponent = (filePath) => {
46683
+ const visited = new Set;
46684
+ const queue = [filePath];
46685
+ while (queue.length > 0) {
46686
+ const current = queue.shift();
46687
+ if (!current)
46688
+ break;
46689
+ if (visited.has(current))
46690
+ continue;
46691
+ visited.add(current);
46692
+ const parents = importers.get(current);
46693
+ if (!parents)
46694
+ continue;
46695
+ const found = processParents(parents, queue);
46696
+ if (found !== undefined)
46697
+ return found;
46698
+ }
46699
+ return;
46700
+ }, getInvalidationVersion = (filePath) => invalidationVersions.get(filePath) ?? 0, invalidate = (filePath) => {
46701
+ cache.delete(filePath);
46702
+ invalidationVersions.set(filePath, (invalidationVersions.get(filePath) ?? 0) + 1);
46703
+ for (const parent of importers.get(filePath) ?? []) {
46704
+ cache.delete(parent);
46705
+ }
46706
+ }, invalidateAll = () => {
46707
+ cache.clear();
46708
+ importers.clear();
46709
+ };
46710
+ var init_transformCache = __esm(() => {
46711
+ cache = globalThis.__transformCache ?? new Map;
46712
+ globalThis.__transformCache = cache;
46713
+ importers = globalThis.__transformImporters ?? new Map;
46714
+ globalThis.__transformImporters = importers;
46715
+ invalidationVersions = globalThis.__transformInvalidationVersions ?? new Map;
46716
+ globalThis.__transformInvalidationVersions = invalidationVersions;
46717
+ });
46718
+
46599
46719
  // src/dev/reactComponentClassifier.ts
46600
46720
  import { resolve as resolve28 } from "path";
46601
46721
  var classifyComponent = (filePath) => {
@@ -46816,68 +46936,6 @@ var init_ssrCache = __esm(() => {
46816
46936
  dirtyFrameworks = new Set;
46817
46937
  });
46818
46938
 
46819
- // src/dev/transformCache.ts
46820
- var exports_transformCache = {};
46821
- __export(exports_transformCache, {
46822
- setTransformed: () => setTransformed,
46823
- invalidateAll: () => invalidateAll,
46824
- invalidate: () => invalidate,
46825
- getTransformed: () => getTransformed,
46826
- getInvalidationVersion: () => getInvalidationVersion,
46827
- findNearestComponent: () => findNearestComponent
46828
- });
46829
- var cache, importers, getTransformed = (filePath) => cache.get(filePath)?.content, setTransformed = (filePath, content, mtime, imports) => {
46830
- const resolvedImports = imports ?? [];
46831
- cache.set(filePath, { content, imports: resolvedImports, mtime });
46832
- for (const imp of resolvedImports) {
46833
- const set2 = importers.get(imp) ?? new Set;
46834
- importers.set(imp, set2);
46835
- set2.add(filePath);
46836
- }
46837
- }, invalidationVersions, isComponentFile = (filePath) => filePath.endsWith(".tsx") || filePath.endsWith(".jsx"), processParents = (parents, queue) => {
46838
- const component = [...parents].find(isComponentFile);
46839
- if (component !== undefined)
46840
- return component;
46841
- for (const parent of parents)
46842
- queue.push(parent);
46843
- return;
46844
- }, findNearestComponent = (filePath) => {
46845
- const visited = new Set;
46846
- const queue = [filePath];
46847
- while (queue.length > 0) {
46848
- const current = queue.shift();
46849
- if (!current)
46850
- break;
46851
- if (visited.has(current))
46852
- continue;
46853
- visited.add(current);
46854
- const parents = importers.get(current);
46855
- if (!parents)
46856
- continue;
46857
- const found = processParents(parents, queue);
46858
- if (found !== undefined)
46859
- return found;
46860
- }
46861
- return;
46862
- }, getInvalidationVersion = (filePath) => invalidationVersions.get(filePath) ?? 0, invalidate = (filePath) => {
46863
- cache.delete(filePath);
46864
- invalidationVersions.set(filePath, (invalidationVersions.get(filePath) ?? 0) + 1);
46865
- for (const parent of importers.get(filePath) ?? []) {
46866
- cache.delete(parent);
46867
- }
46868
- }, invalidateAll = () => {
46869
- cache.clear();
46870
- importers.clear();
46871
- };
46872
- var init_transformCache = __esm(() => {
46873
- cache = globalThis.__transformCache ?? new Map;
46874
- globalThis.__transformCache = cache;
46875
- importers = globalThis.__transformImporters ?? new Map;
46876
- globalThis.__transformImporters = importers;
46877
- invalidationVersions = globalThis.__transformInvalidationVersions ?? new Map;
46878
- globalThis.__transformInvalidationVersions = invalidationVersions;
46879
- });
46880
-
46881
46939
  // src/dev/moduleServer.ts
46882
46940
  var exports_moduleServer = {};
46883
46941
  __export(exports_moduleServer, {
@@ -47135,7 +47193,15 @@ ${code}`;
47135
47193
  const endPos = findFunctionEnd(source, insertPos);
47136
47194
  const funcBody = source.slice(insertPos, endPos);
47137
47195
  return `${source.slice(0, insertPos)}__hmr_wrap(${JSON.stringify(name)}, ${funcBody})${source.slice(endPos)}`;
47138
- }, svelteExternalCss, svelteCompiler = null, vueCompiler = null, warmCompilers = async (frameworks2) => {
47196
+ }, svelteExternalCss, svelteCompiler = null, vueCompiler = null, getLoadedSvelteCompiler = () => {
47197
+ if (!svelteCompiler)
47198
+ throw new Error("Svelte compiler is not loaded.");
47199
+ return svelteCompiler;
47200
+ }, getLoadedVueCompiler = () => {
47201
+ if (!vueCompiler)
47202
+ throw new Error("Vue compiler is not loaded.");
47203
+ return vueCompiler;
47204
+ }, warmCompilers = async (frameworks2) => {
47139
47205
  const [svelteModule, vueModule] = await Promise.all([
47140
47206
  frameworks2.svelte ? import("svelte/compiler") : undefined,
47141
47207
  frameworks2.vue ? import("@vue/compiler-sfc") : undefined
@@ -47163,13 +47229,15 @@ ${code}`;
47163
47229
  source: descriptor.template.content
47164
47230
  });
47165
47231
  }, compileSvelteModule = (raw, filePath) => {
47232
+ const compiler = getLoadedSvelteCompiler();
47166
47233
  const source = tsTranspiler2.transformSync(raw);
47167
- return svelteCompiler.compileModule(source, {
47234
+ return compiler.compileModule(source, {
47168
47235
  dev: true,
47169
47236
  filename: filePath
47170
47237
  }).js.code;
47171
47238
  }, compileSvelteComponent = (raw, filePath, projectRoot, enableAsync = false) => {
47172
- const compiled = svelteCompiler.compile(raw, {
47239
+ const compiler = getLoadedSvelteCompiler();
47240
+ const compiled = compiler.compile(raw, {
47173
47241
  css: "external",
47174
47242
  dev: true,
47175
47243
  experimental: {
@@ -47205,11 +47273,12 @@ ${code}`;
47205
47273
  const code = isModule ? compileSvelteModule(source, filePath) : compileSvelteComponent(source, filePath, projectRoot, enableAsync);
47206
47274
  return rewriteImports2(code, filePath, projectRoot, rewriter);
47207
47275
  }, compileVueTemplate = (descriptor, compiledScript, filePath, componentId) => {
47276
+ const compiler = getLoadedVueCompiler();
47208
47277
  const scriptContent = compiledScript.content;
47209
47278
  if (!descriptor.template)
47210
47279
  return scriptContent;
47211
47280
  const isScoped = descriptor.styles.some((style) => style.scoped);
47212
- const templateResult = vueCompiler.compileTemplate({
47281
+ const templateResult = compiler.compileTemplate({
47213
47282
  compilerOptions: {
47214
47283
  bindingMetadata: compiledScript.bindings,
47215
47284
  prefixIdentifiers: true
@@ -47230,10 +47299,11 @@ export default __script__;`;
47230
47299
  }, compileVueStyles = async (descriptor, filePath, componentId, code, stylePreprocessors) => {
47231
47300
  if (descriptor.styles.length === 0)
47232
47301
  return code;
47233
- const cssCode = (await Promise.all(descriptor.styles.map(async (style) => vueCompiler.compileStyle({
47302
+ const compiler = getLoadedVueCompiler();
47303
+ const cssCode = (await Promise.all(descriptor.styles.map(async (style) => compiler.compileStyle({
47234
47304
  filename: filePath,
47235
47305
  id: `data-v-${componentId}`,
47236
- scoped: style.scoped,
47306
+ scoped: Boolean(style.scoped),
47237
47307
  source: style.lang ? await compileStyleSource(filePath, style.content, style.lang, stylePreprocessors) : style.content,
47238
47308
  trim: true
47239
47309
  }).code))).join(`
@@ -47262,7 +47332,11 @@ ${code}`;
47262
47332
  id: componentId,
47263
47333
  inlineTemplate: false
47264
47334
  });
47265
- let code = compileVueTemplate(descriptor, compiledScript, filePath, componentId);
47335
+ const compiledSfcScript = {
47336
+ bindings: compiledScript.bindings ?? {},
47337
+ content: compiledScript.content
47338
+ };
47339
+ let code = compileVueTemplate(descriptor, compiledSfcScript, filePath, componentId);
47266
47340
  code = await compileVueStyles(descriptor, filePath, componentId, code, stylePreprocessors);
47267
47341
  code = tsTranspiler2.transformSync(code);
47268
47342
  code = injectVueHmr(code, filePath, projectRoot, vueDir);
@@ -47640,7 +47714,7 @@ var init_simpleHTMXHMR = () => {};
47640
47714
  // src/dev/rebuildTrigger.ts
47641
47715
  import { existsSync as existsSync22 } from "fs";
47642
47716
  import { basename as basename11, dirname as dirname14, relative as relative12, resolve as resolve33 } from "path";
47643
- var moduleServerPromise, getModuleServer = () => moduleServerPromise, getStyleTransformConfig = (config) => createStyleTransformConfig(config.stylePreprocessors, config.postcss), parseErrorLocationFromMessage = (msg) => {
47717
+ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequentially = (items, action) => items.reduce((chain, item) => chain.then(() => action(item)), Promise.resolve()), getStyleTransformConfig = (config) => createStyleTransformConfig(config.stylePreprocessors, config.postcss), parseErrorLocationFromMessage = (msg) => {
47644
47718
  const pathLineCol = msg.match(/^([^\s:]+):(\d+)(?::(\d+))?/);
47645
47719
  if (pathLineCol) {
47646
47720
  const [, file4, lineStr, colStr] = pathLineCol;
@@ -47810,19 +47884,31 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, getStyleTr
47810
47884
  return allFiles;
47811
47885
  }, areAllQueuedFilesStable = async (fileChangeQueue) => {
47812
47886
  const allFiles = collectAllQueuedFiles(fileChangeQueue);
47813
- for (const file4 of allFiles) {
47887
+ const checkFile = async (files) => {
47888
+ const [file4, ...remaining] = files;
47889
+ if (!file4) {
47890
+ return true;
47891
+ }
47814
47892
  const stable = await isFileStable(file4);
47815
- if (!stable)
47893
+ if (!stable) {
47816
47894
  return false;
47817
- }
47818
- return true;
47895
+ }
47896
+ return checkFile(remaining);
47897
+ };
47898
+ return checkFile(allFiles);
47819
47899
  }, waitForStableWrites = async (state) => {
47820
- for (let round = 0;round < STABILITY_CHECK_ROUNDS; round++) {
47900
+ const waitRound = async (round) => {
47901
+ if (round >= STABILITY_CHECK_ROUNDS) {
47902
+ return;
47903
+ }
47821
47904
  const stable = await areAllQueuedFilesStable(state.fileChangeQueue);
47822
- if (stable)
47823
- break;
47824
- }
47825
- }, queueFileChange = (state, filePath, config, onRebuildComplete) => {
47905
+ if (stable) {
47906
+ return;
47907
+ }
47908
+ await waitRound(round + 1);
47909
+ };
47910
+ await waitRound(0);
47911
+ }, queueFileChange = async (state, filePath, config, onRebuildComplete) => {
47826
47912
  const framework = detectFramework(filePath, state.resolvedPaths);
47827
47913
  if (framework === "ignored") {
47828
47914
  return;
@@ -47832,8 +47918,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, getStyleTr
47832
47918
  return;
47833
47919
  }
47834
47920
  if (framework === "unknown") {
47835
- const { invalidate: invalidate2 } = (init_transformCache(), __toCommonJS(exports_transformCache));
47836
- invalidate2(resolve33(filePath));
47921
+ invalidate(resolve33(filePath));
47837
47922
  const relPath = relative12(process.cwd(), filePath);
47838
47923
  logHmrUpdate(relPath);
47839
47924
  return;
@@ -48238,9 +48323,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, getStyleTr
48238
48323
  }
48239
48324
  markSsrCacheDirty("svelte");
48240
48325
  const serverDuration = Date.now() - startTime;
48241
- for (const changedFile of svelteFiles) {
48242
- await broadcastSvelteModuleUpdate(state, changedFile, svelteFiles, serverDuration);
48243
- }
48326
+ await runSequentially(svelteFiles, (changedFile) => broadcastSvelteModuleUpdate(state, changedFile, svelteFiles, serverDuration));
48244
48327
  onRebuildComplete({
48245
48328
  hmrState: state,
48246
48329
  manifest: state.manifest
@@ -48364,9 +48447,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, getStyleTr
48364
48447
  await invalidateNonVueModules(nonVueFiles);
48365
48448
  const serverDuration = Date.now() - startTime;
48366
48449
  const forceReload = nonVueFiles.length > 0;
48367
- for (const changedFile of vueFiles) {
48368
- await broadcastVueModuleUpdate(state, changedFile, vueFiles, nonVueFiles, forceReload, serverDuration);
48369
- }
48450
+ await runSequentially(vueFiles, (changedFile) => broadcastVueModuleUpdate(state, changedFile, vueFiles, nonVueFiles, forceReload, serverDuration));
48370
48451
  onRebuildComplete({
48371
48452
  hmrState: state,
48372
48453
  manifest: state.manifest
@@ -48548,11 +48629,11 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, getStyleTr
48548
48629
  const outputHtmlPages = computeOutputPagesDir(state, config, "html");
48549
48630
  const shouldRefreshAllPages = htmlPageFiles.length === 0 && shouldRefreshFromIslandChange;
48550
48631
  const pageFilesToUpdate = shouldRefreshAllPages ? await scanEntryPoints(outputHtmlPages, "*.html") : htmlPageFiles;
48551
- for (const pageFile of pageFilesToUpdate) {
48632
+ await runSequentially(pageFilesToUpdate, async (pageFile) => {
48552
48633
  const htmlPageName = basename11(pageFile);
48553
48634
  const builtHtmlPagePath = resolve33(outputHtmlPages, htmlPageName);
48554
48635
  await processHtmlPageUpdate(state, pageFile, builtHtmlPagePath, manifest, duration);
48555
- }
48636
+ });
48556
48637
  }, handleVueCssOnlyUpdate = (state, vueCssFiles, manifest, duration) => {
48557
48638
  const [cssFile] = vueCssFiles;
48558
48639
  if (!cssFile) {
@@ -48647,9 +48728,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, getStyleTr
48647
48728
  if (isCssOnlyChange && vueCssFiles.length > 0) {
48648
48729
  handleVueCssOnlyUpdate(state, vueCssFiles, manifest, duration);
48649
48730
  }
48650
- for (const vuePagePath of pagesToUpdate) {
48651
- await processVuePageUpdate(state, config, vuePagePath, manifest, duration);
48652
- }
48731
+ await runSequentially(pagesToUpdate, (vuePagePath) => processVuePageUpdate(state, config, vuePagePath, manifest, duration));
48653
48732
  }, handleSvelteCssOnlyUpdate = (state, svelteCssFiles, manifest, duration) => {
48654
48733
  const [cssFile] = svelteCssFiles;
48655
48734
  if (!cssFile) {
@@ -48850,11 +48929,11 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, getStyleTr
48850
48929
  const outputHtmxPages = computeOutputPagesDir(state, config, "htmx");
48851
48930
  const shouldRefreshAllPages = htmxPageFiles.length === 0 && shouldRefreshFromIslandChange;
48852
48931
  const pageFilesToUpdate = shouldRefreshAllPages ? await scanEntryPoints(outputHtmxPages, "*.html") : htmxPageFiles;
48853
- for (const htmxPageFile of pageFilesToUpdate) {
48932
+ await runSequentially(pageFilesToUpdate, async (htmxPageFile) => {
48854
48933
  const htmxPageName = basename11(htmxPageFile);
48855
48934
  const builtHtmxPagePath = resolve33(outputHtmxPages, htmxPageName);
48856
48935
  await processHtmxPageUpdate(state, htmxPageFile, builtHtmxPagePath, manifest, duration);
48857
- }
48936
+ });
48858
48937
  }, collectUpdatedModulePaths = (allModuleUpdates) => {
48859
48938
  const paths = [];
48860
48939
  allModuleUpdates.forEach((update) => {
@@ -48998,11 +49077,18 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, getStyleTr
48998
49077
  const { updateAssetPaths: updateAssetPaths2 } = await Promise.resolve().then(() => (init_updateAssetPaths(), exports_updateAssetPaths));
48999
49078
  const handleUpdate = framework === "html" ? (await Promise.resolve().then(() => (init_simpleHTMLHMR(), exports_simpleHTMLHMR))).handleHTMLUpdate : (await Promise.resolve().then(() => (init_simpleHTMXHMR(), exports_simpleHTMXHMR))).handleHTMXUpdate;
49000
49079
  const { readFileSync: readFs, writeFileSync: writeFs } = await import("fs");
49001
- for (const markupFile of markupFiles) {
49080
+ const processMarkupFiles = async (files) => {
49081
+ const [markupFile, ...remaining] = files;
49082
+ if (!markupFile) {
49083
+ return;
49084
+ }
49002
49085
  const success = await tryProcessMarkupFile(state, markupFile, outputDir, framework, startTime, updateAssetPaths2, handleUpdate, readFs, writeFs);
49003
- if (!success)
49004
- break;
49005
- }
49086
+ if (!success) {
49087
+ return;
49088
+ }
49089
+ await processMarkupFiles(remaining);
49090
+ };
49091
+ await processMarkupFiles(markupFiles);
49006
49092
  }, runHtmlFastPath = async (state, config, filesToRebuild, startTime) => runMarkupFastPath(state, config, filesToRebuild, startTime, "html"), runHtmxFastPath = async (state, config, filesToRebuild, startTime) => runMarkupFastPath(state, config, filesToRebuild, startTime, "htmx"), markHandledFiles = (files, framework, resolvedPaths, handled) => {
49007
49093
  files.filter((f) => detectFramework(f, resolvedPaths) === framework).forEach((f) => handled.add(f));
49008
49094
  }, runFrameworkFastPaths = async (state, config, affectedFrameworks, files, startTime, onRebuildComplete) => {
@@ -49029,12 +49115,12 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, getStyleTr
49029
49115
  handler: handleVueFastPath
49030
49116
  }
49031
49117
  ];
49032
- for (const fastPath of fastPaths) {
49118
+ await runSequentially(fastPaths, async (fastPath) => {
49033
49119
  if (!fastPath.directory || !affectedFrameworks.includes(fastPath.framework))
49034
- continue;
49120
+ return;
49035
49121
  await fastPath.handler(state, config, files, startTime, onRebuildComplete);
49036
49122
  markHandledFiles(files, fastPath.framework, state.resolvedPaths, handled);
49037
- }
49123
+ });
49038
49124
  return files.every((f) => handled.has(f));
49039
49125
  }, performFullRebuild = async (state, config, affectedFrameworks, filesToRebuild, startTime, onRebuildComplete) => {
49040
49126
  const hasManifest = Object.keys(state.manifest).length > 0;
@@ -49177,6 +49263,7 @@ var init_rebuildTrigger = __esm(() => {
49177
49263
  init_dependencyGraph();
49178
49264
  init_constants();
49179
49265
  init_fileHashTracker();
49266
+ init_transformCache();
49180
49267
  init_moduleMapper();
49181
49268
  init_telemetryEvent();
49182
49269
  init_assetStore();
@@ -49663,13 +49750,13 @@ var INTERNALS_KEYS, isRecord7 = (val) => typeof val === "object" && val !== null
49663
49750
  }
49664
49751
  return;
49665
49752
  }, bridgeReactInternals = async () => {
49666
- const pinned = globalThis.__reactModuleRef;
49667
- if (!pinned)
49753
+ const pinnedRef = globalThis.__reactModuleRef;
49754
+ if (!isRecord7(pinnedRef))
49668
49755
  return;
49669
49756
  const react = await import("react");
49670
- if (pinned === react)
49757
+ if (pinnedRef === react)
49671
49758
  return;
49672
- const pinnedInternals = findInternals(pinned);
49759
+ const pinnedInternals = findInternals(pinnedRef);
49673
49760
  const currentInternals = findInternals(react);
49674
49761
  if (!pinnedInternals || !currentInternals || pinnedInternals === currentInternals)
49675
49762
  return;
@@ -50178,17 +50265,26 @@ var SERVER_OUTPUT_LIMIT = 4000, STARTUP_POLL_INTERVAL_MS = 100, DEFAULT_STARTUP_
50178
50265
  const visited = new Set;
50179
50266
  const queue = ["/"];
50180
50267
  const routes = [];
50181
- while (queue.length > 0) {
50268
+ const crawlNextRoute = async () => {
50182
50269
  const path2 = queue.shift();
50183
- if (!path2 || visited.has(path2))
50184
- continue;
50270
+ if (!path2) {
50271
+ return;
50272
+ }
50273
+ if (visited.has(path2)) {
50274
+ await crawlNextRoute();
50275
+ return;
50276
+ }
50185
50277
  visited.add(path2);
50186
50278
  const html = await fetchRoute(baseUrl, path2).catch(() => null);
50187
- if (!html)
50188
- continue;
50279
+ if (!html) {
50280
+ await crawlNextRoute();
50281
+ return;
50282
+ }
50189
50283
  routes.push(path2);
50190
50284
  queue.push(...extractLinks(html, visited));
50191
- }
50285
+ await crawlNextRoute();
50286
+ };
50287
+ await crawlNextRoute();
50192
50288
  return routes;
50193
50289
  }, rerenderRoute = async (route, port, prerenderDir) => {
50194
50290
  try {
@@ -50238,9 +50334,7 @@ var SERVER_OUTPUT_LIMIT = 4000, STARTUP_POLL_INTERVAL_MS = 100, DEFAULT_STARTUP_
50238
50334
  dir: prerenderDir,
50239
50335
  routes: new Map
50240
50336
  };
50241
- for (const route of routes) {
50242
- await prerenderRoute(baseUrl, route, prerenderDir, result, log2);
50243
- }
50337
+ await routes.reduce((chain, route) => chain.then(() => prerenderRoute(baseUrl, route, prerenderDir, result, log2)), Promise.resolve());
50244
50338
  return result;
50245
50339
  }, getStartupTimeoutMs = () => {
50246
50340
  const rawTimeout = Bun.env.ABSOLUTE_PRERENDER_STARTUP_TIMEOUT_MS;
@@ -50248,13 +50342,17 @@ var SERVER_OUTPUT_LIMIT = 4000, STARTUP_POLL_INTERVAL_MS = 100, DEFAULT_STARTUP_
50248
50342
  return Number.isFinite(parsedTimeout) && parsedTimeout > 0 ? parsedTimeout : DEFAULT_STARTUP_TIMEOUT_MS;
50249
50343
  }, waitForServerReady = async (port) => {
50250
50344
  const deadline = performance.now() + getStartupTimeoutMs();
50251
- while (performance.now() < deadline) {
50345
+ const pollServer = async () => {
50346
+ if (performance.now() >= deadline) {
50347
+ return false;
50348
+ }
50252
50349
  if (await probePrerenderServer(port)) {
50253
50350
  return true;
50254
50351
  }
50255
50352
  await Bun.sleep(STARTUP_POLL_INTERVAL_MS);
50256
- }
50257
- return false;
50353
+ return pollServer();
50354
+ };
50355
+ return pollServer();
50258
50356
  }, probePrerenderServer = async (port) => {
50259
50357
  const res = await fetch(`http://localhost:${port}/`).catch(() => null);
50260
50358
  if (!res) {
@@ -50271,10 +50369,11 @@ var SERVER_OUTPUT_LIMIT = 4000, STARTUP_POLL_INTERVAL_MS = 100, DEFAULT_STARTUP_
50271
50369
  const decoder2 = new TextDecoder;
50272
50370
  const read = () => {
50273
50371
  reader.read().then(({ done, value: value2 }) => {
50274
- if (done)
50372
+ if (done) {
50275
50373
  return;
50374
+ }
50276
50375
  output.push(decoder2.decode(value2, { stream: true }));
50277
- read();
50376
+ return read();
50278
50377
  }).catch(() => {});
50279
50378
  };
50280
50379
  read();
@@ -58029,5 +58128,5 @@ export {
58029
58128
  ANGULAR_INIT_TIMEOUT_MS
58030
58129
  };
58031
58130
 
58032
- //# debugId=00ECB0441FCD5AB464756E2164756E21
58131
+ //# debugId=28A9F49049C479BD64756E2164756E21
58033
58132
  //# sourceMappingURL=index.js.map