@photostructure/fs-metadata 0.2.0 → 0.3.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/CHANGELOG.md +6 -0
- package/dist/index.cjs +18 -9
- package/dist/index.cjs.map +1 -1
- package/dist/index.mjs +18 -9
- package/dist/index.mjs.map +1 -1
- package/dist/types/options.d.ts +4 -4
- package/package.json +10 -6
- package/prebuilds/darwin-arm64/@photostructure+fs-metadata.glibc.node +0 -0
- package/prebuilds/win32-x64/@photostructure+fs-metadata.glibc.node +0 -0
- package/src/glob.ts +2 -0
- package/src/linux/mtab.ts +1 -1
- package/src/options.ts +7 -7
- package/src/string.ts +1 -1
- package/src/system_volume.ts +15 -7
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@photostructure/fs-metadata",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.1",
|
|
4
4
|
"description": "Cross-platform native filesystem metadata retrieval for Node.js",
|
|
5
5
|
"homepage": "https://photostructure.github.io/fs-metadata/",
|
|
6
6
|
"types": "./dist/types/index.d.ts",
|
|
@@ -21,6 +21,7 @@
|
|
|
21
21
|
"configure": "node scripts/configure.mjs",
|
|
22
22
|
"prebuildify": "prebuildify --napi --tag-libc --strip",
|
|
23
23
|
"prebuild": "run-s configure prebuildify",
|
|
24
|
+
"clang-tidy": "node-gyp configure -- -f compile_commands_json && clang-tidy -p build/Release src/**/*.cpp",
|
|
24
25
|
"compile": "run-p compile:*",
|
|
25
26
|
"compile:esm": "tsc -p tsconfig.esm.json --noEmit",
|
|
26
27
|
"compile:cjs": "tsc -p tsconfig.cjs.json --noEmit",
|
|
@@ -43,6 +44,7 @@
|
|
|
43
44
|
"test:memory": "cross-env TEST_MEMORY=1 node --expose-gc --experimental-vm-modules --no-warnings node_modules/jest/bin/jest.js --config jest.config.mjs --no-coverage src/memory.test.ts",
|
|
44
45
|
"lint": "eslint",
|
|
45
46
|
"lint:fix": "eslint --fix",
|
|
47
|
+
"snyk": "snyk code test",
|
|
46
48
|
"fmt": "run-p fmt:*",
|
|
47
49
|
"// fmt:cpp": "on ubuntu: `sudo apt install clang-format`",
|
|
48
50
|
"fmt:cpp": "clang-format --style=LLVM -i src/*.cpp src/*/*.cpp src/*/*.h || true",
|
|
@@ -50,7 +52,7 @@
|
|
|
50
52
|
"fmt:json": "prettier --write \"**/*.json\"",
|
|
51
53
|
"fmt:pkg": "npm pkg fix",
|
|
52
54
|
"fmt:ts": "prettier --write \"**/*.(c|m)?ts\"",
|
|
53
|
-
"precommit": "run-s fmt clean prebuild tests",
|
|
55
|
+
"precommit": "run-s fmt clean prebuild tests snyk",
|
|
54
56
|
"prepare-release": "npm run bundle",
|
|
55
57
|
"release": "release-it"
|
|
56
58
|
},
|
|
@@ -93,21 +95,23 @@
|
|
|
93
95
|
"cross-env": "^7.0.3",
|
|
94
96
|
"del-cli": "^6.0.0",
|
|
95
97
|
"eslint": "^9.17.0",
|
|
98
|
+
"eslint-plugin-regexp": "^2.7.0",
|
|
96
99
|
"globals": "^15.14.0",
|
|
100
|
+
"jest": "^29.7.0",
|
|
97
101
|
"jest-environment-node": "^29.7.0",
|
|
98
102
|
"jest-extended": "^4.0.2",
|
|
99
|
-
"jest": "^29.7.0",
|
|
100
103
|
"node-gyp": "^11.0.0",
|
|
101
104
|
"npm-run-all": "4.1.5",
|
|
102
105
|
"prebuildify": "^6.0.1",
|
|
103
|
-
"prettier-plugin-organize-imports": "4.1.0",
|
|
104
106
|
"prettier": "^3.4.2",
|
|
107
|
+
"prettier-plugin-organize-imports": "4.1.0",
|
|
105
108
|
"release-it": "^17.11.0",
|
|
109
|
+
"snyk": "^1.1294.3",
|
|
106
110
|
"terser": "^5.37.0",
|
|
107
111
|
"ts-jest": "^29.2.5",
|
|
108
112
|
"tsup": "^8.3.5",
|
|
109
113
|
"typedoc": "^0.27.6",
|
|
110
|
-
"typescript
|
|
111
|
-
"typescript": "^
|
|
114
|
+
"typescript": "^5.7.2",
|
|
115
|
+
"typescript-eslint": "^8.19.0"
|
|
112
116
|
}
|
|
113
117
|
}
|
|
Binary file
|
|
Binary file
|
package/src/glob.ts
CHANGED
|
@@ -123,5 +123,7 @@ function _compileGlob(patterns: string[] | readonly string[]): RegExp {
|
|
|
123
123
|
: new RegExp(`^(?:${final.join("|")})$`, "i");
|
|
124
124
|
}
|
|
125
125
|
|
|
126
|
+
// eslint-disable-next-line regexp/no-empty-group
|
|
126
127
|
export const AlwaysMatchRE = /(?:)/;
|
|
128
|
+
// eslint-disable-next-line regexp/no-empty-lookarounds-assertion
|
|
127
129
|
export const NeverMatchRE = /(?!)/;
|
package/src/linux/mtab.ts
CHANGED
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/string.ts
CHANGED
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
|
|