@absolutejs/absolute 0.19.0-beta.759 → 0.19.0-beta.760

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.
@@ -3273,11 +3273,11 @@ var readTsconfigPathAliases = () => {
3273
3273
  join5(candidate, "index.jsx")
3274
3274
  ];
3275
3275
  return candidates.find((file) => existsSync5(file));
3276
- }, sourceTreeUsesLegacyAngularAnimations = async (entryPath, rootDir) => {
3276
+ }, createLegacyAngularAnimationUsageResolver = (rootDir) => {
3277
3277
  const baseDir = resolve6(rootDir);
3278
3278
  const tsconfigAliases = readTsconfigPathAliases();
3279
3279
  const transpiler2 = new Bun.Transpiler({ loader: "tsx" });
3280
- const visited = new Set;
3280
+ const scanCache = new Map;
3281
3281
  const resolveLocalImport = (specifier, fromDir) => {
3282
3282
  if (specifier.startsWith(".") || specifier.startsWith("/")) {
3283
3283
  return resolveSourceFile(resolve6(fromDir, specifier));
@@ -3297,7 +3297,40 @@ var readTsconfigPathAliases = () => {
3297
3297
  return;
3298
3298
  }
3299
3299
  };
3300
- const visit = async (filePath) => {
3300
+ const scanFile = (filePath) => {
3301
+ const actualPath = resolveSourceFile(filePath);
3302
+ if (!actualPath) {
3303
+ return Promise.resolve({
3304
+ imports: [],
3305
+ usesLegacyAnimations: false
3306
+ });
3307
+ }
3308
+ const resolved = resolve6(actualPath);
3309
+ const cached = scanCache.get(resolved);
3310
+ if (cached)
3311
+ return cached;
3312
+ const promise = (async () => {
3313
+ let sourceCode;
3314
+ try {
3315
+ sourceCode = await fs.readFile(resolved, "utf-8");
3316
+ } catch {
3317
+ return { imports: [], usesLegacyAnimations: false };
3318
+ }
3319
+ let imports;
3320
+ try {
3321
+ imports = transpiler2.scanImports(sourceCode);
3322
+ } catch {
3323
+ return { imports: [], usesLegacyAnimations: false };
3324
+ }
3325
+ return {
3326
+ imports: imports.map((imp) => imp.path),
3327
+ usesLegacyAnimations: imports.some((imp) => imp.path === "@angular/animations")
3328
+ };
3329
+ })();
3330
+ scanCache.set(resolved, promise);
3331
+ return promise;
3332
+ };
3333
+ const visit = async (filePath, visited = new Set) => {
3301
3334
  const actualPath = resolveSourceFile(filePath);
3302
3335
  if (!actualPath)
3303
3336
  return false;
@@ -3305,30 +3338,18 @@ var readTsconfigPathAliases = () => {
3305
3338
  if (visited.has(resolved))
3306
3339
  return false;
3307
3340
  visited.add(resolved);
3308
- let sourceCode;
3309
- try {
3310
- sourceCode = await fs.readFile(resolved, "utf-8");
3311
- } catch {
3312
- return false;
3313
- }
3314
- let imports;
3315
- try {
3316
- imports = transpiler2.scanImports(sourceCode);
3317
- } catch {
3318
- return false;
3319
- }
3320
- for (const imp of imports) {
3321
- if (imp.path === "@angular/animations")
3322
- return true;
3323
- }
3324
- for (const imp of imports) {
3325
- const importedPath = resolveLocalImport(imp.path, dirname4(resolved));
3326
- if (importedPath && await visit(importedPath))
3341
+ const scan = await scanFile(resolved);
3342
+ if (scan.usesLegacyAnimations)
3343
+ return true;
3344
+ for (const specifier of scan.imports) {
3345
+ const importedPath = resolveLocalImport(specifier, dirname4(resolved));
3346
+ if (importedPath && await visit(importedPath, visited)) {
3327
3347
  return true;
3348
+ }
3328
3349
  }
3329
3350
  return false;
3330
3351
  };
3331
- return visit(entryPath);
3352
+ return (entryPath) => visit(entryPath);
3332
3353
  }, resolveDevClientDir = () => {
3333
3354
  const projectRoot = process.cwd();
3334
3355
  const fromSource = resolve6(import.meta.dir, "../dev/client");
@@ -3982,6 +4003,7 @@ export const __ABSOLUTE_PAGE_USES_LEGACY_ANIMATIONS__ = true;
3982
4003
  const indexesDir = join5(compiledParent, "indexes");
3983
4004
  await fs.mkdir(indexesDir, { recursive: true });
3984
4005
  const aotOutputs = hmr ? [] : await compileAngularFiles(entryPoints.map((entry) => resolve6(entry)), compiledRoot, stylePreprocessors);
4006
+ const usesLegacyAngularAnimations = createLegacyAngularAnimationUsageResolver(outRoot);
3985
4007
  const compileTasks = entryPoints.map(async (entry) => {
3986
4008
  const resolvedEntry = resolve6(entry);
3987
4009
  const relativeEntry = relative3(outRoot, resolvedEntry).replace(/\.[tj]s$/, ".js");
@@ -4033,7 +4055,7 @@ export const __ABSOLUTE_PAGE_USES_LEGACY_ANIMATIONS__ = true;
4033
4055
  return fallback;
4034
4056
  };
4035
4057
  const componentClassName = detectExportedComponentClass(original, `${toPascal(fileBase)}Component`);
4036
- const usesLegacyAnimations = await sourceTreeUsesLegacyAngularAnimations(resolvedEntry, outRoot);
4058
+ const usesLegacyAnimations = await usesLegacyAngularAnimations(resolvedEntry);
4037
4059
  const serverContentHash = Bun.hash(original).toString(BASE_36_RADIX);
4038
4060
  const cachedWrapper = wrapperOutputCache.get(resolvedEntry);
4039
4061
  const clientFile = join5(indexesDir, jsName);
@@ -5454,5 +5476,5 @@ export {
5454
5476
  ABSOLUTE_HTTP_TRANSFER_CACHE_SKIP_HEADER
5455
5477
  };
5456
5478
 
5457
- //# debugId=E05F6DFD53809BC964756E2164756E21
5479
+ //# debugId=840B9580A1CA20FD64756E2164756E21
5458
5480
  //# sourceMappingURL=server.js.map