@absolutejs/absolute 0.19.0-beta.930 → 0.19.0-beta.931
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.
- package/dist/angular/components/core/streamingSlotRegistrar.js +1 -1
- package/dist/angular/components/core/streamingSlotRegistry.js +2 -2
- package/dist/angular/index.js +118 -221
- package/dist/angular/index.js.map +4 -5
- package/dist/angular/server.js +100 -203
- package/dist/angular/server.js.map +4 -5
- package/dist/build.js +566 -688
- package/dist/build.js.map +8 -9
- package/dist/index.js +617 -739
- package/dist/index.js.map +8 -9
- package/dist/islands/index.js +2 -105
- package/dist/islands/index.js.map +4 -5
- package/dist/react/index.js +2 -105
- package/dist/react/index.js.map +4 -5
- package/dist/src/vue/Island.browser.d.ts +12 -36
- package/dist/src/vue/Island.d.ts +11 -35
- package/dist/src/vue/pageHandler.d.ts +0 -8
- package/dist/svelte/index.js +2 -105
- package/dist/svelte/index.js.map +4 -5
- package/dist/vue/browser.js +4 -57
- package/dist/vue/browser.js.map +4 -5
- package/dist/vue/index.js +8 -172
- package/dist/vue/index.js.map +6 -8
- package/dist/vue/server.js +4 -11
- package/dist/vue/server.js.map +3 -3
- package/package.json +1 -1
- package/dist/src/core/normalizeIslandProps.d.ts +0 -15
- package/dist/src/core/vueServerModule.d.ts +0 -1
package/dist/angular/server.js
CHANGED
|
@@ -1725,100 +1725,6 @@ var init_svelteServerModule = __esm(() => {
|
|
|
1725
1725
|
});
|
|
1726
1726
|
});
|
|
1727
1727
|
|
|
1728
|
-
// src/core/vueServerModule.ts
|
|
1729
|
-
import { mkdir as mkdir2 } from "fs/promises";
|
|
1730
|
-
import { dirname as dirname3, join as join5, relative as relative3, resolve as resolve5 } from "path";
|
|
1731
|
-
var {Transpiler } = globalThis.Bun;
|
|
1732
|
-
var ISLAND_COMPONENT_ID_LENGTH = 8, serverCacheRoot2, compiledModuleCache2, transpiler2, ensureRelativeImportPath2 = (from, target) => {
|
|
1733
|
-
const importPath = relative3(dirname3(from), target).replace(/\\/g, "/");
|
|
1734
|
-
return importPath.startsWith(".") ? importPath : `./${importPath}`;
|
|
1735
|
-
}, getCachedModulePath2 = (sourcePath) => {
|
|
1736
|
-
const relativeSourcePath = relative3(process.cwd(), sourcePath).replace(/\\/g, "/");
|
|
1737
|
-
const normalizedSourcePath = relativeSourcePath.startsWith("..") ? sourcePath.replace(/[:\\/]/g, "_") : relativeSourcePath;
|
|
1738
|
-
return join5(serverCacheRoot2, `${normalizedSourcePath}.server.js`);
|
|
1739
|
-
}, writeIfChanged2 = async (path, content) => {
|
|
1740
|
-
const targetFile = Bun.file(path);
|
|
1741
|
-
if (await targetFile.exists()) {
|
|
1742
|
-
const currentContent = await targetFile.text();
|
|
1743
|
-
if (currentContent === content)
|
|
1744
|
-
return;
|
|
1745
|
-
}
|
|
1746
|
-
await Bun.write(path, content);
|
|
1747
|
-
}, stripExports = (code) => code.replace(/export\s+default/, "const script ="), mergeVueImports = (code) => {
|
|
1748
|
-
const lines = code.split(`
|
|
1749
|
-
`);
|
|
1750
|
-
const specifierSet = new Set;
|
|
1751
|
-
const vueImportRegex = /^import\s+{([^}]+)}\s+from\s+['"]vue['"];?$/;
|
|
1752
|
-
lines.forEach((line) => {
|
|
1753
|
-
const match = line.match(vueImportRegex);
|
|
1754
|
-
if (match?.[1])
|
|
1755
|
-
match[1].split(",").forEach((importSpecifier) => specifierSet.add(importSpecifier.trim()));
|
|
1756
|
-
});
|
|
1757
|
-
const nonVueLines = lines.filter((line) => !vueImportRegex.test(line));
|
|
1758
|
-
return specifierSet.size ? [
|
|
1759
|
-
`import { ${[...specifierSet].join(", ")} } from "vue";`,
|
|
1760
|
-
...nonVueLines
|
|
1761
|
-
].join(`
|
|
1762
|
-
`) : nonVueLines.join(`
|
|
1763
|
-
`);
|
|
1764
|
-
}, 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) => {
|
|
1765
|
-
const cachedModulePath = compiledModuleCache2.get(sourcePath);
|
|
1766
|
-
if (cachedModulePath)
|
|
1767
|
-
return cachedModulePath;
|
|
1768
|
-
const compiler = await import("@vue/compiler-sfc");
|
|
1769
|
-
const source = await Bun.file(sourcePath).text();
|
|
1770
|
-
const { descriptor } = compiler.parse(source, { filename: sourcePath });
|
|
1771
|
-
const componentId = Bun.hash(sourcePath).toString(BASE_36_RADIX).slice(0, ISLAND_COMPONENT_ID_LENGTH);
|
|
1772
|
-
const hasScript = descriptor.script || descriptor.scriptSetup;
|
|
1773
|
-
const compiledScript = hasScript ? compiler.compileScript(descriptor, {
|
|
1774
|
-
id: componentId,
|
|
1775
|
-
inlineTemplate: false
|
|
1776
|
-
}) : { bindings: {}, content: "export default {};" };
|
|
1777
|
-
const renderCode = descriptor.template ? compiler.compileTemplate({
|
|
1778
|
-
compilerOptions: {
|
|
1779
|
-
bindingMetadata: compiledScript.bindings,
|
|
1780
|
-
expressionPlugins: ["typescript"],
|
|
1781
|
-
prefixIdentifiers: true,
|
|
1782
|
-
isCustomElement: (tag) => tag === "absolute-island"
|
|
1783
|
-
},
|
|
1784
|
-
filename: sourcePath,
|
|
1785
|
-
id: componentId,
|
|
1786
|
-
scoped: descriptor.styles.some((styleBlock) => styleBlock.scoped),
|
|
1787
|
-
source: descriptor.template.content,
|
|
1788
|
-
ssr: true,
|
|
1789
|
-
ssrCssVars: descriptor.cssVars
|
|
1790
|
-
}).code : "const ssrRender = () => {};";
|
|
1791
|
-
const childImportPaths = extractRelativeVueImports(compiledScript.content);
|
|
1792
|
-
const compiledChildren = await Promise.all(childImportPaths.map(async (relativeImport) => ({
|
|
1793
|
-
compiledPath: await compileVueServerModule(resolve5(dirname3(sourcePath), relativeImport)),
|
|
1794
|
-
spec: relativeImport
|
|
1795
|
-
})));
|
|
1796
|
-
const strippedScript = stripExports(compiledScript.content);
|
|
1797
|
-
const transpiledScript = transpiler2.transformSync(strippedScript);
|
|
1798
|
-
const assembled = mergeVueImports([
|
|
1799
|
-
transpiledScript,
|
|
1800
|
-
renderCode,
|
|
1801
|
-
"script.ssrRender = ssrRender;",
|
|
1802
|
-
"export default script;"
|
|
1803
|
-
].join(`
|
|
1804
|
-
`));
|
|
1805
|
-
const compiledModulePath = getCachedModulePath2(sourcePath);
|
|
1806
|
-
let rewritten = assembled;
|
|
1807
|
-
for (const child of compiledChildren) {
|
|
1808
|
-
rewritten = rewritten.replaceAll(child.spec, ensureRelativeImportPath2(compiledModulePath, child.compiledPath));
|
|
1809
|
-
}
|
|
1810
|
-
await mkdir2(dirname3(compiledModulePath), { recursive: true });
|
|
1811
|
-
await writeIfChanged2(compiledModulePath, rewritten);
|
|
1812
|
-
compiledModuleCache2.set(sourcePath, compiledModulePath);
|
|
1813
|
-
return compiledModulePath;
|
|
1814
|
-
};
|
|
1815
|
-
var init_vueServerModule = __esm(() => {
|
|
1816
|
-
init_constants();
|
|
1817
|
-
serverCacheRoot2 = join5(process.cwd(), ".absolutejs", "islands", "vue");
|
|
1818
|
-
compiledModuleCache2 = new Map;
|
|
1819
|
-
transpiler2 = new Transpiler({ loader: "ts", target: "browser" });
|
|
1820
|
-
});
|
|
1821
|
-
|
|
1822
1728
|
// src/core/islandManifest.ts
|
|
1823
1729
|
var toIslandFrameworkSegment = (framework) => framework[0]?.toUpperCase() + framework.slice(1), collectFrameworkIslands = (manifest, prefix) => {
|
|
1824
1730
|
const entries = {};
|
|
@@ -1905,17 +1811,9 @@ var islandSequence = 0, resolvedServerComponentCache, resolvedServerBuildCompone
|
|
|
1905
1811
|
const loadPromise = loadAndCompileServerBuildComponent(buildReferencePath);
|
|
1906
1812
|
resolvedServerBuildComponentCache.set(buildReferencePath, loadPromise);
|
|
1907
1813
|
return loadPromise;
|
|
1908
|
-
}, resolveRuntimeImportTarget = async (resolvedModulePath) => {
|
|
1909
|
-
if (resolvedModulePath.endsWith(".svelte")) {
|
|
1910
|
-
return compileSvelteServerModule(resolvedModulePath);
|
|
1911
|
-
}
|
|
1912
|
-
if (resolvedModulePath.endsWith(".vue")) {
|
|
1913
|
-
return compileVueServerModule(resolvedModulePath);
|
|
1914
|
-
}
|
|
1915
|
-
return resolvedModulePath;
|
|
1916
1814
|
}, loadServerImportComponent = async (resolvedComponent, exportName) => {
|
|
1917
1815
|
const resolvedModulePath = resolvedComponent.startsWith(".") ? new URL(resolvedComponent, import.meta.url).pathname : resolvedComponent;
|
|
1918
|
-
const importTarget = await
|
|
1816
|
+
const importTarget = resolvedModulePath.endsWith(".svelte") ? await compileSvelteServerModule(resolvedModulePath) : resolvedModulePath;
|
|
1919
1817
|
const loadedModule = await import(importTarget);
|
|
1920
1818
|
if (exportName && exportName !== "default" && exportName in loadedModule) {
|
|
1921
1819
|
return loadedModule[exportName];
|
|
@@ -2019,7 +1917,6 @@ var islandSequence = 0, resolvedServerComponentCache, resolvedServerBuildCompone
|
|
|
2019
1917
|
var init_renderIslandMarkup = __esm(() => {
|
|
2020
1918
|
init_islandSsr();
|
|
2021
1919
|
init_svelteServerModule();
|
|
2022
|
-
init_vueServerModule();
|
|
2023
1920
|
init_islandMarkupAttributes();
|
|
2024
1921
|
init_islands2();
|
|
2025
1922
|
resolvedServerComponentCache = new Map;
|
|
@@ -2862,12 +2759,12 @@ var init_startupBanner = __esm(() => {
|
|
|
2862
2759
|
// src/utils/logger.ts
|
|
2863
2760
|
var colors2, frameworkColors, formatPath = (filePath) => {
|
|
2864
2761
|
const cwd = process.cwd();
|
|
2865
|
-
let
|
|
2866
|
-
|
|
2867
|
-
if (!
|
|
2868
|
-
|
|
2762
|
+
let relative3 = filePath.startsWith(cwd) ? filePath.slice(cwd.length + 1) : filePath;
|
|
2763
|
+
relative3 = relative3.replace(/\\/g, "/");
|
|
2764
|
+
if (!relative3.startsWith("/")) {
|
|
2765
|
+
relative3 = `/${relative3}`;
|
|
2869
2766
|
}
|
|
2870
|
-
return
|
|
2767
|
+
return relative3;
|
|
2871
2768
|
}, getFrameworkColor = (framework) => frameworkColors[framework] || colors2.white, log = (action, options) => {
|
|
2872
2769
|
const timestamp = `${colors2.dim}${formatTimestamp()}${colors2.reset}`;
|
|
2873
2770
|
const tag = `${colors2.cyan}[hmr]${colors2.reset}`;
|
|
@@ -3479,8 +3376,8 @@ __export(exports_generatedDir, {
|
|
|
3479
3376
|
getGeneratedRoot: () => getGeneratedRoot,
|
|
3480
3377
|
getFrameworkGeneratedDir: () => getFrameworkGeneratedDir
|
|
3481
3378
|
});
|
|
3482
|
-
import { join as
|
|
3483
|
-
var GENERATED_DIR_NAME = "generated", ABSOLUTE_CACHE_DIR_NAME = ".absolutejs", getGeneratedRoot = (projectRoot = process.cwd()) =>
|
|
3379
|
+
import { join as join5 } from "path";
|
|
3380
|
+
var GENERATED_DIR_NAME = "generated", ABSOLUTE_CACHE_DIR_NAME = ".absolutejs", getGeneratedRoot = (projectRoot = process.cwd()) => join5(projectRoot, ABSOLUTE_CACHE_DIR_NAME, GENERATED_DIR_NAME), getFrameworkGeneratedDir = (framework, projectRoot = process.cwd()) => join5(getGeneratedRoot(projectRoot), framework);
|
|
3484
3381
|
var init_generatedDir = () => {};
|
|
3485
3382
|
|
|
3486
3383
|
// src/build/compileAngular.ts
|
|
@@ -3492,17 +3389,17 @@ __export(exports_compileAngular, {
|
|
|
3492
3389
|
compileAngular: () => compileAngular
|
|
3493
3390
|
});
|
|
3494
3391
|
import { existsSync as existsSync4, readFileSync as readFileSync4, promises as fs } from "fs";
|
|
3495
|
-
import { join as
|
|
3392
|
+
import { join as join6, basename as basename3, sep, dirname as dirname3, resolve as resolve5, relative as relative3 } from "path";
|
|
3496
3393
|
import ts from "typescript";
|
|
3497
3394
|
var traceAngularPhase = async (name, fn, metadata) => {
|
|
3498
3395
|
const tracePhase = globalThis.__absoluteBuildTracePhase;
|
|
3499
3396
|
return tracePhase ? tracePhase(`compile/angular/${name}`, fn, metadata) : await fn();
|
|
3500
3397
|
}, readTsconfigPathAliases = () => {
|
|
3501
3398
|
try {
|
|
3502
|
-
const configPath =
|
|
3399
|
+
const configPath = resolve5(process.cwd(), "tsconfig.json");
|
|
3503
3400
|
const config = ts.readConfigFile(configPath, ts.sys.readFile).config;
|
|
3504
3401
|
const compilerOptions = config?.compilerOptions ?? {};
|
|
3505
|
-
const baseUrl =
|
|
3402
|
+
const baseUrl = resolve5(process.cwd(), compilerOptions.baseUrl ?? ".");
|
|
3506
3403
|
const aliases = Object.entries(compilerOptions.paths ?? {}).map(([pattern, replacements]) => ({ pattern, replacements }));
|
|
3507
3404
|
return { aliases, baseUrl };
|
|
3508
3405
|
} catch {
|
|
@@ -3522,7 +3419,7 @@ var traceAngularPhase = async (name, fn, metadata) => {
|
|
|
3522
3419
|
const wildcardValue = exactMatch ? "" : specifier.slice(prefix.length, specifier.length - suffix.length);
|
|
3523
3420
|
for (const replacement of alias.replacements) {
|
|
3524
3421
|
const candidate = replacement.replace("*", wildcardValue);
|
|
3525
|
-
const resolved = resolveSourceFile(
|
|
3422
|
+
const resolved = resolveSourceFile(resolve5(baseUrl, candidate));
|
|
3526
3423
|
if (resolved)
|
|
3527
3424
|
return resolved;
|
|
3528
3425
|
}
|
|
@@ -3534,20 +3431,20 @@ var traceAngularPhase = async (name, fn, metadata) => {
|
|
|
3534
3431
|
`${candidate}.tsx`,
|
|
3535
3432
|
`${candidate}.js`,
|
|
3536
3433
|
`${candidate}.jsx`,
|
|
3537
|
-
|
|
3538
|
-
|
|
3539
|
-
|
|
3540
|
-
|
|
3434
|
+
join6(candidate, "index.ts"),
|
|
3435
|
+
join6(candidate, "index.tsx"),
|
|
3436
|
+
join6(candidate, "index.js"),
|
|
3437
|
+
join6(candidate, "index.jsx")
|
|
3541
3438
|
];
|
|
3542
3439
|
return candidates.find((file) => existsSync4(file));
|
|
3543
3440
|
}, createLegacyAngularAnimationUsageResolver = (rootDir) => {
|
|
3544
|
-
const baseDir =
|
|
3441
|
+
const baseDir = resolve5(rootDir);
|
|
3545
3442
|
const tsconfigAliases = readTsconfigPathAliases();
|
|
3546
|
-
const
|
|
3443
|
+
const transpiler2 = new Bun.Transpiler({ loader: "tsx" });
|
|
3547
3444
|
const scanCache = new Map;
|
|
3548
3445
|
const resolveLocalImport = (specifier, fromDir) => {
|
|
3549
3446
|
if (specifier.startsWith(".") || specifier.startsWith("/")) {
|
|
3550
|
-
return resolveSourceFile(
|
|
3447
|
+
return resolveSourceFile(resolve5(fromDir, specifier));
|
|
3551
3448
|
}
|
|
3552
3449
|
const aliased = matchTsconfigAlias(specifier, tsconfigAliases.aliases, tsconfigAliases.baseUrl, resolveSourceFile);
|
|
3553
3450
|
if (aliased)
|
|
@@ -3556,7 +3453,7 @@ var traceAngularPhase = async (name, fn, metadata) => {
|
|
|
3556
3453
|
const resolved = Bun.resolveSync(specifier, fromDir);
|
|
3557
3454
|
if (resolved.includes("/node_modules/"))
|
|
3558
3455
|
return;
|
|
3559
|
-
const absolute =
|
|
3456
|
+
const absolute = resolve5(resolved);
|
|
3560
3457
|
if (!absolute.startsWith(baseDir))
|
|
3561
3458
|
return;
|
|
3562
3459
|
return resolveSourceFile(absolute);
|
|
@@ -3572,7 +3469,7 @@ var traceAngularPhase = async (name, fn, metadata) => {
|
|
|
3572
3469
|
usesLegacyAnimations: false
|
|
3573
3470
|
});
|
|
3574
3471
|
}
|
|
3575
|
-
const resolved =
|
|
3472
|
+
const resolved = resolve5(actualPath);
|
|
3576
3473
|
const cached = scanCache.get(resolved);
|
|
3577
3474
|
if (cached)
|
|
3578
3475
|
return cached;
|
|
@@ -3585,7 +3482,7 @@ var traceAngularPhase = async (name, fn, metadata) => {
|
|
|
3585
3482
|
}
|
|
3586
3483
|
let imports;
|
|
3587
3484
|
try {
|
|
3588
|
-
imports =
|
|
3485
|
+
imports = transpiler2.scanImports(sourceCode);
|
|
3589
3486
|
} catch {
|
|
3590
3487
|
return { imports: [], usesLegacyAnimations: false };
|
|
3591
3488
|
}
|
|
@@ -3601,7 +3498,7 @@ var traceAngularPhase = async (name, fn, metadata) => {
|
|
|
3601
3498
|
const actualPath = resolveSourceFile(filePath);
|
|
3602
3499
|
if (!actualPath)
|
|
3603
3500
|
return false;
|
|
3604
|
-
const resolved =
|
|
3501
|
+
const resolved = resolve5(actualPath);
|
|
3605
3502
|
if (visited.has(resolved))
|
|
3606
3503
|
return false;
|
|
3607
3504
|
visited.add(resolved);
|
|
@@ -3609,7 +3506,7 @@ var traceAngularPhase = async (name, fn, metadata) => {
|
|
|
3609
3506
|
if (scan.usesLegacyAnimations)
|
|
3610
3507
|
return true;
|
|
3611
3508
|
for (const specifier of scan.imports) {
|
|
3612
|
-
const importedPath = resolveLocalImport(specifier,
|
|
3509
|
+
const importedPath = resolveLocalImport(specifier, dirname3(resolved));
|
|
3613
3510
|
if (importedPath && await visit(importedPath, visited)) {
|
|
3614
3511
|
return true;
|
|
3615
3512
|
}
|
|
@@ -3619,14 +3516,14 @@ var traceAngularPhase = async (name, fn, metadata) => {
|
|
|
3619
3516
|
return (entryPath) => visit(entryPath);
|
|
3620
3517
|
}, resolveDevClientDir = () => {
|
|
3621
3518
|
const projectRoot = process.cwd();
|
|
3622
|
-
const fromSource =
|
|
3519
|
+
const fromSource = resolve5(import.meta.dir, "../dev/client");
|
|
3623
3520
|
if (existsSync4(fromSource) && fromSource.startsWith(projectRoot)) {
|
|
3624
3521
|
return fromSource;
|
|
3625
3522
|
}
|
|
3626
|
-
const fromNodeModules =
|
|
3523
|
+
const fromNodeModules = resolve5(projectRoot, "node_modules/@absolutejs/absolute/dist/dev/client");
|
|
3627
3524
|
if (existsSync4(fromNodeModules))
|
|
3628
3525
|
return fromNodeModules;
|
|
3629
|
-
return
|
|
3526
|
+
return resolve5(import.meta.dir, "./dev/client");
|
|
3630
3527
|
}, devClientDir, hmrClientPath, formatDiagnosticMessage = (diagnostic) => {
|
|
3631
3528
|
try {
|
|
3632
3529
|
return ts.flattenDiagnosticMessageText(diagnostic.messageText, `
|
|
@@ -3668,12 +3565,12 @@ var traceAngularPhase = async (name, fn, metadata) => {
|
|
|
3668
3565
|
return `${path.replace(/\.ts$/, ".js")}${query}`;
|
|
3669
3566
|
if (hasJsLikeExtension(path))
|
|
3670
3567
|
return `${path}${query}`;
|
|
3671
|
-
const importerDir =
|
|
3672
|
-
const fileCandidate =
|
|
3568
|
+
const importerDir = dirname3(importerOutputPath);
|
|
3569
|
+
const fileCandidate = resolve5(importerDir, `${path}.js`);
|
|
3673
3570
|
if (outputFiles?.has(fileCandidate) || existsSync4(fileCandidate)) {
|
|
3674
3571
|
return `${path}.js${query}`;
|
|
3675
3572
|
}
|
|
3676
|
-
const indexCandidate =
|
|
3573
|
+
const indexCandidate = resolve5(importerDir, path, "index.js");
|
|
3677
3574
|
if (outputFiles?.has(indexCandidate) || existsSync4(indexCandidate)) {
|
|
3678
3575
|
return `${path}/index.js${query}`;
|
|
3679
3576
|
}
|
|
@@ -3701,18 +3598,18 @@ var traceAngularPhase = async (name, fn, metadata) => {
|
|
|
3701
3598
|
}, resolveLocalTsImport = (fromFile, specifier) => {
|
|
3702
3599
|
if (!isRelativeModuleSpecifier(specifier))
|
|
3703
3600
|
return null;
|
|
3704
|
-
const basePath =
|
|
3601
|
+
const basePath = resolve5(dirname3(fromFile), specifier);
|
|
3705
3602
|
const candidates = /\.[cm]?[tj]sx?$/.test(basePath) ? [basePath] : [
|
|
3706
3603
|
`${basePath}.ts`,
|
|
3707
3604
|
`${basePath}.tsx`,
|
|
3708
3605
|
`${basePath}.mts`,
|
|
3709
3606
|
`${basePath}.cts`,
|
|
3710
|
-
|
|
3711
|
-
|
|
3712
|
-
|
|
3713
|
-
|
|
3607
|
+
join6(basePath, "index.ts"),
|
|
3608
|
+
join6(basePath, "index.tsx"),
|
|
3609
|
+
join6(basePath, "index.mts"),
|
|
3610
|
+
join6(basePath, "index.cts")
|
|
3714
3611
|
];
|
|
3715
|
-
return candidates.map((candidate) =>
|
|
3612
|
+
return candidates.map((candidate) => resolve5(candidate)).find((candidate) => existsSync4(candidate) && !candidate.endsWith(".d.ts")) ?? null;
|
|
3716
3613
|
}, readFileForAotTransform = async (fileName, readFile2) => {
|
|
3717
3614
|
const hostSource = readFile2?.(fileName);
|
|
3718
3615
|
if (typeof hostSource === "string")
|
|
@@ -3736,18 +3633,18 @@ var traceAngularPhase = async (name, fn, metadata) => {
|
|
|
3736
3633
|
const paths = [];
|
|
3737
3634
|
const templateUrlMatch = findUncommentedMatch(source, /templateUrl\s*:\s*['"]([^'"]+)['"]/);
|
|
3738
3635
|
if (templateUrlMatch?.[1])
|
|
3739
|
-
paths.push(
|
|
3636
|
+
paths.push(join6(fileDir, templateUrlMatch[1]));
|
|
3740
3637
|
const styleUrlMatch = findUncommentedMatch(source, /styleUrl\s*:\s*['"]([^'"]+)['"]/);
|
|
3741
3638
|
if (styleUrlMatch?.[1])
|
|
3742
|
-
paths.push(
|
|
3639
|
+
paths.push(join6(fileDir, styleUrlMatch[1]));
|
|
3743
3640
|
const styleUrlsMatch = findUncommentedMatch(source, /styleUrls\s*:\s*\[([^\]]+)\]/);
|
|
3744
3641
|
const urlMatches = styleUrlsMatch?.[1]?.match(/['"]([^'"]+)['"]/g);
|
|
3745
3642
|
if (urlMatches) {
|
|
3746
3643
|
for (const urlMatch of urlMatches) {
|
|
3747
|
-
paths.push(
|
|
3644
|
+
paths.push(join6(fileDir, urlMatch.replace(/['"]/g, "")));
|
|
3748
3645
|
}
|
|
3749
3646
|
}
|
|
3750
|
-
return paths.map((path) =>
|
|
3647
|
+
return paths.map((path) => resolve5(path));
|
|
3751
3648
|
}, readResourceCacheFile = async (cachePath) => {
|
|
3752
3649
|
try {
|
|
3753
3650
|
const entry = JSON.parse(await fs.readFile(cachePath, "utf-8"));
|
|
@@ -3759,13 +3656,13 @@ var traceAngularPhase = async (name, fn, metadata) => {
|
|
|
3759
3656
|
return null;
|
|
3760
3657
|
}
|
|
3761
3658
|
}, writeResourceCacheFile = async (cachePath, source) => {
|
|
3762
|
-
await fs.mkdir(
|
|
3659
|
+
await fs.mkdir(dirname3(cachePath), { recursive: true });
|
|
3763
3660
|
await fs.writeFile(cachePath, JSON.stringify({
|
|
3764
3661
|
source,
|
|
3765
3662
|
version: 1
|
|
3766
3663
|
}), "utf-8");
|
|
3767
3664
|
}, resolveResourceTransformCachePath = async (filePath, source, stylePreprocessors) => {
|
|
3768
|
-
const resourcePaths = collectAngularResourcePaths(source,
|
|
3665
|
+
const resourcePaths = collectAngularResourcePaths(source, dirname3(filePath));
|
|
3769
3666
|
const resourceContents = await Promise.all(resourcePaths.map(async (resourcePath) => {
|
|
3770
3667
|
const content = await fs.readFile(resourcePath, "utf-8");
|
|
3771
3668
|
return `${resourcePath}\x00${content}`;
|
|
@@ -3778,7 +3675,7 @@ var traceAngularPhase = async (name, fn, metadata) => {
|
|
|
3778
3675
|
safeStableStringify(stylePreprocessors ?? null)
|
|
3779
3676
|
].join("\x00");
|
|
3780
3677
|
const cacheKey = Bun.hash(cacheInput).toString(BASE_36_RADIX);
|
|
3781
|
-
return
|
|
3678
|
+
return join6(process.cwd(), ".absolutejs", "cache", "angular-resources", `${cacheKey}.json`);
|
|
3782
3679
|
}, precomputeAotResourceTransforms = async (inputPaths, readFile2, stylePreprocessors) => {
|
|
3783
3680
|
const transformedSources = new Map;
|
|
3784
3681
|
const visited = new Set;
|
|
@@ -3789,7 +3686,7 @@ var traceAngularPhase = async (name, fn, metadata) => {
|
|
|
3789
3686
|
transformedFiles: 0
|
|
3790
3687
|
};
|
|
3791
3688
|
const transformFile = async (filePath) => {
|
|
3792
|
-
const resolvedPath =
|
|
3689
|
+
const resolvedPath = resolve5(filePath);
|
|
3793
3690
|
if (visited.has(resolvedPath))
|
|
3794
3691
|
return;
|
|
3795
3692
|
visited.add(resolvedPath);
|
|
@@ -3805,7 +3702,7 @@ var traceAngularPhase = async (name, fn, metadata) => {
|
|
|
3805
3702
|
transformedSource = cached.source;
|
|
3806
3703
|
} else {
|
|
3807
3704
|
stats.cacheMisses += 1;
|
|
3808
|
-
const transformed = await inlineResources(source,
|
|
3705
|
+
const transformed = await inlineResources(source, dirname3(resolvedPath), stylePreprocessors);
|
|
3809
3706
|
transformedSource = transformed.source;
|
|
3810
3707
|
await writeResourceCacheFile(cachePath, transformedSource);
|
|
3811
3708
|
}
|
|
@@ -3824,7 +3721,7 @@ var traceAngularPhase = async (name, fn, metadata) => {
|
|
|
3824
3721
|
return { stats, transformedSources };
|
|
3825
3722
|
}, compileAngularFiles = async (inputPaths, outDir, stylePreprocessors) => {
|
|
3826
3723
|
const islandMetadataByOutputPath = await traceAngularPhase("aot/island-metadata", () => new Map(inputPaths.map((inputPath) => {
|
|
3827
|
-
const outputPath =
|
|
3724
|
+
const outputPath = resolve5(join6(outDir, relative3(process.cwd(), resolve5(inputPath)).replace(/\.[cm]?[tj]sx?$/, ".js")));
|
|
3828
3725
|
return [
|
|
3829
3726
|
outputPath,
|
|
3830
3727
|
buildIslandMetadataExports(readFileSync4(inputPath, "utf-8"))
|
|
@@ -3834,8 +3731,8 @@ var traceAngularPhase = async (name, fn, metadata) => {
|
|
|
3834
3731
|
const { readConfiguration, performCompilation, EmitFlags } = await traceAngularPhase("aot/import-compiler-cli", () => import("@angular/compiler-cli"));
|
|
3835
3732
|
const tsLibDir = await traceAngularPhase("aot/resolve-typescript-lib", () => {
|
|
3836
3733
|
const tsPath = __require.resolve("typescript");
|
|
3837
|
-
const tsRootDir =
|
|
3838
|
-
return tsRootDir.endsWith("lib") ? tsRootDir :
|
|
3734
|
+
const tsRootDir = dirname3(tsPath);
|
|
3735
|
+
return tsRootDir.endsWith("lib") ? tsRootDir : resolve5(tsRootDir, "lib");
|
|
3839
3736
|
});
|
|
3840
3737
|
const config = await traceAngularPhase("aot/read-configuration", () => readConfiguration("./tsconfig.json"));
|
|
3841
3738
|
const options = {
|
|
@@ -3871,13 +3768,13 @@ var traceAngularPhase = async (name, fn, metadata) => {
|
|
|
3871
3768
|
const originalGetSourceFile = host.getSourceFile;
|
|
3872
3769
|
host.getSourceFile = (fileName, languageVersion, onError) => {
|
|
3873
3770
|
if (fileName.startsWith("lib.") && fileName.endsWith(".d.ts") && tsLibDir) {
|
|
3874
|
-
const resolvedPath =
|
|
3771
|
+
const resolvedPath = join6(tsLibDir, fileName);
|
|
3875
3772
|
return originalGetSourceFile?.call(host, resolvedPath, languageVersion, onError);
|
|
3876
3773
|
}
|
|
3877
3774
|
return originalGetSourceFile?.call(host, fileName, languageVersion, onError);
|
|
3878
3775
|
};
|
|
3879
3776
|
const emitted = {};
|
|
3880
|
-
const resolvedOutDir =
|
|
3777
|
+
const resolvedOutDir = resolve5(outDir);
|
|
3881
3778
|
host.writeFile = (fileName, text) => {
|
|
3882
3779
|
const relativePath = resolveRelativePath(fileName, resolvedOutDir, outDir);
|
|
3883
3780
|
emitted[relativePath] = text;
|
|
@@ -3899,12 +3796,12 @@ var traceAngularPhase = async (name, fn, metadata) => {
|
|
|
3899
3796
|
if (!fileName.endsWith(".ts") || fileName.endsWith(".d.ts")) {
|
|
3900
3797
|
return source;
|
|
3901
3798
|
}
|
|
3902
|
-
const resolvedPath =
|
|
3799
|
+
const resolvedPath = resolve5(fileName);
|
|
3903
3800
|
return transformedSources.get(resolvedPath) ?? source;
|
|
3904
3801
|
};
|
|
3905
3802
|
const originalGetSourceFileForCompile = host.getSourceFile;
|
|
3906
3803
|
host.getSourceFile = (fileName, languageVersion, onError) => {
|
|
3907
|
-
const source = transformedSources.get(
|
|
3804
|
+
const source = transformedSources.get(resolve5(fileName));
|
|
3908
3805
|
if (source) {
|
|
3909
3806
|
return ts.createSourceFile(fileName, source, languageVersion, true);
|
|
3910
3807
|
}
|
|
@@ -3926,9 +3823,9 @@ var traceAngularPhase = async (name, fn, metadata) => {
|
|
|
3926
3823
|
const entries = await traceAngularPhase("aot/postprocess-emitted-js", () => {
|
|
3927
3824
|
const rawEntries = Object.entries(emitted).filter(([fileName]) => fileName.endsWith(".js")).map(([fileName, content]) => ({
|
|
3928
3825
|
content,
|
|
3929
|
-
target:
|
|
3826
|
+
target: join6(outDir, fileName)
|
|
3930
3827
|
}));
|
|
3931
|
-
const outputFiles = new Set(rawEntries.map(({ target }) =>
|
|
3828
|
+
const outputFiles = new Set(rawEntries.map(({ target }) => resolve5(target)));
|
|
3932
3829
|
return rawEntries.map(({ content, target }) => {
|
|
3933
3830
|
let processedContent = content.replace(/from\s+(['"])(\.\.?\/[^'"]+)(\1)/g, (match, quote, path) => {
|
|
3934
3831
|
const rewritten = rewriteRelativeJsSpecifier(target, path, outputFiles);
|
|
@@ -3943,12 +3840,12 @@ var traceAngularPhase = async (name, fn, metadata) => {
|
|
|
3943
3840
|
return cleaned ? `import { ${cleaned}, InternalInjectFlags } from '@angular/core'` : `import { InternalInjectFlags } from '@angular/core'`;
|
|
3944
3841
|
});
|
|
3945
3842
|
processedContent = processedContent.replace(/\b(?<!Internal)InjectFlags\b/g, "InternalInjectFlags");
|
|
3946
|
-
processedContent += islandMetadataByOutputPath.get(
|
|
3843
|
+
processedContent += islandMetadataByOutputPath.get(resolve5(target)) ?? "";
|
|
3947
3844
|
return { content: processedContent, target };
|
|
3948
3845
|
});
|
|
3949
3846
|
});
|
|
3950
3847
|
await traceAngularPhase("aot/write-output", () => Promise.all(entries.map(async ({ target, content }) => {
|
|
3951
|
-
await fs.mkdir(
|
|
3848
|
+
await fs.mkdir(dirname3(target), { recursive: true });
|
|
3952
3849
|
await fs.writeFile(target, content, "utf-8");
|
|
3953
3850
|
})), { outputs: entries.length });
|
|
3954
3851
|
return await traceAngularPhase("aot/collect-output-paths", () => entries.map(({ target }) => target), { outputs: entries.length });
|
|
@@ -3964,7 +3861,7 @@ var traceAngularPhase = async (name, fn, metadata) => {
|
|
|
3964
3861
|
}
|
|
3965
3862
|
return null;
|
|
3966
3863
|
}, resolveAngularDeferImportSpecifier = () => {
|
|
3967
|
-
const sourceEntry =
|
|
3864
|
+
const sourceEntry = resolve5(import.meta.dir, "../angular/components/index.ts");
|
|
3968
3865
|
if (existsSync4(sourceEntry)) {
|
|
3969
3866
|
return sourceEntry.replace(/\\/g, "/");
|
|
3970
3867
|
}
|
|
@@ -4101,7 +3998,7 @@ ${fields}
|
|
|
4101
3998
|
}, inlineTemplateAndLowerDefer = async (source, fileDir) => {
|
|
4102
3999
|
const templateUrlMatch = findUncommentedMatch(source, /templateUrl\s*:\s*['"]([^'"]+)['"]/);
|
|
4103
4000
|
if (templateUrlMatch?.[1]) {
|
|
4104
|
-
const templatePath =
|
|
4001
|
+
const templatePath = join6(fileDir, templateUrlMatch[1]);
|
|
4105
4002
|
if (!existsSync4(templatePath)) {
|
|
4106
4003
|
throw new Error(`Unable to inline Angular templateUrl "${templateUrlMatch[1]}": file not found at ${templatePath}`);
|
|
4107
4004
|
}
|
|
@@ -4132,7 +4029,7 @@ ${fields}
|
|
|
4132
4029
|
}, inlineTemplateAndLowerDeferSync = (source, fileDir) => {
|
|
4133
4030
|
const templateUrlMatch = findUncommentedMatch(source, /templateUrl\s*:\s*['"]([^'"]+)['"]/);
|
|
4134
4031
|
if (templateUrlMatch?.[1]) {
|
|
4135
|
-
const templatePath =
|
|
4032
|
+
const templatePath = join6(fileDir, templateUrlMatch[1]);
|
|
4136
4033
|
if (!existsSync4(templatePath)) {
|
|
4137
4034
|
throw new Error(`Unable to inline Angular templateUrl "${templateUrlMatch[1]}": file not found at ${templatePath}`);
|
|
4138
4035
|
}
|
|
@@ -4169,7 +4066,7 @@ ${fields}
|
|
|
4169
4066
|
return source;
|
|
4170
4067
|
const stylePromises = urlMatches.map((urlMatch) => {
|
|
4171
4068
|
const styleUrl = urlMatch.replace(/['"]/g, "");
|
|
4172
|
-
return readAndEscapeFile(
|
|
4069
|
+
return readAndEscapeFile(join6(fileDir, styleUrl), stylePreprocessors);
|
|
4173
4070
|
});
|
|
4174
4071
|
const results = await Promise.all(stylePromises);
|
|
4175
4072
|
const inlinedStyles = results.filter(Boolean).map((escaped) => `\`${escaped}\``);
|
|
@@ -4180,7 +4077,7 @@ ${fields}
|
|
|
4180
4077
|
const styleUrlMatch = findUncommentedMatch(source, /styleUrl\s*:\s*['"]([^'"]+)['"]/);
|
|
4181
4078
|
if (!styleUrlMatch?.[1])
|
|
4182
4079
|
return source;
|
|
4183
|
-
const escaped = await readAndEscapeFile(
|
|
4080
|
+
const escaped = await readAndEscapeFile(join6(fileDir, styleUrlMatch[1]), stylePreprocessors);
|
|
4184
4081
|
if (!escaped)
|
|
4185
4082
|
return source;
|
|
4186
4083
|
return source.slice(0, styleUrlMatch.index) + `styles: [\`${escaped}\`]` + source.slice(styleUrlMatch.index + styleUrlMatch[0].length);
|
|
@@ -4194,10 +4091,10 @@ ${fields}
|
|
|
4194
4091
|
source: result
|
|
4195
4092
|
};
|
|
4196
4093
|
}, compileAngularFileJIT = async (inputPath, outDir, rootDir, stylePreprocessors, cacheBuster) => {
|
|
4197
|
-
const entryPath =
|
|
4094
|
+
const entryPath = resolve5(inputPath);
|
|
4198
4095
|
const allOutputs = [];
|
|
4199
4096
|
const visited = new Set;
|
|
4200
|
-
const baseDir =
|
|
4097
|
+
const baseDir = resolve5(rootDir ?? process.cwd());
|
|
4201
4098
|
let usesLegacyAnimations = false;
|
|
4202
4099
|
const angularTranspiler = new Bun.Transpiler({
|
|
4203
4100
|
loader: "ts",
|
|
@@ -4215,16 +4112,16 @@ ${fields}
|
|
|
4215
4112
|
`${candidate}.tsx`,
|
|
4216
4113
|
`${candidate}.js`,
|
|
4217
4114
|
`${candidate}.jsx`,
|
|
4218
|
-
|
|
4219
|
-
|
|
4220
|
-
|
|
4221
|
-
|
|
4115
|
+
join6(candidate, "index.ts"),
|
|
4116
|
+
join6(candidate, "index.tsx"),
|
|
4117
|
+
join6(candidate, "index.js"),
|
|
4118
|
+
join6(candidate, "index.jsx")
|
|
4222
4119
|
];
|
|
4223
4120
|
return candidates.find((file) => existsSync4(file));
|
|
4224
4121
|
};
|
|
4225
4122
|
const resolveLocalImport = (specifier, fromDir) => {
|
|
4226
4123
|
if (specifier.startsWith(".") || specifier.startsWith("/")) {
|
|
4227
|
-
return resolveSourceFile2(
|
|
4124
|
+
return resolveSourceFile2(resolve5(fromDir, specifier));
|
|
4228
4125
|
}
|
|
4229
4126
|
const aliased = matchTsconfigAlias(specifier, tsconfigAliases.aliases, tsconfigAliases.baseUrl, resolveSourceFile2);
|
|
4230
4127
|
if (aliased)
|
|
@@ -4233,7 +4130,7 @@ ${fields}
|
|
|
4233
4130
|
const resolved = Bun.resolveSync(specifier, fromDir);
|
|
4234
4131
|
if (resolved.includes("/node_modules/"))
|
|
4235
4132
|
return;
|
|
4236
|
-
const absolute =
|
|
4133
|
+
const absolute = resolve5(resolved);
|
|
4237
4134
|
if (!absolute.startsWith(baseDir))
|
|
4238
4135
|
return;
|
|
4239
4136
|
return resolveSourceFile2(absolute);
|
|
@@ -4242,10 +4139,10 @@ ${fields}
|
|
|
4242
4139
|
}
|
|
4243
4140
|
};
|
|
4244
4141
|
const toOutputPath = (sourcePath) => {
|
|
4245
|
-
const inputDir =
|
|
4142
|
+
const inputDir = dirname3(sourcePath);
|
|
4246
4143
|
const relativeDir = inputDir.startsWith(baseDir) ? inputDir.substring(baseDir.length + 1) : inputDir;
|
|
4247
4144
|
const fileBase = basename3(sourcePath).replace(/\.[cm]?[tj]sx?$/, ".js");
|
|
4248
|
-
return
|
|
4145
|
+
return join6(outDir, relativeDir, fileBase);
|
|
4249
4146
|
};
|
|
4250
4147
|
const withCacheBuster = (specifier) => {
|
|
4251
4148
|
if (!cacheBuster)
|
|
@@ -4282,13 +4179,13 @@ ${fields}
|
|
|
4282
4179
|
return `${prefix}${dots}`;
|
|
4283
4180
|
return `${prefix}../${dots}`;
|
|
4284
4181
|
});
|
|
4285
|
-
if (
|
|
4182
|
+
if (resolve5(actualPath) === entryPath) {
|
|
4286
4183
|
processedContent += buildIslandMetadataExports(sourceCode);
|
|
4287
4184
|
}
|
|
4288
4185
|
return processedContent;
|
|
4289
4186
|
};
|
|
4290
4187
|
const transpileFile = async (filePath) => {
|
|
4291
|
-
const resolved =
|
|
4188
|
+
const resolved = resolve5(filePath);
|
|
4292
4189
|
if (visited.has(resolved))
|
|
4293
4190
|
return;
|
|
4294
4191
|
visited.add(resolved);
|
|
@@ -4298,12 +4195,12 @@ ${fields}
|
|
|
4298
4195
|
if (!existsSync4(actualPath))
|
|
4299
4196
|
return;
|
|
4300
4197
|
let sourceCode = await fs.readFile(actualPath, "utf-8");
|
|
4301
|
-
const inlined = await inlineResources(sourceCode,
|
|
4302
|
-
sourceCode = inlineTemplateAndLowerDeferSync(inlined.source,
|
|
4303
|
-
const inputDir =
|
|
4198
|
+
const inlined = await inlineResources(sourceCode, dirname3(actualPath), stylePreprocessors);
|
|
4199
|
+
sourceCode = inlineTemplateAndLowerDeferSync(inlined.source, dirname3(actualPath)).source;
|
|
4200
|
+
const inputDir = dirname3(actualPath);
|
|
4304
4201
|
const relativeDir = inputDir.startsWith(baseDir) ? inputDir.substring(baseDir.length + 1) : inputDir;
|
|
4305
4202
|
const fileBase = basename3(actualPath).replace(/\.[cm]?[tj]sx?$/, ".js");
|
|
4306
|
-
const targetDir =
|
|
4203
|
+
const targetDir = join6(outDir, relativeDir);
|
|
4307
4204
|
const targetPath = toOutputPath(actualPath);
|
|
4308
4205
|
const localImports = [];
|
|
4309
4206
|
const importRewrites = new Map;
|
|
@@ -4325,12 +4222,12 @@ ${fields}
|
|
|
4325
4222
|
const resolved2 = resolveLocalImport(specifier, inputDir);
|
|
4326
4223
|
if (!resolved2)
|
|
4327
4224
|
return null;
|
|
4328
|
-
const relativeImport =
|
|
4225
|
+
const relativeImport = relative3(targetDir, toOutputPath(resolved2)).replace(/\\/g, "/").replace(/\.js$/, "");
|
|
4329
4226
|
const relativeRewrite = relativeImport.startsWith(".") ? relativeImport : `./${relativeImport}`;
|
|
4330
4227
|
importRewrites.set(specifier, relativeRewrite);
|
|
4331
4228
|
return resolved2;
|
|
4332
4229
|
}).filter((path) => Boolean(path));
|
|
4333
|
-
const isEntry =
|
|
4230
|
+
const isEntry = resolve5(actualPath) === resolve5(entryPath);
|
|
4334
4231
|
const contentHash = Bun.hash(sourceCode).toString(BASE_36_RADIX);
|
|
4335
4232
|
const cacheKey = actualPath;
|
|
4336
4233
|
const shouldWriteFile = cacheBuster && isEntry ? true : jitContentCache.get(cacheKey) !== contentHash || !existsSync4(targetPath);
|
|
@@ -4364,13 +4261,13 @@ export const __ABSOLUTE_PAGE_USES_LEGACY_ANIMATIONS__ = true;
|
|
|
4364
4261
|
return { clientPaths: [...emptyPaths], serverPaths: [...emptyPaths] };
|
|
4365
4262
|
}
|
|
4366
4263
|
const compiledRoot = compiledParent;
|
|
4367
|
-
const indexesDir =
|
|
4264
|
+
const indexesDir = join6(compiledParent, "indexes");
|
|
4368
4265
|
await traceAngularPhase("setup/create-indexes-dir", () => fs.mkdir(indexesDir, { recursive: true }));
|
|
4369
|
-
const aotOutputs = hmr ? [] : await traceAngularPhase("aot/compile-files", () => compileAngularFiles(entryPoints.map((entry) =>
|
|
4266
|
+
const aotOutputs = hmr ? [] : await traceAngularPhase("aot/compile-files", () => compileAngularFiles(entryPoints.map((entry) => resolve5(entry)), compiledRoot, stylePreprocessors), { entries: entryPoints.length });
|
|
4370
4267
|
const usesLegacyAngularAnimations = await traceAngularPhase("setup/legacy-animation-resolver", () => createLegacyAngularAnimationUsageResolver(outRoot));
|
|
4371
4268
|
const compileTasks = entryPoints.map(async (entry) => {
|
|
4372
|
-
const resolvedEntry =
|
|
4373
|
-
const relativeEntry =
|
|
4269
|
+
const resolvedEntry = resolve5(entry);
|
|
4270
|
+
const relativeEntry = relative3(outRoot, resolvedEntry).replace(/\.[tj]s$/, ".js");
|
|
4374
4271
|
const compileEntry = () => compileAngularFileJIT(resolvedEntry, compiledRoot, outRoot, stylePreprocessors);
|
|
4375
4272
|
let outputs = hmr ? await traceAngularPhase("jit/compile-entry", compileEntry, {
|
|
4376
4273
|
entry: resolvedEntry
|
|
@@ -4378,13 +4275,13 @@ export const __ABSOLUTE_PAGE_USES_LEGACY_ANIMATIONS__ = true;
|
|
|
4378
4275
|
const fileBase = basename3(resolvedEntry).replace(/\.[tj]s$/, "");
|
|
4379
4276
|
const jsName = `${fileBase}.js`;
|
|
4380
4277
|
const compiledFallbackPaths = [
|
|
4381
|
-
|
|
4382
|
-
|
|
4383
|
-
|
|
4384
|
-
].map((file) =>
|
|
4278
|
+
join6(compiledRoot, relativeEntry),
|
|
4279
|
+
join6(compiledRoot, "pages", jsName),
|
|
4280
|
+
join6(compiledRoot, jsName)
|
|
4281
|
+
].map((file) => resolve5(file));
|
|
4385
4282
|
const resolveRawServerFile = (candidatePaths) => {
|
|
4386
4283
|
const normalizedCandidates = [
|
|
4387
|
-
...candidatePaths.map((file) =>
|
|
4284
|
+
...candidatePaths.map((file) => resolve5(file)),
|
|
4388
4285
|
...compiledFallbackPaths
|
|
4389
4286
|
];
|
|
4390
4287
|
let candidate = normalizedCandidates.find((file) => existsSync4(file) && file.endsWith(`${sep}pages${sep}${jsName}`));
|
|
@@ -4425,7 +4322,7 @@ export const __ABSOLUTE_PAGE_USES_LEGACY_ANIMATIONS__ = true;
|
|
|
4425
4322
|
const usesLegacyAnimations = await traceAngularPhase("wrapper/detect-legacy-animations", () => usesLegacyAngularAnimations(resolvedEntry), { entry: resolvedEntry });
|
|
4426
4323
|
const serverContentHash = Bun.hash(original).toString(BASE_36_RADIX);
|
|
4427
4324
|
const cachedWrapper = wrapperOutputCache.get(resolvedEntry);
|
|
4428
|
-
const clientFile =
|
|
4325
|
+
const clientFile = join6(indexesDir, jsName);
|
|
4429
4326
|
if (hmr && cachedWrapper && cachedWrapper.serverHash === serverContentHash && existsSync4(clientFile) && (usesLegacyAnimations || !original.includes("__ABSOLUTE_PAGE_USES_LEGACY_ANIMATIONS__")) && (!usesLegacyAnimations || original.includes("__ABSOLUTE_PAGE_USES_LEGACY_ANIMATIONS__"))) {
|
|
4430
4327
|
return {
|
|
4431
4328
|
clientPath: clientFile,
|
|
@@ -4452,7 +4349,7 @@ export const __ABSOLUTE_PAGE_USES_LEGACY_ANIMATIONS__ = true;
|
|
|
4452
4349
|
`;
|
|
4453
4350
|
}
|
|
4454
4351
|
await traceAngularPhase("wrapper/write-server-output", () => fs.writeFile(rawServerFile, rewritten, "utf-8"), { entry: resolvedEntry });
|
|
4455
|
-
const relativePath =
|
|
4352
|
+
const relativePath = relative3(indexesDir, rawServerFile).replace(/\\/g, "/");
|
|
4456
4353
|
const normalizedImportPath = relativePath.startsWith(".") ? relativePath : `./${relativePath}`;
|
|
4457
4354
|
const hmrPreamble = hmr ? `window.__HMR_FRAMEWORK__ = "angular";
|
|
4458
4355
|
import "${hmrClientPath}";
|
|
@@ -4656,7 +4553,7 @@ var init_compileAngular = __esm(() => {
|
|
|
4656
4553
|
init_stylePreprocessor();
|
|
4657
4554
|
init_generatedDir();
|
|
4658
4555
|
devClientDir = resolveDevClientDir();
|
|
4659
|
-
hmrClientPath =
|
|
4556
|
+
hmrClientPath = join6(devClientDir, "hmrClient.ts").replace(/\\/g, "/");
|
|
4660
4557
|
jitContentCache = new Map;
|
|
4661
4558
|
wrapperOutputCache = new Map;
|
|
4662
4559
|
});
|
|
@@ -4824,9 +4721,9 @@ var provideDeterministicEnv = (options = {}) => {
|
|
|
4824
4721
|
// src/angular/pageHandler.ts
|
|
4825
4722
|
init_constants();
|
|
4826
4723
|
import { AsyncLocalStorage as AsyncLocalStorage3 } from "async_hooks";
|
|
4827
|
-
import { mkdir as
|
|
4724
|
+
import { mkdir as mkdir2, symlink } from "fs/promises";
|
|
4828
4725
|
import { tmpdir } from "os";
|
|
4829
|
-
import { basename as basename4, dirname as
|
|
4726
|
+
import { basename as basename4, dirname as dirname4, join as join7, resolve as resolve6 } from "path";
|
|
4830
4727
|
import { pathToFileURL } from "url";
|
|
4831
4728
|
|
|
4832
4729
|
// src/core/islandPageContext.ts
|
|
@@ -5646,23 +5543,23 @@ var ensureAngularCompiler = () => {
|
|
|
5646
5543
|
return compilerImportPromise;
|
|
5647
5544
|
};
|
|
5648
5545
|
var readAngularPageModule = (value) => isRecord5(value) ? value : null;
|
|
5649
|
-
var resolveAngularSsrOutDir = () => process.env.ABSOLUTE_ANGULAR_SSR_OUTDIR ??
|
|
5546
|
+
var resolveAngularSsrOutDir = () => process.env.ABSOLUTE_ANGULAR_SSR_OUTDIR ?? join7(tmpdir(), "absolutejs", "generated", "angular-ssr");
|
|
5650
5547
|
var createAngularRuntimeCacheBuster = () => `${Date.now().toString(BASE_36_RADIX)}.${Math.random().toString(BASE_36_RADIX).substring(2, RANDOM_ID_END_INDEX)}`;
|
|
5651
5548
|
var ensureAngularSsrNodeModules = async (outDir) => {
|
|
5652
|
-
const outRoot =
|
|
5653
|
-
const nodeModulesLink =
|
|
5549
|
+
const outRoot = resolve6(dirname4(dirname4(outDir)));
|
|
5550
|
+
const nodeModulesLink = join7(outRoot, "node_modules");
|
|
5654
5551
|
if (process.env.ABSOLUTE_ANGULAR_SSR_OUTDIR) {
|
|
5655
5552
|
return;
|
|
5656
5553
|
}
|
|
5657
|
-
if (nodeModulesLink ===
|
|
5554
|
+
if (nodeModulesLink === resolve6(process.cwd(), "node_modules")) {
|
|
5658
5555
|
return;
|
|
5659
5556
|
}
|
|
5660
5557
|
if (await Bun.file(nodeModulesLink).exists()) {
|
|
5661
5558
|
return;
|
|
5662
5559
|
}
|
|
5663
|
-
await
|
|
5560
|
+
await mkdir2(outRoot, { recursive: true });
|
|
5664
5561
|
try {
|
|
5665
|
-
await symlink(
|
|
5562
|
+
await symlink(resolve6(process.cwd(), "node_modules"), nodeModulesLink, "dir");
|
|
5666
5563
|
} catch (error) {
|
|
5667
5564
|
if (!(error instanceof Error) || !("code" in error) || error.code !== "EEXIST") {
|
|
5668
5565
|
throw error;
|
|
@@ -5820,5 +5717,5 @@ export {
|
|
|
5820
5717
|
ABSOLUTE_HTTP_TRANSFER_CACHE_SKIP_HEADER
|
|
5821
5718
|
};
|
|
5822
5719
|
|
|
5823
|
-
//# debugId=
|
|
5720
|
+
//# debugId=3FD817D68DD9BDA264756E2164756E21
|
|
5824
5721
|
//# sourceMappingURL=server.js.map
|