File System
The File System utilities offer a way to organize and query file-system data in renoun. It is a powerful tool that allows you to define a schema for file exports and query those exports using a simple API.
To get started with the File System API, instantiate the Directory class to target a set of files and directories from the file system. You can then use the getEntry / getDirectory / getFile methods to query a specific descendant file or directory:
import { Directory } from 'renoun'
const posts = new Directory({
path: 'posts',
loader: {
mdx: (path) => import(`./posts/${path}.mdx`),
},
})
Here we are creating a new Directory instance that targets the posts directory relative to the working directory. We are also specifying a loader for the mdx file extension that will be used to load the file contents using the bundler.
Referencing path schemes
The Directory and File constructors accept path schemes that resolve using internal resolvers before the adapters interact with the file system. The only supported scheme currently is workspace:, which resolves paths relative to the workspace root instead of the current working directory.
This is helpful when using renoun from a nested package (for example apps/site) but you need to reference files located in another workspace directory (like examples):
import { Directory } from 'renoun'
const examples = new Directory({
path: 'workspace:examples',
})
If the current working directory is apps/site, the example above resolves to ../../examples internally while remaining ./examples when run from the workspace root.
Querying file system entries
import { Directory } from 'renoun'
const posts = new Directory({
path: 'posts',
loader: {
mdx: (path) => import(`./posts/${path}.mdx`),
},
})
export default async function Page({ slug }: { slug: string }) {
const post = await posts.getFile(slug, 'mdx')
const Content = await post.getExportValue('default')
return <Content />
}
You can query the entries within the directory to help with generating navigations and index pages. For example, we can filter to only mdx file extensions to generate an index page of links to all posts using the getEntries method:
import { Directory, withSchema } from 'renoun'
interface PostType {
frontmatter: {
title: string
date: Date
}
}
const posts = new Directory({
path: 'posts',
filter: '*.mdx',
loader: {
mdx: withSchema<PostType>((path) => import(`./posts/${path}.mdx`)),
},
})
export default async function Page() {
const allPosts = await posts.getEntries()
return (
<>
<h1>Blog</h1>
<ul>
{allPosts.map(async (post) => {
const pathname = post.getPathname()
const frontmatter = await post.getExportValue('frontmatter')
return (
<li key={pathname}>
<a href={pathname}>{frontmatter.title}</a>
</li>
)
})}
</ul>
</>
)
}
File selection criteria
When querying files using getFile or getEntry, the file system follows a specific priority order to resolve ambiguous paths:
-
Sibling files over directories
: When both a file and a directory exist with the same base name (e.g.,
integrations.mdxandintegrations/), the sibling file is preferred over the directory. This ensures thatgetEntry('integrations')returnsintegrations.mdxrather than theintegrations/directory. -
Base files over files with modifiers
: When multiple files share the same base name but have different modifiers (e.g.,
Reference.tsxandReference.examples.tsx), the base file without a modifier is preferred. -
Extension matching
: When an extension is specified in the query (e.g.,
getFile('button', 'tsx')), only files matching that extension are considered. -
Directory representatives
: If a directory is selected, the file system looks for a representative file within that directory in this order:
-
A file with the same name as the directory (e.g.,
Button/Button.tsx) -
An
indexfile (e.g.,Button/index.tsx) -
A
readmefile (e.g.,Button/readme.md)
-
A file with the same name as the directory (e.g.,
import { Directory, MemoryFileSystem } from 'renoun'
const directory = new Directory({ path: 'posts' })
// When both integrations.mdx and integrations/ exist
// returns integrations.mdx (sibling file, not the directory)
const entry = await directory.getEntry('integrations')
// When both Reference.tsx and Reference.examples.tsx exist
// returns Reference.tsx (base file without modifier)
const file = await directory.getFile('Reference')
Type checking file exports
To improve type safety, you can utilize the withSchema helper to specify the schema for the file’s exports:
import { Directory, withSchema } from 'renoun'
interface PostType {
frontmatter: {
title: string
date: Date
}
}
const posts = new Directory({
path: 'posts',
loader: {
mdx: withSchema<PostType>((path) => import(`./posts/${path}.mdx`)),
},
})
Now when we call JavaScript#getExportValue and JavaScriptExport#getRuntimeValue we will have stronger type checking and autocomplete.
Working with globbed module maps
When using bundler utilities like import.meta.glob, you can return a loader map from the loader option to reuse the globbed modules:
/// <reference types="vite/client" />
import { Directory, withSchema } from 'renoun'
interface PostType {
frontmatter: {
title: string
date: Date
}
}
const posts = new Directory({
path: 'posts',
loader: () => {
const mdxModules = import.meta.glob('./posts/**/*.mdx')
return {
mdx: withSchema<PostType>((path) => mdxModules[`./posts/${path}.mdx`]),
}
},
})
The loader factory executes once and returns the extension-to-loader map, so the globbed modules are reused across all files in the directory. If the glob returns loader functions themselves, they will automatically be called and awaited for you.
Schema Validation
You can also apply schema validation using libraries that follow the Standard Schema Spec like Zod, Valibot, or Arktype to ensure file exports conform to a specific schema:
import { Directory, withSchema } from 'renoun'
import { z } from 'zod'
const posts = new Directory({
path: 'posts',
loader: {
mdx: withSchema(
{
frontmatter: z.object({
title: z.string(),
date: z.date(),
}),
},
(path) => import(`./posts/${path}.mdx`)
),
},
})
Alternatively, you can define a schema yourself using both TypeScript types and custom validation functions:
import { Directory, withSchema } from 'renoun'
interface PostType {
frontmatter: {
title: string
date: Date
}
}
const posts = new Directory({
path: 'posts',
loader: {
mdx: withSchema<PostType>(
{
frontmatter: (value) => {
if (typeof value.title !== 'string') {
throw new Error('Title is required')
}
if (!(value.date instanceof Date)) {
throw new Error('Date is required')
}
return value
},
},
(path) => import(`./posts/${path}.mdx`)
),
},
})
The file system utilities are not limited to MDX files and can be used with any file type. By organizing content and source code into structured collections, you can easily generate static pages and manage complex routing and navigations.
Streaming
File instances expose web streamable methods directly, slice, stream, arrayBuffer, and text—without buffering file contents. Content type and size are inferred from the file metadata (via the type / size accessors), so you can treat a File as a streaming Blob immediately.
Because these helpers mirror the standard Web implementations, they can be passed directly to APIs that expect a Blob or File while still streaming their contents in byte ranges. Below are common ways to use them:
If the underlying file system adapter cannot report a byte length, stream() falls back to the raw readable stream instead of throwing. In that case the size accessor and slice() remain unavailable because they rely on a known length, but you can still forward the stream directly.
Surface streaming views from renoun File instances
import { Directory, File, MemoryFileSystem } from 'renoun/file-system'
const directory = new Directory({
fileSystem: new MemoryFileSystem({
'video.mp4': new Uint8Array([1, 2, 3]),
}),
})
const file = new File({ directory, path: 'video.mp4' })
// Work with slices directly on the File
const previewChunk = await file.slice(0, 1024 * 1024).arrayBuffer()
const type = file.type
Upload streaming files with fetch
Streaming files work with fetch (including in Node runtimes that support Web streams). Nothing is buffered before the request is sent:
import { Directory, File, MemoryFileSystem } from 'renoun/file-system'
const directory = new Directory({
fileSystem: new MemoryFileSystem({
'video.mp4': new Uint8Array([1, 2, 3]),
}),
})
const file = await directory.getFile('video.mp4')
await fetch('https://example.com/upload', {
method: 'PUT',
body: file.slice(), // streamed as the body
headers: { 'content-type': file.type },
})
Serve partial responses efficiently
You can return slices without reading the whole asset:
import { Directory, File } from 'renoun/file-system'
const directory = new Directory({
path: 'workspace:public',
})
export async function GET(request: Request) {
const rangeHeader = request.headers.get('range')
const file = new File({ directory, path: 'video.mp4' })
const { start = 0, end = file.size } = parseRange(rangeHeader)
const slice = file.slice(start, end)
return new Response(slice.stream(), {
status: 206,
headers: {
'content-type': file.type,
'content-range': `bytes ${start}-${end - 1}/${file.size}`,
},
})
}
function parseRange(header: string | null) {
if (!header?.startsWith('bytes=')) return {}
const [start, end] = header.replace('bytes=', '').split('-').map(Number)
return { start, end: Number.isFinite(end) ? end + 1 : undefined }
}
Using GitHostFileSystem
The GitHostFileSystem adapter lets you mirror files from a remote Git provider into memory so they can be queried just like local entries. It accepts the repository coordinates and optional filters and then streams the tarball for the requested ref.
import { Directory, GitHostFileSystem } from 'renoun'
const repoFs = new GitHostFileSystem({
repository: 'souporserious/renoun',
ref: 'main',
})
const docs = new Directory({
path: '.',
fileSystem: repoFs,
})
Avoiding rate limits
Git providers apply very small anonymous rate limits (for example, GitHub only allows 60 unauthenticated requests per hour). Passing an access token to GitHostFileSystem raises those limits dramatically and unlocks the more efficient metadata paths that renoun uses internally.
-
GitHub
– create a
classic personal access token
with the
reposcope for private repositories or no scopes for public repositories. -
GitLab
– use a
personal access token
with the
read_apiscope. - Bitbucket – supply an app password with read access.
Provide the token via the token option, ideally by reading from an environment variable so it is not committed to source control:
import { GitHostFileSystem } from 'renoun'
const repoFs = new GitHostFileSystem({
repository: 'souporserious/renoun',
token: process.env.GITHUB_TOKEN,
})
When a token is supplied, renoun batches GraphQL blame queries and reuses cached metadata to keep requests to a minimum. Without a token the file system falls back to higher-volume REST sampling, so authenticated requests are the easiest way to prevent rate limiting during development and CI.
Inspecting packages with Package
The file system utilities also include a Package helper that can discover workspace packages, resolve the closest node_modules installation, or fall back to repositories fetched through GitHostFileSystem. Once discovered, the package manifest is analyzed so you can introspect exports and imports without manually walking the file tree.
import { Package } from 'renoun'
const renounMdx = new Package({
name: '@renoun/mdx',
loader: {
'remark/add-headings': () => import('@renoun/mdx/remark/add-headings'),
},
})
const remarkAddHeadings = await renounMdx.getExport('remark/add-headings')
const defaultExport = await remarkAddHeadings.getExport('default')
await defaultExport.getType()
await defaultExport.getValue()
import { Package } from 'renoun'
const renounMdx = new Package({
name: '@renoun/mdx',
loader: {
'remark/add-headings': () => import('@renoun/mdx/remark/add-headings'),
},
})
const remarkAddHeadings = await renounMdx.getExport('remark/add-headings')
const defaultExport = await remarkAddHeadings.getExport('default')
const type = await defaultExport.getType()
const value = await defaultExport.getValue()
Each export directory tracks the manifest conditions, target file path, and helper methods for loading runtime values. The same API works for getImports() when you need to trace how a package consumes other modules, making it straightforward to build documentation or automated analysis around any published or workspace package.
API Reference
Constructor
new FileSystem(options?)Parameters
| Parameter | Type | Default Value |
|---|---|---|
| options? | FileSystemOptions | {} |
Methods
| Method | Type | Modifiers | |||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| getProjectOptions | () => ProjectOptions | abstract | |||||||||||||||
ReturnsProjectOptions | |||||||||||||||||
| getAbsolutePath | (path: string) => string | abstract | |||||||||||||||
Parameters
Returnsstring | |||||||||||||||||
| getRelativePathToWorkspace | (path: string) => string | abstract | |||||||||||||||
Parameters
Returnsstring | |||||||||||||||||
| getPathname | (path: PathLike, options?: { basePath?: string; rootPath?: string; }) => string | — | |||||||||||||||
Parameters
Returnsstring | |||||||||||||||||
| readDirectorySync | (path?: string) => Array<…> | abstract | |||||||||||||||
Parameters
ReturnsArray<DirectoryEntry> | |||||||||||||||||
| readDirectory | (path?: string) => Promise<…> | abstract | |||||||||||||||
Parameters
ReturnsPromise<Array<DirectoryEntry>>Modifiersasync | |||||||||||||||||
| readFileSync | (path: string) => string | abstract | |||||||||||||||
Parameters
Returnsstring | |||||||||||||||||
| readFile | (path: string) => Promise<…> | abstract | |||||||||||||||
Parameters
ReturnsPromise<string>Modifiersasync | |||||||||||||||||
| readFileBinarySync | (path: string) => Uint8Array<…> | abstract | |||||||||||||||
Parameters
ReturnsUint8Array<ArrayBufferLike> | |||||||||||||||||
| readFileBinary | (path: string) => Promise<…> | abstract | |||||||||||||||
Parameters
ReturnsPromise<Uint8Array<ArrayBufferLike>>Modifiersasync | |||||||||||||||||
| readFileStream | (path: string) => FileReadableStream | abstract | |||||||||||||||
Parameters
ReturnsFileReadableStream | |||||||||||||||||
| getFileByteLengthSync | (path: string) => number | undefined | abstract | |||||||||||||||
Get the size of a file in bytes. Implementations should return Parameters
Returnsnumber | undefined | |||||||||||||||||
| getFileByteLength | (path: string) => Promise<…> | — | |||||||||||||||
Parameters
ReturnsPromise<number | undefined>Modifiersasync | |||||||||||||||||
| writeFileSync | (path: string, content: FileSystemWriteFileContent) => void | abstract | |||||||||||||||
Parameters
Returnsvoid | |||||||||||||||||
| writeFile | (path: string, content: FileSystemWriteFileContent) => Promise<…> | abstract | |||||||||||||||
Parameters
ReturnsPromise<void>Modifiersasync | |||||||||||||||||
| writeFileStream | (path: string) => FileWritableStream | abstract | |||||||||||||||
Parameters
ReturnsFileWritableStream | |||||||||||||||||
| fileExistsSync | (path: string) => boolean | abstract | |||||||||||||||
Check synchronously if a file exists at the given path. Parameters
Returnsboolean | |||||||||||||||||
| fileExists | (path: string) => Promise<…> | — | |||||||||||||||
Parameters
ReturnsPromise<boolean>Modifiersasync | |||||||||||||||||
| getFileLastModifiedMsSync | (path: string) => number | undefined | abstract | |||||||||||||||
Get the last modified timestamp of a file or directory in milliseconds.
Implementations should return Parameters
Returnsnumber | undefined | |||||||||||||||||
| getFileLastModifiedMs | (path: string) => Promise<…> | — | |||||||||||||||
Parameters
ReturnsPromise<number | undefined>Modifiersasync | |||||||||||||||||
| deleteFileSync | (path: string) => void | abstract | |||||||||||||||
Parameters
Returnsvoid | |||||||||||||||||
| deleteFile | (path: string) => Promise<…> | abstract | |||||||||||||||
Parameters
ReturnsPromise<void>Modifiersasync | |||||||||||||||||
| shouldStripInternal | () => boolean | — | |||||||||||||||
Whether compilerOptions.stripInternal is enabled in the active tsconfig. Returnsboolean | |||||||||||||||||
| isFilePathExcludedFromTsConfig | (filePath: string, isDirectory?: boolean) => boolean | — | |||||||||||||||
Parameters
Returnsboolean | |||||||||||||||||
| isFilePathGitIgnored | (filePath: string) => boolean | abstract | |||||||||||||||
Parameters
Returnsboolean | |||||||||||||||||
| getFileExports | (filePath: string) => Promise<…> | — | |||||||||||||||
Parameters
ReturnsPromise<Array<ModuleExport>>Modifiersasync | |||||||||||||||||
| getFileExportMetadata | (name: string, filePath: string, position: number, kind: SyntaxKind) => Promise<…> | — | |||||||||||||||
Parameters
ReturnsPromise<{ name: string; environment: string; jsDocMetadata: { description?: string; tags?: { name: string; text?: string; }[]; } | undefined; location: DeclarationLocation; }>Modifiersasync | |||||||||||||||||
| getFileExportText | (filePath: string, position: number, kind: SyntaxKind, includeDependencies?: boolean) => Promise<…> | — | |||||||||||||||
Parameters
ReturnsPromise<string>Modifiersasync | |||||||||||||||||
| getFileExportStaticValue | (filePath: string, position: number, kind: SyntaxKind) => Promise<…> | — | |||||||||||||||
Parameters
ReturnsPromise<unknown>Modifiersasync | |||||||||||||||||
| resolveTypeAtLocation | (filePath: string, position: number, kind: SyntaxKind, filter?: TypeFilter | undefined) => Promise<…> | — | |||||||||||||||
Parameters
ReturnsPromise<Kind | undefined>Modifiersasync | |||||||||||||||||
Constructor
new GitHostFileSystem(options)Parameters
| Parameter | Type | Default Value |
|---|---|---|
| options | GitHostFileSystemOptions | — |
Methods
| Method | Type | Modifiers | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| clearCache | () => void | — | ||||||||||||
Returnsvoid | ||||||||||||||
| getGitFileMetadata | (path: string) => Promise<…> | — | ||||||||||||
Parameters
ReturnsPromise<GitMetadata>Modifiersasync | ||||||||||||||
| getGitExportMetadata | (path: string, startLine: number, endLine: number) => Promise<…> | — | ||||||||||||
Parameters
ReturnsPromise<GitExportMetadata>Modifiersasync | ||||||||||||||
| readDirectory | (path?: string) => Promise<…> | — | ||||||||||||
Parameters
ReturnsPromise<Array<DirectoryEntry>>Modifiersasync | ||||||||||||||
| readDirectorySync | () => Array<…> | — | ||||||||||||
ReturnsArray<DirectoryEntry> | ||||||||||||||
| readFile | (path: string) => Promise<…> | — | ||||||||||||
Parameters
ReturnsPromise<string>Modifiersasync | ||||||||||||||
| readFileBinary | (path: string) => Promise<…> | — | ||||||||||||
Parameters
ReturnsPromise<Uint8Array<ArrayBufferLike>>Modifiersasync | ||||||||||||||
| readFileSync | () => string | — | ||||||||||||
Returnsstring | ||||||||||||||
| isFilePathGitIgnored | () => boolean | — | ||||||||||||
Returnsboolean | ||||||||||||||
| isFilePathExcludedFromTsConfig | () => boolean | — | ||||||||||||
Returnsboolean | ||||||||||||||
Extends
MemoryFileSystemUtility type that infers the schema output from validator functions or a Standard Schema.
Type Parameters
| Parameter | Constraint | Default |
|---|---|---|
Exports | — | — |
Type
InferModuleExports<Exports>Overload 1
Provides type inference for the module loader.
Type Parameters
| Parameter | Constraint | Default |
|---|---|---|
Types | ModuleExports<any> | — |
Returns
ModuleLoaderWithSchema<Types, false>Overload 2
A function that resolves the module runtime.
Type Parameters
| Parameter | Constraint | Default |
|---|---|---|
Types | ModuleExports<any> | — |
Parameters
| Parameter | Type | Default Value |
|---|---|---|
| runtime | ModuleRuntimeLoader<unknown> | — |
Returns
ModuleLoaderWithSchema<Types, true>Overload 3
A schema that follows the Standard Schema Spec like Zod, Valibot, and Arktype or custom validation functions to ensure file exports conform to a specific schema.
Type Parameters
| Parameter | Constraint | Default |
|---|---|---|
Types | ModuleExports<any> | never |
Schema | ModuleExports<any> | ModuleExports<any> |
Parameters
| Parameter | Type | Default Value |
|---|---|---|
| schema | IsNever<Types> extends true ? Schema : Partial<ModuleExportValidators<NoInfer<Types>>> | — |
| runtime | ModuleRuntimeLoader<IsNever<Types> extends true ? NoInfer<Schema> : NoInfer<Types>> | — |
Returns
ModuleLoaderWithSchema<IsNever<Types> extends true ? Schema : ModuleExportValidators<NoInfer<Types>>, false>A record of loaders for different file extensions.
Index Signatures
| Key | Type | Modifiers |
|---|---|---|
extension: string | ModuleRuntimeLoader<ModuleExports<any>> | WithSchema<ModuleExports<any>> | ModuleLoaderWithSchema<ModuleExports<any>, false> | — |
Front matter parsed from the markdown file. When using the default
loaders this is populated automatically (if present), and custom
loaders can further narrow this shape via withSchema.
Type
FrontMatterDefault module types for common file extensions.
Properties
| Property | Type | Modifiers |
|---|---|---|
| md | { default: MDXContent; frontMatter?: FrontMatter; } | — |
| mdx | { default: MDXContent; frontMatter?: FrontMatter; } | — |
| json | JSONObject | — |
Intersects
DefaultModuleTypes & TypesInfer extension types for all loaders in a module.
Type Parameters
| Parameter | Constraint | Default |
|---|---|---|
Loaders | ModuleLoaders | — |
Index Signatures
| Key | Type | Modifiers |
|---|---|---|
key: string | InferModuleLoaderTypes<Loaders[string]> | — |
Extract keys from runtime‑capable loaders.
Type Parameters
| Parameter | Constraint | Default |
|---|---|---|
Loaders | — | — |
Type
LoadersWithRuntimeKeys<Loaders>Error for when a file is not found.
Constructor
new FileNotFoundError(path, extension?, context?)Parameters
| Parameter | Type | Default Value |
|---|---|---|
| path | string | Array<string> | — |
| extension? | any | — |
| context? | { directoryPath?: string; absoluteDirectoryPath?: string; rootPath?: string; nearestCandidates?: string[]; } | — |
Extends
ErrorType
Directory<DirectoryTypes, WithDefaultTypes<DirectoryTypes>, DirectoryLoader, DirectoryFilter<FileSystemEntry<WithDefaultTypes<DirectoryTypes>, undefined>, WithDefaultTypes<DirectoryTypes>>> | FileWithExtension<DirectoryTypes, Extension>Options for the File#getPathname and File#getPathnameSegments methods.
Properties
| Property | Type | Modifiers |
|---|---|---|
| includeBasePathname? | boolean | — |
Whether to include the configured | ||
| includeDirectoryNamedSegment? | boolean | — |
Whether to include the directory named segment in the pathname segments e.g. | ||
Options for a file in the file system.
Type Parameters
| Parameter | Constraint | Default |
|---|---|---|
Types | Record<string, any> | Record<string, any> |
Path | string | string |
Properties
| Property | Type | Modifiers |
|---|---|---|
| path | Path | URL | — |
| basePathname? | string | null | — |
| slugCasing? | SlugCasing | — |
| depth? | number | — |
| directory? | PathLike | Directory<Types, WithDefaultTypes<Types>, DirectoryLoader, DirectoryFilter<FileSystemEntry<Types, undefined>, Types>> | — |
A file in the file system.
Constructor
new File<DirectoryTypes, Path, Extension>(options)Type Parameters
| Parameter | Constraint | Default |
|---|---|---|
DirectoryTypes | Record<string, any> | Record<string, any> |
Path | string | string |
Extension | string | ExtractFileExtension<Path> |
Parameters
| Parameter | Type | Default Value |
|---|---|---|
| options | FileOptions<DirectoryTypes, Path> | — |
Accessors
| Accessor | Type | Modifiers |
|---|---|---|
| get type | string | — |
Get the MIME type inferred from the file extension. | ||
| get size | number | — |
Get the file size in bytes without reading the contents. | ||
Methods
| Method | Type | Modifiers | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| getName | () => string | — | ||||||||||||
The intrinsic name of the file. Returnsstring | ||||||||||||||
| getBaseName | () => string | — | ||||||||||||
The base name of the file e.g. Returnsstring | ||||||||||||||
| getModifierName | () => string | undefined | — | ||||||||||||
The modifier name of the file if defined e.g. Returnsstring | undefined | ||||||||||||||
| getTitle | () => string | — | ||||||||||||
The base file name formatted as a title. Returnsstring | ||||||||||||||
| getOrder | () => string | undefined | — | ||||||||||||
The order of the file if defined. Returnsstring | undefined | ||||||||||||||
| getExtension | () => Extension | — | ||||||||||||
The extension of the file if defined. ReturnsExtension | ||||||||||||||
| getDepth | () => number | — | ||||||||||||
Get the depth of the file starting from the root directory. Returnsnumber | ||||||||||||||
| getSlug | () => string | — | ||||||||||||
Get the slug of the file. Returnsstring | ||||||||||||||
| getPathname | (options?: FilePathnameOptions | undefined) => string | — | ||||||||||||
Get the path of this file formatted for routes. The configured Parameters
Returnsstring | ||||||||||||||
| getPathnameSegments | (options?: FilePathnameOptions | undefined) => Array<…> | — | ||||||||||||
Get the route path segments for this file. Parameters
ReturnsArray<string> | ||||||||||||||
| getRelativePathToRoot | () => string | — | ||||||||||||
Get the file path relative to the root directory. Returnsstring | ||||||||||||||
| getRelativePathToWorkspace | () => string | — | ||||||||||||
Get the file path relative to the workspace root. Returnsstring | ||||||||||||||
| getAbsolutePath | () => string | — | ||||||||||||
Get the absolute file system path. Returnsstring | ||||||||||||||
| getBlameUrl | (options?: (Pick<…> & { repository?: RepositoryConfig | string | Repository; }) | undefined) => string | — | ||||||||||||
Get the URL to the file git blame for the configured git repository. Parameters
Returnsstring | ||||||||||||||
| getEditUrl | (options?: (Pick<…> & { repository?: RepositoryConfig | string | Repository; }) | undefined) => string | — | ||||||||||||
Get the edit URL to the file source for the configured git repository. Parameters
Returnsstring | ||||||||||||||
| getHistoryUrl | (options?: (Pick<…> & { repository?: RepositoryConfig | string | Repository; }) | undefined) => string | — | ||||||||||||
Get the URL to the file history for the configured git repository. Parameters
Returnsstring | ||||||||||||||
| getRawUrl | (options?: (Pick<…> & { repository?: RepositoryConfig | string | Repository; }) | undefined) => string | — | ||||||||||||
Get the URL to the raw file contents for the configured git repository. Parameters
Returnsstring | ||||||||||||||
| getSourceUrl | (options?: (Pick<…> & { repository?: RepositoryConfig | string | Repository; }) | undefined) => string | — | ||||||||||||
Get the URL to the file source for the configured git repository. Parameters
Returnsstring | ||||||||||||||
| getReleaseUrl | (options?: SourceReleaseUrlOptions | undefined) => Promise<…> | — | ||||||||||||
Get a release URL for the configured git repository. Parameters
ReturnsPromise<string>Modifiersasync | ||||||||||||||
| getRelease | (options?: SourceReleaseOptions | undefined) => Promise<…> | — | ||||||||||||
Retrieve metadata about a release for the configured git repository. Parameters
ReturnsPromise<Release>Modifiersasync | ||||||||||||||
| getEditorUri | (options?: Omit<…> | undefined) => string | — | ||||||||||||
Get the URI to the file source code for the configured editor. Parameters
Returnsstring | ||||||||||||||
| getFirstCommitDate | () => Promise<…> | — | ||||||||||||
Get the first local git commit date of the file. ReturnsPromise<Date | undefined>Modifiersasync | ||||||||||||||
| getLastCommitDate | () => Promise<…> | — | ||||||||||||
Get the last local git commit date of the file. ReturnsPromise<Date | undefined>Modifiersasync | ||||||||||||||
| getAuthors | () => Promise<…> | — | ||||||||||||
Get the local git authors of the file. ReturnsPromise<Array<GitAuthor>>Modifiersasync | ||||||||||||||
| getParent | () => Directory<…> | — | ||||||||||||
Get the parent directory containing this file. ReturnsDirectory<DirectoryTypes, WithDefaultTypes<DirectoryTypes>, DirectoryLoader, DirectoryFilter<FileSystemEntry<WithDefaultTypes<DirectoryTypes>, undefined>, WithDefaultTypes<DirectoryTypes>>> | ||||||||||||||
| getSiblings | <GroupTypes>(options?: { collection?: Collection<…>; includeDirectoryNamedSegment?: boolean; }) => Promise<…> | — | ||||||||||||
Get the previous and next sibling entries (files or directories) of the parent directory. If the file is an index or readme file, the siblings will be retrieved from the parent directory. Type Parameters
Parameters
ReturnsPromise<[FileSystemEntry<DirectoryTypes, undefined> | undefined, FileSystemEntry<DirectoryTypes, undefined> | undefined]>Modifiersasync | ||||||||||||||
| getText | () => Promise<…> | — | ||||||||||||
Get the source text of this file. ReturnsPromise<string>Modifiersasync | ||||||||||||||
| getBinary | () => Promise<…> | — | ||||||||||||
Get the binary contents of this file. ReturnsPromise<Uint8Array<ArrayBufferLike>>Modifiersasync | ||||||||||||||
| stream | () => FileReadableStream | — | ||||||||||||
Create a readable stream for the file contents. ReturnsFileReadableStream | ||||||||||||||
| text | () => Promise<…> | — | ||||||||||||
Read the file contents as text. ReturnsPromise<string>Modifiersasync | ||||||||||||||
| arrayBuffer | () => Promise<…> | — | ||||||||||||
Read the file contents as an ArrayBuffer. ReturnsPromise<ArrayBuffer>Modifiersasync | ||||||||||||||
| slice | (start?: number, end?: number, contentType?: string) => Blob | — | ||||||||||||
Slice the file contents without buffering. Parameters
ReturnsBlob | ||||||||||||||
| getByteLength | () => Promise<…> | — | ||||||||||||
Get the byte length of this file without reading the contents. ReturnsPromise<number>Modifiersasync | ||||||||||||||
| write | (content: FileSystemWriteFileContent) => Promise<…> | — | ||||||||||||
Write content to this file. Parameters
ReturnsPromise<void>Modifiersasync | ||||||||||||||
| writeStream | () => FileWritableStream | — | ||||||||||||
Create a writable stream for this file. ReturnsFileWritableStream | ||||||||||||||
| delete | () => Promise<…> | — | ||||||||||||
Delete this file from the file system. ReturnsPromise<void>Modifiersasync | ||||||||||||||
| exists | () => Promise<…> | — | ||||||||||||
Check if this file exists in the file system. ReturnsPromise<boolean>Modifiersasync | ||||||||||||||
Type
string | number | boolean | nullType
JSONPrimitive | Array<JSONValue> | JSONObjectIndex Signatures
| Key | Type | Modifiers |
|---|---|---|
Key: string | JSONValue | — |
Type Parameters
| Parameter | Constraint | Default |
|---|---|---|
Data | Record<string, any> | JSONObject |
DirectoryTypes | Record<string, any> | Record<string, any> |
Path | string | string |
Properties
| Property | Type | Modifiers |
|---|---|---|
| schema? | StandardSchemaV1<Data, Data> | (value: unknown) => Data | — |
| path | Path | URL | — |
| basePathname? | string | null | — |
| slugCasing? | SlugCasing | — |
| depth? | number | — |
| directory? | PathLike | Directory<Types, WithDefaultTypes<Types>, DirectoryLoader, DirectoryFilter<FileSystemEntry<Types, undefined>, Types>> | — |
Type Parameters
| Parameter | Constraint | Default |
|---|---|---|
Data | — | — |
Path | string | — |
Type
JSONPathValue<Data, Path>Type
JSONPropertyPath<Data>A JSON file in the file system.
Constructor
new JSONFile<Data, DirectoryTypes, Path, Extension>(fileOptions)Type Parameters
| Parameter | Constraint | Default |
|---|---|---|
Data | Record<string, any> | JSONObject |
DirectoryTypes | Record<string, any> | Record<string, any> |
Path | string | string |
Extension | string | ExtractFileExtension<Path> |
Parameters
| Parameter | Type | Default Value |
|---|---|---|
| fileOptions | JSONFileOptions<Data, DirectoryTypes, Path> | — |
Methods
| Method | Type | Modifiers | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| get | () => Promise<…> (+1 overload) | — | ||||||||||||
Overload 1Get a value from the JSON data using dot notation. Returns ReturnsPromise<Data>ModifiersasyncOverload 2Type Parameters
Parameters
ReturnsPromise<JSONPathValueWithSegments<Data, JSONPathSegments<Path>>>Modifiersasync | ||||||||||||||
Extends
File<DirectoryTypes, Path, Extension>Error for when a module export cannot be found.
Constructor
new ModuleExportNotFoundError(path, name, className)Parameters
| Parameter | Type | Default Value |
|---|---|---|
| path | string | — |
| name | string | — |
| className | string | — |
Extends
ErrorA JavaScript module export.
Constructor
new ModuleExport<Value>(name, file, loader?, slugCasing?)Type Parameters
| Parameter | Constraint | Default |
|---|---|---|
Value | — | — |
Parameters
| Parameter | Type | Default Value |
|---|---|---|
| name | string | — |
| file | JavaScriptFile<any, Record<string, any>, string, string> | — |
| loader? | ModuleLoader<any> | undefined | — |
| slugCasing? | SlugCasing | undefined | — |
Methods
| Method | Type | Modifiers | |||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| init | <Value>(name: string, file: JavaScriptFile<…>, loader?: ModuleLoader<…> | undefined, slugCasing?: SlugCasing | undefined) => Promise<…> | static | |||||||||||||||||||||
Type Parameters
Parameters
ReturnsPromise<ModuleExport<Value>>Modifiersasync | |||||||||||||||||||||||
| getStaticMetadata | () => Promise<…> | protected | |||||||||||||||||||||
ReturnsPromise<{ name: string; environment: string; jsDocMetadata: { description?: string; tags?: { name: string; text?: string; }[]; } | undefined; location: DeclarationLocation; } | undefined>Modifiersasync | |||||||||||||||||||||||
| getSlug | () => string | — | |||||||||||||||||||||
Get the slug of the file export. Returnsstring | |||||||||||||||||||||||
| getName | () => string | — | |||||||||||||||||||||
Get the name of the export. Default exports will use the file name or declaration name if available. Returnsstring | |||||||||||||||||||||||
| getTitle | () => string | — | |||||||||||||||||||||
The export name formatted as a title. Returnsstring | |||||||||||||||||||||||
| getDescription | () => undefined | string | — | |||||||||||||||||||||
Get the JSDoc description for the export. Returnsundefined | string | |||||||||||||||||||||||
| getTags | ({
includeTypes = false,
}?: { includeTypes?: boolean; }) => undefined | Array<…> | — | |||||||||||||||||||||
Get the JSDoc tags for the export. Parameters
Returnsundefined | Array<{ name: string; text?: string; }> | |||||||||||||||||||||||
| getEnvironment | () => undefined | string | — | |||||||||||||||||||||
Get the environment of the export. Returnsundefined | string | |||||||||||||||||||||||
| getText | ({
includeDependencies,
}?: { includeDependencies?: boolean; }) => Promise<…> | — | |||||||||||||||||||||
Get the source text of the export, optionally including dependencies. Note, including dependencies can be expensive to calculate, only use when necessary. Parameters
ReturnsPromise<string>Modifiersasync | |||||||||||||||||||||||
| getPosition | () => undefined | DeclarationPosition | — | |||||||||||||||||||||
Get the start and end position of the export in the file system. Returnsundefined | DeclarationPosition | |||||||||||||||||||||||
| getEditUrl | (options?: (Pick<…> & { repository?: RepositoryConfig | string | Repository; }) | undefined) => string | — | |||||||||||||||||||||
Get the edit URL to the file export source for the configured git repository. Parameters
Returnsstring | |||||||||||||||||||||||
| getSourceUrl | (options?: (Pick<…> & { repository?: RepositoryConfig | string | Repository; }) | undefined) => string | — | |||||||||||||||||||||
Get the URL to the file export source for the configured git repository. Parameters
Returnsstring | |||||||||||||||||||||||
| getReleaseUrl | (options?: SourceReleaseUrlOptions | undefined) => Promise<…> | — | |||||||||||||||||||||
Parameters
ReturnsPromise<string>Modifiersasync | |||||||||||||||||||||||
| getRelease | (options?: SourceReleaseOptions | undefined) => Promise<…> | — | |||||||||||||||||||||
Parameters
ReturnsPromise<Release>Modifiersasync | |||||||||||||||||||||||
| getEditorUri | (options?: Omit<…> | undefined) => string | — | |||||||||||||||||||||
Get the URI to the file export source code for the configured editor. Parameters
Returnsstring | |||||||||||||||||||||||
| getFirstCommitDate | () => Promise<…> | — | |||||||||||||||||||||
Get the first git commit date that touched this export. ReturnsPromise<Date | undefined>Modifiersasync | |||||||||||||||||||||||
| getLastCommitDate | () => Promise<…> | — | |||||||||||||||||||||
Get the last git commit date that touched this export. ReturnsPromise<Date | undefined>Modifiersasync | |||||||||||||||||||||||
| getType | (filter?: TypeFilter | undefined) => Promise<…> | — | |||||||||||||||||||||
Get the resolved type of the export. Parameters
ReturnsPromise<Kind | undefined>Modifiersasync | |||||||||||||||||||||||
| getStaticValue | () => Promise<…> | — | |||||||||||||||||||||
Attempt to return a literal value for this export if it can be determined statically. ReturnsPromise<Value>Modifiersasync | |||||||||||||||||||||||
| getRuntimeValue | () => Promise<…> | — | |||||||||||||||||||||
Get the runtime value of the export. An error will be thrown if the export is not found or the configured schema validation for this file extension fails. ReturnsPromise<Value>Modifiersasync | |||||||||||||||||||||||
| getValue | () => Promise<…> | — | |||||||||||||||||||||
Get the value of this export, preferring a static value and falling back to runtime if available. ReturnsPromise<Value>Modifiersasync | |||||||||||||||||||||||
Options for a JavaScript file in the file system.
Type Parameters
| Parameter | Constraint | Default |
|---|---|---|
Types | Record<string, any> | — |
DirectoryTypes | Record<string, any> | — |
Path | string | — |
Properties
| Property | Type | Modifiers |
|---|---|---|
| loader? | ModuleLoader<Types> | — |
| path | Path | URL | — |
| basePathname? | string | null | — |
| slugCasing? | SlugCasing | — |
| depth? | number | — |
| directory? | PathLike | Directory<Types, WithDefaultTypes<Types>, DirectoryLoader, DirectoryFilter<FileSystemEntry<Types, undefined>, Types>> | — |
A JavaScript file in the file system.
Constructor
new JavaScriptFile<Types, DirectoryTypes, Path, Extension>({
loader,
...fileOptions
})Type Parameters
| Parameter | Constraint | Default |
|---|---|---|
Types | InferDefaultModuleTypes<Path> | — |
DirectoryTypes | Record<string, any> | Record<string, any> |
Path | string | string |
Extension | string | ExtractFileExtension<Path> |
Parameters
| Parameter | Type | Default Value |
|---|---|---|
| { loader, ...fileOptions } | JavaScriptFileOptions<Types, DirectoryTypes, Path> | — |
Methods
| Method | Type | Modifiers | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| parseExportValue | (name: string, value: any) => any | — | ||||||||||||
Parse and validate an export value using the configured schema if available. Parameters
Returnsany | ||||||||||||||
| getExports | () => Promise<…> | — | ||||||||||||
Get all exports from the JavaScript file. ReturnsPromise<Array<ModuleExport<Types[Extract<keyof Types, string>]>>>Modifiersasync | ||||||||||||||
| getExport | <ExportName>(name: ExportName) => Promise<…> | — | ||||||||||||
Get a JavaScript file export by name. Type Parameters
Parameters
ReturnsPromise<ModuleExport<Types[ExportName]>>Modifiersasync | ||||||||||||||
| getNamedExport | <ExportName>(name: ExportName) => Promise<…> | — | ||||||||||||
Get a named export from the JavaScript file. Type Parameters
Parameters
ReturnsPromise<ModuleExport<Types[ExportName]>>Modifiersasync | ||||||||||||||
| getDefaultExport | (this: Types extends { default: infer _DefaultType; } ? JavaScriptFile<…> : never) => Promise<…> | — | ||||||||||||
Get the default export from the JavaScript file. This TypeTypes extends { default: infer _DefaultType; } ? JavaScriptFile<Types, DirectoryTypes, Path, Extension> : neverReturnsPromise<ModuleExport<Types extends { default: infer DefaultType; } ? DefaultType : never>>Modifiersasync | ||||||||||||||
| getExportLocation | (name: string) => Promise<…> | — | ||||||||||||
Get the start position of an export in the JavaScript file. Parameters
ReturnsPromise<ModuleExport | undefined>Modifiersasync | ||||||||||||||
| getExportValue | <ExportName>(name: ExportName) => Promise<…> | — | ||||||||||||
Get the runtime value of an export in the JavaScript file. Type Parameters
Parameters
ReturnsPromise<Types[ExportName]>Modifiersasync | ||||||||||||||
| getHeadings | () => Promise<…> | — | ||||||||||||
Get headings derived from the file exports. ReturnsPromise<Headings>Modifiersasync | ||||||||||||||
| hasExport | (name: string) => Promise<…> | — | ||||||||||||
Check if an export exists in the JavaScript file statically or at runtime. Parameters
ReturnsPromise<boolean>Modifiersasync | ||||||||||||||
Extends
File<DirectoryTypes, Path, Extension>An MDX file export.
Constructor
new MDXModuleExport<Value>(name, file, loader?, slugCasing?)Type Parameters
| Parameter | Constraint | Default |
|---|---|---|
Value | — | — |
Parameters
| Parameter | Type | Default Value |
|---|---|---|
| name | string | — |
| file | MDXFile<any, Record<string, any>, string, string> | — |
| loader? | ModuleLoader<any> | undefined | — |
| slugCasing? | SlugCasing | undefined | — |
Methods
| Method | Type | Modifiers | |||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
| getName | () => string | — | |||||||||
Returnsstring | |||||||||||
| getTitle | () => string | — | |||||||||
Returnsstring | |||||||||||
| getSlug | () => string | — | |||||||||
Returnsstring | |||||||||||
| getEditorUri | (options?: Omit<…> | undefined) => string | — | |||||||||
Parameters
Returnsstring | |||||||||||
| getEditUrl | (options?: (Pick<…> & { repository?: RepositoryConfig | string | Repository; }) | undefined) => string | — | |||||||||
Parameters
Returnsstring | |||||||||||
| getSourceUrl | (options?: (Pick<…> & { repository?: RepositoryConfig | string | Repository; }) | undefined) => string | — | |||||||||
Parameters
Returnsstring | |||||||||||
| getReleaseUrl | (options?: SourceReleaseUrlOptions | undefined) => Promise<…> | — | |||||||||
Parameters
ReturnsPromise<string>Modifiersasync | |||||||||||
| getRelease | (options?: SourceReleaseOptions | undefined) => Promise<…> | — | |||||||||
Parameters
ReturnsPromise<Release>Modifiersasync | |||||||||||
| parseExportValue | (name: string, value: any) => any | — | |||||||||
Parse and validate an export value using the configured schema if available. Parameters
Returnsany | |||||||||||
| getStaticValue | () => Promise<…> | — | |||||||||
Attempt to return a literal value for this export if it can be determined statically. ReturnsPromise<Value>Modifiersasync | |||||||||||
| getRuntimeValue | () => Promise<…> | — | |||||||||
Get the runtime value of the export. An error will be thrown if the export is not found or the configured schema validation for the MDX file fails. ReturnsPromise<Value>Modifiersasync | |||||||||||
| getValue | () => Promise<…> | — | |||||||||
Get the value of this export, preferring a static value and falling back to runtime if available. ReturnsPromise<Value>Modifiersasync | |||||||||||
Options for an MDX file in the file system.
Type Parameters
| Parameter | Constraint | Default |
|---|---|---|
Types | Record<string, any> | — |
DirectoryTypes | Record<string, any> | — |
Path | string | — |
Properties
| Property | Type | Modifiers |
|---|---|---|
| loader? | ModuleLoader<{ default: MDXContent; } & Types> | — |
| path | Path | URL | — |
| basePathname? | string | null | — |
| slugCasing? | SlugCasing | — |
| depth? | number | — |
| directory? | PathLike | Directory<Types, WithDefaultTypes<Types>, DirectoryLoader, DirectoryFilter<FileSystemEntry<Types, undefined>, Types>> | — |
An MDX file in the file system.
Constructor
new MDXFile<Types, DirectoryTypes, Path, Extension>({
loader,
...fileOptions
})Type Parameters
| Parameter | Constraint | Default |
|---|---|---|
Types | Record<string, any> | { default: MDXContent; } |
DirectoryTypes | Record<string, any> | Record<string, any> |
Path | string | string |
Extension | string | ExtractFileExtension<Path> |
Parameters
| Parameter | Type | Default Value |
|---|---|---|
| { loader, ...fileOptions } | MDXFileOptions<{ default: MDXContent; } & Types, DirectoryTypes, Path> | — |
Methods
| Method | Type | Modifiers | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| getText | () => Promise<…> | — | ||||||||||||
ReturnsPromise<string>Modifiersasync | ||||||||||||||
| getFrontMatter | () => Promise<…> | — | ||||||||||||
ReturnsPromise<Record<string, unknown> | undefined>Modifiersasync | ||||||||||||||
| getChatGPTUrl | () => Promise<…> | — | ||||||||||||
ReturnsPromise<string>Modifiersasync | ||||||||||||||
| getClaudeUrl | () => Promise<…> | — | ||||||||||||
ReturnsPromise<string>Modifiersasync | ||||||||||||||
| getExports | () => Promise<…> | — | ||||||||||||
ReturnsPromise<Array<MDXModuleExport<any>>>Modifiersasync | ||||||||||||||
| getExport | <ExportName>(name: ExportName) => Promise<…> | — | ||||||||||||
Type Parameters
Parameters
ReturnsPromise<MDXModuleExport<({ default: MDXContent; } & Types)[ExportName]>>Modifiersasync | ||||||||||||||
| getNamedExport | <ExportName>(name: ExportName) => Promise<…> | — | ||||||||||||
Get a named export from the MDX file. Type Parameters
Parameters
ReturnsPromise<MDXModuleExport<Types[ExportName]>>Modifiersasync | ||||||||||||||
| getDefaultExport | () => Promise<…> | — | ||||||||||||
Get the default export from the MDX file. ReturnsPromise<MDXContent>Modifiersasync | ||||||||||||||
| getContent | () => Promise<…> | — | ||||||||||||
Get the rendered MDX content. ReturnsPromise<MDXContent>Modifiersasync | ||||||||||||||
| getHeadings | () => Promise<…> | — | ||||||||||||
Get headings parsed from the MDX content. ReturnsPromise<Headings>Modifiersasync | ||||||||||||||
| hasExport | (name: string) => Promise<…> | — | ||||||||||||
Check if an export exists at runtime in the MDX file. Parameters
ReturnsPromise<boolean>Modifiersasync | ||||||||||||||
| getExportValue | <ExportName>(name: ExportName) => Promise<…> | — | ||||||||||||
Get the runtime value of an export in the MDX file. Type Parameters
Parameters
ReturnsPromise<({ default: MDXContent; } & Types)[ExportName]>Modifiersasync | ||||||||||||||
| getStaticExportValue | (name: string) => Promise<…> | — | ||||||||||||
Attempt to return a literal value for a named export if it can be determined statically. Parameters
ReturnsPromise<unknown>Modifiersasync | ||||||||||||||
Extends
File<DirectoryTypes, Path, Extension>Options for a Markdown file in the file system.
Type Parameters
| Parameter | Constraint | Default |
|---|---|---|
Types | Record<string, any> | — |
DirectoryTypes | Record<string, any> | — |
Path | string | — |
Properties
| Property | Type | Modifiers |
|---|---|---|
| loader? | ModuleLoader<{ default: MDXContent; } & Types> | — |
| path | Path | URL | — |
| basePathname? | string | null | — |
| slugCasing? | SlugCasing | — |
| depth? | number | — |
| directory? | PathLike | Directory<Types, WithDefaultTypes<Types>, DirectoryLoader, DirectoryFilter<FileSystemEntry<Types, undefined>, Types>> | — |
A Markdown file in the file system.
Constructor
new MarkdownFile<Types, DirectoryTypes, Path, Extension>({
loader,
...fileOptions
})Type Parameters
| Parameter | Constraint | Default |
|---|---|---|
Types | Record<string, any> | { default: MDXContent; } |
DirectoryTypes | Record<string, any> | Record<string, any> |
Path | string | string |
Extension | string | ExtractFileExtension<Path> |
Parameters
| Parameter | Type | Default Value |
|---|---|---|
| { loader, ...fileOptions } | MarkdownFileOptions<{ default: MDXContent; } & Types, DirectoryTypes, Path> | — |
Methods
| Method | Type | Modifiers | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| getText | () => Promise<…> | — | ||||||||||||
ReturnsPromise<string>Modifiersasync | ||||||||||||||
| getFrontMatter | () => Promise<…> | — | ||||||||||||
ReturnsPromise<Record<string, unknown> | undefined>Modifiersasync | ||||||||||||||
| getChatGPTUrl | () => Promise<…> | — | ||||||||||||
ReturnsPromise<string>Modifiersasync | ||||||||||||||
| getClaudeUrl | () => Promise<…> | — | ||||||||||||
ReturnsPromise<string>Modifiersasync | ||||||||||||||
| getContent | () => Promise<…> | — | ||||||||||||
Get the rendered markdown content. ReturnsPromise<MDXContent>Modifiersasync | ||||||||||||||
| getHeadings | () => Promise<…> | — | ||||||||||||
Get headings parsed from the markdown content. ReturnsPromise<Headings>Modifiersasync | ||||||||||||||
| getExportValue | <ExportName>(name: ExportName) => Promise<…> | — | ||||||||||||
Get the runtime value of an export in the Markdown file. (Permissive signature for union compatibility.) Type Parameters
Parameters
ReturnsPromise<({ default: MDXContent; } & Types)[ExportName]>Modifiersasync | ||||||||||||||
Extends
File<DirectoryTypes, Path, Extension>Type
(entry: FileSystemEntry<Types>) => entry is Entry | (entry: FileSystemEntry<Types>) => Promise<boolean> | boolean | stringType Parameters
| Parameter | Constraint | Default |
|---|---|---|
Types | InferDirectoryLoaderTypes<Loaders> | any |
LoaderTypes | Types | any |
Loaders | ModuleLoaders | ModuleRuntimeLoader<any> | ModuleLoaders | ModuleRuntimeLoader<any> |
Filter | DirectoryFilter<FileSystemEntry<LoaderTypes, undefined>, LoaderTypes> | DirectoryFilter<FileSystemEntry<LoaderTypes, undefined>, LoaderTypes> |
Properties
| Property | Type | Modifiers |
|---|---|---|
| path? | PathLike | — |
Directory path in the workspace. | ||
| filter? | Filter | — |
Filter entries with a minimatch pattern or predicate. | ||
| loader? | Loaders | () => Loaders | — |
Extension loaders with or without | ||
| basePathname? | string | null | — |
Base route prepended to descendant | ||
| tsConfigPath? | string | — |
Uses the closest | ||
| slugCasing? | SlugCasing | — |
Slug casing applied to route segments. | ||
| fileSystem? | FileSystem | — |
Custom file‑system adapter. | ||
| sort? | SortDescriptor<ResolveDirectoryFilterEntries<Filter, LoaderTypes>> | — |
Sort callback applied at each directory depth. | ||
| repository? | Repository | RepositoryConfig | string | — |
The repository used to generate source URLs. | ||
A directory containing files and subdirectories in the file system.
Constructor
new Directory<Types, LoaderTypes, Loaders, Filter>(options?)Type Parameters
| Parameter | Constraint | Default |
|---|---|---|
Types | InferDirectoryLoaderTypes<Loaders> | — |
LoaderTypes | WithDefaultTypes<Types> | WithDefaultTypes<Types> |
Loaders | ModuleLoaders | ModuleRuntimeLoader<any> | ModuleLoaders | ModuleRuntimeLoader<any> |
Filter | DirectoryFilter<FileSystemEntry<LoaderTypes, undefined>, LoaderTypes> | DirectoryFilter<FileSystemEntry<LoaderTypes, undefined>, LoaderTypes> |
Parameters
| Parameter | Type | Default Value |
|---|---|---|
| options? | DirectoryOptions<Types, LoaderTypes, Loaders, Filter> | — |
Methods
| Method | Type | Modifiers | |||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| getFilterPatternKind | () => "recursive" | "shallow" | null | — | |||||||||||||||||||||||||||||||||
Returns the glob filter pattern kind for this directory if defined. Returns"recursive" | "shallow" | null | |||||||||||||||||||||||||||||||||||
| getFileSystem | () => FileSystem | — | |||||||||||||||||||||||||||||||||
Get the file system for this directory. ReturnsFileSystem | |||||||||||||||||||||||||||||||||||
| getRepository | (repository?: RepositoryConfig | string | Repository) => Repository | — | |||||||||||||||||||||||||||||||||
Get the Parameters
ReturnsRepository | |||||||||||||||||||||||||||||||||||
| getDepth | () => number | — | |||||||||||||||||||||||||||||||||
Get the depth of the directory starting from the root directory. Returnsnumber | |||||||||||||||||||||||||||||||||||
| getFile | <Path, Extension>(path: Path) => Promise<…> (+1 overload) | — | |||||||||||||||||||||||||||||||||
Overload 1Get a file at the specified If the file is not found, an error will be thrown. Use Type Parameters
Parameters
ReturnsPromise<Extension extends string ? IsJavaScriptLikeExtension<Extension> extends true ? JavaScriptFile<Extension extends keyof LoaderTypes ? InferDefaultModuleTypes<Extension> & LoaderTypes[Extension] : InferDefaultModuleTypes<Extension>, LoaderTypes, string, Extension> : Extension extends "mdx" ? MDXFile<LoaderTypes["mdx"], LoaderTypes, string, Extension> : Extension extends "md" ? MarkdownFile<LoaderTypes["md"], LoaderTypes, string, Extension> : Extension extends "json" ? JSONFile<JSONExtensionType<LoaderTypes>, LoaderTypes, string, Extension> : File<LoaderTypes, Path, Extension> : File<LoaderTypes, string, string>>ModifiersasyncOverload 2Type Parameters
Parameters
ReturnsPromise<Extension extends string ? IsJavaScriptLikeExtension<Extension> extends true ? JavaScriptFile<Extension extends keyof LoaderTypes ? InferDefaultModuleTypes<Extension> & LoaderTypes[Extension] : InferDefaultModuleTypes<Extension>, LoaderTypes, string, Extension> : Extension extends "mdx" ? MDXFile<LoaderTypes["mdx"], LoaderTypes, string, Extension> : Extension extends "md" ? MarkdownFile<LoaderTypes["md"], LoaderTypes, string, Extension> : Extension extends "json" ? JSONFile<JSONExtensionType<LoaderTypes>, LoaderTypes, string, Extension> : File<LoaderTypes, Extension, ExtractFileExtension<Extension>> : File<LoaderTypes, string, string>>Modifiersasync | |||||||||||||||||||||||||||||||||||
| getDirectory | (path: string | Array<…>) => Promise<…> | — | |||||||||||||||||||||||||||||||||
Get a directory at the specified Parameters
ReturnsPromise<Directory<LoaderTypes, WithDefaultTypes<LoaderTypes>, DirectoryLoader, DirectoryFilter<FileSystemEntry<WithDefaultTypes<LoaderTypes>, undefined>, WithDefaultTypes<LoaderTypes>>>>Modifiersasync | |||||||||||||||||||||||||||||||||||
| getEntry | (path: string | Array<…>) => Promise<…> | — | |||||||||||||||||||||||||||||||||
Get a directory or file at the specified
Parameters
ReturnsPromise<FileSystemEntry<LoaderTypes, undefined>>Modifiersasync | |||||||||||||||||||||||||||||||||||
| invalidateSnapshots | () => void | — | |||||||||||||||||||||||||||||||||
Returnsvoid | |||||||||||||||||||||||||||||||||||
| getEntries | (options?: { recursive?: Filter extends string ? Filter extends `**${string}` ? boolean : undefined : boolean; includeDirectoryNamedFiles?: boolean; includeIndexAndReadmeFiles?: boolean; includeGitIgnoredFiles?: boolean; includeTsConfigExcludedFiles?: boolean; }) => Promise<…> | — | |||||||||||||||||||||||||||||||||
Retrieves all entries (files and directories) within the current directory
that are not excluded by Git ignore rules or the closest Parameters
ReturnsPromise<Array<Filter extends string ? Filter extends `**${string}` ? Directory<LoaderTypes, WithDefaultTypes<LoaderTypes>, DirectoryLoader, DirectoryFilter<FileSystemEntry<WithDefaultTypes<LoaderTypes>, undefined>, WithDefaultTypes<LoaderTypes>>> | FileWithExtension<LoaderTypes, ExtractFileExtension<Filter>> : FileWithExtension<LoaderTypes, ExtractFileExtension<Filter>> : Filter extends DirectoryFilter<infer FilteredEntry extends FileSystemEntry<any, undefined>, LoaderTypes> ? FilteredEntry : FileSystemEntry<LoaderTypes, undefined>>>Modifiersasync | |||||||||||||||||||||||||||||||||||
| getRootPath | () => string | — | |||||||||||||||||||||||||||||||||
Get the root directory path. Returnsstring | |||||||||||||||||||||||||||||||||||
| getParent | () => Directory<…> | — | |||||||||||||||||||||||||||||||||
Get the parent directory containing this directory. ReturnsDirectory<any, any, any, DirectoryFilter<FileSystemEntry<any, undefined>, any>> | |||||||||||||||||||||||||||||||||||
| getSiblings | <GroupTypes>(options?: { collection?: Collection<…>; }) => Promise<…> | — | |||||||||||||||||||||||||||||||||
Get the previous and next sibling entries (files or directories) of the parent directory. Type Parameters
Parameters
ReturnsPromise<[FileSystemEntry<LoaderTypes, undefined> | undefined, FileSystemEntry<LoaderTypes, undefined> | undefined]>Modifiersasync | |||||||||||||||||||||||||||||||||||
| getSlug | () => string | — | |||||||||||||||||||||||||||||||||
Get the slug of this directory. Returnsstring | |||||||||||||||||||||||||||||||||||
| getName | () => string | — | |||||||||||||||||||||||||||||||||
Get the base name of this directory. Returnsstring | |||||||||||||||||||||||||||||||||||
| getBaseName | () => string | — | |||||||||||||||||||||||||||||||||
Get the base name of this directory. Returnsstring | |||||||||||||||||||||||||||||||||||
| getTitle | () => string | — | |||||||||||||||||||||||||||||||||
The directory name formatted as a title. Returnsstring | |||||||||||||||||||||||||||||||||||
| getPathname | (options?: { includeBasePathname?: boolean; }) => string | — | |||||||||||||||||||||||||||||||||
Get a URL-friendly path to this directory. Parameters
Returnsstring | |||||||||||||||||||||||||||||||||||
| getPathnameSegments | (options?: { includeBasePathname?: boolean; }) => Array<…> | — | |||||||||||||||||||||||||||||||||
Get the route path segments to this directory. Parameters
ReturnsArray<string> | |||||||||||||||||||||||||||||||||||
| getRelativePathToRoot | () => string | — | |||||||||||||||||||||||||||||||||
Get the relative path of this directory to the root directory. Returnsstring | |||||||||||||||||||||||||||||||||||
| getRelativePathToWorkspace | () => string | — | |||||||||||||||||||||||||||||||||
Get the relative path of the directory to the workspace. Returnsstring | |||||||||||||||||||||||||||||||||||
| getAbsolutePath | () => string | — | |||||||||||||||||||||||||||||||||
Get the absolute path of this directory. Returnsstring | |||||||||||||||||||||||||||||||||||
| getHistoryUrl | (options?: (Pick<…> & { repository?: RepositoryConfig | string | Repository; }) | undefined) => string | — | |||||||||||||||||||||||||||||||||
Get the URL to the directory history for the configured git repository. Parameters
Returnsstring | |||||||||||||||||||||||||||||||||||
| getSourceUrl | (options?: (Pick<…> & { repository?: RepositoryConfig | string | Repository; }) | undefined) => string | — | |||||||||||||||||||||||||||||||||
Get the URL to the directory source for the configured git repository. Parameters
Returnsstring | |||||||||||||||||||||||||||||||||||
| getReleaseUrl | (options?: SourceReleaseUrlOptions | undefined) => Promise<…> | — | |||||||||||||||||||||||||||||||||
Get a release URL for the configured git repository. Parameters
ReturnsPromise<string>Modifiersasync | |||||||||||||||||||||||||||||||||||
| getRelease | (options?: SourceReleaseOptions | undefined) => Promise<…> | — | |||||||||||||||||||||||||||||||||
Retrieve metadata about a release for the configured git repository. Parameters
ReturnsPromise<Release>Modifiersasync | |||||||||||||||||||||||||||||||||||
| getEditorUri | (options?: Pick<…> | undefined) => string | — | |||||||||||||||||||||||||||||||||
Get the URI to the directory source code for the configured editor. Parameters
Returnsstring | |||||||||||||||||||||||||||||||||||
| getFirstCommitDate | () => Promise<…> | — | |||||||||||||||||||||||||||||||||
Get the first local git commit date of this directory. ReturnsPromise<Date | undefined>Modifiersasync | |||||||||||||||||||||||||||||||||||
| getLastCommitDate | () => Promise<…> | — | |||||||||||||||||||||||||||||||||
Get the last local git commit date of this directory. ReturnsPromise<Date | undefined>Modifiersasync | |||||||||||||||||||||||||||||||||||
| getAuthors | () => Promise<…> | — | |||||||||||||||||||||||||||||||||
Get the local git authors of this directory. ReturnsPromise<Array<GitAuthor>>Modifiersasync | |||||||||||||||||||||||||||||||||||
| hasEntry | (entry: FileSystemEntry<…> | undefined) => boolean | — | |||||||||||||||||||||||||||||||||
Checks if this directory contains the provided entry. Parameters
Returnsboolean | |||||||||||||||||||||||||||||||||||
| hasFile | <ExtensionType, Extension>(entry: FileSystemEntry<…> | undefined, extension?: Extension | Array<…>) => boolean | — | |||||||||||||||||||||||||||||||||
Checks if this directory contains the provided file. Type Parameters
Parameters
Returnsboolean | |||||||||||||||||||||||||||||||||||
Options for a Collection.
Type Parameters
| Parameter | Constraint | Default |
|---|---|---|
Entries | Array<FileSystemEntry<any, undefined>> | — |
Properties
| Property | Type | Modifiers |
|---|---|---|
| entries | Entries | — |
A group of file system entries.
Constructor
new Collection<Types, Entries, Loaders>(options)Type Parameters
| Parameter | Constraint | Default |
|---|---|---|
Types | InferModuleLoadersTypes<Loaders> | — |
Entries | Array<FileSystemEntry<any, undefined>> | Array<FileSystemEntry<any, undefined>> |
Loaders | ModuleLoaders | {} | ModuleLoaders |
Parameters
| Parameter | Type | Default Value |
|---|---|---|
| options | CollectionOptions<Entries> | — |
Methods
| Method | Type | Modifiers | |||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| getEntries | (options?: { recursive?: boolean; includeIndexAndReadmeFiles?: boolean; }) => Promise<…> | — | |||||||||||||||
Get all entries in the group. Parameters
ReturnsPromise<Entries>Modifiersasync | |||||||||||||||||
| getEntry | (path: string | Array<…>) => Promise<…> | — | |||||||||||||||
Get an entry in the group by its path. Parameters
ReturnsPromise<FileSystemEntry<Types, undefined>>Modifiersasync | |||||||||||||||||
| getFile | <Extension>(path: string | Array<…>, extension?: Extension | Array<…>) => Promise<…> | — | |||||||||||||||
Get a file at the specified path and optional extension(s). Type Parameters
Parameters
ReturnsPromise<Extension extends string ? IsJavaScriptLikeExtension<Extension> extends true ? JavaScriptFile<Types[Extension], Record<string, any>, string, string> : Extension extends "mdx" ? MDXFile<Types["mdx"], Record<string, any>, string, string> : Extension extends "md" ? MarkdownFile<Types["md"], Record<string, any>, string, string> : File<Types, string, string> : File<Types, string, string>>Modifiersasync | |||||||||||||||||
| getDirectory | (path: string | Array<…>) => Promise<…> | — | |||||||||||||||
Get a directory at the specified path. Parameters
ReturnsPromise<Directory<Types, WithDefaultTypes<Types>, DirectoryLoader, DirectoryFilter<FileSystemEntry<WithDefaultTypes<Types>, undefined>, WithDefaultTypes<Types>>>>Modifiersasync | |||||||||||||||||
Determines if a FileSystemEntry is a Directory.
Type Parameters
| Parameter | Constraint | Default |
|---|---|---|
Types | Record<string, any> | — |
Parameters
| Parameter | Type | Default Value |
|---|---|---|
| entry | FileSystemEntry<Types, undefined> | Collection<Types, Array<FileSystemEntry<any, undefined>>, {}> | undefined | — |
Returns
booleanType
FileWithExtension<Types, Extension>Type
ExtensionUnion | Array<ExtensionUnion>Determines if a FileSystemEntry is a File and optionally narrows the
result based on the provided extensions.
Type Parameters
| Parameter | Constraint | Default |
|---|---|---|
Types | Record<string, any> | — |
Extension | LoadersToExtensions<Types, StringUnion<keyof Types>> | — |
Parameters
| Parameter | Type | Default Value |
|---|---|---|
| entry | FileSystemEntry<Types, undefined> | undefined | — |
| extension? | Extension | — |
Returns
booleanDetermines if a FileSystemEntry is a JavaScriptFile.
Type Parameters
| Parameter | Constraint | Default |
|---|---|---|
FileTypes | Record<string, any> | — |
DirectoryTypes | Record<string, any> | Record<string, any> |
Parameters
| Parameter | Type | Default Value |
|---|---|---|
| entry | FileSystemEntry<DirectoryTypes, undefined> | undefined | — |
Returns
booleanDetermines if a FileSystemEntry is a MarkdownFile.
Type Parameters
| Parameter | Constraint | Default |
|---|---|---|
FileTypes | Record<string, any> | — |
DirectoryTypes | Record<string, any> | Record<string, any> |
Parameters
| Parameter | Type | Default Value |
|---|---|---|
| entry | FileSystemEntry<DirectoryTypes, undefined> | undefined | — |
Returns
booleanDetermines if a FileSystemEntry is a JSONFile.
Type Parameters
| Parameter | Constraint | Default |
|---|---|---|
FileTypes | Record<string, any> | — |
DirectoryTypes | Record<string, any> | Record<string, any> |
Parameters
| Parameter | Type | Default Value |
|---|---|---|
| entry | FileSystemEntry<DirectoryTypes, undefined> | undefined | — |
Returns
booleanDetermines if a FileSystemEntry is an MDXFile.
Type Parameters
| Parameter | Constraint | Default |
|---|---|---|
FileTypes | Record<string, any> | — |
DirectoryTypes | Record<string, any> | Record<string, any> |
Parameters
| Parameter | Type | Default Value |
|---|---|---|
| entry | FileSystemEntry<DirectoryTypes, undefined> | undefined | — |
Returns
booleanAttempts to resolve a file from a FileSystemEntry, preferring index and
readme for directories. The result can be optionally narrowed by extension.
Type Parameters
| Parameter | Constraint | Default |
|---|---|---|
Types | Record<string, any> | — |
Extension | keyof Types & string | string |
Parameters
| Parameter | Type | Default Value |
|---|---|---|
| entry | FileSystemEntry<Types, undefined> | — |
| extension? | Extension | ReadonlyArray<Extension> | — |
Returns
Promise<FileWithExtension<Types, Extension> | undefined>Modifiers
asyncType
ValidSortKey<EntryTypes<Entry>> | SortKeyExtractor<Entry> | SortDescriptorObject<EntryTypes<Entry>, Entry, ValidSortKey<EntryTypes<Entry>> | SortKeyExtractor<Entry>>Compiles a set of sort descriptors into a sort function.
Type Parameters
| Parameter | Constraint | Default |
|---|---|---|
ExtensionTypes | Record<string, any> | — |
Parameters
| Parameter | Type | Default Value |
|---|---|---|
| entries | Array<FileSystemEntry<ExtensionTypes, undefined>> | — |
| descriptor | SortDescriptor<any> | — |
Returns
Promise<void>Modifiers
asyncType Parameters
| Parameter | Constraint | Default |
|---|---|---|
Entry | FileSystemEntry<any, undefined> | — |
Key | SortKeyExtractor<Entry> | SortKeyExtractor<Entry> |
Parameters
| Parameter | Type | Default Value |
|---|---|---|
| key | Key | — |
| compare? | (a: ExtractComparable<Key>, b: ExtractComparable<Key>) => number | — |
Returns
SortDescriptorObject<any, Entry, Key>Type Parameters
| Parameter | Constraint | Default |
|---|---|---|
Types | InferDirectoryLoaderTypes<Loaders> | — |
LoaderTypes | WithDefaultTypes<Types> | — |
Loaders | ModuleLoaders | ModuleRuntimeLoader<any> | — |
Filter | DirectoryFilter<FileSystemEntry<LoaderTypes, undefined>, LoaderTypes> | — |
Properties
| Property | Type | Modifiers |
|---|---|---|
| path? | PathLike | — |
| repository? | Repository | RepositoryConfig | string | — |
The repository used to generate source URLs. | ||
| sort? | SortDescriptor<ResolveDirectoryFilterEntries<Filter, LoaderTypes>> | — |
Sort callback applied at each directory depth. | ||
| filter? | Filter | — |
Filter entries with a minimatch pattern or predicate. | ||
| loader? | Loaders | () => Loaders | — |
Extension loaders with or without | ||
| basePathname? | string | null | — |
Base route prepended to descendant | ||
| tsConfigPath? | string | — |
Uses the closest | ||
| slugCasing? | SlugCasing | — |
Slug casing applied to route segments. | ||
Type Parameters
| Parameter | Constraint | Default |
|---|---|---|
Types | InferDirectoryLoaderTypes<Loaders> | — |
LoaderTypes | WithDefaultTypes<Types> | — |
Loaders | ModuleLoaders | ModuleRuntimeLoader<any> | — |
Filter | DirectoryFilter<FileSystemEntry<LoaderTypes, undefined>, LoaderTypes> | — |
ExportLoaders | Record<
string,
PackageExportLoader<ModuleExports<any>>
> | {} |
Properties
| Property | Type | Modifiers |
|---|---|---|
| name? | string | — |
| path? | PathLike | — |
| directory? | PathLike | Directory<any, any, any, DirectoryFilter<FileSystemEntry<any, undefined>, any>> | — |
| sourcePath? | PathLike | null | — |
| fileSystem? | FileSystem | — |
| exports? | Record<string, PackageExportOptions<Types, LoaderTypes, Loaders, Filter>> | — |
| repository? | RepositoryConfig | string | Repository | — |
| loader? | ExportLoaders | PackageExportLoader<ModuleExports<any>> | — |
Optional runtime loaders for individual package exports or a resolver that will be invoked with the export path (e.g. “remark/add-headings”). | ||
Type
PackageEntryPathTarget | PackageEntrySpecifierTarget | PackageEntryConditionTarget | PackageEntryArrayTarget | PackageEntryNullTarget | PackageEntryUnknownTargetProperties
| Property | Type | Modifiers |
|---|---|---|
| kind | "path" | — |
| relativePath | string | — |
| absolutePath | string | — |
| isPattern | boolean | — |
Properties
| Property | Type | Modifiers |
|---|---|---|
| kind | "specifier" | — |
| specifier | string | — |
Properties
| Property | Type | Modifiers |
|---|---|---|
| kind | "conditions" | — |
| entries | Array<{ condition: string; target: PackageEntryTargetNode; }> | — |
Properties
| Property | Type | Modifiers |
|---|---|---|
| kind | "array" | — |
| targets | Array<PackageEntryTargetNode> | — |
Properties
| Property | Type | Modifiers |
|---|---|---|
| kind | "null" | — |
Properties
| Property | Type | Modifiers |
|---|---|---|
| kind | "unknown" | — |
| value | unknown | — |
Properties
| Property | Type | Modifiers |
|---|---|---|
| key | string | — |
| type | "exports" | "imports" | — |
| source | "manifest" | "override" | — |
| isPattern | boolean | — |
| manifestTarget? | PackageEntryTargetNode | — |
Properties
| Property | Type | Modifiers |
|---|---|---|
| type | "exports" | — |
| derivedAbsolutePath | string | — |
| derivedRelativePath | string | — |
| key | string | — |
| source | "manifest" | "override" | — |
| isPattern | boolean | — |
| manifestTarget? | PackageEntryTargetNode | — |
Properties
| Property | Type | Modifiers |
|---|---|---|
| type | "imports" | — |
| key | string | — |
| source | "manifest" | "override" | — |
| isPattern | boolean | — |
| manifestTarget? | PackageEntryTargetNode | — |
Type Parameters
| Parameter | Constraint | Default |
|---|---|---|
Types | InferDirectoryLoaderTypes<Loaders> | — |
LoaderTypes | WithDefaultTypes<Types> | WithDefaultTypes<Types> |
Loaders | ModuleLoaders | ModuleRuntimeLoader<any> | ModuleLoaders | ModuleRuntimeLoader<any> |
Filter | DirectoryFilter<FileSystemEntry<LoaderTypes, undefined>, LoaderTypes> | DirectoryFilter<FileSystemEntry<LoaderTypes, undefined>, LoaderTypes> |
Properties
| Property | Type | Modifiers |
|---|---|---|
| getExportPath | { (): string; (): string; } | — |
| getAnalysis | { (): PackageExportAnalysis | undefined; (): PackageExportAnalysis | undefined; } | — |
| #exportPath | string | — |
| #analysis? | PackageExportAnalysis | — |
| #path | string | — |
| #rootPath? | string | — |
| #basePathname? | null | string | — |
| #tsConfigPath? | string | — |
| #slugCasing | "none" | "kebab" | "snake" | — |
| #loader? | Loaders | () => Loaders | — |
| #resolvedLoaders? | ModuleLoaders | ModuleRuntimeLoader<any> | — |
| #directory? | Directory<any, any, any, DirectoryFilter<FileSystemEntry<any, undefined>, any>> | — |
| #fileSystem | undefined | FileSystem | — |
| #repository | undefined | Repository | — |
| #repositoryOption? | string | RepositoryConfig | Repository | — |
| #filterPattern? | string | — |
| #filter? | Minimatch | (entry: FileSystemEntry<LoaderTypes, undefined>) => entry is FileSystemEntry<LoaderTypes, undefined> | (entry: FileSystemEntry<LoaderTypes, undefined>) => Promise<boolean> | boolean | — |
| #filterCache? | WeakMap<FileSystemEntry<LoaderTypes, undefined>, boolean> | — |
| #simpleFilter? | { recursive: boolean; extensions: Set<string>; } | — |
| #sort? | any | — |
| getFilterPatternKind | () => "recursive" | "shallow" | null | — |
Returns the glob filter pattern kind for this directory if defined. | ||
| #passesFilter | (entry: FileSystemEntry<LoaderTypes, undefined>) => Promise<boolean> | — |
| #shouldIncludeFile | (entry: FileSystemEntry<LoaderTypes, undefined>) => Promise<boolean> | — |
| #duplicate | (options?: DirectoryOptions<any, any, any>) => Directory<LoaderTypes, LoaderTypes, Loaders, DirectoryFilter<FileSystemEntry<LoaderTypes, undefined>, LoaderTypes>> | — |
Duplicate the directory with the same initial options. | ||
| #getLoaders | () => ModuleLoaders | ModuleRuntimeLoader<any> | undefined | — |
Resolve the loaders map when a factory is provided and cache the result. | ||
| getFileSystem | () => FileSystem | — |
Get the file system for this directory. | ||
| getRepository | (repository?: RepositoryConfig | string | Repository) => Repository | — |
Get the | ||
| getDepth | () => number | — |
Get the depth of the directory starting from the root directory. | ||
| #readDirectoryShallowForTraversal | (directory: Directory<LoaderTypes, WithDefaultTypes<LoaderTypes>, DirectoryLoader, DirectoryFilter<FileSystemEntry<WithDefaultTypes<LoaderTypes>, undefined>, WithDefaultTypes<LoaderTypes>>>) => Promise<Array<FileSystemEntry<LoaderTypes, undefined>>> | — |
Perform a shallow, filter-free read of a directory’s immediate children. This is used for path traversal to avoid expensive recursive inclusion checks. | ||
| #findEntry | (directory: Directory<LoaderTypes, WithDefaultTypes<LoaderTypes>, DirectoryLoader, DirectoryFilter<FileSystemEntry<WithDefaultTypes<LoaderTypes>, undefined>, WithDefaultTypes<LoaderTypes>>>, segments: string[], allExtensions?: string[]) => Promise<FileSystemEntry<LoaderTypes, undefined>> | — |
Walk | ||
| getFile | { <const Path extends string, Extension extends ExtractFileExtension<Path> = ExtractFileExtension<Path>>(path: Path): Promise<Extension extends string ? IsJavaScriptLikeExtension<Extension> extends true ? JavaScriptFile<Extension extends keyof LoaderTypes ? InferDefaultModuleTypes<Extension> & LoaderTypes[Extension] : InferDefaultModuleTypes<Extension>, LoaderTypes, string, Extension> : Extension extends "mdx" ? MDXFile<LoaderTypes["mdx"], LoaderTypes, string, Extension> : Extension extends "md" ? MarkdownFile<LoaderTypes["md"], LoaderTypes, string, Extension> : Extension extends "json" ? JSONFile<JSONExtensionType<LoaderTypes>, LoaderTypes, string, Extension> : File<LoaderTypes, Path, Extension> : File<LoaderTypes, string, string>>; <ExtensionType extends string | keyof LoaderTypes, const Extension extends ExtensionType | Array<Extension>>(path: string | string[], extension?: Extension | Array<Extension> | undefined): Promise<Extension extends string ? IsJavaScriptLikeExtension<Extension> extends true ? JavaScriptFile<Extension extends keyof LoaderTypes ? InferDefaultModuleTypes<Extension> & LoaderTypes[Extension] : InferDefaultModuleTypes<Extension>, LoaderTypes, string, Extension> : Extension extends "mdx" ? MDXFile<LoaderTypes["mdx"], LoaderTypes, string, Extension> : Extension extends "md" ? MarkdownFile<LoaderTypes["md"], LoaderTypes, string, Extension> : Extension extends "json" ? JSONFile<JSONExtensionType<LoaderTypes>, LoaderTypes, string, Extension> : File<LoaderTypes, Extension, ExtractFileExtension<Extension>> : File<LoaderTypes, string, string>>; } | — |
| getDirectory | (path: string | string[]) => Promise<Directory<LoaderTypes, WithDefaultTypes<LoaderTypes>, DirectoryLoader, DirectoryFilter<FileSystemEntry<WithDefaultTypes<LoaderTypes>, undefined>, WithDefaultTypes<LoaderTypes>>>> | — |
Get a directory at the specified | ||
| getEntry | (path: string | string[]) => Promise<FileSystemEntry<LoaderTypes, undefined>> | — |
Get a directory or file at the specified
| ||
| #snapshotCache | Map<number, DirectorySnapshot<LoaderTypes>> | — |
| #pathLookup | Map<string, FileSystemEntry<LoaderTypes, undefined>> | — |
| #addPathLookup | (entry: FileSystemEntry<LoaderTypes, undefined>) => void | — |
Add an entry to the path lookup table. This avoids the need to traverse the entire directory tree to find a file or directory that has already been created. | ||
| invalidateSnapshots | () => void | — |
| getEntries | (options?: { recursive?: (Filter extends string ? Filter extends `**${string}` ? boolean : undefined : boolean) | undefined; includeDirectoryNamedFiles?: boolean; includeIndexAndReadmeFiles?: boolean; includeGitIgnoredFiles?: boolean; includeTsConfigExcludedFiles?: boolean; } | undefined) => Promise<Array<Filter extends string ? Filter extends `**${string}` ? Directory<LoaderTypes, WithDefaultTypes<LoaderTypes>, DirectoryLoader, DirectoryFilter<FileSystemEntry<WithDefaultTypes<LoaderTypes>, undefined>, WithDefaultTypes<LoaderTypes>>> | FileWithExtension<LoaderTypes, ExtractFileExtension<Filter>> : FileWithExtension<LoaderTypes, ExtractFileExtension<Filter>> : Filter extends DirectoryFilter<infer FilteredEntry extends FileSystemEntry<any, undefined>, LoaderTypes> ? FilteredEntry : FileSystemEntry<LoaderTypes, undefined>>> | — |
Retrieves all entries (files and directories) within the current directory
that are not excluded by Git ignore rules or the closest | ||
| #normalizeEntriesOptions | (options?: { recursive?: boolean; includeDirectoryNamedFiles?: boolean; includeIndexAndReadmeFiles?: boolean; includeGitIgnoredFiles?: boolean; includeTsConfigExcludedFiles?: boolean; }) => NormalizedDirectoryEntriesOptions | — |
| #hydrateDirectorySnapshot | (directory: Directory<LoaderTypes, WithDefaultTypes<LoaderTypes>, DirectoryLoader, DirectoryFilter<FileSystemEntry<WithDefaultTypes<LoaderTypes>, undefined>, WithDefaultTypes<LoaderTypes>>>, options: NormalizedDirectoryEntriesOptions, mask: number) => Promise<DirectorySnapshot<LoaderTypes>> | — |
| #isSnapshotStale | (snapshot: DirectorySnapshot<LoaderTypes>) => Promise<boolean> | — |
| #buildSnapshot | (directory: Directory<LoaderTypes, WithDefaultTypes<LoaderTypes>, DirectoryLoader, DirectoryFilter<FileSystemEntry<WithDefaultTypes<LoaderTypes>, undefined>, WithDefaultTypes<LoaderTypes>>>, options: NormalizedDirectoryEntriesOptions, mask: number) => Promise<{ snapshot: DirectorySnapshot<LoaderTypes>; shouldIncludeSelf: boolean; }> | — |
| getRootPath | () => string | — |
Get the root directory path. | ||
| getParent | () => Directory<any, any, any, DirectoryFilter<FileSystemEntry<any, undefined>, any>> | — |
Get the parent directory containing this directory. | ||
| getSiblings | <GroupTypes extends Record<string, any> = LoaderTypes>(options?: { collection?: Collection<GroupTypes, Array<FileSystemEntry<any, undefined>>, {}> | undefined; } | undefined) => Promise<[FileSystemEntry<LoaderTypes, undefined> | undefined, FileSystemEntry<LoaderTypes, undefined> | undefined]> | — |
Get the previous and next sibling entries (files or directories) of the parent directory. | ||
| getSlug | () => string | — |
Get the slug of this directory. | ||
| getName | () => string | — |
Get the base name of this directory. | ||
| getBaseName | () => string | — |
Get the base name of this directory. | ||
| getTitle | () => string | — |
The directory name formatted as a title. | ||
| getPathname | (options?: { includeBasePathname?: boolean; }) => string | — |
Get a URL-friendly path to this directory. | ||
| getPathnameSegments | (options?: { includeBasePathname?: boolean; }) => Array<string> | — |
Get the route path segments to this directory. | ||
| getRelativePathToRoot | () => string | — |
Get the relative path of this directory to the root directory. | ||
| getRelativePathToWorkspace | () => string | — |
Get the relative path of the directory to the workspace. | ||
| getAbsolutePath | () => string | — |
Get the absolute path of this directory. | ||
| #getRepositoryUrl | (repository?: RepositoryConfig | string | Repository, options?: Omit<GetDirectoryUrlOptions, "path">) => string | — |
Get a URL to the directory for the configured git repository. | ||
| getHistoryUrl | (options?: Pick<GetFileUrlOptions, "ref"> & { repository?: RepositoryConfig | string | Repository; }) => string | — |
Get the URL to the directory history for the configured git repository. | ||
| getSourceUrl | (options?: Pick<GetFileUrlOptions, "ref"> & { repository?: RepositoryConfig | string | Repository; }) => string | — |
Get the URL to the directory source for the configured git repository. | ||
| getReleaseUrl | (options?: SourceReleaseUrlOptions) => Promise<string> | — |
Get a release URL for the configured git repository. | ||
| getRelease | (options?: SourceReleaseOptions) => Promise<Release> | — |
Retrieve metadata about a release for the configured git repository. | ||
| getEditorUri | (options?: Pick<GetEditorUriOptions, "editor">) => string | — |
Get the URI to the directory source code for the configured editor. | ||
| getFirstCommitDate | () => Promise<Date | undefined> | — |
Get the first local git commit date of this directory. | ||
| getLastCommitDate | () => Promise<Date | undefined> | — |
Get the last local git commit date of this directory. | ||
| getAuthors | () => Promise<Array<GitAuthor>> | — |
Get the local git authors of this directory. | ||
| hasEntry | (entry: FileSystemEntry<any> | undefined) => entry is FileSystemEntry<LoaderTypes, undefined> | — |
Checks if this directory contains the provided entry. | ||
| hasFile | <ExtensionType extends string | keyof LoaderTypes, const Extension extends ExtensionType | Array<Extension>>(entry: FileSystemEntry<any> | undefined, extension?: Extension | Array<Extension> | undefined) => entry is FileWithExtension<LoaderTypes, Extension> | — |
Checks if this directory contains the provided file. | ||
Methods
| Method | Signature | Modifiers |
|---|---|---|
| getExportPath | () => string | — |
Returnsstring | ||
| getAnalysis | () => PackageExportAnalysis | undefined | — |
ReturnsPackageExportAnalysis | undefined | ||
Type Parameters
| Parameter | Constraint | Default |
|---|---|---|
Types | InferDirectoryLoaderTypes<Loaders> | — |
LoaderTypes | WithDefaultTypes<Types> | WithDefaultTypes<Types> |
Loaders | ModuleLoaders | ModuleRuntimeLoader<any> | ModuleLoaders | ModuleRuntimeLoader<any> |
Filter | DirectoryFilter<FileSystemEntry<LoaderTypes, undefined>, LoaderTypes> | DirectoryFilter<FileSystemEntry<LoaderTypes, undefined>, LoaderTypes> |
Properties
| Property | Type | Modifiers |
|---|---|---|
| getExportPath | { (): string; (): string; } | — |
| getAnalysis | { (): PackageExportAnalysis | undefined; (): PackageExportAnalysis | undefined; } | — |
| #exportPath | string | — |
| #analysis? | PackageExportAnalysis | — |
| #path | string | — |
| #rootPath? | string | — |
| #basePathname? | null | string | — |
| #tsConfigPath? | string | — |
| #slugCasing | "none" | "kebab" | "snake" | — |
| #loader? | Loaders | () => Loaders | — |
| #resolvedLoaders? | ModuleLoaders | ModuleRuntimeLoader<any> | — |
| #directory? | Directory<any, any, any, DirectoryFilter<FileSystemEntry<any, undefined>, any>> | — |
| #fileSystem | undefined | FileSystem | — |
| #repository | undefined | Repository | — |
| #repositoryOption? | string | RepositoryConfig | Repository | — |
| #filterPattern? | string | — |
| #filter? | Minimatch | (entry: FileSystemEntry<LoaderTypes, undefined>) => entry is FileSystemEntry<LoaderTypes, undefined> | (entry: FileSystemEntry<LoaderTypes, undefined>) => Promise<boolean> | boolean | — |
| #filterCache? | WeakMap<FileSystemEntry<LoaderTypes, undefined>, boolean> | — |
| #simpleFilter? | { recursive: boolean; extensions: Set<string>; } | — |
| #sort? | any | — |
| getFilterPatternKind | () => "recursive" | "shallow" | null | — |
Returns the glob filter pattern kind for this directory if defined. | ||
| #passesFilter | (entry: FileSystemEntry<LoaderTypes, undefined>) => Promise<boolean> | — |
| #shouldIncludeFile | (entry: FileSystemEntry<LoaderTypes, undefined>) => Promise<boolean> | — |
| #duplicate | (options?: DirectoryOptions<any, any, any>) => Directory<LoaderTypes, LoaderTypes, Loaders, DirectoryFilter<FileSystemEntry<LoaderTypes, undefined>, LoaderTypes>> | — |
Duplicate the directory with the same initial options. | ||
| #getLoaders | () => ModuleLoaders | ModuleRuntimeLoader<any> | undefined | — |
Resolve the loaders map when a factory is provided and cache the result. | ||
| getFileSystem | () => FileSystem | — |
Get the file system for this directory. | ||
| getRepository | (repository?: RepositoryConfig | string | Repository) => Repository | — |
Get the | ||
| getDepth | () => number | — |
Get the depth of the directory starting from the root directory. | ||
| #readDirectoryShallowForTraversal | (directory: Directory<LoaderTypes, WithDefaultTypes<LoaderTypes>, DirectoryLoader, DirectoryFilter<FileSystemEntry<WithDefaultTypes<LoaderTypes>, undefined>, WithDefaultTypes<LoaderTypes>>>) => Promise<Array<FileSystemEntry<LoaderTypes, undefined>>> | — |
Perform a shallow, filter-free read of a directory’s immediate children. This is used for path traversal to avoid expensive recursive inclusion checks. | ||
| #findEntry | (directory: Directory<LoaderTypes, WithDefaultTypes<LoaderTypes>, DirectoryLoader, DirectoryFilter<FileSystemEntry<WithDefaultTypes<LoaderTypes>, undefined>, WithDefaultTypes<LoaderTypes>>>, segments: string[], allExtensions?: string[]) => Promise<FileSystemEntry<LoaderTypes, undefined>> | — |
Walk | ||
| getFile | { <const Path extends string, Extension extends ExtractFileExtension<Path> = ExtractFileExtension<Path>>(path: Path): Promise<Extension extends string ? IsJavaScriptLikeExtension<Extension> extends true ? JavaScriptFile<Extension extends keyof LoaderTypes ? InferDefaultModuleTypes<Extension> & LoaderTypes[Extension] : InferDefaultModuleTypes<Extension>, LoaderTypes, string, Extension> : Extension extends "mdx" ? MDXFile<LoaderTypes["mdx"], LoaderTypes, string, Extension> : Extension extends "md" ? MarkdownFile<LoaderTypes["md"], LoaderTypes, string, Extension> : Extension extends "json" ? JSONFile<JSONExtensionType<LoaderTypes>, LoaderTypes, string, Extension> : File<LoaderTypes, Path, Extension> : File<LoaderTypes, string, string>>; <ExtensionType extends string | keyof LoaderTypes, const Extension extends ExtensionType | Array<Extension>>(path: string | string[], extension?: Extension | Array<Extension> | undefined): Promise<Extension extends string ? IsJavaScriptLikeExtension<Extension> extends true ? JavaScriptFile<Extension extends keyof LoaderTypes ? InferDefaultModuleTypes<Extension> & LoaderTypes[Extension] : InferDefaultModuleTypes<Extension>, LoaderTypes, string, Extension> : Extension extends "mdx" ? MDXFile<LoaderTypes["mdx"], LoaderTypes, string, Extension> : Extension extends "md" ? MarkdownFile<LoaderTypes["md"], LoaderTypes, string, Extension> : Extension extends "json" ? JSONFile<JSONExtensionType<LoaderTypes>, LoaderTypes, string, Extension> : File<LoaderTypes, Extension, ExtractFileExtension<Extension>> : File<LoaderTypes, string, string>>; } | — |
| getDirectory | (path: string | string[]) => Promise<Directory<LoaderTypes, WithDefaultTypes<LoaderTypes>, DirectoryLoader, DirectoryFilter<FileSystemEntry<WithDefaultTypes<LoaderTypes>, undefined>, WithDefaultTypes<LoaderTypes>>>> | — |
Get a directory at the specified | ||
| getEntry | (path: string | string[]) => Promise<FileSystemEntry<LoaderTypes, undefined>> | — |
Get a directory or file at the specified
| ||
| #snapshotCache | Map<number, DirectorySnapshot<LoaderTypes>> | — |
| #pathLookup | Map<string, FileSystemEntry<LoaderTypes, undefined>> | — |
| #addPathLookup | (entry: FileSystemEntry<LoaderTypes, undefined>) => void | — |
Add an entry to the path lookup table. This avoids the need to traverse the entire directory tree to find a file or directory that has already been created. | ||
| invalidateSnapshots | () => void | — |
| getEntries | (options?: { recursive?: (Filter extends string ? Filter extends `**${string}` ? boolean : undefined : boolean) | undefined; includeDirectoryNamedFiles?: boolean; includeIndexAndReadmeFiles?: boolean; includeGitIgnoredFiles?: boolean; includeTsConfigExcludedFiles?: boolean; } | undefined) => Promise<Array<Filter extends string ? Filter extends `**${string}` ? Directory<LoaderTypes, WithDefaultTypes<LoaderTypes>, DirectoryLoader, DirectoryFilter<FileSystemEntry<WithDefaultTypes<LoaderTypes>, undefined>, WithDefaultTypes<LoaderTypes>>> | FileWithExtension<LoaderTypes, ExtractFileExtension<Filter>> : FileWithExtension<LoaderTypes, ExtractFileExtension<Filter>> : Filter extends DirectoryFilter<infer FilteredEntry extends FileSystemEntry<any, undefined>, LoaderTypes> ? FilteredEntry : FileSystemEntry<LoaderTypes, undefined>>> | — |
Retrieves all entries (files and directories) within the current directory
that are not excluded by Git ignore rules or the closest | ||
| #normalizeEntriesOptions | (options?: { recursive?: boolean; includeDirectoryNamedFiles?: boolean; includeIndexAndReadmeFiles?: boolean; includeGitIgnoredFiles?: boolean; includeTsConfigExcludedFiles?: boolean; }) => NormalizedDirectoryEntriesOptions | — |
| #hydrateDirectorySnapshot | (directory: Directory<LoaderTypes, WithDefaultTypes<LoaderTypes>, DirectoryLoader, DirectoryFilter<FileSystemEntry<WithDefaultTypes<LoaderTypes>, undefined>, WithDefaultTypes<LoaderTypes>>>, options: NormalizedDirectoryEntriesOptions, mask: number) => Promise<DirectorySnapshot<LoaderTypes>> | — |
| #isSnapshotStale | (snapshot: DirectorySnapshot<LoaderTypes>) => Promise<boolean> | — |
| #buildSnapshot | (directory: Directory<LoaderTypes, WithDefaultTypes<LoaderTypes>, DirectoryLoader, DirectoryFilter<FileSystemEntry<WithDefaultTypes<LoaderTypes>, undefined>, WithDefaultTypes<LoaderTypes>>>, options: NormalizedDirectoryEntriesOptions, mask: number) => Promise<{ snapshot: DirectorySnapshot<LoaderTypes>; shouldIncludeSelf: boolean; }> | — |
| getRootPath | () => string | — |
Get the root directory path. | ||
| getParent | () => Directory<any, any, any, DirectoryFilter<FileSystemEntry<any, undefined>, any>> | — |
Get the parent directory containing this directory. | ||
| getSiblings | <GroupTypes extends Record<string, any> = LoaderTypes>(options?: { collection?: Collection<GroupTypes, Array<FileSystemEntry<any, undefined>>, {}> | undefined; } | undefined) => Promise<[FileSystemEntry<LoaderTypes, undefined> | undefined, FileSystemEntry<LoaderTypes, undefined> | undefined]> | — |
Get the previous and next sibling entries (files or directories) of the parent directory. | ||
| getSlug | () => string | — |
Get the slug of this directory. | ||
| getName | () => string | — |
Get the base name of this directory. | ||
| getBaseName | () => string | — |
Get the base name of this directory. | ||
| getTitle | () => string | — |
The directory name formatted as a title. | ||
| getPathname | (options?: { includeBasePathname?: boolean; }) => string | — |
Get a URL-friendly path to this directory. | ||
| getPathnameSegments | (options?: { includeBasePathname?: boolean; }) => Array<string> | — |
Get the route path segments to this directory. | ||
| getRelativePathToRoot | () => string | — |
Get the relative path of this directory to the root directory. | ||
| getRelativePathToWorkspace | () => string | — |
Get the relative path of the directory to the workspace. | ||
| getAbsolutePath | () => string | — |
Get the absolute path of this directory. | ||
| #getRepositoryUrl | (repository?: RepositoryConfig | string | Repository, options?: Omit<GetDirectoryUrlOptions, "path">) => string | — |
Get a URL to the directory for the configured git repository. | ||
| getHistoryUrl | (options?: Pick<GetFileUrlOptions, "ref"> & { repository?: RepositoryConfig | string | Repository; }) => string | — |
Get the URL to the directory history for the configured git repository. | ||
| getSourceUrl | (options?: Pick<GetFileUrlOptions, "ref"> & { repository?: RepositoryConfig | string | Repository; }) => string | — |
Get the URL to the directory source for the configured git repository. | ||
| getReleaseUrl | (options?: SourceReleaseUrlOptions) => Promise<string> | — |
Get a release URL for the configured git repository. | ||
| getRelease | (options?: SourceReleaseOptions) => Promise<Release> | — |
Retrieve metadata about a release for the configured git repository. | ||
| getEditorUri | (options?: Pick<GetEditorUriOptions, "editor">) => string | — |
Get the URI to the directory source code for the configured editor. | ||
| getFirstCommitDate | () => Promise<Date | undefined> | — |
Get the first local git commit date of this directory. | ||
| getLastCommitDate | () => Promise<Date | undefined> | — |
Get the last local git commit date of this directory. | ||
| getAuthors | () => Promise<Array<GitAuthor>> | — |
Get the local git authors of this directory. | ||
| hasEntry | (entry: FileSystemEntry<any> | undefined) => entry is FileSystemEntry<LoaderTypes, undefined> | — |
Checks if this directory contains the provided entry. | ||
| hasFile | <ExtensionType extends string | keyof LoaderTypes, const Extension extends ExtensionType | Array<Extension>>(entry: FileSystemEntry<any> | undefined, extension?: Extension | Array<Extension> | undefined) => entry is FileWithExtension<LoaderTypes, Extension> | — |
Checks if this directory contains the provided file. | ||
Methods
| Method | Signature | Modifiers |
|---|---|---|
| getExportPath | () => string | — |
Returnsstring | ||
| getAnalysis | () => PackageExportAnalysis | undefined | — |
ReturnsPackageExportAnalysis | undefined | ||
Constructor
new Package<Types, LoaderTypes, Loaders, Filter, ExportLoaders>(options)Type Parameters
| Parameter | Constraint | Default |
|---|---|---|
Types | InferDirectoryLoaderTypes<Loaders> | — |
LoaderTypes | WithDefaultTypes<Types> | WithDefaultTypes<Types> |
Loaders | ModuleLoaders | ModuleRuntimeLoader<any> | ModuleLoaders | ModuleRuntimeLoader<any> |
Filter | DirectoryFilter<FileSystemEntry<LoaderTypes, undefined>, LoaderTypes> | DirectoryFilter<FileSystemEntry<LoaderTypes, undefined>, LoaderTypes> |
ExportLoaders | Record<
string,
PackageExportLoader<ModuleExports<any>>
> | {} |
Parameters
| Parameter | Type | Default Value |
|---|---|---|
| options | PackageOptions<Types, LoaderTypes, Loaders, Filter, ExportLoaders> | — |
Methods
| Method | Type | Modifiers | |||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| getName | () => undefined | string | — | |||||||||||||||||||||||||||||||||||||||
Returnsundefined | string | |||||||||||||||||||||||||||||||||||||||||
| getExports | () => Array<…> | — | |||||||||||||||||||||||||||||||||||||||
ReturnsArray<PackageExportDirectory<Types, LoaderTypes, Loaders, Filter>> | |||||||||||||||||||||||||||||||||||||||||
| getExport | <Key>(exportSpecifier: Key, extension?: string | Array<…>) => Promise<…> (+2 overloads) | — | |||||||||||||||||||||||||||||||||||||||
Overload 1Type Parameters
Parameters
ReturnsPromise<JavaScriptFile<InferPackageExportModule<ExportLoaders[Key]>, LoaderTypes, string, string>>ModifiersasyncOverload 2Type Parameters
Parameters
ReturnsPromise<JavaScriptFile<Module, LoaderTypes, string, string>>ModifiersasyncOverload 3Parameters
ReturnsPromise<FileSystemEntry<LoaderTypes, undefined>>Modifiersasync | |||||||||||||||||||||||||||||||||||||||||
| getImports | () => Array<…> | — | |||||||||||||||||||||||||||||||||||||||
ReturnsArray<PackageImportEntry> | |||||||||||||||||||||||||||||||||||||||||
| getImport | (importSpecifier: string) => PackageImportEntry | undefined | — | |||||||||||||||||||||||||||||||||||||||
Get a single import entry by its specifier (e.g. “#internal/*”). Parameters
ReturnsPackageImportEntry | undefined | |||||||||||||||||||||||||||||||||||||||||
Constructor
new PackageImportEntry(analysis)Parameters
| Parameter | Type | Default Value |
|---|---|---|
| analysis | PackageImportAnalysis | — |
Methods
| Method | Type | Modifiers | ||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| getImportPath | () => string | — | ||||||||||||||||||
Returnsstring | ||||||||||||||||||||
| getAnalysis | () => PackageImportAnalysis | — | ||||||||||||||||||
Returns
| ||||||||||||||||||||
A file system that stores files in memory.
Constructor
new MemoryFileSystem(files)Parameters
| Parameter | Type | Default Value |
|---|---|---|
| files | { [path: string]: MemoryFileContent; } | — |
Methods
| Method | Type | Modifiers | ||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| createFile | (path: string, content: MemoryFileContent) => void | — | ||||||||||||||||||||||||
Parameters
Returnsvoid | ||||||||||||||||||||||||||
| getProjectOptions | () => ProjectOptions | — | ||||||||||||||||||||||||
Returns
| ||||||||||||||||||||||||||
| transpileFile | (path: string) => Promise<…> | — | ||||||||||||||||||||||||
Parameters
ReturnsPromise<string>Modifiersasync | ||||||||||||||||||||||||||
| getAbsolutePath | (path: string) => string | — | ||||||||||||||||||||||||
Parameters
Returnsstring | ||||||||||||||||||||||||||
| getRelativePathToWorkspace | (path: string) => string | — | ||||||||||||||||||||||||
Parameters
Returnsstring | ||||||||||||||||||||||||||
| getFiles | () => Map<…> | — | ||||||||||||||||||||||||
ReturnsMap<string, MemoryFileEntry> | ||||||||||||||||||||||||||
| getFileEntry | (path: string) => MemoryFileEntry | undefined | — | ||||||||||||||||||||||||
Parameters
ReturnsMemoryFileEntry | undefined | ||||||||||||||||||||||||||
| readDirectorySync | (path?: string) => Array<…> | — | ||||||||||||||||||||||||
Parameters
ReturnsArray<DirectoryEntry> | ||||||||||||||||||||||||||
| readDirectory | (path?: string) => Promise<…> | — | ||||||||||||||||||||||||
Parameters
ReturnsPromise<Array<DirectoryEntry>>Modifiersasync | ||||||||||||||||||||||||||
| readFileSync | (path: string) => string | — | ||||||||||||||||||||||||
Parameters
Returnsstring | ||||||||||||||||||||||||||
| readFile | (path: string) => Promise<…> | — | ||||||||||||||||||||||||
Parameters
ReturnsPromise<string>Modifiersasync | ||||||||||||||||||||||||||
| readFileBinarySync | (path: string) => Uint8Array<…> | — | ||||||||||||||||||||||||
Parameters
ReturnsUint8Array<ArrayBufferLike> | ||||||||||||||||||||||||||
| readFileBinary | (path: string) => Promise<…> | — | ||||||||||||||||||||||||
Parameters
ReturnsPromise<Uint8Array<ArrayBufferLike>>Modifiersasync | ||||||||||||||||||||||||||
| readFileStream | (path: string) => FileReadableStream | — | ||||||||||||||||||||||||
Parameters
ReturnsFileReadableStream | ||||||||||||||||||||||||||
| getFileByteLengthSync | (path: string) => number | undefined | — | ||||||||||||||||||||||||
Parameters
Returnsnumber | undefined | ||||||||||||||||||||||||||
| writeFileSync | (path: string, content: FileSystemWriteFileContent) => void | — | ||||||||||||||||||||||||
Parameters
Returnsvoid | ||||||||||||||||||||||||||
| writeFile | (path: string, content: FileSystemWriteFileContent) => Promise<…> | — | ||||||||||||||||||||||||
Parameters
ReturnsPromise<void>Modifiersasync | ||||||||||||||||||||||||||
| writeFileStream | (path: string) => FileWritableStream | — | ||||||||||||||||||||||||
Parameters
ReturnsFileWritableStream | ||||||||||||||||||||||||||
| fileExistsSync | (path: string) => boolean | — | ||||||||||||||||||||||||
Parameters
Returnsboolean | ||||||||||||||||||||||||||
| fileExists | (path: string) => Promise<…> | — | ||||||||||||||||||||||||
Parameters
ReturnsPromise<boolean>Modifiersasync | ||||||||||||||||||||||||||
| deleteFileSync | (path: string) => void | — | ||||||||||||||||||||||||
Parameters
Returnsvoid | ||||||||||||||||||||||||||
| deleteFile | (path: string) => Promise<…> | — | ||||||||||||||||||||||||
Parameters
ReturnsPromise<void>Modifiersasync | ||||||||||||||||||||||||||
| isFilePathGitIgnored | (filePath: string) => boolean | — | ||||||||||||||||||||||||
Parameters
Returnsboolean | ||||||||||||||||||||||||||
| getFileLastModifiedMsSync | (_path: string) => number | undefined | — | ||||||||||||||||||||||||
Parameters
Returnsnumber | undefined | ||||||||||||||||||||||||||
| getFileLastModifiedMs | (path: string) => Promise<…> | — | ||||||||||||||||||||||||
Parameters
ReturnsPromise<number | undefined>Modifiersasync | ||||||||||||||||||||||||||
Extends
FileSystemConstructor
new NodeFileSystem(options?)Parameters
| Parameter | Type | Default Value |
|---|---|---|
| options? | FileSystemOptions | {} |
Methods
| Method | Type | Modifiers | |||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
| getProjectOptions | () => { tsConfigFilePath: string; } | — | |||||||||
Returns
| |||||||||||
| getAbsolutePath | (path: string) => string | — | |||||||||
Parameters
Returnsstring | |||||||||||
| getRelativePathToWorkspace | (path: string) => string | — | |||||||||
Parameters
Returnsstring | |||||||||||
| readDirectorySync | (path?: string) => Array<…> | — | |||||||||
Parameters
ReturnsArray<DirectoryEntry> | |||||||||||
| readDirectory | (path?: string) => Promise<…> | — | |||||||||
Parameters
ReturnsPromise<Array<DirectoryEntry>>Modifiersasync | |||||||||||
| readFileSync | (path: string) => string | — | |||||||||
Parameters
Returnsstring | |||||||||||
| readFile | (path: string) => Promise<…> | — | |||||||||
Parameters
ReturnsPromise<string>Modifiersasync | |||||||||||
| readFileBinarySync | (path: string) => Uint8Array<…> | — | |||||||||
Parameters
ReturnsUint8Array<ArrayBufferLike> | |||||||||||
| readFileBinary | (path: string) => Promise<…> | — | |||||||||
Parameters
ReturnsPromise<Uint8Array<ArrayBufferLike>>Modifiersasync | |||||||||||
| readFileStream | (path: string) => FileReadableStream | — | |||||||||
Parameters
ReturnsFileReadableStream | |||||||||||
| getFileByteLengthSync | (path: string) => number | undefined | — | |||||||||
Parameters
Returnsnumber | undefined | |||||||||||
| getFileByteLength | (path: string) => Promise<…> | — | |||||||||
Parameters
ReturnsPromise<number | undefined>Modifiersasync | |||||||||||
| writeFileSync | (path: string, content: FileSystemWriteFileContent) => void | — | |||||||||
Parameters
Returnsvoid | |||||||||||
| writeFile | (path: string, content: FileSystemWriteFileContent) => Promise<…> | — | |||||||||
Parameters
ReturnsPromise<void>Modifiersasync | |||||||||||
| writeFileStream | (path: string) => FileWritableStream | — | |||||||||
Parameters
ReturnsFileWritableStream | |||||||||||
| fileExistsSync | (path: string) => boolean | — | |||||||||
Parameters
Returnsboolean | |||||||||||
| fileExists | (path: string) => Promise<…> | — | |||||||||
Parameters
ReturnsPromise<boolean>Modifiersasync | |||||||||||
| deleteFileSync | (path: string) => void | — | |||||||||
Parameters
Returnsvoid | |||||||||||
| deleteFile | (path: string) => Promise<…> | — | |||||||||
Parameters
ReturnsPromise<void>Modifiersasync | |||||||||||
| isFilePathGitIgnored | (filePath: string) => boolean | — | |||||||||
Parameters
Returnsboolean | |||||||||||
| getFileLastModifiedMsSync | (path: string) => number | undefined | — | |||||||||
Parameters
Returnsnumber | undefined | |||||||||||
| getFileLastModifiedMs | (path: string) => Promise<…> | — | |||||||||
Parameters
ReturnsPromise<number | undefined>Modifiersasync | |||||||||||
Extends
FileSystemConstructor
new Repository(repository)Parameters
| Parameter | Type | Default Value |
|---|---|---|
| repository | RepositoryConfig | string | — |
Methods
| Method | Type | Modifiers | ||||||
|---|---|---|---|---|---|---|---|---|
| toString | () => string | — | ||||||
Returns the string representation of the repository. Returnsstring | ||||||||
| getIssueUrl | (options: GetIssueUrlOptions) => string | — | ||||||
Constructs a new issue URL for the repository. Parameters
Returnsstring | ||||||||
| getFileUrl | (options?: GetFileUrlOptions) => string | — | ||||||
Constructs a URL for a file in the repository. Parameters
Returnsstring | ||||||||
| getDirectoryUrl | (options?: GetDirectoryUrlOptions) => string | — | ||||||
Constructs a URL for a directory in the repository. Parameters
Returnsstring | ||||||||
| getRelease | (options?: GetReleaseOptions | undefined) => Promise<…> | — | ||||||
Retrieve metadata about a release for the repository. Parameters
ReturnsPromise<Release>Modifiersasync | ||||||||
| getReleaseUrl | (options?: GetReleaseUrlOptions | undefined) => Promise<…> | — | ||||||
Retrieve a URL associated with a release (asset, archive, compare, or HTML). Parameters
ReturnsPromise<string>Modifiersasync | ||||||||
Properties
| Property | Type | Modifiers |
|---|---|---|
| byteLength | number | — |
Total length of the resource in bytes. | ||
Methods
| Method | Signature | Modifiers | |||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
| stream | (start: number, end: number) => ReadableStream<…> | — | |||||||||
Provide a stream of data for the specified byte range. The Parameters
ReturnsReadableStream<StreamableChunk> | |||||||||||
Parameters
| Parameter | Type | Default Value |
|---|---|---|
| streamFactory | () => ReadableStream<StreamableChunk> | — |
| start | number | — |
| end | number | — |
Returns
ReadableStream<StreamableUint8Array>Constructor
new StreamableBlob(content, options?)Parameters
| Parameter | Type | Default Value |
|---|---|---|
| content | StreamableContent | — |
| options? | BlobPropertyBag | undefined | — |
Accessors
| Accessor | Type | Modifiers |
|---|---|---|
| get size | number | — |
Methods
| Method | Type | Modifiers | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| stream | () => ReadableStream<…> | — | ||||||||||||
ReturnsReadableStream<StreamableUint8Array> | ||||||||||||||
| arrayBuffer | () => Promise<…> | — | ||||||||||||
ReturnsPromise<ArrayBuffer>Modifiersasync | ||||||||||||||
| text | () => Promise<…> | — | ||||||||||||
ReturnsPromise<string>Modifiersasync | ||||||||||||||
| slice | (start?: number, end?: number, contentType?: string) => Blob | — | ||||||||||||
Parameters
ReturnsBlob | ||||||||||||||
Extends
Blob