@absolutejs/absolute 0.19.0-beta.980 → 0.19.0-beta.982

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.
@@ -1,7 +1,7 @@
1
1
  // @bun
2
2
  var __require = import.meta.require;
3
3
 
4
- // .angular-partial-tmp-X5B7B5/src/core/streamingSlotRegistrar.ts
4
+ // .angular-partial-tmp-2Ztb8l/src/core/streamingSlotRegistrar.ts
5
5
  var STREAMING_SLOT_REGISTRAR_KEY = Symbol.for("absolutejs.streamingSlotRegistrar");
6
6
  var STREAMING_SLOT_WARNING_STORAGE_KEY = Symbol.for("absolutejs.streamingSlotWarningController");
7
7
  var STREAMING_SLOT_COLLECTION_STORAGE_KEY = Symbol.for("absolutejs.streamingSlotCollectionController");
@@ -1,7 +1,7 @@
1
1
  // @bun
2
2
  var __require = import.meta.require;
3
3
 
4
- // .angular-partial-tmp-X5B7B5/src/core/streamingSlotRegistrar.ts
4
+ // .angular-partial-tmp-2Ztb8l/src/core/streamingSlotRegistrar.ts
5
5
  var STREAMING_SLOT_REGISTRAR_KEY = Symbol.for("absolutejs.streamingSlotRegistrar");
6
6
  var STREAMING_SLOT_WARNING_STORAGE_KEY = Symbol.for("absolutejs.streamingSlotWarningController");
7
7
  var STREAMING_SLOT_COLLECTION_STORAGE_KEY = Symbol.for("absolutejs.streamingSlotCollectionController");
@@ -48,7 +48,7 @@ var warnMissingStreamingSlotCollector = (primitiveName) => {
48
48
  getWarningController()?.maybeWarn(primitiveName);
49
49
  };
50
50
 
51
- // .angular-partial-tmp-X5B7B5/src/core/streamingSlotRegistry.ts
51
+ // .angular-partial-tmp-2Ztb8l/src/core/streamingSlotRegistry.ts
52
52
  var STREAMING_SLOT_STORAGE_KEY = Symbol.for("absolutejs.streamingSlotAsyncLocalStorage");
53
53
  var isObjectRecord2 = (value) => Boolean(value) && typeof value === "object";
54
54
  var isAsyncLocalStorage = (value) => isObjectRecord2(value) && ("getStore" in value) && typeof value.getStore === "function" && ("run" in value) && typeof value.run === "function";
@@ -4402,7 +4402,7 @@ export const __ABSOLUTE_PAGE_USES_LEGACY_ANIMATIONS__ = true;
4402
4402
  }
4403
4403
  }
4404
4404
  return allOutputs;
