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

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/build.js CHANGED
@@ -1938,13 +1938,19 @@ var initDominoAdapter = (platformServer) => {
1938
1938
  APP_BASE_HREF: common.APP_BASE_HREF,
1939
1939
  bootstrapApplication: platformBrowser.bootstrapApplication,
1940
1940
  DomSanitizer: platformBrowser.DomSanitizer,
1941
+ ENVIRONMENT_INITIALIZER: core.ENVIRONMENT_INITIALIZER,
1942
+ inject: core.inject,
1941
1943
  provideClientHydration: platformBrowser.provideClientHydration,
1942
1944
  provideServerRendering: platformServer.provideServerRendering,
1943
1945
  provideZonelessChangeDetection: core.provideZonelessChangeDetection,
1944
1946
  reflectComponentType: core.reflectComponentType,
1945
1947
  renderApplication: platformServer.renderApplication,
1948
+ REQUEST: core.REQUEST,
1949
+ REQUEST_CONTEXT: core.REQUEST_CONTEXT,
1950
+ RESPONSE_INIT: core.RESPONSE_INIT,
1946
1951
  Sanitizer: core.Sanitizer,
1947
- SecurityContext: core.SecurityContext
1952
+ SecurityContext: core.SecurityContext,
1953
+ withHttpTransferCacheOptions: platformBrowser.withHttpTransferCacheOptions
1948
1954
  };
