@absolutejs/absolute 0.19.0-beta.742 → 0.19.0-beta.743

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/index.js CHANGED
@@ -1063,13 +1063,19 @@ var initDominoAdapter = (platformServer) => {
1063
1063
  APP_BASE_HREF: common.APP_BASE_HREF,
1064
1064
  bootstrapApplication: platformBrowser.bootstrapApplication,
1065
1065
  DomSanitizer: platformBrowser.DomSanitizer,
1066
+ ENVIRONMENT_INITIALIZER: core.ENVIRONMENT_INITIALIZER,
1067
+ inject: core.inject,
1066
1068
  provideClientHydration: platformBrowser.provideClientHydration,
1067
1069
  provideServerRendering: platformServer.provideServerRendering,
1068
1070
  provideZonelessChangeDetection: core.provideZonelessChangeDetection,
1069
1071
  reflectComponentType: core.reflectComponentType,
1070
1072
  renderApplication: platformServer.renderApplication,
1073
+ REQUEST: core.REQUEST,
1074
+ REQUEST_CONTEXT: core.REQUEST_CONTEXT,
1075
+ RESPONSE_INIT: core.RESPONSE_INIT,
1071
1076
  Sanitizer: core.Sanitizer,
1072
- SecurityContext: core.SecurityContext
1077
+ SecurityContext: core.SecurityContext,
1078
+ withHttpTransferCacheOptions: platformBrowser.withHttpTransferCacheOptions
1073
1079
  };
