@kitschpatrol/aphex 0.1.4 → 0.1.6

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/dist/aphex-swift CHANGED
Binary file
package/dist/index.d.ts CHANGED
@@ -1,7 +1,6 @@
1
1
  import { ExifTool } from "exiftool-vendored";
2
2
  import { ILogBasic, ILogLayer } from "lognow";
3
3
  import { OmitDeep, PartialDeep, Simplify } from "type-fest";
4
- //#region src/aphex-swift/cli-bridge.d.ts
5
4
  /**
6
5
  * Start an interactive session with aphex-swift. Commands will be sent to this
7
6
  * persistent process instead of spawning new ones.
@@ -61,12 +60,8 @@ declare function aphexPhotoInfo(identifiers: string | string[], caseSensitive?:
61
60
  * @throws {Error} If the command fails
62
61
  */
63
62
  declare function aphexAlbumInfo(identifiers: string | string[], caseSensitive?: boolean): Promise<AlbumInfo[]>;
64
- //#endregion
65
- //#region src/utilities/image/mime.d.ts
66
63
  export declare const IMAGE_MIME_TYPES: readonly ["arw", "avif", "bmp", "cr2", "cr3", "crw", "tga", "dng", "gif", "heic", "heif", "jpeg", "nef", "pef", "png", "psd", "svg+xml", "tiff", "webp"];
67
64
  type ImageMimeType = (typeof IMAGE_MIME_TYPES)[number];
68
- //#endregion
69
- //#region src/pipeline/engines/applescript-gui.d.ts
70
65
  /**
71
66
  * Mirrors the export UI in Note that note that some options are contingent on
72
67
  * others.
@@ -120,8 +115,6 @@ type ExportViaAppleScriptGuiOptions = {
120
115
  */
121
116
  tiffBitDepth: 8 | 16;
122
117
  };
123
- //#endregion
124
- //#region src/pipeline/image-export.d.ts
125
118
  type ExportEngine = 'applescript' | 'file-system' | 'photos-gui' | 'swift-photokit';
126
119
  type ExportEngineOptions = ExportEngine | Partial<Record<ImageMimeType, ExportEngine>>;
