@photostructure/fs-metadata 0.1.3 → 0.1.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (225) hide show
  1. package/dist/cjs/{async.js → async.cjs} +2 -2
  2. package/dist/cjs/{debuglog.js → debuglog.cjs} +1 -1
  3. package/dist/cjs/{error.js → error.cjs} +3 -3
  4. package/dist/cjs/{exports.js → exports.cjs} +2 -2
  5. package/dist/cjs/{fs.js → fs.cjs} +1 -1
  6. package/dist/cjs/{glob.js → glob.cjs} +2 -2
  7. package/dist/cjs/{hidden.js → hidden.cjs} +4 -4
  8. package/dist/cjs/index.cjs +2 -2
  9. package/dist/cjs/linux/{dev_disk.js → dev_disk.cjs} +2 -2
  10. package/dist/cjs/linux/{mount_points.js → mount_points.cjs} +7 -7
  11. package/dist/cjs/linux/{mtab.js → mtab.cjs} +5 -5
  12. package/dist/cjs/{mount_point.js → mount_point.cjs} +9 -9
  13. package/dist/cjs/{object.js → object.cjs} +1 -1
  14. package/dist/cjs/{options.js → options.cjs} +2 -2
  15. package/dist/cjs/{path.js → path.cjs} +2 -2
  16. package/dist/cjs/{remote_info.js → remote_info.cjs} +4 -4
  17. package/dist/cjs/{setup.js → setup.cjs} +7 -7
  18. package/dist/cjs/{system_volume.js → system_volume.cjs} +6 -6
  19. package/dist/cjs/{unc.js → unc.cjs} +1 -1
  20. package/dist/cjs/{uuid.js → uuid.cjs} +1 -1
  21. package/dist/cjs/{volume_health_status.js → volume_health_status.cjs} +6 -6
  22. package/dist/cjs/{volume_metadata.js → volume_metadata.cjs} +17 -17
  23. package/dist/{esm/array.d.ts → types/array.js} +25 -6
  24. package/dist/types/array.js.map +1 -0
  25. package/dist/types/async.js +109 -0
  26. package/dist/types/async.js.map +1 -0
  27. package/dist/types/cache.js +25 -0
  28. package/dist/types/cache.js.map +1 -0
  29. package/dist/types/debuglog.js +30 -0
  30. package/dist/types/debuglog.js.map +1 -0
  31. package/dist/types/defer.js +23 -0
  32. package/dist/types/defer.js.map +1 -0
  33. package/dist/types/error.js +58 -0
  34. package/dist/types/error.js.map +1 -0
  35. package/dist/types/exports.js +4 -0
  36. package/dist/types/exports.js.map +1 -0
  37. package/dist/types/fs.js +73 -0
  38. package/dist/types/fs.js.map +1 -0
  39. package/dist/types/glob.js +113 -0
  40. package/dist/types/glob.js.map +1 -0
  41. package/dist/types/hidden.js +155 -0
  42. package/dist/types/hidden.js.map +1 -0
  43. package/dist/types/index.js +7 -0
  44. package/dist/types/index.js.map +1 -0
  45. package/dist/types/linux/dev_disk.js +61 -0
  46. package/dist/types/linux/dev_disk.js.map +1 -0
  47. package/dist/types/linux/mount_points.js +77 -0
  48. package/dist/types/linux/mount_points.js.map +1 -0
  49. package/dist/types/linux/mtab.js +82 -0
  50. package/dist/types/linux/mtab.js.map +1 -0
  51. package/dist/types/mount_point.js +63 -0
  52. package/dist/types/mount_point.js.map +1 -0
  53. package/dist/types/number.js +32 -0
  54. package/dist/types/number.js.map +1 -0
  55. package/dist/types/object.js +52 -0
  56. package/dist/types/object.js.map +1 -0
  57. package/dist/types/options.js +111 -0
  58. package/dist/types/options.js.map +1 -0
  59. package/dist/types/path.js +44 -0
  60. package/dist/types/path.js.map +1 -0
  61. package/dist/types/platform.js +7 -0
  62. package/dist/types/platform.js.map +1 -0
  63. package/dist/types/random.js +37 -0
  64. package/dist/types/random.js.map +1 -0
  65. package/dist/types/remote_info.js +116 -0
  66. package/dist/types/remote_info.js.map +1 -0
  67. package/dist/types/setup.js +41 -0
  68. package/dist/types/setup.js.map +1 -0
  69. package/dist/types/string.js +78 -0
  70. package/dist/types/string.js.map +1 -0
  71. package/dist/types/string_enum.js +24 -0
  72. package/dist/types/string_enum.js.map +1 -0
  73. package/dist/types/system_volume.js +40 -0
  74. package/dist/types/system_volume.js.map +1 -0
  75. package/dist/types/types/native_bindings.js +3 -0
  76. package/dist/types/types/native_bindings.js.map +1 -0
  77. package/dist/types/unc.js +49 -0
  78. package/dist/types/unc.js.map +1 -0
  79. package/dist/types/units.js +31 -0
  80. package/dist/types/units.js.map +1 -0
  81. package/dist/{esm/uuid.d.ts → types/uuid.js} +7 -2
  82. package/dist/types/uuid.js.map +1 -0
  83. package/dist/types/volume_health_status.js +46 -0
  84. package/dist/types/volume_health_status.js.map +1 -0
  85. package/dist/types/volume_metadata.js +164 -0
  86. package/dist/types/volume_metadata.js.map +1 -0
  87. package/package.json +10 -10
  88. package/prebuilds/darwin-arm64/@photostructure+fs-metadata.glibc.node +0 -0
  89. package/prebuilds/win32-x64/@photostructure+fs-metadata.glibc.node +0 -0
  90. package/scripts/fix-cjs.mjs +35 -0
  91. package/dist/cjs/index.d.cts.map +0 -1
  92. package/dist/esm/array.d.ts.map +0 -1
  93. package/dist/esm/async.d.ts +0 -43
  94. package/dist/esm/async.d.ts.map +0 -1
  95. package/dist/esm/cache.d.ts +0 -5
  96. package/dist/esm/cache.d.ts.map +0 -1
  97. package/dist/esm/debuglog.d.ts +0 -9
  98. package/dist/esm/debuglog.d.ts.map +0 -1
  99. package/dist/esm/defer.d.ts +0 -12
  100. package/dist/esm/defer.d.ts.map +0 -1
  101. package/dist/esm/error.d.ts +0 -18
  102. package/dist/esm/error.d.ts.map +0 -1
  103. package/dist/esm/exports.d.ts +0 -99
  104. package/dist/esm/exports.d.ts.map +0 -1
  105. package/dist/esm/fs.d.ts +0 -23
  106. package/dist/esm/fs.d.ts.map +0 -1
  107. package/dist/esm/glob.d.ts +0 -18
  108. package/dist/esm/glob.d.ts.map +0 -1
  109. package/dist/esm/hidden.d.ts +0 -67
  110. package/dist/esm/hidden.d.ts.map +0 -1
  111. package/dist/esm/linux/dev_disk.d.ts +0 -14
  112. package/dist/esm/linux/dev_disk.d.ts.map +0 -1
  113. package/dist/esm/linux/mount_points.d.ts +0 -7
  114. package/dist/esm/linux/mount_points.d.ts.map +0 -1
  115. package/dist/esm/linux/mtab.d.ts +0 -48
  116. package/dist/esm/linux/mtab.d.ts.map +0 -1
  117. package/dist/esm/mount_point.d.ts +0 -56
  118. package/dist/esm/mount_point.d.ts.map +0 -1
  119. package/dist/esm/number.d.ts +0 -8
  120. package/dist/esm/number.d.ts.map +0 -1
  121. package/dist/esm/object.d.ts +0 -18
  122. package/dist/esm/object.d.ts.map +0 -1
  123. package/dist/esm/options.d.ts +0 -80
  124. package/dist/esm/options.d.ts.map +0 -1
  125. package/dist/esm/path.d.ts +0 -18
  126. package/dist/esm/path.d.ts.map +0 -1
  127. package/dist/esm/platform.d.ts +0 -4
  128. package/dist/esm/platform.d.ts.map +0 -1
  129. package/dist/esm/random.d.ts +0 -13
  130. package/dist/esm/random.d.ts.map +0 -1
  131. package/dist/esm/remote_info.d.ts +0 -39
  132. package/dist/esm/remote_info.d.ts.map +0 -1
  133. package/dist/esm/setup.d.ts +0 -3
  134. package/dist/esm/setup.d.ts.map +0 -1
  135. package/dist/esm/string.d.ts +0 -38
  136. package/dist/esm/string.d.ts.map +0 -1
  137. package/dist/esm/string_enum.d.ts +0 -20
  138. package/dist/esm/string_enum.d.ts.map +0 -1
  139. package/dist/esm/system_volume.d.ts +0 -15
  140. package/dist/esm/system_volume.d.ts.map +0 -1
  141. package/dist/esm/types/native_bindings.d.ts +0 -52
  142. package/dist/esm/types/native_bindings.d.ts.map +0 -1
  143. package/dist/esm/unc.d.ts +0 -12
  144. package/dist/esm/unc.d.ts.map +0 -1
  145. package/dist/esm/units.d.ts +0 -17
  146. package/dist/esm/units.d.ts.map +0 -1
  147. package/dist/esm/uuid.d.ts.map +0 -1
  148. package/dist/esm/volume_health_status.d.ts +0 -25
  149. package/dist/esm/volume_health_status.d.ts.map +0 -1
  150. package/dist/esm/volume_metadata.d.ts +0 -55
  151. package/dist/esm/volume_metadata.d.ts.map +0 -1
  152. /package/dist/cjs/{array.js → array.cjs} +0 -0
  153. /package/dist/cjs/{cache.js → cache.cjs} +0 -0
  154. /package/dist/cjs/{defer.js → defer.cjs} +0 -0
  155. /package/dist/cjs/{number.js → number.cjs} +0 -0
  156. /package/dist/cjs/{platform.js → platform.cjs} +0 -0
  157. /package/dist/cjs/{random.js → random.cjs} +0 -0
  158. /package/dist/cjs/{string.js → string.cjs} +0 -0
  159. /package/dist/cjs/{string_enum.js → string_enum.cjs} +0 -0
  160. /package/dist/cjs/types/{native_bindings.js → native_bindings.cjs} +0 -0
  161. /package/dist/cjs/{units.js → units.cjs} +0 -0
  162. /package/dist/{cjs → types}/array.d.ts +0 -0
  163. /package/dist/{cjs → types}/array.d.ts.map +0 -0
  164. /package/dist/{cjs → types}/async.d.ts +0 -0
  165. /package/dist/{cjs → types}/async.d.ts.map +0 -0
  166. /package/dist/{cjs → types}/cache.d.ts +0 -0
  167. /package/dist/{cjs → types}/cache.d.ts.map +0 -0
  168. /package/dist/{cjs → types}/debuglog.d.ts +0 -0
  169. /package/dist/{cjs → types}/debuglog.d.ts.map +0 -0
  170. /package/dist/{cjs → types}/defer.d.ts +0 -0
  171. /package/dist/{cjs → types}/defer.d.ts.map +0 -0
  172. /package/dist/{cjs → types}/error.d.ts +0 -0
  173. /package/dist/{cjs → types}/error.d.ts.map +0 -0
  174. /package/dist/{cjs → types}/exports.d.ts +0 -0
  175. /package/dist/{cjs → types}/exports.d.ts.map +0 -0
  176. /package/dist/{cjs → types}/fs.d.ts +0 -0
  177. /package/dist/{cjs → types}/fs.d.ts.map +0 -0
  178. /package/dist/{cjs → types}/glob.d.ts +0 -0
  179. /package/dist/{cjs → types}/glob.d.ts.map +0 -0
  180. /package/dist/{cjs → types}/hidden.d.ts +0 -0
  181. /package/dist/{cjs → types}/hidden.d.ts.map +0 -0
  182. /package/dist/{esm → types}/index.d.ts +0 -0
  183. /package/dist/{esm → types}/index.d.ts.map +0 -0
  184. /package/dist/{cjs → types}/linux/dev_disk.d.ts +0 -0
  185. /package/dist/{cjs → types}/linux/dev_disk.d.ts.map +0 -0
  186. /package/dist/{cjs → types}/linux/mount_points.d.ts +0 -0
  187. /package/dist/{cjs → types}/linux/mount_points.d.ts.map +0 -0
  188. /package/dist/{cjs → types}/linux/mtab.d.ts +0 -0
  189. /package/dist/{cjs → types}/linux/mtab.d.ts.map +0 -0
  190. /package/dist/{cjs → types}/mount_point.d.ts +0 -0
  191. /package/dist/{cjs → types}/mount_point.d.ts.map +0 -0
  192. /package/dist/{cjs → types}/number.d.ts +0 -0
  193. /package/dist/{cjs → types}/number.d.ts.map +0 -0
  194. /package/dist/{cjs → types}/object.d.ts +0 -0
  195. /package/dist/{cjs → types}/object.d.ts.map +0 -0
  196. /package/dist/{cjs → types}/options.d.ts +0 -0
  197. /package/dist/{cjs → types}/options.d.ts.map +0 -0
  198. /package/dist/{cjs → types}/path.d.ts +0 -0
  199. /package/dist/{cjs → types}/path.d.ts.map +0 -0
  200. /package/dist/{cjs → types}/platform.d.ts +0 -0
  201. /package/dist/{cjs → types}/platform.d.ts.map +0 -0
  202. /package/dist/{cjs → types}/random.d.ts +0 -0
  203. /package/dist/{cjs → types}/random.d.ts.map +0 -0
  204. /package/dist/{cjs → types}/remote_info.d.ts +0 -0
  205. /package/dist/{cjs → types}/remote_info.d.ts.map +0 -0
  206. /package/dist/{cjs → types}/setup.d.ts +0 -0
  207. /package/dist/{cjs → types}/setup.d.ts.map +0 -0
  208. /package/dist/{cjs → types}/string.d.ts +0 -0
  209. /package/dist/{cjs → types}/string.d.ts.map +0 -0
  210. /package/dist/{cjs → types}/string_enum.d.ts +0 -0
  211. /package/dist/{cjs → types}/string_enum.d.ts.map +0 -0
  212. /package/dist/{cjs → types}/system_volume.d.ts +0 -0
  213. /package/dist/{cjs → types}/system_volume.d.ts.map +0 -0
  214. /package/dist/{cjs → types}/types/native_bindings.d.ts +0 -0
  215. /package/dist/{cjs → types}/types/native_bindings.d.ts.map +0 -0
  216. /package/dist/{cjs → types}/unc.d.ts +0 -0
  217. /package/dist/{cjs → types}/unc.d.ts.map +0 -0
  218. /package/dist/{cjs → types}/units.d.ts +0 -0
  219. /package/dist/{cjs → types}/units.d.ts.map +0 -0
  220. /package/dist/{cjs → types}/uuid.d.ts +0 -0
  221. /package/dist/{cjs → types}/uuid.d.ts.map +0 -0
  222. /package/dist/{cjs → types}/volume_health_status.d.ts +0 -0
  223. /package/dist/{cjs → types}/volume_health_status.d.ts.map +0 -0
  224. /package/dist/{cjs → types}/volume_metadata.d.ts +0 -0
  225. /package/dist/{cjs → types}/volume_metadata.d.ts.map +0 -0
