@orkestrel/probe 0.0.11 → 0.0.12
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/bin/main.js +1 -1
- package/dist/bin/main.js.map +1 -1
- package/dist/src/core/index.cjs +36 -1
- package/dist/src/core/index.cjs.map +1 -1
- package/dist/src/core/index.d.cts +99 -53
- package/dist/src/core/index.d.ts +99 -53
- package/dist/src/core/index.js +35 -2
- package/dist/src/core/index.js.map +1 -1
- package/dist/src/server/index.cjs +124 -66
- package/dist/src/server/index.cjs.map +1 -1
- package/dist/src/server/index.d.cts +85 -28
- package/dist/src/server/index.d.ts +85 -28
- package/dist/src/server/index.js +123 -67
- package/dist/src/server/index.js.map +1 -1
- package/package.json +18 -18
|
@@ -17,6 +17,26 @@ import type * as TypeScript from 'typescript';
|
|
|
17
17
|
import { Verdict } from '@orkestrel/probe';
|
|
18
18
|
import type * as VitestNode from 'vitest/node';
|
|
19
19
|
|
|
20
|
+
/**
|
|
21
|
+
* Builds the fresh sibling path a revision's file is written at, preserving the test's resolution
|
|
22
|
+
* directory.
|
|
23
|
+
*
|
|
24
|
+
* @param workspace - The target workspace root
|
|
25
|
+
* @param path - The workspace-relative test path
|
|
26
|
+
* @param revision - The fresh revision identity
|
|
27
|
+
* @returns The absolute sibling path
|
|
28
|
+
*
|
|
29
|
+
* @example
|
|
30
|
+
* ```ts
|
|
31
|
+
* relativeWorkspaceFile(
|
|
32
|
+
* '/srv/checkout',
|
|
33
|
+
* buildRevisionPath('/srv/checkout', 'tmp/probe/greeting.test.ts', '4821-9f0c'),
|
|
34
|
+
* )
|
|
35
|
+
* // 'tmp/probe/greeting.test.probe-4821-9f0c.ts'
|
|
36
|
+
* ```
|
|
37
|
+
*/
|
|
38
|
+
export declare function buildRevisionPath(workspace: string, path: string, revision: string): string;
|
|
39
|
+
|
|
20
40
|
/**
|
|
21
41
|
* Records the listeners one emitter carries for a set of events.
|
|
22
42
|
*
|
|
@@ -52,38 +72,45 @@ export declare function captureListeners(emitter: EventEmitter, events: readonly
|
|
|
52
72
|
export declare function computeDigest(workspace: string, value: unknown): string;
|
|
53
73
|
|
|
54
74
|
/**
|
|
55
|
-
*
|
|
75
|
+
* Normalizes a caught or foreign error into readable text.
|
|
56
76
|
*
|
|
57
|
-
* @param
|
|
58
|
-
* @
|
|
59
|
-
* @param revision - The fresh revision identity
|
|
60
|
-
* @returns An absolute sibling file path
|
|
77
|
+
* @param value - The value to describe
|
|
78
|
+
* @returns Its message when present, or its string representation
|
|
61
79
|
*
|
|
62
80
|
* @example
|
|
63
81
|
* ```ts
|
|
64
|
-
*
|
|
65
|
-
*
|
|
66
|
-
*
|
|
67
|
-
* )
|
|
68
|
-
* // 'tmp/probe/greeting.test.probe-4821-9f0c.ts'
|
|
82
|
+
* describeUnknown(new Error('The lint stage has been destroyed'))
|
|
83
|
+
* // 'The lint stage has been destroyed'
|
|
84
|
+
* describeUnknown(17) // '17'
|
|
69
85
|
* ```
|
|
70
86
|
*/
|
|
71
|
-
export declare function
|
|
87
|
+
export declare function describeUnknown(value: unknown): string;
|
|
72
88
|
|
|
73
89
|
/**
|
|
74
|
-
*
|
|
90
|
+
* Reports whether one path resolves outside the root it is read against.
|
|
75
91
|
*
|
|
76
|
-
* @
|
|
77
|
-
*
|
|
92
|
+
* @remarks
|
|
93
|
+
* Containment decides which paths a claim may reach and which absolute paths a digest may rewrite,
|
|
94
|
+
* so one reading serves every site that asks the question. A target resolving to the root itself is
|
|
95
|
+
* contained, and each caller decides on its own what that empty relative path means for it.
|
|
96
|
+
*
|
|
97
|
+
* The test reads the relative path rather than a string prefix of the root, so a sibling directory
|
|
98
|
+
* whose name begins with the root's own text is outside rather than beneath it. An absolute
|
|
99
|
+
* relative path is the answer a host returns for two paths on different volumes, which no root
|
|
100
|
+
* contains.
|
|
101
|
+
*
|
|
102
|
+
* @param root - The root the target is read against
|
|
103
|
+
* @param target - The path to test, absolute or root-relative
|
|
104
|
+
* @returns True if the target resolves outside the root; false otherwise
|
|
78
105
|
*
|
|
79
106
|
* @example
|
|
80
107
|
* ```ts
|
|
81
|
-
*
|
|
82
|
-
*
|
|
83
|
-
*
|
|
108
|
+
* escapesRoot('/srv/checkout', 'src/core/greeting.ts') // false
|
|
109
|
+
* escapesRoot('/srv/checkout', '../secrets.env') // true
|
|
110
|
+
* escapesRoot('/srv/checkout', '/srv/checkout-backup/secrets.env') // true
|
|
84
111
|
* ```
|
|
85
112
|
*/
|
|
86
|
-
export declare function
|
|
113
|
+
export declare function escapesRoot(root: string, target: string): boolean;
|
|
87
114
|
|
|
88
115
|
/**
|
|
89
116
|
* Names every draft member of a claim-shaped value whose `path` this package's guard refuses.
|
|
@@ -196,9 +223,9 @@ export declare function inferTypeProject(path: string): string;
|
|
|
196
223
|
* ```
|
|
197
224
|
*/
|
|
198
225
|
export declare interface Inspection {
|
|
199
|
-
/**
|
|
226
|
+
/** Holds the candidate drafts and test one stage inspects. */
|
|
200
227
|
readonly subject: Case;
|
|
201
|
-
/**
|
|
228
|
+
/** Holds the claim the subject belongs to. */
|
|
202
229
|
readonly claim: Claim;
|
|
203
230
|
}
|
|
204
231
|
|
|
@@ -248,7 +275,7 @@ export declare interface InspectionOptions {
|
|
|
248
275
|
*
|
|
249
276
|
* @param file - The path whose creation failed
|
|
250
277
|
* @param error - The fault the failed operation raised
|
|
251
|
-
* @returns True
|
|
278
|
+
* @returns True if the fault means the host refuses this name; false otherwise
|
|
252
279
|
*
|
|
253
280
|
* @example
|
|
254
281
|
* ```ts
|
|
@@ -386,7 +413,7 @@ export declare function loadWorkspaceModule(workspace: string, specifier: 'vites
|
|
|
386
413
|
* Reports whether a path is a workspace module Vitest can cache.
|
|
387
414
|
*
|
|
388
415
|
* @param path - The candidate file path
|
|
389
|
-
* @returns True
|
|
416
|
+
* @returns True if the path is a script, TypeScript, Vue, or JSON module; false otherwise
|
|
390
417
|
*
|
|
391
418
|
* @example
|
|
392
419
|
* ```ts
|
|
@@ -544,9 +571,9 @@ export declare class Overlay implements OverlayInterface {
|
|
|
544
571
|
* ```
|
|
545
572
|
*/
|
|
546
573
|
export declare interface OverlayInterface {
|
|
547
|
-
/**
|
|
574
|
+
/** Identifies the candidate set this overlay holds. */
|
|
548
575
|
readonly revision: string;
|
|
549
|
-
/**
|
|
576
|
+
/** Names the absolute path of every candidate this overlay holds. */
|
|
550
577
|
readonly paths: readonly string[];
|
|
551
578
|
/**
|
|
552
579
|
* Records one candidate's text against the absolute path it stands in for.
|
|
@@ -761,6 +788,31 @@ export declare interface ProbeServerInterface {
|
|
|
761
788
|
destroy(): Promise<void>;
|
|
762
789
|
}
|
|
763
790
|
|
|
791
|
+
/**
|
|
792
|
+
* Reads the condition code a native fault carries.
|
|
793
|
+
*
|
|
794
|
+
* @remarks
|
|
795
|
+
* A caller catches `unknown`, so every reading of a caught value's own property calls into code
|
|
796
|
+
* this package does not own: a proxy whose `has` trap throws and a value whose `code` getter throws
|
|
797
|
+
* both arrive here. The read is guarded, so a fault that refuses inspection reports no code rather
|
|
798
|
+
* than raising a second fault over the first. A `code` the host reports as anything other than a
|
|
799
|
+
* string is no code this package compares against, so it reports none either.
|
|
800
|
+
*
|
|
801
|
+
* One reading serves every site that classifies a native fault, so a host condition is admitted the
|
|
802
|
+
* same way wherever it is read.
|
|
803
|
+
*
|
|
804
|
+
* @param error - The caught value to read
|
|
805
|
+
* @returns The fault's `code` when it carries a string one; `undefined` otherwise
|
|
806
|
+
*
|
|
807
|
+
* @example
|
|
808
|
+
* ```ts
|
|
809
|
+
* readFaultCode(Object.assign(new Error('no such file'), { code: 'ENOENT' })) // 'ENOENT'
|
|
810
|
+
* readFaultCode(new Error('the runtime stage was destroyed')) // undefined
|
|
811
|
+
* readFaultCode('ENOENT') // undefined
|
|
812
|
+
* ```
|
|
813
|
+
*/
|
|
814
|
+
export declare function readFaultCode(error: unknown): string | undefined;
|
|
815
|
+
|
|
764
816
|
/**
|
|
765
817
|
* Reads one installed package manifest from the target workspace.
|
|
766
818
|
*
|
|
@@ -942,6 +994,11 @@ export declare function resolveWorkspaceModule(workspace: string, specifier: str
|
|
|
942
994
|
* The runtime overlay leaves bare specifier resolution to Vite: it replaces a bare import only
|
|
943
995
|
* after Vite resolves that import to a covered file. The type stage overlays the declared test
|
|
944
996
|
* path, while this stage executes a generated sibling and overlays only the candidate files.
|
|
997
|
+
* This stage mints its overlay with the default exact-match sensitivity, because it declares no
|
|
998
|
+
* file-name case sensitivity to Vite. A covered path whose spelling an importer wrote differs from
|
|
999
|
+
* the recorded candidate path is therefore served by whatever answers first, and `#misses` reports
|
|
1000
|
+
* it as `The workspace configuration served this module before the runtime overlay` with origin
|
|
1001
|
+
* `workspace` rather than leaving it answered silently.
|
|
945
1002
|
*
|
|
946
1003
|
* Vite retains one unresolved URL for every specification path, so the stage replaces its whole
|
|
947
1004
|
* Vitest service after 64 specifications rather than deleting from each map that service owns. Any
|
|
@@ -1014,10 +1071,10 @@ export declare class RuntimeStage implements StageInterface {
|
|
|
1014
1071
|
* ```
|
|
1015
1072
|
*/
|
|
1016
1073
|
export declare interface StageInterface {
|
|
1017
|
-
/**
|
|
1074
|
+
/** Names the inspection this resident stage performs. */
|
|
1018
1075
|
readonly stage: Stage;
|
|
1019
1076
|
/**
|
|
1020
|
-
*
|
|
1077
|
+
* Reports claimant-owned progress the coordinator compares with its inspection snapshot.
|
|
1021
1078
|
*
|
|
1022
1079
|
* @remarks
|
|
1023
1080
|
* When claimant-owned work is admitted, raise `progress` before awaiting its result. When this
|
|
@@ -1166,9 +1223,9 @@ export declare interface TypeStageInterface extends StageInterface {
|
|
|
1166
1223
|
* ```
|
|
1167
1224
|
*/
|
|
1168
1225
|
export declare interface WorkspaceManifest {
|
|
1169
|
-
/**
|
|
1226
|
+
/** Names the absolute path of the package manifest. */
|
|
1170
1227
|
readonly path: string;
|
|
1171
|
-
/**
|
|
1228
|
+
/** Holds the parsed manifest record. */
|
|
1172
1229
|
readonly contents: Readonly<Record<string, unknown>>;
|
|
1173
1230
|
}
|
|
1174
1231
|
|
|
@@ -17,6 +17,26 @@ import type * as TypeScript from 'typescript';
|
|
|
17
17
|
import { Verdict } from '@orkestrel/probe';
|
|
18
18
|
import type * as VitestNode from 'vitest/node';
|
|
19
19
|
|
|
20
|
+
/**
|
|
21
|
+
* Builds the fresh sibling path a revision's file is written at, preserving the test's resolution
|
|
22
|
+
* directory.
|
|
23
|
+
*
|
|
24
|
+
* @param workspace - The target workspace root
|
|
25
|
+
* @param path - The workspace-relative test path
|
|
26
|
+
* @param revision - The fresh revision identity
|
|
27
|
+
* @returns The absolute sibling path
|
|
28
|
+
*
|
|
29
|
+
* @example
|
|
30
|
+
* ```ts
|
|
31
|
+
* relativeWorkspaceFile(
|
|
32
|
+
* '/srv/checkout',
|
|
33
|
+
* buildRevisionPath('/srv/checkout', 'tmp/probe/greeting.test.ts', '4821-9f0c'),
|
|
34
|
+
* )
|
|
35
|
+
* // 'tmp/probe/greeting.test.probe-4821-9f0c.ts'
|
|
36
|
+
* ```
|
|
37
|
+
*/
|
|
38
|
+
export declare function buildRevisionPath(workspace: string, path: string, revision: string): string;
|
|
39
|
+
|
|
20
40
|
/**
|
|
21
41
|
* Records the listeners one emitter carries for a set of events.
|
|
22
42
|
*
|
|
@@ -52,38 +72,45 @@ export declare function captureListeners(emitter: EventEmitter, events: readonly
|
|
|
52
72
|
export declare function computeDigest(workspace: string, value: unknown): string;
|
|
53
73
|
|
|
54
74
|
/**
|
|
55
|
-
*
|
|
75
|
+
* Normalizes a caught or foreign error into readable text.
|
|
56
76
|
*
|
|
57
|
-
* @param
|
|
58
|
-
* @
|
|
59
|
-
* @param revision - The fresh revision identity
|
|
60
|
-
* @returns An absolute sibling file path
|
|
77
|
+
* @param value - The value to describe
|
|
78
|
+
* @returns Its message when present, or its string representation
|
|
61
79
|
*
|
|
62
80
|
* @example
|
|
63
81
|
* ```ts
|
|
64
|
-
*
|
|
65
|
-
*
|
|
66
|
-
*
|
|
67
|
-
* )
|
|
68
|
-
* // 'tmp/probe/greeting.test.probe-4821-9f0c.ts'
|
|
82
|
+
* describeUnknown(new Error('The lint stage has been destroyed'))
|
|
83
|
+
* // 'The lint stage has been destroyed'
|
|
84
|
+
* describeUnknown(17) // '17'
|
|
69
85
|
* ```
|
|
70
86
|
*/
|
|
71
|
-
export declare function
|
|
87
|
+
export declare function describeUnknown(value: unknown): string;
|
|
72
88
|
|
|
73
89
|
/**
|
|
74
|
-
*
|
|
90
|
+
* Reports whether one path resolves outside the root it is read against.
|
|
75
91
|
*
|
|
76
|
-
* @
|
|
77
|
-
*
|
|
92
|
+
* @remarks
|
|
93
|
+
* Containment decides which paths a claim may reach and which absolute paths a digest may rewrite,
|
|
94
|
+
* so one reading serves every site that asks the question. A target resolving to the root itself is
|
|
95
|
+
* contained, and each caller decides on its own what that empty relative path means for it.
|
|
96
|
+
*
|
|
97
|
+
* The test reads the relative path rather than a string prefix of the root, so a sibling directory
|
|
98
|
+
* whose name begins with the root's own text is outside rather than beneath it. An absolute
|
|
99
|
+
* relative path is the answer a host returns for two paths on different volumes, which no root
|
|
100
|
+
* contains.
|
|
101
|
+
*
|
|
102
|
+
* @param root - The root the target is read against
|
|
103
|
+
* @param target - The path to test, absolute or root-relative
|
|
104
|
+
* @returns True if the target resolves outside the root; false otherwise
|
|
78
105
|
*
|
|
79
106
|
* @example
|
|
80
107
|
* ```ts
|
|
81
|
-
*
|
|
82
|
-
*
|
|
83
|
-
*
|
|
108
|
+
* escapesRoot('/srv/checkout', 'src/core/greeting.ts') // false
|
|
109
|
+
* escapesRoot('/srv/checkout', '../secrets.env') // true
|
|
110
|
+
* escapesRoot('/srv/checkout', '/srv/checkout-backup/secrets.env') // true
|
|
84
111
|
* ```
|
|
85
112
|
*/
|
|
86
|
-
export declare function
|
|
113
|
+
export declare function escapesRoot(root: string, target: string): boolean;
|
|
87
114
|
|
|
88
115
|
/**
|
|
89
116
|
* Names every draft member of a claim-shaped value whose `path` this package's guard refuses.
|
|
@@ -196,9 +223,9 @@ export declare function inferTypeProject(path: string): string;
|
|
|
196
223
|
* ```
|
|
197
224
|
*/
|
|
198
225
|
export declare interface Inspection {
|
|
199
|
-
/**
|
|
226
|
+
/** Holds the candidate drafts and test one stage inspects. */
|
|
200
227
|
readonly subject: Case;
|
|
201
|
-
/**
|
|
228
|
+
/** Holds the claim the subject belongs to. */
|
|
202
229
|
readonly claim: Claim;
|
|
203
230
|
}
|
|
204
231
|
|
|
@@ -248,7 +275,7 @@ export declare interface InspectionOptions {
|
|
|
248
275
|
*
|
|
249
276
|
* @param file - The path whose creation failed
|
|
250
277
|
* @param error - The fault the failed operation raised
|
|
251
|
-
* @returns True
|
|
278
|
+
* @returns True if the fault means the host refuses this name; false otherwise
|
|
252
279
|
*
|
|
253
280
|
* @example
|
|
254
281
|
* ```ts
|
|
@@ -386,7 +413,7 @@ export declare function loadWorkspaceModule(workspace: string, specifier: 'vites
|
|
|
386
413
|
* Reports whether a path is a workspace module Vitest can cache.
|
|
387
414
|
*
|
|
388
415
|
* @param path - The candidate file path
|
|
389
|
-
* @returns True
|
|
416
|
+
* @returns True if the path is a script, TypeScript, Vue, or JSON module; false otherwise
|
|
390
417
|
*
|
|
391
418
|
* @example
|
|
392
419
|
* ```ts
|
|
@@ -544,9 +571,9 @@ export declare class Overlay implements OverlayInterface {
|
|
|
544
571
|
* ```
|
|
545
572
|
*/
|
|
546
573
|
export declare interface OverlayInterface {
|
|
547
|
-
/**
|
|
574
|
+
/** Identifies the candidate set this overlay holds. */
|
|
548
575
|
readonly revision: string;
|
|
549
|
-
/**
|
|
576
|
+
/** Names the absolute path of every candidate this overlay holds. */
|
|
550
577
|
readonly paths: readonly string[];
|
|
551
578
|
/**
|
|
552
579
|
* Records one candidate's text against the absolute path it stands in for.
|
|
@@ -761,6 +788,31 @@ export declare interface ProbeServerInterface {
|
|
|
761
788
|
destroy(): Promise<void>;
|
|
762
789
|
}
|
|
763
790
|
|
|
791
|
+
/**
|
|
792
|
+
* Reads the condition code a native fault carries.
|
|
793
|
+
*
|
|
794
|
+
* @remarks
|
|
795
|
+
* A caller catches `unknown`, so every reading of a caught value's own property calls into code
|
|
796
|
+
* this package does not own: a proxy whose `has` trap throws and a value whose `code` getter throws
|
|
797
|
+
* both arrive here. The read is guarded, so a fault that refuses inspection reports no code rather
|
|
798
|
+
* than raising a second fault over the first. A `code` the host reports as anything other than a
|
|
799
|
+
* string is no code this package compares against, so it reports none either.
|
|
800
|
+
*
|
|
801
|
+
* One reading serves every site that classifies a native fault, so a host condition is admitted the
|
|
802
|
+
* same way wherever it is read.
|
|
803
|
+
*
|
|
804
|
+
* @param error - The caught value to read
|
|
805
|
+
* @returns The fault's `code` when it carries a string one; `undefined` otherwise
|
|
806
|
+
*
|
|
807
|
+
* @example
|
|
808
|
+
* ```ts
|
|
809
|
+
* readFaultCode(Object.assign(new Error('no such file'), { code: 'ENOENT' })) // 'ENOENT'
|
|
810
|
+
* readFaultCode(new Error('the runtime stage was destroyed')) // undefined
|
|
811
|
+
* readFaultCode('ENOENT') // undefined
|
|
812
|
+
* ```
|
|
813
|
+
*/
|
|
814
|
+
export declare function readFaultCode(error: unknown): string | undefined;
|
|
815
|
+
|
|
764
816
|
/**
|
|
765
817
|
* Reads one installed package manifest from the target workspace.
|
|
766
818
|
*
|
|
@@ -942,6 +994,11 @@ export declare function resolveWorkspaceModule(workspace: string, specifier: str
|
|
|
942
994
|
* The runtime overlay leaves bare specifier resolution to Vite: it replaces a bare import only
|
|
943
995
|
* after Vite resolves that import to a covered file. The type stage overlays the declared test
|
|
944
996
|
* path, while this stage executes a generated sibling and overlays only the candidate files.
|
|
997
|
+
* This stage mints its overlay with the default exact-match sensitivity, because it declares no
|
|
998
|
+
* file-name case sensitivity to Vite. A covered path whose spelling an importer wrote differs from
|
|
999
|
+
* the recorded candidate path is therefore served by whatever answers first, and `#misses` reports
|
|
1000
|
+
* it as `The workspace configuration served this module before the runtime overlay` with origin
|
|
1001
|
+
* `workspace` rather than leaving it answered silently.
|
|
945
1002
|
*
|
|
946
1003
|
* Vite retains one unresolved URL for every specification path, so the stage replaces its whole
|
|
947
1004
|
* Vitest service after 64 specifications rather than deleting from each map that service owns. Any
|
|
@@ -1014,10 +1071,10 @@ export declare class RuntimeStage implements StageInterface {
|
|
|
1014
1071
|
* ```
|
|
1015
1072
|
*/
|
|
1016
1073
|
export declare interface StageInterface {
|
|
1017
|
-
/**
|
|
1074
|
+
/** Names the inspection this resident stage performs. */
|
|
1018
1075
|
readonly stage: Stage;
|
|
1019
1076
|
/**
|
|
1020
|
-
*
|
|
1077
|
+
* Reports claimant-owned progress the coordinator compares with its inspection snapshot.
|
|
1021
1078
|
*
|
|
1022
1079
|
* @remarks
|
|
1023
1080
|
* When claimant-owned work is admitted, raise `progress` before awaiting its result. When this
|
|
@@ -1166,9 +1223,9 @@ export declare interface TypeStageInterface extends StageInterface {
|
|
|
1166
1223
|
* ```
|
|
1167
1224
|
*/
|
|
1168
1225
|
export declare interface WorkspaceManifest {
|
|
1169
|
-
/**
|
|
1226
|
+
/** Names the absolute path of the package manifest. */
|
|
1170
1227
|
readonly path: string;
|
|
1171
|
-
/**
|
|
1228
|
+
/** Holds the parsed manifest record. */
|
|
1172
1229
|
readonly contents: Readonly<Record<string, unknown>>;
|
|
1173
1230
|
}
|
|
1174
1231
|
|