@smthrs/plan 0.0.0-stage → 1.0.0-rc.4

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.
Files changed (199) hide show
  1. package/CHANGELOG.md +183 -0
  2. package/LICENSE +21 -0
  3. package/README.md +228 -2
  4. package/dist/cjs/CachePolicy.d.ts +131 -0
  5. package/dist/cjs/CachePolicy.d.ts.map +1 -0
  6. package/dist/cjs/CachePolicy.js +50 -0
  7. package/dist/cjs/CachePolicy.js.map +7 -0
  8. package/dist/cjs/Effects.d.ts +240 -0
  9. package/dist/cjs/Effects.d.ts.map +1 -0
  10. package/dist/cjs/Effects.js +76 -0
  11. package/dist/cjs/Effects.js.map +7 -0
  12. package/dist/cjs/FileSet.d.ts +288 -0
  13. package/dist/cjs/FileSet.d.ts.map +1 -0
  14. package/dist/cjs/FileSet.js +191 -0
  15. package/dist/cjs/FileSet.js.map +7 -0
  16. package/dist/cjs/GraphBuildError.d.ts +122 -0
  17. package/dist/cjs/GraphBuildError.d.ts.map +1 -0
  18. package/dist/cjs/GraphBuildError.js +71 -0
  19. package/dist/cjs/GraphBuildError.js.map +7 -0
  20. package/dist/cjs/KeyMaterial.d.ts +102 -0
  21. package/dist/cjs/KeyMaterial.d.ts.map +1 -0
  22. package/dist/cjs/KeyMaterial.js +64 -0
  23. package/dist/cjs/KeyMaterial.js.map +7 -0
  24. package/dist/cjs/Node.d.ts +606 -0
  25. package/dist/cjs/Node.d.ts.map +1 -0
  26. package/dist/cjs/Node.js +207 -0
  27. package/dist/cjs/Node.js.map +7 -0
  28. package/dist/cjs/Placement.d.ts +117 -0
  29. package/dist/cjs/Placement.d.ts.map +1 -0
  30. package/dist/cjs/Placement.js +46 -0
  31. package/dist/cjs/Placement.js.map +7 -0
  32. package/dist/cjs/Plan.d.ts +440 -0
  33. package/dist/cjs/Plan.d.ts.map +1 -0
  34. package/dist/cjs/Plan.js +508 -0
  35. package/dist/cjs/Plan.js.map +7 -0
  36. package/dist/cjs/PlanDiff.d.ts +58 -0
  37. package/dist/cjs/PlanDiff.d.ts.map +1 -0
  38. package/dist/cjs/PlanDiff.js +124 -0
  39. package/dist/cjs/PlanDiff.js.map +7 -0
  40. package/dist/cjs/Planned.d.ts +121 -0
  41. package/dist/cjs/Planned.d.ts.map +1 -0
  42. package/dist/cjs/Planned.js +72 -0
  43. package/dist/cjs/Planned.js.map +7 -0
  44. package/dist/cjs/Repetition.d.ts +31 -0
  45. package/dist/cjs/Repetition.d.ts.map +1 -0
  46. package/dist/cjs/Repetition.js +36 -0
  47. package/dist/cjs/Repetition.js.map +7 -0
  48. package/dist/cjs/Scheduling.d.ts +89 -0
  49. package/dist/cjs/Scheduling.d.ts.map +1 -0
  50. package/dist/cjs/Scheduling.js +76 -0
  51. package/dist/cjs/Scheduling.js.map +7 -0
  52. package/dist/cjs/StepKey.d.ts +333 -0
  53. package/dist/cjs/StepKey.d.ts.map +1 -0
  54. package/dist/cjs/StepKey.js +311 -0
  55. package/dist/cjs/StepKey.js.map +7 -0
  56. package/dist/cjs/index.d.ts +91 -0
  57. package/dist/cjs/index.d.ts.map +1 -0
  58. package/dist/cjs/index.js +59 -0
  59. package/dist/cjs/index.js.map +7 -0
  60. package/dist/cjs/internal/ConflictAnnotation.d.ts +59 -0
  61. package/dist/cjs/internal/ConflictAnnotation.d.ts.map +1 -0
  62. package/dist/cjs/internal/ConflictAnnotation.js +247 -0
  63. package/dist/cjs/internal/ConflictAnnotation.js.map +7 -0
  64. package/dist/cjs/internal/EffectCandidates.d.ts +19 -0
  65. package/dist/cjs/internal/EffectCandidates.d.ts.map +1 -0
  66. package/dist/cjs/internal/EffectCandidates.js +92 -0
  67. package/dist/cjs/internal/EffectCandidates.js.map +7 -0
  68. package/dist/cjs/internal/JsonMirror.d.ts +34 -0
  69. package/dist/cjs/internal/JsonMirror.d.ts.map +1 -0
  70. package/dist/cjs/internal/JsonMirror.js +195 -0
  71. package/dist/cjs/internal/JsonMirror.js.map +7 -0
  72. package/dist/cjs/internal/effects.d.ts +245 -0
  73. package/dist/cjs/internal/effects.d.ts.map +1 -0
  74. package/dist/cjs/internal/effects.js +290 -0
  75. package/dist/cjs/internal/effects.js.map +7 -0
  76. package/dist/cjs/internal/node.d.ts +526 -0
  77. package/dist/cjs/internal/node.d.ts.map +1 -0
  78. package/dist/cjs/internal/node.js +312 -0
  79. package/dist/cjs/internal/node.js.map +7 -0
  80. package/dist/cjs/package.json +1 -0
  81. package/dist/cjs/test/PlanFixtures.d.ts +127 -0
  82. package/dist/cjs/test/PlanFixtures.d.ts.map +1 -0
  83. package/dist/cjs/test/PlanFixtures.js +59 -0
  84. package/dist/cjs/test/PlanFixtures.js.map +7 -0
  85. package/dist/esm/CachePolicy.d.ts +131 -0
  86. package/dist/esm/CachePolicy.d.ts.map +1 -0
  87. package/dist/esm/CachePolicy.js +117 -0
  88. package/dist/esm/CachePolicy.js.map +1 -0
  89. package/dist/esm/Effects.d.ts +240 -0
  90. package/dist/esm/Effects.d.ts.map +1 -0
  91. package/dist/esm/Effects.js +167 -0
  92. package/dist/esm/Effects.js.map +1 -0
  93. package/dist/esm/FileSet.d.ts +288 -0
  94. package/dist/esm/FileSet.d.ts.map +1 -0
  95. package/dist/esm/FileSet.js +324 -0
  96. package/dist/esm/FileSet.js.map +1 -0
  97. package/dist/esm/GraphBuildError.d.ts +122 -0
  98. package/dist/esm/GraphBuildError.d.ts.map +1 -0
  99. package/dist/esm/GraphBuildError.js +146 -0
  100. package/dist/esm/GraphBuildError.js.map +1 -0
  101. package/dist/esm/KeyMaterial.d.ts +102 -0
  102. package/dist/esm/KeyMaterial.d.ts.map +1 -0
  103. package/dist/esm/KeyMaterial.js +85 -0
  104. package/dist/esm/KeyMaterial.js.map +1 -0
  105. package/dist/esm/Node.d.ts +606 -0
  106. package/dist/esm/Node.d.ts.map +1 -0
  107. package/dist/esm/Node.js +521 -0
  108. package/dist/esm/Node.js.map +1 -0
  109. package/dist/esm/Placement.d.ts +117 -0
  110. package/dist/esm/Placement.d.ts.map +1 -0
  111. package/dist/esm/Placement.js +65 -0
  112. package/dist/esm/Placement.js.map +1 -0
  113. package/dist/esm/Plan.d.ts +440 -0
  114. package/dist/esm/Plan.d.ts.map +1 -0
  115. package/dist/esm/Plan.js +673 -0
  116. package/dist/esm/Plan.js.map +1 -0
  117. package/dist/esm/PlanDiff.d.ts +58 -0
  118. package/dist/esm/PlanDiff.d.ts.map +1 -0
  119. package/dist/esm/PlanDiff.js +159 -0
  120. package/dist/esm/PlanDiff.js.map +1 -0
  121. package/dist/esm/Planned.d.ts +121 -0
  122. package/dist/esm/Planned.d.ts.map +1 -0
  123. package/dist/esm/Planned.js +147 -0
  124. package/dist/esm/Planned.js.map +1 -0
  125. package/dist/esm/Repetition.d.ts +31 -0
  126. package/dist/esm/Repetition.d.ts.map +1 -0
  127. package/dist/esm/Repetition.js +24 -0
  128. package/dist/esm/Repetition.js.map +1 -0
  129. package/dist/esm/Scheduling.d.ts +89 -0
  130. package/dist/esm/Scheduling.d.ts.map +1 -0
  131. package/dist/esm/Scheduling.js +82 -0
  132. package/dist/esm/Scheduling.js.map +1 -0
  133. package/dist/esm/StepKey.d.ts +333 -0
  134. package/dist/esm/StepKey.d.ts.map +1 -0
  135. package/dist/esm/StepKey.js +478 -0
  136. package/dist/esm/StepKey.js.map +1 -0
  137. package/dist/esm/index.d.ts +91 -0
  138. package/dist/esm/index.d.ts.map +1 -0
  139. package/dist/esm/index.js +91 -0
  140. package/dist/esm/index.js.map +1 -0
  141. package/dist/esm/internal/ConflictAnnotation.d.ts +59 -0
  142. package/dist/esm/internal/ConflictAnnotation.d.ts.map +1 -0
  143. package/dist/esm/internal/ConflictAnnotation.js +332 -0
  144. package/dist/esm/internal/ConflictAnnotation.js.map +1 -0
  145. package/dist/esm/internal/EffectCandidates.d.ts +19 -0
  146. package/dist/esm/internal/EffectCandidates.d.ts.map +1 -0
  147. package/dist/esm/internal/EffectCandidates.js +86 -0
  148. package/dist/esm/internal/EffectCandidates.js.map +1 -0
  149. package/dist/esm/internal/JsonMirror.d.ts +34 -0
  150. package/dist/esm/internal/JsonMirror.d.ts.map +1 -0
  151. package/dist/esm/internal/JsonMirror.js +204 -0
  152. package/dist/esm/internal/JsonMirror.js.map +1 -0
  153. package/dist/esm/internal/effects.d.ts +245 -0
  154. package/dist/esm/internal/effects.d.ts.map +1 -0
  155. package/dist/esm/internal/effects.js +459 -0
  156. package/dist/esm/internal/effects.js.map +1 -0
  157. package/dist/esm/internal/node.d.ts +526 -0
  158. package/dist/esm/internal/node.d.ts.map +1 -0
  159. package/dist/esm/internal/node.js +564 -0
  160. package/dist/esm/internal/node.js.map +1 -0
  161. package/dist/esm/test/PlanFixtures.d.ts +127 -0
  162. package/dist/esm/test/PlanFixtures.d.ts.map +1 -0
  163. package/dist/esm/test/PlanFixtures.js +60 -0
  164. package/dist/esm/test/PlanFixtures.js.map +1 -0
  165. package/docs/README.md +165 -0
  166. package/docs/api.md +1475 -0
  167. package/docs/concepts/authoring-ast.md +203 -0
  168. package/docs/concepts/effects-and-conflicts.md +135 -0
  169. package/docs/concepts/plan-value.md +168 -0
  170. package/docs/concepts/step-keys.md +179 -0
  171. package/docs/guides/author-a-node-graph.md +182 -0
  172. package/docs/guides/compile-a-plan.md +146 -0
  173. package/docs/guides/declare-file-effects.md +143 -0
  174. package/docs/guides/diff-two-plans.md +101 -0
  175. package/docs/installation.md +71 -0
  176. package/docs/quickstart.md +128 -0
  177. package/docs/testing.md +73 -0
  178. package/docs/troubleshooting.md +314 -0
  179. package/package.json +254 -3
  180. package/src/CachePolicy.ts +143 -0
  181. package/src/Effects.ts +284 -0
  182. package/src/FileSet.ts +411 -0
  183. package/src/GraphBuildError.ts +158 -0
  184. package/src/KeyMaterial.ts +106 -0
  185. package/src/Node.ts +871 -0
  186. package/src/Placement.ts +99 -0
  187. package/src/Plan.ts +868 -0
  188. package/src/PlanDiff.ts +199 -0
  189. package/src/Planned.ts +208 -0
  190. package/src/Repetition.ts +33 -0
  191. package/src/Scheduling.ts +154 -0
  192. package/src/StepKey.ts +710 -0
  193. package/src/index.ts +103 -0
  194. package/src/internal/ConflictAnnotation.ts +374 -0
  195. package/src/internal/EffectCandidates.ts +89 -0
  196. package/src/internal/JsonMirror.ts +255 -0
  197. package/src/internal/effects.ts +543 -0
  198. package/src/internal/node.ts +858 -0
  199. package/src/test/PlanFixtures.ts +76 -0
