@mmstack/di 21.0.7 → 22.0.0

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.
@@ -51,10 +51,10 @@ class ScopeRegistry {
51
51
  this.resolving.delete(factory);
52
52
  }
53
53
  }
54
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.12", ngImport: i0, type: ScopeRegistry, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
55
- static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.2.12", ngImport: i0, type: ScopeRegistry });
54
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.0", ngImport: i0, type: ScopeRegistry, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
55
+ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "22.0.0", ngImport: i0, type: ScopeRegistry });
56
56
  }
57
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.12", ngImport: i0, type: ScopeRegistry, decorators: [{
57
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.0", ngImport: i0, type: ScopeRegistry, decorators: [{
58
58
  type: Injectable
59
59
  }] });
60
60
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"mmstack-di.mjs","sources":["../../../../packages/di/src/lib/create-run-in-injection-context.ts","../../../../packages/di/src/lib/create-scope.ts","../../../../packages/di/src/lib/inject-lazy.ts","../../../../packages/di/src/lib/injectable.ts","../../../../packages/di/src/lib/root-injectable.ts","../../../../packages/di/src/mmstack-di.ts"],"sourcesContent":["import { inject, Injector, runInInjectionContext } from '@angular/core';\n\n/**\n * Captures an injection context and returns a runner function.\n *\n * This runner function allows you to execute callbacks inside the captured context at a later time.\n * It's really just a slight DX improvement over calling `runInInjectionContext` over and over.\n *\n * @param injector An optional injector. If not provided, the current context's injector is pulled natively via `inject(Injector)`.\n * @returns A runner function that executes any provided callback within the captured context.\n *\n * @example\n * ```ts\n * @Component({ ... })\n * class MyComponent {\n * // Capture at construction so we can run injection-context code later.\n * private readonly run = createRunInInjectionContext();\n *\n * onClick = () => {\n * // `inject()` works here even though we're no longer in an injection context.\n * const value = this.run(() => inject(SomeService).doThing());\n * };\n * }\n * ```\n */\nexport function createRunInInjectionContext(injector?: Injector) {\n if (!injector) injector = inject(Injector);\n\n return <T>(fn: () => T) => runInInjectionContext(injector, fn);\n}\n","import {\n inject,\n Injectable,\n InjectionToken,\n Injector,\n runInInjectionContext,\n type Provider,\n} from '@angular/core';\n\n@Injectable()\nclass ScopeRegistry {\n private readonly injector = inject(Injector);\n // eslint-disable-next-line @typescript-eslint/no-unsafe-function-type\n private readonly registry = new Map<Function, any>();\n // eslint-disable-next-line @typescript-eslint/no-unsafe-function-type\n private readonly resolving = new Set<Function>();\n\n getOrCreate<T>(factory: () => T, scopeName?: string, factoryName?: string): T {\n if (this.registry.has(factory)) return this.registry.get(factory);\n if (this.resolving.has(factory))\n throw new Error(\n `[mmstack/di]: Circular dependency detected in scope \"${scopeName ?? 'unknown'}\"${factoryName ? ` while resolving \"${factoryName}\"` : ''}`,\n );\n\n this.resolving.add(factory);\n try {\n const val = runInInjectionContext(this.injector, factory);\n this.registry.set(factory, val);\n return val;\n } finally {\n this.resolving.delete(factory);\n }\n }\n}\n\n/**\n * Creates a specialized dependency injection scope.\n *\n * This utility allows you to create a localized dependency injection scope where you can\n * register and provide shared state, services, or primitives that are bound to a specific\n * component tree instead of the global root injector.\n *\n * @param name Optional name for the scope, primarily used for debugging and error messages.\n * @returns A tuple containing `[registerFn, provideFn]`:\n * - `registerFn`: A function to register a factory within the scope. Returns an injection function to retrieve the value.\n * - `provideFn`: An Angular provider function that must be added to the `providers` array where the scope begins.\n *\n * @example\n * ```ts\n * const [registerInUserScope, provideUserScope] = createScope('UserScope');\n *\n * // Define a state/service bound to this scope\n * const injectUserState = registerInUserScope(() => signal({ name: 'John Doe' }));\n * const injectLogger = registerInUserScope(() => {\n * const globalLogger = inject(GlobalLogger);\n * const user = injectUserState();\n * return {\n * log: (msg: string) => globalLogger.log(`[USER MODULE (${user().name})]: ${msg}`),\n * }\n * })\n * @Component({\n * providers: [provideUserScope()] // provides a new instance of every dependency registered to the scope\n * })\n * class ParentComponent {}\n *\n * @Component({})\n * class ChildComponent {\n * readonly userState = injectUserState();\n * readonly logger = injectLogger();\n * }\n * ```\n */\nexport function createScope(name?: string) {\n const token = new InjectionToken<ScopeRegistry>(name ?? '@mmstack/di/scope');\n\n const provideFn = (): Provider => ({\n provide: token,\n useClass: ScopeRegistry,\n });\n\n const registerFn = <T>(factory: () => T, factoryName?: string) => {\n return () => {\n const registry = inject(token, { optional: true });\n if (!registry)\n throw new Error(\n `[mmstack/di]: Scope ${name ?? 'unknown'} not found. Please make sure you provide it`,\n );\n\n return registry.getOrCreate(factory, name, factoryName);\n };\n };\n\n return [registerFn, provideFn] as const;\n}\n","import {\n inject,\n Injector,\n runInInjectionContext,\n type HostAttributeToken,\n type InjectOptions,\n type ProviderToken,\n} from '@angular/core';\n\nconst UNINITIALIZED_SYMBOL = Symbol('@mmstack/di/inject-lazy/uninitialized');\n\ntype OptionalInjectOptions = Omit<InjectOptions, 'optional'> & {\n optional: true;\n};\n\ntype NonOptionalInjectOptions = Omit<InjectOptions, 'optional'> & {\n optional?: false;\n};\n\n/**\n * Defers the resolution and instantiation of a token until the returned getter\n * function is called. The resolved value is cached for subsequent calls — the\n * actual `inject()` call happens at most once, on first access.\n *\n * Useful for services that are expensive to construct, or for breaking\n * circular dependency chains in component fields.\n *\n * @typeParam T The type of the resolved dependency.\n * @param token The dependency token to inject.\n * @returns A getter function that returns the lazily resolved dependency.\n *\n * @example\n * ```ts\n * @Component({ ... })\n * class MyComponent {\n * // Injection context captured at construction; HeavyService is NOT instantiated yet.\n * private readonly getHeavy = injectLazy(HeavyService);\n *\n * onClick = () => {\n * // First access constructs HeavyService and caches it; subsequent calls return the same instance.\n * this.getHeavy().doExpensiveThing();\n * };\n * }\n * ```\n */\nexport function injectLazy<T>(token: ProviderToken<T>): () => T;\n\n/**\n * Defers the resolution and instantiation of an optional token until the\n * returned getter is called. Returns `null` (not undefined) when the token\n * isn't provided, matching Angular's `inject(token, { optional: true })`\n * semantics.\n *\n * @typeParam T The type of the resolved dependency.\n * @param token The dependency token to inject.\n * @param options Injection options specifying optional resolution.\n * @returns A getter function that returns the lazily resolved dependency or `null`.\n *\n * @example\n * ```ts\n * const getAnalytics = injectLazy(AnalyticsService, { optional: true });\n *\n * function trackEvent(name: string) {\n * getAnalytics()?.track(name); // safely no-op if Analytics isn't provided\n * }\n * ```\n */\nexport function injectLazy<T>(\n token: ProviderToken<T>,\n options: OptionalInjectOptions,\n): () => T | null;\n\n/**\n * Defers the resolution and instantiation of a token until the returned getter function is called.\n * The resolved value is cached for subsequent calls.\n *\n * @param token The dependency token to inject.\n * @param options Injection options specifying non-optional resolution.\n * @returns A getter function that returns the lazily resolved dependency.\n */\nexport function injectLazy<T>(\n token: ProviderToken<T>,\n options: NonOptionalInjectOptions,\n): () => T;\n\n/**\n * Defers reading a host attribute until the returned getter is called.\n * Mirrors {@link HostAttributeToken} resolution but lazily.\n *\n * @param token The host attribute token to inject.\n * @returns A getter function that returns the lazily resolved attribute string.\n *\n * @example\n * ```ts\n * @Directive({ ... })\n * class MyDirective {\n * private readonly getRole = injectLazy(new HostAttributeToken('role'));\n * // Only reads the DOM attribute when first accessed.\n * }\n * ```\n */\nexport function injectLazy(token: HostAttributeToken): () => string;\n\n/**\n * Defers the resolution and instantiation of a host attribute token until the returned getter function is called.\n * The resolved value is cached for subsequent calls.\n *\n * @param token The host attribute token to inject.\n * @param options Injection options specifying non-optional resolution.\n * @returns A getter function that returns the lazily resolved attribute string.\n */\nexport function injectLazy(\n token: HostAttributeToken,\n options?: {\n optional?: false;\n },\n): () => string;\n\n/**\n * Defers the resolution and instantiation of a host attribute token until the returned getter function is called.\n * The resolved value is cached for subsequent calls.\n *\n * @param token The host attribute token to inject.\n * @param options Injection options specifying optional resolution.\n * @returns A getter function that returns the lazily resolved attribute string or null.\n */\nexport function injectLazy(\n token: HostAttributeToken,\n options: {\n optional: true;\n },\n): () => string | null;\n\nexport function injectLazy<T>(\n token: ProviderToken<T> | HostAttributeToken,\n options?: Partial<OptionalInjectOptions | NonOptionalInjectOptions>,\n): () => T | string | null {\n const injector = inject(Injector);\n let instance: T | string | null | typeof UNINITIALIZED_SYMBOL =\n UNINITIALIZED_SYMBOL;\n\n return () => {\n if (instance === UNINITIALIZED_SYMBOL)\n instance = runInInjectionContext(injector, () => {\n return options\n ? inject(token as any, options as any)\n : inject(token as any);\n });\n\n return instance as T | string | null;\n };\n}\n","import {\n inject,\n InjectionToken,\n type AbstractType,\n type InjectOptions,\n type Provider,\n type Type,\n} from '@angular/core';\n\ntype ServiceType<T> =\n T extends Type<infer U>\n ? U\n : T extends AbstractType<infer U>\n ? U\n : T extends InjectionToken<infer U>\n ? U\n : never;\n\ntype MapDeps<T extends readonly any[]> = {\n [K in keyof T]: ServiceType<T[K]>;\n};\n\ntype ProviderFn<T> = {\n (value: T): Provider;\n <const TDeps extends any[]>(\n fn: (...deps: MapDeps<TDeps>) => T,\n deps: TDeps,\n ): Provider;\n};\n\ntype InjectFns<T> = [\n (opt?: Omit<InjectOptions, 'optional'>) => T,\n ProviderFn<T>,\n];\n\ntype FallbackInjectableOptions<T> = {\n /** Default value returned when the injectable is not provided */\n fallback: T;\n};\n\ntype LazyFallbackInjectableOptions<T> = {\n /** Function that returns a default value when the injectable is not provided. Useful for expensive defaults. */\n lazyFallback: () => T;\n};\n\ntype ErrorMessageInjectableOptions = {\n /** Error message thrown when the injectable is not provided */\n errorMessage: string;\n};\n\ntype InjectableOptions<T> =\n | FallbackInjectableOptions<T>\n | LazyFallbackInjectableOptions<T>\n | ErrorMessageInjectableOptions;\n\n/**\n * Creates a typed `InjectionToken` plus a tuple of `[inject, provide]` helpers.\n * Without configuration, the inject helper returns `T | null` when the token\n * hasn't been provided.\n *\n * @typeParam T The type of the value the token holds.\n * @param token Unique token identifier (used as the token's debug name).\n * @returns A tuple `[injectFn, provideFn]` for type-safe dependency injection.\n *\n * @example\n * ```ts\n * const [injectTheme, provideTheme] = injectable<'dark' | 'light'>('Theme');\n *\n * // In a provider scope:\n * bootstrapApplication(App, { providers: [provideTheme('dark')] });\n *\n * // In a consumer:\n * const theme = injectTheme(); // 'dark' | 'light' | null\n * ```\n */\nexport function injectable<T>(token: string): InjectFns<T | null>;\n\n/**\n * Creates a typed `InjectionToken` with an eager fallback value. The inject\n * helper returns `T` (never `null`): when the token isn't provided, the\n * configured `fallback` is returned.\n *\n * @typeParam T The type of the value the token holds.\n * @param token Unique token identifier.\n * @param opt Configuration with `fallback` value (evaluated immediately).\n * @returns A tuple `[injectFn, provideFn]` for type-safe dependency injection.\n *\n * @example\n * ```ts\n * const [injectConfig, provideConfig] = injectable<Config>('Config', {\n * fallback: { apiUrl: 'https://api.example.com', retries: 3 },\n * });\n *\n * const config = injectConfig(); // Always Config — never null\n * ```\n */\nexport function injectable<T>(\n token: string,\n opt: FallbackInjectableOptions<T>,\n): InjectFns<T>;\n\n/**\n * Creates a typed `InjectionToken` with a *lazy* fallback. The fallback\n * factory runs on first access (and only once) when the token isn't\n * provided — useful when constructing the default is expensive or has its\n * own dependencies.\n *\n * @typeParam T The type of the value the token holds.\n * @param token Unique token identifier.\n * @param opt Configuration with `lazyFallback` factory (deferred until needed).\n * @returns A tuple `[injectFn, provideFn]` for type-safe dependency injection.\n *\n * @example\n * ```ts\n * const [injectCache, provideCache] = injectable<Cache>('Cache', {\n * lazyFallback: () => new Cache({ size: 1000 }), // only constructed if no override is provided\n * });\n * ```\n */\nexport function injectable<T>(\n token: string,\n opt: LazyFallbackInjectableOptions<T>,\n): InjectFns<T>;\n\n/**\n * Creates a typed `InjectionToken` that throws a custom error message when\n * the token isn't provided. Use this when \"no provider\" is genuinely a bug\n * rather than a permitted state.\n *\n * @typeParam T The type of the value the token holds.\n * @param token Unique token identifier.\n * @param opt Configuration with `errorMessage` to throw on missing provider.\n * @returns A tuple `[injectFn, provideFn]` for type-safe dependency injection.\n *\n * @example\n * ```ts\n * const [injectAuth, provideAuth] = injectable<AuthService>('Auth', {\n * errorMessage: 'AuthService must be provided before any consumer reads it',\n * });\n *\n * const auth = injectAuth(); // throws if no provideAuth(...) is in scope\n * ```\n */\nexport function injectable<T>(\n token: string,\n opt: ErrorMessageInjectableOptions,\n): InjectFns<T>;\n\n/**\n * Creates a typed `InjectionToken` with a baked-in factory used as the lazy\n * fallback. The factory runs in an injection context, so it can use\n * `inject()` to compose dependencies.\n *\n * @typeParam T The type of the value the factory produces.\n * @param fn Factory function evaluated lazily on first inject if no override is provided.\n * @param name Optional token name (used as the debug name).\n * @returns A tuple `[injectFn, provideFn]` for type-safe dependency injection.\n *\n * @example\n * ```ts\n * const [injectUser, provideUser] = injectable(\n * () => inject(HttpClient).get<User>('/api/me'),\n * 'CurrentUser',\n * );\n * ```\n */\nexport function injectable<T>(fn: () => T, name?: string): InjectFns<T>;\n\nexport function injectable<T>(\n tokenOrFn: string | (() => T),\n optOrString?: InjectableOptions<T> | string,\n): InjectFns<T> {\n const token =\n typeof tokenOrFn === 'string'\n ? tokenOrFn\n : typeof optOrString === 'string'\n ? optOrString\n : '@mmstack/di/injectable';\n\n const opt =\n typeof tokenOrFn === 'function'\n ? { lazyFallback: tokenOrFn }\n : typeof optOrString === 'string'\n ? undefined\n : optOrString;\n\n const injectionToken = new InjectionToken<T>(token);\n\n const options = opt as\n | Partial<\n FallbackInjectableOptions<T> &\n LazyFallbackInjectableOptions<T> &\n ErrorMessageInjectableOptions\n >\n | undefined;\n\n let fallback: T | undefined | null = options?.fallback;\n\n const initFallback =\n options?.lazyFallback ?? (() => options?.fallback ?? null);\n\n const fallbackFn = () => {\n if (fallback === undefined) fallback = initFallback();\n return fallback;\n };\n\n const injectFn = (iOpt?: Omit<InjectOptions, 'optional'>) => {\n const injected =\n inject(injectionToken, {\n ...iOpt,\n optional: true,\n }) ?? fallbackFn();\n\n if (injected === null && options?.errorMessage)\n throw new Error(options.errorMessage);\n\n return injected as T;\n };\n\n const provideFn = (\n fnOrValue: T | ((...deps: any[]) => T),\n deps?: any[],\n ): Provider => {\n if (deps !== undefined)\n return {\n provide: injectionToken,\n useFactory: fnOrValue as (...args: any[]) => T,\n deps,\n };\n\n return {\n provide: injectionToken,\n useValue: fnOrValue,\n };\n };\n\n return [injectFn, provideFn];\n}\n","import { inject, InjectionToken, Injector } from '@angular/core';\n\n/**\n * Creates a root-level singleton wired into the global (`providedIn: 'root'`)\n * injector. Returns a typed `inject()` helper — calling it anywhere in an\n * injection context yields the same singleton instance. Useful for app-wide\n * signal stores, configuration, or services that don't need per-component\n * scoping.\n *\n * @typeParam T The type of the singleton value produced by the factory.\n * @param factory Factory invoked once (lazily) to construct the singleton.\n * Receives the root `Injector` for cases where `inject()` isn't ergonomic.\n * @param name Optional token name (used as the debug name).\n * @returns A getter function that returns the same singleton instance on every call.\n *\n * @example\n * ```ts\n * // Define once at module scope:\n * const injectCurrentUser = rootInjectable(\n * () => signal<User | null>(null),\n * 'CurrentUser',\n * );\n *\n * // Consume from anywhere in an injection context:\n * @Component({ ... })\n * class HeaderComponent {\n * readonly user = injectCurrentUser();\n * }\n * ```\n */\nexport function rootInjectable<T>(\n factory: (injector: Injector) => T, // Keeping the injector just in case\n name?: string,\n): () => T {\n const token = new InjectionToken<T>(name ?? '@mmstack/di/root-injectable', {\n providedIn: 'root',\n factory: () => factory(inject(Injector)),\n });\n\n return () => inject(token);\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;AAEA;;;;;;;;;;;;;;;;;;;;;;AAsBG;AACG,SAAU,2BAA2B,CAAC,QAAmB,EAAA;AAC7D,IAAA,IAAI,CAAC,QAAQ;AAAE,QAAA,QAAQ,GAAG,MAAM,CAAC,QAAQ,CAAC;IAE1C,OAAO,CAAI,EAAW,KAAK,qBA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,OAAO,CAAC,QAAQ,EAAE,SAAS,CAAC;AAC9B;;AC3OA;;;;;;;;;;;;;;;;;;;;;;;;;;;AA2BG;AACG,SAAU,cAAc,CAC5B,OAAkC;AAClC,IAAa,EAAA;IAEb,MAAM,KAAK,GAAG,IAAI,cAAc,CAAI,IAAI,IAAI,6BAA6B,EAAE;AACzE,QAAA,UAAU,EAAE,MAAM;QAClB,OAAO,EAAE,MAAM,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;AACzC,KAAA,CAAC;AAEF,IAAA,OAAO,MAAM,MAAM,CAAC,KAAK,CAAC;AAC5B;;ACxCA;;AAEG;;;;"}
1
+ {"version":3,"file":"mmstack-di.mjs","sources":["../../../../packages/di/src/lib/create-run-in-injection-context.ts","../../../../packages/di/src/lib/create-scope.ts","../../../../packages/di/src/lib/inject-lazy.ts","../../../../packages/di/src/lib/injectable.ts","../../../../packages/di/src/lib/root-injectable.ts","../../../../packages/di/src/mmstack-di.ts"],"sourcesContent":["import { inject, Injector, runInInjectionContext } from '@angular/core';\n\n/**\n * Captures an injection context and returns a runner function.\n *\n * This runner function allows you to execute callbacks inside the captured context at a later time.\n * It's really just a slight DX improvement over calling `runInInjectionContext` over and over.\n *\n * @param injector An optional injector. If not provided, the current context's injector is pulled natively via `inject(Injector)`.\n * @returns A runner function that executes any provided callback within the captured context.\n *\n * @example\n * ```ts\n * @Component({ ... })\n * class MyComponent {\n * // Capture at construction so we can run injection-context code later.\n * private readonly run = createRunInInjectionContext();\n *\n * onClick = () => {\n * // `inject()` works here even though we're no longer in an injection context.\n * const value = this.run(() => inject(SomeService).doThing());\n * };\n * }\n * ```\n */\nexport function createRunInInjectionContext(injector?: Injector) {\n if (!injector) injector = inject(Injector);\n\n return <T>(fn: () => T) => runInInjectionContext(injector, fn);\n}\n","import {\n inject,\n Injectable,\n InjectionToken,\n Injector,\n runInInjectionContext,\n type Provider,\n} from '@angular/core';\n\n@Injectable()\nclass ScopeRegistry {\n private readonly injector = inject(Injector);\n // eslint-disable-next-line @typescript-eslint/no-unsafe-function-type\n private readonly registry = new Map<Function, any>();\n // eslint-disable-next-line @typescript-eslint/no-unsafe-function-type\n private readonly resolving = new Set<Function>();\n\n getOrCreate<T>(factory: () => T, scopeName?: string, factoryName?: string): T {\n if (this.registry.has(factory)) return this.registry.get(factory);\n if (this.resolving.has(factory))\n throw new Error(\n `[mmstack/di]: Circular dependency detected in scope \"${scopeName ?? 'unknown'}\"${factoryName ? ` while resolving \"${factoryName}\"` : ''}`,\n );\n\n this.resolving.add(factory);\n try {\n const val = runInInjectionContext(this.injector, factory);\n this.registry.set(factory, val);\n return val;\n } finally {\n this.resolving.delete(factory);\n }\n }\n}\n\n/**\n * Creates a specialized dependency injection scope.\n *\n * This utility allows you to create a localized dependency injection scope where you can\n * register and provide shared state, services, or primitives that are bound to a specific\n * component tree instead of the global root injector.\n *\n * @param name Optional name for the scope, primarily used for debugging and error messages.\n * @returns A tuple containing `[registerFn, provideFn]`:\n * - `registerFn`: A function to register a factory within the scope. Returns an injection function to retrieve the value.\n * - `provideFn`: An Angular provider function that must be added to the `providers` array where the scope begins.\n *\n * @example\n * ```ts\n * const [registerInUserScope, provideUserScope] = createScope('UserScope');\n *\n * // Define a state/service bound to this scope\n * const injectUserState = registerInUserScope(() => signal({ name: 'John Doe' }));\n * const injectLogger = registerInUserScope(() => {\n * const globalLogger = inject(GlobalLogger);\n * const user = injectUserState();\n * return {\n * log: (msg: string) => globalLogger.log(`[USER MODULE (${user().name})]: ${msg}`),\n * }\n * })\n * @Component({\n * providers: [provideUserScope()] // provides a new instance of every dependency registered to the scope\n * })\n * class ParentComponent {}\n *\n * @Component({})\n * class ChildComponent {\n * readonly userState = injectUserState();\n * readonly logger = injectLogger();\n * }\n * ```\n */\nexport function createScope(name?: string) {\n const token = new InjectionToken<ScopeRegistry>(name ?? '@mmstack/di/scope');\n\n const provideFn = (): Provider => ({\n provide: token,\n useClass: ScopeRegistry,\n });\n\n const registerFn = <T>(factory: () => T, factoryName?: string) => {\n return () => {\n const registry = inject(token, { optional: true });\n if (!registry)\n throw new Error(\n `[mmstack/di]: Scope ${name ?? 'unknown'} not found. Please make sure you provide it`,\n );\n\n return registry.getOrCreate(factory, name, factoryName);\n };\n };\n\n return [registerFn, provideFn] as const;\n}\n","import {\n inject,\n Injector,\n runInInjectionContext,\n type HostAttributeToken,\n type InjectOptions,\n type ProviderToken,\n} from '@angular/core';\n\nconst UNINITIALIZED_SYMBOL = Symbol('@mmstack/di/inject-lazy/uninitialized');\n\ntype OptionalInjectOptions = Omit<InjectOptions, 'optional'> & {\n optional: true;\n};\n\ntype NonOptionalInjectOptions = Omit<InjectOptions, 'optional'> & {\n optional?: false;\n};\n\n/**\n * Defers the resolution and instantiation of a token until the returned getter\n * function is called. The resolved value is cached for subsequent calls — the\n * actual `inject()` call happens at most once, on first access.\n *\n * Useful for services that are expensive to construct, or for breaking\n * circular dependency chains in component fields.\n *\n * @typeParam T The type of the resolved dependency.\n * @param token The dependency token to inject.\n * @returns A getter function that returns the lazily resolved dependency.\n *\n * @example\n * ```ts\n * @Component({ ... })\n * class MyComponent {\n * // Injection context captured at construction; HeavyService is NOT instantiated yet.\n * private readonly getHeavy = injectLazy(HeavyService);\n *\n * onClick = () => {\n * // First access constructs HeavyService and caches it; subsequent calls return the same instance.\n * this.getHeavy().doExpensiveThing();\n * };\n * }\n * ```\n */\nexport function injectLazy<T>(token: ProviderToken<T>): () => T;\n\n/**\n * Defers the resolution and instantiation of an optional token until the\n * returned getter is called. Returns `null` (not undefined) when the token\n * isn't provided, matching Angular's `inject(token, { optional: true })`\n * semantics.\n *\n * @typeParam T The type of the resolved dependency.\n * @param token The dependency token to inject.\n * @param options Injection options specifying optional resolution.\n * @returns A getter function that returns the lazily resolved dependency or `null`.\n *\n * @example\n * ```ts\n * const getAnalytics = injectLazy(AnalyticsService, { optional: true });\n *\n * function trackEvent(name: string) {\n * getAnalytics()?.track(name); // safely no-op if Analytics isn't provided\n * }\n * ```\n */\nexport function injectLazy<T>(\n token: ProviderToken<T>,\n options: OptionalInjectOptions,\n): () => T | null;\n\n/**\n * Defers the resolution and instantiation of a token until the returned getter function is called.\n * The resolved value is cached for subsequent calls.\n *\n * @param token The dependency token to inject.\n * @param options Injection options specifying non-optional resolution.\n * @returns A getter function that returns the lazily resolved dependency.\n */\nexport function injectLazy<T>(\n token: ProviderToken<T>,\n options: NonOptionalInjectOptions,\n): () => T;\n\n/**\n * Defers reading a host attribute until the returned getter is called.\n * Mirrors {@link HostAttributeToken} resolution but lazily.\n *\n * @param token The host attribute token to inject.\n * @returns A getter function that returns the lazily resolved attribute string.\n *\n * @example\n * ```ts\n * @Directive({ ... })\n * class MyDirective {\n * private readonly getRole = injectLazy(new HostAttributeToken('role'));\n * // Only reads the DOM attribute when first accessed.\n * }\n * ```\n */\nexport function injectLazy(token: HostAttributeToken): () => string;\n\n/**\n * Defers the resolution and instantiation of a host attribute token until the returned getter function is called.\n * The resolved value is cached for subsequent calls.\n *\n * @param token The host attribute token to inject.\n * @param options Injection options specifying non-optional resolution.\n * @returns A getter function that returns the lazily resolved attribute string.\n */\nexport function injectLazy(\n token: HostAttributeToken,\n options?: {\n optional?: false;\n },\n): () => string;\n\n/**\n * Defers the resolution and instantiation of a host attribute token until the returned getter function is called.\n * The resolved value is cached for subsequent calls.\n *\n * @param token The host attribute token to inject.\n * @param options Injection options specifying optional resolution.\n * @returns A getter function that returns the lazily resolved attribute string or null.\n */\nexport function injectLazy(\n token: HostAttributeToken,\n options: {\n optional: true;\n },\n): () => string | null;\n\nexport function injectLazy<T>(\n token: ProviderToken<T> | HostAttributeToken,\n options?: Partial<OptionalInjectOptions | NonOptionalInjectOptions>,\n): () => T | string | null {\n const injector = inject(Injector);\n let instance: T | string | null | typeof UNINITIALIZED_SYMBOL =\n UNINITIALIZED_SYMBOL;\n\n return () => {\n if (instance === UNINITIALIZED_SYMBOL)\n instance = runInInjectionContext(injector, () => {\n return options\n ? inject(token as any, options as any)\n : inject(token as any);\n });\n\n return instance as T | string | null;\n };\n}\n","import {\n inject,\n InjectionToken,\n type AbstractType,\n type InjectOptions,\n type Provider,\n type Type,\n} from '@angular/core';\n\ntype ServiceType<T> =\n T extends Type<infer U>\n ? U\n : T extends AbstractType<infer U>\n ? U\n : T extends InjectionToken<infer U>\n ? U\n : never;\n\ntype MapDeps<T extends readonly any[]> = {\n [K in keyof T]: ServiceType<T[K]>;\n};\n\ntype ProviderFn<T> = {\n (value: T): Provider;\n <const TDeps extends any[]>(\n fn: (...deps: MapDeps<TDeps>) => T,\n deps: TDeps,\n ): Provider;\n};\n\ntype InjectFns<T> = [\n (opt?: Omit<InjectOptions, 'optional'>) => T,\n ProviderFn<T>,\n];\n\ntype FallbackInjectableOptions<T> = {\n /** Default value returned when the injectable is not provided */\n fallback: T;\n};\n\ntype LazyFallbackInjectableOptions<T> = {\n /** Function that returns a default value when the injectable is not provided. Useful for expensive defaults. */\n lazyFallback: () => T;\n};\n\ntype ErrorMessageInjectableOptions = {\n /** Error message thrown when the injectable is not provided */\n errorMessage: string;\n};\n\ntype InjectableOptions<T> =\n | FallbackInjectableOptions<T>\n | LazyFallbackInjectableOptions<T>\n | ErrorMessageInjectableOptions;\n\n/**\n * Creates a typed `InjectionToken` plus a tuple of `[inject, provide]` helpers.\n * Without configuration, the inject helper returns `T | null` when the token\n * hasn't been provided.\n *\n * @typeParam T The type of the value the token holds.\n * @param token Unique token identifier (used as the token's debug name).\n * @returns A tuple `[injectFn, provideFn]` for type-safe dependency injection.\n *\n * @example\n * ```ts\n * const [injectTheme, provideTheme] = injectable<'dark' | 'light'>('Theme');\n *\n * // In a provider scope:\n * bootstrapApplication(App, { providers: [provideTheme('dark')] });\n *\n * // In a consumer:\n * const theme = injectTheme(); // 'dark' | 'light' | null\n * ```\n */\nexport function injectable<T>(token: string): InjectFns<T | null>;\n\n/**\n * Creates a typed `InjectionToken` with an eager fallback value. The inject\n * helper returns `T` (never `null`): when the token isn't provided, the\n * configured `fallback` is returned.\n *\n * @typeParam T The type of the value the token holds.\n * @param token Unique token identifier.\n * @param opt Configuration with `fallback` value (evaluated immediately).\n * @returns A tuple `[injectFn, provideFn]` for type-safe dependency injection.\n *\n * @example\n * ```ts\n * const [injectConfig, provideConfig] = injectable<Config>('Config', {\n * fallback: { apiUrl: 'https://api.example.com', retries: 3 },\n * });\n *\n * const config = injectConfig(); // Always Config — never null\n * ```\n */\nexport function injectable<T>(\n token: string,\n opt: FallbackInjectableOptions<T>,\n): InjectFns<T>;\n\n/**\n * Creates a typed `InjectionToken` with a *lazy* fallback. The fallback\n * factory runs on first access (and only once) when the token isn't\n * provided — useful when constructing the default is expensive or has its\n * own dependencies.\n *\n * @typeParam T The type of the value the token holds.\n * @param token Unique token identifier.\n * @param opt Configuration with `lazyFallback` factory (deferred until needed).\n * @returns A tuple `[injectFn, provideFn]` for type-safe dependency injection.\n *\n * @example\n * ```ts\n * const [injectCache, provideCache] = injectable<Cache>('Cache', {\n * lazyFallback: () => new Cache({ size: 1000 }), // only constructed if no override is provided\n * });\n * ```\n */\nexport function injectable<T>(\n token: string,\n opt: LazyFallbackInjectableOptions<T>,\n): InjectFns<T>;\n\n/**\n * Creates a typed `InjectionToken` that throws a custom error message when\n * the token isn't provided. Use this when \"no provider\" is genuinely a bug\n * rather than a permitted state.\n *\n * @typeParam T The type of the value the token holds.\n * @param token Unique token identifier.\n * @param opt Configuration with `errorMessage` to throw on missing provider.\n * @returns A tuple `[injectFn, provideFn]` for type-safe dependency injection.\n *\n * @example\n * ```ts\n * const [injectAuth, provideAuth] = injectable<AuthService>('Auth', {\n * errorMessage: 'AuthService must be provided before any consumer reads it',\n * });\n *\n * const auth = injectAuth(); // throws if no provideAuth(...) is in scope\n * ```\n */\nexport function injectable<T>(\n token: string,\n opt: ErrorMessageInjectableOptions,\n): InjectFns<T>;\n\n/**\n * Creates a typed `InjectionToken` with a baked-in factory used as the lazy\n * fallback. The factory runs in an injection context, so it can use\n * `inject()` to compose dependencies.\n *\n * @typeParam T The type of the value the factory produces.\n * @param fn Factory function evaluated lazily on first inject if no override is provided.\n * @param name Optional token name (used as the debug name).\n * @returns A tuple `[injectFn, provideFn]` for type-safe dependency injection.\n *\n * @example\n * ```ts\n * const [injectUser, provideUser] = injectable(\n * () => inject(HttpClient).get<User>('/api/me'),\n * 'CurrentUser',\n * );\n * ```\n */\nexport function injectable<T>(fn: () => T, name?: string): InjectFns<T>;\n\nexport function injectable<T>(\n tokenOrFn: string | (() => T),\n optOrString?: InjectableOptions<T> | string,\n): InjectFns<T> {\n const token =\n typeof tokenOrFn === 'string'\n ? tokenOrFn\n : typeof optOrString === 'string'\n ? optOrString\n : '@mmstack/di/injectable';\n\n const opt =\n typeof tokenOrFn === 'function'\n ? { lazyFallback: tokenOrFn }\n : typeof optOrString === 'string'\n ? undefined\n : optOrString;\n\n const injectionToken = new InjectionToken<T>(token);\n\n const options = opt as\n | Partial<\n FallbackInjectableOptions<T> &\n LazyFallbackInjectableOptions<T> &\n ErrorMessageInjectableOptions\n >\n | undefined;\n\n let fallback: T | undefined | null = options?.fallback;\n\n const initFallback =\n options?.lazyFallback ?? (() => options?.fallback ?? null);\n\n const fallbackFn = () => {\n if (fallback === undefined) fallback = initFallback();\n return fallback;\n };\n\n const injectFn = (iOpt?: Omit<InjectOptions, 'optional'>) => {\n const injected =\n inject(injectionToken, {\n ...iOpt,\n optional: true,\n }) ?? fallbackFn();\n\n if (injected === null && options?.errorMessage)\n throw new Error(options.errorMessage);\n\n return injected as T;\n };\n\n const provideFn = (\n fnOrValue: T | ((...deps: any[]) => T),\n deps?: any[],\n ): Provider => {\n if (deps !== undefined)\n return {\n provide: injectionToken,\n useFactory: fnOrValue as (...args: any[]) => T,\n deps,\n };\n\n return {\n provide: injectionToken,\n useValue: fnOrValue,\n };\n };\n\n return [injectFn, provideFn];\n}\n","import { inject, InjectionToken, Injector } from '@angular/core';\n\n/**\n * Creates a root-level singleton wired into the global (`providedIn: 'root'`)\n * injector. Returns a typed `inject()` helper — calling it anywhere in an\n * injection context yields the same singleton instance. Useful for app-wide\n * signal stores, configuration, or services that don't need per-component\n * scoping.\n *\n * @typeParam T The type of the singleton value produced by the factory.\n * @param factory Factory invoked once (lazily) to construct the singleton.\n * Receives the root `Injector` for cases where `inject()` isn't ergonomic.\n * @param name Optional token name (used as the debug name).\n * @returns A getter function that returns the same singleton instance on every call.\n *\n * @example\n * ```ts\n * // Define once at module scope:\n * const injectCurrentUser = rootInjectable(\n * () => signal<User | null>(null),\n * 'CurrentUser',\n * );\n *\n * // Consume from anywhere in an injection context:\n * @Component({ ... })\n * class HeaderComponent {\n * readonly user = injectCurrentUser();\n * }\n * ```\n */\nexport function rootInjectable<T>(\n factory: (injector: Injector) => T, // Keeping the injector just in case\n name?: string,\n): () => T {\n const token = new InjectionToken<T>(name ?? '@mmstack/di/root-injectable', {\n providedIn: 'root',\n factory: () => factory(inject(Injector)),\n });\n\n return () => inject(token);\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;AAEA;;;;;;;;;;;;;;;;;;;;;;AAsBG;AACG,SAAU,2BAA2B,CAAC,QAAmB,EAAA;AAC7D,IAAA,IAAI,CAAC,QAAQ;AAAE,QAAA,QAAQ,GAAG,MAAM,CAAC,QAAQ,CAAC;IAE1C,OAAO,CAAI,EAAW,KAAK,qBAAqB,CAAC,QAAQ,EAAE,EAAE,CAAC;AAChE;;ACpBA,MACM,aAAa,CAAA;AACA,IAAA,QAAQ,GAAG,MAAM,CAAC,QAAQ,CAAC;;AAE3B,IAAA,QAAQ,GAAG,IAAI,GAAG,EAAiB;;AAEnC,IAAA,SAAS,GAAG,IAAI,GAAG,EAAY;AAEhD,IAAA,WAAW,CAAI,OAAgB,EAAE,SAAkB,EAAE,WAAoB,EAAA;AACvE,QAAA,IAAI,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,OAAO,CAAC;YAAE,OAAO,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,OAAO,CAAC;AACjE,Q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json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mmstack/di",
3
- "version": "21.0.7",
3
+ "version": "22.0.0",
4
4
  "keywords": [
5
5
  "angular",
6
6
  "dependency injection",
@@ -17,7 +17,7 @@
17
17
  },
18
18
  "homepage": "https://github.com/mihajm/mmstack/blob/master/packages/di",
19
19
  "peerDependencies": {
20
- "@angular/core": ">=21 <22"
20
+ "@angular/core": ">=22 <23"
21
21
  },
22
22
  "sideEffects": false,
23
23
  "module": "fesm2022/mmstack-di.mjs",