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