@absolutejs/absolute 0.19.0-beta.1023 → 0.19.0-beta.1025

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 (45) hide show
  1. package/dist/angular/browser.js +13 -17
  2. package/dist/angular/browser.js.map +3 -3
  3. package/dist/angular/components/core/streamingSlotRegistrar.js +1 -1
  4. package/dist/angular/components/core/streamingSlotRegistry.js +2 -2
  5. package/dist/angular/index.js +595 -267
  6. package/dist/angular/index.js.map +11 -8
  7. package/dist/angular/server.js +577 -249
  8. package/dist/angular/server.js.map +11 -8
  9. package/dist/build.js +827 -735
  10. package/dist/build.js.map +11 -10
  11. package/dist/cli/config/server.js +49 -42
  12. package/dist/cli/index.js +366 -9
  13. package/dist/client/index.js +34 -20
  14. package/dist/client/index.js.map +6 -6
  15. package/dist/index.js +899 -800
  16. package/dist/index.js.map +12 -11
  17. package/dist/islands/index.js +416 -95
  18. package/dist/islands/index.js.map +10 -7
  19. package/dist/react/browser.js +13 -17
  20. package/dist/react/browser.js.map +3 -3
  21. package/dist/react/index.js +484 -156
  22. package/dist/react/index.js.map +12 -9
  23. package/dist/react/server.js +69 -62
  24. package/dist/react/server.js.map +5 -5
  25. package/dist/src/cli/scripts/tunnelRelay.d.ts +9 -0
  26. package/dist/src/client/preserveIslandMarkup.d.ts +4 -1
  27. package/dist/src/core/angularServerModule.d.ts +1 -0
  28. package/dist/src/dev/tunnel/client.d.ts +20 -0
  29. package/dist/src/dev/tunnel/protocol.d.ts +85 -0
  30. package/dist/src/dev/tunnel/relay.d.ts +28 -0
  31. package/dist/src/utils/loadConfig.d.ts +4 -0
  32. package/dist/svelte/index.js +389 -61
  33. package/dist/svelte/index.js.map +11 -8
  34. package/dist/svelte/server.js +50 -43
  35. package/dist/svelte/server.js.map +3 -3
  36. package/dist/types/angular.d.ts +3 -0
  37. package/dist/types/build.d.ts +11 -0
  38. package/dist/types/globals.d.ts +0 -1
  39. package/dist/vue/browser.js +13 -17
  40. package/dist/vue/browser.js.map +3 -3
  41. package/dist/vue/index.js +477 -153
  42. package/dist/vue/index.js.map +12 -9
  43. package/dist/vue/server.js +50 -43
  44. package/dist/vue/server.js.map +3 -3
  45. package/package.json +2 -6
