@vibe-agent-toolkit/utils 0.2.0-rc.10 → 0.2.0-rc.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +112 -10
- package/dist/archive/archive.d.ts +129 -0
- package/dist/archive/archive.d.ts.map +1 -0
- package/dist/archive/archive.js +223 -0
- package/dist/archive/archive.js.map +1 -0
- package/dist/archive/entries.d.ts +132 -0
- package/dist/archive/entries.d.ts.map +1 -0
- package/dist/archive/entries.js +223 -0
- package/dist/archive/entries.js.map +1 -0
- package/dist/archive/limits.d.ts +39 -0
- package/dist/archive/limits.d.ts.map +1 -0
- package/dist/archive/limits.js +59 -0
- package/dist/archive/limits.js.map +1 -0
- package/dist/archive/records.d.ts +14 -0
- package/dist/archive/records.d.ts.map +1 -0
- package/dist/archive/records.js +3 -0
- package/dist/archive/records.js.map +1 -0
- package/dist/archive/tar-reader.d.ts +18 -0
- package/dist/archive/tar-reader.d.ts.map +1 -0
- package/dist/archive/tar-reader.js +173 -0
- package/dist/archive/tar-reader.js.map +1 -0
- package/dist/archive/zip-reader.d.ts +76 -0
- package/dist/archive/zip-reader.d.ts.map +1 -0
- package/dist/archive/zip-reader.js +376 -0
- package/dist/archive/zip-reader.js.map +1 -0
- package/dist/archive.d.ts +14 -0
- package/dist/archive.d.ts.map +1 -0
- package/dist/archive.js +12 -0
- package/dist/archive.js.map +1 -0
- package/dist/asset-reference.d.ts +17 -1
- package/dist/asset-reference.d.ts.map +1 -1
- package/dist/asset-reference.js +31 -7
- package/dist/asset-reference.js.map +1 -1
- package/dist/dirent-kind.d.ts +13 -40
- package/dist/dirent-kind.d.ts.map +1 -1
- package/dist/dirent-kind.js +21 -69
- package/dist/dirent-kind.js.map +1 -1
- package/dist/entrypoint.d.ts +2 -2
- package/dist/entrypoint.d.ts.map +1 -1
- package/dist/entrypoint.js +4 -3
- package/dist/entrypoint.js.map +1 -1
- package/dist/env-flag.d.ts +13 -5
- package/dist/env-flag.d.ts.map +1 -1
- package/dist/env-flag.js +13 -5
- package/dist/env-flag.js.map +1 -1
- package/dist/errors/confirmed-absent.d.ts +41 -0
- package/dist/errors/confirmed-absent.d.ts.map +1 -0
- package/dist/errors/confirmed-absent.js +43 -0
- package/dist/errors/confirmed-absent.js.map +1 -0
- package/dist/errors/errno-table.d.ts +177 -0
- package/dist/errors/errno-table.d.ts.map +1 -0
- package/dist/errors/errno-table.js +343 -0
- package/dist/errors/errno-table.js.map +1 -0
- package/dist/errors/fs-boundary.d.ts +36 -0
- package/dist/errors/fs-boundary.d.ts.map +1 -0
- package/dist/errors/fs-boundary.js +121 -0
- package/dist/errors/fs-boundary.js.map +1 -0
- package/dist/errors/fs-fault.d.ts +176 -0
- package/dist/errors/fs-fault.d.ts.map +1 -0
- package/dist/errors/fs-fault.js +215 -0
- package/dist/errors/fs-fault.js.map +1 -0
- package/dist/errors/git-errno.d.ts +13 -0
- package/dist/errors/git-errno.d.ts.map +1 -0
- package/dist/errors/git-errno.js +45 -0
- package/dist/errors/git-errno.js.map +1 -0
- package/dist/errors/path-present.d.ts +72 -0
- package/dist/errors/path-present.d.ts.map +1 -0
- package/dist/errors/path-present.js +110 -0
- package/dist/errors/path-present.js.map +1 -0
- package/dist/errors/rag-index-empty.d.ts +16 -0
- package/dist/errors/rag-index-empty.d.ts.map +1 -0
- package/dist/errors/rag-index-empty.js +16 -0
- package/dist/errors/rag-index-empty.js.map +1 -0
- package/dist/errors/suppressed-faults.d.ts +34 -0
- package/dist/errors/suppressed-faults.d.ts.map +1 -0
- package/dist/errors/suppressed-faults.js +66 -0
- package/dist/errors/suppressed-faults.js.map +1 -0
- package/dist/file-crawler.d.ts +13 -18
- package/dist/file-crawler.d.ts.map +1 -1
- package/dist/file-crawler.js +140 -24
- package/dist/file-crawler.js.map +1 -1
- package/dist/fs-utils.d.ts +75 -50
- package/dist/fs-utils.d.ts.map +1 -1
- package/dist/fs-utils.js +148 -158
- package/dist/fs-utils.js.map +1 -1
- package/dist/fs.d.ts +5 -4
- package/dist/fs.d.ts.map +1 -1
- package/dist/fs.js +5 -4
- package/dist/fs.js.map +1 -1
- package/dist/git-snapshot.d.ts +25 -17
- package/dist/git-snapshot.d.ts.map +1 -1
- package/dist/git-snapshot.js +65 -11
- package/dist/git-snapshot.js.map +1 -1
- package/dist/git-tracker.d.ts +11 -3
- package/dist/git-tracker.d.ts.map +1 -1
- package/dist/git-tracker.js +29 -6
- package/dist/git-tracker.js.map +1 -1
- package/dist/git-utils.d.ts.map +1 -1
- package/dist/git-utils.js +7 -35
- package/dist/git-utils.js.map +1 -1
- package/dist/git.d.ts +1 -1
- package/dist/git.d.ts.map +1 -1
- package/dist/git.js +1 -1
- package/dist/git.js.map +1 -1
- package/dist/gitignore-checker.d.ts.map +1 -1
- package/dist/gitignore-checker.js +5 -4
- package/dist/gitignore-checker.js.map +1 -1
- package/dist/in-order.d.ts +93 -0
- package/dist/in-order.d.ts.map +1 -0
- package/dist/in-order.js +165 -0
- package/dist/in-order.js.map +1 -0
- package/dist/index.d.ts +20 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +30 -4
- package/dist/index.js.map +1 -1
- package/dist/kill-process-tree.d.ts +43 -0
- package/dist/kill-process-tree.d.ts.map +1 -0
- package/dist/kill-process-tree.js +48 -0
- package/dist/kill-process-tree.js.map +1 -0
- package/dist/link-following.d.ts +115 -0
- package/dist/link-following.d.ts.map +1 -0
- package/dist/link-following.js +283 -0
- package/dist/link-following.js.map +1 -0
- package/dist/listing-refusal.d.ts +44 -0
- package/dist/listing-refusal.d.ts.map +1 -1
- package/dist/listing-refusal.js +79 -2
- package/dist/listing-refusal.js.map +1 -1
- package/dist/name-fold.d.ts +25 -0
- package/dist/name-fold.d.ts.map +1 -0
- package/dist/name-fold.js +40 -0
- package/dist/name-fold.js.map +1 -0
- package/dist/path-containment.d.ts +17 -0
- package/dist/path-containment.d.ts.map +1 -1
- package/dist/path-containment.js +28 -5
- package/dist/path-containment.js.map +1 -1
- package/dist/path-utils.d.ts +14 -17
- package/dist/path-utils.d.ts.map +1 -1
- package/dist/path-utils.js +37 -55
- package/dist/path-utils.js.map +1 -1
- package/dist/process.d.ts +2 -0
- package/dist/process.d.ts.map +1 -1
- package/dist/process.js +2 -0
- package/dist/process.js.map +1 -1
- package/dist/project-utils.d.ts.map +1 -1
- package/dist/project-utils.js +8 -9
- package/dist/project-utils.js.map +1 -1
- package/dist/safe-exec.d.ts +6 -2
- package/dist/safe-exec.d.ts.map +1 -1
- package/dist/safe-exec.js +1 -1
- package/dist/safe-exec.js.map +1 -1
- package/dist/skill-targets.d.ts.map +1 -1
- package/dist/skill-targets.js +3 -1
- package/dist/skill-targets.js.map +1 -1
- package/dist/skill-test/spawn-claude.d.ts +0 -15
- package/dist/skill-test/spawn-claude.d.ts.map +1 -1
- package/dist/skill-test/spawn-claude.js +11 -50
- package/dist/skill-test/spawn-claude.js.map +1 -1
- package/dist/special-file.d.ts +18 -0
- package/dist/special-file.d.ts.map +1 -0
- package/dist/special-file.js +21 -0
- package/dist/special-file.js.map +1 -0
- package/dist/terminating-signals.d.ts +129 -0
- package/dist/terminating-signals.d.ts.map +1 -0
- package/dist/terminating-signals.js +210 -0
- package/dist/terminating-signals.js.map +1 -0
- package/dist/test-helpers.d.ts +9 -5
- package/dist/test-helpers.d.ts.map +1 -1
- package/dist/test-helpers.js +18 -21
- package/dist/test-helpers.js.map +1 -1
- package/dist/test-scratch-guard.d.ts +34 -0
- package/dist/test-scratch-guard.d.ts.map +1 -0
- package/dist/test-scratch-guard.js +45 -0
- package/dist/test-scratch-guard.js.map +1 -0
- package/dist/testing/archive-fixtures.d.ts +147 -0
- package/dist/testing/archive-fixtures.d.ts.map +1 -0
- package/dist/testing/archive-fixtures.js +449 -0
- package/dist/testing/archive-fixtures.js.map +1 -0
- package/dist/testing/executables.d.ts +6 -0
- package/dist/testing/executables.d.ts.map +1 -1
- package/dist/testing/executables.js +20 -9
- package/dist/testing/executables.js.map +1 -1
- package/dist/testing/fault-fs-preload.d.ts +16 -0
- package/dist/testing/fault-fs-preload.d.ts.map +1 -0
- package/dist/testing/fault-fs-preload.js +22 -0
- package/dist/testing/fault-fs-preload.js.map +1 -0
- package/dist/testing/fault-fs.d.ts +115 -0
- package/dist/testing/fault-fs.d.ts.map +1 -0
- package/dist/testing/fault-fs.js +411 -0
- package/dist/testing/fault-fs.js.map +1 -0
- package/dist/testing/fault-spec.d.ts +83 -0
- package/dist/testing/fault-spec.d.ts.map +1 -0
- package/dist/testing/fault-spec.js +132 -0
- package/dist/testing/fault-spec.js.map +1 -0
- package/dist/testing/hostile-tree.d.ts.map +1 -1
- package/dist/testing/hostile-tree.js +3 -4
- package/dist/testing/hostile-tree.js.map +1 -1
- package/dist/testing/platform-gates.d.ts +8 -0
- package/dist/testing/platform-gates.d.ts.map +1 -1
- package/dist/testing/platform-gates.js +24 -0
- package/dist/testing/platform-gates.js.map +1 -1
- package/dist/testing/temp-dir.d.ts +31 -0
- package/dist/testing/temp-dir.d.ts.map +1 -1
- package/dist/testing/temp-dir.js +63 -0
- package/dist/testing/temp-dir.js.map +1 -1
- package/dist/testing/tier-timeout.d.ts +34 -0
- package/dist/testing/tier-timeout.d.ts.map +1 -0
- package/dist/testing/tier-timeout.js +45 -0
- package/dist/testing/tier-timeout.js.map +1 -0
- package/dist/testing/tree-snapshot.d.ts +71 -0
- package/dist/testing/tree-snapshot.d.ts.map +1 -0
- package/dist/testing/tree-snapshot.js +163 -0
- package/dist/testing/tree-snapshot.js.map +1 -0
- package/dist/testing.d.ts +6 -0
- package/dist/testing.d.ts.map +1 -1
- package/dist/testing.js +8 -1
- package/dist/testing.js.map +1 -1
- package/dist/text-content.d.ts +29 -0
- package/dist/text-content.d.ts.map +1 -1
- package/dist/text-content.js +64 -0
- package/dist/text-content.js.map +1 -1
- package/dist/text-file.d.ts +58 -6
- package/dist/text-file.d.ts.map +1 -1
- package/dist/text-file.js +111 -11
- package/dist/text-file.js.map +1 -1
- package/dist/text.d.ts +1 -1
- package/dist/text.d.ts.map +1 -1
- package/dist/text.js +1 -1
- package/dist/text.js.map +1 -1
- package/dist/timing-dump.d.ts.map +1 -1
- package/dist/timing-dump.js +2 -10
- package/dist/timing-dump.js.map +1 -1
- package/dist/tree-change/apply-decisions.d.ts +101 -0
- package/dist/tree-change/apply-decisions.d.ts.map +1 -0
- package/dist/tree-change/apply-decisions.js +139 -0
- package/dist/tree-change/apply-decisions.js.map +1 -0
- package/dist/tree-change/apply.d.ts +98 -0
- package/dist/tree-change/apply.d.ts.map +1 -0
- package/dist/tree-change/apply.js +364 -0
- package/dist/tree-change/apply.js.map +1 -0
- package/dist/tree-change/copy-decisions.d.ts +58 -0
- package/dist/tree-change/copy-decisions.d.ts.map +1 -0
- package/dist/tree-change/copy-decisions.js +66 -0
- package/dist/tree-change/copy-decisions.js.map +1 -0
- package/dist/tree-change/copy-tree.d.ts +125 -0
- package/dist/tree-change/copy-tree.d.ts.map +1 -0
- package/dist/tree-change/copy-tree.js +279 -0
- package/dist/tree-change/copy-tree.js.map +1 -0
- package/dist/tree-change/files.d.ts +167 -0
- package/dist/tree-change/files.d.ts.map +1 -0
- package/dist/tree-change/files.js +423 -0
- package/dist/tree-change/files.js.map +1 -0
- package/dist/tree-change/followed-walk.d.ts +54 -0
- package/dist/tree-change/followed-walk.d.ts.map +1 -0
- package/dist/tree-change/followed-walk.js +81 -0
- package/dist/tree-change/followed-walk.js.map +1 -0
- package/dist/tree-change/host-chain.d.ts +48 -0
- package/dist/tree-change/host-chain.d.ts.map +1 -0
- package/dist/tree-change/host-chain.js +85 -0
- package/dist/tree-change/host-chain.js.map +1 -0
- package/dist/tree-change/identity-compare.d.ts +61 -0
- package/dist/tree-change/identity-compare.d.ts.map +1 -0
- package/dist/tree-change/identity-compare.js +115 -0
- package/dist/tree-change/identity-compare.js.map +1 -0
- package/dist/tree-change/identity.d.ts +62 -0
- package/dist/tree-change/identity.d.ts.map +1 -0
- package/dist/tree-change/identity.js +152 -0
- package/dist/tree-change/identity.js.map +1 -0
- package/dist/tree-change/index.d.ts +24 -0
- package/dist/tree-change/index.d.ts.map +1 -0
- package/dist/tree-change/index.js +14 -0
- package/dist/tree-change/index.js.map +1 -0
- package/dist/tree-change/link-chain.d.ts +180 -0
- package/dist/tree-change/link-chain.d.ts.map +1 -0
- package/dist/tree-change/link-chain.js +377 -0
- package/dist/tree-change/link-chain.js.map +1 -0
- package/dist/tree-change/link-containment.d.ts +105 -0
- package/dist/tree-change/link-containment.d.ts.map +1 -0
- package/dist/tree-change/link-containment.js +196 -0
- package/dist/tree-change/link-containment.js.map +1 -0
- package/dist/tree-change/link-walk.d.ts +49 -0
- package/dist/tree-change/link-walk.d.ts.map +1 -0
- package/dist/tree-change/link-walk.js +69 -0
- package/dist/tree-change/link-walk.js.map +1 -0
- package/dist/tree-change/plan.d.ts +206 -0
- package/dist/tree-change/plan.d.ts.map +1 -0
- package/dist/tree-change/plan.js +320 -0
- package/dist/tree-change/plan.js.map +1 -0
- package/dist/tree-change/readable-tree.d.ts +44 -0
- package/dist/tree-change/readable-tree.d.ts.map +1 -0
- package/dist/tree-change/readable-tree.js +52 -0
- package/dist/tree-change/readable-tree.js.map +1 -0
- package/dist/tree-change/rollback-error.d.ts +29 -0
- package/dist/tree-change/rollback-error.d.ts.map +1 -0
- package/dist/tree-change/rollback-error.js +31 -0
- package/dist/tree-change/rollback-error.js.map +1 -0
- package/dist/tree-change/staging-names.d.ts +27 -0
- package/dist/tree-change/staging-names.d.ts.map +1 -0
- package/dist/tree-change/staging-names.js +40 -0
- package/dist/tree-change/staging-names.js.map +1 -0
- package/dist/tree-change/tree-walk.d.ts +81 -0
- package/dist/tree-change/tree-walk.d.ts.map +1 -0
- package/dist/tree-change/tree-walk.js +212 -0
- package/dist/tree-change/tree-walk.js.map +1 -0
- package/dist/win32-namespace.d.ts +24 -0
- package/dist/win32-namespace.d.ts.map +1 -0
- package/dist/win32-namespace.js +31 -0
- package/dist/win32-namespace.js.map +1 -0
- package/dist/yaml/surgical-yaml.d.ts +12 -3
- package/dist/yaml/surgical-yaml.d.ts.map +1 -1
- package/dist/yaml/surgical-yaml.js +16 -6
- package/dist/yaml/surgical-yaml.js.map +1 -1
- package/eslint/README.md +12 -4
- package/eslint/rules/fs-binding-scan.cjs +278 -0
- package/eslint/rules/no-adhoc-errno.cjs +364 -0
- package/eslint/rules/no-bare-symlink-in-tests.cjs +2 -3
- package/eslint/rules/no-blind-catch.cjs +1 -1
- package/eslint/rules/no-destructive-fs.cjs +359 -0
- package/eslint/rules/no-existssync.cjs +70 -0
- package/eslint/rules/no-fragile-entrypoint-guard.cjs +3 -2
- package/eslint/rules/no-link-following-fs.cjs +68 -0
- package/eslint/rules/no-literal-process-exit.cjs +96 -8
- package/eslint/rules/no-literal-test-timeout.cjs +214 -0
- package/eslint/rules/no-raw-signal-listener.cjs +224 -0
- package/eslint/rules/no-stdout-outside-writer.cjs +135 -0
- package/package.json +10 -2
- package/dist/errors/errno.d.ts +0 -51
- package/dist/errors/errno.d.ts.map +0 -1
- package/dist/errors/errno.js +0 -112
- package/dist/errors/errno.js.map +0 -1
- package/eslint/rules/no-fs-promises-cp.cjs +0 -43
package/dist/text-file.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"text-file.js","sourceRoot":"","sources":["../src/text-file.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"text-file.js","sourceRoot":"","sources":["../src/text-file.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAAE,SAAS,EAAE,SAAS,IAAI,WAAW,EAAE,SAAS,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACjG,OAAO,EAAE,IAAI,EAAmB,MAAM,kBAAkB,CAAC;AAEzD,OAAO,EAAE,iBAAiB,EAA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GAUG;AACH,MAAM,CAAC,KAAK,UAAU,cAAc,CAAC,QAAgB;IACnD,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,QAAQ,EAAE,mBAAmB,EAAE,CAAC,CAAC;IAC3D,IAAI,CAAC;QACH,iBAAiB,CAAC,MAAM,MAAM,CAAC,IAAI,EAAE,EAAE,QAAQ,CAAC,CAAC;QACjD,OAAO,MAAM,CAAC;IAChB,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,MAAM,MAAM,CAAC,KAAK,EAAE,CAAC;QACrB,MAAM,KAAK,CAAC;IACd,CAAC;AACH,CAAC;AAED;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,MAAM,CAAC,KAAK,UAAU,kBAAkB,CAAC,QAAgB;IACvD,MAAM,MAAM,GAAG,MAAM,cAAc,CAAC,QAAQ,CAAC,CAAC;IAC9C,IAAI,CAAC;QACH,qBAAqB,CAAC,CAAC,MAAM,MAAM,CAAC,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC;QAClD,OAAO,MAAM,MAAM,CAAC,QAAQ,EAAE,CAAC;IACjC,CAAC;YAAS,CAAC;QACT,MAAM,MAAM,CAAC,KAAK,EAAE,CAAC;IACvB,CAAC;AACH,CAAC"}
|
package/dist/text.d.ts
CHANGED
|
@@ -12,5 +12,5 @@
|
|
|
12
12
|
* `readTextContent` from `@vibe-agent-toolkit/utils/fs`, which is this plus a
|
|
13
13
|
* `readFile`.
|
|
14
14
|
*/
|
|
15
|
-
export { decodeTextContent, type DecodedText, type EncodingSource, type TextEncoding, type TextProvenance, } from './text-content.js';
|
|
15
|
+
export { decodeTextContent, type DecodedText, type EncodingSource, type TextEncoding, type TextProvenance, TextTooLargeError, } from './text-content.js';
|
|
16
16
|
//# sourceMappingURL=text.d.ts.map
|
package/dist/text.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"text.d.ts","sourceRoot":"","sources":["../src/text.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,EACL,iBAAiB,EACjB,KAAK,WAAW,EAChB,KAAK,cAAc,EACnB,KAAK,YAAY,EACjB,KAAK,cAAc,
|
|
1
|
+
{"version":3,"file":"text.d.ts","sourceRoot":"","sources":["../src/text.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,EACL,iBAAiB,EACjB,KAAK,WAAW,EAChB,KAAK,cAAc,EACnB,KAAK,YAAY,EACjB,KAAK,cAAc,EACnB,iBAAiB,GAClB,MAAM,mBAAmB,CAAC"}
|
package/dist/text.js
CHANGED
|
@@ -12,5 +12,5 @@
|
|
|
12
12
|
* `readTextContent` from `@vibe-agent-toolkit/utils/fs`, which is this plus a
|
|
13
13
|
* `readFile`.
|
|
14
14
|
*/
|
|
15
|
-
export { decodeTextContent, } from './text-content.js';
|
|
15
|
+
export { decodeTextContent, TextTooLargeError, } from './text-content.js';
|
|
16
16
|
//# sourceMappingURL=text.js.map
|
package/dist/text.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"text.js","sourceRoot":"","sources":["../src/text.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,EACL,iBAAiB,
|
|
1
|
+
{"version":3,"file":"text.js","sourceRoot":"","sources":["../src/text.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,EACL,iBAAiB,EAKjB,iBAAiB,GAClB,MAAM,mBAAmB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"timing-dump.d.ts","sourceRoot":"","sources":["../src/timing-dump.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgDG;
|
|
1
|
+
{"version":3,"file":"timing-dump.d.ts","sourceRoot":"","sources":["../src/timing-dump.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgDG;AAQH;;;;;;;;GAQG;AACH,MAAM,WAAW,aAAa;IAC5B,6CAA6C;IAC7C,MAAM,EAAE,MAAM,CAAC;IACf,gEAAgE;IAChE,SAAS,EAAE,MAAM,CAAC;IAClB,kEAAkE;IAClE,WAAW,EAAE,MAAM,CAAC;CACrB;AAQD;;;;;;;;GAQG;AACH,eAAO,MAAM,mBAAmB,OAAO,CAAC;AA6BxC;;;;;;;;;GASG;AACH,wBAAgB,wBAAwB,CAAC,GAAG,EAAE,MAAM,GAAG,SAAS,GAAG,MAAM,GAAG,IAAI,CAE/E;AAED;;;;;;;;;GASG;AACH,wBAAgB,uBAAuB,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,GAAG,IAAI,CAG1F;AAED;;;;;;;;;GASG;AACH,wBAAgB,qBAAqB,CAAC,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,IAAI,CAM3E;AAED;;;;;;;;;GASG;AACH,wBAAgB,iBAAiB,IAAI,aAAa,CAOjD;AA+CD;;;;;;;;;;;;;GAaG;AACH,wBAAgB,eAAe,CAC7B,IAAI,EAAE,MAAM,EACZ,SAAS,EAAE,MAAM,GAAG,IAAI,EACxB,QAAQ,EAAE,MAAM,EAChB,KAAK,EAAE,MAAM,OAAO,GACnB,MAAM,GAAG,IAAI,CAoBf"}
|
package/dist/timing-dump.js
CHANGED
|
@@ -48,6 +48,7 @@
|
|
|
48
48
|
* itself is its accumulator shape, its dump body and the noun it is called by.
|
|
49
49
|
*/
|
|
50
50
|
import { writeFileSync } from 'node:fs';
|
|
51
|
+
import { isAlreadyExistsError } from './errors/errno-table.js';
|
|
51
52
|
import { safePath } from './path-core.js';
|
|
52
53
|
import { mkdirSyncReal } from './path-utils.js';
|
|
53
54
|
/** `process.cpuUsage()` reports microseconds; a dump reports milliseconds. */
|
|
@@ -152,15 +153,6 @@ function timingDumpCandidate(directory, stem, collision) {
|
|
|
152
153
|
const suffix = collision === 0 ? '' : `-${String(collision)}`;
|
|
153
154
|
return safePath.join(directory, `${stem}${suffix}.json`);
|
|
154
155
|
}
|
|
155
|
-
/**
|
|
156
|
-
* Whether a caught write failure means somebody else already holds the name.
|
|
157
|
-
*
|
|
158
|
-
* @param error - Whatever `writeFileSync` threw
|
|
159
|
-
* @returns `true` only for `EEXIST`, which is a lost race and not a fault
|
|
160
|
-
*/
|
|
161
|
-
function isNameAlreadyTaken(error) {
|
|
162
|
-
return error instanceof Error && 'code' in error && error.code === 'EEXIST';
|
|
163
|
-
}
|
|
164
156
|
/**
|
|
165
157
|
* Claim a name by creating it, and fill it in the same operation.
|
|
166
158
|
*
|
|
@@ -185,7 +177,7 @@ function claimTimingDump(directory, basename, contents) {
|
|
|
185
177
|
return { outcome: 'written', path: candidate };
|
|
186
178
|
}
|
|
187
179
|
catch (error) {
|
|
188
|
-
if (!
|
|
180
|
+
if (!isAlreadyExistsError(error))
|
|
189
181
|
return { outcome: 'failed', path: candidate, error };
|
|
190
182
|
}
|
|
191
183
|
}
|
package/dist/timing-dump.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"timing-dump.js","sourceRoot":"","sources":["../src/timing-dump.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgDG;AAEH,OAAO,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAExC,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAC1C,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAoBhD,8EAA8E;AAC9E,MAAM,mBAAmB,GAAG,IAAI,CAAC;AAEjC,uEAAuE;AACvE,MAAM,aAAa,GAAG,IAAI,CAAC;AAE3B;;;;;;;;GAQG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAG,IAAI,CAAC;AAExC;;;;;;;;;GASG;AACH,MA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K,CAAC,CAAC;QAChD,OAAO,IAAI,CAAC;IACd,CAAC;IAED,IAAI,KAAK,CAAC,OAAO,KAAK,SAAS;QAAE,OAAO,KAAK,CAAC,IAAI,CAAC;IACnD,uBAAuB,CACrB,IAAI,EACJ,KAAK,CAAC,IAAI,EACV,KAAK,CAAC,OAAO,KAAK,WAAW,CAAC,CAAC,CAAC,cAAc,CAAC,CAAC,CAAC,KAAK,CAAC,KAAK,CAC7D,CAAC;IACF,OAAO,IAAI,CAAC;AACd,CAAC"}
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The decisions of the apply half of the tree-change primitive, and of its file helpers, that touch
|
|
3
|
+
* no filesystem: each is handed what was read and answers what to do. `apply.ts` and `files.ts` are
|
|
4
|
+
* the halves that make the calls — and hold nothing else to decide.
|
|
5
|
+
*/
|
|
6
|
+
import { type FsFaultFacts } from '../errors/errno-table.js';
|
|
7
|
+
import { FsFaultError, type FsSide } from '../errors/fs-fault.js';
|
|
8
|
+
import { VatError } from '../errors/vat-error.js';
|
|
9
|
+
import type { EntryKind, PlannedChange } from './plan.js';
|
|
10
|
+
/** {@link tempDirRefusal}: a directory to dispose of that is not strictly under the temp directory — a defect in the caller. */
|
|
11
|
+
export declare const TEMP_DIR_OUTSIDE_TMPDIR_CODE = "TEMP_DIR_OUTSIDE_TMPDIR";
|
|
12
|
+
/** A replaced entry, parked once the new one was live, that could not be removed. */
|
|
13
|
+
export declare const TREE_CLEANUP_INCOMPLETE_CODE = "TREE_CLEANUP_INCOMPLETE";
|
|
14
|
+
/**
|
|
15
|
+
* Whether a `write` fill's failure is the DESTINATION's: a path the failing call acted on
|
|
16
|
+
* ({@link pathsActedOn} — the one reading of an errno's two paths, so never a symlink's target
|
|
17
|
+
* text) is under the staged tree, all the callback may write. Anything else, an input the
|
|
18
|
+
* callback read (a sibling of the destination included), is not: it is rethrown as it was, for
|
|
19
|
+
* the verb's boundary to classify.
|
|
20
|
+
*
|
|
21
|
+
* @param facts - The errno, the call and the paths the OS named
|
|
22
|
+
* @param sideOf - The side a path is on, with the staged tree as the only `destination`
|
|
23
|
+
*/
|
|
24
|
+
export declare function fillFaultIsDestinations(facts: FsFaultFacts, sideOf: (path: string) => FsSide | undefined): boolean;
|
|
25
|
+
/** What is at a destination when the apply reaches it. */
|
|
26
|
+
interface DestinationNow {
|
|
27
|
+
readonly kind: EntryKind;
|
|
28
|
+
/** Whether it is a directory holding nothing; read only when the plan took an empty directory as free. */
|
|
29
|
+
readonly emptyDirectory: boolean;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Whether a destination is no longer what the plan decided on — staging (a whole copy, a whole
|
|
33
|
+
* build) runs between the plan and the first rename, and anything can write there meanwhile:
|
|
34
|
+
* - another KIND of entry than the plan saw (nothing where it parks; something where it creates);
|
|
35
|
+
* - a directory a `must-be-free` change took because it was EMPTY, and now is not.
|
|
36
|
+
*
|
|
37
|
+
* @returns What changed, for the refusal's wording; `undefined` when it is as planned
|
|
38
|
+
*/
|
|
39
|
+
export declare function changedSincePlan(planned: PlannedChange, now: DestinationNow): string | undefined;
|
|
40
|
+
/**
|
|
41
|
+
* The refusal of a destination that changed under the apply: the table's `occupied` destination
|
|
42
|
+
* fault (something appeared while the command wrote), naming it and what changed. The entry is
|
|
43
|
+
* left exactly as it was found.
|
|
44
|
+
*/
|
|
45
|
+
export declare function changedDestinationFault(planned: PlannedChange, what: string): FsFaultError;
|
|
46
|
+
/**
|
|
47
|
+
* What a finalize does with the parked entries it could not remove: a REMOVE's is thrown (removal
|
|
48
|
+
* was the job; the first one, with every other recorded beside it), a replace's is a warning — the
|
|
49
|
+
* new tree is live.
|
|
50
|
+
*
|
|
51
|
+
* @param refused - Each parked entry that would not go, with the op of its change
|
|
52
|
+
* @returns The index of the one to throw, or `undefined` when every one is a warning
|
|
53
|
+
*/
|
|
54
|
+
export declare function finalizeThrows(refused: ReadonlyArray<{
|
|
55
|
+
readonly op: PlannedChange['change']['op'];
|
|
56
|
+
}>): number | undefined;
|
|
57
|
+
/**
|
|
58
|
+
* Where the removal of the parents a create made goes next: `dir` is removed only while it is
|
|
59
|
+
* `top` (the first directory `mkdir` made) or under it, and the walk stops once `top` itself went.
|
|
60
|
+
*
|
|
61
|
+
* @param top - The first directory staging made, canonical
|
|
62
|
+
* @param dir - The directory about to be removed, canonical
|
|
63
|
+
* @returns `stop` (outside what staging made: never touched), `last` (it is `top`), or `continue` (go on to its parent)
|
|
64
|
+
*/
|
|
65
|
+
export declare function madeParentStep(top: string, dir: string): 'stop' | 'last' | 'continue';
|
|
66
|
+
/**
|
|
67
|
+
* The refusal of a file VAT writes into a tree it is building, where what was copied into that tree
|
|
68
|
+
* already holds an entry on the way — a file or a link at the file's own name, or a link (or a file)
|
|
69
|
+
* where one of its directories goes. Whatever is there came with the tree, so it is the SOURCE's
|
|
70
|
+
* layout (origin `content`), never something to write over or through.
|
|
71
|
+
*
|
|
72
|
+
* @param entry - The entry in the way, as a path
|
|
73
|
+
* @param writing - What VAT was writing, for the message: `VAT's marketplace marker`
|
|
74
|
+
* @param cause - The errno that reported it, when one did
|
|
75
|
+
*/
|
|
76
|
+
export declare function entryInTheWayFault(entry: string, writing: string, cause: unknown): FsFaultError;
|
|
77
|
+
/** A rename is tried this many times under win32 when the OS reports contention; the waits between are 50, 100, 200, 400, 800 ms. */
|
|
78
|
+
export declare const RENAME_TRIES = 6;
|
|
79
|
+
/**
|
|
80
|
+
* Whether a refused rename is tried again, and after how long: only under win32, only for
|
|
81
|
+
* contention (a scanner, an indexer, a handle still closing), and only while tries are left.
|
|
82
|
+
*
|
|
83
|
+
* @param platform - `process.platform`
|
|
84
|
+
* @param attempt - The 0-based try that just failed
|
|
85
|
+
* @param contention - Whether the errno is one a rename race raises there
|
|
86
|
+
* @returns The wait in milliseconds before the next try, or `undefined` when the refusal is final
|
|
87
|
+
*/
|
|
88
|
+
export declare function renameRetryDelay(platform: NodeJS.Platform, attempt: number, contention: boolean): number | undefined;
|
|
89
|
+
/**
|
|
90
|
+
* The refusal — a defect in the caller — of a directory to dispose of that is not strictly under
|
|
91
|
+
* the temp directory: the disposal makes a read-only tree writable before it deletes it, so a wrong
|
|
92
|
+
* argument (an empty string, a project directory) must be refused before anything is touched.
|
|
93
|
+
*
|
|
94
|
+
* @param dir - The directory handed to the disposal
|
|
95
|
+
* @param tmp - The temp directory
|
|
96
|
+
* @param containment - Where `dir` is against `tmp`, as `isUnderRoot` judged it
|
|
97
|
+
* @returns The error to throw, or `undefined` when `dir` may be disposed of
|
|
98
|
+
*/
|
|
99
|
+
export declare function tempDirRefusal(dir: string, tmp: string, containment: 'inside' | 'outside' | 'absent'): VatError | undefined;
|
|
100
|
+
export {};
|
|
101
|
+
//# sourceMappingURL=apply-decisions.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"apply-decisions.d.ts","sourceRoot":"","sources":["../../src/tree-change/apply-decisions.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,KAAK,YAAY,EAAgB,MAAM,0BAA0B,CAAC;AAC3E,OAAO,EAAE,YAAY,EAAE,KAAK,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAClE,OAAO,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAGlD,OAAO,KAAK,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAE1D,gIAAgI;AAChI,eAAO,MAAM,4BAA4B,4BAA4B,CAAC;AAEtE,qFAAqF;AACrF,eAAO,MAAM,4BAA4B,4BAA4B,CAAC;AAEtE;;;;;;;;;GASG;AACH,wBAAgB,uBAAuB,CAAC,KAAK,EAAE,YAAY,EAAE,MAAM,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,MAAM,GAAG,SAAS,GAAG,OAAO,CAElH;AAED,0DAA0D;AAC1D,UAAU,cAAc;IACtB,QAAQ,CAAC,IAAI,EAAE,SAAS,CAAC;IACzB,0GAA0G;IAC1G,QAAQ,CAAC,cAAc,EAAE,OAAO,CAAC;CAClC;AAED;;;;;;;GAOG;AACH,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,aAAa,EAAE,GAAG,EAAE,cAAc,GAAG,MAAM,GAAG,SAAS,CAMhG;AAID;;;;GAIG;AACH,wBAAgB,uBAAuB,CAAC,OAAO,EAAE,aAAa,EAAE,IAAI,EAAE,MAAM,GAAG,YAAY,CAW1F;AAED;;;;;;;GAOG;AACH,wBAAgB,cAAc,CAAC,OAAO,EAAE,aAAa,CAAC;IAAE,QAAQ,CAAC,EAAE,EAAE,aAAa,CAAC,QAAQ,CAAC,CAAC,IAAI,CAAC,CAAA;CAAE,CAAC,GAAG,MAAM,GAAG,SAAS,CAGzH;AAED;;;;;;;GAOG;AACH,wBAAgB,cAAc,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,MAAM,GAAG,UAAU,CAIrF;AAED;;;;;;;;;GASG;AACH,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,GAAG,YAAY,CAU/F;AAED,qIAAqI;AACrI,eAAO,MAAM,YAAY,IAAI,CAAC;AAG9B;;;;;;;;GAQG;AACH,wBAAgB,gBAAgB,CAAC,QAAQ,EAAE,MAAM,CAAC,QAAQ,EAAE,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,OAAO,GAAG,MAAM,GAAG,SAAS,CAGpH;AAED;;;;;;;;;GASG;AACH,wBAAgB,cAAc,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,WAAW,EAAE,QAAQ,GAAG,SAAS,GAAG,QAAQ,GAAG,QAAQ,GAAG,SAAS,CAG3H"}
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The decisions of the apply half of the tree-change primitive, and of its file helpers, that touch
|
|
3
|
+
* no filesystem: each is handed what was read and answers what to do. `apply.ts` and `files.ts` are
|
|
4
|
+
* the halves that make the calls — and hold nothing else to decide.
|
|
5
|
+
*/
|
|
6
|
+
import { pathsActedOn } from '../errors/errno-table.js';
|
|
7
|
+
import { FsFaultError } from '../errors/fs-fault.js';
|
|
8
|
+
import { VatError } from '../errors/vat-error.js';
|
|
9
|
+
import { relativeEscapesRoot, safePath } from '../path-core.js';
|
|
10
|
+
/** {@link tempDirRefusal}: a directory to dispose of that is not strictly under the temp directory — a defect in the caller. */
|
|
11
|
+
export const TEMP_DIR_OUTSIDE_TMPDIR_CODE = 'TEMP_DIR_OUTSIDE_TMPDIR';
|
|
12
|
+
/** A replaced entry, parked once the new one was live, that could not be removed. */
|
|
13
|
+
export const TREE_CLEANUP_INCOMPLETE_CODE = 'TREE_CLEANUP_INCOMPLETE';
|
|
14
|
+
/**
|
|
15
|
+
* Whether a `write` fill's failure is the DESTINATION's: a path the failing call acted on
|
|
16
|
+
* ({@link pathsActedOn} — the one reading of an errno's two paths, so never a symlink's target
|
|
17
|
+
* text) is under the staged tree, all the callback may write. Anything else, an input the
|
|
18
|
+
* callback read (a sibling of the destination included), is not: it is rethrown as it was, for
|
|
19
|
+
* the verb's boundary to classify.
|
|
20
|
+
*
|
|
21
|
+
* @param facts - The errno, the call and the paths the OS named
|
|
22
|
+
* @param sideOf - The side a path is on, with the staged tree as the only `destination`
|
|
23
|
+
*/
|
|
24
|
+
export function fillFaultIsDestinations(facts, sideOf) {
|
|
25
|
+
return pathsActedOn(facts).some((named) => sideOf(named) === 'destination');
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Whether a destination is no longer what the plan decided on — staging (a whole copy, a whole
|
|
29
|
+
* build) runs between the plan and the first rename, and anything can write there meanwhile:
|
|
30
|
+
* - another KIND of entry than the plan saw (nothing where it parks; something where it creates);
|
|
31
|
+
* - a directory a `must-be-free` change took because it was EMPTY, and now is not.
|
|
32
|
+
*
|
|
33
|
+
* @returns What changed, for the refusal's wording; `undefined` when it is as planned
|
|
34
|
+
*/
|
|
35
|
+
export function changedSincePlan(planned, now) {
|
|
36
|
+
if (now.kind !== planned.existing) {
|
|
37
|
+
return `it was ${describeKind(planned.existing)} when the change was planned and is ${describeKind(now.kind)} now`;
|
|
38
|
+
}
|
|
39
|
+
const tookAsFree = planned.change.ownership.kind === 'must-be-free' && planned.existing === 'directory';
|
|
40
|
+
return tookAsFree && !now.emptyDirectory ? 'it was an empty directory when the change was planned and holds entries now' : undefined;
|
|
41
|
+
}
|
|
42
|
+
const describeKind = (kind) => (kind === 'absent' ? 'absent' : `a ${kind}`);
|
|
43
|
+
/**
|
|
44
|
+
* The refusal of a destination that changed under the apply: the table's `occupied` destination
|
|
45
|
+
* fault (something appeared while the command wrote), naming it and what changed. The entry is
|
|
46
|
+
* left exactly as it was found.
|
|
47
|
+
*/
|
|
48
|
+
export function changedDestinationFault(planned, what) {
|
|
49
|
+
const { dest, label } = planned.change;
|
|
50
|
+
return new FsFaultError({
|
|
51
|
+
side: 'destination',
|
|
52
|
+
faultClass: 'occupied',
|
|
53
|
+
errno: 'EEXIST',
|
|
54
|
+
path: dest,
|
|
55
|
+
origin: 'argument',
|
|
56
|
+
action: `put ${label} in place: something else changed the destination while it was being prepared (${what}); it was left as found`,
|
|
57
|
+
cause: undefined,
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* What a finalize does with the parked entries it could not remove: a REMOVE's is thrown (removal
|
|
62
|
+
* was the job; the first one, with every other recorded beside it), a replace's is a warning — the
|
|
63
|
+
* new tree is live.
|
|
64
|
+
*
|
|
65
|
+
* @param refused - Each parked entry that would not go, with the op of its change
|
|
66
|
+
* @returns The index of the one to throw, or `undefined` when every one is a warning
|
|
67
|
+
*/
|
|
68
|
+
export function finalizeThrows(refused) {
|
|
69
|
+
const index = refused.findIndex((each) => each.op === 'remove');
|
|
70
|
+
return index === -1 ? undefined : index;
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* Where the removal of the parents a create made goes next: `dir` is removed only while it is
|
|
74
|
+
* `top` (the first directory `mkdir` made) or under it, and the walk stops once `top` itself went.
|
|
75
|
+
*
|
|
76
|
+
* @param top - The first directory staging made, canonical
|
|
77
|
+
* @param dir - The directory about to be removed, canonical
|
|
78
|
+
* @returns `stop` (outside what staging made: never touched), `last` (it is `top`), or `continue` (go on to its parent)
|
|
79
|
+
*/
|
|
80
|
+
export function madeParentStep(top, dir) {
|
|
81
|
+
const below = safePath.relative(top, dir);
|
|
82
|
+
if (relativeEscapesRoot(below))
|
|
83
|
+
return 'stop';
|
|
84
|
+
return below === '' ? 'last' : 'continue';
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* The refusal of a file VAT writes into a tree it is building, where what was copied into that tree
|
|
88
|
+
* already holds an entry on the way — a file or a link at the file's own name, or a link (or a file)
|
|
89
|
+
* where one of its directories goes. Whatever is there came with the tree, so it is the SOURCE's
|
|
90
|
+
* layout (origin `content`), never something to write over or through.
|
|
91
|
+
*
|
|
92
|
+
* @param entry - The entry in the way, as a path
|
|
93
|
+
* @param writing - What VAT was writing, for the message: `VAT's marketplace marker`
|
|
94
|
+
* @param cause - The errno that reported it, when one did
|
|
95
|
+
*/
|
|
96
|
+
export function entryInTheWayFault(entry, writing, cause) {
|
|
97
|
+
return new FsFaultError({
|
|
98
|
+
side: 'source',
|
|
99
|
+
faultClass: 'occupied',
|
|
100
|
+
errno: 'EEXIST',
|
|
101
|
+
path: entry,
|
|
102
|
+
origin: 'content',
|
|
103
|
+
action: `write ${writing}: the tree it goes into already holds an entry there, which VAT never writes over or through`,
|
|
104
|
+
cause,
|
|
105
|
+
});
|
|
106
|
+
}
|
|
107
|
+
/** A rename is tried this many times under win32 when the OS reports contention; the waits between are 50, 100, 200, 400, 800 ms. */
|
|
108
|
+
export const RENAME_TRIES = 6;
|
|
109
|
+
const FIRST_BACKOFF_MS = 50;
|
|
110
|
+
/**
|
|
111
|
+
* Whether a refused rename is tried again, and after how long: only under win32, only for
|
|
112
|
+
* contention (a scanner, an indexer, a handle still closing), and only while tries are left.
|
|
113
|
+
*
|
|
114
|
+
* @param platform - `process.platform`
|
|
115
|
+
* @param attempt - The 0-based try that just failed
|
|
116
|
+
* @param contention - Whether the errno is one a rename race raises there
|
|
117
|
+
* @returns The wait in milliseconds before the next try, or `undefined` when the refusal is final
|
|
118
|
+
*/
|
|
119
|
+
export function renameRetryDelay(platform, attempt, contention) {
|
|
120
|
+
if (platform !== 'win32' || !contention || attempt + 1 >= RENAME_TRIES)
|
|
121
|
+
return undefined;
|
|
122
|
+
return FIRST_BACKOFF_MS * 2 ** attempt;
|
|
123
|
+
}
|
|
124
|
+
/**
|
|
125
|
+
* The refusal — a defect in the caller — of a directory to dispose of that is not strictly under
|
|
126
|
+
* the temp directory: the disposal makes a read-only tree writable before it deletes it, so a wrong
|
|
127
|
+
* argument (an empty string, a project directory) must be refused before anything is touched.
|
|
128
|
+
*
|
|
129
|
+
* @param dir - The directory handed to the disposal
|
|
130
|
+
* @param tmp - The temp directory
|
|
131
|
+
* @param containment - Where `dir` is against `tmp`, as `isUnderRoot` judged it
|
|
132
|
+
* @returns The error to throw, or `undefined` when `dir` may be disposed of
|
|
133
|
+
*/
|
|
134
|
+
export function tempDirRefusal(dir, tmp, containment) {
|
|
135
|
+
if (containment !== 'outside')
|
|
136
|
+
return undefined;
|
|
137
|
+
return new VatError(TEMP_DIR_OUTSIDE_TMPDIR_CODE, `Refusing to dispose of ${dir}: it is not inside the temporary directory ${tmp}`);
|
|
138
|
+
}
|
|
139
|
+
//# sourceMappingURL=apply-decisions.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"apply-decisions.js","sourceRoot":"","sources":["../../src/tree-change/apply-decisions.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAqB,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAC3E,OAAO,EAAE,YAAY,EAAe,MAAM,uBAAuB,CAAC;AAClE,OAAO,EAAE,QAAQ,EAAE,MAAM,wB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G,EAAE,CAAC;AAE5B;;;;;;;;GAQG;AACH,MAAM,UAAU,gBAAgB,CAAC,QAAyB,EAAE,OAAe,EAAE,UAAmB;IAC9F,IAAI,QAAQ,KAAK,OAAO,IAAI,CAAC,UAAU,IAAI,OAAO,GAAG,CAAC,IAAI,YAAY;QAAE,OAAO,SAAS,CAAC;IACzF,OAAO,gBAAgB,GAAG,CAAC,IAAI,OAAO,CAAC;AACzC,CAAC;AAED;;;;;;;;;GASG;AACH,MAAM,UAAU,cAAc,CAAC,GAAW,EAAE,GAAW,EAAE,WAA4C;IACnG,IAAI,WAAW,KAAK,SAAS;QAAE,OAAO,SAAS,CAAC;IAChD,OAAO,IAAI,QAAQ,CAAC,4BAA4B,EAAE,0BAA0B,GAAG,8CAA8C,GAAG,EAAE,CAAC,CAAC;AACtI,CAAC"}
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The apply half of the tree-change primitive: carry out a {@link TreePlan} as one
|
|
3
|
+
* transaction, in a fixed order —
|
|
4
|
+
*
|
|
5
|
+
* 1. **Stage** every new entry beside its destination, on the same filesystem (so
|
|
6
|
+
* a swap never crosses devices): a `mkdtemp` directory filled by `copyTree`, a
|
|
7
|
+
* fresh directory (plain `mkdir`, the caller's mode) filled by the `write`
|
|
8
|
+
* callback, or a fresh name for a file or a link. A failure removes
|
|
9
|
+
* every staged entry, and every parent directory a create made; no destination
|
|
10
|
+
* has changed.
|
|
11
|
+
* 2. **Park** every entry being replaced or removed: `rename(dest, <staged>.previous)`.
|
|
12
|
+
* Every park happens before any swap, so a name is free before anything lands
|
|
13
|
+
* on it — on a case-folding filesystem `Old` and `old` are one name. Each
|
|
14
|
+
* destination is examined again first: one that is no longer what the plan decided
|
|
15
|
+
* on (another writer filled a directory the plan took as empty, or put an entry
|
|
16
|
+
* where it found none) is a `destination` fault, class `occupied`, and is left as
|
|
17
|
+
* found — the plan is rolled back.
|
|
18
|
+
* 3. **Swap** every staged entry in: `rename(staged, dest)`.
|
|
19
|
+
* 4. **`afterSwap()`** — the caller's own writes that must agree with the tree
|
|
20
|
+
* (a registry). A throw rolls back every swap.
|
|
21
|
+
* 5. **Rollback**, when 2–4 throw: in reverse, each swapped entry is moved off its
|
|
22
|
+
* destination and its parked entry renamed back, then the parents a create made
|
|
23
|
+
* are removed. A parked entry is NEVER deleted on a failure path: if one cannot
|
|
24
|
+
* be put back — or a create's new entry cannot be moved off — the error is
|
|
25
|
+
* {@link TreeRollbackIncompleteError}, naming each.
|
|
26
|
+
* 6. **Finalize**: each parked entry is removed, its modes notwithstanding. For a
|
|
27
|
+
* replace a refusal is only a warning ({@link TREE_CLEANUP_INCOMPLETE_CODE}): the
|
|
28
|
+
* new tree is live. For a remove, removal is the job, so it is a `destination`
|
|
29
|
+
* fault naming the parked path — the data is already off the user's path.
|
|
30
|
+
*
|
|
31
|
+
* Every rename is {@link renameFileAtomic}'s, retried under win32 on contention.
|
|
32
|
+
* The primitive's own filesystem faults are classified `destination` (staging sits
|
|
33
|
+
* beside the user's destination); a `copy` source's read is already classified on
|
|
34
|
+
* the fill's declared side; a
|
|
35
|
+
* `write` fill's raw errno is `destination` only when it names a path under the
|
|
36
|
+
* destination's parent — anything else (an input the callback read) is rethrown
|
|
37
|
+
* raw, for the verb's boundary to classify.
|
|
38
|
+
*
|
|
39
|
+
* A thrown failure is never mutated. What a failure path could not clean up (a
|
|
40
|
+
* staged entry, a parent, a replaced tree beside a failed remove) is recorded
|
|
41
|
+
* beside it, off its cause chain: `suppressedFaultsOf(error)`.
|
|
42
|
+
*/
|
|
43
|
+
import { TREE_CLEANUP_INCOMPLETE_CODE } from './apply-decisions.js';
|
|
44
|
+
import { type TreePlan } from './plan.js';
|
|
45
|
+
export { TREE_CLEANUP_INCOMPLETE_CODE } from './apply-decisions.js';
|
|
46
|
+
export interface ApplyOptions {
|
|
47
|
+
/**
|
|
48
|
+
* Runs once every swap is done; a throw rolls every change back and is rethrown.
|
|
49
|
+
* ⚠️ Its own filesystem faults must be classified `destination` (it writes user
|
|
50
|
+
* state beside the tree): should the rollback then fail, the error becomes
|
|
51
|
+
* `TREE_ROLLBACK_INCOMPLETE` (`RUN_INCOMPLETE`), which agrees with every
|
|
52
|
+
* destination row of the refusal table and with no other side's.
|
|
53
|
+
*/
|
|
54
|
+
readonly afterSwap?: () => Promise<void>;
|
|
55
|
+
}
|
|
56
|
+
/** A finding a successful apply reports: the change is done, something beside it is left. */
|
|
57
|
+
export interface TreeChangeWarning {
|
|
58
|
+
readonly code: typeof TREE_CLEANUP_INCOMPLETE_CODE;
|
|
59
|
+
/** The entry left behind. */
|
|
60
|
+
readonly path: string;
|
|
61
|
+
readonly message: string;
|
|
62
|
+
}
|
|
63
|
+
export interface ApplyResult {
|
|
64
|
+
readonly warnings: readonly TreeChangeWarning[];
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* Carry out `plan`: stage, park, swap, `afterSwap`, finalize — or roll back so
|
|
68
|
+
* every destination is exactly as it was.
|
|
69
|
+
*
|
|
70
|
+
* @param plan - What `planTreeChanges` decided; `keep` and `subsumed` changes are not touched
|
|
71
|
+
* @param options - `afterSwap`, run once the new tree is in place
|
|
72
|
+
* @returns The warnings of a change that is done: a previous tree left beside a replaced one
|
|
73
|
+
* @throws the first failure, after the rollback and unchanged: an `FsFaultError` (side
|
|
74
|
+
* `destination`, or the fill's declared side for a copy source's read), a `write` fill's own error or raw
|
|
75
|
+
* errno, or whatever `afterSwap` threw — with what could not be cleaned up in
|
|
76
|
+
* `suppressedFaultsOf(error)`; {@link TreeRollbackIncompleteError} (cause: that
|
|
77
|
+
* failure) when the rollback could not undo every change; for a `remove` whose
|
|
78
|
+
* parked entry cannot be removed, an `FsFaultError` side `destination` naming it
|
|
79
|
+
*/
|
|
80
|
+
export declare function applyTreePlan(plan: TreePlan, options?: ApplyOptions): Promise<ApplyResult>;
|
|
81
|
+
/** What {@link applyTreePlanOrLeftover} finished with: the warnings of a clean apply, or the failure that came after the commit. */
|
|
82
|
+
export interface ApplyOutcome extends ApplyResult {
|
|
83
|
+
/**
|
|
84
|
+
* The failure that came once every change was in place (and `afterSwap` had run): a parked entry of
|
|
85
|
+
* a `remove` the OS would not delete. It cannot be undone and is no refusal of the change — the
|
|
86
|
+
* change is DONE, every destination as planned — so it is returned, naming what is left (its `path`
|
|
87
|
+
* the parked entry), for the verb to report beside the work it finished. Absent when the apply finished clean.
|
|
88
|
+
*/
|
|
89
|
+
readonly leftover?: unknown;
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* {@link applyTreePlan}, for a verb that reports a change it finished even when what it parked could
|
|
93
|
+
* not then be deleted (an uninstall, a clear): a failure before the commit — every swap made and
|
|
94
|
+
* `afterSwap` run — rolled back and is thrown, as by `applyTreePlan`; one after it is returned as
|
|
95
|
+
* `leftover`. The commit is the one line between "nothing finished" and "the change is done".
|
|
96
|
+
*/
|
|
97
|
+
export declare function applyTreePlanOrLeftover(plan: TreePlan, options?: ApplyOptions): Promise<ApplyOutcome>;
|
|
98
|
+
//# sourceMappingURL=apply.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"apply.d.ts","sourceRoot":"","sources":["../../src/tree-change/apply.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyCG;AAcH,OAAO,EAAsG,4BAA4B,EAAE,MAAM,sBAAsB,CAAC;AAIxK,OAAO,EAAgD,KAAK,QAAQ,EAAE,MAAM,WAAW,CAAC;AAIxF,OAAO,EAAE,4BAA4B,EAAE,MAAM,sBAAsB,CAAC;AAKpE,MAAM,WAAW,YAAY;IAC3B;;;;;;OAMG;IACH,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;CAC1C;AAED,6FAA6F;AAC7F,MAAM,WAAW,iBAAiB;IAChC,QAAQ,CAAC,IAAI,EAAE,OAAO,4BAA4B,CAAC;IACnD,6BAA6B;IAC7B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;CAC1B;AAED,MAAM,WAAW,WAAW;IAC1B,QAAQ,CAAC,QAAQ,EAAE,SAAS,iBAAiB,EAAE,CAAC;CACjD;AAiQD;;;;;;;;;;;;;GAaG;AACH,wBAAgB,aAAa,CAAC,IAAI,EAAE,QAAQ,EAAE,OAAO,GAAE,YAAiB,GAAG,OAAO,CAAC,WAAW,CAAC,CAE9F;AAED,oIAAoI;AACpI,MAAM,WAAW,YAAa,SAAQ,WAAW;IAC/C;;;;;OAKG;IACH,QAAQ,CAAC,QAAQ,CAAC,EAAE,OAAO,CAAC;CAC7B;AAED;;;;;GAKG;AACH,wBAAsB,uBAAuB,CAAC,IAAI,EAAE,QAAQ,EAAE,OAAO,GAAE,YAAiB,GAAG,OAAO,CAAC,YAAY,CAAC,CAa/G"}
|