@descryy/adapter-common 0.1.0 → 0.2.0

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/LICENSE ADDED
@@ -0,0 +1,8 @@
1
+ Copyright (c) 2026 Descry
2
+
3
+ All rights reserved.
4
+
5
+ This software is proprietary and confidential. No license, express or
6
+ implied, to use, copy, modify, merge, publish, distribute, sublicense, or
7
+ sell copies of this software is granted without prior written permission
8
+ from the copyright holder.
@@ -1,58 +1,41 @@
1
1
  /**
2
- * File discovery.
3
- *
4
- * Hand-rolled rather than a glob dependency. The patterns a corpus manifest
5
- * uses are `src/**` + extension, which is three regex constructs, and an adapter
6
- * that ships one dependency ships that dependency's transitive tree into every
7
- * install of a locally-installed developer tool.
2
+ * File discovery. Hand-rolled rather than a glob dependency: corpus manifests
3
+ * only need `src/**` + extension (three regex constructs), and a dependency
4
+ * here ships its whole transitive tree into every install of this tool.
8
5
  */
9
6
  /**
10
- * Directory patterns a repository's own `.gitignore` files exclude.
11
- *
12
- * **Deliberately only directories, and deliberately only unambiguous ones.** A
13
- * full gitignore implementation has negation, nesting, anchoring and precedence,
14
- * and every one of those is a way to exclude a file that is real source. The
15
- * asymmetry decides the design: a build directory wrongly walked costs parse
16
- * time and some junk nodes, while a source directory wrongly skipped removes
17
- * real code from the graph and *cannot be seen* in any recall measurement,
18
- * because the files never entered the denominator.
7
+ * Directory patterns a repository's own `.gitignore` excludes.
19
8
  *
20
- * So this reads the forms that can only mean a directory — `dist/`, `/build`,
21
- * `coverage` on its own line — and ignores globs, negations and anything with a
22
- * path separator inside it. What it declines to interpret is simply walked, as
23
- * before.
9
+ * Deliberately only directories, and only unambiguous ones (`dist/`, `/build`,
10
+ * `coverage` alone on a line — no globs, negation, or path separators). A full
11
+ * gitignore implementation has negation, nesting, anchoring and precedence,
12
+ * and each is a way to wrongly exclude real source; a wrongly-walked build dir
13
+ * just costs parse time, but a wrongly-skipped source dir removes code from
14
+ * the graph invisibly — it never enters the recall denominator. What this
15
+ * declines to interpret is simply walked, as before.
24
16
  */
25
17
  export declare function ignoredDirectories(root: string): ReadonlySet<string>;
26
18
  /**
27
- * Translate a glob to an anchored regular expression.
28
- *
29
- * Supports `**` (any number of path segments, including none), `*` (any run of
30
- * characters within one segment) and `?`. That is the whole surface the corpus
31
- * manifests use; anything more would be inventing requirements.
19
+ * Glob to anchored regex. Supports `**` (any path depth, incl. zero), `*`
20
+ * (any run within one segment) and `?` — the whole surface corpus manifests
21
+ * use; more would be inventing requirements.
32
22
  */
33
23
  export declare function globToRegExp(glob: string): RegExp;
34
24
  export declare function matchesAny(path: string, globs: readonly string[]): boolean;
35
25
  /**
36
26
  * Every file under `root` matching any glob, repo-relative and sorted.
37
27
  *
38
- * Sorted because batch contents must not depend on directory-entry order: the
39
- * engine asserts that ingesting the same repository twice produces a
40
- * byte-identical database, and an unsorted walk breaks that on a different
41
- * filesystem rather than on this one.
28
+ * Sorted so batch contents don't depend on directory-entry order: the engine
29
+ * asserts that ingesting the same repo twice is byte-identical, and an
30
+ * unsorted walk breaks that on a different filesystem, not this one.
42
31
  */
