@opensip-cli/graph 0.1.7 → 0.1.9
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 +2 -2
- package/dist/__tests__/cli/symbol-index.test.js +29 -8
- package/dist/__tests__/cli/symbol-index.test.js.map +1 -1
- package/dist/cli/graph/graph-aux-command-specs.d.ts +2 -6
- package/dist/cli/graph/graph-aux-command-specs.d.ts.map +1 -1
- package/dist/cli/graph/graph-aux-command-specs.js +10 -9
- package/dist/cli/graph/graph-aux-command-specs.js.map +1 -1
- package/dist/cli/orchestrate/__tests__/_equivalence-harness.js +4 -1
- package/dist/cli/orchestrate/__tests__/_equivalence-harness.js.map +1 -1
- package/dist/cli/orchestrate/__tests__/export-index.test.d.ts +6 -4
- package/dist/cli/orchestrate/__tests__/export-index.test.d.ts.map +1 -1
- package/dist/cli/orchestrate/__tests__/export-index.test.js +66 -38
- package/dist/cli/orchestrate/__tests__/export-index.test.js.map +1 -1
- package/dist/cli/orchestrate/__tests__/layout-equivalence.test.d.ts +43 -0
- package/dist/cli/orchestrate/__tests__/layout-equivalence.test.d.ts.map +1 -0
- package/dist/cli/orchestrate/__tests__/layout-equivalence.test.js +329 -0
- package/dist/cli/orchestrate/__tests__/layout-equivalence.test.js.map +1 -0
- package/dist/cli/symbol-index.d.ts +6 -1
- package/dist/cli/symbol-index.d.ts.map +1 -1
- package/dist/cli/symbol-index.js +22 -4
- package/dist/cli/symbol-index.js.map +1 -1
- package/dist/cross-package/export-index.d.ts +30 -31
- package/dist/cross-package/export-index.d.ts.map +1 -1
- package/dist/cross-package/export-index.js +40 -17
- package/dist/cross-package/export-index.js.map +1 -1
- package/dist/cross-package/package-group.d.ts +52 -0
- package/dist/cross-package/package-group.d.ts.map +1 -0
- package/dist/cross-package/package-group.js +64 -0
- package/dist/cross-package/package-group.js.map +1 -0
- package/dist/persistence/schema.d.ts.map +1 -1
- package/dist/persistence/schema.js +18 -0
- package/dist/persistence/schema.js.map +1 -1
- package/package.json +286 -20
|
@@ -20,23 +20,34 @@
|
|
|
20
20
|
* wires them into `resolveCrossBoundaryCalls`.
|
|
21
21
|
*
|
|
22
22
|
* Package-key alignment (the linchpin Phase 2 depends on): the boundary
|
|
23
|
-
* resolver buckets occurrences
|
|
24
|
-
*
|
|
25
|
-
*
|
|
26
|
-
*
|
|
27
|
-
*
|
|
28
|
-
*
|
|
23
|
+
* resolver buckets occurrences, and {@link resolveSpecifierToPackage} returns a
|
|
24
|
+
* `packageGroup`, by ONE shared key function — {@link packageGroupOf}. With a
|
|
25
|
+
* {@link PackageManifestIndex} (the production path — every real caller passes
|
|
26
|
+
* one) the key is the OWNING package's `name`, found by the longest manifest-dir
|
|
27
|
+
* prefix of the file path. That is layout-AGNOSTIC: it works for `apps/`, `libs/`,
|
|
28
|
+
* `crates/`, nested `packages/<ns>/<pkg>/`, or a single-package repo — anywhere a
|
|
29
|
+
* `package.json` lives — not just a flat `packages/<seg>/` tree. Without a
|
|
30
|
+
* manifest (legacy / unit-test callers only) it falls back to the historical
|
|
31
|
+
* `packages/<segment>` path heuristic. Both {@link buildExportIndex} and
|
|
32
|
+
* {@link resolveSpecifierToPackage} use the SAME function with the SAME manifest,
|
|
33
|
+
* so a specifier's resolved group matches the `ExportIndex` keys verbatim — the
|
|
34
|
+
* linchpin holds on any layout.
|
|
29
35
|
*/
|
|
36
|
+
import type { PackageManifestIndex } from './package-group.js';
|
|
30
37
|
import type { Shard } from '../cli/orchestrate/shard-model.js';
|
|
31
38
|
import type { Catalog, FunctionOccurrence } from '../types.js';
|
|
39
|
+
export { packageGroupOf } from './package-group.js';
|
|
40
|
+
export type { PackageManifest, PackageManifestIndex } from './package-group.js';
|
|
32
41
|
/**
|
|
33
42
|
* Per-package export symbol table: `package` → (`name` → exported occurrences).
|
|
34
43
|
*
|
|
35
|
-
* The outer key is `
|
|
36
|
-
*
|
|
37
|
-
*
|
|
38
|
-
*
|
|
39
|
-
*
|
|
44
|
+
* The outer key is {@link packageGroupOf}`(filePath, manifestIndex)` — the
|
|
45
|
+
* owning package's `name` when a manifest is supplied (layout-agnostic), else
|
|
46
|
+
* the `packages/<segment>` heuristic — matching the bucketing the boundary
|
|
47
|
+
* resolver uses; the inner key is a function's `simpleName`. Only
|
|
48
|
+
* `visibility === 'exported'` occurrences are present — module-local and private
|
|
49
|
+
* occurrences are excluded, since an import specifier can only reach a package's
|
|
50
|
+
* exports.
|
|
40
51
|
*
|
|
41
52
|
* Insertion order follows catalog iteration. Consumers MUST match by name, not
|
|
42
53
|
* order; the inner arrays are the deterministic candidate set for a name.
|
|
@@ -47,27 +58,14 @@ export type ExportIndex = ReadonlyMap<string, ReadonlyMap<string, readonly Funct
|
|
|
47
58
|
* its simple name. Deterministic and allocation-lean: one pass over
|
|
48
59
|
* `catalog.functions`, no sorting (matching is by name, not order).
|
|
49
60
|
*
|
|
50
|
-
* The package key is `
|
|
51
|
-
* cross-shard resolver buckets by — so Phase 2 can look up
|
|
61
|
+
* The package key is `packageGroupOf(occ.filePath, manifestIndex)` — identical
|
|
62
|
+
* to what the cross-shard resolver buckets by — so Phase 2 can look up
|
|
52
63
|
* `exportIndex.get(packageGroup)` where `packageGroup` comes from
|
|
53
|
-
* {@link resolveSpecifierToPackage}.
|
|
64
|
+
* {@link resolveSpecifierToPackage} (with the SAME manifest). Passing the
|
|
65
|
+
* manifest is what makes the index layout-agnostic (keyed by package `name`);
|
|
66
|
+
* omitting it falls back to the `packages/<segment>` heuristic.
|
|
54
67
|
*/
|
|
55
68
|
export declare function buildExportIndex(catalog: Catalog, manifestIndex?: PackageManifestIndex): ExportIndex;
|
|
56
|
-
/**
|
|
57
|
-
* One workspace package's manifest facts the specifier resolver needs.
|
|
58
|
-
*
|
|
59
|
-
* `dir` is the package's PROJECT-RELATIVE root (e.g. `packages/core`) — the
|
|
60
|
-
* form `packageOf` expects — derived from the shard's absolute `rootDir`
|
|
61
|
-
* against the common project root. `exportsMap` is the raw `exports` field
|
|
62
|
-
* (when an object), used to gate subpath resolution.
|
|
63
|
-
*/
|
|
64
|
-
export interface PackageManifest {
|
|
65
|
-
readonly name: string;
|
|
66
|
-
readonly dir: string;
|
|
67
|
-
readonly exportsMap?: Record<string, unknown>;
|
|
68
|
-
}
|
|
69
|
-
/** Package `name` → its {@link PackageManifest}. */
|
|
70
|
-
export type PackageManifestIndex = ReadonlyMap<string, PackageManifest>;
|
|
71
69
|
/**
|
|
72
70
|
* Read each shard's `package.json` (`name`, `exports`) and index it by package
|
|
73
71
|
* name. Reuses the already-resolved `Shard[]` (no re-discovery); a shard whose
|
|
@@ -76,7 +74,7 @@ export type PackageManifestIndex = ReadonlyMap<string, PackageManifest>;
|
|
|
76
74
|
*
|
|
77
75
|
* `projectRoot` is the common root all shard file paths are relativized
|
|
78
76
|
* against, so each manifest's `dir` is in the same project-relative form
|
|
79
|
-
* `
|
|
77
|
+
* `packageGroupOf` matches against.
|
|
80
78
|
*/
|
|
81
79
|
export declare function buildPackageManifestIndex(shards: readonly Shard[], projectRoot: string): PackageManifestIndex;
|
|
82
80
|
/**
|
|
@@ -91,7 +89,8 @@ export declare function buildPackageManifestIndex(shards: readonly Shard[], proj
|
|
|
91
89
|
export declare function buildPackageManifestIndexFromRoots(rootDirs: readonly string[], projectRoot: string): PackageManifestIndex;
|
|
92
90
|
/** The outcome of resolving a bare import specifier to a workspace package. */
|
|
93
91
|
export interface ResolvedSpecifier {
|
|
94
|
-
/** The
|
|
92
|
+
/** The {@link packageGroupOf}-aligned group key (the package `name`) — looks
|
|
93
|
+
* up into an {@link ExportIndex} built with the same manifest. */
|
|
95
94
|
readonly packageGroup: string;
|
|
96
95
|
/** The `exports` subpath (`./errors`) when the specifier addressed one. */
|
|
97
96
|
readonly subpath?: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"export-index.d.ts","sourceRoot":"","sources":["../../src/cross-package/export-index.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"export-index.d.ts","sourceRoot":"","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@ -20,27 +20,39 @@
|
|
|
20
20
|
* wires them into `resolveCrossBoundaryCalls`.
|
|
21
21
|
*
|
|
22
22
|
* Package-key alignment (the linchpin Phase 2 depends on): the boundary
|
|
23
|
-
* resolver buckets occurrences
|
|
24
|
-
*
|
|
25
|
-
*
|
|
26
|
-
*
|
|
27
|
-
*
|
|
28
|
-
*
|
|
23
|
+
* resolver buckets occurrences, and {@link resolveSpecifierToPackage} returns a
|
|
24
|
+
* `packageGroup`, by ONE shared key function — {@link packageGroupOf}. With a
|
|
25
|
+
* {@link PackageManifestIndex} (the production path — every real caller passes
|
|
26
|
+
* one) the key is the OWNING package's `name`, found by the longest manifest-dir
|
|
27
|
+
* prefix of the file path. That is layout-AGNOSTIC: it works for `apps/`, `libs/`,
|
|
28
|
+
* `crates/`, nested `packages/<ns>/<pkg>/`, or a single-package repo — anywhere a
|
|
29
|
+
* `package.json` lives — not just a flat `packages/<seg>/` tree. Without a
|
|
30
|
+
* manifest (legacy / unit-test callers only) it falls back to the historical
|
|
31
|
+
* `packages/<segment>` path heuristic. Both {@link buildExportIndex} and
|
|
32
|
+
* {@link resolveSpecifierToPackage} use the SAME function with the SAME manifest,
|
|
33
|
+
* so a specifier's resolved group matches the `ExportIndex` keys verbatim — the
|
|
34
|
+
* linchpin holds on any layout.
|
|
29
35
|
*/
|
|
30
36
|
import { readFileSync } from 'node:fs';
|
|
31
37
|
import { posix, relative } from 'node:path';
|
|
32
38
|
import { logger } from '@opensip-cli/core';
|
|
33
|
-
import {
|
|
39
|
+
import { packageGroupOf } from './package-group.js';
|
|
34
40
|
import { toPosixPath } from './posix-path.js';
|
|
41
|
+
// The package-attribution types + key function live in `package-group.js`;
|
|
42
|
+
// re-exported here so every existing `from './export-index.js'` import keeps
|
|
43
|
+
// working (and the public API surface is unchanged).
|
|
44
|
+
export { packageGroupOf } from './package-group.js';
|
|
35
45
|
/**
|
|
36
46
|
* Bucket every exported occurrence in `catalog` by its package group then by
|
|
37
47
|
* its simple name. Deterministic and allocation-lean: one pass over
|
|
38
48
|
* `catalog.functions`, no sorting (matching is by name, not order).
|
|
39
49
|
*
|
|
40
|
-
* The package key is `
|
|
41
|
-
* cross-shard resolver buckets by — so Phase 2 can look up
|
|
50
|
+
* The package key is `packageGroupOf(occ.filePath, manifestIndex)` — identical
|
|
51
|
+
* to what the cross-shard resolver buckets by — so Phase 2 can look up
|
|
42
52
|
* `exportIndex.get(packageGroup)` where `packageGroup` comes from
|
|
43
|
-
* {@link resolveSpecifierToPackage}.
|
|
53
|
+
* {@link resolveSpecifierToPackage} (with the SAME manifest). Passing the
|
|
54
|
+
* manifest is what makes the index layout-agnostic (keyed by package `name`);
|
|
55
|
+
* omitting it falls back to the `packages/<segment>` heuristic.
|
|
44
56
|
*/
|
|
45
57
|
export function buildExportIndex(catalog, manifestIndex) {
|
|
46
58
|
const index = new Map();
|
|
@@ -50,7 +62,7 @@ export function buildExportIndex(catalog, manifestIndex) {
|
|
|
50
62
|
for (const occ of occs) {
|
|
51
63
|
if (occ.visibility !== 'exported')
|
|
52
64
|
continue;
|
|
53
|
-
const pkg =
|
|
65
|
+
const pkg = packageGroupOf(occ.filePath, manifestIndex);
|
|
54
66
|
const byName = getOrCreateMap(index, pkg);
|
|
55
67
|
const bucket = byName.get(occ.simpleName);
|
|
56
68
|
if (bucket)
|
|
@@ -99,16 +111,17 @@ function applyReExports(index, reExports, manifestIndex) {
|
|
|
99
111
|
/** Apply one re-export fact; returns whether it added any new index entry. */
|
|
100
112
|
function applyOneReExport(index, r, manifestIndex) {
|
|
101
113
|
// Relative re-export stays in-package (already indexed); workspace specifier
|
|
102
|
-
// resolves to its package group. External / untracked → skip.
|
|
114
|
+
// resolves to its package group. External / untracked → skip. Both branches
|
|
115
|
+
// use the SAME manifest-aware key so they align with the base index keys.
|
|
103
116
|
const sourcePkg = r.specifier.startsWith('.')
|
|
104
|
-
?
|
|
117
|
+
? packageGroupOf(r.fromFile, manifestIndex)
|
|
105
118
|
: resolveSpecifierToPackage(r.specifier, manifestIndex)?.packageGroup;
|
|
106
119
|
if (sourcePkg === undefined)
|
|
107
120
|
return false; // @silent-ok — external/untracked specifier; decline
|
|
108
121
|
const sourceBucket = index.get(sourcePkg);
|
|
109
122
|
if (sourceBucket === undefined)
|
|
110
123
|
return false; // @silent-ok — source package has no indexed exports
|
|
111
|
-
const fromBucket = getOrCreateMap(index,
|
|
124
|
+
const fromBucket = getOrCreateMap(index, packageGroupOf(r.fromFile, manifestIndex));
|
|
112
125
|
return r.exportedName === '*'
|
|
113
126
|
? expandStarReExport(sourceBucket, fromBucket)
|
|
114
127
|
: addNamedReExport(r, sourceBucket, fromBucket);
|
|
@@ -151,6 +164,9 @@ function getOrCreateMap(outer, key) {
|
|
|
151
164
|
outer.set(key, created);
|
|
152
165
|
return created;
|
|
153
166
|
}
|
|
167
|
+
// ── Task 1.2: package-name → package(+exports) manifest index ─────
|
|
168
|
+
// (`PackageManifest` / `PackageManifestIndex` are defined in `package-group.js`
|
|
169
|
+
// and re-exported at the top of this module.)
|
|
154
170
|
/**
|
|
155
171
|
* Read each shard's `package.json` (`name`, `exports`) and index it by package
|
|
156
172
|
* name. Reuses the already-resolved `Shard[]` (no re-discovery); a shard whose
|
|
@@ -159,7 +175,7 @@ function getOrCreateMap(outer, key) {
|
|
|
159
175
|
*
|
|
160
176
|
* `projectRoot` is the common root all shard file paths are relativized
|
|
161
177
|
* against, so each manifest's `dir` is in the same project-relative form
|
|
162
|
-
* `
|
|
178
|
+
* `packageGroupOf` matches against.
|
|
163
179
|
*/
|
|
164
180
|
export function buildPackageManifestIndex(shards, projectRoot) {
|
|
165
181
|
return buildPackageManifestIndexFromRoots(shards.map((s) => s.rootDir), projectRoot);
|
|
@@ -227,7 +243,9 @@ function readManifest(rootDirAbs, projectRoot) {
|
|
|
227
243
|
: undefined;
|
|
228
244
|
return { name, dir: relativeDir(rootDirAbs, projectRoot), exportsMap };
|
|
229
245
|
}
|
|
230
|
-
/** Project-relative POSIX dir for a shard's absolute rootDir
|
|
246
|
+
/** Project-relative POSIX dir for a shard's absolute rootDir — the prefix
|
|
247
|
+
* {@link packageGroupOf} matches file paths against (`''` when the package IS
|
|
248
|
+
* the project root, i.e. a single-package repo). */
|
|
231
249
|
function relativeDir(rootDirAbs, projectRoot) {
|
|
232
250
|
return toPosixPath(relative(projectRoot, rootDirAbs));
|
|
233
251
|
}
|
|
@@ -261,7 +279,12 @@ export function resolveSpecifierToPackage(specifier, manifestIndex) {
|
|
|
261
279
|
if (subpath !== undefined && !exportsDeclares(manifest.exportsMap, subpath)) {
|
|
262
280
|
return undefined; // unmappable subpath → decline
|
|
263
281
|
}
|
|
264
|
-
|
|
282
|
+
// The group key is the package's own `name` — identical to what
|
|
283
|
+
// `packageGroupOf` (and therefore `buildExportIndex`) keys this package's
|
|
284
|
+
// files by when given the SAME manifest index. This is the layout-agnostic
|
|
285
|
+
// linchpin: the resolved group keys straight into the export index regardless
|
|
286
|
+
// of where the package's dir sits in the tree.
|
|
287
|
+
const packageGroup = manifest.name;
|
|
265
288
|
return subpath === undefined ? { packageGroup } : { packageGroup, subpath };
|
|
266
289
|
}
|
|
267
290
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"export-index.js","sourceRoot":"","sources":["../../src/cross-package/export-index.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"export-index.js","sourceRoot":"","sources":["../../src/cross-package/export-index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AAE5C,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAE3C,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACpD,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAM9C,2EAA2E;AAC3E,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AAW,GAAG,GAAG,KAAK,CAAC,CAAC,CAAC,IAAI,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC;QAC9C,MAAM,IAAI,GAAG,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;QAC5B,OAAO,EAAE,WAAW,EAAE,OAAO,EAAE,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,KAAK,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,CAAC,SAAS,EAAE,CAAC;IACvF,CAAC;IACD,0BAA0B;IAC1B,MAAM,WAAW,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC;IAC7B,IAAI,WAAW,KAAK,SAAS,IAAI,WAAW,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QAC1D,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,OAAO,EAAE,SAAS,EAAE,CAAC;IACxD,CAAC;IACD,MAAM,IAAI,GAAG,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;IAC5B,OAAO,EAAE,WAAW,EAAE,OAAO,EAAE,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,KAAK,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,CAAC,SAAS,EAAE,CAAC;AACvF,CAAC;AAED,iFAAiF;AACjF,SAAS,eAAe,CACtB,UAA+C,EAC/C,OAAe;IAEf,OAAO,UAAU,KAAK,SAAS,IAAI,MAAM,CAAC,SAAS,CAAC,cAAc,CAAC,IAAI,CAAC,UAAU,EAAE,OAAO,CAAC,CAAC;AAC/F,CAAC"}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Layout-agnostic package attribution for cross-package resolution.
|
|
3
|
+
*
|
|
4
|
+
* One key function — {@link packageGroupOf} — and the manifest types it reads.
|
|
5
|
+
* Both the export symbol index (`buildExportIndex`) and the specifier resolver
|
|
6
|
+
* (`resolveSpecifierToPackage`) bucket by this SAME function with the SAME
|
|
7
|
+
* manifest, so a resolved specifier's group keys straight into the export index
|
|
8
|
+
* on ANY repo layout — the linchpin the cross-shard linker depends on.
|
|
9
|
+
*
|
|
10
|
+
* With a {@link PackageManifestIndex} (the production path — every real caller
|
|
11
|
+
* passes one) the group key is the OWNING package's `name`, found by the longest
|
|
12
|
+
* manifest-`dir` prefix of the file path. That is genuinely layout-agnostic: a
|
|
13
|
+
* package under `apps/web`, `libs/util`, `crates/x`, nested
|
|
14
|
+
* `packages/<group>/<leaf>`, or the repo root (single-package, `dir === ''`) all
|
|
15
|
+
* resolve to their real `package.json` `name`. Without a manifest (legacy /
|
|
16
|
+
* unit-test callers only) it falls back to the historical `packages/<segment>`
|
|
17
|
+
* path heuristic ({@link packageOf}).
|
|
18
|
+
*
|
|
19
|
+
* Extracted from `export-index.ts` so the (cohesive) package-attribution logic +
|
|
20
|
+
* its manifest types live in one focused module; `export-index.ts` re-exports the
|
|
21
|
+
* types for back-compatible import paths.
|
|
22
|
+
*/
|
|
23
|
+
/**
|
|
24
|
+
* One workspace package's manifest facts the specifier resolver needs.
|
|
25
|
+
*
|
|
26
|
+
* `dir` is the package's PROJECT-RELATIVE root (e.g. `packages/core`, `apps/web`,
|
|
27
|
+
* or `''` for a single-package repo rooted at the project) — derived from the
|
|
28
|
+
* shard's absolute `rootDir` against the common project root. It is the prefix
|
|
29
|
+
* {@link packageGroupOf} matches file paths against. `exportsMap` is the raw
|
|
30
|
+
* `exports` field (when an object), used to gate subpath resolution.
|
|
31
|
+
*/
|
|
32
|
+
export interface PackageManifest {
|
|
33
|
+
readonly name: string;
|
|
34
|
+
readonly dir: string;
|
|
35
|
+
readonly exportsMap?: Record<string, unknown>;
|
|
36
|
+
}
|
|
37
|
+
/** Package `name` → its {@link PackageManifest}. */
|
|
38
|
+
export type PackageManifestIndex = ReadonlyMap<string, PackageManifest>;
|
|
39
|
+
/**
|
|
40
|
+
* The package-group key for a project-relative POSIX `filePath` — the SINGLE key
|
|
41
|
+
* function the export index and the specifier resolver both bucket by, so they
|
|
42
|
+
* align on any repo layout.
|
|
43
|
+
*
|
|
44
|
+
* - WITH a {@link PackageManifestIndex} (the production path): the `name` of the
|
|
45
|
+
* OWNING package — the manifest whose project-relative `dir` is the longest
|
|
46
|
+
* path-segment prefix of `filePath`. Falls through to the path heuristic only
|
|
47
|
+
* when NO manifest dir is a prefix (a file outside every tracked package).
|
|
48
|
+
* - WITHOUT a manifest (legacy / unit-test callers): the `packages/<segment>`
|
|
49
|
+
* path heuristic ({@link packageOf}).
|
|
50
|
+
*/
|
|
51
|
+
export declare function packageGroupOf(filePath: string, manifestIndex?: PackageManifestIndex): string;
|
|
52
|
+
//# sourceMappingURL=package-group.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"package-group.d.ts","sourceRoot":"","sources":["../../src/cross-package/package-group.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAIH;;;;;;;;GAQG;AACH,MAAM,WAAW,eAAe;IAC9B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CAC/C;AAED,oDAAoD;AACpD,MAAM,MAAM,oBAAoB,GAAG,WAAW,CAAC,MAAM,EAAqB,eAAe,CAAC,CAAC;AAE3F;;;;;;;;;;;GAWG;AACH,wBAAgB,cAAc,CAAC,QAAQ,EAAE,MAAM,EAAE,aAAa,CAAC,EAAE,oBAAoB,GAAG,MAAM,CAM7F"}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Layout-agnostic package attribution for cross-package resolution.
|
|
3
|
+
*
|
|
4
|
+
* One key function — {@link packageGroupOf} — and the manifest types it reads.
|
|
5
|
+
* Both the export symbol index (`buildExportIndex`) and the specifier resolver
|
|
6
|
+
* (`resolveSpecifierToPackage`) bucket by this SAME function with the SAME
|
|
7
|
+
* manifest, so a resolved specifier's group keys straight into the export index
|
|
8
|
+
* on ANY repo layout — the linchpin the cross-shard linker depends on.
|
|
9
|
+
*
|
|
10
|
+
* With a {@link PackageManifestIndex} (the production path — every real caller
|
|
11
|
+
* passes one) the group key is the OWNING package's `name`, found by the longest
|
|
12
|
+
* manifest-`dir` prefix of the file path. That is genuinely layout-agnostic: a
|
|
13
|
+
* package under `apps/web`, `libs/util`, `crates/x`, nested
|
|
14
|
+
* `packages/<group>/<leaf>`, or the repo root (single-package, `dir === ''`) all
|
|
15
|
+
* resolve to their real `package.json` `name`. Without a manifest (legacy /
|
|
16
|
+
* unit-test callers only) it falls back to the historical `packages/<segment>`
|
|
17
|
+
* path heuristic ({@link packageOf}).
|
|
18
|
+
*
|
|
19
|
+
* Extracted from `export-index.ts` so the (cohesive) package-attribution logic +
|
|
20
|
+
* its manifest types live in one focused module; `export-index.ts` re-exports the
|
|
21
|
+
* types for back-compatible import paths.
|
|
22
|
+
*/
|
|
23
|
+
import { packageOf } from '../resolve-callee.js';
|
|
24
|
+
/**
|
|
25
|
+
* The package-group key for a project-relative POSIX `filePath` — the SINGLE key
|
|
26
|
+
* function the export index and the specifier resolver both bucket by, so they
|
|
27
|
+
* align on any repo layout.
|
|
28
|
+
*
|
|
29
|
+
* - WITH a {@link PackageManifestIndex} (the production path): the `name` of the
|
|
30
|
+
* OWNING package — the manifest whose project-relative `dir` is the longest
|
|
31
|
+
* path-segment prefix of `filePath`. Falls through to the path heuristic only
|
|
32
|
+
* when NO manifest dir is a prefix (a file outside every tracked package).
|
|
33
|
+
* - WITHOUT a manifest (legacy / unit-test callers): the `packages/<segment>`
|
|
34
|
+
* path heuristic ({@link packageOf}).
|
|
35
|
+
*/
|
|
36
|
+
export function packageGroupOf(filePath, manifestIndex) {
|
|
37
|
+
if (manifestIndex !== undefined) {
|
|
38
|
+
const owner = longestDirPrefixOwner(filePath, manifestIndex);
|
|
39
|
+
if (owner !== undefined)
|
|
40
|
+
return owner;
|
|
41
|
+
}
|
|
42
|
+
return packageOf(filePath);
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* The `name` of the manifest whose project-relative `dir` is the longest
|
|
46
|
+
* path-segment prefix of `filePath`, or `undefined` when none matches. A package
|
|
47
|
+
* at the repo root (`dir === ''`) owns every file no deeper package claims (the
|
|
48
|
+
* single-package-repo case). Matching is on whole path segments so `apps/web`
|
|
49
|
+
* never spuriously prefixes `apps/website/...`.
|
|
50
|
+
*/
|
|
51
|
+
function longestDirPrefixOwner(filePath, manifestIndex) {
|
|
52
|
+
let bestName;
|
|
53
|
+
let bestLen = -1;
|
|
54
|
+
for (const manifest of manifestIndex.values()) {
|
|
55
|
+
const dir = manifest.dir;
|
|
56
|
+
const isPrefix = dir === '' || filePath === dir || filePath.startsWith(`${dir}/`);
|
|
57
|
+
if (isPrefix && dir.length > bestLen) {
|
|
58
|
+
bestLen = dir.length;
|
|
59
|
+
bestName = manifest.name;
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
return bestName;
|
|
63
|
+
}
|
|
64
|
+
//# sourceMappingURL=package-group.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"package-group.js","sourceRoot":"","sources":["../../src/cross-package/package-group.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AAoBjD;;;;;;;;;;;GAWG;AACH,MAAM,UAAU,cAAc,CAAC,QAAgB,EAAE,aAAoC;IACnF,IAAI,aAAa,KAAK,SAAS,EAAE,CAAC;QAChC,MAAM,KAAK,GAAG,qBAAqB,CAAC,QAAQ,EAAE,aAAa,CAAC,CAAC;QAC7D,IAAI,KAAK,KAAK,SAAS;YAAE,OAAO,KAAK,CAAC;IACxC,CAAC;IACD,OAAO,SAAS,CAAC,QAAQ,CAAC,CAAC;AAC7B,CAAC;AAED;;;;;;GAMG;AACH,SAAS,qBAAqB,CAC5B,QAAgB,EAChB,aAAmC;IAEnC,IAAI,QAA4B,CAAC;IACjC,IAAI,OAAO,GAAG,CAAC,CAAC,CAAC;IACjB,KAAK,MAAM,QAAQ,IAAI,aAAa,CAAC,MAAM,EAAE,EAAE,CAAC;QAC9C,MAAM,GAAG,GAAG,QAAQ,CAAC,GAAG,CAAC;QACzB,MAAM,QAAQ,GAAG,GAAG,KAAK,EAAE,IAAI,QAAQ,KAAK,GAAG,IAAI,QAAQ,CAAC,UAAU,CAAC,GAAG,GAAG,GAAG,CAAC,CAAC;QAClF,IAAI,QAAQ,IAAI,GAAG,CAAC,MAAM,GAAG,OAAO,EAAE,CAAC;YACrC,OAAO,GAAG,GAAG,CAAC,MAAM,CAAC;YACrB,QAAQ,GAAG,QAAQ,CAAC,IAAI,CAAC;QAC3B,CAAC;IACH,CAAC;IACD,OAAO,QAAQ,CAAC;AAClB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../src/persistence/schema.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../src/persistence/schema.ts"],"names":[],"mappings":"AA0BA;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,YAAY;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAOvB,CAAC;AAEH;;;;;;;;;;;;;;;;GAgBG;AACH,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAM7B,CAAC"}
|
|
@@ -1,3 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Graph tool's Drizzle table definitions (catalog + shard fragment).
|
|
3
|
+
*
|
|
4
|
+
* ⚠️ MIGRATIONS LIVE IN `@opensip-cli/datastore`, NOT HERE. The platform uses one
|
|
5
|
+
* SQLite database with a single centralized migrations folder; this tool's tables
|
|
6
|
+
* are migrated alongside everyone else's. `datastore/drizzle.config.ts` imports
|
|
7
|
+
* THIS file as a schema source. Therefore, after editing the tables below you MUST:
|
|
8
|
+
*
|
|
9
|
+
* 1. `pnpm --filter @opensip-cli/datastore db:generate` (regenerate the migration)
|
|
10
|
+
* 2. commit the generated `packages/datastore/migrations/*` files
|
|
11
|
+
* 3. bump `LOGICAL_SCHEMA_VERSION` in `datastore/src/schema-version.ts` in lockstep
|
|
12
|
+
* with the new journal entry count (so existing DBs migrate forward).
|
|
13
|
+
*
|
|
14
|
+
* `datastore`'s `migration-integrity` + `version-guard` test suites fail loudly if
|
|
15
|
+
* the journal and schema drift, but they can't tell you to run db:generate — this
|
|
16
|
+
* note is the signpost. (Owning the schema here but the migration there is a known
|
|
17
|
+
* inversion; centralizing migrations is the deliberate trade — see ADR-0036.)
|
|
18
|
+
*/
|
|
1
19
|
import { integer, sqliteTable, text } from 'drizzle-orm/sqlite-core';
|
|
2
20
|
// ADR-0036: the graph baseline tables (`graph_baseline_signals` /
|
|
3
21
|
// `graph_baseline_meta`) moved to the generic host-owned `tool_baseline_entries`
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schema.js","sourceRoot":"","sources":["../../src/persistence/schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,WAAW,EAAE,IAAI,EAAE,MAAM,yBAAyB,CAAC;AAErE,kEAAkE;AAClE,iFAAiF;AACjF,8EAA8E;AAC9E,mFAAmF;AACnF,mEAAmE;AAEnE;;;;;;;;;;;;;GAaG;AACH,MAAM,CAAC,MAAM,YAAY,GAAG,WAAW,CAAC,eAAe,EAAE;IACvD,EAAE,EAAE,OAAO,CAAC,IAAI,CA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