@adaas/a-concept 0.3.6 → 0.3.7

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.
@@ -1320,20 +1320,17 @@ var A_Meta = class _A_Meta {
1320
1320
  size() {
1321
1321
  return this.meta.size;
1322
1322
  }
1323
- /**
1324
- * This method is needed to convert the key to a regular expression and cover cases like:
1325
- *
1326
- * simple * e.g. "a*" instead of "a.*"
1327
- *
1328
- * simple ? e.g. "a?" instead of "a."
1329
- *
1330
- * etc.
1331
- *
1332
- * @param key
1333
- * @returns
1334
- */
1335
1323
  convertToRegExp(key) {
1336
- return key instanceof RegExp ? key : new RegExp(key);
1324
+ if (key instanceof RegExp) return key;
1325
+ if (!this._regExpCache) {
1326
+ this._regExpCache = /* @__PURE__ */ new Map();
1327
+ }
1328
+ let cached = this._regExpCache.get(key);
1329
+ if (!cached) {
1330
+ cached = new RegExp(key);
1331
+ this._regExpCache.set(key, cached);
1332
+ }
1333
+ return cached;
1337
1334
  }
1338
1335
  /**
1339
1336
  * Method to find values in the map by name.
@@ -3682,8 +3679,13 @@ var A_ComponentMeta = class extends A_Meta {
3682
3679
  };
3683
3680
 
3684
3681
  // src/lib/A-Scope/A-Scope.class.ts
3685
- var A_Scope = class {
3682
+ var _A_Scope = class _A_Scope {
3686
3683
  constructor(param1, param2) {
3684
+ /**
3685
+ * Unique numeric ID for this scope instance. Used as a cache key discriminator
3686
+ * to prevent collisions between scopes with the same name or version.
3687
+ */
3688
+ this.uid = _A_Scope._nextUid++;
3687
3689
  /**
3688
3690
  * Internal meta storage using A_Meta for type-safe key-value operations.
3689
3691
  * This stores all the scope's runtime data that can be accessed and modified
@@ -3691,6 +3693,23 @@ var A_Scope = class {
3691
3693
  */
3692
3694
  this._meta = new A_Meta();
3693
3695
  // ===========================================================================
3696
+ // --------------------Cache & Versioning--------------------------------------
3697
+ // ===========================================================================
3698
+ /**
3699
+ * Monotonically increasing version counter. Incremented on every mutation
3700
+ * (register, deregister, import, deimport, inherit, destroy) so that
3701
+ * external caches (e.g. A_Context feature-extension cache) can detect
3702
+ * staleness cheaply via numeric comparison.
3703
+ */
3704
+ this._version = 0;
3705
+ /**
3706
+ * Cache for resolveConstructor results (both positive and negative).
3707
+ * Key = constructor name (string) or constructor reference toString.
3708
+ * Value = resolved constructor or `null` for negative results.
3709
+ * Invalidated by incrementing _version (cache is cleared on bump).
3710
+ */
3711
+ this._resolveConstructorCache = /* @__PURE__ */ new Map();
3712
+ // ===========================================================================
3694
3713
  // --------------------ALLowed Constructors--------------------------------
3695
3714
  // ===========================================================================
3696
3715
  /**
@@ -3775,6 +3794,13 @@ var A_Scope = class {
3775
3794
  get allowedErrors() {
3776
3795
  return this._allowedErrors;
3777
3796
  }
3797
+ /**
3798
+ * Returns the current version of the scope. Each mutation increments the version,
3799
+ * allowing external caches to detect staleness via numeric comparison.
3800
+ */
3801
+ get version() {
3802
+ return this._version;
3803
+ }
3778
3804
  // ===========================================================================
3779
3805
  // --------------------Readonly Registered Properties--------------------------
3780
3806
  // ===========================================================================
@@ -3826,6 +3852,14 @@ var A_Scope = class {
3826
3852
  get parent() {
3827
3853
  return this._parent;
3828
3854
  }
3855
+ /**
3856
+ * Increments the scope version and clears internal caches.
3857
+ * Must be called on every scope mutation (register, deregister, import, deimport, inherit, destroy).
3858
+ */
3859
+ bumpVersion() {
3860
+ this._version++;
3861
+ this._resolveConstructorCache.clear();
3862
+ }
3829
3863
  /**
3830
3864
  * Generator to iterate through all parent scopes
3831
3865
  */
@@ -3959,6 +3993,7 @@ var A_Scope = class {
3959
3993
  if (this.issuer()) {
3960
3994
  A_Context.deallocate(this);
3961
3995
  }
3996
+ this.bumpVersion();
3962
3997
  }
3963
3998
  /**
3964
3999
  * Retrieves a value from the scope's meta.
@@ -4034,6 +4069,7 @@ var A_Scope = class {
4034
4069
  `Circular inheritance detected: ${[...circularCheck, parent.name].join(" -> ")}`
4035
4070
  );
4036
4071
  this._parent = parent;
4072
+ this.bumpVersion();
4037
4073
  return this;
4038
4074
  }
4039
4075
  /**
@@ -4055,6 +4091,7 @@ var A_Scope = class {
4055
4091
  if (this._imports.has(scope))
4056
4092
  return;
4057
4093
  this._imports.add(scope);
4094
+ this.bumpVersion();
4058
4095
  });
4059
4096
  return this;
4060
4097
  }
@@ -4067,8 +4104,10 @@ var A_Scope = class {
4067
4104
  */
4068
4105
  deimport(...scopes) {
4069
4106
  scopes.forEach((scope) => {
4070
- if (this._imports.has(scope))
4107
+ if (this._imports.has(scope)) {
4071
4108
  this._imports.delete(scope);
4109
+ this.bumpVersion();
4110
+ }
4072
4111
  });
4073
4112
  return this;
4074
4113
  }
@@ -4209,6 +4248,20 @@ var A_Scope = class {
4209
4248
  A_ScopeError.ResolutionError,
4210
4249
  `Invalid constructor name provided: ${name}`
4211
4250
  );
4251
+ const cacheKey = name;
4252
+ if (this._resolveConstructorCache.has(cacheKey)) {
4253
+ const cached = this._resolveConstructorCache.get(cacheKey);
4254
+ return cached === null ? void 0 : cached;
4255
+ }
4256
+ const resolved = this._resolveConstructorUncached(name);
4257
+ this._resolveConstructorCache.set(cacheKey, resolved ?? null);
4258
+ return resolved;
4259
+ }
4260
+ /**
4261
+ * Internal uncached implementation of resolveConstructor for string names.
4262
+ * Separated to allow the public method to wrap with caching.
4263
+ */
4264
+ _resolveConstructorUncached(name) {
4212
4265
  const component = Array.from(this.allowedComponents).find(
4213
4266
  (c) => c.name === name || c.name === A_FormatterHelper.toPascalCase(name)
4214
4267
  );
@@ -4556,6 +4609,7 @@ var A_Scope = class {
4556
4609
  param1
4557
4610
  );
4558
4611
  A_Context.register(this, param1);
4612
+ this.bumpVersion();
4559
4613
  break;
4560
4614
  }
4561
4615
  // 3) In case when it's a A-Entity instance
@@ -4564,6 +4618,7 @@ var A_Scope = class {
4564
4618
  this.allowedEntities.add(param1.constructor);
4565
4619
  this._entities.set(param1.aseid.toString(), param1);
4566
4620
  A_Context.register(this, param1);
4621
+ this.bumpVersion();
4567
4622
  break;
4568
4623
  }
4569
4624
  // 4) In case when it's a A-Fragment instance
@@ -4575,6 +4630,7 @@ var A_Scope = class {
4575
4630
  param1
4576
4631
  );
4577
4632
  A_Context.register(this, param1);
4633
+ this.bumpVersion();
4578
4634
  break;
4579
4635
  }
