crossroom 0.0.0-stage → 0.3.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/README.md +111 -2
- package/dist/LICENSE +209 -0
- package/dist/THIRD-PARTY-NOTICES.md +842 -0
- package/dist/chunk-5TLKYAI3.mjs +66 -0
- package/dist/chunk-7CTZAMHT.mjs +24392 -0
- package/dist/chunk-EIMFGA2U.mjs +10 -0
- package/dist/chunk-GWFVXAVQ.mjs +5315 -0
- package/dist/chunk-J4QPGWFS.mjs +424 -0
- package/dist/chunk-KJTOBYEN.mjs +157 -0
- package/dist/chunk-NAX7L4WR.mjs +60 -0
- package/dist/chunk-NXBBMDR5.mjs +20 -0
- package/dist/chunk-O3GNP4DR.mjs +20245 -0
- package/dist/chunk-P7MSGDOB.mjs +47 -0
- package/dist/chunk-PN2OQIQ5.mjs +157 -0
- package/dist/chunk-UYXRRLXZ.mjs +98 -0
- package/dist/chunk-ZJ3UBXDU.mjs +37368 -0
- package/dist/cli-DIMNWMDE.mjs +121 -0
- package/dist/client-VOJ62D5R.mjs +17086 -0
- package/dist/client-version-2BE42C46.mjs +30 -0
- package/dist/crossroom.mjs +30 -0
- package/dist/discovery-EZAQSANW.mjs +1148 -0
- package/dist/instance-5LWNFMHX.mjs +10 -0
- package/dist/keep-in-account-MEAE6BNO.mjs +147 -0
- package/dist/local-agent-JSROJL7Y.mjs +18 -0
- package/dist/memory-notes-7U7YO23S.mjs +55 -0
- package/dist/node-CRLXXXMX.mjs +2258 -0
- package/dist/node-LUE5WS4G.mjs +20 -0
- package/dist/relay-call-DKXVPYE4.mjs +33 -0
- package/dist/sdk-P6RTMO2C.mjs +49 -0
- package/dist/wait-DMXS3HDV.mjs +21 -0
- package/package.json +53 -4
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { createRequire as __parleyRequire } from 'node:module'; const require = __parleyRequire(import.meta.url);
|
|
2
|
+
|
|
3
|
+
// src/paths.ts
|
|
4
|
+
import { realpathSync } from "node:fs";
|
|
5
|
+
import path from "node:path";
|
|
6
|
+
var gone = (error) => {
|
|
7
|
+
const code = error?.code;
|
|
8
|
+
return code === "ENOENT" || code === "ENOTDIR";
|
|
9
|
+
};
|
|
10
|
+
function canonical(p) {
|
|
11
|
+
try {
|
|
12
|
+
return realpathSync.native(p);
|
|
13
|
+
} catch (error) {
|
|
14
|
+
if (gone(error)) throw error;
|
|
15
|
+
return realpathSync(p);
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
function canonicalPrefix(p) {
|
|
19
|
+
const absolute = path.resolve(p);
|
|
20
|
+
const rest = [];
|
|
21
|
+
let head = absolute;
|
|
22
|
+
for (; ; ) {
|
|
23
|
+
let real;
|
|
24
|
+
try {
|
|
25
|
+
real = canonical(head);
|
|
26
|
+
} catch (error) {
|
|
27
|
+
if (!gone(error)) throw error;
|
|
28
|
+
const parent = path.dirname(head);
|
|
29
|
+
if (parent === head) return absolute;
|
|
30
|
+
rest.unshift(path.basename(head));
|
|
31
|
+
head = parent;
|
|
32
|
+
continue;
|
|
33
|
+
}
|
|
34
|
+
return path.join(real, ...rest);
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
var FOLD = process.platform === "win32";
|
|
38
|
+
function key(p, foldCase) {
|
|
39
|
+
return foldCase ? p.toLowerCase() : p;
|
|
40
|
+
}
|
|
41
|
+
function resolved(p) {
|
|
42
|
+
try {
|
|
43
|
+
return canonicalPrefix(p);
|
|
44
|
+
} catch {
|
|
45
|
+
return path.resolve(p);
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
function contains(parent, child) {
|
|
49
|
+
const relative = path.relative(parent, child);
|
|
50
|
+
return relative === "" || relative !== ".." && !relative.startsWith(".." + path.sep) && !path.isAbsolute(relative);
|
|
51
|
+
}
|
|
52
|
+
function sameLocation(a, b, { foldCase = FOLD } = {}) {
|
|
53
|
+
if (key(path.resolve(a), foldCase) === key(path.resolve(b), foldCase)) return true;
|
|
54
|
+
return key(resolved(a), foldCase) === key(resolved(b), foldCase);
|
|
55
|
+
}
|
|
56
|
+
function insideLocation(child, parent, { foldCase = FOLD } = {}) {
|
|
57
|
+
if (contains(key(path.resolve(parent), foldCase), key(path.resolve(child), foldCase))) return true;
|
|
58
|
+
return contains(key(resolved(parent), foldCase), key(resolved(child), foldCase));
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
export {
|
|
62
|
+
canonical,
|
|
63
|
+
canonicalPrefix,
|
|
64
|
+
sameLocation,
|
|
65
|
+
insideLocation
|
|
66
|
+
};
|