@@ -6,8 +6,8 @@ exports.delay = delay;
6
6
  exports.mapConcurrent = mapConcurrent;
7
7
  const node_os_1 = require("node:os");
8
8
  const node_process_1 = require("node:process");
9
- const number_js_1 = require("./number.js");
10
- const string_js_1 = require("./string.js");
9
+ const number_js_1 = require("./number.cjs");
10
+ const string_js_1 = require("./string.cjs");
11
11
  /**
12
12
  * An error that is thrown when a promise does not resolve within the specified
13
13
  * time.
@@ -4,7 +4,7 @@ exports.isDebugEnabled = exports.debugLogContext = void 0;
4
4
  exports.debug = debug;
5
5
  exports.resetDebugLog = resetDebugLog;
6
6
  const node_util_1 = require("node:util");
7
- const defer_js_1 = require("./defer.js");
7
+ const defer_js_1 = require("./defer.cjs");
8
8
  // allow tests to reset the debug log context
9
9
  exports.debugLogContext = (0, defer_js_1.defer)(() => {
10
10
  for (const ea of ["fs-metadata", "fs-meta"]) {
@@ -3,9 +3,9 @@
3
3
  Object.defineProperty(exports, "__esModule", { value: true });
4
4
  exports.WrappedError = void 0;
5
5
  exports.toError = toError;
6
- const number_js_1 = require("./number.js");
7
- const object_js_1 = require("./object.js");
8
- const string_js_1 = require("./string.js");
6
+ const number_js_1 = require("./number.cjs");
7
+ const object_js_1 = require("./object.cjs");
8
+ const string_js_1 = require("./string.cjs");
9
9
  function toMessage(context, cause) {
10
10
  const causeStr = cause instanceof Error
11
11
  ? cause.message
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.VolumeHealthStatuses = exports.TimeoutMsDefault = exports.SystemPathPatternsDefault = exports.SystemFsTypesDefault = exports.optionsWithDefaults = exports.OptionsDefault = exports.LinuxMountTablePathsDefault = exports.IncludeSystemVolumesDefault = void 0;
4
- const options_js_1 = require("./options.js");
4
+ const options_js_1 = require("./options.cjs");
5
5
  Object.defineProperty(exports, "IncludeSystemVolumesDefault", { enumerable: true, get: function () { return options_js_1.IncludeSystemVolumesDefault; } });
6
6
  Object.defineProperty(exports, "LinuxMountTablePathsDefault", { enumerable: true, get: function () { return options_js_1.LinuxMountTablePathsDefault; } });
7
7
  Object.defineProperty(exports, "OptionsDefault", { enumerable: true, get: function () { return options_js_1.OptionsDefault; } });
@@ -9,6 +9,6 @@ Object.defineProperty(exports, "optionsWithDefaults", { enumerable: true, get: f
9
9
  Object.defineProperty(exports, "SystemFsTypesDefault", { enumerable: true, get: function () { return options_js_1.SystemFsTypesDefault; } });
10
10
  Object.defineProperty(exports, "SystemPathPatternsDefault", { enumerable: true, get: function () { return options_js_1.SystemPathPatternsDefault; } });
11
11
  Object.defineProperty(exports, "TimeoutMsDefault", { enumerable: true, get: function () { return options_js_1.TimeoutMsDefault; } });
12
- const volume_health_status_js_1 = require("./volume_health_status.js");
12
+ const volume_health_status_js_1 = require("./volume_health_status.cjs");
13
13
  Object.defineProperty(exports, "VolumeHealthStatuses", { enumerable: true, get: function () { return volume_health_status_js_1.VolumeHealthStatuses; } });
14
14
  //# sourceMappingURL=exports.js.map
@@ -10,7 +10,7 @@ exports.canReaddir = canReaddir;
10
10
  const node_fs_1 = require("node:fs");
11
11
  const promises_1 = require("node:fs/promises");
12
12
  const node_path_1 = require("node:path");
13
- const async_js_1 = require("./async.js");
13
+ const async_js_1 = require("./async.cjs");
14
14
  /**
15
15
  * Wrapping node:fs/promises.stat() so we can mock it in tests.
16
16
  */
