@photostructure/fs-metadata 0.2.0 → 0.3.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 +6 -0
- package/dist/index.cjs +17 -8
- package/dist/index.cjs.map +1 -1
- package/dist/index.mjs +17 -8
- package/dist/index.mjs.map +1 -1
- package/dist/types/options.d.ts +4 -4
- package/package.json +1 -1
- package/prebuilds/darwin-arm64/@photostructure+fs-metadata.glibc.node +0 -0
- package/prebuilds/win32-x64/@photostructure+fs-metadata.glibc.node +0 -0
- package/src/options.ts +7 -7
- package/src/system_volume.ts +15 -7
package/src/options.ts
CHANGED
|
@@ -41,7 +41,7 @@ export interface Options {
|
|
|
41
41
|
*
|
|
42
42
|
* @see {@link SystemFsTypesDefault} for the default value
|
|
43
43
|
*/
|
|
44
|
-
systemFsTypes:
|
|
44
|
+
systemFsTypes: string[];
|
|
45
45
|
|
|
46
46
|
/**
|
|
47
47
|
* On Linux, use the first mount point table in this array that is readable.
|
|
@@ -105,7 +105,7 @@ export const SystemPathPatternsDefault = [
|
|
|
105
105
|
/**
|
|
106
106
|
* Filesystem types that indicate system volumes
|
|
107
107
|
*/
|
|
108
|
-
export const SystemFsTypesDefault =
|
|
108
|
+
export const SystemFsTypesDefault = [
|
|
109
109
|
"autofs",
|
|
110
110
|
"binfmt_misc",
|
|
111
111
|
"cgroup",
|
|
@@ -128,16 +128,16 @@ export const SystemFsTypesDefault = new Set([
|
|
|
128
128
|
"squashfs",
|
|
129
129
|
"sysfs",
|
|
130
130
|
"tmpfs",
|
|
131
|
-
]
|
|
131
|
+
] as const;
|
|
132
132
|
|
|
133
133
|
export const LinuxMountTablePathsDefault = [
|
|
134
134
|
"/proc/self/mounts",
|
|
135
135
|
"/proc/mounts",
|
|
136
136
|
"/etc/mtab",
|
|
137
|
-
];
|
|
137
|
+
] as const;
|
|
138
138
|
|
|
139
139
|
/**
|
|
140
|
-
* Should {@link getAllVolumeMetadata
|
|
140
|
+
* Should {@link getAllVolumeMetadata} include system volumes by
|
|
141
141
|
* default?
|
|
142
142
|
*/
|
|
143
143
|
export const IncludeSystemVolumesDefault = isWindows;
|
|
@@ -151,8 +151,8 @@ export const OptionsDefault: Options = {
|
|
|
151
151
|
timeoutMs: TimeoutMsDefault,
|
|
152
152
|
maxConcurrency: availableParallelism(),
|
|
153
153
|
systemPathPatterns: [...SystemPathPatternsDefault],
|
|
154
|
-
systemFsTypes:
|
|
155
|
-
linuxMountTablePaths: LinuxMountTablePathsDefault,
|
|
154
|
+
systemFsTypes: [...SystemFsTypesDefault],
|
|
155
|
+
linuxMountTablePaths: [...LinuxMountTablePathsDefault],
|
|
156
156
|
includeSystemVolumes: IncludeSystemVolumesDefault,
|
|
157
157
|
} as const;
|
|
158
158
|
|
package/src/system_volume.ts
CHANGED
|
@@ -31,7 +31,6 @@ export function isSystemVolume(
|
|
|
31
31
|
fstype: string | undefined,
|
|
32
32
|
config: Partial<SystemVolumeConfig> = {},
|
|
33
33
|
): boolean {
|
|
34
|
-
debug("[isSystemVolume] checking %s (fstype: %s)", mountPoint, fstype);
|
|
35
34
|
if (isWindows) {
|
|
36
35
|
const systemDrive = normalizePath(process.env["SystemDrive"]);
|
|
37
36
|
if (systemDrive != null && mountPoint === systemDrive) {
|
|
@@ -39,13 +38,22 @@ export function isSystemVolume(
|
|
|
39
38
|
return true;
|
|
40
39
|
}
|
|
41
40
|
}
|
|
42
|
-
const
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
mountPoint,
|
|
41
|
+
const isSystemFsType =
|
|
42
|
+
isNotBlank(fstype) &&
|
|
43
|
+
((config.systemFsTypes ?? SystemFsTypesDefault) as string[]).includes(
|
|
44
|
+
fstype,
|
|
47
45
|
);
|
|
48
|
-
|
|
46
|
+
const hasSystemPath = compileGlob(
|
|
47
|
+
config.systemPathPatterns ?? SystemPathPatternsDefault,
|
|
48
|
+
).test(mountPoint);
|
|
49
|
+
const result = isSystemFsType || hasSystemPath;
|
|
50
|
+
debug("[isSystemVolume]", {
|
|
51
|
+
mountPoint,
|
|
52
|
+
fstype,
|
|
53
|
+
result,
|
|
54
|
+
isSystemFsType,
|
|
55
|
+
hasSystemPath,
|
|
56
|
+
});
|
|
49
57
|
return result;
|
|
50
58
|
}
|
|
51
59
|
|