@absolutejs/absolute 0.19.0-beta.1022 → 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 +865 -755
  10. package/dist/build.js.map +12 -11
  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 +922 -805
  15. package/dist/index.js.map +13 -12
  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
package/dist/vue/index.js CHANGED
@@ -1504,9 +1504,12 @@ var initDominoAdapter = (platformServer) => {
1504
1504
  return {
1505
1505
  APP_BASE_HREF: common.APP_BASE_HREF,
1506
1506
  bootstrapApplication: platformBrowser.bootstrapApplication,
1507
+ Component: core.Component,
1507
1508
  DomSanitizer: platformBrowser.DomSanitizer,
1508
1509
  ENVIRONMENT_INITIALIZER: core.ENVIRONMENT_INITIALIZER,
1509
1510
  inject: core.inject,
1511
+ InjectionToken: core.InjectionToken,
1512
+ NgComponentOutlet: common.NgComponentOutlet,
1510
1513
  provideClientHydration: platformBrowser.provideClientHydration,
1511
1514
  provideServerRendering: platformServer.provideServerRendering,
1512
1515
  provideZonelessChangeDetection: core.provideZonelessChangeDetection,
@@ -1762,9 +1765,8 @@ var angularIslandSelector = "abs-angular-island", isAngularComponent = (value) =
1762
1765
  const componentName = typeof component.name === "string" && component.name.length > 0 ? component.name : "AngularIsland";
1763
1766
  return `${componentName}:${JSON.stringify(props)}`;
1764
1767
  }, buildAngularIslandWrapperMetadata = async (component, islandId, wrapperKey) => {
1765
- const { Component, InjectionToken, inject } = await import("@angular/core");
1766
- const { NgComponentOutlet } = await import("@angular/common");
1767
1768
  const deps = await getAngularDeps();
1769
+ const { Component, InjectionToken, NgComponentOutlet, inject } = deps;
1768
1770
  const selector = getAngularIslandSelector(islandId);
1769
1771
  const propsToken = new InjectionToken(`${wrapperKey}:props`);
1770
1772
 
@@ -1870,7 +1872,15 @@ var init_islands2 = __esm(() => {
1870
1872
  var renderAngularIslandToHtmlInternal = async (component, props, islandId) => {
1871
1873
  const { renderAngularIslandToHtml: renderAngularIslandToHtml2 } = await Promise.resolve().then(() => (init_islands2(), exports_islands));
1872
1874
  return renderAngularIslandToHtml2(component, props, islandId);
1873
- }, 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 }) => {
1875
+ }, renderAngularIslandToHtml2, LEADING_HOISTED_RESOURCE_RE, stripLeadingHoistedResources = (html) => {
1876
+ let result = html;
1877
+ let match = LEADING_HOISTED_RESOURCE_RE.exec(result);
1878
+ while (match) {
1879
+ result = result.slice(match[0].length);
1880
+ match = LEADING_HOISTED_RESOURCE_RE.exec(result);
1881
+ }
1882
+ return result.trimStart();
1883
+ }, 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 }) => {
1874
1884
  const { body } = render(component, { props });
1875
1885
  return body;
1876
1886
  }), renderVueIslandToHtml = (component, props) => import("vue").then(({ createSSRApp, h: createVueVNode }) => {
@@ -1881,10 +1891,311 @@ var renderAngularIslandToHtmlInternal = async (component, props, islandId) => {
1881
1891
  });
1882
1892
  var init_islandSsr = __esm(() => {
1883
1893
  renderAngularIslandToHtml2 = renderAngularIslandToHtmlInternal;
1894
+ 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;
1895
+ });
1896
+
1897
+ // src/build/nativeRewrite.ts
1898
+ import { dlopen, FFIType, ptr } from "bun:ffi";
1899
+ import { platform as platform2, arch as arch2 } from "os";
1900
+ import { resolve as resolve3 } from "path";
1901
+ var ffiDefinition, nativeLib = null, loadNative = () => {
1902
+ if (nativeLib !== null)
1903
+ return nativeLib;
1904
+ const osPlatform = platform2();
1905
+ const cpu = arch2();
1906
+ const platformMap = {
1907
+ "darwin-arm64": "darwin-arm64/fast_ops.dylib",
1908
+ "darwin-x64": "darwin-x64/fast_ops.dylib",
1909
+ "linux-arm64": "linux-arm64/fast_ops.so",
1910
+ "linux-x64": "linux-x64/fast_ops.so",
1911
+ "win32-arm64": "windows-arm64/fast_ops.dll",
1912
+ "win32-x64": "windows-x64/fast_ops.dll"
1913
+ };
1914
+ const libPath = platformMap[`${osPlatform}-${cpu}`];
1915
+ if (!libPath)
1916
+ return null;
1917
+ try {
1918
+ const fullPath = resolve3(import.meta.dir, "../../native/packages", libPath);
1919
+ const lib = dlopen(fullPath, ffiDefinition);
1920
+ nativeLib = lib.symbols;
1921
+ return nativeLib;
1922
+ } catch {
1923
+ return null;
1924
+ }
1925
+ }, nativeRewriteImports = (content, replacements) => {
1926
+ const lib = loadNative();
1927
+ if (!lib)
1928
+ return null;
1929
+ const jsonStr = JSON.stringify(replacements);
1930
+ const contentBuf = Buffer.from(content);
1931
+ const jsonBuf = Buffer.from(jsonStr);
1932
+ const outBuf = Buffer.alloc(content.length * 2);
1933
+ const outLenBuf = new BigUint64Array([BigInt(outBuf.length)]);
1934
+ const result = lib.rewrite_imports(ptr(contentBuf), contentBuf.length, ptr(jsonBuf), jsonBuf.length, ptr(outBuf), ptr(new Uint8Array(outLenBuf.buffer)));
1935
+ if (result < 0)
1936
+ return null;
1937
+ if (result === 0)
1938
+ return content;
1939
+ const outLen = Number(outLenBuf[0]);
1940
+ return outBuf.subarray(0, outLen).toString("utf-8");
1941
+ };
1942
+ var init_nativeRewrite = __esm(() => {
1943
+ ffiDefinition = {
1944
+ rewrite_imports: {
1945
+ args: [
1946
+ FFIType.ptr,
1947
+ FFIType.u64,
1948
+ FFIType.ptr,
1949
+ FFIType.u64,
1950
+ FFIType.ptr,
1951
+ FFIType.ptr
1952
+ ],
1953
+ returns: FFIType.i32
1954
+ }
1955
+ };
1956
+ });
1957
+
1958
+ // src/build/rewriteImportsPlugin.ts
1959
+ var exports_rewriteImportsPlugin = {};
1960
+ __export(exports_rewriteImportsPlugin, {
1961
+ rewriteVendorDirectories: () => rewriteVendorDirectories,
1962
+ rewriteImportsInContent: () => rewriteImportsInContent,
1963
+ rewriteBuildOutputsWith: () => rewriteBuildOutputsWith,
1964
+ rewriteBuildOutputs: () => rewriteBuildOutputs,
1965
+ jsRewriteImports: () => jsRewriteImports,
1966
+ fixMissingReExportNamespacesInContent: () => fixMissingReExportNamespacesInContent,
1967
+ buildWithImportRewrite: () => buildWithImportRewrite
1968
+ });
1969
+ import { readdir as readdir2 } from "fs/promises";
1970
+ import { join as join4 } from "path";
1971
+ var escapeRegex = (str) => str.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"), jsRewriteImports = (content, replacements) => {
1972
+ let result = content;
1973
+ for (const [specifier, webPath] of replacements) {
1974
+ const escaped = escapeRegex(specifier);
1975
+ const fromRegex = new RegExp(`(from\\s*["'])${escaped}(["'])`, "g");
1976
+ const sideEffectRegex = new RegExp(`(import\\s*["'])${escaped}(["'])`, "g");
1977
+ const dynamicRegex = new RegExp(`(import\\s*\\(\\s*["'])${escaped}(["']\\s*\\))`, "g");
1978
+ result = result.replace(fromRegex, `$1${webPath}$2`);
1979
+ result = result.replace(sideEffectRegex, `$1${webPath}$2`);
1980
+ result = result.replace(dynamicRegex, `$1${webPath}$2`);
1981
+ }
1982
+ return result;
1983
+ }, rewriteImportsInContent = (content, vendorPaths) => {
1984
+ if (Object.keys(vendorPaths).length === 0)
1985
+ return content;
1986
+ const replacements = Object.entries(vendorPaths).sort(([keyA], [keyB]) => keyB.length - keyA.length);
1987
+ const native = nativeRewriteImports(content, replacements);
1988
+ return native ?? jsRewriteImports(content, replacements);
1989
+ }, fixMissingReExportNamespacesInContent = (content) => {
1990
+ const REEXPORT_PATTERN = /__reExport\(\s*[A-Za-z_$][\w$]*\s*,\s*([A-Za-z_$][\w$]*)\s*\)/g;
1991
+ REEXPORT_PATTERN.lastIndex = 0;
1992
+ const missing = [];
1993
+ let match;
1994
+ while ((match = REEXPORT_PATTERN.exec(content)) !== null) {
1995
+ const ident = match[1];
1996
+ if (!ident)
1997
+ continue;
1998
+ const nsImportRe = new RegExp(`\\bimport\\s*\\*\\s*as\\s+${ident}\\s+from\\b`);
1999
+ if (nsImportRe.test(content))
2000
+ continue;
2001
+ const declRe = new RegExp(`\\b(?:const|let|var|function|class)\\s+${ident}\\b`);
2002
+ if (declRe.test(content))
2003
+ continue;
2004
+ const namedImportRe = new RegExp(`\\bimport\\s*\\{[^}]*\\b${ident}\\b[^}]*\\}\\s*from\\b`);
2005
+ if (namedImportRe.test(content))
2006
+ continue;
2007
+ const importPathRe = /(?:from\s+|import\s*)["']([^"']+)["']/g;
2008
+ let pathMatch;
2009
+ let sourcePath;
2010
+ while ((pathMatch = importPathRe.exec(content)) !== null) {
2011
+ const p = pathMatch[1];
2012
+ if (!p)
2013
+ continue;
2014
+ const base = p.split("/").pop()?.replace(/\.[mc]?js$/, "");
2015
+ if (!base)
2016
+ continue;
2017
+ const normalized = base.startsWith("_") ? base.slice(1) : base;
2018
+ if (normalized === ident || normalized.endsWith(`_${ident}`)) {
2019
+ sourcePath = p;
2020
+ break;
2021
+ }
2022
+ }
2023
+ if (sourcePath)
2024
+ missing.push({ ident, path: sourcePath });
2025
+ }
2026
+ if (missing.length === 0)
2027
+ return content;
2028
+ const seen = new Set;
2029
+ const unique = missing.filter((entry) => {
2030
+ if (seen.has(entry.ident))
2031
+ return false;
2032
+ seen.add(entry.ident);
2033
+ return true;
2034
+ });
2035
+ const inserts = unique.map((entry) => `import * as ${entry.ident} from "${entry.path}";`).join(`
2036
+ `);
2037
+ return `${inserts}
2038
+ ${content}`;
2039
+ }, isReadableArtifact = (artifact) => artifact.path.endsWith(".js"), rewriteBuildOutputs = async (outputs, vendorPaths) => {
2040
+ if (Object.keys(vendorPaths).length === 0)
2041
+ return;
2042
+ await Promise.all(outputs.filter(isReadableArtifact).map(async (artifact) => {
2043
+ let original;
2044
+ try {
2045
+ original = await artifact.text();
2046
+ } catch (err) {
2047
+ const code = err.code;
2048
+ if (code === "ENOENT")
2049
+ return;
2050
+ throw err;
2051
+ }
2052
+ const rewritten = rewriteImportsInContent(original, vendorPaths);
2053
+ if (rewritten === original)
2054
+ return;
2055
+ try {
2056
+ await Bun.write(artifact.path, rewritten);
2057
+ } catch (err) {
2058
+ const code = err.code;
2059
+ if (code === "ENOENT")
2060
+ return;
2061
+ throw err;
2062
+ }
2063
+ }));
2064
+ }, rewriteBuildOutputsWith = async (outputs, resolveVendorPaths) => {
2065
+ await Promise.all(outputs.filter(isReadableArtifact).map(async (artifact) => {
2066
+ const vendorPaths = resolveVendorPaths(artifact);
2067
+ if (Object.keys(vendorPaths).length === 0)
2068
+ return;
2069
+ let original;
2070
+ try {
2071
+ original = await artifact.text();
2072
+ } catch (err) {
2073
+ const code = err.code;
2074
+ if (code === "ENOENT")
2075
+ return;
2076
+ throw err;
2077
+ }
2078
+ const rewritten = rewriteImportsInContent(original, vendorPaths);
2079
+ if (rewritten === original)
2080
+ return;
2081
+ try {
2082
+ await Bun.write(artifact.path, rewritten);
2083
+ } catch (err) {
2084
+ const code = err.code;
2085
+ if (code === "ENOENT")
2086
+ return;
2087
+ throw err;
2088
+ }
2089
+ }));
2090
+ }, rewriteVendorDirectories = async (vendorDirs, vendorPaths) => {
2091
+ if (Object.keys(vendorPaths).length === 0)
2092
+ return;
2093
+ const allFiles = [];
2094
+ for (const dir of vendorDirs) {
2095
+ try {
2096
+ const entries = await readdir2(dir);
2097
+ for (const entry of entries) {
2098
+ if (entry.endsWith(".js"))
2099
+ allFiles.push(join4(dir, entry));
2100
+ }
2101
+ } catch {}
2102
+ }
2103
+ await Promise.all(allFiles.map(async (filePath) => {
2104
+ let original;
2105
+ try {
2106
+ original = await Bun.file(filePath).text();
2107
+ } catch (err) {
2108
+ const code = err.code;
2109
+ if (code === "ENOENT")
2110
+ return;
2111
+ throw err;
2112
+ }
2113
+ let next = rewriteImportsInContent(original, vendorPaths);
2114
+ next = fixMissingReExportNamespacesInContent(next);
2115
+ if (next === original)
2116
+ return;
2117
+ try {
2118
+ await Bun.write(filePath, next);
2119
+ } catch (err) {
2120
+ const code = err.code;
2121
+ if (code === "ENOENT")
2122
+ return;
2123
+ throw err;
2124
+ }
2125
+ }));
2126
+ }, buildWithImportRewrite = async (pendingBuild, vendorPaths) => {
2127
+ const result = await pendingBuild;
2128
+ if (result.outputs.length > 0) {
2129
+ await rewriteBuildOutputs(result.outputs, vendorPaths);
2130
+ }
2131
+ return result;
2132
+ };
2133
+ var init_rewriteImportsPlugin = __esm(() => {
2134
+ init_nativeRewrite();
2135
+ });
2136
+
2137
+ // src/core/angularServerModule.ts
2138
+ import { mkdir } from "fs/promises";
2139
+ import { dirname as dirname3, join as join5, relative } from "path";
2140
+ var serverCacheRoot, compiledModuleCache, ANGULAR_SPECIFIER_RE, getCachedModulePath = (sourcePath) => {
2141
+ const relativeSourcePath = relative(process.cwd(), sourcePath).replace(/\\/g, "/");
2142
+ const normalizedSourcePath = relativeSourcePath.startsWith("..") ? sourcePath.replace(/[:\\/]/g, "_") : relativeSourcePath;
2143
+ return join5(serverCacheRoot, `${normalizedSourcePath}.server.js`);
2144
+ }, collectVendorPaths = (code) => {
2145
+ const vendorPaths = {};
2146
+ if (!isProductionRuntime()) {
2147
+ return vendorPaths;
2148
+ }
2149
+ const specifiers = new Set([...code.matchAll(ANGULAR_SPECIFIER_RE)].map((match) => match[1]));
2150
+ specifiers.forEach((specifier) => {
2151
+ if (!specifier)
2152
+ return;
2153
+ const resolved = resolveAngularRuntimePath(specifier);
2154
+ if (resolved === specifier)
2155
+ return;
2156
+ vendorPaths[specifier] = resolved;
2157
+ });
2158
+ return vendorPaths;
2159
+ }, buildAngularServerModule = async (sourcePath) => {
2160
+ const result = await Bun.build({
2161
+ entrypoints: [sourcePath],
2162
+ format: "esm",
2163
+ packages: "external",
2164
+ target: "bun",
2165
+ throw: false
2166
+ });
2167
+ const entry = result.outputs.find((output) => output.kind === "entry-point");
2168
+ if (!result.success || !entry) {
2169
+ const message = result.logs.map((log2) => String(log2)).join(`
2170
+ `);
2171
+ throw new Error(`Failed to compile Angular island server module for "${sourcePath}":
2172
+ ${message}`);
2173
+ }
2174
+ const code = await entry.text();
2175
+ const rewritten = rewriteImportsInContent(code, collectVendorPaths(code));
2176
+ const modulePath = getCachedModulePath(sourcePath);
2177
+ await mkdir(dirname3(modulePath), { recursive: true });
2178
+ await Bun.write(modulePath, rewritten);
2179
+ return modulePath;
2180
+ }, compileAngularServerModule = (sourcePath) => {
2181
+ const cached = compiledModuleCache.get(sourcePath);
2182
+ if (cached) {
2183
+ return cached;
2184
+ }
2185
+ const compiledModulePromise = buildAngularServerModule(sourcePath);
2186
+ compiledModuleCache.set(sourcePath, compiledModulePromise);
2187
+ return compiledModulePromise;
2188
+ };
2189
+ var init_angularServerModule = __esm(() => {
2190
+ init_resolveAngularPackage();
2191
+ init_rewriteImportsPlugin();
2192
+ serverCacheRoot = join5(process.cwd(), ".absolutejs", "islands", "angular");
2193
+ compiledModuleCache = new Map;
2194
+ ANGULAR_SPECIFIER_RE = /["'](@angular\/[^"']+)["']/g;
1884
2195
  });
