@beehexa/hexasync-template-ports 2608.20.18 → 2608.20.31
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +71 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +26 -0
- package/dist/index.js.map +1 -0
- package/package.json +1 -1
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Every IO shape the composer needs — interfaces ONLY (AD-4, core).
|
|
3
|
+
*
|
|
4
|
+
* This package contains no implementation and, by the `ports-are-interfaces-only` rule in
|
|
5
|
+
* `.dependency-cruiser.cjs`, cannot even import one. That is what makes composing from something
|
|
6
|
+
* other than a disk possible at all: an unsaved editor buffer, a browser filesystem, and an
|
|
7
|
+
* in-memory fixture in a test are each just another implementation of these.
|
|
8
|
+
*
|
|
9
|
+
* Identity is a **normalized URI string** (AD-18) — never a filesystem path, never a platform
|
|
10
|
+
* separator. Canonicalization lives in `@beehexa/hexasync-template-model`'s URI algebra so every adapter
|
|
11
|
+
* agrees, rather than each normalizing its own way and letting the desktop and web hosts disagree
|
|
12
|
+
* about whether two references mean the same file.
|
|
13
|
+
*
|
|
14
|
+
* ONE acknowledged exception, and it is the CLI's, not this contract's: `hexasync`'s reader
|
|
15
|
+
* converts glob results back to platform paths before they reach the compose path, because a
|
|
16
|
+
* worklist path is printed into the merge-integrity report and changing its spelling would break
|
|
17
|
+
* the byte-identical guarantee (NFR-19). Core never learns what a path is — the conversion sits
|
|
18
|
+
* in the adapter — but the identities flowing through a CLI compose are platform paths, so
|
|
19
|
+
* "always" would overstate it.
|
|
20
|
+
*
|
|
21
|
+
* Every method is async (AD-11). `vscode.workspace.fs` and a browser filesystem are async and
|
|
22
|
+
* cannot be made otherwise, so a synchronous port would have shut the web host out permanently.
|
|
23
|
+
* A Node adapter wrapping sync calls in a resolved promise costs nothing by comparison.
|
|
24
|
+
*/
|
|
25
|
+
/**
|
|
26
|
+
* Reading, existence and globbing — the three things the compose path does to a filesystem
|
|
27
|
+
* (Story 1.5 AC 1).
|
|
28
|
+
*
|
|
29
|
+
* Deliberately no `write`: composing must produce artefacts without writing them (Story 1.7), and
|
|
30
|
+
* a write method here would be a standing invitation to break that.
|
|
31
|
+
*/
|
|
32
|
+
export interface TemplateReader {
|
|
33
|
+
/**
|
|
34
|
+
* File content as text, or `undefined` when it does not exist.
|
|
35
|
+
*
|
|
36
|
+
* `undefined` rather than a throw, because "not there" is an ordinary and expected answer during
|
|
37
|
+
* composition — an optional `variables.yaml`, an external not yet fetched. Reserving exceptions
|
|
38
|
+
* for genuine failures (permission denied, unreadable bytes) keeps the two distinguishable.
|
|
39
|
+
*/
|
|
40
|
+
read(uri: string): Promise<string | undefined>;
|
|
41
|
+
/** Whether something exists at this URI. */
|
|
42
|
+
exists(uri: string): Promise<boolean>;
|
|
43
|
+
/**
|
|
44
|
+
* URIs matching a glob pattern under `baseUri`, in a stable order.
|
|
45
|
+
*
|
|
46
|
+
* Stable is part of the contract, not a nicety: compose output must be byte-identical run to run
|
|
47
|
+
* (NFR-19), and if a component glob's order varied then merge order would vary, and so would the
|
|
48
|
+
* output.
|
|
49
|
+
*/
|
|
50
|
+
glob(baseUri: string, pattern: string): Promise<readonly string[]>;
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Turns a URI into its canonical identity, following symlinks where the host can.
|
|
54
|
+
*
|
|
55
|
+
* Kept separate from `TemplateReader` because most callers never need it, and because its contract
|
|
56
|
+
* has a subtlety worth isolating: where an adapter has `realpath`, the result must be **normalized
|
|
57
|
+
* into** the URI form rather than **substituted for** it (AD-18, Story 1.5 AC 4). A raw `realpath`
|
|
58
|
+
* string is a platform path, and letting one leak in as an identity is precisely how two adapters
|
|
59
|
+
* end up disagreeing about the same file.
|
|
60
|
+
*/
|
|
61
|
+
export interface IdentityResolver {
|
|
62
|
+
/** The canonical normalized URI. Returns the input's own normal form when unresolvable. */
|
|
63
|
+
identify(uri: string): Promise<string>;
|
|
64
|
+
}
|
|
65
|
+
/** What the composer needs in order to resolve and read a project. */
|
|
66
|
+
export interface ComposeIo {
|
|
67
|
+
readonly reader: TemplateReader;
|
|
68
|
+
/** Optional: without it, a URI's own normal form is its identity. */
|
|
69
|
+
readonly identity?: IdentityResolver;
|
|
70
|
+
}
|
|
71
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAEH;;;;;;GAMG;AACH,MAAM,WAAW,cAAc;IAC7B;;;;;;OAMG;IACH,IAAI,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,CAAC;IAE/C,4CAA4C;IAC5C,MAAM,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;IAEtC;;;;;;OAMG;IACH,IAAI,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,SAAS,MAAM,EAAE,CAAC,CAAC;CACpE;AAED;;;;;;;;GAQG;AACH,MAAM,WAAW,gBAAgB;IAC/B,2FAA2F;IAC3F,QAAQ,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;CACxC;AAED,sEAAsE;AACtE,MAAM,WAAW,SAAS;IACxB,QAAQ,CAAC,MAAM,EAAE,cAAc,CAAC;IAChC,qEAAqE;IACrE,QAAQ,CAAC,QAAQ,CAAC,EAAE,gBAAgB,CAAC;CACtC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Every IO shape the composer needs — interfaces ONLY (AD-4, core).
|
|
3
|
+
*
|
|
4
|
+
* This package contains no implementation and, by the `ports-are-interfaces-only` rule in
|
|
5
|
+
* `.dependency-cruiser.cjs`, cannot even import one. That is what makes composing from something
|
|
6
|
+
* other than a disk possible at all: an unsaved editor buffer, a browser filesystem, and an
|
|
7
|
+
* in-memory fixture in a test are each just another implementation of these.
|
|
8
|
+
*
|
|
9
|
+
* Identity is a **normalized URI string** (AD-18) — never a filesystem path, never a platform
|
|
10
|
+
* separator. Canonicalization lives in `@beehexa/hexasync-template-model`'s URI algebra so every adapter
|
|
11
|
+
* agrees, rather than each normalizing its own way and letting the desktop and web hosts disagree
|
|
12
|
+
* about whether two references mean the same file.
|
|
13
|
+
*
|
|
14
|
+
* ONE acknowledged exception, and it is the CLI's, not this contract's: `hexasync`'s reader
|
|
15
|
+
* converts glob results back to platform paths before they reach the compose path, because a
|
|
16
|
+
* worklist path is printed into the merge-integrity report and changing its spelling would break
|
|
17
|
+
* the byte-identical guarantee (NFR-19). Core never learns what a path is — the conversion sits
|
|
18
|
+
* in the adapter — but the identities flowing through a CLI compose are platform paths, so
|
|
19
|
+
* "always" would overstate it.
|
|
20
|
+
*
|
|
21
|
+
* Every method is async (AD-11). `vscode.workspace.fs` and a browser filesystem are async and
|
|
22
|
+
* cannot be made otherwise, so a synchronous port would have shut the web host out permanently.
|
|
23
|
+
* A Node adapter wrapping sync calls in a resolved promise costs nothing by comparison.
|
|
24
|
+
*/
|
|
25
|
+
export {};
|
|
26
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@beehexa/hexasync-template-ports",
|
|
3
|
-
"version": "2608.20.
|
|
3
|
+
"version": "2608.20.31",
|
|
4
4
|
"description": "Interfaces only — every IO shape the core needs, and no implementation of any of them.",
|
|
5
5
|
"license": "SEE LICENSE IN ../../LICENSE",
|
|
6
6
|
"type": "module",
|