1949
1955
  }, angularDeps = null, getAngularDeps = () => {
1950
1956
  if (!angularDeps) {
@@ -2036,6 +2042,30 @@ var init_registerClientScript = __esm(() => {
2036
2042
  }
2037
2043
  });
2038
2044
 
2045
+ // src/angular/httpTransferCache.ts
2046
+ var ABSOLUTE_HTTP_TRANSFER_CACHE_SKIP_HEADER = "x-skip-transfer-cache", buildAbsoluteHttpTransferCacheOptions = (options = {}) => {
2047
+ const {
2048
+ filter: userFilter,
2049
+ skipHeader = ABSOLUTE_HTTP_TRANSFER_CACHE_SKIP_HEADER,
2050
+ ...angularOptions
2051
+ } = options;
2052
+ return {
2053
+ includePostRequests: false,
2054
+ includeRequestsWithAuthHeaders: false,
2055
+ ...angularOptions,
2056
+ filter: (request) => !request.headers.has(skipHeader) && (userFilter?.(request) ?? true)
2057
+ };
2058
+ };
2059
+
2060
+ // src/angular/requestProviders.ts
2061
+ import { REQUEST, REQUEST_CONTEXT, RESPONSE_INIT } from "@angular/core";
2062
+ var buildRequestProviders = (deps, request, requestContext, responseInit) => [
2063
+ { provide: deps.REQUEST, useValue: request ?? null },
2064
+ { provide: deps.REQUEST_CONTEXT, useValue: requestContext ?? null },
2065
+ { provide: deps.RESPONSE_INIT, useValue: responseInit ?? null }
2066
+ ];
2067
+ var init_requestProviders = () => {};
2068
+
2039
2069
  // src/angular/ssrRender.ts
2040
2070
  var routePropsCache, cacheRouteData = (pagePath, data) => {
2041
2071
  const cacheKey = pagePath.split("?")[0] ?? pagePath;
@@ -2049,18 +2079,24 @@ var routePropsCache, cacheRouteData = (pagePath, data) => {
2049
2079
  APP_BASE_HREF: common?.APP_BASE_HREF ?? baseDeps.APP_BASE_HREF,
2050
2080
  bootstrapApplication: platformBrowser?.bootstrapApplication ?? baseDeps.bootstrapApplication,
2051
2081
  DomSanitizer: platformBrowser?.DomSanitizer ?? baseDeps.DomSanitizer,
2082
+ ENVIRONMENT_INITIALIZER: core.ENVIRONMENT_INITIALIZER ?? baseDeps.ENVIRONMENT_INITIALIZER,
2083
+ inject: core.inject ?? baseDeps.inject,
2052
2084
  provideClientHydration: platformBrowser?.provideClientHydration ?? baseDeps.provideClientHydration,
2053
2085
  provideServerRendering: platformServer?.provideServerRendering ?? baseDeps.provideServerRendering,
2054
2086
  provideZonelessChangeDetection: core.provideZonelessChangeDetection,
2055
2087
  reflectComponentType: core.reflectComponentType,
2056
2088
  renderApplication: platformServer?.renderApplication ?? baseDeps.renderApplication,
2089
+ REQUEST: core.REQUEST ?? baseDeps.REQUEST,
2090
+ REQUEST_CONTEXT: core.REQUEST_CONTEXT ?? baseDeps.REQUEST_CONTEXT,
2091
+ RESPONSE_INIT: core.RESPONSE_INIT ?? baseDeps.RESPONSE_INIT,
2057
2092
  Sanitizer: core.Sanitizer,
2058
- SecurityContext: core.SecurityContext
2093
+ SecurityContext: core.SecurityContext,
2094
+ withHttpTransferCacheOptions: platformBrowser?.withHttpTransferCacheOptions ?? baseDeps.withHttpTransferCacheOptions
2059
2095
  };
2060
- }, buildProviders = (deps, sanitizer, maybeProps, tokenMap, userProviders = []) => {
2096
+ }, buildProviders = (deps, sanitizer, maybeProps, tokenMap, request, requestContext, responseInit, userProviders = []) => {
2061
2097
  const providers = [
2062
2098
  deps.provideServerRendering(),
2063
- deps.provideClientHydration(),
2099
+ deps.provideClientHydration(deps.withHttpTransferCacheOptions(buildAbsoluteHttpTransferCacheOptions())),
2064
2100
  deps.provideZonelessChangeDetection(),
2065
2101
  { provide: deps.APP_BASE_HREF, useValue: "/" },
2066
2102
  {
@@ -2068,6 +2104,7 @@ var routePropsCache, cacheRouteData = (pagePath, data) => {
2068
2104
  useValue: sanitizer
2069
2105
  },
2070
2106
  { provide: deps.Sanitizer, useValue: sanitizer },
2107
+ ...buildRequestProviders(deps, request, requestContext, responseInit),
2071
2108
  ...userProviders
2072
2109
  ];
2073
2110
  if (!maybeProps) {
@@ -2150,6 +2187,7 @@ var routePropsCache, cacheRouteData = (pagePath, data) => {
2150
2187
  };
2151
2188
  var init_ssrRender = __esm(() => {
2152
2189
  init_registerClientScript();
2190
+ init_requestProviders();
2153
2191
  routePropsCache = new Map;
2154
2192
  selectorCache = new Map;
2155
2193
  });
@@ -43506,6 +43544,74 @@ var computeConfigHash = () => {
43506
43544
  }
43507
43545
  }
43508
43546
  return;
43547
+ }, resolveSourceFile = (candidate) => {
43548
+ const candidates = candidate.match(/\.[cm]?[tj]sx?$/) ? [candidate] : [
43549
+ `${candidate}.ts`,
43550
+ `${candidate}.tsx`,
43551
+ `${candidate}.js`,
43552
+ `${candidate}.jsx`,
43553
+ join15(candidate, "index.ts"),
43554
+ join15(candidate, "index.tsx"),
43555
+ join15(candidate, "index.js"),
43556
+ join15(candidate, "index.jsx")
43557
+ ];
43558
+ return candidates.find((file3) => existsSync16(file3));
43559
+ }, sourceTreeUsesLegacyAngularAnimations = async (entryPath, rootDir) => {
43560
+ const baseDir = resolve16(rootDir);
43561
+ const tsconfigAliases = readTsconfigPathAliases();
43562
+ const transpiler4 = new Bun.Transpiler({ loader: "tsx" });
43563
+ const visited = new Set;
43564
+ const resolveLocalImport = (specifier, fromDir) => {
43565
+ if (specifier.startsWith(".") || specifier.startsWith("/")) {
43566
+ return resolveSourceFile(resolve16(fromDir, specifier));
43567
+ }
43568
+ const aliased = matchTsconfigAlias(specifier, tsconfigAliases.aliases, tsconfigAliases.baseUrl, resolveSourceFile);
43569
+ if (aliased)
43570
+ return aliased;
43571
+ try {
43572
+ const resolved = Bun.resolveSync(specifier, fromDir);
43573
+ if (resolved.includes("/node_modules/"))
43574
+ return;
43575
+ const absolute = resolve16(resolved);
43576
+ if (!absolute.startsWith(baseDir))
43577
+ return;
43578
+ return resolveSourceFile(absolute);
43579
+ } catch {
43580
+ return;
43581
+ }
43582
+ };
43583
+ const visit = async (filePath) => {
43584
+ const actualPath = resolveSourceFile(filePath);
43585
+ if (!actualPath)
43586
+ return false;
43587
+ const resolved = resolve16(actualPath);
43588
+ if (visited.has(resolved))
43589
+ return false;
43590
+ visited.add(resolved);
43591
+ let sourceCode;
43592
+ try {
43593
+ sourceCode = await fs2.readFile(resolved, "utf-8");
43594
+ } catch {
43595
+ return false;
43596
+ }
43597
+ let imports;
43598
+ try {
43599
+ imports = transpiler4.scanImports(sourceCode);
43600
+ } catch {
43601
+ return false;
43602
+ }
43603
+ for (const imp of imports) {
43604
+ if (imp.path === "@angular/animations")
43605
+ return true;
43606
+ }
43607
+ for (const imp of imports) {
43608
+ const importedPath = resolveLocalImport(imp.path, dirname10(resolved));
43609
+ if (importedPath && await visit(importedPath))
43610
+ return true;
43611
+ }
43612
+ return false;
43613
+ };
43614
+ return visit(entryPath);
43509
43615
  }, resolveDevClientDir4 = () => {
43510
43616
  const projectRoot = process.cwd();
43511
43617
  const fromSource = resolve16(import.meta.dir, "../dev/client");
@@ -43987,6 +44093,7 @@ ${fields}
43987
44093
  const allOutputs = [];
43988
44094
  const visited = new Set;
43989
44095
  const baseDir = resolve16(rootDir ?? process.cwd());
44096
+ let usesLegacyAnimations = false;
43990
44097
  const angularTranspiler = new Bun.Transpiler({
43991
44098
  loader: "ts",
43992
44099
  tsconfig: JSON.stringify({
@@ -43997,7 +44104,7 @@ ${fields}
43997
44104
  })
43998
44105
  });
43999
44106
  const tsconfigAliases = readTsconfigPathAliases();
44000
- const resolveSourceFile = (candidate) => {
44107
+ const resolveSourceFile2 = (candidate) => {
44001
44108
  const candidates = candidate.match(/\.[cm]?[tj]sx?$/) ? [candidate] : [
44002
44109
  `${candidate}.ts`,
44003
44110
  `${candidate}.tsx`,
@@ -44012,9 +44119,9 @@ ${fields}
44012
44119
  };
44013
44120
  const resolveLocalImport = (specifier, fromDir) => {
44014
44121
  if (specifier.startsWith(".") || specifier.startsWith("/")) {
44015
- return resolveSourceFile(resolve16(fromDir, specifier));
44122
+ return resolveSourceFile2(resolve16(fromDir, specifier));
44016
44123
  }
44017
- const aliased = matchTsconfigAlias(specifier, tsconfigAliases.aliases, tsconfigAliases.baseUrl, resolveSourceFile);
44124
+ const aliased = matchTsconfigAlias(specifier, tsconfigAliases.aliases, tsconfigAliases.baseUrl, resolveSourceFile2);
44018
44125
  if (aliased)
44019
44126
  return aliased;
44020
44127
  try {
@@ -44024,7 +44131,7 @@ ${fields}
44024
44131
  const absolute = resolve16(resolved);
44025
44132
  if (!absolute.startsWith(baseDir))
44026
44133
  return;
44027
- return resolveSourceFile(absolute);
44134
+ return resolveSourceFile2(absolute);
44028
44135
  } catch {
44029
44136
  return;
44030
44137
  }
@@ -44102,6 +44209,9 @@ ${fields}
44102
44209
  if (importMatch[1])
44103
44210
  localImports.push(importMatch[1]);
44104
44211
  }
44212
+ if (localImports.includes("@angular/animations")) {
44213
+ usesLegacyAnimations = true;
44214
+ }
44105
44215
  const localImportPaths = localImports.map((specifier) => {
44106
44216
  const resolved2 = resolveLocalImport(specifier, inputDir);
44107
44217
  if (!resolved2)
@@ -44124,6 +44234,18 @@ ${fields}
44124
44234
  await Promise.all(localImportPaths.map((importPath) => transpileFile(importPath)));
44125
44235
  };
44126
44236
  await transpileFile(inputPath);
44237
+ const entryOutputPath = toOutputPath(entryPath);
44238
+ if (existsSync16(entryOutputPath)) {
44239
+ const entryOutput = await fs2.readFile(entryOutputPath, "utf-8");
44240
+ const withoutLegacyFlag = entryOutput.replace(/\nexport const __ABSOLUTE_PAGE_USES_LEGACY_ANIMATIONS__ = true;\n?/g, `
44241
+ `);
44242
+ const nextEntryOutput = usesLegacyAnimations ? `${withoutLegacyFlag}
44243
+ export const __ABSOLUTE_PAGE_USES_LEGACY_ANIMATIONS__ = true;
44244
+ ` : withoutLegacyFlag;
44245
+ if (nextEntryOutput !== entryOutput) {
44246
+ await fs2.writeFile(entryOutputPath, nextEntryOutput, "utf-8");
44247
+ }
44248
+ }
44127
44249
  return allOutputs;
44128
44250
  }, compileAngular = async (entryPoints, outRoot, hmr = false, stylePreprocessors) => {
44129
44251
  const compiledParent = join15(outRoot, "generated");
@@ -44185,10 +44307,11 @@ ${fields}
44185
44307
  return fallback;
44186
44308
  };
44187
44309
  const componentClassName = detectExportedComponentClass(original, `${toPascal(fileBase)}Component`);
44310
+ const usesLegacyAnimations = await sourceTreeUsesLegacyAngularAnimations(resolvedEntry, outRoot);
44188
44311
  const serverContentHash = Bun.hash(original).toString(BASE_36_RADIX);
44189
44312
  const cachedWrapper = wrapperOutputCache.get(resolvedEntry);
44190
44313
  const clientFile = join15(indexesDir, jsName);
44191
- if (hmr && cachedWrapper && cachedWrapper.serverHash === serverContentHash && existsSync16(clientFile)) {
44314
+ if (hmr && cachedWrapper && cachedWrapper.serverHash === serverContentHash && existsSync16(clientFile) && (usesLegacyAnimations || !original.includes("__ABSOLUTE_PAGE_USES_LEGACY_ANIMATIONS__")) && (!usesLegacyAnimations || original.includes("__ABSOLUTE_PAGE_USES_LEGACY_ANIMATIONS__"))) {
44192
44315
  return {
44193
44316
  clientPath: clientFile,
44194
44317
  indexUnchanged: true,
@@ -44196,6 +44319,8 @@ ${fields}
44196
44319
  };
44197
44320
  }
44198
44321
  let rewritten = original;
44322
+ rewritten = rewritten.replace(/\nexport const __ABSOLUTE_PAGE_USES_LEGACY_ANIMATIONS__ = true;\n?/g, `
44323
+ `);
44199
44324
  if (!rewritten.includes(`import '@angular/compiler';`)) {
44200
44325
  rewritten = `import '@angular/compiler';
44201
44326
  ${rewritten}`;
@@ -44204,6 +44329,11 @@ ${rewritten}`;
44204
44329
  if (!rewritten.includes("export default")) {
44205
44330
  rewritten += `
44206
44331
  export default ${componentClassName};
44332
+ `;
44333
+ }
44334
+ if (usesLegacyAnimations) {
44335
+ rewritten += `
44336
+ export const __ABSOLUTE_PAGE_USES_LEGACY_ANIMATIONS__ = true;
44207
44337
  `;
44208
44338
  }
44209
44339
  if (hmr) {
@@ -44232,6 +44362,7 @@ import "${hmrClientPath5}";
44232
44362
  import '@angular/compiler';
44233
44363
  import { bootstrapApplication } from '@angular/platform-browser';
44234
44364
  import { provideClientHydration } from '@angular/platform-browser';
44365
+ import { withHttpTransferCacheOptions } from '@angular/platform-browser';
44235
44366
  import { provideZonelessChangeDetection } from '@angular/core';
44236
44367
  import * as pageModule from '${normalizedImportPath}';
44237
44368
 
@@ -44258,6 +44389,13 @@ var propProviders = Object.entries(pageProps).map(function(entry) {
44258
44389
  // that worked in SSR fail with NG0201 after hydration.
44259
44390
  var maybePageProviders = Reflect.get(pageModule, 'providers');
44260
44391
  var pageProviders = Array.isArray(maybePageProviders) ? maybePageProviders : [];
44392
+ var absoluteHttpTransferCacheOptions = {
44393
+ includePostRequests: false,
44394
+ includeRequestsWithAuthHeaders: false,
44395
+ filter: function(request) {
44396
+ return !request.headers.has('x-skip-transfer-cache');
44397
+ }
44398
+ };
44261
44399
 
44262
44400
  // Re-Bootstrap HMR with View Transitions API
44263
44401
  if (window.__ANGULAR_APP__) {
@@ -44273,7 +44411,7 @@ if (!document.querySelector(_sel)) {
44273
44411
 
44274
44412
  var providers = [provideZonelessChangeDetection()];
44275
44413
  if (!window.__HMR_SKIP_HYDRATION__ && !pageHasIslands) {
44276
- providers.push(provideClientHydration());
44414
+ providers.push(provideClientHydration(withHttpTransferCacheOptions(absoluteHttpTransferCacheOptions)));
44277
44415
  }
44278
44416
  delete window.__HMR_SKIP_HYDRATION__;
44279
44417
  providers.push.apply(providers, pageProviders);
@@ -44304,6 +44442,7 @@ if (pageHasRawStreamingSlots) {
44304
44442
  import '@angular/compiler';
44305
44443
  import { bootstrapApplication } from '@angular/platform-browser';
44306
44444
  import { provideClientHydration } from '@angular/platform-browser';
44445
+ import { withHttpTransferCacheOptions } from '@angular/platform-browser';
44307
44446
  import { enableProdMode, provideZonelessChangeDetection } from '@angular/core';
44308
44447
  import * as pageModule from '${normalizedImportPath}';
44309
44448
 
@@ -44330,12 +44469,19 @@ var propProviders = Object.entries(pageProps).map(function(entry) {
44330
44469
  // that worked in SSR fail with NG0201 after hydration.
44331
44470
  var maybePageProviders = Reflect.get(pageModule, 'providers');
44332
44471
  var pageProviders = Array.isArray(maybePageProviders) ? maybePageProviders : [];
44472
+ var absoluteHttpTransferCacheOptions = {
44473
+ includePostRequests: false,
44474
+ includeRequestsWithAuthHeaders: false,
44475
+ filter: function(request) {
44476
+ return !request.headers.has('x-skip-transfer-cache');
44477
+ }
44478
+ };
44333
44479
 
44334
44480
  enableProdMode();
44335
44481
 
44336
44482
  var providers = [provideZonelessChangeDetection()].concat(pageProviders).concat(propProviders);
44337
44483
  if (!pageHasIslands) {
44338
- providers.unshift(provideClientHydration());
44484
+ providers.unshift(provideClientHydration(withHttpTransferCacheOptions(absoluteHttpTransferCacheOptions)));
44339
44485
  }
44340
44486
  window.__ABS_SLOT_HYDRATION_PENDING__ = pageHasRawStreamingSlots;
44341
44487
 
@@ -49935,5 +50081,5 @@ export {
49935
50081
  build
49936
50082
  };
49937
50083
 
49938
- //# debugId=E2B14CE9D731531264756E2164756E21
50084
+ //# debugId=8901CFECDF6121B564756E2164756E21
49939
50085
  //# sourceMappingURL=build.js.map