@beehexa/hexasync-template-model 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/dist/uriPath.js DELETED
@@ -1,151 +0,0 @@
1
- /**
2
- * URI path algebra — the AD-18 corollary.
3
- *
4
- * Core may not use `node:path` (AD-3, amended 2026-08-01): the VS Code web
5
- * extension host does not provide it, and a bundler polyfill is exactly how
6
- * desktop and web end up disagreeing about file identity. So core does its own
7
- * path arithmetic over **normalized URI strings**: POSIX `/` only, with `.` and
8
- * `..` collapsed explicitly.
9
- *
10
- * Pure string work. No IO, no Node builtins, no platform behaviour.
11
- */
12
- /**
13
- * `c:/…` — a Windows absolute path, which is ROOTED WITHOUT a leading slash.
14
- *
15
- * The one shape this file's "POSIX `/` only" model does not otherwise describe. Every caller has
16
- * already folded backslashes to `/` before this is tested, so only the forward form appears here.
17
- *
18
- * A single letter followed by `:/` cannot be a URI scheme in this codebase's terms — `splitPrefix`
19
- * and `isAbsoluteUri` both test the `scheme://` form FIRST, so `c://host/x` is still read as a
20
- * scheme with an authority rather than as a drive.
21
- */
22
- const DRIVE_ROOT = /^[a-zA-Z]:\//;
23
- /** Splits `scheme://authority`, or a Windows drive root (if any), from the path remainder. */
24
- function splitPrefix(uri) {
25
- const m = /^([a-zA-Z][a-zA-Z0-9+.-]*:\/\/[^/]*\/?)/.exec(uri);
26
- if (m)
27
- return { prefix: m[1], rest: uri.slice(m[1].length) };
28
- // A DRIVE is a root. Left as an ordinary segment it was one — so `..` could climb PAST `c:` and
29
- // out of the volume, and `relativeUri` saw two different drives as sharing a root and produced a
30
- // traversal between them. `c:/` is three characters, always.
31
- if (DRIVE_ROOT.test(uri))
32
- return { prefix: uri.slice(0, 3), rest: uri.slice(3) };
33
- if (uri.startsWith('/'))
34
- return { prefix: '/', rest: uri.slice(1) };
35
- return { prefix: '', rest: uri };
36
- }
37
- function collapse(segments, keepLeadingDotDot) {
38
- const out = [];
39
- for (const seg of segments) {
40
- if (seg === '' || seg === '.')
41
- continue;
42
- if (seg === '..') {
43
- const last = out[out.length - 1];
44
- if (out.length > 0 && last !== '..') {
45
- out.pop();
46
- }
47
- else if (keepLeadingDotDot) {
48
- out.push('..');
49
- }
50
- // When traversal cannot be kept (rooted path), it is dropped —
51
- // a rooted path can never escape its own root.
52
- continue;
53
- }
54
- out.push(seg);
55
- }
56
- return out;
57
- }
58
- export function normalizeUri(uri) {
59
- const forwardOnly = String(uri).replace(/\\/g, '/');
60
- const { prefix, rest } = splitPrefix(forwardOnly);
61
- const rooted = prefix !== '';
62
- const segments = collapse(rest.split('/'), !rooted);
63
- const joined = segments.join('/');
64
- if (prefix === '')
65
- return joined;
66
- if (prefix === '/')
67
- return `/${joined}`;
68
- return joined === ''
69
- ? prefix
70
- : `${prefix.endsWith('/') ? prefix : `${prefix}/`}${joined}`;
71
- }
72
- export function joinUri(base, ...segments) {
73
- const tail = segments.filter((s) => s !== undefined && s !== null && String(s) !== '');
74
- const combined = [String(base), ...tail.map(String)].join('/');
75
- return normalizeUri(combined);
76
- }
77
- export function dirnameUri(uri) {
78
- const normalized = normalizeUri(uri);
79
- const { prefix, rest } = splitPrefix(normalized);
80
- const idx = rest.lastIndexOf('/');
81
- if (idx === -1)
82
- return prefix === '' ? '' : prefix;
83
- return normalizeUri(`${prefix}${rest.slice(0, idx)}`);
84
- }
85
- export function basenameUri(uri) {
86
- const normalized = normalizeUri(uri);
87
- const { rest } = splitPrefix(normalized);
88
- const idx = rest.lastIndexOf('/');
89
- return idx === -1 ? rest : rest.slice(idx + 1);
90
- }
91
- /**
92
- * True when `target` is absolute in its own right — rooted, drive-rooted, or schemed.
93
- *
94
- * Exported because `node:path`'s `isAbsolute` cannot answer this question for the web host: it
95
- * knows nothing of `vscode-vfs://`, and on Windows it would reject a rooted POSIX path that is
96
- * perfectly absolute in URI terms. This was the last of Story 1.5's 37 `path.*` call sites, and
97
- * it had to move before `resolveMdIncludes` could follow the rest of the compose logic into core.
98
- *
99
- * ### The drive letter (reported 2026-08-08)
100
- *
101
- * It answered FALSE for `C:\docs\notes.md`, which is as absolute as a path gets. `merge.ts` asks
102
- * this question at both `!md[…]` resolution sites — `isAbsoluteUri(ref) ? ref : resolveUri(base,
103
- * ref)` — so an author on Windows writing an absolute include had it joined onto the project's base
104
- * directory instead, producing `D:/project/C:/docs/notes.md` and an `ENOENT` naming a path nobody
105
- * wrote. On Linux the same include starts with `/` and was always answered correctly, which is why
106
- * only a Windows test run found it.
107
- */
108
- export function isAbsoluteUri(target) {
109
- const t = String(target).replace(/\\/g, '/');
110
- return (t.startsWith('/') ||
111
- /^[a-zA-Z][a-zA-Z0-9+.-]*:\/\//.test(t) ||
112
- DRIVE_ROOT.test(t));
113
- }
114
- export function resolveUri(base, target) {
115
- return isAbsoluteUri(target) ? normalizeUri(target) : joinUri(base, target);
116
- }
117
- export function relativeUri(from, to) {
118
- const a = normalizeUri(from);
119
- const b = normalizeUri(to);
120
- const pa = splitPrefix(a);
121
- const pb = splitPrefix(b);
122
- if (pa.prefix !== pb.prefix)
123
- return b; // different roots — no relative path exists
124
- const fromSeg = pa.rest.split('/').filter((s) => s !== '');
125
- const toSeg = pb.rest.split('/').filter((s) => s !== '');
126
- let i = 0;
127
- while (i < fromSeg.length && i < toSeg.length && fromSeg[i] === toSeg[i])
128
- i += 1;
129
- const up = Array.from({ length: fromSeg.length - i }, () => '..');
130
- return [...up, ...toSeg.slice(i)].join('/');
131
- }
132
- /**
133
- * The escape guard (AC 5). True only when `child` is strictly inside `parent`.
134
- *
135
- * Segment-aware on purpose: a `startsWith` check would accept `rootsibling/x`
136
- * for parent `root` and happily write outside the install target.
137
- */
138
- export function isInsideUri(parent, child) {
139
- const p = normalizeUri(parent);
140
- const c = normalizeUri(child);
141
- const pp = splitPrefix(p);
142
- const pc = splitPrefix(c);
143
- if (pp.prefix !== pc.prefix)
144
- return false;
145
- const pSeg = pp.rest.split('/').filter((s) => s !== '');
146
- const cSeg = pc.rest.split('/').filter((s) => s !== '');
147
- if (cSeg.length <= pSeg.length)
148
- return false;
149
- return pSeg.every((seg, i) => cSeg[i] === seg);
150
- }
151
- //# sourceMappingURL=uriPath.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"uriPath.js","sourceRoot":"","sources":["../src/uriPath.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH;;;;;;;;;GASG;AACH,MAAM,UAAU,GAAG,cAAc,CAAC;AAElC,8FAA8F;AAC9F,SAAS,WAAW,CAAC,GAAW;IAC9B,MAAM,CAAC,GAAG,yCAAyC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IAC9D,IAAI,CAAC;QAAE,OAAO,EAAE,MAAM,EAAE,CAAC,CAAC,CAAC,CAAE,EAAE,IAAI,EAAE,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAE,CAAC,MAAM,CAAC,EAAE,CAAC;IAC/D,gGAAgG;IAChG,iGAAiG;IACjG,6DAA6D;IAC7D,IAAI,UAAU,CAAC,IAAI,CAAC,GAAG,CAAC;QACtB,OAAO,EAAE,MAAM,EAAE,GAAG,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,IAAI,EAAE,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC;IACzD,IAAI,GAAG,CAAC,UAAU,CAAC,GAAG,CAAC;QAAE,OAAO,EAAE,MAAM,EAAE,GAAG,EAAE,IAAI,EAAE,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC;IACpE,OAAO,EAAE,MAAM,EAAE,EAAE,EAAE,IAAI,EAAE,GAAG,EAAE,CAAC;AACnC,CAAC;AAED,SAAS,QAAQ,CACf,QAA2B,EAC3B,iBAA0B;IAE1B,MAAM,GAAG,GAAa,EAAE,CAAC;IACzB,KAAK,MAAM,GAAG,IAAI,QAAQ,EAAE,CAAC;QAC3B,IAAI,GAAG,KAAK,EAAE,IAAI,GAAG,KAAK,GAAG;YAA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