@neodx/vfs
Version:
Simple virtual file system - working dir context, lazy changes, different modes, integrations and moreover
40 lines (39 loc) • 1.09 kB
JavaScript
import { walkGlob as r } from '@neodx/glob';
import { isTypeOfString as o } from '@neodx/std';
import { c as t } from '../_internal/create-vfs-plugin-CTZbwgZU.mjs';
import { scanVfs as a, createScanVfsCache as i } from './scan.mjs';
function n() {
return t('glob', r => {
async function t(t, a) {
return await e(r, Array.isArray(t) || o(t) ? { ...a, glob: t } : t);
}
return (r.glob = t), r;
});
}
async function e(
o,
{ glob: t, ignore: n, timeout: e, signal: l, log: s = o.log.child('glob'), maxDepth: c }
) {
let f = i();
return await r(t, {
timeout: e,
ignore: n,
signal: l,
log: s,
reader: async ({ path: r, isIgnored: t, isMatched: i, signal: n }) =>
(await o.isFile(r))
? i(r)
? ['']
: []
: await a(o, {
path: r,
cache: f,
signal: n,
maxDepth: c,
filter: ({ relativePath: r }) => i(r),
barrier: ({ relativePath: r }) => t(r)
})
});
}
export { n as glob, e as globVfs };
//# sourceMappingURL=glob.mjs.map