@@ -3,8 +3,8 @@
3
3
  Object.defineProperty(exports, "__esModule", { value: true });
4
4
  exports.NeverMatchRE = exports.AlwaysMatchRE = void 0;
5
5
  exports.compileGlob = compileGlob;
6
- const platform_js_1 = require("./platform.js");
7
- const string_js_1 = require("./string.js");
6
+ const platform_js_1 = require("./platform.cjs");
7
+ const string_js_1 = require("./string.cjs");
8
8
  const cache = new Map();
9
9
  /**
10
10
  * Compiles an array of glob patterns into a single regular expression.
@@ -9,10 +9,10 @@ exports.getHiddenMetadata = getHiddenMetadata;
9
9
  exports.setHidden = setHidden;
10
10
  const promises_1 = require("node:fs/promises");
11
11
  const node_path_1 = require("node:path");
12
- const error_js_1 = require("./error.js");
13
- const fs_js_1 = require("./fs.js");
14
- const path_js_1 = require("./path.js");
15
- const platform_js_1 = require("./platform.js");
12
+ const error_js_1 = require("./error.cjs");
13
+ const fs_js_1 = require("./fs.cjs");
14
+ const path_js_1 = require("./path.cjs");
15
+ const platform_js_1 = require("./platform.cjs");
16
16
  const HiddenSupportByPlatform = {
17
17
  win32: {
18
18
  supported: {
@@ -17,7 +17,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
17
17
  var _a;
18
18
  Object.defineProperty(exports, "__esModule", { value: true });
19
19
  exports.setHidden = exports.getHiddenMetadata = exports.isHiddenRecursive = exports.isHidden = exports.getAllVolumeMetadata = exports.getVolumeMetadata = exports.getVolumeMountPoints = void 0;
20
- const setup_js_1 = require("./setup.js");
21
- __exportStar(require("./exports.js"), exports);
20
+ const setup_js_1 = require("./setup.cjs");
21
+ __exportStar(require("./exports.cjs"), exports);
22
22
  _a = (0, setup_js_1.setup)(__dirname), exports.getVolumeMountPoints = _a.getVolumeMountPoints, exports.getVolumeMetadata = _a.getVolumeMetadata, exports.getAllVolumeMetadata = _a.getAllVolumeMetadata, exports.isHidden = _a.isHidden, exports.isHiddenRecursive = _a.isHiddenRecursive, exports.getHiddenMetadata = _a.getHiddenMetadata, exports.setHidden = _a.setHidden;
23
23
  //# sourceMappingURL=index.cjs.map
@@ -6,8 +6,8 @@ exports.getLabelFromDevDisk = getLabelFromDevDisk;
6
6
  exports.getBasenameLinkedTo = getBasenameLinkedTo;
7
7
  const promises_1 = require("node:fs/promises");
8
8
  const node_path_1 = require("node:path");
9
- const debuglog_js_1 = require("../debuglog.js");
10
- const string_js_1 = require("../string.js");
9
+ const debuglog_js_1 = require("../debuglog.cjs");
10
+ const string_js_1 = require("../string.cjs");
11
11
  /**
12
12
  * Gets the UUID from symlinks for a given device path asynchronously
13
13
  * @param devicePath The device path to look up
@@ -4,13 +4,13 @@ exports.getLinuxMountPoints = getLinuxMountPoints;
4
4
  exports.getLinuxMtabMetadata = getLinuxMtabMetadata;
5
5
  // src/linux/mount_points.ts
6
6
  const promises_1 = require("node:fs/promises");
7
- const debuglog_js_1 = require("../debuglog.js");
8
- const error_js_1 = require("../error.js");
9
- const mount_point_js_1 = require("../mount_point.js");
10
- const object_js_1 = require("../object.js");
11
- const options_js_1 = require("../options.js");
12
- const system_volume_js_1 = require("../system_volume.js");
13
- const mtab_js_1 = require("./mtab.js");
7
+ const debuglog_js_1 = require("../debuglog.cjs");
8
+ const error_js_1 = require("../error.cjs");
9
+ const mount_point_js_1 = require("../mount_point.cjs");
10
+ const object_js_1 = require("../object.cjs");
11
+ const options_js_1 = require("../options.cjs");
12
+ const system_volume_js_1 = require("../system_volume.cjs");
13
+ const mtab_js_1 = require("./mtab.cjs");
14
14
  async function getLinuxMountPoints(native, opts) {
15
15
  const o = (0, options_js_1.optionsWithDefaults)(opts);
16
16
  const raw = [];
@@ -5,11 +5,11 @@ exports.mountEntryToMountPoint = mountEntryToMountPoint;
5
5
  exports.mountEntryToPartialVolumeMetadata = mountEntryToPartialVolumeMetadata;
6
6
  exports.parseMtab = parseMtab;
7
7
  exports.formatMtab = formatMtab;
8
- const number_js_1 = require("../number.js");
9
- const path_js_1 = require("../path.js");
10
- const remote_info_js_1 = require("../remote_info.js");
11
- const string_js_1 = require("../string.js");
12
- const system_volume_js_1 = require("../system_volume.js");
8
+ const number_js_1 = require("../number.cjs");
9
+ const path_js_1 = require("../path.cjs");
10
+ const remote_info_js_1 = require("../remote_info.cjs");
11
+ const string_js_1 = require("../string.cjs");
12
+ const system_volume_js_1 = require("../system_volume.cjs");
13
13
  function mountEntryToMountPoint(entry) {
14
14
  const mountPoint = (0, path_js_1.normalizePosixPath)(entry.fs_file);
15
15
  const fstype = (0, string_js_1.toNotBlank)(entry.fs_vfstype) ?? (0, string_js_1.toNotBlank)(entry.fs_spec);
@@ -3,15 +3,15 @@
3
3
  Object.defineProperty(exports, "__esModule", { value: true });
4
4
  exports.isMountPoint = isMountPoint;
5
5
  exports.getVolumeMountPoints = getVolumeMountPoints;
6
- const array_js_1 = require("./array.js");
7
- const async_js_1 = require("./async.js");
8
- const debuglog_js_1 = require("./debuglog.js");
9
- const mount_points_js_1 = require("./linux/mount_points.js");
10
- const object_js_1 = require("./object.js");
11
- const platform_js_1 = require("./platform.js");
12
- const string_js_1 = require("./string.js");
13
- const system_volume_js_1 = require("./system_volume.js");
14
- const volume_health_status_js_1 = require("./volume_health_status.js");
6
+ const array_js_1 = require("./array.cjs");
7
+ const async_js_1 = require("./async.cjs");
8
+ const debuglog_js_1 = require("./debuglog.cjs");
9
+ const mount_points_js_1 = require("./linux/mount_points.cjs");
10
+ const object_js_1 = require("./object.cjs");
11
+ const platform_js_1 = require("./platform.cjs");
12
+ const string_js_1 = require("./string.cjs");
13
+ const system_volume_js_1 = require("./system_volume.cjs");
14
+ const volume_health_status_js_1 = require("./volume_health_status.cjs");
15
15
  function isMountPoint(obj) {
16
16
  if (!(0, object_js_1.isObject)(obj))
17
17
  return false;
@@ -6,7 +6,7 @@ exports.map = map;
6
6
  exports.omit = omit;
7
7
  exports.pick = pick;
8
8
  exports.compactValues = compactValues;
9
- const string_js_1 = require("./string.js");
9
+ const string_js_1 = require("./string.cjs");
10
10
  /**
11
11
  * Check if a value is an object
12
12
  */
