@file-viewer/asset-installer 3.2.0 → 3.2.1

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.en.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # @file-viewer/asset-installer
2
2
 
3
- Runtime package version 3.2.0.
3
+ Runtime package version 3.2.1.
4
4
 
5
5
  Usage and API documentation: https://doc.file-viewer.app/
6
6
 
package/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # @file-viewer/asset-installer
2
2
 
3
- Runtime package version 3.2.0.
3
+ Runtime package version 3.2.1.
4
4
 
5
5
  Usage and API documentation: https://doc.file-viewer.app/
6
6
 
package/dist/index.d.ts CHANGED
@@ -15,6 +15,7 @@ export interface CapabilityAssetReceiptFile {
15
15
  path: string;
16
16
  size: number;
17
17
  sha256: string;
18
+ /** managed includes a path shared by two File Viewer asset owners. */
18
19
  ownership: 'managed' | 'shared';
19
20
  }
20
21
  export interface CapabilityAssetReceipt {
@@ -100,6 +101,7 @@ export declare function uninstallFileViewerCapabilityAssetPack(targetDirInput: s
100
101
  targetDir: string;
101
102
  removedFiles: string[];
102
103
  }>;
104
+ /** Shared implementation for the stable bin shipped by each independent asset-owner package. */
103
105
  export declare function runFileViewerAssetPackCli(packRootInput: string, args: string[]): Promise<{
104
106
  help: true;
105
107
  text: string;
package/dist/index.js CHANGED
@@ -48,6 +48,7 @@ const nearestExistingParent = async (path) => {
48
48
  }
49
49
  }
50
50
  };
51
+ /** Resolve through the nearest existing ancestor once, then keep every later path inside that canonical root. */
51
52
  const prepareTargetDir = async (targetDirInput) => {
52
53
  const requested = resolve(targetDirInput);
53
54
  const { existing, missing } = await nearestExistingParent(requested);
@@ -183,6 +184,7 @@ const parseLockState = async (path) => {
183
184
  };
184
185
  const restoreQuarantinedLock = async (quarantinePath, originalPath) => {
185
186
  try {
187
+ // An atomic no-replace restore cannot overwrite a newer claimant.
186
188
  await link(quarantinePath, originalPath);
187
189
  await rm(quarantinePath, { force: true });
188
190
  }
@@ -221,6 +223,7 @@ const reclaimStaleAuxiliaryLock = async (targetDir, path) => {
221
223
  await restoreQuarantinedLock(quarantinePath, path);
222
224
  }
223
225
  catch {
226
+ // Keep the quarantined inode and fail closed if another process won.
224
227
  }
225
228
  }
226
229
  throw error;
@@ -284,6 +287,9 @@ const quarantineStaleAssetLock = async (targetDir, lockPath) => {
284
287
  try {
285
288
  if (!(await parseLockState(lockPath)).stale)
286
289
  return false;
290
+ // The reaper claim ensures no second stale branch can race this rename.
291
+ // New contenders may create a fresh lock after the rename, but cleanup only
292
+ // touches the uniquely named quarantined inode.
287
293
  await rename(lockPath, quarantinePath);
288
294
  await rm(quarantinePath, { force: true });
289
295
  return true;
@@ -1032,6 +1038,7 @@ export async function uninstallFileViewerCapabilityAssetPack(targetDirInput, own
1032
1038
  await releaseAssetLock(lock);
1033
1039
  }
1034
1040
  }
1041
+ /** Shared implementation for the stable bin shipped by each independent asset-owner package. */
1035
1042
  export async function runFileViewerAssetPackCli(packRootInput, args) {
1036
1043
  const packRoot = resolve(packRootInput);
1037
1044
  const packageJson = JSON.parse((await readNoFollow(resolve(packRoot, 'package.json'))).toString('utf8'));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@file-viewer/asset-installer",
3
- "version": "3.2.0",
3
+ "version": "3.2.1",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "description": "Small transactional installer shared by independently shipped File Viewer capability asset packs.",