@@ -0,0 +1,86 @@
1
+ /**
2
+ * Rebuildable candidate index for the compiler's existing overlap predicate.
3
+ * Exact paths and tree prefixes share a trie keyed by case-folded segments, the
4
+ * form FileSet.overlaps compares. A plain string is a literal path there, even
5
+ * one holding `*`. Globs stay conservative: their exclusions and pair semantics
6
+ * are decided by FileSet.overlaps, never here.
7
+ * Nothing in this index becomes persisted plan or key material.
8
+ * @since 0.1.0
9
+ * @private
10
+ */
11
+ import * as FileSet from "../FileSet.js";
12
+ const branch = () => ({ children: new Map(), exact: new Set(), trees: new Set() });
13
+ const add = (target, values) => {
14
+ for (const value of values)
15
+ target.add(value);
16
+ };
17
+ /** A Glob has no single trie position, so it stays conservative. */
18
+ const patternLike = (entry) => typeof entry !== "string" && entry._tag === "Glob";
19
+ const ordered = (values) => Array.from(values).sort((left, right) => left - right);
20
+ /**
21
+ * Selects possible producers in declaration order; callers retain the final
22
+ * FileSet.overlaps check for every selected pair.
23
+ * @since 0.1.0
24
+ * @private
25
+ */
26
+ export const make = (produced) => {
27
+ const root = branch();
28
+ const all = new Set();
29
+ const globs = new Set();
30
+ for (let owner = 0; owner < produced.length; owner++) {
31
+ for (const entry of produced[owner]) {
32
+ all.add(owner);
33
+ if (patternLike(entry)) {
34
+ globs.add(owner);
35
+ continue;
36
+ }
37
+ const path = typeof entry === "string" ? entry : entry.path;
38
+ let current = root;
39
+ for (const segment of FileSet.folded(path).split("/")) {
40
+ let child = current.children.get(segment);
41
+ if (child === undefined) {
42
+ child = branch();
43
+ current.children.set(segment, child);
44
+ }
45
+ current = child;
46
+ }
47
+ const owners = typeof entry === "string" ? current.exact : current.trees;
48
+ owners.add(owner);
49
+ }
50
+ }
51
+ return (entries) => {
52
+ const found = new Set();
53
+ for (const entry of entries) {
54
+ // A glob can overlap every other glob/tree; literal matches and
55
+ // exclusions remain the final predicate's responsibility as well.
56
+ if (patternLike(entry))
57
+ return ordered(all);
58
+ add(found, globs);
59
+ const path = typeof entry === "string" ? entry : entry.path;
60
+ let current = root;
61
+ for (const segment of FileSet.folded(path).split("/")) {
62
+ current = current.children.get(segment);
63
+ if (current === undefined)
64
+ break;
65
+ add(found, current.trees);
66
+ }
67
+ if (current === undefined)
68
+ continue;
69
+ add(found, current.exact);
70
+ if (typeof entry === "string")
71
+ continue;
72
+ const stack = Array.from(current.children.values());
73
+ while (stack.length > 0) {
74
+ const descendant = stack.pop();
75
+ add(found, descendant.exact);
76
+ add(found, descendant.trees);
77
+ for (const child of descendant.children.values())
78
+ stack.push(child);
79
+ }
80
+ }
81
+ // Original declaration order controls annotations, conflict precedence,
82
+ // and cycle diagnostics, irrespective of trie or Set traversal order.
83
+ return ordered(found);
84
+ };
85
+ };
86
+ //# sourceMappingURL=EffectCandidates.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"EffectCandidates.js","sourceRoot":"","sources":["../../../src/internal/EffectCandidates.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,KAAK,OAAO,MAAM,eAAe,CAAA;AAQxC,MAAM,MAAM,GAAG,GAAW,EAAE,CAAC,CAAC,EAAE,QAAQ,EAAE,IAAI,GAAG,EAAE,EAAE,KAAK,EAAE,IAAI,GAAG,EAAE,EAAE,KAAK,EAAE,IAAI,GAAG,EAAE,EAAE,CAAC,CAAA;AAC1F,MAAM,GAAG,GAAG,CAAC,MAAmB,EAAE,MAA2B,EAAQ,EAAE;IACrE,KAAK,MAAM,KAAK,IAAI,MAAM;QAAE,MAAM,CAAC,GAAG,CAAC,KAAK,CAAC,CAAA;AAC/C,CAAC,CAAA;AACD,oEAAoE;AACpE,MAAM,WAAW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OAAO,KAAK,KAAK,QAAQ;gBAAE,SAAQ;YACvC,MAAM,KAAK,GAAG,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,MAAM,EAAE,CAAC,CAAA;YACnD,OAAO,KAAK,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;gBACxB,MAAM,UAAU,GAAG,KAAK,CAAC,GAAG,EAAG,CAAA;gBAC/B,GAAG,CAAC,KAAK,EAAE,UAAU,CAAC,KAAK,CAAC,CAAA;gBAC5B,GAAG,CAAC,KAAK,EAAE,UAAU,CAAC,KAAK,CAAC,CAAA;gBAC5B,KAAK,MAAM,KAAK,IAAI,UAAU,CAAC,QAAQ,CAAC,MAAM,EAAE;oBAAE,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,CAAA;YACrE,CAAC;QACH,CAAC;QACD,wEAAwE;QACxE,sEAAsE;QACtE,OAAO,OAAO,CAAC,KAAK,CAAC,CAAA;IACvB,CAAC,CAAA;AACH,CAAC,CAAA","sourcesContent":["/**\n * Rebuildable candidate index for the compiler's existing overlap predicate.\n * Exact paths and tree prefixes share a trie keyed by case-folded segments, the\n * form FileSet.overlaps compares. A plain string is a literal path there, even\n * one holding `*`. Globs stay conservative: their exclusions and pair semantics\n * are decided by FileSet.overlaps, never here.\n * Nothing in this index becomes persisted plan or key material.\n * @since 0.1.0\n * @private\n */\n\nimport * as FileSet from \"../FileSet.ts\"\n\ninterface Branch {\n readonly children: Map<string, Branch>\n readonly exact: Set<number>\n readonly trees: Set<number>\n}\n\nconst branch = (): Branch => ({ children: new Map(), exact: new Set(), trees: new Set() })\nconst add = (target: Set<number>, values: ReadonlySet<number>): void => {\n for (const value of values) target.add(value)\n}\n/** A Glob has no single trie position, so it stays conservative. */\nconst patternLike = (entry: FileSet.Entry): entry is FileSet.Glob => typeof entry !== \"string\" && entry._tag === \"Glob\"\nconst ordered = (values: ReadonlySet<number>): Array<number> => Array.from(values).sort((left, right) => left - right)\n\n/**\n * Selects possible producers in declaration order; callers retain the final\n * FileSet.overlaps check for every selected pair.\n * @since 0.1.0\n * @private\n */\nexport const make = (produced: ReadonlyArray<ReadonlyArray<FileSet.Entry>>) => {\n const root = branch()\n const all = new Set<number>()\n const globs = new Set<number>()\n for (let owner = 0; owner < produced.length; owner++) {\n for (const entry of produced[owner]!) {\n all.add(owner)\n if (patternLike(entry)) {\n globs.add(owner)\n continue\n }\n const path = typeof entry === \"string\" ? entry : entry.path\n let current = root\n for (const segment of FileSet.folded(path).split(\"/\")) {\n let child = current.children.get(segment)\n if (child === undefined) {\n child = branch()\n current.children.set(segment, child)\n }\n current = child\n }\n const owners = typeof entry === \"string\" ? current.exact : current.trees\n owners.add(owner)\n }\n }\n\n return (entries: ReadonlyArray<FileSet.Entry>): ReadonlyArray<number> => {\n const found = new Set<number>()\n for (const entry of entries) {\n // A glob can overlap every other glob/tree; literal matches and\n // exclusions remain the final predicate's responsibility as well.\n if (patternLike(entry)) return ordered(all)\n add(found, globs)\n const path = typeof entry === \"string\" ? entry : entry.path\n let current: Branch | undefined = root\n for (const segment of FileSet.folded(path).split(\"/\")) {\n current = current.children.get(segment)\n if (current === undefined) break\n add(found, current.trees)\n }\n if (current === undefined) continue\n add(found, current.exact)\n if (typeof entry === \"string\") continue\n const stack = Array.from(current.children.values())\n while (stack.length > 0) {\n const descendant = stack.pop()!\n add(found, descendant.exact)\n add(found, descendant.trees)\n for (const child of descendant.children.values()) stack.push(child)\n }\n }\n // Original declaration order controls annotations, conflict precedence,\n // and cycle diagnostics, irrespective of trie or Set traversal order.\n return ordered(found)\n }\n}\n"]}
@@ -0,0 +1,34 @@
1
+ /**
2
+ * The inert JSON mirror of a value: what `JSON.stringify` would see, as data.
3
+ *
4
+ * The AST stores payloads this way, the plan compiler stores key material this
5
+ * way, and a plan diff compares declarations this way, so all three share the
6
+ * one walk. A planned value is the only member with no JSON meaning of its
7
+ * own, and each caller decides what it becomes.
8
+ *
9
+ * @since 0.1.0
10
+ * @private
11
+ */
12
+ import * as Planned from "../Planned.ts";
13
+ /**
14
+ * Clones the JSON mirror of the input, so {@link module:StepKey.content} over
15
+ * the clone and the input produce the same key and the clone holds only inert
16
+ * JSON data. The walk uses an explicit stack, memoizes shared references and
17
+ * cycles, honors callable `toJSON`, omits object members without a JSON
18
+ * representation, and writes `null` for those values in arrays.
19
+ *
20
+ * `toJSON` receives the key canonical serialization passes it: the member
21
+ * name, the array index, or `""` at the root. Its replacement is therefore
22
+ * memoized per source and key, since one shared source may serialize
23
+ * differently at two positions. A source met again inside its own
24
+ * replacement reuses that replacement, so a cycle through `toJSON` clones as
25
+ * a cycle whatever key it recurs at.
26
+ *
27
+ * A planned value becomes whatever `plannedValue` returns for it. Refusals
28
+ * throw a {@link GraphBuildError} naming the member's path.
29
+ *
30
+ * @since 0.1.0
31
+ * @private
32
+ */
33
+ export declare const jsonMirror: (input: unknown, plannedValue: (value: unknown, reference: Planned.Reference) => unknown) => unknown;
34
+ //# sourceMappingURL=JsonMirror.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"JsonMirror.d.ts","sourceRoot":"","sources":["../../../src/internal/JsonMirror.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAGH,OAAO,KAAK,OAAO,MAAM,eAAe,CAAA;AAqFxC;;;;;;;;;;;;;;;;;;;GAmBG;AACH,eAAO,MAAM,UAAU,GACrB,OAAO,OAAO,EACd,cAAc,CAAC,KAAK,EAAE,OAAO,EAAE,SAAS,EAAE,OAAO,CAAC,SAAS,KAAK,OAAO,KACtE,OAqIF,CAAA"}
@@ -0,0 +1,204 @@
1
+ /**
2
+ * The inert JSON mirror of a value: what `JSON.stringify` would see, as data.
3
+ *
4
+ * The AST stores payloads this way, the plan compiler stores key material this
5
+ * way, and a plan diff compares declarations this way, so all three share the
6
+ * one walk. A planned value is the only member with no JSON meaning of its
7
+ * own, and each caller decides what it becomes.
8
+ *
9
+ * @since 0.1.0
10
+ * @private
11
+ */
12
+ import { GraphBuildError } from "../GraphBuildError.js";
13
+ import * as Planned from "../Planned.js";
14
+ /** The chain read outwards, root first: the array the refusals report. */
15
+ const clonePath = (path) => {
16
+ const keys = [];
17
+ for (let current = path; current !== undefined; current = current.parent)
18
+ keys.push(current.key);
19
+ return keys.reverse();
20
+ };
21
+ const payloadError = (at, reason) => {
22
+ const path = clonePath(at);
23
+ return new GraphBuildError({
24
+ code: "invalid_payload",
25
+ node: "payload",
26
+ path,
27
+ message: `Plan payload at ${path.length === 0 ? "$" : `$.${path.join(".")}`} ${reason}`
28
+ });
29
+ };
30
+ const cyclicPayloadError = (at) => {
31
+ const path = clonePath(at);
32
+ return new GraphBuildError({
33
+ code: "cyclic_payload",
34
+ node: "payload",
35
+ path,
36
+ message: `Plan payload at ${path.length === 0 ? "$" : `$.${path.join(".")}`} has a toJSON method that returns itself`
37
+ });
38
+ };
39
+ const inheritedDataProperty = (value, key) => {
40
+ let current = value;
41
+ while (current !== null) {
42
+ const descriptor = Object.getOwnPropertyDescriptor(current, key);
43
+ if (descriptor !== undefined) {
44
+ return "value" in descriptor ? { kind: "data", value: descriptor.value } : { kind: "accessor" };
45
+ }
46
+ current = Object.getPrototypeOf(current);
47
+ }
48
+ return { kind: "missing" };
49
+ };
50
+ /**
51
+ * Clones the JSON mirror of the input, so {@link module:StepKey.content} over
52
+ * the clone and the input produce the same key and the clone holds only inert
53
+ * JSON data. The walk uses an explicit stack, memoizes shared references and
54
+ * cycles, honors callable `toJSON`, omits object members without a JSON
55
+ * representation, and writes `null` for those values in arrays.
56
+ *
57
+ * `toJSON` receives the key canonical serialization passes it: the member
58
+ * name, the array index, or `""` at the root. Its replacement is therefore
59
+ * memoized per source and key, since one shared source may serialize
60
+ * differently at two positions. A source met again inside its own
61
+ * replacement reuses that replacement, so a cycle through `toJSON` clones as
62
+ * a cycle whatever key it recurs at.
63
+ *
64
+ * A planned value becomes whatever `plannedValue` returns for it. Refusals
65
+ * throw a {@link GraphBuildError} naming the member's path.
66
+ *
67
+ * @since 0.1.0
68
+ * @private
69
+ */
70
+ export const jsonMirror = (input, plannedValue) => {
71
+ const missing = Symbol("missing JSON representation");
72
+ const seen = new WeakMap();
73
+ const replacedAt = new WeakMap();
74
+ const open = new Map();
75
+ let result;
76
+ const frames = [];
77
+ /** Resolves one member, opening a frame when it is an unseen container. */
78
+ const enter = (initial, place, path) => {
79
+ let current = initial;
80
+ const key = path === undefined ? "" : path.key;
81
+ const replacements = [];
82
+ const resolving = new WeakSet();
83
+ const finish = (member) => {
84
+ for (const replacement of replacements) {
85
+ let byKey = replacedAt.get(replacement);
86
+ if (byKey === undefined)
87
+ replacedAt.set(replacement, byKey = new Map());
88
+ byKey.set(key, member);
89
+ }
90
+ place(member);
91
+ };
92
+ while (true) {
93
+ const reference = Planned.reference(current);
94
+ if (reference !== undefined) {
95
+ finish(plannedValue(current, reference));
96
+ return;
97
+ }
98
+ const kind = typeof current;
99
+ if (current === null || (kind !== "object" && kind !== "function")) {
100
+ finish(kind === "undefined" || kind === "symbol" ? missing : current);
101
+ return;
102
+ }
103
+ const source = current;
104
+ if (seen.has(source)) {
105
+ finish(seen.get(source));
106
+ return;
107
+ }
108
+ if (resolving.has(source)) {
109
+ throw cyclicPayloadError(path);
110
+ }
111
+ const toJSON = inheritedDataProperty(source, "toJSON");
112
+ if (toJSON.kind === "accessor") {
113
+ throw payloadError(path, "has an accessor-backed toJSON member");
114
+ }
115
+ if (toJSON.kind === "data" && typeof toJSON.value === "function") {
116
+ const byKey = replacedAt.get(source);
117
+ if (byKey !== undefined && byKey.has(key)) {
118
+ finish(byKey.get(key));
119
+ return;
120
+ }
121
+ if (open.has(source)) {
122
+ finish(open.get(source));
123
+ return;
124
+ }
125
+ resolving.add(source);
126
+ replacements.push(source);
127
+ current = Reflect.apply(toJSON.value, source, [key]);
128
+ continue;
129
+ }
130
+ if (kind === "function") {
131
+ seen.set(source, missing);
132
+ finish(missing);
133
+ return;
134
+ }
135
+ const prototype = Object.getPrototypeOf(source);
136
+ if (!Array.isArray(source) && prototype !== Object.prototype && prototype !== null) {
137
+ throw payloadError(path, "has an unsupported prototype and no data-valued toJSON method");
138
+ }
139
+ const container = current;
140
+ const descriptors = Object.getOwnPropertyDescriptors(container);
141
+ const output = Array.isArray(container)
142
+ ? []
143
+ : Object.create(null);
144
+ seen.set(container, output);
145
+ finish(output);
146
+ frames.push({
147
+ source: container,
148
+ output,
149
+ descriptors,
150
+ keys: Array.isArray(container)
151
+ ? undefined
152
+ : Reflect.ownKeys(descriptors).filter((key) => typeof key === "string" && descriptors[key].enumerable === true),
153
+ path,
154
+ replaced: replacements,
155
+ index: 0
156
+ });
157
+ for (const replacement of replacements)
158
+ open.set(replacement, output);
159
+ return;
160
+ }
161
+ };
162
+ enter(input, (member) => {
163
+ result = member === missing ? undefined : member;
164
+ }, undefined);
165
+ while (frames.length > 0) {
166
+ const frame = frames[frames.length - 1];
167
+ if (frame.index >= (frame.keys ?? frame.source).length) {
168
+ frames.pop();
169
+ for (const replacement of frame.replaced)
170
+ open.delete(replacement);
171
+ continue;
172
+ }
173
+ const position = frame.index;
174
+ frame.index = position + 1;
175
+ if (frame.keys === undefined) {
176
+ const members = frame.output;
177
+ const descriptor = frame.descriptors[String(position)];
178
+ if (descriptor !== undefined && !("value" in descriptor)) {
179
+ throw payloadError({ parent: frame.path, key: String(position) }, "is an accessor");
180
+ }
181
+ enter(descriptor === undefined ? undefined : descriptor.value, (member) => {
182
+ members.push(member === missing ? null : member);
183
+ }, { parent: frame.path, key: String(position) });
184
+ }
185
+ else {
186
+ const key = frame.keys[position];
187
+ const descriptor = frame.descriptors[key];
188
+ if (!("value" in descriptor))
189
+ throw payloadError({ parent: frame.path, key }, "is an accessor");
190
+ enter(descriptor.value, (member) => {
191
+ if (member === missing)
192
+ return;
193
+ Object.defineProperty(frame.output, key, {
194
+ configurable: true,
195
+ enumerable: true,
196
+ value: member,
197
+ writable: true
198
+ });
199
+ }, { parent: frame.path, key });
200
+ }
201
+ }
202
+ return result;
203
+ };
204
+ //# sourceMappingURL=JsonMir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C,MAAM,KAAK,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,MAAM,CAAC,CAAA;YAClD,CAAC,EAAE,EAAE,MAAM,EAAE,KAAK,CAAC,IAAI,EAAE,GAAG,EAAE,MAAM,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAA;QACnD,CAAC;aAAM,CAAC;YACN,MAAM,GAAG,GAAG,KAAK,CAAC,IAAI,CAAC,QAAQ,CAAE,CAAA;YACjC,MAAM,UAAU,GAAG,KAAK,CAAC,WAAW,CAAC,GAAG,CAAE,CAAA;YAC1C,IAAI,CAAC,CAAC,OAAO,IAAI,UAAU,CAAC;gBAAE,MAAM,YAAY,CAAC,EAAE,MAAM,EAAE,KAAK,CAAC,IAAI,EAAE,GAAG,EAAE,EAAE,gBAAgB,CAAC,CAAA;YAC/F,KAAK,CAAC,UAAU,CAAC,KAAK,EAAE,CAAC,MAAM,EAAE,EAAE;gBACjC,IAAI,MAAM,KAAK,OAAO;oBAAE,OAAM;gBAC9B,MAAM,CAAC,cAAc,CAAC,KAAK,CAAC,MAAM,EAAE,GAAG,EAAE;oBACvC,YAAY,EAAE,IAAI;oBAClB,UAAU,EAAE,IAAI;oBAChB,KAAK,EAAE,MAAM;oBACb,QAAQ,EAAE,IAAI;iBACf,CAAC,CAAA;YACJ,CAAC,EAAE,EAAE,MAAM,EAAE,KAAK,CAAC,IAAI,EAAE,GAAG,EAAE,CAAC,CAAA;QACjC,CAAC;IACH,CAAC;IACD,OAAO,MAAM,CAAA;AACf,CAAC,CAAA","sourcesContent":["/**\n * The inert JSON mirror of a value: what `JSON.stringify` would see, as data.\n *\n * The AST stores payloads this way, the plan compiler stores key material this\n * way, and a plan diff compares declarations this way, so all three share the\n * one walk. A planned value is the only member with no JSON meaning of its\n * own, and each caller decides what it becomes.\n *\n * @since 0.1.0\n * @private\n */\n\nimport { GraphBuildError } from \"../GraphBuildError.ts\"\nimport * as Planned from \"../Planned.ts\"\n\n/**\n * One container being cloned: the object walked, the clone being filled, and\n * the member position the walk has reached. `keys` is `undefined` for an\n * array, whose members are positional.\n *\n * @since 0.1.0\n * @private\n */\ninterface CloneFrame {\n readonly source: Record<string, unknown> | ReadonlyArray<unknown>\n readonly output: Record<string, unknown> | Array<unknown>\n readonly descriptors: PropertyDescriptorMap\n readonly keys: ReadonlyArray<string> | undefined\n readonly path: ClonePath\n /** Sources whose callable `toJSON` resolved to this container. */\n readonly replaced: ReadonlyArray<object>\n index: number\n}\n\n/**\n * Where the walk stands, as a link to its parent rather than a copy of the\n * whole path. Payload depth is bounded only by the caller, and copying the\n * path at each member made a clone cost memory quadratic in that depth: a\n * 20,000-deep payload held 20,000 live frames whose paths together ran to\n * hundreds of millions of entries, several gigabytes, for a result that is\n * linear. The path is read only to name a member in a refusal, so it stays a\n * chain here and is flattened at the throw.\n *\n * `undefined` is the root, whose path is empty.\n *\n * @since 0.1.0\n * @private\n */\ntype ClonePath = { readonly parent: ClonePath; readonly key: string } | undefined\n\n/** The chain read outwards, root first: the array the refusals report. */\nconst clonePath = (path: ClonePath): ReadonlyArray<string> => {\n const keys: Array<string> = []\n for (let current = path; current !== undefined; current = current.parent) keys.push(current.key)\n return keys.reverse()\n}\n\nconst payloadError = (at: ClonePath, reason: string): GraphBuildError => {\n const path = clonePath(at)\n return new GraphBuildError({\n code: \"invalid_payload\",\n node: \"payload\",\n path,\n message: `Plan payload at ${path.length === 0 ? \"$\" : `$.${path.join(\".\")}`} ${reason}`\n })\n}\n\nconst cyclicPayloadError = (at: ClonePath): GraphBuildError => {\n const path = clonePath(at)\n return new GraphBuildError({\n code: \"cyclic_payload\",\n node: \"payload\",\n path,\n message: `Plan payload at ${\n path.length === 0 ? \"$\" : `$.${path.join(\".\")}`\n } has a toJSON method that returns itself`\n })\n}\n\nconst inheritedDataProperty = (\n value: object,\n key: PropertyKey\n):\n | { readonly kind: \"data\"; readonly value: unknown }\n | { readonly kind: \"accessor\" }\n | { readonly kind: \"missing\" } =>\n{\n let current: object | null = value\n while (current !== null) {\n const descriptor = Object.getOwnPropertyDescriptor(current, key)\n if (descriptor !== undefined) {\n return \"value\" in descriptor ? { kind: \"data\", value: descriptor.value } : { kind: \"accessor\" }\n }\n current = Object.getPrototypeOf(current) as object | null\n }\n return { kind: \"missing\" }\n}\n\n/**\n * Clones the JSON mirror of the input, so {@link module:StepKey.content} over\n * the clone and the input produce the same key and the clone holds only inert\n * JSON data. The walk uses an explicit stack, memoizes shared references and\n * cycles, honors callable `toJSON`, omits object members without a JSON\n * representation, and writes `null` for those values in arrays.\n *\n * `toJSON` receives the key canonical serialization passes it: the member\n * name, the array index, or `\"\"` at the root. Its replacement is therefore\n * memoized per source and key, since one shared source may serialize\n * differently at two positions. A source met again inside its own\n * replacement reuses that replacement, so a cycle through `toJSON` clones as\n * a cycle whatever key it recurs at.\n *\n * A planned value becomes whatever `plannedValue` returns for it. Refusals\n * throw a {@link GraphBuildError} naming the member's path.\n *\n * @since 0.1.0\n * @private\n */\nexport const jsonMirror = (\n input: unknown,\n plannedValue: (value: unknown, reference: Planned.Reference) => unknown\n): unknown => {\n const missing = Symbol(\"missing JSON representation\")\n const seen = new WeakMap<object, unknown>()\n const replacedAt = new WeakMap<object, Map<string, unknown>>()\n const open = new Map<object, unknown>()\n let result: unknown\n const frames: Array<CloneFrame> = []\n /** Resolves one member, opening a frame when it is an unseen container. */\n const enter = (\n initial: unknown,\n place: (member: unknown | typeof missing) => void,\n path: ClonePath\n ): void => {\n let current = initial\n const key = path === undefined ? \"\" : path.key\n const replacements: Array<object> = []\n const resolving = new WeakSet<object>()\n const finish = (member: unknown | typeof missing): void => {\n for (const replacement of replacements) {\n let byKey = replacedAt.get(replacement)\n if (byKey === undefined) replacedAt.set(replacement, byKey = new Map())\n byKey.set(key, member)\n }\n place(member)\n }\n while (true) {\n const reference = Planned.reference(current)\n if (reference !== undefined) {\n finish(plannedValue(current, reference))\n return\n }\n const kind = typeof current\n if (current === null || (kind !== \"object\" && kind !== \"function\")) {\n finish(kind === \"undefined\" || kind === \"symbol\" ? missing : current)\n return\n }\n const source = current as object\n if (seen.has(source)) {\n finish(seen.get(source))\n return\n }\n if (resolving.has(source)) {\n throw cyclicPayloadError(path)\n }\n const toJSON = inheritedDataProperty(source, \"toJSON\")\n if (toJSON.kind === \"accessor\") {\n throw payloadError(path, \"has an accessor-backed toJSON member\")\n }\n if (toJSON.kind === \"data\" && typeof toJSON.value === \"function\") {\n const byKey = replacedAt.get(source)\n if (byKey !== undefined && byKey.has(key)) {\n finish(byKey.get(key))\n return\n }\n if (open.has(source)) {\n finish(open.get(source))\n return\n }\n resolving.add(source)\n replacements.push(source)\n current = Reflect.apply(toJSON.value, source, [key])\n continue\n }\n if (kind === \"function\") {\n seen.set(source, missing)\n finish(missing)\n return\n }\n const prototype = Object.getPrototypeOf(source)\n if (!Array.isArray(source) && prototype !== Object.prototype && prototype !== null) {\n throw payloadError(path, \"has an unsupported prototype and no data-valued toJSON method\")\n }\n const container = current as Record<string, unknown> | ReadonlyArray<unknown>\n const descriptors = Object.getOwnPropertyDescriptors(container) as PropertyDescriptorMap\n const output: Record<string, unknown> | Array<unknown> = Array.isArray(container)\n ? []\n : Object.create(null) as Record<string, unknown>\n seen.set(container, output)\n finish(output)\n frames.push({\n source: container,\n output,\n descriptors,\n keys: Array.isArray(container)\n ? undefined\n : Reflect.ownKeys(descriptors).filter((key): key is string =>\n typeof key === \"string\" && descriptors[key]!.enumerable === true\n ),\n path,\n replaced: replacements,\n index: 0\n })\n for (const replacement of replacements) open.set(replacement, output)\n return\n }\n }\n enter(input, (member) => {\n result = member === missing ? undefined : member\n }, undefined)\n while (frames.length > 0) {\n const frame = frames[frames.length - 1]!\n if (frame.index >= (frame.keys ?? frame.source as ReadonlyArray<unknown>).length) {\n frames.pop()\n for (const replacement of frame.replaced) open.delete(replacement)\n continue\n }\n const position = frame.index\n frame.index = position + 1\n if (frame.keys === undefined) {\n const members = frame.output as Array<unknown>\n const descriptor = frame.descriptors[String(position)]\n if (descriptor !== undefined && !(\"value\" in descriptor)) {\n throw payloadError({ parent: frame.path, key: String(position) }, \"is an accessor\")\n }\n enter(descriptor === undefined ? undefined : descriptor.value, (member) => {\n members.push(member === missing ? null : member)\n }, { parent: frame.path, key: String(position) })\n } else {\n const key = frame.keys[position]!\n const descriptor = frame.descriptors[key]!\n if (!(\"value\" in descriptor)) throw payloadError({ parent: frame.path, key }, \"is an accessor\")\n enter(descriptor.value, (member) => {\n if (member === missing) return\n Object.defineProperty(frame.output, key, {\n configurable: true,\n enumerable: true,\n value: member,\n writable: true\n })\n }, { parent: frame.path, key })\n }\n }\n return result\n}\n"]}
@@ -0,0 +1,245 @@
1
+ /**
2
+ * Path indexing shared by effect matching and the graph's write-conflict pass.
3
+ *
4
+ * The pattern grammar is exhaustive: an entry ending in `*` matches by string
5
+ * prefix and every other entry matches itself alone. Every path is read a
6
+ * bounded number of times: once to look for a dot segment, once to detect a
7
+ * pattern, and once per comparison a binary search needs while the distinct
8
+ * paths are sorted and each pattern's prefix is located. After that a path is
9
+ * an integer rank and every match is an integer comparison, so matching two
10
+ * declarations costs their combined length plus the matches, whatever the
11
+ * paths' lengths or how many patterns nest. An envelope is prepared once for
12
+ * every step it encloses: its exact entries go into a set and its covering
13
+ * patterns collapse to disjoint sorted prefixes, so a step path costs one
14
+ * lookup and one binary search however wide the envelope is.
15
+ *
16
+ * Governing contract: `packages/smithers/flows/plan/docs/api.md`, published as
17
+ * https://smithers.sh/docs/reference/api/plan.
18
+ *
19
+ * @since 1.0.0-rc.0
20
+ */
21
+ import type * as Effects from "../Effects.ts";
22
+ /**
23
+ * Whether `path` contains a whole `.` or `..` segment.
24
+ *
25
+ * A path with no `.` costs one native search. Otherwise the segments from the
26
+ * one holding the first `.` onward are scanned once, without allocating.
27
+ *
28
+ * @since 1.0.0-rc.0
29
+ * @private
30
+ */
31
+ export declare const hasDotSegment: (path: string) => boolean;
32
+ /**
33
+ * Whether an entry is a pattern: only a trailing `*` makes one.
34
+ *
35
+ * @since 1.0.0-rc.0
36
+ * @private
37
+ */
38
+ export declare const isGlob: (entry: string) => boolean;
39
+ /**
40
+ * The string prefix a pattern matches by: everything for `*` and `**`,
41
+ * `prefix/` for `prefix/**`, and `prefix` for `prefix*`.
42
+ *
43
+ * @since 1.0.0-rc.0
44
+ * @private
45
+ */
46
+ export declare const globPrefix: (glob: string) => string;
47
+ /**
48
+ * The distinct paths of one or more declarations in code-unit order, with
49
+ * what matching needs to know about each: its rank, whether it carries a dot
50
+ * segment, whether it is a pattern that can cover anything, and for such a
51
+ * pattern the rank interval its prefix covers.
52
+ *
53
+ * @since 1.0.0-rc.0
54
+ * @private
55
+ */
56
+ export interface PathIndex {
57
+ readonly paths: ReadonlyArray<string>;
58
+ readonly rank: ReadonlyMap<string, number>;
59
+ readonly dotted: Uint8Array;
60
+ readonly glob: Uint8Array;
61
+ readonly low: Int32Array;
62
+ readonly high: Int32Array;
63
+ }
64
+ /**
65
+ * Indexes the union of the given path lists.
66
+ *
67
+ * @since 1.0.0-rc.0
68
+ * @private
69
+ */
70
+ export declare const indexPaths: (lists: Iterable<ReadonlyArray<string>>) => PathIndex;
71
+ /**
72
+ * One declaration's paths as ranks of a {@link PathIndex}: every path in
73
+ * ascending rank order, and the patterns whose prefix intervals are not
74
+ * contained in another of the declaration's patterns. Those intervals are
75
+ * disjoint and ascending, so enumerating them visits each covered rank once.
76
+ *
77
+ * @since 1.0.0-rc.0
78
+ * @private
79
+ */
80
+ export interface Ranked {
81
+ readonly ranks: Int32Array;
82
+ readonly globs: Int32Array;
83
+ }
84
+ /**
85
+ * Ranks a declaration's paths against an index that contains them.
86
+ *
87
+ * @since 1.0.0-rc.0
88
+ * @private
89
+ */
90
+ export declare const rankPaths: (index: PathIndex, paths: ReadonlyArray<string>) => Ranked;
91
+ /**
92
+ * The ranks of the paths two write declarations share, ascending: a path of
93
+ * `b` that `a` names or covers, and a path of `a` that `b` covers unless it is
94
+ * the same pattern or itself covers that pattern. This is the pairwise
95
+ * definition, exact paths matched through the merge of two sorted rank lists
96
+ * and each covering pattern enumerating the ranks of the other declaration
97
+ * inside its interval. Each of the three passes yields an ascending list, so
98
+ * the result is their merge and no sort is needed.
99
+ *
100
+ * @since 1.0.0-rc.0
101
+ * @private
102
+ */
103
+ export declare const overlapRanks: (index: PathIndex, a: Ranked, b: Ranked) => Array<number>;
104
+ /**
105
+ * One envelope list prepared for repeated coverage checks: its distinct
106
+ * entries, matched exactly through a set, and the prefixes of its covering
107
+ * patterns with every pattern nested under another collapsed into the
108
+ * outermost. The kept prefixes are disjoint and sorted, so the only prefix
109
+ * that can cover a path is the greatest one not greater than the path, and
110
+ * one binary search finds it.
111
+ *
112
+ * @since 1.0.0-rc.0
113
+ * @private
114
+ */
115
+ export interface Prepared {
116
+ readonly exact: ReadonlySet<string>;
117
+ readonly prefixes: ReadonlyArray<string>;
118
+ }
119
+ /**
120
+ * Prepares one envelope list. Each entry is read a bounded number of times:
121
+ * once into the set, once to detect a pattern, and for a pattern once to take
122
+ * its prefix and once to test that prefix for a dot segment, plus the
123
+ * comparisons that sort the prefixes and one prefix comparison that collapses
124
+ * a nested one.
125
+ *
126
+ * @since 1.0.0-rc.0
127
+ * @private
128
+ */
129
+ export declare const prepare: (paths: ReadonlyArray<string>) => Prepared;
130
+ /**
131
+ * Whether a prepared list names or covers `path`. A path carrying a dot
132
+ * segment is never covered, so the path is scanned once for one and, when
133
+ * clean, looked up once and compared against at most one prefix.
134
+ *
135
+ * @since 1.0.0-rc.0
136
+ * @private
137
+ */
138
+ export declare const covered: (prepared: Prepared, path: string) => boolean;
139
+ /**
140
+ * The fields of a declaration that narrowing reads. Structural, so this module
141
+ * needs nothing from the public module built on it.
142
+ *
143
+ * @since 1.0.0-rc.0
144
+ * @private
145
+ */
146
+ export interface DeclarationLike {
147
+ readonly reads: ReadonlyArray<string>;
148
+ readonly writes: ReadonlyArray<string>;
149
+ readonly mode: Effects.Mode;
150
+ readonly tier?: Effects.Tier | undefined;
151
+ }
152
+ /**
153
+ * An envelope prepared once for every step it encloses.
154
+ *
155
+ * @since 1.0.0-rc.0
156
+ * @private
157
+ */
158
+ export interface PreparedEnvelope {
159
+ readonly reads: Prepared;
160
+ readonly writes: Prepared;
161
+ readonly mode: Effects.Mode;
162
+ readonly tier: Effects.Tier;
163
+ }
164
+ /**
165
+ * The outcome of narrowing a step against a prepared envelope, shaped as the
166
+ * public `NarrowResult`.
167
+ *
168
+ * @since 1.0.0-rc.0
169
+ * @private
170
+ */
171
+ export type NarrowOutcome = Effects.NarrowResult;
172
+ /**
173
+ * Prepares both lists of an envelope.
174
+ *
175
+ * @since 1.0.0-rc.0
176
+ * @private
177
+ */
178
+ export declare const prepareEnvelope: (envelope: DeclarationLike) => PreparedEnvelope;
179
+ /**
180
+ * Verifies that a step stays within a prepared envelope: every read and write
181
+ * path must be covered by the matching list, the mode may only tighten, and
182
+ * the tier may only narrow. Each step path costs one coverage check.
183
+ *
184
+ * @since 1.0.0-rc.0
185
+ * @private
186
+ */
187
+ export declare const narrowPrepared: (envelope: PreparedEnvelope, step: DeclarationLike) => NarrowOutcome;
188
+ /**
189
+ * Maximum length, in UTF-16 code units, of one effect path a graph build
190
+ * admits before it refuses the plan as too large. 4096 is `PATH_MAX`
191
+ * on Linux, the longest path a supported host can open, so no path that names
192
+ * a file is refused. Every per-character cost of a build is bounded by it:
193
+ * the one dot-segment scan each path gets, the comparisons that sort the
194
+ * distinct paths, and the comparisons that locate each pattern's prefix. The
195
+ * length is read before any character is, so an over-long path costs one
196
+ * property read.
197
+ *
198
+ * @category limits
199
+ * @since 1.0.0-rc.0
200
+ */
201
+ export declare const maximumPathLength = 4096;
202
+ /**
203
+ * Maximum number of patterns, entries ending in `*`, one read list or one
204
+ * write list of an effect declaration may carry before a graph build refuses
205
+ * the plan as too large. A pattern never costs a match more than a
206
+ * literal path does: its prefix is located once by binary search, patterns
207
+ * nested under another collapse into the outermost before the paths they
208
+ * cover are enumerated, and every match after that is an integer comparison.
209
+ * What a pattern costs beyond a literal is that search, two binary searches
210
+ * of at most 16 comparisons each over a plan at the builder's plan-wide path
211
+ * ceiling,
212
+ * every comparison reading up to {@link maximumPathLength} code units.
213
+ * 128 keeps that term, 4,096 comparisons per list, below the sort that admits
214
+ * a per-declaration list of literal paths, while still letting one
215
+ * declaration name a subtree per package of a large monorepo. The count is
216
+ * read from the last character of each path as it is admitted, so a pattern
217
+ * past the limit costs one character read.
218
+ *
219
+ * @category limits
220
+ * @since 1.0.0-rc.0
221
+ */
222
+ export declare const maximumGlobs = 128;
223
+ /**
224
+ * Copies one declaration's paths, refusing before the copy grows past
225
+ * `limit`. A real array is refused by its length before a member is read; any
226
+ * other iterable is copied one path at a time and refused as soon as it
227
+ * exceeds the limit, so a caller-assembled declaration cannot dodge the bound
228
+ * by hiding its size from `length`. Each path is then refused by its length
229
+ * before any character is read, and by the count of patterns the list has
230
+ * carried so far, so an over-long path or a pattern past the limit costs one
231
+ * property read.
232
+ *
233
+ * @private
234
+ * @since 1.0.0-rc.0
235
+ */
236
+ export declare const copyPaths: (paths: ReadonlyArray<string>, limit: number, refuse: () => Error) => Array<string>;
237
+ /**
238
+ * Snapshots a declaration into graph-owned data, copying at most `limit`
239
+ * paths in total across its reads and writes.
240
+ *
241
+ * @private
242
+ * @since 1.0.0-rc.0
243
+ */
244
+ export declare const boundedEffects: (declaration: Effects.Declaration, limit: number, refuse: () => Error) => Effects.Declaration;
245
+ //# sourceMappingURL=effects.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"effects.d.ts","sourceRoot":"","sources":["../../../src/internal/effects.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,KAAK,KAAK,OAAO,MAAM,eAAe,CAAA;AAM7C;;;;;;;;GAQG;AACH,eAAO,MAAM,aAAa,GAAI,MAAM,MAAM,KAAG,OAc5C,CAAA;AAED;;;;;GAKG;AACH,eAAO,MAAM,MAAM,GAAI,OAAO,MAAM,KAAG,OAAsD,CAAA;AAE7F;;;;;;GAMG;AACH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