4580
4636
  // 5) In case when it's a A-Error instance
@@ -4586,6 +4642,7 @@ var A_Scope = class {
4586
4642
  param1
4587
4643
  );
4588
4644
  A_Context.register(this, param1);
4645
+ this.bumpVersion();
4589
4646
  break;
4590
4647
  }
4591
4648
  // ------------------------------------------
@@ -4593,26 +4650,34 @@ var A_Scope = class {
4593
4650
  // ------------------------------------------
4594
4651
  // 6) In case when it's a A-Component constructor
4595
4652
  case A_TypeGuards.isComponentConstructor(param1): {
4596
- if (!this.allowedComponents.has(param1))
4653
+ if (!this.allowedComponents.has(param1)) {
4597
4654
  this.allowedComponents.add(param1);
4655
+ this.bumpVersion();
4656
+ }
4598
4657
  break;
4599
4658
  }
4600
4659
  // 8) In case when it's a A-Fragment constructor
4601
4660
  case A_TypeGuards.isFragmentConstructor(param1): {
4602
- if (!this.allowedFragments.has(param1))
4661
+ if (!this.allowedFragments.has(param1)) {
4603
4662
  this.allowedFragments.add(param1);
4663
+ this.bumpVersion();
4664
+ }
4604
4665
  break;
4605
4666
  }
4606
4667
  // 9) In case when it's a A-Entity constructor
4607
4668
  case A_TypeGuards.isEntityConstructor(param1): {
4608
- if (!this.allowedEntities.has(param1))
4669
+ if (!this.allowedEntities.has(param1)) {
4609
4670
  this.allowedEntities.add(param1);
4671
+ this.bumpVersion();
4672
+ }
4610
4673
  break;
4611
4674
  }
4612
4675
  // 10) In case when it's a A-Error constructor
4613
4676
  case A_TypeGuards.isErrorConstructor(param1): {
4614
- if (!this.allowedErrors.has(param1))
4677
+ if (!this.allowedErrors.has(param1)) {
4615
4678
  this.allowedErrors.add(param1);
4679
+ this.bumpVersion();
4680
+ }
4616
4681
  break;
4617
4682
  }
4618
4683
  // ------------------------------------------
@@ -4652,6 +4717,7 @@ var A_Scope = class {
4652
4717
  if (!hasComponent) {
4653
4718
  this.allowedComponents.delete(ctor);
4654
4719
  }
4720
+ this.bumpVersion();
4655
4721
  break;
4656
4722
  }
4657
4723
  // 3) In case when it's a A-Entity instance
@@ -4663,6 +4729,7 @@ var A_Scope = class {
4663
4729
  if (!hasEntity) {
4664
4730
  this.allowedEntities.delete(ctor);
4665
4731
  }
4732
+ this.bumpVersion();
4666
4733
  break;
4667
4734
  }
4668
4735
  // 4) In case when it's a A-Fragment instance
@@ -4674,6 +4741,7 @@ var A_Scope = class {
4674
4741
  if (!hasFragment) {
4675
4742
  this.allowedFragments.delete(ctor);
4676
4743
  }
4744
+ this.bumpVersion();
4677
4745
  break;
4678
4746
  }
4679
4747
  // 5) In case when it's a A-Error instance
@@ -4685,6 +4753,7 @@ var A_Scope = class {
4685
4753
  if (!hasError) {
4686
4754
  this.allowedErrors.delete(ctor);
4687
4755
  }
4756
+ this.bumpVersion();
4688
4757
  break;
4689
4758
  }
4690
4759
  // ------------------------------------------
@@ -4693,6 +4762,7 @@ var A_Scope = class {
4693
4762
  // 6) In case when it's a A-Component constructor
4694
4763
  case A_TypeGuards.isComponentConstructor(param1): {
4695
4764
  this.allowedComponents.delete(param1);
4765
+ this.bumpVersion();
4696
4766
  break;
4697
4767
  }
4698
4768
  // 8) In case when it's a A-Fragment constructor
@@ -4704,6 +4774,7 @@ var A_Scope = class {
4704
4774
  A_Context.deregister(instance);
4705
4775
  }
4706
4776
  });