@@ -4,8 +4,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
4
4
  exports.OptionsDefault = exports.IncludeSystemVolumesDefault = exports.LinuxMountTablePathsDefault = exports.SystemFsTypesDefault = exports.SystemPathPatternsDefault = exports.TimeoutMsDefault = void 0;
5
5
  exports.optionsWithDefaults = optionsWithDefaults;
6
6
  const node_os_1 = require("node:os");
7
- const object_js_1 = require("./object.js");
8
- const platform_js_1 = require("./platform.js");
7
+ const object_js_1 = require("./object.cjs");
8
+ const platform_js_1 = require("./platform.cjs");
9
9
  /**
10
10
  * Default timeout in milliseconds for {@link Options.timeoutMs}.
11
11
  *
@@ -6,8 +6,8 @@ exports.normalizePosixPath = normalizePosixPath;
6
6
  exports.normalizeWindowsPath = normalizeWindowsPath;
7
7
  exports.isRootDirectory = isRootDirectory;
8
8
  const node_path_1 = require("node:path");
9
- const platform_js_1 = require("./platform.js");
10
- const string_js_1 = require("./string.js");
9
+ const platform_js_1 = require("./platform.cjs");
10
+ const string_js_1 = require("./string.cjs");
11
11
  function normalizePath(mountPoint) {
12
12
  if ((0, string_js_1.isBlank)(mountPoint))
13
13
  return undefined;
@@ -6,10 +6,10 @@ exports.normalizeProtocol = normalizeProtocol;
6
6
  exports.isRemoteFsType = isRemoteFsType;
7
7
  exports.parseURL = parseURL;
8
8
  exports.extractRemoteInfo = extractRemoteInfo;
9
- const debuglog_js_1 = require("./debuglog.js");
10
- const object_js_1 = require("./object.js");
11
- const platform_js_1 = require("./platform.js");
12
- const string_js_1 = require("./string.js");
9
+ const debuglog_js_1 = require("./debuglog.cjs");
10
+ const object_js_1 = require("./object.cjs");
11
+ const platform_js_1 = require("./platform.cjs");
12
+ const string_js_1 = require("./string.cjs");
13
13
  function isRemoteInfo(obj) {
14
14
  if (!(0, object_js_1.isObject)(obj))
15
15
  return false;
@@ -6,13 +6,13 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
6
6
  Object.defineProperty(exports, "__esModule", { value: true });
7
7
  exports.setup = setup;
8
8
  const node_gyp_build_1 = __importDefault(require("node-gyp-build"));
9
- const debuglog_js_1 = require("./debuglog.js");
10
- const defer_js_1 = require("./defer.js");
11
- const fs_js_1 = require("./fs.js");
12
- const hidden_js_1 = require("./hidden.js");
13
- const mount_point_js_1 = require("./mount_point.js");
14
- const options_js_1 = require("./options.js");
15
- const volume_metadata_js_1 = require("./volume_metadata.js");
9
+ const debuglog_js_1 = require("./debuglog.cjs");
10
+ const defer_js_1 = require("./defer.cjs");
11
+ const fs_js_1 = require("./fs.cjs");
12
+ const hidden_js_1 = require("./hidden.cjs");
13
+ const mount_point_js_1 = require("./mount_point.cjs");
14
+ const options_js_1 = require("./options.cjs");
15
+ const volume_metadata_js_1 = require("./volume_metadata.cjs");
16
16
  function setup(dirname) {
17
17
  const nativeFn = (0, defer_js_1.defer)(async () => {
18
18
  const start = Date.now();
@@ -3,12 +3,12 @@
3
3
  Object.defineProperty(exports, "__esModule", { value: true });
4
4
  exports.isSystemVolume = isSystemVolume;
5
5
  exports.assignSystemVolume = assignSystemVolume;
6
- const debuglog_js_1 = require("./debuglog.js");
7
- const glob_js_1 = require("./glob.js");
8
- const options_js_1 = require("./options.js");
9
- const path_js_1 = require("./path.js");
10
- const platform_js_1 = require("./platform.js");
11
- const string_js_1 = require("./string.js");
6
+ const debuglog_js_1 = require("./debuglog.cjs");
7
+ const glob_js_1 = require("./glob.cjs");
8
+ const options_js_1 = require("./options.cjs");
9
+ const path_js_1 = require("./path.cjs");
10
+ const platform_js_1 = require("./platform.cjs");
11
+ const string_js_1 = require("./string.cjs");
12
12
  /**
13
13
  * Determines if a mount point represents a system volume based on its path and
14
14
  * filesystem type
@@ -2,7 +2,7 @@
2
2
  // src/unc.ts
3
3
  Object.defineProperty(exports, "__esModule", { value: true });
4
4
  exports.parseUNCPath = parseUNCPath;
5
- const string_js_1 = require("./string.js");
5
+ const string_js_1 = require("./string.cjs");
6
6
  /**
7
7
  * Checks if a string is formatted as a valid UNC path.
8
8
  * A valid UNC path starts with double backslashes or slashes,
@@ -2,7 +2,7 @@
2
2
  // src/uuid.ts
3
3
  Object.defineProperty(exports, "__esModule", { value: true });
4
4
  exports.extractUUID = extractUUID;
5
- const string_js_1 = require("./string.js");
5
+ const string_js_1 = require("./string.cjs");
6
6
  const uuidRegex = /[a-z0-9][a-z0-9-]{7,}/i;
7
7
  /**
8
8
  * Some volume UUIDs are short, like, `ABCD1234`.
@@ -3,12 +3,12 @@
3
3
  Object.defineProperty(exports, "__esModule", { value: true });
4
4
  exports.VolumeHealthStatuses = void 0;
5
5
  exports.directoryStatus = directoryStatus;
6
- const async_js_1 = require("./async.js");
7
- const debuglog_js_1 = require("./debuglog.js");
8
- const error_js_1 = require("./error.js");
9
- const fs_js_1 = require("./fs.js");
10
- const object_js_1 = require("./object.js");
11
- const string_enum_js_1 = require("./string_enum.js");
6
+ const async_js_1 = require("./async.cjs");
7
+ const debuglog_js_1 = require("./debuglog.cjs");
8
+ const error_js_1 = require("./error.cjs");
9
+ const fs_js_1 = require("./fs.cjs");
10
+ const object_js_1 = require("./object.cjs");
11
+ const string_enum_js_1 = require("./string_enum.cjs");
12
12
  /**
13
13
  * Health statuses for volumes (mostly applicable to Windows).
14
14
  *
@@ -4,23 +4,23 @@ Object.defineProperty(exports, "__esModule", { value: true });
4
4
  exports._ = void 0;
5
5
  exports.getVolumeMetadata = getVolumeMetadata;
6
6
  exports.getAllVolumeMetadata = getAllVolumeMetadata;
7
- const async_js_1 = require("./async.js");
8
- const debuglog_js_1 = require("./debuglog.js");
9
- const error_js_1 = require("./error.js");
10
- const dev_disk_js_1 = require("./linux/dev_disk.js");
11
- const mount_points_js_1 = require("./linux/mount_points.js");
12
- const mtab_js_1 = require("./linux/mtab.js");
13
- const mount_point_js_1 = require("./mount_point.js");
14
- const object_js_1 = require("./object.js");
15
- const options_js_1 = require("./options.js");
16
- const path_js_1 = require("./path.js");
17
- const platform_js_1 = require("./platform.js");
18
- const remote_info_js_1 = require("./remote_info.js");
19
- const string_js_1 = require("./string.js");
20
- const system_volume_js_1 = require("./system_volume.js");
21
- const unc_js_1 = require("./unc.js");
22
- const uuid_js_1 = require("./uuid.js");
23
- const volume_health_status_js_1 = require("./volume_health_status.js");
7
+ const async_js_1 = require("./async.cjs");
8
+ const debuglog_js_1 = require("./debuglog.cjs");
9
+ const error_js_1 = require("./error.cjs");
10
+ const dev_disk_js_1 = require("./linux/dev_disk.cjs");
11
+ const mount_points_js_1 = require("./linux/mount_points.cjs");
12
+ const mtab_js_1 = require("./linux/mtab.cjs");
13
+ const mount_point_js_1 = require("./mount_point.cjs");
14
+ const object_js_1 = require("./object.cjs");
15
+ const options_js_1 = require("./options.cjs");
16
+ const path_js_1 = require("./path.cjs");
17
+ const platform_js_1 = require("./platform.cjs");
18
+ const remote_info_js_1 = require("./remote_info.cjs");
19
+ const string_js_1 = require("./string.cjs");
20
+ const system_volume_js_1 = require("./system_volume.cjs");
21
+ const unc_js_1 = require("./unc.cjs");
22
+ const uuid_js_1 = require("./uuid.cjs");
23
+ const volume_health_status_js_1 = require("./volume_health_status.cjs");
24
24
  async function getVolumeMetadata(o, nativeFn) {
25
25
  if ((0, string_js_1.isBlank)(o.mountPoint)) {
26
26
  throw new TypeError("Invalid mountPoint: got " + JSON.stringify(o.mountPoint));
@@ -1,8 +1,12 @@
1
+ // src/array.ts
1
2
  /**
2
3
  * @return a new array whose elements return true based on the given `predicate`
3
4
  * function.
4
5
  */
