@absolutejs/absolute 0.19.0-beta.927 → 0.19.0-beta.929
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 +221 -118
- package/dist/angular/index.js.map +5 -4
- package/dist/angular/server.js +203 -100
- package/dist/angular/server.js.map +5 -4
- package/dist/build.js +687 -565
- package/dist/build.js.map +9 -8
- package/dist/index.js +738 -616
- package/dist/index.js.map +9 -8
- package/dist/islands/index.js +105 -2
- package/dist/islands/index.js.map +5 -4
- package/dist/react/index.js +105 -2
- package/dist/react/index.js.map +5 -4
- package/dist/src/core/normalizeIslandProps.d.ts +15 -0
- package/dist/src/core/vueServerModule.d.ts +1 -0
- package/dist/src/vue/Island.browser.d.ts +36 -12
- package/dist/src/vue/Island.d.ts +35 -11
- package/dist/src/vue/pageHandler.d.ts +8 -0
- package/dist/svelte/index.js +105 -2
- package/dist/svelte/index.js.map +5 -4
- package/dist/vue/browser.js +57 -4
- package/dist/vue/browser.js.map +5 -4
- package/dist/vue/index.js +172 -8
- package/dist/vue/index.js.map +8 -6
- package/dist/vue/server.js +11 -4
- package/dist/vue/server.js.map +3 -3
- package/package.json +1 -1
package/dist/angular/index.js
CHANGED
|
@@ -1725,6 +1725,100 @@ 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
|
+
|
|
1728
1822
|
// src/core/islandManifest.ts
|
|
1729
1823
|
var toIslandFrameworkSegment = (framework) => framework[0]?.toUpperCase() + framework.slice(1), collectFrameworkIslands = (manifest, prefix) => {
|
|
1730
1824
|
const entries = {};
|
|
@@ -1811,9 +1905,17 @@ var islandSequence = 0, resolvedServerComponentCache, resolvedServerBuildCompone
|
|
|
1811
1905
|
const loadPromise = loadAndCompileServerBuildComponent(buildReferencePath);
|
|
1812
1906
|
resolvedServerBuildComponentCache.set(buildReferencePath, loadPromise);
|
|
1813
1907
|
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;
|
|
1814
1916
|
}, loadServerImportComponent = async (resolvedComponent, exportName) => {
|
|
1815
1917
|
const resolvedModulePath = resolvedComponent.startsWith(".") ? new URL(resolvedComponent, import.meta.url).pathname : resolvedComponent;
|
|
1816
|
-
const importTarget =
|
|
1918
|
+
const importTarget = await resolveRuntimeImportTarget(resolvedModulePath);
|
|
1817
1919
|
const loadedModule = await import(importTarget);
|
|
1818
1920
|
if (exportName && exportName !== "default" && exportName in loadedModule) {
|
|
1819
1921
|
return loadedModule[exportName];
|
|
@@ -1917,6 +2019,7 @@ var islandSequence = 0, resolvedServerComponentCache, resolvedServerBuildCompone
|
|
|
1917
2019
|
var init_renderIslandMarkup = __esm(() => {
|
|
1918
2020
|
init_islandSsr();
|
|
1919
2021
|
init_svelteServerModule();
|
|
2022
|
+
init_vueServerModule();
|
|
1920
2023
|
init_islandMarkupAttributes();
|
|
1921
2024
|
init_islands2();
|
|
1922
2025
|
resolvedServerComponentCache = new Map;
|
|
@@ -2759,12 +2862,12 @@ var init_startupBanner = __esm(() => {
|
|
|
2759
2862
|
// src/utils/logger.ts
|
|
2760
2863
|
var colors2, frameworkColors, formatPath = (filePath) => {
|
|
2761
2864
|
const cwd = process.cwd();
|
|
2762
|
-
let
|
|
2763
|
-
|
|
2764
|
-
if (!
|
|
2765
|
-
|
|
2865
|
+
let relative4 = filePath.startsWith(cwd) ? filePath.slice(cwd.length + 1) : filePath;
|
|
2866
|
+
relative4 = relative4.replace(/\\/g, "/");
|
|
2867
|
+
if (!relative4.startsWith("/")) {
|
|
2868
|
+
relative4 = `/${relative4}`;
|
|
2766
2869
|
}
|
|
2767
|
-
return
|
|
2870
|
+
return relative4;
|
|
2768
2871
|
}, getFrameworkColor = (framework) => frameworkColors[framework] || colors2.white, log = (action, options) => {
|
|
2769
2872
|
const timestamp = `${colors2.dim}${formatTimestamp()}${colors2.reset}`;
|
|
2770
2873
|
const tag = `${colors2.cyan}[hmr]${colors2.reset}`;
|
|
@@ -3376,8 +3479,8 @@ __export(exports_generatedDir, {
|
|
|
3376
3479
|
getGeneratedRoot: () => getGeneratedRoot,
|
|
3377
3480
|
getFrameworkGeneratedDir: () => getFrameworkGeneratedDir
|
|
3378
3481
|
});
|
|
3379
|
-
import { join as
|
|
3380
|
-
var GENERATED_DIR_NAME = "generated", ABSOLUTE_CACHE_DIR_NAME = ".absolutejs", getGeneratedRoot = (projectRoot = process.cwd()) =>
|
|
3482
|
+
import { join as join6 } from "path";
|
|
3483
|
+
var GENERATED_DIR_NAME = "generated", ABSOLUTE_CACHE_DIR_NAME = ".absolutejs", getGeneratedRoot = (projectRoot = process.cwd()) => join6(projectRoot, ABSOLUTE_CACHE_DIR_NAME, GENERATED_DIR_NAME), getFrameworkGeneratedDir = (framework, projectRoot = process.cwd()) => join6(getGeneratedRoot(projectRoot), framework);
|
|
3381
3484
|
var init_generatedDir = () => {};
|
|
3382
3485
|
|
|
3383
3486
|
// src/build/compileAngular.ts
|
|
@@ -3389,17 +3492,17 @@ __export(exports_compileAngular, {
|
|
|
3389
3492
|
compileAngular: () => compileAngular
|
|
3390
3493
|
});
|
|
3391
3494
|
import { existsSync as existsSync4, readFileSync as readFileSync4, promises as fs } from "fs";
|
|
3392
|
-
import { join as
|
|
3495
|
+
import { join as join7, basename as basename3, sep, dirname as dirname4, resolve as resolve6, relative as relative4 } from "path";
|
|
3393
3496
|
import ts from "typescript";
|
|
3394
3497
|
var traceAngularPhase = async (name, fn, metadata) => {
|
|
3395
3498
|
const tracePhase = globalThis.__absoluteBuildTracePhase;
|
|
3396
3499
|
return tracePhase ? tracePhase(`compile/angular/${name}`, fn, metadata) : await fn();
|
|
3397
3500
|
}, readTsconfigPathAliases = () => {
|
|
3398
3501
|
try {
|
|
3399
|
-
const configPath =
|
|
3502
|
+
const configPath = resolve6(process.cwd(), "tsconfig.json");
|
|
3400
3503
|
const config = ts.readConfigFile(configPath, ts.sys.readFile).config;
|
|
3401
3504
|
const compilerOptions = config?.compilerOptions ?? {};
|
|
3402
|
-
const baseUrl =
|
|
3505
|
+
const baseUrl = resolve6(process.cwd(), compilerOptions.baseUrl ?? ".");
|
|
3403
3506
|
const aliases = Object.entries(compilerOptions.paths ?? {}).map(([pattern, replacements]) => ({ pattern, replacements }));
|
|
3404
3507
|
return { aliases, baseUrl };
|
|
3405
3508
|
} catch {
|
|
@@ -3419,7 +3522,7 @@ var traceAngularPhase = async (name, fn, metadata) => {
|
|
|
3419
3522
|
const wildcardValue = exactMatch ? "" : specifier.slice(prefix.length, specifier.length - suffix.length);
|
|
3420
3523
|
for (const replacement of alias.replacements) {
|
|
3421
3524
|
const candidate = replacement.replace("*", wildcardValue);
|
|
3422
|
-
const resolved = resolveSourceFile(
|
|
3525
|
+
const resolved = resolveSourceFile(resolve6(baseUrl, candidate));
|
|
3423
3526
|
if (resolved)
|
|
3424
3527
|
return resolved;
|
|
3425
3528
|
}
|
|
@@ -3431,20 +3534,20 @@ var traceAngularPhase = async (name, fn, metadata) => {
|
|
|
3431
3534
|
`${candidate}.tsx`,
|
|
3432
3535
|
`${candidate}.js`,
|
|
3433
3536
|
`${candidate}.jsx`,
|
|
3434
|
-
|
|
3435
|
-
|
|
3436
|
-
|
|
3437
|
-
|
|
3537
|
+
join7(candidate, "index.ts"),
|
|
3538
|
+
join7(candidate, "index.tsx"),
|
|
3539
|
+
join7(candidate, "index.js"),
|
|
3540
|
+
join7(candidate, "index.jsx")
|
|
3438
3541
|
];
|
|
3439
3542
|
return candidates.find((file) => existsSync4(file));
|
|
3440
3543
|
}, createLegacyAngularAnimationUsageResolver = (rootDir) => {
|
|
3441
|
-
const baseDir =
|
|
3544
|
+
const baseDir = resolve6(rootDir);
|
|
3442
3545
|
const tsconfigAliases = readTsconfigPathAliases();
|
|
3443
|
-
const
|
|
3546
|
+
const transpiler3 = new Bun.Transpiler({ loader: "tsx" });
|
|
3444
3547
|
const scanCache = new Map;
|
|
3445
3548
|
const resolveLocalImport = (specifier, fromDir) => {
|
|
3446
3549
|
if (specifier.startsWith(".") || specifier.startsWith("/")) {
|
|
3447
|
-
return resolveSourceFile(
|
|
3550
|
+
return resolveSourceFile(resolve6(fromDir, specifier));
|
|
3448
3551
|
}
|
|
3449
3552
|
const aliased = matchTsconfigAlias(specifier, tsconfigAliases.aliases, tsconfigAliases.baseUrl, resolveSourceFile);
|
|
3450
3553
|
if (aliased)
|
|
@@ -3453,7 +3556,7 @@ var traceAngularPhase = async (name, fn, metadata) => {
|
|
|
3453
3556
|
const resolved = Bun.resolveSync(specifier, fromDir);
|
|
3454
3557
|
if (resolved.includes("/node_modules/"))
|
|
3455
3558
|
return;
|
|
3456
|
-
const absolute =
|
|
3559
|
+
const absolute = resolve6(resolved);
|
|
3457
3560
|
if (!absolute.startsWith(baseDir))
|
|
3458
3561
|
return;
|
|
3459
3562
|
return resolveSourceFile(absolute);
|
|
@@ -3469,7 +3572,7 @@ var traceAngularPhase = async (name, fn, metadata) => {
|
|
|
3469
3572
|
usesLegacyAnimations: false
|
|
3470
3573
|
});
|
|
3471
3574
|
}
|
|
3472
|
-
const resolved =
|
|
3575
|
+
const resolved = resolve6(actualPath);
|
|
3473
3576
|
const cached = scanCache.get(resolved);
|
|
3474
3577
|
if (cached)
|
|
3475
3578
|
return cached;
|
|
@@ -3482,7 +3585,7 @@ var traceAngularPhase = async (name, fn, metadata) => {
|
|
|
3482
3585
|
}
|
|
3483
3586
|
let imports;
|
|
3484
3587
|
try {
|
|
3485
|
-
imports =
|
|
3588
|
+
imports = transpiler3.scanImports(sourceCode);
|
|
3486
3589
|
} catch {
|
|
3487
3590
|
return { imports: [], usesLegacyAnimations: false };
|
|
3488
3591
|
}
|
|
@@ -3498,7 +3601,7 @@ var traceAngularPhase = async (name, fn, metadata) => {
|
|
|
3498
3601
|
const actualPath = resolveSourceFile(filePath);
|
|
3499
3602
|
if (!actualPath)
|
|
3500
3603
|
return false;
|
|
3501
|
-
const resolved =
|
|
3604
|
+
const resolved = resolve6(actualPath);
|
|
3502
3605
|
if (visited.has(resolved))
|
|
3503
3606
|
return false;
|
|
3504
3607
|
visited.add(resolved);
|
|
@@ -3506,7 +3609,7 @@ var traceAngularPhase = async (name, fn, metadata) => {
|
|
|
3506
3609
|
if (scan.usesLegacyAnimations)
|
|
3507
3610
|
return true;
|
|
3508
3611
|
for (const specifier of scan.imports) {
|
|
3509
|
-
const importedPath = resolveLocalImport(specifier,
|
|
3612
|
+
const importedPath = resolveLocalImport(specifier, dirname4(resolved));
|
|
3510
3613
|
if (importedPath && await visit(importedPath, visited)) {
|
|
3511
3614
|
return true;
|
|
3512
3615
|
}
|
|
@@ -3516,14 +3619,14 @@ var traceAngularPhase = async (name, fn, metadata) => {
|
|
|
3516
3619
|
return (entryPath) => visit(entryPath);
|
|
3517
3620
|
}, resolveDevClientDir = () => {
|
|
3518
3621
|
const projectRoot = process.cwd();
|
|
3519
|
-
const fromSource =
|
|
3622
|
+
const fromSource = resolve6(import.meta.dir, "../dev/client");
|
|
3520
3623
|
if (existsSync4(fromSource) && fromSource.startsWith(projectRoot)) {
|
|
3521
3624
|
return fromSource;
|
|
3522
3625
|
}
|
|
3523
|
-
const fromNodeModules =
|
|
3626
|
+
const fromNodeModules = resolve6(projectRoot, "node_modules/@absolutejs/absolute/dist/dev/client");
|
|
3524
3627
|
if (existsSync4(fromNodeModules))
|
|
3525
3628
|
return fromNodeModules;
|
|
3526
|
-
return
|
|
3629
|
+
return resolve6(import.meta.dir, "./dev/client");
|
|
3527
3630
|
}, devClientDir, hmrClientPath, formatDiagnosticMessage = (diagnostic) => {
|
|
3528
3631
|
try {
|
|
3529
3632
|
return ts.flattenDiagnosticMessageText(diagnostic.messageText, `
|
|
@@ -3565,12 +3668,12 @@ var traceAngularPhase = async (name, fn, metadata) => {
|
|
|
3565
3668
|
return `${path.replace(/\.ts$/, ".js")}${query}`;
|
|
3566
3669
|
if (hasJsLikeExtension(path))
|
|
3567
3670
|
return `${path}${query}`;
|
|
3568
|
-
const importerDir =
|
|
3569
|
-
const fileCandidate =
|
|
3671
|
+
const importerDir = dirname4(importerOutputPath);
|
|
3672
|
+
const fileCandidate = resolve6(importerDir, `${path}.js`);
|
|
3570
3673
|
if (outputFiles?.has(fileCandidate) || existsSync4(fileCandidate)) {
|
|
3571
3674
|
return `${path}.js${query}`;
|
|
3572
3675
|
}
|
|
3573
|
-
const indexCandidate =
|
|
3676
|
+
const indexCandidate = resolve6(importerDir, path, "index.js");
|
|
3574
3677
|
if (outputFiles?.has(indexCandidate) || existsSync4(indexCandidate)) {
|
|
3575
3678
|
return `${path}/index.js${query}`;
|
|
3576
3679
|
}
|
|
@@ -3598,18 +3701,18 @@ var traceAngularPhase = async (name, fn, metadata) => {
|
|
|
3598
3701
|
}, resolveLocalTsImport = (fromFile, specifier) => {
|
|
3599
3702
|
if (!isRelativeModuleSpecifier(specifier))
|
|
3600
3703
|
return null;
|
|
3601
|
-
const basePath =
|
|
3704
|
+
const basePath = resolve6(dirname4(fromFile), specifier);
|
|
3602
3705
|
const candidates = /\.[cm]?[tj]sx?$/.test(basePath) ? [basePath] : [
|
|
3603
3706
|
`${basePath}.ts`,
|
|
3604
3707
|
`${basePath}.tsx`,
|
|
3605
3708
|
`${basePath}.mts`,
|
|
3606
3709
|
`${basePath}.cts`,
|
|
3607
|
-
|
|
3608
|
-
|
|
3609
|
-
|
|
3610
|
-
|
|
3710
|
+
join7(basePath, "index.ts"),
|
|
3711
|
+
join7(basePath, "index.tsx"),
|
|
3712
|
+
join7(basePath, "index.mts"),
|
|
3713
|
+
join7(basePath, "index.cts")
|
|
3611
3714
|
];
|
|
3612
|
-
return candidates.map((candidate) =>
|
|
3715
|
+
return candidates.map((candidate) => resolve6(candidate)).find((candidate) => existsSync4(candidate) && !candidate.endsWith(".d.ts")) ?? null;
|
|
3613
3716
|
}, readFileForAotTransform = async (fileName, readFile2) => {
|
|
3614
3717
|
const hostSource = readFile2?.(fileName);
|
|
3615
3718
|
if (typeof hostSource === "string")
|
|
@@ -3633,18 +3736,18 @@ var traceAngularPhase = async (name, fn, metadata) => {
|
|
|
3633
3736
|
const paths = [];
|
|
3634
3737
|
const templateUrlMatch = findUncommentedMatch(source, /templateUrl\s*:\s*['"]([^'"]+)['"]/);
|
|
3635
3738
|
if (templateUrlMatch?.[1])
|
|
3636
|
-
paths.push(
|
|
3739
|
+
paths.push(join7(fileDir, templateUrlMatch[1]));
|
|
3637
3740
|
const styleUrlMatch = findUncommentedMatch(source, /styleUrl\s*:\s*['"]([^'"]+)['"]/);
|
|
3638
3741
|
if (styleUrlMatch?.[1])
|
|
3639
|
-
paths.push(
|
|
3742
|
+
paths.push(join7(fileDir, styleUrlMatch[1]));
|
|
3640
3743
|
const styleUrlsMatch = findUncommentedMatch(source, /styleUrls\s*:\s*\[([^\]]+)\]/);
|
|
3641
3744
|
const urlMatches = styleUrlsMatch?.[1]?.match(/['"]([^'"]+)['"]/g);
|
|
3642
3745
|
if (urlMatches) {
|
|
3643
3746
|
for (const urlMatch of urlMatches) {
|
|
3644
|
-
paths.push(
|
|
3747
|
+
paths.push(join7(fileDir, urlMatch.replace(/['"]/g, "")));
|
|
3645
3748
|
}
|
|
3646
3749
|
}
|
|
3647
|
-
return paths.map((path) =>
|
|
3750
|
+
return paths.map((path) => resolve6(path));
|
|
3648
3751
|
}, readResourceCacheFile = async (cachePath) => {
|
|
3649
3752
|
try {
|
|
3650
3753
|
const entry = JSON.parse(await fs.readFile(cachePath, "utf-8"));
|
|
@@ -3656,13 +3759,13 @@ var traceAngularPhase = async (name, fn, metadata) => {
|
|
|
3656
3759
|
return null;
|
|
3657
3760
|
}
|
|
3658
3761
|
}, writeResourceCacheFile = async (cachePath, source) => {
|
|
3659
|
-
await fs.mkdir(
|
|
3762
|
+
await fs.mkdir(dirname4(cachePath), { recursive: true });
|
|
3660
3763
|
await fs.writeFile(cachePath, JSON.stringify({
|
|
3661
3764
|
source,
|
|
3662
3765
|
version: 1
|
|
3663
3766
|
}), "utf-8");
|
|
3664
3767
|
}, resolveResourceTransformCachePath = async (filePath, source, stylePreprocessors) => {
|
|
3665
|
-
const resourcePaths = collectAngularResourcePaths(source,
|
|
3768
|
+
const resourcePaths = collectAngularResourcePaths(source, dirname4(filePath));
|
|
3666
3769
|
const resourceContents = await Promise.all(resourcePaths.map(async (resourcePath) => {
|
|
3667
3770
|
const content = await fs.readFile(resourcePath, "utf-8");
|
|
3668
3771
|
return `${resourcePath}\x00${content}`;
|
|
@@ -3675,7 +3778,7 @@ var traceAngularPhase = async (name, fn, metadata) => {
|
|
|
3675
3778
|
safeStableStringify(stylePreprocessors ?? null)
|
|
3676
3779
|
].join("\x00");
|
|
3677
3780
|
const cacheKey = Bun.hash(cacheInput).toString(BASE_36_RADIX);
|
|
3678
|
-
return
|
|
3781
|
+
return join7(process.cwd(), ".absolutejs", "cache", "angular-resources", `${cacheKey}.json`);
|
|
3679
3782
|
}, precomputeAotResourceTransforms = async (inputPaths, readFile2, stylePreprocessors) => {
|
|
3680
3783
|
const transformedSources = new Map;
|
|
3681
3784
|
const visited = new Set;
|
|
@@ -3686,7 +3789,7 @@ var traceAngularPhase = async (name, fn, metadata) => {
|
|
|
3686
3789
|
transformedFiles: 0
|
|
3687
3790
|
};
|
|
3688
3791
|
const transformFile = async (filePath) => {
|
|
3689
|
-
const resolvedPath =
|
|
3792
|
+
const resolvedPath = resolve6(filePath);
|
|
3690
3793
|
if (visited.has(resolvedPath))
|
|
3691
3794
|
return;
|
|
3692
3795
|
visited.add(resolvedPath);
|
|
@@ -3702,7 +3805,7 @@ var traceAngularPhase = async (name, fn, metadata) => {
|
|
|
3702
3805
|
transformedSource = cached.source;
|
|
3703
3806
|
} else {
|
|
3704
3807
|
stats.cacheMisses += 1;
|
|
3705
|
-
const transformed = await inlineResources(source,
|
|
3808
|
+
const transformed = await inlineResources(source, dirname4(resolvedPath), stylePreprocessors);
|
|
3706
3809
|
transformedSource = transformed.source;
|
|
3707
3810
|
await writeResourceCacheFile(cachePath, transformedSource);
|
|
3708
3811
|
}
|
|
@@ -3721,7 +3824,7 @@ var traceAngularPhase = async (name, fn, metadata) => {
|
|
|
3721
3824
|
return { stats, transformedSources };
|
|
3722
3825
|
}, compileAngularFiles = async (inputPaths, outDir, stylePreprocessors) => {
|
|
3723
3826
|
const islandMetadataByOutputPath = await traceAngularPhase("aot/island-metadata", () => new Map(inputPaths.map((inputPath) => {
|
|
3724
|
-
const outputPath =
|
|
3827
|
+
const outputPath = resolve6(join7(outDir, relative4(process.cwd(), resolve6(inputPath)).replace(/\.[cm]?[tj]sx?$/, ".js")));
|
|
3725
3828
|
return [
|
|
3726
3829
|
outputPath,
|
|
3727
3830
|
buildIslandMetadataExports(readFileSync4(inputPath, "utf-8"))
|
|
@@ -3731,8 +3834,8 @@ var traceAngularPhase = async (name, fn, metadata) => {
|
|
|
3731
3834
|
const { readConfiguration, performCompilation, EmitFlags } = await traceAngularPhase("aot/import-compiler-cli", () => import("@angular/compiler-cli"));
|
|
3732
3835
|
const tsLibDir = await traceAngularPhase("aot/resolve-typescript-lib", () => {
|
|
3733
3836
|
const tsPath = __require.resolve("typescript");
|
|
3734
|
-
const tsRootDir =
|
|
3735
|
-
return tsRootDir.endsWith("lib") ? tsRootDir :
|
|
3837
|
+
const tsRootDir = dirname4(tsPath);
|
|
3838
|
+
return tsRootDir.endsWith("lib") ? tsRootDir : resolve6(tsRootDir, "lib");
|
|
3736
3839
|
});
|
|
3737
3840
|
const config = await traceAngularPhase("aot/read-configuration", () => readConfiguration("./tsconfig.json"));
|
|
3738
3841
|
const options = {
|
|
@@ -3768,13 +3871,13 @@ var traceAngularPhase = async (name, fn, metadata) => {
|
|
|
3768
3871
|
const originalGetSourceFile = host.getSourceFile;
|
|
3769
3872
|
host.getSourceFile = (fileName, languageVersion, onError) => {
|
|
3770
3873
|
if (fileName.startsWith("lib.") && fileName.endsWith(".d.ts") && tsLibDir) {
|
|
3771
|
-
const resolvedPath =
|
|
3874
|
+
const resolvedPath = join7(tsLibDir, fileName);
|
|
3772
3875
|
return originalGetSourceFile?.call(host, resolvedPath, languageVersion, onError);
|
|
3773
3876
|
}
|
|
3774
3877
|
return originalGetSourceFile?.call(host, fileName, languageVersion, onError);
|
|
3775
3878
|
};
|
|
3776
3879
|
const emitted = {};
|
|
3777
|
-
const resolvedOutDir =
|
|
3880
|
+
const resolvedOutDir = resolve6(outDir);
|
|
3778
3881
|
host.writeFile = (fileName, text) => {
|
|
3779
3882
|
const relativePath = resolveRelativePath(fileName, resolvedOutDir, outDir);
|
|
3780
3883
|
emitted[relativePath] = text;
|
|
@@ -3796,12 +3899,12 @@ var traceAngularPhase = async (name, fn, metadata) => {
|
|
|
3796
3899
|
if (!fileName.endsWith(".ts") || fileName.endsWith(".d.ts")) {
|
|
3797
3900
|
return source;
|
|
3798
3901
|
}
|
|
3799
|
-
const resolvedPath =
|
|
3902
|
+
const resolvedPath = resolve6(fileName);
|
|
3800
3903
|
return transformedSources.get(resolvedPath) ?? source;
|
|
3801
3904
|
};
|
|
3802
3905
|
const originalGetSourceFileForCompile = host.getSourceFile;
|
|
3803
3906
|
host.getSourceFile = (fileName, languageVersion, onError) => {
|
|
3804
|
-
const source = transformedSources.get(
|
|
3907
|
+
const source = transformedSources.get(resolve6(fileName));
|
|
3805
3908
|
if (source) {
|
|
3806
3909
|
return ts.createSourceFile(fileName, source, languageVersion, true);
|
|
3807
3910
|
}
|
|
@@ -3823,9 +3926,9 @@ var traceAngularPhase = async (name, fn, metadata) => {
|
|
|
3823
3926
|
const entries = await traceAngularPhase("aot/postprocess-emitted-js", () => {
|
|
3824
3927
|
const rawEntries = Object.entries(emitted).filter(([fileName]) => fileName.endsWith(".js")).map(([fileName, content]) => ({
|
|
3825
3928
|
content,
|
|
3826
|
-
target:
|
|
3929
|
+
target: join7(outDir, fileName)
|
|
3827
3930
|
}));
|
|
3828
|
-
const outputFiles = new Set(rawEntries.map(({ target }) =>
|
|
3931
|
+
const outputFiles = new Set(rawEntries.map(({ target }) => resolve6(target)));
|
|
3829
3932
|
return rawEntries.map(({ content, target }) => {
|
|
3830
3933
|
let processedContent = content.replace(/from\s+(['"])(\.\.?\/[^'"]+)(\1)/g, (match, quote, path) => {
|
|
3831
3934
|
const rewritten = rewriteRelativeJsSpecifier(target, path, outputFiles);
|
|
@@ -3840,12 +3943,12 @@ var traceAngularPhase = async (name, fn, metadata) => {
|
|
|
3840
3943
|
return cleaned ? `import { ${cleaned}, InternalInjectFlags } from '@angular/core'` : `import { InternalInjectFlags } from '@angular/core'`;
|
|
3841
3944
|
});
|
|
3842
3945
|
processedContent = processedContent.replace(/\b(?<!Internal)InjectFlags\b/g, "InternalInjectFlags");
|
|
3843
|
-
processedContent += islandMetadataByOutputPath.get(
|
|
3946
|
+
processedContent += islandMetadataByOutputPath.get(resolve6(target)) ?? "";
|
|
3844
3947
|
return { content: processedContent, target };
|
|
3845
3948
|
});
|
|
3846
3949
|
});
|
|
3847
3950
|
await traceAngularPhase("aot/write-output", () => Promise.all(entries.map(async ({ target, content }) => {
|
|
3848
|
-
await fs.mkdir(
|
|
3951
|
+
await fs.mkdir(dirname4(target), { recursive: true });
|
|
3849
3952
|
await fs.writeFile(target, content, "utf-8");
|
|
3850
3953
|
})), { outputs: entries.length });
|
|
3851
3954
|
return await traceAngularPhase("aot/collect-output-paths", () => entries.map(({ target }) => target), { outputs: entries.length });
|
|
@@ -3861,7 +3964,7 @@ var traceAngularPhase = async (name, fn, metadata) => {
|
|
|
3861
3964
|
}
|
|
3862
3965
|
return null;
|
|
3863
3966
|
}, resolveAngularDeferImportSpecifier = () => {
|
|
3864
|
-
const sourceEntry =
|
|
3967
|
+
const sourceEntry = resolve6(import.meta.dir, "../angular/components/index.ts");
|
|
3865
3968
|
if (existsSync4(sourceEntry)) {
|
|
3866
3969
|
return sourceEntry.replace(/\\/g, "/");
|
|
3867
3970
|
}
|
|
@@ -3998,7 +4101,7 @@ ${fields}
|
|
|
3998
4101
|
}, inlineTemplateAndLowerDefer = async (source, fileDir) => {
|
|
3999
4102
|
const templateUrlMatch = findUncommentedMatch(source, /templateUrl\s*:\s*['"]([^'"]+)['"]/);
|
|
4000
4103
|
if (templateUrlMatch?.[1]) {
|
|
4001
|
-
const templatePath =
|
|
4104
|
+
const templatePath = join7(fileDir, templateUrlMatch[1]);
|
|
4002
4105
|
if (!existsSync4(templatePath)) {
|
|
4003
4106
|
throw new Error(`Unable to inline Angular templateUrl "${templateUrlMatch[1]}": file not found at ${templatePath}`);
|
|
4004
4107
|
}
|
|
@@ -4029,7 +4132,7 @@ ${fields}
|
|
|
4029
4132
|
}, inlineTemplateAndLowerDeferSync = (source, fileDir) => {
|
|
4030
4133
|
const templateUrlMatch = findUncommentedMatch(source, /templateUrl\s*:\s*['"]([^'"]+)['"]/);
|
|
4031
4134
|
if (templateUrlMatch?.[1]) {
|
|
4032
|
-
const templatePath =
|
|
4135
|
+
const templatePath = join7(fileDir, templateUrlMatch[1]);
|
|
4033
4136
|
if (!existsSync4(templatePath)) {
|
|
4034
4137
|
throw new Error(`Unable to inline Angular templateUrl "${templateUrlMatch[1]}": file not found at ${templatePath}`);
|
|
4035
4138
|
}
|
|
@@ -4066,7 +4169,7 @@ ${fields}
|
|
|
4066
4169
|
return source;
|
|
4067
4170
|
const stylePromises = urlMatches.map((urlMatch) => {
|
|
4068
4171
|
const styleUrl = urlMatch.replace(/['"]/g, "");
|
|
4069
|
-
return readAndEscapeFile(
|
|
4172
|
+
return readAndEscapeFile(join7(fileDir, styleUrl), stylePreprocessors);
|
|
4070
4173
|
});
|
|
4071
4174
|
const results = await Promise.all(stylePromises);
|
|
4072
4175
|
const inlinedStyles = results.filter(Boolean).map((escaped) => `\`${escaped}\``);
|
|
@@ -4077,7 +4180,7 @@ ${fields}
|
|
|
4077
4180
|
const styleUrlMatch = findUncommentedMatch(source, /styleUrl\s*:\s*['"]([^'"]+)['"]/);
|
|
4078
4181
|
if (!styleUrlMatch?.[1])
|
|
4079
4182
|
return source;
|
|
4080
|
-
const escaped = await readAndEscapeFile(
|
|
4183
|
+
const escaped = await readAndEscapeFile(join7(fileDir, styleUrlMatch[1]), stylePreprocessors);
|
|
4081
4184
|
if (!escaped)
|
|
4082
4185
|
return source;
|
|
4083
4186
|
return source.slice(0, styleUrlMatch.index) + `styles: [\`${escaped}\`]` + source.slice(styleUrlMatch.index + styleUrlMatch[0].length);
|
|
@@ -4091,10 +4194,10 @@ ${fields}
|
|
|
4091
4194
|
source: result
|
|
4092
4195
|
};
|
|
4093
4196
|
}, compileAngularFileJIT = async (inputPath, outDir, rootDir, stylePreprocessors, cacheBuster) => {
|
|
4094
|
-
const entryPath =
|
|
4197
|
+
const entryPath = resolve6(inputPath);
|
|
4095
4198
|
const allOutputs = [];
|
|
4096
4199
|
const visited = new Set;
|
|
4097
|
-
const baseDir =
|
|
4200
|
+
const baseDir = resolve6(rootDir ?? process.cwd());
|
|
4098
4201
|
let usesLegacyAnimations = false;
|
|
4099
4202
|
const angularTranspiler = new Bun.Transpiler({
|
|
4100
4203
|
loader: "ts",
|
|
@@ -4112,16 +4215,16 @@ ${fields}
|
|
|
4112
4215
|
`${candidate}.tsx`,
|
|
4113
4216
|
`${candidate}.js`,
|
|
4114
4217
|
`${candidate}.jsx`,
|
|
4115
|
-
|
|
4116
|
-
|
|
4117
|
-
|
|
4118
|
-
|
|
4218
|
+
join7(candidate, "index.ts"),
|
|
4219
|
+
join7(candidate, "index.tsx"),
|
|
4220
|
+
join7(candidate, "index.js"),
|
|
4221
|
+
join7(candidate, "index.jsx")
|
|
4119
4222
|
];
|
|
4120
4223
|
return candidates.find((file) => existsSync4(file));
|
|
4121
4224
|
};
|
|
4122
4225
|
const resolveLocalImport = (specifier, fromDir) => {
|
|
4123
4226
|
if (specifier.startsWith(".") || specifier.startsWith("/")) {
|
|
4124
|
-
return resolveSourceFile2(
|
|
4227
|
+
return resolveSourceFile2(resolve6(fromDir, specifier));
|
|
4125
4228
|
}
|
|
4126
4229
|
const aliased = matchTsconfigAlias(specifier, tsconfigAliases.aliases, tsconfigAliases.baseUrl, resolveSourceFile2);
|
|
4127
4230
|
if (aliased)
|
|
@@ -4130,7 +4233,7 @@ ${fields}
|
|
|
4130
4233
|
const resolved = Bun.resolveSync(specifier, fromDir);
|
|
4131
4234
|
if (resolved.includes("/node_modules/"))
|
|
4132
4235
|
return;
|
|
4133
|
-
const absolute =
|
|
4236
|
+
const absolute = resolve6(resolved);
|
|
4134
4237
|
if (!absolute.startsWith(baseDir))
|
|
4135
4238
|
return;
|
|
4136
4239
|
return resolveSourceFile2(absolute);
|
|
@@ -4139,10 +4242,10 @@ ${fields}
|
|
|
4139
4242
|
}
|
|
4140
4243
|
};
|
|
4141
4244
|
const toOutputPath = (sourcePath) => {
|
|
4142
|
-
const inputDir =
|
|
4245
|
+
const inputDir = dirname4(sourcePath);
|
|
4143
4246
|
const relativeDir = inputDir.startsWith(baseDir) ? inputDir.substring(baseDir.length + 1) : inputDir;
|
|
4144
4247
|
const fileBase = basename3(sourcePath).replace(/\.[cm]?[tj]sx?$/, ".js");
|
|
4145
|
-
return
|
|
4248
|
+
return join7(outDir, relativeDir, fileBase);
|
|
4146
4249
|
};
|
|
4147
4250
|
const withCacheBuster = (specifier) => {
|
|
4148
4251
|
if (!cacheBuster)
|
|
@@ -4179,13 +4282,13 @@ ${fields}
|
|
|
4179
4282
|
return `${prefix}${dots}`;
|
|
4180
4283
|
return `${prefix}../${dots}`;
|
|
4181
4284
|
});
|
|
4182
|
-
if (
|
|
4285
|
+
if (resolve6(actualPath) === entryPath) {
|
|
4183
4286
|
processedContent += buildIslandMetadataExports(sourceCode);
|
|
4184
4287
|
}
|
|
4185
4288
|
return processedContent;
|
|
4186
4289
|
};
|
|
4187
4290
|
const transpileFile = async (filePath) => {
|
|
4188
|
-
const resolved =
|
|
4291
|
+
const resolved = resolve6(filePath);
|
|
4189
4292
|
if (visited.has(resolved))
|
|
4190
4293
|
return;
|
|
4191
4294
|
visited.add(resolved);
|
|
@@ -4195,12 +4298,12 @@ ${fields}
|
|
|
4195
4298
|
if (!existsSync4(actualPath))
|
|
4196
4299
|
return;
|
|
4197
4300
|
let sourceCode = await fs.readFile(actualPath, "utf-8");
|
|
4198
|
-
const inlined = await inlineResources(sourceCode,
|
|
4199
|
-
sourceCode = inlineTemplateAndLowerDeferSync(inlined.source,
|
|
4200
|
-
const inputDir =
|
|
4301
|
+
const inlined = await inlineResources(sourceCode, dirname4(actualPath), stylePreprocessors);
|
|
4302
|
+
sourceCode = inlineTemplateAndLowerDeferSync(inlined.source, dirname4(actualPath)).source;
|
|
4303
|
+
const inputDir = dirname4(actualPath);
|
|
4201
4304
|
const relativeDir = inputDir.startsWith(baseDir) ? inputDir.substring(baseDir.length + 1) : inputDir;
|
|
4202
4305
|
const fileBase = basename3(actualPath).replace(/\.[cm]?[tj]sx?$/, ".js");
|
|
4203
|
-
const targetDir =
|
|
4306
|
+
const targetDir = join7(outDir, relativeDir);
|
|
4204
4307
|
const targetPath = toOutputPath(actualPath);
|
|
4205
4308
|
const localImports = [];
|
|
4206
4309
|
const importRewrites = new Map;
|
|
@@ -4222,12 +4325,12 @@ ${fields}
|
|
|
4222
4325
|
const resolved2 = resolveLocalImport(specifier, inputDir);
|
|
4223
4326
|
if (!resolved2)
|
|
4224
4327
|
return null;
|
|
4225
|
-
const relativeImport =
|
|
4328
|
+
const relativeImport = relative4(targetDir, toOutputPath(resolved2)).replace(/\\/g, "/").replace(/\.js$/, "");
|
|
4226
4329
|
const relativeRewrite = relativeImport.startsWith(".") ? relativeImport : `./${relativeImport}`;
|
|
4227
4330
|
importRewrites.set(specifier, relativeRewrite);
|
|
4228
4331
|
return resolved2;
|
|
4229
4332
|
}).filter((path) => Boolean(path));
|
|
4230
|
-
const isEntry =
|
|
4333
|
+
const isEntry = resolve6(actualPath) === resolve6(entryPath);
|
|
4231
4334
|
const contentHash = Bun.hash(sourceCode).toString(BASE_36_RADIX);
|
|
4232
4335
|
const cacheKey = actualPath;
|
|
4233
4336
|
const shouldWriteFile = cacheBuster && isEntry ? true : jitContentCache.get(cacheKey) !== contentHash || !existsSync4(targetPath);
|
|
@@ -4261,13 +4364,13 @@ export const __ABSOLUTE_PAGE_USES_LEGACY_ANIMATIONS__ = true;
|
|
|
4261
4364
|
return { clientPaths: [...emptyPaths], serverPaths: [...emptyPaths] };
|
|
4262
4365
|
}
|
|
4263
4366
|
const compiledRoot = compiledParent;
|
|
4264
|
-
const indexesDir =
|
|
4367
|
+
const indexesDir = join7(compiledParent, "indexes");
|
|
4265
4368
|
await traceAngularPhase("setup/create-indexes-dir", () => fs.mkdir(indexesDir, { recursive: true }));
|
|
4266
|
-
const aotOutputs = hmr ? [] : await traceAngularPhase("aot/compile-files", () => compileAngularFiles(entryPoints.map((entry) =>
|
|
4369
|
+
const aotOutputs = hmr ? [] : await traceAngularPhase("aot/compile-files", () => compileAngularFiles(entryPoints.map((entry) => resolve6(entry)), compiledRoot, stylePreprocessors), { entries: entryPoints.length });
|
|
4267
4370
|
const usesLegacyAngularAnimations = await traceAngularPhase("setup/legacy-animation-resolver", () => createLegacyAngularAnimationUsageResolver(outRoot));
|
|
4268
4371
|
const compileTasks = entryPoints.map(async (entry) => {
|
|
4269
|
-
const resolvedEntry =
|
|
4270
|
-
const relativeEntry =
|
|
4372
|
+
const resolvedEntry = resolve6(entry);
|
|
4373
|
+
const relativeEntry = relative4(outRoot, resolvedEntry).replace(/\.[tj]s$/, ".js");
|
|
4271
4374
|
const compileEntry = () => compileAngularFileJIT(resolvedEntry, compiledRoot, outRoot, stylePreprocessors);
|
|
4272
4375
|
let outputs = hmr ? await traceAngularPhase("jit/compile-entry", compileEntry, {
|
|
4273
4376
|
entry: resolvedEntry
|
|
@@ -4275,13 +4378,13 @@ export const __ABSOLUTE_PAGE_USES_LEGACY_ANIMATIONS__ = true;
|
|
|
4275
4378
|
const fileBase = basename3(resolvedEntry).replace(/\.[tj]s$/, "");
|
|
4276
4379
|
const jsName = `${fileBase}.js`;
|
|
4277
4380
|
const compiledFallbackPaths = [
|
|
4278
|
-
|
|
4279
|
-
|
|
4280
|
-
|
|
4281
|
-
].map((file) =>
|
|
4381
|
+
join7(compiledRoot, relativeEntry),
|
|
4382
|
+
join7(compiledRoot, "pages", jsName),
|
|
4383
|
+
join7(compiledRoot, jsName)
|
|
4384
|
+
].map((file) => resolve6(file));
|
|
4282
4385
|
const resolveRawServerFile = (candidatePaths) => {
|
|
4283
4386
|
const normalizedCandidates = [
|
|
4284
|
-
...candidatePaths.map((file) =>
|
|
4387
|
+
...candidatePaths.map((file) => resolve6(file)),
|
|
4285
4388
|
...compiledFallbackPaths
|
|
4286
4389
|
];
|
|
4287
4390
|
let candidate = normalizedCandidates.find((file) => existsSync4(file) && file.endsWith(`${sep}pages${sep}${jsName}`));
|
|
@@ -4322,7 +4425,7 @@ export const __ABSOLUTE_PAGE_USES_LEGACY_ANIMATIONS__ = true;
|
|
|
4322
4425
|
const usesLegacyAnimations = await traceAngularPhase("wrapper/detect-legacy-animations", () => usesLegacyAngularAnimations(resolvedEntry), { entry: resolvedEntry });
|
|
4323
4426
|
const serverContentHash = Bun.hash(original).toString(BASE_36_RADIX);
|
|
4324
4427
|
const cachedWrapper = wrapperOutputCache.get(resolvedEntry);
|
|
4325
|
-
const clientFile =
|
|
4428
|
+
const clientFile = join7(indexesDir, jsName);
|
|
4326
4429
|
if (hmr && cachedWrapper && cachedWrapper.serverHash === serverContentHash && existsSync4(clientFile) && (usesLegacyAnimations || !original.includes("__ABSOLUTE_PAGE_USES_LEGACY_ANIMATIONS__")) && (!usesLegacyAnimations || original.includes("__ABSOLUTE_PAGE_USES_LEGACY_ANIMATIONS__"))) {
|
|
4327
4430
|
return {
|
|
4328
4431
|
clientPath: clientFile,
|
|
@@ -4349,7 +4452,7 @@ export const __ABSOLUTE_PAGE_USES_LEGACY_ANIMATIONS__ = true;
|
|
|
4349
4452
|
`;
|
|
4350
4453
|
}
|
|
4351
4454
|
await traceAngularPhase("wrapper/write-server-output", () => fs.writeFile(rawServerFile, rewritten, "utf-8"), { entry: resolvedEntry });
|
|
4352
|
-
const relativePath =
|
|
4455
|
+
const relativePath = relative4(indexesDir, rawServerFile).replace(/\\/g, "/");
|
|
4353
4456
|
const normalizedImportPath = relativePath.startsWith(".") ? relativePath : `./${relativePath}`;
|
|
4354
4457
|
const hmrPreamble = hmr ? `window.__HMR_FRAMEWORK__ = "angular";
|
|
4355
4458
|
import "${hmrClientPath}";
|
|
@@ -4553,7 +4656,7 @@ var init_compileAngular = __esm(() => {
|
|
|
4553
4656
|
init_stylePreprocessor();
|
|
4554
4657
|
init_generatedDir();
|
|
4555
4658
|
devClientDir = resolveDevClientDir();
|
|
4556
|
-
hmrClientPath =
|
|
4659
|
+
hmrClientPath = join7(devClientDir, "hmrClient.ts").replace(/\\/g, "/");
|
|
4557
4660
|
jitContentCache = new Map;
|
|
4558
4661
|
wrapperOutputCache = new Map;
|
|
4559
4662
|
});
|
|
@@ -5242,7 +5345,7 @@ var require_Observable = __commonJS((exports) => {
|
|
|
5242
5345
|
Observable2.prototype.forEach = function(next, promiseCtor) {
|
|
5243
5346
|
var _this = this;
|
|
5244
5347
|
promiseCtor = getPromiseCtor(promiseCtor);
|
|
5245
|
-
return new promiseCtor(function(
|
|
5348
|
+
return new promiseCtor(function(resolve8, reject) {
|
|
5246
5349
|
var subscriber = new Subscriber_1.SafeSubscriber({
|
|
5247
5350
|
next: function(value) {
|
|
5248
5351
|
try {
|
|
@@ -5253,7 +5356,7 @@ var require_Observable = __commonJS((exports) => {
|
|
|
5253
5356
|
}
|
|
5254
5357
|
},
|
|
5255
5358
|
error: reject,
|
|
5256
|
-
complete:
|
|
5359
|
+
complete: resolve8
|
|
5257
5360
|
});
|
|
5258
5361
|
_this.subscribe(subscriber);
|
|
5259
5362
|
});
|
|
@@ -5275,14 +5378,14 @@ var require_Observable = __commonJS((exports) => {
|
|
|
5275
5378
|
Observable2.prototype.toPromise = function(promiseCtor) {
|
|
5276
5379
|
var _this = this;
|
|
5277
5380
|
promiseCtor = getPromiseCtor(promiseCtor);
|
|
5278
|
-
return new promiseCtor(function(
|
|
5381
|
+
return new promiseCtor(function(resolve8, reject) {
|
|
5279
5382
|
var value;
|
|
5280
5383
|
_this.subscribe(function(x) {
|
|
5281
5384
|
return value = x;
|
|
5282
5385
|
}, function(err) {
|
|
5283
5386
|
return reject(err);
|
|
5284
5387
|
}, function() {
|
|
5285
|
-
return
|
|
5388
|
+
return resolve8(value);
|
|
5286
5389
|
});
|
|
5287
5390
|
});
|
|
5288
5391
|
};
|
|
@@ -7310,11 +7413,11 @@ var require_isReadableStreamLike = __commonJS((exports) => {
|
|
|
7310
7413
|
var require_innerFrom = __commonJS((exports) => {
|
|
7311
7414
|
var __awaiter = exports && exports.__awaiter || function(thisArg, _arguments, P, generator) {
|
|
7312
7415
|
function adopt(value) {
|
|
7313
|
-
return value instanceof P ? value : new P(function(
|
|
7314
|
-
|
|
7416
|
+
return value instanceof P ? value : new P(function(resolve8) {
|
|
7417
|
+
resolve8(value);
|
|
7315
7418
|
});
|
|
7316
7419
|
}
|
|
7317
|
-
return new (P || (P = Promise))(function(
|
|
7420
|
+
return new (P || (P = Promise))(function(resolve8, reject) {
|
|
7318
7421
|
function fulfilled(value) {
|
|
7319
7422
|
try {
|
|
7320
7423
|
step(generator.next(value));
|
|
@@ -7330,7 +7433,7 @@ var require_innerFrom = __commonJS((exports) => {
|
|
|
7330
7433
|
}
|
|
7331
7434
|
}
|
|
7332
7435
|
function step(result) {
|
|
7333
|
-
result.done ?
|
|
7436
|
+
result.done ? resolve8(result.value) : adopt(result.value).then(fulfilled, rejected);
|
|
7334
7437
|
}
|
|
7335
7438
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
7336
7439
|
});
|
|
@@ -7420,14 +7523,14 @@ var require_innerFrom = __commonJS((exports) => {
|
|
|
7420
7523
|
}, i);
|
|
7421
7524
|
function verb(n) {
|
|
7422
7525
|
i[n] = o[n] && function(v) {
|
|
7423
|
-
return new Promise(function(
|
|
7424
|
-
v = o[n](v), settle(
|
|
7526
|
+
return new Promise(function(resolve8, reject) {
|
|
7527
|
+
v = o[n](v), settle(resolve8, reject, v.done, v.value);
|
|
7425
7528
|
});
|
|
7426
7529
|
};
|
|
7427
7530
|
}
|
|
7428
|
-
function settle(
|
|
7531
|
+
function settle(resolve8, reject, d, v) {
|
|
7429
7532
|
Promise.resolve(v).then(function(v2) {
|
|
7430
|
-
|
|
7533
|
+
resolve8({ value: v2, done: d });
|
|
7431
7534
|
}, reject);
|
|
7432
7535
|
}
|
|
7433
7536
|
};
|
|
@@ -8003,7 +8106,7 @@ var require_lastValueFrom = __commonJS((exports) => {
|
|
|
8003
8106
|
var EmptyError_1 = require_EmptyError();
|
|
8004
8107
|
function lastValueFrom(source, config) {
|
|
8005
8108
|
var hasConfig = typeof config === "object";
|
|
8006
|
-
return new Promise(function(
|
|
8109
|
+
return new Promise(function(resolve8, reject) {
|
|
8007
8110
|
var _hasValue = false;
|
|
8008
8111
|
var _value;
|
|
8009
8112
|
source.subscribe({
|
|
@@ -8014,9 +8117,9 @@ var require_lastValueFrom = __commonJS((exports) => {
|
|
|
8014
8117
|
error: reject,
|
|
8015
8118
|
complete: function() {
|
|
8016
8119
|
if (_hasValue) {
|
|
8017
|
-
|
|
8120
|
+
resolve8(_value);
|
|
8018
8121
|
} else if (hasConfig) {
|
|
8019
|
-
|
|
8122
|
+
resolve8(config.defaultValue);
|
|
8020
8123
|
} else {
|
|
8021
8124
|
reject(new EmptyError_1.EmptyError);
|
|
8022
8125
|
}
|
|
@@ -8035,16 +8138,16 @@ var require_firstValueFrom = __commonJS((exports) => {
|
|
|
8035
8138
|
var Subscriber_1 = require_Subscriber();
|
|
8036
8139
|
function firstValueFrom(source, config) {
|
|
8037
8140
|
var hasConfig = typeof config === "object";
|
|
8038
|
-
return new Promise(function(
|
|
8141
|
+
return new Promise(function(resolve8, reject) {
|
|
8039
8142
|
var subscriber = new Subscriber_1.SafeSubscriber({
|
|
8040
8143
|
next: function(value) {
|
|
8041
|
-
|
|
8144
|
+
resolve8(value);
|
|
8042
8145
|
subscriber.unsubscribe();
|
|
8043
8146
|
},
|
|
8044
8147
|
error: reject,
|
|
8045
8148
|
complete: function() {
|
|
8046
8149
|
if (hasConfig) {
|
|
8047
|
-
|
|
8150
|
+
resolve8(config.defaultValue);
|
|
8048
8151
|
} else {
|
|
8049
8152
|
reject(new EmptyError_1.EmptyError);
|
|
8050
8153
|
}
|
|
@@ -13662,9 +13765,9 @@ var provideDeterministicEnv = (options = {}) => {
|
|
|
13662
13765
|
// src/angular/pageHandler.ts
|
|
13663
13766
|
init_constants();
|
|
13664
13767
|
import { AsyncLocalStorage as AsyncLocalStorage3 } from "async_hooks";
|
|
13665
|
-
import { mkdir as
|
|
13768
|
+
import { mkdir as mkdir3, symlink } from "fs/promises";
|
|
13666
13769
|
import { tmpdir } from "os";
|
|
13667
|
-
import { basename as basename4, dirname as
|
|
13770
|
+
import { basename as basename4, dirname as dirname5, join as join8, resolve as resolve7 } from "path";
|
|
13668
13771
|
import { pathToFileURL } from "url";
|
|
13669
13772
|
|
|
13670
13773
|
// src/core/islandPageContext.ts
|
|
@@ -14484,23 +14587,23 @@ var ensureAngularCompiler = () => {
|
|
|
14484
14587
|
return compilerImportPromise;
|
|
14485
14588
|
};
|
|
14486
14589
|
var readAngularPageModule = (value) => isRecord5(value) ? value : null;
|
|
14487
|
-
var resolveAngularSsrOutDir = () => process.env.ABSOLUTE_ANGULAR_SSR_OUTDIR ??
|
|
14590
|
+
var resolveAngularSsrOutDir = () => process.env.ABSOLUTE_ANGULAR_SSR_OUTDIR ?? join8(tmpdir(), "absolutejs", "generated", "angular-ssr");
|
|
14488
14591
|
var createAngularRuntimeCacheBuster = () => `${Date.now().toString(BASE_36_RADIX)}.${Math.random().toString(BASE_36_RADIX).substring(2, RANDOM_ID_END_INDEX)}`;
|
|
14489
14592
|
var ensureAngularSsrNodeModules = async (outDir) => {
|
|
14490
|
-
const outRoot =
|
|
14491
|
-
const nodeModulesLink =
|
|
14593
|
+
const outRoot = resolve7(dirname5(dirname5(outDir)));
|
|
14594
|
+
const nodeModulesLink = join8(outRoot, "node_modules");
|
|
14492
14595
|
if (process.env.ABSOLUTE_ANGULAR_SSR_OUTDIR) {
|
|
14493
14596
|
return;
|
|
14494
14597
|
}
|
|
14495
|
-
if (nodeModulesLink ===
|
|
14598
|
+
if (nodeModulesLink === resolve7(process.cwd(), "node_modules")) {
|
|
14496
14599
|
return;
|
|
14497
14600
|
}
|
|
14498
14601
|
if (await Bun.file(nodeModulesLink).exists()) {
|
|
14499
14602
|
return;
|
|
14500
14603
|
}
|
|
14501
|
-
await
|
|
14604
|
+
await mkdir3(outRoot, { recursive: true });
|
|
14502
14605
|
try {
|
|
14503
|
-
await symlink(
|
|
14606
|
+
await symlink(resolve7(process.cwd(), "node_modules"), nodeModulesLink, "dir");
|
|
14504
14607
|
} catch (error) {
|
|
14505
14608
|
if (!(error instanceof Error) || !("code" in error) || error.code !== "EEXIST") {
|
|
14506
14609
|
throw error;
|
|
@@ -15040,5 +15143,5 @@ export {
|
|
|
15040
15143
|
ABSOLUTE_HTTP_TRANSFER_CACHE_SKIP_HEADER
|
|
15041
15144
|
};
|
|
15042
15145
|
|
|
15043
|
-
//# debugId=
|
|
15146
|
+
//# debugId=89D3B3ACE7ADB95364756E2164756E21
|
|
15044
15147
|
//# sourceMappingURL=index.js.map
|