@zenfs/core
Advanced tools
Comparing version 1.6.12 to 1.6.13
{ | ||
"name": "@zenfs/core", | ||
"version": "1.6.12", | ||
"version": "1.6.13", | ||
"description": "A filesystem, anywhere", | ||
@@ -62,7 +62,2 @@ "funding": { | ||
}, | ||
"lint-staged": { | ||
"*": [ | ||
"prettier --write" | ||
] | ||
}, | ||
"dependencies": { | ||
@@ -77,3 +72,2 @@ "@types/node": "^22.10.1", | ||
"optionalDependencies": { | ||
"minimatch": "^9.0.3", | ||
"c8": "^10.1.2" | ||
@@ -86,3 +80,2 @@ }, | ||
"globals": "^15.9.0", | ||
"lint-staged": "^15.2.7", | ||
"prettier": "^3.2.5", | ||
@@ -89,0 +82,0 @@ "tsx": "^4.19.1", |
#!/usr/bin/env node | ||
import { readdirSync, statSync, writeFileSync } from 'node:fs'; | ||
import _path from 'node:path/posix'; | ||
import { matchesGlob, relative, join, resolve } from 'node:path/posix'; | ||
import { parseArgs } from 'node:util'; | ||
@@ -39,20 +39,2 @@ | ||
let matchesGlob = _path.matchesGlob; | ||
if (matchesGlob && options.verbose) { | ||
console.debug('[debug] path.matchesGlob is available.'); | ||
} | ||
if (!matchesGlob) { | ||
console.warn('Warning: path.matchesGlob is not available, falling back to minimatch. (Node 20.17.0+ or 22.5.0+ needed)'); | ||
try { | ||
const { minimatch } = await import('minimatch'); | ||
matchesGlob = minimatch; | ||
} catch { | ||
console.error('Fatal error: Failed to fall back to minimatch (is it installed?)'); | ||
process.exit(1); | ||
} | ||
} | ||
function fixSlash(path) { | ||
@@ -100,3 +82,3 @@ return path.replaceAll('\\', '/'); | ||
if (stats.isFile()) { | ||
entries.set('/' + _path.relative(resolvedRoot, path), stats); | ||
entries.set('/' + relative(resolvedRoot, path), stats); | ||
if (options.verbose) { | ||
@@ -109,5 +91,5 @@ console.log(`${color('green', 'file')} ${path}`); | ||
for (const file of readdirSync(path)) { | ||
computeEntries(_path.join(path, file)); | ||
computeEntries(join(path, file)); | ||
} | ||
entries.set('/' + _path.relative(resolvedRoot, path), stats); | ||
entries.set('/' + relative(resolvedRoot, path), stats); | ||
if (options.verbose) { | ||
@@ -125,3 +107,3 @@ console.log(`${color('bright_green', ' dir')} ${path}`); | ||
if (!options.quiet) { | ||
console.log('Generated listing for ' + fixSlash(_path.resolve(root))); | ||
console.log('Generated listing for ' + fixSlash(resolve(root))); | ||
} | ||
@@ -128,0 +110,0 @@ |
7
9
590072
14777