@smoothbricks/nx-plugin 0.4.26 → 0.4.27

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 (343) hide show
  1. package/README.md +994 -117
  2. package/dist/bin/smoo-nx-bound-failures.d.ts +3 -0
  3. package/dist/bin/smoo-nx-bound-failures.d.ts.map +1 -0
  4. package/dist/bin/smoo-nx-bound-failures.js +31 -0
  5. package/dist/bin/smoo-nx-cargo-hash.js +28 -3
  6. package/dist/bin/smoo-nx-exec.js +15 -73
  7. package/dist/bin/smoo-nx-failures.d.ts +3 -0
  8. package/dist/bin/smoo-nx-failures.d.ts.map +1 -0
  9. package/dist/bin/smoo-nx-failures.js +3 -0
  10. package/dist/bin/smoo-nx-nextest-extract.js +3 -2
  11. package/dist/bin/smoo-nx-test-walks.d.ts +3 -0
  12. package/dist/bin/smoo-nx-test-walks.d.ts.map +1 -0
  13. package/dist/bin/smoo-nx-test-walks.js +34 -0
  14. package/dist/bounded-test-policy.d.ts +7 -1
  15. package/dist/bounded-test-policy.d.ts.map +1 -1
  16. package/dist/bounded-test-policy.js +101 -40
  17. package/dist/build-state-output-policy.d.ts +25 -0
  18. package/dist/build-state-output-policy.d.ts.map +1 -0
  19. package/dist/build-state-output-policy.js +64 -0
  20. package/dist/cargo-closure-input.d.ts +3 -2
  21. package/dist/cargo-closure-input.d.ts.map +1 -1
  22. package/dist/cargo-closure-input.js +16 -15
  23. package/dist/cargo-dev-profile.d.ts +37 -0
  24. package/dist/cargo-dev-profile.d.ts.map +1 -0
  25. package/dist/cargo-dev-profile.js +108 -0
  26. package/dist/cargo-source-hash.d.ts +43 -6
  27. package/dist/cargo-source-hash.d.ts.map +1 -1
  28. package/dist/cargo-source-hash.js +309 -73
  29. package/dist/cargo-toolchain-policy.d.ts +4 -0
  30. package/dist/cargo-toolchain-policy.d.ts.map +1 -1
  31. package/dist/cargo-toolchain-policy.js +5 -0
  32. package/dist/cargo-workspace.d.ts +101 -5
  33. package/dist/cargo-workspace.d.ts.map +1 -1
  34. package/dist/cargo-workspace.js +291 -10
  35. package/dist/cross-check-policy.d.ts +21 -3
  36. package/dist/cross-check-policy.d.ts.map +1 -1
  37. package/dist/cross-check-policy.js +24 -6
  38. package/dist/disk-command-policy.d.ts +7 -0
  39. package/dist/disk-command-policy.d.ts.map +1 -0
  40. package/dist/disk-command-policy.js +98 -0
  41. package/dist/ensure-built-receipt.d.ts +25 -0
  42. package/dist/ensure-built-receipt.d.ts.map +1 -0
  43. package/dist/ensure-built-receipt.js +261 -0
  44. package/dist/ensure-built-witness.d.ts +57 -0
  45. package/dist/ensure-built-witness.d.ts.map +1 -0
  46. package/dist/ensure-built-witness.js +412 -0
  47. package/dist/ensure-built.d.ts +207 -12
  48. package/dist/ensure-built.d.ts.map +1 -1
  49. package/dist/ensure-built.js +576 -202
  50. package/dist/eslint-file-set.d.ts +7 -0
  51. package/dist/eslint-file-set.d.ts.map +1 -0
  52. package/dist/eslint-file-set.js +12 -0
  53. package/dist/executors/bounded-exec/cpu-pool.d.ts +63 -0
  54. package/dist/executors/bounded-exec/cpu-pool.d.ts.map +1 -0
  55. package/dist/executors/bounded-exec/cpu-pool.js +379 -0
  56. package/dist/executors/bounded-exec/cpu-tokens.d.ts +82 -0
  57. package/dist/executors/bounded-exec/cpu-tokens.d.ts.map +1 -0
  58. package/dist/executors/bounded-exec/cpu-tokens.js +114 -0
  59. package/dist/executors/bounded-exec/disk-lease.d.ts +61 -0
  60. package/dist/executors/bounded-exec/disk-lease.d.ts.map +1 -0
  61. package/dist/executors/bounded-exec/disk-lease.js +91 -0
  62. package/dist/executors/bounded-exec/executor.d.ts +45 -2
  63. package/dist/executors/bounded-exec/executor.d.ts.map +1 -1
  64. package/dist/executors/bounded-exec/executor.js +447 -52
  65. package/dist/executors/bounded-exec/gateway-lease.d.ts +52 -0
  66. package/dist/executors/bounded-exec/gateway-lease.d.ts.map +1 -0
  67. package/dist/executors/bounded-exec/gateway-lease.js +143 -0
  68. package/dist/executors/bounded-exec/hang-diagnostics.d.ts +35 -0
  69. package/dist/executors/bounded-exec/hang-diagnostics.d.ts.map +1 -0
  70. package/dist/executors/bounded-exec/hang-diagnostics.js +231 -0
  71. package/dist/executors/bounded-exec/progress.d.ts +35 -0
  72. package/dist/executors/bounded-exec/progress.d.ts.map +1 -0
  73. package/dist/executors/bounded-exec/progress.js +79 -0
  74. package/dist/executors/bounded-exec/ram-temp-fixtures.d.ts +3 -0
  75. package/dist/executors/bounded-exec/ram-temp-fixtures.d.ts.map +1 -0
  76. package/dist/executors/bounded-exec/ram-temp-fixtures.js +12 -0
  77. package/dist/executors/bounded-exec/ram-temp-held.d.ts +91 -0
  78. package/dist/executors/bounded-exec/ram-temp-held.d.ts.map +1 -0
  79. package/dist/executors/bounded-exec/ram-temp-held.js +152 -0
  80. package/dist/executors/bounded-exec/ram-temp.d.ts +223 -0
  81. package/dist/executors/bounded-exec/ram-temp.d.ts.map +1 -0
  82. package/dist/executors/bounded-exec/ram-temp.js +1528 -0
  83. package/dist/executors/bounded-exec/schema.d.ts +29 -11
  84. package/dist/executors/bounded-exec/schema.d.ts.map +1 -1
  85. package/dist/executors/bounded-exec/verdict.d.ts +162 -0
  86. package/dist/executors/bounded-exec/verdict.d.ts.map +1 -0
  87. package/dist/executors/bounded-exec/verdict.js +318 -0
  88. package/dist/executors/shard-timings/executor.d.ts +14 -0
  89. package/dist/executors/shard-timings/executor.d.ts.map +1 -0
  90. package/dist/executors/shard-timings/executor.js +25 -0
  91. package/dist/executors/shard-timings/schema.d.ts +4 -0
  92. package/dist/executors/shard-timings/schema.d.ts.map +1 -0
  93. package/dist/executors/shard-timings/schema.js +1 -0
  94. package/dist/failure-summary.d.ts +5 -0
  95. package/dist/failure-summary.d.ts.map +1 -0
  96. package/dist/failure-summary.js +118 -0
  97. package/dist/generators/create-package/generator.d.ts.map +1 -1
  98. package/dist/generators/create-package/generator.js +6 -2
  99. package/dist/index.d.ts +14 -2
  100. package/dist/index.d.ts.map +1 -1
  101. package/dist/index.js +370 -138
  102. package/dist/managed-files/ci-workflow.d.ts +13 -0
  103. package/dist/managed-files/ci-workflow.d.ts.map +1 -1
  104. package/dist/managed-files/ci-workflow.js +44 -13
  105. package/dist/managed-files/files.d.ts +7 -1
  106. package/dist/managed-files/files.d.ts.map +1 -1
  107. package/dist/managed-files/files.js +62 -8
  108. package/dist/managed-files/json-edit.d.ts +21 -0
  109. package/dist/managed-files/json-edit.d.ts.map +1 -0
  110. package/dist/managed-files/json-edit.js +295 -0
  111. package/dist/managed-files/managed-format.d.ts +33 -1
  112. package/dist/managed-files/managed-format.d.ts.map +1 -1
  113. package/dist/managed-files/managed-format.js +82 -2
  114. package/dist/managed-files/pr-preview-cleanup-workflow.d.ts +7 -0
  115. package/dist/managed-files/pr-preview-cleanup-workflow.d.ts.map +1 -1
  116. package/dist/managed-files/pr-preview-cleanup-workflow.js +68 -4
  117. package/dist/managed-files/publish-workflow.d.ts.map +1 -1
  118. package/dist/managed-files/publish-workflow.js +231 -48
  119. package/dist/managed-files/tree.d.ts +5 -0
  120. package/dist/managed-files/tree.d.ts.map +1 -1
  121. package/dist/managed-files/tree.js +5 -3
  122. package/dist/manifest-hash.d.ts.map +1 -1
  123. package/dist/manifest-hash.js +2 -5
  124. package/dist/nextest-code-bound.d.ts +62 -0
  125. package/dist/nextest-code-bound.d.ts.map +1 -0
  126. package/dist/nextest-code-bound.js +154 -0
  127. package/dist/nextest-extraction.d.ts +24 -8
  128. package/dist/nextest-extraction.d.ts.map +1 -1
  129. package/dist/nextest-extraction.js +42 -7
  130. package/dist/package-target-policy.d.ts.map +1 -1
  131. package/dist/package-target-policy.js +3 -5
  132. package/dist/release-config-policy.d.ts.map +1 -1
  133. package/dist/release-config-policy.js +3 -5
  134. package/dist/runtime-input.d.ts +14 -0
  135. package/dist/runtime-input.d.ts.map +1 -0
  136. package/dist/runtime-input.js +15 -0
  137. package/dist/rust-tokens.d.ts +11 -0
  138. package/dist/rust-tokens.d.ts.map +1 -0
  139. package/dist/rust-tokens.js +81 -0
  140. package/dist/task-results.d.ts +6 -0
  141. package/dist/task-results.d.ts.map +1 -0
  142. package/dist/task-results.js +61 -0
  143. package/dist/test-program.d.ts +54 -0
  144. package/dist/test-program.d.ts.map +1 -0
  145. package/dist/test-program.js +292 -0
  146. package/dist/test-timings.d.ts +71 -0
  147. package/dist/test-timings.d.ts.map +1 -0
  148. package/dist/test-timings.js +393 -0
  149. package/dist/test-walk-policy.d.ts +103 -0
  150. package/dist/test-walk-policy.d.ts.map +1 -0
  151. package/dist/test-walk-policy.js +657 -0
  152. package/dist/testing.d.ts +177 -0
  153. package/dist/testing.d.ts.map +1 -0
  154. package/dist/testing.js +824 -0
  155. package/dist/type-guards.d.ts +3 -0
  156. package/dist/type-guards.d.ts.map +1 -0
  157. package/dist/type-guards.js +4 -0
  158. package/dist/typecheck-test-policy.d.ts +8 -5
  159. package/dist/typecheck-test-policy.d.ts.map +1 -1
  160. package/dist/typecheck-test-policy.js +113 -100
  161. package/dist/workspace-config-policy.d.ts +8 -0
  162. package/dist/workspace-config-policy.d.ts.map +1 -1
  163. package/dist/workspace-config-policy.js +175 -63
  164. package/dist/workspace-index.d.ts +12 -0
  165. package/dist/workspace-index.d.ts.map +1 -0
  166. package/dist/workspace-index.js +17 -0
  167. package/dist/workspace-manifest.d.ts +37 -0
  168. package/dist/workspace-manifest.d.ts.map +1 -1
  169. package/executors.json +5 -0
  170. package/loader.js +13 -11
  171. package/managed/raw/envrc +33 -67
  172. package/managed/raw/git-format-staged.yml +30 -35
  173. package/managed/raw/patches/nx@23.2.1.patch +3484 -0
  174. package/managed/raw/tooling/direnv/apple-developer.sh +83 -0
  175. package/managed/raw/tooling/direnv/developer-links.ts +569 -11
  176. package/managed/raw/tooling/direnv/devenv.smoo.nix +314 -93
  177. package/managed/raw/tooling/direnv/github-actions-bootstrap.sh +20 -11
  178. package/managed/raw/tooling/direnv/linked-snapshots.ts +845 -0
  179. package/managed/raw/tooling/direnv/nx-socket-dir.sh +82 -0
  180. package/managed/raw/tooling/direnv/repo-path +14 -2
  181. package/managed/raw/tooling/direnv/setup-environment.ts +962 -148
  182. package/managed/raw/tooling/direnv/toolchain-stamp.ts +45 -3
  183. package/managed/raw/tooling/direnv/ttsc-env.sh +39 -0
  184. package/managed/raw/tooling/git-hooks/commit-msg.sh +5 -6
  185. package/managed/raw/tooling/git-hooks/pre-commit.sh +7 -6
  186. package/managed/raw/tooling/git-hooks/pre-push.sh +20 -15
  187. package/managed/templates/github/actions/cache-nix-devenv/action.yml +6 -6
  188. package/managed/templates/github/actions/cache-node-modules/action.yml +6 -4
  189. package/managed/templates/github/actions/cache-nx/action.yml +1 -1
  190. package/managed/templates/github/actions/cache-ttsc-plugins/action.yml +1 -1
  191. package/managed/templates/github/actions/forgejo-artifact.cjs +99 -0
  192. package/managed/templates/github/actions/forgejo-download-artifact/action.yml +49 -0
  193. package/managed/templates/github/actions/forgejo-download-artifact/index.cjs +7 -0
  194. package/managed/templates/github/actions/forgejo-upload-artifact/action.yml +65 -0
  195. package/managed/templates/github/actions/forgejo-upload-artifact/index.cjs +7 -0
  196. package/managed/templates/github/actions/setup-devenv/action.yml +21 -3
  197. package/managed/templates/github/workflows/managed-files.yml +1 -2
  198. package/nextest.toml +8 -41
  199. package/package.json +74 -12
  200. package/runtime-input.sh +81 -0
  201. package/src/__tests__/counted-cargo.ts +33 -14
  202. package/src/__tests__/fixture-nx-env.ts +111 -46
  203. package/src/__tests__/progress-clock.ts +43 -0
  204. package/src/__tests__/runtime-input.ts +23 -0
  205. package/src/bin/smoo-nx-bound-failures.test.ts +127 -0
  206. package/src/bin/smoo-nx-bound-failures.ts +33 -0
  207. package/src/bin/smoo-nx-cargo-hash.ts +28 -3
  208. package/src/bin/smoo-nx-exec.ts +16 -74
  209. package/src/bin/smoo-nx-failures.ts +4 -0
  210. package/src/bin/smoo-nx-nextest-extract.ts +3 -2
  211. package/src/bin/smoo-nx-test-walks.ts +42 -0
  212. package/src/bounded-test-policy.test.ts +268 -21
  213. package/src/bounded-test-policy.ts +114 -42
  214. package/src/build-state-output-policy.test.ts +115 -0
  215. package/src/build-state-output-policy.ts +90 -0
  216. package/src/bun-bootstrap.test.ts +57 -3
  217. package/src/bun-file-packages.test.ts +47 -0
  218. package/src/cargo-closure-input.test.ts +138 -66
  219. package/src/cargo-closure-input.ts +17 -15
  220. package/src/cargo-dev-profile.ts +137 -0
  221. package/src/cargo-resolve-cache.test.ts +70 -1
  222. package/src/cargo-source-hash.test.ts +193 -97
  223. package/src/cargo-source-hash.ts +345 -68
  224. package/src/cargo-toolchain-policy.ts +6 -0
  225. package/src/cargo-workspace.test.ts +320 -0
  226. package/src/cargo-workspace.ts +336 -10
  227. package/src/cross-check-policy.test.ts +59 -1
  228. package/src/cross-check-policy.ts +25 -6
  229. package/src/disk-command-policy.test.ts +61 -0
  230. package/src/disk-command-policy.ts +107 -0
  231. package/src/ensure-built-receipt.test.ts +184 -0
  232. package/src/ensure-built-receipt.ts +263 -0
  233. package/src/ensure-built-witness.test.ts +344 -0
  234. package/src/ensure-built-witness.ts +252 -0
  235. package/src/ensure-built.test.ts +1036 -578
  236. package/src/ensure-built.ts +820 -224
  237. package/src/eslint-file-set.ts +9 -0
  238. package/src/executors/bounded-exec/cpu-pool.test.ts +454 -0
  239. package/src/executors/bounded-exec/cpu-pool.ts +417 -0
  240. package/src/executors/bounded-exec/cpu-tokens.test.ts +269 -0
  241. package/src/executors/bounded-exec/cpu-tokens.ts +177 -0
  242. package/src/executors/bounded-exec/disk-lease.test.ts +185 -0
  243. package/src/executors/bounded-exec/disk-lease.ts +139 -0
  244. package/src/executors/bounded-exec/executor-host.test.ts +778 -0
  245. package/src/executors/bounded-exec/executor.test.ts +1116 -63
  246. package/src/executors/bounded-exec/executor.ts +565 -67
  247. package/src/executors/bounded-exec/gateway-lease.ts +176 -0
  248. package/src/executors/bounded-exec/hang-diagnostics.test.ts +285 -0
  249. package/src/executors/bounded-exec/hang-diagnostics.ts +283 -0
  250. package/src/executors/bounded-exec/progress.test.ts +79 -0
  251. package/src/executors/bounded-exec/progress.ts +118 -0
  252. package/src/executors/bounded-exec/ram-temp-fixtures.ts +12 -0
  253. package/src/executors/bounded-exec/ram-temp-held.test.ts +264 -0
  254. package/src/executors/bounded-exec/ram-temp-held.ts +242 -0
  255. package/src/executors/bounded-exec/ram-temp-host.test.ts +605 -0
  256. package/src/executors/bounded-exec/ram-temp.test.ts +674 -0
  257. package/src/executors/bounded-exec/ram-temp.ts +1918 -0
  258. package/src/executors/bounded-exec/schema.json +11 -5
  259. package/src/executors/bounded-exec/schema.ts +27 -11
  260. package/src/executors/bounded-exec/verdict.test.ts +440 -0
  261. package/src/executors/bounded-exec/verdict.ts +433 -0
  262. package/src/executors/shard-timings/executor.ts +36 -0
  263. package/src/executors/shard-timings/schema.json +21 -0
  264. package/src/executors/shard-timings/schema.ts +4 -0
  265. package/src/failure-summary.ts +119 -0
  266. package/src/generators/bounded-test-targets/generator.test.ts +4 -4
  267. package/src/generators/bun-test-tracing/generator.test.ts +2 -2
  268. package/src/generators/create-package/generator.test.ts +6 -0
  269. package/src/generators/create-package/generator.ts +6 -2
  270. package/src/host-controller-wiring.test.ts +31 -0
  271. package/src/index.test.ts +909 -295
  272. package/src/index.ts +441 -143
  273. package/src/linked-snapshots.nx.test.ts +172 -0
  274. package/src/managed-files/ci-workflow.ts +54 -13
  275. package/src/managed-files/files.ts +65 -9
  276. package/src/managed-files/forgejo-artifact.test.ts +395 -0
  277. package/src/managed-files/generator.test.ts +60 -1
  278. package/src/managed-files/json-edit.test.ts +216 -0
  279. package/src/managed-files/json-edit.ts +290 -0
  280. package/src/managed-files/managed-format-json.test.ts +308 -0
  281. package/src/managed-files/managed-format.ts +90 -2
  282. package/src/managed-files/pr-preview-cleanup-workflow.ts +69 -3
  283. package/src/managed-files/publish-workflow.ts +285 -67
  284. package/src/managed-files/repo-path.test.ts +129 -0
  285. package/src/managed-files/trace-db-artifact.test.ts +7 -0
  286. package/src/managed-files/tree.ts +11 -3
  287. package/src/manifest-hash.ts +2 -6
  288. package/src/nextest-code-bound.test.ts +155 -0
  289. package/src/nextest-code-bound.ts +195 -0
  290. package/src/nextest-extraction.test.ts +37 -5
  291. package/src/nextest-extraction.ts +51 -9
  292. package/src/nextest-partitions.test.ts +427 -82
  293. package/src/nx-cache-bound.test.ts +5 -10
  294. package/src/nx-cache-restore-mtime.test.ts +170 -0
  295. package/src/nx-daemon-claim.test.ts +277 -0
  296. package/src/nx-daemon-idle-cpu.test.ts +81 -0
  297. package/src/nx-daemon-idle-policy.test.ts +51 -0
  298. package/src/nx-daemon-ignore-files.test.ts +210 -0
  299. package/src/nx-daemon-root-normalization.test.ts +105 -0
  300. package/src/nx-daemon-validity.test.ts +925 -0
  301. package/src/nx-dot-input-policy.test.ts +353 -0
  302. package/src/nx-failure-life-cycles.test.ts +207 -0
  303. package/src/nx-files-archive-racy.test.ts +97 -0
  304. package/src/nx-foreign-workspace-env.test.ts +329 -0
  305. package/src/nx-incomplete-run-summary.test.ts +70 -0
  306. package/src/nx-plugin-load-errors.test.ts +120 -0
  307. package/src/nx-project-resolution-cache.test.ts +176 -0
  308. package/src/nx-raw-inputs.test.ts +166 -0
  309. package/src/nx-resident-graph-workers.test.ts +7 -16
  310. package/src/nx-run-information.test.ts +118 -0
  311. package/src/nx-skipped-task-exit.test.ts +180 -0
  312. package/src/nx-state-location.test.ts +63 -0
  313. package/src/nx-store-resolution.test.ts +26 -25
  314. package/src/nx-task-graph-cycles.test.ts +148 -0
  315. package/src/nx-task-output-lease.test.ts +414 -0
  316. package/src/nx-use-local.test.ts +103 -0
  317. package/src/package-target-policy.ts +3 -6
  318. package/src/release-config-policy.ts +3 -6
  319. package/src/runtime-input.test.ts +215 -0
  320. package/src/runtime-input.ts +17 -0
  321. package/src/rust-tokens.ts +78 -0
  322. package/src/serial-group-wiring.test.ts +326 -0
  323. package/src/task-history-namespace.test.ts +87 -89
  324. package/src/task-results.test.ts +226 -0
  325. package/src/task-results.ts +75 -0
  326. package/src/test-program.test.ts +303 -0
  327. package/src/test-program.ts +341 -0
  328. package/src/test-timings.test.ts +240 -0
  329. package/src/test-timings.ts +311 -0
  330. package/src/test-walk-policy.test.ts +585 -0
  331. package/src/test-walk-policy.ts +731 -0
  332. package/src/testing.test.ts +509 -0
  333. package/src/testing.ts +922 -0
  334. package/src/type-guards.ts +4 -0
  335. package/src/typecheck-test-policy.test.ts +496 -11
  336. package/src/typecheck-test-policy.ts +137 -103
  337. package/src/workspace-config-policy.test.ts +212 -13
  338. package/src/workspace-config-policy.ts +101 -73
  339. package/src/workspace-index.ts +18 -0
  340. package/src/workspace-manifest.ts +41 -0
  341. package/test-timings.json +85 -30
  342. package/managed/raw/tooling/direnv/inherited-devenv.ts +0 -665
  343. package/managed/raw/tooling/direnv/shared-caches.sh +0 -53
