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

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 (38) 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/client/index.js +34 -20
  13. package/dist/client/index.js.map +6 -6
  14. package/dist/index.js +899 -800
  15. package/dist/index.js.map +12 -11
  16. package/dist/islands/index.js +416 -95
  17. package/dist/islands/index.js.map +10 -7
  18. package/dist/react/browser.js +13 -17
  19. package/dist/react/browser.js.map +3 -3
  20. package/dist/react/index.js +484 -156
  21. package/dist/react/index.js.map +12 -9
  22. package/dist/react/server.js +69 -62
  23. package/dist/react/server.js.map +5 -5
  24. package/dist/src/client/preserveIslandMarkup.d.ts +4 -1
  25. package/dist/src/core/angularServerModule.d.ts +1 -0
  26. package/dist/svelte/index.js +389 -61
  27. package/dist/svelte/index.js.map +11 -8
  28. package/dist/svelte/server.js +50 -43
  29. package/dist/svelte/server.js.map +3 -3
  30. package/dist/types/angular.d.ts +3 -0
  31. package/dist/types/globals.d.ts +0 -1
  32. package/dist/vue/browser.js +13 -17
  33. package/dist/vue/browser.js.map +3 -3
  34. package/dist/vue/index.js +477 -153
  35. package/dist/vue/index.js.map +12 -9
  36. package/dist/vue/server.js +50 -43
  37. package/dist/vue/server.js.map +3 -3
  38. package/package.json +1 -1
@@ -468,9 +468,12 @@ var initDominoAdapter = (platformServer) => {
468
468
  return {
469
469
  APP_BASE_HREF: common.APP_BASE_HREF,
470
470
  bootstrapApplication: platformBrowser.bootstrapApplication,
471
+ Component: core.Component,
471
472
  DomSanitizer: platformBrowser.DomSanitizer,
472
473
  ENVIRONMENT_INITIALIZER: core.ENVIRONMENT_INITIALIZER,
473
474
  inject: core.inject,
475
+ InjectionToken: core.InjectionToken,
476
+ NgComponentOutlet: common.NgComponentOutlet,
474
477
  provideClientHydration: platformBrowser.provideClientHydration,
475
478
  provideServerRendering: platformServer.provideServerRendering,
476
479
  provideZonelessChangeDetection: core.provideZonelessChangeDetection,
@@ -643,9 +646,8 @@ var angularIslandSelector = "abs-angular-island", isAngularComponent = (value) =
643
646
  const componentName = typeof component.name === "string" && component.name.length > 0 ? component.name : "AngularIsland";
644
647
  return `${componentName}:${JSON.stringify(props)}`;
645
648
  }, buildAngularIslandWrapperMetadata = async (component, islandId, wrapperKey) => {
646
- const { Component, InjectionToken: InjectionToken2, inject } = await import("@angular/core");
647
- const { NgComponentOutlet } = await import("@angular/common");
648
649
  const deps = await getAngularDeps();
650
+ const { Component, InjectionToken: InjectionToken2, NgComponentOutlet, inject } = deps;
649
651
  const selector = getAngularIslandSelector(islandId);
650
652
  const propsToken = new InjectionToken2(`${wrapperKey}:props`);
651
653
 
@@ -751,7 +753,15 @@ var init_islands = __esm(() => {
751
753
  var renderAngularIslandToHtmlInternal = async (component, props, islandId) => {
752
754
  const { renderAngularIslandToHtml: renderAngularIslandToHtml2 } = await Promise.resolve().then(() => (init_islands(), exports_islands));
753
755
  return renderAngularIslandToHtml2(component, props, islandId);
754
- }, 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 }) => {
756
+ }, renderAngularIslandToHtml2, LEADING_HOISTED_RESOURCE_RE, stripLeadingHoistedResources = (html) => {
757
+ let result = html;
758
+ let match = LEADING_HOISTED_RESOURCE_RE.exec(result);
759
+ while (match) {
760
+ result = result.slice(match[0].length);
761
+ match = LEADING_HOISTED_RESOURCE_RE.exec(result);
762
+ }
763
+ return result.trimStart();
764
+ }, 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 }) => {
755
765
  const { body } = render(component, { props });
756
766
  return body;
757
767
  }), renderVueIslandToHtml = (component, props) => import("vue").then(({ createSSRApp, h: createVueVNode }) => {
@@ -762,10 +772,311 @@ var renderAngularIslandToHtmlInternal = async (component, props, islandId) => {
762
772
  });
763
773
  var init_islandSsr = __esm(() => {
764
774
  renderAngularIslandToHtml2 = renderAngularIslandToHtmlInternal;
775
+ 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;
776
+ });
777
+
778
+ // src/build/nativeRewrite.ts
779
+ import { dlopen, FFIType, ptr } from "bun:ffi";
780
+ import { platform, arch } from "os";
781
+ import { resolve as resolve2 } from "path";
782
+ var ffiDefinition, nativeLib = null, loadNative = () => {
783
+ if (nativeLib !== null)
784
+ return nativeLib;
785
+ const osPlatform = platform();
786
+ const cpu = arch();
787
+ const platformMap = {
788
+ "darwin-arm64": "darwin-arm64/fast_ops.dylib",
789
+ "darwin-x64": "darwin-x64/fast_ops.dylib",
790
+ "linux-arm64": "linux-arm64/fast_ops.so",
791
+ "linux-x64": "linux-x64/fast_ops.so",
792
+ "win32-arm64": "windows-arm64/fast_ops.dll",
793
+ "win32-x64": "windows-x64/fast_ops.dll"
794
+ };
795
+ const libPath = platformMap[`${osPlatform}-${cpu}`];
796
+ if (!libPath)
797
+ return null;
798
+ try {
799
+ const fullPath = resolve2(import.meta.dir, "../../native/packages", libPath);
800
+ const lib = dlopen(fullPath, ffiDefinition);
801
+ nativeLib = lib.symbols;
802
+ return nativeLib;
803
+ } catch {
804
+ return null;
805
+ }
806
+ }, nativeRewriteImports = (content, replacements) => {
807
+ const lib = loadNative();
808
+ if (!lib)
809
+ return null;
810
+ const jsonStr = JSON.stringify(replacements);
811
+ const contentBuf = Buffer.from(content);
812
+ const jsonBuf = Buffer.from(jsonStr);
813
+ const outBuf = Buffer.alloc(content.length * 2);
814
+ const outLenBuf = new BigUint64Array([BigInt(outBuf.length)]);
815
+ const result = lib.rewrite_imports(ptr(contentBuf), contentBuf.length, ptr(jsonBuf), jsonBuf.length, ptr(outBuf), ptr(new Uint8Array(outLenBuf.buffer)));
816
+ if (result < 0)
817
+ return null;
818
+ if (result === 0)
819
+ return content;
820
+ const outLen = Number(outLenBuf[0]);
821
+ return outBuf.subarray(0, outLen).toString("utf-8");
822
+ };
823
+ var init_nativeRewrite = __esm(() => {
824
+ ffiDefinition = {
825
+ rewrite_imports: {
826
+ args: [
827
+ FFIType.ptr,
828
+ FFIType.u64,
829
+ FFIType.ptr,
830
+ FFIType.u64,
831
+ FFIType.ptr,
832
+ FFIType.ptr
833
+ ],
834
+ returns: FFIType.i32
835
+ }
836
+ };
837
+ });
838
+
839
+ // src/build/rewriteImportsPlugin.ts
840
+ var exports_rewriteImportsPlugin = {};
841
+ __export(exports_rewriteImportsPlugin, {
842
+ rewriteVendorDirectories: () => rewriteVendorDirectories,
843
+ rewriteImportsInContent: () => rewriteImportsInContent,
844
+ rewriteBuildOutputsWith: () => rewriteBuildOutputsWith,
845
+ rewriteBuildOutputs: () => rewriteBuildOutputs,
846
+ jsRewriteImports: () => jsRewriteImports,
847
+ fixMissingReExportNamespacesInContent: () => fixMissingReExportNamespacesInContent,
848
+ buildWithImportRewrite: () => buildWithImportRewrite
849
+ });
850
+ import { readdir } from "fs/promises";
851
+ import { join as join2 } from "path";
852
+ var escapeRegex = (str) => str.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"), jsRewriteImports = (content, replacements) => {
853
+ let result = content;
854
+ for (const [specifier, webPath] of replacements) {
855
+ const escaped = escapeRegex(specifier);
856
+ const fromRegex = new RegExp(`(from\\s*["'])${escaped}(["'])`, "g");
857
+ const sideEffectRegex = new RegExp(`(import\\s*["'])${escaped}(["'])`, "g");
858
+ const dynamicRegex = new RegExp(`(import\\s*\\(\\s*["'])${escaped}(["']\\s*\\))`, "g");
859
+ result = result.replace(fromRegex, `$1${webPath}$2`);
860
+ result = result.replace(sideEffectRegex, `$1${webPath}$2`);
861
+ result = result.replace(dynamicRegex, `$1${webPath}$2`);
862
+ }
863
+ return result;
864
+ }, rewriteImportsInContent = (content, vendorPaths) => {
865
+ if (Object.keys(vendorPaths).length === 0)
866
+ return content;
867
+ const replacements = Object.entries(vendorPaths).sort(([keyA], [keyB]) => keyB.length - keyA.length);
868
+ const native = nativeRewriteImports(content, replacements);
869
+ return native ?? jsRewriteImports(content, replacements);
870
+ }, fixMissingReExportNamespacesInContent = (content) => {
871
+ const REEXPORT_PATTERN = /__reExport\(\s*[A-Za-z_$][\w$]*\s*,\s*([A-Za-z_$][\w$]*)\s*\)/g;
872
+ REEXPORT_PATTERN.lastIndex = 0;
873
+ const missing = [];
874
+ let match;
875
+ while ((match = REEXPORT_PATTERN.exec(content)) !== null) {
876
+ const ident = match[1];
877
+ if (!ident)
878
+ continue;
879
+ const nsImportRe = new RegExp(`\\bimport\\s*\\*\\s*as\\s+${ident}\\s+from\\b`);
880
+ if (nsImportRe.test(content))
881
+ continue;
882
+ const declRe = new RegExp(`\\b(?:const|let|var|function|class)\\s+${ident}\\b`);
883
+ if (declRe.test(content))
884
+ continue;
885
+ const namedImportRe = new RegExp(`\\bimport\\s*\\{[^}]*\\b${ident}\\b[^}]*\\}\\s*from\\b`);
886
+ if (namedImportRe.test(content))
887
+ continue;
888
+ const importPathRe = /(?:from\s+|import\s*)["']([^"']+)["']/g;
889
+ let pathMatch;
890
+ let sourcePath;
891
+ while ((pathMatch = importPathRe.exec(content)) !== null) {
892
+ const p = pathMatch[1];
893
+ if (!p)
894
+ continue;
895
+ const base = p.split("/").pop()?.replace(/\.[mc]?js$/, "");
896
+ if (!base)
897
+ continue;
898
+ const normalized = base.startsWith("_") ? base.slice(1) : base;
899
+ if (normalized === ident || normalized.endsWith(`_${ident}`)) {
900
+ sourcePath = p;
901
+ break;
902
+ }
903
+ }
904
+ if (sourcePath)
905
+ missing.push({ ident, path: sourcePath });
906
+ }
907
+ if (missing.length === 0)
908
+ return content;
909
+ const seen = new Set;
910
+ const unique = missing.filter((entry) => {
911
+ if (seen.has(entry.ident))
912
+ return false;
913
+ seen.add(entry.ident);
914
+ return true;
915
+ });
916
+ const inserts = unique.map((entry) => `import * as ${entry.ident} from "${entry.path}";`).join(`
917
+ `);
918
+ return `${inserts}
919
+ ${content}`;
920
+ }, isReadableArtifact = (artifact) => artifact.path.endsWith(".js"), rewriteBuildOutputs = async (outputs, vendorPaths) => {
921
+ if (Object.keys(vendorPaths).length === 0)
922
+ return;
923
+ await Promise.all(outputs.filter(isReadableArtifact).map(async (artifact) => {
924
+ let original;
925
+ try {
926
+ original = await artifact.text();
927
+ } catch (err) {
928
+ const code = err.code;
929
+ if (code === "ENOENT")
930
+ return;
931
+ throw err;
932
+ }
933
+ const rewritten = rewriteImportsInContent(original, vendorPaths);
934
+ if (rewritten === original)
935
+ return;
936
+ try {
937
+ await Bun.write(artifact.path, rewritten);
938
+ } catch (err) {
939
+ const code = err.code;
940
+ if (code === "ENOENT")
941
+ return;
942
+ throw err;
943
+ }
944
+ }));
945
+ }, rewriteBuildOutputsWith = async (outputs, resolveVendorPaths) => {
946
+ await Promise.all(outputs.filter(isReadableArtifact).map(async (artifact) => {
947
+ const vendorPaths = resolveVendorPaths(artifact);
948
+ if (Object.keys(vendorPaths).length === 0)
949
+ return;
950
+ let original;
951
+ try {
952
+ original = await artifact.text();
953
+ } catch (err) {
954
+ const code = err.code;
955
+ if (code === "ENOENT")
956
+ return;
957
+ throw err;
958
+ }
959
+ const rewritten = rewriteImportsInContent(original, vendorPaths);
960
+ if (rewritten === original)
961
+ return;
962
+ try {
963
+ await Bun.write(artifact.path, rewritten);
964
+ } catch (err) {
965
+ const code = err.code;
966
+ if (code === "ENOENT")
967
+ return;
968
+ throw err;
969
+ }
970
+ }));
971
+ }, rewriteVendorDirectories = async (vendorDirs, vendorPaths) => {
972
+ if (Object.keys(vendorPaths).length === 0)
973
+ return;
974
+ const allFiles = [];
975
+ for (const dir of vendorDirs) {
976
+ try {
977
+ const entries = await readdir(dir);
978
+ for (const entry of entries) {
979
+ if (entry.endsWith(".js"))
980
+ allFiles.push(join2(dir, entry));
981
+ }
982
+ } catch {}
983
+ }
984
+ await Promise.all(allFiles.map(async (filePath) => {
985
+ let original;
986
+ try {
987
+ original = await Bun.file(filePath).text();
988
+ } catch (err) {
989
+ const code = err.code;
990
+ if (code === "ENOENT")
991
+ return;
992
+ throw err;
993
+ }
994
+ let next = rewriteImportsInContent(original, vendorPaths);
995
+ next = fixMissingReExportNamespacesInContent(next);
996
+ if (next === original)
997
+ return;
998
+ try {
999
+ await Bun.write(filePath, next);
1000
+ } catch (err) {
1001
+ const code = err.code;
1002
+ if (code === "ENOENT")
1003
+ return;
1004
+ throw err;
1005
+ }
1006
+ }));
1007
+ }, buildWithImportRewrite = async (pendingBuild, vendorPaths) => {
1008
+ const result = await pendingBuild;
1009
+ if (result.outputs.length > 0) {
1010
+ await rewriteBuildOutputs(result.outputs, vendorPaths);
1011
+ }
1012
+ return result;
1013
+ };
1014
+ var init_rewriteImportsPlugin = __esm(() => {
1015
+ init_nativeRewrite();
1016
+ });
1017
+
1018
+ // src/core/angularServerModule.ts
1019
+ import { mkdir } from "fs/promises";
1020
+ import { dirname, join as join3, relative } from "path";
1021
+ var serverCacheRoot, compiledModuleCache, ANGULAR_SPECIFIER_RE, getCachedModulePath = (sourcePath) => {
1022
+ const relativeSourcePath = relative(process.cwd(), sourcePath).replace(/\\/g, "/");
1023
+ const normalizedSourcePath = relativeSourcePath.startsWith("..") ? sourcePath.replace(/[:\\/]/g, "_") : relativeSourcePath;
1024
+ return join3(serverCacheRoot, `${normalizedSourcePath}.server.js`);
1025
+ }, collectVendorPaths = (code) => {
1026
+ const vendorPaths = {};
1027
+ if (!isProductionRuntime()) {
1028
+ return vendorPaths;
1029
+ }
1030
+ const specifiers = new Set([...code.matchAll(ANGULAR_SPECIFIER_RE)].map((match) => match[1]));
1031
+ specifiers.forEach((specifier) => {
1032
+ if (!specifier)
1033
+ return;
1034
+ const resolved = resolveAngularRuntimePath(specifier);
1035
+ if (resolved === specifier)
1036
+ return;
1037
+ vendorPaths[specifier] = resolved;
1038
+ });
1039
+ return vendorPaths;
1040
+ }, buildAngularServerModule = async (sourcePath) => {
1041
+ const result = await Bun.build({
1042
+ entrypoints: [sourcePath],
1043
+ format: "esm",
1044
+ packages: "external",
1045
+ target: "bun",
1046
+ throw: false
1047
+ });
1048
+ const entry = result.outputs.find((output) => output.kind === "entry-point");
1049
+ if (!result.success || !entry) {
1050
+ const message = result.logs.map((log) => String(log)).join(`
1051
+ `);
1052
+ throw new Error(`Failed to compile Angular island server module for "${sourcePath}":
1053
+ ${message}`);
1054
+ }
1055
+ const code = await entry.text();
1056
+ const rewritten = rewriteImportsInContent(code, collectVendorPaths(code));
1057
+ const modulePath = getCachedModulePath(sourcePath);
1058
+ await mkdir(dirname(modulePath), { recursive: true });
1059
+ await Bun.write(modulePath, rewritten);
1060
+ return modulePath;
1061
+ }, compileAngularServerModule = (sourcePath) => {
1062
+ const cached = compiledModuleCache.get(sourcePath);
1063
+ if (cached) {
1064
+ return cached;
1065
+ }
1066
+ const compiledModulePromise = buildAngularServerModule(sourcePath);
1067
+ compiledModuleCache.set(sourcePath, compiledModulePromise);
1068
+ return compiledModulePromise;
1069
+ };
1070
+ var init_angularServerModule = __esm(() => {
1071
+ init_resolveAngularPackage();
1072
+ init_rewriteImportsPlugin();
1073
+ serverCacheRoot = join3(process.cwd(), ".absolutejs", "islands", "angular");
1074
+ compiledModuleCache = new Map;
1075
+ ANGULAR_SPECIFIER_RE = /["'](@angular\/[^"']+)["']/g;
765
1076
  });