127
120
  type ExportApplePhotoOptions = {
@@ -148,8 +141,6 @@ type ExportApplePhotoResult = {
148
141
  photoInfo: PhotoInfo;
149
142
  };
150
143
  type FileNameOptions = 'fileName' | 'title' | 'uuid';
151
- //#endregion
152
- //#region src/utilities/image/tags.d.ts
153
144
  declare const VALID_LABELS: readonly ["animation", "diagram", "illustration", "image", "photo", "render", "screenshot", "video"];
154
145
  type Label = (typeof VALID_LABELS)[number];
155
146
  type ValidateTagsResult = {
@@ -175,8 +166,6 @@ type ImageTags = {
175
166
  label?: Label | undefined;
176
167
  preservedFileName?: string | undefined;
177
168
  };
178
- //#endregion
179
- //#region src/pipeline/image-metadata.d.ts
180
169
  type ManageMetadataOptions = {
181
170
  syncToEdited: boolean;
182
171
  syncToTarget: boolean;
@@ -190,16 +179,12 @@ type ManageMetadataResult = {
190
179
  tagsToTarget: Array<keyof ImageTags> | undefined;
191
180
  validationResult: undefined | ValidateTagsResult;
192
181
  };
193
- //#endregion
194
- //#region src/utilities/image/color.d.ts
195
182
  declare const validColorProfiles: readonly ["Adobe RGB (1998)", "Apple Wide Color Sharing Profile", "Display P3", "None", "ProPhoto RGB", "sRGB IEC61966-2.1", "Unsupported"];
196
183
  type ColorProfile = (typeof validColorProfiles)[number];
197
184
  /**
198
185
  * Normalize the color profile of an image
199
186
  */
200
187
  declare function normalizeColorProfile(imagePath: string, preserveColorProfiles?: ColorProfile[], defaultColorProfile?: ColorProfile): Promise<'assigned' | 'converted' | 'no-action'>;
201
- //#endregion
202
- //#region src/utilities/image/convert.d.ts
203
188
  type LosslessFormat = 'avif' | 'none' | 'png' | 'webp';
204
189
  type NearLosslessFormat = 'none' | 'webp';
205
190
  type LossyFormat = 'avif' | 'jpeg' | 'none' | 'webp';
@@ -269,8 +254,6 @@ declare function compressImage(sourceImagePath: string, destinationDirectory: st
269
254
  compression: 'lossless' | 'lossy' | 'near-lossless' | 'none';
270
255
  path: string;
271
256
  }>;
272
- //#endregion
273
- //#region src/utilities/image/image.d.ts
274
257
  type ImageInfo = {
275
258
  alpha: boolean;
276
259
  colorProfile: string;
@@ -283,8 +266,6 @@ type ImageInfo = {
283
266
  sizeBytes: number;
284
267
  tags: ImageTags;
285
268
  };
286
- //#endregion
287
- //#region src/pipeline/image-process.d.ts
288
269
  type ProcessImageOptions = CompressImageOptions & {
289
270
  /** Fallback color profile applied when source profile is not in preserve list */
290
271
  defaultColorProfile: ColorProfile;
@@ -328,8 +309,6 @@ type ProcessImageResult = {
328
309
  * Run in parallel through a worker for album processing
329
310
  */
330
311
  export declare function processImage(sourceImagePath: string, destinationDirectory: string, options: ProcessImageOptions): Promise<ProcessImageResult>;
331
- //#endregion
332
- //#region src/pipeline/image-sync.d.ts
333
312
  type DiffStrategy = 'exif-tags' | 'export-options' | 'file-name' | 'force-update' | 'metadata-options' | 'photo-info' | 'process-options';
334
313
  type SyncOptions = {
335
314
  deleteOthers: boolean;
@@ -346,8 +325,6 @@ type SyncResult = {
346
325
  }>;
347
326
  toDelete: string[];
348
327
  };
349
- //#endregion
350
- //#region src/utilities/exiftool.d.ts
351
328
  /**
352
329
  * End the exiftool process gracefully
353
330
  *
@@ -355,8 +332,6 @@ type SyncResult = {
355
332
  * processes. It's safe to call multiple times.
356
333
  */
357
334
  export declare function endExiftool(): Promise<void>;
358
- //#endregion
359
- //#region src/utilities/log.d.ts
360
335
  /**
361
336
  * Set the logger instance for the module. Export this for library consumers to
362
337
  * inject their own logger.
@@ -365,8 +340,6 @@ export declare function endExiftool(): Promise<void>;
365
340
  * Stream-like log target
366
341
  */
367
342
  export declare function setLogger(logger?: ILogBasic | ILogLayer<unknown>): void;
368
- //#endregion
369
- //#region src/index.d.ts
370
343
  /**
371
344
  * Helper for deep merging ExportOptions object against library defaults.
372
345
  * Exported for unplugin-aphex.
@@ -401,5 +374,4 @@ export declare function exportPhoto(identifier: PhotoInfo | string, destinationD
401
374
  * Export photos
402
375
  */
403
376
  export declare function exportPhotos(identifiers: Array<AlbumInfo | PhotoInfo | string>, destinationDirectory: string, options?: PartialDeep<ExportOptions>): Promise<ExportResult[]>;
404
- //#endregion
405
377
  export { type ImageMimeType, aphexAlbumInfo as getAlbumInfo, aphexPhotoInfo as getPhotoInfo };
package/dist/index.js CHANGED
@@ -13,8 +13,7 @@ import { imageSizeFromFile } from "image-size/fromFile";
13
13
  import { lookup, mimes } from "mrmime";
14
14
  import { Piscina } from "piscina";
15
15
  import { deepEqual } from "fast-equals";
16
- //#endregion
17
- //#region src/utilities/log.ts
16
+ // src/utilities/log.ts
18
17
  /**
19
18
  * The default logger instance for the library.
20
19
  */
@@ -29,8 +28,7 @@ let log = createLogger("@kitschpatrol/aphex");
29
28
  function setLogger(logger) {
30
29
  log = injectionHelper(logger);
31
30
  }
32
- //#endregion
33
- //#region src/utilities/exiftool.ts
31
+ // src/utilities/exiftool.ts
34
32
  /**
35
33
  * Centralized exiftool instance management
36
34
  *
@@ -75,7 +73,9 @@ function scheduleProcessCleanup() {
75
73
  process.on("beforeExit", () => {
76
74
  if (cleanupScheduled) return;
77
75
  cleanupScheduled = true;
78
- endExiftool();
76
+ endExiftool().catch((error) => {
77
+ log.warn(`Failed to end exiftool processes: ${String(error)}`);
78
+ });
79
79
  });
80
80
  process.on("exit", () => {
81
81
  if (exiftoolInstance.pids.length > 0) log.debug(`Exiftool processes still running at exit: ${exiftoolInstance.pids.join(", ")}`);
@@ -83,20 +83,27 @@ function scheduleProcessCleanup() {
83
83
  process.on("SIGINT", () => {
84
84
  (async () => {
85
85
  log.debug("Received SIGINT, cleaning up exiftool...");
86
- await endExiftool();
86
+ try {
87
+ await endExiftool();
88
+ } catch (error) {
89
+ log.warn(`Failed to end exiftool processes: ${String(error)}`);
90
+ }
87
91
  process.exit(130);
88
92
  })();
89
93
  });
90
94
  process.on("SIGTERM", () => {
91
95
  (async () => {
92
96
  log.debug("Received SIGTERM, cleaning up exiftool...");
93
- await endExiftool();
97
+ try {
98
+ await endExiftool();
99
+ } catch (error) {
100
+ log.warn(`Failed to end exiftool processes: ${String(error)}`);
101
+ }
94
102
  process.exit(143);
95
103
  })();
96
104
  });
97
105
  }
98
- //#endregion
99
- //#region src/utilities/file.ts
106
+ // src/utilities/file.ts
100
107
  /**
101
108
  * Removes the file extension from a file path
102
109
  */
@@ -155,8 +162,7 @@ async function getTempDirectory(...labels) {
155
162
  const prefix = labels.length > 0 ? `com.kitschpatrol.aphex.${labels.map((l) => l.toLowerCase()).join(".")}.` : "com.kitschpatrol.aphex.";
156
163
  return fse.mkdtemp(path.join(os.tmpdir(), prefix));
157
164
  }
158
- //#endregion
159
- //#region src/utilities/general.ts
165
+ // src/utilities/general.ts
160
166
  const UUID_REGEX = /^[\da-f]{8}(?:-[\da-f]{4}){3}-[\da-f]{12}$/iv;
161
167
  /**
162
168
  * Sips makes a mess of the temp folder and does not respect TMPDIR, so we need
@@ -192,8 +198,7 @@ function ensureArray(value) {
192
198
  function assertSingleElement(array) {
193
199
  if (array.length !== 1) throw new Error(`Expected array of length 1, got ${array.length}`);
194
200
  }
195
- //#endregion
196
- //#region src/utilities/paths.ts
201
+ // src/utilities/paths.ts
197
202
  /**
198
203
  * Import.meta.dirname for Node >= 20.19.0
199
204
  *
@@ -225,8 +230,7 @@ function getPackageBinPath(meta) {
225
230
  const dirname = getDirname(meta);
226
231
  return path.basename(dirname) === "dist" ? path.join(dirname) : path.join("dist");
227
232
  }
228
- //#endregion
229
- //#region src/aphex-swift/cli-bridge.ts
233
+ // src/aphex-swift/cli-bridge.ts
230
234
  const SHELL_SPECIAL_CHARS_REGEX = /[\s'"\\]/v;
231
235
  let interactiveProcess;
232
236
  let currentRequest;
@@ -478,8 +482,7 @@ function dateReviver$1(key, value) {
478
482
  ].includes(key)) return value.length > 0 ? new Date(value) : void 0;
479
483
  return value;
480
484
  }
481
- //#endregion
482
- //#region src/aphex-swift/identifiers.ts
485
+ // src/aphex-swift/identifiers.ts
483
486
  /**
484
487
  * Takes a mix of photos, albums, strings, all resolved to a single array of
485
488
  * PhotoInfo objects
@@ -508,8 +511,7 @@ async function resolvePhotoIdentifier(identifier) {
508
511
  if (aphexPhotoInfoResult.length > 1) throw new Error(`Multiple photo assets found for identifier "${identifier} — is it an album?"`);
509
512
  return photoInfo;
510
513
  }
511
- //#endregion
512
- //#region src/utilities/defaults.ts
514
+ // src/utilities/defaults.ts
513
515
  const mergeDefaultsInternal = createDefu((object, key, value) => {
514
516
  if (Array.isArray(object[key]) && Array.isArray(value)) {
515
517
  const merged = [.../* @__PURE__ */ new Set([...object[key], ...value])];
@@ -522,11 +524,9 @@ const mergeDefaultsInternal = createDefu((object, key, value) => {
522
524
  * Merge, treating arrays like sets
523
525
  */
524
526
  function mergeDefaults(options, defaults) {
525
- if (options === void 0) return defaults;
526
- return mergeDefaultsInternal(options, defaults);
527
+ return options === void 0 ? defaults : mergeDefaultsInternal(options, defaults);
527
528
  }
528
- //#endregion
529
- //#region src/utilities/image/mime.ts
529
+ // src/utilities/image/mime.ts
530
530
  mimes.arw = "image/arw";
531
531
  mimes.cr2 = "image/cr2";
532
532
  mimes.cr3 = "image/cr3";
@@ -576,8 +576,7 @@ function lookupImageMimeType(imagePath, validate = false) {
576
576
  if (shouldValidate && matchedMimeTypes === void 0) throw new Error(`Invalid image MIME type: ${mime} for ${imagePath}`);
577
577
  return matchedMimeTypes;
578
578
  }
579
- //#endregion
580
- //#region src/utilities/image/color.ts
579
+ // src/utilities/image/color.ts
581
580
  const SIPS_PROFILE_REGEX = /profile: (.+)/v;
582
581
  /**
583
582
  * Get the color profile of an image
@@ -696,8 +695,7 @@ async function normalizeColorProfile(imagePath, preserveColorProfiles = [
696
695
  await convertColorProfile(imagePath, defaultColorProfile);
697
696
  return "converted";
698
697
  }
699
- //#endregion
700
- //#region src/utilities/image/tags.ts
698
+ // src/utilities/image/tags.ts
701
699
  const VALID_LABELS = [
702
700
  "animation",
703
701
  "diagram",
@@ -812,14 +810,14 @@ function parseUserComment(userComment) {
812
810
  * Set the tags on an image
813
811
  */
814
812
  async function setTags(imagePath, imageTags) {
815
- const { aphexMetadata, creator, credit, description, label, preservedFileName } = imageTags;
813
+ const { aphexMetadata, creator = "", credit = "", description = "", label = "", preservedFileName = "" } = imageTags;
816
814
  const userComment = aphexMetadata ? JSON.stringify(aphexMetadata) : void 0;
817
815
  const tags = {
818
- ..."creator" in imageTags && { "XMP:Creator": creator ?? "" },
819
- ..."description" in imageTags && { "XMP:Description": description ?? "" },
820
- ..."credit" in imageTags && { "XMP:Credit": credit ?? "" },
821
- ..."label" in imageTags && { "XMP:Label": label ?? "" },
822
- ..."preservedFileName" in imageTags && { "XMP:PreservedFileName": preservedFileName ?? "" },
816
+ ..."creator" in imageTags && { "XMP:Creator": creator },
817
+ ..."description" in imageTags && { "XMP:Description": description },
818
+ ..."credit" in imageTags && { "XMP:Credit": credit },
819
+ ..."label" in imageTags && { "XMP:Label": label },
820
+ ..."preservedFileName" in imageTags && { "XMP:PreservedFileName": preservedFileName },
823
821
  ..."aphexMetadata" in imageTags && { "XMP:UserComment": userComment ?? "" }
824
822
  };
825
823
  await getExiftool().write(imagePath, tags, { writeArgs: ["-overwrite_original_in_place"] });
@@ -849,8 +847,7 @@ async function cloneTags(sourceImagePath, destinationImagePath, includeKeys, for
849
847
  if (Object.keys(tagsToAssign).length > 0) await setTags(destinationImagePath, tagsToAssign);
850
848
  return Object.keys(tagsToAssign);
851
849
  }
852
- //#endregion
853
- //#region src/utilities/image/image.ts
850
+ // src/utilities/image/image.ts
854
851
  /**
855
852
  * Get all available information about an image
856
853
  */
@@ -908,8 +905,7 @@ async function hasAlpha(imagePath) {
908
905
  throw new Error(`Error checking file: ${String(error)}`, { cause: error });
909
906
  }
910
907
  }
911
- //#endregion
912
- //#region src/pipeline/engines/applescript.ts
908
+ // src/pipeline/engines/applescript.ts
913
909
  const UUID_SUFFIX_PHOTO = "/L0/001";
914
910
  function escapeForAppleScript(text) {
915
911
  return text.replaceAll("\\", "\\\\").replaceAll("\"", "\\\"");
@@ -949,8 +945,7 @@ async function exportViaAppleScript(photoUuid, forceOriginal = false) {
949
945
  throw new Error(`Failed to export photo via AppleScript: ${errorMessage}`, { cause: error });
950
946
  }
951
947
  }
952
- //#endregion
953
- //#region src/pipeline/engines/applescript-gui.ts
948
+ // src/pipeline/engines/applescript-gui.ts
954
949
  /** Apple's defaults, but these are overridden by Aphex by default */
955
950
  const defaultExportViaAppleScriptGuiOptions = {
956
951
  colorProfile: "Most Compatible",
@@ -997,8 +992,7 @@ async function exportViaAppleScriptGui(uuid, options) {
997
992
  if (typeof results[0] !== "string") throw new TypeError(`Unexpected export results for album "${uuid}": ${JSON.stringify(results)}`);
998
993
  return results;
999
994
  }
1000
- //#endregion
1001
- //#region src/pipeline/engines/file-system.ts
995
+ // src/pipeline/engines/file-system.ts
1002
996
  /**
1003
997
  * Export a photo via direct file system copy of the original or edited file to
1004
998
  * a temporary directory Clean up and move the file as needed afterwards
@@ -1017,8 +1011,7 @@ async function exportViaFileSystem(photoUuid, forceOriginal = false) {
1017
1011
  await fse.copy(edited.filePath, destinationPath, { overwrite: true });
1018
1012
  return destinationPath;
1019
1013
  }
1020
- //#endregion
1021
- //#region src/pipeline/engines/swift-photokit.ts
1014
+ // src/pipeline/engines/swift-photokit.ts
1022
1015
  /**
1023
1016
  * Export a photo via aphex-swift command line tool using PhotoKit
1024
1017
  */
@@ -1027,8 +1020,7 @@ async function exportViaSwiftPhotoKit(photoUuid) {
1027
1020
  if (result === void 0) throw new Error(`Export via PhotoKit returned no files for photo "${photoUuid}"`);
1028
1021
  return result;
1029
1022
  }
1030
- //#endregion
1031
- //#region src/pipeline/image-export.ts
1023
+ // src/pipeline/image-export.ts
1032
1024
  const defaultExportApplePhotoOptions = {
1033
1025
  appleScriptGuiOptions: {
1034
1026
  colorProfile: "sRGB",
@@ -1167,8 +1159,7 @@ async function getEngineForPhoto(photoInfo, options) {
1167
1159
  * the album, deleting any images that are no longer in the album Optionally
1168
1160
  * audit the album for duplicate titles Does NOT further process the images
1169
1161
  */
1170
- //#endregion
1171
- //#region src/pipeline/image-metadata.ts
1162
+ // src/pipeline/image-metadata.ts
1172
1163
  const defaultManageMetadataOptions = {
1173
1164
  syncToEdited: true,
1174
1165
  syncToTarget: true,
@@ -1217,8 +1208,7 @@ async function manageMetadata(identifier, targetFilePath, options, exportOptions
1217
1208
  validationResult
1218
1209
  };
1219
1210
  }
1220
- //#endregion
1221
- //#region src/utilities/image/convert.ts
1211
+ // src/utilities/image/convert.ts
1222
1212
  /**
1223
1213
  * Optimize a PNG image
1224
1214
  */
@@ -1356,11 +1346,11 @@ async function convertToPng(sourceImagePath, destinationDirectory, force = false
1356
1346
  "--setProperty",
1357
1347
  "format",
1358
1348
  "png",
1359
- ...restoreColorProfile !== void 0 && restoreColorProfile !== "None" ? [
1349
+ ...restoreColorProfile === void 0 || restoreColorProfile === "None" ? [] : [
1360
1350
  "--setProperty",
1361
1351
  "profile",
1362
1352
  getPathToColorProfile(restoreColorProfile)
1363
- ] : [],
1353
+ ],
1364
1354
  sourceImagePath,
1365
1355
  "--out",
1366
1356
  destinationImagePath
@@ -1506,8 +1496,7 @@ async function compressImage(sourceImagePath, destinationDirectory, options) {
1506
1496
  path: destinationImagePath
1507
1497
  };
1508
1498
  }
1509
- //#endregion
1510
- //#region src/utilities/image/compare.ts
1499
+ // src/utilities/image/compare.ts
1511
1500
  const SSIM_REGEX = /All:\s*([\d.]+)/v;
1512
1501
  const PSNR_REGEX = /average:\s*([\d.]+)/v;
1513
1502
  /**
@@ -1620,8 +1609,7 @@ async function calculatePSNRInternal(image1, image2) {
1620
1609
  const psnrValue = PSNR_REGEX.exec(result.stderr)?.[1];
1621
1610
  return psnrValue === void 0 ? 0 : Number(psnrValue);
1622
1611
  }
1623
- //#endregion
1624
- //#region src/pipeline/image-process.ts
1612
+ // src/pipeline/image-process.ts
1625
1613
  const defaultProcessImageOptions = {
1626
1614
  defaultColorProfile: "sRGB IEC61966-2.1",
1627
1615
  forceCompression: false,
@@ -1759,8 +1747,7 @@ function isProcessImageResultReport(object) {
1759
1747
  if (object.similarity !== void 0) return typeof object.similarity.dssim === "number" && typeof object.similarity.psnr === "number" && typeof object.similarity.ssim === "number";
1760
1748
  return true;
1761
1749
  }
1762
- //#endregion
1763
- //#region src/pipeline/image-sync.ts
1750
+ // src/pipeline/image-sync.ts
1764
1751
  async function getDestinationFiles(destinationDirectory) {
1765
1752
  const files = (await fse.readdir(destinationDirectory, { withFileTypes: true })).filter((entry) => entry.isFile());
1766
1753
  return Promise.all(files.map(async (file) => {
@@ -1856,8 +1843,7 @@ async function isDifferent(diffStrategies, sourcePhotoInfo, sourcePhotoFileBaseN
1856
1843
  for (const diffStrategy of diffStrategies) if (await strategyFindsDifference(diffStrategy)) return diffStrategy;
1857
1844
  return false;
1858
1845
  }
1859
- //#endregion
1860
- //#region src/index.ts
1846
+ // src/index.ts
1861
1847
  /**
1862
1848
  * Helper for deep merging ExportOptions object against library defaults.
1863
1849
  * Exported for unplugin-aphex.
@@ -1993,5 +1979,4 @@ function cleanProcessResults(result) {
1993
1979
  output: strippedOutput
1994
1980
  };
1995
1981
  }
1996
- //#endregion
1997
1982
  export { IMAGE_MIME_TYPES, defaultExportOptions, defaultSyncOptions, endExiftool, exportPhoto, exportPhotos, aphexAlbumInfo as getAlbumInfo, aphexPhotoInfo as getPhotoInfo, interactiveSessionStart, interactiveSessionStop, mergeDefaultExportOptions, processImage, setLogger };
package/package.json CHANGED
@@ -1,13 +1,15 @@
1
1
  {
2
2
  "name": "@kitschpatrol/aphex",
3
- "version": "0.1.4",
3
+ "version": "0.1.6",
4
4
  "description": "Apple Photos Export. TypeScript library and CLI tool to export and process images and albums from your macOS Photos.app library.",
5
5
  "keywords": [
6
6
  "apple",
7
7
  "apple-photos",
8
8
  "photokit",
9
9
  "photos",
10
- "npm-package"
10
+ "npm-package",
11
+ "cli",
12
+ "homebrew-formula"
11
13
  ],
12
14
  "homepage": "https://github.com/kitschpatrol/aphex",
13
15
  "bugs": "https://github.com/kitschpatrol/aphex/issues",
@@ -36,19 +38,19 @@
36
38
  "aphex": "./dist/aphex-swift"
37
39
  },
38
40
  "files": [
39
- "dist/*"
41
+ "dist"
40
42
  ],
41
43
  "dependencies": {
42
44
  "@sindresorhus/is": "^8.1.0",
43
45
  "defu": "^6.1.7",
44
- "execa": "^10.0.1",
45
- "exiftool-vendored": "^38.1.0",
46
- "fast-equals": "^6.0.4",
47
- "fs-extra": "^11.4.0",
46
+ "execa": "^10.2.1",
47
+ "exiftool-vendored": "^39.1.0",
48
+ "fast-equals": "^6.2.1",
49
+ "fs-extra": "^11.4.1",
48
50
  "github-slugger": "^2.0.0",
49
51
  "image-size": "^2.0.4",
50
52
  "importx": "^0.5.2",
51
- "lognow": "^0.8.4",
53
+ "lognow": "^0.8.7",
52
54
  "mrmime": "^2.0.1",
53
55
  "piscina": "^5.3.2",
54
56
  "type-fest": "^5.10.0"
@@ -56,26 +58,27 @@
56
58
  "devDependencies": {
57
59
  "@arethetypeswrong/core": "^0.18.5",
58
60
  "@clack/prompts": "^1.8.1",
59
- "@kitschpatrol/shared-config": "^8.10.0",
61
+ "@kitschpatrol/shared-config": "^8.14.0",
60
62
  "@types/fs-extra": "^11.0.4",
61
- "@types/node": "~24.13.4",
62
- "@vitest/coverage-v8": "^5.0.1",
63
- "brewpub": "^0.3.0",
63
+ "@types/node": "~24.13.6",
64
+ "@vitest/coverage-v8": "^5.0.5",
65
+ "brewpub": "^0.5.0",
64
66
  "bumpp": "^12.3.0",
65
67
  "globby": "^16.2.4",
66
68
  "markdown-table": "^3.0.4",
67
- "mdat-plugin-cli-help": "^3.2.0",
69
+ "mdat-plugin-cli-help": "^3.4.1",
68
70
  "open": "^11.0.4",
69
- "pretty-bytes": "^7.1.3",
70
- "pretty-ms": "^9.3.1",
71
- "publint": "^0.3.24",
72
- "tsdown": "^0.23.0",
71
+ "pretty-bytes": "^7.2.0",
72
+ "pretty-ms": "^10.0.0",
73
+ "publint": "^0.3.25",
74
+ "shx": "^0.4.0",
75
+ "tsdown": "^0.23.4",
73
76
  "tsx": "^4.23.15",
74
77
  "typescript": "~6.0.3",
75
- "vitest": "^5.0.1"
78
+ "vitest": "^5.0.5"
76
79
  },
77
80
  "engines": {
78
- "node": ">=24.16.0"
81
+ "node": "^24.16.0 || >=26.3.0"
79
82
  },
80
83
  "os": [
81
84
  "darwin"
@@ -91,9 +94,9 @@
91
94
  "build:1-lib": "tsdown",
92
95
  "build:2-native": "cd native/aphex-swift && ./build.sh",
93
96
  "build:3-publint": "publint",
94
- "clean-deep": "git rm -f pnpm-lock.yaml && git clean -fdX -e !.claude/",
95
- "fix": "ksc fix && mdat ./native/aphex-swift/readme.md",
96
- "lint": "ksc lint",
97
+ "clean-deep": "shx rm -f pnpm-lock.yaml && git clean -fdX",
98
+ "fix": "pnpm build && ksc fix && mdat ./native/aphex-swift/readme.md",
99
+ "lint": "pnpm build && ksc lint && mdat check ./native/aphex-swift/readme.md",
97
100
  "release": "bumpp --commit 'Release: %s' && pnpm build && pnpm publish --otp $(op item get npm --otp) && brewpub --tap kitschpatrol/tap",
98
101
  "test": "vitest run",
99
102
  "test:coverage": "vitest run --coverage"
package/readme.md CHANGED
@@ -10,6 +10,7 @@
10
10
 
11
11
  [![NPM Package @kitschpatrol/aphex](https://img.shields.io/npm/v/@kitschpatrol/aphex.svg)](https://www.npmjs.com/package/@kitschpatrol/aphex)
12
12
  [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/license/mit)
13
+ [![Homebrew](https://img.shields.io/badge/Homebrew-kitschpatrol%2Ftap%2Faphex-FBB040?logo=homebrew&logoColor=white)](https://github.com/kitschpatrol/homebrew-tap/blob/HEAD/Formula/aphex.rb)
13
14
 
14
15
  <!-- /badges -->
15
16
 
@@ -47,12 +48,35 @@ The name "Aphex" is a concatenation of **A**pple **PH**otos **EX**port.
47
48
 
48
49
  ## Getting started
49
50
 
51
+ <!-- dependencies -->
52
+
50
53
  ### Dependencies
51
54
 
52
- Requires an Apple Silicon (`arm64`) Mac with Photos.app installed and [Node 22.18.0](https://nodejs.org/en/download/) or newer. No Intel (`x86_64`) build of the bundled native binary is provided.
55
+ - [Node.js](https://nodejs.org/) 24.16.0 or newer (specifically `^24.16.0 || >=26.3.0`)
56
+ - Supported operating systems: macOS
57
+
58
+ <!-- /dependencies -->
59
+
60
+ Requires an Apple Silicon (`arm64`) Mac with Photos.app installed. No Intel (`x86_64`) build of the bundled native binary is provided.
61
+
62
+ ### Installation
63
+
64
+ Pick the option that matches how you plan to use it.
65
+
66
+ #### Library installation
67
+
68
+ Add it to your project to import the TypeScript API. This also puts the `aphex` CLI on your project's path:
69
+
70
+ ```sh
71
+ npm install @kitschpatrol/aphex
72
+ ```
53
73
 
54
74
  Full image processing functionality also requires a number of command-line tools available via [Homebrew](https://brew.sh):
55
75
 
76
+ ```sh
77
+ brew install libavif mozjpeg imagemagick webp dssim ffmpeg guetzli oxipng
78
+ ```
79
+
56
80
  | Tool | Used for |
57
81
  | ------------- | ------------------------------------------------------------------------- |
58
82
  | `libavif` | AVIF encoding |
@@ -64,28 +88,28 @@ Full image processing functionality also requires a number of command-line tools
64
88
  | `ffmpeg` | Media probing used by some conversion paths |
65
89
  | `dssim` | Perceptual similarity metrics (only needed if `logSimilarity` is enabled) |
66
90
 
67
- If you skip image processing (`processOptions: 'disabled'`) you can omit the Homebrew dependencies.
91
+ If you skip image processing (`processOptions: 'disabled'`) you can omit these.
68
92
 
69
- ### Installation
93
+ #### CLI installation
94
+
95
+ Note that the Aphex CLI does _not_ expose all the functionality from the TypeScript library. It's a native bridge focused on querying your library for images and metadata, and also certain fast-path export strategies.
70
96
 
71
- The easiest way to install the CLI tool is via Homebrew:
97
+ Run it once without installing:
72
98
 
73
99
  ```sh
74
- brew install kitschpatrol/tap/aphex
100
+ npx @kitschpatrol/aphex
75
101
  ```
76
102
 
77
- If you're working in a Node project or prefer to install through npm, you will need some additional dependencies for the image processing functionality exposed through the library API.
78
-
79
- These are easiest to install via Homebrew:
103
+ Or install it globally with Homebrew:
80
104
 
81
105
  ```sh
82
- brew install libavif mozjpeg imagemagick webp dssim ffmpeg guetzli oxipng
106
+ brew install kitschpatrol/tap/aphex
83
107
  ```
84
108
 
85
- Then, in your node project:
109
+ Or install it globally with npm:
86
110
 
87
111
  ```sh
88
- npm install @kitschpatrol/aphex
112
+ npm install --global @kitschpatrol/aphex
89
113
  ```
90
114
 
91
115
  ### Permissions
@@ -207,7 +231,7 @@ setLogger(console)
207
231
 
208
232
  ##### Exporting a photo by filename
209
233
 
210
- Let's assume you have an album named "Trip" in your Photos.app library containing a photo with the filename "IMG\_1922.jpeg":
234
+ Let's assume you have an album named "Trip" in your Photos.app library containing a photo with the filename "IMG_1922.jpeg":
211
235
 
212
236
  ```ts
213
237
  const result = await exportPhoto('Trip/IMG_1922.jpeg', '~/Desktop')