@openclaw/fs-safe 0.2.4 → 0.2.6
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/CHANGELOG.md +21 -1
- package/README.md +8 -9
- package/dist/archive-staging.d.ts.map +1 -1
- package/dist/archive-staging.js +12 -1
- package/dist/file-store-boundary.js +2 -2
- package/dist/file-store.d.ts.map +1 -1
- package/dist/file-store.js +6 -5
- package/dist/guarded-mkdir.d.ts.map +1 -1
- package/dist/guarded-mkdir.js +6 -6
- package/dist/json-document-store.d.ts +1 -1
- package/dist/json-document-store.d.ts.map +1 -1
- package/dist/json-document-store.js +5 -3
- package/dist/json-durable-queue.d.ts.map +1 -1
- package/dist/json-durable-queue.js +157 -4
- package/dist/json-stringify.d.ts +2 -0
- package/dist/json-stringify.d.ts.map +1 -0
- package/dist/json-stringify.js +7 -0
- package/dist/json.d.ts.map +1 -1
- package/dist/json.js +3 -2
- package/dist/local-roots.d.ts.map +1 -1
- package/dist/local-roots.js +4 -1
- package/dist/path.d.ts +1 -0
- package/dist/path.d.ts.map +1 -1
- package/dist/path.js +4 -1
- package/dist/permissions.d.ts.map +1 -1
- package/dist/permissions.js +7 -10
- package/dist/pinned-python.d.ts.map +1 -1
- package/dist/pinned-python.js +158 -69
- package/dist/pinned-write.d.ts +3 -1
- package/dist/pinned-write.d.ts.map +1 -1
- package/dist/pinned-write.js +54 -45
- package/dist/root-impl.d.ts.map +1 -1
- package/dist/root-impl.js +6 -2
- package/dist/root-path.js +2 -2
- package/dist/root-paths.js +25 -3
- package/dist/secret-file.d.ts.map +1 -1
- package/dist/secret-file.js +76 -50
- package/dist/secure-file.d.ts.map +1 -1
- package/dist/secure-file.js +3 -1
- package/dist/temp-target.js +1 -1
- package/dist/timing.d.ts.map +1 -1
- package/dist/timing.js +8 -1
- package/docs/index.md +1 -1
- package/docs/json-store.md +3 -1
- package/docs/python-helper.md +3 -3
- package/docs/root.md +5 -6
- package/package.json +4 -4
- package/dist/archive-utils.d.ts +0 -3
- package/dist/archive-utils.d.ts.map +0 -1
- package/dist/archive-utils.js +0 -26
- package/dist/boundary-file-read.d.ts +0 -44
- package/dist/boundary-file-read.d.ts.map +0 -1
- package/dist/boundary-file-read.js +0 -129
- package/dist/boundary-path.d.ts +0 -39
- package/dist/boundary-path.d.ts.map +0 -1
- package/dist/boundary-path.js +0 -598
- package/dist/fs-pinned-path-helper.d.ts +0 -7
- package/dist/fs-pinned-path-helper.d.ts.map +0 -1
- package/dist/fs-pinned-path-helper.js +0 -182
- package/dist/fs-pinned-write-helper.d.ts +0 -21
- package/dist/fs-pinned-write-helper.d.ts.map +0 -1
- package/dist/fs-pinned-write-helper.js +0 -263
- package/dist/hardlink-guards.d.ts +0 -7
- package/dist/hardlink-guards.d.ts.map +0 -1
- package/dist/hardlink-guards.js +0 -30
- package/dist/install-safe-path.d.ts +0 -20
- package/dist/install-safe-path.d.ts.map +0 -1
- package/dist/install-safe-path.js +0 -94
- package/dist/json-file.d.ts +0 -3
- package/dist/json-file.d.ts.map +0 -1
- package/dist/json-file.js +0 -123
- package/dist/json-files.d.ts +0 -20
- package/dist/json-files.d.ts.map +0 -1
- package/dist/json-files.js +0 -153
- package/dist/path-alias-guards.d.ts +0 -19
- package/dist/path-alias-guards.d.ts.map +0 -1
- package/dist/path-alias-guards.js +0 -21
- package/dist/path-guards.d.ts +0 -7
- package/dist/path-guards.d.ts.map +0 -1
- package/dist/path-guards.js +0 -49
- package/dist/path-safety.d.ts +0 -12
- package/dist/path-safety.d.ts.map +0 -1
- package/dist/path-safety.js +0 -50
- package/dist/path-scope.d.ts +0 -2
- package/dist/path-scope.d.ts.map +0 -1
- package/dist/path-scope.js +0 -1
- package/dist/private-file-store.d.ts +0 -60
- package/dist/private-file-store.d.ts.map +0 -1
- package/dist/private-file-store.js +0 -233
- package/dist/safe-open-sync.d.ts +0 -24
- package/dist/safe-open-sync.d.ts.map +0 -1
- package/dist/safe-open-sync.js +0 -71
- package/dist/safe-root.d.ts +0 -123
- package/dist/safe-root.d.ts.map +0 -1
- package/dist/safe-root.js +0 -1060
- package/dist/secure-temp-workspace.d.ts +0 -25
- package/dist/secure-temp-workspace.d.ts.map +0 -1
- package/dist/secure-temp-workspace.js +0 -136
- package/dist/sibling-temp-file.d.ts +0 -16
- package/dist/sibling-temp-file.d.ts.map +0 -1
- package/dist/sibling-temp-file.js +0 -73
- package/dist/sibling-temp-write.d.ts +0 -8
- package/dist/sibling-temp-write.d.ts.map +0 -1
- package/dist/sibling-temp-write.js +0 -40
package/docs/root.md
CHANGED
|
@@ -102,15 +102,14 @@ operations that Node's `fs` API does not expose ergonomically.
|
|
|
102
102
|
```ts
|
|
103
103
|
import { configureFsSafePython } from "@openclaw/fs-safe/config";
|
|
104
104
|
|
|
105
|
-
configureFsSafePython({ mode: "off" }); //
|
|
105
|
+
configureFsSafePython({ mode: "off" }); // disable helper; some writes fail closed
|
|
106
106
|
configureFsSafePython({ mode: "require" }); // fail if fd-relative helper unavailable
|
|
107
107
|
```
|
|
108
108
|
|
|
109
|
-
`auto` is the default. Configure the mode before creating roots.
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
[Python helper policy](python-helper.md) for deployment guidance.
|
|
109
|
+
`auto` is the default. Configure the mode before creating roots. On POSIX,
|
|
110
|
+
write methods that require fd-relative parent commits fail closed without the
|
|
111
|
+
helper. Use `require` when any helper loss should be treated as a deployment
|
|
112
|
+
failure. See [Python helper policy](python-helper.md) for deployment guidance.
|
|
114
113
|
|
|
115
114
|
### Properties
|
|
116
115
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@openclaw/fs-safe",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.6",
|
|
4
4
|
"description": "Capability-style filesystem roots for Node.js apps that handle untrusted relative paths.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -99,7 +99,7 @@
|
|
|
99
99
|
},
|
|
100
100
|
"scripts": {
|
|
101
101
|
"benchmark": "node scripts/benchmark.mjs",
|
|
102
|
-
"build": "tsc -p tsconfig.json",
|
|
102
|
+
"build": "node -e \"require('fs').rmSync('dist',{recursive:true,force:true})\" && tsc -p tsconfig.json",
|
|
103
103
|
"lint:file-size": "node scripts/check-file-size.mjs",
|
|
104
104
|
"lint:fs-boundary": "node scripts/check-fs-boundary-primitives.mjs",
|
|
105
105
|
"prepack": "node scripts/prepack-build.mjs",
|
|
@@ -115,9 +115,9 @@
|
|
|
115
115
|
},
|
|
116
116
|
"devDependencies": {
|
|
117
117
|
"@types/node": "^22.15.19",
|
|
118
|
-
"@vitest/coverage-v8": "
|
|
118
|
+
"@vitest/coverage-v8": "4.1.6",
|
|
119
119
|
"typescript": "^5.8.3",
|
|
120
|
-
"vitest": "^
|
|
120
|
+
"vitest": "^4.1.6"
|
|
121
121
|
},
|
|
122
122
|
"engines": {
|
|
123
123
|
"node": ">=20.11"
|
package/dist/archive-utils.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"archive-utils.d.ts","sourceRoot":"","sources":["../src/archive-utils.ts"],"names":[],"mappings":"AAEA,wBAAsB,WAAW,CAAC,CAAC,EACjC,OAAO,EAAE,OAAO,CAAC,CAAC,CAAC,EACnB,SAAS,EAAE,MAAM,EACjB,KAAK,EAAE,MAAM,GACZ,OAAO,CAAC,CAAC,CAAC,CAiBZ;AAED,wBAAsB,UAAU,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAOnE"}
|
package/dist/archive-utils.js
DELETED
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import fs from "node:fs/promises";
|
|
2
|
-
export async function withTimeout(promise, timeoutMs, label) {
|
|
3
|
-
let timeoutId;
|
|
4
|
-
try {
|
|
5
|
-
return await Promise.race([
|
|
6
|
-
promise,
|
|
7
|
-
new Promise((_, reject) => {
|
|
8
|
-
timeoutId = setTimeout(() => reject(new Error(`${label} timed out after ${timeoutMs}ms`)), timeoutMs);
|
|
9
|
-
}),
|
|
10
|
-
]);
|
|
11
|
-
}
|
|
12
|
-
finally {
|
|
13
|
-
if (timeoutId) {
|
|
14
|
-
clearTimeout(timeoutId);
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
export async function fileExists(filePath) {
|
|
19
|
-
try {
|
|
20
|
-
await fs.stat(filePath);
|
|
21
|
-
return true;
|
|
22
|
-
}
|
|
23
|
-
catch {
|
|
24
|
-
return false;
|
|
25
|
-
}
|
|
26
|
-
}
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
import fs from "node:fs";
|
|
2
|
-
import type { PathAliasPolicy } from "./path-alias-guards.js";
|
|
3
|
-
import { type SafeOpenSyncAllowedType, type SafeOpenSyncFailureReason } from "./safe-open-sync.js";
|
|
4
|
-
type BoundaryReadFs = Pick<typeof fs, "closeSync" | "constants" | "fstatSync" | "lstatSync" | "openSync" | "readFileSync" | "realpathSync">;
|
|
5
|
-
export type BoundaryFileOpenFailureReason = SafeOpenSyncFailureReason | "validation";
|
|
6
|
-
export type BoundaryFileOpenResult = {
|
|
7
|
-
ok: true;
|
|
8
|
-
path: string;
|
|
9
|
-
fd: number;
|
|
10
|
-
stat: fs.Stats;
|
|
11
|
-
rootRealPath: string;
|
|
12
|
-
} | {
|
|
13
|
-
ok: false;
|
|
14
|
-
reason: BoundaryFileOpenFailureReason;
|
|
15
|
-
error?: unknown;
|
|
16
|
-
};
|
|
17
|
-
export type BoundaryFileOpenFailure = Extract<BoundaryFileOpenResult, {
|
|
18
|
-
ok: false;
|
|
19
|
-
}>;
|
|
20
|
-
export type OpenBoundaryFileSyncParams = {
|
|
21
|
-
absolutePath: string;
|
|
22
|
-
rootPath: string;
|
|
23
|
-
boundaryLabel: string;
|
|
24
|
-
rootRealPath?: string;
|
|
25
|
-
maxBytes?: number;
|
|
26
|
-
rejectHardlinks?: boolean;
|
|
27
|
-
allowedType?: SafeOpenSyncAllowedType;
|
|
28
|
-
skipLexicalRootCheck?: boolean;
|
|
29
|
-
ioFs?: BoundaryReadFs;
|
|
30
|
-
};
|
|
31
|
-
export type OpenBoundaryFileParams = OpenBoundaryFileSyncParams & {
|
|
32
|
-
aliasPolicy?: PathAliasPolicy;
|
|
33
|
-
};
|
|
34
|
-
export declare function canUseBoundaryFileOpen(ioFs: typeof fs): boolean;
|
|
35
|
-
export declare function openBoundaryFileSync(params: OpenBoundaryFileSyncParams): BoundaryFileOpenResult;
|
|
36
|
-
export declare function matchBoundaryFileOpenFailure<T>(failure: BoundaryFileOpenFailure, handlers: {
|
|
37
|
-
path?: (failure: BoundaryFileOpenFailure) => T;
|
|
38
|
-
validation?: (failure: BoundaryFileOpenFailure) => T;
|
|
39
|
-
io?: (failure: BoundaryFileOpenFailure) => T;
|
|
40
|
-
fallback: (failure: BoundaryFileOpenFailure) => T;
|
|
41
|
-
}): T;
|
|
42
|
-
export declare function openBoundaryFile(params: OpenBoundaryFileParams): Promise<BoundaryFileOpenResult>;
|
|
43
|
-
export {};
|
|
44
|
-
//# sourceMappingURL=boundary-file-read.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"boundary-file-read.d.ts","sourceRoot":"","sources":["../src/boundary-file-read.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,SAAS,CAAC;AAOzB,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAC9D,OAAO,EAEL,KAAK,uBAAuB,EAC5B,KAAK,yBAAyB,EAC/B,MAAM,qBAAqB,CAAC;AAE7B,KAAK,cAAc,GAAG,IAAI,CACxB,OAAO,EAAE,EACP,WAAW,GACX,WAAW,GACX,WAAW,GACX,WAAW,GACX,UAAU,GACV,cAAc,GACd,cAAc,CACjB,CAAC;AAEF,MAAM,MAAM,6BAA6B,GAAG,yBAAyB,GAAG,YAAY,CAAC;AAErF,MAAM,MAAM,sBAAsB,GAC9B;IA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E,CAAC,OAAO,EAAE,uBAAuB,KAAK,CAAC,CAAC;IAC7C,QAAQ,EAAE,CAAC,OAAO,EAAE,uBAAuB,KAAK,CAAC,CAAC;CACnD,GACA,CAAC,CAUH;AAoDD,wBAAsB,gBAAgB,CACpC,MAAM,EAAE,sBAAsB,GAC7B,OAAO,CAAC,sBAAsB,CAAC,CAsBjC"}
|
|
@@ -1,129 +0,0 @@
|
|
|
1
|
-
import fs from "node:fs";
|
|
2
|
-
import path from "node:path";
|
|
3
|
-
import { resolveBoundaryPath, resolveBoundaryPathSync, } from "./boundary-path.js";
|
|
4
|
-
import { openVerifiedFileSync, } from "./safe-open-sync.js";
|
|
5
|
-
export function canUseBoundaryFileOpen(ioFs) {
|
|
6
|
-
return (typeof ioFs.openSync === "function" &&
|
|
7
|
-
typeof ioFs.closeSync === "function" &&
|
|
8
|
-
typeof ioFs.fstatSync === "function" &&
|
|
9
|
-
typeof ioFs.lstatSync === "function" &&
|
|
10
|
-
typeof ioFs.realpathSync === "function" &&
|
|
11
|
-
typeof ioFs.readFileSync === "function" &&
|
|
12
|
-
typeof ioFs.constants === "object" &&
|
|
13
|
-
ioFs.constants !== null);
|
|
14
|
-
}
|
|
15
|
-
export function openBoundaryFileSync(params) {
|
|
16
|
-
const ioFs = params.ioFs ?? fs;
|
|
17
|
-
const resolved = resolveBoundaryFilePathGeneric({
|
|
18
|
-
absolutePath: params.absolutePath,
|
|
19
|
-
resolve: (absolutePath) => resolveBoundaryPathSync({
|
|
20
|
-
absolutePath,
|
|
21
|
-
rootPath: params.rootPath,
|
|
22
|
-
rootCanonicalPath: params.rootRealPath,
|
|
23
|
-
boundaryLabel: params.boundaryLabel,
|
|
24
|
-
skipLexicalRootCheck: params.skipLexicalRootCheck,
|
|
25
|
-
}),
|
|
26
|
-
});
|
|
27
|
-
if (resolved instanceof Promise) {
|
|
28
|
-
return toBoundaryValidationError(new Error("Unexpected async boundary resolution"));
|
|
29
|
-
}
|
|
30
|
-
return finalizeBoundaryFileOpen({
|
|
31
|
-
resolved,
|
|
32
|
-
maxBytes: params.maxBytes,
|
|
33
|
-
rejectHardlinks: params.rejectHardlinks,
|
|
34
|
-
allowedType: params.allowedType,
|
|
35
|
-
ioFs,
|
|
36
|
-
});
|
|
37
|
-
}
|
|
38
|
-
export function matchBoundaryFileOpenFailure(failure, handlers) {
|
|
39
|
-
switch (failure.reason) {
|
|
40
|
-
case "path":
|
|
41
|
-
return handlers.path ? handlers.path(failure) : handlers.fallback(failure);
|
|
42
|
-
case "validation":
|
|
43
|
-
return handlers.validation ? handlers.validation(failure) : handlers.fallback(failure);
|
|
44
|
-
case "io":
|
|
45
|
-
return handlers.io ? handlers.io(failure) : handlers.fallback(failure);
|
|
46
|
-
}
|
|
47
|
-
return handlers.fallback(failure);
|
|
48
|
-
}
|
|
49
|
-
function openBoundaryFileResolved(params) {
|
|
50
|
-
const opened = openVerifiedFileSync({
|
|
51
|
-
filePath: params.absolutePath,
|
|
52
|
-
resolvedPath: params.resolvedPath,
|
|
53
|
-
rejectHardlinks: params.rejectHardlinks ?? true,
|
|
54
|
-
maxBytes: params.maxBytes,
|
|
55
|
-
allowedType: params.allowedType,
|
|
56
|
-
ioFs: params.ioFs,
|
|
57
|
-
});
|
|
58
|
-
if (!opened.ok) {
|
|
59
|
-
return opened;
|
|
60
|
-
}
|
|
61
|
-
return {
|
|
62
|
-
ok: true,
|
|
63
|
-
path: opened.path,
|
|
64
|
-
fd: opened.fd,
|
|
65
|
-
stat: opened.stat,
|
|
66
|
-
rootRealPath: params.rootRealPath,
|
|
67
|
-
};
|
|
68
|
-
}
|
|
69
|
-
function finalizeBoundaryFileOpen(params) {
|
|
70
|
-
if ("ok" in params.resolved) {
|
|
71
|
-
return params.resolved;
|
|
72
|
-
}
|
|
73
|
-
return openBoundaryFileResolved({
|
|
74
|
-
absolutePath: params.resolved.absolutePath,
|
|
75
|
-
resolvedPath: params.resolved.resolvedPath,
|
|
76
|
-
rootRealPath: params.resolved.rootRealPath,
|
|
77
|
-
maxBytes: params.maxBytes,
|
|
78
|
-
rejectHardlinks: params.rejectHardlinks,
|
|
79
|
-
allowedType: params.allowedType,
|
|
80
|
-
ioFs: params.ioFs,
|
|
81
|
-
});
|
|
82
|
-
}
|
|
83
|
-
export async function openBoundaryFile(params) {
|
|
84
|
-
const ioFs = params.ioFs ?? fs;
|
|
85
|
-
const maybeResolved = resolveBoundaryFilePathGeneric({
|
|
86
|
-
absolutePath: params.absolutePath,
|
|
87
|
-
resolve: (absolutePath) => resolveBoundaryPath({
|
|
88
|
-
absolutePath,
|
|
89
|
-
rootPath: params.rootPath,
|
|
90
|
-
rootCanonicalPath: params.rootRealPath,
|
|
91
|
-
boundaryLabel: params.boundaryLabel,
|
|
92
|
-
policy: params.aliasPolicy,
|
|
93
|
-
skipLexicalRootCheck: params.skipLexicalRootCheck,
|
|
94
|
-
}),
|
|
95
|
-
});
|
|
96
|
-
const resolved = maybeResolved instanceof Promise ? await maybeResolved : maybeResolved;
|
|
97
|
-
return finalizeBoundaryFileOpen({
|
|
98
|
-
resolved,
|
|
99
|
-
maxBytes: params.maxBytes,
|
|
100
|
-
rejectHardlinks: params.rejectHardlinks,
|
|
101
|
-
allowedType: params.allowedType,
|
|
102
|
-
ioFs,
|
|
103
|
-
});
|
|
104
|
-
}
|
|
105
|
-
function toBoundaryValidationError(error) {
|
|
106
|
-
return { ok: false, reason: "validation", error };
|
|
107
|
-
}
|
|
108
|
-
function mapResolvedBoundaryPath(absolutePath, resolved) {
|
|
109
|
-
return {
|
|
110
|
-
absolutePath,
|
|
111
|
-
resolvedPath: resolved.canonicalPath,
|
|
112
|
-
rootRealPath: resolved.rootCanonicalPath,
|
|
113
|
-
};
|
|
114
|
-
}
|
|
115
|
-
function resolveBoundaryFilePathGeneric(params) {
|
|
116
|
-
const absolutePath = path.resolve(params.absolutePath);
|
|
117
|
-
try {
|
|
118
|
-
const resolved = params.resolve(absolutePath);
|
|
119
|
-
if (resolved instanceof Promise) {
|
|
120
|
-
return resolved
|
|
121
|
-
.then((value) => mapResolvedBoundaryPath(absolutePath, value))
|
|
122
|
-
.catch((error) => toBoundaryValidationError(error));
|
|
123
|
-
}
|
|
124
|
-
return mapResolvedBoundaryPath(absolutePath, resolved);
|
|
125
|
-
}
|
|
126
|
-
catch (error) {
|
|
127
|
-
return toBoundaryValidationError(error);
|
|
128
|
-
}
|
|
129
|
-
}
|
package/dist/boundary-path.d.ts
DELETED
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
type BoundaryPathIntent = "read" | "write" | "create" | "delete" | "stat";
|
|
2
|
-
export type BoundaryPathAliasPolicy = {
|
|
3
|
-
allowFinalSymlinkForUnlink?: boolean;
|
|
4
|
-
allowFinalHardlinkForUnlink?: boolean;
|
|
5
|
-
};
|
|
6
|
-
export declare const BOUNDARY_PATH_ALIAS_POLICIES: {
|
|
7
|
-
readonly strict: Readonly<{
|
|
8
|
-
allowFinalSymlinkForUnlink: false;
|
|
9
|
-
allowFinalHardlinkForUnlink: false;
|
|
10
|
-
}>;
|
|
11
|
-
readonly unlinkTarget: Readonly<{
|
|
12
|
-
allowFinalSymlinkForUnlink: true;
|
|
13
|
-
allowFinalHardlinkForUnlink: true;
|
|
14
|
-
}>;
|
|
15
|
-
};
|
|
16
|
-
type ResolveBoundaryPathParams = {
|
|
17
|
-
absolutePath: string;
|
|
18
|
-
rootPath: string;
|
|
19
|
-
boundaryLabel: string;
|
|
20
|
-
intent?: BoundaryPathIntent;
|
|
21
|
-
policy?: BoundaryPathAliasPolicy;
|
|
22
|
-
skipLexicalRootCheck?: boolean;
|
|
23
|
-
rootCanonicalPath?: string;
|
|
24
|
-
};
|
|
25
|
-
type ResolvedBoundaryPathKind = "missing" | "file" | "directory" | "symlink" | "other";
|
|
26
|
-
export type ResolvedBoundaryPath = {
|
|
27
|
-
absolutePath: string;
|
|
28
|
-
canonicalPath: string;
|
|
29
|
-
rootPath: string;
|
|
30
|
-
rootCanonicalPath: string;
|
|
31
|
-
relativePath: string;
|
|
32
|
-
exists: boolean;
|
|
33
|
-
kind: ResolvedBoundaryPathKind;
|
|
34
|
-
};
|
|
35
|
-
export declare function resolveBoundaryPath(params: ResolveBoundaryPathParams): Promise<ResolvedBoundaryPath>;
|
|
36
|
-
export declare function resolveBoundaryPathSync(params: ResolveBoundaryPathParams): ResolvedBoundaryPath;
|
|
37
|
-
export declare function resolvePathViaExistingAncestorSync(targetPath: string): string;
|
|
38
|
-
export {};
|
|
39
|
-
//# sourceMappingURL=boundary-path.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"boundary-path.d.ts","sourceRoot":"","sources":["../src/boundary-path.ts"],"names":[],"mappings":"AAMA,KAAK,kBAAkB,GAAG,MAAM,GAAG,OAAO,GAAG,QAAQ,GAAG,QAAQ,GAAG,MAAM,CAAC;AAE1E,MAAM,MAAM,uBAAuB,GAAG;IACpC,0BAA0B,CAAC,EAAE,OAAO,CAAC;IACrC,2BAA2B,CAAC,EAAE,OAAO,CAAC;CACvC,CAAC;AAEF,eAAO,MAAM,4BAA4B;;;;;;;;;CAS/B,CAAC;AAEX,KAAK,yBAAyB,GAAG;IAC/B,YAAY,EAAE,MAAM,CAAC;IACrB,QAAQ,EAAE,MAAM,CAAC;IACjB,aAAa,EAAE,MAAM,CAAC;IACtB,MAAM,CAAC,EAAE,kBAAkB,CAAC;IAC5B,MAAM,CAAC,EAAE,uBAAuB,CAAC;IACjC,oBAAoB,CAAC,EAAE,OAAO,CAAC;IAC/B,iBAAiB,CAAC,EAAE,MAAM,CAAC;CAC5B,CAAC;AAEF,KAAK,wBAAwB,GAAG,SAAS,GAAG,MAAM,GAAG,WAAW,GAAG,SAAS,GAAG,OAAO,CAAC;AAEvF,MAAM,MAAM,oBAAoB,GAAG;IACjC,YAAY,EAAE,MAAM,CAAC;IACrB,aAAa,EAAE,MAAM,CAAC;IACtB,QAAQ,EAAE,MAAM,CAAC;IACjB,iBAAiB,EAAE,MAAM,CAAC;IAC1B,YAAY,EAAE,MAA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