@beehexa/hexasync-template-io-node 2608.15.1 → 2608.20.18
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/package.json +4 -4
- package/dist/index.d.ts +0 -14
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js +0 -88
- package/dist/index.js.map +0 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@beehexa/hexasync-template-io-node",
|
|
3
|
-
"version": "2608.
|
|
3
|
+
"version": "2608.20.18",
|
|
4
4
|
"description": "Node implementations of the port interfaces.",
|
|
5
5
|
"license": "SEE LICENSE IN ../../LICENSE",
|
|
6
6
|
"type": "module",
|
|
@@ -20,14 +20,14 @@
|
|
|
20
20
|
"build": "tsc -p tsconfig.build.json"
|
|
21
21
|
},
|
|
22
22
|
"dependencies": {
|
|
23
|
-
"@beehexa/hexasync-template-model": "2608.
|
|
24
|
-
"@beehexa/hexasync-template-ports": "2608.
|
|
23
|
+
"@beehexa/hexasync-template-model": "2608.20.18",
|
|
24
|
+
"@beehexa/hexasync-template-ports": "2608.20.18",
|
|
25
25
|
"fast-glob": "^3.3.2"
|
|
26
26
|
},
|
|
27
27
|
"hexasync": {
|
|
28
28
|
"layer": "adapter"
|
|
29
29
|
},
|
|
30
30
|
"devDependencies": {
|
|
31
|
-
"@beehexa/hexasync-template-compose": "2608.
|
|
31
|
+
"@beehexa/hexasync-template-compose": "2608.20.18"
|
|
32
32
|
}
|
|
33
33
|
}
|
package/dist/index.d.ts
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import type { IdentityResolver, TemplateReader } from '@beehexa/hexasync-template-ports';
|
|
2
|
-
/** A `file://` URI for a filesystem path. */
|
|
3
|
-
export declare function uriFromPath(path: string): string;
|
|
4
|
-
/**
|
|
5
|
-
* The filesystem path for a URI, accepting a bare path too.
|
|
6
|
-
*
|
|
7
|
-
* Bare paths are accepted because the CLI's existing call sites pass them. Refusing would force
|
|
8
|
-
* all 40 of them to convert at the boundary in one change — exactly the big-bang migration Story
|
|
9
|
-
* 1.5 is structured to avoid.
|
|
10
|
-
*/
|
|
11
|
-
export declare function pathFromUri(uri: string): string;
|
|
12
|
-
export declare function nodeTemplateReader(): TemplateReader;
|
|
13
|
-
export declare function nodeIdentityResolver(): IdentityResolver;
|
|
14
|
-
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAgBA,OAAO,KAAK,EACV,gBAAgB,EAChB,cAAc,EACf,MAAM,kCAAkC,CAAC;AAE1C,6CAA6C;AAC7C,wBAAgB,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAEhD;AAED;;;;;;GAMG;AACH,wBAAgB,WAAW,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAE/C;AAED,wBAAgB,kBAAkB,IAAI,cAAc,CAsCnD;AAED,wBAAgB,oBAAoB,IAAI,gBAAgB,CAevD"}
|
package/dist/index.js
DELETED
|
@@ -1,88 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Node implementations of the compose ports (AD-4, ADAPTER).
|
|
3
|
-
*
|
|
4
|
-
* The only place in the composer allowed to touch a real filesystem. It exists so core never has
|
|
5
|
-
* to: swap this for the in-memory reader, or a `vscode.workspace.fs` one, and the same composition
|
|
6
|
-
* runs against unsaved editor buffers or a browser.
|
|
7
|
-
*
|
|
8
|
-
* The `file://` ↔ path conversion lives here rather than in core deliberately. A filesystem path
|
|
9
|
-
* is a platform artefact; a URI is the identity. Keeping the conversion in the adapter is what
|
|
10
|
-
* stops a platform path leaking upward and becoming an identity another adapter would spell
|
|
11
|
-
* differently (AD-18).
|
|
12
|
-
*/
|
|
13
|
-
import { readFile, stat, realpath } from 'node:fs/promises';
|
|
14
|
-
import { fileURLToPath, pathToFileURL } from 'node:url';
|
|
15
|
-
import fastGlob from 'fast-glob';
|
|
16
|
-
import { normalizeUri } from '@beehexa/hexasync-template-model';
|
|
17
|
-
/** A `file://` URI for a filesystem path. */
|
|
18
|
-
export function uriFromPath(path) {
|
|
19
|
-
return normalizeUri(pathToFileURL(path).href);
|
|
20
|
-
}
|
|
21
|
-
/**
|
|
22
|
-
* The filesystem path for a URI, accepting a bare path too.
|
|
23
|
-
*
|
|
24
|
-
* Bare paths are accepted because the CLI's existing call sites pass them. Refusing would force
|
|
25
|
-
* all 40 of them to convert at the boundary in one change — exactly the big-bang migration Story
|
|
26
|
-
* 1.5 is structured to avoid.
|
|
27
|
-
*/
|
|
28
|
-
export function pathFromUri(uri) {
|
|
29
|
-
return uri.startsWith('file://') ? fileURLToPath(uri) : uri;
|
|
30
|
-
}
|
|
31
|
-
export function nodeTemplateReader() {
|
|
32
|
-
return {
|
|
33
|
-
async read(uri) {
|
|
34
|
-
try {
|
|
35
|
-
return await readFile(pathFromUri(uri), 'utf8');
|
|
36
|
-
}
|
|
37
|
-
catch (error) {
|
|
38
|
-
// ENOENT and EISDIR both mean "no file content here", an ordinary answer during
|
|
39
|
-
// composition. Anything else — permission denied, unreadable bytes — is a real failure and
|
|
40
|
-
// must NOT be flattened into `undefined`, or a broken environment would compose silently
|
|
41
|
-
// as though the files were merely absent.
|
|
42
|
-
const code = error.code;
|
|
43
|
-
if (code === 'ENOENT' || code === 'EISDIR')
|
|
44
|
-
return undefined;
|
|
45
|
-
throw error;
|
|
46
|
-
}
|
|
47
|
-
},
|
|
48
|
-
async exists(uri) {
|
|
49
|
-
try {
|
|
50
|
-
await stat(pathFromUri(uri));
|
|
51
|
-
return true;
|
|
52
|
-
}
|
|
53
|
-
catch {
|
|
54
|
-
return false;
|
|
55
|
-
}
|
|
56
|
-
},
|
|
57
|
-
async glob(baseUri, pattern) {
|
|
58
|
-
const matches = await fastGlob(pattern, {
|
|
59
|
-
cwd: pathFromUri(baseUri),
|
|
60
|
-
absolute: true,
|
|
61
|
-
dot: false,
|
|
62
|
-
followSymbolicLinks: false,
|
|
63
|
-
});
|
|
64
|
-
// Sorted explicitly: fast-glob's order follows directory traversal, and compose output must
|
|
65
|
-
// be byte-identical run to run (NFR-19). An unsorted glob would vary merge order and so the
|
|
66
|
-
// output — intermittently, and only on some filesystems.
|
|
67
|
-
return matches.map(uriFromPath).sort();
|
|
68
|
-
},
|
|
69
|
-
};
|
|
70
|
-
}
|
|
71
|
-
export function nodeIdentityResolver() {
|
|
72
|
-
return {
|
|
73
|
-
async identify(uri) {
|
|
74
|
-
try {
|
|
75
|
-
// `realpath` returns a PLATFORM PATH. Normalized back into URI form rather than used as
|
|
76
|
-
// the identity directly — AD-18's requirement, and the difference between two adapters
|
|
77
|
-
// genuinely agreeing on identity and merely appearing to.
|
|
78
|
-
return uriFromPath(await realpath(pathFromUri(uri)));
|
|
79
|
-
}
|
|
80
|
-
catch {
|
|
81
|
-
// Unresolvable (missing file, broken symlink): its own normal form is its identity, so
|
|
82
|
-
// something that does not exist yet still has a stable name to be referred to by.
|
|
83
|
-
return normalizeUri(uri.startsWith('file://') ? uri : uriFromPath(uri));
|
|
84
|
-
}
|
|
85
|
-
},
|
|
86
|
-
};
|
|
87
|
-
}
|
|
88
|
-
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AACH,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5D,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACxD,OAAO,QAAQ,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,YAAY,EAAE,MAAM,kCAAkC,CAAC;AAMhE,6CAA6C;AAC7C,MAAM,UAAU,WAAW,CAAC,IAAY;IACtC,OAAO,YA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