@hey-api/codegen-core 0.8.0 → 0.8.1
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/README.md +1 -1
- package/dist/index.d.mts +10 -3
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +111 -55
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -28,7 +28,7 @@ Start with our [Contributing](https://heyapi.dev/openapi-ts/community/contributi
|
|
|
28
28
|
|
|
29
29
|
## Sponsors
|
|
30
30
|
|
|
31
|
-
|
|
31
|
+
Partners behind the future of API tooling. [Become a sponsor](https://github.com/sponsors/hey-api).
|
|
32
32
|
|
|
33
33
|
<h3 align="center">Gold</h3>
|
|
34
34
|
|
package/dist/index.d.mts
CHANGED
|
@@ -1009,10 +1009,13 @@ declare class NodeRegistry implements INodeRegistry {
|
|
|
1009
1009
|
//#region src/symbols/registry.d.ts
|
|
1010
1010
|
type SymbolId = number;
|
|
1011
1011
|
declare class SymbolRegistry implements ISymbolRegistry {
|
|
1012
|
+
/** Forward index: cache key → index key space it was registered with. */
|
|
1013
|
+
private _cacheDependencies;
|
|
1014
|
+
/** Reverse index: serialized index entry → set of cache keys that depend on it. */
|
|
1015
|
+
private _dependencyToCache;
|
|
1012
1016
|
private _id;
|
|
1013
1017
|
private _indices;
|
|
1014
1018
|
private _queryCache;
|
|
1015
|
-
private _queryCacheDependencies;
|
|
1016
1019
|
private _registered;
|
|
1017
1020
|
private _stubs;
|
|
1018
1021
|
private _stubCache;
|
|
@@ -1024,13 +1027,17 @@ declare class SymbolRegistry implements ISymbolRegistry {
|
|
|
1024
1027
|
reference(meta: ISymbolMeta): Symbol;
|
|
1025
1028
|
register(symbol: ISymbolIn): Symbol;
|
|
1026
1029
|
registered(): IterableIterator<Symbol>;
|
|
1027
|
-
private buildCacheKey;
|
|
1028
1030
|
private buildIndexKeySpace;
|
|
1031
|
+
/**
|
|
1032
|
+
* Derives a stable, order-insensitive cache key from a pre-built key space.
|
|
1033
|
+
* Avoids rebuilding the key space when it's already available.
|
|
1034
|
+
*/
|
|
1035
|
+
private cacheKeyFromKeySpace;
|
|
1029
1036
|
private indexSymbol;
|
|
1030
1037
|
private invalidateCache;
|
|
1031
1038
|
private isSubset;
|
|
1039
|
+
private queryByKeySpace;
|
|
1032
1040
|
private replaceStubs;
|
|
1033
|
-
private serializeIndexEntry;
|
|
1034
1041
|
}
|
|
1035
1042
|
//#endregion
|
|
1036
1043
|
//#region src/project/project.d.ts
|
package/dist/index.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.mts","names":[],"sources":["../src/refs/types.ts","../src/extensions.ts","../src/nodes/node.ts","../src/symbols/types.ts","../src/symbols/symbol.ts","../src/planner/scope.ts","../src/planner/types.ts","../src/languages/types.ts","../src/files/types.ts","../src/nodes/types.ts","../src/output.ts","../src/renderer.ts","../src/project/types.ts","../src/files/file.ts","../src/bindings.ts","../src/brands.ts","../src/config/interactive.ts","../src/logger.ts","../src/config/load.ts","../src/config/merge.ts","../src/guards.ts","../src/languages/extensions.ts","../src/languages/modules.ts","../src/languages/resolvers.ts","../src/log.ts","../src/planner/resolvers.ts","../src/files/registry.ts","../src/nodes/registry.ts","../src/symbols/registry.ts","../src/project/project.ts","../src/refs/refs.ts","../src/structure/types.ts","../src/structure/node.ts","../src/structure/model.ts"],"mappings":";;;;;;;;AAUA;;;;;;KAAY,GAAA,MAAS,CAAA;EAAA,CAAa,MAAA;AAAA,IAAqB,CAAA;EAAM,MAAA,EAAQ,CAAA;AAAA;;;;;;AAarE;;;;;;KAAY,IAAA,oBACE,CAAA,GAAI,GAAA,CAAI,CAAA,CAAE,CAAA;;;;;;;;;KAWZ,OAAA,MAAa,CAAA;EAAY,MAAA;AAAA,IAAoB,CAAA,GAAI,CAAA;;;;;;;;;;AAY7D;KAAY,QAAA,oBACE,CAAA,GAAI,CAAA,CAAE,CAAA,UAAW,GAAA,Y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EgCmBV,KAAA,CAAM,IAAA,WAAe,aAAA;EhCnBN;;;;;EgC+Bf,OAAA,CAAA,GAAW,aAAA;EhC9BY;;AAWzB;;;;EgCoCG,SAAA,aAAA,CAAuB,MAAA,WAAiB,SAAA,CAAU,aAAA;IAAkB,IAAA,EAAM,CAAA;EAAA;EhCpC1B;;;;;EgCiDhD,IAAA,CAAA,GAAQ,SAAA,CAAU,aAAA;AAAA;;;cCjFR,cAAA;;UAEH,MAAA;EjCKK;EAAA,QiCHL,YAAA;EjCGW;;;EAAA,IiCEf,KAAA,CAAA,GAAS,aAAA,CAAc,aAAA;EjCFyC;;;EiCWpE,MAAA,CAAO,IAAA,EAAM,eAAA;EjCXwC;;;;;AAavD;;;EiCyCE,IAAA,CAAK,IAAA,kBAAsB,aAAA;EjCxCP;;;;;EiCyDnB,IAAA,CAAA,GAAQ,SAAA,CAAU,aAAA;AAAA"}
|
|
1
|
+
{"version":3,"file":"index.d.mts","names":[],"sources":["../src/refs/types.ts","../src/extensions.ts","../src/nodes/node.ts","../src/symbols/types.ts","../src/symbols/symbol.ts","../src/planner/scope.ts","../src/planner/types.ts","../src/languages/types.ts","../src/files/types.ts","../src/nodes/types.ts","../src/output.ts","../src/renderer.ts","../src/project/types.ts","../src/files/file.ts","../src/bindings.ts","../src/brands.ts","../src/config/interactive.ts","../src/logger.ts","../src/config/load.ts","../src/config/merge.ts","../src/guards.ts","../src/languages/extensions.ts","../src/languages/modules.ts","../src/languages/resolvers.ts","../src/log.ts","../src/planner/resolvers.ts","../src/files/registry.ts","../src/nodes/registry.ts","../src/symbols/registry.ts","../src/project/project.ts","../src/refs/refs.ts","../src/structure/types.ts","../src/structure/node.ts","../src/structure/model.ts"],"mappings":";;;;;;;;AAUA;;;;;;KAAY,GAAA,MAAS,CAAA;EAAA,CAAa,MAAA;AAAA,IAAqB,CAAA;EAAM,MAAA,EAAQ,CAAA;AAAA;;;;;;AAarE;;;;;;KAAY,IAAA,oBACE,CAAA,GAAI,GAAA,CA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A;EhCIA;EgCFb,IAAA;EhCEqD;EgCArD,MAAA,GAAS,aAAA;EhCA2D;EgCEpE,KAAA,GAAQ,cAAA;EhCFM;EgCId,WAAA;EhCJgC;EgCMhC,OAAA;cAGE,IAAA,UACA,MAAA,GAAS,aAAA,EACT,OAAA;IACE,OAAA;EAAA;EAAA,IAQA,MAAA,CAAA;EhCPM;;;;;;;;EgCmBV,KAAA,CAAM,IAAA,WAAe,aAAA;EhCnBN;;;;;EgC+Bf,OAAA,CAAA,GAAW,aAAA;EhC9BY;;AAWzB;;;;EgCoCG,SAAA,aAAA,CAAuB,MAAA,WAAiB,SAAA,CAAU,aAAA;IAAkB,IAAA,EAAM,CAAA;EAAA;EhCpC1B;;;;;EgCiDhD,IAAA,CAAA,GAAQ,SAAA,CAAU,aAAA;AAAA;;;cCjFR,cAAA;;UAEH,MAAA;EjCKK;EAAA,QiCHL,YAAA;EjCGW;;;EAAA,IiCEf,KAAA,CAAA,GAAS,aAAA,CAAc,aAAA;EjCFyC;;;EiCWpE,MAAA,CAAO,IAAA,EAAM,eAAA;EjCXwC;;;;;AAavD;;;EiCyCE,IAAA,CAAK,IAAA,kBAAsB,aAAA;EjCxCP;;;;;EiCyDnB,IAAA,CAAA,GAAQ,SAAA,CAAU,aAAA;AAAA"}
|
package/dist/index.mjs
CHANGED
|
@@ -1075,15 +1075,19 @@ var Planner = class {
|
|
|
1075
1075
|
* Updates all specified name scopes with the assigned final name.
|
|
1076
1076
|
*/
|
|
1077
1077
|
assignSymbolName(args) {
|
|
1078
|
-
const {
|
|
1078
|
+
const { file, node, scope, scopesToUpdate, symbol } = args;
|
|
1079
1079
|
if (this.cacheResolvedNames.has(symbol.id)) return;
|
|
1080
1080
|
const baseName = symbol.name;
|
|
1081
1081
|
let finalName = node?.nameSanitizer?.(baseName) ?? symbol.node?.nameSanitizer?.(baseName) ?? baseName;
|
|
1082
1082
|
let attempt = 1;
|
|
1083
|
-
const localNames = ctx.localNames(scope);
|
|
1084
1083
|
while (true) {
|
|
1085
1084
|
const language = node?.language || symbol.node?.language || file.language;
|
|
1086
|
-
if (
|
|
1085
|
+
if (this.nameIsAvailable({
|
|
1086
|
+
kind: symbol.kind,
|
|
1087
|
+
language,
|
|
1088
|
+
name: finalName,
|
|
1089
|
+
scope
|
|
1090
|
+
})) break;
|
|
1087
1091
|
const resolvedName = ((language ? this.project.nameConflictResolvers[language] : void 0) ?? this.project.defaultNameConflictResolver)({
|
|
1088
1092
|
attempt,
|
|
1089
1093
|
baseName
|
|
@@ -1098,6 +1102,24 @@ var Planner = class {
|
|
|
1098
1102
|
for (const scope of updateScopes) this.updateScope(symbol, scope);
|
|
1099
1103
|
}
|
|
1100
1104
|
/**
|
|
1105
|
+
* Checks whether `name` can be used for a new symbol of `kind` in `scope`.
|
|
1106
|
+
*
|
|
1107
|
+
* Walks up the scope chain and verifies that every existing declaration with
|
|
1108
|
+
* that name is compatible (i.e., can share the same identifier) with `kind`.
|
|
1109
|
+
* This avoids copying the entire accumulated name map on every call.
|
|
1110
|
+
*/
|
|
1111
|
+
nameIsAvailable({ kind, language, name, scope }) {
|
|
1112
|
+
let current = scope;
|
|
1113
|
+
while (current) {
|
|
1114
|
+
const kinds = current.localNames.get(name);
|
|
1115
|
+
if (kinds) {
|
|
1116
|
+
for (const existingKind of kinds) if (!canDeclarationsShareIdentifier(language, kind, existingKind)) return false;
|
|
1117
|
+
}
|
|
1118
|
+
current = current.parent;
|
|
1119
|
+
}
|
|
1120
|
+
return true;
|
|
1121
|
+
}
|
|
1122
|
+
/**
|
|
1101
1123
|
* Updates the provided name scope with the symbol's final name and kind.
|
|
1102
1124
|
*
|
|
1103
1125
|
* Ensures the name scope tracks all kinds associated with a given name.
|
|
@@ -1405,10 +1427,13 @@ var Symbol = class {
|
|
|
1405
1427
|
//#endregion
|
|
1406
1428
|
//#region src/symbols/registry.ts
|
|
1407
1429
|
var SymbolRegistry = class {
|
|
1430
|
+
/** Forward index: cache key → index key space it was registered with. */
|
|
1431
|
+
_cacheDependencies = /* @__PURE__ */ new Map();
|
|
1432
|
+
/** Reverse index: serialized index entry → set of cache keys that depend on it. */
|
|
1433
|
+
_dependencyToCache = /* @__PURE__ */ new Map();
|
|
1408
1434
|
_id = 0;
|
|
1409
1435
|
_indices = /* @__PURE__ */ new Map();
|
|
1410
1436
|
_queryCache = /* @__PURE__ */ new Map();
|
|
1411
|
-
_queryCacheDependencies = /* @__PURE__ */ new Map();
|
|
1412
1437
|
_registered = /* @__PURE__ */ new Set();
|
|
1413
1438
|
_stubs = /* @__PURE__ */ new Set();
|
|
1414
1439
|
_stubCache = /* @__PURE__ */ new Map();
|
|
@@ -1424,43 +1449,15 @@ var SymbolRegistry = class {
|
|
|
1424
1449
|
return this._id++;
|
|
1425
1450
|
}
|
|
1426
1451
|
query(filter) {
|
|
1427
|
-
const cacheKey = this.buildCacheKey(filter);
|
|
1428
|
-
const cachedIds = this._queryCache.get(cacheKey);
|
|
1429
|
-
if (cachedIds) return cachedIds.map((symbolId) => this._values.get(symbolId));
|
|
1430
|
-
const sets = [];
|
|
1431
1452
|
const indexKeySpace = this.buildIndexKeySpace(filter);
|
|
1432
|
-
const
|
|
1433
|
-
|
|
1434
|
-
for (const indexEntry of indexKeySpace) {
|
|
1435
|
-
cacheDependencies.add(this.serializeIndexEntry(indexEntry));
|
|
1436
|
-
const values = this._indices.get(indexEntry[0]);
|
|
1437
|
-
if (!values) {
|
|
1438
|
-
missed = true;
|
|
1439
|
-
break;
|
|
1440
|
-
}
|
|
1441
|
-
const set = values.get(indexEntry[1]);
|
|
1442
|
-
if (!set) {
|
|
1443
|
-
missed = true;
|
|
1444
|
-
break;
|
|
1445
|
-
}
|
|
1446
|
-
sets.push(set);
|
|
1447
|
-
}
|
|
1448
|
-
if (missed || !sets.length) {
|
|
1449
|
-
this._queryCacheDependencies.set(cacheKey, cacheDependencies);
|
|
1450
|
-
this._queryCache.set(cacheKey, []);
|
|
1451
|
-
return [];
|
|
1452
|
-
}
|
|
1453
|
-
let result = new Set(sets[0]);
|
|
1454
|
-
for (const set of sets.slice(1)) result = new Set([...result].filter((symbolId) => set.has(symbolId)));
|
|
1455
|
-
const resultIds = [...result];
|
|
1456
|
-
this._queryCacheDependencies.set(cacheKey, cacheDependencies);
|
|
1457
|
-
this._queryCache.set(cacheKey, resultIds);
|
|
1458
|
-
return resultIds.map((symbolId) => this._values.get(symbolId));
|
|
1453
|
+
const cacheKey = this.cacheKeyFromKeySpace(indexKeySpace);
|
|
1454
|
+
return this.queryByKeySpace(indexKeySpace, cacheKey);
|
|
1459
1455
|
}
|
|
1460
1456
|
reference(meta) {
|
|
1461
|
-
const
|
|
1457
|
+
const indexKeySpace = this.buildIndexKeySpace(meta);
|
|
1458
|
+
const cacheKey = this.cacheKeyFromKeySpace(indexKeySpace);
|
|
1459
|
+
const [registered] = this.queryByKeySpace(indexKeySpace, cacheKey);
|
|
1462
1460
|
if (registered) return registered;
|
|
1463
|
-
const cacheKey = this.buildCacheKey(meta);
|
|
1464
1461
|
const cachedId = this._stubCache.get(cacheKey);
|
|
1465
1462
|
if (cachedId !== void 0) return this._values.get(cachedId);
|
|
1466
1463
|
const stub = new Symbol({
|
|
@@ -1487,18 +1484,26 @@ var SymbolRegistry = class {
|
|
|
1487
1484
|
*registered() {
|
|
1488
1485
|
for (const id of this._registered.values()) yield this._values.get(id);
|
|
1489
1486
|
}
|
|
1490
|
-
buildCacheKey(filter) {
|
|
1491
|
-
return this.buildIndexKeySpace(filter).map((indexEntry) => this.serializeIndexEntry(indexEntry)).sort().join("|");
|
|
1492
|
-
}
|
|
1493
1487
|
buildIndexKeySpace(meta, prefix = "") {
|
|
1494
1488
|
const entries = [];
|
|
1495
1489
|
for (const [key, value] of Object.entries(meta)) {
|
|
1496
1490
|
const path = prefix ? `${prefix}.${key}` : key;
|
|
1497
1491
|
if (value && typeof value === "object" && !Array.isArray(value)) entries.push(...this.buildIndexKeySpace(value, path));
|
|
1498
|
-
else entries.push([
|
|
1492
|
+
else entries.push([
|
|
1493
|
+
path,
|
|
1494
|
+
value,
|
|
1495
|
+
`${path}:${JSON.stringify(value)}`
|
|
1496
|
+
]);
|
|
1499
1497
|
}
|
|
1500
1498
|
return entries;
|
|
1501
1499
|
}
|
|
1500
|
+
/**
|
|
1501
|
+
* Derives a stable, order-insensitive cache key from a pre-built key space.
|
|
1502
|
+
* Avoids rebuilding the key space when it's already available.
|
|
1503
|
+
*/
|
|
1504
|
+
cacheKeyFromKeySpace(indexKeySpace) {
|
|
1505
|
+
return indexKeySpace.map((indexEntry) => indexEntry[2]).sort().join("|");
|
|
1506
|
+
}
|
|
1502
1507
|
indexSymbol(symbolId, indexKeySpace) {
|
|
1503
1508
|
for (const [key, value] of indexKeySpace) {
|
|
1504
1509
|
if (!this._indices.has(key)) this._indices.set(key, /* @__PURE__ */ new Map());
|
|
@@ -1509,32 +1514,83 @@ var SymbolRegistry = class {
|
|
|
1509
1514
|
}
|
|
1510
1515
|
}
|
|
1511
1516
|
invalidateCache(indexKeySpace) {
|
|
1512
|
-
const
|
|
1513
|
-
|
|
1514
|
-
this.
|
|
1515
|
-
|
|
1516
|
-
|
|
1517
|
+
for (const indexEntry of indexKeySpace) {
|
|
1518
|
+
const serialized = indexEntry[2];
|
|
1519
|
+
const cacheKeys = this._dependencyToCache.get(serialized);
|
|
1520
|
+
if (!cacheKeys) continue;
|
|
1521
|
+
for (const cacheKey of cacheKeys) {
|
|
1522
|
+
this._queryCache.delete(cacheKey);
|
|
1523
|
+
const deps = this._cacheDependencies.get(cacheKey);
|
|
1524
|
+
if (deps) {
|
|
1525
|
+
for (const dep of deps) if (dep[2] !== serialized) this._dependencyToCache.get(dep[2])?.delete(cacheKey);
|
|
1526
|
+
this._cacheDependencies.delete(cacheKey);
|
|
1527
|
+
}
|
|
1528
|
+
}
|
|
1529
|
+
this._dependencyToCache.delete(serialized);
|
|
1517
1530
|
}
|
|
1518
1531
|
}
|
|
1519
1532
|
isSubset(sub, sup) {
|
|
1520
|
-
const supMap = new Map(sup);
|
|
1533
|
+
const supMap = new Map(sup.map((e) => [e[0], e[1]]));
|
|
1521
1534
|
for (const [key, value] of sub) if (!supMap.has(key) || supMap.get(key) !== value) return false;
|
|
1522
1535
|
return true;
|
|
1523
1536
|
}
|
|
1537
|
+
queryByKeySpace(indexKeySpace, cacheKey) {
|
|
1538
|
+
const cached = this._queryCache.get(cacheKey);
|
|
1539
|
+
if (cached) return cached;
|
|
1540
|
+
const sets = [];
|
|
1541
|
+
let missed = false;
|
|
1542
|
+
for (const indexEntry of indexKeySpace) {
|
|
1543
|
+
const serialized = indexEntry[2];
|
|
1544
|
+
let cacheKeys;
|
|
1545
|
+
if (this._dependencyToCache.has(serialized)) cacheKeys = this._dependencyToCache.get(serialized);
|
|
1546
|
+
else {
|
|
1547
|
+
cacheKeys = /* @__PURE__ */ new Set();
|
|
1548
|
+
this._dependencyToCache.set(serialized, cacheKeys);
|
|
1549
|
+
}
|
|
1550
|
+
cacheKeys.add(cacheKey);
|
|
1551
|
+
if (!missed) {
|
|
1552
|
+
const values = this._indices.get(indexEntry[0]);
|
|
1553
|
+
if (!values) {
|
|
1554
|
+
missed = true;
|
|
1555
|
+
continue;
|
|
1556
|
+
}
|
|
1557
|
+
const set = values.get(indexEntry[1]);
|
|
1558
|
+
if (!set) {
|
|
1559
|
+
missed = true;
|
|
1560
|
+
continue;
|
|
1561
|
+
}
|
|
1562
|
+
sets.push(set);
|
|
1563
|
+
}
|
|
1564
|
+
}
|
|
1565
|
+
this._cacheDependencies.set(cacheKey, indexKeySpace);
|
|
1566
|
+
if (missed || !sets.length) {
|
|
1567
|
+
this._queryCache.set(cacheKey, []);
|
|
1568
|
+
return [];
|
|
1569
|
+
}
|
|
1570
|
+
sets.sort((a, b) => a.size - b.size);
|
|
1571
|
+
const result = new Set(sets[0]);
|
|
1572
|
+
for (let i = 1; i < sets.length; i++) {
|
|
1573
|
+
const set = sets[i];
|
|
1574
|
+
for (const symbolId of result) if (!set.has(symbolId)) result.delete(symbolId);
|
|
1575
|
+
}
|
|
1576
|
+
const symbols = Array.from(result, (symbolId) => this._values.get(symbolId));
|
|
1577
|
+
this._queryCache.set(cacheKey, symbols);
|
|
1578
|
+
return symbols;
|
|
1579
|
+
}
|
|
1524
1580
|
replaceStubs(symbol, indexKeySpace) {
|
|
1525
1581
|
for (const stubId of this._stubs.values()) {
|
|
1526
1582
|
const stub = this._values.get(stubId);
|
|
1527
|
-
if (stub?.meta
|
|
1528
|
-
const
|
|
1529
|
-
this.
|
|
1530
|
-
|
|
1531
|
-
|
|
1583
|
+
if (stub?.meta) {
|
|
1584
|
+
const stubKeySpace = this.buildIndexKeySpace(stub.meta);
|
|
1585
|
+
if (this.isSubset(stubKeySpace, indexKeySpace)) {
|
|
1586
|
+
const cacheKey = this.cacheKeyFromKeySpace(stubKeySpace);
|
|
1587
|
+
this._stubCache.delete(cacheKey);
|
|
1588
|
+
this._stubs.delete(stubId);
|
|
1589
|
+
stub.setCanonical(symbol);
|
|
1590
|
+
}
|
|
1532
1591
|
}
|
|
1533
1592
|
}
|
|
1534
1593
|
}
|
|
1535
|
-
serializeIndexEntry(indexEntry) {
|
|
1536
|
-
return `${indexEntry[0]}:${JSON.stringify(indexEntry[1])}`;
|
|
1537
|
-
}
|
|
1538
1594
|
};
|
|
1539
1595
|
//#endregion
|
|
1540
1596
|
//#region src/project/project.ts
|
package/dist/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","names":[],"sources":["../src/brands.ts","../src/config/interactive.ts","../src/config/merge.ts","../src/config/load.ts","../src/log.ts","../src/files/file.ts","../src/guards.ts","../src/languages/extensions.ts","../src/languages/modules.ts","../src/planner/resolvers.ts","../src/languages/resolvers.ts","../src/logger.ts","../src/files/registry.ts","../src/refs/refs.ts","../src/nodes/registry.ts","../src/project/namespace.ts","../src/planner/scope.ts","../src/planner/analyzer.ts","../src/planner/planner.ts","../src/symbols/symbol.ts","../src/symbols/registry.ts","../src/project/project.ts","../src/structure/node.ts","../src/structure/model.ts"],"sourcesContent":["export const fileBrand = 'heyapi.file';\nexport const nodeBrand = 'heyapi.node';\nexport const symbolBrand = 'heyapi.symbol';\n","/**\n * Detect if the current session is interactive based on TTY status and environment variables.\n * This is used as a fallback when the user doesn't explicitly set the interactive option.\n * @internal\n */\nexport function detectInteractiveSession(): boolean {\n return Boolean(\n process.stdin.isTTY &&\n process.stdout.isTTY &&\n !process.env.CI &&\n !process.env.NO_INTERACTIVE &&\n !process.env.NO_INTERACTION,\n );\n}\n","import type { AnyObject } from '@hey-api/types';\n\nfunction isPlainObject(value: unknown): value is AnyObject {\n return typeof value === 'object' && value !== null && !Array.isArray(value);\n}\n\nexport function mergeConfigs<T extends AnyObject>(\n configA: T | undefined,\n configB: T | undefined,\n): T {\n const a = (configA || {}) as AnyObject;\n const b = (configB || {}) as AnyObject;\n\n const result: AnyObject = { ...a };\n\n for (const key of Object.keys(b)) {\n const valueA = a[key];\n const valueB = b[key];\n\n if (isPlainObject(valueA) && isPlainObject(valueB)) {\n result[key] = mergeConfigs(valueA, valueB);\n } else {\n result[key] = valueB;\n }\n }\n\n return result as T;\n}\n","import type { AnyObject, MaybeArray } from '@hey-api/types';\nimport { loadConfig } from 'c12';\n\nimport type { Logger } from '../logger';\nimport { mergeConfigs } from './merge';\n\nexport async function loadConfigFile<T extends AnyObject>({\n configFile,\n logger,\n name,\n userConfig,\n}: {\n configFile: string | undefined;\n logger: Logger;\n name: string;\n userConfig: T;\n}): Promise<{\n configFile: string | undefined;\n configs: ReadonlyArray<T>;\n foundConfig: boolean;\n}> {\n const eventC12 = logger.timeEvent('c12');\n const { config: fileConfig, configFile: loadedConfigFile } = await loadConfig<MaybeArray<T>>({\n configFile,\n name,\n });\n eventC12.timeEnd();\n\n const fileConfigs = fileConfig instanceof Array ? fileConfig : [fileConfig];\n const mergedConfigs = fileConfigs.map((config) => mergeConfigs<T>(config, userConfig));\n const foundConfig = fileConfigs.some((config) => Object.keys(config).length);\n\n return { configFile: loadedConfigFile, configs: mergedConfigs, foundConfig };\n}\n","import type { MaybeArray, MaybeFunc } from '@hey-api/types';\nimport colors from 'ansi-colors';\n// @ts-expect-error\nimport colorSupport from 'color-support';\n\ncolors.enabled = colorSupport().hasBasic;\n\nconst DEBUG_NAMESPACE = 'heyapi';\n\nconst NO_WARNINGS = /^(1|true|yes|on)$/i.test(process.env.HEYAPI_DISABLE_WARNINGS ?? '');\n\nconst DebugGroups = {\n analyzer: colors.greenBright,\n dsl: colors.cyanBright,\n file: colors.yellowBright,\n registry: colors.blueBright,\n symbol: colors.magentaBright,\n} as const;\n\nconst WarnGroups = {\n deprecated: colors.magentaBright,\n} as const;\n\nlet cachedDebugGroups: Set<string> | undefined;\nfunction getDebugGroups(): Set<string> {\n if (cachedDebugGroups) return cachedDebugGroups;\n\n const value = process.env.DEBUG;\n cachedDebugGroups = new Set(value ? value.split(',').map((x) => x.trim().toLowerCase()) : []);\n\n return cachedDebugGroups;\n}\n\n/**\n * Tracks which deprecations have been shown to avoid spam.\n */\nconst shownDeprecations = new Set<string>();\n\nfunction debug(message: string, group: keyof typeof DebugGroups) {\n const groups = getDebugGroups();\n if (\n !(\n groups.has('*') ||\n groups.has(`${DEBUG_NAMESPACE}:*`) ||\n groups.has(`${DEBUG_NAMESPACE}:${group}`) ||\n groups.has(group)\n )\n ) {\n return;\n }\n\n const color = DebugGroups[group] ?? colors.whiteBright;\n const prefix = color(`${DEBUG_NAMESPACE}:${group}`);\n\n console.debug(`${prefix} ${message}`);\n}\n\nfunction warn(message: string, group?: keyof typeof WarnGroups) {\n if (NO_WARNINGS) return;\n\n const color = group ? WarnGroups[group] : colors.yellowBright;\n\n console.warn(color(`${message}`));\n}\n\nfunction warnDeprecated({\n context,\n field,\n replacement,\n}: {\n context?: string;\n field: string;\n replacement?: MaybeFunc<(field: string) => MaybeArray<string>>;\n}) {\n const key = context\n ? `${context}:${field}:${JSON.stringify(replacement)}`\n : `${field}:${JSON.stringify(replacement)}`;\n\n if (shownDeprecations.has(key)) return;\n shownDeprecations.add(key);\n\n let message = `\\`${field}\\` is deprecated.`;\n\n if (replacement) {\n const reps = typeof replacement === 'function' ? replacement(field) : replacement;\n const repArray = reps instanceof Array ? reps : [reps];\n const repString = repArray.map((r) => `\\`${r}\\``).join(' or ');\n message += ` Use ${repString} instead.`;\n }\n\n const prefix = context ? `[${context}] ` : '';\n warn(`${prefix}${message}`, 'deprecated');\n}\n\nexport const log = {\n debug,\n warn,\n warnDeprecated,\n};\n","import path from 'node:path';\n\nimport type { ExportModule, ImportModule } from '../bindings';\nimport { fileBrand } from '../brands';\nimport type { Language } from '../languages/types';\nimport { log } from '../log';\nimport type { INode } from '../nodes/node';\nimport type { NameScopes } from '../planner/scope';\nimport type { IProject } from '../project/types';\nimport type { Renderer } from '../renderer';\nimport type { IFileIn } from './types';\n\nexport class File<Node extends INode = INode> {\n /**\n * Exports from this file.\n */\n private _exports: Array<ExportModule> = [];\n /**\n * File extension (e.g., `.ts`).\n */\n private _extension?: string;\n /**\n * Actual emitted file path, including extension and directories.\n */\n private _finalPath?: string;\n /**\n * Imports to this file.\n */\n private _imports: Array<ImportModule> = [];\n /**\n * Language of the file.\n */\n private _language?: Language;\n /**\n * Logical, extension-free path used for planning and routing.\n */\n private _logicalFilePath: string;\n /**\n * Base name of the file (without extension).\n */\n private _name?: string;\n /**\n * Syntax nodes contained in this file.\n */\n private _nodes: Array<Node> = [];\n /**\n * Renderer assigned to this file.\n */\n private _renderer?: Renderer;\n\n /** Brand used for identifying files. */\n readonly '~brand' = fileBrand;\n /** All names defined in this file, including local scopes. */\n allNames: NameScopes = new Map();\n /** Whether this file is external to the project. */\n external: boolean;\n /** Unique identifier for the file. */\n readonly id: number;\n /** The project this file belongs to. */\n readonly project: IProject;\n /** Names declared at the top level of the file. */\n topLevelNames: NameScopes = new Map();\n\n constructor(input: IFileIn, id: number, project: IProject) {\n this.external = input.external ?? false;\n this.id = id;\n if (input.language !== undefined) this._language = input.language;\n this._logicalFilePath = input.logicalFilePath.split(path.sep).join('/');\n if (input.name !== undefined) this._name = input.name;\n this.project = project;\n }\n\n /**\n * Exports from this file.\n */\n get exports(): ReadonlyArray<ExportModule> {\n return [...this._exports];\n }\n\n /**\n * Read-only accessor for the file extension.\n */\n get extension(): string | undefined {\n if (this.external) return;\n if (this._extension) return this._extension;\n const language = this.language;\n const extension = language ? this.project.extensions[language] : undefined;\n if (extension && extension[0]) return extension[0];\n return;\n }\n\n /**\n * Read-only accessor for the final emitted path.\n *\n * If undefined, the file has not yet been assigned a final path\n * or is external to the project and should not be emitted.\n */\n get finalPath(): string | undefined {\n if (this._finalPath) return this._finalPath;\n const dirs = this._logicalFilePath ? this._logicalFilePath.split('/').slice(0, -1) : [];\n return [...dirs, `${this.name}${this.extension ?? ''}`].join('/');\n }\n\n /**\n * Imports to this file.\n */\n get imports(): ReadonlyArray<ImportModule> {\n return [...this._imports];\n }\n\n /**\n * Language of the file; inferred from nodes or fallback if not set explicitly.\n */\n get language(): Language | undefined {\n if (this._language) return this._language;\n if (this._nodes[0]) return this._nodes[0].language;\n return;\n }\n\n /**\n * Logical, extension-free path used for planning and routing.\n */\n get logicalFilePath(): string {\n return this._logicalFilePath;\n }\n\n /**\n * Base name of the file (without extension).\n *\n * If no name was set explicitly, it is inferred from the logical file path.\n */\n get name(): string {\n if (this._name) return this._name;\n const name = this._logicalFilePath.split('/').pop();\n if (name) return name;\n const message = `File ${this.toString()} has no name`;\n log.debug(message, 'file');\n throw new Error(message);\n }\n\n /**\n * Syntax nodes contained in this file.\n */\n get nodes(): ReadonlyArray<Node> {\n return [...this._nodes];\n }\n\n /**\n * Renderer assigned to this file.\n */\n get renderer(): Renderer | undefined {\n return this._renderer;\n }\n\n /**\n * Add an export group to the file.\n */\n addExport(group: ExportModule): void {\n this._exports.push(group);\n }\n\n /**\n * Add an import group to the file.\n */\n addImport(group: ImportModule): void {\n this._imports.push(group);\n }\n\n /**\n * Add a syntax node to the file.\n */\n addNode(node: Node): void {\n this._nodes.push(node);\n node.file = this;\n }\n\n /**\n * Sets the file extension.\n */\n setExtension(extension: string): void {\n this._extension = extension;\n }\n\n /**\n * Sets the final emitted path of the file.\n */\n setFinalPath(path: string): void {\n this._finalPath = path;\n }\n\n /**\n * Sets the language of the file.\n */\n setLanguage(lang: Language): void {\n this._language = lang;\n }\n\n /**\n * Sets the name of the file.\n */\n setName(name: string): void {\n this._name = name;\n }\n\n /**\n * Sets the renderer assigned to this file.\n */\n setRenderer(renderer: Renderer): void {\n this._renderer = renderer;\n }\n\n /**\n * Returns a debug‑friendly string representation identifying the file.\n */\n toString(): string {\n return `[File ${this._logicalFilePath}#${this.id}]`;\n }\n}\n","import { nodeBrand, symbolBrand } from './brands';\nimport type { INode } from './nodes/node';\nimport type { Ref } from './refs/types';\nimport type { Symbol } from './symbols/symbol';\n\nexport function isBrand(value: unknown, brand: string): value is INode {\n if (!value || typeof value !== 'object') return false;\n return (value as any)['~brand'] === brand;\n}\n\nexport function isNode(value: unknown): value is INode {\n if (!value || typeof value !== 'object') return false;\n return isBrand(value, nodeBrand);\n}\n\nexport function isNodeRef(value: Ref<unknown>): value is Ref<INode> {\n return isBrand(value['~ref'], nodeBrand);\n}\n\nexport function isSymbol(value: unknown): value is Symbol {\n return isBrand(value, symbolBrand);\n}\n\nexport function isSymbolRef(value: Ref<unknown>): value is Ref<Symbol> {\n return isBrand(value['~ref'], symbolBrand);\n}\n","import type { Extensions } from './types';\n\nexport const defaultExtensions: Extensions = {\n c: ['.c'],\n 'c#': ['.cs'],\n 'c++': ['.cpp', '.hpp'],\n css: ['.css'],\n dart: ['.dart'],\n go: ['.go'],\n haskell: ['.hs'],\n html: ['.html'],\n java: ['.java'],\n javascript: ['.js', '.jsx'],\n json: ['.json'],\n kotlin: ['.kt'],\n lua: ['.lua'],\n markdown: ['.md'],\n matlab: ['.m'],\n perl: ['.pl'],\n php: ['.php'],\n python: ['.py'],\n r: ['.r'],\n ruby: ['.rb'],\n rust: ['.rs'],\n scala: ['.scala'],\n shell: ['.sh'],\n sql: ['.sql'],\n swift: ['.swift'],\n typescript: ['.ts', '.tsx'],\n yaml: ['.yaml', '.yml'],\n};\n","import type { ModuleEntryNames } from './types';\n\nexport const defaultModuleEntryNames: ModuleEntryNames = {\n javascript: 'index',\n python: '__init__',\n typescript: 'index',\n};\n","import type { NameConflictResolver } from './types';\n\nexport const simpleNameConflictResolver: NameConflictResolver = ({ attempt, baseName }) =>\n attempt === 0 ? baseName : `${baseName}${attempt + 1}`;\n\nexport const underscoreNameConflictResolver: NameConflictResolver = ({ attempt, baseName }) =>\n attempt === 0 ? baseName : `${baseName}_${attempt + 1}`;\n","import { underscoreNameConflictResolver } from '../planner/resolvers';\nimport type { NameConflictResolvers } from './types';\n\nexport const defaultNameConflictResolvers: NameConflictResolvers = {\n php: underscoreNameConflictResolver,\n python: underscoreNameConflictResolver,\n ruby: underscoreNameConflictResolver,\n};\n","import colors from 'ansi-colors';\n\ninterface LoggerEvent {\n end?: PerformanceMark;\n events: Array<LoggerEvent>;\n id: string; // unique internal key\n name: string;\n start: PerformanceMark;\n}\n\ninterface Severity {\n color: colors.StyleFunction;\n type: 'duration' | 'percentage';\n}\n\ninterface StoredEventResult {\n position: ReadonlyArray<number>;\n}\n\nlet loggerCounter = 0;\nconst nameToId = (name: string) => `${name}-${loggerCounter++}`;\nconst idEnd = (id: string) => `${id}-end`;\nconst idLength = (id: string) => `${id}-length`;\nconst idStart = (id: string) => `${id}-start`;\n\nconst getSeverity = (duration: number, percentage: number): Severity | undefined => {\n if (duration > 200) {\n return {\n color: colors.red,\n type: 'duration',\n };\n }\n if (percentage > 30) {\n return {\n color: colors.red,\n type: 'percentage',\n };\n }\n if (duration > 50) {\n return {\n color: colors.yellow,\n type: 'duration',\n };\n }\n if (percentage > 10) {\n return {\n color: colors.yellow,\n type: 'percentage',\n };\n }\n return;\n};\n\nexport class Logger {\n private events: Array<LoggerEvent> = [];\n\n private end(result: StoredEventResult): void {\n let event: LoggerEvent | undefined;\n let events = this.events;\n for (const index of result.position) {\n event = events[index];\n if (event?.events) {\n events = event.events;\n }\n }\n if (event && !event.end) {\n event.end = performance.mark(idEnd(event.id));\n }\n }\n\n /**\n * Recursively end all unended events in the event tree.\n * This ensures all events have end marks before measuring.\n */\n private endAllEvents(events: Array<LoggerEvent>): void {\n for (const event of events) {\n if (!event.end) {\n event.end = performance.mark(idEnd(event.id));\n }\n if (event.events.length) {\n this.endAllEvents(event.events);\n }\n }\n }\n\n report(print: boolean = true): PerformanceMeasure | undefined {\n const firstEvent = this.events[0];\n if (!firstEvent) return;\n\n // Ensure all events are ended before reporting\n this.endAllEvents(this.events);\n\n const lastEvent = this.events[this.events.length - 1]!;\n const name = 'root';\n const id = nameToId(name);\n\n try {\n const measure = performance.measure(\n idLength(id),\n idStart(firstEvent.id),\n idEnd(lastEvent.id),\n );\n if (print) {\n this.reportEvent({\n end: lastEvent.end,\n events: this.events,\n id,\n indent: 0,\n measure,\n name,\n start: firstEvent!.start,\n });\n }\n return measure;\n } catch {\n // If measuring fails (e.g., marks don't exist), silently skip reporting\n // to avoid crashing the application\n return;\n }\n }\n\n private reportEvent({\n indent,\n ...parent\n }: LoggerEvent & {\n indent: number;\n measure: PerformanceMeasure;\n }): void {\n const color = !indent ? colors.cyan : colors.gray;\n const lastIndex = parent.events.length - 1;\n\n parent.events.forEach((event, index) => {\n try {\n const measure = performance.measure(idLength(event.id), idStart(event.id), idEnd(event.id));\n const duration = Math.ceil(measure.duration * 100) / 100;\n const percentage =\n Math.ceil((measure.duration / parent.measure.duration) * 100 * 100) / 100;\n const severity = indent ? getSeverity(duration, percentage) : undefined;\n\n let durationLabel = `${duration.toFixed(2).padStart(8)}ms`;\n if (severity?.type === 'duration') {\n durationLabel = severity.color(durationLabel);\n }\n\n const branch = index === lastIndex ? '└─ ' : '├─ ';\n const prefix = !indent ? '' : '│ '.repeat(indent - 1) + branch;\n const maxLength = 38 - prefix.length;\n\n const percentageBranch = !indent ? '' : '↳ ';\n const percentagePrefix = indent ? ' '.repeat(indent - 1) + percentageBranch : '';\n let percentageLabel = `${percentagePrefix}${percentage.toFixed(2)}%`;\n if (severity?.type === 'percentage') {\n percentageLabel = severity.color(percentageLabel);\n }\n const jobPrefix = colors.gray('[root] ');\n console.log(\n `${jobPrefix}${colors.gray(prefix)}${color(\n `${event.name.padEnd(maxLength)} ${durationLabel} (${percentageLabel})`,\n )}`,\n );\n this.reportEvent({ ...event, indent: indent + 1, measure });\n } catch {\n // If measuring fails (e.g., marks don't exist), silently skip this event\n // to avoid crashing the application\n }\n });\n }\n\n private start(id: string): PerformanceMark {\n return performance.mark(idStart(id));\n }\n\n private storeEvent({\n result,\n ...event\n }: Pick<LoggerEvent, 'events' | 'id' | 'name' | 'start'> & {\n result: StoredEventResult;\n }): void {\n const lastEventIndex = event.events.length - 1;\n const lastEvent = event.events[lastEventIndex];\n if (lastEvent && !lastEvent.end) {\n result.position = [...result.position, lastEventIndex];\n this.storeEvent({ ...event, events: lastEvent.events, result });\n return;\n }\n const length = event.events.push({ ...event, events: [] });\n result.position = [...result.position, length - 1];\n }\n\n timeEvent(name: string) {\n const id = nameToId(name);\n const start = this.start(id);\n const event: LoggerEvent = {\n events: this.events,\n id,\n name,\n start,\n };\n const result: StoredEventResult = {\n position: [],\n };\n this.storeEvent({ ...event, result });\n return {\n mark: start,\n timeEnd: () => this.end(result),\n };\n }\n}\n","import path from 'node:path';\n\nimport type { IProject } from '../project/types';\nimport { File } from './file';\nimport type { FileKeyArgs, IFileIn, IFileRegistry } from './types';\n\ntype FileId = number;\ntype FileKey = string;\n\nexport class FileRegistry implements IFileRegistry {\n private _id: FileId = 0;\n private _values: Map<FileKey, File> = new Map();\n private readonly project: IProject;\n\n constructor(project: IProject) {\n this.project = project;\n }\n\n get(args: FileKeyArgs): File | undefined {\n return this._values.get(this.createFileKey(args));\n }\n\n isRegistered(args: FileKeyArgs): boolean {\n return this._values.has(this.createFileKey(args));\n }\n\n get nextId(): FileId {\n return this._id++;\n }\n\n register(file: IFileIn): File {\n const key = this.createFileKey(file);\n\n let result = this._values.get(key);\n if (result) {\n if (file.name) {\n result.setName(file.name);\n }\n } else {\n result = new File(file, this.nextId, this.project);\n }\n\n this._values.set(key, result);\n\n return result;\n }\n\n *registered(): IterableIterator<File> {\n for (const file of this._values.values()) {\n yield file;\n }\n }\n\n private createFileKey(args: FileKeyArgs): string {\n const logicalPath = args.logicalFilePath.split(path.sep).join('/');\n return `${args.external ? 'ext:' : ''}${logicalPath}${args.language ? `:${args.language}` : ''}`;\n }\n}\n","import type { FromRef, FromRefs, Ref, Refs } from './types';\n\n/**\n * Wraps a single value in a Ref object.\n *\n * If the value is already a Ref, returns it as-is (idempotent).\n *\n * @example\n * ```ts\n * const r = ref(123); // { '~ref': 123 }\n * console.log(r['~ref']); // 123\n *\n * const r2 = ref(r); // { '~ref': 123 } (not double-wrapped)\n * ```\n */\nexport const ref = <T>(value: T): Ref<T> => {\n if (isRef(value)) {\n return value as Ref<T>;\n }\n return { '~ref': value } as Ref<T>;\n};\n\n/**\n * Converts a plain object to an object of Refs (deep, per property).\n *\n * @example\n * ```ts\n * const obj = { a: 1, b: \"x\" };\n * const refs = refs(obj); // { a: { '~ref': 1 }, b: { '~ref': \"x\" } }\n * ```\n */\nexport const refs = <T extends Record<string, unknown>>(obj: T): Refs<T> => {\n const result = {} as Refs<T>;\n for (const key in obj) {\n if (Object.prototype.hasOwnProperty.call(obj, key)) {\n result[key] = ref(obj[key]);\n }\n }\n return result;\n};\n\n/**\n * Unwraps a single Ref object to its value.\n *\n * @example\n * ```ts\n * const r = { '~ref': 42 };\n * const n = fromRef(r); // 42\n * console.log(n); // 42\n * ```\n */\nexport const fromRef = <T extends Ref<unknown> | undefined>(ref: T): FromRef<T> =>\n ref?.['~ref'] as FromRef<T>;\n\n/**\n * Converts an object of Refs back to a plain object (unwraps all refs).\n *\n * @example\n * ```ts\n * const refs = { a: { '~ref': 1 }, b: { '~ref': \"x\" } };\n * const plain = fromRefs(refs); // { a: 1, b: \"x\" }\n * ```\n */\nexport const fromRefs = <T extends Refs<Record<string, unknown>>>(obj: T): FromRefs<T> => {\n const result = {} as FromRefs<T>;\n for (const key in obj) {\n if (Object.prototype.hasOwnProperty.call(obj, key)) {\n result[key] = fromRef(obj[key]!) as (typeof result)[typeof key];\n }\n }\n return result;\n};\n\n/**\n * Checks whether a value is a Ref object.\n *\n * @param value Value to check\n * @returns True if the value is a Ref object.\n */\nexport const isRef = <T>(value: unknown): value is Ref<T> =>\n typeof value === 'object' && value !== null && '~ref' in value;\n","import { fromRef, ref } from '../refs/refs';\nimport type { Ref } from '../refs/types';\nimport type { INode } from './node';\nimport type { INodeRegistry } from './types';\n\nexport class NodeRegistry implements INodeRegistry {\n private list: Array<Ref<INode | null>> = [];\n\n add(node: INode | null): number {\n const index = this.list.push(ref(node));\n return index - 1;\n }\n\n *all(): Iterable<INode> {\n for (const r of this.list) {\n const node = fromRef(r);\n if (node) yield node;\n }\n }\n\n remove(index: number): void {\n this.list[index] = ref(null);\n }\n\n update(index: number, node: INode | null): void {\n this.list[index] = ref(node);\n }\n}\n","import type { Language } from '../languages/types';\nimport type { SymbolKind } from '../symbols/types';\n\nconst typescriptMergeKindRank: Record<SymbolKind, number> = {\n class: 3,\n enum: 4,\n function: 5,\n interface: 1,\n namespace: 0,\n type: 2,\n var: 6,\n};\n\n/**\n * Returns true if two declarations of given kinds\n * are allowed to share the same identifier in TypeScript.\n */\nfunction canTypeScriptDeclarationsShareIdentifier(a: SymbolKind, b: SymbolKind): boolean {\n // sort based on TypeScript merge precedence so `a` is always the weaker merge candidate\n // ensures that asymmetric merges like `type + var` are correctly handled\n if (typescriptMergeKindRank[a] > typescriptMergeKindRank[b]) {\n [a, b] = [b, a];\n }\n\n switch (a) {\n case 'interface':\n return b === 'class' || b === 'interface';\n case 'namespace':\n return b === 'class' || b === 'enum' || b === 'function' || b === 'namespace';\n case 'type':\n // type can only merge with value-only declarations\n return b === 'function' || b === 'var';\n default:\n return false;\n }\n}\n\nexport function canDeclarationsShareIdentifier(\n language: Language | undefined,\n a: SymbolKind,\n b: SymbolKind,\n): boolean {\n if (language === 'typescript') {\n return canTypeScriptDeclarationsShareIdentifier(a, b);\n }\n\n return false;\n}\n","import type { Ref } from '../refs/types';\nimport type { Symbol } from '../symbols/symbol';\nimport type { SymbolKind } from '../symbols/types';\n\nexport type NameScopes = Map<string, Set<SymbolKind>>;\n\nexport type Scope = {\n /** Child scopes. */\n children: Array<Scope>;\n /** Resolved names in this scope. */\n localNames: NameScopes;\n /** Parent scope, if any. */\n parent?: Scope;\n /** Symbols registered in this scope. */\n symbols: Array<Ref<Symbol>>;\n};\n\nexport type AssignOptions = {\n /** The primary scope in which to assign a symbol's final name. */\n scope: Scope;\n /** Additional scopes to update as side effects when assigning a symbol's final name. */\n scopesToUpdate: ReadonlyArray<Scope>;\n};\n\nexport const createScope = (\n args: {\n localNames?: NameScopes;\n parent?: Scope;\n } = {},\n): Scope => ({\n children: [],\n localNames: args.localNames || new Map(),\n parent: args.parent,\n symbols: [],\n});\n","import { isNodeRef, isSymbolRef } from '../guards';\nimport type { INode, NodeRelationship } from '../nodes/node';\nimport { fromRef, isRef, ref } from '../refs/refs';\nimport type { Ref } from '../refs/types';\nimport type { Symbol } from '../symbols/symbol';\nimport type { NameScopes, Scope } from './scope';\nimport { createScope } from './scope';\nimport type { IAnalysisContext, Input } from './types';\n\nexport class AnalysisContext implements IAnalysisContext {\n /**\n * Stack of parent nodes during analysis.\n *\n * The top of the stack is the current semantic container.\n */\n private _parentStack: Array<INode> = [];\n\n scope: Scope;\n scopes: Scope = createScope();\n symbol?: Symbol;\n\n constructor(node: INode) {\n this._parentStack.push(node);\n this.scope = this.scopes;\n this.symbol = node.symbol;\n }\n\n /**\n * Get the current semantic parent (top of stack).\n */\n get currentParent(): INode | undefined {\n return this._parentStack[this._parentStack.length - 1];\n }\n\n /**\n * Register a child node under the current parent.\n */\n addChild(child: INode, relationship: NodeRelationship = 'container'): void {\n const parent = this.currentParent;\n if (!parent) return;\n\n if (!parent.structuralChildren) {\n parent.structuralChildren = new Map();\n }\n parent.structuralChildren.set(child, relationship);\n\n if (!child.structuralParents) {\n child.structuralParents = new Map();\n }\n child.structuralParents.set(parent, relationship);\n }\n\n addDependency(symbol: Ref<Symbol>): void {\n if (this.symbol !== fromRef(symbol)) {\n this.scope.symbols.push(symbol);\n }\n }\n\n analyze(input: Input): void {\n const value = isRef(input) ? input : ref(input);\n if (isSymbolRef(value)) {\n const symbol = fromRef(value);\n // avoid adding self as child\n if (symbol.node && this.currentParent !== symbol.node) {\n this.addChild(symbol.node, 'reference');\n }\n this.addDependency(value);\n } else if (isNodeRef(value)) {\n const node = fromRef(value);\n this.addChild(node, 'container');\n this.pushParent(node);\n node.analyze(this);\n this.popParent();\n }\n }\n\n localNames(scope: Scope): NameScopes {\n const names: NameScopes = new Map();\n for (const [name, kinds] of scope.localNames) {\n names.set(name, new Set(kinds));\n }\n if (scope.parent) {\n const parentNames = this.localNames(scope.parent);\n for (const [name, kinds] of parentNames) {\n if (!names.has(name)) {\n names.set(name, kinds);\n } else {\n const existingKinds = names.get(name)!;\n for (const kind of kinds) {\n existingKinds.add(kind);\n }\n }\n }\n }\n return names;\n }\n\n /**\n * Pop the current semantic parent.\n * Call this when exiting a container node.\n */\n popParent(): void {\n this._parentStack.pop();\n }\n\n popScope(): void {\n this.scope = this.scope.parent ?? this.scope;\n }\n\n /**\n * Push a node as the current semantic parent.\n */\n pushParent(node: INode): void {\n this._parentStack.push(node);\n }\n\n pushScope(): void {\n const scope = createScope({ parent: this.scope });\n this.scope.children.push(scope);\n this.scope = scope;\n }\n\n walkScopes(\n callback: (symbol: Ref<Symbol>, scope: Scope) => void,\n scope: Scope = this.scopes,\n ): void {\n this.scope = scope;\n for (const symbol of scope.symbols) {\n callback(symbol, scope);\n }\n for (const child of scope.children) {\n scope = child;\n this.walkScopes(callback, scope);\n }\n this.scope = this.scopes;\n }\n}\n\nexport class Analyzer {\n private nodeCache = new WeakMap<INode, AnalysisContext>();\n\n analyzeNode(node: INode): AnalysisContext {\n const cached = this.nodeCache.get(node);\n if (cached) return cached;\n\n node.root = true;\n const ctx = new AnalysisContext(node);\n node.analyze(ctx);\n\n this.nodeCache.set(node, ctx);\n return ctx;\n }\n\n analyze(nodes: Iterable<INode>, callback?: (ctx: AnalysisContext, node: INode) => void): void {\n for (const node of nodes) {\n const ctx = this.analyzeNode(node);\n callback?.(ctx, node);\n }\n }\n}\n","import path from 'node:path';\n\nimport type { ExportModule, ImportModule } from '../bindings';\nimport type { IProjectRenderMeta } from '../extensions';\nimport type { File } from '../files/file';\nimport type { INode } from '../nodes/node';\nimport { canDeclarationsShareIdentifier } from '../project/namespace';\nimport type { IProject } from '../project/types';\nimport { fromRef } from '../refs/refs';\nimport type { RenderContext } from '../renderer';\nimport type { Symbol } from '../symbols/symbol';\nimport type { SymbolKind } from '../symbols/types';\nimport type { AnalysisContext } from './analyzer';\nimport { Analyzer } from './analyzer';\nimport type { AssignOptions, Scope } from './scope';\nimport { createScope } from './scope';\n\nconst isTypeOnlyKind = (kind: SymbolKind) => kind === 'type' || kind === 'interface';\n\nexport class Planner {\n private readonly analyzer = new Analyzer();\n private readonly cacheResolvedNames = new Set<number>();\n private readonly project: IProject;\n\n constructor(project: IProject) {\n this.project = project;\n }\n\n /**\n * Executes the planning phase for the project.\n */\n plan(meta?: IProjectRenderMeta) {\n this.cacheResolvedNames.clear();\n this.allocateFiles();\n this.assignLocalNames();\n this.resolveFilePaths(meta);\n this.planExports();\n this.planImports();\n }\n\n /**\n * Creates and assigns a file to every node, re-export,\n * and external dependency.\n */\n private allocateFiles(): void {\n this.analyzer.analyze(this.project.nodes.all(), (ctx, node) => {\n const symbol = node.symbol;\n if (!symbol) return;\n\n const file = this.project.files.register({\n external: false,\n language: node.language,\n logicalFilePath: symbol.getFilePath?.(symbol) || this.project.defaultFileName,\n });\n file.addNode(node);\n symbol.setFile(file);\n for (const logicalFilePath of symbol.getExportFromFilePath?.(symbol) ?? []) {\n this.project.files.register({\n external: false,\n language: file.language,\n logicalFilePath,\n });\n }\n ctx.walkScopes((dependency) => {\n const dep = fromRef(dependency);\n if (dep.external && dep.isCanonical && !dep.file) {\n const file = this.project.files.register({\n external: true,\n language: dep.node?.language,\n logicalFilePath: dep.external,\n });\n dep.setFile(file);\n }\n });\n });\n }\n\n /**\n * Assigns final names to all symbols.\n *\n * First assigns top-level (file-scoped) symbol names, then local symbols.\n */\n private assignLocalNames(): void {\n this.analyzer.analyze(this.project.nodes.all(), (ctx, node) => {\n const symbol = node.symbol;\n if (!symbol) return;\n this.assignTopLevelName({ ctx, node, symbol });\n });\n\n this.analyzer.analyze(this.project.nodes.all(), (ctx, node) => {\n const file = node.file;\n if (!file) return;\n ctx.walkScopes((dependency) => {\n const dep = fromRef(dependency);\n // top-level or external symbol\n if (dep.file) return;\n // TODO: pass node\n this.assignLocalName({\n ctx,\n file,\n scopesToUpdate: [createScope({ localNames: file.allNames })],\n symbol: dep,\n });\n });\n });\n }\n\n /**\n * Resolves and sets final file paths for all non-external files. Attaches renderers.\n *\n * Uses the project's fileName function if provided, otherwise uses the file's current name.\n *\n * Resolves final paths relative to the project's root directory.\n */\n private resolveFilePaths(meta?: IProjectRenderMeta): void {\n for (const file of this.project.files.registered()) {\n if (file.external) {\n file.setFinalPath(file.logicalFilePath);\n continue;\n }\n const finalName = this.project.fileName?.(file.name) || file.name;\n file.setName(finalName);\n const finalPath = file.finalPath;\n if (finalPath) {\n file.setFinalPath(path.resolve(this.project.root, finalPath));\n }\n const ctx: RenderContext = { file, meta, project: this.project };\n const renderer = this.project.renderers.find((r) => r.supports(ctx));\n if (renderer) file.setRenderer(renderer);\n }\n }\n\n /**\n * Plans exports by analyzing all exported symbols.\n *\n * Registers re-export targets as files and creates new exported symbols for them.\n *\n * Assigns names to re-exported symbols and collects re-export metadata,\n * distinguishing type-only exports based on symbol kinds.\n */\n private planExports(): void {\n const seenByFile = new Map<File, Map<string, { kinds: Set<SymbolKind>; symbol: Symbol }>>();\n const sourceFile = new Map<number, File>();\n\n this.analyzer.analyze(this.project.nodes.all(), (ctx, node) => {\n if (!node.exported) return;\n\n const symbol = node.symbol;\n if (!symbol) return;\n\n const file = node.file;\n if (!file) return;\n\n for (const logicalFilePath of symbol.getExportFromFilePath?.(symbol) ?? []) {\n const target = this.project.files.register({\n external: false,\n language: node.language,\n logicalFilePath,\n });\n if (target.id === file.id) continue;\n\n let fileMap = seenByFile.get(target);\n if (!fileMap) {\n fileMap = new Map();\n seenByFile.set(target, fileMap);\n }\n\n const exp = this.project.symbols.register({\n exported: true,\n external: symbol.external,\n importKind: symbol.importKind,\n kind: symbol.kind,\n name: symbol.finalName,\n });\n exp.setFile(target);\n sourceFile.set(exp.id, file);\n // TODO: pass node\n this.assignTopLevelName({ ctx, symbol: exp });\n\n let entry = fileMap.get(exp.finalName);\n if (!entry) {\n entry = { kinds: new Set(), symbol: exp };\n fileMap.set(exp.finalName, entry);\n }\n entry.kinds.add(exp.kind);\n }\n });\n\n for (const [file, fileMap] of seenByFile) {\n const exports = new Map<File, ExportModule>();\n for (const [, entry] of fileMap) {\n const source = sourceFile.get(entry.symbol.id)!;\n let exp = exports.get(source);\n if (!exp) {\n exp = {\n canExportAll: true,\n exports: [],\n from: source,\n isTypeOnly: true,\n };\n }\n const isTypeOnly = [...entry.kinds].every((kind) => isTypeOnlyKind(kind));\n const exportedName = entry.symbol.finalName;\n exp.exports.push({\n exportedName,\n isTypeOnly,\n kind: entry.symbol.importKind,\n sourceName: entry.symbol.name,\n });\n if (entry.symbol.name !== entry.symbol.finalName) {\n exp.canExportAll = false;\n }\n if (!isTypeOnly) {\n exp.isTypeOnly = false;\n }\n exports.set(source, exp);\n }\n for (const [, exp] of exports) {\n file.addExport(exp);\n }\n }\n }\n\n /**\n * Plans imports by analyzing symbol dependencies across files.\n *\n * For external dependencies, assigns top-level names.\n *\n * Creates or reuses import symbols for dependencies from other files,\n * assigning names and updating import metadata including type-only flags.\n */\n private planImports(): void {\n const seenByFile = new Map<\n File,\n Map<\n string,\n {\n dep: Symbol;\n kinds: Set<SymbolKind>;\n symbol: Symbol;\n }\n >\n >();\n\n this.analyzer.analyze(this.project.nodes.all(), (ctx) => {\n const symbol = ctx.symbol;\n if (!symbol) return;\n\n const file = symbol.file;\n if (!file) return;\n\n let fileMap = seenByFile.get(file);\n if (!fileMap) {\n fileMap = new Map();\n seenByFile.set(file, fileMap);\n }\n\n ctx.walkScopes((dependency) => {\n const dep = fromRef(dependency);\n if (!dep.file || dep.file.id === file.id) return;\n\n if (dep.external) {\n // TODO: pass node\n this.assignTopLevelName({ ctx, symbol: dep });\n }\n\n const fromFileId = dep.file.id;\n const importedName = dep.finalName;\n const kind = dep.importKind;\n const key = `${fromFileId}|${importedName}|${kind}`;\n\n let entry = fileMap.get(key);\n if (!entry) {\n const imp = this.project.symbols.register({\n exported: dep.exported,\n external: dep.external,\n importKind: dep.importKind,\n kind: dep.kind,\n name: dep.finalName,\n });\n imp.setFile(file);\n // TODO: pass node\n this.assignTopLevelName({\n ctx,\n scope: createScope({ localNames: imp.file!.allNames }),\n symbol: imp,\n });\n entry = {\n dep,\n kinds: new Set(),\n symbol: imp,\n };\n fileMap.set(key, entry);\n }\n entry.kinds.add(dep.kind);\n\n dependency['~ref'] = entry.symbol;\n });\n });\n\n for (const [file, fileMap] of seenByFile) {\n const imports = new Map<File, ImportModule>();\n for (const [, entry] of fileMap) {\n const source = entry.dep.file!;\n let imp = imports.get(source);\n if (!imp) {\n imp = {\n from: source,\n imports: [],\n isTypeOnly: true,\n kind: 'named',\n };\n }\n const isTypeOnly = [...entry.kinds].every((kind) => isTypeOnlyKind(kind));\n if (entry.symbol.importKind === 'namespace') {\n imp.imports = [];\n imp.kind = 'namespace';\n imp.localName = entry.symbol.finalName;\n } else if (entry.symbol.importKind === 'default') {\n imp.kind = 'default';\n imp.localName = entry.symbol.finalName;\n } else {\n imp.imports.push({\n isTypeOnly,\n localName: entry.symbol.finalName,\n sourceName: entry.dep.finalName,\n });\n }\n if (!isTypeOnly) {\n imp.isTypeOnly = false;\n }\n imports.set(source, imp);\n }\n for (const [, imp] of imports) {\n file.addImport(imp);\n }\n }\n }\n\n /**\n * Assigns the final name to a top-level (file-scoped) symbol.\n *\n * Uses the symbol's file top-level names as the default scope,\n * and updates all relevant name scopes including the file's allNames and local scopes.\n *\n * Supports optional overrides for the naming scope and scopes to update.\n */\n private assignTopLevelName(\n args: Partial<AssignOptions> & {\n ctx: AnalysisContext;\n debug?: boolean;\n node?: INode;\n symbol: Symbol;\n },\n ): void {\n if (!args.symbol.file) return;\n this.assignSymbolName({\n ...args,\n file: args.symbol.file,\n scope: args?.scope ?? createScope({ localNames: args.symbol.file.topLevelNames }),\n scopesToUpdate: [\n createScope({ localNames: args.symbol.file.allNames }),\n args.ctx.scopes,\n ...(args?.scopesToUpdate ?? []),\n ],\n });\n }\n\n /**\n * Assigns the final name to a non-top-level (local) symbol.\n *\n * Uses the provided scope or derives it from the current analysis context's local names.\n *\n * Updates all provided name scopes accordingly.\n */\n private assignLocalName(\n args: Pick<Partial<AssignOptions>, 'scope'> &\n Pick<AssignOptions, 'scopesToUpdate'> & {\n ctx: AnalysisContext;\n debug?: boolean;\n /** The file the symbol belongs to. */\n file: File;\n node?: INode;\n symbol: Symbol;\n },\n ): void {\n this.assignSymbolName({\n ...args,\n scope: args.scope ?? args.ctx.scope,\n });\n }\n\n /**\n * Assigns the final name to a symbol within the provided name scope.\n *\n * Resolves name conflicts until a unique name is found.\n *\n * Updates all specified name scopes with the assigned final name.\n */\n private assignSymbolName(\n args: AssignOptions & {\n ctx: AnalysisContext;\n debug?: boolean;\n /** The file the symbol belongs to. */\n file: File;\n node?: INode;\n symbol: Symbol;\n },\n ): void {\n const { ctx, file, node, scope, scopesToUpdate, symbol } = args;\n if (this.cacheResolvedNames.has(symbol.id)) return;\n\n const baseName = symbol.name;\n let finalName =\n node?.nameSanitizer?.(baseName) ?? symbol.node?.nameSanitizer?.(baseName) ?? baseName;\n let attempt = 1;\n\n const localNames = ctx.localNames(scope);\n while (true) {\n const language = node?.language || symbol.node?.language || file.language;\n\n const kinds = [...(localNames.get(finalName) ?? [])];\n\n const ok = kinds.every((kind) => canDeclarationsShareIdentifier(language, symbol.kind, kind));\n if (ok) break;\n\n const resolver =\n (language ? this.project.nameConflictResolvers[language] : undefined) ??\n this.project.defaultNameConflictResolver;\n const resolvedName = resolver({ attempt, baseName });\n if (!resolvedName) {\n throw new Error(`Unresolvable name conflict: ${symbol.toString()}`);\n }\n\n finalName =\n node?.nameSanitizer?.(resolvedName) ??\n symbol.node?.nameSanitizer?.(resolvedName) ??\n resolvedName;\n attempt = attempt + 1;\n }\n\n symbol.setFinalName(finalName);\n this.cacheResolvedNames.add(symbol.id);\n const updateScopes = [scope, ...scopesToUpdate];\n for (const scope of updateScopes) {\n this.updateScope(symbol, scope);\n }\n }\n\n /**\n * Updates the provided name scope with the symbol's final name and kind.\n *\n * Ensures the name scope tracks all kinds associated with a given name.\n */\n private updateScope(symbol: Symbol, scope: Scope): void {\n const name = symbol.finalName;\n const cache = scope.localNames.get(name) ?? new Set();\n cache.add(symbol.kind);\n scope.localNames.set(name, cache);\n }\n}\n","import { symbolBrand } from '../brands';\nimport type { ISymbolMeta } from '../extensions';\nimport type { File } from '../files/file';\nimport { log } from '../log';\nimport type { INode } from '../nodes/node';\nimport type { BindingKind, ISymbolIn, SymbolKind } from './types';\n\nexport class Symbol<Node extends INode = INode> {\n /**\n * Canonical symbol this stub resolves to, if any.\n *\n * Stubs created during DSL construction may later be associated\n * with a fully registered symbol. Once set, all property lookups\n * should defer to the canonical symbol.\n */\n private _canonical?: Symbol;\n /**\n * True if this symbol is exported from its defining file.\n *\n * @default false\n */\n private _exported: boolean;\n /**\n * External module name if this symbol is imported from a module not managed\n * by the project (e.g., \"zod\", \"lodash\").\n *\n * @default undefined\n */\n private _external?: string;\n /**\n * The file this symbol is ultimately emitted into.\n *\n * Only top-level symbols have an assigned file.\n */\n private _file?: File;\n /**\n * The alias-resolved, conflict-free emitted name.\n */\n private _finalName?: string;\n /**\n * Custom strategy to determine from which file path(s) this symbol is re-exported.\n *\n * @returns The file path(s) that re-export this symbol, or undefined if none.\n */\n private _getExportFromFilePath?: (symbol: Symbol) => ReadonlyArray<string> | undefined;\n /**\n * Custom strategy to determine file output path.\n *\n * @returns The file path to output the symbol to, or undefined to fallback to default behavior.\n */\n private _getFilePath?: (symbol: Symbol) => string | undefined;\n /**\n * How this symbol should be imported (namespace/default/named).\n *\n * @default 'named'\n */\n private _importKind: BindingKind;\n /**\n * Kind of symbol (class, type, alias, etc.).\n *\n * @default 'var'\n */\n private _kind: SymbolKind;\n /**\n * Arbitrary user metadata.\n *\n * @default undefined\n */\n private _meta?: ISymbolMeta;\n /**\n * Intended user-facing name before conflict resolution.\n *\n * @example \"UserModel\"\n */\n private _name: string;\n /**\n * Node that defines this symbol.\n */\n private _node?: Node;\n\n /** Brand used for identifying symbols. */\n readonly '~brand' = symbolBrand;\n /** Globally unique, stable symbol ID. */\n readonly id: number;\n\n constructor(input: ISymbolIn, id: number) {\n this._exported = input.exported ?? false;\n this._external = input.external;\n this._getExportFromFilePath = input.getExportFromFilePath;\n this._getFilePath = input.getFilePath;\n this.id = id;\n this._importKind = input.importKind ?? 'named';\n this._kind = input.kind ?? 'var';\n this._meta = input.meta;\n this._name = input.name;\n }\n\n /**\n * Returns the canonical symbol for this instance.\n *\n * If this symbol was created as a stub, this getter returns\n * the fully registered canonical symbol. Otherwise, it returns\n * the symbol itself.\n */\n get canonical(): Symbol {\n return this._canonical ?? this;\n }\n\n /**\n * Indicates whether this symbol is exported from its defining file.\n */\n get exported(): boolean {\n return this.canonical._exported;\n }\n\n /**\n * External module from which this symbol originates, if any.\n */\n get external(): string | undefined {\n return this.canonical._external;\n }\n\n /**\n * Read‑only accessor for the assigned output file.\n *\n * Only top-level symbols have an assigned file.\n */\n get file(): File | undefined {\n return this.canonical._file;\n }\n\n /**\n * Read‑only accessor for the resolved final emitted name.\n */\n get finalName(): string {\n if (!this.canonical._finalName) {\n const message = `Symbol finalName has not been resolved yet for ${this.canonical.toString()}`;\n log.debug(message, 'symbol');\n throw new Error(message);\n }\n return this.canonical._finalName;\n }\n\n /**\n * Custom re-export file path resolver, if provided.\n */\n get getExportFromFilePath(): ((symbol: Symbol) => ReadonlyArray<string> | undefined) | undefined {\n return this.canonical._getExportFromFilePath;\n }\n\n /**\n * Custom file path resolver, if provided.\n */\n get getFilePath(): ((symbol: Symbol) => string | undefined) | undefined {\n return this.canonical._getFilePath;\n }\n\n /**\n * How this symbol should be imported (named/default/namespace).\n */\n get importKind(): BindingKind {\n return this.canonical._importKind;\n }\n\n /**\n * Indicates whether this is a canonical symbol (not a stub).\n */\n get isCanonical(): boolean {\n return !this._canonical || this._canonical === this;\n }\n\n /**\n * The symbol's kind (class, type, alias, variable, etc.).\n */\n get kind(): SymbolKind {\n return this.canonical._kind;\n }\n\n /**\n * Arbitrary user‑provided metadata associated with this symbol.\n */\n get meta(): ISymbolMeta | undefined {\n return this.canonical._meta;\n }\n\n /**\n * User-intended name before aliasing or conflict resolution.\n */\n get name(): string {\n return this.canonical._name;\n }\n\n /**\n * Read‑only accessor for the defining node.\n */\n get node(): Node | undefined {\n return this.canonical._node as Node | undefined;\n }\n\n /**\n * Marks this symbol as a stub and assigns its canonical symbol.\n *\n * After calling this, all semantic queries (name, kind, file,\n * meta, etc.) should reflect the canonical symbol's values.\n *\n * @param symbol — The canonical symbol this stub should resolve to.\n */\n setCanonical(symbol: Symbol): void {\n this._canonical = symbol;\n }\n\n /**\n * Marks the symbol as exported from its file.\n *\n * @param exported — Whether the symbol is exported.\n */\n setExported(exported: boolean): void {\n this.assertCanonical();\n this._exported = exported;\n }\n\n /**\n * Assigns the output file this symbol will be emitted into.\n *\n * This may only be set once.\n */\n setFile(file: File): void {\n this.assertCanonical();\n if (this._file && this._file !== file) {\n const message = `Symbol ${this.canonical.toString()} is already assigned to a different file.`;\n log.debug(message, 'symbol');\n throw new Error(message);\n }\n this._file = file;\n }\n\n /**\n * Assigns the conflict‑resolved final local name for this symbol.\n *\n * This may only be set once.\n */\n setFinalName(name: string): void {\n this.assertCanonical();\n if (this._finalName && this._finalName !== name) {\n const message = `Symbol finalName has already been resolved for ${this.canonical.toString()}.`;\n log.debug(message, 'symbol');\n throw new Error(message);\n }\n this._finalName = name;\n }\n\n /**\n * Sets how this symbol should be imported.\n *\n * @param kind — The import strategy (named/default/namespace).\n */\n setImportKind(kind: BindingKind): void {\n this.assertCanonical();\n this._importKind = kind;\n }\n\n /**\n * Sets the symbol's kind (class, type, alias, variable, etc.).\n *\n * @param kind — The new symbol kind.\n */\n setKind(kind: SymbolKind): void {\n this.assertCanonical();\n this._kind = kind;\n }\n\n /**\n * Updates the intended user‑facing name for this symbol.\n *\n * @param name — The new name.\n */\n setName(name: string): void {\n this.assertCanonical();\n this._name = name;\n }\n\n /**\n * Binds the node that defines this symbol.\n *\n * This may only be set once.\n */\n setNode(node: Node): void {\n this.assertCanonical();\n if (this._node && this._node !== node) {\n const message = `Symbol ${this.canonical.toString()} is already bound to a different node.`;\n log.debug(message, 'symbol');\n // TODO: symbol <> node relationship needs to be refactor to 1:many\n // disabled in the meantime or it would throw\n // throw new Error(message);\n }\n this._node = node;\n node.symbol = this;\n }\n\n /**\n * Returns a debug‑friendly string representation identifying the symbol.\n */\n toString(): string {\n const canonical = this.canonical;\n if (canonical._finalName && canonical._finalName !== canonical._name) {\n return `[Symbol ${canonical._name} → ${canonical._finalName}#${canonical.id}]`;\n }\n return `[Symbol ${canonical._name || canonical._meta !== undefined ? JSON.stringify(canonical._meta) : '<unknown>'}#${canonical.id}]`;\n }\n\n /**\n * Ensures this symbol is canonical before allowing mutation.\n *\n * A symbol that has been marked as a stub (i.e., its `_canonical` points\n * to a different symbol) may not be mutated. This guard throws an error\n * if any setter attempts to modify a stub, preventing accidental writes\n * to non‑canonical instances.\n *\n * @throws {Error} If the symbol is a stub and is being mutated.\n */\n private assertCanonical(): void {\n if (this._canonical && this._canonical !== this) {\n const message = `Illegal mutation of stub symbol ${this.toString()} → canonical: ${this._canonical.toString()}`;\n log.debug(message, 'symbol');\n throw new Error(message);\n }\n }\n}\n","import type { ISymbolMeta } from '../extensions';\nimport { Symbol } from './symbol';\nimport type { ISymbolIdentifier, ISymbolIn, ISymbolRegistry } from './types';\n\ntype IndexEntry = [string, unknown];\ntype IndexKeySpace = ReadonlyArray<IndexEntry>;\ntype QueryCacheKey = string;\ntype SymbolId = number;\n\nexport class SymbolRegistry implements ISymbolRegistry {\n private _id: SymbolId = 0;\n private _indices: Map<IndexEntry[0], Map<IndexEntry[1], Set<SymbolId>>> = new Map();\n private _queryCache: Map<QueryCacheKey, ReadonlyArray<SymbolId>> = new Map();\n private _queryCacheDependencies: Map<QueryCacheKey, Set<QueryCacheKey>> = new Map();\n private _registered: Set<SymbolId> = new Set();\n private _stubs: Set<SymbolId> = new Set();\n private _stubCache: Map<QueryCacheKey, SymbolId> = new Map();\n private _values: Map<SymbolId, Symbol> = new Map();\n\n get(identifier: ISymbolIdentifier): Symbol | undefined {\n return typeof identifier === 'number'\n ? this._values.get(identifier)\n : this.query(identifier)[0];\n }\n\n isRegistered(identifier: ISymbolIdentifier): boolean {\n const symbol = this.get(identifier);\n return symbol ? this._registered.has(symbol.id) : false;\n }\n\n get nextId(): SymbolId {\n return this._id++;\n }\n\n query(filter: ISymbolMeta): ReadonlyArray<Symbol> {\n const cacheKey = this.buildCacheKey(filter);\n const cachedIds = this._queryCache.get(cacheKey);\n if (cachedIds) {\n return cachedIds.map((symbolId) => this._values.get(symbolId)!);\n }\n const sets: Array<Set<SymbolId>> = [];\n const indexKeySpace = this.buildIndexKeySpace(filter);\n const cacheDependencies = new Set<QueryCacheKey>();\n let missed = false;\n for (const indexEntry of indexKeySpace) {\n cacheDependencies.add(this.serializeIndexEntry(indexEntry));\n const values = this._indices.get(indexEntry[0]);\n if (!values) {\n missed = true;\n break;\n }\n const set = values.get(indexEntry[1]);\n if (!set) {\n missed = true;\n break;\n }\n sets.push(set);\n }\n if (missed || !sets.length) {\n this._queryCacheDependencies.set(cacheKey, cacheDependencies);\n this._queryCache.set(cacheKey, []);\n return [];\n }\n let result = new Set(sets[0]);\n for (const set of sets.slice(1)) {\n result = new Set([...result].filter((symbolId) => set.has(symbolId)));\n }\n const resultIds = [...result];\n this._queryCacheDependencies.set(cacheKey, cacheDependencies);\n this._queryCache.set(cacheKey, resultIds);\n return resultIds.map((symbolId) => this._values.get(symbolId)!);\n }\n\n reference(meta: ISymbolMeta): Symbol {\n const [registered] = this.query(meta);\n if (registered) return registered;\n\n const cacheKey = this.buildCacheKey(meta);\n const cachedId = this._stubCache.get(cacheKey);\n if (cachedId !== undefined) return this._values.get(cachedId)!;\n\n const stub = new Symbol({ meta, name: '' }, this.nextId);\n\n this._values.set(stub.id, stub);\n this._stubs.add(stub.id);\n this._stubCache.set(cacheKey, stub.id);\n return stub;\n }\n\n register(symbol: ISymbolIn): Symbol {\n const result = new Symbol(symbol, this.nextId);\n\n this._values.set(result.id, result);\n this._registered.add(result.id);\n\n if (result.meta) {\n const indexKeySpace = this.buildIndexKeySpace(result.meta);\n this.indexSymbol(result.id, indexKeySpace);\n this.invalidateCache(indexKeySpace);\n this.replaceStubs(result, indexKeySpace);\n }\n\n return result;\n }\n\n *registered(): IterableIterator<Symbol> {\n for (const id of this._registered.values()) {\n yield this._values.get(id)!;\n }\n }\n\n private buildCacheKey(filter: ISymbolMeta): QueryCacheKey {\n const indexKeySpace = this.buildIndexKeySpace(filter);\n return indexKeySpace\n .map((indexEntry) => this.serializeIndexEntry(indexEntry))\n .sort() // ensure order-insensitivity\n .join('|');\n }\n\n private buildIndexKeySpace(meta: ISymbolMeta, prefix = ''): IndexKeySpace {\n const entries: Array<IndexEntry> = [];\n for (const [key, value] of Object.entries(meta)) {\n const path = prefix ? `${prefix}.${key}` : key;\n if (value && typeof value === 'object' && !Array.isArray(value)) {\n entries.push(...this.buildIndexKeySpace(value as ISymbolMeta, path));\n } else {\n entries.push([path, value]);\n }\n }\n return entries;\n }\n\n private indexSymbol(symbolId: SymbolId, indexKeySpace: IndexKeySpace): void {\n for (const [key, value] of indexKeySpace) {\n if (!this._indices.has(key)) this._indices.set(key, new Map());\n const values = this._indices.get(key)!;\n const set = values.get(value) ?? new Set();\n set.add(symbolId);\n values.set(value, set);\n }\n }\n\n private invalidateCache(indexKeySpace: IndexKeySpace): void {\n const changed = indexKeySpace.map((indexEntry) => this.serializeIndexEntry(indexEntry));\n for (const [cacheKey, cacheDependencies] of this._queryCacheDependencies.entries()) {\n for (const key of changed) {\n if (cacheDependencies.has(key)) {\n this._queryCacheDependencies.delete(cacheKey);\n this._queryCache.delete(cacheKey);\n break;\n }\n }\n }\n }\n\n private isSubset(sub: IndexKeySpace, sup: IndexKeySpace): boolean {\n const supMap = new Map(sup);\n for (const [key, value] of sub) {\n if (!supMap.has(key) || supMap.get(key) !== value) {\n return false;\n }\n }\n return true;\n }\n\n private replaceStubs(symbol: Symbol, indexKeySpace: IndexKeySpace): void {\n for (const stubId of this._stubs.values()) {\n const stub = this._values.get(stubId);\n if (stub?.meta && this.isSubset(this.buildIndexKeySpace(stub.meta), indexKeySpace)) {\n const cacheKey = this.buildCacheKey(stub.meta);\n this._stubCache.delete(cacheKey);\n this._stubs.delete(stubId);\n stub.setCanonical(symbol);\n }\n }\n }\n\n private serializeIndexEntry(indexEntry: IndexEntry): string {\n return `${indexEntry[0]}:${JSON.stringify(indexEntry[1])}`;\n }\n}\n","import path from 'node:path';\n\nimport type { IProjectRenderMeta } from '../extensions';\nimport { FileRegistry } from '../files/registry';\nimport { defaultExtensions } from '../languages/extensions';\nimport { defaultModuleEntryNames } from '../languages/modules';\nimport { defaultNameConflictResolvers } from '../languages/resolvers';\nimport type { Extensions, ModuleEntryNames, NameConflictResolvers } from '../languages/types';\nimport { NodeRegistry } from '../nodes/registry';\nimport type { IOutput } from '../output';\nimport { Planner } from '../planner/planner';\nimport { simpleNameConflictResolver } from '../planner/resolvers';\nimport type { NameConflictResolver } from '../planner/types';\nimport type { Renderer } from '../renderer';\nimport { SymbolRegistry } from '../symbols/registry';\nimport type { IProject } from './types';\n\nexport class Project implements IProject {\n private _isPlanned = false;\n\n readonly files: FileRegistry;\n readonly nodes = new NodeRegistry();\n readonly symbols = new SymbolRegistry();\n\n readonly defaultFileName: string;\n readonly defaultNameConflictResolver: NameConflictResolver;\n readonly extensions: Extensions;\n readonly fileName?: (name: string) => string;\n readonly moduleEntryNames: ModuleEntryNames;\n readonly nameConflictResolvers: NameConflictResolvers;\n readonly renderers: ReadonlyArray<Renderer>;\n readonly root: string;\n\n constructor(\n args: Pick<\n Partial<IProject>,\n | 'defaultFileName'\n | 'defaultNameConflictResolver'\n | 'extensions'\n | 'fileName'\n | 'moduleEntryNames'\n | 'nameConflictResolvers'\n | 'renderers'\n > &\n Pick<IProject, 'root'>,\n ) {\n const fileName = args.fileName;\n this.defaultFileName = args.defaultFileName ?? 'main';\n this.defaultNameConflictResolver =\n args.defaultNameConflictResolver ?? simpleNameConflictResolver;\n this.extensions = {\n ...defaultExtensions,\n ...args.extensions,\n };\n this.fileName = typeof fileName === 'string' ? () => fileName : fileName;\n this.files = new FileRegistry(this);\n this.moduleEntryNames = {\n ...defaultModuleEntryNames,\n ...args.moduleEntryNames,\n };\n this.nameConflictResolvers = {\n ...defaultNameConflictResolvers,\n ...args.nameConflictResolvers,\n };\n this.renderers = args.renderers ?? [];\n this.root = path.resolve(args.root).replace(/[/\\\\]+$/, '');\n }\n\n plan(meta?: IProjectRenderMeta): void {\n if (this._isPlanned) return;\n new Planner(this).plan(meta);\n this._isPlanned = true;\n }\n\n render(meta?: IProjectRenderMeta): ReadonlyArray<IOutput> {\n if (!this._isPlanned) this.plan(meta);\n const files: Array<IOutput> = [];\n for (const file of this.files.registered()) {\n if (!file.external && file.finalPath && file.renderer) {\n const content = file.renderer.render({ file, meta, project: this });\n files.push({ content, path: file.finalPath });\n }\n }\n return files;\n }\n}\n","import type { StructureItem, StructureShell } from './types';\n\nexport class StructureNode {\n /** Nested nodes within this node. */\n children: Map<string, StructureNode> = new Map();\n /** Items contained in this node. */\n items: Array<StructureItem> = [];\n /** The name of this node (e.g., \"Users\", \"Accounts\"). */\n name: string;\n /** Parent node in the hierarchy. Undefined if this is the root node. */\n parent?: StructureNode;\n /** Shell claimed for this node. */\n shell?: StructureShell;\n /** Source of the claimed shell. */\n shellSource?: symbol;\n /** True if this is a virtual root. */\n virtual: boolean;\n\n constructor(\n name: string,\n parent?: StructureNode,\n options?: {\n virtual?: boolean;\n },\n ) {\n this.name = name;\n this.parent = parent;\n this.virtual = options?.virtual ?? false;\n }\n\n get isRoot(): boolean {\n return !this.parent;\n }\n\n /**\n * Gets or creates a child node.\n *\n * If the child doesn't exist, it's created automatically.\n *\n * @param name - The name of the child node\n * @returns The child node instance\n */\n child(name: string): StructureNode {\n if (!this.children.has(name)) {\n this.children.set(name, new StructureNode(name, this));\n }\n return this.children.get(name)!;\n }\n\n /**\n * Gets the full path of this node in the hierarchy.\n *\n * @returns An array of node names from the root to this node\n */\n getPath(): ReadonlyArray<string> {\n const path: Array<string> = [];\n // eslint-disable-next-line @typescript-eslint/no-this-alias\n let cursor: StructureNode | undefined = this;\n while (cursor) {\n path.unshift(cursor.name);\n cursor = cursor.parent;\n }\n return path;\n }\n\n /**\n * Yields items from a specific source with typed data.\n *\n * @param source - The source symbol to filter by\n * @returns Generator of items from that source\n */\n *itemsFrom<T = unknown>(source: symbol): Generator<StructureItem & { data: T }> {\n for (const item of this.items) {\n if (item.source === source) {\n yield item as StructureItem & { data: T };\n }\n }\n }\n\n /**\n * Walk all nodes in the structure (depth-first, post-order).\n *\n * @returns Generator of all structure nodes\n */\n *walk(): Generator<StructureNode> {\n for (const node of this.children.values()) {\n yield* node.walk();\n }\n yield this;\n }\n}\n","import { StructureNode } from './node';\nimport type { StructureInsert } from './types';\n\nexport class StructureModel {\n /** Root nodes mapped by their names. */\n private _roots: Map<string, StructureNode> = new Map();\n /** Node for data without a specific root. */\n private _virtualRoot?: StructureNode;\n\n /**\n * Get all root nodes.\n */\n get roots(): ReadonlyArray<StructureNode> {\n const roots = Array.from(this._roots.values());\n if (this._virtualRoot) roots.unshift(this._virtualRoot);\n return roots;\n }\n\n /**\n * Insert data into the structure.\n */\n insert(args: StructureInsert): void {\n const { data, locations, source } = args;\n for (const location of locations) {\n const { path, shell } = location;\n const fullPath = path.filter((s): s is string => Boolean(s));\n const segments = fullPath.slice(0, -1);\n const name = fullPath[fullPath.length - 1];\n\n if (!name) {\n throw new Error('Cannot insert data without path.');\n }\n\n let cursor: StructureNode | null = null;\n\n for (const segment of segments) {\n if (!cursor) {\n cursor = this.root(segment);\n } else {\n cursor = cursor.child(segment);\n }\n\n if (shell && !cursor.shell) {\n cursor.shell = shell;\n cursor.shellSource = source;\n }\n }\n\n if (!cursor) {\n cursor = this.root(null);\n }\n\n cursor.items.push({ data, location: fullPath, source });\n }\n }\n\n /**\n * Gets or creates a root by name.\n *\n * If the root doesn't exist, it's created automatically.\n *\n * @param name - The name of the root\n * @returns The root instance\n */\n root(name: string | null): StructureNode {\n if (!name) {\n return (this._virtualRoot ??= new StructureNode('', undefined, {\n virtual: true,\n }));\n }\n if (!this._roots.has(name)) {\n this._roots.set(name, new StructureNode(name));\n }\n return this._roots.get(name)!;\n }\n\n /**\n * Walk all nodes in the structure (depth-first, post-order).\n *\n * @returns Generator of all structure nodes\n */\n *walk(): Generator<StructureNode> {\n if (this._virtualRoot) {\n yield* this._virtualRoot.walk();\n }\n for (const root of this._roots.values()) {\n yield* root.walk();\n }\n }\n}\n"],"mappings":";;;;;AAAA,MAAa,YAAY;AACzB,MAAa,YAAY;AACzB,MAAa,cAAc;;;;;;;;ACG3B,SAAgB,2BAAoC;AAClD,QAAO,QACL,QAAQ,MAAM,SACd,QAAQ,OAAO,SACf,CAAC,QAAQ,IAAI,MACb,CAAC,QAAQ,IAAI,kBACb,CAAC,QAAQ,IAAI,eACd;;;;ACVH,SAAS,cAAc,OAAoC;AACzD,QAAO,OAAO,UAAU,YAAY,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AC;AAEJ,MAAI,CAAC,KAAK,OAAO,IAAI,KAAK,CACxB,MAAK,OAAO,IAAI,MAAM,IAAI,cAAc,KAAK,CAAC;AAEhD,SAAO,KAAK,OAAO,IAAI,KAAK;;;;;;;CAQ9B,CAAC,OAAiC;AAChC,MAAI,KAAK,aACP,QAAO,KAAK,aAAa,MAAM;AAEjC,OAAK,MAAM,QAAQ,KAAK,OAAO,QAAQ,CACrC,QAAO,KAAK,MAAM"}
|
|
1
|
+
{"version":3,"file":"index.mjs","names":[],"sources":["../src/brands.ts","../src/config/interactive.ts","../src/config/merge.ts","../src/config/load.ts","../src/log.ts","../src/files/file.ts","../src/guards.ts","../src/languages/extensions.ts","../src/languages/modules.ts","../src/planner/resolvers.ts","../src/languages/resolvers.ts","../src/logger.ts","../src/files/registry.ts","../src/refs/refs.ts","../src/nodes/registry.ts","../src/project/namespace.ts","../src/planner/scope.ts","../src/planner/analyzer.ts","../src/planner/planner.ts","../src/symbols/symbol.ts","../src/symbols/registry.ts","../src/project/project.ts","../src/structure/node.ts","../src/structure/model.ts"],"sourcesContent":["export const fileBrand = 'heyapi.file';\nexport const nodeBrand = 'heyapi.node';\nexport const symbolBrand = 'heyapi.symbol';\n","/**\n * Detect if the current session is interactive based on TTY status and environment variables.\n * This is used as a fallback when the user doesn't explicitly set the interactive option.\n * @internal\n */\nexport function detectInteractiveSession(): boolean {\n return Boolean(\n process.stdin.isTTY &&\n process.stdout.isTTY &&\n !process.env.CI &&\n !process.env.NO_INTERACTIVE &&\n !process.env.NO_INTERACTION,\n );\n}\n","import type { AnyObject } from '@hey-api/types';\n\nfunction isPlainObject(value: unknown): value is AnyObject {\n return typeof value === 'object' && value !== null && !Array.isArray(value);\n}\n\nexport function mergeConfigs<T extends AnyObject>(\n configA: T | undefined,\n configB: T | undefined,\n): T {\n const a = (configA || {}) as AnyObject;\n const b = (configB || {}) as AnyObject;\n\n const result: AnyObject = { ...a };\n\n for (const key of Object.keys(b)) {\n const valueA = a[key];\n const valueB = b[key];\n\n if (isPlainObject(valueA) && isPlainObject(valueB)) {\n result[key] = mergeConfigs(valueA, valueB);\n } else {\n result[key] = valueB;\n }\n }\n\n return result as T;\n}\n","import type { AnyObject, MaybeArray } from '@hey-api/types';\nimport { loadConfig } from 'c12';\n\nimport type { Logger } from '../logger';\nimport { mergeConfigs } from './merge';\n\nexport async function loadConfigFile<T extends AnyObject>({\n configFile,\n logger,\n name,\n userConfig,\n}: {\n configFile: string | undefined;\n logger: Logger;\n name: string;\n userConfig: T;\n}): Promise<{\n configFile: string | undefined;\n configs: ReadonlyArray<T>;\n foundConfig: boolean;\n}> {\n const eventC12 = logger.timeEvent('c12');\n const { config: fileConfig, configFile: loadedConfigFile } = await loadConfig<MaybeArray<T>>({\n configFile,\n name,\n });\n eventC12.timeEnd();\n\n const fileConfigs = fileConfig instanceof Array ? fileConfig : [fileConfig];\n const mergedConfigs = fileConfigs.map((config) => mergeConfigs<T>(config, userConfig));\n const foundConfig = fileConfigs.some((config) => Object.keys(config).length);\n\n return { configFile: loadedConfigFile, configs: mergedConfigs, foundConfig };\n}\n","import type { MaybeArray, MaybeFunc } from '@hey-api/types';\nimport colors from 'ansi-colors';\n// @ts-expect-error\nimport colorSupport from 'color-support';\n\ncolors.enabled = colorSupport().hasBasic;\n\nconst DEBUG_NAMESPACE = 'heyapi';\n\nconst NO_WARNINGS = /^(1|true|yes|on)$/i.test(process.env.HEYAPI_DISABLE_WARNINGS ?? '');\n\nconst DebugGroups = {\n analyzer: colors.greenBright,\n dsl: colors.cyanBright,\n file: colors.yellowBright,\n registry: colors.blueBright,\n symbol: colors.magentaBright,\n} as const;\n\nconst WarnGroups = {\n deprecated: colors.magentaBright,\n} as const;\n\nlet cachedDebugGroups: Set<string> | undefined;\nfunction getDebugGroups(): Set<string> {\n if (cachedDebugGroups) return cachedDebugGroups;\n\n const value = process.env.DEBUG;\n cachedDebugGroups = new Set(value ? value.split(',').map((x) => x.trim().toLowerCase()) : []);\n\n return cachedDebugGroups;\n}\n\n/**\n * Tracks which deprecations have been shown to avoid spam.\n */\nconst shownDeprecations = new Set<string>();\n\nfunction debug(message: string, group: keyof typeof DebugGroups) {\n const groups = getDebugGroups();\n if (\n !(\n groups.has('*') ||\n groups.has(`${DEBUG_NAMESPACE}:*`) ||\n groups.has(`${DEBUG_NAMESPACE}:${group}`) ||\n groups.has(group)\n )\n ) {\n return;\n }\n\n const color = DebugGroups[group] ?? colors.whiteBright;\n const prefix = color(`${DEBUG_NAMESPACE}:${group}`);\n\n console.debug(`${prefix} ${message}`);\n}\n\nfunction warn(message: string, group?: keyof typeof WarnGroups) {\n if (NO_WARNINGS) return;\n\n const color = group ? WarnGroups[group] : colors.yellowBright;\n\n console.warn(color(`${message}`));\n}\n\nfunction warnDeprecated({\n context,\n field,\n replacement,\n}: {\n context?: string;\n field: string;\n replacement?: MaybeFunc<(field: string) => MaybeArray<string>>;\n}) {\n const key = context\n ? `${context}:${field}:${JSON.stringify(replacement)}`\n : `${field}:${JSON.stringify(replacement)}`;\n\n if (shownDeprecations.has(key)) return;\n shownDeprecations.add(key);\n\n let message = `\\`${field}\\` is deprecated.`;\n\n if (replacement) {\n const reps = typeof replacement === 'function' ? replacement(field) : replacement;\n const repArray = reps instanceof Array ? reps : [reps];\n const repString = repArray.map((r) => `\\`${r}\\``).join(' or ');\n message += ` Use ${repString} instead.`;\n }\n\n const prefix = context ? `[${context}] ` : '';\n warn(`${prefix}${message}`, 'deprecated');\n}\n\nexport const log = {\n debug,\n warn,\n warnDeprecated,\n};\n","import path from 'node:path';\n\nimport type { ExportModule, ImportModule } from '../bindings';\nimport { fileBrand } from '../brands';\nimport type { Language } from '../languages/types';\nimport { log } from '../log';\nimport type { INode } from '../nodes/node';\nimport type { NameScopes } from '../planner/scope';\nimport type { IProject } from '../project/types';\nimport type { Renderer } from '../renderer';\nimport type { IFileIn } from './types';\n\nexport class File<Node extends INode = INode> {\n /**\n * Exports from this file.\n */\n private _exports: Array<ExportModule> = [];\n /**\n * File extension (e.g., `.ts`).\n */\n private _extension?: string;\n /**\n * Actual emitted file path, including extension and directories.\n */\n private _finalPath?: string;\n /**\n * Imports to this file.\n */\n private _imports: Array<ImportModule> = [];\n /**\n * Language of the file.\n */\n private _language?: Language;\n /**\n * Logical, extension-free path used for planning and routing.\n */\n private _logicalFilePath: string;\n /**\n * Base name of the file (without extension).\n */\n private _name?: string;\n /**\n * Syntax nodes contained in this file.\n */\n private _nodes: Array<Node> = [];\n /**\n * Renderer assigned to this file.\n */\n private _renderer?: Renderer;\n\n /** Brand used for identifying files. */\n readonly '~brand' = fileBrand;\n /** All names defined in this file, including local scopes. */\n allNames: NameScopes = new Map();\n /** Whether this file is external to the project. */\n external: boolean;\n /** Unique identifier for the file. */\n readonly id: number;\n /** The project this file belongs to. */\n readonly project: IProject;\n /** Names declared at the top level of the file. */\n topLevelNames: NameScopes = new Map();\n\n constructor(input: IFileIn, id: number, project: IProject) {\n this.external = input.external ?? false;\n this.id = id;\n if (input.language !== undefined) this._language = input.language;\n this._logicalFilePath = input.logicalFilePath.split(path.sep).join('/');\n if (input.name !== undefined) this._name = input.name;\n this.project = project;\n }\n\n /**\n * Exports from this file.\n */\n get exports(): ReadonlyArray<ExportModule> {\n return [...this._exports];\n }\n\n /**\n * Read-only accessor for the file extension.\n */\n get extension(): string | undefined {\n if (this.external) return;\n if (this._extension) return this._extension;\n const language = this.language;\n const extension = language ? this.project.extensions[language] : undefined;\n if (extension && extension[0]) return extension[0];\n return;\n }\n\n /**\n * Read-only accessor for the final emitted path.\n *\n * If undefined, the file has not yet been assigned a final path\n * or is external to the project and should not be emitted.\n */\n get finalPath(): string | undefined {\n if (this._finalPath) return this._finalPath;\n const dirs = this._logicalFilePath ? this._logicalFilePath.split('/').slice(0, -1) : [];\n return [...dirs, `${this.name}${this.extension ?? ''}`].join('/');\n }\n\n /**\n * Imports to this file.\n */\n get imports(): ReadonlyArray<ImportModule> {\n return [...this._imports];\n }\n\n /**\n * Language of the file; inferred from nodes or fallback if not set explicitly.\n */\n get language(): Language | undefined {\n if (this._language) return this._language;\n if (this._nodes[0]) return this._nodes[0].language;\n return;\n }\n\n /**\n * Logical, extension-free path used for planning and routing.\n */\n get logicalFilePath(): string {\n return this._logicalFilePath;\n }\n\n /**\n * Base name of the file (without extension).\n *\n * If no name was set explicitly, it is inferred from the logical file path.\n */\n get name(): string {\n if (this._name) return this._name;\n const name = this._logicalFilePath.split('/').pop();\n if (name) return name;\n const message = `File ${this.toString()} has no name`;\n log.debug(message, 'file');\n throw new Error(message);\n }\n\n /**\n * Syntax nodes contained in this file.\n */\n get nodes(): ReadonlyArray<Node> {\n return [...this._nodes];\n }\n\n /**\n * Renderer assigned to this file.\n */\n get renderer(): Renderer | undefined {\n return this._renderer;\n }\n\n /**\n * Add an export group to the file.\n */\n addExport(group: ExportModule): void {\n this._exports.push(group);\n }\n\n /**\n * Add an import group to the file.\n */\n addImport(group: ImportModule): void {\n this._imports.push(group);\n }\n\n /**\n * Add a syntax node to the file.\n */\n addNode(node: Node): void {\n this._nodes.push(node);\n node.file = this;\n }\n\n /**\n * Sets the file extension.\n */\n setExtension(extension: string): void {\n this._extension = extension;\n }\n\n /**\n * Sets the final emitted path of the file.\n */\n setFinalPath(path: string): void {\n this._finalPath = path;\n }\n\n /**\n * Sets the language of the file.\n */\n setLanguage(lang: Language): void {\n this._language = lang;\n }\n\n /**\n * Sets the name of the file.\n */\n setName(name: string): void {\n this._name = name;\n }\n\n /**\n * Sets the renderer assigned to this file.\n */\n setRenderer(renderer: Renderer): void {\n this._renderer = renderer;\n }\n\n /**\n * Returns a debug‑friendly string representation identifying the file.\n */\n toString(): string {\n return `[File ${this._logicalFilePath}#${this.id}]`;\n }\n}\n","import { nodeBrand, symbolBrand } from './brands';\nimport type { INode } from './nodes/node';\nimport type { Ref } from './refs/types';\nimport type { Symbol } from './symbols/symbol';\n\nexport function isBrand(value: unknown, brand: string): value is INode {\n if (!value || typeof value !== 'object') return false;\n return (value as any)['~brand'] === brand;\n}\n\nexport function isNode(value: unknown): value is INode {\n if (!value || typeof value !== 'object') return false;\n return isBrand(value, nodeBrand);\n}\n\nexport function isNodeRef(value: Ref<unknown>): value is Ref<INode> {\n return isBrand(value['~ref'], nodeBrand);\n}\n\nexport function isSymbol(value: unknown): value is Symbol {\n return isBrand(value, symbolBrand);\n}\n\nexport function isSymbolRef(value: Ref<unknown>): value is Ref<Symbol> {\n return isBrand(value['~ref'], symbolBrand);\n}\n","import type { Extensions } from './types';\n\nexport const defaultExtensions: Extensions = {\n c: ['.c'],\n 'c#': ['.cs'],\n 'c++': ['.cpp', '.hpp'],\n css: ['.css'],\n dart: ['.dart'],\n go: ['.go'],\n haskell: ['.hs'],\n html: ['.html'],\n java: ['.java'],\n javascript: ['.js', '.jsx'],\n json: ['.json'],\n kotlin: ['.kt'],\n lua: ['.lua'],\n markdown: ['.md'],\n matlab: ['.m'],\n perl: ['.pl'],\n php: ['.php'],\n python: ['.py'],\n r: ['.r'],\n ruby: ['.rb'],\n rust: ['.rs'],\n scala: ['.scala'],\n shell: ['.sh'],\n sql: ['.sql'],\n swift: ['.swift'],\n typescript: ['.ts', '.tsx'],\n yaml: ['.yaml', '.yml'],\n};\n","import type { ModuleEntryNames } from './types';\n\nexport const defaultModuleEntryNames: ModuleEntryNames = {\n javascript: 'index',\n python: '__init__',\n typescript: 'index',\n};\n","import type { NameConflictResolver } from './types';\n\nexport const simpleNameConflictResolver: NameConflictResolver = ({ attempt, baseName }) =>\n attempt === 0 ? baseName : `${baseName}${attempt + 1}`;\n\nexport const underscoreNameConflictResolver: NameConflictResolver = ({ attempt, baseName }) =>\n attempt === 0 ? baseName : `${baseName}_${attempt + 1}`;\n","import { underscoreNameConflictResolver } from '../planner/resolvers';\nimport type { NameConflictResolvers } from './types';\n\nexport const defaultNameConflictResolvers: NameConflictResolvers = {\n php: underscoreNameConflictResolver,\n python: underscoreNameConflictResolver,\n ruby: underscoreNameConflictResolver,\n};\n","import colors from 'ansi-colors';\n\ninterface LoggerEvent {\n end?: PerformanceMark;\n events: Array<LoggerEvent>;\n id: string; // unique internal key\n name: string;\n start: PerformanceMark;\n}\n\ninterface Severity {\n color: colors.StyleFunction;\n type: 'duration' | 'percentage';\n}\n\ninterface StoredEventResult {\n position: ReadonlyArray<number>;\n}\n\nlet loggerCounter = 0;\nconst nameToId = (name: string) => `${name}-${loggerCounter++}`;\nconst idEnd = (id: string) => `${id}-end`;\nconst idLength = (id: string) => `${id}-length`;\nconst idStart = (id: string) => `${id}-start`;\n\nconst getSeverity = (duration: number, percentage: number): Severity | undefined => {\n if (duration > 200) {\n return {\n color: colors.red,\n type: 'duration',\n };\n }\n if (percentage > 30) {\n return {\n color: colors.red,\n type: 'percentage',\n };\n }\n if (duration > 50) {\n return {\n color: colors.yellow,\n type: 'duration',\n };\n }\n if (percentage > 10) {\n return {\n color: colors.yellow,\n type: 'percentage',\n };\n }\n return;\n};\n\nexport class Logger {\n private events: Array<LoggerEvent> = [];\n\n private end(result: StoredEventResult): void {\n let event: LoggerEvent | undefined;\n let events = this.events;\n for (const index of result.position) {\n event = events[index];\n if (event?.events) {\n events = event.events;\n }\n }\n if (event && !event.end) {\n event.end = performance.mark(idEnd(event.id));\n }\n }\n\n /**\n * Recursively end all unended events in the event tree.\n * This ensures all events have end marks before measuring.\n */\n private endAllEvents(events: Array<LoggerEvent>): void {\n for (const event of events) {\n if (!event.end) {\n event.end = performance.mark(idEnd(event.id));\n }\n if (event.events.length) {\n this.endAllEvents(event.events);\n }\n }\n }\n\n report(print: boolean = true): PerformanceMeasure | undefined {\n const firstEvent = this.events[0];\n if (!firstEvent) return;\n\n // Ensure all events are ended before reporting\n this.endAllEvents(this.events);\n\n const lastEvent = this.events[this.events.length - 1]!;\n const name = 'root';\n const id = nameToId(name);\n\n try {\n const measure = performance.measure(\n idLength(id),\n idStart(firstEvent.id),\n idEnd(lastEvent.id),\n );\n if (print) {\n this.reportEvent({\n end: lastEvent.end,\n events: this.events,\n id,\n indent: 0,\n measure,\n name,\n start: firstEvent!.start,\n });\n }\n return measure;\n } catch {\n // If measuring fails (e.g., marks don't exist), silently skip reporting\n // to avoid crashing the application\n return;\n }\n }\n\n private reportEvent({\n indent,\n ...parent\n }: LoggerEvent & {\n indent: number;\n measure: PerformanceMeasure;\n }): void {\n const color = !indent ? colors.cyan : colors.gray;\n const lastIndex = parent.events.length - 1;\n\n parent.events.forEach((event, index) => {\n try {\n const measure = performance.measure(idLength(event.id), idStart(event.id), idEnd(event.id));\n const duration = Math.ceil(measure.duration * 100) / 100;\n const percentage =\n Math.ceil((measure.duration / parent.measure.duration) * 100 * 100) / 100;\n const severity = indent ? getSeverity(duration, percentage) : undefined;\n\n let durationLabel = `${duration.toFixed(2).padStart(8)}ms`;\n if (severity?.type === 'duration') {\n durationLabel = severity.color(durationLabel);\n }\n\n const branch = index === lastIndex ? '└─ ' : '├─ ';\n const prefix = !indent ? '' : '│ '.repeat(indent - 1) + branch;\n const maxLength = 38 - prefix.length;\n\n const percentageBranch = !indent ? '' : '↳ ';\n const percentagePrefix = indent ? ' '.repeat(indent - 1) + percentageBranch : '';\n let percentageLabel = `${percentagePrefix}${percentage.toFixed(2)}%`;\n if (severity?.type === 'percentage') {\n percentageLabel = severity.color(percentageLabel);\n }\n const jobPrefix = colors.gray('[root] ');\n console.log(\n `${jobPrefix}${colors.gray(prefix)}${color(\n `${event.name.padEnd(maxLength)} ${durationLabel} (${percentageLabel})`,\n )}`,\n );\n this.reportEvent({ ...event, indent: indent + 1, measure });\n } catch {\n // If measuring fails (e.g., marks don't exist), silently skip this event\n // to avoid crashing the application\n }\n });\n }\n\n private start(id: string): PerformanceMark {\n return performance.mark(idStart(id));\n }\n\n private storeEvent({\n result,\n ...event\n }: Pick<LoggerEvent, 'events' | 'id' | 'name' | 'start'> & {\n result: StoredEventResult;\n }): void {\n const lastEventIndex = event.events.length - 1;\n const lastEvent = event.events[lastEventIndex];\n if (lastEvent && !lastEvent.end) {\n result.position = [...result.position, lastEventIndex];\n this.storeEvent({ ...event, events: lastEvent.events, result });\n return;\n }\n const length = event.events.push({ ...event, events: [] });\n result.position = [...result.position, length - 1];\n }\n\n timeEvent(name: string) {\n const id = nameToId(name);\n const start = this.start(id);\n const event: LoggerEvent = {\n events: this.events,\n id,\n name,\n start,\n };\n const result: StoredEventResult = {\n position: [],\n };\n this.storeEvent({ ...event, result });\n return {\n mark: start,\n timeEnd: () => this.end(result),\n };\n }\n}\n","import path from 'node:path';\n\nimport type { IProject } from '../project/types';\nimport { File } from './file';\nimport type { FileKeyArgs, IFileIn, IFileRegistry } from './types';\n\ntype FileId = number;\ntype FileKey = string;\n\nexport class FileRegistry implements IFileRegistry {\n private _id: FileId = 0;\n private _values: Map<FileKey, File> = new Map();\n private readonly project: IProject;\n\n constructor(project: IProject) {\n this.project = project;\n }\n\n get(args: FileKeyArgs): File | undefined {\n return this._values.get(this.createFileKey(args));\n }\n\n isRegistered(args: FileKeyArgs): boolean {\n return this._values.has(this.createFileKey(args));\n }\n\n get nextId(): FileId {\n return this._id++;\n }\n\n register(file: IFileIn): File {\n const key = this.createFileKey(file);\n\n let result = this._values.get(key);\n if (result) {\n if (file.name) {\n result.setName(file.name);\n }\n } else {\n result = new File(file, this.nextId, this.project);\n }\n\n this._values.set(key, result);\n\n return result;\n }\n\n *registered(): IterableIterator<File> {\n for (const file of this._values.values()) {\n yield file;\n }\n }\n\n private createFileKey(args: FileKeyArgs): string {\n const logicalPath = args.logicalFilePath.split(path.sep).join('/');\n return `${args.external ? 'ext:' : ''}${logicalPath}${args.language ? `:${args.language}` : ''}`;\n }\n}\n","import type { FromRef, FromRefs, Ref, Refs } from './types';\n\n/**\n * Wraps a single value in a Ref object.\n *\n * If the value is already a Ref, returns it as-is (idempotent).\n *\n * @example\n * ```ts\n * const r = ref(123); // { '~ref': 123 }\n * console.log(r['~ref']); // 123\n *\n * const r2 = ref(r); // { '~ref': 123 } (not double-wrapped)\n * ```\n */\nexport const ref = <T>(value: T): Ref<T> => {\n if (isRef(value)) {\n return value as Ref<T>;\n }\n return { '~ref': value } as Ref<T>;\n};\n\n/**\n * Converts a plain object to an object of Refs (deep, per property).\n *\n * @example\n * ```ts\n * const obj = { a: 1, b: \"x\" };\n * const refs = refs(obj); // { a: { '~ref': 1 }, b: { '~ref': \"x\" } }\n * ```\n */\nexport const refs = <T extends Record<string, unknown>>(obj: T): Refs<T> => {\n const result = {} as Refs<T>;\n for (const key in obj) {\n if (Object.prototype.hasOwnProperty.call(obj, key)) {\n result[key] = ref(obj[key]);\n }\n }\n return result;\n};\n\n/**\n * Unwraps a single Ref object to its value.\n *\n * @example\n * ```ts\n * const r = { '~ref': 42 };\n * const n = fromRef(r); // 42\n * console.log(n); // 42\n * ```\n */\nexport const fromRef = <T extends Ref<unknown> | undefined>(ref: T): FromRef<T> =>\n ref?.['~ref'] as FromRef<T>;\n\n/**\n * Converts an object of Refs back to a plain object (unwraps all refs).\n *\n * @example\n * ```ts\n * const refs = { a: { '~ref': 1 }, b: { '~ref': \"x\" } };\n * const plain = fromRefs(refs); // { a: 1, b: \"x\" }\n * ```\n */\nexport const fromRefs = <T extends Refs<Record<string, unknown>>>(obj: T): FromRefs<T> => {\n const result = {} as FromRefs<T>;\n for (const key in obj) {\n if (Object.prototype.hasOwnProperty.call(obj, key)) {\n result[key] = fromRef(obj[key]!) as (typeof result)[typeof key];\n }\n }\n return result;\n};\n\n/**\n * Checks whether a value is a Ref object.\n *\n * @param value Value to check\n * @returns True if the value is a Ref object.\n */\nexport const isRef = <T>(value: unknown): value is Ref<T> =>\n typeof value === 'object' && value !== null && '~ref' in value;\n","import { fromRef, ref } from '../refs/refs';\nimport type { Ref } from '../refs/types';\nimport type { INode } from './node';\nimport type { INodeRegistry } from './types';\n\nexport class NodeRegistry implements INodeRegistry {\n private list: Array<Ref<INode | null>> = [];\n\n add(node: INode | null): number {\n const index = this.list.push(ref(node));\n return index - 1;\n }\n\n *all(): Iterable<INode> {\n for (const r of this.list) {\n const node = fromRef(r);\n if (node) yield node;\n }\n }\n\n remove(index: number): void {\n this.list[index] = ref(null);\n }\n\n update(index: number, node: INode | null): void {\n this.list[index] = ref(node);\n }\n}\n","import type { Language } from '../languages/types';\nimport type { SymbolKind } from '../symbols/types';\n\nconst typescriptMergeKindRank: Record<SymbolKind, number> = {\n class: 3,\n enum: 4,\n function: 5,\n interface: 1,\n namespace: 0,\n type: 2,\n var: 6,\n};\n\n/**\n * Returns true if two declarations of given kinds\n * are allowed to share the same identifier in TypeScript.\n */\nfunction canTypeScriptDeclarationsShareIdentifier(a: SymbolKind, b: SymbolKind): boolean {\n // sort based on TypeScript merge precedence so `a` is always the weaker merge candidate\n // ensures that asymmetric merges like `type + var` are correctly handled\n if (typescriptMergeKindRank[a] > typescriptMergeKindRank[b]) {\n [a, b] = [b, a];\n }\n\n switch (a) {\n case 'interface':\n return b === 'class' || b === 'interface';\n case 'namespace':\n return b === 'class' || b === 'enum' || b === 'function' || b === 'namespace';\n case 'type':\n // type can only merge with value-only declarations\n return b === 'function' || b === 'var';\n default:\n return false;\n }\n}\n\nexport function canDeclarationsShareIdentifier(\n language: Language | undefined,\n a: SymbolKind,\n b: SymbolKind,\n): boolean {\n if (language === 'typescript') {\n return canTypeScriptDeclarationsShareIdentifier(a, b);\n }\n\n return false;\n}\n","import type { Ref } from '../refs/types';\nimport type { Symbol } from '../symbols/symbol';\nimport type { SymbolKind } from '../symbols/types';\n\nexport type NameScopes = Map<string, Set<SymbolKind>>;\n\nexport type Scope = {\n /** Child scopes. */\n children: Array<Scope>;\n /** Resolved names in this scope. */\n localNames: NameScopes;\n /** Parent scope, if any. */\n parent?: Scope;\n /** Symbols registered in this scope. */\n symbols: Array<Ref<Symbol>>;\n};\n\nexport type AssignOptions = {\n /** The primary scope in which to assign a symbol's final name. */\n scope: Scope;\n /** Additional scopes to update as side effects when assigning a symbol's final name. */\n scopesToUpdate: ReadonlyArray<Scope>;\n};\n\nexport const createScope = (\n args: {\n localNames?: NameScopes;\n parent?: Scope;\n } = {},\n): Scope => ({\n children: [],\n localNames: args.localNames || new Map(),\n parent: args.parent,\n symbols: [],\n});\n","import { isNodeRef, isSymbolRef } from '../guards';\nimport type { INode, NodeRelationship } from '../nodes/node';\nimport { fromRef, isRef, ref } from '../refs/refs';\nimport type { Ref } from '../refs/types';\nimport type { Symbol } from '../symbols/symbol';\nimport type { NameScopes, Scope } from './scope';\nimport { createScope } from './scope';\nimport type { IAnalysisContext, Input } from './types';\n\nexport class AnalysisContext implements IAnalysisContext {\n /**\n * Stack of parent nodes during analysis.\n *\n * The top of the stack is the current semantic container.\n */\n private _parentStack: Array<INode> = [];\n\n scope: Scope;\n scopes: Scope = createScope();\n symbol?: Symbol;\n\n constructor(node: INode) {\n this._parentStack.push(node);\n this.scope = this.scopes;\n this.symbol = node.symbol;\n }\n\n /**\n * Get the current semantic parent (top of stack).\n */\n get currentParent(): INode | undefined {\n return this._parentStack[this._parentStack.length - 1];\n }\n\n /**\n * Register a child node under the current parent.\n */\n addChild(child: INode, relationship: NodeRelationship = 'container'): void {\n const parent = this.currentParent;\n if (!parent) return;\n\n if (!parent.structuralChildren) {\n parent.structuralChildren = new Map();\n }\n parent.structuralChildren.set(child, relationship);\n\n if (!child.structuralParents) {\n child.structuralParents = new Map();\n }\n child.structuralParents.set(parent, relationship);\n }\n\n addDependency(symbol: Ref<Symbol>): void {\n if (this.symbol !== fromRef(symbol)) {\n this.scope.symbols.push(symbol);\n }\n }\n\n analyze(input: Input): void {\n const value = isRef(input) ? input : ref(input);\n if (isSymbolRef(value)) {\n const symbol = fromRef(value);\n // avoid adding self as child\n if (symbol.node && this.currentParent !== symbol.node) {\n this.addChild(symbol.node, 'reference');\n }\n this.addDependency(value);\n } else if (isNodeRef(value)) {\n const node = fromRef(value);\n this.addChild(node, 'container');\n this.pushParent(node);\n node.analyze(this);\n this.popParent();\n }\n }\n\n localNames(scope: Scope): NameScopes {\n const names: NameScopes = new Map();\n for (const [name, kinds] of scope.localNames) {\n names.set(name, new Set(kinds));\n }\n if (scope.parent) {\n const parentNames = this.localNames(scope.parent);\n for (const [name, kinds] of parentNames) {\n if (!names.has(name)) {\n names.set(name, kinds);\n } else {\n const existingKinds = names.get(name)!;\n for (const kind of kinds) {\n existingKinds.add(kind);\n }\n }\n }\n }\n return names;\n }\n\n /**\n * Pop the current semantic parent.\n * Call this when exiting a container node.\n */\n popParent(): void {\n this._parentStack.pop();\n }\n\n popScope(): void {\n this.scope = this.scope.parent ?? this.scope;\n }\n\n /**\n * Push a node as the current semantic parent.\n */\n pushParent(node: INode): void {\n this._parentStack.push(node);\n }\n\n pushScope(): void {\n const scope = createScope({ parent: this.scope });\n this.scope.children.push(scope);\n this.scope = scope;\n }\n\n walkScopes(\n callback: (symbol: Ref<Symbol>, scope: Scope) => void,\n scope: Scope = this.scopes,\n ): void {\n this.scope = scope;\n for (const symbol of scope.symbols) {\n callback(symbol, scope);\n }\n for (const child of scope.children) {\n scope = child;\n this.walkScopes(callback, scope);\n }\n this.scope = this.scopes;\n }\n}\n\nexport class Analyzer {\n private nodeCache = new WeakMap<INode, AnalysisContext>();\n\n analyzeNode(node: INode): AnalysisContext {\n const cached = this.nodeCache.get(node);\n if (cached) return cached;\n\n node.root = true;\n const ctx = new AnalysisContext(node);\n node.analyze(ctx);\n\n this.nodeCache.set(node, ctx);\n return ctx;\n }\n\n analyze(nodes: Iterable<INode>, callback?: (ctx: AnalysisContext, node: INode) => void): void {\n for (const node of nodes) {\n const ctx = this.analyzeNode(node);\n callback?.(ctx, node);\n }\n }\n}\n","import path from 'node:path';\n\nimport type { ExportModule, ImportModule } from '../bindings';\nimport type { IProjectRenderMeta } from '../extensions';\nimport type { File } from '../files/file';\nimport type { INode } from '../nodes/node';\nimport { canDeclarationsShareIdentifier } from '../project/namespace';\nimport type { IProject } from '../project/types';\nimport { fromRef } from '../refs/refs';\nimport type { RenderContext } from '../renderer';\nimport type { Symbol } from '../symbols/symbol';\nimport type { SymbolKind } from '../symbols/types';\nimport type { AnalysisContext } from './analyzer';\nimport { Analyzer } from './analyzer';\nimport type { AssignOptions, Scope } from './scope';\nimport { createScope } from './scope';\n\nconst isTypeOnlyKind = (kind: SymbolKind) => kind === 'type' || kind === 'interface';\n\nexport class Planner {\n private readonly analyzer = new Analyzer();\n private readonly cacheResolvedNames = new Set<number>();\n private readonly project: IProject;\n\n constructor(project: IProject) {\n this.project = project;\n }\n\n /**\n * Executes the planning phase for the project.\n */\n plan(meta?: IProjectRenderMeta) {\n this.cacheResolvedNames.clear();\n this.allocateFiles();\n this.assignLocalNames();\n this.resolveFilePaths(meta);\n this.planExports();\n this.planImports();\n }\n\n /**\n * Creates and assigns a file to every node, re-export,\n * and external dependency.\n */\n private allocateFiles(): void {\n this.analyzer.analyze(this.project.nodes.all(), (ctx, node) => {\n const symbol = node.symbol;\n if (!symbol) return;\n\n const file = this.project.files.register({\n external: false,\n language: node.language,\n logicalFilePath: symbol.getFilePath?.(symbol) || this.project.defaultFileName,\n });\n file.addNode(node);\n symbol.setFile(file);\n for (const logicalFilePath of symbol.getExportFromFilePath?.(symbol) ?? []) {\n this.project.files.register({\n external: false,\n language: file.language,\n logicalFilePath,\n });\n }\n ctx.walkScopes((dependency) => {\n const dep = fromRef(dependency);\n if (dep.external && dep.isCanonical && !dep.file) {\n const file = this.project.files.register({\n external: true,\n language: dep.node?.language,\n logicalFilePath: dep.external,\n });\n dep.setFile(file);\n }\n });\n });\n }\n\n /**\n * Assigns final names to all symbols.\n *\n * First assigns top-level (file-scoped) symbol names, then local symbols.\n */\n private assignLocalNames(): void {\n this.analyzer.analyze(this.project.nodes.all(), (ctx, node) => {\n const symbol = node.symbol;\n if (!symbol) return;\n this.assignTopLevelName({ ctx, node, symbol });\n });\n\n this.analyzer.analyze(this.project.nodes.all(), (ctx, node) => {\n const file = node.file;\n if (!file) return;\n ctx.walkScopes((dependency) => {\n const dep = fromRef(dependency);\n // top-level or external symbol\n if (dep.file) return;\n // TODO: pass node\n this.assignLocalName({\n ctx,\n file,\n scopesToUpdate: [createScope({ localNames: file.allNames })],\n symbol: dep,\n });\n });\n });\n }\n\n /**\n * Resolves and sets final file paths for all non-external files. Attaches renderers.\n *\n * Uses the project's fileName function if provided, otherwise uses the file's current name.\n *\n * Resolves final paths relative to the project's root directory.\n */\n private resolveFilePaths(meta?: IProjectRenderMeta): void {\n for (const file of this.project.files.registered()) {\n if (file.external) {\n file.setFinalPath(file.logicalFilePath);\n continue;\n }\n const finalName = this.project.fileName?.(file.name) || file.name;\n file.setName(finalName);\n const finalPath = file.finalPath;\n if (finalPath) {\n file.setFinalPath(path.resolve(this.project.root, finalPath));\n }\n const ctx: RenderContext = { file, meta, project: this.project };\n const renderer = this.project.renderers.find((r) => r.supports(ctx));\n if (renderer) file.setRenderer(renderer);\n }\n }\n\n /**\n * Plans exports by analyzing all exported symbols.\n *\n * Registers re-export targets as files and creates new exported symbols for them.\n *\n * Assigns names to re-exported symbols and collects re-export metadata,\n * distinguishing type-only exports based on symbol kinds.\n */\n private planExports(): void {\n const seenByFile = new Map<File, Map<string, { kinds: Set<SymbolKind>; symbol: Symbol }>>();\n const sourceFile = new Map<number, File>();\n\n this.analyzer.analyze(this.project.nodes.all(), (ctx, node) => {\n if (!node.exported) return;\n\n const symbol = node.symbol;\n if (!symbol) return;\n\n const file = node.file;\n if (!file) return;\n\n for (const logicalFilePath of symbol.getExportFromFilePath?.(symbol) ?? []) {\n const target = this.project.files.register({\n external: false,\n language: node.language,\n logicalFilePath,\n });\n if (target.id === file.id) continue;\n\n let fileMap = seenByFile.get(target);\n if (!fileMap) {\n fileMap = new Map();\n seenByFile.set(target, fileMap);\n }\n\n const exp = this.project.symbols.register({\n exported: true,\n external: symbol.external,\n importKind: symbol.importKind,\n kind: symbol.kind,\n name: symbol.finalName,\n });\n exp.setFile(target);\n sourceFile.set(exp.id, file);\n // TODO: pass node\n this.assignTopLevelName({ ctx, symbol: exp });\n\n let entry = fileMap.get(exp.finalName);\n if (!entry) {\n entry = { kinds: new Set(), symbol: exp };\n fileMap.set(exp.finalName, entry);\n }\n entry.kinds.add(exp.kind);\n }\n });\n\n for (const [file, fileMap] of seenByFile) {\n const exports = new Map<File, ExportModule>();\n for (const [, entry] of fileMap) {\n const source = sourceFile.get(entry.symbol.id)!;\n let exp = exports.get(source);\n if (!exp) {\n exp = {\n canExportAll: true,\n exports: [],\n from: source,\n isTypeOnly: true,\n };\n }\n const isTypeOnly = [...entry.kinds].every((kind) => isTypeOnlyKind(kind));\n const exportedName = entry.symbol.finalName;\n exp.exports.push({\n exportedName,\n isTypeOnly,\n kind: entry.symbol.importKind,\n sourceName: entry.symbol.name,\n });\n if (entry.symbol.name !== entry.symbol.finalName) {\n exp.canExportAll = false;\n }\n if (!isTypeOnly) {\n exp.isTypeOnly = false;\n }\n exports.set(source, exp);\n }\n for (const [, exp] of exports) {\n file.addExport(exp);\n }\n }\n }\n\n /**\n * Plans imports by analyzing symbol dependencies across files.\n *\n * For external dependencies, assigns top-level names.\n *\n * Creates or reuses import symbols for dependencies from other files,\n * assigning names and updating import metadata including type-only flags.\n */\n private planImports(): void {\n const seenByFile = new Map<\n File,\n Map<\n string,\n {\n dep: Symbol;\n kinds: Set<SymbolKind>;\n symbol: Symbol;\n }\n >\n >();\n\n this.analyzer.analyze(this.project.nodes.all(), (ctx) => {\n const symbol = ctx.symbol;\n if (!symbol) return;\n\n const file = symbol.file;\n if (!file) return;\n\n let fileMap = seenByFile.get(file);\n if (!fileMap) {\n fileMap = new Map();\n seenByFile.set(file, fileMap);\n }\n\n ctx.walkScopes((dependency) => {\n const dep = fromRef(dependency);\n if (!dep.file || dep.file.id === file.id) return;\n\n if (dep.external) {\n // TODO: pass node\n this.assignTopLevelName({ ctx, symbol: dep });\n }\n\n const fromFileId = dep.file.id;\n const importedName = dep.finalName;\n const kind = dep.importKind;\n const key = `${fromFileId}|${importedName}|${kind}`;\n\n let entry = fileMap.get(key);\n if (!entry) {\n const imp = this.project.symbols.register({\n exported: dep.exported,\n external: dep.external,\n importKind: dep.importKind,\n kind: dep.kind,\n name: dep.finalName,\n });\n imp.setFile(file);\n // TODO: pass node\n this.assignTopLevelName({\n ctx,\n scope: createScope({ localNames: imp.file!.allNames }),\n symbol: imp,\n });\n entry = {\n dep,\n kinds: new Set(),\n symbol: imp,\n };\n fileMap.set(key, entry);\n }\n entry.kinds.add(dep.kind);\n\n dependency['~ref'] = entry.symbol;\n });\n });\n\n for (const [file, fileMap] of seenByFile) {\n const imports = new Map<File, ImportModule>();\n for (const [, entry] of fileMap) {\n const source = entry.dep.file!;\n let imp = imports.get(source);\n if (!imp) {\n imp = {\n from: source,\n imports: [],\n isTypeOnly: true,\n kind: 'named',\n };\n }\n const isTypeOnly = [...entry.kinds].every((kind) => isTypeOnlyKind(kind));\n if (entry.symbol.importKind === 'namespace') {\n imp.imports = [];\n imp.kind = 'namespace';\n imp.localName = entry.symbol.finalName;\n } else if (entry.symbol.importKind === 'default') {\n imp.kind = 'default';\n imp.localName = entry.symbol.finalName;\n } else {\n imp.imports.push({\n isTypeOnly,\n localName: entry.symbol.finalName,\n sourceName: entry.dep.finalName,\n });\n }\n if (!isTypeOnly) {\n imp.isTypeOnly = false;\n }\n imports.set(source, imp);\n }\n for (const [, imp] of imports) {\n file.addImport(imp);\n }\n }\n }\n\n /**\n * Assigns the final name to a top-level (file-scoped) symbol.\n *\n * Uses the symbol's file top-level names as the default scope,\n * and updates all relevant name scopes including the file's allNames and local scopes.\n *\n * Supports optional overrides for the naming scope and scopes to update.\n */\n private assignTopLevelName(\n args: Partial<AssignOptions> & {\n ctx: AnalysisContext;\n debug?: boolean;\n node?: INode;\n symbol: Symbol;\n },\n ): void {\n if (!args.symbol.file) return;\n this.assignSymbolName({\n ...args,\n file: args.symbol.file,\n scope: args?.scope ?? createScope({ localNames: args.symbol.file.topLevelNames }),\n scopesToUpdate: [\n createScope({ localNames: args.symbol.file.allNames }),\n args.ctx.scopes,\n ...(args?.scopesToUpdate ?? []),\n ],\n });\n }\n\n /**\n * Assigns the final name to a non-top-level (local) symbol.\n *\n * Uses the provided scope or derives it from the current analysis context's local names.\n *\n * Updates all provided name scopes accordingly.\n */\n private assignLocalName(\n args: Pick<Partial<AssignOptions>, 'scope'> &\n Pick<AssignOptions, 'scopesToUpdate'> & {\n ctx: AnalysisContext;\n debug?: boolean;\n /** The file the symbol belongs to. */\n file: File;\n node?: INode;\n symbol: Symbol;\n },\n ): void {\n this.assignSymbolName({\n ...args,\n scope: args.scope ?? args.ctx.scope,\n });\n }\n\n /**\n * Assigns the final name to a symbol within the provided name scope.\n *\n * Resolves name conflicts until a unique name is found.\n *\n * Updates all specified name scopes with the assigned final name.\n */\n private assignSymbolName(\n args: AssignOptions & {\n ctx: AnalysisContext;\n debug?: boolean;\n /** The file the symbol belongs to. */\n file: File;\n node?: INode;\n symbol: Symbol;\n },\n ): void {\n const { file, node, scope, scopesToUpdate, symbol } = args;\n if (this.cacheResolvedNames.has(symbol.id)) return;\n\n const baseName = symbol.name;\n let finalName =\n node?.nameSanitizer?.(baseName) ?? symbol.node?.nameSanitizer?.(baseName) ?? baseName;\n let attempt = 1;\n\n while (true) {\n const language = node?.language || symbol.node?.language || file.language;\n\n const ok = this.nameIsAvailable({ kind: symbol.kind, language, name: finalName, scope });\n if (ok) break;\n\n const resolver =\n (language ? this.project.nameConflictResolvers[language] : undefined) ??\n this.project.defaultNameConflictResolver;\n const resolvedName = resolver({ attempt, baseName });\n if (!resolvedName) {\n throw new Error(`Unresolvable name conflict: ${symbol.toString()}`);\n }\n\n finalName =\n node?.nameSanitizer?.(resolvedName) ??\n symbol.node?.nameSanitizer?.(resolvedName) ??\n resolvedName;\n attempt = attempt + 1;\n }\n\n symbol.setFinalName(finalName);\n this.cacheResolvedNames.add(symbol.id);\n const updateScopes = [scope, ...scopesToUpdate];\n for (const scope of updateScopes) {\n this.updateScope(symbol, scope);\n }\n }\n\n /**\n * Checks whether `name` can be used for a new symbol of `kind` in `scope`.\n *\n * Walks up the scope chain and verifies that every existing declaration with\n * that name is compatible (i.e., can share the same identifier) with `kind`.\n * This avoids copying the entire accumulated name map on every call.\n */\n private nameIsAvailable({\n kind,\n language,\n name,\n scope,\n }: {\n kind: SymbolKind;\n language: string | undefined;\n name: string;\n scope: Scope;\n }): boolean {\n let current: Scope | undefined = scope;\n while (current) {\n const kinds = current.localNames.get(name);\n if (kinds) {\n for (const existingKind of kinds) {\n if (!canDeclarationsShareIdentifier(language, kind, existingKind)) {\n return false;\n }\n }\n }\n current = current.parent;\n }\n return true;\n }\n\n /**\n * Updates the provided name scope with the symbol's final name and kind.\n *\n * Ensures the name scope tracks all kinds associated with a given name.\n */\n private updateScope(symbol: Symbol, scope: Scope): void {\n const name = symbol.finalName;\n const cache = scope.localNames.get(name) ?? new Set();\n cache.add(symbol.kind);\n scope.localNames.set(name, cache);\n }\n}\n","import { symbolBrand } from '../brands';\nimport type { ISymbolMeta } from '../extensions';\nimport type { File } from '../files/file';\nimport { log } from '../log';\nimport type { INode } from '../nodes/node';\nimport type { BindingKind, ISymbolIn, SymbolKind } from './types';\n\nexport class Symbol<Node extends INode = INode> {\n /**\n * Canonical symbol this stub resolves to, if any.\n *\n * Stubs created during DSL construction may later be associated\n * with a fully registered symbol. Once set, all property lookups\n * should defer to the canonical symbol.\n */\n private _canonical?: Symbol;\n /**\n * True if this symbol is exported from its defining file.\n *\n * @default false\n */\n private _exported: boolean;\n /**\n * External module name if this symbol is imported from a module not managed\n * by the project (e.g., \"zod\", \"lodash\").\n *\n * @default undefined\n */\n private _external?: string;\n /**\n * The file this symbol is ultimately emitted into.\n *\n * Only top-level symbols have an assigned file.\n */\n private _file?: File;\n /**\n * The alias-resolved, conflict-free emitted name.\n */\n private _finalName?: string;\n /**\n * Custom strategy to determine from which file path(s) this symbol is re-exported.\n *\n * @returns The file path(s) that re-export this symbol, or undefined if none.\n */\n private _getExportFromFilePath?: (symbol: Symbol) => ReadonlyArray<string> | undefined;\n /**\n * Custom strategy to determine file output path.\n *\n * @returns The file path to output the symbol to, or undefined to fallback to default behavior.\n */\n private _getFilePath?: (symbol: Symbol) => string | undefined;\n /**\n * How this symbol should be imported (namespace/default/named).\n *\n * @default 'named'\n */\n private _importKind: BindingKind;\n /**\n * Kind of symbol (class, type, alias, etc.).\n *\n * @default 'var'\n */\n private _kind: SymbolKind;\n /**\n * Arbitrary user metadata.\n *\n * @default undefined\n */\n private _meta?: ISymbolMeta;\n /**\n * Intended user-facing name before conflict resolution.\n *\n * @example \"UserModel\"\n */\n private _name: string;\n /**\n * Node that defines this symbol.\n */\n private _node?: Node;\n\n /** Brand used for identifying symbols. */\n readonly '~brand' = symbolBrand;\n /** Globally unique, stable symbol ID. */\n readonly id: number;\n\n constructor(input: ISymbolIn, id: number) {\n this._exported = input.exported ?? false;\n this._external = input.external;\n this._getExportFromFilePath = input.getExportFromFilePath;\n this._getFilePath = input.getFilePath;\n this.id = id;\n this._importKind = input.importKind ?? 'named';\n this._kind = input.kind ?? 'var';\n this._meta = input.meta;\n this._name = input.name;\n }\n\n /**\n * Returns the canonical symbol for this instance.\n *\n * If this symbol was created as a stub, this getter returns\n * the fully registered canonical symbol. Otherwise, it returns\n * the symbol itself.\n */\n get canonical(): Symbol {\n return this._canonical ?? this;\n }\n\n /**\n * Indicates whether this symbol is exported from its defining file.\n */\n get exported(): boolean {\n return this.canonical._exported;\n }\n\n /**\n * External module from which this symbol originates, if any.\n */\n get external(): string | undefined {\n return this.canonical._external;\n }\n\n /**\n * Read‑only accessor for the assigned output file.\n *\n * Only top-level symbols have an assigned file.\n */\n get file(): File | undefined {\n return this.canonical._file;\n }\n\n /**\n * Read‑only accessor for the resolved final emitted name.\n */\n get finalName(): string {\n if (!this.canonical._finalName) {\n const message = `Symbol finalName has not been resolved yet for ${this.canonical.toString()}`;\n log.debug(message, 'symbol');\n throw new Error(message);\n }\n return this.canonical._finalName;\n }\n\n /**\n * Custom re-export file path resolver, if provided.\n */\n get getExportFromFilePath(): ((symbol: Symbol) => ReadonlyArray<string> | undefined) | undefined {\n return this.canonical._getExportFromFilePath;\n }\n\n /**\n * Custom file path resolver, if provided.\n */\n get getFilePath(): ((symbol: Symbol) => string | undefined) | undefined {\n return this.canonical._getFilePath;\n }\n\n /**\n * How this symbol should be imported (named/default/namespace).\n */\n get importKind(): BindingKind {\n return this.canonical._importKind;\n }\n\n /**\n * Indicates whether this is a canonical symbol (not a stub).\n */\n get isCanonical(): boolean {\n return !this._canonical || this._canonical === this;\n }\n\n /**\n * The symbol's kind (class, type, alias, variable, etc.).\n */\n get kind(): SymbolKind {\n return this.canonical._kind;\n }\n\n /**\n * Arbitrary user‑provided metadata associated with this symbol.\n */\n get meta(): ISymbolMeta | undefined {\n return this.canonical._meta;\n }\n\n /**\n * User-intended name before aliasing or conflict resolution.\n */\n get name(): string {\n return this.canonical._name;\n }\n\n /**\n * Read‑only accessor for the defining node.\n */\n get node(): Node | undefined {\n return this.canonical._node as Node | undefined;\n }\n\n /**\n * Marks this symbol as a stub and assigns its canonical symbol.\n *\n * After calling this, all semantic queries (name, kind, file,\n * meta, etc.) should reflect the canonical symbol's values.\n *\n * @param symbol — The canonical symbol this stub should resolve to.\n */\n setCanonical(symbol: Symbol): void {\n this._canonical = symbol;\n }\n\n /**\n * Marks the symbol as exported from its file.\n *\n * @param exported — Whether the symbol is exported.\n */\n setExported(exported: boolean): void {\n this.assertCanonical();\n this._exported = exported;\n }\n\n /**\n * Assigns the output file this symbol will be emitted into.\n *\n * This may only be set once.\n */\n setFile(file: File): void {\n this.assertCanonical();\n if (this._file && this._file !== file) {\n const message = `Symbol ${this.canonical.toString()} is already assigned to a different file.`;\n log.debug(message, 'symbol');\n throw new Error(message);\n }\n this._file = file;\n }\n\n /**\n * Assigns the conflict‑resolved final local name for this symbol.\n *\n * This may only be set once.\n */\n setFinalName(name: string): void {\n this.assertCanonical();\n if (this._finalName && this._finalName !== name) {\n const message = `Symbol finalName has already been resolved for ${this.canonical.toString()}.`;\n log.debug(message, 'symbol');\n throw new Error(message);\n }\n this._finalName = name;\n }\n\n /**\n * Sets how this symbol should be imported.\n *\n * @param kind — The import strategy (named/default/namespace).\n */\n setImportKind(kind: BindingKind): void {\n this.assertCanonical();\n this._importKind = kind;\n }\n\n /**\n * Sets the symbol's kind (class, type, alias, variable, etc.).\n *\n * @param kind — The new symbol kind.\n */\n setKind(kind: SymbolKind): void {\n this.assertCanonical();\n this._kind = kind;\n }\n\n /**\n * Updates the intended user‑facing name for this symbol.\n *\n * @param name — The new name.\n */\n setName(name: string): void {\n this.assertCanonical();\n this._name = name;\n }\n\n /**\n * Binds the node that defines this symbol.\n *\n * This may only be set once.\n */\n setNode(node: Node): void {\n this.assertCanonical();\n if (this._node && this._node !== node) {\n const message = `Symbol ${this.canonical.toString()} is already bound to a different node.`;\n log.debug(message, 'symbol');\n // TODO: symbol <> node relationship needs to be refactor to 1:many\n // disabled in the meantime or it would throw\n // throw new Error(message);\n }\n this._node = node;\n node.symbol = this;\n }\n\n /**\n * Returns a debug‑friendly string representation identifying the symbol.\n */\n toString(): string {\n const canonical = this.canonical;\n if (canonical._finalName && canonical._finalName !== canonical._name) {\n return `[Symbol ${canonical._name} → ${canonical._finalName}#${canonical.id}]`;\n }\n return `[Symbol ${canonical._name || canonical._meta !== undefined ? JSON.stringify(canonical._meta) : '<unknown>'}#${canonical.id}]`;\n }\n\n /**\n * Ensures this symbol is canonical before allowing mutation.\n *\n * A symbol that has been marked as a stub (i.e., its `_canonical` points\n * to a different symbol) may not be mutated. This guard throws an error\n * if any setter attempts to modify a stub, preventing accidental writes\n * to non‑canonical instances.\n *\n * @throws {Error} If the symbol is a stub and is being mutated.\n */\n private assertCanonical(): void {\n if (this._canonical && this._canonical !== this) {\n const message = `Illegal mutation of stub symbol ${this.toString()} → canonical: ${this._canonical.toString()}`;\n log.debug(message, 'symbol');\n throw new Error(message);\n }\n }\n}\n","import type { ISymbolMeta } from '../extensions';\nimport { Symbol } from './symbol';\nimport type { ISymbolIdentifier, ISymbolIn, ISymbolRegistry } from './types';\n\ntype IndexEntry = readonly [key: string, value: unknown, serialized: string];\ntype IndexKeySpace = ReadonlyArray<IndexEntry>;\ntype QueryCacheKey = string;\ntype SymbolId = number;\n\nexport class SymbolRegistry implements ISymbolRegistry {\n /** Forward index: cache key → index key space it was registered with. */\n private _cacheDependencies: Map<QueryCacheKey, IndexKeySpace> = new Map();\n /** Reverse index: serialized index entry → set of cache keys that depend on it. */\n private _dependencyToCache: Map<string, Set<QueryCacheKey>> = new Map();\n private _id: SymbolId = 0;\n private _indices: Map<IndexEntry[0], Map<IndexEntry[1], Set<SymbolId>>> = new Map();\n private _queryCache: Map<QueryCacheKey, ReadonlyArray<Symbol>> = new Map();\n private _registered: Set<SymbolId> = new Set();\n private _stubs: Set<SymbolId> = new Set();\n private _stubCache: Map<QueryCacheKey, SymbolId> = new Map();\n private _values: Map<SymbolId, Symbol> = new Map();\n\n get(identifier: ISymbolIdentifier): Symbol | undefined {\n return typeof identifier === 'number'\n ? this._values.get(identifier)\n : this.query(identifier)[0];\n }\n\n isRegistered(identifier: ISymbolIdentifier): boolean {\n const symbol = this.get(identifier);\n return symbol ? this._registered.has(symbol.id) : false;\n }\n\n get nextId(): SymbolId {\n return this._id++;\n }\n\n query(filter: ISymbolMeta): ReadonlyArray<Symbol> {\n const indexKeySpace = this.buildIndexKeySpace(filter);\n const cacheKey = this.cacheKeyFromKeySpace(indexKeySpace);\n return this.queryByKeySpace(indexKeySpace, cacheKey);\n }\n\n reference(meta: ISymbolMeta): Symbol {\n const indexKeySpace = this.buildIndexKeySpace(meta);\n const cacheKey = this.cacheKeyFromKeySpace(indexKeySpace);\n const [registered] = this.queryByKeySpace(indexKeySpace, cacheKey);\n if (registered) return registered;\n\n const cachedId = this._stubCache.get(cacheKey);\n if (cachedId !== undefined) return this._values.get(cachedId)!;\n\n const stub = new Symbol({ meta, name: '' }, this.nextId);\n\n this._values.set(stub.id, stub);\n this._stubs.add(stub.id);\n this._stubCache.set(cacheKey, stub.id);\n return stub;\n }\n\n register(symbol: ISymbolIn): Symbol {\n const result = new Symbol(symbol, this.nextId);\n\n this._values.set(result.id, result);\n this._registered.add(result.id);\n\n if (result.meta) {\n const indexKeySpace = this.buildIndexKeySpace(result.meta);\n this.indexSymbol(result.id, indexKeySpace);\n this.invalidateCache(indexKeySpace);\n this.replaceStubs(result, indexKeySpace);\n }\n\n return result;\n }\n\n *registered(): IterableIterator<Symbol> {\n for (const id of this._registered.values()) {\n yield this._values.get(id)!;\n }\n }\n\n private buildIndexKeySpace(meta: ISymbolMeta, prefix = ''): IndexKeySpace {\n const entries: Array<IndexEntry> = [];\n for (const [key, value] of Object.entries(meta)) {\n const path = prefix ? `${prefix}.${key}` : key;\n if (value && typeof value === 'object' && !Array.isArray(value)) {\n entries.push(...this.buildIndexKeySpace(value as ISymbolMeta, path));\n } else {\n entries.push([path, value, `${path}:${JSON.stringify(value)}`]);\n }\n }\n return entries;\n }\n\n /**\n * Derives a stable, order-insensitive cache key from a pre-built key space.\n * Avoids rebuilding the key space when it's already available.\n */\n private cacheKeyFromKeySpace(indexKeySpace: IndexKeySpace): QueryCacheKey {\n return indexKeySpace\n .map((indexEntry) => indexEntry[2])\n .sort() // ensure order-insensitivity\n .join('|');\n }\n\n private indexSymbol(symbolId: SymbolId, indexKeySpace: IndexKeySpace): void {\n for (const [key, value] of indexKeySpace) {\n if (!this._indices.has(key)) this._indices.set(key, new Map());\n const values = this._indices.get(key)!;\n const set = values.get(value) ?? new Set();\n set.add(symbolId);\n values.set(value, set);\n }\n }\n\n private invalidateCache(indexKeySpace: IndexKeySpace): void {\n for (const indexEntry of indexKeySpace) {\n const serialized = indexEntry[2];\n const cacheKeys = this._dependencyToCache.get(serialized);\n if (!cacheKeys) continue;\n for (const cacheKey of cacheKeys) {\n this._queryCache.delete(cacheKey);\n // Clean up stale reverse-index references so _dependencyToCache doesn't\n // accumulate orphaned entries for evicted cache keys.\n const deps = this._cacheDependencies.get(cacheKey);\n if (deps) {\n for (const dep of deps) {\n if (dep[2] !== serialized) {\n this._dependencyToCache.get(dep[2])?.delete(cacheKey);\n }\n }\n this._cacheDependencies.delete(cacheKey);\n }\n }\n this._dependencyToCache.delete(serialized);\n }\n }\n\n private isSubset(sub: IndexKeySpace, sup: IndexKeySpace): boolean {\n const supMap = new Map(sup.map((e) => [e[0], e[1]] as const));\n for (const [key, value] of sub) {\n if (!supMap.has(key) || supMap.get(key) !== value) {\n return false;\n }\n }\n return true;\n }\n\n private queryByKeySpace(\n indexKeySpace: IndexKeySpace,\n cacheKey: QueryCacheKey,\n ): ReadonlyArray<Symbol> {\n const cached = this._queryCache.get(cacheKey);\n if (cached) {\n return cached;\n }\n const sets: Array<Set<SymbolId>> = [];\n let missed = false;\n\n // Build index sets and register cache dependencies inline within a single pass.\n for (const indexEntry of indexKeySpace) {\n const serialized = indexEntry[2];\n let cacheKeys: Set<string>;\n\n if (this._dependencyToCache.has(serialized)) {\n cacheKeys = this._dependencyToCache.get(serialized)!;\n } else {\n cacheKeys = new Set();\n this._dependencyToCache.set(serialized, cacheKeys);\n }\n\n cacheKeys.add(cacheKey);\n\n if (!missed) {\n const values = this._indices.get(indexEntry[0]);\n if (!values) {\n missed = true;\n continue;\n }\n const set = values.get(indexEntry[1]);\n if (!set) {\n missed = true;\n continue;\n }\n sets.push(set);\n }\n }\n\n this._cacheDependencies.set(cacheKey, indexKeySpace);\n\n if (missed || !sets.length) {\n this._queryCache.set(cacheKey, []);\n return [];\n }\n\n // We want to do a Set intersection, but large inputs may contain a few very\n // large sets. The profiling showed that Set operations became a huge bottleneck\n // on such inputs.\n //\n // To avoid iterating over large sets multiple times, we sort the sets by size\n // and use the smallest set as the base to minimize iterations and deletions.\n sets.sort((a, b) => a.size - b.size);\n const result = new Set(sets[0]);\n for (let i = 1; i < sets.length; i++) {\n const set = sets[i]!;\n for (const symbolId of result) {\n if (!set.has(symbolId)) result.delete(symbolId);\n }\n }\n\n const symbols = Array.from(result, (symbolId) => this._values.get(symbolId)!);\n this._queryCache.set(cacheKey, symbols);\n return symbols;\n }\n\n private replaceStubs(symbol: Symbol, indexKeySpace: IndexKeySpace): void {\n for (const stubId of this._stubs.values()) {\n const stub = this._values.get(stubId);\n if (stub?.meta) {\n const stubKeySpace = this.buildIndexKeySpace(stub.meta);\n if (this.isSubset(stubKeySpace, indexKeySpace)) {\n const cacheKey = this.cacheKeyFromKeySpace(stubKeySpace);\n this._stubCache.delete(cacheKey);\n this._stubs.delete(stubId);\n stub.setCanonical(symbol);\n }\n }\n }\n }\n}\n","import path from 'node:path';\n\nimport type { IProjectRenderMeta } from '../extensions';\nimport { FileRegistry } from '../files/registry';\nimport { defaultExtensions } from '../languages/extensions';\nimport { defaultModuleEntryNames } from '../languages/modules';\nimport { defaultNameConflictResolvers } from '../languages/resolvers';\nimport type { Extensions, ModuleEntryNames, NameConflictResolvers } from '../languages/types';\nimport { NodeRegistry } from '../nodes/registry';\nimport type { IOutput } from '../output';\nimport { Planner } from '../planner/planner';\nimport { simpleNameConflictResolver } from '../planner/resolvers';\nimport type { NameConflictResolver } from '../planner/types';\nimport type { Renderer } from '../renderer';\nimport { SymbolRegistry } from '../symbols/registry';\nimport type { IProject } from './types';\n\nexport class Project implements IProject {\n private _isPlanned = false;\n\n readonly files: FileRegistry;\n readonly nodes = new NodeRegistry();\n readonly symbols = new SymbolRegistry();\n\n readonly defaultFileName: string;\n readonly defaultNameConflictResolver: NameConflictResolver;\n readonly extensions: Extensions;\n readonly fileName?: (name: string) => string;\n readonly moduleEntryNames: ModuleEntryNames;\n readonly nameConflictResolvers: NameConflictResolvers;\n readonly renderers: ReadonlyArray<Renderer>;\n readonly root: string;\n\n constructor(\n args: Pick<\n Partial<IProject>,\n | 'defaultFileName'\n | 'defaultNameConflictResolver'\n | 'extensions'\n | 'fileName'\n | 'moduleEntryNames'\n | 'nameConflictResolvers'\n | 'renderers'\n > &\n Pick<IProject, 'root'>,\n ) {\n const fileName = args.fileName;\n this.defaultFileName = args.defaultFileName ?? 'main';\n this.defaultNameConflictResolver =\n args.defaultNameConflictResolver ?? simpleNameConflictResolver;\n this.extensions = {\n ...defaultExtensions,\n ...args.extensions,\n };\n this.fileName = typeof fileName === 'string' ? () => fileName : fileName;\n this.files = new FileRegistry(this);\n this.moduleEntryNames = {\n ...defaultModuleEntryNames,\n ...args.moduleEntryNames,\n };\n this.nameConflictResolvers = {\n ...defaultNameConflictResolvers,\n ...args.nameConflictResolvers,\n };\n this.renderers = args.renderers ?? [];\n this.root = path.resolve(args.root).replace(/[/\\\\]+$/, '');\n }\n\n plan(meta?: IProjectRenderMeta): void {\n if (this._isPlanned) return;\n new Planner(this).plan(meta);\n this._isPlanned = true;\n }\n\n render(meta?: IProjectRenderMeta): ReadonlyArray<IOutput> {\n if (!this._isPlanned) this.plan(meta);\n const files: Array<IOutput> = [];\n for (const file of this.files.registered()) {\n if (!file.external && file.finalPath && file.renderer) {\n const content = file.renderer.render({ file, meta, project: this });\n files.push({ content, path: file.finalPath });\n }\n }\n return files;\n }\n}\n","import type { StructureItem, StructureShell } from './types';\n\nexport class StructureNode {\n /** Nested nodes within this node. */\n children: Map<string, StructureNode> = new Map();\n /** Items contained in this node. */\n items: Array<StructureItem> = [];\n /** The name of this node (e.g., \"Users\", \"Accounts\"). */\n name: string;\n /** Parent node in the hierarchy. Undefined if this is the root node. */\n parent?: StructureNode;\n /** Shell claimed for this node. */\n shell?: StructureShell;\n /** Source of the claimed shell. */\n shellSource?: symbol;\n /** True if this is a virtual root. */\n virtual: boolean;\n\n constructor(\n name: string,\n parent?: StructureNode,\n options?: {\n virtual?: boolean;\n },\n ) {\n this.name = name;\n this.parent = parent;\n this.virtual = options?.virtual ?? false;\n }\n\n get isRoot(): boolean {\n return !this.parent;\n }\n\n /**\n * Gets or creates a child node.\n *\n * If the child doesn't exist, it's created automatically.\n *\n * @param name - The name of the child node\n * @returns The child node instance\n */\n child(name: string): StructureNode {\n if (!this.children.has(name)) {\n this.children.set(name, new StructureNode(name, this));\n }\n return this.children.get(name)!;\n }\n\n /**\n * Gets the full path of this node in the hierarchy.\n *\n * @returns An array of node names from the root to this node\n */\n getPath(): ReadonlyArray<string> {\n const path: Array<string> = [];\n // eslint-disable-next-line @typescript-eslint/no-this-alias\n let cursor: StructureNode | undefined = this;\n while (cursor) {\n path.unshift(cursor.name);\n cursor = cursor.parent;\n }\n return path;\n }\n\n /**\n * Yields items from a specific source with typed data.\n *\n * @param source - The source symbol to filter by\n * @returns Generator of items from that source\n */\n *itemsFrom<T = unknown>(source: symbol): Generator<StructureItem & { data: T }> {\n for (const item of this.items) {\n if (item.source === source) {\n yield item as StructureItem & { data: T };\n }\n }\n }\n\n /**\n * Walk all nodes in the structure (depth-first, post-order).\n *\n * @returns Generator of all structure nodes\n */\n *walk(): Generator<StructureNode> {\n for (const node of this.children.values()) {\n yield* node.walk();\n }\n yield this;\n }\n}\n","import { StructureNode } from './node';\nimport type { StructureInsert } from './types';\n\nexport class StructureModel {\n /** Root nodes mapped by their names. */\n private _roots: Map<string, StructureNode> = new Map();\n /** Node for data without a specific root. */\n private _virtualRoot?: StructureNode;\n\n /**\n * Get all root nodes.\n */\n get roots(): ReadonlyArray<StructureNode> {\n const roots = Array.from(this._roots.values());\n if (this._virtualRoot) roots.unshift(this._virtualRoot);\n return roots;\n }\n\n /**\n * Insert data into the structure.\n */\n insert(args: StructureInsert): void {\n const { data, locations, source } = args;\n for (const location of locations) {\n const { path, shell } = location;\n const fullPath = path.filter((s): s is string => Boolean(s));\n const segments = fullPath.slice(0, -1);\n const name = fullPath[fullPath.length - 1];\n\n if (!name) {\n throw new Error('Cannot insert data without path.');\n }\n\n let cursor: StructureNode | null = null;\n\n for (const segment of segments) {\n if (!cursor) {\n cursor = this.root(segment);\n } else {\n cursor = cursor.child(segment);\n }\n\n if (shell && !cursor.shell) {\n cursor.shell = shell;\n cursor.shellSource = source;\n }\n }\n\n if (!cursor) {\n cursor = this.root(null);\n }\n\n cursor.items.push({ data, location: fullPath, source });\n }\n }\n\n /**\n * Gets or creates a root by name.\n *\n * If the root doesn't exist, it's created automatically.\n *\n * @param name - The name of the root\n * @returns The root instance\n */\n root(name: string | null): StructureNode {\n if (!name) {\n return (this._virtualRoot ??= new StructureNode('', undefined, {\n virtual: true,\n }));\n }\n if (!this._roots.has(name)) {\n this._roots.set(name, new StructureNode(name));\n }\n return this._roots.get(name)!;\n }\n\n /**\n * Walk all nodes in the structure (depth-first, post-order).\n *\n * @returns Generator of all structure nodes\n */\n *walk(): Generator<StructureNode> {\n if (this._virtualRoot) {\n yield* this._virtualRoot.walk();\n }\n for (const root of this._roots.values()) {\n yield* root.walk();\n }\n }\n}\n"],"mappings":";;;;;AAAA,MAAa,YAAY;AACzB,MAAa,YAAY;AACzB,MAAa,cAAc;;;;;;;;ACG3B,SAAgB,2BAAoC;AAClD,QAAO,QACL,QAAQ,MAAM,SACd,QAAQ,OAAO,SACf,CAAC,QAAQ,IAAI,MACb,CAAC,QAAQ,IAAI,kBACb,CAAC,QAAQ,IAAI,eACd;;;;ACVH,SAAS,cAAc,OAAoC;AACzD,QAAO,OAAO,UAAU,YAAY,UAAU,QAAQ,CAAC,MAAM,QAAQ,MAAM;;AAG7E,SAAgB,aACd,SACA,SACG;CACH,MAAM,IAAK,WAAW,EAAE;CACxB,MAAM,IAAK,WAAW,EAAE;CAExB,MAAM,SAAoB,EAAE,GAAG,GAAG;AAElC,MAAK,MAAM,OAAO,OAAO,KAAK,EAAE,EAAE;EAChC,MAAM,SAAS,EAAE;EACjB,MAAM,SAAS,EAAE;AAEjB,MAAI,cAAc,OAAO,IAAI,cAAc,OAAO,CAChD,QAAO,OAAO,aAAa,QAAQ,OAAO;MAE1C,QAAO,OAAO;;AAIlB,QAAO;;;;ACpBT,eAAsB,eAAoC,EACxD,YACA,QACA,MACA,cAUC;CACD,MAAM,WAAW,OAAO,UAAU,MAAM;CACxC,MAAM,EAAE,QAAQ,YAAY,YAAY,qBAAqB,MAAM,WAA0B;EAC3F;EACA;EACD,CAAC;AACF,UAAS,SAAS;CAElB,MAAM,cAAc,sBAAsB,QAAQ,aAAa,CAAC,WAAW;AAI3E,QAAO;EAAE,YAAY;EAAkB,SAHjB,YAAY,KA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