1074
1080
  }, angularDeps = null, getAngularDeps = () => {
1075
1081
  if (!angularDeps) {
@@ -1169,6 +1175,30 @@ var init_registerClientScript = __esm(() => {
1169
1175
  }
1170
1176
  });
1171
1177
 
1178
+ // src/angular/httpTransferCache.ts
1179
+ var ABSOLUTE_HTTP_TRANSFER_CACHE_SKIP_HEADER = "x-skip-transfer-cache", buildAbsoluteHttpTransferCacheOptions = (options = {}) => {
1180
+ const {
1181
+ filter: userFilter,
1182
+ skipHeader = ABSOLUTE_HTTP_TRANSFER_CACHE_SKIP_HEADER,
1183
+ ...angularOptions
1184
+ } = options;
1185
+ return {
1186
+ includePostRequests: false,
1187
+ includeRequestsWithAuthHeaders: false,
1188
+ ...angularOptions,
1189
+ filter: (request) => !request.headers.has(skipHeader) && (userFilter?.(request) ?? true)
1190
+ };
1191
+ };
1192
+
1193
+ // src/angular/requestProviders.ts
1194
+ import { REQUEST, REQUEST_CONTEXT, RESPONSE_INIT } from "@angular/core";
1195
+ var buildRequestProviders = (deps, request, requestContext, responseInit) => [
1196
+ { provide: deps.REQUEST, useValue: request ?? null },
1197
+ { provide: deps.REQUEST_CONTEXT, useValue: requestContext ?? null },
1198
+ { provide: deps.RESPONSE_INIT, useValue: responseInit ?? null }
1199
+ ];
1200
+ var init_requestProviders = () => {};
1201
+
1172
1202
  // src/angular/ssrRender.ts
1173
1203
  var routePropsCache, cacheRouteData = (pagePath, data) => {
1174
1204
  const cacheKey = pagePath.split("?")[0] ?? pagePath;
@@ -1182,18 +1212,24 @@ var routePropsCache, cacheRouteData = (pagePath, data) => {
1182
1212
  APP_BASE_HREF: common?.APP_BASE_HREF ?? baseDeps.APP_BASE_HREF,
1183
1213
  bootstrapApplication: platformBrowser?.bootstrapApplication ?? baseDeps.bootstrapApplication,
1184
1214
  DomSanitizer: platformBrowser?.DomSanitizer ?? baseDeps.DomSanitizer,
1215
+ ENVIRONMENT_INITIALIZER: core.ENVIRONMENT_INITIALIZER ?? baseDeps.ENVIRONMENT_INITIALIZER,
1216
+ inject: core.inject ?? baseDeps.inject,
1185
1217
  provideClientHydration: platformBrowser?.provideClientHydration ?? baseDeps.provideClientHydration,
1186
1218
  provideServerRendering: platformServer?.provideServerRendering ?? baseDeps.provideServerRendering,
1187
1219
  provideZonelessChangeDetection: core.provideZonelessChangeDetection,
1188
1220
  reflectComponentType: core.reflectComponentType,
1189
1221
  renderApplication: platformServer?.renderApplication ?? baseDeps.renderApplication,
1222
+ REQUEST: core.REQUEST ?? baseDeps.REQUEST,
1223
+ REQUEST_CONTEXT: core.REQUEST_CONTEXT ?? baseDeps.REQUEST_CONTEXT,
1224
+ RESPONSE_INIT: core.RESPONSE_INIT ?? baseDeps.RESPONSE_INIT,
1190
1225
  Sanitizer: core.Sanitizer,
1191
- SecurityContext: core.SecurityContext
1226
+ SecurityContext: core.SecurityContext,
1227
+ withHttpTransferCacheOptions: platformBrowser?.withHttpTransferCacheOptions ?? baseDeps.withHttpTransferCacheOptions
1192
1228
  };
1193
- }, buildProviders = (deps, sanitizer, maybeProps, tokenMap, userProviders = []) => {
1229
+ }, buildProviders = (deps, sanitizer, maybeProps, tokenMap, request, requestContext, responseInit, userProviders = []) => {
1194
1230
  const providers = [
1195
1231
  deps.provideServerRendering(),
1196
- deps.provideClientHydration(),
1232
+ deps.provideClientHydration(deps.withHttpTransferCacheOptions(buildAbsoluteHttpTransferCacheOptions())),
1197
1233
  deps.provideZonelessChangeDetection(),
1198
1234
  { provide: deps.APP_BASE_HREF, useValue: "/" },
1199
1235
  {
@@ -1201,6 +1237,7 @@ var routePropsCache, cacheRouteData = (pagePath, data) => {
1201
1237
  useValue: sanitizer
1202
1238
  },
1203
1239
  { provide: deps.Sanitizer, useValue: sanitizer },
1240
+ ...buildRequestProviders(deps, request, requestContext, responseInit),
1204
1241
  ...userProviders
1205
1242
  ];
1206
1243
  if (!maybeProps) {
@@ -1283,6 +1320,7 @@ var routePropsCache, cacheRouteData = (pagePath, data) => {
1283
1320
  };
1284
1321
  var init_ssrRender = __esm(() => {
1285
1322
  init_registerClientScript();
1323
+ init_requestProviders();
1286
1324
  routePropsCache = new Map;
1287
1325
  selectorCache = new Map;
1288
1326
  });
@@ -43698,6 +43736,74 @@ var computeConfigHash = () => {
43698
43736
  }
43699
43737
  }
43700
43738
  return;
43739
+ }, resolveSourceFile = (candidate) => {
43740
+ const candidates = candidate.match(/\.[cm]?[tj]sx?$/) ? [candidate] : [
43741
+ `${candidate}.ts`,
43742
+ `${candidate}.tsx`,
43743
+ `${candidate}.js`,
43744
+ `${candidate}.jsx`,
43745
+ join15(candidate, "index.ts"),
43746
+ join15(candidate, "index.tsx"),
43747
+ join15(candidate, "index.js"),
43748
+ join15(candidate, "index.jsx")
43749
+ ];
43750
+ return candidates.find((file4) => existsSync16(file4));
43751
+ }, sourceTreeUsesLegacyAngularAnimations = async (entryPath, rootDir) => {
43752
+ const baseDir = resolve19(rootDir);
43753
+ const tsconfigAliases = readTsconfigPathAliases();
43754
+ const transpiler4 = new Bun.Transpiler({ loader: "tsx" });
43755
+ const visited = new Set;
43756
+ const resolveLocalImport = (specifier, fromDir) => {
43757
+ if (specifier.startsWith(".") || specifier.startsWith("/")) {
43758
+ return resolveSourceFile(resolve19(fromDir, specifier));
43759
+ }
43760
+ const aliased = matchTsconfigAlias(specifier, tsconfigAliases.aliases, tsconfigAliases.baseUrl, resolveSourceFile);
43761
+ if (aliased)
43762
+ return aliased;
43763
+ try {
43764
+ const resolved = Bun.resolveSync(specifier, fromDir);
43765
+ if (resolved.includes("/node_modules/"))
43766
+ return;
43767
+ const absolute = resolve19(resolved);
43768
+ if (!absolute.startsWith(baseDir))
43769
+ return;
43770
+ return resolveSourceFile(absolute);
43771
+ } catch {
43772
+ return;
43773
+ }
43774
+ };
43775
+ const visit = async (filePath) => {
43776
+ const actualPath = resolveSourceFile(filePath);
43777
+ if (!actualPath)
43778
+ return false;
43779
+ const resolved = resolve19(actualPath);
43780
+ if (visited.has(resolved))
43781
+ return false;
43782
+ visited.add(resolved);
43783
+ let sourceCode;
43784
+ try {
43785
+ sourceCode = await fs2.readFile(resolved, "utf-8");
43786
+ } catch {
43787
+ return false;
43788
+ }
43789
+ let imports;
43790
+ try {
43791
+ imports = transpiler4.scanImports(sourceCode);
43792
+ } catch {
43793
+ return false;
43794
+ }
43795
+ for (const imp of imports) {
43796
+ if (imp.path === "@angular/animations")
43797
+ return true;
43798
+ }
43799
+ for (const imp of imports) {
43800
+ const importedPath = resolveLocalImport(imp.path, dirname11(resolved));
43801
+ if (importedPath && await visit(importedPath))
43802
+ return true;
43803
+ }
43804
+ return false;
43805
+ };
43806
+ return visit(entryPath);
43701
43807
  }, resolveDevClientDir4 = () => {
43702
43808
  const projectRoot = process.cwd();
43703
43809
  const fromSource = resolve19(import.meta.dir, "../dev/client");
@@ -44179,6 +44285,7 @@ ${fields}
44179
44285
  const allOutputs = [];
44180
44286
  const visited = new Set;
44181
44287
  const baseDir = resolve19(rootDir ?? process.cwd());
44288
+ let usesLegacyAnimations = false;
44182
44289
  const angularTranspiler = new Bun.Transpiler({
44183
44290
  loader: "ts",
44184
44291
  tsconfig: JSON.stringify({
@@ -44189,7 +44296,7 @@ ${fields}
44189
44296
  })
44190
44297
  });
44191
44298
  const tsconfigAliases = readTsconfigPathAliases();
44192
- const resolveSourceFile = (candidate) => {
44299
+ const resolveSourceFile2 = (candidate) => {
44193
44300
  const candidates = candidate.match(/\.[cm]?[tj]sx?$/) ? [candidate] : [
44194
44301
  `${candidate}.ts`,
44195
44302
  `${candidate}.tsx`,
@@ -44204,9 +44311,9 @@ ${fields}
44204
44311
  };
44205
44312
  const resolveLocalImport = (specifier, fromDir) => {
44206
44313
  if (specifier.startsWith(".") || specifier.startsWith("/")) {
44207
- return resolveSourceFile(resolve19(fromDir, specifier));
44314
+ return resolveSourceFile2(resolve19(fromDir, specifier));
44208
44315
  }
44209
- const aliased = matchTsconfigAlias(specifier, tsconfigAliases.aliases, tsconfigAliases.baseUrl, resolveSourceFile);
44316
+ const aliased = matchTsconfigAlias(specifier, tsconfigAliases.aliases, tsconfigAliases.baseUrl, resolveSourceFile2);
44210
44317
  if (aliased)
44211
44318
  return aliased;
44212
44319
  try {
@@ -44216,7 +44323,7 @@ ${fields}
44216
44323
  const absolute = resolve19(resolved);
44217
44324
  if (!absolute.startsWith(baseDir))
44218
44325
  return;
44219
- return resolveSourceFile(absolute);
44326
+ return resolveSourceFile2(absolute);
44220
44327
  } catch {
44221
44328
  return;
44222
44329
  }
@@ -44294,6 +44401,9 @@ ${fields}
44294
44401
  if (importMatch[1])
44295
44402
  localImports.push(importMatch[1]);
44296
44403
  }
44404
+ if (localImports.includes("@angular/animations")) {
44405
+ usesLegacyAnimations = true;
44406
+ }
44297
44407
  const localImportPaths = localImports.map((specifier) => {
44298
44408
  const resolved2 = resolveLocalImport(specifier, inputDir);
44299
44409
  if (!resolved2)
@@ -44316,6 +44426,18 @@ ${fields}
44316
44426
  await Promise.all(localImportPaths.map((importPath) => transpileFile(importPath)));
44317
44427
  };
44318
44428
  await transpileFile(inputPath);
44429
+ const entryOutputPath = toOutputPath(entryPath);
44430
+ if (existsSync16(entryOutputPath)) {
44431
+ const entryOutput = await fs2.readFile(entryOutputPath, "utf-8");
44432
+ const withoutLegacyFlag = entryOutput.replace(/\nexport const __ABSOLUTE_PAGE_USES_LEGACY_ANIMATIONS__ = true;\n?/g, `
44433
+ `);
44434
+ const nextEntryOutput = usesLegacyAnimations ? `${withoutLegacyFlag}
44435
+ export const __ABSOLUTE_PAGE_USES_LEGACY_ANIMATIONS__ = true;
44436
+ ` : withoutLegacyFlag;
44437
+ if (nextEntryOutput !== entryOutput) {
44438
+ await fs2.writeFile(entryOutputPath, nextEntryOutput, "utf-8");
44439
+ }
44440
+ }
44319
44441
  return allOutputs;
44320
44442
  }, compileAngular = async (entryPoints, outRoot, hmr = false, stylePreprocessors) => {
44321
44443
  const compiledParent = join15(outRoot, "generated");
@@ -44377,10 +44499,11 @@ ${fields}
44377
44499
  return fallback;
44378
44500
  };
44379
44501
  const componentClassName = detectExportedComponentClass(original, `${toPascal(fileBase)}Component`);
44502
+ const usesLegacyAnimations = await sourceTreeUsesLegacyAngularAnimations(resolvedEntry, outRoot);
44380
44503
  const serverContentHash = Bun.hash(original).toString(BASE_36_RADIX);
44381
44504
  const cachedWrapper = wrapperOutputCache.get(resolvedEntry);
44382
44505
  const clientFile = join15(indexesDir, jsName);
44383
- if (hmr && cachedWrapper && cachedWrapper.serverHash === serverContentHash && existsSync16(clientFile)) {
44506
+ if (hmr && cachedWrapper && cachedWrapper.serverHash === serverContentHash && existsSync16(clientFile) && (usesLegacyAnimations || !original.includes("__ABSOLUTE_PAGE_USES_LEGACY_ANIMATIONS__")) && (!usesLegacyAnimations || original.includes("__ABSOLUTE_PAGE_USES_LEGACY_ANIMATIONS__"))) {
44384
44507
  return {
44385
44508
  clientPath: clientFile,
44386
44509
  indexUnchanged: true,
@@ -44388,6 +44511,8 @@ ${fields}
44388
44511
  };
44389
44512
  }
44390
44513
  let rewritten = original;
44514
+ rewritten = rewritten.replace(/\nexport const __ABSOLUTE_PAGE_USES_LEGACY_ANIMATIONS__ = true;\n?/g, `
44515
+ `);
44391
44516
  if (!rewritten.includes(`import '@angular/compiler';`)) {
44392
44517
  rewritten = `import '@angular/compiler';
44393
44518
  ${rewritten}`;
@@ -44396,6 +44521,11 @@ ${rewritten}`;
44396
44521
  if (!rewritten.includes("export default")) {
44397
44522
  rewritten += `
44398
44523
  export default ${componentClassName};
44524
+ `;
44525
+ }
44526
+ if (usesLegacyAnimations) {
44527
+ rewritten += `
44528
+ export const __ABSOLUTE_PAGE_USES_LEGACY_ANIMATIONS__ = true;
44399
44529
  `;
44400
44530
  }
44401
44531
  if (hmr) {
@@ -44424,6 +44554,7 @@ import "${hmrClientPath5}";
44424
44554
  import '@angular/compiler';
44425
44555
  import { bootstrapApplication } from '@angular/platform-browser';
44426
44556
  import { provideClientHydration } from '@angular/platform-browser';
44557
+ import { withHttpTransferCacheOptions } from '@angular/platform-browser';
44427
44558
  import { provideZonelessChangeDetection } from '@angular/core';
44428
44559
  import * as pageModule from '${normalizedImportPath}';
44429
44560
 
@@ -44450,6 +44581,13 @@ var propProviders = Object.entries(pageProps).map(function(entry) {
44450
44581
  // that worked in SSR fail with NG0201 after hydration.
44451
44582
  var maybePageProviders = Reflect.get(pageModule, 'providers');
44452
44583
  var pageProviders = Array.isArray(maybePageProviders) ? maybePageProviders : [];
44584
+ var absoluteHttpTransferCacheOptions = {
44585
+ includePostRequests: false,
44586
+ includeRequestsWithAuthHeaders: false,
44587
+ filter: function(request) {
44588
+ return !request.headers.has('x-skip-transfer-cache');
44589
+ }
44590
+ };
44453
44591
 
44454
44592
  // Re-Bootstrap HMR with View Transitions API
44455
44593
  if (window.__ANGULAR_APP__) {
@@ -44465,7 +44603,7 @@ if (!document.querySelector(_sel)) {
44465
44603
 
44466
44604
  var providers = [provideZonelessChangeDetection()];
44467
44605
  if (!window.__HMR_SKIP_HYDRATION__ && !pageHasIslands) {
44468
- providers.push(provideClientHydration());
44606
+ providers.push(provideClientHydration(withHttpTransferCacheOptions(absoluteHttpTransferCacheOptions)));
44469
44607
  }
44470
44608
  delete window.__HMR_SKIP_HYDRATION__;
44471
44609
  providers.push.apply(providers, pageProviders);
@@ -44496,6 +44634,7 @@ if (pageHasRawStreamingSlots) {
44496
44634
  import '@angular/compiler';
44497
44635
  import { bootstrapApplication } from '@angular/platform-browser';
44498
44636
  import { provideClientHydration } from '@angular/platform-browser';
44637
+ import { withHttpTransferCacheOptions } from '@angular/platform-browser';
44499
44638
  import { enableProdMode, provideZonelessChangeDetection } from '@angular/core';
44500
44639
  import * as pageModule from '${normalizedImportPath}';
44501
44640
 
@@ -44522,12 +44661,19 @@ var propProviders = Object.entries(pageProps).map(function(entry) {
44522
44661
  // that worked in SSR fail with NG0201 after hydration.
44523
44662
  var maybePageProviders = Reflect.get(pageModule, 'providers');
44524
44663
  var pageProviders = Array.isArray(maybePageProviders) ? maybePageProviders : [];
44664
+ var absoluteHttpTransferCacheOptions = {
44665
+ includePostRequests: false,
44666
+ includeRequestsWithAuthHeaders: false,
44667
+ filter: function(request) {
44668
+ return !request.headers.has('x-skip-transfer-cache');
44669
+ }
44670
+ };
44525
44671
 
44526
44672
  enableProdMode();
44527
44673
 
44528
44674
  var providers = [provideZonelessChangeDetection()].concat(pageProviders).concat(propProviders);
44529
44675
  if (!pageHasIslands) {
44530
- providers.unshift(provideClientHydration());
44676
+ providers.unshift(provideClientHydration(withHttpTransferCacheOptions(absoluteHttpTransferCacheOptions)));
44531
44677
  }
44532
44678
  window.__ABS_SLOT_HYDRATION_PENDING__ = pageHasRawStreamingSlots;
44533
44679
 
@@ -58395,5 +58541,5 @@ export {
58395
58541
  ANGULAR_INIT_TIMEOUT_MS
58396
58542
  };
58397
58543
 
58398
- //# debugId=150625FC81D495AD64756E2164756E21
58544
+ //# debugId=758A53A3F7982E3F64756E2164756E21
58399
58545
  //# sourceMappingURL=index.js.map