@absolutejs/absolute 0.19.0-beta.983 → 0.19.0-beta.985

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.
@@ -11,12 +11,19 @@ export type Observer<T> = {
11
11
  * collapsed into one call so consumers can't forget the cleanup
12
12
  * operator (the most common Angular memory-leak source).
13
13
  *
14
- * Prefer calling from an injection context (field initializer or
15
- * constructor). When called outside one — e.g. from `ngOnInit` —
16
- * pass the host's `DestroyRef` explicitly as the third argument
17
- * (capture it via `destroyRef = inject(DestroyRef)` in a field
18
- * initializer once). Otherwise auto-teardown is dropped and the
19
- * caller owns the returned `Subscription`.
14
+ * `inject(DestroyRef)` is only legal in an Angular injection context
15
+ * (constructor, field initializer, factory,
16
+ * `runInInjectionContext`). Calling `useSubscription` without a
17
+ * captured `DestroyRef` from `ngOnInit` or any other lifecycle hook
18
+ * will throw `NG0203`. For those call sites, capture the ref once in
19
+ * a field initializer (`private destroyRef = inject(DestroyRef);`)
20
+ * and pass it as the third argument:
21
+ *
22
+ * ```ts
23
+ * ngOnInit() {
24
+ * useSubscription(this.events$, (event) => { ... }, this.destroyRef);
25
+ * }
26
+ * ```
20
27
  *
21
28
  * Note: this composable handles teardown only — it does not trigger
22
29
  * change detection on emissions. If the observer mutates state that
@@ -19,13 +19,20 @@ export type AngularPageRequestInput<Ctx = unknown> = AngularPageRenderOptions &
19
19
  request?: Request;
20
20
  /** Mutable response init made available through Angular's RESPONSE_INIT token. */
21
21
  responseInit?: ResponseInit;
22
- /** Page-level Angular providers `appProviders` for the typical case,
23
- * `[...appProviders, provideRouter(routes)]` for sub-router pages, etc.
24
- * These flow into `bootstrapApplication` at SSR. The framework's
25
- * build pass (`runAngularHandlerScan`) reads the same expression
26
- * via static AST analysis and emits a matching providers module the
27
- * client bundle imports, so SSR and client bootstrap with identical
28
- * DI trees without the page module exporting `providers`. */
22
+ /** Extra per-request providers merged in on top of the page
23
+ * module's bundled providers (`appProviders` + `provideRouter` +
24
+ * `APP_BASE_HREF`) at SSR bootstrap. Use for handler-scoped DI
25
+ * values that depend on the request — e.g. a tenant-specific
26
+ * feature-flag service, a per-request HTTP interceptor token,
27
+ * or test-only overrides. The same Angular module instance is
28
+ * shared (the backend resolves `@angular/core` through the same
29
+ * `node_modules` Bun cache key as the rebuilt page bundle), so
30
+ * tokens declared here interop with the bundled providers.
31
+ *
32
+ * **SSR-only.** The browser bundle doesn't see these — the
33
+ * client picks up only the providers baked into the page
34
+ * module. If the same provider must run on both sides, add it
35
+ * to `absolute.config.ts > angular.providers` instead. */
29
36
  providers?: ReadonlyArray<Provider | EnvironmentProviders>;
30
37
  /** Sitemap metadata for this route. Statically read from the handler
31
38
  * source at registration time, so only literal-object values are
@@ -1,30 +1,8 @@
1
- export type ImportSpec = {
2
- /** Local name as used inside the providers expression. */
3
- localName: string;
4
- /** Original exported name (matches localName unless the source used `as`). */
5
- importedName: string;
6
- /** `true` when the import was a default import (`import foo from "..."`). */
7
- isDefault: boolean;
8
- /** Module specifier as written in the source — could be a bare package
9
- * name (`@angular/router`) or a path (`./foo`, `../../utils/x`). The
10
- * path forms are resolved to absolute file paths by `resolvedAbsPath`. */
11
- source: string;
12
- /** Absolute path the source resolves to, or `null` for bare specifiers
13
- * (`@angular/router`, `firebase/auth`, …) which the generated file
14
- * will re-import by the same bare specifier. */
15
- resolvedAbsPath: string | null;
16
- };
17
1
  export type AngularHandlerCall = {
18
2
  /** File the call lives in. */
19
3
  sourceFile: string;
20
4
  /** Manifest key extracted from `pagePath: asset(manifest, "Foo")`. */
21
5
  manifestKey: string;
22
- /** Verbatim source text of the `providers:` argument expression, or
23
- * `null` if the call didn't include one. */
24
- providersExpr: string | null;
25
- /** Imports from the source file that the `providers:` expression refers
26
- * to. Empty array when `providersExpr` is null. */
27
- providerImports: ImportSpec[];
28
6
  /** Mount path from the surrounding `.get("/path", ...)` / `.post(...)`
29
7
  * Elysia chain. `null` when the call isn't directly inside such a
30
8
  * registration (rare but possible — e.g. inside a helper function). */
package/package.json CHANGED
@@ -402,5 +402,5 @@
402
402
  ]
403
403
  }
404
404
  },
405
- "version": "0.19.0-beta.983"
405
+ "version": "0.19.0-beta.985"
406
406
  }