@openclaw/fs-safe 0.14.0 → 0.16.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +88 -0
- package/README.md +38 -10
- package/dist/advanced.d.ts +2 -1
- package/dist/advanced.d.ts.map +1 -1
- package/dist/advanced.js +2 -1
- package/dist/archive-kind.d.ts +0 -1
- package/dist/archive-kind.d.ts.map +1 -1
- package/dist/archive-kind.js +5 -17
- package/dist/archive-merge.d.ts.map +1 -1
- package/dist/archive-merge.js +113 -46
- package/dist/archive-parser.wasm +0 -0
- package/dist/archive-read.d.ts.map +1 -1
- package/dist/archive-read.js +10 -11
- package/dist/archive-tar-stream.d.ts +3 -0
- package/dist/archive-tar-stream.d.ts.map +1 -1
- package/dist/archive-tar-stream.js +56 -37
- package/dist/archive-tar-wasm.d.ts +16 -4
- package/dist/archive-tar-wasm.d.ts.map +1 -1
- package/dist/archive-tar-wasm.js +134 -34
- package/dist/archive-zip-directory.d.ts +4 -0
- package/dist/archive-zip-directory.d.ts.map +1 -1
- package/dist/archive-zip-directory.js +2 -0
- package/dist/archive-zip-entry.d.ts +6 -2
- package/dist/archive-zip-entry.d.ts.map +1 -1
- package/dist/archive-zip-entry.js +23 -8
- package/dist/archive-zip-integrity.d.ts.map +1 -1
- package/dist/archive-zip-integrity.js +3 -4
- package/dist/archive-zip-loader.d.ts.map +1 -1
- package/dist/archive-zip-loader.js +107 -31
- package/dist/archive-zip-names.d.ts +1 -0
- package/dist/archive-zip-names.d.ts.map +1 -1
- package/dist/archive-zip-names.js +6 -0
- package/dist/archive.d.ts.map +1 -1
- package/dist/archive.js +11 -11
- package/dist/bounded-read-stream.d.ts +0 -1
- package/dist/bounded-read-stream.d.ts.map +1 -1
- package/dist/bounded-read-stream.js +0 -6
- package/dist/clone-metadata.d.ts +1 -0
- package/dist/clone-metadata.d.ts.map +1 -1
- package/dist/clone-metadata.js +6 -2
- package/dist/copy-publication.d.ts +6 -0
- package/dist/copy-publication.d.ts.map +1 -1
- package/dist/copy-publication.js +3 -0
- package/dist/copy-tree-portable.d.ts.map +1 -1
- package/dist/copy-tree-portable.js +44 -24
- package/dist/copy.d.ts.map +1 -1
- package/dist/copy.js +29 -11
- package/dist/create-directory.d.ts +20 -0
- package/dist/create-directory.d.ts.map +1 -0
- package/dist/create-directory.js +130 -0
- package/dist/create-file-async.d.ts +7 -0
- package/dist/create-file-async.d.ts.map +1 -0
- package/dist/create-file-async.js +121 -0
- package/dist/create-file.d.ts +8 -0
- package/dist/create-file.d.ts.map +1 -0
- package/dist/create-file.js +190 -0
- package/dist/create-owned-file.d.ts +8 -0
- package/dist/create-owned-file.d.ts.map +1 -0
- package/dist/create-owned-file.js +16 -0
- package/dist/create.d.ts +4 -0
- package/dist/create.d.ts.map +1 -0
- package/dist/create.js +2 -0
- package/dist/creation-darwin.d.ts +7 -0
- package/dist/creation-darwin.d.ts.map +1 -0
- package/dist/creation-darwin.js +79 -0
- package/dist/creation-file-state.d.ts +19 -0
- package/dist/creation-file-state.d.ts.map +1 -0
- package/dist/creation-file-state.js +118 -0
- package/dist/creation-path.d.ts +21 -0
- package/dist/creation-path.d.ts.map +1 -0
- package/dist/creation-path.js +71 -0
- package/dist/creation-permissions.d.ts +19 -0
- package/dist/creation-permissions.d.ts.map +1 -0
- package/dist/creation-permissions.js +125 -0
- package/dist/directory-durability.d.ts +1 -1
- package/dist/directory-durability.d.ts.map +1 -1
- package/dist/directory-durability.js +22 -80
- package/dist/directory-guard.d.ts +3 -0
- package/dist/directory-guard.d.ts.map +1 -1
- package/dist/directory-mode-node.d.ts +2 -0
- package/dist/directory-mode-node.d.ts.map +1 -1
- package/dist/directory-mode-node.js +8 -0
- package/dist/directory-mode-owner.js +5 -5
- package/dist/directory-receipt.d.ts +24 -0
- package/dist/directory-receipt.d.ts.map +1 -0
- package/dist/directory-receipt.js +127 -0
- package/dist/file-cleanup.d.ts +19 -0
- package/dist/file-cleanup.d.ts.map +1 -0
- package/dist/file-cleanup.js +78 -0
- package/dist/file-handle-transfer.d.ts +2 -0
- package/dist/file-handle-transfer.d.ts.map +1 -1
- package/dist/file-handle-transfer.js +57 -2
- package/dist/file-identity.d.ts.map +1 -1
- package/dist/file-identity.js +18 -4
- package/dist/file-lock-sync-admission.d.ts +19 -0
- package/dist/file-lock-sync-admission.d.ts.map +1 -0
- package/dist/file-lock-sync-admission.js +93 -0
- package/dist/file-lock-sync-root-acquire.d.ts +4 -0
- package/dist/file-lock-sync-root-acquire.d.ts.map +1 -0
- package/dist/file-lock-sync-root-acquire.js +370 -0
- package/dist/file-lock-sync-root-arbitration.d.ts +18 -0
- package/dist/file-lock-sync-root-arbitration.d.ts.map +1 -0
- package/dist/file-lock-sync-root-arbitration.js +66 -0
- package/dist/file-lock-sync-root-held.d.ts +34 -0
- package/dist/file-lock-sync-root-held.d.ts.map +1 -0
- package/dist/file-lock-sync-root-held.js +393 -0
- package/dist/file-lock-sync-root-io.d.ts +44 -0
- package/dist/file-lock-sync-root-io.d.ts.map +1 -0
- package/dist/file-lock-sync-root-io.js +209 -0
- package/dist/file-lock-sync-root-mutation.d.ts +17 -0
- package/dist/file-lock-sync-root-mutation.d.ts.map +1 -0
- package/dist/file-lock-sync-root-mutation.js +277 -0
- package/dist/file-lock-sync-root-options.d.ts +20 -0
- package/dist/file-lock-sync-root-options.d.ts.map +1 -0
- package/dist/file-lock-sync-root-options.js +58 -0
- package/dist/file-lock-sync-root-registration.d.ts +2 -0
- package/dist/file-lock-sync-root-registration.d.ts.map +1 -0
- package/dist/file-lock-sync-root-registration.js +90 -0
- package/dist/file-lock-sync-root.d.ts +36 -0
- package/dist/file-lock-sync-root.d.ts.map +1 -0
- package/dist/file-lock-sync-root.js +361 -0
- package/dist/file-lock-sync-stale-admission.d.ts +24 -0
- package/dist/file-lock-sync-stale-admission.d.ts.map +1 -0
- package/dist/file-lock-sync-stale-admission.js +205 -0
- package/dist/file-lock-sync.d.ts.map +1 -1
- package/dist/file-lock-sync.js +245 -205
- package/dist/file-observation.d.ts +1 -1
- package/dist/file-observation.d.ts.map +1 -1
- package/dist/file-store-boundary.d.ts +2 -6
- package/dist/file-store-boundary.d.ts.map +1 -1
- package/dist/file-store-boundary.js +3 -9
- package/dist/file-store-prune.d.ts.map +1 -1
- package/dist/file-store-prune.js +5 -1
- package/dist/file-store-sync-write.d.ts.map +1 -1
- package/dist/file-store-sync-write.js +5 -8
- package/dist/file-store.d.ts.map +1 -1
- package/dist/file-store.js +47 -12
- package/dist/guarded-mkdir.d.ts +1 -0
- package/dist/guarded-mkdir.d.ts.map +1 -1
- package/dist/guarded-mkdir.js +36 -7
- package/dist/json-document-store.d.ts.map +1 -1
- package/dist/json-document-store.js +22 -15
- package/dist/json-durable-queue-ownership.d.ts +0 -1
- package/dist/json-durable-queue-ownership.d.ts.map +1 -1
- package/dist/json-durable-queue-ownership.js +0 -6
- package/dist/move-path.js +1 -1
- package/dist/native-binding.d.ts +13 -1
- package/dist/native-binding.d.ts.map +1 -1
- package/dist/native-fallback-warning.d.ts +4 -0
- package/dist/native-fallback-warning.d.ts.map +1 -0
- package/dist/native-fallback-warning.js +11 -0
- package/dist/native-operations.d.ts +0 -2
- package/dist/native-operations.d.ts.map +1 -1
- package/dist/native-operations.js +0 -24
- package/dist/native-parent-admission.d.ts +5 -2
- package/dist/native-parent-admission.d.ts.map +1 -1
- package/dist/native-parent-admission.js +27 -7
- package/dist/native-pinned-write-windows.d.ts +1 -1
- package/dist/native-pinned-write-windows.d.ts.map +1 -1
- package/dist/native-pinned-write-windows.js +174 -29
- package/dist/native-pinned-write.d.ts.map +1 -1
- package/dist/native-pinned-write.js +26 -14
- package/dist/native-policy-parent-windows.d.ts +14 -0
- package/dist/native-policy-parent-windows.d.ts.map +1 -0
- package/dist/native-policy-parent-windows.js +209 -0
- package/dist/native-rename-outcome.d.ts +4 -0
- package/dist/native-rename-outcome.d.ts.map +1 -0
- package/dist/native-rename-outcome.js +8 -0
- package/dist/native-staged-file.d.ts +3 -2
- package/dist/native-staged-file.d.ts.map +1 -1
- package/dist/native-staged-file.js +121 -72
- package/dist/output.d.ts.map +1 -1
- package/dist/output.js +12 -8
- package/dist/owner-dacl.d.ts.map +1 -1
- package/dist/owner-dacl.js +10 -4
- package/dist/path-prefix.d.ts.map +1 -1
- package/dist/path-prefix.js +30 -8
- package/dist/path-suffix-aliases.d.ts +2 -0
- package/dist/path-suffix-aliases.d.ts.map +1 -1
- package/dist/path-suffix-aliases.js +25 -17
- package/dist/permission-exec.d.ts +2 -0
- package/dist/permission-exec.d.ts.map +1 -1
- package/dist/permission-exec.js +150 -21
- package/dist/permissions-windows.js +1 -1
- package/dist/pinned-mutation-admission.d.ts.map +1 -1
- package/dist/pinned-mutation-admission.js +10 -5
- package/dist/pinned-mutation-observation.d.ts +0 -1
- package/dist/pinned-mutation-observation.d.ts.map +1 -1
- package/dist/pinned-mutation-observation.js +0 -19
- package/dist/pinned-mutation-shared-route.d.ts +1 -0
- package/dist/pinned-mutation-shared-route.d.ts.map +1 -1
- package/dist/pinned-mutation-shared-route.js +1 -1
- package/dist/pinned-write-input.d.ts +4 -0
- package/dist/pinned-write-input.d.ts.map +1 -0
- package/dist/pinned-write-input.js +25 -0
- package/dist/pinned-write-mode.d.ts +5 -0
- package/dist/pinned-write-mode.d.ts.map +1 -0
- package/dist/pinned-write-mode.js +24 -0
- package/dist/pinned-write-staged.d.ts +6 -0
- package/dist/pinned-write-staged.d.ts.map +1 -0
- package/dist/pinned-write-staged.js +187 -0
- package/dist/pinned-write-types.d.ts +5 -0
- package/dist/pinned-write-types.d.ts.map +1 -1
- package/dist/pinned-write.d.ts.map +1 -1
- package/dist/pinned-write.js +35 -145
- package/dist/private-directory.d.ts.map +1 -1
- package/dist/private-directory.js +18 -4
- package/dist/private-producer-handoff-sync.d.ts +14 -0
- package/dist/private-producer-handoff-sync.d.ts.map +1 -0
- package/dist/private-producer-handoff-sync.js +114 -0
- package/dist/private-producer-handoff.d.ts +22 -4
- package/dist/private-producer-handoff.d.ts.map +1 -1
- package/dist/private-producer-handoff.js +140 -77
- package/dist/private-temp-workspace.d.ts.map +1 -1
- package/dist/private-temp-workspace.js +75 -121
- package/dist/publish-copy-stage.d.ts +2 -1
- package/dist/publish-copy-stage.d.ts.map +1 -1
- package/dist/publish-copy-stage.js +16 -7
- package/dist/publish-file.d.ts.map +1 -1
- package/dist/publish-file.js +2 -2
- package/dist/regular-file.d.ts.map +1 -1
- package/dist/regular-file.js +1 -15
- package/dist/replace-directory.d.ts.map +1 -1
- package/dist/replace-directory.js +256 -18
- package/dist/replace-file-copy-fallback.d.ts.map +1 -1
- package/dist/replace-file-copy-fallback.js +62 -70
- package/dist/replace-file-copy-source.d.ts.map +1 -1
- package/dist/replace-file-copy-source.js +10 -12
- package/dist/replace-file-temp-owner.d.ts +5 -9
- package/dist/replace-file-temp-owner.d.ts.map +1 -1
- package/dist/replace-file-temp-owner.js +56 -72
- package/dist/replace-file.js +6 -6
- package/dist/retained-directory-replacement.d.ts +26 -0
- package/dist/retained-directory-replacement.d.ts.map +1 -0
- package/dist/retained-directory-replacement.js +193 -0
- package/dist/root-boundary.d.ts +1 -0
- package/dist/root-boundary.d.ts.map +1 -1
- package/dist/root-boundary.js +4 -0
- package/dist/root-context.d.ts +0 -8
- package/dist/root-context.d.ts.map +1 -1
- package/dist/root-context.js +0 -3
- package/dist/root-create-input.d.ts +8 -1
- package/dist/root-create-input.d.ts.map +1 -1
- package/dist/root-create-input.js +17 -4
- package/dist/root-directory-creation.d.ts +3 -3
- package/dist/root-directory-creation.d.ts.map +1 -1
- package/dist/root-directory-creation.js +15 -3
- package/dist/root-directory-list.d.ts +1 -0
- package/dist/root-directory-list.d.ts.map +1 -1
- package/dist/root-directory-list.js +1 -0
- package/dist/root-impl.d.ts.map +1 -1
- package/dist/root-impl.js +46 -17
- package/dist/root-move-noreplace.d.ts.map +1 -1
- package/dist/root-move-noreplace.js +24 -15
- package/dist/root-options.d.ts +12 -4
- package/dist/root-options.d.ts.map +1 -1
- package/dist/root-path-errors.d.ts +1 -0
- package/dist/root-path-errors.d.ts.map +1 -1
- package/dist/root-path-errors.js +11 -2
- package/dist/root-path-existing.d.ts.map +1 -1
- package/dist/root-path-existing.js +11 -35
- package/dist/root-path-stat.d.ts.map +1 -1
- package/dist/root-path-stat.js +59 -7
- package/dist/root-path.js +1 -13
- package/dist/root-remove.d.ts +1 -0
- package/dist/root-remove.d.ts.map +1 -1
- package/dist/root-remove.js +4 -0
- package/dist/root-walk.d.ts +1 -1
- package/dist/root-walk.d.ts.map +1 -1
- package/dist/root-walk.js +17 -2
- package/dist/root-write-admission.d.ts +0 -2
- package/dist/root-write-admission.d.ts.map +1 -1
- package/dist/root-write-admission.js +1 -15
- package/dist/root-write-complete-parent.d.ts.map +1 -1
- package/dist/root-write-complete-parent.js +7 -23
- package/dist/root-write-publication.js +1 -1
- package/dist/root-write-verification.d.ts.map +1 -1
- package/dist/root-write-verification.js +29 -42
- package/dist/secret-file.d.ts.map +1 -1
- package/dist/secret-file.js +3 -24
- package/dist/secret-read-async.d.ts.map +1 -1
- package/dist/secret-read-async.js +3 -24
- package/dist/secret-read-policy.d.ts +6 -2
- package/dist/secret-read-policy.d.ts.map +1 -1
- package/dist/secret-read-policy.js +26 -2
- package/dist/secure-file-windows.d.ts +6 -0
- package/dist/secure-file-windows.d.ts.map +1 -1
- package/dist/secure-file-windows.js +34 -117
- package/dist/secure-file.js +2 -2
- package/dist/sibling-temp.d.ts.map +1 -1
- package/dist/sibling-temp.js +23 -12
- package/dist/sidecar-lock-acquire.d.ts +2 -28
- package/dist/sidecar-lock-acquire.d.ts.map +1 -1
- package/dist/sidecar-lock-acquire.js +288 -199
- package/dist/sidecar-lock-admission-context.d.ts +19 -0
- package/dist/sidecar-lock-admission-context.d.ts.map +1 -0
- package/dist/sidecar-lock-admission-context.js +60 -0
- package/dist/sidecar-lock-admission-parser.d.ts +43 -0
- package/dist/sidecar-lock-admission-parser.d.ts.map +1 -0
- package/dist/sidecar-lock-admission-parser.js +113 -0
- package/dist/sidecar-lock-admission.d.ts +35 -0
- package/dist/sidecar-lock-admission.d.ts.map +1 -0
- package/dist/sidecar-lock-admission.js +7 -0
- package/dist/sidecar-lock-reclaim.d.ts +9 -4
- package/dist/sidecar-lock-reclaim.d.ts.map +1 -1
- package/dist/sidecar-lock-reclaim.js +80 -25
- package/dist/sidecar-lock-root.d.ts.map +1 -1
- package/dist/sidecar-lock-root.js +2 -1
- package/dist/sidecar-lock-stale-admission.d.ts +39 -0
- package/dist/sidecar-lock-stale-admission.d.ts.map +1 -0
- package/dist/sidecar-lock-stale-admission.js +232 -0
- package/dist/sidecar-lock-target.d.ts +8 -0
- package/dist/sidecar-lock-target.d.ts.map +1 -0
- package/dist/sidecar-lock-target.js +55 -0
- package/dist/sidecar-lock.d.ts.map +1 -1
- package/dist/sidecar-lock.js +100 -16
- package/dist/staged-directory.d.ts.map +1 -1
- package/dist/staged-directory.js +6 -6
- package/dist/staged-file-settlement.d.ts +17 -0
- package/dist/staged-file-settlement.d.ts.map +1 -0
- package/dist/staged-file-settlement.js +57 -0
- package/dist/temp-workspace-descriptor.d.ts.map +1 -1
- package/dist/temp-workspace-descriptor.js +9 -27
- package/dist/temp-workspace-owner.d.ts.map +1 -1
- package/dist/temp-workspace-owner.js +8 -8
- package/dist/walk.d.ts +5 -1
- package/dist/walk.d.ts.map +1 -1
- package/dist/walk.js +19 -6
- package/dist/windows-owner.d.ts.map +1 -1
- package/dist/windows-owner.js +4 -3
- package/dist/windows-security-bridge.cs +336 -0
- package/dist/windows-security-bridge.ps1 +15 -0
- package/dist/windows-security-command.d.ts +26 -0
- package/dist/windows-security-command.d.ts.map +1 -0
- package/dist/windows-security-command.js +363 -0
- package/dist/windows-security-facts.d.ts +6 -0
- package/dist/windows-security-facts.d.ts.map +1 -0
- package/dist/windows-security-facts.js +108 -0
- package/docs/advanced.md +4 -2
- package/docs/archive.md +97 -46
- package/docs/atomic.md +85 -8
- package/docs/config.md +6 -2
- package/docs/contributing.md +44 -4
- package/docs/copy.md +37 -0
- package/docs/creation.md +128 -0
- package/docs/durability.md +24 -0
- package/docs/file-store.md +19 -0
- package/docs/install.md +31 -7
- package/docs/json-store.md +5 -0
- package/docs/migrating-to-0.5.md +15 -6
- package/docs/migrating-to-0.6.md +9 -4
- package/docs/native-helper.md +32 -12
- package/docs/native.md +38 -7
- package/docs/output.md +6 -0
- package/docs/path-prefix.md +10 -0
- package/docs/path-suffix-aliases.md +51 -6
- package/docs/permissions.md +50 -14
- package/docs/public-api.md +3 -2
- package/docs/root.md +56 -3
- package/docs/secret-file.md +11 -2
- package/docs/secure-file.md +9 -4
- package/docs/sidecar-lock.md +114 -8
- package/docs/staged-file.md +12 -3
- package/docs/temp.md +20 -3
- package/docs/walk.md +67 -1
- package/docs/writing.md +76 -6
- package/package.json +19 -16
- package/dist/darwin-acl.d.ts +0 -4
- package/dist/darwin-acl.d.ts.map +0 -1
- package/dist/darwin-acl.js +0 -24
|
@@ -107,30 +107,83 @@ function throwTempWorkspaceOpenFailure(failure) {
|
|
|
107
107
|
},
|
|
108
108
|
});
|
|
109
109
|
}
|
|
110
|
-
|
|
110
|
+
function tempWorkspaceSettings(options) {
|
|
111
111
|
const rootDir = options.rootDir;
|
|
112
112
|
assertNoWindowsPathAlias(rootDir, "filesystem", "temp workspace root uses a Windows filesystem namespace alias");
|
|
113
113
|
const dirMode = options.dirMode ?? 0o700;
|
|
114
114
|
validateTempWorkspaceDirMode(dirMode);
|
|
115
115
|
const mode = options.mode ?? 0o600;
|
|
116
116
|
const cleanupSafety = resolveTempWorkspaceCleanupSafety(options.cleanupSafety);
|
|
117
|
-
|
|
118
|
-
|
|
117
|
+
return { rootDir, dirMode, mode, cleanupSafety };
|
|
118
|
+
}
|
|
119
|
+
function tempWorkspaceChildPrefix(root, options, scopedPrefix) {
|
|
119
120
|
assertNoWindowsPathAlias(root, "filesystem", "temp workspace root uses a Windows filesystem namespace alias");
|
|
120
|
-
// Capture and sanitize caller-controlled
|
|
121
|
-
const
|
|
122
|
-
const workspacePrefix = scopedPrefix
|
|
123
|
-
? `${sanitizeTempPrefix(rawPrefix)}${randomUUID()}-`
|
|
124
|
-
: rawPrefix;
|
|
121
|
+
// Capture and sanitize caller-controlled data before retaining descriptors.
|
|
122
|
+
const prefix = options.prefix;
|
|
123
|
+
const workspacePrefix = scopedPrefix ? `${sanitizeTempPrefix(prefix)}${randomUUID()}-` : prefix;
|
|
125
124
|
const childPrefix = path.join(root, sanitizeTempPrefix(workspacePrefix));
|
|
126
125
|
assertNoWindowsPathAlias(childPrefix, "filesystem", "temp workspace path uses a Windows filesystem namespace alias");
|
|
126
|
+
return childPrefix;
|
|
127
|
+
}
|
|
128
|
+
function throwTempWorkspaceCreationFailure(error, retainedChild, capability, owner) {
|
|
129
|
+
try {
|
|
130
|
+
if (owner)
|
|
131
|
+
owner.cleanupSync();
|
|
132
|
+
else {
|
|
133
|
+
const closeErrors = [];
|
|
134
|
+
try {
|
|
135
|
+
retainedChild?.close();
|
|
136
|
+
}
|
|
137
|
+
catch (closeError) {
|
|
138
|
+
closeErrors.push(closeError);
|
|
139
|
+
}
|
|
140
|
+
try {
|
|
141
|
+
capability.close();
|
|
142
|
+
}
|
|
143
|
+
catch (closeError) {
|
|
144
|
+
closeErrors.push(closeError);
|
|
145
|
+
}
|
|
146
|
+
if (closeErrors.length === 1)
|
|
147
|
+
throw closeErrors[0];
|
|
148
|
+
if (closeErrors.length > 1) {
|
|
149
|
+
throw new AggregateError(closeErrors, "temp workspace admission descriptor close failed");
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
catch (cleanupError) {
|
|
154
|
+
throw new AggregateError([error, cleanupError], "temp workspace creation and cleanup both failed");
|
|
155
|
+
}
|
|
156
|
+
throw error;
|
|
157
|
+
}
|
|
158
|
+
function registerTempWorkspace(dir, retainedChild, capability, admission, dirMode) {
|
|
159
|
+
let owner;
|
|
160
|
+
let stat;
|
|
161
|
+
let unregisterTempDir;
|
|
162
|
+
try {
|
|
163
|
+
const retainChildDescriptor = capability.admitChildDescriptor(retainedChild.ensureReadable());
|
|
164
|
+
// Final adoption orders ancestry and cleanup-parent authority before the
|
|
165
|
+
// original child's descriptor and named security-state checks.
|
|
166
|
+
if (capability.parent)
|
|
167
|
+
capability.assertAncestryCurrent();
|
|
168
|
+
else
|
|
169
|
+
admission.assertAncestry();
|
|
170
|
+
stat = retainedChild.finalizeAdmission(admission.ownerUid, dirMode);
|
|
171
|
+
owner = new TempWorkspaceCleanupOwner(retainedChild, capability, retainChildDescriptor);
|
|
172
|
+
unregisterTempDir = registerTempPathForExit(dir, { cleanupSync: () => owner.cleanupSync() });
|
|
173
|
+
}
|
|
174
|
+
catch (error) {
|
|
175
|
+
throwTempWorkspaceCreationFailure(error, retainedChild, capability, owner);
|
|
176
|
+
}
|
|
177
|
+
return { owner: owner, unregisterTempDir, identity: { dev: Number(stat.dev), ino: Number(stat.ino) } };
|
|
178
|
+
}
|
|
179
|
+
async function createTempWorkspace(options, scopedPrefix = false) {
|
|
180
|
+
const { rootDir, dirMode, mode, cleanupSafety } = tempWorkspaceSettings(options);
|
|
181
|
+
const admission = await admitTempWorkspaceRoot(rootDir);
|
|
182
|
+
const root = admission.dir;
|
|
183
|
+
const childPrefix = tempWorkspaceChildPrefix(root, options, scopedPrefix);
|
|
127
184
|
const capability = new TempWorkspaceCleanupCapability(root, cleanupSafety, admission, dirMode);
|
|
128
185
|
let dir;
|
|
129
|
-
let stat;
|
|
130
186
|
let retainedChild;
|
|
131
|
-
let retainChildDescriptor = false;
|
|
132
|
-
let cleanupOwner;
|
|
133
|
-
let unregisterTempDir;
|
|
134
187
|
try {
|
|
135
188
|
// Native capability discovery is complete before this synchronous
|
|
136
189
|
// boundary. The existing canonical-root route now captures the complete
|
|
@@ -143,7 +196,7 @@ async function createTempWorkspace(options, scopedPrefix = false) {
|
|
|
143
196
|
capability.assertCurrent();
|
|
144
197
|
else
|
|
145
198
|
admission.assertCurrent();
|
|
146
|
-
stat = inspectDirectoryIdentitySync(dir);
|
|
199
|
+
const stat = inspectDirectoryIdentitySync(dir);
|
|
147
200
|
const needsModeInitialization = validateInitialTempWorkspaceChild(stat, admission.ownerUid, dirMode);
|
|
148
201
|
// Retain while the child still has its private creation mode so an
|
|
149
202
|
// explicit dirMode such as 0 cannot make identity descriptor acquisition fail.
|
|
@@ -151,52 +204,11 @@ async function createTempWorkspace(options, scopedPrefix = false) {
|
|
|
151
204
|
const modeInitialization = admitRetainedTempWorkspaceChild(retainedChild, needsModeInitialization, admission, dirMode);
|
|
152
205
|
if (modeInitialization)
|
|
153
206
|
await modeInitialization;
|
|
154
|
-
retainChildDescriptor = capability.admitChildDescriptor(retainedChild.ensureReadable());
|
|
155
|
-
// Final adoption order is deliberate: complete ancestry, retained cleanup
|
|
156
|
-
// parent, then descriptor and named checks of the original child identity.
|
|
157
|
-
if (capability.parent)
|
|
158
|
-
capability.assertAncestryCurrent();
|
|
159
|
-
else
|
|
160
|
-
admission.assertAncestry();
|
|
161
|
-
stat = retainedChild.finalizeAdmission(admission.ownerUid, dirMode);
|
|
162
|
-
cleanupOwner = new TempWorkspaceCleanupOwner(retainedChild, capability, retainChildDescriptor);
|
|
163
|
-
retainedChild = undefined;
|
|
164
|
-
unregisterTempDir = registerTempPathForExit(dir, {
|
|
165
|
-
cleanupSync: () => cleanupOwner.cleanupSync(),
|
|
166
|
-
});
|
|
167
207
|
}
|
|
168
208
|
catch (error) {
|
|
169
|
-
|
|
170
|
-
if (cleanupOwner)
|
|
171
|
-
cleanupOwner.cleanupSync();
|
|
172
|
-
else {
|
|
173
|
-
const closeErrors = [];
|
|
174
|
-
try {
|
|
175
|
-
retainedChild?.close();
|
|
176
|
-
}
|
|
177
|
-
catch (closeError) {
|
|
178
|
-
closeErrors.push(closeError);
|
|
179
|
-
}
|
|
180
|
-
try {
|
|
181
|
-
capability.close();
|
|
182
|
-
}
|
|
183
|
-
catch (closeError) {
|
|
184
|
-
closeErrors.push(closeError);
|
|
185
|
-
}
|
|
186
|
-
if (closeErrors.length === 1)
|
|
187
|
-
throw closeErrors[0];
|
|
188
|
-
if (closeErrors.length > 1) {
|
|
189
|
-
throw new AggregateError(closeErrors, "temp workspace admission descriptor close failed");
|
|
190
|
-
}
|
|
191
|
-
}
|
|
192
|
-
}
|
|
193
|
-
catch (cleanupError) {
|
|
194
|
-
throw new AggregateError([error, cleanupError], "temp workspace creation and cleanup both failed");
|
|
195
|
-
}
|
|
196
|
-
throw error;
|
|
209
|
+
throwTempWorkspaceCreationFailure(error, retainedChild, capability);
|
|
197
210
|
}
|
|
198
|
-
const owner =
|
|
199
|
-
const identity = { dev: Number(stat.dev), ino: Number(stat.ino) };
|
|
211
|
+
const { owner, identity, unregisterTempDir } = registerTempWorkspace(dir, retainedChild, capability, admission, dirMode);
|
|
200
212
|
// Once registered, even a store-construction failure remains exit-cleanable.
|
|
201
213
|
const store = fileStore({ rootDir: dir, private: true, dirMode, mode });
|
|
202
214
|
return {
|
|
@@ -250,30 +262,13 @@ export async function withTempWorkspace(options, run) {
|
|
|
250
262
|
}
|
|
251
263
|
}
|
|
252
264
|
function createTempWorkspaceSync(options, scopedPrefix = false) {
|
|
253
|
-
const rootDir = options
|
|
254
|
-
assertNoWindowsPathAlias(rootDir, "filesystem", "temp workspace root uses a Windows filesystem namespace alias");
|
|
255
|
-
const dirMode = options.dirMode ?? 0o700;
|
|
256
|
-
validateTempWorkspaceDirMode(dirMode);
|
|
257
|
-
const mode = options.mode ?? 0o600;
|
|
258
|
-
const cleanupSafety = resolveTempWorkspaceCleanupSafety(options.cleanupSafety);
|
|
265
|
+
const { rootDir, dirMode, mode, cleanupSafety } = tempWorkspaceSettings(options);
|
|
259
266
|
const admission = admitTempWorkspaceRootSync(rootDir);
|
|
260
267
|
const root = admission.dir;
|
|
261
|
-
|
|
262
|
-
// Capture and sanitize caller-controlled prefix data before retaining descriptors.
|
|
263
|
-
const rawPrefix = options.prefix;
|
|
264
|
-
const workspacePrefix = scopedPrefix
|
|
265
|
-
? `${sanitizeTempPrefix(rawPrefix)}${randomUUID()}-`
|
|
266
|
-
: rawPrefix;
|
|
267
|
-
const childPrefix = path.join(root, sanitizeTempPrefix(workspacePrefix));
|
|
268
|
-
assertNoWindowsPathAlias(childPrefix, "filesystem", "temp workspace path uses a Windows filesystem namespace alias");
|
|
268
|
+
const childPrefix = tempWorkspaceChildPrefix(root, options, scopedPrefix);
|
|
269
269
|
const capability = new TempWorkspaceCleanupCapability(root, cleanupSafety, admission, dirMode);
|
|
270
270
|
let dir;
|
|
271
|
-
let stat;
|
|
272
271
|
let retainedChild;
|
|
273
|
-
let retainChildDescriptor = false;
|
|
274
|
-
let needsModeInitialization;
|
|
275
|
-
let cleanupOwner;
|
|
276
|
-
let unregisterTempDir;
|
|
277
272
|
try {
|
|
278
273
|
const directRequestedMode = canCreateTempWorkspaceWithRequestedMode(dirMode);
|
|
279
274
|
if (directRequestedMode) {
|
|
@@ -288,64 +283,23 @@ function createTempWorkspaceSync(options, scopedPrefix = false) {
|
|
|
288
283
|
capability.assertCurrent();
|
|
289
284
|
else
|
|
290
285
|
admission.assertCurrent();
|
|
286
|
+
let stat;
|
|
291
287
|
if (directRequestedMode) {
|
|
292
288
|
const created = TempWorkspaceRetainedChild.retainCreated(dir);
|
|
293
289
|
retainedChild = created.retained;
|
|
294
290
|
stat = created.stat;
|
|
295
|
-
needsModeInitialization = validateInitialTempWorkspaceChild(stat, admission.ownerUid, dirMode);
|
|
296
291
|
}
|
|
297
292
|
else {
|
|
298
293
|
stat = inspectDirectoryIdentitySync(dir);
|
|
299
|
-
needsModeInitialization = validateInitialTempWorkspaceChild(stat, admission.ownerUid, dirMode);
|
|
300
|
-
retainedChild = TempWorkspaceRetainedChild.retain(dir, stat);
|
|
301
294
|
}
|
|
295
|
+
const needsModeInitialization = validateInitialTempWorkspaceChild(stat, admission.ownerUid, dirMode);
|
|
296
|
+
retainedChild ??= TempWorkspaceRetainedChild.retain(dir, stat);
|
|
302
297
|
admitRetainedTempWorkspaceChildSync(retainedChild, needsModeInitialization, admission, dirMode);
|
|
303
|
-
retainChildDescriptor = capability.admitChildDescriptor(retainedChild.ensureReadable());
|
|
304
|
-
// Match async adoption: complete ancestry and retained cleanup authority
|
|
305
|
-
// precede descriptor and named child security-state checks.
|
|
306
|
-
if (capability.parent)
|
|
307
|
-
capability.assertAncestryCurrent();
|
|
308
|
-
else
|
|
309
|
-
admission.assertAncestry();
|
|
310
|
-
stat = retainedChild.finalizeAdmission(admission.ownerUid, dirMode);
|
|
311
|
-
cleanupOwner = new TempWorkspaceCleanupOwner(retainedChild, capability, retainChildDescriptor);
|
|
312
|
-
retainedChild = undefined;
|
|
313
|
-
unregisterTempDir = registerTempPathForExit(dir, {
|
|
314
|
-
cleanupSync: () => cleanupOwner.cleanupSync(),
|
|
315
|
-
});
|
|
316
298
|
}
|
|
317
299
|
catch (error) {
|
|
318
|
-
|
|
319
|
-
if (cleanupOwner)
|
|
320
|
-
cleanupOwner.cleanupSync();
|
|
321
|
-
else {
|
|
322
|
-
const closeErrors = [];
|
|
323
|
-
try {
|
|
324
|
-
retainedChild?.close();
|
|
325
|
-
}
|
|
326
|
-
catch (closeError) {
|
|
327
|
-
closeErrors.push(closeError);
|
|
328
|
-
}
|
|
329
|
-
try {
|
|
330
|
-
capability.close();
|
|
331
|
-
}
|
|
332
|
-
catch (closeError) {
|
|
333
|
-
closeErrors.push(closeError);
|
|
334
|
-
}
|
|
335
|
-
if (closeErrors.length === 1)
|
|
336
|
-
throw closeErrors[0];
|
|
337
|
-
if (closeErrors.length > 1) {
|
|
338
|
-
throw new AggregateError(closeErrors, "temp workspace admission descriptor close failed");
|
|
339
|
-
}
|
|
340
|
-
}
|
|
341
|
-
}
|
|
342
|
-
catch (cleanupError) {
|
|
343
|
-
throw new AggregateError([error, cleanupError], "temp workspace creation and cleanup both failed");
|
|
344
|
-
}
|
|
345
|
-
throw error;
|
|
300
|
+
throwTempWorkspaceCreationFailure(error, retainedChild, capability);
|
|
346
301
|
}
|
|
347
|
-
const owner =
|
|
348
|
-
const identity = { dev: Number(stat.dev), ino: Number(stat.ino) };
|
|
302
|
+
const { owner, identity, unregisterTempDir } = registerTempWorkspace(dir, retainedChild, capability, admission, dirMode);
|
|
349
303
|
// Once registered, even a store-construction failure remains exit-cleanable.
|
|
350
304
|
const store = fileStoreSync({ rootDir: dir, private: true, dirMode, mode });
|
|
351
305
|
return {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type BigIntStats } from "node:fs";
|
|
2
|
-
import type
|
|
2
|
+
import { type AnyAsyncDirectoryGuard } from "./directory-guard.js";
|
|
3
3
|
import type { PublishedWriteIdentity } from "./pinned-write.js";
|
|
4
4
|
export declare function publishCopyStage(params: {
|
|
5
5
|
temporaryPath: string;
|
|
@@ -8,6 +8,7 @@ export declare function publishCopyStage(params: {
|
|
|
8
8
|
identity: BigIntStats;
|
|
9
9
|
parentGuard: AnyAsyncDirectoryGuard;
|
|
10
10
|
assertBeforeMutation?: () => void;
|
|
11
|
+
onPublicationAttempt?: () => void;
|
|
11
12
|
onPublished?: (identity: PublishedWriteIdentity) => void;
|
|
12
13
|
}): void;
|
|
13
14
|
//# sourceMappingURL=publish-copy-stage.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"publish-copy-stage.d.ts","sourceRoot":"","sources":["../src/publish-copy-stage.ts"],"names":[],"mappings":"AAAA,OAAW,EAAE,KAAK,WAAW,EAAE,MAAM,SAAS,CAAC;AAE/C,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"publish-copy-stage.d.ts","sourceRoot":"","sources":["../src/publish-copy-stage.ts"],"names":[],"mappings":"AAAA,OAAW,EAAE,KAAK,WAAW,EAAE,MAAM,SAAS,CAAC;AAE/C,OAAO,EAA4B,KAAK,sBAAsB,EAAE,MAAM,sBAAsB,CAAC;AAG7F,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,mBAAmB,CAAC;AAIhE,wBAAgB,gBAAgB,CAAC,MAAM,EAAE;IACvC,aAAa,EAAE,MAAM,CAAC;IACtB,UAAU,EAAE,MAAM,CAAC;IACnB,EAAE,EAAE,MAAM,CAAC;IACX,QAAQ,EAAE,WAAW,CAAC;IACtB,WAAW,EAAE,sBAAsB,CAAC;IACpC,oBAAoB,CAAC,EAAE,MAAM,IAAI,CAAC;IAClC,oBAAoB,CAAC,EAAE,MAAM,IAAI,CAAC;IAClC,WAAW,CAAC,EAAE,CAAC,QAAQ,EAAE,sBAAsB,KAAK,IAAI,CAAC;CAC1D,GAAG,IAAI,CA4CP"}
|
|
@@ -1,19 +1,28 @@
|
|
|
1
1
|
import fs, {} from "node:fs";
|
|
2
2
|
import path from "node:path";
|
|
3
|
+
import { assertSyncDirectoryGuard } from "./directory-guard.js";
|
|
3
4
|
import { FsSafeError } from "./errors.js";
|
|
4
5
|
import { sameFileIdentityForCleanup } from "./file-identity.js";
|
|
5
6
|
// Node has no portable no-replace rename. Link only our completed private stage,
|
|
6
7
|
// then unlink it in the same JS turn so local readers never observe two names.
|
|
7
8
|
export function publishCopyStage(params) {
|
|
8
9
|
const { identity, temporaryPath, targetPath } = params;
|
|
9
|
-
const
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
!
|
|
14
|
-
|
|
15
|
-
|
|
10
|
+
const assertCurrent = () => {
|
|
11
|
+
assertSyncDirectoryGuard(params.parentGuard);
|
|
12
|
+
const staged = fs.lstatSync(temporaryPath, { bigint: true });
|
|
13
|
+
const opened = fs.fstatSync(params.fd, { bigint: true });
|
|
14
|
+
if (!staged.isFile() || staged.isSymbolicLink() || staged.nlink !== 1n ||
|
|
15
|
+
!sameFileIdentityForCleanup(staged, identity) ||
|
|
16
|
+
!sameFileIdentityForCleanup(opened, identity)) {
|
|
17
|
+
throw new FsSafeError("path-mismatch", "exclusive copy stage changed before publication");
|
|
18
|
+
}
|
|
19
|
+
};
|
|
20
|
+
assertCurrent();
|
|
16
21
|
params.assertBeforeMutation?.();
|
|
22
|
+
// Caller authority checks can synchronously replace a parent or staged entry.
|
|
23
|
+
if (params.assertBeforeMutation)
|
|
24
|
+
assertCurrent();
|
|
25
|
+
params.onPublicationAttempt?.();
|
|
17
26
|
fs.linkSync(temporaryPath, targetPath);
|
|
18
27
|
let observerRejected = false;
|
|
19
28
|
let observerError;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"publish-file.d.ts","sourceRoot":"","sources":["../src/publish-file.ts"],"names":[],"mappings":"AACA,OAAe,EAAoB,KAAK,KAAK,EAAE,MAAM,SAAS,CAAC;AAG/D,OAAO,EAEL,KAAK,gBAAgB,EACrB,KAAK,oBAAoB,EAC1B,MAAM,2BAA2B,CAAC;
|
|
1
|
+
{"version":3,"file":"publish-file.d.ts","sourceRoot":"","sources":["../src/publish-file.ts"],"names":[],"mappings":"AACA,OAAe,EAAoB,KAAK,KAAK,EAAE,MAAM,SAAS,CAAC;AAG/D,OAAO,EAEL,KAAK,gBAAgB,EACrB,KAAK,oBAAoB,EAC1B,MAAM,2BAA2B,CAAC;AAInC,OAAO,EAGL,KAAK,gBAAgB,EACtB,MAAM,oBAAoB,CAAC;AAK5B,OAAO,EAML,KAAK,qCAAqC,EAC3C,MAAM,2BAA2B,CAAC;AAKnC,YAAY,EACV,2BAA2B,EAC3B,wCAAwC,EACxC,kCAAkC,EAClC,gCAAgC,EAChC,qCAAqC,GACtC,MAAM,2BAA2B,CAAC;AAEnC,MAAM,MAAM,4BAA4B,GAAG,cAAc,GAAG,eAAe,GAAG,kBAAkB,CAAC;AAEjG,MAAM,MAAM,0BAA0B,GAAG;IACvC,MAAM,EAAE,UAAU,GAAG,gBAAgB,GAAG,kBAAkB,CAAC;IAC3D,QAAQ,EAAE,KAAK,CAAC;IAChB,aAAa,EAAE,oBAAoB,CAAC;CACrC,CAAC;AAIF,wBAAgB,uBAAuB,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO,CAE/D;AA0ND,wBAAsB,oBAAoB,CAAC,MAAM,EAAE;IACjD,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;IACnB,sBAAsB,CAAC,EAAE,gBAAgB,CAAC;IAC1C,QAAQ,EAAE,4BAA4B,CAAC;IACvC,aAAa,CAAC,EAAE,qCAAqC,CAAC;IACtD,aAAa,CAAC,EAAE,gBAAgB,CAAC;CAClC,GAAG,OAAO,CAAC,0BAA0B,CAAC,CA4NtC"}
|
package/dist/publish-file.js
CHANGED
|
@@ -4,6 +4,7 @@ import fs, {} from "node:fs/promises";
|
|
|
4
4
|
import path from "node:path";
|
|
5
5
|
import { pinDirectory, } from "./directory-durability.js";
|
|
6
6
|
import { FsSafeError } from "./errors.js";
|
|
7
|
+
import { ownDirectoryReceipt } from "./directory-receipt.js";
|
|
7
8
|
import { hashFileHandle } from "./file-hash.js";
|
|
8
9
|
import { sameFileIdentity, sameFileIdentityForCleanup, } from "./file-identity.js";
|
|
9
10
|
import { syncFileBestEffortSync } from "./file-sync.js";
|
|
@@ -183,8 +184,7 @@ export async function publishFileExclusive(params) {
|
|
|
183
184
|
const targetPathInput = admitStandalonePublicationPath(params.targetPath, "publication target uses a Windows filesystem namespace alias");
|
|
184
185
|
const parentReceiptInput = params.parentReceipt;
|
|
185
186
|
const parentReceipt = parentReceiptInput
|
|
186
|
-
?
|
|
187
|
-
identity: parentReceiptInput.identity }
|
|
187
|
+
? ownDirectoryReceipt(parentReceiptInput)
|
|
188
188
|
: undefined;
|
|
189
189
|
if (parentReceipt) {
|
|
190
190
|
assertNoWindowsPathAlias(parentReceipt.path, "filesystem", "publication parent uses a Windows filesystem namespace alias");
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"regular-file.d.ts","sourceRoot":"","sources":["../src/regular-file.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAe,KAAK,EAAE,MAAM,SAAS,CAAC;AAClD,OAAO,MAAM,MAAM,SAAS,CAAC;AAuB7B,MAAM,MAAM,qBAAqB,GAAG;IAAE,OAAO,EAAE,IAAI,CAAA;CAAE,GAAG;IAAE,OAAO,EAAE,KAAK,CAAC;IAAC,IAAI,EAAE,KAAK,CAAA;CAAE,CAAC;AAExF,KAAK,8BAA8B,GAAG,IAAI,CACxC,OAAO,MAAM,CAAC,SAAS,EACvB,UAAU,GAAG,SAAS,GAAG,UAAU,CACpC,GACC,OAAO,CAAC,IAAI,CAAC,OAAO,MAAM,CAAC,SAAS,EAAE,YAAY,GAAG,YAAY,CAAC,CAAC,CAAC;AAEtE,MAAM,MAAM,wBAAwB,GAAG;IACrC,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,MAAM,GAAG,UAAU,CAAC;IAC7B,QAAQ,CAAC,EAAE,cAAc,CAAC;IAC1B,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,oBAAoB,CAAC,EAAE,OAAO,CAAC;CAChC,CAAC;AAEF,wBAAgB,6BAA6B,CAC3C,SAAS,GAAE,8BAAiD,GAC3D,MAAM,CASR;AAaD,wBAAsB,eAAe,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,qBAAqB,CAAC,
|
|
1
|
+
{"version":3,"file":"regular-file.d.ts","sourceRoot":"","sources":["../src/regular-file.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAe,KAAK,EAAE,MAAM,SAAS,CAAC;AAClD,OAAO,MAAM,MAAM,SAAS,CAAC;AAuB7B,MAAM,MAAM,qBAAqB,GAAG;IAAE,OAAO,EAAE,IAAI,CAAA;CAAE,GAAG;IAAE,OAAO,EAAE,KAAK,CAAC;IAAC,IAAI,EAAE,KAAK,CAAA;CAAE,CAAC;AAExF,KAAK,8BAA8B,GAAG,IAAI,CACxC,OAAO,MAAM,CAAC,SAAS,EACvB,UAAU,GAAG,SAAS,GAAG,UAAU,CACpC,GACC,OAAO,CAAC,IAAI,CAAC,OAAO,MAAM,CAAC,SAAS,EAAE,YAAY,GAAG,YAAY,CAAC,CAAC,CAAC;AAEtE,MAAM,MAAM,wBAAwB,GAAG;IACrC,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,MAAM,GAAG,UAAU,CAAC;IAC7B,QAAQ,CAAC,EAAE,cAAc,CAAC;IAC1B,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,oBAAoB,CAAC,EAAE,OAAO,CAAC;CAChC,CAAC;AAEF,wBAAgB,6BAA6B,CAC3C,SAAS,GAAE,8BAAiD,GAC3D,MAAM,CASR;AAaD,wBAAsB,eAAe,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,qBAAqB,CAAC,CAEtF;AAED,wBAAgB,mBAAmB,CAAC,QAAQ,EAAE,MAAM,GAAG,qBAAqB,CAe3E;AAED,wBAAsB,eAAe,CAAC,MAAM,EAAE;IAC5C,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB,GAAG,OAAO,CAAC;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,KAAK,CAAA;CAAE,CAAC,CA+D3C;AA2DD,wBAAgB,mBAAmB,CAAC,MAAM,EAAE;IAAE,QAAQ,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,EAAE,MAAM,CAAA;CAAE,GAAG;IACpF,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,KAAK,CAAC;CACb,CAsCA;AAmBD,wBAAsB,iBAAiB,CAAC,OAAO,EAAE,wBAAwB,GAAG,OAAO,CAAC,IAAI,CAAC,CAkFxF;AAED,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,wBAAwB,GAAG,IAAI,CAkF7E"}
|
package/dist/regular-file.js
CHANGED
|
@@ -30,21 +30,7 @@ function translateBoundedReadOverflow(error, filePath, maxBytes) {
|
|
|
30
30
|
throw error;
|
|
31
31
|
}
|
|
32
32
|
export async function statRegularFile(filePath) {
|
|
33
|
-
|
|
34
|
-
let stat;
|
|
35
|
-
try {
|
|
36
|
-
stat = fsSync.lstatSync(filePath);
|
|
37
|
-
}
|
|
38
|
-
catch (err) {
|
|
39
|
-
if (isNotFoundPathError(err)) {
|
|
40
|
-
return { missing: true };
|
|
41
|
-
}
|
|
42
|
-
throw err;
|
|
43
|
-
}
|
|
44
|
-
if (stat.isSymbolicLink() || !stat.isFile()) {
|
|
45
|
-
throw new Error("path must be a regular file");
|
|
46
|
-
}
|
|
47
|
-
return { missing: false, stat };
|
|
33
|
+
return statRegularFileSync(filePath);
|
|
48
34
|
}
|
|
49
35
|
export function statRegularFileSync(filePath) {
|
|
50
36
|
assertNoWindowsPathAlias(filePath, "filesystem", "file path uses a Windows filesystem namespace alias");
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"replace-directory.d.ts","sourceRoot":"","sources":["../src/replace-directory.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"replace-directory.d.ts","sourceRoot":"","sources":["../src/replace-directory.ts"],"names":[],"mappings":"AAuBA,MAAM,MAAM,6BAA6B,GAAG;IAC1C,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;IAClB,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB,CAAC;AAqIF,wBAAsB,sBAAsB,CAC1C,OAAO,EAAE,6BAA6B,GACrC,OAAO,CAAC,IAAI,CAAC,CAiBf"}
|