4777
+ this.bumpVersion();
4707
4778
  break;
4708
4779
  }
4709
4780
  // 9) In case when it's a A-Entity constructor
@@ -4715,6 +4786,7 @@ var A_Scope = class {
4715
4786
  A_Context.deregister(instance);
4716
4787
  }
4717
4788
  });
4789
+ this.bumpVersion();
4718
4790
  break;
4719
4791
  }
4720
4792
  // 10) In case when it's a A-Error constructor
@@ -4726,6 +4798,7 @@ var A_Scope = class {
4726
4798
  A_Context.deregister(instance);
4727
4799
  }
4728
4800
  });
4801
+ this.bumpVersion();
4729
4802
  break;
4730
4803
  }
4731
4804
  // ------------------------------------------
@@ -4846,6 +4919,11 @@ var A_Scope = class {
4846
4919
  console.log(chain.join(" -> "));
4847
4920
  }
4848
4921
  };
4922
+ /**
4923
+ * Auto-incrementing counter for generating unique scope IDs.
4924
+ */
4925
+ _A_Scope._nextUid = 0;
4926
+ var A_Scope = _A_Scope;
4849
4927
 
4850
4928
  // src/lib/A-Scope/A-Scope.error.ts
4851
4929
  var A_ScopeError = class extends A_Error {
@@ -4882,7 +4960,7 @@ A_ContextError.ComponentNotRegisteredError = "Component not registered in the co
4882
4960
  A_ContextError.InvalidDeregisterParameterError = "Invalid parameter provided to deregister component";
4883
4961
 
4884
4962
  // src/lib/A-Context/A-Context.class.ts
4885
- var A_Context = class _A_Context {
4963
+ var _A_Context = class _A_Context {
4886
4964
  /**
4887
4965
  * Private constructor to enforce singleton pattern.
4888
4966
  *
@@ -4909,6 +4987,18 @@ var A_Context = class _A_Context {
4909
4987
  * Meta provides to store extra information about the class behavior and configuration.
4910
4988
  */
4911
4989
  this._metaStorage = /* @__PURE__ */ new Map();
4990
+ /**
4991
+ * Monotonically increasing version counter for _metaStorage.
4992
+ * Incremented whenever a new entry is added to _metaStorage so that
4993
+ * caches depending on meta content can detect staleness.
4994
+ */
4995
+ this._metaVersion = 0;
4996
+ /**
4997
+ * Cache for featureExtensions results.
4998
+ * Key format: `${featureName}::${componentConstructorName}::${scopeVersion}::${metaVersion}`
4999
+ * Automatically invalidated when scope version or meta version changes.
5000
+ */
5001
+ this._featureExtensionsCache = /* @__PURE__ */ new Map();
4912
5002
  this._globals = /* @__PURE__ */ new Map();
4913
5003
  const name = String(A_CONCEPT_ENV.A_CONCEPT_ROOT_SCOPE) || "root";
4914
5004
  this._root = new A_Scope({ name });
@@ -5112,6 +5202,7 @@ var A_Context = class _A_Context {
5112
5202
  if (!inheritedMeta)
5113
5203
  inheritedMeta = new metaType();
5114
5204
  instance._metaStorage.set(property, inheritedMeta.clone());
5205
+ instance._metaVersion++;
5115
5206
  }
5116
5207
  return instance._metaStorage.get(property);
5117
5208
  }
@@ -5120,6 +5211,7 @@ var A_Context = class _A_Context {
5120
5211
  const existingMeta = _A_Context.meta(param1);
5121
5212
  const constructor = typeof param1 === "function" ? param1 : param1.constructor;
5122
5213
  instance._metaStorage.set(constructor, existingMeta ? meta.from(existingMeta) : meta);
5214
+ instance._metaVersion++;
5123
5215
  }
5124
5216
  /**
5125
5217
  *
@@ -5175,11 +5267,10 @@ var A_Context = class _A_Context {
5175
5267
  * @param name
5176
5268
  */
5177
5269
  static featureTemplate(name, component, scope = this.scope(component)) {
5178
- const componentName = A_CommonHelper.getComponentName(component);
5179
5270
  if (!component) throw new A_ContextError(A_ContextError.InvalidFeatureTemplateParameterError, `Unable to get feature template. Component cannot be null or undefined.`);
5180
5271
  if (!name) throw new A_ContextError(A_ContextError.InvalidFeatureTemplateParameterError, `Unable to get feature template. Feature name cannot be null or undefined.`);
5181
5272
  if (!A_TypeGuards.isAllowedForFeatureDefinition(component))
5182
- throw new A_ContextError(A_ContextError.InvalidFeatureTemplateParameterError, `Unable to get feature template. Component of type ${componentName} is not allowed for feature definition.`);
5273
+ throw new A_ContextError(A_ContextError.InvalidFeatureTemplateParameterError, `Unable to get feature template. Component of type ${A_CommonHelper.getComponentName(component)} is not allowed for feature definition.`);
5183
5274
  const steps = [
5184
5275
  // 1) Get the base feature definition from the component
5185
5276
  ...this.featureDefinition(name, component),
@@ -5202,59 +5293,116 @@ var A_Context = class _A_Context {
5202
5293
  */
5203
5294
  static featureExtensions(name, component, scope) {
5204
5295
  const instance = this.getInstance();
5205
- const componentName = A_CommonHelper.getComponentName(component);
5206
5296
  if (!component) throw new A_ContextError(A_ContextError.InvalidFeatureExtensionParameterError, `Unable to get feature template. Component cannot be null or undefined.`);
5207
5297
  if (!name) throw new A_ContextError(A_ContextError.InvalidFeatureExtensionParameterError, `Unable to get feature template. Feature name cannot be null or undefined.`);
5208
5298
  if (!A_TypeGuards.isAllowedForFeatureDefinition(component))
5209
- throw new A_ContextError(A_ContextError.InvalidFeatureExtensionParameterError, `Unable to get feature template. Component of type ${componentName} is not allowed for feature definition.`);
5299
+ throw new A_ContextError(A_ContextError.InvalidFeatureExtensionParameterError, `Unable to get feature template. Component of type ${A_CommonHelper.getComponentName(component)} is not allowed for feature definition.`);
5300
+ const componentCtor = typeof component === "function" ? component : component.constructor;
5301
+ const effectiveScope = scope.parent || scope;
5302
+ const cacheKey = `${String(name)}::${componentCtor.name}::s${effectiveScope.uid}v${effectiveScope.version}::m${instance._metaVersion}`;
5303
+ const cached = instance._featureExtensionsCache.get(cacheKey);
5304
+ if (cached) {
5305
+ return cached;
5306
+ }
5210
5307
  const callNames = A_CommonHelper.getClassInheritanceChain(component).filter((c) => c !== A_Component && c !== A_Container && c !== A_Entity).map((c) => `${c.name}.${name}`);
5211
5308
  const steps = /* @__PURE__ */ new Map();
5212
5309
  const allowedComponents = /* @__PURE__ */ new Set();
5310
+ const componentNameCache = /* @__PURE__ */ new Map();
5311
+ const dependencyCache = /* @__PURE__ */ new Map();
5312
+ const getNameCached = (cmp) => {
5313
+ let n = componentNameCache.get(cmp);
5314
+ if (n === void 0) {
5315
+ n = A_CommonHelper.getComponentName(cmp);
5316
+ componentNameCache.set(cmp, n);
5317
+ }
5318
+ return n;
5319
+ };
5320
+ const getDependencyCached = (cmp) => {
5321
+ let d = dependencyCache.get(cmp);
5322
+ if (!d) {
5323
+ d = new A_Dependency(cmp);
5324
+ dependencyCache.set(cmp, d);
5325
+ }
5326
+ return d;
5327
+ };
5328
+ const scopeFilteredMetas = [];
5329
+ for (const [cmp, meta] of instance._metaStorage) {
5330
+ if (scope.has(cmp) && (A_TypeGuards.isComponentMetaInstance(meta) || A_TypeGuards.isContainerMetaInstance(meta))) {
5331
+ scopeFilteredMetas.push([cmp, meta]);
5332
+ }
5333
+ }
5213
5334
  for (const callName of callNames) {
5214
- for (const [cmp, meta] of instance._metaStorage) {
5215
- if (scope.has(cmp) && (A_TypeGuards.isComponentMetaInstance(meta) || A_TypeGuards.isContainerMetaInstance(meta))) {
5216
- allowedComponents.add(cmp);
5217
- meta.extensions(callName).forEach((declaration) => {
5218
- const inherited = Array.from(allowedComponents).reverse().find((c) => A_CommonHelper.isInheritedFrom(cmp, c) && c !== cmp);
5219
- if (inherited) {
5220
- steps.delete(`${A_CommonHelper.getComponentName(inherited)}.${declaration.handler}`);
5221
- }
5222
- if (declaration.override) {
5223
- const overrideRegexp = new RegExp(declaration.override);
5224
- for (const [stepKey, step] of steps) {
5225
- if (overrideRegexp.test(stepKey) || overrideRegexp.test(step.handler)) {
5226
- steps.delete(stepKey);
5227
- }
5335
+ for (const [cmp, meta] of scopeFilteredMetas) {
5336
+ allowedComponents.add(cmp);
5337
+ const extensions = meta.extensions(callName);
5338
+ for (let i = 0; i < extensions.length; i++) {
5339
+ const declaration = extensions[i];
5340
+ const inherited = Array.from(allowedComponents).reverse().find((c) => A_CommonHelper.isInheritedFrom(cmp, c) && c !== cmp);
5341
+ if (inherited) {
5342
+ steps.delete(`${getNameCached(inherited)}.${declaration.handler}`);
5343
+ }
5344
+ if (declaration.override) {
5345
+ const overrideRegexp = new RegExp(declaration.override);
5346
+ for (const [stepKey, step] of steps) {
5347
+ if (overrideRegexp.test(stepKey) || overrideRegexp.test(step.handler)) {
5348
+ steps.delete(stepKey);
5228
5349
  }
5229
5350
  }
5230
- steps.set(`${A_CommonHelper.getComponentName(cmp)}.${declaration.handler}`, {
5231
- dependency: new A_Dependency(cmp),
5232
- ...declaration
5233
- });
5351
+ }
5352
+ steps.set(`${getNameCached(cmp)}.${declaration.handler}`, {
5353
+ dependency: getDependencyCached(cmp),
5354
+ ...declaration
5234
5355
  });
5235
5356
  }
5236
5357
  }
5237
5358
  }
5238
- return instance.filterToMostDerived(scope, Array.from(steps.values()));
5359
+ const result = instance.filterToMostDerived(scope, Array.from(steps.values()));
5360
+ if (instance._featureExtensionsCache.size >= _A_Context.FEATURE_EXTENSIONS_CACHE_MAX_SIZE) {
5361
+ instance._featureExtensionsCache.clear();
5362
+ }
5363
+ instance._featureExtensionsCache.set(cacheKey, result);
5364
+ return result;
5239
5365
  }
5240
5366
  /**
5241
5367
  * method helps to filter steps in a way that only the most derived classes are kept.
5242
5368
  *
5369
+ * Optimized: Uses a pre-built constructor→class map and single-pass prototype chain
5370
+ * walk to eliminate parent classes in O(n·d) where d is inheritance depth,
5371
+ * instead of the previous O(n²) with isPrototypeOf checks.
5372
+ *
5243
5373
  * @param scope
5244
5374
  * @param items
5245
5375
  * @returns
5246
5376
  */
5247
5377
  filterToMostDerived(scope, items) {
5248
- return items.filter((item) => {
5249
- const currentClass = scope.resolveConstructor(item.dependency.name);
5250
- const isParentOfAnother = items.some((other) => {
5251
- if (other === item) return false;
5252
- const otherClass = scope.resolveConstructor(other.dependency.name);
5253
- if (!currentClass || !otherClass) return false;
5254
- return currentClass.prototype.isPrototypeOf(otherClass.prototype);
5255
- });
5256
- return !isParentOfAnother;
5257
- });
5378
+ if (items.length <= 1) return items;
5379
+ const resolvedClasses = /* @__PURE__ */ new Map();
5380
+ const presentNames = /* @__PURE__ */ new Set();
5381
+ for (const item of items) {
5382
+ const depName = item.dependency.name;
5383
+ if (!resolvedClasses.has(depName)) {
5384
+ resolvedClasses.set(depName, scope.resolveConstructor(depName));
5385
+ }
5386
+ presentNames.add(depName);
5387
+ }
5388
+ const parentNames = /* @__PURE__ */ new Set();
5389
+ const ctorToName = /* @__PURE__ */ new Map();
5390
+ for (const [depName, ctor] of resolvedClasses) {
5391
+ if (ctor) ctorToName.set(ctor, depName);
5392
+ }
5393
+ for (const [depName, ctor] of resolvedClasses) {
5394
+ if (!ctor) continue;
5395
+ let ancestor = Object.getPrototypeOf(ctor.prototype);
5396
+ while (ancestor && ancestor !== Object.prototype) {
5397
+ const ancestorCtor = ancestor.constructor;
5398
+ const ancestorName = ctorToName.get(ancestorCtor);
5399
+ if (ancestorName && ancestorName !== depName && presentNames.has(ancestorName)) {
5400
+ parentNames.add(ancestorName);
5401
+ }
5402
+ ancestor = Object.getPrototypeOf(ancestor);
5403
+ }
5404
+ }
5405
+ return items.filter((item) => !parentNames.has(item.dependency.name));
5258
5406
  }
5259
5407
  /**
5260
5408
  * This method returns the feature template definition without any extensions.
@@ -5369,6 +5517,8 @@ var A_Context = class _A_Context {
5369
5517
  static reset() {
5370
5518
  const instance = _A_Context.getInstance();
5371
5519
  instance._registry = /* @__PURE__ */ new WeakMap();
5520
+ instance._featureExtensionsCache.clear();
5521
+ instance._metaVersion++;
5372
5522
  const name = String(A_CONCEPT_ENV.A_CONCEPT_ROOT_SCOPE) || "root";
5373
5523
  instance._root = new A_Scope({ name });
5374
5524
  }
@@ -5412,6 +5562,12 @@ var A_Context = class _A_Context {
5412
5562
  return A_TypeGuards.isContainerConstructor(param) || A_TypeGuards.isComponentConstructor(param) || A_TypeGuards.isEntityConstructor(param);
5413
5563
  }
5414
5564
  };
5565
+ /**
5566
+ * Maximum number of entries in the featureExtensions cache.
5567
+ * When exceeded, the entire cache is cleared to prevent unbounded growth.
5568
+ */
5569
+ _A_Context.FEATURE_EXTENSIONS_CACHE_MAX_SIZE = 1024;
5570
+ var A_Context = _A_Context;
5415
5571
 
5416
5572
  // src/lib/A-Abstraction/A-Abstraction.error.ts
5417
5573
  var A_AbstractionError = class extends A_Error {