@@ -1,4 +1,8 @@
1
1
  import type { NonEmptyArray, PackageCargoCredentialsConfig, PackagePrivateNpmConfig, PackageRemoteCacheConfig, PackageSmooGithub, PackageSmooGithubEnvironments, PackageSourceCheckoutConfig } from '../workspace-manifest.js';
2
+ export declare const githubActionPins: Readonly<Record<'checkout' | 'nxSetShas' | 'cacheSave' | 'uploadArtifact' | 'downloadArtifact', {
3
+ readonly ref: string;
4
+ readonly version: string;
5
+ }>>;
2
6
  export declare enum CiWorkflowStepKind {
3
7
  Checkout = "checkout",
4
8
  SourceCheckouts = "source-checkouts",
@@ -231,5 +235,14 @@ export declare function deployStepSecretEnvLines(config: DeployStepSecretConfig)
231
235
  * never uses.
232
236
  */
233
237
  export declare function cloudflareCredentialEnvLines(deploySecrets: Record<string, string> | undefined): string[];
238
+ /**
239
+ * Every package's lmao trace sink, with its WAL sidecars: a run killed before a
240
+ * checkpoint leaves its committed frames in `-wal`, and without them the
241
+ * uploaded database reads `no such table: spans`. lmao's
242
+ * `TRACE_DB_DIRECTORY`/`TRACE_DB_FILENAME` own the path; the plugin cannot
243
+ * import them at runtime (lmao is not a runtime dependency), so a test pins
244
+ * this glob to them.
245
+ */
246
+ export declare const TRACE_DB_ARTIFACT_GLOB = "packages/*/.cache/lmao/trace-results.db*";
234
247
  export declare function artifactStepLines(provider: PackageSmooGithub['actionsProvider'], name: string, kind: 'upload' | 'download', inputs: readonly string[], condition?: string): string[];
235
248
  //# sourceMappingURL=ci-workflow.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"ci-workflow.d.ts","sourceRoot":"","sources":["../../src/managed-files/ci-workflow.ts"],"names":[],"mappings":"AAUA,OAAO,KAAK,EACV,aAAa,EACb,6BAA6B,EAE7B,uBAAuB,EACvB,wBAAwB,EACxB,iBAAiB,EACjB,6BAA6B,EAC7B,2BAA2B,EAC5B,MAAM,0BAA0B,CAAC;AAGlC,oBAAY,kBAAkB;IAC5B,QAAQ,aAAa;IACrB,eAAe,qBAAqB;IACpC,WAAW,iBAAiB;IAC5B,gBAAgB,sBAAsB;IACtC,SAAS,gBAAgB;IACzB,cAAc,qBAAqB;IACnC,KAAK,UAAU;IACf,YAAY,kBAAkB;IAC9B,IAAI,SAAS;IACb,SAAS,eAAe;IACxB,uBAAuB,8BAA8B;IACrD,iBAAiB,wBAAwB;IACzC,uBAAuB,+BAA+B;IACtD,yBAAyB,iCAAiC;IAC1D,UAAU,gBAAgB;IAC1B,iBAAiB,wBAAwB;IACzC,oBAAoB,2BAA2B;IAC/C,MAAM,WAAW;IACjB,WAAW,kBAAkB;IAC7B,cAAc,qBAAqB;IACnC,aAAa,oBAAoB;CAClC;AAED,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,kBAAkB,CAAC;IACzB,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;CAChB;AAED;;;;;;GAMG;AACH,MAAM,WAAW,sBAAsB;IACrC,cAAc,CAAC,EAAE,YAAY,CAAC;IAC9B,wEAAwE;IACxE,aAAa,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CACxC;AAED;;;;;;;;;;GAUG;AACH,MAAM,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AI,EAAE,MAAM,GAAG,SAAS,GAAG,MAAM,CAEhE;AAQD;;;;;;;;;;GAUG;AACH,wBAAgB,wBAAwB,CAAC,MAAM,EAAE,sBAAsB,GAAG,MAAM,EAAE,CAGjF;AAED;;;;;GAKG;AACH,wBAAgB,4BAA4B,CAAC,aAAa,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,SAAS,GAAG,MAAM,EAAE,CAMxG;AAmRD;;;;;;;GAOG;AACH,eAAO,MAAM,sBAAsB,6CAA6C,CAAC;AAEjF,wBAAgB,iBAAiB,CAC/B,QAAQ,EAAE,iBAAiB,CAAC,iBAAiB,CAAC,EAC9C,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,QAAQ,GAAG,UAAU,EAC3B,MAAM,EAAE,SAAS,MAAM,EAAE,EACzB,SAAS,SAAc,GACtB,MAAM,EAAE,CAkBV"}
@@ -3,6 +3,28 @@ import { parse as parseYaml } from 'yaml';
3
3
  import { cargoCrossTestArchiveFile, cargoCrossTestArchiveTargetName, cargoCrossTestTargetName, } from '../cross-check-policy.js';
4
4
  import { PRODUCTION_PUSH_DEPLOY_TAG } from '../deploy-policy.js';
5
5
  import { renderRunsOnLine } from './github-runs-on.js';
6
+ export const githubActionPins = {
7
+ checkout: {
8
+ ref: 'actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd',
9
+ version: 'v6.0.2',
10
+ },
11
+ nxSetShas: {
12
+ ref: 'nrwl/nx-set-shas@afb73a62d26e41464e9254689e1fd6122ee683c1',
13
+ version: 'v5.0.1',
14
+ },
15
+ cacheSave: {
16
+ ref: 'actions/cache/save@27d5ce7f107fe9357f9df03efb73ab90386fccae',
17
+ version: 'v5.0.5',
18
+ },
19
+ uploadArtifact: {
20
+ ref: 'actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a',
21
+ version: 'v7.0.1',
22
+ },
23
+ downloadArtifact: {
24
+ ref: 'actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c',
25
+ version: 'v8.0.1',
26
+ },
27
+ };
6
28
  export var CiWorkflowStepKind;
7
29
  (function (CiWorkflowStepKind) {
8
30
  CiWorkflowStepKind["Checkout"] = "checkout";
@@ -215,10 +237,11 @@ function yamlLinesForStep(step, options) {
215
237
  case CiWorkflowStepKind.Checkout:
216
238
  return [
217
239
  ` - name: ${step.name}`,
218
- ' uses: actions/checkout@v6.0.2',
240
+ ` uses: ${githubActionPins.checkout.ref} # ${githubActionPins.checkout.version}`,
219
241
  ' with:',
220
- ' filter: blob:none',
242
+ ' # Full history includes blobs needed by nx affected after checkout credentials are removed.',
221
243
  ' fetch-depth: 0',
244
+ ' persist-credentials: false',
222
245
  ];
223
246
  case CiWorkflowStepKind.SourceCheckouts:
224
247
  return sourceCheckoutsStepLines(step, options.sourceCheckouts ?? []);
@@ -232,7 +255,7 @@ function yamlLinesForStep(step, options) {
232
255
  return [
233
256
  ` - name: ${step.name}`,
234
257
  " if: github.server_url == 'https://github.com' || endsWith(github.api_url, '/api/v3')",
235
- ' uses: nrwl/nx-set-shas@v5.0.1',
258
+ ` uses: ${githubActionPins.nxSetShas.ref} # ${githubActionPins.nxSetShas.version}`,
236
259
  ' with:',
237
260
  ' workflow-id: ci.yml',
238
261
  ];
@@ -352,7 +375,7 @@ function yamlLinesForStep(step, options) {
352
375
  " ${{ steps.setup.outputs.host-runner != 'true' && github.event_name == 'push' && github.ref ==",
353
376
  " format('refs/heads/{0}', github.event.repository.default_branch) && steps.nx-cache.outputs.cache-hit != 'true'",
354
377
  ' }}',
355
- ' uses: actions/cache/save@v5.0.5',
378
+ ` uses: ${githubActionPins.cacheSave.ref} # ${githubActionPins.cacheSave.version}`,
356
379
  ' with:',
357
380
  ' path: |',
358
381
  ' .nx/cache',
@@ -362,7 +385,7 @@ function yamlLinesForStep(step, options) {
362
385
  case CiWorkflowStepKind.UploadTraceDbs:
363
386
  return artifactStepLines(options.actionsProvider, step.name, 'upload', [
364
387
  'name: trace-results-${{ github.run_id }}',
365
- 'path: packages/*/.cache/trace-results.db*',
388
+ `path: ${TRACE_DB_ARTIFACT_GLOB}`,
366
389
  'if-no-files-found: ignore',
367
390
  'retention-days: 14',
368
391
  'include-hidden-files: true',
@@ -1020,7 +1043,7 @@ function darwinCrossTestTargetNames(options) {
1020
1043
  * step carries exactly these archives, and upload-artifact roots an artifact at
1021
1044
  * the least common ancestor of the files it uploaded.
1022
1045
  *
1023
- * One cargo workspace's triples all share `target/nextest` and travel together.
1046
+ * One cargo workspace's triples all share `.cache/nextest` and travel together.
1024
1047
  * Two workspaces that each declare a darwin triple do not: their common
1025
1048
  * ancestor is above the directory the runner targets read from, so the pair is
1026
1049
  * refused here instead of restoring both archives one directory too high.
@@ -1087,17 +1110,25 @@ ${renderOptionalLines(deployStepSecretEnvLines(options))} # prettier-igno
1087
1110
 
1088
1111
  ${renderCiWorkflowSteps(followUpCleanupStep(numbers), options)}`;
1089
1112
  }
1113
+ /**
1114
+ * Every package's lmao trace sink, with its WAL sidecars: a run killed before a
1115
+ * checkpoint leaves its committed frames in `-wal`, and without them the
1116
+ * uploaded database reads `no such table: spans`. lmao's
1117
+ * `TRACE_DB_DIRECTORY`/`TRACE_DB_FILENAME` own the path; the plugin cannot
1118
+ * import them at runtime (lmao is not a runtime dependency), so a test pins
1119
+ * this glob to them.
1120
+ */
1121
+ export const TRACE_DB_ARTIFACT_GLOB = 'packages/*/.cache/lmao/trace-results.db*';
1090
1122
  export function artifactStepLines(provider, name, kind, inputs, condition = 'success()') {
1091
- // GitHub resolves every action before evaluating step conditions, so a
1092
- // Forgejo absolute action URL must never appear in a GitHub workflow.
1093
- // Forgejo 15 supports v4 artifacts; its pinned clients remove the GHES gate.
1123
+ // Local adapters keep both providers in GitHub's workflow grammar while
1124
+ // Forgejo runs its exact pinned clients without the GitHub GHES rejection.
1094
1125
  const action = provider === 'forgejo'
1095
1126
  ? kind === 'upload'
1096
- ? 'https://code.forgejo.org/forgejo/upload-artifact@cb8afe72b42edc798abfb8fcb556cf660d894245'
1097
- : 'https://code.forgejo.org/forgejo/download-artifact@769f970437aa3291b13f35dc23fc87967d7fb19f'
1127
+ ? './.github/actions/forgejo-upload-artifact'
1128
+ : './.github/actions/forgejo-download-artifact'
1098
1129
  : kind === 'upload'
1099
- ? 'actions/upload-artifact@v7.0.1'
1100
- : 'actions/download-artifact@v8.0.1';
1130
+ ? `${githubActionPins.uploadArtifact.ref} # ${githubActionPins.uploadArtifact.version}`
1131
+ : `${githubActionPins.downloadArtifact.ref} # ${githubActionPins.downloadArtifact.version}`;
1101
1132
  return [
1102
1133
  ` - name: ${name}`,
1103
1134
  ` if: ${condition}`,
@@ -46,6 +46,12 @@ export declare const managedTtscPatch: {
46
46
  readonly key: 'ttsc@0.30.4';
47
47
  readonly path: 'patches/ttsc@0.30.4.patch';
48
48
  };
49
+ /** Maintained Nx 23.2.1 repairs, applied as an ordinary Bun patchedDependency over the registry release. */
50
+ export declare const managedNxPatch: {
51
+ readonly version: '23.2.1';
52
+ readonly key: 'nx@23.2.1';
53
+ readonly path: 'patches/nx@23.2.1.patch';
54
+ };
49
55
  export declare const managedFileTargetsForTest: {
50
56
  target: string;
51
57
  executable: boolean | undefined;
@@ -55,5 +61,5 @@ export declare function managedFileTargetsForContext(context: ManagedFileContext
55
61
  /** Render all packaged templates before staging any workspace changes. */
56
62
  export declare function renderManagedFiles(context: ManagedFileContext): ManagedFile[];
57
63
  /** Renders a generated workflow through its real managed-file descriptor, so the context wiring is covered. */
58
- export declare function renderManagedWorkflowForTest(source: 'ci-workflow' | 'publish-workflow' | 'pr-preview-cleanup-workflow', context: ManagedFileContext): string;
64
+ export declare function renderManagedWorkflowForTest(source: 'ci-workflow' | 'publish-workflow' | 'pr-preview-cleanup-workflow' | 'pr-stage-sweep-workflow', context: ManagedFileContext): string;
59
65
  //# sourceMappingURL=files.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"files.d.ts","sourceRoot":"","sources":["../../src/managed-files/files.ts"],"names":[],"mapp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c;aACzB,OAAO,EAAE,QAAQ;aACjB,GAAG,EAAE,WAAW;aAChB,IAAI,EAAE,yBAAyB;CACvB,CAAC;AAgNX,eAAO,MAAM,yBAAyB;;;GAAyE,CAAC;AAchH,qFAAqF;AACrF,wBAAgB,4BAA4B,CAAC,OAAO,EAAE,kBAAkB,GAAG,MAAM,EAAE,CAElF;AAED,0EAA0E;AAC1E,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,kBAAkB,GAAG,WAAW,EAAE,CAM7E;AAED,+GAA+G;AAC/G,wBAAgB,4BAA4B,CAC1C,MAAM,EAAE,aAAa,GAAG,kBAAkB,GAAG,6BAA6B,GAAG,yBAAyB,EACtG,OAAO,EAAE,kBAAkB,GAC1B,MAAM,CAMR"}
@@ -3,7 +3,7 @@ import { join } from 'node:path';
3
3
  import { managedAssetsRoot } from '../managed-assets.js';
4
4
  import { privateNpmReadTokenJobEnv, renderCiWorkflowYaml } from './ci-workflow.js';
5
5
  import { renderRunsOnLine } from './github-runs-on.js';
6
- import { renderPrPreviewCleanupWorkflowYaml } from './pr-preview-cleanup-workflow.js';
6
+ import { renderPrPreviewCleanupWorkflowYaml, renderPrStageSweepWorkflowYaml } from './pr-preview-cleanup-workflow.js';
7
7
  import { renderPublishWorkflowYaml } from './publish-workflow.js';
8
8
  /** Temporary upstream compiler repairs distributed to smoo-managed Bun workspaces. */
9
9
  export const managedTtscPatch = {
@@ -11,12 +11,23 @@ export const managedTtscPatch = {
11
11
  key: 'ttsc@0.30.4',
12
12
  path: 'patches/ttsc@0.30.4.patch',
13
13
  };
14
+ /** Maintained Nx 23.2.1 repairs, applied as an ordinary Bun patchedDependency over the registry release. */
15
+ export const managedNxPatch = {
16
+ version: '23.2.1',
17
+ key: 'nx@23.2.1',
18
+ path: 'patches/nx@23.2.1.patch',
19
+ };
14
20
  const managedFiles = [
15
21
  {
16
22
  kind: 'raw',
17
23
  source: managedTtscPatch.path,
18
24
  target: managedTtscPatch.path,
19
25
  },
26
+ {
27
+ kind: 'raw',
28
+ source: managedNxPatch.path,
29
+ target: managedNxPatch.path,
30
+ },
20
31
  {
21
32
  kind: 'raw',
22
33
  source: 'envrc',
@@ -51,6 +62,11 @@ const managedFiles = [
51
62
  source: 'tooling/direnv/developer-links.ts',
52
63
  target: 'tooling/direnv/developer-links.ts',
53
64
  },
65
+ {
66
+ kind: 'raw',
67
+ source: 'tooling/direnv/linked-snapshots.ts',
68
+ target: 'tooling/direnv/linked-snapshots.ts',
69
+ },
54
70
  {
55
71
  kind: 'raw',
56
72
  source: 'tooling/direnv/secret-references.ts',
@@ -69,14 +85,18 @@ const managedFiles = [
69
85
  },
70
86
  {
71
87
  kind: 'raw',
72
- source: 'tooling/direnv/shared-caches.sh',
73
- target: 'tooling/direnv/shared-caches.sh',
88
+ source: 'tooling/direnv/nx-socket-dir.sh',
89
+ target: 'tooling/direnv/nx-socket-dir.sh',
74
90
  },
75
91
  {
76
92
  kind: 'raw',
77
- source: 'tooling/direnv/inherited-devenv.ts',
78
- target: 'tooling/direnv/inherited-devenv.ts',
79
- executable: true,
93
+ source: 'tooling/direnv/ttsc-env.sh',
94
+ target: 'tooling/direnv/ttsc-env.sh',
95
+ },
96
+ {
97
+ kind: 'raw',
98
+ source: 'tooling/direnv/apple-developer.sh',
99
+ target: 'tooling/direnv/apple-developer.sh',
80
100
  },
81
101
  {
82
102
  kind: 'raw',
@@ -129,6 +149,12 @@ const managedFiles = [
129
149
  target: '.github/workflows/pr-preview-cleanup.yml',
130
150
  cloudflareDeployOnly: true,
131
151
  },
152
+ {
153
+ kind: 'generated',
154
+ source: 'pr-stage-sweep-workflow',
155
+ target: '.github/workflows/pr-stage-sweep.yml',
156
+ cloudflareDeployOnly: true,
157
+ },
132
158
  {
133
159
  kind: 'generated',
134
160
  source: 'publish-workflow',
@@ -170,6 +196,31 @@ const managedFiles = [
170
196
  source: 'github/actions/cache-nx/action.yml',
171
197
  target: '.github/actions/cache-nx/action.yml',
172
198
  },
199
+ {
200
+ kind: 'template',
201
+ source: 'github/actions/forgejo-upload-artifact/action.yml',
202
+ target: '.github/actions/forgejo-upload-artifact/action.yml',
203
+ },
204
+ {
205
+ kind: 'template',
206
+ source: 'github/actions/forgejo-upload-artifact/index.cjs',
207
+ target: '.github/actions/forgejo-upload-artifact/index.cjs',
208
+ },
209
+ {
210
+ kind: 'template',
211
+ source: 'github/actions/forgejo-download-artifact/action.yml',
212
+ target: '.github/actions/forgejo-download-artifact/action.yml',
213
+ },
214
+ {
215
+ kind: 'template',
216
+ source: 'github/actions/forgejo-download-artifact/index.cjs',
217
+ target: '.github/actions/forgejo-download-artifact/index.cjs',
218
+ },
219
+ {
220
+ kind: 'template',
221
+ source: 'github/actions/forgejo-artifact.cjs',
222
+ target: '.github/actions/forgejo-artifact.cjs',
223
+ },
173
224
  ];
174
225
  export const managedFileTargetsForTest = managedFiles.map(({ target, executable }) => ({ target, executable }));
175
226
  /**
@@ -250,8 +301,11 @@ function getManagedContent(file, context) {
250
301
  deploySecrets: context.ciDeploySecrets,
251
302
  });
252
303
  }
253
- if (file.source === 'pr-preview-cleanup-workflow') {
254
- return renderPrPreviewCleanupWorkflowYaml({
304
+ if (file.source === 'pr-preview-cleanup-workflow' || file.source === 'pr-stage-sweep-workflow') {
305
+ const render = file.source === 'pr-preview-cleanup-workflow'
306
+ ? renderPrPreviewCleanupWorkflowYaml
307
+ : renderPrStageSweepWorkflowYaml;
308
+ return render({
255
309
  runsOn: context.ciRunsOn,
256
310
  privateNpm: context.privateNpm,
257
311
  sourceCheckouts: context.sourceCheckouts,
@@ -0,0 +1,21 @@
1
+ /**
2
+ * `text` edited to parse as `after`, with every byte the difference does not touch left alone.
3
+ *
4
+ * A managed file that people also write (a tsconfig explaining why it extends what it extends) cannot be
5
+ * regenerated from its parsed value: serializing drops every comment. The generator owns a handful of fields, so it
6
+ * edits those, and the rest of the file is the author's.
7
+ *
8
+ * - A scalar or an object that changed is replaced where it stands; an array that only grew gains its new elements
9
+ * at the end, one that only shrank loses those elements, and any other array is replaced whole (comments inside
10
+ * it go with it: no generator step reorders an array it owns).
11
+ * - A comment that trails an element on its own line belongs to that element: removing the element removes the
12
+ * comment with it, and an element added after it goes after the comment, never between the two. A comment on a
13
+ * line of its own stays wherever it is, including above a key that was removed.
14
+ * - Inserted values are written compactly on a line of their own; their layout is the caller's formatter's to
15
+ * decide, not this function's.
16
+ *
17
+ * The result is checked: text that does not parse to exactly `after` is a fault in this function, not something to
18
+ * write.
19
+ */
20
+ export declare function editJsonText(text: string, after: unknown): string;
21
+ //# sourceMappingURL=json-edit.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"json-edit.d.ts","sourceRoot":"","sources":["../../src/managed-files/json-edit.ts"],"names":[],"mappings":"AAcA;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,GAAG,MAAM,CAejE"}
@@ -0,0 +1,295 @@
1
+ import { isDeepStrictEqual } from 'node:util';
2
+ import { applyEdits, parse, parseTree } from 'jsonc-parser';
3
+ import { isRecord } from '../type-guards.js';
4
+ /**
5
+ * `text` edited to parse as `after`, with every byte the difference does not touch left alone.
6
+ *
7
+ * A managed file that people also write (a tsconfig explaining why it extends what it extends) cannot be
8
+ * regenerated from its parsed value: serializing drops every comment. The generator owns a handful of fields, so it
9
+ * edits those, and the rest of the file is the author's.
10
+ *
11
+ * - A scalar or an object that changed is replaced where it stands; an array that only grew gains its new elements
12
+ * at the end, one that only shrank loses those elements, and any other array is replaced whole (comments inside
13
+ * it go with it: no generator step reorders an array it owns).
14
+ * - A comment that trails an element on its own line belongs to that element: removing the element removes the
15
+ * comment with it, and an element added after it goes after the comment, never between the two. A comment on a
16
+ * line of its own stays wherever it is, including above a key that was removed.
17
+ * - Inserted values are written compactly on a line of their own; their layout is the caller's formatter's to
18
+ * decide, not this function's.
19
+ *
20
+ * The result is checked: text that does not parse to exactly `after` is a fault in this function, not something to
21
+ * write.
22
+ */
23
+ export function editJsonText(text, after) {
24
+ // What the document means, not how a caller built it: a key set to undefined is no key.
25
+ const target = JSON.parse(JSON.stringify(after));
26
+ let edited = text;
27
+ for (const change of changesBetween(parseDocument(text), target, [])) {
28
+ edited = applyEdits(edited, editsFor(edited, change));
29
+ // A repeated key is every one of its properties: one removal leaves the other still in the document.
30
+ while (change.kind === 'remove' && typeof change.path.at(-1) === 'string' && isPresent(edited, change.path)) {
31
+ edited = applyEdits(edited, editsFor(edited, change));
32
+ }
33
+ }
34
+ if (!isDeepStrictEqual(parseDocument(edited), target)) {
35
+ throw new Error('the edited JSON text does not parse to the document the policy produced, so it is not written');
36
+ }
37
+ return edited;
38
+ }
39
+ /** Whether `text` still has a member at `path`. */
40
+ function isPresent(text, path) {
41
+ const root = parseTree(text, undefined, { allowTrailingComma: true });
42
+ return root !== undefined && memberAt(root, path) !== undefined;
43
+ }
44
+ function parseDocument(text) {
45
+ const errors = [];
46
+ const document = parse(text, errors, { allowTrailingComma: true });
47
+ const [first] = errors;
48
+ if (first !== undefined)
49
+ throw new Error(`not valid JSON/JSONC (error ${first.error} at offset ${first.offset})`);
50
+ return document;
51
+ }
52
+ function* changesBetween(before, after, path) {
53
+ if (isRecord(before) && isRecord(after)) {
54
+ for (const key of Object.keys(before)) {
55
+ if (!Object.hasOwn(after, key))
56
+ yield { kind: 'remove', path: [...path, key] };
57
+ }
58
+ for (const [key, value] of Object.entries(after)) {
59
+ if (Object.hasOwn(before, key))
60
+ yield* changesBetween(before[key], value, [...path, key]);
61
+ else
62
+ yield { kind: 'add-key', path, key, value };
63
+ }
64
+ }
65
+ else if (Array.isArray(before) && Array.isArray(after)) {
66
+ yield* arrayChanges(before, after, path);
67
+ }
68
+ else if (!isDeepStrictEqual(before, after)) {
69
+ yield { kind: 'replace', path, value: after };
70
+ }
71
+ }
72
+ function* arrayChanges(before, after, path) {
73
+ if (isDeepStrictEqual(before, after))
74
+ return;
75
+ if (before.every((element, index) => isDeepStrictEqual(element, after[index]))) {
76
+ for (const element of after.slice(before.length))
77
+ yield { kind: 'append', path, value: element };
78
+ return;
79
+ }
80
+ const removed = removedIndexes(before, after);
81
+ if (removed !== null) {
82
+ // Last first, so an index still names the element it did when the changes were derived.
83
+ for (const index of [...removed].reverse())
84
+ yield { kind: 'remove', path: [...path, index] };
85
+ return;
86
+ }
87
+ yield { kind: 'replace', path, value: after };
88
+ }
89
+ /** The indexes of `before` that `after` leaves out, when `after` is `before` with only removals; else null. */
90
+ function removedIndexes(before, after) {
91
+ const removed = [];
92
+ let kept = 0;
93
+ before.forEach((element, index) => {
94
+ if (kept < after.length && isDeepStrictEqual(element, after[kept]))
95
+ kept += 1;
96
+ else
97
+ removed.push(index);
98
+ });
99
+ return kept === after.length ? removed : null;
100
+ }
101
+ /** The edits that make `change` to `text`, found by walking the text's own syntax tree. */
102
+ function editsFor(text, change) {
103
+ const root = parseTree(text, undefined, { allowTrailingComma: true });
104
+ const member = root === undefined ? undefined : memberAt(root, change.path);
105
+ if (member === undefined)
106
+ throw new Error(`no ${JSON.stringify(change.path)} in the JSON text to edit`);
107
+ switch (change.kind) {
108
+ case 'replace': {
109
+ const value = valueNodeOf(member);
110
+ return [{ offset: value.offset, length: value.length, content: JSON.stringify(change.value) }];
111
+ }
112
+ case 'remove':
113
+ return removal(text, member);
114
+ case 'add-key':
115
+ return insertion(text, valueNodeOf(member), `${JSON.stringify(change.key)}: ${JSON.stringify(change.value)}`);
116
+ case 'append':
117
+ return insertion(text, valueNodeOf(member), JSON.stringify(change.value));
118
+ }
119
+ }
120
+ /** The node a path names: the property for a key, the element for an index, the root for no path. */
121
+ function memberAt(root, path) {
122
+ let member = root;
123
+ for (const segment of path) {
124
+ if (member === undefined)
125
+ return undefined;
126
+ const container = valueNodeOf(member);
127
+ member = typeof segment === 'number' ? container.children?.[segment] : lastProperty(container, segment);
128
+ }
129
+ return member;
130
+ }
131
+ /** The value a member holds: a property's value, or an element itself. */
132
+ function valueNodeOf(member) {
133
+ return member.type === 'property' ? (member.children?.[1] ?? member) : member;
134
+ }
135
+ /** The last property of an object with this key: a parser keeps the last of duplicate keys, so that is the one that means something. */
136
+ function lastProperty(object, key) {
137
+ if (object.type !== 'object')
138
+ return undefined;
139
+ const properties = object.children ?? [];
140
+ for (let index = properties.length - 1; index >= 0; index--) {
141
+ const property = properties[index];
142
+ if (property?.children?.[0]?.value === key)
143
+ return property;
144
+ }
145
+ return undefined;
146
+ }
147
+ /** The edits that add `entry` after the last member of `container`, or inside it when it is empty. */
148
+ function insertion(text, container, entry) {
149
+ if (container.type !== 'object' && container.type !== 'array')
150
+ throw new Error('only an object or an array can gain a member');
151
+ const last = container.children?.at(-1);
152
+ if (last === undefined)
153
+ return [{ offset: container.offset + 1, length: 0, content: entry }];
154
+ const lastEnd = last.offset + last.length;
155
+ const closer = container.offset + container.length - 1;
156
+ const separator = separatorAfter(text, lastEnd, closer);
157
+ // After the comments on the last member's line, and after its separator when that is on a later line.
158
+ const at = Math.max(sameLineEnd(text, lastEnd, closer), separator === null ? 0 : separator + 1);
159
+ // A trailing comma the author wrote stays, one comma further along.
160
+ const added = `\n${entry}${separator === null ? '' : ','}`;
161
+ if (separator !== null)
162
+ return [{ offset: at, length: 0, content: added }];
163
+ // No separator yet: it goes straight after the member, ahead of its comments.
164
+ return at === lastEnd
165
+ ? [{ offset: lastEnd, length: 0, content: `,${added}` }]
166
+ : [
167
+ { offset: lastEnd, length: 0, content: ',' },
168
+ { offset: at, length: 0, content: added },
169
+ ];
170
+ }
171
+ /**
172
+ * The edits that delete a member of an object or array: its text, its separator, and the comments that trail it on
173
+ * its line, plus the whole line when it has the line to itself. The member before a last one loses its separator so
174
+ * no comma is left dangling.
175
+ */
176
+ function removal(text, member) {
177
+ const container = member.parent;
178
+ const siblings = container?.children;
179
+ if (container === undefined || siblings === undefined)
180
+ throw new Error('a JSON value with no container cannot be removed');
181
+ const index = siblings.indexOf(member);
182
+ const previous = siblings[index - 1];
183
+ const memberEnd = member.offset + member.length;
184
+ const limit = siblings[index + 1]?.offset ?? container.offset + container.length - 1;
185
+ const separator = separatorAfter(text, memberEnd, limit);
186
+ const { from, to } = wholeLines(text, member.offset, sameLineEnd(text, memberEnd, limit));
187
+ const edits = [{ offset: from, length: to - from, content: '' }];
188
+ // A separator on a later line (a leading-comma style) is not part of the member's line.
189
+ if (separator !== null && separator >= to)
190
+ edits.push({ offset: separator, length: 1, content: '' });
191
+ if (separator === null && previous !== undefined) {
192
+ const own = separatorAfter(text, previous.offset + previous.length, member.offset);
193
+ if (own !== null)
194
+ edits.push({ offset: own, length: 1, content: '' });
195
+ }
196
+ return edits;
197
+ }
198
+ /** The span `start`..`end` widened to its whole lines, when nothing else is on them. */
199
+ function wholeLines(text, start, end) {
200
+ let from = start;
201
+ while (from > 0 && isHorizontalSpace(text[from - 1]))
202
+ from -= 1;
203
+ let to = end;
204
+ while (to < text.length && isHorizontalSpace(text[to]))
205
+ to += 1;
206
+ const alone = from === 0 || isLineBreak(text[from - 1]);
207
+ const lineBreak = text.startsWith('\r\n', to) ? 2 : isLineBreak(text[to]) ? 1 : 0;
208
+ return alone && lineBreak > 0 ? { from, to: to + lineBreak } : { from: start, to: end };
209
+ }
210
+ /** The offset of the separating comma in `text[from, limit)`, skipping comments; null when there is none. */
211
+ function separatorAfter(text, from, limit) {
212
+ let index = from;
213
+ while (index < limit) {
214
+ const char = text[index];
215
+ if (char === ',')
216
+ return index;
217
+ if (text.startsWith('//', index))
218
+ index = lineEnd(text, index, limit);
219
+ else if (text.startsWith('/*', index))
220
+ index = blockEnd(text, index, limit);
221
+ else if (isHorizontalSpace(char) || isLineBreak(char))
222
+ index += 1;
223
+ else
224
+ return null;
225
+ }
226
+ return null;
227
+ }
228
+ /**
229
+ * The end of what trails a member on its line: its comma if that is on the line, and the comments after it. A comment
230
+ * after the comma with a value behind it on the line leads that value, so it is not the member's to take.
231
+ */
232
+ function sameLineEnd(text, from, limit) {
233
+ let end = from;
234
+ let index = from;
235
+ let sawComma = false;
236
+ while (index < limit) {
237
+ const char = text[index];
238
+ if (isHorizontalSpace(char)) {
239
+ index += 1;
240
+ }
241
+ else if (char === ',' && !sawComma) {
242
+ sawComma = true;
243
+ index += 1;
244
+ end = index;
245
+ }
246
+ else if (text.startsWith('/*', index)) {
247
+ const close = blockEnd(text, index, limit);
248
+ if (sawComma && !onlyTriviaToLineEnd(text, close, limit))
249
+ break;
250
+ index = end = close;
251
+ }
252
+ else if (text.startsWith('//', index)) {
253
+ return lineEnd(text, index, limit);
254
+ }
255
+ else {
256
+ break;
257
+ }
258
+ }
259
+ return end;
260
+ }
261
+ /**
262
+ * Whether nothing but whitespace and comments is left on the line from `from`. `limit` is where the next member
263
+ * starts, or the container's closer: reaching a member on the line is not "nothing left".
264
+ */
265
+ function onlyTriviaToLineEnd(text, from, limit) {
266
+ let index = from;
267
+ while (index < limit) {
268
+ const char = text[index];
269
+ if (isHorizontalSpace(char))
270
+ index += 1;
271
+ else if (text.startsWith('/*', index))
272
+ index = blockEnd(text, index, limit);
273
+ else
274
+ return text.startsWith('//', index) || isLineBreak(char);
275
+ }
276
+ const atLimit = text[limit];
277
+ return atLimit === '}' || atLimit === ']' || atLimit === undefined;
278
+ }
279
+ /** Where a `//` comment ends: at the line break, which jsonc-parser takes as `\n` or `\r`. */
280
+ function lineEnd(text, from, limit) {
281
+ let index = from;
282
+ while (index < limit && !isLineBreak(text[index]))
283
+ index += 1;
284
+ return index;
285
+ }
286
+ function blockEnd(text, from, limit) {
287
+ const close = text.indexOf('*/', from + 2);
288
+ return close === -1 ? limit : Math.min(close + 2, limit);
289
+ }
290
+ function isHorizontalSpace(char) {
291
+ return char === ' ' || char === '\t';
292
+ }
293
+ function isLineBreak(char) {
294
+ return char === '\n' || char === '\r';
295
+ }