5
- export declare function asyncFilter<T>(arr: T[], predicate: (item: T) => boolean | Promise<boolean>): Promise<T[]>;
6
+ export async function asyncFilter(arr, predicate) {
7
+ const results = await Promise.all(arr.map(async (ea) => predicate(ea)));
8
+ return arr.filter((_item, index) => results[index]);
9
+ }
6
10
  /**
7
11
  * Remove duplicate elements from an array.
8
12
  *
@@ -11,21 +15,36 @@ export declare function asyncFilter<T>(arr: T[], predicate: (item: T) => boolean
11
15
  *
12
16
  * @return A new array with duplicate elements removed
13
17
  */
14
- export declare function uniq<T>(arr: T[]): T[];
18
+ export function uniq(arr) {
19
+ return Array.from(new Set(arr));
20
+ }
15
21
  /**
16
22
  * Remove duplicate elements from an array based on a key function.
17
23
  * @param keyFn A function that returns a key for each element. Elements that
18
24
  * the key function returns nullish will be removed from the returned array.
19
25
  * @return a new array omitting duplicate elements based on a key function.
20
26
  */
21
- export declare function uniqBy<T, K>(arr: T[], keyFn: (item: T) => K | undefined): T[];
27
+ export function uniqBy(arr, keyFn) {
28
+ const seen = new Set();
29
+ return arr.filter((item) => {
30
+ const key = keyFn(item);
31
+ if (key == null || seen.has(key))
32
+ return false;
33
+ seen.add(key);
34
+ return true;
35
+ });
36
+ }
22
37
  /**
23
38
  * @return an array of specified length, with each element created by calling
24
39
  * the provided function.
25
40
  */
