@absolutejs/absolute 0.19.0-beta.761 → 0.19.0-beta.762

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.
@@ -3230,7 +3230,10 @@ __export(exports_compileAngular, {
3230
3230
  import { existsSync as existsSync5, readFileSync as readFileSync4, promises as fs } from "fs";
3231
3231
  import { join as join5, basename as basename3, sep, dirname as dirname4, resolve as resolve6, relative as relative3 } from "path";
3232
3232
  import ts from "typescript";
3233
- var readTsconfigPathAliases = () => {
3233
+ var traceAngularPhase = async (name, fn, metadata) => {
3234
+ const tracePhase = globalThis.__absoluteBuildTracePhase;
3235
+ return tracePhase ? tracePhase(`compile/angular/${name}`, fn, metadata) : await fn();
3236
+ }, readTsconfigPathAliases = () => {
3234
3237
  try {
3235
3238
  const configPath = resolve6(process.cwd(), "tsconfig.json");
3236
3239
  const config = ts.readConfigFile(configPath, ts.sys.readFile).config;
@@ -3480,18 +3483,20 @@ ${registrations}
3480
3483
  await Promise.all(inputPaths.map((inputPath) => transformFile(inputPath)));
3481
3484
  return transformedSources;
3482
3485
  }, compileAngularFiles = async (inputPaths, outDir, stylePreprocessors) => {
3483
- const islandMetadataByOutputPath = new Map(inputPaths.map((inputPath) => {
3486
+ const islandMetadataByOutputPath = await traceAngularPhase("aot/island-metadata", () => new Map(inputPaths.map((inputPath) => {
3484
3487
  const outputPath = resolve6(join5(outDir, relative3(process.cwd(), resolve6(inputPath)).replace(/\.[cm]?[tj]sx?$/, ".js")));
3485
3488
  return [
3486
3489
  outputPath,
3487
3490
  buildIslandMetadataExports(readFileSync4(inputPath, "utf-8"))
3488
3491
  ];
3489
- }));
3490
- const { readConfiguration, performCompilation, EmitFlags } = await import("@angular/compiler-cli");
3491
- const tsPath = __require.resolve("typescript");
3492
- const tsRootDir = dirname4(tsPath);
3493
- const tsLibDir = tsRootDir.endsWith("lib") ? tsRootDir : resolve6(tsRootDir, "lib");
3494
- const config = readConfiguration("./tsconfig.json");
3492
+ })), { entries: inputPaths.length });
3493
+ const { readConfiguration, performCompilation, EmitFlags } = await traceAngularPhase("aot/import-compiler-cli", () => import("@angular/compiler-cli"));
3494
+ const tsLibDir = await traceAngularPhase("aot/resolve-typescript-lib", () => {
3495
+ const tsPath = __require.resolve("typescript");
3496
+ const tsRootDir = dirname4(tsPath);
3497
+ return tsRootDir.endsWith("lib") ? tsRootDir : resolve6(tsRootDir, "lib");
3498
+ });
3499
+ const config = await traceAngularPhase("aot/read-configuration", () => readConfiguration("./tsconfig.json"));
3495
3500
  const options = {
3496
3501
  emitDecoratorMetadata: true,
3497
3502
  esModuleInterop: true,
@@ -3514,7 +3519,7 @@ ${registrations}
3514
3519
  options.incremental = false;
3515
3520
  options.tsBuildInfoFile = undefined;
3516
3521
  options.rootDir = process.cwd();
3517
- const host = ts.createCompilerHost(options);
3522
+ const host = await traceAngularPhase("aot/create-compiler-host", () => ts.createCompilerHost(options));
3518
3523
  const originalGetDefaultLibLocation = host.getDefaultLibLocation;
3519
3524
  host.getDefaultLibLocation = () => tsLibDir || (originalGetDefaultLibLocation ? originalGetDefaultLibLocation() : "");
3520
3525
  const originalGetDefaultLibFileName = host.getDefaultLibFileName;
@@ -3537,7 +3542,7 @@ ${registrations}
3537
3542
  emitted[relativePath] = text;
3538
3543
  };
3539
3544
  const originalReadFile = host.readFile;
3540
- const aotTransformedSources = await precomputeAotResourceTransforms(inputPaths, originalReadFile?.bind(host), stylePreprocessors);
3545
+ const aotTransformedSources = await traceAngularPhase("aot/precompute-resources", () => precomputeAotResourceTransforms(inputPaths, originalReadFile?.bind(host), stylePreprocessors), { entries: inputPaths.length });
3541
3546
  host.readFile = (fileName) => {
3542
3547
  const source = originalReadFile ? originalReadFile.call(host, fileName) : undefined;
3543
3548
  if (typeof source !== "string")
@@ -3558,42 +3563,46 @@ ${registrations}
3558
3563
  };
3559
3564
  let diagnostics;
3560
3565
  try {
3561
- ({ diagnostics } = performCompilation({
3566
+ ({ diagnostics } = await traceAngularPhase("aot/perform-compilation", () => performCompilation({
3562
3567
  emitFlags: EmitFlags.Default,
3563
3568
  host,
3564
3569
  options,
3565
3570
  rootNames: inputPaths
3566
- }));
3571
+ }), { entries: inputPaths.length }));
3567
3572
  } finally {
3568
3573
  host.readFile = originalReadFile;
3569
3574
  host.getSourceFile = originalGetSourceFileForCompile;
3570
3575
  }
3571
- throwOnCompilationErrors(diagnostics);
3572
- const rawEntries = Object.entries(emitted).filter(([fileName]) => fileName.endsWith(".js")).map(([fileName, content]) => ({
3573
- content,
3574
- target: join5(outDir, fileName)
3575
- }));
3576
- const outputFiles = new Set(rawEntries.map(({ target }) => resolve6(target)));
3577
- const entries = rawEntries.map(({ content, target }) => {
3578
- let processedContent = content.replace(/from\s+(['"])(\.\.?\/[^'"]+)(\1)/g, (match, quote, path) => {
3579
- const rewritten = rewriteRelativeJsSpecifier(target, path, outputFiles);
3580
- if (rewritten !== path) {
3581
- return `from ${quote}${rewritten}${quote}`;
3582
- }
3583
- return match;
3584
- });
3585
- processedContent = processedContent.replace(/\u0275\u0275domElementStart/g, "\u0275\u0275elementStart").replace(/\u0275\u0275domElementEnd/g, "\u0275\u0275elementEnd").replace(/\u0275\u0275domElement\(/g, "\u0275\u0275element(").replace(/\u0275\u0275domProperty/g, "\u0275\u0275property").replace(/\u0275\u0275domListener/g, "\u0275\u0275listener");
3586
- processedContent = processedContent.replace(/import\s*{\s*([^}]*)\bInjectFlags\b([^}]*)\s*}\s*from\s*['"]@angular\/core['"]/g, (match, before, after) => {
3587
- const cleaned = (before + after).replace(/,\s*,/g, ",").replace(/^\s*,\s*/, "").replace(/,\s*$/, "");
3588
- return cleaned ? `import { ${cleaned}, InternalInjectFlags } from '@angular/core'` : `import { InternalInjectFlags } from '@angular/core'`;
3576
+ await traceAngularPhase("aot/check-diagnostics", () => throwOnCompilationErrors(diagnostics));
3577
+ const entries = await traceAngularPhase("aot/postprocess-emitted-js", () => {
3578
+ const rawEntries = Object.entries(emitted).filter(([fileName]) => fileName.endsWith(".js")).map(([fileName, content]) => ({
3579
+ content,
3580
+ target: join5(outDir, fileName)
3581
+ }));
3582
+ const outputFiles = new Set(rawEntries.map(({ target }) => resolve6(target)));
3583
+ return rawEntries.map(({ content, target }) => {
3584
+ let processedContent = content.replace(/from\s+(['"])(\.\.?\/[^'"]+)(\1)/g, (match, quote, path) => {
3585
+ const rewritten = rewriteRelativeJsSpecifier(target, path, outputFiles);
3586
+ if (rewritten !== path) {
3587
+ return `from ${quote}${rewritten}${quote}`;
3588
+ }
3589
+ return match;
3590
+ });
3591
+ processedContent = processedContent.replace(/\u0275\u0275domElementStart/g, "\u0275\u0275elementStart").replace(/\u0275\u0275domElementEnd/g, "\u0275\u0275elementEnd").replace(/\u0275\u0275domElement\(/g, "\u0275\u0275element(").replace(/\u0275\u0275domProperty/g, "\u0275\u0275property").replace(/\u0275\u0275domListener/g, "\u0275\u0275listener");
3592
+ processedContent = processedContent.replace(/import\s*{\s*([^}]*)\bInjectFlags\b([^}]*)\s*}\s*from\s*['"]@angular\/core['"]/g, (match, before, after) => {
3593
+ const cleaned = (before + after).replace(/,\s*,/g, ",").replace(/^\s*,\s*/, "").replace(/,\s*$/, "");
3594
+ return cleaned ? `import { ${cleaned}, InternalInjectFlags } from '@angular/core'` : `import { InternalInjectFlags } from '@angular/core'`;
3595
+ });
3596
+ processedContent = processedContent.replace(/\b(?<!Internal)InjectFlags\b/g, "InternalInjectFlags");
3597
+ processedContent += islandMetadataByOutputPath.get(resolve6(target)) ?? "";
3598
+ return { content: processedContent, target };
3589
3599
  });
3590
- processedContent = processedContent.replace(/\b(?<!Internal)InjectFlags\b/g, "InternalInjectFlags");
3591
- processedContent += islandMetadataByOutputPath.get(resolve6(target)) ?? "";
3592
- return { content: processedContent, target };
3593
3600
  });
3594
- await Promise.all(entries.map(({ target }) => fs.mkdir(dirname4(target), { recursive: true })));
3595
- await Promise.all(entries.map(({ target, content }) => fs.writeFile(target, content, "utf-8")));
3596
- return entries.map(({ target }) => target);
3601
+ await traceAngularPhase("aot/write-output", () => Promise.all(entries.map(async ({ target, content }) => {
3602
+ await fs.mkdir(dirname4(target), { recursive: true });
3603
+ await fs.writeFile(target, content, "utf-8");
3604
+ })), { outputs: entries.length });
3605
+ return await traceAngularPhase("aot/collect-output-paths", () => entries.map(({ target }) => target), { outputs: entries.length });
3597
3606
  }, compileAngularFile = async (inputPath, outDir, stylePreprocessors) => compileAngularFiles([inputPath], outDir, stylePreprocessors), jitContentCache, wrapperOutputCache, escapeTemplateContent = (content) => content.replace(/\\/g, "\\\\").replace(/`/g, "\\`").replace(/\$\{/g, "\\${"), findUncommentedMatch = (source, pattern) => {
3598
3607
  const re = new RegExp(pattern.source, pattern.flags.includes("g") ? pattern.flags : pattern.flags + "g");
3599
3608
  let match;
@@ -3682,31 +3691,31 @@ ${importLine}${source.slice(insertAt)}`;
3682
3691
  }
3683
3692
  return parts.join("");
3684
3693
  }, buildDeferSlotTemplateResolver = () => ` __absoluteDeferTemplateExpressionCache = new Map<string, string>();
3685
- __absoluteDeferResolveTemplateExpression(expression: string) {
3686
- const cached = this.__absoluteDeferTemplateExpressionCache.get(expression);
3687
- if (cached !== undefined) return cached;
3688
-
3689
- const scope = new Proxy(this, {
3690
- get: (_target, property) => {
3691
- const value = (this as Record<PropertyKey, unknown>)[property];
3692
- return typeof value === "function" ? value.bind(this) : value;
3693
- }
3694
- });
3695
- let value = '';
3696
- try {
3697
- const evaluate = new Function(
3698
- 'scope',
3699
- "with (scope) { return (" + expression + "); }"
3700
- );
3701
-
3702
- const resolvedValue = evaluate(scope);
3703
- value = resolvedValue == null ? '' : String(resolvedValue);
3704
- } catch (_error) {
3705
- value = '';
3706
- }
3707
- this.__absoluteDeferTemplateExpressionCache.set(expression, value);
3708
- return value;
3709
- }
3694
+ ` + ` __absoluteDeferResolveTemplateExpression(expression: string) {
3695
+ ` + ` const cached = this.__absoluteDeferTemplateExpressionCache.get(expression);
3696
+ ` + ` if (cached !== undefined) return cached;
3697
+ ` + `
3698
+ ` + ` const scope = new Proxy(this, {
3699
+ ` + ` get: (_target, property) => {
3700
+ ` + ` const value = (this as Record<PropertyKey, unknown>)[property];
3701
+ ` + ` return typeof value === "function" ? value.bind(this) : value;
3702
+ ` + ` }
3703
+ ` + ` });
3704
+ ` + ` let value = '';
3705
+ ` + ` try {
3706
+ ` + ` const evaluate = new Function(
3707
+ ` + ` 'scope',
3708
+ ` + ` "with (scope) { return (" + expression + "); }"
3709
+ ` + ` );
3710
+ ` + `
3711
+ ` + ` const resolvedValue = evaluate(scope);
3712
+ ` + ` value = resolvedValue == null ? '' : String(resolvedValue);
3713
+ ` + ` } catch (_error) {
3714
+ ` + ` value = '';
3715
+ ` + ` }
3716
+ ` + ` this.__absoluteDeferTemplateExpressionCache.set(expression, value);
3717
+ ` + ` return value;
3718
+ ` + ` }
3710
3719
 
3711
3720
  `, buildDeferSlotFields = (slots) => [
3712
3721
  buildDeferSlotTemplateResolver(),
@@ -3720,8 +3729,8 @@ ${slot.resolvedBindings.map((binding) => ` "${binding.key}": this.__absoluteDef
3720
3729
  ` : ` __absoluteDeferData${index} = () => ({});
3721
3730
  `;
3722
3731
  return `${htmlField + dataField} __absoluteDeferResolvePayload${index} = () => new Promise<any>((resolve) => {
3723
- setTimeout(() => resolve({ kind: 'angular-defer', state: 'resolved', html: this.__absoluteDeferHtml${index}(), data: this.__absoluteDeferData${index}() }), ${slot.delayMs});
3724
- });
3732
+ ` + ` setTimeout(() => resolve({ kind: 'angular-defer', state: 'resolved', html: this.__absoluteDeferHtml${index}(), data: this.__absoluteDeferData${index}() }), ${slot.delayMs});
3733
+ ` + ` });
3725
3734
  `;
3726
3735
  })
3727
3736
  ].join(`
@@ -4001,14 +4010,16 @@ export const __ABSOLUTE_PAGE_USES_LEGACY_ANIMATIONS__ = true;
4001
4010
  }
4002
4011
  const compiledRoot = compiledParent;
4003
4012
  const indexesDir = join5(compiledParent, "indexes");
4004
- await fs.mkdir(indexesDir, { recursive: true });
4005
- const aotOutputs = hmr ? [] : await compileAngularFiles(entryPoints.map((entry) => resolve6(entry)), compiledRoot, stylePreprocessors);
4006
- const usesLegacyAngularAnimations = createLegacyAngularAnimationUsageResolver(outRoot);
4013
+ await traceAngularPhase("setup/create-indexes-dir", () => fs.mkdir(indexesDir, { recursive: true }));
4014
+ const aotOutputs = hmr ? [] : await traceAngularPhase("aot/compile-files", () => compileAngularFiles(entryPoints.map((entry) => resolve6(entry)), compiledRoot, stylePreprocessors), { entries: entryPoints.length });
4015
+ const usesLegacyAngularAnimations = await traceAngularPhase("setup/legacy-animation-resolver", () => createLegacyAngularAnimationUsageResolver(outRoot));
4007
4016
  const compileTasks = entryPoints.map(async (entry) => {
4008
4017
  const resolvedEntry = resolve6(entry);
4009
4018
  const relativeEntry = relative3(outRoot, resolvedEntry).replace(/\.[tj]s$/, ".js");
4010
4019
  const compileEntry = () => compileAngularFileJIT(resolvedEntry, compiledRoot, outRoot, stylePreprocessors);
4011
- let outputs = hmr ? await compileEntry() : aotOutputs;
4020
+ let outputs = hmr ? await traceAngularPhase("jit/compile-entry", compileEntry, {
4021
+ entry: resolvedEntry
4022
+ }) : aotOutputs;
4012
4023
  const fileBase = basename3(resolvedEntry).replace(/\.[tj]s$/, "");
4013
4024
  const jsName = `${fileBase}.js`;
4014
4025
  const compiledFallbackPaths = [
@@ -4030,13 +4041,13 @@ export const __ABSOLUTE_PAGE_USES_LEGACY_ANIMATIONS__ = true;
4030
4041
  }
4031
4042
  return candidate;
4032
4043
  };
4033
- let rawServerFile = resolveRawServerFile(outputs);
4044
+ let rawServerFile = await traceAngularPhase("wrapper/resolve-server-output", () => resolveRawServerFile(outputs), { entry: resolvedEntry });
4034
4045
  if (!rawServerFile) {
4035
- rawServerFile = resolveRawServerFile([]);
4046
+ rawServerFile = await traceAngularPhase("wrapper/resolve-server-output-fallback", () => resolveRawServerFile([]), { entry: resolvedEntry });
4036
4047
  }
4037
4048
  if (rawServerFile && !existsSync5(rawServerFile)) {
4038
4049
  outputs = hmr ? await compileEntry() : aotOutputs;
4039
- rawServerFile = resolveRawServerFile(outputs);
4050
+ rawServerFile = await traceAngularPhase("wrapper/resolve-server-output-retry", () => resolveRawServerFile(outputs), { entry: resolvedEntry });
4040
4051
  }
4041
4052
  if (!rawServerFile || !existsSync5(rawServerFile)) {
4042
4053
  throw new Error(`Compiled output not found for ${entry}. Looking for: ${jsName}. Available: ${[
@@ -4044,7 +4055,7 @@ export const __ABSOLUTE_PAGE_USES_LEGACY_ANIMATIONS__ = true;
4044
4055
  ...compiledFallbackPaths
4045
4056
  ].join(", ")}`);
4046
4057
  }
4047
- const original = await fs.readFile(rawServerFile, "utf-8");
4058
+ const original = await traceAngularPhase("wrapper/read-server-output", () => fs.readFile(rawServerFile, "utf-8"), { entry: resolvedEntry });
4048
4059
  const detectExportedComponentClass = (source, fallback) => {
4049
4060
  const defaultMatch = source.match(/export\s+default\s+([A-Za-z_$][\w$]*)\s*;/);
4050
4061
  if (defaultMatch)
@@ -4054,8 +4065,8 @@ export const __ABSOLUTE_PAGE_USES_LEGACY_ANIMATIONS__ = true;
4054
4065
  return exportClassMatch[1];
4055
4066
  return fallback;
4056
4067
  };
4057
- const componentClassName = detectExportedComponentClass(original, `${toPascal(fileBase)}Component`);
4058
- const usesLegacyAnimations = await usesLegacyAngularAnimations(resolvedEntry);
4068
+ const componentClassName = await traceAngularPhase("wrapper/detect-component-class", () => detectExportedComponentClass(original, `${toPascal(fileBase)}Component`), { entry: resolvedEntry });
4069
+ const usesLegacyAnimations = await traceAngularPhase("wrapper/detect-legacy-animations", () => usesLegacyAngularAnimations(resolvedEntry), { entry: resolvedEntry });
4059
4070
  const serverContentHash = Bun.hash(original).toString(BASE_36_RADIX);
4060
4071
  const cachedWrapper = wrapperOutputCache.get(resolvedEntry);
4061
4072
  const clientFile = join5(indexesDir, jsName);
@@ -4099,7 +4110,7 @@ export const __ABSOLUTE_PAGE_USES_LEGACY_ANIMATIONS__ = true;
4099
4110
  `);
4100
4111
  await fs.writeFile(ssrDepsFile, ssrDepsContent, "utf-8");
4101
4112
  }
4102
- await fs.writeFile(rawServerFile, rewritten, "utf-8");
4113
+ await traceAngularPhase("wrapper/write-server-output", () => fs.writeFile(rawServerFile, rewritten, "utf-8"), { entry: resolvedEntry });
4103
4114
  const relativePath = relative3(indexesDir, rawServerFile).replace(/\\/g, "/");
4104
4115
  const normalizedImportPath = relativePath.startsWith(".") ? relativePath : `./${relativePath}`;
4105
4116
  const hmrPreamble = hmr ? `window.__HMR_FRAMEWORK__ = "angular";
@@ -4278,7 +4289,7 @@ if (pageHasRawStreamingSlots) {
4278
4289
  `.trim();
4279
4290
  const indexHash = Bun.hash(hydration).toString(BASE_36_RADIX);
4280
4291
  const indexUnchanged = cachedWrapper?.indexHash === indexHash;
4281
- await fs.writeFile(clientFile, hydration, "utf-8");
4292
+ await traceAngularPhase("wrapper/write-client-index", () => fs.writeFile(clientFile, hydration, "utf-8"), { entry: resolvedEntry });
4282
4293
  wrapperOutputCache.set(resolvedEntry, {
4283
4294
  indexHash,
4284
4295
  serverHash: serverContentHash
@@ -4289,9 +4300,11 @@ if (pageHasRawStreamingSlots) {
4289
4300
  serverPath: rawServerFile
4290
4301
  };
4291
4302
  });
4292
- const results = await Promise.all(compileTasks);
4293
- const serverPaths = results.map((r) => r.serverPath);
4294
- const clientPaths = results.map((r) => r.clientPath);
4303
+ const results = await traceAngularPhase("wrapper/process-entries", () => Promise.all(compileTasks), { entries: entryPoints.length });
4304
+ const { clientPaths, serverPaths } = await traceAngularPhase("wrapper/collect-paths", () => ({
4305
+ clientPaths: results.map((r) => r.clientPath),
4306
+ serverPaths: results.map((r) => r.serverPath)
4307
+ }), { entries: results.length });
4295
4308
  return {
4296
4309
  allIndexesUnchanged: hmr && results.every((r) => r.indexUnchanged),
4297
4310
  clientPaths,
@@ -5476,5 +5489,5 @@ export {
5476
5489
  ABSOLUTE_HTTP_TRANSFER_CACHE_SKIP_HEADER
5477
5490
  };
5478
5491
 
5479
- //# debugId=840B9580A1CA20FD64756E2164756E21
5492
+ //# debugId=E1A93A2992AB9D4564756E2164756E21
5480
5493
  //# sourceMappingURL=server.js.map