@smthrs/plan 0.0.0-stage → 1.0.0-rc.13
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 +189 -0
- package/LICENSE +21 -0
- package/README.md +230 -2
- package/THIRD_PARTY_NOTICES.md +48 -0
- package/dist/cjs/CachePolicy.d.ts +131 -0
- package/dist/cjs/CachePolicy.d.ts.map +1 -0
- package/dist/cjs/CachePolicy.js +50 -0
- package/dist/cjs/CachePolicy.js.map +7 -0
- package/dist/cjs/Effects.d.ts +258 -0
- package/dist/cjs/Effects.d.ts.map +1 -0
- package/dist/cjs/Effects.js +76 -0
- package/dist/cjs/Effects.js.map +7 -0
- package/dist/cjs/FileSet.d.ts +366 -0
- package/dist/cjs/FileSet.d.ts.map +1 -0
- package/dist/cjs/FileSet.js +196 -0
- package/dist/cjs/FileSet.js.map +7 -0
- package/dist/cjs/GraphBuildError.d.ts +120 -0
- package/dist/cjs/GraphBuildError.d.ts.map +1 -0
- package/dist/cjs/GraphBuildError.js +71 -0
- package/dist/cjs/GraphBuildError.js.map +7 -0
- package/dist/cjs/KeyMaterial.d.ts +107 -0
- package/dist/cjs/KeyMaterial.d.ts.map +1 -0
- package/dist/cjs/KeyMaterial.js +64 -0
- package/dist/cjs/KeyMaterial.js.map +7 -0
- package/dist/cjs/Node.d.ts +685 -0
- package/dist/cjs/Node.d.ts.map +1 -0
- package/dist/cjs/Node.js +230 -0
- package/dist/cjs/Node.js.map +7 -0
- package/dist/cjs/Placement.d.ts +117 -0
- package/dist/cjs/Placement.d.ts.map +1 -0
- package/dist/cjs/Placement.js +46 -0
- package/dist/cjs/Placement.js.map +7 -0
- package/dist/cjs/Plan.d.ts +489 -0
- package/dist/cjs/Plan.d.ts.map +1 -0
- package/dist/cjs/Plan.js +511 -0
- package/dist/cjs/Plan.js.map +7 -0
- package/dist/cjs/PlanDiff.d.ts +77 -0
- package/dist/cjs/PlanDiff.d.ts.map +1 -0
- package/dist/cjs/PlanDiff.js +149 -0
- package/dist/cjs/PlanDiff.js.map +7 -0
- package/dist/cjs/Planned.d.ts +121 -0
- package/dist/cjs/Planned.d.ts.map +1 -0
- package/dist/cjs/Planned.js +72 -0
- package/dist/cjs/Planned.js.map +7 -0
- package/dist/cjs/Repetition.d.ts +31 -0
- package/dist/cjs/Repetition.d.ts.map +1 -0
- package/dist/cjs/Repetition.js +36 -0
- package/dist/cjs/Repetition.js.map +7 -0
- package/dist/cjs/Scheduling.d.ts +89 -0
- package/dist/cjs/Scheduling.d.ts.map +1 -0
- package/dist/cjs/Scheduling.js +76 -0
- package/dist/cjs/Scheduling.js.map +7 -0
- package/dist/cjs/StepKey.d.ts +354 -0
- package/dist/cjs/StepKey.d.ts.map +1 -0
- package/dist/cjs/StepKey.js +313 -0
- package/dist/cjs/StepKey.js.map +7 -0
- package/dist/cjs/index.d.ts +91 -0
- package/dist/cjs/index.d.ts.map +1 -0
- package/dist/cjs/index.js +59 -0
- package/dist/cjs/index.js.map +7 -0
- package/dist/cjs/internal/ConflictAnnotation.d.ts +59 -0
- package/dist/cjs/internal/ConflictAnnotation.d.ts.map +1 -0
- package/dist/cjs/internal/ConflictAnnotation.js +247 -0
- package/dist/cjs/internal/ConflictAnnotation.js.map +7 -0
- package/dist/cjs/internal/EffectCandidates.d.ts +19 -0
- package/dist/cjs/internal/EffectCandidates.d.ts.map +1 -0
- package/dist/cjs/internal/EffectCandidates.js +92 -0
- package/dist/cjs/internal/EffectCandidates.js.map +7 -0
- package/dist/cjs/internal/JsonMirror.d.ts +34 -0
- package/dist/cjs/internal/JsonMirror.d.ts.map +1 -0
- package/dist/cjs/internal/JsonMirror.js +195 -0
- package/dist/cjs/internal/JsonMirror.js.map +7 -0
- package/dist/cjs/internal/SchemaIdentity.d.ts +140 -0
- package/dist/cjs/internal/SchemaIdentity.d.ts.map +1 -0
- package/dist/cjs/internal/SchemaIdentity.js +718 -0
- package/dist/cjs/internal/SchemaIdentity.js.map +7 -0
- package/dist/cjs/internal/effects.d.ts +245 -0
- package/dist/cjs/internal/effects.d.ts.map +1 -0
- package/dist/cjs/internal/effects.js +290 -0
- package/dist/cjs/internal/effects.js.map +7 -0
- package/dist/cjs/internal/node.d.ts +526 -0
- package/dist/cjs/internal/node.d.ts.map +1 -0
- package/dist/cjs/internal/node.js +313 -0
- package/dist/cjs/internal/node.js.map +7 -0
- package/dist/cjs/package.json +1 -0
- package/dist/cjs/test/PlanFixtures.d.ts +127 -0
- package/dist/cjs/test/PlanFixtures.d.ts.map +1 -0
- package/dist/cjs/test/PlanFixtures.js +59 -0
- package/dist/cjs/test/PlanFixtures.js.map +7 -0
- package/dist/esm/CachePolicy.d.ts +131 -0
- package/dist/esm/CachePolicy.d.ts.map +1 -0
- package/dist/esm/CachePolicy.js +117 -0
- package/dist/esm/CachePolicy.js.map +1 -0
- package/dist/esm/Effects.d.ts +258 -0
- package/dist/esm/Effects.d.ts.map +1 -0
- package/dist/esm/Effects.js +178 -0
- package/dist/esm/Effects.js.map +1 -0
- package/dist/esm/FileSet.d.ts +366 -0
- package/dist/esm/FileSet.d.ts.map +1 -0
- package/dist/esm/FileSet.js +398 -0
- package/dist/esm/FileSet.js.map +1 -0
- package/dist/esm/GraphBuildError.d.ts +120 -0
- package/dist/esm/GraphBuildError.d.ts.map +1 -0
- package/dist/esm/GraphBuildError.js +145 -0
- package/dist/esm/GraphBuildError.js.map +1 -0
- package/dist/esm/KeyMaterial.d.ts +107 -0
- package/dist/esm/KeyMaterial.d.ts.map +1 -0
- package/dist/esm/KeyMaterial.js +92 -0
- package/dist/esm/KeyMaterial.js.map +1 -0
- package/dist/esm/Node.d.ts +685 -0
- package/dist/esm/Node.d.ts.map +1 -0
- package/dist/esm/Node.js +591 -0
- package/dist/esm/Node.js.map +1 -0
- package/dist/esm/Placement.d.ts +117 -0
- package/dist/esm/Placement.d.ts.map +1 -0
- package/dist/esm/Placement.js +65 -0
- package/dist/esm/Placement.js.map +1 -0
- package/dist/esm/Plan.d.ts +489 -0
- package/dist/esm/Plan.d.ts.map +1 -0
- package/dist/esm/Plan.js +718 -0
- package/dist/esm/Plan.js.map +1 -0
- package/dist/esm/PlanDiff.d.ts +77 -0
- package/dist/esm/PlanDiff.d.ts.map +1 -0
- package/dist/esm/PlanDiff.js +205 -0
- package/dist/esm/PlanDiff.js.map +1 -0
- package/dist/esm/Planned.d.ts +121 -0
- package/dist/esm/Planned.d.ts.map +1 -0
- package/dist/esm/Planned.js +147 -0
- package/dist/esm/Planned.js.map +1 -0
- package/dist/esm/Repetition.d.ts +31 -0
- package/dist/esm/Repetition.d.ts.map +1 -0
- package/dist/esm/Repetition.js +24 -0
- package/dist/esm/Repetition.js.map +1 -0
- package/dist/esm/Scheduling.d.ts +89 -0
- package/dist/esm/Scheduling.d.ts.map +1 -0
- package/dist/esm/Scheduling.js +82 -0
- package/dist/esm/Scheduling.js.map +1 -0
- package/dist/esm/StepKey.d.ts +354 -0
- package/dist/esm/StepKey.d.ts.map +1 -0
- package/dist/esm/StepKey.js +503 -0
- package/dist/esm/StepKey.js.map +1 -0
- package/dist/esm/index.d.ts +91 -0
- package/dist/esm/index.d.ts.map +1 -0
- package/dist/esm/index.js +91 -0
- package/dist/esm/index.js.map +1 -0
- package/dist/esm/internal/ConflictAnnotation.d.ts +59 -0
- package/dist/esm/internal/ConflictAnnotation.d.ts.map +1 -0
- package/dist/esm/internal/ConflictAnnotation.js +332 -0
- package/dist/esm/internal/ConflictAnnotation.js.map +1 -0
- package/dist/esm/internal/EffectCandidates.d.ts +19 -0
- package/dist/esm/internal/EffectCandidates.d.ts.map +1 -0
- package/dist/esm/internal/EffectCandidates.js +86 -0
- package/dist/esm/internal/EffectCandidates.js.map +1 -0
- package/dist/esm/internal/JsonMirror.d.ts +34 -0
- package/dist/esm/internal/JsonMirror.d.ts.map +1 -0
- package/dist/esm/internal/JsonMirror.js +204 -0
- package/dist/esm/internal/JsonMirror.js.map +1 -0
- package/dist/esm/internal/SchemaIdentity.d.ts +140 -0
- package/dist/esm/internal/SchemaIdentity.d.ts.map +1 -0
- package/dist/esm/internal/SchemaIdentity.js +1002 -0
- package/dist/esm/internal/SchemaIdentity.js.map +1 -0
- package/dist/esm/internal/effects.d.ts +245 -0
- package/dist/esm/internal/effects.d.ts.map +1 -0
- package/dist/esm/internal/effects.js +459 -0
- package/dist/esm/internal/effects.js.map +1 -0
- package/dist/esm/internal/node.d.ts +526 -0
- package/dist/esm/internal/node.d.ts.map +1 -0
- package/dist/esm/internal/node.js +565 -0
- package/dist/esm/internal/node.js.map +1 -0
- package/dist/esm/test/PlanFixtures.d.ts +127 -0
- package/dist/esm/test/PlanFixtures.d.ts.map +1 -0
- package/dist/esm/test/PlanFixtures.js +60 -0
- package/dist/esm/test/PlanFixtures.js.map +1 -0
- package/docs/README.md +167 -0
- package/docs/api.md +1485 -0
- package/docs/concepts/authoring-ast.md +204 -0
- package/docs/concepts/effects-and-conflicts.md +135 -0
- package/docs/concepts/plan-value.md +168 -0
- package/docs/concepts/step-keys.md +179 -0
- package/docs/guides/author-a-node-graph.md +182 -0
- package/docs/guides/compile-a-plan.md +146 -0
- package/docs/guides/declare-file-effects.md +143 -0
- package/docs/guides/diff-two-plans.md +310 -0
- package/docs/installation.md +75 -0
- package/docs/quickstart.md +128 -0
- package/docs/testing.md +73 -0
- package/docs/troubleshooting.md +314 -0
- package/package.json +255 -3
- package/src/CachePolicy.ts +143 -0
- package/src/Effects.ts +302 -0
- package/src/FileSet.ts +493 -0
- package/src/GraphBuildError.ts +156 -0
- package/src/KeyMaterial.ts +111 -0
- package/src/Node.ts +974 -0
- package/src/Placement.ts +99 -0
- package/src/Plan.ts +911 -0
- package/src/PlanDiff.ts +244 -0
- package/src/Planned.ts +208 -0
- package/src/Repetition.ts +33 -0
- package/src/Scheduling.ts +154 -0
- package/src/StepKey.ts +736 -0
- package/src/index.ts +103 -0
- package/src/internal/ConflictAnnotation.ts +374 -0
- package/src/internal/EffectCandidates.ts +89 -0
- package/src/internal/JsonMirror.ts +255 -0
- package/src/internal/SchemaIdentity.ts +1096 -0
- package/src/internal/effects.ts +543 -0
- package/src/internal/node.ts +859 -0
- package/src/test/PlanFixtures.ts +76 -0
|
@@ -0,0 +1,366 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Static filesystem declaration vocabulary shared by planning and execution.
|
|
3
|
+
*
|
|
4
|
+
* Declared paths use `/` as their canonical separator and normalize Unicode
|
|
5
|
+
* to NFC. Workspace-relative paths reject C0 controls (U+0000 through U+001F)
|
|
6
|
+
* and DEL (U+007F), which name nothing a supported filesystem can open. C1
|
|
7
|
+
* controls (U+0080 through U+009F) remain accepted because those bytes are
|
|
8
|
+
* legal in a POSIX file name.
|
|
9
|
+
*
|
|
10
|
+
* @since 0.1.0
|
|
11
|
+
*/
|
|
12
|
+
import * as Schema from "effect/Schema";
|
|
13
|
+
/**
|
|
14
|
+
* How strictly a declared file set is enforced at the boundary.
|
|
15
|
+
*
|
|
16
|
+
* `hard` rejects undeclared access. `expected` records access for validation
|
|
17
|
+
* after execution without requiring the sandbox to reject it immediately.
|
|
18
|
+
*
|
|
19
|
+
* This is the ONE spelling of the pair. `Plan.NodeEffects.boundaryMode` is this
|
|
20
|
+
* schema and so is `@smthrs/flow`'s `Action.BoundaryMode`; the literal used to
|
|
21
|
+
* be written out in all three places.
|
|
22
|
+
*
|
|
23
|
+
* @category schemas
|
|
24
|
+
* @since 1.0.0-rc.0
|
|
25
|
+
*/
|
|
26
|
+
export declare const BoundaryMode: Schema.Literals<readonly ["hard", "expected"]>;
|
|
27
|
+
/**
|
|
28
|
+
* The value form of {@link BoundaryMode}.
|
|
29
|
+
*
|
|
30
|
+
* @category models
|
|
31
|
+
* @since 1.0.0-rc.0
|
|
32
|
+
*/
|
|
33
|
+
export type BoundaryMode = typeof BoundaryMode.Type;
|
|
34
|
+
/**
|
|
35
|
+
* The canonical spelling of a declared path or pattern: every separator is
|
|
36
|
+
* `/`, and Unicode is normalized to NFC.
|
|
37
|
+
*
|
|
38
|
+
* {@link workspaceRelative} accepts a backslash as a separator, so
|
|
39
|
+
* `dist\same.js` and `dist/same.js` are two spellings of ONE workspace path.
|
|
40
|
+
* Every exact-path comparison in this module goes through this form, because
|
|
41
|
+
* comparing the raw spellings would let the separator alias defeat overlap
|
|
42
|
+
* detection exactly as `.` segments and empty segments would.
|
|
43
|
+
*
|
|
44
|
+
* @category accessors
|
|
45
|
+
* @since 0.1.0
|
|
46
|
+
*/
|
|
47
|
+
export declare const canonical: (path: string) => string;
|
|
48
|
+
/**
|
|
49
|
+
* The {@link canonical} spelling with letter case folded away.
|
|
50
|
+
*
|
|
51
|
+
* A case-insensitive filesystem (default macOS APFS, Windows NTFS) opens
|
|
52
|
+
* `src/A.ts` and `src/a.ts` as one file, so static overlap compares this form:
|
|
53
|
+
* two declarations that differ only in case must serialize. Folding goes
|
|
54
|
+
* through upper case because that mapping is context-free, so it folds each
|
|
55
|
+
* character alone and commutes with splitting a path into segments.
|
|
56
|
+
*
|
|
57
|
+
* @category accessors
|
|
58
|
+
* @since 1.0.0-rc.0
|
|
59
|
+
*/
|
|
60
|
+
export declare const folded: (path: string) => string;
|
|
61
|
+
/**
|
|
62
|
+
* A non-empty workspace-relative path or pattern.
|
|
63
|
+
*
|
|
64
|
+
* Decoding fails with a `SchemaError` when {@link workspaceRelative} refuses
|
|
65
|
+
* the string. A bare `Pattern` in a declaration names one literal path; only a
|
|
66
|
+
* {@link Glob} gives `*` and `**` wildcard meaning.
|
|
67
|
+
*
|
|
68
|
+
* @category schemas
|
|
69
|
+
* @since 0.1.0
|
|
70
|
+
*/
|
|
71
|
+
export declare const Pattern: Schema.NonEmptyString;
|
|
72
|
+
/**
|
|
73
|
+
* Whether a declared path or pattern stays inside the workspace and names it
|
|
74
|
+
* one way only. Refuses absolute paths (POSIX and drive-letter), upward
|
|
75
|
+
* traversal, and the aliasing forms — `.` segments, empty segments — that
|
|
76
|
+
* would let two spellings of one file defeat exact-string overlap detection.
|
|
77
|
+
*
|
|
78
|
+
* C0 controls and DEL are refused as well.
|
|
79
|
+
*
|
|
80
|
+
* @category predicates
|
|
81
|
+
* @since 0.1.0
|
|
82
|
+
*/
|
|
83
|
+
export declare const workspaceRelative: (pattern: string) => boolean;
|
|
84
|
+
/**
|
|
85
|
+
* A Bazel-style file glob: the paths matching any `include` pattern and no
|
|
86
|
+
* `exclude` pattern.
|
|
87
|
+
*
|
|
88
|
+
* In a pattern, `*` matches within one path segment and a `**` segment
|
|
89
|
+
* matches zero or more whole segments. A trailing `**` needs its separator,
|
|
90
|
+
* so `src/**` does not match `src` itself.
|
|
91
|
+
*
|
|
92
|
+
* @category schemas
|
|
93
|
+
* @since 0.1.0
|
|
94
|
+
*/
|
|
95
|
+
export declare const Glob: Schema.TaggedStruct<"Glob", {
|
|
96
|
+
readonly include: Schema.NonEmptyArray<Schema.NonEmptyString>;
|
|
97
|
+
readonly exclude: Schema.optional<Schema.$Array<Schema.NonEmptyString>>;
|
|
98
|
+
}>;
|
|
99
|
+
/**
|
|
100
|
+
* The value form of {@link Glob}.
|
|
101
|
+
*
|
|
102
|
+
* @category models
|
|
103
|
+
* @since 0.1.0
|
|
104
|
+
*/
|
|
105
|
+
export type Glob = typeof Glob.Type;
|
|
106
|
+
/**
|
|
107
|
+
* A directory output captured and replayed as one tree artifact.
|
|
108
|
+
*
|
|
109
|
+
* It covers `path` and every path beneath it, compared in {@link folded}
|
|
110
|
+
* form.
|
|
111
|
+
*
|
|
112
|
+
* @category schemas
|
|
113
|
+
* @since 0.1.0
|
|
114
|
+
*/
|
|
115
|
+
export declare const TreeArtifact: Schema.TaggedStruct<"TreeArtifact", {
|
|
116
|
+
readonly path: Schema.NonEmptyString;
|
|
117
|
+
}>;
|
|
118
|
+
/**
|
|
119
|
+
* The value form of {@link TreeArtifact}.
|
|
120
|
+
*
|
|
121
|
+
* @category models
|
|
122
|
+
* @since 0.1.0
|
|
123
|
+
*/
|
|
124
|
+
export type TreeArtifact = typeof TreeArtifact.Type;
|
|
125
|
+
/**
|
|
126
|
+
* One leaf declaration: a literal path, a {@link Glob}, or a
|
|
127
|
+
* {@link TreeArtifact}. Write sets and filegroups hold entries.
|
|
128
|
+
*
|
|
129
|
+
* @category schemas
|
|
130
|
+
* @since 0.1.0
|
|
131
|
+
*/
|
|
132
|
+
export declare const Entry: Schema.Union<readonly [Schema.NonEmptyString, Schema.TaggedStruct<"Glob", {
|
|
133
|
+
readonly include: Schema.NonEmptyArray<Schema.NonEmptyString>;
|
|
134
|
+
readonly exclude: Schema.optional<Schema.$Array<Schema.NonEmptyString>>;
|
|
135
|
+
}>, Schema.TaggedStruct<"TreeArtifact", {
|
|
136
|
+
readonly path: Schema.NonEmptyString;
|
|
137
|
+
}>]>;
|
|
138
|
+
/**
|
|
139
|
+
* The value form of {@link Entry}.
|
|
140
|
+
*
|
|
141
|
+
* @category models
|
|
142
|
+
* @since 0.1.0
|
|
143
|
+
*/
|
|
144
|
+
export type Entry = typeof Entry.Type;
|
|
145
|
+
/**
|
|
146
|
+
* One leaf declaration valid in a read set: a literal path or a {@link Glob}.
|
|
147
|
+
* A read set cannot name a {@link TreeArtifact}, which is an output form.
|
|
148
|
+
*
|
|
149
|
+
* @category schemas
|
|
150
|
+
* @since 0.1.0
|
|
151
|
+
*/
|
|
152
|
+
export declare const ReadEntry: Schema.Union<readonly [Schema.NonEmptyString, Schema.TaggedStruct<"Glob", {
|
|
153
|
+
readonly include: Schema.NonEmptyArray<Schema.NonEmptyString>;
|
|
154
|
+
readonly exclude: Schema.optional<Schema.$Array<Schema.NonEmptyString>>;
|
|
155
|
+
}>]>;
|
|
156
|
+
/**
|
|
157
|
+
* The value form of {@link ReadEntry}.
|
|
158
|
+
*
|
|
159
|
+
* @category models
|
|
160
|
+
* @since 0.1.0
|
|
161
|
+
*/
|
|
162
|
+
export type ReadEntry = typeof ReadEntry.Type;
|
|
163
|
+
/**
|
|
164
|
+
* A named, reusable list of {@link Entry} declarations.
|
|
165
|
+
*
|
|
166
|
+
* {@link expand} replaces a filegroup with its entries in place before any
|
|
167
|
+
* overlap check or measurement, so the name never reaches the boundary.
|
|
168
|
+
* Filegroups do not nest.
|
|
169
|
+
*
|
|
170
|
+
* @category schemas
|
|
171
|
+
* @since 0.1.0
|
|
172
|
+
*/
|
|
173
|
+
export declare const Filegroup: Schema.TaggedStruct<"Filegroup", {
|
|
174
|
+
readonly name: Schema.NonEmptyString;
|
|
175
|
+
readonly entries: Schema.$Array<Schema.Union<readonly [Schema.NonEmptyString, Schema.TaggedStruct<"Glob", {
|
|
176
|
+
readonly include: Schema.NonEmptyArray<Schema.NonEmptyString>;
|
|
177
|
+
readonly exclude: Schema.optional<Schema.$Array<Schema.NonEmptyString>>;
|
|
178
|
+
}>, Schema.TaggedStruct<"TreeArtifact", {
|
|
179
|
+
readonly path: Schema.NonEmptyString;
|
|
180
|
+
}>]>>;
|
|
181
|
+
}>;
|
|
182
|
+
/**
|
|
183
|
+
* The value form of {@link Filegroup}.
|
|
184
|
+
*
|
|
185
|
+
* @category models
|
|
186
|
+
* @since 0.1.0
|
|
187
|
+
*/
|
|
188
|
+
export type Filegroup = typeof Filegroup.Type;
|
|
189
|
+
/**
|
|
190
|
+
* A {@link Filegroup} restricted to {@link ReadEntry} declarations, for use
|
|
191
|
+
* in a read set. It shares the `"Filegroup"` tag.
|
|
192
|
+
*
|
|
193
|
+
* @category schemas
|
|
194
|
+
* @since 0.1.0
|
|
195
|
+
*/
|
|
196
|
+
export declare const ReadFilegroup: Schema.TaggedStruct<"Filegroup", {
|
|
197
|
+
readonly name: Schema.NonEmptyString;
|
|
198
|
+
readonly entries: Schema.$Array<Schema.Union<readonly [Schema.NonEmptyString, Schema.TaggedStruct<"Glob", {
|
|
199
|
+
readonly include: Schema.NonEmptyArray<Schema.NonEmptyString>;
|
|
200
|
+
readonly exclude: Schema.optional<Schema.$Array<Schema.NonEmptyString>>;
|
|
201
|
+
}>]>>;
|
|
202
|
+
}>;
|
|
203
|
+
/**
|
|
204
|
+
* The value form of {@link ReadFilegroup}.
|
|
205
|
+
*
|
|
206
|
+
* @category models
|
|
207
|
+
* @since 0.1.0
|
|
208
|
+
*/
|
|
209
|
+
export type ReadFilegroup = typeof ReadFilegroup.Type;
|
|
210
|
+
/**
|
|
211
|
+
* Any declaration accepted in a write set: an {@link Entry} or a
|
|
212
|
+
* {@link Filegroup}.
|
|
213
|
+
*
|
|
214
|
+
* @category schemas
|
|
215
|
+
* @since 0.1.0
|
|
216
|
+
*/
|
|
217
|
+
export declare const Declaration: Schema.Union<readonly [Schema.Union<readonly [Schema.NonEmptyString, Schema.TaggedStruct<"Glob", {
|
|
218
|
+
readonly include: Schema.NonEmptyArray<Schema.NonEmptyString>;
|
|
219
|
+
readonly exclude: Schema.optional<Schema.$Array<Schema.NonEmptyString>>;
|
|
220
|
+
}>, Schema.TaggedStruct<"TreeArtifact", {
|
|
221
|
+
readonly path: Schema.NonEmptyString;
|
|
222
|
+
}>]>, Schema.TaggedStruct<"Filegroup", {
|
|
223
|
+
readonly name: Schema.NonEmptyString;
|
|
224
|
+
readonly entries: Schema.$Array<Schema.Union<readonly [Schema.NonEmptyString, Schema.TaggedStruct<"Glob", {
|
|
225
|
+
readonly include: Schema.NonEmptyArray<Schema.NonEmptyString>;
|
|
226
|
+
readonly exclude: Schema.optional<Schema.$Array<Schema.NonEmptyString>>;
|
|
227
|
+
}>, Schema.TaggedStruct<"TreeArtifact", {
|
|
228
|
+
readonly path: Schema.NonEmptyString;
|
|
229
|
+
}>]>>;
|
|
230
|
+
}>]>;
|
|
231
|
+
/**
|
|
232
|
+
* The value form of {@link Declaration}.
|
|
233
|
+
*
|
|
234
|
+
* @category models
|
|
235
|
+
* @since 0.1.0
|
|
236
|
+
*/
|
|
237
|
+
export type Declaration = typeof Declaration.Type;
|
|
238
|
+
/**
|
|
239
|
+
* Any declaration accepted in a read set: a {@link ReadEntry} or a
|
|
240
|
+
* {@link ReadFilegroup}.
|
|
241
|
+
*
|
|
242
|
+
* @category schemas
|
|
243
|
+
* @since 0.1.0
|
|
244
|
+
*/
|
|
245
|
+
export declare const ReadDeclaration: Schema.Union<readonly [Schema.Union<readonly [Schema.NonEmptyString, Schema.TaggedStruct<"Glob", {
|
|
246
|
+
readonly include: Schema.NonEmptyArray<Schema.NonEmptyString>;
|
|
247
|
+
readonly exclude: Schema.optional<Schema.$Array<Schema.NonEmptyString>>;
|
|
248
|
+
}>]>, Schema.TaggedStruct<"Filegroup", {
|
|
249
|
+
readonly name: Schema.NonEmptyString;
|
|
250
|
+
readonly entries: Schema.$Array<Schema.Union<readonly [Schema.NonEmptyString, Schema.TaggedStruct<"Glob", {
|
|
251
|
+
readonly include: Schema.NonEmptyArray<Schema.NonEmptyString>;
|
|
252
|
+
readonly exclude: Schema.optional<Schema.$Array<Schema.NonEmptyString>>;
|
|
253
|
+
}>]>>;
|
|
254
|
+
}>]>;
|
|
255
|
+
/**
|
|
256
|
+
* The value form of {@link ReadDeclaration}.
|
|
257
|
+
*
|
|
258
|
+
* @category models
|
|
259
|
+
* @since 0.1.0
|
|
260
|
+
*/
|
|
261
|
+
export type ReadDeclaration = typeof ReadDeclaration.Type;
|
|
262
|
+
/**
|
|
263
|
+
* Creates a {@link Filegroup}. It does not validate `name` or `entries`;
|
|
264
|
+
* decode through {@link Filegroup} when the input is untrusted.
|
|
265
|
+
*
|
|
266
|
+
* @param name - The filegroup name.
|
|
267
|
+
* @param entries - The entries the filegroup expands to, in order.
|
|
268
|
+
* @returns The filegroup value.
|
|
269
|
+
* @category constructors
|
|
270
|
+
* @since 0.1.0
|
|
271
|
+
*/
|
|
272
|
+
export declare const makeFilegroup: (name: string, entries: ReadonlyArray<Entry>) => Filegroup;
|
|
273
|
+
/**
|
|
274
|
+
* Replaces each {@link Filegroup} with its entries, in place, and keeps every
|
|
275
|
+
* other declaration as it is. Order is preserved and duplicates are kept.
|
|
276
|
+
*
|
|
277
|
+
* @param declarations - Write-set declarations, possibly holding filegroups.
|
|
278
|
+
* @returns The flat list of entries.
|
|
279
|
+
* @category accessors
|
|
280
|
+
* @since 0.1.0
|
|
281
|
+
*/
|
|
282
|
+
export declare const expand: (declarations: ReadonlyArray<Declaration>) => ReadonlyArray<Entry>;
|
|
283
|
+
/**
|
|
284
|
+
* {@link expand} for read sets: replaces each {@link ReadFilegroup} with its
|
|
285
|
+
* entries, in place, preserving order and duplicates.
|
|
286
|
+
*
|
|
287
|
+
* @param declarations - Read-set declarations, possibly holding filegroups.
|
|
288
|
+
* @returns The flat list of read entries.
|
|
289
|
+
* @category accessors
|
|
290
|
+
* @since 0.1.0
|
|
291
|
+
*/
|
|
292
|
+
export declare const expandReads: (declarations: ReadonlyArray<ReadDeclaration>) => ReadonlyArray<ReadEntry>;
|
|
293
|
+
/**
|
|
294
|
+
* Whether a value carries the `"Glob"` tag. It checks only the tag, not the
|
|
295
|
+
* patterns.
|
|
296
|
+
*
|
|
297
|
+
* @param value - Any value.
|
|
298
|
+
* @returns `true` for an object whose `_tag` is `"Glob"`.
|
|
299
|
+
* @category guards
|
|
300
|
+
* @since 0.1.0
|
|
301
|
+
*/
|
|
302
|
+
export declare const isGlob: (value: unknown) => value is Glob;
|
|
303
|
+
/**
|
|
304
|
+
* Whether a value carries the `"TreeArtifact"` tag. It checks only the tag,
|
|
305
|
+
* not the path.
|
|
306
|
+
*
|
|
307
|
+
* @param value - Any value.
|
|
308
|
+
* @returns `true` for an object whose `_tag` is `"TreeArtifact"`.
|
|
309
|
+
* @category guards
|
|
310
|
+
* @since 0.1.0
|
|
311
|
+
*/
|
|
312
|
+
export declare const isTreeArtifact: (value: unknown) => value is TreeArtifact;
|
|
313
|
+
/**
|
|
314
|
+
* Whether `path` matches `pattern` under {@link Glob} wildcard rules.
|
|
315
|
+
*
|
|
316
|
+
* The pattern is read in its {@link canonical} spelling; the path is matched
|
|
317
|
+
* as given, case-sensitively, with `/` as its only separator.
|
|
318
|
+
*
|
|
319
|
+
* @param pattern - A Bazel-style pattern such as `src/*.ts` or `docs/**`.
|
|
320
|
+
* @param path - A workspace-relative path.
|
|
321
|
+
* @returns `true` when the path matches.
|
|
322
|
+
* @category predicates
|
|
323
|
+
* @since 0.1.0
|
|
324
|
+
*/
|
|
325
|
+
export declare const matchesPattern: (pattern: string, path: string) => boolean;
|
|
326
|
+
/**
|
|
327
|
+
* Whether `path` matches some `include` pattern of `glob` and no `exclude`
|
|
328
|
+
* pattern, each tested with {@link matchesPattern}. Case-sensitive.
|
|
329
|
+
*
|
|
330
|
+
* @param glob - The glob to test.
|
|
331
|
+
* @param path - A workspace-relative path.
|
|
332
|
+
* @returns `true` when the glob selects the path.
|
|
333
|
+
* @category predicates
|
|
334
|
+
* @since 0.1.0
|
|
335
|
+
*/
|
|
336
|
+
export declare const matchesGlob: (glob: Glob, path: string) => boolean;
|
|
337
|
+
/**
|
|
338
|
+
* Whether a canonical path is inside a declaration, case-sensitively.
|
|
339
|
+
* Unlike {@link overlaps}, this predicate establishes replay authority.
|
|
340
|
+
*
|
|
341
|
+
* @category predicates
|
|
342
|
+
* @since 1.0.0-rc.0
|
|
343
|
+
*/
|
|
344
|
+
export declare const contains: (entry: Entry, path: string) => boolean;
|
|
345
|
+
/**
|
|
346
|
+
* Conservative static overlap. `true` may over-serialize; `false` proves that
|
|
347
|
+
* no path can belong to both declarations.
|
|
348
|
+
*
|
|
349
|
+
* A plain string is a literal path, even when it contains `*` or `**`, as it
|
|
350
|
+
* is at execution (sandbox admission, capture, removal, and replay); wildcard
|
|
351
|
+
* matching belongs to a Glob.
|
|
352
|
+
*
|
|
353
|
+
* Exact paths and tree roots compare in their
|
|
354
|
+
* {@link folded} form, so separator aliases, canonically equivalent Unicode
|
|
355
|
+
* spellings, and spellings that differ only in letter case overlap. A Glob
|
|
356
|
+
* against an exact path folds its includes and ignores exclusions: an excluded
|
|
357
|
+
* spelling may alias an included spelling on another filesystem. {@link matchesGlob} itself stays case-sensitive and tests the path bytes it
|
|
358
|
+
* is handed; its property suite pins a backslash inside a path segment as
|
|
359
|
+
* literal text, so canonicalizing a measured path before matching is its
|
|
360
|
+
* caller's decision, not this module's.
|
|
361
|
+
*
|
|
362
|
+
* @category predicates
|
|
363
|
+
* @since 0.1.0
|
|
364
|
+
*/
|
|
365
|
+
export declare const overlaps: (left: Entry, right: Entry) => boolean;
|
|
366
|
+
//# sourceMappingURL=FileSet.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FileSet.d.ts","sourceRoot":"","sources":["../../src/FileSet.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,KAAK,MAAM,MAAM,eAAe,CAAA;AAEvC;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,YAAY,gDAAwC,CAAA;AAEjE;;;;;GAKG;AACH,MAAM,MAAM,YAAY,GAAG,OAAO,YAAY,CAAC,IAAI,CAAA;AAEnD;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,SAAS,GAAI,MAAM,MAAM,KAAG,MAAqD,CAAA;AAE9F;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,MAAM,GAAI,MAAM,MAAM,KAAG,MAAwD,CAAA;AAE9F;;;;;;;;;GASG;AACH,eAAO,MAAM,OAAO,uBAKnB,CAAA;AAED;;;;;;;;;;GAUG;AACH,eAAO,MAAM,iBAAiB,GAAI,SAAS,MAAM,KAAG,OAUnD,CAAA;AAED;;;;;;;;;;GAUG;AACH,eAAO,MAAM,IAAI;;;EAGf,CAAA;AAEF;;;;;GAKG;AACH,MAAM,MAAM,IAAI,GAAG,OAAO,IAAI,CAAC,IAAI,CAAA;AAEnC;;;;;;;;GAQG;AACH,eAAO,MAAM,YAAY;;EAEvB,CAAA;AAEF;;;;;GAKG;AACH,MAAM,MAAM,YAAY,GAAG,OAAO,YAAY,CAAC,IAAI,CAAA;AAEnD;;;;;;GAMG;AACH,eAAO,MAAM,KAAK;;;;;IAA8C,CAAA;AAEhE;;;;;GAKG;AACH,MAAM,MAAM,KAAK,GAAG,OAAO,KAAK,CAAC,IAAI,CAAA;AAErC;;;;;;GAMG;AACH,eAAO,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;AACH,eAAO,MAAM,cAAc,GAAI,SAAS,MAAM,EAAE,MAAM,MAAM,KAAG,OAAwC,CAAA;AAEvG;;;;;;;;;GASG;AACH,eAAO,MAAM,WAAW,GAAI,MAAM,IAAI,EAAE,MAAM,MAAM,KAAG,OAEiB,CAAA;AAQxE;;;;;;GAMG;AACH,eAAO,MAAM,QAAQ,GAAI,OAAO,KAAK,EAAE,MAAM,MAAM,KAAG,OAMrD,CAAA;AAMD;;;;;;;;;;;;;;;;;;;GAmBG;AACH,eAAO,MAAM,QAAQ,GAAI,MAAM,KAAK,EAAE,OAAO,KAAK,KAAG,OAepD,CAAA"}
|
|
@@ -0,0 +1,196 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
28
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
+
var FileSet_exports = {};
|
|
30
|
+
__export(FileSet_exports, {
|
|
31
|
+
BoundaryMode: () => BoundaryMode,
|
|
32
|
+
Declaration: () => Declaration,
|
|
33
|
+
Entry: () => Entry,
|
|
34
|
+
Filegroup: () => Filegroup,
|
|
35
|
+
Glob: () => Glob,
|
|
36
|
+
Pattern: () => Pattern,
|
|
37
|
+
ReadDeclaration: () => ReadDeclaration,
|
|
38
|
+
ReadEntry: () => ReadEntry,
|
|
39
|
+
ReadFilegroup: () => ReadFilegroup,
|
|
40
|
+
TreeArtifact: () => TreeArtifact,
|
|
41
|
+
canonical: () => canonical,
|
|
42
|
+
contains: () => contains,
|
|
43
|
+
expand: () => expand,
|
|
44
|
+
expandReads: () => expandReads,
|
|
45
|
+
folded: () => folded,
|
|
46
|
+
isGlob: () => isGlob,
|
|
47
|
+
isTreeArtifact: () => isTreeArtifact,
|
|
48
|
+
makeFilegroup: () => makeFilegroup,
|
|
49
|
+
matchesGlob: () => matchesGlob,
|
|
50
|
+
matchesPattern: () => matchesPattern,
|
|
51
|
+
overlaps: () => overlaps,
|
|
52
|
+
workspaceRelative: () => workspaceRelative
|
|
53
|
+
});
|
|
54
|
+
module.exports = __toCommonJS(FileSet_exports);
|
|
55
|
+
var Schema = __toESM(require("effect/Schema"), 1);
|
|
56
|
+
const BoundaryMode = Schema.Literals(["hard", "expected"]);
|
|
57
|
+
const canonical = (path) => path.replaceAll("\\", "/").normalize("NFC");
|
|
58
|
+
const folded = (path) => canonical(path).toUpperCase().normalize("NFC");
|
|
59
|
+
const Pattern = Schema.NonEmptyString.check(
|
|
60
|
+
Schema.makeFilter(
|
|
61
|
+
(pattern) => workspaceRelative(pattern) || "file patterns must be workspace-relative and cannot traverse upward",
|
|
62
|
+
{ title: "workspaceRelativePattern" }
|
|
63
|
+
)
|
|
64
|
+
);
|
|
65
|
+
const workspaceRelative = (pattern) => {
|
|
66
|
+
for (let index = 0; index < pattern.length; index++) {
|
|
67
|
+
const code = pattern.charCodeAt(index);
|
|
68
|
+
if (code <= 31 || code === 127) return false;
|
|
69
|
+
}
|
|
70
|
+
if (pattern.startsWith("/")) return false;
|
|
71
|
+
const segments = canonical(pattern).split("/");
|
|
72
|
+
if (/^[A-Za-z]:/.test(segments[0]) || segments[0].endsWith(":")) return false;
|
|
73
|
+
return segments.every((segment) => segment !== ".." && segment !== "." && segment !== "");
|
|
74
|
+
};
|
|
75
|
+
const Glob = Schema.TaggedStruct("Glob", {
|
|
76
|
+
include: Schema.NonEmptyArray(Pattern),
|
|
77
|
+
exclude: Schema.optional(Schema.Array(Pattern))
|
|
78
|
+
});
|
|
79
|
+
const TreeArtifact = Schema.TaggedStruct("TreeArtifact", {
|
|
80
|
+
path: Pattern
|
|
81
|
+
});
|
|
82
|
+
const Entry = Schema.Union([Pattern, Glob, TreeArtifact]);
|
|
83
|
+
const ReadEntry = Schema.Union([Pattern, Glob]);
|
|
84
|
+
const Filegroup = Schema.TaggedStruct("Filegroup", {
|
|
85
|
+
name: Schema.NonEmptyString,
|
|
86
|
+
entries: Schema.Array(Entry)
|
|
87
|
+
});
|
|
88
|
+
const ReadFilegroup = Schema.TaggedStruct("Filegroup", {
|
|
89
|
+
name: Schema.NonEmptyString,
|
|
90
|
+
entries: Schema.Array(ReadEntry)
|
|
91
|
+
});
|
|
92
|
+
const Declaration = Schema.Union([Entry, Filegroup]);
|
|
93
|
+
const ReadDeclaration = Schema.Union([ReadEntry, ReadFilegroup]);
|
|
94
|
+
const makeFilegroup = (name, entries) => ({
|
|
95
|
+
_tag: "Filegroup",
|
|
96
|
+
name,
|
|
97
|
+
entries
|
|
98
|
+
});
|
|
99
|
+
const expand = (declarations) => declarations.flatMap(
|
|
100
|
+
(declaration) => typeof declaration !== "string" && declaration._tag === "Filegroup" ? declaration.entries : [declaration]
|
|
101
|
+
);
|
|
102
|
+
const expandReads = (declarations) => declarations.flatMap(
|
|
103
|
+
(declaration) => typeof declaration !== "string" && declaration._tag === "Filegroup" ? declaration.entries : [declaration]
|
|
104
|
+
);
|
|
105
|
+
const isGlob = (value) => typeof value === "object" && value !== null && "_tag" in value && value._tag === "Glob";
|
|
106
|
+
const isTreeArtifact = (value) => typeof value === "object" && value !== null && "_tag" in value && value._tag === "TreeArtifact";
|
|
107
|
+
const literalSearch = (literal) => {
|
|
108
|
+
const fallback = new Uint32Array(literal.length);
|
|
109
|
+
let matched = 0;
|
|
110
|
+
for (let index = 1; index < literal.length; index++) {
|
|
111
|
+
while (matched > 0 && literal[index] !== literal[matched]) matched = fallback[matched - 1];
|
|
112
|
+
if (literal[index] === literal[matched]) matched++;
|
|
113
|
+
fallback[index] = matched;
|
|
114
|
+
}
|
|
115
|
+
return (path, start, end) => {
|
|
116
|
+
let matched2 = 0;
|
|
117
|
+
for (let index = start; index < end; index++) {
|
|
118
|
+
while (matched2 > 0 && path[index] !== literal[matched2]) matched2 = fallback[matched2 - 1];
|
|
119
|
+
if (path[index] === literal[matched2]) matched2++;
|
|
120
|
+
if (matched2 === literal.length) return index + 1;
|
|
121
|
+
}
|
|
122
|
+
return -1;
|
|
123
|
+
};
|
|
124
|
+
};
|
|
125
|
+
const segmentMatcher = (segment) => {
|
|
126
|
+
const chunks = segment.split(/\*+/);
|
|
127
|
+
const prefix = chunks.shift();
|
|
128
|
+
if (chunks.length === 0) return (path) => path === prefix;
|
|
129
|
+
const suffix = chunks.pop();
|
|
130
|
+
const searches = chunks.map(literalSearch);
|
|
131
|
+
return (path) => {
|
|
132
|
+
const end = path.length - suffix.length;
|
|
133
|
+
if (prefix.length > end || !path.startsWith(prefix) || !path.endsWith(suffix)) return false;
|
|
134
|
+
let position = prefix.length;
|
|
135
|
+
for (const search of searches) {
|
|
136
|
+
position = search(path, position, end);
|
|
137
|
+
if (position === -1) return false;
|
|
138
|
+
}
|
|
139
|
+
return true;
|
|
140
|
+
};
|
|
141
|
+
};
|
|
142
|
+
const patternMatchers = /* @__PURE__ */ new Map();
|
|
143
|
+
const patternMatcher = (pattern) => {
|
|
144
|
+
const key = canonical(pattern);
|
|
145
|
+
const cached = patternMatchers.get(key);
|
|
146
|
+
if (cached !== void 0) return cached;
|
|
147
|
+
const segments = key.split("/").map((segment) => segment === "**" ? void 0 : segmentMatcher(segment));
|
|
148
|
+
const matcher = (path) => {
|
|
149
|
+
const parts = path.split("/");
|
|
150
|
+
let next = new Uint8Array(parts.length + 1);
|
|
151
|
+
next[parts.length] = 1;
|
|
152
|
+
for (let index = segments.length - 1; index >= 0; index--) {
|
|
153
|
+
const segment = segments[index];
|
|
154
|
+
const current = new Uint8Array(parts.length + 1);
|
|
155
|
+
for (let part = parts.length - 1; part >= 0; part--) {
|
|
156
|
+
current[part] = segment === void 0 ? Number(
|
|
157
|
+
index === segments.length - 1 || next[part] === 1 || parts[part] !== "" && current[part + 1] === 1
|
|
158
|
+
) : Number(next[part + 1] === 1 && segment(parts[part]));
|
|
159
|
+
}
|
|
160
|
+
next = current;
|
|
161
|
+
}
|
|
162
|
+
return next[0] === 1;
|
|
163
|
+
};
|
|
164
|
+
patternMatchers.set(key, matcher);
|
|
165
|
+
return matcher;
|
|
166
|
+
};
|
|
167
|
+
const matchesPattern = (pattern, path) => patternMatcher(pattern)(path);
|
|
168
|
+
const matchesGlob = (glob, path) => glob.include.some((pattern) => matchesPattern(pattern, path)) && !(glob.exclude ?? []).some((pattern) => matchesPattern(pattern, path));
|
|
169
|
+
const beneath = (tree, path) => {
|
|
170
|
+
const root = folded(tree);
|
|
171
|
+
const inside = folded(path);
|
|
172
|
+
return inside === root || inside.startsWith(`${root}/`);
|
|
173
|
+
};
|
|
174
|
+
const contains = (entry, path) => {
|
|
175
|
+
const inside = canonical(path);
|
|
176
|
+
if (typeof entry === "string") return canonical(entry) === inside;
|
|
177
|
+
if (isGlob(entry)) return matchesGlob(entry, inside);
|
|
178
|
+
const root = canonical(entry.path);
|
|
179
|
+
return inside === root || inside.startsWith(`${root}/`);
|
|
180
|
+
};
|
|
181
|
+
const mayMatchGlob = (glob, path) => glob.include.some((pattern) => matchesPattern(folded(pattern), folded(path)));
|
|
182
|
+
const overlaps = (left, right) => {
|
|
183
|
+
if (typeof left === "string" && typeof right === "string") return folded(left) === folded(right);
|
|
184
|
+
if (typeof left === "string" && isGlob(right)) return mayMatchGlob(right, left);
|
|
185
|
+
if (isGlob(left) && typeof right === "string") return mayMatchGlob(left, right);
|
|
186
|
+
if (isGlob(left) && isGlob(right)) return true;
|
|
187
|
+
if (isTreeArtifact(left) && typeof right === "string") return beneath(left.path, right);
|
|
188
|
+
if (typeof left === "string" && isTreeArtifact(right)) return beneath(right.path, left);
|
|
189
|
+
if (isTreeArtifact(left) && isTreeArtifact(right)) {
|
|
190
|
+
return beneath(left.path, right.path) || beneath(right.path, left.path);
|
|
191
|
+
}
|
|
192
|
+
if (isTreeArtifact(left) && isGlob(right)) return true;
|
|
193
|
+
if (isGlob(left) && isTreeArtifact(right)) return overlaps(right, left);
|
|
194
|
+
return true;
|
|
195
|
+
};
|
|
196
|
+
//# sourceMappingURL=FileSet.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/FileSet.ts"],
|
|
4
|
+
"sourcesContent": ["/**\n * Static filesystem declaration vocabulary shared by planning and execution.\n *\n * Declared paths use `/` as their canonical separator and normalize Unicode\n * to NFC. Workspace-relative paths reject C0 controls (U+0000 through U+001F)\n * and DEL (U+007F), which name nothing a supported filesystem can open. C1\n * controls (U+0080 through U+009F) remain accepted because those bytes are\n * legal in a POSIX file name.\n *\n * @since 0.1.0\n */\n\nimport * as Schema from \"effect/Schema\"\n\n/**\n * How strictly a declared file set is enforced at the boundary.\n *\n * `hard` rejects undeclared access. `expected` records access for validation\n * after execution without requiring the sandbox to reject it immediately.\n *\n * This is the ONE spelling of the pair. `Plan.NodeEffects.boundaryMode` is this\n * schema and so is `@smthrs/flow`'s `Action.BoundaryMode`; the literal used to\n * be written out in all three places.\n *\n * @category schemas\n * @since 1.0.0-rc.0\n */\nexport const BoundaryMode = Schema.Literals([\"hard\", \"expected\"])\n\n/**\n * The value form of {@link BoundaryMode}.\n *\n * @category models\n * @since 1.0.0-rc.0\n */\nexport type BoundaryMode = typeof BoundaryMode.Type\n\n/**\n * The canonical spelling of a declared path or pattern: every separator is\n * `/`, and Unicode is normalized to NFC.\n *\n * {@link workspaceRelative} accepts a backslash as a separator, so\n * `dist\\same.js` and `dist/same.js` are two spellings of ONE workspace path.\n * Every exact-path comparison in this module goes through this form, because\n * comparing the raw spellings would let the separator alias defeat overlap\n * detection exactly as `.` segments and empty segments would.\n *\n * @category accessors\n * @since 0.1.0\n */\nexport const canonical = (path: string): string => path.replaceAll(\"\\\\\", \"/\").normalize(\"NFC\")\n\n/**\n * The {@link canonical} spelling with letter case folded away.\n *\n * A case-insensitive filesystem (default macOS APFS, Windows NTFS) opens\n * `src/A.ts` and `src/a.ts` as one file, so static overlap compares this form:\n * two declarations that differ only in case must serialize. Folding goes\n * through upper case because that mapping is context-free, so it folds each\n * character alone and commutes with splitting a path into segments.\n *\n * @category accessors\n * @since 1.0.0-rc.0\n */\nexport const folded = (path: string): string => canonical(path).toUpperCase().normalize(\"NFC\")\n\n/**\n * A non-empty workspace-relative path or pattern.\n *\n * Decoding fails with a `SchemaError` when {@link workspaceRelative} refuses\n * the string. A bare `Pattern` in a declaration names one literal path; only a\n * {@link Glob} gives `*` and `**` wildcard meaning.\n *\n * @category schemas\n * @since 0.1.0\n */\nexport const Pattern = Schema.NonEmptyString.check(\n Schema.makeFilter(\n (pattern) => workspaceRelative(pattern) || \"file patterns must be workspace-relative and cannot traverse upward\",\n { title: \"workspaceRelativePattern\" }\n )\n)\n\n/**\n * Whether a declared path or pattern stays inside the workspace and names it\n * one way only. Refuses absolute paths (POSIX and drive-letter), upward\n * traversal, and the aliasing forms \u2014 `.` segments, empty segments \u2014 that\n * would let two spellings of one file defeat exact-string overlap detection.\n *\n * C0 controls and DEL are refused as well.\n *\n * @category predicates\n * @since 0.1.0\n */\nexport const workspaceRelative = (pattern: string): boolean => {\n for (let index = 0; index < pattern.length; index++) {\n const code = pattern.charCodeAt(index)\n if (code <= 0x1f || code === 0x7f) return false\n }\n if (pattern.startsWith(\"/\")) return false\n const segments = canonical(pattern).split(\"/\")\n // `C:foo` is drive-relative on Windows, so any drive-letter prefix escapes.\n if (/^[A-Za-z]:/.test(segments[0]!) || segments[0]!.endsWith(\":\")) return false\n return segments.every((segment) => segment !== \"..\" && segment !== \".\" && segment !== \"\")\n}\n\n/**\n * A Bazel-style file glob: the paths matching any `include` pattern and no\n * `exclude` pattern.\n *\n * In a pattern, `*` matches within one path segment and a `**` segment\n * matches zero or more whole segments. A trailing `**` needs its separator,\n * so `src/**` does not match `src` itself.\n *\n * @category schemas\n * @since 0.1.0\n */\nexport const Glob = Schema.TaggedStruct(\"Glob\", {\n include: Schema.NonEmptyArray(Pattern),\n exclude: Schema.optional(Schema.Array(Pattern))\n})\n\n/**\n * The value form of {@link Glob}.\n *\n * @category models\n * @since 0.1.0\n */\nexport type Glob = typeof Glob.Type\n\n/**\n * A directory output captured and replayed as one tree artifact.\n *\n * It covers `path` and every path beneath it, compared in {@link folded}\n * form.\n *\n * @category schemas\n * @since 0.1.0\n */\nexport const TreeArtifact = Schema.TaggedStruct(\"TreeArtifact\", {\n path: Pattern\n})\n\n/**\n * The value form of {@link TreeArtifact}.\n *\n * @category models\n * @since 0.1.0\n */\nexport type TreeArtifact = typeof TreeArtifact.Type\n\n/**\n * One leaf declaration: a literal path, a {@link Glob}, or a\n * {@link TreeArtifact}. Write sets and filegroups hold entries.\n *\n * @category schemas\n * @since 0.1.0\n */\nexport const Entry = Schema.Union([Pattern, Glob, TreeArtifact])\n\n/**\n * The value form of {@link Entry}.\n *\n * @category models\n * @since 0.1.0\n */\nexport type Entry = typeof Entry.Type\n\n/**\n * One leaf declaration valid in a read set: a literal path or a {@link Glob}.\n * A read set cannot name a {@link TreeArtifact}, which is an output form.\n *\n * @category schemas\n * @since 0.1.0\n */\nexport const ReadEntry = Schema.Union([Pattern, Glob])\n\n/**\n * The value form of {@link ReadEntry}.\n *\n * @category models\n * @since 0.1.0\n */\nexport type ReadEntry = typeof ReadEntry.Type\n\n/**\n * A named, reusable list of {@link Entry} declarations.\n *\n * {@link expand} replaces a filegroup with its entries in place before any\n * overlap check or measurement, so the name never reaches the boundary.\n * Filegroups do not nest.\n *\n * @category schemas\n * @since 0.1.0\n */\nexport const Filegroup = Schema.TaggedStruct(\"Filegroup\", {\n name: Schema.NonEmptyString,\n entries: Schema.Array(Entry)\n})\n\n/**\n * The value form of {@link Filegroup}.\n *\n * @category models\n * @since 0.1.0\n */\nexport type Filegroup = typeof Filegroup.Type\n\n/**\n * A {@link Filegroup} restricted to {@link ReadEntry} declarations, for use\n * in a read set. It shares the `\"Filegroup\"` tag.\n *\n * @category schemas\n * @since 0.1.0\n */\nexport const ReadFilegroup = Schema.TaggedStruct(\"Filegroup\", {\n name: Schema.NonEmptyString,\n entries: Schema.Array(ReadEntry)\n})\n\n/**\n * The value form of {@link ReadFilegroup}.\n *\n * @category models\n * @since 0.1.0\n */\nexport type ReadFilegroup = typeof ReadFilegroup.Type\n\n/**\n * Any declaration accepted in a write set: an {@link Entry} or a\n * {@link Filegroup}.\n *\n * @category schemas\n * @since 0.1.0\n */\nexport const Declaration = Schema.Union([Entry, Filegroup])\n\n/**\n * The value form of {@link Declaration}.\n *\n * @category models\n * @since 0.1.0\n */\nexport type Declaration = typeof Declaration.Type\n\n/**\n * Any declaration accepted in a read set: a {@link ReadEntry} or a\n * {@link ReadFilegroup}.\n *\n * @category schemas\n * @since 0.1.0\n */\nexport const ReadDeclaration = Schema.Union([ReadEntry, ReadFilegroup])\n\n/**\n * The value form of {@link ReadDeclaration}.\n *\n * @category models\n * @since 0.1.0\n */\nexport type ReadDeclaration = typeof ReadDeclaration.Type\n\n/**\n * Creates a {@link Filegroup}. It does not validate `name` or `entries`;\n * decode through {@link Filegroup} when the input is untrusted.\n *\n * @param name - The filegroup name.\n * @param entries - The entries the filegroup expands to, in order.\n * @returns The filegroup value.\n * @category constructors\n * @since 0.1.0\n */\nexport const makeFilegroup = (name: string, entries: ReadonlyArray<Entry>): Filegroup => ({\n _tag: \"Filegroup\",\n name,\n entries\n})\n\n/**\n * Replaces each {@link Filegroup} with its entries, in place, and keeps every\n * other declaration as it is. Order is preserved and duplicates are kept.\n *\n * @param declarations - Write-set declarations, possibly holding filegroups.\n * @returns The flat list of entries.\n * @category accessors\n * @since 0.1.0\n */\nexport const expand = (declarations: ReadonlyArray<Declaration>): ReadonlyArray<Entry> =>\n declarations.flatMap((declaration) =>\n typeof declaration !== \"string\" && declaration._tag === \"Filegroup\" ? declaration.entries : [declaration]\n )\n\n/**\n * {@link expand} for read sets: replaces each {@link ReadFilegroup} with its\n * entries, in place, preserving order and duplicates.\n *\n * @param declarations - Read-set declarations, possibly holding filegroups.\n * @returns The flat list of read entries.\n * @category accessors\n * @since 0.1.0\n */\nexport const expandReads = (declarations: ReadonlyArray<ReadDeclaration>): ReadonlyArray<ReadEntry> =>\n declarations.flatMap((declaration) =>\n typeof declaration !== \"string\" && declaration._tag === \"Filegroup\" ? declaration.entries : [declaration]\n )\n\n/**\n * Whether a value carries the `\"Glob\"` tag. It checks only the tag, not the\n * patterns.\n *\n * @param value - Any value.\n * @returns `true` for an object whose `_tag` is `\"Glob\"`.\n * @category guards\n * @since 0.1.0\n */\nexport const isGlob = (value: unknown): value is Glob =>\n typeof value === \"object\" && value !== null && \"_tag\" in value && value._tag === \"Glob\"\n\n/**\n * Whether a value carries the `\"TreeArtifact\"` tag. It checks only the tag,\n * not the path.\n *\n * @param value - Any value.\n * @returns `true` for an object whose `_tag` is `\"TreeArtifact\"`.\n * @category guards\n * @since 0.1.0\n */\nexport const isTreeArtifact = (value: unknown): value is TreeArtifact =>\n typeof value === \"object\" && value !== null && \"_tag\" in value && value._tag === \"TreeArtifact\"\n\n/** KMP searches a literal without rescanning a long near-matching prefix. */\nconst literalSearch = (literal: string) => {\n const fallback = new Uint32Array(literal.length)\n let matched = 0\n for (let index = 1; index < literal.length; index++) {\n while (matched > 0 && literal[index] !== literal[matched]) matched = fallback[matched - 1]!\n if (literal[index] === literal[matched]) matched++\n fallback[index] = matched\n }\n return (path: string, start: number, end: number): number => {\n let matched = 0\n for (let index = start; index < end; index++) {\n while (matched > 0 && path[index] !== literal[matched]) matched = fallback[matched - 1]!\n if (path[index] === literal[matched]) matched++\n if (matched === literal.length) return index + 1\n }\n return -1\n }\n}\n\n/** Anchored ends and disjoint literal searches make each segment match linear. */\nconst segmentMatcher = (segment: string): (path: string) => boolean => {\n const chunks = segment.split(/\\*+/)\n const prefix = chunks.shift()!\n if (chunks.length === 0) return (path) => path === prefix\n const suffix = chunks.pop()!\n const searches = chunks.map(literalSearch)\n return (path) => {\n const end = path.length - suffix.length\n if (prefix.length > end || !path.startsWith(prefix) || !path.endsWith(suffix)) return false\n let position = prefix.length\n for (const search of searches) {\n position = search(path, position, end)\n if (position === -1) return false\n }\n return true\n }\n}\n\nconst patternMatchers = new Map<string, (path: string) => boolean>()\n\n/** Compile once per canonical spelling; recursive segments use no backtracking. */\nconst patternMatcher = (pattern: string): (path: string) => boolean => {\n const key = canonical(pattern)\n const cached = patternMatchers.get(key)\n if (cached !== undefined) return cached\n const segments = key.split(\"/\").map((segment) => segment === \"**\" ? undefined : segmentMatcher(segment))\n const matcher = (path: string): boolean => {\n const parts = path.split(\"/\")\n // Suffix membership: next[j] says the remaining pattern matches parts[j..].\n // Each pattern/path segment pair is visited once, even with repeated **.\n let next = new Uint8Array(parts.length + 1)\n next[parts.length] = 1\n for (let index = segments.length - 1; index >= 0; index--) {\n const segment = segments[index]\n const current = new Uint8Array(parts.length + 1)\n for (let part = parts.length - 1; part >= 0; part--) {\n current[part] = segment === undefined\n // A trailing ** accepts every remaining code unit. It still needs\n // the separator preceding it: src/** does not match bare src.\n ? Number(\n index === segments.length - 1 || next[part] === 1 ||\n (parts[part] !== \"\" && current[part + 1] === 1)\n )\n : Number(next[part + 1] === 1 && segment(parts[part]!))\n }\n next = current\n }\n return next[0] === 1\n }\n patternMatchers.set(key, matcher)\n return matcher\n}\n\n/**\n * Whether `path` matches `pattern` under {@link Glob} wildcard rules.\n *\n * The pattern is read in its {@link canonical} spelling; the path is matched\n * as given, case-sensitively, with `/` as its only separator.\n *\n * @param pattern - A Bazel-style pattern such as `src/*.ts` or `docs/**`.\n * @param path - A workspace-relative path.\n * @returns `true` when the path matches.\n * @category predicates\n * @since 0.1.0\n */\nexport const matchesPattern = (pattern: string, path: string): boolean => patternMatcher(pattern)(path)\n\n/**\n * Whether `path` matches some `include` pattern of `glob` and no `exclude`\n * pattern, each tested with {@link matchesPattern}. Case-sensitive.\n *\n * @param glob - The glob to test.\n * @param path - A workspace-relative path.\n * @returns `true` when the glob selects the path.\n * @category predicates\n * @since 0.1.0\n */\nexport const matchesGlob = (glob: Glob, path: string): boolean =>\n glob.include.some((pattern) => matchesPattern(pattern, path)) &&\n !(glob.exclude ?? []).some((pattern) => matchesPattern(pattern, path))\n\nconst beneath = (tree: string, path: string): boolean => {\n const root = folded(tree)\n const inside = folded(path)\n return inside === root || inside.startsWith(`${root}/`)\n}\n\n/**\n * Whether a canonical path is inside a declaration, case-sensitively.\n * Unlike {@link overlaps}, this predicate establishes replay authority.\n *\n * @category predicates\n * @since 1.0.0-rc.0\n */\nexport const contains = (entry: Entry, path: string): boolean => {\n const inside = canonical(path)\n if (typeof entry === \"string\") return canonical(entry) === inside\n if (isGlob(entry)) return matchesGlob(entry, inside)\n const root = canonical(entry.path)\n return inside === root || inside.startsWith(`${root}/`)\n}\n\n/** Includes fold conservatively; exclusions cannot rule out all case aliases. */\nconst mayMatchGlob = (glob: Glob, path: string): boolean =>\n glob.include.some((pattern) => matchesPattern(folded(pattern), folded(path)))\n\n/**\n * Conservative static overlap. `true` may over-serialize; `false` proves that\n * no path can belong to both declarations.\n *\n * A plain string is a literal path, even when it contains `*` or `**`, as it\n * is at execution (sandbox admission, capture, removal, and replay); wildcard\n * matching belongs to a Glob.\n *\n * Exact paths and tree roots compare in their\n * {@link folded} form, so separator aliases, canonically equivalent Unicode\n * spellings, and spellings that differ only in letter case overlap. A Glob\n * against an exact path folds its includes and ignores exclusions: an excluded\n * spelling may alias an included spelling on another filesystem. {@link matchesGlob} itself stays case-sensitive and tests the path bytes it\n * is handed; its property suite pins a backslash inside a path segment as\n * literal text, so canonicalizing a measured path before matching is its\n * caller's decision, not this module's.\n *\n * @category predicates\n * @since 0.1.0\n */\nexport const overlaps = (left: Entry, right: Entry): boolean => {\n if (typeof left === \"string\" && typeof right === \"string\") return folded(left) === folded(right)\n if (typeof left === \"string\" && isGlob(right)) return mayMatchGlob(right, left)\n if (isGlob(left) && typeof right === \"string\") return mayMatchGlob(left, right)\n if (isGlob(left) && isGlob(right)) return true\n if (isTreeArtifact(left) && typeof right === \"string\") return beneath(left.path, right)\n if (typeof left === \"string\" && isTreeArtifact(right)) return beneath(right.path, left)\n if (isTreeArtifact(left) && isTreeArtifact(right)) {\n return beneath(left.path, right.path) || beneath(right.path, left.path)\n }\n if (isTreeArtifact(left) && isGlob(right)) return true\n /* v8 ignore else -- the closed Entry union leaves only Glob/TreeArtifact here */\n if (isGlob(left) && isTreeArtifact(right)) return overlaps(right, left)\n /* v8 ignore next -- Entry's closed union makes every pair return above */\n return true\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AA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