26
- export declare function times<T>(length: number, fn: (index: number) => T): T[];
41
+ export function times(length, fn) {
42
+ return Array.from({ length }, (_, i) => fn(i));
43
+ }
27
44
  /**
28
45
  * @return a new array with elements that are not `null` or `undefined`.
29
46
  */
30
- export declare function compact<T>(arr: (T | null | undefined)[] | undefined): T[];
31
- //# sourceMappingURL=array.d.ts.map
47
+ export function compact(arr) {
48
+ return arr == null ? [] : arr.filter((ea) => ea != null);
49
+ }
50
+ //# sourceMappingURL=array.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"array.js","sourceRoot":"","sources":["../../src/array.ts"],"names":[],"mappings":"AAAA,eAAe;AAEf;;;GAGG;AACH,MAAM,CAAC,KAAK,UAAU,WAAW,CAC/B,GAAQ,EACR,SAAkD;IAElD,MAAM,OAAO,GAAG,MAAM,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,KAAK,EAAE,EAAE,EAAE,EAAE,CAAC,SAAS,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;IACxE,OAAO,GAAG,CAAC,MAAM,CAAC,CAAC,KAAK,EAAE,KAAK,EAAE,EAAE,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC;AACtD,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,UAAU,IAAI,CAAI,GAAQ;IAC9B,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC;AAClC,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,MAAM,CAAO,GAAQ,EAAE,KAAiC;IACtE,MAAM,IAAI,GAAG,IAAI,GAAG,EAAK,CAAC;IAC1B,OAAO,GAAG,CAAC,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE;QACzB,MAAM,GAAG,GAAG,KAAK,CAAC,IAAI,CAAC,CAAC;QACxB,IAAI,GAAG,IAAI,IAAI,IAAI,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC;YAAE,OAAO,KAAK,CAAC;QAC/C,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;QACd,OAAO,IAAI,CAAC;IACd,CAAC,CAAC,CAAC;AACL,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,KAAK,CAAI,MAAc,EAAE,EAAwB;IAC/D,OAAO,KAAK,CAAC,IAAI,CAAC,EAAE,MAAM,EAAE,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC;AACjD,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,OAAO,CAAI,GAAyC;IAClE,OAAO,GAAG,IAAI,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,EAAE,EAAW,EAAE,CAAC,EAAE,IAAI,IAAI,CAAC,CAAC;AACpE,CAAC"}
@@ -0,0 +1,109 @@
1
+ import { availableParallelism } from "node:os";
2
+ import { env } from "node:process";
3
+ import { gt0, isNumber } from "./number.js";
4
+ import { isBlank } from "./string.js";
5
+ /**
6
+ * An error that is thrown when a promise does not resolve within the specified
7
+ * time.
8
+ */
9
+ export class TimeoutError extends Error {
10
+ constructor(message, captureStackTrace = true) {
11
+ super(message);
12
+ this.name = "TimeoutError";
13
+ // Capture the stack trace up to the calling site
14
+ if (captureStackTrace && Error.captureStackTrace) {
15
+ Error.captureStackTrace(this, this.constructor);
16
+ }
17
+ }
18
+ }
19
+ /**
20
+ * Rejects the promise with a TimeoutError if it does not resolve within the
21
+ * specified time.
22
+ *
23
+ * @param promise The promise to wrap.
24
+ * @param timeoutMs The timeout in milliseconds. Timeouts are disabled if this is 0.
25
+ * @returns A promise that resolves when the input promise resolves, or rejects
26
+ * with a TimeoutError if the input promise does not resolve within the
27
+ * specified time.
28
+ * @throws {TimeoutError} if the input promise does not resolve within the
29
+ * specified time.
30
+ * @throws {TypeError} if timeoutMs is not a number that is greater than 0.
31
+ */
32
+ export async function withTimeout(opts) {
33
+ const desc = isBlank(opts.desc) ? "thenOrTimeout()" : opts.desc;
34
+ if (!isNumber(opts.timeoutMs)) {
35
+ throw new TypeError(desc +
36
+ ": Expected timeoutMs to be numeric, but got " +
37
+ JSON.stringify(opts.timeoutMs));
38
+ }
39
+ const timeoutMs = Math.floor(opts.timeoutMs);
40
+ if (timeoutMs < 0) {
41
+ throw new TypeError(desc + ": Expected timeoutMs to be > 0, but got " + timeoutMs);
42
+ }
43
+ if (timeoutMs === 0) {
44
+ return opts.promise;
45
+ }
46
+ // Create error here to captured the caller's stack trace. If we create it in
47
+ // the timeout callback, the stack trace will be truncated to this function.
48
+ const timeoutError = new TimeoutError(`${desc}: timeout after ${timeoutMs}ms`);
49
+ if (env["NODE_ENV"] === "test" && timeoutMs === 1) {
50
+ timeoutError.message += "(timeout test)";
51
+ opts.promise.catch(() => { }); // < avoid unhandled rejection warnings
52
+ throw timeoutError;
53
+ }
54
+ let timeoutId;
55
+ opts.promise
56
+ .catch(() => { }) // < avoid unhandled rejection warnings
57
+ .finally(() => {
58
+ if (timeoutId != null) {
59
+ clearTimeout(timeoutId);
60
+ timeoutId = undefined;
61
+ }
62
+ });
63
+ const timeoutPromise = new Promise((_, reject) => {
64
+ timeoutId = setTimeout(() => {
65
+ if (timeoutId != null) {
66
+ timeoutError.message += "(timeout callback)";
67
+ reject(timeoutError);
68
+ }
69
+ timeoutId = undefined;
70
+ }, timeoutMs);
71
+ });
72
+ return Promise.race([opts.promise, timeoutPromise]);
73
+ }
74
+ /**
75
+ * Delay for the specified number of milliseconds.
76
+ *
77
+ * @param ms The number of milliseconds to delay
78
+ * @param t Optional value to resolve with after delay
79
+ * @returns Promise that resolves with the provided value (or void if none provided)
80
+ */
81
+ export async function delay(ms, t) {
82
+ return new Promise((resolve) => setTimeout(() => resolve(t), ms));
83
+ }
84
+ /**
85
+ * Apply `fn` to every item in `items` with a maximum concurrency of
86
+ * `maxConcurrency`.
87
+ */
88
+ export async function mapConcurrent({ items, fn, maxConcurrency = availableParallelism(), }) {
89
+ // Validate maxConcurrency
90
+ if (!gt0(maxConcurrency)) {
91
+ throw new Error(`maxConcurrency must be a positive integer, got: ${maxConcurrency}`);
92
+ }
93
+ if (typeof fn !== "function") {
94
+ throw new TypeError(`fn must be a function, got: ${typeof fn}`);
95
+ }
96
+ const results = [];
97
+ const executing = new Set();
98
+ for (const [index, item] of items.entries()) {
99
+ // Create a wrapped promise that handles cleanup
100
+ while (executing.size >= maxConcurrency) {
101
+ await Promise.race(executing);
102
+ }
103
+ const p = (results[index] = fn(item).catch((error) => error));
104
+ executing.add(p);
105
+ p.finally(() => executing.delete(p));
106
+ }
107
+ return Promise.all(results);
108
+ }
109
+ //# sourceMappingURL=async.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"async.js","sourceRoot":"","sources":["../../src/async.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,SAAS,CAAC;AAC/C,OAAO,EAAE,GAAG,EAAE,MAAM,cAAc,CAAC;AACnC,OAAO,EAAE,GAAG,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAEtC;;;GAGG;AACH,MAAM,OAAO,YAAa,SAAQ,KAAK;IACrC,YAAY,OAAe,EAAE,iBAAiB,GAAG,IAAI;QACnD,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,cAAc,CAAC;QAC3B,iDAAiD;QACjD,IAAI,iBAAiB,IAAI,KAAK,CAAC,iBAAiB,EAAE,CAAC;YACjD,KAAK,CAAC,iBAAiB,CAAC,IAAI,EAAE,IAAI,CAAC,WAAW,CAAC,CAAC;QAClD,CAAC;IACH,CAAC;CACF;AACD;;;;;;;;;;;;GAYG;AACH,MAAM,CAAC,KAAK,UAAU,WAAW,CAAI,IAIpC;IACC,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,iBAAiB,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC;IAEhE,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,SAAS,CAAC,EAAE,CAAC;QAC9B,MAAM,IAAI,SAAS,CACjB,IAAI;YACF,8CAA8C;YAC9C,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,SAAS,CAAC,CACjC,CAAC;IACJ,CAAC;IAED,MAAM,SAAS,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;IAE7C,IAAI,SAAS,GAAG,CAAC,EAAE,CAAC;QAClB,MAAM,IAAI,SAAS,CACjB,IAAI,GAAG,0CAA0C,GAAG,SAAS,CAC9D,CAAC;IACJ,CAAC;IAED,IAAI,SAAS,KAAK,CAAC,EAAE,CAAC;QACpB,OAAO,IAAI,CAAC,OAAO,CAAC;IACtB,CAAC;IAED,6EAA6E;IAC7E,4EAA4E;IAC5E,MAAM,YAAY,GAAG,IAAI,YAAY,CACnC,GAAG,IAAI,mBAAmB,SAAS,IAAI,CACxC,CAAC;IAEF,IAAI,GAAG,CAAC,UAAU,CAAC,KAAK,MAAM,IAAI,SAAS,KAAK,CAAC,EAAE,CAAC;QAClD,YAAY,CAAC,OAAO,IAAI,gBAAgB,CAAC;QACzC,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,GAAG,EAAE,GAAE,CAAC,CAAC,CAAC,CAAC,uCAAuC;QACrE,MAAM,YAAY,CAAC;IACrB,CAAC;IAED,IAAI,SAAqC,CAAC;IAE1C,IAAI,CAAC,OAAO;SACT,KAAK,CAAC,GAAG,EAAE,GAAE,CAAC,CAAC,CAAC,uCAAuC;SACvD,OAAO,CAAC,GAAG,EAAE;QACZ,IAAI,SAAS,IAAI,IAAI,EAAE,CAAC;YACtB,YAAY,CAAC,SAAS,CAAC,CAAC;YACxB,SAAS,GAAG,SAAS,CAAC;QACxB,CAAC;IACH,CAAC,CAAC,CAAC;IAEL,MAAM,cAAc,GAAG,IAAI,OAAO,CAAQ,CAAC,CAAC,EAAE,MAAM,EAAE,EAAE;QACtD,SAAS,GAAG,UAAU,CAAC,GAAG,EAAE;YAC1B,IAAI,SAAS,IAAI,IAAI,EAAE,CAAC;gBACtB,YAAY,CAAC,OAAO,IAAI,oBAAoB,CAAC;gBAC7C,MAAM,CAAC,YAAY,CAAC,CAAC;YACvB,CAAC;YACD,SAAS,GAAG,SAAS,CAAC;QACxB,CAAC,EAAE,SAAS,CAAC,CAAC;IAChB,CAAC,CAAC,CAAC;IAEH,OAAO,OAAO,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,OAAO,EAAE,cAAc,CAAC,CAAC,CAAC;AACtD,CAAC;AAED;;;;;;GAMG;AACH,MAAM,CAAC,KAAK,UAAU,KAAK,CAAW,EAAU,EAAE,CAAK;IACrD,OAAO,IAAI,OAAO,CAAI,CAAC,OAAO,EAAE,EAAE,CAAC,UAAU,CAAC,GAAG,EAAE,CAAC,OAAO,CAAC,CAAM,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC;AAC5E,CAAC;AAED;;;GAGG;AACH,MAAM,CAAC,KAAK,UAAU,aAAa,CAAO,EACxC,KAAK,EACL,EAAE,EACF,cAAc,GAAG,oBAAoB,EAAE,GAKxC;IACC,0BAA0B;IAC1B,IAAI,CAAC,GAAG,CAAC,cAAc,CAAC,EAAE,CAAC;QACzB,MAAM,IAAI,KAAK,CACb,mDAAmD,cAAc,EAAE,CACpE,CAAC;IACJ,CAAC;IAED,IAAI,OAAO,EAAE,KAAK,UAAU,EAAE,CAAC;QAC7B,MAAM,IAAI,SAAS,CAAC,+BAA+B,OAAO,EAAE,EAAE,CAAC,CAAC;IAClE,CAAC;IAED,MAAM,OAAO,GAAyB,EAAE,CAAC;IACzC,MAAM,SAAS,GAAuB,IAAI,GAAG,EAAE,CAAC;IAEhD,KAAK,MAAM,CAAC,KAAK,EAAE,IAAI,CAAC,IAAI,KAAK,CAAC,OAAO,EAAE,EAAE,CAAC;QAC5C,gDAAgD;QAChD,OAAO,SAAS,CAAC,IAAI,IAAI,cAAc,EAAE,CAAC;YACxC,MAAM,OAAO,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;QAChC,CAAC;QACD,MAAM,CAAC,GAAG,CAAC,OAAO,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,CAAC,KAAK,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC;QAC9D,SAAS,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;QACjB,CAAC,CAAC,OAAO,CAAC,GAAG,EAAE,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC;IACvC,CAAC;IAED,OAAO,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;AAC9B,CAAC"}
@@ -0,0 +1,25 @@
1
+ /**
2
+ * Cache the result of a function for a given time-to-live (TTL).
3
+ */
4
+ export function ttlCache(fn, ttl) {
5
+ if (ttl <= 0)
6
+ return fn;
7
+ const cache = new Map();
8
+ return (...args) => {
9
+ const key = JSON.stringify(args);
10
+ const entry = cache.get(key);
11
+ if (entry) {
12
+ return entry.r;
13
+ }
14
+ const result = fn(...args);
15
+ const timeoutId = setTimeout(() => {
16
+ const currentEntry = cache.get(key);
17
+ if (currentEntry?.t === timeoutId) {
18
+ cache.delete(key);
19
+ }
20
+ }, ttl);
21
+ cache.set(key, { r: result, t: timeoutId });
22
+ return result;
23
+ };
24
+ }
25
+ //# sourceMappingURL=cache.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cache.js","sourceRoot":"","sources":["../../src/cache.ts"],"names":[],"mappings":"AAKA;;GAEG;AACH,MAAM,UAAU,QAAQ,CACtB,EAAwB,EACxB,GAAW;IAEX,IAAI,GAAG,IAAI,CAAC;QAAE,OAAO,EAAE,CAAC;IAExB,MAAM,KAAK,GAAG,IAAI,GAAG,EAAyB,CAAC;IAE/C,OAAO,CAAC,GAAG,IAAU,EAAK,EAAE;QAC1B,MAAM,GAAG,GAAG,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC;QACjC,MAAM,KAAK,GAAG,KAAK,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;QAE7B,IAAI,KAAK,EAAE,CAAC;YACV,OAAO,KAAK,CAAC,CAAC,CAAC;QACjB,CAAC;QAED,MAAM,MAAM,GAAG,EAAE,CAAC,GAAG,IAAI,CAAC,CAAC;QAE3B,MAAM,SAAS,GAAG,UAAU,CAAC,GAAG,EAAE;YAChC,MAAM,YAAY,GAAG,KAAK,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;YACpC,IAAI,YAAY,EAAE,CAAC,KAAK,SAAS,EAAE,CAAC;gBAClC,KAAK,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;YACpB,CAAC;QACH,CAAC,EAAE,GAAG,CAAC,CAAC;QAER,KAAK,CAAC,GAAG,CAAC,GAAG,EAAE,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,SAAS,EAAE,CAAC,CAAC;QAE5C,OAAO,MAAM,CAAC;IAChB,CAAC,CAAC;AACJ,CAAC"}
@@ -0,0 +1,30 @@
1
+ import { debuglog, format } from "node:util";
2
+ import { defer } from "./defer.js";
3
+ // allow tests to reset the debug log context
4
+ export const debugLogContext = defer(() => {
5
+ for (const ea of ["fs-metadata", "fs-meta"]) {
6
+ if (debuglog(ea).enabled) {
7
+ return ea;
8
+ }
9
+ if (debuglog(ea.toUpperCase()).enabled) {
10
+ return ea;
11
+ }
12
+ }
13
+ return "photostructure:fs-metadata";
14
+ });
15
+ export const isDebugEnabled = defer(() => {
16
+ return debuglog(debugLogContext()).enabled ?? false;
17
+ });
18
+ export function debug(msg, ...args) {
19
+ if (!isDebugEnabled())
20
+ return;
21
+ const now = new Date();
22
+ // Format: [HH:MM:SS.mmm] prefix: message
23
+ const timestamp = `[${now.getHours().toString().padStart(2, "0")}:${now.getMinutes().toString().padStart(2, "0")}:${now.getSeconds().toString().padStart(2, "0")}.${now.getMilliseconds().toString().padStart(3, "0")}] ${debugLogContext()} `;
24
+ process.stderr.write(timestamp + format(msg, ...args) + "\n");
25
+ }
26
+ export function resetDebugLog() {
27
+ debugLogContext.reset();
28
+ isDebugEnabled.reset();
29
+ }
30
+ //# sourceMappingURL=debuglog.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"debuglog.js","sourceRoot":"","sources":["../../src/debuglog.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AAC7C,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AAEnC,6CAA6C;AAE7C,MAAM,CAAC,MAAM,eAAe,GAAG,KAAK,CAAC,GAAG,EAAE;IACxC,KAAK,MAAM,EAAE,IAAI,CAAC,aAAa,EAAE,SAAS,CAAC,EAAE,CAAC;QAC5C,IAAI,QAAQ,CAAC,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC;YACzB,OAAO,EAAE,CAAC;QACZ,CAAC;QACD,IAAI,QAAQ,CAAC,EAAE,CAAC,WAAW,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC;YACvC,OAAO,EAAE,CAAC;QACZ,CAAC;IACH,CAAC;IACD,OAAO,4BAA4B,CAAC;AACtC,CAAC,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,cAAc,GAAG,KAAK,CAAC,GAAG,EAAE;IACvC,OAAO,QAAQ,CAAC,eAAe,EAAE,CAAC,CAAC,OAAO,IAAI,KAAK,CAAC;AACtD,CAAC,CAAC,CAAC;AAEH,MAAM,UAAU,KAAK,CAAC,GAAW,EAAE,GAAG,IAAe;IACnD,IAAI,CAAC,cAAc,EAAE;QAAE,OAAO;IAC9B,MAAM,GAAG,GAAG,IAAI,IAAI,EAAE,CAAC;IAEvB,yCAAyC;IACzC,MAAM,SAAS,GAAG,IAAI,GAAG,CAAC,QAAQ,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC,IAAI,GAAG,CAAC,UAAU,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC,IAAI,GAAG,CAAC,UAAU,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC,IAAI,GAAG,CAAC,eAAe,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC,KAAK,eAAe,EAAE,GAAG,CAAC;IAE/O,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,SAAS,GAAG,MAAM,CAAC,GAAG,EAAE,GAAG,IAAI,CAAC,GAAG,IAAI,CAAC,CAAC;AAChE,CAAC;AAED,MAAM,UAAU,aAAa;IAC3B,eAAe,CAAC,KAAK,EAAE,CAAC;IACxB,cAAc,CAAC,KAAK,EAAE,CAAC;AACzB,CAAC"}
@@ -0,0 +1,23 @@
1
+ // src/defer.ts
2
+ /**
3
+ * Creates a deferred value that is computed once on first access and cached for
4
+ * subsequent accesses.
5
+ * @param thunk A function that takes no arguments and returns a value
6
+ * @returns A function that returns the computed value
7
+ */
8
+ export function defer(thunk) {
9
+ let computed = false;
10
+ let value;
11
+ const fn = () => {
12
+ if (!computed) {
13
+ computed = true;
14
+ value = thunk();
15
+ }
16
+ return value;
17
+ };
18
+ fn.reset = () => {
19
+ computed = false;
20
+ };
21
+ return fn;
22
+ }
23
+ //# sourceMappingURL=defer.js.map