1885
2196
 
1886
2197
  // src/build/resolvePackageImport.ts
1887
- import { resolve as resolve3, join as join4 } from "path";
2198
+ import { resolve as resolve4, join as join6 } from "path";
1888
2199
  import { existsSync as existsSync5, readFileSync as readFileSync4 } from "fs";
1889
2200
  var resolveExportPath = (entry, conditions) => {
1890
2201
  if (typeof entry === "string")
@@ -1906,11 +2217,11 @@ var resolveExportPath = (entry, conditions) => {
1906
2217
  const packageName = isScoped ? `${parts[0]}/${parts[1]}` : parts[0];
1907
2218
  const subpath = isScoped ? parts.slice(2).join("/") : parts.slice(1).join("/");
1908
2219
  const exportKey = subpath ? `./${subpath}` : ".";
1909
- const currentPackageJsonPath = resolve3(process.cwd(), "package.json");
2220
+ const currentPackageJsonPath = resolve4(process.cwd(), "package.json");
1910
2221
  const currentPackageJson = existsSync5(currentPackageJsonPath) ? JSON.parse(readFileSync4(currentPackageJsonPath, "utf-8")) : null;
1911
2222
  const currentPackageDir = currentPackageJson?.name === packageName ? process.cwd() : null;
1912
- const packageDir = currentPackageDir ?? resolve3(process.cwd(), "node_modules", packageName ?? "");
1913
- const packageJsonPath = join4(packageDir, "package.json");
2223
+ const packageDir = currentPackageDir ?? resolve4(process.cwd(), "node_modules", packageName ?? "");
2224
+ const packageJsonPath = join6(packageDir, "package.json");
1914
2225
  if (!existsSync5(packageJsonPath))
1915
2226
  return null;
1916
2227
  try {
@@ -1925,12 +2236,12 @@ var resolveExportPath = (entry, conditions) => {
1925
2236
  if (!importPath)
1926
2237
  return null;
1927
2238
  if (currentPackageDir && importPath.startsWith("./dist/")) {
1928
- const sourceCandidate = resolve3(packageDir, importPath.replace(/^\.\/dist\//, "./src/"));
2239
+ const sourceCandidate = resolve4(packageDir, importPath.replace(/^\.\/dist\//, "./src/"));
1929
2240
  if (existsSync5(sourceCandidate)) {
1930
2241
  return sourceCandidate;
1931
2242
  }
1932
2243
  }
1933
- const resolved = resolve3(packageDir, importPath);
2244
+ const resolved = resolve4(packageDir, importPath);
1934
2245
  return existsSync5(resolved) ? resolved : null;
1935
2246
  } catch {
1936
2247
  return null;
@@ -2087,12 +2398,12 @@ import { existsSync as existsSync6, readFileSync as readFileSync5 } from "fs";
2087
2398
  import { readFile as readFile2 } from "fs/promises";
2088
2399
  import { createRequire } from "module";
2089
2400
  import {
2090
- dirname as dirname3,
2401
+ dirname as dirname4,
2091
2402
  extname,
2092
2403
  isAbsolute,
2093
- join as join5,
2094
- relative,
2095
- resolve as resolve4
2404
+ join as join7,
2405
+ relative as relative2,
2406
+ resolve as resolve5
2096
2407
  } from "path";
2097
2408
  import { fileURLToPath, pathToFileURL } from "url";
2098
2409
  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) => {
@@ -2128,9 +2439,9 @@ ${message}`);
2128
2439
  return requireOptionalPeer(specifier);
2129
2440
  }
2130
2441
  }, normalizeLoadPaths = (filePath, paths = []) => [
2131
- dirname3(filePath),
2442
+ dirname4(filePath),
2132
2443
  process.cwd(),
2133
- ...paths.map((path) => resolve4(process.cwd(), path))
2444
+ ...paths.map((path) => resolve5(process.cwd(), path))
2134
2445
  ], tsconfigAliasCache, stripJsonComments = (source) => source.replace(/\/\*[\s\S]*?\*\//g, "").replace(/(^|[^:])\/\/.*$/gm, "$1"), normalizeAliasEntries = (aliases) => Object.entries(aliases ?? {}).map(([pattern, value]) => ({
2135
2446
  pattern,
2136
2447
  replacements: Array.isArray(value) ? value : [value]
@@ -2138,7 +2449,7 @@ ${message}`);
2138
2449
  const cwd = process.cwd();
2139
2450
  if (tsconfigAliasCache?.cwd === cwd)
2140
2451
  return tsconfigAliasCache;
2141
- const tsconfigPath = resolve4(cwd, "tsconfig.json");
2452
+ const tsconfigPath = resolve5(cwd, "tsconfig.json");
2142
2453
  const empty = { aliases: [], baseUrl: cwd, cwd };
2143
2454
  if (!existsSync6(tsconfigPath)) {
2144
2455
  tsconfigAliasCache = empty;
@@ -2147,7 +2458,7 @@ ${message}`);
2147
2458
  try {
2148
2459
  const parsed = JSON.parse(stripJsonComments(readFileSync5(tsconfigPath, "utf-8")));
2149
2460
  const compilerOptions = parsed.compilerOptions ?? {};
2150
- const baseUrl = resolve4(cwd, compilerOptions.baseUrl ?? ".");
2461
+ const baseUrl = resolve5(cwd, compilerOptions.baseUrl ?? ".");
2151
2462
  tsconfigAliasCache = {
2152
2463
  aliases: normalizeAliasEntries(compilerOptions.paths),
2153
2464
  baseUrl,
@@ -2175,7 +2486,7 @@ ${message}`);
2175
2486
  continue;
2176
2487
  const wildcard = match[1] ?? "";
2177
2488
  for (const replacement of alias.replacements) {
2178
- targets.push(resolve4(baseUrl, replacement.replace("*", wildcard)));
2489
+ targets.push(resolve5(baseUrl, replacement.replace("*", wildcard)));
2179
2490
  }
2180
2491
  }
2181
2492
  return targets;
@@ -2189,21 +2500,21 @@ ${message}`);
2189
2500
  const ext = extname(basePath);
2190
2501
  const paths = ext ? [basePath] : getLanguageExtensions(language).flatMap((extension) => [
2191
2502
  `${basePath}${extension}`,
2192
- join5(basePath, `index${extension}`)
2503
+ join7(basePath, `index${extension}`)
2193
2504
  ]);
2194
2505
  if (language === "scss" || language === "sass") {
2195
2506
  return paths.flatMap((path) => {
2196
- const dir = dirname3(path);
2507
+ const dir = dirname4(path);
2197
2508
  const base = path.slice(dir.length + 1);
2198
- return [path, join5(dir, `_${base}`)];
2509
+ return [path, join7(dir, `_${base}`)];
2199
2510
  });
2200
2511
  }
2201
2512
  return paths;
2202
2513
  }, resolveImportPath = (specifier, fromDirectory, loadPaths, language, config) => {
2203
2514
  const rawCandidates = [
2204
2515
  ...resolveAliasTargets(specifier, config),
2205
- isAbsolute(specifier) ? specifier : resolve4(fromDirectory, specifier),
2206
- ...loadPaths.map((path) => resolve4(path, specifier))
2516
+ isAbsolute(specifier) ? specifier : resolve5(fromDirectory, specifier),
2517
+ ...loadPaths.map((path) => resolve5(path, specifier))
2207
2518
  ];
2208
2519
  for (const candidate of rawCandidates.flatMap((path) => getCandidatePaths(path, language))) {
2209
2520
  if (existsSync6(candidate))
@@ -2219,8 +2530,8 @@ ${message}`);
2219
2530
  path: url.slice(0, markerIndex)
2220
2531
  };
2221
2532
  }, rebaseCssUrls = (contents, sourceFile, entryFile) => {
2222
- const sourceDir = dirname3(sourceFile);
2223
- const entryDir = dirname3(entryFile);
2533
+ const sourceDir = dirname4(sourceFile);
2534
+ const entryDir = dirname4(entryFile);
2224
2535
  if (sourceDir === entryDir)
2225
2536
  return contents;
2226
2537
  return contents.replace(/url\(\s*(['"]?)([^'")]+)\1\s*\)/gi, (match, quote, rawUrl) => {
@@ -2228,7 +2539,7 @@ ${message}`);
2228
2539
  if (!trimmedUrl || isExternalCssUrl(trimmedUrl))
2229
2540
  return match;
2230
2541
  const { marker, path } = splitCssUrl(trimmedUrl);
2231
- const rebased = relative(entryDir, resolve4(sourceDir, path)).replace(/\\/g, "/");
2542
+ const rebased = relative2(entryDir, resolve5(sourceDir, path)).replace(/\\/g, "/");
2232
2543
  const normalized = rebased.startsWith(".") ? rebased : `./${rebased}`;
2233
2544
  const nextQuote = quote || '"';
2234
2545
  return `url(${nextQuote}${normalized}${marker}${nextQuote})`;
@@ -2236,7 +2547,7 @@ ${message}`);
2236
2547
  }, rewriteAliasedStyleImports = (contents, sourceFile, loadPaths, language, config) => contents.replace(/(@(?:use|forward|import|require)\s+)(["'])([^"']+)\2/g, (match, prefix, quote, specifier) => {
2237
2548
  if (specifier.startsWith(".") || isAbsolute(specifier) || isExternalCssUrl(specifier))
2238
2549
  return match;
2239
- const resolved = resolveImportPath(specifier, dirname3(sourceFile), loadPaths, language, config);
2550
+ const resolved = resolveImportPath(specifier, dirname4(sourceFile), loadPaths, language, config);
2240
2551
  return resolved ? `${prefix}${quote}${resolved}${quote}` : match;
2241
2552
  }), preprocessLoadedStyle = (contents, sourceFile, entryFile, loadPaths = [], language, config) => {
2242
2553
  const rebased = rebaseCssUrls(contents, sourceFile, entryFile);
@@ -2266,7 +2577,7 @@ ${contents}` : contents, normalizePostcssModule = (mod) => {
2266
2577
  }
2267
2578
  return mod;
2268
2579
  }, loadPostcssConfigFile = async (configPath2) => {
2269
- const resolved = resolve4(process.cwd(), configPath2);
2580
+ const resolved = resolve5(process.cwd(), configPath2);
2270
2581
  const loaded = resolved.endsWith(".cjs") || resolved.endsWith(".cts") ? requireOptionalPeerSync(resolved) : await importOptionalPeer(`${new URL(`file://${resolved}`).href}?t=${Date.now()}`);
2271
2582
  const config = normalizePostcssModule(loaded);
2272
2583
  const value = typeof config === "function" ? await config({
@@ -2326,9 +2637,9 @@ ${contents}` : contents, normalizePostcssModule = (mod) => {
2326
2637
  return result.css;
2327
2638
  }, createSassImporter = (entryFile, loadPaths, language, config, deps) => ({
2328
2639
  canonicalize(specifier, options) {
2329
- const fromDirectory = options.containingUrl ? dirname3(fileURLToPath(options.containingUrl)) : dirname3(entryFile);
2640
+ const fromDirectory = options.containingUrl ? dirname4(fileURLToPath(options.containingUrl)) : dirname4(entryFile);
2330
2641
  const resolved = resolveImportPath(specifier, fromDirectory, loadPaths, language, config);
2331
- return resolved ? new URL(pathToFileURL(resolve4(resolved)).href) : null;
2642
+ return resolved ? new URL(pathToFileURL(resolve5(resolved)).href) : null;
2332
2643
  },
2333
2644
  load(canonicalUrl) {
2334
2645
  const filePath = fileURLToPath(canonicalUrl);
@@ -2345,9 +2656,9 @@ ${contents}` : contents, normalizePostcssModule = (mod) => {
2345
2656
  install(less, pluginManager) {
2346
2657
  const baseManager = new less.FileManager;
2347
2658
  const manager = Object.create(baseManager);
2348
- manager.supports = (filename, currentDirectory) => Boolean(resolveImportPath(filename, resolve4(currentDirectory), loadPaths, "less", config));
2659
+ manager.supports = (filename, currentDirectory) => Boolean(resolveImportPath(filename, resolve5(currentDirectory), loadPaths, "less", config));
2349
2660
  manager.loadFile = async (filename, currentDirectory) => {
2350
- const resolved = resolveImportPath(filename, resolve4(currentDirectory), loadPaths, "less", config);
2661
+ const resolved = resolveImportPath(filename, resolve5(currentDirectory), loadPaths, "less", config);
2351
2662
  if (!resolved) {
2352
2663
  throw new Error(`Unable to resolve Less import "${filename}"`);
2353
2664
  }
@@ -2384,29 +2695,29 @@ ${contents}` : contents, normalizePostcssModule = (mod) => {
2384
2695
  const stylusDeps = renderer.deps?.();
2385
2696
  if (Array.isArray(stylusDeps)) {
2386
2697
  for (const dep of stylusDeps)
2387
- deps.add(resolve4(dep));
2698
+ deps.add(resolve5(dep));
2388
2699
  }
2389
2700
  }
2390
2701
  resolveCss(css ?? "");
2391
2702
  });
2392
2703
  });
2393
2704
  }, styleDependencyGraph, styleOutputHashes, recordStyleDeps = (entry, deps) => {
2394
- const key = resolve4(entry);
2705
+ const key = resolve5(entry);
2395
2706
  const stripped = new Set;
2396
2707
  for (const dep of deps) {
2397
- const resolved = resolve4(dep);
2708
+ const resolved = resolve5(dep);
2398
2709
  if (resolved !== key)
2399
2710
  stripped.add(resolved);
2400
2711
  }
2401
2712
  styleDependencyGraph.set(key, stripped);
2402
2713
  }, addStyleImporter = (importerPath, stylePath) => {
2403
- const key = resolve4(importerPath);
2404
- const target = resolve4(stylePath);
2714
+ const key = resolve5(importerPath);
2715
+ const target = resolve5(stylePath);
2405
2716
  const deps = styleDependencyGraph.get(key) ?? new Set;
2406
2717
  deps.add(target);
2407
2718
  styleDependencyGraph.set(key, deps);
2408
2719
  }, findStyleEntriesImporting = (changedPath) => {
2409
- const target = resolve4(changedPath);
2720
+ const target = resolve5(changedPath);
2410
2721
  const importers = [];
2411
2722
  for (const [entry, deps] of styleDependencyGraph) {
2412
2723
  if (deps.has(target))
@@ -2414,13 +2725,13 @@ ${contents}` : contents, normalizePostcssModule = (mod) => {
2414
2725
  }
2415
2726
  return importers;
2416
2727
  }, recordStyleOutput = (entry, css) => {
2417
- const key = resolve4(entry);
2728
+ const key = resolve5(entry);
2418
2729
  const hash = createHash("sha1").update(css).digest("hex");
2419
2730
  const previous = styleOutputHashes.get(key);
2420
2731
  styleOutputHashes.set(key, hash);
2421
2732
  return previous !== hash;
2422
2733
  }, forgetStyleEntry = (entry) => {
2423
- const key = resolve4(entry);
2734
+ const key = resolve5(entry);
2424
2735
  styleDependencyGraph.delete(key);
2425
2736
  styleOutputHashes.delete(key);
2426
2737
  }, compileStyleSource = async (filePath, source, languageHint, config) => {
@@ -2446,7 +2757,7 @@ ${contents}` : contents, normalizePostcssModule = (mod) => {
2446
2757
  loadPaths,
2447
2758
  style: "expanded",
2448
2759
  syntax: language === "sass" ? "indented" : "scss",
2449
- url: new URL(pathToFileURL(resolve4(filePath)).href)
2760
+ url: new URL(pathToFileURL(resolve5(filePath)).href)
2450
2761
  });
2451
2762
  const css = await runPostcss(result.css, filePath, config);
2452
2763
  const loadedUrls = result.loadedUrls ?? [];
@@ -2454,7 +2765,7 @@ ${contents}` : contents, normalizePostcssModule = (mod) => {
2454
2765
  if (url.protocol !== "file:")
2455
2766
  continue;
2456
2767
  const dep = fileURLToPath(url);
2457
- if (resolve4(dep) === resolve4(filePath))
2768
+ if (resolve5(dep) === resolve5(filePath))
2458
2769
  continue;
2459
2770
  deps.add(dep);
2460
2771
  }
@@ -2575,7 +2886,7 @@ ${contents}` : contents, normalizePostcssModule = (mod) => {
2575
2886
  const start = match.index ?? 0;
2576
2887
  const end = start + match[0].length;
2577
2888
  parts.push(content.slice(cursor, start));
2578
- const fullPath = isAbsolute(importPath) ? importPath : resolve4(baseDir, importPath);
2889
+ const fullPath = isAbsolute(importPath) ? importPath : resolve5(baseDir, importPath);
2579
2890
  if (visited.has(fullPath) || !existsSync6(fullPath)) {
2580
2891
  parts.push(visited.has(fullPath) ? "" : match[0]);
2581
2892
  cursor = end;
@@ -2584,7 +2895,7 @@ ${contents}` : contents, normalizePostcssModule = (mod) => {
2584
2895
  const nextVisited = new Set(visited);
2585
2896
  nextVisited.add(fullPath);
2586
2897
  const imported = await readFile2(fullPath, "utf-8");
2587
- parts.push(await resolveCssImportsAsync(imported, dirname3(fullPath), nextVisited));
2898
+ parts.push(await resolveCssImportsAsync(imported, dirname4(fullPath), nextVisited));
2588
2899
  cursor = end;
2589
2900
  }
2590
2901
  parts.push(content.slice(cursor));
@@ -2593,13 +2904,13 @@ ${contents}` : contents, normalizePostcssModule = (mod) => {
2593
2904
  if (!isPreprocessableStylePath(filePath)) {
2594
2905
  const raw = await readFile2(filePath, "utf-8");
2595
2906
  const processed = await runPostcss(raw, filePath, config);
2596
- return resolveCssImportsAsync(processed, dirname3(filePath), new Set([filePath]));
2907
+ return resolveCssImportsAsync(processed, dirname4(filePath), new Set([filePath]));
2597
2908
  }
2598
2909
  const compiled = await compileStyleSource(filePath, undefined, undefined, config);
2599
- return resolveCssImportsAsync(compiled, dirname3(filePath), new Set([filePath]));
2910
+ return resolveCssImportsAsync(compiled, dirname4(filePath), new Set([filePath]));
2600
2911
  }, resolveCssImportsSync = (content, baseDir, visited) => {
2601
2912
  return content.replace(CSS_IMPORT_PATTERN, (match, importPath) => {
2602
- const fullPath = isAbsolute(importPath) ? importPath : resolve4(baseDir, importPath);
2913
+ const fullPath = isAbsolute(importPath) ? importPath : resolve5(baseDir, importPath);
2603
2914
  if (visited.has(fullPath))
2604
2915
  return "";
2605
2916
  if (!existsSync6(fullPath))
@@ -2607,7 +2918,7 @@ ${contents}` : contents, normalizePostcssModule = (mod) => {
2607
2918
  const nextVisited = new Set(visited);
2608
2919
  nextVisited.add(fullPath);
2609
2920
  const imported = readFileSync5(fullPath, "utf-8");
2610
- return resolveCssImportsSync(imported, dirname3(fullPath), nextVisited);
2921
+ return resolveCssImportsSync(imported, dirname4(fullPath), nextVisited);
2611
2922
  });
2612
2923
  }, compileStyleFileIfNeededSync = (filePath, config) => {
2613
2924
  const rawContents = readFileSync5(filePath, "utf-8");
@@ -2633,18 +2944,18 @@ ${contents}` : contents, normalizePostcssModule = (mod) => {
2633
2944
  loadPaths,
2634
2945
  style: "expanded",
2635
2946
  syntax: language === "sass" ? "indented" : "scss",
2636
- url: new URL(pathToFileURL(resolve4(filePath)).href)
2947
+ url: new URL(pathToFileURL(resolve5(filePath)).href)
2637
2948
  });
2638
2949
  const loadedUrls = result.loadedUrls ?? [];
2639
2950
  for (const url of loadedUrls) {
2640
2951
  if (url.protocol !== "file:")
2641
2952
  continue;
2642
2953
  const dep = fileURLToPath(url);
2643
- if (resolve4(dep) === resolve4(filePath))
2954
+ if (resolve5(dep) === resolve5(filePath))
2644
2955
  continue;
2645
2956
  addStyleImporter(filePath, dep);
2646
2957
  }
2647
- return resolveCssImportsSync(result.css, dirname3(filePath), new Set([filePath]));
2958
+ return resolveCssImportsSync(result.css, dirname4(filePath), new Set([filePath]));
2648
2959
  }
2649
2960
  if (language === "less") {
2650
2961
  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.`);
@@ -2652,7 +2963,7 @@ ${contents}` : contents, normalizePostcssModule = (mod) => {
2652
2963
  if (language === "stylus") {
2653
2964
  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.`);
2654
2965
  }
2655
- return resolveCssImportsSync(rawContents, dirname3(filePath), new Set([filePath]));
2966
+ return resolveCssImportsSync(rawContents, dirname4(filePath), new Set([filePath]));
2656
2967
  }, getCssOutputExtension = (filePath) => isPreprocessableStylePath(filePath) ? ".css" : extname(filePath);
2657
2968
  var init_stylePreprocessor = __esm(() => {
2658
2969
  CSS_EXTENSION_PATTERN = /\.css$/i;
@@ -2661,7 +2972,7 @@ var init_stylePreprocessor = __esm(() => {
2661
2972
  STYLE_LANGUAGE_PATTERN = /^(s[ac]ss|less|styl(?:us)?)$/i;
2662
2973
  importOptionalPeer = new Function("specifier", "return import(specifier)");
2663
2974
  requireOptionalPeer = new Function("specifier", "return require(specifier)");
2664
- requireFromCwd = createRequire(join5(process.cwd(), "package.json"));
2975
+ requireFromCwd = createRequire(join7(process.cwd(), "package.json"));
2665
2976
  styleDependencyGraph = new Map;
2666
2977
  styleOutputHashes = new Map;
2667
2978
  stylePreprocessorPlugin = createStylePreprocessorPlugin();
@@ -2669,14 +2980,14 @@ var init_stylePreprocessor = __esm(() => {
2669
2980
  });
2670
2981
 
2671
2982
  // src/core/svelteServerModule.ts
2672
- import { mkdir, readdir as readdir2 } from "fs/promises";
2673
- import { basename as basename3, dirname as dirname4, extname as extname2, join as join6, relative as relative2, resolve as resolve5 } from "path";
2674
- var serverCacheRoot, compiledModuleCache, originalSourcePathCache, transpiler, ensureRelativeImportPath = (from, target) => {
2675
- const importPath = relative2(dirname4(from), target).replace(/\\/g, "/");
2983
+ import { mkdir as mkdir2, readdir as readdir3 } from "fs/promises";
2984
+ import { basename as basename3, dirname as dirname5, extname as extname2, join as join8, relative as relative3, resolve as resolve6 } from "path";
2985
+ var serverCacheRoot2, compiledModuleCache2, originalSourcePathCache, transpiler, ensureRelativeImportPath = (from, target) => {
2986
+ const importPath = relative3(dirname5(from), target).replace(/\\/g, "/");
2676
2987
  return importPath.startsWith(".") ? importPath : `./${importPath}`;
2677
2988
  }, processDirectoryEntries = (entries, dir, targetFileName, stack) => {
2678
2989
  for (const entry of entries) {
2679
- const entryPath = join6(dir, entry.name);
2990
+ const entryPath = join8(dir, entry.name);
2680
2991
  if (entry.isDirectory())
2681
2992
  stack.push(entryPath);
2682
2993
  if (entry.isFile() && entry.name === targetFileName) {
@@ -2690,7 +3001,7 @@ var serverCacheRoot, compiledModuleCache, originalSourcePathCache, transpiler, e
2690
3001
  const nextStack = [];
2691
3002
  const dirEntries = await Promise.all(dirs.map(async (dir) => ({
2692
3003
  dir,
2693
- entries: await readdir2(dir, {
3004
+ entries: await readdir3(dir, {
2694
3005
  encoding: "utf-8",
2695
3006
  withFileTypes: true
2696
3007
  })
@@ -2706,11 +3017,11 @@ var serverCacheRoot, compiledModuleCache, originalSourcePathCache, transpiler, e
2706
3017
  if (cachedPath !== undefined) {
2707
3018
  return cachedPath;
2708
3019
  }
2709
- if (!sourcePath.includes(`${join6(process.cwd(), "build")}${process.platform === "win32" ? "" : "/"}`) && !sourcePath.includes("/build/")) {
3020
+ if (!sourcePath.includes(`${join8(process.cwd(), "build")}${process.platform === "win32" ? "" : "/"}`) && !sourcePath.includes("/build/")) {
2710
3021
  originalSourcePathCache.set(sourcePath, sourcePath);
2711
3022
  return sourcePath;
2712
3023
  }
2713
- const resolvedSourcePath = await findSourceFileByBasename(join6(process.cwd(), "src"), normalizeBuiltSvelteFileName(sourcePath));
3024
+ const resolvedSourcePath = await findSourceFileByBasename(join8(process.cwd(), "src"), normalizeBuiltSvelteFileName(sourcePath));
2714
3025
  const nextPath = resolvedSourcePath ?? sourcePath;
2715
3026
  originalSourcePathCache.set(sourcePath, nextPath);
2716
3027
  return nextPath;
@@ -2718,7 +3029,7 @@ var serverCacheRoot, compiledModuleCache, originalSourcePathCache, transpiler, e
2718
3029
  if (!spec.startsWith(".")) {
2719
3030
  return null;
2720
3031
  }
2721
- const basePath = resolve5(dirname4(from), spec);
3032
+ const basePath = resolve6(dirname5(from), spec);
2722
3033
  const candidates = [
2723
3034
  basePath,
2724
3035
  `${basePath}.ts`,
@@ -2726,19 +3037,19 @@ var serverCacheRoot, compiledModuleCache, originalSourcePathCache, transpiler, e
2726
3037
  `${basePath}.mjs`,
2727
3038
  `${basePath}.cjs`,
2728
3039
  `${basePath}.json`,
2729
- join6(basePath, "index.ts"),
2730
- join6(basePath, "index.js"),
2731
- join6(basePath, "index.mjs"),
2732
- join6(basePath, "index.cjs"),
2733
- join6(basePath, "index.json")
3040
+ join8(basePath, "index.ts"),
3041
+ join8(basePath, "index.js"),
3042
+ join8(basePath, "index.mjs"),
3043
+ join8(basePath, "index.cjs"),
3044
+ join8(basePath, "index.json")
2734
3045
  ];
2735
3046
  const existResults = await Promise.all(candidates.map((candidate) => Bun.file(candidate).exists()));
2736
3047
  const foundIndex = existResults.indexOf(true);
2737
3048
  return foundIndex >= 0 ? candidates[foundIndex] ?? null : null;
2738
- }, getCachedModulePath = (sourcePath) => {
2739
- const relativeSourcePath = relative2(process.cwd(), sourcePath).replace(/\\/g, "/");
3049
+ }, getCachedModulePath2 = (sourcePath) => {
3050
+ const relativeSourcePath = relative3(process.cwd(), sourcePath).replace(/\\/g, "/");
2740
3051
  const normalizedSourcePath = relativeSourcePath.startsWith("..") ? sourcePath.replace(/[:\\/]/g, "_") : relativeSourcePath;
2741
- return join6(serverCacheRoot, `${normalizedSourcePath}.server.js`);
3052
+ return join8(serverCacheRoot2, `${normalizedSourcePath}.server.js`);
2742
3053
  }, resolveSvelteImport = async (spec, from) => {
2743
3054
  if (!spec.startsWith(".") && !spec.startsWith("/")) {
2744
3055
  const resolved = resolvePackageImport(spec);
@@ -2750,7 +3061,7 @@ var serverCacheRoot, compiledModuleCache, originalSourcePathCache, transpiler, e
2750
3061
  if (!spec.startsWith(".")) {
2751
3062
  return null;
2752
3063
  }
2753
- const explicitPath = resolve5(dirname4(from), spec);
3064
+ const explicitPath = resolve6(dirname5(from), spec);
2754
3065
  if (extname2(explicitPath) === ".svelte") {
2755
3066
  return explicitPath;
2756
3067
  }
@@ -2770,7 +3081,7 @@ var serverCacheRoot, compiledModuleCache, originalSourcePathCache, transpiler, e
2770
3081
  }
2771
3082
  await Bun.write(path, content);
2772
3083
  }, compileSvelteServerModule = async (sourcePath) => {
2773
- const cachedModulePath = compiledModuleCache.get(sourcePath);
3084
+ const cachedModulePath = compiledModuleCache2.get(sourcePath);
2774
3085
  if (cachedModulePath) {
2775
3086
  return cachedModulePath;
2776
3087
  }
@@ -2809,7 +3120,7 @@ var serverCacheRoot, compiledModuleCache, originalSourcePathCache, transpiler, e
2809
3120
  continue;
2810
3121
  if (resolvedChildModules[index])
2811
3122
  continue;
2812
- rewrittenModulePaths.set(spec, ensureRelativeImportPath(getCachedModulePath(sourcePath), resolvedModuleImport));
3123
+ rewrittenModulePaths.set(spec, ensureRelativeImportPath(getCachedModulePath2(sourcePath), resolvedModuleImport));
2813
3124
  }
2814
3125
  for (const [spec, resolvedModuleImport] of rewrittenModulePaths) {
2815
3126
  transpiled = transpiled.replaceAll(spec, resolvedModuleImport);
@@ -2823,15 +3134,15 @@ var serverCacheRoot, compiledModuleCache, originalSourcePathCache, transpiler, e
2823
3134
  generate: "server"
2824
3135
  }).js.code;
2825
3136
  for (const [spec, compiledChildPath] of childModulePaths) {
2826
- compiledCode = compiledCode.replaceAll(spec, ensureRelativeImportPath(getCachedModulePath(sourcePath), compiledChildPath));
3137
+ compiledCode = compiledCode.replaceAll(spec, ensureRelativeImportPath(getCachedModulePath2(sourcePath), compiledChildPath));
2827
3138
  }
2828
3139
  for (const [spec, resolvedModuleImport] of rewrittenModulePaths) {
2829
3140
  compiledCode = compiledCode.replaceAll(spec, resolvedModuleImport);
2830
3141
  }
2831
- const compiledModulePath = getCachedModulePath(sourcePath);
2832
- await mkdir(dirname4(compiledModulePath), { recursive: true });
3142
+ const compiledModulePath = getCachedModulePath2(sourcePath);
3143
+ await mkdir2(dirname5(compiledModulePath), { recursive: true });
2833
3144
  await writeIfChanged(compiledModulePath, compiledCode);
2834
- compiledModuleCache.set(sourcePath, compiledModulePath);
3145
+ compiledModuleCache2.set(sourcePath, compiledModulePath);
2835
3146
  return compiledModulePath;
2836
3147
  };
2837
3148
  var init_svelteServerModule = __esm(() => {
@@ -2839,8 +3150,8 @@ var init_svelteServerModule = __esm(() => {
2839
3150
  init_lowerIslandSyntax();
2840
3151
  init_lowerAwaitSlotSyntax();
2841
3152
  init_stylePreprocessor();
2842
- serverCacheRoot = join6(process.cwd(), ".absolutejs", "islands", "svelte");
2843
- compiledModuleCache = new Map;
3153
+ serverCacheRoot2 = join8(process.cwd(), ".absolutejs", "islands", "svelte");
3154
+ compiledModuleCache2 = new Map;
2844
3155
  originalSourcePathCache = new Map;
2845
3156
  transpiler = new Bun.Transpiler({
2846
3157
  loader: "ts",
@@ -2850,16 +3161,16 @@ var init_svelteServerModule = __esm(() => {
2850
3161
 
2851
3162
  // src/core/vueServerModule.ts
2852
3163
  import { existsSync as existsSync7, readFileSync as readFileSync6, realpathSync } from "fs";
2853
- import { mkdir as mkdir2 } from "fs/promises";
2854
- import { dirname as dirname5, join as join7, relative as relative3, resolve as resolve6 } from "path";
3164
+ import { mkdir as mkdir3 } from "fs/promises";
3165
+ import { dirname as dirname6, join as join9, relative as relative4, resolve as resolve7 } from "path";
2855
3166
  var {Transpiler } = globalThis.Bun;
2856
- var ISLAND_COMPONENT_ID_LENGTH = 8, serverCacheRoot2, compiledModuleCache2, transpiler2, ensureRelativeImportPath2 = (from, target) => {
2857
- const importPath = relative3(dirname5(from), target).replace(/\\/g, "/");
3167
+ var ISLAND_COMPONENT_ID_LENGTH = 8, serverCacheRoot3, compiledModuleCache3, transpiler2, ensureRelativeImportPath2 = (from, target) => {
3168
+ const importPath = relative4(dirname6(from), target).replace(/\\/g, "/");
2858
3169
  return importPath.startsWith(".") ? importPath : `./${importPath}`;
2859
- }, getCachedModulePath2 = (sourcePath) => {
2860
- const relativeSourcePath = relative3(process.cwd(), sourcePath).replace(/\\/g, "/");
3170
+ }, getCachedModulePath3 = (sourcePath) => {
3171
+ const relativeSourcePath = relative4(process.cwd(), sourcePath).replace(/\\/g, "/");
2861
3172
  const normalizedSourcePath = relativeSourcePath.startsWith("..") ? sourcePath.replace(/[:\\/]/g, "_") : relativeSourcePath;
2862
- return join7(serverCacheRoot2, `${normalizedSourcePath}.server.js`);
3173
+ return join9(serverCacheRoot3, `${normalizedSourcePath}.server.js`);
2863
3174
  }, writeIfChanged2 = async (path, content) => {
2864
3175
  const targetFile = Bun.file(path);
2865
3176
  if (await targetFile.exists()) {
@@ -2886,7 +3197,7 @@ var ISLAND_COMPONENT_ID_LENGTH = 8, serverCacheRoot2, compiledModuleCache2, tran
2886
3197
  `) : nonVueLines.join(`
2887
3198
  `);
2888
3199
  }, 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) => {
2889
- const cachedModulePath = compiledModuleCache2.get(sourcePath);
3200
+ const cachedModulePath = compiledModuleCache3.get(sourcePath);
2890
3201
  if (cachedModulePath)
2891
3202
  return cachedModulePath;
2892
3203
  const compiler = await import("@vue/compiler-sfc");
@@ -2919,7 +3230,7 @@ var ISLAND_COMPONENT_ID_LENGTH = 8, serverCacheRoot2, compiledModuleCache2, tran
2919
3230
  }).code : "const ssrRender = () => {};";
2920
3231
  const childImportPaths = extractRelativeVueImports(compiledScript.content);
2921
3232
  const compiledChildren = await Promise.all(childImportPaths.map(async (relativeImport) => ({
2922
- compiledPath: await compileVueServerModule(resolve6(dirname5(sourcePath), relativeImport)),
3233
+ compiledPath: await compileVueServerModule(resolve7(dirname6(sourcePath), relativeImport)),
2923
3234
  spec: relativeImport
2924
3235
  })));
2925
3236
  const strippedScript = stripExports(compiledScript.content);
@@ -2931,20 +3242,20 @@ var ISLAND_COMPONENT_ID_LENGTH = 8, serverCacheRoot2, compiledModuleCache2, tran
2931
3242
  "export default script;"
2932
3243
  ].join(`
2933
3244
  `));
2934
- const compiledModulePath = getCachedModulePath2(sourcePath);
3245
+ const compiledModulePath = getCachedModulePath3(sourcePath);
2935
3246
  let rewritten = assembled;
2936
3247
  for (const child of compiledChildren) {
2937
3248
  rewritten = rewritten.replaceAll(child.spec, ensureRelativeImportPath2(compiledModulePath, child.compiledPath));
2938
3249
  }
2939
- await mkdir2(dirname5(compiledModulePath), { recursive: true });
3250
+ await mkdir3(dirname6(compiledModulePath), { recursive: true });
2940
3251
  await writeIfChanged2(compiledModulePath, rewritten);
2941
- compiledModuleCache2.set(sourcePath, compiledModulePath);
3252
+ compiledModuleCache3.set(sourcePath, compiledModulePath);
2942
3253
  return compiledModulePath;
2943
3254
  };
2944
3255
  var init_vueServerModule = __esm(() => {
2945
3256
  init_constants();
2946
- serverCacheRoot2 = join7(process.cwd(), ".absolutejs", "islands", "vue");
2947
- compiledModuleCache2 = new Map;
3257
+ serverCacheRoot3 = join9(process.cwd(), ".absolutejs", "islands", "vue");
3258
+ compiledModuleCache3 = new Map;
2948
3259
  transpiler2 = new Transpiler({ loader: "ts", target: "browser" });
2949
3260
  });
2950
3261
 
@@ -3026,8 +3337,17 @@ var islandSequence = 0, resolvedServerComponentCache, resolvedServerBuildCompone
3026
3337
  throw new Error("Resolved Vue island is not a valid Vue component.");
3027
3338
  }
3028
3339
  return resolvedComponent;
3340
+ }, loadAngularServerBuildComponent = async (buildReferencePath, exportName) => {
3341
+ const serverModulePath = await compileAngularServerModule(buildReferencePath);
3342
+ const loadedModule = await import(serverModulePath);
3343
+ if (exportName && exportName !== "default" && exportName in loadedModule) {
3344
+ return loadedModule[exportName];
3345
+ }
3346
+ return "default" in loadedModule ? loadedModule.default : loadedModule;
3029
3347
  }, resolveAngularServerIslandComponent = async (component) => {
3030
- const resolvedComponent = await resolveServerIslandComponent(component);
3348
+ const buildReference = getIslandBuildReference(component);
3349
+ const buildReferencePath = buildReference?.source ? resolveBuildReferencePath(buildReference.source, import.meta.url) : null;
3350
+ const resolvedComponent = buildReferencePath ? await loadAngularServerBuildComponent(buildReferencePath, buildReference?.export) : await resolveServerIslandComponent(component);
3031
3351
  if (!isAngularServerIslandComponent(resolvedComponent)) {
3032
3352
  throw new Error("Resolved Angular island is not a valid Angular component.");
3033
3353
  }
@@ -3083,6 +3403,7 @@ var islandSequence = 0, resolvedServerComponentCache, resolvedServerBuildCompone
3083
3403
  };
3084
3404
  var init_renderIslandMarkup = __esm(() => {
3085
3405
  init_islandSsr();
3406
+ init_angularServerModule();
3086
3407
  init_svelteServerModule();
3087
3408
  init_vueServerModule();
3088
3409
  init_islandMarkupAttributes();
@@ -3726,7 +4047,6 @@ var resolveSpaChildCss = async (siblingJsPath, requestUrl) => {
3726
4047
  };
3727
4048
 
3728
4049
  // src/core/islandPageContext.ts
3729
- init_constants();
3730
4050
  var BOOTSTRAP_MANIFEST_KEY = "BootstrapClient";
3731
4051
  var ISLAND_MARKER = 'data-island="true"';
3732
4052
  var MANIFEST_MARKER = "__ABSOLUTE_MANIFEST__";
@@ -3847,61 +4167,69 @@ var pipeStreamWithHeadInjection = (stream, markup) => {
3847
4167
  var pipeStreamWithIslandMarkerDetection = (stream, markup) => {
3848
4168
  const encoder = new TextEncoder;
3849
4169
  const decoder = new TextDecoder;
3850
- const lookbehind = Math.max(ISLAND_MARKER.length, BYTES_PER_KILOBYTE);
3851
- const processPending = (controller, pending, injected) => {
3852
- if (injected) {
3853
- controller.enqueue(encoder.encode(pending));
3854
- return { injected, pending: "" };
4170
+ const headLookbehind = CLOSING_HEAD_TAG.length - 1;
4171
+ const enqueue = (controller, text) => {
4172
+ if (text.length > 0) {
4173
+ controller.enqueue(encoder.encode(text));
3855
4174
  }
3856
- const markerIndex = pending.indexOf(ISLAND_MARKER);
3857
- if (markerIndex >= 0) {
3858
- const tagStart = pending.lastIndexOf("<", markerIndex);
3859
- const injectAt = tagStart >= 0 ? tagStart : markerIndex;
3860
- const next = `${pending.slice(0, injectAt)}${markup}${pending.slice(injectAt)}`;
3861
- controller.enqueue(encoder.encode(next));
3862
- return { injected: true, pending: "" };
4175
+ };
4176
+ const processHolding = (controller, held) => {
4177
+ if (!held.includes(ISLAND_MARKER)) {
4178
+ return { held, injected: false, pending: "", sawHead: true };
3863
4179
  }
3864
- return {
3865
- injected,
3866
- pending: flushSafePendingText(controller, encoder, pending, lookbehind)
3867
- };
4180
+ enqueue(controller, `${markup}${held}`);
4181
+ return { held: "", injected: true, pending: "", sawHead: true };
3868
4182
  };
3869
- const finishIslandMarkerStream = (controller, pending) => {
3870
- const finalPending = pending + decoder.decode();
3871
- if (finalPending.length > 0) {
3872
- controller.enqueue(encoder.encode(finalPending));
4183
+ const processHead = (controller, pending) => {
4184
+ const headIndex = pending.indexOf(CLOSING_HEAD_TAG);
4185
+ if (headIndex < 0) {
4186
+ return {
4187
+ held: "",
4188
+ injected: false,
4189
+ pending: flushSafePendingText(controller, encoder, pending, headLookbehind),
4190
+ sawHead: false
4191
+ };
3873
4192
  }
3874
- controller.close();
4193
+ enqueue(controller, pending.slice(0, headIndex));
4194
+ return processHolding(controller, pending.slice(headIndex));
3875
4195
  };
3876
- const consumeIslandChunk = async (controller, reader, pending, injected) => {
3877
- const { done, value } = await readStreamChunk(reader);
3878
- if (done || !value) {
3879
- return { done, injected, pending };
4196
+ const processChunk = (controller, state, chunk) => {
4197
+ if (state.injected) {
4198
+ enqueue(controller, chunk);
4199
+ return state;
3880
4200
  }
3881
- const processed = processPending(controller, pending + streamChunkToString(value, decoder), injected);
3882
- return {
3883
- done,
3884
- injected: processed.injected,
3885
- pending: processed.pending
3886
- };
4201
+ if (!state.sawHead) {
4202
+ return processHead(controller, state.pending + chunk);
4203
+ }
4204
+ return processHolding(controller, state.held + chunk);
3887
4205
  };
3888
- const runIslandMarkerLoop = async (controller, reader) => {
3889
- const consumeNextIslandChunk = async (injected, pending) => {
3890
- const consumed = await consumeIslandChunk(controller, reader, pending, injected);
3891
- const nextState = updateInjectedState(consumed, injected, pending);
3892
- if (nextState.done) {
3893
- return { injected, pending };
4206
+ const finishMarkerStream = (controller, state) => {
4207
+ const tail = decoder.decode();
4208
+ const remainder = state.injected ? tail : (state.sawHead ? state.held : state.pending) + tail;
4209
+ enqueue(controller, remainder);
4210
+ controller.close();
4211
+ };
4212
+ const runMarkerLoop = (controller, reader) => {
4213
+ const consumeNext = async (state) => {
4214
+ const { done, value } = await readStreamChunk(reader);
4215
+ if (done || !value) {
4216
+ return state;
3894
4217
  }
3895
- return consumeNextIslandChunk(nextState.injected, nextState.pending);
4218
+ return consumeNext(processChunk(controller, state, streamChunkToString(value, decoder)));
3896
4219
  };
3897
- return consumeNextIslandChunk(false, "");
4220
+ return consumeNext({
4221
+ held: "",
4222
+ injected: false,
4223
+ pending: "",
4224
+ sawHead: false
4225
+ });
3898
4226
  };
3899
4227
  return new ReadableStream({
3900
4228
  async start(controller) {
3901
4229
  const reader = stream.getReader();
3902
4230
  try {
3903
- const { pending } = await runIslandMarkerLoop(controller, reader);
3904
- finishIslandMarkerStream(controller, pending);
4231
+ const finalState = await runMarkerLoop(controller, reader);
4232
+ finishMarkerStream(controller, finalState);
3905
4233
  } catch (error) {
3906
4234
  controller.error(error);
3907
4235
  }
@@ -4535,13 +4863,6 @@ import { defineComponent as defineComponent4, h as h4, onServerPrefetch } from "
4535
4863
 
4536
4864
  // src/client/preserveIslandMarkup.ts
4537
4865
  init_islandMarkupAttributes();
4538
- var getClaimMap = () => {
4539
- if (typeof window === "undefined") {
4540
- return null;
4541
- }
4542
- window.__ABS_CLAIMED_ISLAND_MARKUP__ ??= new Map;
4543
- return window.__ABS_CLAIMED_ISLAND_MARKUP__;
4544
- };
4545
4866
  var getSnapshotMap = () => {
4546
4867
  if (typeof window === "undefined") {
4547
4868
  return null;
@@ -4600,19 +4921,22 @@ var preserveIslandMarkup = (props) => {
4600
4921
  innerHTML: ""
4601
4922
  };
4602
4923
  }
4603
- const claimMap = getClaimMap();
4604
4924
  const snapshotMap = getSnapshotMap();
4605
4925
  const signature = getIslandSignature(props);
4606
- const claimedCount = claimMap?.get(signature) ?? 0;
4607
- const snapshotCandidate = snapshotMap?.get(signature)?.[claimedCount];
4608
- const candidates = Array.from(document.querySelectorAll('[data-island="true"]')).filter((element) => isMatchingIslandElement(element, props));
4609
- const candidate = candidates[claimedCount];
4610
- if (claimMap) {
4611
- claimMap.set(signature, claimedCount + 1);
4926
+ const snapshotCandidate = snapshotMap?.get(signature)?.[0];
4927
+ if (snapshotCandidate) {
4928
+ return snapshotCandidate;
4929
+ }
4930
+ const liveCandidate = Array.from(document.querySelectorAll('[data-island="true"]')).find((element) => isMatchingIslandElement(element, props));
4931
+ if (!liveCandidate) {
4932
+ return {
4933
+ attributes: getIslandMarkerAttributes(props),
4934
+ innerHTML: ""
4935
+ };
4612
4936
  }
4613
4937
  return {
4614
- attributes: snapshotCandidate?.attributes ?? getIslandMarkerAttributes(props),
4615
- innerHTML: snapshotCandidate?.innerHTML ?? candidate?.innerHTML ?? ""
4938
+ attributes: Object.fromEntries(liveCandidate.getAttributeNames().map((name) => [name, liveCandidate.getAttribute(name) ?? ""])),
4939
+ innerHTML: liveCandidate.innerHTML
4616
4940
  };
4617
4941
  };
4618
4942
 
@@ -4903,5 +5227,5 @@ export {
4903
5227
  Image
4904
5228
  };
4905
5229
 
4906
- //# debugId=ADCFF4A648D8A9A964756E2164756E21
5230
+ //# debugId=ADC4671C6C64EF8F64756E2164756E21
4907
5231
  //# sourceMappingURL=index.js.map