@@ -78,25 +78,6 @@ var __legacyMetadataTS = (k, v) => {
78
78
  var __esm = (fn, res) => () => (fn && (res = fn(fn = 0)), res);
79
79
  var __require = import.meta.require;
80
80
 
81
- // src/constants.ts
82
- var ANGULAR_INIT_TIMEOUT_MS = 500, ANSI_ESCAPE_CODE = 27, ANSI_ESCAPE_LENGTH = 3, ASCII_SPACE = 32, BASE_36_RADIX = 36, BUN_BUILD_WARNING_SUPPRESSION = "wildcard sideEffects are not supported yet", BODY_SLICE_LENGTH = 2000, BYTES_PER_KILOBYTE = 1024, CLI_ARGS_OFFSET = 3, CSS_ERROR_RESOLVE_DELAY_MS = 50, CSS_MAX_CHECK_ATTEMPTS = 10, CSS_MAX_PARSE_TIMEOUT_MS = 500, CSS_SHEET_READY_TIMEOUT_MS = 100, DEFAULT_CHUNK_SIZE = 16384, DEFAULT_DEBOUNCE_MS = 15, DEFAULT_PORT = 3000, DEV_SERVER_RESTART_DEBOUNCE_MS = 100, DOM_UPDATE_DELAY_MS = 50, FILE_PROTOCOL_PREFIX_LENGTH = 7, FOCUS_ID_PREFIX_LENGTH = 3, FOCUS_IDX_PREFIX_LENGTH = 4, FOCUS_NAME_PREFIX_LENGTH = 5, ESLINT_STUDIO_DEFAULT_HOST = "eslint.absolute.localhost", ESLINT_STUDIO_DEFAULT_PORT = 4099, CONFIG_DEFAULT_HOST = "config.absolute.localhost", CONFIG_DEFAULT_PORT = 4099, HMR_UPDATE_TIMEOUT_MS = 2000, HOOK_SIGNATURE_LENGTH = 12, EXCLUDE_LAST_OFFSET = -1, HTTP_STATUS_OK = 200, HTTP_STATUS_BAD_REQUEST = 400, HTTP_STATUS_NOT_FOUND = 404, HOURS_IN_DAY = 24, HOURS_IN_HALF_DAY = 12, IMAGE_DEFAULT_DEVICE_SIZES, IMAGE_DEFAULT_IMAGE_SIZES, IMAGE_DEFAULT_QUALITY = 75, IMAGE_GLOB_SUFFIX_LENGTH = 2, INSTANCE_PROBE_TIMEOUT_MS = 250, MAX_ERROR_LENGTH = 200, MAX_RECONNECT_ATTEMPTS = 60, MILLISECONDS_IN_A_SECOND = 1000, MINUTES_IN_AN_HOUR = 60, SECONDS_IN_A_MINUTE = 60, MILLISECONDS_IN_A_MINUTE, MILLISECONDS_IN_A_DAY, OVERLAY_FADE_DURATION_MS = 150, PING_INTERVAL_MS = 30000, LIST_LOG_TAIL_MAX_BYTES = 65536, LIST_TUI_COLUMN_GAP = 2, LIST_TUI_DEFAULT_HEIGHT = 28, LIST_TUI_DEFAULT_WIDTH = 100, LIST_TUI_ESCAPE_SEQUENCE_TIMEOUT_MS = 30, LIST_TUI_FOOTER_LINE_COUNT = 2, LIST_TUI_MARKER_WIDTH = 2, LIST_TUI_MIN_LOG_HEIGHT = 3, LIST_TUI_MIN_URL_WIDTH = 16, LIST_TUI_RENDER_DEBOUNCE_MS = 16, LIST_TUI_STATUS_MESSAGE_TIMEOUT_MS = 4000, LIST_WATCH_REFRESH_MS = 1000, RAF_BATCH_COUNT = 3, RANDOM_ID_END_INDEX = 11, REBUILD_BATCH_DELAY_MS = 10, REBUILD_RELOAD_DELAY_MS = 200, RECONNECT_INITIAL_DELAY_MS = 500, RECONNECT_POLL_INTERVAL_MS = 300, REACT_STREAM_SLOT_FAST_DELAY_MS = 5, REACT_STREAM_SLOT_SLOW_DELAY_MS = 20, SIGINT_EXIT_CODE = 130, SIGTERM_EXIT_CODE = 143, SVELTE_CSS_LOAD_TIMEOUT_MS = 500, TIME_PRECISION = 2, TWO_THIRDS, UNFOUND_INDEX = -1, WEBSOCKET_NORMAL_CLOSURE = 1000, WORKSPACE_COMMAND_ARGS_OFFSET = 3, WORKSPACE_FAILURE_LOG_PRINT_LIMIT = 30, WORKSPACE_FAILURE_RECENT_LOG_LIMIT = 60, WORKSPACE_READY_ATTEMPT_TIMEOUT_MS = 5000, WORKSPACE_READY_PROBE_INTERVAL_MS = 250, WORKSPACE_READY_TIMEOUT_MS = 30000, WORKSPACE_SHUTDOWN_TIMEOUT_MS = 1e4, WORKSPACE_TUI_DEFAULT_HEIGHT = 28, WORKSPACE_TUI_DEFAULT_WIDTH = 100, WORKSPACE_TUI_ESCAPE_SEQUENCE_TIMEOUT_MS = 30, WORKSPACE_TUI_FOOTER_LINE_COUNT = 3, WORKSPACE_TUI_MIN_LOG_HEIGHT = 3, WORKSPACE_TUI_MIN_SERVICE_NAME_WIDTH = 7, WORKSPACE_TUI_MIN_TARGET_WIDTH = 8, WORKSPACE_TUI_MIN_WRAP_WIDTH = 12, WORKSPACE_TUI_PROMPT_CURSOR_OFFSET = 3, WORKSPACE_TUI_RECENT_LOG_LIMIT = 40, WORKSPACE_TUI_RENDER_DEBOUNCE_MS = 16, WORKSPACE_TUI_STATUS_WIDTH = 10, WORKSPACE_TUI_TARGET_PADDING_WIDTH = 6, WORKSPACE_TUI_VISIBILITY_WIDTH = 8;
83
- var init_constants = __esm(() => {
84
- IMAGE_DEFAULT_DEVICE_SIZES = [
85
- 640,
86
- 750,
87
- 828,
88
- 1080,
89
- 1200,
90
- 1920,
91
- 2048,
92
- 3840
93
- ];
94
- IMAGE_DEFAULT_IMAGE_SIZES = [16, 32, 48, 64, 96, 128, 256, 384];
95
- MILLISECONDS_IN_A_MINUTE = MILLISECONDS_IN_A_SECOND * SECONDS_IN_A_MINUTE;
96
- MILLISECONDS_IN_A_DAY = MILLISECONDS_IN_A_SECOND * SECONDS_IN_A_MINUTE * MINUTES_IN_AN_HOUR * HOURS_IN_DAY;
97
- TWO_THIRDS = 2 / 3;
98
- });
99
-
100
81
  // src/core/devRouteRegistrationCallsite.ts
101
82
  var exports_devRouteRegistrationCallsite = {};
102
83
  __export(exports_devRouteRegistrationCallsite, {
@@ -312,6 +293,25 @@ var streamSwapRuntime = () => {
312
293
  return value.slice(start + 1, end);
313
294
  }, getStreamSwapRuntimeScript = () => `(function(){${stripFunctionWrapper(streamSwapRuntime.toString())}})();`;
314
295
 
296
+ // src/constants.ts
297
+ var ANGULAR_INIT_TIMEOUT_MS = 500, ANSI_ESCAPE_CODE = 27, ANSI_ESCAPE_LENGTH = 3, ASCII_SPACE = 32, BASE_36_RADIX = 36, BUN_BUILD_WARNING_SUPPRESSION = "wildcard sideEffects are not supported yet", BODY_SLICE_LENGTH = 2000, BYTES_PER_KILOBYTE = 1024, CLI_ARGS_OFFSET = 3, CSS_ERROR_RESOLVE_DELAY_MS = 50, CSS_MAX_CHECK_ATTEMPTS = 10, CSS_MAX_PARSE_TIMEOUT_MS = 500, CSS_SHEET_READY_TIMEOUT_MS = 100, DEFAULT_CHUNK_SIZE = 16384, DEFAULT_DEBOUNCE_MS = 15, DEFAULT_PORT = 3000, DEV_SERVER_RESTART_DEBOUNCE_MS = 100, DOM_UPDATE_DELAY_MS = 50, FILE_PROTOCOL_PREFIX_LENGTH = 7, FOCUS_ID_PREFIX_LENGTH = 3, FOCUS_IDX_PREFIX_LENGTH = 4, FOCUS_NAME_PREFIX_LENGTH = 5, ESLINT_STUDIO_DEFAULT_HOST = "eslint.absolute.localhost", ESLINT_STUDIO_DEFAULT_PORT = 4099, CONFIG_DEFAULT_HOST = "config.absolute.localhost", CONFIG_DEFAULT_PORT = 4099, HMR_UPDATE_TIMEOUT_MS = 2000, HOOK_SIGNATURE_LENGTH = 12, EXCLUDE_LAST_OFFSET = -1, HTTP_STATUS_OK = 200, HTTP_STATUS_BAD_REQUEST = 400, HTTP_STATUS_NOT_FOUND = 404, HOURS_IN_DAY = 24, HOURS_IN_HALF_DAY = 12, IMAGE_DEFAULT_DEVICE_SIZES, IMAGE_DEFAULT_IMAGE_SIZES, IMAGE_DEFAULT_QUALITY = 75, IMAGE_GLOB_SUFFIX_LENGTH = 2, INSTANCE_PROBE_TIMEOUT_MS = 250, MAX_ERROR_LENGTH = 200, MAX_RECONNECT_ATTEMPTS = 60, MILLISECONDS_IN_A_SECOND = 1000, MINUTES_IN_AN_HOUR = 60, SECONDS_IN_A_MINUTE = 60, MILLISECONDS_IN_A_MINUTE, MILLISECONDS_IN_A_DAY, OVERLAY_FADE_DURATION_MS = 150, PING_INTERVAL_MS = 30000, LIST_LOG_TAIL_MAX_BYTES = 65536, LIST_TUI_COLUMN_GAP = 2, LIST_TUI_DEFAULT_HEIGHT = 28, LIST_TUI_DEFAULT_WIDTH = 100, LIST_TUI_ESCAPE_SEQUENCE_TIMEOUT_MS = 30, LIST_TUI_FOOTER_LINE_COUNT = 2, LIST_TUI_MARKER_WIDTH = 2, LIST_TUI_MIN_LOG_HEIGHT = 3, LIST_TUI_MIN_URL_WIDTH = 16, LIST_TUI_RENDER_DEBOUNCE_MS = 16, LIST_TUI_STATUS_MESSAGE_TIMEOUT_MS = 4000, LIST_WATCH_REFRESH_MS = 1000, RAF_BATCH_COUNT = 3, RANDOM_ID_END_INDEX = 11, REBUILD_BATCH_DELAY_MS = 10, REBUILD_RELOAD_DELAY_MS = 200, RECONNECT_INITIAL_DELAY_MS = 500, RECONNECT_POLL_INTERVAL_MS = 300, REACT_STREAM_SLOT_FAST_DELAY_MS = 5, REACT_STREAM_SLOT_SLOW_DELAY_MS = 20, SIGINT_EXIT_CODE = 130, SIGTERM_EXIT_CODE = 143, SVELTE_CSS_LOAD_TIMEOUT_MS = 500, TIME_PRECISION = 2, TWO_THIRDS, UNFOUND_INDEX = -1, WEBSOCKET_NORMAL_CLOSURE = 1000, WORKSPACE_COMMAND_ARGS_OFFSET = 3, WORKSPACE_FAILURE_LOG_PRINT_LIMIT = 30, WORKSPACE_FAILURE_RECENT_LOG_LIMIT = 60, WORKSPACE_READY_ATTEMPT_TIMEOUT_MS = 5000, WORKSPACE_READY_PROBE_INTERVAL_MS = 250, WORKSPACE_READY_TIMEOUT_MS = 30000, WORKSPACE_SHUTDOWN_TIMEOUT_MS = 1e4, WORKSPACE_TUI_DEFAULT_HEIGHT = 28, WORKSPACE_TUI_DEFAULT_WIDTH = 100, WORKSPACE_TUI_ESCAPE_SEQUENCE_TIMEOUT_MS = 30, WORKSPACE_TUI_FOOTER_LINE_COUNT = 3, WORKSPACE_TUI_MIN_LOG_HEIGHT = 3, WORKSPACE_TUI_MIN_SERVICE_NAME_WIDTH = 7, WORKSPACE_TUI_MIN_TARGET_WIDTH = 8, WORKSPACE_TUI_MIN_WRAP_WIDTH = 12, WORKSPACE_TUI_PROMPT_CURSOR_OFFSET = 3, WORKSPACE_TUI_RECENT_LOG_LIMIT = 40, WORKSPACE_TUI_RENDER_DEBOUNCE_MS = 16, WORKSPACE_TUI_STATUS_WIDTH = 10, WORKSPACE_TUI_TARGET_PADDING_WIDTH = 6, WORKSPACE_TUI_VISIBILITY_WIDTH = 8;
298
+ var init_constants = __esm(() => {
299
+ IMAGE_DEFAULT_DEVICE_SIZES = [
300
+ 640,
301
+ 750,
302
+ 828,
303
+ 1080,
304
+ 1200,
305
+ 1920,
306
+ 2048,
307
+ 3840
308
+ ];
309
+ IMAGE_DEFAULT_IMAGE_SIZES = [16, 32, 48, 64, 96, 128, 256, 384];
310
+ MILLISECONDS_IN_A_MINUTE = MILLISECONDS_IN_A_SECOND * SECONDS_IN_A_MINUTE;
311
+ MILLISECONDS_IN_A_DAY = MILLISECONDS_IN_A_SECOND * SECONDS_IN_A_MINUTE * MINUTES_IN_AN_HOUR * HOURS_IN_DAY;
312
+ TWO_THIRDS = 2 / 3;
313
+ });
314
+
315
315
  // src/utils/escapeScriptContent.ts
316
316
  var ESCAPE_LOOKUP, ESCAPE_REGEX, escapeScriptContent = (content) => content.replace(ESCAPE_REGEX, (char) => {
317
317
  const escaped = ESCAPE_LOOKUP[char];
@@ -1379,9 +1379,12 @@ var initDominoAdapter = (platformServer) => {
1379
1379
  return {
1380
1380
  APP_BASE_HREF: common.APP_BASE_HREF,
1381
1381
  bootstrapApplication: platformBrowser.bootstrapApplication,
1382
+ Component: core.Component,
1382
1383
  DomSanitizer: platformBrowser.DomSanitizer,
1383
1384
  ENVIRONMENT_INITIALIZER: core.ENVIRONMENT_INITIALIZER,
1384
1385
  inject: core.inject,
1386
+ InjectionToken: core.InjectionToken,
1387
+ NgComponentOutlet: common.NgComponentOutlet,
1385
1388
  provideClientHydration: platformBrowser.provideClientHydration,
1386
1389
  provideServerRendering: platformServer.provideServerRendering,
1387
1390
  provideZonelessChangeDetection: core.provideZonelessChangeDetection,
@@ -1637,9 +1640,8 @@ var angularIslandSelector = "abs-angular-island", isAngularComponent = (value) =
1637
1640
  const componentName = typeof component.name === "string" && component.name.length > 0 ? component.name : "AngularIsland";
1638
1641
  return `${componentName}:${JSON.stringify(props)}`;
1639
1642
  }, buildAngularIslandWrapperMetadata = async (component, islandId, wrapperKey) => {
1640
- const { Component, InjectionToken, inject } = await import("@angular/core");
1641
- const { NgComponentOutlet } = await import("@angular/common");
1642
1643
  const deps = await getAngularDeps();
1644
+ const { Component, InjectionToken, NgComponentOutlet, inject } = deps;
1643
1645
  const selector = getAngularIslandSelector(islandId);
1644
1646
  const propsToken = new InjectionToken(`${wrapperKey}:props`);
1645
1647
 
@@ -1745,7 +1747,15 @@ var init_islands2 = __esm(() => {
1745
1747
  var renderAngularIslandToHtmlInternal = async (component, props, islandId) => {
1746
1748
  const { renderAngularIslandToHtml: renderAngularIslandToHtml2 } = await Promise.resolve().then(() => (init_islands2(), exports_islands));
1747
1749
  return renderAngularIslandToHtml2(component, props, islandId);
1748
- }, renderAngularIslandToHtml2, renderReactIslandToHtml = (component, props) => import("react").then(({ createElement }) => import("react-dom/server").then(({ renderToStaticMarkup }) => renderToStaticMarkup(createElement(component, props)))), renderSvelteIslandToHtml = (component, props) => import("svelte/server").then(({ render }) => {
1750
+ }, renderAngularIslandToHtml2, LEADING_HOISTED_RESOURCE_RE, stripLeadingHoistedResources = (html) => {
1751
+ let result = html;
1752
+ let match = LEADING_HOISTED_RESOURCE_RE.exec(result);
1753
+ while (match) {
1754
+ result = result.slice(match[0].length);
1755
+ match = LEADING_HOISTED_RESOURCE_RE.exec(result);
1756
+ }
1757
+ return result.trimStart();
1758
+ }, renderReactIslandToHtml = (component, props) => import("react").then(({ createElement }) => import("react-dom/server").then(({ renderToString }) => stripLeadingHoistedResources(renderToString(createElement(component, props))))), renderSvelteIslandToHtml = (component, props) => import("svelte/server").then(({ render }) => {
1749
1759
  const { body } = render(component, { props });
1750
1760
  return body;
1751
1761
  }), renderVueIslandToHtml = (component, props) => import("vue").then(({ createSSRApp, h: createVueVNode }) => {
@@ -1756,10 +1766,311 @@ var renderAngularIslandToHtmlInternal = async (component, props, islandId) => {
1756
1766
  });
1757
1767
  var init_islandSsr = __esm(() => {
1758
1768
  renderAngularIslandToHtml2 = renderAngularIslandToHtmlInternal;
1769
+ LEADING_HOISTED_RESOURCE_RE = /^\s*(?:<link\b[^>]*\/?>|<meta\b[^>]*\/?>|<title\b[^>]*>[\s\S]*?<\/title>|<style\b[^>]*>[\s\S]*?<\/style>|<script\b[^>]*>[\s\S]*?<\/script>)/i;
1770
+ });
1771
+
1772
+ // src/build/nativeRewrite.ts
1773
+ import { dlopen, FFIType, ptr } from "bun:ffi";
1774
+ import { platform, arch } from "os";
1775
+ import { resolve as resolve2 } from "path";
1776
+ var ffiDefinition, nativeLib = null, loadNative = () => {
1777
+ if (nativeLib !== null)
1778
+ return nativeLib;
1779
+ const osPlatform = platform();
1780
+ const cpu = arch();
1781
+ const platformMap = {
1782
+ "darwin-arm64": "darwin-arm64/fast_ops.dylib",
1783
+ "darwin-x64": "darwin-x64/fast_ops.dylib",
1784
+ "linux-arm64": "linux-arm64/fast_ops.so",
1785
+ "linux-x64": "linux-x64/fast_ops.so",
1786
+ "win32-arm64": "windows-arm64/fast_ops.dll",
1787
+ "win32-x64": "windows-x64/fast_ops.dll"
1788
+ };
1789
+ const libPath = platformMap[`${osPlatform}-${cpu}`];
1790
+ if (!libPath)
1791
+ return null;
1792
+ try {
1793
+ const fullPath = resolve2(import.meta.dir, "../../native/packages", libPath);
1794
+ const lib = dlopen(fullPath, ffiDefinition);
1795
+ nativeLib = lib.symbols;
1796
+ return nativeLib;
1797
+ } catch {
1798
+ return null;
1799
+ }
1800
+ }, nativeRewriteImports = (content, replacements) => {
1801
+ const lib = loadNative();
1802
+ if (!lib)
1803
+ return null;
1804
+ const jsonStr = JSON.stringify(replacements);
1805
+ const contentBuf = Buffer.from(content);
1806
+ const jsonBuf = Buffer.from(jsonStr);
1807
+ const outBuf = Buffer.alloc(content.length * 2);
1808
+ const outLenBuf = new BigUint64Array([BigInt(outBuf.length)]);
1809
+ const result = lib.rewrite_imports(ptr(contentBuf), contentBuf.length, ptr(jsonBuf), jsonBuf.length, ptr(outBuf), ptr(new Uint8Array(outLenBuf.buffer)));
1810
+ if (result < 0)
1811
+ return null;
1812
+ if (result === 0)
1813
+ return content;
1814
+ const outLen = Number(outLenBuf[0]);
1815
+ return outBuf.subarray(0, outLen).toString("utf-8");
1816
+ };
1817
+ var init_nativeRewrite = __esm(() => {
1818
+ ffiDefinition = {
1819
+ rewrite_imports: {
1820
+ args: [
1821
+ FFIType.ptr,
1822
+ FFIType.u64,
1823
+ FFIType.ptr,
1824
+ FFIType.u64,
1825
+ FFIType.ptr,
1826
+ FFIType.ptr
1827
+ ],
1828
+ returns: FFIType.i32
1829
+ }
1830
+ };
1831
+ });
1832
+
1833
+ // src/build/rewriteImportsPlugin.ts
1834
+ var exports_rewriteImportsPlugin = {};
1835
+ __export(exports_rewriteImportsPlugin, {
1836
+ rewriteVendorDirectories: () => rewriteVendorDirectories,
1837
+ rewriteImportsInContent: () => rewriteImportsInContent,
1838
+ rewriteBuildOutputsWith: () => rewriteBuildOutputsWith,
1839
+ rewriteBuildOutputs: () => rewriteBuildOutputs,
1840
+ jsRewriteImports: () => jsRewriteImports,
1841
+ fixMissingReExportNamespacesInContent: () => fixMissingReExportNamespacesInContent,
1842
+ buildWithImportRewrite: () => buildWithImportRewrite
1843
+ });
1844
+ import { readdir } from "fs/promises";
1845
+ import { join as join2 } from "path";
1846
+ var escapeRegex = (str) => str.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"), jsRewriteImports = (content, replacements) => {
1847
+ let result = content;
1848
+ for (const [specifier, webPath] of replacements) {
1849
+ const escaped = escapeRegex(specifier);
1850
+ const fromRegex = new RegExp(`(from\\s*["'])${escaped}(["'])`, "g");
1851
+ const sideEffectRegex = new RegExp(`(import\\s*["'])${escaped}(["'])`, "g");
1852
+ const dynamicRegex = new RegExp(`(import\\s*\\(\\s*["'])${escaped}(["']\\s*\\))`, "g");
1853
+ result = result.replace(fromRegex, `$1${webPath}$2`);
1854
+ result = result.replace(sideEffectRegex, `$1${webPath}$2`);
1855
+ result = result.replace(dynamicRegex, `$1${webPath}$2`);
1856
+ }
1857
+ return result;
1858
+ }, rewriteImportsInContent = (content, vendorPaths) => {
1859
+ if (Object.keys(vendorPaths).length === 0)
1860
+ return content;
1861
+ const replacements = Object.entries(vendorPaths).sort(([keyA], [keyB]) => keyB.length - keyA.length);
1862
+ const native = nativeRewriteImports(content, replacements);
1863
+ return native ?? jsRewriteImports(content, replacements);
1864
+ }, fixMissingReExportNamespacesInContent = (content) => {
1865
+ const REEXPORT_PATTERN = /__reExport\(\s*[A-Za-z_$][\w$]*\s*,\s*([A-Za-z_$][\w$]*)\s*\)/g;
1866
+ REEXPORT_PATTERN.lastIndex = 0;
1867
+ const missing = [];
1868
+ let match;
1869
+ while ((match = REEXPORT_PATTERN.exec(content)) !== null) {
1870
+ const ident = match[1];
1871
+ if (!ident)
1872
+ continue;
1873
+ const nsImportRe = new RegExp(`\\bimport\\s*\\*\\s*as\\s+${ident}\\s+from\\b`);
1874
+ if (nsImportRe.test(content))
1875
+ continue;
1876
+ const declRe = new RegExp(`\\b(?:const|let|var|function|class)\\s+${ident}\\b`);
1877
+ if (declRe.test(content))
1878
+ continue;
1879
+ const namedImportRe = new RegExp(`\\bimport\\s*\\{[^}]*\\b${ident}\\b[^}]*\\}\\s*from\\b`);
1880
+ if (namedImportRe.test(content))
1881
+ continue;
1882
+ const importPathRe = /(?:from\s+|import\s*)["']([^"']+)["']/g;
1883
+ let pathMatch;
1884
+ let sourcePath;
1885
+ while ((pathMatch = importPathRe.exec(content)) !== null) {
1886
+ const p = pathMatch[1];
1887
+ if (!p)
1888
+ continue;
1889
+ const base = p.split("/").pop()?.replace(/\.[mc]?js$/, "");
1890
+ if (!base)
1891
+ continue;
1892
+ const normalized = base.startsWith("_") ? base.slice(1) : base;
1893
+ if (normalized === ident || normalized.endsWith(`_${ident}`)) {
1894
+ sourcePath = p;
1895
+ break;
1896
+ }
1897
+ }
1898
+ if (sourcePath)
1899
+ missing.push({ ident, path: sourcePath });
1900
+ }
1901
+ if (missing.length === 0)
1902
+ return content;
1903
+ const seen = new Set;
1904
+ const unique = missing.filter((entry) => {
1905
+ if (seen.has(entry.ident))
1906
+ return false;
1907
+ seen.add(entry.ident);
1908
+ return true;
1909
+ });
1910
+ const inserts = unique.map((entry) => `import * as ${entry.ident} from "${entry.path}";`).join(`
1911
+ `);
1912
+ return `${inserts}
1913
+ ${content}`;
1914
+ }, isReadableArtifact = (artifact) => artifact.path.endsWith(".js"), rewriteBuildOutputs = async (outputs, vendorPaths) => {
1915
+ if (Object.keys(vendorPaths).length === 0)
1916
+ return;
1917
+ await Promise.all(outputs.filter(isReadableArtifact).map(async (artifact) => {
1918
+ let original;
1919
+ try {
1920
+ original = await artifact.text();
1921
+ } catch (err) {
1922
+ const code = err.code;
1923
+ if (code === "ENOENT")
1924
+ return;
1925
+ throw err;
1926
+ }
1927
+ const rewritten = rewriteImportsInContent(original, vendorPaths);
1928
+ if (rewritten === original)
1929
+ return;
1930
+ try {
1931
+ await Bun.write(artifact.path, rewritten);
1932
+ } catch (err) {
1933
+ const code = err.code;
1934
+ if (code === "ENOENT")
1935
+ return;
1936
+ throw err;
1937
+ }
1938
+ }));
1939
+ }, rewriteBuildOutputsWith = async (outputs, resolveVendorPaths) => {
1940
+ await Promise.all(outputs.filter(isReadableArtifact).map(async (artifact) => {
1941
+ const vendorPaths = resolveVendorPaths(artifact);
1942
+ if (Object.keys(vendorPaths).length === 0)
1943
+ return;
1944
+ let original;
1945
+ try {
1946
+ original = await artifact.text();
1947
+ } catch (err) {
1948
+ const code = err.code;
1949
+ if (code === "ENOENT")
1950
+ return;
1951
+ throw err;
1952
+ }
1953
+ const rewritten = rewriteImportsInContent(original, vendorPaths);
1954
+ if (rewritten === original)
1955
+ return;
1956
+ try {
1957
+ await Bun.write(artifact.path, rewritten);
1958
+ } catch (err) {
1959
+ const code = err.code;
1960
+ if (code === "ENOENT")
1961
+ return;
1962
+ throw err;
1963
+ }
1964
+ }));
1965
+ }, rewriteVendorDirectories = async (vendorDirs, vendorPaths) => {
1966
+ if (Object.keys(vendorPaths).length === 0)
1967
+ return;
1968
+ const allFiles = [];
1969
+ for (const dir of vendorDirs) {
1970
+ try {
1971
+ const entries = await readdir(dir);
1972
+ for (const entry of entries) {
1973
+ if (entry.endsWith(".js"))
1974
+ allFiles.push(join2(dir, entry));
1975
+ }
1976
+ } catch {}
1977
+ }
1978
+ await Promise.all(allFiles.map(async (filePath) => {
1979
+ let original;
1980
+ try {
1981
+ original = await Bun.file(filePath).text();
1982
+ } catch (err) {
1983
+ const code = err.code;
1984
+ if (code === "ENOENT")
1985
+ return;
1986
+ throw err;
1987
+ }
1988
+ let next = rewriteImportsInContent(original, vendorPaths);
1989
+ next = fixMissingReExportNamespacesInContent(next);
1990
+ if (next === original)
1991
+ return;
1992
+ try {
1993
+ await Bun.write(filePath, next);
1994
+ } catch (err) {
1995
+ const code = err.code;
1996
+ if (code === "ENOENT")
1997
+ return;
1998
+ throw err;
1999
+ }
2000
+ }));
2001
+ }, buildWithImportRewrite = async (pendingBuild, vendorPaths) => {
2002
+ const result = await pendingBuild;
2003
+ if (result.outputs.length > 0) {
2004
+ await rewriteBuildOutputs(result.outputs, vendorPaths);
2005
+ }
2006
+ return result;
2007
+ };
2008
+ var init_rewriteImportsPlugin = __esm(() => {
2009
+ init_nativeRewrite();
2010
+ });
2011
+
2012
+ // src/core/angularServerModule.ts
2013
+ import { mkdir } from "fs/promises";
2014
+ import { dirname, join as join3, relative } from "path";
2015
+ var serverCacheRoot, compiledModuleCache, ANGULAR_SPECIFIER_RE, getCachedModulePath = (sourcePath) => {
2016
+ const relativeSourcePath = relative(process.cwd(), sourcePath).replace(/\\/g, "/");
2017
+ const normalizedSourcePath = relativeSourcePath.startsWith("..") ? sourcePath.replace(/[:\\/]/g, "_") : relativeSourcePath;
2018
+ return join3(serverCacheRoot, `${normalizedSourcePath}.server.js`);
2019
+ }, collectVendorPaths = (code) => {
2020
+ const vendorPaths = {};
2021
+ if (!isProductionRuntime()) {
2022
+ return vendorPaths;
2023
+ }
2024
+ const specifiers = new Set([...code.matchAll(ANGULAR_SPECIFIER_RE)].map((match) => match[1]));
2025
+ specifiers.forEach((specifier) => {
2026
+ if (!specifier)
2027
+ return;
2028
+ const resolved = resolveAngularRuntimePath(specifier);
2029
+ if (resolved === specifier)
2030
+ return;
2031
+ vendorPaths[specifier] = resolved;
2032
+ });
2033
+ return vendorPaths;
2034
+ }, buildAngularServerModule = async (sourcePath) => {
2035
+ const result = await Bun.build({
2036
+ entrypoints: [sourcePath],
2037
+ format: "esm",
2038
+ packages: "external",
2039
+ target: "bun",
2040
+ throw: false
2041
+ });
2042
+ const entry = result.outputs.find((output) => output.kind === "entry-point");
2043
+ if (!result.success || !entry) {
2044
+ const message = result.logs.map((log2) => String(log2)).join(`
2045
+ `);
2046
+ throw new Error(`Failed to compile Angular island server module for "${sourcePath}":
2047
+ ${message}`);
2048
+ }
2049
+ const code = await entry.text();
2050
+ const rewritten = rewriteImportsInContent(code, collectVendorPaths(code));
2051
+ const modulePath = getCachedModulePath(sourcePath);
2052
+ await mkdir(dirname(modulePath), { recursive: true });
2053
+ await Bun.write(modulePath, rewritten);
2054
+ return modulePath;
2055
+ }, compileAngularServerModule = (sourcePath) => {
2056
+ const cached = compiledModuleCache.get(sourcePath);
2057
+ if (cached) {
2058
+ return cached;
2059
+ }
2060
+ const compiledModulePromise = buildAngularServerModule(sourcePath);
2061
+ compiledModuleCache.set(sourcePath, compiledModulePromise);
2062
+ return compiledModulePromise;
2063
+ };
2064
+ var init_angularServerModule = __esm(() => {
2065
+ init_resolveAngularPackage();
2066
+ init_rewriteImportsPlugin();
2067
+ serverCacheRoot = join3(process.cwd(), ".absolutejs", "islands", "angular");
2068
+ compiledModuleCache = new Map;
2069
+ ANGULAR_SPECIFIER_RE = /["'](@angular\/[^"']+)["']/g;
1759
2070
  });
1760
2071
 
1761
2072
  // src/build/resolvePackageImport.ts
1762
- import { resolve as resolve2, join as join2 } from "path";
2073
+ import { resolve as resolve3, join as join4 } from "path";
1763
2074
  import { existsSync as existsSync2, readFileSync as readFileSync2 } from "fs";
1764
2075
  var resolveExportPath = (entry, conditions) => {
1765
2076
  if (typeof entry === "string")
@@ -1781,11 +2092,11 @@ var resolveExportPath = (entry, conditions) => {
1781
2092
  const packageName = isScoped ? `${parts[0]}/${parts[1]}` : parts[0];
1782
2093
  const subpath = isScoped ? parts.slice(2).join("/") : parts.slice(1).join("/");
1783
2094
  const exportKey = subpath ? `./${subpath}` : ".";
1784
- const currentPackageJsonPath = resolve2(process.cwd(), "package.json");
2095
+ const currentPackageJsonPath = resolve3(process.cwd(), "package.json");
1785
2096
  const currentPackageJson = existsSync2(currentPackageJsonPath) ? JSON.parse(readFileSync2(currentPackageJsonPath, "utf-8")) : null;
1786
2097
  const currentPackageDir = currentPackageJson?.name === packageName ? process.cwd() : null;
1787
- const packageDir = currentPackageDir ?? resolve2(process.cwd(), "node_modules", packageName ?? "");
1788
- const packageJsonPath = join2(packageDir, "package.json");
2098
+ const packageDir = currentPackageDir ?? resolve3(process.cwd(), "node_modules", packageName ?? "");
2099
+ const packageJsonPath = join4(packageDir, "package.json");
1789
2100
  if (!existsSync2(packageJsonPath))
1790
2101
  return null;
1791
2102
  try {
@@ -1800,12 +2111,12 @@ var resolveExportPath = (entry, conditions) => {
1800
2111
  if (!importPath)
1801
2112
  return null;
1802
2113
  if (currentPackageDir && importPath.startsWith("./dist/")) {
1803
- const sourceCandidate = resolve2(packageDir, importPath.replace(/^\.\/dist\//, "./src/"));
2114
+ const sourceCandidate = resolve3(packageDir, importPath.replace(/^\.\/dist\//, "./src/"));
1804
2115
  if (existsSync2(sourceCandidate)) {
1805
2116
  return sourceCandidate;
1806
2117
  }
1807
2118
  }
1808
- const resolved = resolve2(packageDir, importPath);
2119
+ const resolved = resolve3(packageDir, importPath);
1809
2120
  return existsSync2(resolved) ? resolved : null;
1810
2121
  } catch {
1811
2122
  return null;
@@ -1962,12 +2273,12 @@ import { existsSync as existsSync3, readFileSync as readFileSync3 } from "fs";
1962
2273
  import { readFile } from "fs/promises";
1963
2274
  import { createRequire } from "module";
1964
2275
  import {
1965
- dirname,
2276
+ dirname as dirname2,
1966
2277
  extname,
1967
2278
  isAbsolute,
1968
- join as join3,
1969
- relative,
1970
- resolve as resolve3
2279
+ join as join5,
2280
+ relative as relative2,
2281
+ resolve as resolve4
1971
2282
  } from "path";
1972
2283
  import { fileURLToPath, pathToFileURL } from "url";
1973
2284
  var CSS_EXTENSION_PATTERN, STYLE_EXTENSION_PATTERN, STYLE_MODULE_EXTENSION_PATTERN, STYLE_LANGUAGE_PATTERN, importOptionalPeer, requireOptionalPeer, requireFromCwd, isPreprocessableStylePath = (filePath) => STYLE_EXTENSION_PATTERN.test(filePath), isStyleModulePath = (filePath) => STYLE_MODULE_EXTENSION_PATTERN.test(filePath), isStylePath = (filePath) => /\.(css|s[ac]ss|less|styl(?:us)?)$/i.test(filePath), getStyleBaseName = (filePath) => filePath.replace(/\.(css|s[ac]ss|less|styl(?:us)?)$/i, ""), getStyleLanguage = (filePathOrLanguage) => {
@@ -2003,9 +2314,9 @@ ${message}`);
2003
2314
  return requireOptionalPeer(specifier);
2004
2315
  }
2005
2316
  }, normalizeLoadPaths = (filePath, paths = []) => [
2006
- dirname(filePath),
2317
+ dirname2(filePath),
2007
2318
  process.cwd(),
2008
- ...paths.map((path) => resolve3(process.cwd(), path))
2319
+ ...paths.map((path) => resolve4(process.cwd(), path))
2009
2320
  ], tsconfigAliasCache, stripJsonComments = (source) => source.replace(/\/\*[\s\S]*?\*\//g, "").replace(/(^|[^:])\/\/.*$/gm, "$1"), normalizeAliasEntries = (aliases) => Object.entries(aliases ?? {}).map(([pattern, value]) => ({
2010
2321
  pattern,
2011
2322
  replacements: Array.isArray(value) ? value : [value]
@@ -2013,7 +2324,7 @@ ${message}`);
2013
2324
  const cwd = process.cwd();
2014
2325
  if (tsconfigAliasCache?.cwd === cwd)
2015
2326
  return tsconfigAliasCache;
2016
- const tsconfigPath = resolve3(cwd, "tsconfig.json");
2327
+ const tsconfigPath = resolve4(cwd, "tsconfig.json");
2017
2328
  const empty = { aliases: [], baseUrl: cwd, cwd };
2018
2329
  if (!existsSync3(tsconfigPath)) {
2019
2330
  tsconfigAliasCache = empty;
@@ -2022,7 +2333,7 @@ ${message}`);
2022
2333
  try {
2023
2334
  const parsed = JSON.parse(stripJsonComments(readFileSync3(tsconfigPath, "utf-8")));
2024
2335
  const compilerOptions = parsed.compilerOptions ?? {};
2025
- const baseUrl = resolve3(cwd, compilerOptions.baseUrl ?? ".");
2336
+ const baseUrl = resolve4(cwd, compilerOptions.baseUrl ?? ".");
2026
2337
  tsconfigAliasCache = {
2027
2338
  aliases: normalizeAliasEntries(compilerOptions.paths),
2028
2339
  baseUrl,
@@ -2050,7 +2361,7 @@ ${message}`);
2050
2361
  continue;
2051
2362
  const wildcard = match[1] ?? "";
2052
2363
  for (const replacement of alias.replacements) {
2053
- targets.push(resolve3(baseUrl, replacement.replace("*", wildcard)));
2364
+ targets.push(resolve4(baseUrl, replacement.replace("*", wildcard)));
2054
2365
  }
2055
2366
  }
2056
2367
  return targets;
@@ -2064,21 +2375,21 @@ ${message}`);
2064
2375
  const ext = extname(basePath);
2065
2376
  const paths = ext ? [basePath] : getLanguageExtensions(language).flatMap((extension) => [
2066
2377
  `${basePath}${extension}`,
2067
- join3(basePath, `index${extension}`)
2378
+ join5(basePath, `index${extension}`)
2068
2379
  ]);
2069
2380
  if (language === "scss" || language === "sass") {
2070
2381
  return paths.flatMap((path) => {
2071
- const dir = dirname(path);
2382
+ const dir = dirname2(path);
2072
2383
  const base = path.slice(dir.length + 1);
2073
- return [path, join3(dir, `_${base}`)];
2384
+ return [path, join5(dir, `_${base}`)];
2074
2385
  });
2075
2386
  }
2076
2387
  return paths;
2077
2388
  }, resolveImportPath = (specifier, fromDirectory, loadPaths, language, config) => {
2078
2389
  const rawCandidates = [
2079
2390
  ...resolveAliasTargets(specifier, config),
2080
- isAbsolute(specifier) ? specifier : resolve3(fromDirectory, specifier),
2081
- ...loadPaths.map((path) => resolve3(path, specifier))
2391
+ isAbsolute(specifier) ? specifier : resolve4(fromDirectory, specifier),
2392
+ ...loadPaths.map((path) => resolve4(path, specifier))
2082
2393
  ];
2083
2394
  for (const candidate of rawCandidates.flatMap((path) => getCandidatePaths(path, language))) {
2084
2395
  if (existsSync3(candidate))
@@ -2094,8 +2405,8 @@ ${message}`);
2094
2405
  path: url.slice(0, markerIndex)
2095
2406
  };
2096
2407
  }, rebaseCssUrls = (contents, sourceFile, entryFile) => {
2097
- const sourceDir = dirname(sourceFile);
2098
- const entryDir = dirname(entryFile);
2408
+ const sourceDir = dirname2(sourceFile);
2409
+ const entryDir = dirname2(entryFile);
2099
2410
  if (sourceDir === entryDir)
2100
2411
  return contents;
2101
2412
  return contents.replace(/url\(\s*(['"]?)([^'")]+)\1\s*\)/gi, (match, quote, rawUrl) => {
@@ -2103,7 +2414,7 @@ ${message}`);
2103
2414
  if (!trimmedUrl || isExternalCssUrl(trimmedUrl))
2104
2415
  return match;
2105
2416
  const { marker, path } = splitCssUrl(trimmedUrl);
2106
- const rebased = relative(entryDir, resolve3(sourceDir, path)).replace(/\\/g, "/");
2417
+ const rebased = relative2(entryDir, resolve4(sourceDir, path)).replace(/\\/g, "/");
2107
2418
  const normalized = rebased.startsWith(".") ? rebased : `./${rebased}`;
2108
2419
  const nextQuote = quote || '"';
2109
2420
  return `url(${nextQuote}${normalized}${marker}${nextQuote})`;
@@ -2111,7 +2422,7 @@ ${message}`);
2111
2422
  }, rewriteAliasedStyleImports = (contents, sourceFile, loadPaths, language, config) => contents.replace(/(@(?:use|forward|import|require)\s+)(["'])([^"']+)\2/g, (match, prefix, quote, specifier) => {
2112
2423
  if (specifier.startsWith(".") || isAbsolute(specifier) || isExternalCssUrl(specifier))
2113
2424
  return match;
2114
- const resolved = resolveImportPath(specifier, dirname(sourceFile), loadPaths, language, config);
2425
+ const resolved = resolveImportPath(specifier, dirname2(sourceFile), loadPaths, language, config);
2115
2426
  return resolved ? `${prefix}${quote}${resolved}${quote}` : match;
2116
2427
  }), preprocessLoadedStyle = (contents, sourceFile, entryFile, loadPaths = [], language, config) => {
2117
2428
  const rebased = rebaseCssUrls(contents, sourceFile, entryFile);
@@ -2141,7 +2452,7 @@ ${contents}` : contents, normalizePostcssModule = (mod) => {
2141
2452
  }
2142
2453
  return mod;
2143
2454
  }, loadPostcssConfigFile = async (configPath) => {
2144
- const resolved = resolve3(process.cwd(), configPath);
2455
+ const resolved = resolve4(process.cwd(), configPath);
2145
2456
  const loaded = resolved.endsWith(".cjs") || resolved.endsWith(".cts") ? requireOptionalPeerSync(resolved) : await importOptionalPeer(`${new URL(`file://${resolved}`).href}?t=${Date.now()}`);
2146
2457
  const config = normalizePostcssModule(loaded);
2147
2458
  const value = typeof config === "function" ? await config({
@@ -2201,9 +2512,9 @@ ${contents}` : contents, normalizePostcssModule = (mod) => {
2201
2512
  return result.css;
2202
2513
  }, createSassImporter = (entryFile, loadPaths, language, config, deps) => ({
2203
2514
  canonicalize(specifier, options) {
2204
- const fromDirectory = options.containingUrl ? dirname(fileURLToPath(options.containingUrl)) : dirname(entryFile);
2515
+ const fromDirectory = options.containingUrl ? dirname2(fileURLToPath(options.containingUrl)) : dirname2(entryFile);
2205
2516
  const resolved = resolveImportPath(specifier, fromDirectory, loadPaths, language, config);
2206
- return resolved ? new URL(pathToFileURL(resolve3(resolved)).href) : null;
2517
+ return resolved ? new URL(pathToFileURL(resolve4(resolved)).href) : null;
2207
2518
  },
2208
2519
  load(canonicalUrl) {
2209
2520
  const filePath = fileURLToPath(canonicalUrl);
@@ -2220,9 +2531,9 @@ ${contents}` : contents, normalizePostcssModule = (mod) => {
2220
2531
  install(less, pluginManager) {
2221
2532
  const baseManager = new less.FileManager;
2222
2533
  const manager = Object.create(baseManager);
2223
- manager.supports = (filename, currentDirectory) => Boolean(resolveImportPath(filename, resolve3(currentDirectory), loadPaths, "less", config));
2534
+ manager.supports = (filename, currentDirectory) => Boolean(resolveImportPath(filename, resolve4(currentDirectory), loadPaths, "less", config));
2224
2535
  manager.loadFile = async (filename, currentDirectory) => {
2225
- const resolved = resolveImportPath(filename, resolve3(currentDirectory), loadPaths, "less", config);
2536
+ const resolved = resolveImportPath(filename, resolve4(currentDirectory), loadPaths, "less", config);
2226
2537
  if (!resolved) {
2227
2538
  throw new Error(`Unable to resolve Less import "${filename}"`);
2228
2539
  }
@@ -2259,29 +2570,29 @@ ${contents}` : contents, normalizePostcssModule = (mod) => {
2259
2570
  const stylusDeps = renderer.deps?.();
2260
2571
  if (Array.isArray(stylusDeps)) {
2261
2572
  for (const dep of stylusDeps)
2262
- deps.add(resolve3(dep));
2573
+ deps.add(resolve4(dep));
2263
2574
  }
2264
2575
  }
2265
2576
  resolveCss(css ?? "");
2266
2577
  });
2267
2578
  });
2268
2579
  }, styleDependencyGraph, styleOutputHashes, recordStyleDeps = (entry, deps) => {
2269
- const key = resolve3(entry);
2580
+ const key = resolve4(entry);
2270
2581
  const stripped = new Set;
2271
2582
  for (const dep of deps) {
2272
- const resolved = resolve3(dep);
2583
+ const resolved = resolve4(dep);
2273
2584
  if (resolved !== key)
2274
2585
  stripped.add(resolved);
2275
2586
  }
2276
2587
  styleDependencyGraph.set(key, stripped);
2277
2588
  }, addStyleImporter = (importerPath, stylePath) => {
2278
- const key = resolve3(importerPath);
2279
- const target = resolve3(stylePath);
2589
+ const key = resolve4(importerPath);
2590
+ const target = resolve4(stylePath);
2280
2591
  const deps = styleDependencyGraph.get(key) ?? new Set;
2281
2592
  deps.add(target);
2282
2593
  styleDependencyGraph.set(key, deps);
2283
2594
  }, findStyleEntriesImporting = (changedPath) => {
2284
- const target = resolve3(changedPath);
2595
+ const target = resolve4(changedPath);
2285
2596
  const importers = [];
2286
2597
  for (const [entry, deps] of styleDependencyGraph) {
2287
2598
  if (deps.has(target))
@@ -2289,13 +2600,13 @@ ${contents}` : contents, normalizePostcssModule = (mod) => {
2289
2600
  }
2290
2601
  return importers;
2291
2602
  }, recordStyleOutput = (entry, css) => {
2292
- const key = resolve3(entry);
2603
+ const key = resolve4(entry);
2293
2604
  const hash = createHash("sha1").update(css).digest("hex");
2294
2605
  const previous = styleOutputHashes.get(key);
2295
2606
  styleOutputHashes.set(key, hash);
2296
2607
  return previous !== hash;
2297
2608
  }, forgetStyleEntry = (entry) => {
2298
- const key = resolve3(entry);
2609
+ const key = resolve4(entry);
2299
2610
  styleDependencyGraph.delete(key);
2300
2611
  styleOutputHashes.delete(key);
2301
2612
  }, compileStyleSource = async (filePath, source, languageHint, config) => {
@@ -2321,7 +2632,7 @@ ${contents}` : contents, normalizePostcssModule = (mod) => {
2321
2632
  loadPaths,
2322
2633
  style: "expanded",
2323
2634
  syntax: language === "sass" ? "indented" : "scss",
2324
- url: new URL(pathToFileURL(resolve3(filePath)).href)
2635
+ url: new URL(pathToFileURL(resolve4(filePath)).href)
2325
2636
  });
2326
2637
  const css = await runPostcss(result.css, filePath, config);
2327
2638
  const loadedUrls = result.loadedUrls ?? [];
@@ -2329,7 +2640,7 @@ ${contents}` : contents, normalizePostcssModule = (mod) => {
2329
2640
  if (url.protocol !== "file:")
2330
2641
  continue;
2331
2642
  const dep = fileURLToPath(url);
2332
- if (resolve3(dep) === resolve3(filePath))
2643
+ if (resolve4(dep) === resolve4(filePath))
2333
2644
  continue;
2334
2645
  deps.add(dep);
2335
2646
  }
@@ -2450,7 +2761,7 @@ ${contents}` : contents, normalizePostcssModule = (mod) => {
2450
2761
  const start = match.index ?? 0;
2451
2762
  const end = start + match[0].length;
2452
2763
  parts.push(content.slice(cursor, start));
2453
- const fullPath = isAbsolute(importPath) ? importPath : resolve3(baseDir, importPath);
2764
+ const fullPath = isAbsolute(importPath) ? importPath : resolve4(baseDir, importPath);
2454
2765
  if (visited.has(fullPath) || !existsSync3(fullPath)) {
2455
2766
  parts.push(visited.has(fullPath) ? "" : match[0]);
2456
2767
  cursor = end;
@@ -2459,7 +2770,7 @@ ${contents}` : contents, normalizePostcssModule = (mod) => {
2459
2770
  const nextVisited = new Set(visited);
2460
2771
  nextVisited.add(fullPath);
2461
2772
  const imported = await readFile(fullPath, "utf-8");
2462
- parts.push(await resolveCssImportsAsync(imported, dirname(fullPath), nextVisited));
2773
+ parts.push(await resolveCssImportsAsync(imported, dirname2(fullPath), nextVisited));
2463
2774
  cursor = end;
2464
2775
  }
2465
2776
  parts.push(content.slice(cursor));
@@ -2468,13 +2779,13 @@ ${contents}` : contents, normalizePostcssModule = (mod) => {
2468
2779
  if (!isPreprocessableStylePath(filePath)) {
2469
2780
  const raw = await readFile(filePath, "utf-8");
2470
2781
  const processed = await runPostcss(raw, filePath, config);
2471
- return resolveCssImportsAsync(processed, dirname(filePath), new Set([filePath]));
2782
+ return resolveCssImportsAsync(processed, dirname2(filePath), new Set([filePath]));
2472
2783
  }
2473
2784
  const compiled = await compileStyleSource(filePath, undefined, undefined, config);
2474
- return resolveCssImportsAsync(compiled, dirname(filePath), new Set([filePath]));
2785
+ return resolveCssImportsAsync(compiled, dirname2(filePath), new Set([filePath]));
2475
2786
  }, resolveCssImportsSync = (content, baseDir, visited) => {
2476
2787
  return content.replace(CSS_IMPORT_PATTERN, (match, importPath) => {
2477
- const fullPath = isAbsolute(importPath) ? importPath : resolve3(baseDir, importPath);
2788
+ const fullPath = isAbsolute(importPath) ? importPath : resolve4(baseDir, importPath);
2478
2789
  if (visited.has(fullPath))
2479
2790
  return "";
2480
2791
  if (!existsSync3(fullPath))
@@ -2482,7 +2793,7 @@ ${contents}` : contents, normalizePostcssModule = (mod) => {
2482
2793
  const nextVisited = new Set(visited);
2483
2794
  nextVisited.add(fullPath);
2484
2795
  const imported = readFileSync3(fullPath, "utf-8");
2485
- return resolveCssImportsSync(imported, dirname(fullPath), nextVisited);
2796
+ return resolveCssImportsSync(imported, dirname2(fullPath), nextVisited);
2486
2797
  });
2487
2798
  }, compileStyleFileIfNeededSync = (filePath, config) => {
2488
2799
  const rawContents = readFileSync3(filePath, "utf-8");
@@ -2508,18 +2819,18 @@ ${contents}` : contents, normalizePostcssModule = (mod) => {
2508
2819
  loadPaths,
2509
2820
  style: "expanded",
2510
2821
  syntax: language === "sass" ? "indented" : "scss",
2511
- url: new URL(pathToFileURL(resolve3(filePath)).href)
2822
+ url: new URL(pathToFileURL(resolve4(filePath)).href)
2512
2823
  });
2513
2824
  const loadedUrls = result.loadedUrls ?? [];
2514
2825
  for (const url of loadedUrls) {
2515
2826
  if (url.protocol !== "file:")
2516
2827
  continue;
2517
2828
  const dep = fileURLToPath(url);
2518
- if (resolve3(dep) === resolve3(filePath))
2829
+ if (resolve4(dep) === resolve4(filePath))
2519
2830
  continue;
2520
2831
  addStyleImporter(filePath, dep);
2521
2832
  }
2522
- return resolveCssImportsSync(result.css, dirname(filePath), new Set([filePath]));
2833
+ return resolveCssImportsSync(result.css, dirname2(filePath), new Set([filePath]));
2523
2834
  }
2524
2835
  if (language === "less") {
2525
2836
  throw new Error(`Unable to compile ${filePath}: Less styleUrl preprocessing is async-only. Import the Less file from a bundled entrypoint or use SCSS/CSS for Angular styleUrl.`);
@@ -2527,7 +2838,7 @@ ${contents}` : contents, normalizePostcssModule = (mod) => {
2527
2838
  if (language === "stylus") {
2528
2839
  throw new Error(`Unable to compile ${filePath}: Stylus styleUrl preprocessing is async-only. Import the Stylus file from a bundled entrypoint or use SCSS/CSS for Angular styleUrl.`);
2529
2840
  }
2530
- return resolveCssImportsSync(rawContents, dirname(filePath), new Set([filePath]));
2841
+ return resolveCssImportsSync(rawContents, dirname2(filePath), new Set([filePath]));
2531
2842
  }, getCssOutputExtension = (filePath) => isPreprocessableStylePath(filePath) ? ".css" : extname(filePath);
2532
2843
  var init_stylePreprocessor = __esm(() => {
2533
2844
  CSS_EXTENSION_PATTERN = /\.css$/i;
@@ -2536,7 +2847,7 @@ var init_stylePreprocessor = __esm(() => {
2536
2847
  STYLE_LANGUAGE_PATTERN = /^(s[ac]ss|less|styl(?:us)?)$/i;
2537
2848
  importOptionalPeer = new Function("specifier", "return import(specifier)");
2538
2849
  requireOptionalPeer = new Function("specifier", "return require(specifier)");
2539
- requireFromCwd = createRequire(join3(process.cwd(), "package.json"));
2850
+ requireFromCwd = createRequire(join5(process.cwd(), "package.json"));
2540
2851
  styleDependencyGraph = new Map;
2541
2852
  styleOutputHashes = new Map;
2542
2853
  stylePreprocessorPlugin = createStylePreprocessorPlugin();
@@ -2544,14 +2855,14 @@ var init_stylePreprocessor = __esm(() => {
2544
2855
  });
2545
2856
 
2546
2857
  // src/core/svelteServerModule.ts
2547
- import { mkdir, readdir } from "fs/promises";
2548
- import { basename as basename2, dirname as dirname2, extname as extname2, join as join4, relative as relative2, resolve as resolve4 } from "path";
2549
- var serverCacheRoot, compiledModuleCache, originalSourcePathCache, transpiler, ensureRelativeImportPath = (from, target) => {
2550
- const importPath = relative2(dirname2(from), target).replace(/\\/g, "/");
2858
+ import { mkdir as mkdir2, readdir as readdir2 } from "fs/promises";
2859
+ import { basename as basename2, dirname as dirname3, extname as extname2, join as join6, relative as relative3, resolve as resolve5 } from "path";
2860
+ var serverCacheRoot2, compiledModuleCache2, originalSourcePathCache, transpiler, ensureRelativeImportPath = (from, target) => {
2861
+ const importPath = relative3(dirname3(from), target).replace(/\\/g, "/");
2551
2862
  return importPath.startsWith(".") ? importPath : `./${importPath}`;
2552
2863
  }, processDirectoryEntries = (entries, dir, targetFileName, stack) => {
2553
2864
  for (const entry of entries) {
2554
- const entryPath = join4(dir, entry.name);
2865
+ const entryPath = join6(dir, entry.name);
2555
2866
  if (entry.isDirectory())
2556
2867
  stack.push(entryPath);
2557
2868
  if (entry.isFile() && entry.name === targetFileName) {
@@ -2565,7 +2876,7 @@ var serverCacheRoot, compiledModuleCache, originalSourcePathCache, transpiler, e
2565
2876
  const nextStack = [];
2566
2877
  const dirEntries = await Promise.all(dirs.map(async (dir) => ({
2567
2878
  dir,
2568
- entries: await readdir(dir, {
2879
+ entries: await readdir2(dir, {
2569
2880
  encoding: "utf-8",
2570
2881
  withFileTypes: true
2571
2882
  })
@@ -2581,11 +2892,11 @@ var serverCacheRoot, compiledModuleCache, originalSourcePathCache, transpiler, e
2581
2892
  if (cachedPath !== undefined) {
2582
2893
  return cachedPath;
2583
2894
  }
2584
- if (!sourcePath.includes(`${join4(process.cwd(), "build")}${process.platform === "win32" ? "" : "/"}`) && !sourcePath.includes("/build/")) {
2895
+ if (!sourcePath.includes(`${join6(process.cwd(), "build")}${process.platform === "win32" ? "" : "/"}`) && !sourcePath.includes("/build/")) {
2585
2896
  originalSourcePathCache.set(sourcePath, sourcePath);
2586
2897
  return sourcePath;
2587
2898
  }
2588
- const resolvedSourcePath = await findSourceFileByBasename(join4(process.cwd(), "src"), normalizeBuiltSvelteFileName(sourcePath));
2899
+ const resolvedSourcePath = await findSourceFileByBasename(join6(process.cwd(), "src"), normalizeBuiltSvelteFileName(sourcePath));
2589
2900
  const nextPath = resolvedSourcePath ?? sourcePath;
2590
2901
  originalSourcePathCache.set(sourcePath, nextPath);
2591
2902
  return nextPath;
@@ -2593,7 +2904,7 @@ var serverCacheRoot, compiledModuleCache, originalSourcePathCache, transpiler, e
2593
2904
  if (!spec.startsWith(".")) {
2594
2905
  return null;
2595
2906
  }
2596
- const basePath = resolve4(dirname2(from), spec);
2907
+ const basePath = resolve5(dirname3(from), spec);
2597
2908
  const candidates = [
2598
2909
  basePath,
2599
2910
  `${basePath}.ts`,
@@ -2601,19 +2912,19 @@ var serverCacheRoot, compiledModuleCache, originalSourcePathCache, transpiler, e
2601
2912
  `${basePath}.mjs`,
2602
2913
  `${basePath}.cjs`,
2603
2914
  `${basePath}.json`,
2604
- join4(basePath, "index.ts"),
2605
- join4(basePath, "index.js"),
2606
- join4(basePath, "index.mjs"),
2607
- join4(basePath, "index.cjs"),
2608
- join4(basePath, "index.json")
2915
+ join6(basePath, "index.ts"),
2916
+ join6(basePath, "index.js"),
2917
+ join6(basePath, "index.mjs"),
2918
+ join6(basePath, "index.cjs"),
2919
+ join6(basePath, "index.json")
2609
2920
  ];
2610
2921
  const existResults = await Promise.all(candidates.map((candidate) => Bun.file(candidate).exists()));
2611
2922
  const foundIndex = existResults.indexOf(true);
2612
2923
  return foundIndex >= 0 ? candidates[foundIndex] ?? null : null;
2613
- }, getCachedModulePath = (sourcePath) => {
2614
- const relativeSourcePath = relative2(process.cwd(), sourcePath).replace(/\\/g, "/");
2924
+ }, getCachedModulePath2 = (sourcePath) => {
2925
+ const relativeSourcePath = relative3(process.cwd(), sourcePath).replace(/\\/g, "/");
2615
2926
  const normalizedSourcePath = relativeSourcePath.startsWith("..") ? sourcePath.replace(/[:\\/]/g, "_") : relativeSourcePath;
2616
- return join4(serverCacheRoot, `${normalizedSourcePath}.server.js`);
2927
+ return join6(serverCacheRoot2, `${normalizedSourcePath}.server.js`);
2617
2928
  }, resolveSvelteImport = async (spec, from) => {
2618
2929
  if (!spec.startsWith(".") && !spec.startsWith("/")) {
2619
2930
  const resolved = resolvePackageImport(spec);
@@ -2625,7 +2936,7 @@ var serverCacheRoot, compiledModuleCache, originalSourcePathCache, transpiler, e
2625
2936
  if (!spec.startsWith(".")) {
2626
2937
  return null;
2627
2938
  }
2628
- const explicitPath = resolve4(dirname2(from), spec);
2939
+ const explicitPath = resolve5(dirname3(from), spec);
2629
2940
  if (extname2(explicitPath) === ".svelte") {
2630
2941
  return explicitPath;
2631
2942
  }
@@ -2645,7 +2956,7 @@ var serverCacheRoot, compiledModuleCache, originalSourcePathCache, transpiler, e
2645
2956
  }
2646
2957
  await Bun.write(path, content);
2647
2958
  }, compileSvelteServerModule = async (sourcePath) => {
2648
- const cachedModulePath = compiledModuleCache.get(sourcePath);
2959
+ const cachedModulePath = compiledModuleCache2.get(sourcePath);
2649
2960
  if (cachedModulePath) {
2650
2961
  return cachedModulePath;
2651
2962
  }
@@ -2684,7 +2995,7 @@ var serverCacheRoot, compiledModuleCache, originalSourcePathCache, transpiler, e
2684
2995
  continue;
2685
2996
  if (resolvedChildModules[index])
2686
2997
  continue;
2687
- rewrittenModulePaths.set(spec, ensureRelativeImportPath(getCachedModulePath(sourcePath), resolvedModuleImport));
2998
+ rewrittenModulePaths.set(spec, ensureRelativeImportPath(getCachedModulePath2(sourcePath), resolvedModuleImport));
2688
2999
  }
2689
3000
  for (const [spec, resolvedModuleImport] of rewrittenModulePaths) {
2690
3001
  transpiled = transpiled.replaceAll(spec, resolvedModuleImport);
@@ -2698,15 +3009,15 @@ var serverCacheRoot, compiledModuleCache, originalSourcePathCache, transpiler, e
2698
3009
  generate: "server"
2699
3010
  }).js.code;
2700
3011
  for (const [spec, compiledChildPath] of childModulePaths) {
2701
- compiledCode = compiledCode.replaceAll(spec, ensureRelativeImportPath(getCachedModulePath(sourcePath), compiledChildPath));
3012
+ compiledCode = compiledCode.replaceAll(spec, ensureRelativeImportPath(getCachedModulePath2(sourcePath), compiledChildPath));
2702
3013
  }
2703
3014
  for (const [spec, resolvedModuleImport] of rewrittenModulePaths) {
2704
3015
  compiledCode = compiledCode.replaceAll(spec, resolvedModuleImport);
2705
3016
  }
2706
- const compiledModulePath = getCachedModulePath(sourcePath);
2707
- await mkdir(dirname2(compiledModulePath), { recursive: true });
3017
+ const compiledModulePath = getCachedModulePath2(sourcePath);
3018
+ await mkdir2(dirname3(compiledModulePath), { recursive: true });
2708
3019
  await writeIfChanged(compiledModulePath, compiledCode);
2709
- compiledModuleCache.set(sourcePath, compiledModulePath);
3020
+ compiledModuleCache2.set(sourcePath, compiledModulePath);
2710
3021
  return compiledModulePath;
2711
3022
  };
2712
3023
  var init_svelteServerModule = __esm(() => {
@@ -2714,8 +3025,8 @@ var init_svelteServerModule = __esm(() => {
2714
3025
  init_lowerIslandSyntax();
2715
3026
  init_lowerAwaitSlotSyntax();
2716
3027
  init_stylePreprocessor();
2717
- serverCacheRoot = join4(process.cwd(), ".absolutejs", "islands", "svelte");
2718
- compiledModuleCache = new Map;
3028
+ serverCacheRoot2 = join6(process.cwd(), ".absolutejs", "islands", "svelte");
3029
+ compiledModuleCache2 = new Map;
2719
3030
  originalSourcePathCache = new Map;
2720
3031
  transpiler = new Bun.Transpiler({
2721
3032
  loader: "ts",
@@ -2725,16 +3036,16 @@ var init_svelteServerModule = __esm(() => {
2725
3036
 
2726
3037
  // src/core/vueServerModule.ts
2727
3038
  import { existsSync as existsSync4, readFileSync as readFileSync4, realpathSync } from "fs";
2728
- import { mkdir as mkdir2 } from "fs/promises";
2729
- import { dirname as dirname3, join as join5, relative as relative3, resolve as resolve5 } from "path";
3039
+ import { mkdir as mkdir3 } from "fs/promises";
3040
+ import { dirname as dirname4, join as join7, relative as relative4, resolve as resolve6 } from "path";
2730
3041
  var {Transpiler } = globalThis.Bun;
2731
- var ISLAND_COMPONENT_ID_LENGTH = 8, serverCacheRoot2, compiledModuleCache2, transpiler2, ensureRelativeImportPath2 = (from, target) => {
2732
- const importPath = relative3(dirname3(from), target).replace(/\\/g, "/");
3042
+ var ISLAND_COMPONENT_ID_LENGTH = 8, serverCacheRoot3, compiledModuleCache3, transpiler2, ensureRelativeImportPath2 = (from, target) => {
3043
+ const importPath = relative4(dirname4(from), target).replace(/\\/g, "/");
2733
3044
  return importPath.startsWith(".") ? importPath : `./${importPath}`;
2734
- }, getCachedModulePath2 = (sourcePath) => {
2735
- const relativeSourcePath = relative3(process.cwd(), sourcePath).replace(/\\/g, "/");
3045
+ }, getCachedModulePath3 = (sourcePath) => {
3046
+ const relativeSourcePath = relative4(process.cwd(), sourcePath).replace(/\\/g, "/");
2736
3047
  const normalizedSourcePath = relativeSourcePath.startsWith("..") ? sourcePath.replace(/[:\\/]/g, "_") : relativeSourcePath;
2737
- return join5(serverCacheRoot2, `${normalizedSourcePath}.server.js`);
3048
+ return join7(serverCacheRoot3, `${normalizedSourcePath}.server.js`);
2738
3049
  }, writeIfChanged2 = async (path, content) => {
2739
3050
  const targetFile = Bun.file(path);
2740
3051
  if (await targetFile.exists()) {
@@ -2761,7 +3072,7 @@ var ISLAND_COMPONENT_ID_LENGTH = 8, serverCacheRoot2, compiledModuleCache2, tran
2761
3072
  `) : nonVueLines.join(`
2762
3073
  `);
2763
3074
  }, extractRelativeVueImports = (sourceCode) => Array.from(sourceCode.matchAll(/import\s+[\s\S]+?['"]([^'"]+)['"]/g)).map((match) => match[1]).filter((importPath) => typeof importPath === "string" && importPath.startsWith(".") && importPath.endsWith(".vue")), compileVueServerModule = async (sourcePath) => {
2764
- const cachedModulePath = compiledModuleCache2.get(sourcePath);
3075
+ const cachedModulePath = compiledModuleCache3.get(sourcePath);
2765
3076
  if (cachedModulePath)
2766
3077
  return cachedModulePath;
2767
3078
  const compiler = await import("@vue/compiler-sfc");
@@ -2794,7 +3105,7 @@ var ISLAND_COMPONENT_ID_LENGTH = 8, serverCacheRoot2, compiledModuleCache2, tran
2794
3105
  }).code : "const ssrRender = () => {};";
2795
3106
  const childImportPaths = extractRelativeVueImports(compiledScript.content);
2796
3107
  const compiledChildren = await Promise.all(childImportPaths.map(async (relativeImport) => ({
2797
- compiledPath: await compileVueServerModule(resolve5(dirname3(sourcePath), relativeImport)),
3108
+ compiledPath: await compileVueServerModule(resolve6(dirname4(sourcePath), relativeImport)),
2798
3109
  spec: relativeImport
2799
3110
  })));
2800
3111
  const strippedScript = stripExports(compiledScript.content);
@@ -2806,20 +3117,20 @@ var ISLAND_COMPONENT_ID_LENGTH = 8, serverCacheRoot2, compiledModuleCache2, tran
2806
3117
  "export default script;"
2807
3118
  ].join(`
2808
3119
  `));
2809
- const compiledModulePath = getCachedModulePath2(sourcePath);
3120
+ const compiledModulePath = getCachedModulePath3(sourcePath);
2810
3121
  let rewritten = assembled;
2811
3122
  for (const child of compiledChildren) {
2812
3123
  rewritten = rewritten.replaceAll(child.spec, ensureRelativeImportPath2(compiledModulePath, child.compiledPath));
2813
3124
  }
2814
- await mkdir2(dirname3(compiledModulePath), { recursive: true });
3125
+ await mkdir3(dirname4(compiledModulePath), { recursive: true });
2815
3126
  await writeIfChanged2(compiledModulePath, rewritten);
2816
- compiledModuleCache2.set(sourcePath, compiledModulePath);
3127
+ compiledModuleCache3.set(sourcePath, compiledModulePath);
2817
3128
  return compiledModulePath;
2818
3129
  };
2819
3130
  var init_vueServerModule = __esm(() => {
2820
3131
  init_constants();
2821
- serverCacheRoot2 = join5(process.cwd(), ".absolutejs", "islands", "vue");
2822
- compiledModuleCache2 = new Map;
3132
+ serverCacheRoot3 = join7(process.cwd(), ".absolutejs", "islands", "vue");
3133
+ compiledModuleCache3 = new Map;
2823
3134
  transpiler2 = new Transpiler({ loader: "ts", target: "browser" });
2824
3135
  });
2825
3136
 
@@ -2901,8 +3212,17 @@ var islandSequence = 0, resolvedServerComponentCache, resolvedServerBuildCompone
2901
3212
  throw new Error("Resolved Vue island is not a valid Vue component.");
2902
3213
  }
2903
3214
  return resolvedComponent;
3215
+ }, loadAngularServerBuildComponent = async (buildReferencePath, exportName) => {
3216
+ const serverModulePath = await compileAngularServerModule(buildReferencePath);
3217
+ const loadedModule = await import(serverModulePath);
3218
+ if (exportName && exportName !== "default" && exportName in loadedModule) {
3219
+ return loadedModule[exportName];
3220
+ }
3221
+ return "default" in loadedModule ? loadedModule.default : loadedModule;
2904
3222
  }, resolveAngularServerIslandComponent = async (component) => {
2905
- const resolvedComponent = await resolveServerIslandComponent(component);
3223
+ const buildReference = getIslandBuildReference(component);
3224
+ const buildReferencePath = buildReference?.source ? resolveBuildReferencePath(buildReference.source, import.meta.url) : null;
3225
+ const resolvedComponent = buildReferencePath ? await loadAngularServerBuildComponent(buildReferencePath, buildReference?.export) : await resolveServerIslandComponent(component);
2906
3226
  if (!isAngularServerIslandComponent(resolvedComponent)) {
2907
3227
  throw new Error("Resolved Angular island is not a valid Angular component.");
2908
3228
  }
@@ -2958,6 +3278,7 @@ var islandSequence = 0, resolvedServerComponentCache, resolvedServerBuildCompone
2958
3278
  };
2959
3279
  var init_renderIslandMarkup = __esm(() => {
2960
3280
  init_islandSsr();
3281
+ init_angularServerModule();
2961
3282
  init_svelteServerModule();
2962
3283
  init_vueServerModule();
2963
3284
  init_islandMarkupAttributes();
@@ -3075,7 +3396,6 @@ var runWithStreamingSlotRegistry = async (task) => {
3075
3396
  };
3076
3397
 
3077
3398
  // src/core/islandPageContext.ts
3078
- init_constants();
3079
3399
  var BOOTSTRAP_MANIFEST_KEY = "BootstrapClient";
3080
3400
  var ISLAND_MARKER = 'data-island="true"';
3081
3401
  var MANIFEST_MARKER = "__ABSOLUTE_MANIFEST__";
@@ -3196,61 +3516,69 @@ var pipeStreamWithHeadInjection = (stream, markup) => {
3196
3516
  var pipeStreamWithIslandMarkerDetection = (stream, markup) => {
3197
3517
  const encoder = new TextEncoder;
3198
3518
  const decoder = new TextDecoder;
3199
- const lookbehind = Math.max(ISLAND_MARKER.length, BYTES_PER_KILOBYTE);
3200
- const processPending = (controller, pending, injected) => {
3201
- if (injected) {
3202
- controller.enqueue(encoder.encode(pending));
3203
- return { injected, pending: "" };
3519
+ const headLookbehind = CLOSING_HEAD_TAG.length - 1;
3520
+ const enqueue = (controller, text) => {
3521
+ if (text.length > 0) {
3522
+ controller.enqueue(encoder.encode(text));
3204
3523
  }
3205
- const markerIndex = pending.indexOf(ISLAND_MARKER);
3206
- if (markerIndex >= 0) {
3207
- const tagStart = pending.lastIndexOf("<", markerIndex);
3208
- const injectAt = tagStart >= 0 ? tagStart : markerIndex;
3209
- const next = `${pending.slice(0, injectAt)}${markup}${pending.slice(injectAt)}`;
3210
- controller.enqueue(encoder.encode(next));
3211
- return { injected: true, pending: "" };
3524
+ };
3525
+ const processHolding = (controller, held) => {
3526
+ if (!held.includes(ISLAND_MARKER)) {
3527
+ return { held, injected: false, pending: "", sawHead: true };
3212
3528
  }
3213
- return {
3214
- injected,
3215
- pending: flushSafePendingText(controller, encoder, pending, lookbehind)
3216
- };
3529
+ enqueue(controller, `${markup}${held}`);
3530
+ return { held: "", injected: true, pending: "", sawHead: true };
3217
3531
  };
3218
- const finishIslandMarkerStream = (controller, pending) => {
3219
- const finalPending = pending + decoder.decode();
3220
- if (finalPending.length > 0) {
3221
- controller.enqueue(encoder.encode(finalPending));
3532
+ const processHead = (controller, pending) => {
3533
+ const headIndex = pending.indexOf(CLOSING_HEAD_TAG);
3534
+ if (headIndex < 0) {
3535
+ return {
3536
+ held: "",
3537
+ injected: false,
3538
+ pending: flushSafePendingText(controller, encoder, pending, headLookbehind),
3539
+ sawHead: false
3540
+ };
3222
3541
  }
3223
- controller.close();
3542
+ enqueue(controller, pending.slice(0, headIndex));
3543
+ return processHolding(controller, pending.slice(headIndex));
3224
3544
  };
3225
- const consumeIslandChunk = async (controller, reader, pending, injected) => {
3226
- const { done, value } = await readStreamChunk(reader);
3227
- if (done || !value) {
3228
- return { done, injected, pending };
3545
+ const processChunk = (controller, state, chunk) => {
3546
+ if (state.injected) {
3547
+ enqueue(controller, chunk);
3548
+ return state;
3229
3549
  }
3230
- const processed = processPending(controller, pending + streamChunkToString(value, decoder), injected);
3231
- return {
3232
- done,
3233
- injected: processed.injected,
3234
- pending: processed.pending
3235
- };
3550
+ if (!state.sawHead) {
3551
+ return processHead(controller, state.pending + chunk);
3552
+ }
3553
+ return processHolding(controller, state.held + chunk);
3236
3554
  };
3237
- const runIslandMarkerLoop = async (controller, reader) => {
3238
- const consumeNextIslandChunk = async (injected, pending) => {
3239
- const consumed = await consumeIslandChunk(controller, reader, pending, injected);
3240
- const nextState = updateInjectedState(consumed, injected, pending);
3241
- if (nextState.done) {
3242
- return { injected, pending };
3555
+ const finishMarkerStream = (controller, state) => {
3556
+ const tail = decoder.decode();
3557
+ const remainder = state.injected ? tail : (state.sawHead ? state.held : state.pending) + tail;
3558
+ enqueue(controller, remainder);
3559
+ controller.close();
3560
+ };
3561
+ const runMarkerLoop = (controller, reader) => {
3562
+ const consumeNext = async (state) => {
3563
+ const { done, value } = await readStreamChunk(reader);
3564
+ if (done || !value) {
3565
+ return state;
3243
3566
  }
3244
- return consumeNextIslandChunk(nextState.injected, nextState.pending);
3567
+ return consumeNext(processChunk(controller, state, streamChunkToString(value, decoder)));
3245
3568
  };
3246
- return consumeNextIslandChunk(false, "");
3569
+ return consumeNext({
3570
+ held: "",
3571
+ injected: false,
3572
+ pending: "",
3573
+ sawHead: false
3574
+ });
3247
3575
  };
3248
3576
  return new ReadableStream({
3249
3577
  async start(controller) {
3250
3578
  const reader = stream.getReader();
3251
3579
  try {
3252
- const { pending } = await runIslandMarkerLoop(controller, reader);
3253
- finishIslandMarkerStream(controller, pending);
3580
+ const finalState = await runMarkerLoop(controller, reader);
3581
+ finishMarkerStream(controller, finalState);
3254
3582
  } catch (error) {
3255
3583
  controller.error(error);
3256
3584
  }
@@ -3946,5 +4274,5 @@ export {
3946
4274
  Island
3947
4275
  };
3948
4276
 
3949
- //# debugId=5B0C9327714D55D064756E2164756E21
4277
+ //# debugId=152CAFBD5735946464756E2164756E21
3950
4278
  //# sourceMappingURL=index.js.map