@photostructure/fs-metadata 1.2.0 → 1.4.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 +37 -0
- package/CONTRIBUTING.md +3 -3
- package/binding.gyp +0 -22
- package/dist/index.cjs +11 -40
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +15 -3
- package/dist/index.d.mts +15 -3
- package/dist/index.d.ts +15 -3
- package/dist/index.mjs +11 -40
- package/dist/index.mjs.map +1 -1
- package/doc/C++_REVIEW_TODO.md +3 -36
- package/doc/LINUX_API_REFERENCE.md +4 -147
- package/doc/SECURITY_AUDIT_2026.md +5 -0
- package/doc/gotchas.md +27 -0
- package/package.json +9 -10
- package/prebuilds/darwin-arm64/@photostructure+fs-metadata.glibc.node +0 -0
- package/prebuilds/darwin-x64/@photostructure+fs-metadata.glibc.node +0 -0
- package/prebuilds/linux-arm64/@photostructure+fs-metadata.glibc.node +0 -0
- package/prebuilds/linux-x64/@photostructure+fs-metadata.glibc.node +0 -0
- package/prebuilds/win32-arm64/@photostructure+fs-metadata.glibc.node +0 -0
- package/prebuilds/win32-x64/@photostructure+fs-metadata.glibc.node +0 -0
- package/scripts/clang-tidy.ts +1 -3
- package/scripts/prebuild-linux-glibc.sh +1 -5
- package/scripts/sanitizers-test.sh +0 -1
- package/src/binding.cpp +0 -15
- package/src/index.ts +6 -2
- package/src/linux/mount_points.ts +8 -42
- package/src/linux/volume_metadata.cpp +0 -16
- package/src/mount_point_for_path.ts +1 -1
- package/src/types/mount_point.ts +1 -1
- package/src/types/native_bindings.ts +0 -5
- package/src/types/options.ts +14 -0
- package/src/volume_metadata.ts +22 -11
- package/src/volume_mount_points.ts +1 -1
- package/scripts/setup-native.mjs +0 -39
- package/src/linux/gio_mount_points.cpp +0 -80
- package/src/linux/gio_mount_points.h +0 -37
- package/src/linux/gio_utils.cpp +0 -115
- package/src/linux/gio_utils.h +0 -69
- package/src/linux/gio_volume_metadata.cpp +0 -81
- package/src/linux/gio_volume_metadata.h +0 -20
package/CHANGELOG.md
CHANGED
|
@@ -14,6 +14,43 @@ Fixed for any bug fixes.
|
|
|
14
14
|
Security in case of vulnerabilities.
|
|
15
15
|
-->
|
|
16
16
|
|
|
17
|
+
## 1.4.0 - 2026-04-20
|
|
18
|
+
|
|
19
|
+
### Removed
|
|
20
|
+
|
|
21
|
+
- **Linux GIO/GLib integration removed.** The optional `enable_gio` build-time
|
|
22
|
+
flag, the `getGioMountPoints` native binding, and the entire `src/linux/gio_*`
|
|
23
|
+
source tree have been deleted. The Linux mount-points and volume-metadata
|
|
24
|
+
paths now use `/proc/self/mounts` parsing exclusively.
|
|
25
|
+
|
|
26
|
+
Background: GIO was originally added to surface auto-mounted volumes (USB
|
|
27
|
+
sticks, external SSDs) that appeared to be missing from `/proc/mounts`. The
|
|
28
|
+
earlier mount-table read order has since been fixed, and direct verification
|
|
29
|
+
on Ubuntu 24 confirmed that udisks2-mounted devices (`/media/$USER/...`) are
|
|
30
|
+
fully visible via `/proc/self/mounts` without GIO. The remaining GIO code
|
|
31
|
+
path was a thin wrapper around `g_unix_mounts_get()` (which itself reads
|
|
32
|
+
`/proc/self/mountinfo`) — functionally redundant with the existing mtab
|
|
33
|
+
parser. The GVolumeMonitor enrichment path that originally justified GIO had
|
|
34
|
+
already been removed for thread-safety reasons in an earlier release.
|
|
35
|
+
|
|
36
|
+
Net effect: smaller native module, no `libglib2.0-dev` build dependency, no
|
|
37
|
+
`libgio` runtime dependency, simpler Linux build matrix. No public API
|
|
38
|
+
changes — `getVolumeMountPoints()` and `getVolumeMetadata()` return the same
|
|
39
|
+
data as before.
|
|
40
|
+
|
|
41
|
+
### Changed
|
|
42
|
+
|
|
43
|
+
- Linux build no longer requires `libglib2.0-dev`. Only `libblkid-dev` (and
|
|
44
|
+
`uuid-dev` for the dev environment) is needed when compiling from source.
|
|
45
|
+
- `scripts/setup-native.mjs` removed — its only purpose was GIO autodetection.
|
|
46
|
+
`npm run build` and `npm run build:native` no longer invoke it.
|
|
47
|
+
|
|
48
|
+
## 1.3.0 - 2026-03-26
|
|
49
|
+
|
|
50
|
+
### Added
|
|
51
|
+
|
|
52
|
+
- New optional `mountPoints` field on `Options`: pass pre-fetched mount points to `getMountPointForPath()` and `getVolumeMetadataForPath()` to avoid redundant system queries when resolving multiple paths. Obtain via `getVolumeMountPoints({ includeSystemVolumes: true })`.
|
|
53
|
+
|
|
17
54
|
## 1.2.0 - 2026-03-26
|
|
18
55
|
|
|
19
56
|
### Added
|
package/CONTRIBUTING.md
CHANGED
|
@@ -41,7 +41,7 @@ Install the Xcode Command Line Tools, and then
|
|
|
41
41
|
|
|
42
42
|
### On Ubuntu/Debian
|
|
43
43
|
|
|
44
|
-
sudo apt-get install bear build-essential clang-format
|
|
44
|
+
sudo apt-get install bear build-essential clang-format libblkid-dev uuid-dev
|
|
45
45
|
|
|
46
46
|
## Before submitting your PR
|
|
47
47
|
|
|
@@ -57,7 +57,7 @@ into account both Windows and POSIX systems.
|
|
|
57
57
|
|
|
58
58
|
- macOS on x86 and Apple Silicon
|
|
59
59
|
- Windows on x64
|
|
60
|
-
- glibc Linux on x64 and arm64
|
|
60
|
+
- glibc Linux on x64 and arm64
|
|
61
61
|
- MUSL Alpine Linux on x64 and arm64
|
|
62
62
|
|
|
63
63
|
## Development Gotchas
|
|
@@ -121,7 +121,7 @@ Actions that have multiple targets can be run in parallel using wildcards:
|
|
|
121
121
|
|
|
122
122
|
### Naming Guidelines
|
|
123
123
|
|
|
124
|
-
- Use explicit names to avoid ambiguity (e.g., `
|
|
124
|
+
- Use explicit names to avoid ambiguity (e.g., `build:native` instead of just `build`)
|
|
125
125
|
- Group related scripts by action prefix for easy wildcard execution
|
|
126
126
|
- Avoid names that could cause npm lifecycle conflicts (e.g., `prebuild` vs `build`)
|
|
127
127
|
- Use descriptive suffixes that clearly indicate the target or purpose
|
package/binding.gyp
CHANGED
|
@@ -1,7 +1,4 @@
|
|
|
1
1
|
{
|
|
2
|
-
"variables": {
|
|
3
|
-
"enable_gio%": "false"
|
|
4
|
-
},
|
|
5
2
|
"targets": [
|
|
6
3
|
{
|
|
7
4
|
"target_name": "fs_metadata",
|
|
@@ -57,25 +54,6 @@
|
|
|
57
54
|
"cflags": ["-mbranch-protection=standard"],
|
|
58
55
|
"cflags_cc": ["-mbranch-protection=standard"]
|
|
59
56
|
}
|
|
60
|
-
],
|
|
61
|
-
[
|
|
62
|
-
"enable_gio=='true'",
|
|
63
|
-
{
|
|
64
|
-
"sources": [
|
|
65
|
-
"src/linux/gio_utils.cpp",
|
|
66
|
-
"src/linux/gio_mount_points.cpp",
|
|
67
|
-
"src/linux/gio_volume_metadata.cpp"
|
|
68
|
-
],
|
|
69
|
-
"defines": [
|
|
70
|
-
"ENABLE_GIO=1"
|
|
71
|
-
],
|
|
72
|
-
"libraries": [
|
|
73
|
-
"<!@(pkg-config --libs gio-unix-2.0)"
|
|
74
|
-
],
|
|
75
|
-
"cflags": [
|
|
76
|
-
"<!@(pkg-config --cflags gio-unix-2.0)"
|
|
77
|
-
]
|
|
78
|
-
}
|
|
79
57
|
]
|
|
80
58
|
]
|
|
81
59
|
}
|
package/dist/index.cjs
CHANGED
|
@@ -694,11 +694,6 @@ async function* readLinks(directory) {
|
|
|
694
694
|
// src/linux/mount_points.ts
|
|
695
695
|
var import_promises4 = require("fs/promises");
|
|
696
696
|
|
|
697
|
-
// src/mount_point.ts
|
|
698
|
-
function isMountPoint(obj) {
|
|
699
|
-
return isObject(obj) && "mountPoint" in obj && isNotBlank(obj.mountPoint);
|
|
700
|
-
}
|
|
701
|
-
|
|
702
697
|
// src/options.ts
|
|
703
698
|
var import_node_os2 = require("os");
|
|
704
699
|
var import_node_process3 = require("process");
|
|
@@ -1180,49 +1175,25 @@ function parseMtab(content) {
|
|
|
1180
1175
|
}
|
|
1181
1176
|
|
|
1182
1177
|
// src/linux/mount_points.ts
|
|
1183
|
-
async function getLinuxMountPoints(
|
|
1178
|
+
async function getLinuxMountPoints(opts) {
|
|
1184
1179
|
const o = optionsWithDefaults(opts);
|
|
1185
|
-
const raw = [];
|
|
1186
|
-
try {
|
|
1187
|
-
const arr = await (await native()).getGioMountPoints?.();
|
|
1188
|
-
debug("[getLinuxMountPoints] GIO mount points: %o", arr);
|
|
1189
|
-
if (arr != null) raw.push(...arr);
|
|
1190
|
-
} catch (error) {
|
|
1191
|
-
debug("Failed to get GIO mount points: %s", error);
|
|
1192
|
-
}
|
|
1193
1180
|
let cause;
|
|
1194
1181
|
for (const input of o.linuxMountTablePaths) {
|
|
1195
1182
|
try {
|
|
1196
1183
|
const mtabContent = await (0, import_promises4.readFile)(input, "utf8");
|
|
1197
|
-
const
|
|
1198
|
-
debug("[getLinuxMountPoints] %s mount points: %o", input,
|
|
1199
|
-
if (
|
|
1200
|
-
|
|
1201
|
-
break;
|
|
1184
|
+
const results = parseMtab(mtabContent).map((ea) => mountEntryToMountPoint(ea)).filter((ea) => ea != null);
|
|
1185
|
+
debug("[getLinuxMountPoints] %s mount points: %o", input, results);
|
|
1186
|
+
if (results.length > 0) {
|
|
1187
|
+
return results;
|
|
1202
1188
|
}
|
|
1203
1189
|
} catch (error) {
|
|
1204
1190
|
cause ??= toError(error);
|
|
1205
1191
|
}
|
|
1206
1192
|
}
|
|
1207
|
-
|
|
1208
|
-
|
|
1209
|
-
|
|
1210
|
-
|
|
1211
|
-
if (isMountPoint(merged)) {
|
|
1212
|
-
byMountPoint.set(merged.mountPoint, merged);
|
|
1213
|
-
}
|
|
1214
|
-
}
|
|
1215
|
-
if (byMountPoint.size === 0) {
|
|
1216
|
-
throw new WrappedError(
|
|
1217
|
-
`Failed to find any mount points (tried: ${JSON.stringify(o.linuxMountTablePaths)})`,
|
|
1218
|
-
{ cause }
|
|
1219
|
-
);
|
|
1220
|
-
}
|
|
1221
|
-
const results = [...byMountPoint.values()];
|
|
1222
|
-
debug("[getLinuxMountPoints] %o", {
|
|
1223
|
-
results: results.map((ea) => ea.mountPoint)
|
|
1224
|
-
});
|
|
1225
|
-
return results;
|
|
1193
|
+
throw new WrappedError(
|
|
1194
|
+
`Failed to find any mount points (tried: ${JSON.stringify(o.linuxMountTablePaths)})`,
|
|
1195
|
+
{ cause }
|
|
1196
|
+
);
|
|
1226
1197
|
}
|
|
1227
1198
|
async function getLinuxMtabMetadata(mountPoint, opts) {
|
|
1228
1199
|
let caughtError;
|
|
@@ -1349,7 +1320,7 @@ async function _getVolumeMountPoints(o, nativeFn2) {
|
|
|
1349
1320
|
points.length
|
|
1350
1321
|
);
|
|
1351
1322
|
return points;
|
|
1352
|
-
})() : getLinuxMountPoints(
|
|
1323
|
+
})() : getLinuxMountPoints(o));
|
|
1353
1324
|
debug("[getVolumeMountPoints] raw mount points: %o", raw);
|
|
1354
1325
|
const compacted = raw.map((ea) => compactValues(ea)).filter((ea) => isNotBlank(ea.mountPoint));
|
|
1355
1326
|
for (const ea of compacted) {
|
|
@@ -1502,7 +1473,7 @@ async function getVolumeMetadataForPathImpl(pathname, opts, nativeFn2) {
|
|
|
1502
1473
|
}
|
|
1503
1474
|
async function findMountPointByDeviceId(resolved, resolvedStat, opts, nativeFn2) {
|
|
1504
1475
|
const targetDev = resolvedStat.dev;
|
|
1505
|
-
const mountPoints = await getVolumeMountPointsImpl(
|
|
1476
|
+
const mountPoints = opts.mountPoints ?? await getVolumeMountPointsImpl(
|
|
1506
1477
|
{ ...opts, includeSystemVolumes: true },
|
|
1507
1478
|
nativeFn2
|
|
1508
1479
|
);
|