@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/index.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
|
});
|
|
@@ -5345,7 +5242,7 @@ var require_Observable = __commonJS((exports) => {
|
|
|
5345
5242
|
Observable2.prototype.forEach = function(next, promiseCtor) {
|
|
5346
5243
|
var _this = this;
|
|
5347
5244
|
promiseCtor = getPromiseCtor(promiseCtor);
|
|
5348
|
-
return new promiseCtor(function(
|
|
5245
|
+
return new promiseCtor(function(resolve7, reject) {
|
|
5349
5246
|
var subscriber = new Subscriber_1.SafeSubscriber({
|
|
5350
5247
|
next: function(value) {
|
|
5351
5248
|
try {
|
|
@@ -5356,7 +5253,7 @@ var require_Observable = __commonJS((exports) => {
|
|
|
5356
5253
|
}
|
|
5357
5254
|
},
|
|
5358
5255
|
error: reject,
|
|
5359
|
-
complete:
|
|
5256
|
+
complete: resolve7
|
|
5360
5257
|
});
|
|
5361
5258
|
_this.subscribe(subscriber);
|
|
5362
5259
|
});
|
|
@@ -5378,14 +5275,14 @@ var require_Observable = __commonJS((exports) => {
|
|
|
5378
5275
|
Observable2.prototype.toPromise = function(promiseCtor) {
|
|
5379
5276
|
var _this = this;
|
|
5380
5277
|
promiseCtor = getPromiseCtor(promiseCtor);
|
|
5381
|
-
return new promiseCtor(function(
|
|
5278
|
+
return new promiseCtor(function(resolve7, reject) {
|
|
5382
5279
|
var value;
|
|
5383
5280
|
_this.subscribe(function(x) {
|
|
5384
5281
|
return value = x;
|
|
5385
5282
|
}, function(err) {
|
|
5386
5283
|
return reject(err);
|
|
5387
5284
|
}, function() {
|
|
5388
|
-
return
|
|
5285
|
+
return resolve7(value);
|
|
5389
5286
|
});
|
|
5390
5287
|
});
|
|
5391
5288
|
};
|
|
@@ -7413,11 +7310,11 @@ var require_isReadableStreamLike = __commonJS((exports) => {
|
|
|
7413
7310
|
var require_innerFrom = __commonJS((exports) => {
|
|
7414
7311
|
var __awaiter = exports && exports.__awaiter || function(thisArg, _arguments, P, generator) {
|
|
7415
7312
|
function adopt(value) {
|
|
7416
|
-
return value instanceof P ? value : new P(function(
|
|
7417
|
-
|
|
7313
|
+
return value instanceof P ? value : new P(function(resolve7) {
|
|
7314
|
+
resolve7(value);
|
|
7418
7315
|
});
|
|
7419
7316
|
}
|
|
7420
|
-
return new (P || (P = Promise))(function(
|
|
7317
|
+
return new (P || (P = Promise))(function(resolve7, reject) {
|
|
7421
7318
|
function fulfilled(value) {
|
|
7422
7319
|
try {
|
|
7423
7320
|
step(generator.next(value));
|
|
@@ -7433,7 +7330,7 @@ var require_innerFrom = __commonJS((exports) => {
|
|
|
7433
7330
|
}
|
|
7434
7331
|
}
|
|
7435
7332
|
function step(result) {
|
|
7436
|
-
result.done ?
|
|
7333
|
+
result.done ? resolve7(result.value) : adopt(result.value).then(fulfilled, rejected);
|
|
7437
7334
|
}
|
|
7438
7335
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
7439
7336
|
});
|
|
@@ -7523,14 +7420,14 @@ var require_innerFrom = __commonJS((exports) => {
|
|
|
7523
7420
|
}, i);
|
|
7524
7421
|
function verb(n) {
|
|
7525
7422
|
i[n] = o[n] && function(v) {
|
|
7526
|
-
return new Promise(function(
|
|
7527
|
-
v = o[n](v), settle(
|
|
7423
|
+
return new Promise(function(resolve7, reject) {
|
|
7424
|
+
v = o[n](v), settle(resolve7, reject, v.done, v.value);
|
|
7528
7425
|
});
|
|
7529
7426
|
};
|
|
7530
7427
|
}
|
|
7531
|
-
function settle(
|
|
7428
|
+
function settle(resolve7, reject, d, v) {
|
|
7532
7429
|
Promise.resolve(v).then(function(v2) {
|
|
7533
|
-
|
|
7430
|
+
resolve7({ value: v2, done: d });
|
|
7534
7431
|
}, reject);
|
|
7535
7432
|
}
|
|
7536
7433
|
};
|
|
@@ -8106,7 +8003,7 @@ var require_lastValueFrom = __commonJS((exports) => {
|
|
|
8106
8003
|
var EmptyError_1 = require_EmptyError();
|
|
8107
8004
|
function lastValueFrom(source, config) {
|
|
8108
8005
|
var hasConfig = typeof config === "object";
|
|
8109
|
-
return new Promise(function(
|
|
8006
|
+
return new Promise(function(resolve7, reject) {
|
|
8110
8007
|
var _hasValue = false;
|
|
8111
8008
|
var _value;
|
|
8112
8009
|
source.subscribe({
|
|
@@ -8117,9 +8014,9 @@ var require_lastValueFrom = __commonJS((exports) => {
|
|
|
8117
8014
|
error: reject,
|
|
8118
8015
|
complete: function() {
|
|
8119
8016
|
if (_hasValue) {
|
|
8120
|
-
|
|
8017
|
+
resolve7(_value);
|
|
8121
8018
|
} else if (hasConfig) {
|
|
8122
|
-
|
|
8019
|
+
resolve7(config.defaultValue);
|
|
8123
8020
|
} else {
|
|
8124
8021
|
reject(new EmptyError_1.EmptyError);
|
|
8125
8022
|
}
|
|
@@ -8138,16 +8035,16 @@ var require_firstValueFrom = __commonJS((exports) => {
|
|
|
8138
8035
|
var Subscriber_1 = require_Subscriber();
|
|
8139
8036
|
function firstValueFrom(source, config) {
|
|
8140
8037
|
var hasConfig = typeof config === "object";
|
|
8141
|
-
return new Promise(function(
|
|
8038
|
+
return new Promise(function(resolve7, reject) {
|
|
8142
8039
|
var subscriber = new Subscriber_1.SafeSubscriber({
|
|
8143
8040
|
next: function(value) {
|
|
8144
|
-
|
|
8041
|
+
resolve7(value);
|
|
8145
8042
|
subscriber.unsubscribe();
|
|
8146
8043
|
},
|
|
8147
8044
|
error: reject,
|
|
8148
8045
|
complete: function() {
|
|
8149
8046
|
if (hasConfig) {
|
|
8150
|
-
|
|
8047
|
+
resolve7(config.defaultValue);
|
|
8151
8048
|
} else {
|
|
8152
8049
|
reject(new EmptyError_1.EmptyError);
|
|
8153
8050
|
}
|
|
@@ -13765,9 +13662,9 @@ var provideDeterministicEnv = (options = {}) => {
|
|
|
13765
13662
|
// src/angular/pageHandler.ts
|
|
13766
13663
|
init_constants();
|
|
13767
13664
|
import { AsyncLocalStorage as AsyncLocalStorage3 } from "async_hooks";
|
|
13768
|
-
import { mkdir as
|
|
13665
|
+
import { mkdir as mkdir2, symlink } from "fs/promises";
|
|
13769
13666
|
import { tmpdir } from "os";
|
|
13770
|
-
import { basename as basename4, dirname as
|
|
13667
|
+
import { basename as basename4, dirname as dirname4, join as join7, resolve as resolve6 } from "path";
|
|
13771
13668
|
import { pathToFileURL } from "url";
|
|
13772
13669
|
|
|
13773
13670
|
// src/core/islandPageContext.ts
|
|
@@ -14587,23 +14484,23 @@ var ensureAngularCompiler = () => {
|
|
|
14587
14484
|
return compilerImportPromise;
|
|
14588
14485
|
};
|
|
14589
14486
|
var readAngularPageModule = (value) => isRecord5(value) ? value : null;
|
|
14590
|
-
var resolveAngularSsrOutDir = () => process.env.ABSOLUTE_ANGULAR_SSR_OUTDIR ??
|
|
14487
|
+
var resolveAngularSsrOutDir = () => process.env.ABSOLUTE_ANGULAR_SSR_OUTDIR ?? join7(tmpdir(), "absolutejs", "generated", "angular-ssr");
|
|
14591
14488
|
var createAngularRuntimeCacheBuster = () => `${Date.now().toString(BASE_36_RADIX)}.${Math.random().toString(BASE_36_RADIX).substring(2, RANDOM_ID_END_INDEX)}`;
|
|
14592
14489
|
var ensureAngularSsrNodeModules = async (outDir) => {
|
|
14593
|
-
const outRoot =
|
|
14594
|
-
const nodeModulesLink =
|
|
14490
|
+
const outRoot = resolve6(dirname4(dirname4(outDir)));
|
|
14491
|
+
const nodeModulesLink = join7(outRoot, "node_modules");
|
|
14595
14492
|
if (process.env.ABSOLUTE_ANGULAR_SSR_OUTDIR) {
|
|
14596
14493
|
return;
|
|
14597
14494
|
}
|
|
14598
|
-
if (nodeModulesLink ===
|
|
14495
|
+
if (nodeModulesLink === resolve6(process.cwd(), "node_modules")) {
|
|
14599
14496
|
return;
|
|
14600
14497
|
}
|
|
14601
14498
|
if (await Bun.file(nodeModulesLink).exists()) {
|
|
14602
14499
|
return;
|
|
14603
14500
|
}
|
|
14604
|
-
await
|
|
14501
|
+
await mkdir2(outRoot, { recursive: true });
|
|
14605
14502
|
try {
|
|
14606
|
-
await symlink(
|
|
14503
|
+
await symlink(resolve6(process.cwd(), "node_modules"), nodeModulesLink, "dir");
|
|
14607
14504
|
} catch (error) {
|
|
14608
14505
|
if (!(error instanceof Error) || !("code" in error) || error.code !== "EEXIST") {
|
|
14609
14506
|
throw error;
|
|
@@ -15143,5 +15040,5 @@ export {
|
|
|
15143
15040
|
ABSOLUTE_HTTP_TRANSFER_CACHE_SKIP_HEADER
|
|
15144
15041
|
};
|
|
15145
15042
|
|
|
15146
|
-
//# debugId=
|
|
15043
|
+
//# debugId=57CD1AC1802A85CD64756E2164756E21
|
|
15147
15044
|
//# sourceMappingURL=index.js.map
|