766
1077
 
767
1078
  // src/build/resolvePackageImport.ts
768
- import { resolve as resolve2, join as join2 } from "path";
1079
+ import { resolve as resolve3, join as join4 } from "path";
769
1080
  import { existsSync as existsSync2, readFileSync as readFileSync2 } from "fs";
770
1081
  var resolveExportPath = (entry, conditions) => {
771
1082
  if (typeof entry === "string")
@@ -787,11 +1098,11 @@ var resolveExportPath = (entry, conditions) => {
787
1098
  const packageName = isScoped ? `${parts[0]}/${parts[1]}` : parts[0];
788
1099
  const subpath = isScoped ? parts.slice(2).join("/") : parts.slice(1).join("/");
789
1100
  const exportKey = subpath ? `./${subpath}` : ".";
790
- const currentPackageJsonPath = resolve2(process.cwd(), "package.json");
1101
+ const currentPackageJsonPath = resolve3(process.cwd(), "package.json");
791
1102
  const currentPackageJson = existsSync2(currentPackageJsonPath) ? JSON.parse(readFileSync2(currentPackageJsonPath, "utf-8")) : null;
792
1103
  const currentPackageDir = currentPackageJson?.name === packageName ? process.cwd() : null;
793
- const packageDir = currentPackageDir ?? resolve2(process.cwd(), "node_modules", packageName ?? "");
794
- const packageJsonPath = join2(packageDir, "package.json");
1104
+ const packageDir = currentPackageDir ?? resolve3(process.cwd(), "node_modules", packageName ?? "");
1105
+ const packageJsonPath = join4(packageDir, "package.json");
795
1106
  if (!existsSync2(packageJsonPath))
796
1107
  return null;
797
1108
  try {
@@ -806,12 +1117,12 @@ var resolveExportPath = (entry, conditions) => {
806
1117
  if (!importPath)
807
1118
  return null;
808
1119
  if (currentPackageDir && importPath.startsWith("./dist/")) {
809
- const sourceCandidate = resolve2(packageDir, importPath.replace(/^\.\/dist\//, "./src/"));
1120
+ const sourceCandidate = resolve3(packageDir, importPath.replace(/^\.\/dist\//, "./src/"));
810
1121
  if (existsSync2(sourceCandidate)) {
811
1122
  return sourceCandidate;
812
1123
  }
813
1124
  }
814
- const resolved = resolve2(packageDir, importPath);
1125
+ const resolved = resolve3(packageDir, importPath);
815
1126
  return existsSync2(resolved) ? resolved : null;
816
1127
  } catch {
817
1128
  return null;
@@ -968,12 +1279,12 @@ import { existsSync as existsSync3, readFileSync as readFileSync3 } from "fs";
968
1279
  import { readFile } from "fs/promises";
969
1280
  import { createRequire } from "module";
970
1281
  import {
971
- dirname,
1282
+ dirname as dirname2,
972
1283
  extname,
973
1284
  isAbsolute,
974
- join as join3,
975
- relative,
976
- resolve as resolve3
1285
+ join as join5,
1286
+ relative as relative2,
1287
+ resolve as resolve4
977
1288
  } from "path";
978
1289
  import { fileURLToPath, pathToFileURL } from "url";
979
1290
  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) => {
@@ -1009,9 +1320,9 @@ ${message}`);
1009
1320
  return requireOptionalPeer(specifier);
1010
1321
  }
1011
1322
  }, normalizeLoadPaths = (filePath, paths = []) => [
1012
- dirname(filePath),
1323
+ dirname2(filePath),
1013
1324
  process.cwd(),
1014
- ...paths.map((path) => resolve3(process.cwd(), path))
1325
+ ...paths.map((path) => resolve4(process.cwd(), path))
1015
1326
  ], tsconfigAliasCache, stripJsonComments = (source) => source.replace(/\/\*[\s\S]*?\*\//g, "").replace(/(^|[^:])\/\/.*$/gm, "$1"), normalizeAliasEntries = (aliases) => Object.entries(aliases ?? {}).map(([pattern, value]) => ({
1016
1327
  pattern,
1017
1328
  replacements: Array.isArray(value) ? value : [value]
@@ -1019,7 +1330,7 @@ ${message}`);
1019
1330
  const cwd = process.cwd();
1020
1331
  if (tsconfigAliasCache?.cwd === cwd)
1021
1332
  return tsconfigAliasCache;
1022
- const tsconfigPath = resolve3(cwd, "tsconfig.json");
1333
+ const tsconfigPath = resolve4(cwd, "tsconfig.json");
1023
1334
  const empty = { aliases: [], baseUrl: cwd, cwd };
1024
1335
  if (!existsSync3(tsconfigPath)) {
1025
1336
  tsconfigAliasCache = empty;
@@ -1028,7 +1339,7 @@ ${message}`);
1028
1339
  try {
1029
1340
  const parsed = JSON.parse(stripJsonComments(readFileSync3(tsconfigPath, "utf-8")));
1030
1341
  const compilerOptions = parsed.compilerOptions ?? {};
1031
- const baseUrl = resolve3(cwd, compilerOptions.baseUrl ?? ".");
1342
+ const baseUrl = resolve4(cwd, compilerOptions.baseUrl ?? ".");
1032
1343
  tsconfigAliasCache = {
1033
1344
  aliases: normalizeAliasEntries(compilerOptions.paths),
1034
1345
  baseUrl,
@@ -1056,7 +1367,7 @@ ${message}`);
1056
1367
  continue;
1057
1368
  const wildcard = match[1] ?? "";
1058
1369
  for (const replacement of alias.replacements) {
1059
- targets.push(resolve3(baseUrl, replacement.replace("*", wildcard)));
1370
+ targets.push(resolve4(baseUrl, replacement.replace("*", wildcard)));
1060
1371
  }
1061
1372
  }
1062
1373
  return targets;
@@ -1070,21 +1381,21 @@ ${message}`);
1070
1381
  const ext = extname(basePath);
1071
1382
  const paths = ext ? [basePath] : getLanguageExtensions(language).flatMap((extension) => [
1072
1383
  `${basePath}${extension}`,
1073
- join3(basePath, `index${extension}`)
1384
+ join5(basePath, `index${extension}`)
1074
1385
  ]);
1075
1386
  if (language === "scss" || language === "sass") {
1076
1387
  return paths.flatMap((path) => {
1077
- const dir = dirname(path);
1388
+ const dir = dirname2(path);
1078
1389
  const base = path.slice(dir.length + 1);
1079
- return [path, join3(dir, `_${base}`)];
1390
+ return [path, join5(dir, `_${base}`)];
1080
1391
  });
1081
1392
  }
1082
1393
  return paths;
1083
1394
  }, resolveImportPath = (specifier, fromDirectory, loadPaths, language, config) => {
1084
1395
  const rawCandidates = [
1085
1396
  ...resolveAliasTargets(specifier, config),
1086
- isAbsolute(specifier) ? specifier : resolve3(fromDirectory, specifier),
1087
- ...loadPaths.map((path) => resolve3(path, specifier))
1397
+ isAbsolute(specifier) ? specifier : resolve4(fromDirectory, specifier),
1398
+ ...loadPaths.map((path) => resolve4(path, specifier))
1088
1399
  ];
1089
1400
  for (const candidate of rawCandidates.flatMap((path) => getCandidatePaths(path, language))) {
1090
1401
  if (existsSync3(candidate))
@@ -1100,8 +1411,8 @@ ${message}`);
1100
1411
  path: url.slice(0, markerIndex)
1101
1412
  };
1102
1413
  }, rebaseCssUrls = (contents, sourceFile, entryFile) => {
1103
- const sourceDir = dirname(sourceFile);
1104
- const entryDir = dirname(entryFile);
1414
+ const sourceDir = dirname2(sourceFile);
1415
+ const entryDir = dirname2(entryFile);
1105
1416
  if (sourceDir === entryDir)
1106
1417
  return contents;
1107
1418
  return contents.replace(/url\(\s*(['"]?)([^'")]+)\1\s*\)/gi, (match, quote, rawUrl) => {
@@ -1109,7 +1420,7 @@ ${message}`);
1109
1420
  if (!trimmedUrl || isExternalCssUrl(trimmedUrl))
1110
1421
  return match;
1111
1422
  const { marker, path } = splitCssUrl(trimmedUrl);
1112
- const rebased = relative(entryDir, resolve3(sourceDir, path)).replace(/\\/g, "/");
1423
+ const rebased = relative2(entryDir, resolve4(sourceDir, path)).replace(/\\/g, "/");
1113
1424
  const normalized = rebased.startsWith(".") ? rebased : `./${rebased}`;
1114
1425
  const nextQuote = quote || '"';
1115
1426
  return `url(${nextQuote}${normalized}${marker}${nextQuote})`;
@@ -1117,7 +1428,7 @@ ${message}`);
1117
1428
  }, rewriteAliasedStyleImports = (contents, sourceFile, loadPaths, language, config) => contents.replace(/(@(?:use|forward|import|require)\s+)(["'])([^"']+)\2/g, (match, prefix, quote, specifier) => {
1118
1429
  if (specifier.startsWith(".") || isAbsolute(specifier) || isExternalCssUrl(specifier))
1119
1430
  return match;
1120
- const resolved = resolveImportPath(specifier, dirname(sourceFile), loadPaths, language, config);
1431
+ const resolved = resolveImportPath(specifier, dirname2(sourceFile), loadPaths, language, config);
1121
1432
  return resolved ? `${prefix}${quote}${resolved}${quote}` : match;
1122
1433
  }), preprocessLoadedStyle = (contents, sourceFile, entryFile, loadPaths = [], language, config) => {
1123
1434
  const rebased = rebaseCssUrls(contents, sourceFile, entryFile);
@@ -1147,7 +1458,7 @@ ${contents}` : contents, normalizePostcssModule = (mod) => {
1147
1458
  }
1148
1459
  return mod;
1149
1460
  }, loadPostcssConfigFile = async (configPath) => {
1150
- const resolved = resolve3(process.cwd(), configPath);
1461
+ const resolved = resolve4(process.cwd(), configPath);
1151
1462
  const loaded = resolved.endsWith(".cjs") || resolved.endsWith(".cts") ? requireOptionalPeerSync(resolved) : await importOptionalPeer(`${new URL(`file://${resolved}`).href}?t=${Date.now()}`);
1152
1463
  const config = normalizePostcssModule(loaded);
1153
1464
  const value = typeof config === "function" ? await config({
@@ -1207,9 +1518,9 @@ ${contents}` : contents, normalizePostcssModule = (mod) => {
1207
1518
  return result.css;
1208
1519
  }, createSassImporter = (entryFile, loadPaths, language, config, deps) => ({
1209
1520
  canonicalize(specifier, options) {
1210
- const fromDirectory = options.containingUrl ? dirname(fileURLToPath(options.containingUrl)) : dirname(entryFile);
1521
+ const fromDirectory = options.containingUrl ? dirname2(fileURLToPath(options.containingUrl)) : dirname2(entryFile);
1211
1522
  const resolved = resolveImportPath(specifier, fromDirectory, loadPaths, language, config);
1212
- return resolved ? new URL(pathToFileURL(resolve3(resolved)).href) : null;
1523
+ return resolved ? new URL(pathToFileURL(resolve4(resolved)).href) : null;
1213
1524
  },
1214
1525
  load(canonicalUrl) {
1215
1526
  const filePath = fileURLToPath(canonicalUrl);
@@ -1226,9 +1537,9 @@ ${contents}` : contents, normalizePostcssModule = (mod) => {
1226
1537
  install(less, pluginManager) {
1227
1538
  const baseManager = new less.FileManager;
1228
1539
  const manager = Object.create(baseManager);
1229
- manager.supports = (filename, currentDirectory) => Boolean(resolveImportPath(filename, resolve3(currentDirectory), loadPaths, "less", config));
1540
+ manager.supports = (filename, currentDirectory) => Boolean(resolveImportPath(filename, resolve4(currentDirectory), loadPaths, "less", config));
1230
1541
  manager.loadFile = async (filename, currentDirectory) => {
1231
- const resolved = resolveImportPath(filename, resolve3(currentDirectory), loadPaths, "less", config);
1542
+ const resolved = resolveImportPath(filename, resolve4(currentDirectory), loadPaths, "less", config);
1232
1543
  if (!resolved) {
1233
1544
  throw new Error(`Unable to resolve Less import "${filename}"`);
1234
1545
  }
@@ -1265,29 +1576,29 @@ ${contents}` : contents, normalizePostcssModule = (mod) => {
1265
1576
  const stylusDeps = renderer.deps?.();
1266
1577
  if (Array.isArray(stylusDeps)) {
1267
1578
  for (const dep of stylusDeps)
1268
- deps.add(resolve3(dep));
1579
+ deps.add(resolve4(dep));
1269
1580
  }
1270
1581
  }
1271
1582
  resolveCss(css ?? "");
1272
1583
  });
1273
1584
  });
1274
1585
  }, styleDependencyGraph, styleOutputHashes, recordStyleDeps = (entry, deps) => {
1275
- const key = resolve3(entry);
1586
+ const key = resolve4(entry);
1276
1587
  const stripped = new Set;
1277
1588
  for (const dep of deps) {
1278
- const resolved = resolve3(dep);
1589
+ const resolved = resolve4(dep);
1279
1590
  if (resolved !== key)
1280
1591
  stripped.add(resolved);
1281
1592
  }
1282
1593
  styleDependencyGraph.set(key, stripped);
1283
1594
  }, addStyleImporter = (importerPath, stylePath) => {
1284
- const key = resolve3(importerPath);
1285
- const target = resolve3(stylePath);
1595
+ const key = resolve4(importerPath);
1596
+ const target = resolve4(stylePath);
1286
1597
  const deps = styleDependencyGraph.get(key) ?? new Set;
1287
1598
  deps.add(target);
1288
1599
  styleDependencyGraph.set(key, deps);
1289
1600
  }, findStyleEntriesImporting = (changedPath) => {
1290
- const target = resolve3(changedPath);
1601
+ const target = resolve4(changedPath);
1291
1602
  const importers = [];
1292
1603
  for (const [entry, deps] of styleDependencyGraph) {
1293
1604
  if (deps.has(target))
@@ -1295,13 +1606,13 @@ ${contents}` : contents, normalizePostcssModule = (mod) => {
1295
1606
  }
1296
1607
  return importers;
1297
1608
  }, recordStyleOutput = (entry, css) => {
1298
- const key = resolve3(entry);
1609
+ const key = resolve4(entry);
1299
1610
  const hash = createHash("sha1").update(css).digest("hex");
1300
1611
  const previous = styleOutputHashes.get(key);
1301
1612
  styleOutputHashes.set(key, hash);
1302
1613
  return previous !== hash;
1303
1614
  }, forgetStyleEntry = (entry) => {
1304
- const key = resolve3(entry);
1615
+ const key = resolve4(entry);
1305
1616
  styleDependencyGraph.delete(key);
1306
1617
  styleOutputHashes.delete(key);
1307
1618
  }, compileStyleSource = async (filePath, source, languageHint, config) => {
@@ -1327,7 +1638,7 @@ ${contents}` : contents, normalizePostcssModule = (mod) => {
1327
1638
  loadPaths,
1328
1639
  style: "expanded",
1329
1640
  syntax: language === "sass" ? "indented" : "scss",
1330
- url: new URL(pathToFileURL(resolve3(filePath)).href)
1641
+ url: new URL(pathToFileURL(resolve4(filePath)).href)
1331
1642
  });
1332
1643
  const css = await runPostcss(result.css, filePath, config);
1333
1644
  const loadedUrls = result.loadedUrls ?? [];
@@ -1335,7 +1646,7 @@ ${contents}` : contents, normalizePostcssModule = (mod) => {
1335
1646
  if (url.protocol !== "file:")
1336
1647
  continue;
1337
1648
  const dep = fileURLToPath(url);
1338
- if (resolve3(dep) === resolve3(filePath))
1649
+ if (resolve4(dep) === resolve4(filePath))
1339
1650
  continue;
1340
1651
  deps.add(dep);
1341
1652
  }
@@ -1456,7 +1767,7 @@ ${contents}` : contents, normalizePostcssModule = (mod) => {
1456
1767
  const start = match.index ?? 0;
1457
1768
  const end = start + match[0].length;
1458
1769
  parts.push(content.slice(cursor, start));
1459
- const fullPath = isAbsolute(importPath) ? importPath : resolve3(baseDir, importPath);
1770
+ const fullPath = isAbsolute(importPath) ? importPath : resolve4(baseDir, importPath);
1460
1771
  if (visited.has(fullPath) || !existsSync3(fullPath)) {
1461
1772
  parts.push(visited.has(fullPath) ? "" : match[0]);
1462
1773
  cursor = end;
@@ -1465,7 +1776,7 @@ ${contents}` : contents, normalizePostcssModule = (mod) => {
1465
1776
  const nextVisited = new Set(visited);
1466
1777
  nextVisited.add(fullPath);
1467
1778
  const imported = await readFile(fullPath, "utf-8");
1468
- parts.push(await resolveCssImportsAsync(imported, dirname(fullPath), nextVisited));
1779
+ parts.push(await resolveCssImportsAsync(imported, dirname2(fullPath), nextVisited));
1469
1780
  cursor = end;
1470
1781
  }
1471
1782
  parts.push(content.slice(cursor));
@@ -1474,13 +1785,13 @@ ${contents}` : contents, normalizePostcssModule = (mod) => {
1474
1785
  if (!isPreprocessableStylePath(filePath)) {
1475
1786
  const raw = await readFile(filePath, "utf-8");
1476
1787
  const processed = await runPostcss(raw, filePath, config);
1477
- return resolveCssImportsAsync(processed, dirname(filePath), new Set([filePath]));
1788
+ return resolveCssImportsAsync(processed, dirname2(filePath), new Set([filePath]));
1478
1789
  }
1479
1790
  const compiled = await compileStyleSource(filePath, undefined, undefined, config);
1480
- return resolveCssImportsAsync(compiled, dirname(filePath), new Set([filePath]));
1791
+ return resolveCssImportsAsync(compiled, dirname2(filePath), new Set([filePath]));
1481
1792
  }, resolveCssImportsSync = (content, baseDir, visited) => {
1482
1793
  return content.replace(CSS_IMPORT_PATTERN, (match, importPath) => {
1483
- const fullPath = isAbsolute(importPath) ? importPath : resolve3(baseDir, importPath);
1794
+ const fullPath = isAbsolute(importPath) ? importPath : resolve4(baseDir, importPath);
1484
1795
  if (visited.has(fullPath))
1485
1796
  return "";
1486
1797
  if (!existsSync3(fullPath))
@@ -1488,7 +1799,7 @@ ${contents}` : contents, normalizePostcssModule = (mod) => {
1488
1799
  const nextVisited = new Set(visited);
1489
1800
  nextVisited.add(fullPath);
1490
1801
  const imported = readFileSync3(fullPath, "utf-8");
1491
- return resolveCssImportsSync(imported, dirname(fullPath), nextVisited);
1802
+ return resolveCssImportsSync(imported, dirname2(fullPath), nextVisited);
1492
1803
  });
1493
1804
  }, compileStyleFileIfNeededSync = (filePath, config) => {
1494
1805
  const rawContents = readFileSync3(filePath, "utf-8");
@@ -1514,18 +1825,18 @@ ${contents}` : contents, normalizePostcssModule = (mod) => {
1514
1825
  loadPaths,
1515
1826
  style: "expanded",
1516
1827
  syntax: language === "sass" ? "indented" : "scss",
1517
- url: new URL(pathToFileURL(resolve3(filePath)).href)
1828
+ url: new URL(pathToFileURL(resolve4(filePath)).href)
1518
1829
  });
1519
1830
  const loadedUrls = result.loadedUrls ?? [];
1520
1831
  for (const url of loadedUrls) {
1521
1832
  if (url.protocol !== "file:")
1522
1833
  continue;
1523
1834
  const dep = fileURLToPath(url);
1524
- if (resolve3(dep) === resolve3(filePath))
1835
+ if (resolve4(dep) === resolve4(filePath))
1525
1836
  continue;
1526
1837
  addStyleImporter(filePath, dep);
1527
1838
  }
1528
- return resolveCssImportsSync(result.css, dirname(filePath), new Set([filePath]));
1839
+ return resolveCssImportsSync(result.css, dirname2(filePath), new Set([filePath]));
1529
1840
  }
1530
1841
  if (language === "less") {
1531
1842
  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.`);
@@ -1533,7 +1844,7 @@ ${contents}` : contents, normalizePostcssModule = (mod) => {
1533
1844
  if (language === "stylus") {
1534
1845
  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.`);
1535
1846
  }
1536
- return resolveCssImportsSync(rawContents, dirname(filePath), new Set([filePath]));
1847
+ return resolveCssImportsSync(rawContents, dirname2(filePath), new Set([filePath]));
1537
1848
  }, getCssOutputExtension = (filePath) => isPreprocessableStylePath(filePath) ? ".css" : extname(filePath);
1538
1849
  var init_stylePreprocessor = __esm(() => {
1539
1850
  CSS_EXTENSION_PATTERN = /\.css$/i;
@@ -1542,7 +1853,7 @@ var init_stylePreprocessor = __esm(() => {
1542
1853
  STYLE_LANGUAGE_PATTERN = /^(s[ac]ss|less|styl(?:us)?)$/i;
1543
1854
  importOptionalPeer = new Function("specifier", "return import(specifier)");
1544
1855
  requireOptionalPeer = new Function("specifier", "return require(specifier)");
1545
- requireFromCwd = createRequire(join3(process.cwd(), "package.json"));
1856
+ requireFromCwd = createRequire(join5(process.cwd(), "package.json"));
1546
1857
  styleDependencyGraph = new Map;
1547
1858
  styleOutputHashes = new Map;
1548
1859
  stylePreprocessorPlugin = createStylePreprocessorPlugin();
@@ -1550,14 +1861,14 @@ var init_stylePreprocessor = __esm(() => {
1550
1861
  });
1551
1862
 
1552
1863
  // src/core/svelteServerModule.ts
1553
- import { mkdir, readdir } from "fs/promises";
1554
- import { basename as basename2, dirname as dirname2, extname as extname2, join as join4, relative as relative2, resolve as resolve4 } from "path";
1555
- var serverCacheRoot, compiledModuleCache, originalSourcePathCache, transpiler, ensureRelativeImportPath = (from, target) => {
1556
- const importPath = relative2(dirname2(from), target).replace(/\\/g, "/");
1864
+ import { mkdir as mkdir2, readdir as readdir2 } from "fs/promises";
1865
+ import { basename as basename2, dirname as dirname3, extname as extname2, join as join6, relative as relative3, resolve as resolve5 } from "path";
1866
+ var serverCacheRoot2, compiledModuleCache2, originalSourcePathCache, transpiler, ensureRelativeImportPath = (from, target) => {
1867
+ const importPath = relative3(dirname3(from), target).replace(/\\/g, "/");
1557
1868
  return importPath.startsWith(".") ? importPath : `./${importPath}`;
1558
1869
  }, processDirectoryEntries = (entries, dir, targetFileName, stack) => {
1559
1870
  for (const entry of entries) {
1560
- const entryPath = join4(dir, entry.name);
1871
+ const entryPath = join6(dir, entry.name);
1561
1872
  if (entry.isDirectory())
1562
1873
  stack.push(entryPath);
1563
1874
  if (entry.isFile() && entry.name === targetFileName) {
@@ -1571,7 +1882,7 @@ var serverCacheRoot, compiledModuleCache, originalSourcePathCache, transpiler, e
1571
1882
  const nextStack = [];
1572
1883
  const dirEntries = await Promise.all(dirs.map(async (dir) => ({
1573
1884
  dir,
1574
- entries: await readdir(dir, {
1885
+ entries: await readdir2(dir, {
1575
1886
  encoding: "utf-8",
1576
1887
  withFileTypes: true
1577
1888
  })
@@ -1587,11 +1898,11 @@ var serverCacheRoot, compiledModuleCache, originalSourcePathCache, transpiler, e
1587
1898
  if (cachedPath !== undefined) {
1588
1899
  return cachedPath;
1589
1900
  }
1590
- if (!sourcePath.includes(`${join4(process.cwd(), "build")}${process.platform === "win32" ? "" : "/"}`) && !sourcePath.includes("/build/")) {
1901
+ if (!sourcePath.includes(`${join6(process.cwd(), "build")}${process.platform === "win32" ? "" : "/"}`) && !sourcePath.includes("/build/")) {
1591
1902
  originalSourcePathCache.set(sourcePath, sourcePath);
1592
1903
  return sourcePath;
1593
1904
  }
1594
- const resolvedSourcePath = await findSourceFileByBasename(join4(process.cwd(), "src"), normalizeBuiltSvelteFileName(sourcePath));
1905
+ const resolvedSourcePath = await findSourceFileByBasename(join6(process.cwd(), "src"), normalizeBuiltSvelteFileName(sourcePath));
1595
1906
  const nextPath = resolvedSourcePath ?? sourcePath;
1596
1907
  originalSourcePathCache.set(sourcePath, nextPath);
1597
1908
  return nextPath;
@@ -1599,7 +1910,7 @@ var serverCacheRoot, compiledModuleCache, originalSourcePathCache, transpiler, e
1599
1910
  if (!spec.startsWith(".")) {
1600
1911
  return null;
1601
1912
  }
1602
- const basePath = resolve4(dirname2(from), spec);
1913
+ const basePath = resolve5(dirname3(from), spec);
1603
1914
  const candidates = [
1604
1915
  basePath,
1605
1916
  `${basePath}.ts`,
@@ -1607,19 +1918,19 @@ var serverCacheRoot, compiledModuleCache, originalSourcePathCache, transpiler, e
1607
1918
  `${basePath}.mjs`,
1608
1919
  `${basePath}.cjs`,
1609
1920
  `${basePath}.json`,
1610
- join4(basePath, "index.ts"),
1611
- join4(basePath, "index.js"),
1612
- join4(basePath, "index.mjs"),
1613
- join4(basePath, "index.cjs"),
1614
- join4(basePath, "index.json")
1921
+ join6(basePath, "index.ts"),
1922
+ join6(basePath, "index.js"),
1923
+ join6(basePath, "index.mjs"),
1924
+ join6(basePath, "index.cjs"),
1925
+ join6(basePath, "index.json")
1615
1926
  ];
1616
1927
  const existResults = await Promise.all(candidates.map((candidate) => Bun.file(candidate).exists()));
1617
1928
  const foundIndex = existResults.indexOf(true);
1618
1929
  return foundIndex >= 0 ? candidates[foundIndex] ?? null : null;
1619
- }, getCachedModulePath = (sourcePath) => {
1620
- const relativeSourcePath = relative2(process.cwd(), sourcePath).replace(/\\/g, "/");
1930
+ }, getCachedModulePath2 = (sourcePath) => {
1931
+ const relativeSourcePath = relative3(process.cwd(), sourcePath).replace(/\\/g, "/");
1621
1932
  const normalizedSourcePath = relativeSourcePath.startsWith("..") ? sourcePath.replace(/[:\\/]/g, "_") : relativeSourcePath;
1622
- return join4(serverCacheRoot, `${normalizedSourcePath}.server.js`);
1933
+ return join6(serverCacheRoot2, `${normalizedSourcePath}.server.js`);
1623
1934
  }, resolveSvelteImport = async (spec, from) => {
1624
1935
  if (!spec.startsWith(".") && !spec.startsWith("/")) {
1625
1936
  const resolved = resolvePackageImport(spec);
@@ -1631,7 +1942,7 @@ var serverCacheRoot, compiledModuleCache, originalSourcePathCache, transpiler, e
1631
1942
  if (!spec.startsWith(".")) {
1632
1943
  return null;
1633
1944
  }
1634
- const explicitPath = resolve4(dirname2(from), spec);
1945
+ const explicitPath = resolve5(dirname3(from), spec);
1635
1946
  if (extname2(explicitPath) === ".svelte") {
1636
1947
  return explicitPath;
1637
1948
  }
@@ -1651,7 +1962,7 @@ var serverCacheRoot, compiledModuleCache, originalSourcePathCache, transpiler, e
1651
1962
  }
1652
1963
  await Bun.write(path, content);
1653
1964
  }, compileSvelteServerModule = async (sourcePath) => {
1654
- const cachedModulePath = compiledModuleCache.get(sourcePath);
1965
+ const cachedModulePath = compiledModuleCache2.get(sourcePath);
1655
1966
  if (cachedModulePath) {
1656
1967
  return cachedModulePath;
1657
1968
  }
@@ -1690,7 +2001,7 @@ var serverCacheRoot, compiledModuleCache, originalSourcePathCache, transpiler, e
1690
2001
  continue;
1691
2002
  if (resolvedChildModules[index])
1692
2003
  continue;
1693
- rewrittenModulePaths.set(spec, ensureRelativeImportPath(getCachedModulePath(sourcePath), resolvedModuleImport));
2004
+ rewrittenModulePaths.set(spec, ensureRelativeImportPath(getCachedModulePath2(sourcePath), resolvedModuleImport));
1694
2005
  }
1695
2006
  for (const [spec, resolvedModuleImport] of rewrittenModulePaths) {
1696
2007
  transpiled = transpiled.replaceAll(spec, resolvedModuleImport);
@@ -1704,15 +2015,15 @@ var serverCacheRoot, compiledModuleCache, originalSourcePathCache, transpiler, e
1704
2015
  generate: "server"
1705
2016
  }).js.code;
1706
2017
  for (const [spec, compiledChildPath] of childModulePaths) {
1707
- compiledCode = compiledCode.replaceAll(spec, ensureRelativeImportPath(getCachedModulePath(sourcePath), compiledChildPath));
2018
+ compiledCode = compiledCode.replaceAll(spec, ensureRelativeImportPath(getCachedModulePath2(sourcePath), compiledChildPath));
1708
2019
  }
1709
2020
  for (const [spec, resolvedModuleImport] of rewrittenModulePaths) {
1710
2021
  compiledCode = compiledCode.replaceAll(spec, resolvedModuleImport);
1711
2022
  }
1712
- const compiledModulePath = getCachedModulePath(sourcePath);
1713
- await mkdir(dirname2(compiledModulePath), { recursive: true });
2023
+ const compiledModulePath = getCachedModulePath2(sourcePath);
2024
+ await mkdir2(dirname3(compiledModulePath), { recursive: true });
1714
2025
  await writeIfChanged(compiledModulePath, compiledCode);
1715
- compiledModuleCache.set(sourcePath, compiledModulePath);
2026
+ compiledModuleCache2.set(sourcePath, compiledModulePath);
1716
2027
  return compiledModulePath;
1717
2028
  };
1718
2029
  var init_svelteServerModule = __esm(() => {
@@ -1720,8 +2031,8 @@ var init_svelteServerModule = __esm(() => {
1720
2031
  init_lowerIslandSyntax();
1721
2032
  init_lowerAwaitSlotSyntax();
1722
2033
  init_stylePreprocessor();
1723
- serverCacheRoot = join4(process.cwd(), ".absolutejs", "islands", "svelte");
1724
- compiledModuleCache = new Map;
2034
+ serverCacheRoot2 = join6(process.cwd(), ".absolutejs", "islands", "svelte");
2035
+ compiledModuleCache2 = new Map;
1725
2036
  originalSourcePathCache = new Map;
1726
2037
  transpiler = new Bun.Transpiler({
1727
2038
  loader: "ts",
@@ -1731,16 +2042,16 @@ var init_svelteServerModule = __esm(() => {
1731
2042
 
1732
2043
  // src/core/vueServerModule.ts
1733
2044
  import { existsSync as existsSync4, readFileSync as readFileSync4, realpathSync } from "fs";
1734
- import { mkdir as mkdir2 } from "fs/promises";
1735
- import { dirname as dirname3, join as join5, relative as relative3, resolve as resolve5 } from "path";
2045
+ import { mkdir as mkdir3 } from "fs/promises";
2046
+ import { dirname as dirname4, join as join7, relative as relative4, resolve as resolve6 } from "path";
1736
2047
  var {Transpiler } = globalThis.Bun;
1737
- var ISLAND_COMPONENT_ID_LENGTH = 8, serverCacheRoot2, compiledModuleCache2, transpiler2, ensureRelativeImportPath2 = (from, target) => {
1738
- const importPath = relative3(dirname3(from), target).replace(/\\/g, "/");
2048
+ var ISLAND_COMPONENT_ID_LENGTH = 8, serverCacheRoot3, compiledModuleCache3, transpiler2, ensureRelativeImportPath2 = (from, target) => {
2049
+ const importPath = relative4(dirname4(from), target).replace(/\\/g, "/");
1739
2050
  return importPath.startsWith(".") ? importPath : `./${importPath}`;
1740
- }, getCachedModulePath2 = (sourcePath) => {
1741
- const relativeSourcePath = relative3(process.cwd(), sourcePath).replace(/\\/g, "/");
2051
+ }, getCachedModulePath3 = (sourcePath) => {
2052
+ const relativeSourcePath = relative4(process.cwd(), sourcePath).replace(/\\/g, "/");
1742
2053
  const normalizedSourcePath = relativeSourcePath.startsWith("..") ? sourcePath.replace(/[:\\/]/g, "_") : relativeSourcePath;
1743
- return join5(serverCacheRoot2, `${normalizedSourcePath}.server.js`);
2054
+ return join7(serverCacheRoot3, `${normalizedSourcePath}.server.js`);
1744
2055
  }, writeIfChanged2 = async (path, content) => {
1745
2056
  const targetFile = Bun.file(path);
1746
2057
  if (await targetFile.exists()) {
@@ -1767,7 +2078,7 @@ var ISLAND_COMPONENT_ID_LENGTH = 8, serverCacheRoot2, compiledModuleCache2, tran
1767
2078
  `) : nonVueLines.join(`
1768
2079
  `);
1769
2080
  }, 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) => {
1770
- const cachedModulePath = compiledModuleCache2.get(sourcePath);
2081
+ const cachedModulePath = compiledModuleCache3.get(sourcePath);
1771
2082
  if (cachedModulePath)
1772
2083
  return cachedModulePath;
1773
2084
  const compiler = await import("@vue/compiler-sfc");
@@ -1800,7 +2111,7 @@ var ISLAND_COMPONENT_ID_LENGTH = 8, serverCacheRoot2, compiledModuleCache2, tran
1800
2111
  }).code : "const ssrRender = () => {};";
1801
2112
  const childImportPaths = extractRelativeVueImports(compiledScript.content);
1802
2113
  const compiledChildren = await Promise.all(childImportPaths.map(async (relativeImport) => ({
1803
- compiledPath: await compileVueServerModule(resolve5(dirname3(sourcePath), relativeImport)),
2114
+ compiledPath: await compileVueServerModule(resolve6(dirname4(sourcePath), relativeImport)),
1804
2115
  spec: relativeImport
1805
2116
  })));
1806
2117
  const strippedScript = stripExports(compiledScript.content);
@@ -1812,20 +2123,20 @@ var ISLAND_COMPONENT_ID_LENGTH = 8, serverCacheRoot2, compiledModuleCache2, tran
1812
2123
  "export default script;"
1813
2124
  ].join(`
1814
2125
  `));
1815
- const compiledModulePath = getCachedModulePath2(sourcePath);
2126
+ const compiledModulePath = getCachedModulePath3(sourcePath);
1816
2127
  let rewritten = assembled;
1817
2128
  for (const child of compiledChildren) {
1818
2129
  rewritten = rewritten.replaceAll(child.spec, ensureRelativeImportPath2(compiledModulePath, child.compiledPath));
1819
2130
  }
1820
- await mkdir2(dirname3(compiledModulePath), { recursive: true });
2131
+ await mkdir3(dirname4(compiledModulePath), { recursive: true });
1821
2132
  await writeIfChanged2(compiledModulePath, rewritten);
1822
- compiledModuleCache2.set(sourcePath, compiledModulePath);
2133
+ compiledModuleCache3.set(sourcePath, compiledModulePath);
1823
2134
  return compiledModulePath;
1824
2135
  };
1825
2136
  var init_vueServerModule = __esm(() => {
1826
2137
  init_constants();
1827
- serverCacheRoot2 = join5(process.cwd(), ".absolutejs", "islands", "vue");
1828
- compiledModuleCache2 = new Map;
2138
+ serverCacheRoot3 = join7(process.cwd(), ".absolutejs", "islands", "vue");
2139
+ compiledModuleCache3 = new Map;
1829
2140
  transpiler2 = new Transpiler({ loader: "ts", target: "browser" });
1830
2141
  });
1831
2142
 
@@ -1971,8 +2282,17 @@ var islandSequence = 0, resolvedServerComponentCache, resolvedServerBuildCompone
1971
2282
  throw new Error("Resolved Vue island is not a valid Vue component.");
1972
2283
  }
1973
2284
  return resolvedComponent;
2285
+ }, loadAngularServerBuildComponent = async (buildReferencePath, exportName) => {
2286
+ const serverModulePath = await compileAngularServerModule(buildReferencePath);
2287
+ const loadedModule = await import(serverModulePath);
2288
+ if (exportName && exportName !== "default" && exportName in loadedModule) {
2289
+ return loadedModule[exportName];
2290
+ }
2291
+ return "default" in loadedModule ? loadedModule.default : loadedModule;
1974
2292
  }, resolveAngularServerIslandComponent = async (component) => {
1975
- const resolvedComponent = await resolveServerIslandComponent(component);
2293
+ const buildReference = getIslandBuildReference(component);
2294
+ const buildReferencePath = buildReference?.source ? resolveBuildReferencePath(buildReference.source, import.meta.url) : null;
2295
+ const resolvedComponent = buildReferencePath ? await loadAngularServerBuildComponent(buildReferencePath, buildReference?.export) : await resolveServerIslandComponent(component);
1976
2296
  if (!isAngularServerIslandComponent(resolvedComponent)) {
1977
2297
  throw new Error("Resolved Angular island is not a valid Angular component.");
1978
2298
  }
@@ -2028,6 +2348,7 @@ var islandSequence = 0, resolvedServerComponentCache, resolvedServerBuildCompone
2028
2348
  };
2029
2349
  var init_renderIslandMarkup = __esm(() => {
2030
2350
  init_islandSsr();
2351
+ init_angularServerModule();
2031
2352
  init_svelteServerModule();
2032
2353
  init_vueServerModule();
2033
2354
  init_islandMarkupAttributes();
@@ -2901,12 +3222,12 @@ var init_startupBanner = __esm(() => {
2901
3222
  // src/utils/logger.ts
2902
3223
  var colors2, frameworkColors, formatPath = (filePath) => {
2903
3224
  const cwd = process.cwd();
2904
- let relative4 = filePath.startsWith(cwd) ? filePath.slice(cwd.length + 1) : filePath;
2905
- relative4 = relative4.replace(/\\/g, "/");
2906
- if (!relative4.startsWith("/")) {
2907
- relative4 = `/${relative4}`;
3225
+ let relative5 = filePath.startsWith(cwd) ? filePath.slice(cwd.length + 1) : filePath;
3226
+ relative5 = relative5.replace(/\\/g, "/");
3227
+ if (!relative5.startsWith("/")) {
3228
+ relative5 = `/${relative5}`;
2908
3229
  }
2909
- return relative4;
3230
+ return relative5;
2910
3231
  }, getFrameworkColor = (framework) => frameworkColors[framework] || colors2.white, log = (action, options) => {
2911
3232
  const timestamp = `${colors2.dim}${formatTimestamp()}${colors2.reset}`;
2912
3233
  const tag = `${colors2.cyan}[hmr]${colors2.reset}`;
@@ -3510,8 +3831,8 @@ __export(exports_generatedDir, {
3510
3831
  getGeneratedRoot: () => getGeneratedRoot,
3511
3832
  getFrameworkGeneratedDir: () => getFrameworkGeneratedDir
3512
3833
  });
3513
- import { join as join6 } from "path";
3514
- var GENERATED_DIR_NAME = "generated", ABSOLUTE_CACHE_DIR_NAME = ".absolutejs", getGeneratedRoot = (projectRoot = process.cwd()) => join6(projectRoot, ABSOLUTE_CACHE_DIR_NAME, GENERATED_DIR_NAME), getFrameworkGeneratedDir = (framework, projectRoot = process.cwd()) => join6(getGeneratedRoot(projectRoot), framework);
3834
+ import { join as join8 } from "path";
3835
+ var GENERATED_DIR_NAME = "generated", ABSOLUTE_CACHE_DIR_NAME = ".absolutejs", getGeneratedRoot = (projectRoot = process.cwd()) => join8(projectRoot, ABSOLUTE_CACHE_DIR_NAME, GENERATED_DIR_NAME), getFrameworkGeneratedDir = (framework, projectRoot = process.cwd()) => join8(getGeneratedRoot(projectRoot), framework);
3515
3836
  var init_generatedDir = () => {};
3516
3837
 
3517
3838
  // src/build/compileAngular.ts
@@ -3524,7 +3845,7 @@ __export(exports_compileAngular, {
3524
3845
  compileAngular: () => compileAngular
3525
3846
  });
3526
3847
  import { existsSync as existsSync5, readFileSync as readFileSync5, promises as fs } from "fs";
3527
- import { join as join7, basename as basename3, sep, dirname as dirname4, resolve as resolve6, relative as relative4 } from "path";
3848
+ import { join as join9, basename as basename3, sep, dirname as dirname5, resolve as resolve7, relative as relative5 } from "path";
3528
3849
  var {Glob } = globalThis.Bun;
3529
3850
  import ts from "typescript";
3530
3851
  var traceAngularPhase = async (name, fn, metadata) => {
@@ -3532,10 +3853,10 @@ var traceAngularPhase = async (name, fn, metadata) => {
3532
3853
  return tracePhase ? tracePhase(`compile/angular/${name}`, fn, metadata) : await fn();
3533
3854
  }, readTsconfigPathAliases = () => {
3534
3855
  try {
3535
- const configPath = resolve6(process.cwd(), "tsconfig.json");
3856
+ const configPath = resolve7(process.cwd(), "tsconfig.json");
3536
3857
  const config = ts.readConfigFile(configPath, ts.sys.readFile).config;
3537
3858
  const compilerOptions = config?.compilerOptions ?? {};
3538
- const baseUrl = resolve6(process.cwd(), compilerOptions.baseUrl ?? ".");
3859
+ const baseUrl = resolve7(process.cwd(), compilerOptions.baseUrl ?? ".");
3539
3860
  const aliases = Object.entries(compilerOptions.paths ?? {}).map(([pattern, replacements]) => ({ pattern, replacements }));
3540
3861
  return { aliases, baseUrl };
3541
3862
  } catch {
@@ -3555,7 +3876,7 @@ var traceAngularPhase = async (name, fn, metadata) => {
3555
3876
  const wildcardValue = exactMatch ? "" : specifier.slice(prefix.length, specifier.length - suffix.length);
3556
3877
  for (const replacement of alias.replacements) {
3557
3878
  const candidate = replacement.replace("*", wildcardValue);
3558
- const resolved = resolveSourceFile(resolve6(baseUrl, candidate));
3879
+ const resolved = resolveSourceFile(resolve7(baseUrl, candidate));
3559
3880
  if (resolved)
3560
3881
  return resolved;
3561
3882
  }
@@ -3567,20 +3888,20 @@ var traceAngularPhase = async (name, fn, metadata) => {
3567
3888
  `${candidate}.tsx`,
3568
3889
  `${candidate}.js`,
3569
3890
  `${candidate}.jsx`,
3570
- join7(candidate, "index.ts"),
3571
- join7(candidate, "index.tsx"),
3572
- join7(candidate, "index.js"),
3573
- join7(candidate, "index.jsx")
3891
+ join9(candidate, "index.ts"),
3892
+ join9(candidate, "index.tsx"),
3893
+ join9(candidate, "index.js"),
3894
+ join9(candidate, "index.jsx")
3574
3895
  ];
3575
3896
  return candidates.find((file) => existsSync5(file));
3576
3897
  }, createLegacyAngularAnimationUsageResolver = (rootDir) => {
3577
- const baseDir = resolve6(rootDir);
3898
+ const baseDir = resolve7(rootDir);
3578
3899
  const tsconfigAliases = readTsconfigPathAliases();
3579
3900
  const transpiler3 = new Bun.Transpiler({ loader: "tsx" });
3580
3901
  const scanCache = new Map;
3581
3902
  const resolveLocalImport = (specifier, fromDir) => {
3582
3903
  if (specifier.startsWith(".") || specifier.startsWith("/")) {
3583
- return resolveSourceFile(resolve6(fromDir, specifier));
3904
+ return resolveSourceFile(resolve7(fromDir, specifier));
3584
3905
  }
3585
3906
  const aliased = matchTsconfigAlias(specifier, tsconfigAliases.aliases, tsconfigAliases.baseUrl, resolveSourceFile);
3586
3907
  if (aliased)
@@ -3589,7 +3910,7 @@ var traceAngularPhase = async (name, fn, metadata) => {
3589
3910
  const resolved = Bun.resolveSync(specifier, fromDir);
3590
3911
  if (resolved.includes("/node_modules/"))
3591
3912
  return;
3592
- const absolute = resolve6(resolved);
3913
+ const absolute = resolve7(resolved);
3593
3914
  if (!absolute.startsWith(baseDir))
3594
3915
  return;
3595
3916
  return resolveSourceFile(absolute);
@@ -3605,7 +3926,7 @@ var traceAngularPhase = async (name, fn, metadata) => {
3605
3926
  usesLegacyAnimations: false
3606
3927
  });
3607
3928
  }
3608
- const resolved = resolve6(actualPath);
3929
+ const resolved = resolve7(actualPath);
3609
3930
  const cached = scanCache.get(resolved);
3610
3931
  if (cached)
3611
3932
  return cached;
@@ -3634,7 +3955,7 @@ var traceAngularPhase = async (name, fn, metadata) => {
3634
3955
  const actualPath = resolveSourceFile(filePath);
3635
3956
  if (!actualPath)
3636
3957
  return false;
3637
- const resolved = resolve6(actualPath);
3958
+ const resolved = resolve7(actualPath);
3638
3959
  if (visited.has(resolved))
3639
3960
  return false;
3640
3961
  visited.add(resolved);
@@ -3642,7 +3963,7 @@ var traceAngularPhase = async (name, fn, metadata) => {
3642
3963
  if (scan.usesLegacyAnimations)
3643
3964
  return true;
3644
3965
  for (const specifier of scan.imports) {
3645
- const importedPath = resolveLocalImport(specifier, dirname4(resolved));
3966
+ const importedPath = resolveLocalImport(specifier, dirname5(resolved));
3646
3967
  if (importedPath && await visit(importedPath, visited)) {
3647
3968
  return true;
3648
3969
  }
@@ -3652,14 +3973,14 @@ var traceAngularPhase = async (name, fn, metadata) => {
3652
3973
  return (entryPath) => visit(entryPath);
3653
3974
  }, resolveDevClientDir = () => {
3654
3975
  const projectRoot = process.cwd();
3655
- const fromSource = resolve6(import.meta.dir, "../dev/client");
3976
+ const fromSource = resolve7(import.meta.dir, "../dev/client");
3656
3977
  if (existsSync5(fromSource) && fromSource.startsWith(projectRoot)) {
3657
3978
  return fromSource;
3658
3979
  }
3659
- const fromNodeModules = resolve6(projectRoot, "node_modules/@absolutejs/absolute/dist/dev/client");
3980
+ const fromNodeModules = resolve7(projectRoot, "node_modules/@absolutejs/absolute/dist/dev/client");
3660
3981
  if (existsSync5(fromNodeModules))
3661
3982
  return fromNodeModules;
3662
- return resolve6(import.meta.dir, "./dev/client");
3983
+ return resolve7(import.meta.dir, "./dev/client");
3663
3984
  }, devClientDir, hmrClientPath, formatDiagnosticMessage = (diagnostic) => {
3664
3985
  try {
3665
3986
  return ts.flattenDiagnosticMessageText(diagnostic.messageText, `
@@ -3701,12 +4022,12 @@ var traceAngularPhase = async (name, fn, metadata) => {
3701
4022
  return `${path.replace(/\.ts$/, ".js")}${query}`;
3702
4023
  if (hasJsLikeExtension(path))
3703
4024
  return `${path}${query}`;
3704
- const importerDir = dirname4(importerOutputPath);
3705
- const fileCandidate = resolve6(importerDir, `${path}.js`);
4025
+ const importerDir = dirname5(importerOutputPath);
4026
+ const fileCandidate = resolve7(importerDir, `${path}.js`);
3706
4027
  if (outputFiles?.has(fileCandidate) || existsSync5(fileCandidate)) {
3707
4028
  return `${path}.js${query}`;
3708
4029
  }
3709
- const indexCandidate = resolve6(importerDir, path, "index.js");
4030
+ const indexCandidate = resolve7(importerDir, path, "index.js");
3710
4031
  if (outputFiles?.has(indexCandidate) || existsSync5(indexCandidate)) {
3711
4032
  return `${path}/index.js${query}`;
3712
4033
  }
@@ -3734,18 +4055,18 @@ var traceAngularPhase = async (name, fn, metadata) => {
3734
4055
  }, resolveLocalTsImport = (fromFile, specifier) => {
3735
4056
  if (!isRelativeModuleSpecifier(specifier))
3736
4057
  return null;
3737
- const basePath = resolve6(dirname4(fromFile), specifier);
4058
+ const basePath = resolve7(dirname5(fromFile), specifier);
3738
4059
  const candidates = /\.[cm]?[tj]sx?$/.test(basePath) ? [basePath] : [
3739
4060
  `${basePath}.ts`,
3740
4061
  `${basePath}.tsx`,
3741
4062
  `${basePath}.mts`,
3742
4063
  `${basePath}.cts`,
3743
- join7(basePath, "index.ts"),
3744
- join7(basePath, "index.tsx"),
3745
- join7(basePath, "index.mts"),
3746
- join7(basePath, "index.cts")
4064
+ join9(basePath, "index.ts"),
4065
+ join9(basePath, "index.tsx"),
4066
+ join9(basePath, "index.mts"),
4067
+ join9(basePath, "index.cts")
3747
4068
  ];
3748
- return candidates.map((candidate) => resolve6(candidate)).find((candidate) => existsSync5(candidate) && !candidate.endsWith(".d.ts")) ?? null;
4069
+ return candidates.map((candidate) => resolve7(candidate)).find((candidate) => existsSync5(candidate) && !candidate.endsWith(".d.ts")) ?? null;
3749
4070
  }, readFileForAotTransform = async (fileName, readFile2) => {
3750
4071
  const hostSource = readFile2?.(fileName);
3751
4072
  if (typeof hostSource === "string")
@@ -3769,18 +4090,18 @@ var traceAngularPhase = async (name, fn, metadata) => {
3769
4090
  const paths = [];
3770
4091
  const templateUrlMatch = findUncommentedMatch(source, /templateUrl\s*:\s*['"]([^'"]+)['"]/);
3771
4092
  if (templateUrlMatch?.[1])
3772
- paths.push(join7(fileDir, templateUrlMatch[1]));
4093
+ paths.push(join9(fileDir, templateUrlMatch[1]));
3773
4094
  const styleUrlMatch = findUncommentedMatch(source, /styleUrl\s*:\s*['"]([^'"]+)['"]/);
3774
4095
  if (styleUrlMatch?.[1])
3775
- paths.push(join7(fileDir, styleUrlMatch[1]));
4096
+ paths.push(join9(fileDir, styleUrlMatch[1]));
3776
4097
  const styleUrlsMatch = findUncommentedMatch(source, /styleUrls\s*:\s*\[([^\]]+)\]/);
3777
4098
  const urlMatches = styleUrlsMatch?.[1]?.match(/['"]([^'"]+)['"]/g);
3778
4099
  if (urlMatches) {
3779
4100
  for (const urlMatch of urlMatches) {
3780
- paths.push(join7(fileDir, urlMatch.replace(/['"]/g, "")));
4101
+ paths.push(join9(fileDir, urlMatch.replace(/['"]/g, "")));
3781
4102
  }
3782
4103
  }
3783
- return paths.map((path) => resolve6(path));
4104
+ return paths.map((path) => resolve7(path));
3784
4105
  }, readResourceCacheFile = async (cachePath) => {
3785
4106
  try {
3786
4107
  const entry = JSON.parse(await fs.readFile(cachePath, "utf-8"));
@@ -3792,13 +4113,13 @@ var traceAngularPhase = async (name, fn, metadata) => {
3792
4113
  return null;
3793
4114
  }
3794
4115
  }, writeResourceCacheFile = async (cachePath, source) => {
3795
- await fs.mkdir(dirname4(cachePath), { recursive: true });
4116
+ await fs.mkdir(dirname5(cachePath), { recursive: true });
3796
4117
  await fs.writeFile(cachePath, JSON.stringify({
3797
4118
  source,
3798
4119
  version: 1
3799
4120
  }), "utf-8");
3800
4121
  }, resolveResourceTransformCachePath = async (filePath, source, stylePreprocessors) => {
3801
- const resourcePaths = collectAngularResourcePaths(source, dirname4(filePath));
4122
+ const resourcePaths = collectAngularResourcePaths(source, dirname5(filePath));
3802
4123
  const resourceContents = await Promise.all(resourcePaths.map(async (resourcePath) => {
3803
4124
  const content = await fs.readFile(resourcePath, "utf-8");
3804
4125
  return `${resourcePath}\x00${content}`;
@@ -3811,7 +4132,7 @@ var traceAngularPhase = async (name, fn, metadata) => {
3811
4132
  safeStableStringify(stylePreprocessors ?? null)
3812
4133
  ].join("\x00");
3813
4134
  const cacheKey = Bun.hash(cacheInput).toString(BASE_36_RADIX);
3814
- return join7(process.cwd(), ".absolutejs", "cache", "angular-resources", `${cacheKey}.json`);
4135
+ return join9(process.cwd(), ".absolutejs", "cache", "angular-resources", `${cacheKey}.json`);
3815
4136
  }, precomputeAotResourceTransforms = async (inputPaths, readFile2, stylePreprocessors) => {
3816
4137
  const transformedSources = new Map;
3817
4138
  const visited = new Set;
@@ -3822,7 +4143,7 @@ var traceAngularPhase = async (name, fn, metadata) => {
3822
4143
  transformedFiles: 0
3823
4144
  };
3824
4145
  const transformFile = async (filePath) => {
3825
- const resolvedPath = resolve6(filePath);
4146
+ const resolvedPath = resolve7(filePath);
3826
4147
  if (visited.has(resolvedPath))
3827
4148
  return;
3828
4149
  visited.add(resolvedPath);
@@ -3838,7 +4159,7 @@ var traceAngularPhase = async (name, fn, metadata) => {
3838
4159
  transformedSource = cached.source;
3839
4160
  } else {
3840
4161
  stats.cacheMisses += 1;
3841
- const transformed = await inlineResources(source, dirname4(resolvedPath), stylePreprocessors);
4162
+ const transformed = await inlineResources(source, dirname5(resolvedPath), stylePreprocessors);
3842
4163
  transformedSource = transformed.source;
3843
4164
  await writeResourceCacheFile(cachePath, transformedSource);
3844
4165
  }
@@ -3857,7 +4178,7 @@ var traceAngularPhase = async (name, fn, metadata) => {
3857
4178
  return { stats, transformedSources };
3858
4179
  }, compileAngularFiles = async (inputPaths, outDir, stylePreprocessors) => {
3859
4180
  const islandMetadataByOutputPath = await traceAngularPhase("aot/island-metadata", () => new Map(inputPaths.map((inputPath) => {
3860
- const outputPath = resolve6(join7(outDir, relative4(process.cwd(), resolve6(inputPath)).replace(/\.[cm]?[tj]sx?$/, ".js")));
4181
+ const outputPath = resolve7(join9(outDir, relative5(process.cwd(), resolve7(inputPath)).replace(/\.[cm]?[tj]sx?$/, ".js")));
3861
4182
  return [
3862
4183
  outputPath,
3863
4184
  buildIslandMetadataExports(readFileSync5(inputPath, "utf-8"))
@@ -3867,8 +4188,8 @@ var traceAngularPhase = async (name, fn, metadata) => {
3867
4188
  const { readConfiguration, performCompilation, EmitFlags } = await traceAngularPhase("aot/import-compiler-cli", () => import("@angular/compiler-cli"));
3868
4189
  const tsLibDir = await traceAngularPhase("aot/resolve-typescript-lib", () => {
3869
4190
  const tsPath = __require.resolve("typescript");
3870
- const tsRootDir = dirname4(tsPath);
3871
- return tsRootDir.endsWith("lib") ? tsRootDir : resolve6(tsRootDir, "lib");
4191
+ const tsRootDir = dirname5(tsPath);
4192
+ return tsRootDir.endsWith("lib") ? tsRootDir : resolve7(tsRootDir, "lib");
3872
4193
  });
3873
4194
  const config = await traceAngularPhase("aot/read-configuration", () => readConfiguration("./tsconfig.json"));
3874
4195
  const options = {
@@ -3904,13 +4225,13 @@ var traceAngularPhase = async (name, fn, metadata) => {
3904
4225
  const originalGetSourceFile = host.getSourceFile;
3905
4226
  host.getSourceFile = (fileName, languageVersion, onError) => {
3906
4227
  if (fileName.startsWith("lib.") && fileName.endsWith(".d.ts") && tsLibDir) {
3907
- const resolvedPath = join7(tsLibDir, fileName);
4228
+ const resolvedPath = join9(tsLibDir, fileName);
3908
4229
  return originalGetSourceFile?.call(host, resolvedPath, languageVersion, onError);
3909
4230
  }
3910
4231
  return originalGetSourceFile?.call(host, fileName, languageVersion, onError);
3911
4232
  };
3912
4233
  const emitted = {};
3913
- const resolvedOutDir = resolve6(outDir);
4234
+ const resolvedOutDir = resolve7(outDir);
3914
4235
  host.writeFile = (fileName, text) => {
3915
4236
  const relativePath = resolveRelativePath(fileName, resolvedOutDir, outDir);
3916
4237
  emitted[relativePath] = text;
@@ -3932,12 +4253,12 @@ var traceAngularPhase = async (name, fn, metadata) => {
3932
4253
  if (!fileName.endsWith(".ts") || fileName.endsWith(".d.ts")) {
3933
4254
  return source;
3934
4255
  }
3935
- const resolvedPath = resolve6(fileName);
4256
+ const resolvedPath = resolve7(fileName);
3936
4257
  return transformedSources.get(resolvedPath) ?? source;
3937
4258
  };
3938
4259
  const originalGetSourceFileForCompile = host.getSourceFile;
3939
4260
  host.getSourceFile = (fileName, languageVersion, onError) => {
3940
- const source = transformedSources.get(resolve6(fileName));
4261
+ const source = transformedSources.get(resolve7(fileName));
3941
4262
  if (source) {
3942
4263
  return ts.createSourceFile(fileName, source, languageVersion, true);
3943
4264
  }
@@ -3959,9 +4280,9 @@ var traceAngularPhase = async (name, fn, metadata) => {
3959
4280
  const entries = await traceAngularPhase("aot/postprocess-emitted-js", () => {
3960
4281
  const rawEntries = Object.entries(emitted).filter(([fileName]) => fileName.endsWith(".js")).map(([fileName, content]) => ({
3961
4282
  content,
3962
- target: join7(outDir, fileName)
4283
+ target: join9(outDir, fileName)
3963
4284
  }));
3964
- const outputFiles = new Set(rawEntries.map(({ target }) => resolve6(target)));
4285
+ const outputFiles = new Set(rawEntries.map(({ target }) => resolve7(target)));
3965
4286
  return rawEntries.map(({ content, target }) => {
3966
4287
  let processedContent = content.replace(/from\s+(['"])(\.\.?\/[^'"]+)(\1)/g, (match, quote, path) => {
3967
4288
  const rewritten = rewriteRelativeJsSpecifier(target, path, outputFiles);
@@ -3976,17 +4297,17 @@ var traceAngularPhase = async (name, fn, metadata) => {
3976
4297
  return cleaned ? `import { ${cleaned}, InternalInjectFlags } from '@angular/core'` : `import { InternalInjectFlags } from '@angular/core'`;
3977
4298
  });
3978
4299
  processedContent = processedContent.replace(/\b(?<!Internal)InjectFlags\b/g, "InternalInjectFlags");
3979
- processedContent += islandMetadataByOutputPath.get(resolve6(target)) ?? "";
4300
+ processedContent += islandMetadataByOutputPath.get(resolve7(target)) ?? "";
3980
4301
  return { content: processedContent, target };
3981
4302
  });
3982
4303
  });
3983
4304
  await traceAngularPhase("aot/write-output", () => Promise.all(entries.map(async ({ target, content }) => {
3984
- await fs.mkdir(dirname4(target), { recursive: true });
4305
+ await fs.mkdir(dirname5(target), { recursive: true });
3985
4306
  await fs.writeFile(target, content, "utf-8");
3986
4307
  })), { outputs: entries.length });
3987
4308
  return await traceAngularPhase("aot/collect-output-paths", () => entries.map(({ target }) => target), { outputs: entries.length });
3988
4309
  }, compileAngularFile = async (inputPath, outDir, stylePreprocessors) => compileAngularFiles([inputPath], outDir, stylePreprocessors), jitContentCache, invalidateAngularJitCache = (filePath) => {
3989
- jitContentCache.delete(resolve6(filePath));
4310
+ jitContentCache.delete(resolve7(filePath));
3990
4311
  }, wrapperOutputCache, escapeTemplateContent = (content) => content.replace(/\\/g, "\\\\").replace(/`/g, "\\`").replace(/\$\{/g, "\\${"), findUncommentedMatch = (source, pattern) => {
3991
4312
  const re = new RegExp(pattern.source, pattern.flags.includes("g") ? pattern.flags : pattern.flags + "g");
3992
4313
  let match;
@@ -3999,7 +4320,7 @@ var traceAngularPhase = async (name, fn, metadata) => {
3999
4320
  }
4000
4321
  return null;
4001
4322
  }, resolveAngularDeferImportSpecifier = () => {
4002
- const sourceEntry = resolve6(import.meta.dir, "../angular/components/index.ts");
4323
+ const sourceEntry = resolve7(import.meta.dir, "../angular/components/index.ts");
4003
4324
  if (existsSync5(sourceEntry)) {
4004
4325
  return sourceEntry.replace(/\\/g, "/");
4005
4326
  }
@@ -4136,7 +4457,7 @@ ${fields}
4136
4457
  }, inlineTemplateAndLowerDefer = async (source, fileDir) => {
4137
4458
  const templateUrlMatch = findUncommentedMatch(source, /templateUrl\s*:\s*['"]([^'"]+)['"]/);
4138
4459
  if (templateUrlMatch?.[1]) {
4139
- const templatePath = join7(fileDir, templateUrlMatch[1]);
4460
+ const templatePath = join9(fileDir, templateUrlMatch[1]);
4140
4461
  if (!existsSync5(templatePath)) {
4141
4462
  throw new Error(`Unable to inline Angular templateUrl "${templateUrlMatch[1]}": file not found at ${templatePath}`);
4142
4463
  }
@@ -4167,7 +4488,7 @@ ${fields}
4167
4488
  }, inlineTemplateAndLowerDeferSync = (source, fileDir) => {
4168
4489
  const templateUrlMatch = findUncommentedMatch(source, /templateUrl\s*:\s*['"]([^'"]+)['"]/);
4169
4490
  if (templateUrlMatch?.[1]) {
4170
- const templatePath = join7(fileDir, templateUrlMatch[1]);
4491
+ const templatePath = join9(fileDir, templateUrlMatch[1]);
4171
4492
  if (!existsSync5(templatePath)) {
4172
4493
  throw new Error(`Unable to inline Angular templateUrl "${templateUrlMatch[1]}": file not found at ${templatePath}`);
4173
4494
  }
@@ -4204,7 +4525,7 @@ ${fields}
4204
4525
  return source;
4205
4526
  const stylePromises = urlMatches.map((urlMatch) => {
4206
4527
  const styleUrl = urlMatch.replace(/['"]/g, "");
4207
- return readAndEscapeFile(join7(fileDir, styleUrl), stylePreprocessors);
4528
+ return readAndEscapeFile(join9(fileDir, styleUrl), stylePreprocessors);
4208
4529
  });
4209
4530
  const results = await Promise.all(stylePromises);
4210
4531
  const inlinedStyles = results.filter(Boolean).map((escaped) => `\`${escaped}\``);
@@ -4215,7 +4536,7 @@ ${fields}
4215
4536
  const styleUrlMatch = findUncommentedMatch(source, /styleUrl\s*:\s*['"]([^'"]+)['"]/);
4216
4537
  if (!styleUrlMatch?.[1])
4217
4538
  return source;
4218
- const escaped = await readAndEscapeFile(join7(fileDir, styleUrlMatch[1]), stylePreprocessors);
4539
+ const escaped = await readAndEscapeFile(join9(fileDir, styleUrlMatch[1]), stylePreprocessors);
4219
4540
  if (!escaped)
4220
4541
  return source;
4221
4542
  return source.slice(0, styleUrlMatch.index) + `styles: [\`${escaped}\`]` + source.slice(styleUrlMatch.index + styleUrlMatch[0].length);
@@ -4229,10 +4550,10 @@ ${fields}
4229
4550
  source: result
4230
4551
  };
4231
4552
  }, compileAngularFileJIT = async (inputPath, outDir, rootDir, stylePreprocessors, cacheBuster) => {
4232
- const entryPath = resolve6(inputPath);
4553
+ const entryPath = resolve7(inputPath);
4233
4554
  const allOutputs = [];
4234
4555
  const visited = new Set;
4235
- const baseDir = resolve6(rootDir ?? process.cwd());
4556
+ const baseDir = resolve7(rootDir ?? process.cwd());
4236
4557
  let usesLegacyAnimations = false;
4237
4558
  const angularTranspiler = new Bun.Transpiler({
4238
4559
  loader: "ts",
@@ -4251,16 +4572,16 @@ ${fields}
4251
4572
  `${candidate}.js`,
4252
4573
  `${candidate}.jsx`,
4253
4574
  `${candidate}.json`,
4254
- join7(candidate, "index.ts"),
4255
- join7(candidate, "index.tsx"),
4256
- join7(candidate, "index.js"),
4257
- join7(candidate, "index.jsx")
4575
+ join9(candidate, "index.ts"),
4576
+ join9(candidate, "index.tsx"),
4577
+ join9(candidate, "index.js"),
4578
+ join9(candidate, "index.jsx")
4258
4579
  ];
4259
4580
  return candidates.find((file) => existsSync5(file));
4260
4581
  };
4261
4582
  const resolveLocalImport = (specifier, fromDir) => {
4262
4583
  if (specifier.startsWith(".") || specifier.startsWith("/")) {
4263
- return resolveSourceFile2(resolve6(fromDir, specifier));
4584
+ return resolveSourceFile2(resolve7(fromDir, specifier));
4264
4585
  }
4265
4586
  const aliased = matchTsconfigAlias(specifier, tsconfigAliases.aliases, tsconfigAliases.baseUrl, resolveSourceFile2);
4266
4587
  if (aliased)
@@ -4269,7 +4590,7 @@ ${fields}
4269
4590
  const resolved = Bun.resolveSync(specifier, fromDir);
4270
4591
  if (resolved.includes("/node_modules/"))
4271
4592
  return;
4272
- const absolute = resolve6(resolved);
4593
+ const absolute = resolve7(resolved);
4273
4594
  if (!absolute.startsWith(baseDir))
4274
4595
  return;
4275
4596
  return resolveSourceFile2(absolute);
@@ -4278,13 +4599,13 @@ ${fields}
4278
4599
  }
4279
4600
  };
4280
4601
  const toOutputPath = (sourcePath) => {
4281
- const inputDir = dirname4(sourcePath);
4602
+ const inputDir = dirname5(sourcePath);
4282
4603
  const fileBase = basename3(sourcePath).replace(/\.[cm]?[tj]sx?$/, ".js");
4283
4604
  if (inputDir === outDir || inputDir.startsWith(`${outDir}${sep}`)) {
4284
- return join7(inputDir, fileBase);
4605
+ return join9(inputDir, fileBase);
4285
4606
  }
4286
4607
  const relativeDir = inputDir.startsWith(baseDir) ? inputDir.substring(baseDir.length + 1) : inputDir;
4287
- return join7(outDir, relativeDir, fileBase);
4608
+ return join9(outDir, relativeDir, fileBase);
4288
4609
  };
4289
4610
  const withCacheBuster = (specifier) => {
4290
4611
  if (!cacheBuster)
@@ -4321,21 +4642,21 @@ ${fields}
4321
4642
  return `${prefix}${dots}`;
4322
4643
  return `${prefix}../${dots}`;
4323
4644
  });
4324
- if (resolve6(actualPath) === entryPath) {
4645
+ if (resolve7(actualPath) === entryPath) {
4325
4646
  processedContent += buildIslandMetadataExports(sourceCode);
4326
4647
  }
4327
4648
  return processedContent;
4328
4649
  };
4329
4650
  const transpileFile = async (filePath) => {
4330
- const resolved = resolve6(filePath);
4651
+ const resolved = resolve7(filePath);
4331
4652
  if (visited.has(resolved))
4332
4653
  return;
4333
4654
  visited.add(resolved);
4334
4655
  if (resolved.endsWith(".json") && existsSync5(resolved)) {
4335
- const inputDir2 = dirname4(resolved);
4656
+ const inputDir2 = dirname5(resolved);
4336
4657
  const relativeDir2 = inputDir2.startsWith(baseDir) ? inputDir2.substring(baseDir.length + 1) : inputDir2;
4337
- const targetDir2 = join7(outDir, relativeDir2);
4338
- const targetPath2 = join7(targetDir2, basename3(resolved));
4658
+ const targetDir2 = join9(outDir, relativeDir2);
4659
+ const targetPath2 = join9(targetDir2, basename3(resolved));
4339
4660
  await fs.mkdir(targetDir2, { recursive: true });
4340
4661
  await fs.copyFile(resolved, targetPath2);
4341
4662
  allOutputs.push(targetPath2);
@@ -4347,13 +4668,13 @@ ${fields}
4347
4668
  if (!existsSync5(actualPath))
4348
4669
  return;
4349
4670
  let sourceCode = await fs.readFile(actualPath, "utf-8");
4350
- const inlined = await inlineResources(sourceCode, dirname4(actualPath), stylePreprocessors);
4351
- sourceCode = inlineTemplateAndLowerDeferSync(inlined.source, dirname4(actualPath)).source;
4352
- const inputDir = dirname4(actualPath);
4671
+ const inlined = await inlineResources(sourceCode, dirname5(actualPath), stylePreprocessors);
4672
+ sourceCode = inlineTemplateAndLowerDeferSync(inlined.source, dirname5(actualPath)).source;
4673
+ const inputDir = dirname5(actualPath);
4353
4674
  const fileBase = basename3(actualPath).replace(/\.[cm]?[tj]sx?$/, ".js");
4354
4675
  const targetPath = toOutputPath(actualPath);
4355
- const targetDir = dirname4(targetPath);
4356
- const relativeDir = relative4(outDir, targetDir).replace(/\\/g, "/");
4676
+ const targetDir = dirname5(targetPath);
4677
+ const relativeDir = relative5(outDir, targetDir).replace(/\\/g, "/");
4357
4678
  const localImports = [];
4358
4679
  const importRewrites = new Map;
4359
4680
  const fromRegex = /(?:from|import)\s+['"]([^'".][^'"]*|\.\.?\/[^'"]+)['"]/g;
@@ -4374,12 +4695,12 @@ ${fields}
4374
4695
  const resolved2 = resolveLocalImport(specifier, inputDir);
4375
4696
  if (!resolved2)
4376
4697
  return null;
4377
- const relativeImport = relative4(targetDir, toOutputPath(resolved2)).replace(/\\/g, "/").replace(/\.js$/, "");
4698
+ const relativeImport = relative5(targetDir, toOutputPath(resolved2)).replace(/\\/g, "/").replace(/\.js$/, "");
4378
4699
  const relativeRewrite = relativeImport.startsWith(".") ? relativeImport : `./${relativeImport}`;
4379
4700
  importRewrites.set(specifier, relativeRewrite);
4380
4701
  return resolved2;
4381
4702
  }).filter((path) => Boolean(path));
4382
- const isEntry = resolve6(actualPath) === resolve6(entryPath);
4703
+ const isEntry = resolve7(actualPath) === resolve7(entryPath);
4383
4704
  const contentHash = Bun.hash(sourceCode).toString(BASE_36_RADIX);
4384
4705
  const cacheKey = actualPath;
4385
4706
  const shouldWriteFile = cacheBuster && isEntry ? true : jitContentCache.get(cacheKey) !== contentHash || !existsSync5(targetPath);
@@ -4413,13 +4734,13 @@ export const __ABSOLUTE_PAGE_USES_LEGACY_ANIMATIONS__ = true;
4413
4734
  return { clientPaths: [...emptyPaths], serverPaths: [...emptyPaths] };
4414
4735
  }
4415
4736
  const compiledRoot = compiledParent;
4416
- const indexesDir = join7(compiledParent, "indexes");
4737
+ const indexesDir = join9(compiledParent, "indexes");
4417
4738
  await traceAngularPhase("setup/create-indexes-dir", () => fs.mkdir(indexesDir, { recursive: true }));
4418
- const aotOutputs = hmr ? [] : await traceAngularPhase("aot/compile-files", () => compileAngularFiles(entryPoints.map((entry) => resolve6(entry)), compiledRoot, stylePreprocessors), { entries: entryPoints.length });
4739
+ const aotOutputs = hmr ? [] : await traceAngularPhase("aot/compile-files", () => compileAngularFiles(entryPoints.map((entry) => resolve7(entry)), compiledRoot, stylePreprocessors), { entries: entryPoints.length });
4419
4740
  if (!hmr) {
4420
4741
  await traceAngularPhase("aot/copy-json-resources", async () => {
4421
4742
  const cwd = process.cwd();
4422
- const angularSrcDir = resolve6(outRoot);
4743
+ const angularSrcDir = resolve7(outRoot);
4423
4744
  if (!existsSync5(angularSrcDir))
4424
4745
  return;
4425
4746
  const jsonGlob = new Glob("**/*.json");
@@ -4427,18 +4748,18 @@ export const __ABSOLUTE_PAGE_USES_LEGACY_ANIMATIONS__ = true;
4427
4748
  absolute: false,
4428
4749
  cwd: angularSrcDir
4429
4750
  })) {
4430
- const sourcePath = join7(angularSrcDir, rel);
4431
- const cwdRel = relative4(cwd, sourcePath);
4432
- const targetPath = join7(compiledRoot, cwdRel);
4433
- await fs.mkdir(dirname4(targetPath), { recursive: true });
4751
+ const sourcePath = join9(angularSrcDir, rel);
4752
+ const cwdRel = relative5(cwd, sourcePath);
4753
+ const targetPath = join9(compiledRoot, cwdRel);
4754
+ await fs.mkdir(dirname5(targetPath), { recursive: true });
4434
4755
  await fs.copyFile(sourcePath, targetPath);
4435
4756
  }
4436
4757
  });
4437
4758
  }
4438
4759
  const usesLegacyAngularAnimations = await traceAngularPhase("setup/legacy-animation-resolver", () => createLegacyAngularAnimationUsageResolver(outRoot));
4439
4760
  const compileTasks = entryPoints.map(async (entry) => {
4440
- const resolvedEntry = resolve6(entry);
4441
- const relativeEntry = relative4(outRoot, resolvedEntry).replace(/\.[tj]s$/, ".js");
4761
+ const resolvedEntry = resolve7(entry);
4762
+ const relativeEntry = relative5(outRoot, resolvedEntry).replace(/\.[tj]s$/, ".js");
4442
4763
  const compileEntry = () => compileAngularFileJIT(resolvedEntry, compiledRoot, outRoot, stylePreprocessors);
4443
4764
  let outputs = hmr ? await traceAngularPhase("jit/compile-entry", compileEntry, {
4444
4765
  entry: resolvedEntry
@@ -4446,13 +4767,13 @@ export const __ABSOLUTE_PAGE_USES_LEGACY_ANIMATIONS__ = true;
4446
4767
  const fileBase = basename3(resolvedEntry).replace(/\.[tj]s$/, "");
4447
4768
  const jsName = `${fileBase}.js`;
4448
4769
  const compiledFallbackPaths = [
4449
- join7(compiledRoot, relativeEntry),
4450
- join7(compiledRoot, "pages", jsName),
4451
- join7(compiledRoot, jsName)
4452
- ].map((file) => resolve6(file));
4770
+ join9(compiledRoot, relativeEntry),
4771
+ join9(compiledRoot, "pages", jsName),
4772
+ join9(compiledRoot, jsName)
4773
+ ].map((file) => resolve7(file));
4453
4774
  const resolveRawServerFile = (candidatePaths) => {
4454
4775
  const normalizedCandidates = [
4455
- ...candidatePaths.map((file) => resolve6(file)),
4776
+ ...candidatePaths.map((file) => resolve7(file)),
4456
4777
  ...compiledFallbackPaths
4457
4778
  ];
4458
4779
  let candidate = normalizedCandidates.find((file) => existsSync5(file) && file.endsWith(`${sep}${relativeEntry}`));
@@ -4510,7 +4831,7 @@ export const __ABSOLUTE_PAGE_USES_LEGACY_ANIMATIONS__ = true;
4510
4831
  })() : "no-providers";
4511
4832
  const serverContentHash = `${Bun.hash(original).toString(BASE_36_RADIX)}.${Bun.hash(providersHashInput).toString(BASE_36_RADIX)}`;
4512
4833
  const cachedWrapper = wrapperOutputCache.get(resolvedEntry);
4513
- const clientFile = join7(indexesDir, jsName);
4834
+ const clientFile = join9(indexesDir, jsName);
4514
4835
  if (hmr && cachedWrapper && cachedWrapper.serverHash === serverContentHash && existsSync5(clientFile) && (usesLegacyAnimations || !original.includes("__ABSOLUTE_PAGE_USES_LEGACY_ANIMATIONS__")) && (!usesLegacyAnimations || original.includes("__ABSOLUTE_PAGE_USES_LEGACY_ANIMATIONS__"))) {
4515
4836
  return {
4516
4837
  clientPath: clientFile,
@@ -4542,13 +4863,13 @@ export const __ABSOLUTE_PAGE_USES_LEGACY_ANIMATIONS__ = true;
4542
4863
  const fragments = [];
4543
4864
  if (providersInjection.appProvidersSource) {
4544
4865
  const compiledAppProvidersPath = (() => {
4545
- const angularDirAbs = resolve6(outRoot);
4546
- const appSourceAbs = resolve6(providersInjection.appProvidersSource);
4547
- const rel = relative4(angularDirAbs, appSourceAbs).replace(/\\/g, "/");
4548
- return join7(compiledParent, rel).replace(/\.[cm]?[tj]sx?$/, ".js");
4866
+ const angularDirAbs = resolve7(outRoot);
4867
+ const appSourceAbs = resolve7(providersInjection.appProvidersSource);
4868
+ const rel = relative5(angularDirAbs, appSourceAbs).replace(/\\/g, "/");
4869
+ return join9(compiledParent, rel).replace(/\.[cm]?[tj]sx?$/, ".js");
4549
4870
  })();
4550
4871
  const appProvidersSpec = (() => {
4551
- const rel = relative4(dirname4(rawServerFile), compiledAppProvidersPath).replace(/\\/g, "/");
4872
+ const rel = relative5(dirname5(rawServerFile), compiledAppProvidersPath).replace(/\\/g, "/");
4552
4873
  return rel.startsWith(".") ? rel : `./${rel}`;
4553
4874
  })();
4554
4875
  importLines.push(`import { appProviders as __abs_globalProviders } from "${appProvidersSpec}";`);
@@ -4573,7 +4894,7 @@ export const providers = [${fragments.join(", ")}];
4573
4894
  }
4574
4895
  }
4575
4896
  await traceAngularPhase("wrapper/write-server-output", () => fs.writeFile(rawServerFile, rewritten, "utf-8"), { entry: resolvedEntry });
4576
- const relativePath = relative4(indexesDir, rawServerFile).replace(/\\/g, "/");
4897
+ const relativePath = relative5(indexesDir, rawServerFile).replace(/\\/g, "/");
4577
4898
  const normalizedImportPath = relativePath.startsWith(".") ? relativePath : `./${relativePath}`;
4578
4899
  const hmrPreamble = hmr ? `window.__HMR_FRAMEWORK__ = "angular";
4579
4900
  import "${hmrClientPath}";
@@ -4769,7 +5090,7 @@ var init_compileAngular = __esm(() => {
4769
5090
  init_stylePreprocessor();
4770
5091
  init_generatedDir();
4771
5092
  devClientDir = resolveDevClientDir();
4772
- hmrClientPath = join7(devClientDir, "hmrClient.ts").replace(/\\/g, "/");
5093
+ hmrClientPath = join9(devClientDir, "hmrClient.ts").replace(/\\/g, "/");
4773
5094
  jitContentCache = new Map;
4774
5095
  wrapperOutputCache = new Map;
4775
5096
  });
@@ -5458,7 +5779,7 @@ var require_Observable = __commonJS((exports) => {
5458
5779
  Observable2.prototype.forEach = function(next, promiseCtor) {
5459
5780
  var _this = this;
5460
5781
  promiseCtor = getPromiseCtor(promiseCtor);
5461
- return new promiseCtor(function(resolve8, reject) {
5782
+ return new promiseCtor(function(resolve9, reject) {
5462
5783
  var subscriber = new Subscriber_1.SafeSubscriber({
5463
5784
  next: function(value) {
5464
5785
  try {
@@ -5469,7 +5790,7 @@ var require_Observable = __commonJS((exports) => {
5469
5790
  }
5470
5791
  },
5471
5792
  error: reject,
5472
- complete: resolve8
5793
+ complete: resolve9
5473
5794
  });
5474
5795
  _this.subscribe(subscriber);
5475
5796
  });
@@ -5491,14 +5812,14 @@ var require_Observable = __commonJS((exports) => {
5491
5812
  Observable2.prototype.toPromise = function(promiseCtor) {
5492
5813
  var _this = this;
5493
5814
  promiseCtor = getPromiseCtor(promiseCtor);
5494
- return new promiseCtor(function(resolve8, reject) {
5815
+ return new promiseCtor(function(resolve9, reject) {
5495
5816
  var value;
5496
5817
  _this.subscribe(function(x) {
5497
5818
  return value = x;
5498
5819
  }, function(err) {
5499
5820
  return reject(err);
5500
5821
  }, function() {
5501
- return resolve8(value);
5822
+ return resolve9(value);
5502
5823
  });
5503
5824
  });
5504
5825
  };
@@ -7526,11 +7847,11 @@ var require_isReadableStreamLike = __commonJS((exports) => {
7526
7847
  var require_innerFrom = __commonJS((exports) => {
7527
7848
  var __awaiter = exports && exports.__awaiter || function(thisArg, _arguments, P, generator) {
7528
7849
  function adopt(value) {
7529
- return value instanceof P ? value : new P(function(resolve8) {
7530
- resolve8(value);
7850
+ return value instanceof P ? value : new P(function(resolve9) {
7851
+ resolve9(value);
7531
7852
  });
7532
7853
  }
7533
- return new (P || (P = Promise))(function(resolve8, reject) {
7854
+ return new (P || (P = Promise))(function(resolve9, reject) {
7534
7855
  function fulfilled(value) {
7535
7856
  try {
7536
7857
  step(generator.next(value));
@@ -7546,7 +7867,7 @@ var require_innerFrom = __commonJS((exports) => {
7546
7867
  }
7547
7868
  }
7548
7869
  function step(result) {
7549
- result.done ? resolve8(result.value) : adopt(result.value).then(fulfilled, rejected);
7870
+ result.done ? resolve9(result.value) : adopt(result.value).then(fulfilled, rejected);
7550
7871
  }
7551
7872
  step((generator = generator.apply(thisArg, _arguments || [])).next());
7552
7873
  });
@@ -7636,14 +7957,14 @@ var require_innerFrom = __commonJS((exports) => {
7636
7957
  }, i);
7637
7958
  function verb(n) {
7638
7959
  i[n] = o[n] && function(v) {
7639
- return new Promise(function(resolve8, reject) {
7640
- v = o[n](v), settle(resolve8, reject, v.done, v.value);
7960
+ return new Promise(function(resolve9, reject) {
7961
+ v = o[n](v), settle(resolve9, reject, v.done, v.value);
7641
7962
  });
7642
7963
  };
7643
7964
  }
7644
- function settle(resolve8, reject, d, v) {
7965
+ function settle(resolve9, reject, d, v) {
7645
7966
  Promise.resolve(v).then(function(v2) {
7646
- resolve8({ value: v2, done: d });
7967
+ resolve9({ value: v2, done: d });
7647
7968
  }, reject);
7648
7969
  }
7649
7970
  };
@@ -8219,7 +8540,7 @@ var require_lastValueFrom = __commonJS((exports) => {
8219
8540
  var EmptyError_1 = require_EmptyError();
8220
8541
  function lastValueFrom(source, config) {
8221
8542
  var hasConfig = typeof config === "object";
8222
- return new Promise(function(resolve8, reject) {
8543
+ return new Promise(function(resolve9, reject) {
8223
8544
  var _hasValue = false;
8224
8545
  var _value;
8225
8546
  source.subscribe({
@@ -8230,9 +8551,9 @@ var require_lastValueFrom = __commonJS((exports) => {
8230
8551
  error: reject,
8231
8552
  complete: function() {
8232
8553
  if (_hasValue) {
8233
- resolve8(_value);
8554
+ resolve9(_value);
8234
8555
  } else if (hasConfig) {
8235
- resolve8(config.defaultValue);
8556
+ resolve9(config.defaultValue);
8236
8557
  } else {
8237
8558
  reject(new EmptyError_1.EmptyError);
8238
8559
  }
@@ -8251,16 +8572,16 @@ var require_firstValueFrom = __commonJS((exports) => {
8251
8572
  var Subscriber_1 = require_Subscriber();
8252
8573
  function firstValueFrom(source, config) {
8253
8574
  var hasConfig = typeof config === "object";
8254
- return new Promise(function(resolve8, reject) {
8575
+ return new Promise(function(resolve9, reject) {
8255
8576
  var subscriber = new Subscriber_1.SafeSubscriber({
8256
8577
  next: function(value) {
8257
- resolve8(value);
8578
+ resolve9(value);
8258
8579
  subscriber.unsubscribe();
8259
8580
  },
8260
8581
  error: reject,
8261
8582
  complete: function() {
8262
8583
  if (hasConfig) {
8263
- resolve8(config.defaultValue);
8584
+ resolve9(config.defaultValue);
8264
8585
  } else {
8265
8586
  reject(new EmptyError_1.EmptyError);
8266
8587
  }
@@ -13878,13 +14199,12 @@ var provideDeterministicEnv = (options = {}) => {
13878
14199
  // src/angular/pageHandler.ts
13879
14200
  init_constants();
13880
14201
  import { AsyncLocalStorage as AsyncLocalStorage3 } from "async_hooks";
13881
- import { mkdir as mkdir3, symlink } from "fs/promises";
14202
+ import { mkdir as mkdir4, symlink } from "fs/promises";
13882
14203
  import { tmpdir } from "os";
13883
- import { basename as basename4, dirname as dirname5, join as join8, resolve as resolve7 } from "path";
14204
+ import { basename as basename4, dirname as dirname6, join as join10, resolve as resolve8 } from "path";
13884
14205
  import { pathToFileURL as pathToFileURL2 } from "url";
13885
14206
 
13886
14207
  // src/core/islandPageContext.ts
13887
- init_constants();
13888
14208
  var BOOTSTRAP_MANIFEST_KEY = "BootstrapClient";
13889
14209
  var ISLAND_MARKER = 'data-island="true"';
13890
14210
  var MANIFEST_MARKER = "__ABSOLUTE_MANIFEST__";
@@ -14005,61 +14325,69 @@ var pipeStreamWithHeadInjection = (stream, markup) => {
14005
14325
  var pipeStreamWithIslandMarkerDetection = (stream, markup) => {
14006
14326
  const encoder = new TextEncoder;
14007
14327
  const decoder = new TextDecoder;
14008
- const lookbehind = Math.max(ISLAND_MARKER.length, BYTES_PER_KILOBYTE);
14009
- const processPending = (controller, pending, injected) => {
14010
- if (injected) {
14011
- controller.enqueue(encoder.encode(pending));
14012
- return { injected, pending: "" };
14328
+ const headLookbehind = CLOSING_HEAD_TAG.length - 1;
14329
+ const enqueue = (controller, text) => {
14330
+ if (text.length > 0) {
14331
+ controller.enqueue(encoder.encode(text));
14013
14332
  }
14014
- const markerIndex = pending.indexOf(ISLAND_MARKER);
14015
- if (markerIndex >= 0) {
14016
- const tagStart = pending.lastIndexOf("<", markerIndex);
14017
- const injectAt = tagStart >= 0 ? tagStart : markerIndex;
14018
- const next = `${pending.slice(0, injectAt)}${markup}${pending.slice(injectAt)}`;
14019
- controller.enqueue(encoder.encode(next));
14020
- return { injected: true, pending: "" };
14333
+ };
14334
+ const processHolding = (controller, held) => {
14335
+ if (!held.includes(ISLAND_MARKER)) {
14336
+ return { held, injected: false, pending: "", sawHead: true };
14021
14337
  }
14022
- return {
14023
- injected,
14024
- pending: flushSafePendingText(controller, encoder, pending, lookbehind)
14025
- };
14338
+ enqueue(controller, `${markup}${held}`);
14339
+ return { held: "", injected: true, pending: "", sawHead: true };
14026
14340
  };
14027
- const finishIslandMarkerStream = (controller, pending) => {
14028
- const finalPending = pending + decoder.decode();
14029
- if (finalPending.length > 0) {
14030
- controller.enqueue(encoder.encode(finalPending));
14341
+ const processHead = (controller, pending) => {
14342
+ const headIndex = pending.indexOf(CLOSING_HEAD_TAG);
14343
+ if (headIndex < 0) {
14344
+ return {
14345
+ held: "",
14346
+ injected: false,
14347
+ pending: flushSafePendingText(controller, encoder, pending, headLookbehind),
14348
+ sawHead: false
14349
+ };
14031
14350
  }
14032
- controller.close();
14351
+ enqueue(controller, pending.slice(0, headIndex));
14352
+ return processHolding(controller, pending.slice(headIndex));
14033
14353
  };
14034
- const consumeIslandChunk = async (controller, reader, pending, injected) => {
14035
- const { done, value } = await readStreamChunk(reader);
14036
- if (done || !value) {
14037
- return { done, injected, pending };
14354
+ const processChunk = (controller, state, chunk) => {
14355
+ if (state.injected) {
14356
+ enqueue(controller, chunk);
14357
+ return state;
14038
14358
  }
14039
- const processed = processPending(controller, pending + streamChunkToString(value, decoder), injected);
14040
- return {
14041
- done,
14042
- injected: processed.injected,
14043
- pending: processed.pending
14044
- };
14359
+ if (!state.sawHead) {
14360
+ return processHead(controller, state.pending + chunk);
14361
+ }
14362
+ return processHolding(controller, state.held + chunk);
14045
14363
  };
14046
- const runIslandMarkerLoop = async (controller, reader) => {
14047
- const consumeNextIslandChunk = async (injected, pending) => {
14048
- const consumed = await consumeIslandChunk(controller, reader, pending, injected);
14049
- const nextState = updateInjectedState(consumed, injected, pending);
14050
- if (nextState.done) {
14051
- return { injected, pending };
14364
+ const finishMarkerStream = (controller, state) => {
14365
+ const tail = decoder.decode();
14366
+ const remainder = state.injected ? tail : (state.sawHead ? state.held : state.pending) + tail;
14367
+ enqueue(controller, remainder);
14368
+ controller.close();
14369
+ };
14370
+ const runMarkerLoop = (controller, reader) => {
14371
+ const consumeNext = async (state) => {
14372
+ const { done, value } = await readStreamChunk(reader);
14373
+ if (done || !value) {
14374
+ return state;
14052
14375
  }
14053
- return consumeNextIslandChunk(nextState.injected, nextState.pending);
14376
+ return consumeNext(processChunk(controller, state, streamChunkToString(value, decoder)));
14054
14377
  };
14055
- return consumeNextIslandChunk(false, "");
14378
+ return consumeNext({
14379
+ held: "",
14380
+ injected: false,
14381
+ pending: "",
14382
+ sawHead: false
14383
+ });
14056
14384
  };
14057
14385
  return new ReadableStream({
14058
14386
  async start(controller) {
14059
14387
  const reader = stream.getReader();
14060
14388
  try {
14061
- const { pending } = await runIslandMarkerLoop(controller, reader);
14062
- finishIslandMarkerStream(controller, pending);
14389
+ const finalState = await runMarkerLoop(controller, reader);
14390
+ finishMarkerStream(controller, finalState);
14063
14391
  } catch (error) {
14064
14392
  controller.error(error);
14065
14393
  }
@@ -14787,23 +15115,23 @@ var ensureAngularCompiler = () => {
14787
15115
  return compilerImportPromise;
14788
15116
  };
14789
15117
  var readAngularPageModule = (value) => isRecord5(value) ? value : null;
14790
- var resolveAngularSsrOutDir = () => process.env.ABSOLUTE_ANGULAR_SSR_OUTDIR ?? join8(tmpdir(), "absolutejs", "generated", "angular-ssr");
15118
+ var resolveAngularSsrOutDir = () => process.env.ABSOLUTE_ANGULAR_SSR_OUTDIR ?? join10(tmpdir(), "absolutejs", "generated", "angular-ssr");
14791
15119
  var createAngularRuntimeCacheBuster = () => `${Date.now().toString(BASE_36_RADIX)}.${Math.random().toString(BASE_36_RADIX).substring(2, RANDOM_ID_END_INDEX)}`;
14792
15120
  var ensureAngularSsrNodeModules = async (outDir) => {
14793
- const outRoot = resolve7(dirname5(dirname5(outDir)));
14794
- const nodeModulesLink = join8(outRoot, "node_modules");
15121
+ const outRoot = resolve8(dirname6(dirname6(outDir)));
15122
+ const nodeModulesLink = join10(outRoot, "node_modules");
14795
15123
  if (process.env.ABSOLUTE_ANGULAR_SSR_OUTDIR) {
14796
15124
  return;
14797
15125
  }
14798
- if (nodeModulesLink === resolve7(process.cwd(), "node_modules")) {
15126
+ if (nodeModulesLink === resolve8(process.cwd(), "node_modules")) {
14799
15127
  return;
14800
15128
  }
14801
15129
  if (await Bun.file(nodeModulesLink).exists()) {
14802
15130
  return;
14803
15131
  }
14804
- await mkdir3(outRoot, { recursive: true });
15132
+ await mkdir4(outRoot, { recursive: true });
14805
15133
  try {
14806
- await symlink(resolve7(process.cwd(), "node_modules"), nodeModulesLink, "dir");
15134
+ await symlink(resolve8(process.cwd(), "node_modules"), nodeModulesLink, "dir");
14807
15135
  } catch (error) {
14808
15136
  if (!(error instanceof Error) || !("code" in error) || error.code !== "EEXIST") {
14809
15137
  throw error;
@@ -15454,5 +15782,5 @@ export {
15454
15782
  ABSOLUTE_HTTP_TRANSFER_CACHE_SKIP_HEADER
15455
15783
  };
15456
15784
 
15457
- //# debugId=090E3ECBBEB6ACF464756E2164756E21
15785
+ //# debugId=F7963258377987D964756E2164756E21
15458
15786
  //# sourceMappingURL=index.js.map