nfkit 1.0.31 → 1.0.32

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.
package/dist/index.cjs CHANGED
@@ -1302,7 +1302,6 @@ var AppContextCore = class {
1302
1302
  this.provideRecords = [];
1303
1303
  this.registry = /* @__PURE__ */ new Map();
1304
1304
  this.objectSteps = [];
1305
- this.parentContexts = /* @__PURE__ */ new Set();
1306
1305
  this.started = false;
1307
1306
  this.starting = false;
1308
1307
  this.startingEntries = null;
@@ -1344,43 +1343,6 @@ var AppContextCore = class {
1344
1343
  this.loadingRecords.delete(record);
1345
1344
  }
1346
1345
  }
1347
- applyUsedContext(other) {
1348
- if (Array.isArray(other?.provideRecords)) {
1349
- this.provideRecords.push(...other.provideRecords);
1350
- }
1351
- if (Array.isArray(other?.objectSteps)) {
1352
- this.objectSteps.push(...other.objectSteps);
1353
- for (const step of other.objectSteps) {
1354
- step(this);
1355
- }
1356
- }
1357
- if (other?.started) {
1358
- if (other?.registry instanceof Map) {
1359
- for (const [key, value] of other.registry.entries()) {
1360
- this.registry.set(key, value);
1361
- }
1362
- }
1363
- }
1364
- }
1365
- hasStartedInParentChain(visited = /* @__PURE__ */ new Set()) {
1366
- if (visited.has(this)) return false;
1367
- visited.add(this);
1368
- if (this.started) return true;
1369
- for (const parent of this.parentContexts) {
1370
- if (parent.hasStartedInParentChain(visited)) {
1371
- return true;
1372
- }
1373
- }
1374
- return false;
1375
- }
1376
- propagateUsedContextToParents(other, visited = /* @__PURE__ */ new Set()) {
1377
- if (visited.has(this)) return;
1378
- visited.add(this);
1379
- for (const parent of this.parentContexts) {
1380
- parent.applyUsedContext(other);
1381
- parent.propagateUsedContextToParents(other, visited);
1382
- }
1383
- }
1384
1346
  provide(cls, ...args) {
1385
1347
  const last = args[args.length - 1];
1386
1348
  const hasOptions = !!last && typeof last === "object" && ("provide" in last || "merge" in last || "useValue" in last || "useFactory" in last || "useClass" in last);
@@ -1471,14 +1433,27 @@ var AppContextCore = class {
1471
1433
  use(...ctxes) {
1472
1434
  for (const ctx of ctxes) {
1473
1435
  const other = ctx;
1474
- if (this.hasStartedInParentChain() && !other?.started) {
1436
+ if (this.started && !other?.started) {
1475
1437
  throw new Error(
1476
1438
  "Cannot use an unstarted context into a started context."
1477
1439
  );
1478
1440
  }
1479
- this.applyUsedContext(other);
1480
- other.parentContexts.add(this);
1481
- this.propagateUsedContextToParents(other);
1441
+ if (Array.isArray(other?.provideRecords)) {
1442
+ this.provideRecords.push(...other.provideRecords);
1443
+ }
1444
+ if (Array.isArray(other?.objectSteps)) {
1445
+ this.objectSteps.push(...other.objectSteps);
1446
+ for (const step of other.objectSteps) {
1447
+ step(this);
1448
+ }
1449
+ }
1450
+ if (other?.started) {
1451
+ if (other?.registry instanceof Map) {
1452
+ for (const [key, value] of other.registry.entries()) {
1453
+ this.registry.set(key, value);
1454
+ }
1455
+ }
1456
+ }
1482
1457
  }
1483
1458
  return this;
1484
1459
  }