4405
- }, compileAngular = async (entryPoints, outRoot, hmr = false, stylePreprocessors) => {
4405
+ }, compileAngular = async (entryPoints, outRoot, hmr = false, stylePreprocessors, providersInjection) => {
4406
4406
  const compiledParent = getFrameworkGeneratedDir("angular");
4407
4407
  if (entryPoints.length === 0) {
4408
4408
  const emptyPaths = [];
@@ -4517,25 +4517,40 @@ export default ${componentClassName};
4517
4517
  export const __ABSOLUTE_PAGE_USES_LEGACY_ANIMATIONS__ = true;
4518
4518
  `;
4519
4519
  }
4520
- const providersServerPath = join8(compiledParent, "providers", `${toPascal(fileBase)}.providers.js`);
4521
- if (existsSync5(providersServerPath)) {
4522
- const rel = relative4(dirname4(rawServerFile), providersServerPath).replace(/\\/g, "/");
4523
- const specifier = rel.startsWith(".") ? rel : `./${rel}`;
4520
+ const pageInjection = providersInjection?.pagesByFile.get(resolvedEntry);
4521
+ if (providersInjection && pageInjection) {
4522
+ const compiledAppProvidersPath = (() => {
4523
+ const angularDirAbs = resolve6(outRoot);
4524
+ const appSourceAbs = resolve6(providersInjection.appProvidersSource);
4525
+ const rel = relative4(angularDirAbs, appSourceAbs).replace(/\\/g, "/");
4526
+ return join8(compiledParent, rel).replace(/\.[cm]?[tj]sx?$/, ".js");
4527
+ })();
4528
+ const appProvidersSpec = (() => {
4529
+ const rel = relative4(dirname4(rawServerFile), compiledAppProvidersPath).replace(/\\/g, "/");
4530
+ return rel.startsWith(".") ? rel : `./${rel}`;
4531
+ })();
4532
+ const importLines = [
4533
+ `import { appProviders as __abs_globalProviders } from "${appProvidersSpec}";`
4534
+ ];
4535
+ const fragments = ["...__abs_globalProviders"];
4536
+ if (pageInjection.hasRoutes) {
4537
+ importLines.push(`import { provideRouter as __abs_provideRouter, withComponentInputBinding as __abs_withComponentInputBinding, withViewTransitions as __abs_withViewTransitions } from "@angular/router";`);
4538
+ fragments.push("__abs_provideRouter(routes, __abs_withComponentInputBinding(), __abs_withViewTransitions())");
4539
+ }
4540
+ if (pageInjection.basePath !== null) {
4541
+ importLines.push(`import { APP_BASE_HREF as __abs_APP_BASE_HREF } from "@angular/common";`);
4542
+ fragments.push(`{ provide: __abs_APP_BASE_HREF, useValue: ${JSON.stringify(pageInjection.basePath)} }`);
4543
+ }
4524
4544
  rewritten += `
4525
- export { providers } from "${specifier}";
4545
+ ${importLines.join(`
4546
+ `)}
4547
+ export const providers = [${fragments.join(", ")}];
4526
4548
  `;
4527
4549
  }
4528
4550
  await traceAngularPhase("wrapper/write-server-output", () => fs.writeFile(rawServerFile, rewritten, "utf-8"), { entry: resolvedEntry });
4529
4551
  const relativePath = relative4(indexesDir, rawServerFile).replace(/\\/g, "/");
4530
4552
  const normalizedImportPath = relativePath.startsWith(".") ? relativePath : `./${relativePath}`;
4531
- const manifestKeyForProviders = toPascal(fileBase);
4532
- const providersServerFilePath = join8(compiledParent, "providers", `${manifestKeyForProviders}.providers.js`);
4533
- const hasGeneratedProviders = existsSync5(providersServerFilePath);
4534
- const providersImportPath = hasGeneratedProviders ? (() => {
4535
- const rel = relative4(indexesDir, providersServerFilePath.replace(/\.js$/, "")).replace(/\\/g, "/");
4536
- return rel.startsWith(".") ? rel : `./${rel}`;
4537
- })() : null;
4538
- const generatedProvidersImport = providersImportPath ? `import { providers as generatedProviders } from '${providersImportPath}';` : "var generatedProviders = null;";
4553
+ const generatedProvidersImport = "var generatedProviders = null;";
4539
4554
  const hmrPreamble = hmr ? `window.__HMR_FRAMEWORK__ = "angular";
4540
4555
  import "${hmrClientPath}";
4541
4556
  ` : "";
@@ -14958,9 +14973,24 @@ var useResource = (fetcher, options = {}) => {
14958
14973
  // src/angular/composables/useSubscription.ts
14959
14974
  import { DestroyRef as DestroyRef2, inject as inject3 } from "@angular/core";
14960
14975
  import { takeUntilDestroyed } from "@angular/core/rxjs-interop";
14961
- function useSubscription(observable, observerOrNext) {
14962
- const destroyRef = inject3(DestroyRef2);
14963
- return observable.pipe(takeUntilDestroyed(destroyRef)).subscribe(typeof observerOrNext === "function" ? { next: observerOrNext } : observerOrNext);
14976
+ var warnedOnce = false;
14977
+ var tryCaptureDestroyRef = () => {
14978
+ try {
14979
+ return inject3(DestroyRef2);
14980
+ } catch {
14981
+ if (!warnedOnce) {
14982
+ warnedOnce = true;
14983
+ console.warn("[absolute/angular] useSubscription was called outside an Angular injection context (likely from a lifecycle hook). Auto-teardown via takeUntilDestroyed is disabled for that call; the subscription will leak unless the caller manually unsubscribes. Move the call to a field initializer or the constructor, or pass the captured DestroyRef as the third argument.");
14984
+ }
14985
+ return null;
14986
+ }
14987
+ };
14988
+ function useSubscription(observable, observerOrNext, destroyRef) {
14989
+ const captured = destroyRef ?? tryCaptureDestroyRef();
14990
+ const observer = typeof observerOrNext === "function" ? { next: observerOrNext } : observerOrNext;
14991
+ if (!captured)
14992
+ return observable.subscribe(observer);
14993
+ return observable.pipe(takeUntilDestroyed(captured)).subscribe(observer);
14964
14994
  }
14965
14995
  // src/angular/composables/useTimers.ts
14966
14996
  import { DestroyRef as DestroyRef3, inject as inject4 } from "@angular/core";
@@ -15408,5 +15438,5 @@ export {
15408
15438
  ABSOLUTE_HTTP_TRANSFER_CACHE_SKIP_HEADER
15409
15439
  };
15410
15440
 
15411
- //# debugId=A8E28413262E9BF764756E2164756E21
15441
+ //# debugId=F34843F550663CE764756E2164756E21
15412
15442
  //# sourceMappingURL=index.js.map