43
32
  export interface DiscoverOptions {
44
- /**
45
- * Called once with every directory name `.gitignore` excluded, so the count
46
- * reaches the report rather than vanishing into the walk.
47
- */
33
+ /** Called once with every directory `.gitignore` excluded, so the count reaches the report. */
48
34
  readonly onIgnored?: (names: readonly string[]) => void;
49
35
  /**
50
- * Called for each nested checkout skipped, repo-relative.
51
- *
52
- * Surfaced rather than logged: a repository that contains three worktrees of
53
- * itself is a fact the report has to be able to state, because the difference
54
- * between "we analysed 1,087 files" and "we analysed 1,087 of 4,300" is the
55
- * difference between a result and a misleading one.
36
+ * Called for each nested checkout skipped, repo-relative. Surfaced rather
37
+ * than logged — "analysed 1,087 files" and "analysed 1,087 of 4,300" are
38
+ * different claims, and the report must be able to state which one is true.
56
39
  */
57
40
  readonly onNestedCheckout?: (repoRelativeDir: string) => void;
58
41
  }
@@ -1 +1 @@
1
- {"version":3,"file":"discover.d.ts","sourceRoot":"","sources":["../src/discover.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAiBH;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,MAAM,GAAG,WAAW,CAAC,MAAM,CAAC,CAqBpE;AAMD;;;;;;GAMG;AACH,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAmBjD;AAED,wBAAgB,UAAU,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,SAAS,MAAM,EAAE,GAAG,OAAO,CAE1E;AAED;;;;;;;GAOG;AACH,MAAM,WAAW,eAAe;IAC9B;;;OAGG;IACH,QAAQ,CAAC,SAAS,CAAC,EAAE,CAAC,KAAK,EAAE,SAAS,MAAM,EAAE,KAAK,IAAI,CAAC;IACxD;;;;;;;OAOG;IACH,QAAQ,CAAC,gBAAgB,CAAC,EAAE,CAAC,eAAe,EAAE,MAAM,KAAK,IAAI,CAAC;CAC/D;AAiBD,wBAAgB,QAAQ,CACtB,IAAI,EAAE,MAAM,EACZ,KAAK,EAAE,SAAS,MAAM,EAAE,EACxB,OAAO,GAAE,eAAoB,GAC5B,MAAM,EAAE,CA+BV;AAED,qFAAqF;AACrF,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,MAAM,CAIrE"}
1
+ {"version":3,"file":"discover.d.ts","sourceRoot":"","sources":["../src/discover.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAcH;;;;;;;;;;GAUG;AACH,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,MAAM,GAAG,WAAW,CAAC,MAAM,CAAC,CAqBpE;AAMD;;;;GAIG;AACH,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAkBjD;AAED,wBAAgB,UAAU,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,SAAS,MAAM,EAAE,GAAG,OAAO,CAE1E;AAED;;;;;;GAMG;AACH,MAAM,WAAW,eAAe;IAC9B,+FAA+F;IAC/F,QAAQ,CAAC,SAAS,CAAC,EAAE,CAAC,KAAK,EAAE,SAAS,MAAM,EAAE,KAAK,IAAI,CAAC;IACxD;;;;OAIG;IACH,QAAQ,CAAC,gBAAgB,CAAC,EAAE,CAAC,eAAe,EAAE,MAAM,KAAK,IAAI,CAAC;CAC/D;AAcD,wBAAgB,QAAQ,CACtB,IAAI,EAAE,MAAM,EACZ,KAAK,EAAE,SAAS,MAAM,EAAE,EACxB,OAAO,GAAE,eAAoB,GAC5B,MAAM,EAAE,CA+BV;AAED,qFAAqF;AACrF,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,MAAM,CAIrE"}
package/dist/discover.js CHANGED
@@ -1,39 +1,28 @@
1
1
  /**
2
- * File discovery.
3
- *
4
- * Hand-rolled rather than a glob dependency. The patterns a corpus manifest
5
- * uses are `src/**` + extension, which is three regex constructs, and an adapter
6
- * that ships one dependency ships that dependency's transitive tree into every
7
- * install of a locally-installed developer tool.
2
+ * File discovery. Hand-rolled rather than a glob dependency: corpus manifests
3
+ * only need `src/**` + extension (three regex constructs), and a dependency
4
+ * here ships its whole transitive tree into every install of this tool.
8
5
  */
9
6
  import { existsSync, readFileSync, readdirSync } from "node:fs";
10
7
  import { join, sep } from "node:path";
11
8
  /**
12
- * Directories never worth walking. Skipped before `readdir`, not filtered after.
9
+ * Directories never worth walking, skipped before `readdir`.
13
10
  *
14
- * This list is a **floor, not the policy.** It is a guess about where build
15
- * output lives, and a guess is exactly what `.gitignore` exists to replace: the
16
- * repository has already declared which of its files are not source, and the
17
- * standing rule is that where the project will tell you, you never infer. So the
18
- * list stays for repositories with no `.gitignore` and for `.git` itself, and
19
- * `ignoredDirectories` reads the declaration on top of it.
11
+ * A **floor, not the policy**: a guess about build output, kept only for repos
12
+ * with no `.gitignore` (and for `.git` itself). Where the project declares its
13
+ * own exclusions, `ignoredDirectories` reads that instead of guessing.
20
14
  */
21
15
  const SKIP = new Set(["node_modules", ".git", "dist", "build", "out", "coverage", ".next"]);
22
16
  /**
23
- * Directory patterns a repository's own `.gitignore` files exclude.
24
- *
25
- * **Deliberately only directories, and deliberately only unambiguous ones.** A
26
- * full gitignore implementation has negation, nesting, anchoring and precedence,
27
- * and every one of those is a way to exclude a file that is real source. The
28
- * asymmetry decides the design: a build directory wrongly walked costs parse
29
- * time and some junk nodes, while a source directory wrongly skipped removes
30
- * real code from the graph and *cannot be seen* in any recall measurement,
31
- * because the files never entered the denominator.
17
+ * Directory patterns a repository's own `.gitignore` excludes.
32
18
  *
33
- * So this reads the forms that can only mean a directory — `dist/`, `/build`,
34
- * `coverage` on its own line — and ignores globs, negations and anything with a
35
- * path separator inside it. What it declines to interpret is simply walked, as
36
- * before.
19
+ * Deliberately only directories, and only unambiguous ones (`dist/`, `/build`,
20
+ * `coverage` alone on a line — no globs, negation, or path separators). A full
21
+ * gitignore implementation has negation, nesting, anchoring and precedence,
22
+ * and each is a way to wrongly exclude real source; a wrongly-walked build dir
23
+ * just costs parse time, but a wrongly-skipped source dir removes code from
24
+ * the graph invisibly — it never enters the recall denominator. What this
25
+ * declines to interpret is simply walked, as before.
37
26
  */
38
27
  export function ignoredDirectories(root) {
39
28
  const names = new Set();
@@ -65,11 +54,9 @@ function escape(literal) {
65
54
  return literal.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
66
55
  }
67
56
  /**
68
- * Translate a glob to an anchored regular expression.
69
- *
70
- * Supports `**` (any number of path segments, including none), `*` (any run of
71
- * characters within one segment) and `?`. That is the whole surface the corpus
72
- * manifests use; anything more would be inventing requirements.
57
+ * Glob to anchored regex. Supports `**` (any path depth, incl. zero), `*`
58
+ * (any run within one segment) and `?` — the whole surface corpus manifests
59
+ * use; more would be inventing requirements.
73
60
  */
74
61
  export function globToRegExp(glob) {
75
62
  let out = "";
@@ -77,8 +64,7 @@ export function globToRegExp(glob) {
77
64
  const char = glob[i];
78
65
  if (char === "*") {
79
66
  if (glob[i + 1] === "*") {
80
- // `**/` collapses to "any depth, including zero segments" so that
81
- // `src/**/*.ts` matches `src/money.ts` as well as `src/ui/Page.ts`.
67
+ // `**/` = any depth incl. zero, so `src/**/*.ts` matches `src/money.ts` too.
82
68
  const slash = glob[i + 2] === "/";
83
69
  out += slash ? "(?:[^/]+/)*" : ".*";
84
70
  i += slash ? 2 : 1;
@@ -95,15 +81,12 @@ export function matchesAny(path, globs) {
95
81
  return globs.some((glob) => globToRegExp(glob).test(path));
96
82
  }
97
83
  /**
98
- * A directory holding its own `.git` is a different repository — a submodule, a
99
- * vendored checkout, or a `git worktree`. It is skipped for the same reason
100
- * `node_modules` is, plus a sharper one: node identity is
101
- * `hash(repo, kind, path)` (DEC-011), so analysing a nested checkout as part of
102
- * its parent stamps the parent's repo id onto another repository's symbols.
103
- *
104
- * Found on real code. One repository contained three worktrees of itself, each
105
- * with the same `package.json` name — 6,309 of 8,902 emitted nodes were exact
106
- * identity collisions with their own copies.
84
+ * A directory holding its own `.git` is a different repo (submodule, vendored
85
+ * checkout, worktree) and is skipped: node identity is `hash(repo, kind,
86
+ * path)` (DEC-011), so analysing it as part of the parent stamps the parent's
87
+ * repo id onto another repo's symbols. Measured on real code one repo with
88
+ * three worktrees of itself produced 6,309 of 8,902 emitted nodes as exact
89
+ * identity collisions.
107
90
  */
108
91
  function isNestedCheckout(dir) {
109
92
  return existsSync(join(dir, ".git"));
@@ -1 +1 @@
1
- {"version":3,"file":"discover.js","sourceRoot":"","sources":["../src/discover.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAChE,OAAO,EAAE,IAAI,EAAE,GAAG,EAAE,MAAM,WAAW,CAAC;AAEtC;;;;;;;;;GASG;AACH,MAAM,IAAI,GAAG,IAAI,GAAG,CAAC,CAAC,cAAc,EAAE,MAAM,EAAE,MAAM,EAA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AC,EAAE,CAAC;oBAC5C,OAAO,CAAC,gBAAgB,EAAE,CAAC,QAAQ,CAAC,CAAC;oBACrC,SAAS;gBACX,CAAC;gBACD,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,CAAC,EAAE,QAAQ,CAAC,CAAC;YACxC,CAAC;iBACI,IAAI,KAAK,CAAC,MAAM,EAAE,IAAI,UAAU,CAAC,QAAQ,EAAE,KAAK,CAAC;gBAAE,KAAK,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;QAC/E,CAAC;IACH,CAAC,CAAC;IAEF,IAAI,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;IACf,OAAO,KAAK,CAAC,IAAI,EAAE,CAAC;AACtB,CAAC;AAED,qFAAqF;AACrF,MAAM,UAAU,cAAc,CAAC,IAAY,EAAE,QAAgB;IAC3D,MAAM,MAAM,GAAG,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,GAAG,GAAG,CAAC;IACtD,MAAM,QAAQ,GAAG,QAAQ,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC;IACxF,OAAO,QAAQ,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AACvC,CAAC"}
package/dist/isolate.d.ts CHANGED
@@ -1,25 +1,16 @@
1
1
  /**
2
- * Per-file isolation for the work that happens *after* a file parses.
2
+ * Per-file isolation for the work *after* a file parses. Read/parse errors are
3
+ * already isolated (`unreadable`, `too-large`, `parseText`'s caught failure);
4
+ * the unguarded step is walking a parsed tree into an adapter's per-file unit,
5
+ * which indexes children and assumes shapes a grammar can decline to produce —
6
+ * a throw there takes the whole pass down, not just one file (real failure
7
+ * mode: `Cannot read properties of undefined (reading 'length')`, worst when
8
+ * a developer is analysing the file they just half-finished writing).
3
9
  *
4
- * Reading and parsing are already isolated everywhere: a read error becomes an
5
- * `unreadable` skip, an oversized file a `too-large` one, and `parseText` catches
6
- * the grammar and hands back a failure rather than throwing. The step nothing
7
- * guards is the one in between — walking a parsed tree into an adapter's own
8
- * per-file unit. That code indexes children, reads `.length`, and assumes shapes
9
- * a real grammar can decline to produce, and a throw there does not degrade one
10
- * file: it takes the whole pass down, along with every file that had already
11
- * succeeded.
12
- *
13
- * That failure mode is not hypothetical. `Cannot read properties of undefined
14
- * (reading 'length')` is exactly its shape, and it fires hardest at the worst
15
- * moment — a developer analysing code they just wrote is analysing the file most
16
- * likely to be half-finished.
17
- *
18
- * The vocabulary does not grow to accommodate this. A step that throws is a file
19
- * we could not finish reading, disclosed through `skippedFiles` with reason
20
- * `other` and the real error message as its detail — the same route
21
- * `adapter-go` already uses for a file it can see but cannot place in a module.
22
- * `SkipReason` stays at four values.
10
+ * The vocabulary doesn't grow for this: a throw becomes a `skippedFiles` entry
11
+ * with reason `other` and the real error as detail same route `adapter-go`
12
+ * uses for a file it can see but can't place in a module. `SkipReason` stays
13
+ * at four values.
23
14
  */
24
15
  /** A file the adapter parsed but could not finish, and why. */
25
16
  export interface IsolatedFailure {
@@ -37,14 +28,13 @@ export type Isolated<T> = {
37
28
  /**
38
29
  * Run one file's step, converting a throw into a disclosed skip for that file.
39
30
  *
40
- * Deliberately synchronous. Every adapter's per-file walk is synchronous over an
41
- * already-parsed tree, and an async signature here would invite a caller to move
42
- * I/O inside the boundary, where a partially-written unit is much harder to
43
- * reason about than a partially-read directory.
31
+ * Deliberately synchronous every adapter's per-file walk is synchronous over
32
+ * an already-parsed tree, and async here would invite I/O inside the boundary,
33
+ * where a partially-written unit is harder to reason about than a
34
+ * partially-read directory.
44
35
  *
45
- * **An abort is re-thrown.** A cancelled run is not a corpus of broken files, and
46
- * recording it as one would turn a single deliberate stop into a per-file
47
- * disclosure about the repository for every file that had not been reached yet.
36
+ * An abort is re-thrown: a cancelled run isn't a corpus of broken files, and
37
+ * recording it as one would misreport every file not yet reached as broken.
48
38
  */
49
39
  export declare function isolateFile<T>(file: string, step: () => T): Isolated<T>;
50
40
  //# sourceMappingURL=isolate.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"isolate.d.ts","sourceRoot":"","sources":["../src/isolate.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAEH,+DAA+D;AAC/D,MAAM,WAAW,eAAe;IAC9B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,wEAAwE;IACxE,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;CACzB;AAED,MAAM,MAAM,QAAQ,CAAC,CAAC,IAClB;IAAE,QAAQ,CAAC,KAAK,EAAE,CAAC,CAAC;IAAC,QAAQ,CAAC,OAAO,EAAE,SAAS,CAAA;CAAE,GAClD;IAAE,QAAQ,CAAC,KAAK,EAAE,SAAS,CAAC;IAAC,QAAQ,CAAC,OAAO,EAAE,eAAe,CAAA;CAAE,CAAC;AAErE;;;;;;;;;;;GAWG;AACH,wBAAgB,WAAW,CAAC,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,CAAC,GAAG,QAAQ,CAAC,CAAC,CAAC,CAUvE"}
1
+ {"version":3,"file":"isolate.d.ts","sourceRoot":"","sources":["../src/isolate.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,+DAA+D;AAC/D,MAAM,WAAW,eAAe;IAC9B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,wEAAwE;IACxE,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;CACzB;AAED,MAAM,MAAM,QAAQ,CAAC,CAAC,IAClB;IAAE,QAAQ,CAAC,KAAK,EAAE,CAAC,CAAC;IAAC,QAAQ,CAAC,OAAO,EAAE,SAAS,CAAA;CAAE,GAClD;IAAE,QAAQ,CAAC,KAAK,EAAE,SAAS,CAAC;IAAC,QAAQ,CAAC,OAAO,EAAE,eAAe,CAAA;CAAE,CAAC;AAErE;;;;;;;;;;GAUG;AACH,wBAAgB,WAAW,CAAC,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,CAAC,GAAG,QAAQ,CAAC,CAAC,CAAC,CAUvE"}
package/dist/isolate.js CHANGED
@@ -1,37 +1,27 @@
1
1
  /**
2
- * Per-file isolation for the work that happens *after* a file parses.
2
+ * Per-file isolation for the work *after* a file parses. Read/parse errors are
3
+ * already isolated (`unreadable`, `too-large`, `parseText`'s caught failure);
4
+ * the unguarded step is walking a parsed tree into an adapter's per-file unit,
5
+ * which indexes children and assumes shapes a grammar can decline to produce —
6
+ * a throw there takes the whole pass down, not just one file (real failure
7
+ * mode: `Cannot read properties of undefined (reading 'length')`, worst when
8
+ * a developer is analysing the file they just half-finished writing).
3
9
  *
4
- * Reading and parsing are already isolated everywhere: a read error becomes an
5
- * `unreadable` skip, an oversized file a `too-large` one, and `parseText` catches
6
- * the grammar and hands back a failure rather than throwing. The step nothing
7
- * guards is the one in between — walking a parsed tree into an adapter's own
8
- * per-file unit. That code indexes children, reads `.length`, and assumes shapes
9
- * a real grammar can decline to produce, and a throw there does not degrade one
10
- * file: it takes the whole pass down, along with every file that had already
11
- * succeeded.
12
- *
13
- * That failure mode is not hypothetical. `Cannot read properties of undefined
14
- * (reading 'length')` is exactly its shape, and it fires hardest at the worst
15
- * moment — a developer analysing code they just wrote is analysing the file most
16
- * likely to be half-finished.
17
- *
18
- * The vocabulary does not grow to accommodate this. A step that throws is a file
19
- * we could not finish reading, disclosed through `skippedFiles` with reason
20
- * `other` and the real error message as its detail — the same route
21
- * `adapter-go` already uses for a file it can see but cannot place in a module.
22
- * `SkipReason` stays at four values.
10
+ * The vocabulary doesn't grow for this: a throw becomes a `skippedFiles` entry
11
+ * with reason `other` and the real error as detail same route `adapter-go`
12
+ * uses for a file it can see but can't place in a module. `SkipReason` stays
13
+ * at four values.
23
14
  */
24
15
  /**
25
16
  * Run one file's step, converting a throw into a disclosed skip for that file.
26
17
  *
27
- * Deliberately synchronous. Every adapter's per-file walk is synchronous over an
28
- * already-parsed tree, and an async signature here would invite a caller to move
29
- * I/O inside the boundary, where a partially-written unit is much harder to
30
- * reason about than a partially-read directory.
18
+ * Deliberately synchronous every adapter's per-file walk is synchronous over
19
+ * an already-parsed tree, and async here would invite I/O inside the boundary,
20
+ * where a partially-written unit is harder to reason about than a
21
+ * partially-read directory.
31
22
  *
32
- * **An abort is re-thrown.** A cancelled run is not a corpus of broken files, and
33
- * recording it as one would turn a single deliberate stop into a per-file
34
- * disclosure about the repository for every file that had not been reached yet.
23
+ * An abort is re-thrown: a cancelled run isn't a corpus of broken files, and
24
+ * recording it as one would misreport every file not yet reached as broken.
35
25
  */
36
26
  export function isolateFile(file, step) {
37
27
  try {
@@ -1 +1 @@
1
- {"version":3,"file":"isolate.js","sourceRoot":"","sources":["../src/isolate.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAaH;;;;;;;;;;;GAWG;AACH,MAAM,UAAU,WAAW,CAAI,IAAY,EAAE,IAAa;IACxD,IAAI,CAAC;QACH,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,EAAE,OAAO,EAAE,SAAS,EAAE,CAAC;IAC/C,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,IAAI,KAAK,YAAY,KAAK,IAAI,KAAK,CAAC,IAAI,KAAK,YAAY;YAAE,MAAM,KAAK,CAAC;QACvE,OAAO;YACL,KAAK,EAAE,SAAS;YAChB,OAAO,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE;SAClF,CAAC;IACJ,CAAC;AACH,CAAC"}
1
+ {"version":3,"file":"isolate.js","sourceRoot":"","sources":["../src/isolate.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAaH;;;;;;;;;;GAUG;AACH,MAAM,UAAU,WAAW,CAAI,IAAY,EAAE,IAAa;IACxD,IAAI,CAAC;QACH,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,EAAE,OAAO,EAAE,SAAS,EAAE,CAAC;IAC/C,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,IAAI,KAAK,YAAY,KAAK,IAAI,KAAK,CAAC,IAAI,KAAK,YAAY;YAAE,MAAM,KAAK,CAAC;QACvE,OAAO;YACL,KAAK,EAAE,SAAS;YAChB,OAAO,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE;SAClF,CAAC;IACJ,CAAC;AACH,CAAC"}
package/package.json CHANGED
@@ -1,9 +1,18 @@
1
1
  {
2
2
  "name": "@descryy/adapter-common",
3
- "version": "0.1.0",
3
+ "version": "0.2.0",
4
4
  "type": "module",
5
5
  "description": "Shared adapter infrastructure: file discovery, glob matching, path normalisation. No language knowledge.",
6
6
  "license": "UNLICENSED",
7
+ "repository": {
8
+ "type": "git",
9
+ "url": "git+https://github.com/descryhq-wq/descry-adapters.git",
10
+ "directory": "packages/adapter-common"
11
+ },
12
+ "bugs": {
13
+ "url": "https://github.com/descryhq-wq/descry-adapters/issues"
14
+ },
15
+ "homepage": "https://github.com/descryhq-wq/descry-adapters#readme",
7
16
  "engines": {
8
17
  "node": ">=22.5"
9
18
  },