1- /* Version: 0.27.0 - May 16, 2026 06:37:44 */
1+ /* Version: 0.27.0 - May 16, 2026 06:50:12 */
22/**
33 * Canonical token names for the built-in injectables exposed by the core `ng`
44 * module.
@@ -2141,48 +2141,22 @@ function createPersistentProxy(target, key, storage, options = {}) {
21412141 });
21422142}
21432143
2144- /**
2145- * A value is "injectable" if it is a function, or if it is an ng1
2146- * array-notation-style array where the head is strings and the tail is a
2147- * function.
2148- */
2149- function isInjectable(val) {
2150- if (isArray(val) && val.length > 0) {
2151- const lastIndex = val.length - 1;
2152- for (let i = 0; i < lastIndex; i++) {
2153- if (!isString(val[i]))
2154- return false;
2155- }
2156- return isFunction(val[lastIndex]);
2157- }
2158- return isFunction(val);
2159- }
2160- /**
2161- * It is probably a Promise if it's an object and it has a function `then`.
2162- */
2163- function isPromise(obj) {
2164- return (obj !== null &&
2165- typeof obj === "object" &&
2166- isFunction(obj.then));
2167- }
2168-
21692144const BADARG = "badarg";
21702145const reasons = new Map([
21712146 [notNullOrUndefined, "required"],
21722147 [isArray, "notarray"],
2173- [isInjectable, "notinjectable"],
21742148 [isDefined, "required"],
21752149 [isString, "notstring"],
21762150]);
2177- function getReason(val) {
2178- return reasons.get(val) ?? "fail";
2151+ function getReason(val, reason ) {
2152+ return reason ?? reasons.get(val) ?? "fail";
21792153}
21802154/**
21812155 * Validate a value using a predicate function.
21822156 * Throws if the predicate returns false.
21832157 * IMPORTANT: use this function only for developer errors and not user/data errors.
21842158 */
2185- function validate(fn, arg, name) {
2159+ function validate(fn, arg, name, reason ) {
21862160 if (fn(arg)) {
21872161 return arg;
21882162 }
@@ -2193,7 +2167,7 @@ function validate(fn, arg, name) {
21932167 catch {
21942168 serialized = String(arg);
21952169 }
2196- throw new TypeError(`badarg:${getReason(fn)} ${name}=${serialized}`);
2170+ throw new TypeError(`badarg:${getReason(fn, reason )} ${name}=${serialized}`);
21972171}
21982172function validateRequired(arg, name) {
21992173 return validate(notNullOrUndefined, arg, name);
@@ -2474,6 +2448,23 @@ function supportObject(delegate) {
24742448 };
24752449}
24762450
2451+ /**
2452+ * A value is injectable if it is a function, class constructor, or ng1
2453+ * array-notation-style value where dependency names are strings and the final
2454+ * item is callable.
2455+ */
2456+ function isInjectable(val) {
2457+ if (isArray(val) && val.length > 0) {
2458+ const lastIndex = val.length - 1;
2459+ for (let i = 0; i < lastIndex; i++) {
2460+ if (!isString(val[i]))
2461+ return false;
2462+ }
2463+ return isFunction(val[lastIndex]);
2464+ }
2465+ return isFunction(val);
2466+ }
2467+
24772468let eventBusInstance;
24782469/**
24792470 * Configurable provider for the application-wide {@link PubSub} event bus.
@@ -2715,7 +2706,7 @@ class NgModule {
27152706 * @returns {NgModule}
27162707 */
27172708 config(configFn) {
2718- validate(isInjectable, configFn, "configFn");
2709+ validate(isInjectable, configFn, "configFn", "notinjectable" );
27192710 this._configBlocks.push([_injector, "invoke", [configFn]]);
27202711 return this;
27212712 }
@@ -2724,7 +2715,7 @@ class NgModule {
27242715 * @returns {NgModule}
27252716 */
27262717 run(block) {
2727- validate(isInjectable, block, "block");
2718+ validate(isInjectable, block, "block", "notinjectable" );
27282719 this._runBlocks.push(block);
27292720 return this;
27302721 }
@@ -22366,13 +22357,13 @@ function stringify(value) {
2236622357 return "undefined";
2236722358 if (isNull(item))
2236822359 return "null";
22369- if (isPromise (item))
22360+ if (isPromiseLike (item))
2237022361 return "[Promise]";
2237122362 if (isRejection(item))
2237222363 return String(item._transitionRejection);
2237322364 if (hasToString(item))
2237422365 return String(callFunction(item.toString, item));
22375- if (isInjectable (item))
22366+ if (isFunction (item))
2237622367 return functionToString(item);
2237722368 return item;
2237822369 }
@@ -25984,7 +25975,7 @@ class TransitionHook {
2598425975 static _invokeHooks(hooks, doneCallback) {
2598525976 for (let idx = 0; idx < hooks.length; idx++) {
2598625977 const hookResult = hooks[idx]._invokeHook();
25987- if (isPromise (hookResult)) {
25978+ if (isPromiseLike (hookResult)) {
2598825979 return TransitionHook._chainThenDone(hooks, idx + 1, Promise.resolve(hookResult), doneCallback);
2598925980 }
2599025981 }
@@ -26007,7 +25998,7 @@ class TransitionHook {
2600725998 }
2600825999 /** @internal */
2600926000 static _logRejectedResult(hook, result) {
26010- if (isPromise (result)) {
26001+ if (isPromiseLike (result)) {
2601126002 Promise.resolve(result).catch((err) => {
2601226003 hook._logError(Rejection.normalize(err));
2601326004 });
@@ -26092,7 +26083,7 @@ class TransitionHook {
2609226083 return notCurrent;
2609326084 try {
2609426085 const result = this._invokeCallback(hook);
26095- if (!this._type._synchronous && isPromise (result)) {
26086+ if (!this._type._synchronous && isPromiseLike (result)) {
2609626087 return this._handleAsyncResult(result);
2609726088 }
2609826089 return this._handleResult(result);
@@ -26113,7 +26104,7 @@ class TransitionHook {
2611326104 const notCurrent = this._getNotCurrentRejection();
2611426105 if (notCurrent)
2611526106 return notCurrent;
26116- if (isPromise (result)) {
26107+ if (isPromiseLike (result)) {
2611726108 return this._handleAsyncHookResult(Promise.resolve(result));
2611826109 }
2611926110 if (result === false) {
0 commit comments