Appearance
marmotte / utils/fs
utils/fs
Type Aliases
PathFilter
PathFilter =
RegExp| (path) =>boolean
Defined in: src/utils/fs.ts:5
Functions
dirExists()
dirExists(
path):boolean
Defined in: src/utils/fs.ts:45
Returns true if path exists and is a directory.
Parameters
path
string
Returns
boolean
fileExists()
fileExists(
path):boolean
Defined in: src/utils/fs.ts:50
Returns true if path exists and is a regular file.
Parameters
path
string
Returns
boolean
moduleExists()
moduleExists(
path):boolean
Defined in: src/utils/fs.ts:59
Returns true if path resolves to a TypeScript module — either:
- a directory containing an
index.ts, or - a
<path>.tsfile.
Parameters
path
string
Returns
boolean
resolveEntries()
resolveEntries(
sourceDir,filter):Promise<Record<string,string>>
Defined in: src/utils/fs.ts:35
Walks sourceDir recursively and returns a Rollup-compatible entry map ({ [name]: absolutePath }) for every file matched by filter. The entry name is the file path relative to sourceDir, without its extension.
Parameters
sourceDir
string
filter
Returns
Promise<Record<string, string>>
Example
ts
// { "index": "/abs/src/index.ts", "utils/foo": "/abs/src/utils/foo.ts" }
await resolveEntries("/abs/src", /\.ts$/)walk()
walk(
dir,filter?):AsyncGenerator<string>
Defined in: src/utils/fs.ts:17
Recursively iterates over a directory (and its subdirectories) files
Parameters
dir
string
filter?
Returns
AsyncGenerator<string>