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',
filter: '*.mdx',
loader: (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.
Repository-first workflows
Use Repository as the entry point for git-backed workflows. It selects the correct file-system adapter automatically (local/clone via GitFileSystem, remote API via GitVirtualFileSystem) and exposes factory helpers for Directory and File. Clone mode is lazy, so the repository is not cloned until you actually read from a directory or file.
Local repositories automatically use a worktree overlay when no explicit ref is provided. This means GitFileSystem prefers on-disk content (including uncommitted or untracked files) and falls back to git objects when a file is not present in the working tree. When a ref is explicitly set, or when a repository is remote/virtual, reads are git-only for deterministic results.
import { Repository } from 'renoun'
// Remote with clone (default)
const clonedRepo = new Repository({
path: 'https://github.com/mrdoob/three.js',
depth: 1,
})
const clonedDirectory = clonedRepo.getDirectory('src')
// Remote API (virtual)
const virtualRepo = new Repository({
path: 'https://github.com/mrdoob/three.js',
clone: false,
})
const virtualDirectory = virtualRepo.getDirectory('src')
// Local
const localRepo = new Repository()
const localDocs = localRepo.getDirectory('docs')Directories created without a repository will auto-detect git roots and attach an implicit Repository when possible:
import { Directory } from 'renoun'
// Auto-detects the closest git repo and enables git metadata.
const directory = new Directory({ path: 'src' })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.getContent()
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 } from 'renoun'
import { z } from 'zod'
const posts = new Directory({
path: 'posts',
filter: '*.mdx',
schema: {
mdx: {
frontmatter: z.object({
title: z.string(),
date: z.coerce.date(),
}),
},
},
loader: {
mdx: (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 } 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 define a schema for exports (runtime validation) and optionally type the loader (compile-time):
import { Directory } from 'renoun'
import { z } from 'zod'
const posts = new Directory({
path: 'posts',
schema: {
mdx: {
frontmatter: z.object({
title: z.string(),
date: z.coerce.date(),
}),
},
},
loader: {
mdx: (path) => import(`./posts/${path}.mdx`),
},
})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 } from 'renoun'
interface PostType {
frontmatter: {
title: string
date: Date
}
}
const posts = new Directory({
path: 'posts',
loader: import.meta.glob<PostType>('./posts/*.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 } from 'renoun'
import { z } from 'zod'
const posts = new Directory({
path: 'posts',
schema: {
mdx: {
frontmatter: z.object({
title: z.string(),
date: z.date(),
}),
},
},
loader: {
mdx: (path) => import(`./posts/${path}.mdx`),
},
})Alternatively, you can define a schema yourself using both TypeScript types and custom validation functions:
import { Directory } from 'renoun'
interface PostType {
frontmatter: {
title: string
date: Date
}
}
const posts = new Directory({
path: 'posts',
schema: {
mdx: {
frontmatter: (value: any) => {
if (typeof value.title !== 'string') {
throw new Error('Title is required')
}
if (!(value.date instanceof Date)) {
throw new Error('Date is required')
}
return value
},
},
},
loader: (path) => import(`./posts/${path}`),
})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, InMemoryFileSystem } from 'renoun/file-system'
const directory = new Directory({
fileSystem: new InMemoryFileSystem({
'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.typeUpload 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, InMemoryFileSystem } from 'renoun/file-system'
const directory = new Directory({
fileSystem: new InMemoryFileSystem({
'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 GitVirtualFileSystem
The GitVirtualFileSystem 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, GitVirtualFileSystem } from 'renoun'
const fileSystem = new GitVirtualFileSystem({
repository: 'souporserious/renoun',
ref: 'main',
})
const directory = new Directory({
fileSystem,
})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 GitVirtualFileSystem 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 { GitVirtualFileSystem } from 'renoun'
const fileSystem = new GitVirtualFileSystem({
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.
Using GitFileSystem
The GitFileSystem adapter provides high-performance file access for local
git repositories. It can clone remote repositories automatically and read files at any ref by streaming directly from git’s object store.
Basic usage with a local repo
import { Directory, GitFileSystem } from 'renoun'
const fileSystem = new GitFileSystem({
repository: process.cwd(),
})
const directory = new Directory({
fileSystem,
})Clone a remote repository
import { Directory, GitFileSystem } from 'renoun'
const fileSystem = new GitFileSystem({
repository: 'souporserious/renoun',
ref: 'main',
})By default, remote repositories are cloned into the cache directory.
Sparse checkout for monorepos
To limit the scope of the repository to a specific directory, you can use the sparse option to specify the directories to checkout:
import { GitFileSystem } from 'renoun'
const fileSystem = new GitFileSystem({
repository: 'https://github.com/vercel/next.js',
sparse: ['packages/next'],
ref: 'canary',
})Performance benefits
- Blob SHA caching (same content = cache hit)
- Persistent git processes (no spawn overhead)
- Read files at any git ref (branches, tags, commits)
- Works in sparse checkouts
Comparison with GitVirtualFileSystem
| Feature | GitFileSystem | GitVirtualFileSystem |
|---|---|---|
| File access | git CLI | HTTP APIs |
| Rate limits | None | API limits apply |
| Auth | SSH keys / git config | OAuth tokens |
| History depth | Full (if not shallow) | Limited by API |
Worktree overlay (local repositories)
GitFileSystem reads file contents from git objects by default. For local repositories with no explicit ref, it uses a worktree overlay that prefers files on disk (including new/uncommitted files) and falls back to git objects when a file does not exist locally.
This keeps local development fast and intuitive while preserving accurate git history:
- Content comes from disk when available.
- Git metadata (commit dates/authors/history) still comes from the repository.
- Untracked files are readable but have no git history.
-
If you set
refexplicitly,GitFileSystemswitches to git-only reads.
Migration guide
import { Directory, Repository } from 'renoun'
// Remote with clone (default)
const clonedRepo = new Repository({
path: 'https://github.com/mrdoob/three.js',
depth: 1,
})
const clonedDirectory = clonedRepo.getDirectory('src')
// Remote API
const virtualRepo = new Repository({
path: 'https://github.com/mrdoob/three.js',
clone: false,
})
const virtualDirectory = virtualRepo.getDirectory('src')
// Local (auto-detects)
const autoDirectory = new Directory({ path: 'src' })
// Explicit local
const localRepo = new Repository()
const localDirectory = localRepo.getDirectory('src')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 GitVirtualFileSystem. 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-sections': () => import('@renoun/mdx/remark/add-sections'),
},
})
const remarkAddSections = await renounMdx.getExport('remark/add-sections')
const defaultExport = await remarkAddSections.getExport('default')
await defaultExport.getType()
await defaultExport.getValue()import { Package } from 'renoun'
const renounMdx = new Package({
name: '@renoun/mdx',
loader: {
'remark/add-sections': () => import('@renoun/mdx/remark/add-sections'),
},
})
const remarkAddSections = await renounMdx.getExport('remark/add-sections')
const defaultExport = await remarkAddSections.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
Properties
| Property | Type | Modifiers |
|---|---|---|
| id | string | — |
The slugified heading text. | ||
| title | string | — |
The stringified heading text. | ||
| depth | number | — |
The heading level (1-6). | ||
| summary? | string | — |
Concise summary derived from the section content. | ||
| jsx? | React.ReactNode | — |
The heading content as JSX (preserves formatting like code, emphasis, etc.). | ||
| children? | Array<ContentSection> | — |
Nested child sections. | ||
Utility type that infers the schema output from validator functions or a Standard Schema.
Type Parameters
| Parameter | Constraint | Default |
|---|---|---|
Exports | — | — |
Type
InferModuleExports<Exports>A record of loaders for different file extensions.
Index Signatures
| Key | Type | Modifiers |
|---|---|---|
extension: string | ModuleLoader<ModuleExports<unknown>> | — |
Frontmatter 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 schema.
Type
FrontmatterDefault module types for common file extensions.
Properties
| Property | Type | Modifiers |
|---|---|---|
| md | { default: MDXContent; frontmatter?: Frontmatter; } | — |
| mdx | { default: MDXContent; frontmatter?: Frontmatter; } | — |
| json | JSONObject | — |
IsAny<Types> does not extend true
| Property | Type | |
|---|---|---|
| md | "md" extends keyof Types ? Merge<DefaultModuleTypes["md" & keyof Types], Types["md" & keyof Types]> : { default: MDXContent; frontmatter?: Frontmatter; } | |
| mdx | "mdx" extends keyof Types ? Merge<DefaultModuleTypes["mdx" & keyof Types], Types["mdx" & keyof Types]> : { default: MDXContent; frontmatter?: Frontmatter; } | |
| json | "json" extends keyof Types ? Merge<DefaultModuleTypes["json" & keyof Types], Types["json" & keyof Types]> : JSONObject | |
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, DirectorySchema | undefined, DirectoryFilter<FileSystemEntry<ApplyDirectorySchema<WithDefaultTypes<DirectoryTypes>, DirectorySchema | undefined>, undefined>, ApplyDirectorySchema<WithDefaultTypes<DirectoryTypes>, DirectorySchema | undefined>> | undefined> | 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 |
SchemaOption | DirectorySchemaOption | undefined | undefined |
Properties
| Property | Type | Modifiers |
|---|---|---|
| path | Path | URL | — |
The path to the file. | ||
| basePathname? | string | null | — |
The base pathname to use for the file. | ||
| slugCasing? | SlugCasing | — |
The slug casing to use for the file. | ||
| depth? | number | — |
The depth of the file in the file system. | ||
| schema? | SchemaOption | — |
Optional schema for this file (overrides the parent directory schema). | ||
| byteLength? | number | — |
Known byte length for the file contents. When omitted, | ||
| directory? | PathLike | Directory<Types, WithDefaultTypes<Types>, DirectoryLoader, undefined, DirectoryFilter<FileSystemEntry<ApplyDirectorySchema<WithDefaultTypes<Types>, undefined>, undefined>, ApplyDirectorySchema<WithDefaultTypes<Types>, undefined>> | undefined> | — |
The directory to use for the file. | ||
| repository? | RepositoryInput | — |
The repository to use for git operations and source URLs. | ||
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, any> | — |
Accessors
| Accessor | Type | |
|---|---|---|
| lastModified | number | |
The last modified time of the file in milliseconds. | ||
| name | string | |
The intrinsic name of the file. | ||
| baseName | string | |
The base name of the file e.g. | ||
| kind | string | undefined | |
The modifier name of the file if defined e.g. | ||
| title | string | |
The base file name formatted as a title. | ||
| order | string | undefined | |
The order of the file if defined. | ||
| extension | Extension | |
The extension of the file if defined. | ||
| depth | number | |
Get the depth of the file starting from the root directory. | ||
| schema | undefined | DirectorySchemaOption | |
Get the schema configuration for this file if defined. | ||
| slug | string | |
Get the slug of the file. | ||
| relativePath | string | |
The file path relative to the root directory. | ||
| workspacePath | string | |
The file path relative to the workspace root. | ||
| absolutePath | string | |
The absolute file system path. | ||
| type | string | |
MIME type inferred from file extension. | ||
| size | number | |
Get the file size in bytes without reading the contents. | ||
Methods
| Method | Type | |||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 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> | ||||||||||||||
| getBlameUrl | (options?: (Pick<…> & { repository?: RepositoryInput; }) | undefined) => string | |||||||||||||
Get the URL to the file git blame for the configured git repository. Parameters
Returnsstring | ||||||||||||||
| getEditUrl | (options?: (Pick<…> & { repository?: RepositoryInput; }) | undefined) => string | |||||||||||||
Get the edit URL to the file source for the configured git repository. Parameters
Returnsstring | ||||||||||||||
| getHistoryUrl | (options?: (Pick<…> & { repository?: RepositoryInput; }) | undefined) => string | |||||||||||||
Get the URL to the file history for the configured git repository. Parameters
Returnsstring | ||||||||||||||
| getRawUrl | (options?: (Pick<…> & { repository?: RepositoryInput; }) | undefined) => string | |||||||||||||
Get the URL to the raw file contents for the configured git repository. Parameters
Returnsstring | ||||||||||||||
| getSourceUrl | (options?: (Pick<…> & { repository?: RepositoryInput; }) | 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, DirectorySchema | undefined, DirectoryFilter<FileSystemEntry<ApplyDirectorySchema<WithDefaultTypes<DirectoryTypes>, DirectorySchema | undefined>, undefined>, ApplyDirectorySchema<WithDefaultTypes<DirectoryTypes>, DirectorySchema | undefined>> | undefined> | ||||||||||||||
| 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 | ||||||||||||||
| getFileStructureBase | () => Promise<…> | |||||||||||||
ModifiersprotectedReturnsPromise<FileStructure>Modifiersasync | ||||||||||||||
| getStructure | () => Promise<…> | |||||||||||||
ReturnsPromise<FileStructure>Modifiersasync | ||||||||||||||
| bytes | () => Promise<…> | |||||||||||||
Read the file contents as bytes. ReturnsPromise<Uint8Array<ArrayBuffer>>Modifiersasync | ||||||||||||||
| stream | () => ReadableStream<…> | |||||||||||||
Create a readable stream for the file contents. ReturnsReadableStream<Uint8Array<ArrayBuffer>> | ||||||||||||||
| getText | () => Promise<…> | |||||||||||||
Read the file contents as text (UTF-8 decode, Blob semantics). 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
null | string | number | boolean | Array<JSONValue> | JSONObjectType Parameters
| Parameter | Constraint | Default |
|---|---|---|
Data | Record<string, any> | JSONObject |
DirectoryTypes | Record<string, any> | Record<string, any> |
Path | string | string |
Extends
FileOptions<DirectoryTypes, Path, any>Properties
| Property | Type | Modifiers |
|---|---|---|
| schema? | StandardSchemaV1<Data, Data> | (value: unknown) => Data | — |
| path | Path | URL | — |
The path to the file. | ||
| basePathname? | string | null | — |
The base pathname to use for the file. | ||
| slugCasing? | SlugCasing | — |
The slug casing to use for the file. | ||
| depth? | number | — |
The depth of the file in the file system. | ||
| byteLength? | number | — |
Known byte length for the file contents. When omitted, | ||
| directory? | PathLike | Directory<Types, WithDefaultTypes<Types>, DirectoryLoader, undefined, DirectoryFilter<FileSystemEntry<ApplyDirectorySchema<WithDefaultTypes<Types>, undefined>, undefined>, ApplyDirectorySchema<WithDefaultTypes<Types>, undefined>> | undefined> | — |
The directory to use for the file. | ||
| repository? | RepositoryInput | — |
The repository to use for git operations and source URLs. | ||
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 | |||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 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 | ||||||||||||||
| 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> | ||||||||||||||
| getBlameUrl | (options?: (Pick<…> & { repository?: RepositoryInput; }) | undefined) => string | |||||||||||||
Get the URL to the file git blame for the configured git repository. Parameters
Returnsstring | ||||||||||||||
| getEditUrl | (options?: (Pick<…> & { repository?: RepositoryInput; }) | undefined) => string | |||||||||||||
Get the edit URL to the file source for the configured git repository. Parameters
Returnsstring | ||||||||||||||
| getHistoryUrl | (options?: (Pick<…> & { repository?: RepositoryInput; }) | undefined) => string | |||||||||||||
Get the URL to the file history for the configured git repository. Parameters
Returnsstring | ||||||||||||||
| getRawUrl | (options?: (Pick<…> & { repository?: RepositoryInput; }) | undefined) => string | |||||||||||||
Get the URL to the raw file contents for the configured git repository. Parameters
Returnsstring | ||||||||||||||
| getSourceUrl | (options?: (Pick<…> & { repository?: RepositoryInput; }) | 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, DirectorySchema | undefined, DirectoryFilter<FileSystemEntry<ApplyDirectorySchema<WithDefaultTypes<DirectoryTypes>, DirectorySchema | undefined>, undefined>, ApplyDirectorySchema<WithDefaultTypes<DirectoryTypes>, DirectorySchema | undefined>> | undefined> | ||||||||||||||
| getSiblings | <GroupTypes>(options?: { collection?: Collection<…> | undefined; 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 | ||||||||||||||
| getFileStructureBase | () => Promise<…> | |||||||||||||
ModifiersprotectedReturnsPromise<FileStructure>Modifiersasync | ||||||||||||||
| getStructure | () => Promise<…> | |||||||||||||
ReturnsPromise<FileStructure>Modifiersasync | ||||||||||||||
| bytes | () => Promise<…> | |||||||||||||
Read the file contents as bytes. ReturnsPromise<Uint8Array<ArrayBuffer>>Modifiersasync | ||||||||||||||
| stream | () => ReadableStream<…> | |||||||||||||
Create a readable stream for the file contents. ReturnsReadableStream<Uint8Array<ArrayBuffer>> | ||||||||||||||
| getText | () => Promise<…> | |||||||||||||
Read the file contents as text (UTF-8 decode, Blob semantics). 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 | ||||||||||||||
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 | — |
Accessors
| Accessor | Type | |
|---|---|---|
| slug | string | |
Get the slug of the file export. | ||
| name | string | |
Get the name of the export. Default exports will use the file name or declaration name if available. | ||
| title | string | |
The export name formatted as a title. | ||
| description | undefined | string | |
Get the JSDoc description for the export. | ||
Methods
| Method | Type | ||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| init | <Value>(name: string, file: JavaScriptFile<…>, loader?: ModuleLoader<…> | undefined, slugCasing?: SlugCasing | undefined) => Promise<…> | ||||||||||||||||||||||
ModifiersstaticType Parameters
Parameters
ReturnsPromise<ModuleExport<Value>>Modifiersasync | |||||||||||||||||||||||
| getStaticMetadata | () => Promise<…> | ||||||||||||||||||||||
ModifiersprotectedReturnsPromise<{ name: string; environment: string; jsDocMetadata: { description?: string; tags?: { name: string; text?: string; }[]; } | undefined; location: DeclarationLocation; } | undefined>Modifiersasync | |||||||||||||||||||||||
| 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?: Repository; }) | undefined) => string | ||||||||||||||||||||||
Get the edit URL to the file export source for the configured git repository. Parameters
Returnsstring | |||||||||||||||||||||||
| getSourceUrl | (options?: (Pick<…> & { repository?: 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 | |||||||||||||||||||||||
| isComponent | () => boolean | ||||||||||||||||||||||
Determine whether this export is a React component type. Uses cached runtime values when available (e.g. after calling
Returnsboolean | |||||||||||||||||||||||
| getValue | () => Promise<…> | ||||||||||||||||||||||
Get the value of this export, preferring a static value and falling back to runtime if available. ReturnsPromise<Value>Modifiersasync | |||||||||||||||||||||||
| getValueWithDefault | <DefaultValue>(defaultValue: DefaultValue) => Promise<…> | ||||||||||||||||||||||
Get the value of this export, returning the provided default value when the export is not found. Type Parameters
Parameters
ReturnsPromise<Value>Modifiersasync | |||||||||||||||||||||||
| getStructure | () => Promise<…> | ||||||||||||||||||||||
ReturnsPromise<ModuleExportStructure>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 | — |
Extends
FileOptions<DirectoryTypes, Path, undefined>Properties
| Property | Type | Modifiers |
|---|---|---|
| loader? | ModuleLoader<Types> | — |
| path | Path | URL | — |
The path to the file. | ||
| basePathname? | string | null | — |
The base pathname to use for the file. | ||
| slugCasing? | SlugCasing | — |
The slug casing to use for the file. | ||
| depth? | number | — |
The depth of the file in the file system. | ||
| schema? | SchemaOption | — |
Optional schema for this file (overrides the parent directory schema). | ||
| byteLength? | number | — |
Known byte length for the file contents. When omitted, | ||
| directory? | PathLike | Directory<Types, WithDefaultTypes<Types>, DirectoryLoader, undefined, DirectoryFilter<FileSystemEntry<ApplyDirectorySchema<WithDefaultTypes<Types>, undefined>, undefined>, ApplyDirectorySchema<WithDefaultTypes<Types>, undefined>> | undefined> | — |
The directory to use for the file. | ||
| repository? | RepositoryInput | — |
The repository to use for git operations and source URLs. | ||
A JavaScript file in the file system.
Constructor
new JavaScriptFile<Types, DirectoryTypes, Path, Extension>({
loader,
...fileOptions
})Type Parameters
| Parameter | Constraint | Default |
|---|---|---|
Types | InferDefaultModuleTypes<Path> | any |
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 | |||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 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 | ||||||||||||||
| getSections | () => Promise<…> | |||||||||||||
Get an outline derived from regions and exports in the JavaScript file. ReturnsPromise<Array<Section>>Modifiersasync | ||||||||||||||
| getOutlineRanges | () => Promise<…> | |||||||||||||
Get the outlining ranges in the JavaScript file. ReturnsPromise<Array<OutlineRange>>Modifiersasync | ||||||||||||||
| getFoldingRanges | () => Promise<…> | |||||||||||||
Get foldable ranges in the JavaScript file (IDE-style folding). ReturnsPromise<Array<OutlineRange>>Modifiersasync | ||||||||||||||
| getStructure | () => Promise<…> | |||||||||||||
ReturnsPromise<FileStructure>Modifiersasync | ||||||||||||||
| hasExport | (name: string) => Promise<…> | |||||||||||||
Check if an export exists in the JavaScript file statically or at runtime. Parameters
ReturnsPromise<boolean>Modifiersasync | ||||||||||||||
| 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> | ||||||||||||||
| getBlameUrl | (options?: (Pick<…> & { repository?: RepositoryInput; }) | undefined) => string | |||||||||||||
Get the URL to the file git blame for the configured git repository. Parameters
Returnsstring | ||||||||||||||
| getEditUrl | (options?: (Pick<…> & { repository?: RepositoryInput; }) | undefined) => string | |||||||||||||
Get the edit URL to the file source for the configured git repository. Parameters
Returnsstring | ||||||||||||||
| getHistoryUrl | (options?: (Pick<…> & { repository?: RepositoryInput; }) | undefined) => string | |||||||||||||
Get the URL to the file history for the configured git repository. Parameters
Returnsstring | ||||||||||||||
| getRawUrl | (options?: (Pick<…> & { repository?: RepositoryInput; }) | undefined) => string | |||||||||||||
Get the URL to the raw file contents for the configured git repository. Parameters
Returnsstring | ||||||||||||||
| getSourceUrl | (options?: (Pick<…> & { repository?: RepositoryInput; }) | 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, DirectorySchema | undefined, DirectoryFilter<FileSystemEntry<ApplyDirectorySchema<WithDefaultTypes<DirectoryTypes>, DirectorySchema | undefined>, undefined>, ApplyDirectorySchema<WithDefaultTypes<DirectoryTypes>, DirectorySchema | undefined>> | undefined> | ||||||||||||||
| getSiblings | <GroupTypes>(options?: { collection?: Collection<…> | undefined; 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 | ||||||||||||||
| getFileStructureBase | () => Promise<…> | |||||||||||||
ModifiersprotectedReturnsPromise<FileStructure>Modifiersasync | ||||||||||||||
| bytes | () => Promise<…> | |||||||||||||
Read the file contents as bytes. ReturnsPromise<Uint8Array<ArrayBuffer>>Modifiersasync | ||||||||||||||
| stream | () => ReadableStream<…> | |||||||||||||
Create a readable stream for the file contents. ReturnsReadableStream<Uint8Array<ArrayBuffer>> | ||||||||||||||
| getText | () => Promise<…> | |||||||||||||
Read the file contents as text (UTF-8 decode, Blob semantics). 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 | ||||||||||||||
Extends
File<DirectoryTypes, Path, Extension>An MDX file export.
Constructor
new MDXModuleExport<Value>(name, file, loader?, slugCasing?, getModuleFn?)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 | — |
| getModuleFn? | () => Promise<any> | — |
Accessors
| Accessor | Type | |
|---|---|---|
| name | string | |
| title | string | |
| slug | string | |
Methods
| Method | Type | ||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
| getEditorUri | (options?: Omit<…> | undefined) => string | ||||||||||
Parameters
Returnsstring | |||||||||||
| getEditUrl | (options?: (Pick<…> & { repository?: Repository; }) | undefined) => string | ||||||||||
Parameters
Returnsstring | |||||||||||
| getSourceUrl | (options?: (Pick<…> & { repository?: 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 | — |
Extends
FileOptions<DirectoryTypes, Path, undefined>Properties
| Property | Type | Modifiers |
|---|---|---|
| loader? | ModuleLoader<{ default: MDXContent; } & Types> | — |
| path | Path | URL | — |
The path to the file. | ||
| basePathname? | string | null | — |
The base pathname to use for the file. | ||
| slugCasing? | SlugCasing | — |
The slug casing to use for the file. | ||
| depth? | number | — |
The depth of the file in the file system. | ||
| schema? | SchemaOption | — |
Optional schema for this file (overrides the parent directory schema). | ||
| byteLength? | number | — |
Known byte length for the file contents. When omitted, | ||
| directory? | PathLike | Directory<Types, WithDefaultTypes<Types>, DirectoryLoader, undefined, DirectoryFilter<FileSystemEntry<ApplyDirectorySchema<WithDefaultTypes<Types>, undefined>, undefined>, ApplyDirectorySchema<WithDefaultTypes<Types>, undefined>> | undefined> | — |
The directory to use for the file. | ||
| repository? | RepositoryInput | — |
The repository to use for git operations and source URLs. | ||
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 | |||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| getText | (options?: { includeFrontmatter?: boolean; }) => Promise<…> | |||||||||||||
Parameters
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 | ||||||||||||||
| getSections | () => Promise<…> | |||||||||||||
Get sections parsed from the MDX content based on headings. ReturnsPromise<Array<ContentSection>>Modifiersasync | ||||||||||||||
| getStructure | () => Promise<…> | |||||||||||||
ReturnsPromise<FileStructure>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 | ||||||||||||||
| 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> | ||||||||||||||
| getBlameUrl | (options?: (Pick<…> & { repository?: RepositoryInput; }) | undefined) => string | |||||||||||||
Get the URL to the file git blame for the configured git repository. Parameters
Returnsstring | ||||||||||||||
| getEditUrl | (options?: (Pick<…> & { repository?: RepositoryInput; }) | undefined) => string | |||||||||||||
Get the edit URL to the file source for the configured git repository. Parameters
Returnsstring | ||||||||||||||
| getHistoryUrl | (options?: (Pick<…> & { repository?: RepositoryInput; }) | undefined) => string | |||||||||||||
Get the URL to the file history for the configured git repository. Parameters
Returnsstring | ||||||||||||||
| getRawUrl | (options?: (Pick<…> & { repository?: RepositoryInput; }) | undefined) => string | |||||||||||||
Get the URL to the raw file contents for the configured git repository. Parameters
Returnsstring | ||||||||||||||
| getSourceUrl | (options?: (Pick<…> & { repository?: RepositoryInput; }) | 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, DirectorySchema | undefined, DirectoryFilter<FileSystemEntry<ApplyDirectorySchema<WithDefaultTypes<DirectoryTypes>, DirectorySchema | undefined>, undefined>, ApplyDirectorySchema<WithDefaultTypes<DirectoryTypes>, DirectorySchema | undefined>> | undefined> | ||||||||||||||
| getSiblings | <GroupTypes>(options?: { collection?: Collection<…> | undefined; 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 | ||||||||||||||
| getFileStructureBase | () => Promise<…> | |||||||||||||
ModifiersprotectedReturnsPromise<FileStructure>Modifiersasync | ||||||||||||||
| bytes | () => Promise<…> | |||||||||||||
Read the file contents as bytes. ReturnsPromise<Uint8Array<ArrayBuffer>>Modifiersasync | ||||||||||||||
| stream | () => ReadableStream<…> | |||||||||||||
Create a readable stream for the file contents. ReturnsReadableStream<Uint8Array<ArrayBuffer>> | ||||||||||||||
| 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 | ||||||||||||||
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 | — |
SchemaOption | DirectorySchemaOption | undefined | undefined |
Extends
FileOptions<DirectoryTypes, Path, SchemaOption>Properties
| Property | Type | Modifiers |
|---|---|---|
| loader? | ModuleLoader<{ default: MDXContent; } & Types> | — |
| path | Path | URL | — |
The path to the file. | ||
| basePathname? | string | null | — |
The base pathname to use for the file. | ||
| slugCasing? | SlugCasing | — |
The slug casing to use for the file. | ||
| depth? | number | — |
The depth of the file in the file system. | ||
| schema? | SchemaOption | — |
Optional schema for this file (overrides the parent directory schema). | ||
| byteLength? | number | — |
Known byte length for the file contents. When omitted, | ||
| directory? | PathLike | Directory<Types, WithDefaultTypes<Types>, DirectoryLoader, undefined, DirectoryFilter<FileSystemEntry<ApplyDirectorySchema<WithDefaultTypes<Types>, undefined>, undefined>, ApplyDirectorySchema<WithDefaultTypes<Types>, undefined>> | undefined> | — |
The directory to use for the file. | ||
| repository? | RepositoryInput | — |
The repository to use for git operations and source URLs. | ||
A Markdown file in the file system.
Constructor
new MarkdownFile<Types, DirectoryTypes, Path, Extension, SchemaOption>({
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> |
SchemaOption | DirectorySchemaOption | undefined | undefined |
Parameters
| Parameter | Type | Default Value |
|---|---|---|
| { loader, ...fileOptions } | MarkdownFileOptions<{ default: MDXContent; } & Types, DirectoryTypes, Path, SchemaOption> | — |
Methods
| Method | Type | |||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| getText | (options?: { includeFrontmatter?: boolean; }) => Promise<…> | |||||||||||||
Parameters
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 | ||||||||||||||
| getSections | () => Promise<…> | |||||||||||||
Get sections parsed from the markdown content based on headings. ReturnsPromise<Array<ContentSection>>Modifiersasync | ||||||||||||||
| getStructure | () => Promise<…> | |||||||||||||
ReturnsPromise<FileStructure>Modifiersasync | ||||||||||||||
| parseExportValue | (name: string, value: any) => any | |||||||||||||
Get the runtime value of an export in the Markdown file. (Permissive signature for union compatibility.) Parameters
Returnsany | ||||||||||||||
| getExportValue | <ExportName>(name: ExportName) => Promise<…> | |||||||||||||
Type Parameters
Parameters
ReturnsPromise<ApplyFileSchemaOption<{ default: MDXContent; } & Types, SchemaOption>[ExportName]>Modifiersasync | ||||||||||||||
| 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> | ||||||||||||||
| getBlameUrl | (options?: (Pick<…> & { repository?: RepositoryInput; }) | undefined) => string | |||||||||||||
Get the URL to the file git blame for the configured git repository. Parameters
Returnsstring | ||||||||||||||
| getEditUrl | (options?: (Pick<…> & { repository?: RepositoryInput; }) | undefined) => string | |||||||||||||
Get the edit URL to the file source for the configured git repository. Parameters
Returnsstring | ||||||||||||||
| getHistoryUrl | (options?: (Pick<…> & { repository?: RepositoryInput; }) | undefined) => string | |||||||||||||
Get the URL to the file history for the configured git repository. Parameters
Returnsstring | ||||||||||||||
| getRawUrl | (options?: (Pick<…> & { repository?: RepositoryInput; }) | undefined) => string | |||||||||||||
Get the URL to the raw file contents for the configured git repository. Parameters
Returnsstring | ||||||||||||||
| getSourceUrl | (options?: (Pick<…> & { repository?: RepositoryInput; }) | 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, DirectorySchema | undefined, DirectoryFilter<FileSystemEntry<ApplyDirectorySchema<WithDefaultTypes<DirectoryTypes>, DirectorySchema | undefined>, undefined>, ApplyDirectorySchema<WithDefaultTypes<DirectoryTypes>, DirectorySchema | undefined>> | undefined> | ||||||||||||||
| getSiblings | <GroupTypes>(options?: { collection?: Collection<…> | undefined; 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 | ||||||||||||||
| getFileStructureBase | () => Promise<…> | |||||||||||||
ModifiersprotectedReturnsPromise<FileStructure>Modifiersasync | ||||||||||||||
| bytes | () => Promise<…> | |||||||||||||
Read the file contents as bytes. ReturnsPromise<Uint8Array<ArrayBuffer>>Modifiersasync | ||||||||||||||
| stream | () => ReadableStream<…> | |||||||||||||
Create a readable stream for the file contents. ReturnsReadableStream<Uint8Array<ArrayBuffer>> | ||||||||||||||
| 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 | ||||||||||||||
Extends
File<DirectoryTypes, Path, Extension>Type
(entry: FileSystemEntry<Types>) => entry is Entry | (entry: FileSystemEntry<Types>) => Promise<boolean> | boolean | stringType Parameters
| Parameter | Constraint | Default |
|---|---|---|
Types | Record<string, any> | {} |
LoaderTypes | WithDefaultTypes<Types> | WithDefaultTypes<Types> |
Loaders | ModuleLoaders | ModuleRuntimeLoader<any> | Partial<Record<string, () => Promise<any>>> | ModuleLoaders | ModuleRuntimeLoader<any> | Partial<Record<string, () => Promise<any>>> |
Schema | DirectorySchema | undefined | DirectorySchema | undefined |
Filter | DirectoryFilter<FileSystemEntry<ApplyDirectorySchema<LoaderTypes, Schema>, undefined>, ApplyDirectorySchema<LoaderTypes, Schema>> | undefined | DirectoryFilter<FileSystemEntry<ApplyDirectorySchema<LoaderTypes, Schema>, undefined>, ApplyDirectorySchema<LoaderTypes, Schema>> | undefined |
Properties
| Property | Type | Modifiers |
|---|---|---|
| path? | PathLike | — |
Directory path in the workspace. | ||
| filter? | Filter | — |
Filter entries with a minimatch pattern or predicate. | ||
| schema? | Schema | — |
Directory schema (global or per-extension). | ||
| loader? | Loaders | () => Loaders | — |
Extension loaders, a runtime loader, or an | ||
| basePathname? | string | null | — |
Base route prepended to descendant | ||
| tsConfigPath? | string | — |
Uses the closest | ||
| slugCasing? | SlugCasing | — |
Slug casing applied to route segments. | ||
| sort? | SortDescriptor<FileSystemEntry<ApplyDirectorySchema<LoaderTypes, NoInferType<Schema>>, undefined>> | — |
Sort callback applied at each directory depth. | ||
Type Parameters
| Parameter | Constraint | Default |
|---|---|---|
Types | Record<string, any> | {} |
LoaderTypes | WithDefaultTypes<Types> | WithDefaultTypes<Types> |
Loaders | ModuleLoaders | ModuleRuntimeLoader<any> | Partial<Record<string, () => Promise<any>>> | ModuleLoaders | ModuleRuntimeLoader<any> | Partial<Record<string, () => Promise<any>>> |
Schema | DirectorySchema | undefined | DirectorySchema | undefined |
Filter | DirectoryFilter<FileSystemEntry<ApplyDirectorySchema<LoaderTypes, Schema>, undefined>, ApplyDirectorySchema<LoaderTypes, Schema>> | undefined | DirectoryFilter<FileSystemEntry<ApplyDirectorySchema<LoaderTypes, Schema>, undefined>, ApplyDirectorySchema<LoaderTypes, Schema>> | undefined |
Extends
BaseDirectoryOptions<Types, LoaderTypes, Loaders, Schema, Filter>Properties
| Property | Type | Modifiers |
|---|---|---|
| repository? | RepositoryInput | — |
The repository used for git-backed operations. | ||
| path? | PathLike | — |
Directory path in the workspace. | ||
| filter? | Filter | — |
Filter entries with a minimatch pattern or predicate. | ||
| schema? | Schema | — |
Directory schema (global or per-extension). | ||
| loader? | Loaders | () => Loaders | — |
Extension loaders, a runtime loader, or an | ||
| basePathname? | string | null | — |
Base route prepended to descendant | ||
| tsConfigPath? | string | — |
Uses the closest | ||
| slugCasing? | SlugCasing | — |
Slug casing applied to route segments. | ||
| sort? | SortDescriptor<FileSystemEntry<ApplyDirectorySchema<LoaderTypes, NoInferType<Schema>>, undefined>> | — |
Sort callback applied at each directory depth. | ||
Type Parameters
| Parameter | Constraint | Default |
|---|---|---|
Types | Record<string, any> | {} |
LoaderTypes | WithDefaultTypes<Types> | WithDefaultTypes<Types> |
Loaders | ModuleLoaders | ModuleRuntimeLoader<any> | Partial<Record<string, () => Promise<any>>> | ModuleLoaders | ModuleRuntimeLoader<any> | Partial<Record<string, () => Promise<any>>> |
Schema | DirectorySchema | undefined | DirectorySchema | undefined |
Filter | DirectoryFilter<FileSystemEntry<ApplyDirectorySchema<LoaderTypes, Schema>, undefined>, ApplyDirectorySchema<LoaderTypes, Schema>> | undefined | DirectoryFilter<FileSystemEntry<ApplyDirectorySchema<LoaderTypes, Schema>, undefined>, ApplyDirectorySchema<LoaderTypes, Schema>> | undefined |
Extends
BaseDirectoryOptions<Types, LoaderTypes, Loaders, Schema, Filter>Properties
| Property | Type | Modifiers |
|---|---|---|
| fileSystem | FileSystem | — |
Custom file‑system adapter (escape hatch). | ||
| repository? | RepositoryInput | — |
Optional repository for git-backed metadata and URLs. | ||
| path? | PathLike | — |
Directory path in the workspace. | ||
| filter? | Filter | — |
Filter entries with a minimatch pattern or predicate. | ||
| schema? | Schema | — |
Directory schema (global or per-extension). | ||
| loader? | Loaders | () => Loaders | — |
Extension loaders, a runtime loader, or an | ||
| basePathname? | string | null | — |
Base route prepended to descendant | ||
| tsConfigPath? | string | — |
Uses the closest | ||
| slugCasing? | SlugCasing | — |
Slug casing applied to route segments. | ||
| sort? | SortDescriptor<FileSystemEntry<ApplyDirectorySchema<LoaderTypes, NoInferType<Schema>>, undefined>> | — |
Sort callback applied at each directory depth. | ||
Type
GitDirectoryOptions<Types, LoaderTypes, Loaders, Schema, Filter> | FileSystemDirectoryOptions<Types, LoaderTypes, Loaders, Schema, Filter>A directory containing files and subdirectories in the file system.
Constructor
new Directory<Types, LoaderTypes, Loaders, Schema, Filter>(options?)Type Parameters
| Parameter | Constraint | Default |
|---|---|---|
Types | Record<string, any> | {} |
LoaderTypes | WithDefaultTypes<Types> | WithDefaultTypes<Types> |
Loaders | ModuleLoaders | ModuleRuntimeLoader<any> | Partial<Record<string, () => Promise<any>>> | ModuleLoaders | ModuleRuntimeLoader<any> | Partial<Record<string, () => Promise<any>>> |
Schema | DirectorySchema | undefined | DirectorySchema | undefined |
Filter | DirectoryFilter<FileSystemEntry<ApplyDirectorySchema<LoaderTypes, Schema>, undefined>, ApplyDirectorySchema<LoaderTypes, Schema>> | undefined | DirectoryFilter<FileSystemEntry<ApplyDirectorySchema<LoaderTypes, Schema>, undefined>, ApplyDirectorySchema<LoaderTypes, Schema>> | undefined |
Parameters
| Parameter | Type | Default Value |
|---|---|---|
| options? | GitDirectoryOptions<Types, LoaderTypes, Loaders, Schema, Filter> | — |
new Directory<Types, LoaderTypes, Loaders, Schema, Filter>(options)Type Parameters
| Parameter | Constraint | Default |
|---|---|---|
Types | Record<string, any> | {} |
LoaderTypes | WithDefaultTypes<Types> | WithDefaultTypes<Types> |
Loaders | ModuleLoaders | ModuleRuntimeLoader<any> | Partial<Record<string, () => Promise<any>>> | ModuleLoaders | ModuleRuntimeLoader<any> | Partial<Record<string, () => Promise<any>>> |
Schema | DirectorySchema | undefined | DirectorySchema | undefined |
Filter | DirectoryFilter<FileSystemEntry<ApplyDirectorySchema<LoaderTypes, Schema>, undefined>, ApplyDirectorySchema<LoaderTypes, Schema>> | undefined | DirectoryFilter<FileSystemEntry<ApplyDirectorySchema<LoaderTypes, Schema>, undefined>, ApplyDirectorySchema<LoaderTypes, Schema>> | undefined |
Parameters
| Parameter | Type | Default Value |
|---|---|---|
| options | FileSystemDirectoryOptions<Types, LoaderTypes, Loaders, Schema, Filter> | — |
new Directory<Types, LoaderTypes, Loaders, Schema, Filter>(options?)Type Parameters
| Parameter | Constraint | Default |
|---|---|---|
Types | Record<string, any> | {} |
LoaderTypes | WithDefaultTypes<Types> | WithDefaultTypes<Types> |
Loaders | ModuleLoaders | ModuleRuntimeLoader<any> | Partial<Record<string, () => Promise<any>>> | ModuleLoaders | ModuleRuntimeLoader<any> | Partial<Record<string, () => Promise<any>>> |
Schema | DirectorySchema | undefined | DirectorySchema | undefined |
Filter | DirectoryFilter<FileSystemEntry<ApplyDirectorySchema<LoaderTypes, Schema>, undefined>, ApplyDirectorySchema<LoaderTypes, Schema>> | undefined | DirectoryFilter<FileSystemEntry<ApplyDirectorySchema<LoaderTypes, Schema>, undefined>, ApplyDirectorySchema<LoaderTypes, Schema>> | undefined |
Parameters
| Parameter | Type | Default Value |
|---|---|---|
| options? | GitDirectoryOptions<Types, LoaderTypes, Loaders, Schema, Filter> | FileSystemDirectoryOptions<Types, LoaderTypes, Loaders, Schema, Filter> | — |
Accessors
| Accessor | Type | |
|---|---|---|
| depth | number | |
Get the depth of the directory starting from the root directory. | ||
| slug | string | |
Get the slug of this directory. | ||
| name | string | |
The directory name. | ||
| baseName | string | |
The base name of this directory. | ||
| title | string | |
The directory name formatted as a title. | ||
| relativePath | string | |
The relative path of this directory to the root directory. | ||
| workspacePath | string | |
The relative path of the directory to the workspace. | ||
| absolutePath | string | |
The absolute path of this directory. | ||
Methods
| Method | Type | ||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| getFilterPatternKind | () => "recursive" | "shallow" | null | ||||||||||||||||||||||||||||||||||||||||||||||
Returns the glob filter pattern kind for this directory if defined. Returns"recursive" | "shallow" | null | |||||||||||||||||||||||||||||||||||||||||||||||
| getSchema | () => undefined | DirectorySchema | ||||||||||||||||||||||||||||||||||||||||||||||
Get the schema configuration for this directory. Returnsundefined | DirectorySchema | |||||||||||||||||||||||||||||||||||||||||||||||
| getFileSystem | () => FileSystem | ||||||||||||||||||||||||||||||||||||||||||||||
Get the file system for this directory. ReturnsFileSystem | |||||||||||||||||||||||||||||||||||||||||||||||
| getRepository | (repository?: RepositoryInput | undefined) => Repository | ||||||||||||||||||||||||||||||||||||||||||||||
Get the Parameters
ReturnsRepository | |||||||||||||||||||||||||||||||||||||||||||||||
| getRepositoryIfAvailable | () => undefined | Repository | ||||||||||||||||||||||||||||||||||||||||||||||
Returnsundefined | Repository | |||||||||||||||||||||||||||||||||||||||||||||||
| getFile | <Path, Extension>(path: Path) => Promise<…> (+2 overloads) | ||||||||||||||||||||||||||||||||||||||||||||||
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<JavaScriptFileExtensionTypes<Extension, ResolveDirectoryTypes<LoaderTypes, Loaders, Schema>>, any, string, Extension> : Extension extends "mdx" ? MDXFile<WithUnknownExportsIfNoConcreteSchema<Schema, ResolveDirectoryTypes<LoaderTypes, Loaders, Schema>["mdx"]>, any, string, Extension> : Extension extends "md" ? MarkdownFile<WithUnknownExportsIfNoConcreteSchema<Schema, ResolveDirectoryTypes<LoaderTypes, Loaders, Schema>["md"]>, any, string, Extension, undefined> : Extension extends "json" ? JSONFile<JSONExtensionType<ResolveDirectoryTypes<LoaderTypes, Loaders, Schema>> & Record<string, any>, any, string, Extension> : File<any, Path, Extension> : File<any, string, string>>ModifiersasyncOverload 2Type Parameters
Parameters
ReturnsPromise<IsJavaScriptLikeExtension<Extension> extends true ? JavaScriptFile<JavaScriptFileExtensionTypes<Extension, ResolveDirectoryTypes<LoaderTypes, Loaders, Schema>>, any, string, Extension> : Extension extends "mdx" ? MDXFile<WithUnknownExportsIfNoConcreteSchema<Schema, ResolveDirectoryTypes<LoaderTypes, Loaders, Schema>["mdx"]>, any, string, Extension> : Extension extends "md" ? MarkdownFile<WithUnknownExportsIfNoConcreteSchema<Schema, ResolveDirectoryTypes<LoaderTypes, Loaders, Schema>["md"]>, any, string, Extension, undefined> : Extension extends "json" ? JSONFile<JSONExtensionType<ResolveDirectoryTypes<LoaderTypes, Loaders, Schema>> & Record<string, any>, any, string, Extension> : File<any, Extension, ExtractFileExtension<Extension>>>ModifiersasyncOverload 3Type Parameters
Parameters
ReturnsPromise<ExtensionElement<Extension> extends infer Ext extends string ? IsJavaScriptLikeExtension<Ext> extends true ? JavaScriptFile<JavaScriptFileExtensionTypes<Ext, ResolveDirectoryTypes<LoaderTypes, Loaders, Schema>>, any, string, Ext> : Ext extends "mdx" ? MDXFile<WithUnknownExportsIfNoConcreteSchema<Schema, ResolveDirectoryTypes<LoaderTypes, Loaders, Schema>["mdx"]>, any, string, Ext> : Ext extends "md" ? MarkdownFile<WithUnknownExportsIfNoConcreteSchema<Schema, ResolveDirectoryTypes<LoaderTypes, Loaders, Schema>["md"]>, any, string, Ext, undefined> : Ext extends "json" ? JSONFile<JSONExtensionType<ResolveDirectoryTypes<LoaderTypes, Loaders, Schema>> & Record<string, any>, any, string, Ext> : File<any, Ext, ExtractFileExtension<Ext>> : File<any, string, string>>Modifiersasync | |||||||||||||||||||||||||||||||||||||||||||||||
| getDirectory | (path: string | Array<…>) => Promise<…> | ||||||||||||||||||||||||||||||||||||||||||||||
Get a directory at the specified Parameters
ReturnsPromise<Directory<LoaderTypes, WithDefaultTypes<LoaderTypes>, DirectoryLoader, DirectorySchema | undefined, DirectoryFilter<FileSystemEntry<ApplyDirectorySchema<WithDefaultTypes<LoaderTypes>, DirectorySchema | undefined>, undefined>, ApplyDirectorySchema<WithDefaultTypes<LoaderTypes>, DirectorySchema | undefined>> | undefined>>Modifiersasync | |||||||||||||||||||||||||||||||||||||||||||||||
| getEntry | (path: string | Array<…>) => Promise<…> | ||||||||||||||||||||||||||||||||||||||||||||||
Get a directory or file at the specified
Parameters
ReturnsPromise<FileSystemEntry<LoaderTypes, undefined>>Modifiersasync | |||||||||||||||||||||||||||||||||||||||||||||||
| invalidateSnapshots | () => void | ||||||||||||||||||||||||||||||||||||||||||||||
Returnsvoid | |||||||||||||||||||||||||||||||||||||||||||||||
| getEntries | <ProvidedFilter>(options?: { filter?: ProvidedFilter; recursive?: DirectoryEntriesRecursiveOption<…>; includeDirectoryNamedFiles?: boolean; includeIndexAndReadmeFiles?: boolean; includeGitIgnoredFiles?: boolean; includeTsConfigExcludedFiles?: boolean; includeHiddenFiles?: boolean; }) => Promise<…> | ||||||||||||||||||||||||||||||||||||||||||||||
Retrieves all entries (files and directories) within the current directory
that are not excluded by Git ignore rules or the closest Type Parameters
Parameters
ReturnsPromise<Array<ResolveDirectoryFilterEntries<ProvidedFilter extends undefined ? Filter : ProvidedFilter, ApplyDirectorySchema<LoaderTypes, Schema>>>>Modifiersasync | |||||||||||||||||||||||||||||||||||||||||||||||
| getStructure | () => Promise<…> | ||||||||||||||||||||||||||||||||||||||||||||||
ReturnsPromise<Array<DirectoryStructure | FileStructure>>Modifiersasync | |||||||||||||||||||||||||||||||||||||||||||||||
| getRootPath | () => string | ||||||||||||||||||||||||||||||||||||||||||||||
Get the root directory path. Returnsstring | |||||||||||||||||||||||||||||||||||||||||||||||
| getParent | () => Directory<…> | ||||||||||||||||||||||||||||||||||||||||||||||
Get the parent directory containing this directory. ReturnsDirectory<any, any, any, DirectorySchema | undefined, DirectoryFilter<FileSystemEntry<ApplyDirectorySchema<any, DirectorySchema | undefined>, undefined>, ApplyDirectorySchema<any, DirectorySchema | undefined>> | undefined> | |||||||||||||||||||||||||||||||||||||||||||||||
| 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 | |||||||||||||||||||||||||||||||||||||||||||||||
| 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> | |||||||||||||||||||||||||||||||||||||||||||||||
| getHistoryUrl | (options?: (Pick<…> & { repository?: RepositoryInput; }) | undefined) => string | ||||||||||||||||||||||||||||||||||||||||||||||
Get the URL to the directory history for the configured git repository. Parameters
Returnsstring | |||||||||||||||||||||||||||||||||||||||||||||||
| getSourceUrl | (options?: (Pick<…> & { repository?: RepositoryInput; }) | 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 | Record<string, any> | never |
Entries | Array<FileSystemEntry<any, undefined>> | Array<FileSystemEntry<any, undefined>> |
Loaders | ModuleLoaders | {} | { [x: string]: ModuleRuntimeLoader<ModuleExports<unknown>>; } | { [x: string]: ModuleRuntimeLoader<Omit<ModuleExports<unknown>, never>>; } | { [x: string]: ModuleRuntimeLoader<Merge<ModuleExports<unknown>, InferModuleExports<Record<string, StandardSchemaV1<unknown, unknown> | ModuleExportValidator<Record<string, unknown>, Record<string, unknown>>>>>>; } | { [x: string]: ModuleRuntimeLoader<Merge<ModuleExports<unknown>, InferModuleExports<Partial<Record<string, DirectorySchemaOption>>>>>; } | { [x: string]: ModuleRuntimeLoader<UnknownModuleExports>; } | { [x: string]: ModuleRuntimeLoader<Omit<UnknownModuleExports, never>>; } | { [x: string]: ModuleRuntimeLoader<Merge<UnknownModuleExports, InferModuleExports<Record<string, StandardSchemaV1<unknown, unknown> | ModuleExportValidator<Record<string, unknown>, Record<string, unknown>>>>>>; } | { [x: string]: ModuleRuntimeLoader<Merge<UnknownModuleExports, InferModuleExports<Partial<Record<string, DirectorySchemaOption>>>>>; } | { [x: string]: ModuleRuntimeLoader<UnknownModuleExports>; } | { [x: string]: ModuleRuntimeLoader<Omit<UnknownModuleExports, never>>; } | { [x: string]: ModuleRuntimeLoader<Merge<UnknownModuleExports, InferModuleExports<Record<string, StandardSchemaV1<unknown, unknown> | ModuleExportValidator<Record<string, unknown>, Record<string, unknown>>>>>>; } | { [x: string]: ModuleRuntimeLoader<Merge<UnknownModuleExports, InferModuleExports<Partial<Record<string, DirectorySchemaOption>>>>>; } |
Parameters
| Parameter | Type | Default Value |
|---|---|---|
| options | CollectionOptions<Entries> | — |
Methods
| Method | Type | |||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 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<CollectionResolvedTypes<Types, Entries, Loaders>, undefined>>Modifiersasync | ||||||||||||||||||||
| getFile | <Path, Extension>(path: Path, 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<CollectionModuleType<CollectionResolvedTypes<Types, Entries, Loaders>, Extension>, Record<string, any>, string, string> : Extension extends "mdx" ? MDXFile<CollectionModuleType<CollectionResolvedTypes<Types, Entries, Loaders>, "mdx">, Record<string, any>, string, string> : Extension extends "md" ? MarkdownFile<CollectionModuleType<CollectionResolvedTypes<Types, Entries, Loaders>, "md">, Record<string, any>, string, string, undefined> : File<CollectionResolvedTypes<Types, Entries, Loaders>, string, string> : Path extends string ? ExtractFileExtension<Path> extends infer PathExtension extends string ? IsJavaScriptLikeExtension<PathExtension> extends true ? JavaScriptFile<CollectionModuleType<CollectionResolvedTypes<Types, Entries, Loaders>, PathExtension>, Record<string, any>, string, string> : PathExtension extends "mdx" ? MDXFile<CollectionModuleType<CollectionResolvedTypes<Types, Entries, Loaders>, "mdx">, Record<string, any>, string, string> : PathExtension extends "md" ? MarkdownFile<CollectionModuleType<CollectionResolvedTypes<Types, Entries, Loaders>, "md">, Record<string, any>, string, string, undefined> : File<CollectionResolvedTypes<Types, Entries, Loaders>, string, string> : File<CollectionResolvedTypes<Types, Entries, Loaders>, string, string> : File<CollectionResolvedTypes<Types, Entries, Loaders>, string, string>>Modifiersasync | ||||||||||||||||||||
| getDirectory | (path: string | Array<…>) => Promise<…> | |||||||||||||||||||
Get a directory at the specified path. Parameters
ReturnsPromise<Directory<CollectionResolvedTypes<Types, Entries, Loaders>, WithDefaultTypes<CollectionResolvedTypes<Types, Entries, Loaders>>, DirectoryLoader, DirectorySchema | undefined, DirectoryFilter<FileSystemEntry<ApplyDirectorySchema<WithDefaultTypes<CollectionResolvedTypes<Types, Entries, Loaders>>, DirectorySchema | undefined>, undefined>, ApplyDirectorySchema<WithDefaultTypes<CollectionResolvedTypes<Types, Entries, Loaders>>, DirectorySchema | undefined>> | undefined>>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>>, { [x: string]: ModuleRuntimeLoader<ModuleExports<unknown>>; } & { [x: string]: ModuleRuntimeLoader<Omit<ModuleExports<unknown>, never>>; } & { [x: string]: ModuleRuntimeLoader<Merge<ModuleExports<unknown>, InferModuleExports<Record<string, StandardSchemaV1<unknown, unknown> | ModuleExportValidator<Record<string, unknown>, Record<string, unknown>>>>>>; } & { [x: string]: ModuleRuntimeLoader<Merge<ModuleExports<unknown>, InferModuleExports<Partial<Record<string, DirectorySchemaOption>>>>>; } & { [x: string]: ModuleRuntimeLoader<UnknownModuleExports>; } & { [x: string]: ModuleRuntimeLoader<Omit<UnknownModuleExports, never>>; } & { [x: string]: ModuleRuntimeLoader<Merge<UnknownModuleExports, InferModuleExports<Record<string, StandardSchemaV1<unknown, unknown> | ModuleExportValidator<Record<string, unknown>, Record<string, unknown>>>>>>; } & { [x: string]: ModuleRuntimeLoader<Merge<UnknownModuleExports, InferModuleExports<Partial<Record<string, DirectorySchemaOption>>>>>; } & { [x: string]: ModuleRuntimeLoader<UnknownModuleExports>; } & { [x: string]: ModuleRuntimeLoader<Omit<UnknownModuleExports, never>>; } & { [x: string]: ModuleRuntimeLoader<Merge<UnknownModuleExports, InferModuleExports<Record<string, StandardSchemaV1<unknown, unknown> | ModuleExportValidator<Record<string, unknown>, Record<string, unknown>>>>>>; } & { [x: string]: ModuleRuntimeLoader<Merge<UnknownModuleExports, InferModuleExports<Partial<Record<string, DirectorySchemaOption>>>>>; }> | 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>Methods
| Method | Signature | Modifiers | ||||||
|---|---|---|---|---|---|---|---|---|
| readDirectorySync | (path?: string) => Array<…> | — | ||||||
Parameters
ReturnsArray<DirectoryEntry> | ||||||||
| readFileSync | (path: string) => string | — | ||||||
Parameters
Returnsstring | ||||||||
| readFileBinarySync | (path: string) => Uint8Array<…> | — | ||||||
Parameters
ReturnsUint8Array<ArrayBufferLike> | ||||||||
| readFileStream | (path: string) => FileReadableStream | — | ||||||
Parameters
ReturnsFileReadableStream | ||||||||
| getFileByteLengthSync | (path: string) => number | undefined | — | ||||||
Get the size of a file in bytes. Implementations should return Parameters
Returnsnumber | undefined | ||||||||
| fileExistsSync | (path: string) => boolean | — | ||||||
Check synchronously if a file exists at the given path. Parameters
Returnsboolean | ||||||||
| getFileLastModifiedMsSync | (path: string) => number | undefined | — | ||||||
Get the last modified timestamp of a file or directory in milliseconds.
Implementations should return Parameters
Returnsnumber | undefined | ||||||||
Methods
| Method | Signature | Modifiers | ||||||
|---|---|---|---|---|---|---|---|---|
| readDirectory | (path?: string) => Promise<…> | async | ||||||
Parameters
ReturnsPromise<Array<DirectoryEntry>>Modifiersasync | ||||||||
| readFile | (path: string) => Promise<…> | async | ||||||
Parameters
ReturnsPromise<string>Modifiersasync | ||||||||
| readFileBinary | (path: string) => Promise<…> | async | ||||||
Parameters
ReturnsPromise<Uint8Array<ArrayBufferLike>>Modifiersasync | ||||||||
| readFileStream | (path: string) => FileReadableStream | — | ||||||
Parameters
ReturnsFileReadableStream | ||||||||
| getFileByteLength | (path: string) => Promise<…> | async | ||||||
Get the size of a file in bytes. Implementations should return Parameters
ReturnsPromise<number | undefined>Modifiersasync | ||||||||
| fileExists | (path: string) => Promise<…> | async | ||||||
Check if a file exists at the given path. Parameters
ReturnsPromise<boolean>Modifiersasync | ||||||||
| getFileLastModifiedMs | (path: string) => Promise<…> | async | ||||||
Get the last modified timestamp of a file or directory in milliseconds.
Implementations should return Parameters
ReturnsPromise<number | undefined>Modifiersasync | ||||||||
Methods
| Method | Signature | Modifiers | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| writeFileSync | (path: string, content: FileSystemWriteFileContent) => void | — | ||||||||||||
Parameters
Returnsvoid | ||||||||||||||
| writeFile | (path: string, content: FileSystemWriteFileContent) => Promise<…> | async | ||||||||||||
Parameters
ReturnsPromise<void>Modifiersasync | ||||||||||||||
| writeFileStream | (path: string) => FileWritableStream | — | ||||||||||||
Parameters
ReturnsFileWritableStream | ||||||||||||||
| deleteFileSync | (path: string) => void | — | ||||||||||||
Parameters
Returnsvoid | ||||||||||||||
| deleteFile | (path: string) => Promise<…> | async | ||||||||||||
Parameters
ReturnsPromise<void>Modifiersasync | ||||||||||||||
| createDirectory | (path: string) => Promise<…> | async | ||||||||||||
Parameters
ReturnsPromise<void>Modifiersasync | ||||||||||||||
| rename | (source: string, target: string, options?: { overwrite?: boolean; }) => Promise<…> | async | ||||||||||||
Parameters
ReturnsPromise<void>Modifiersasync | ||||||||||||||
| copy | (source: string, target: string, options?: { overwrite?: boolean; }) => Promise<…> | async | ||||||||||||
Parameters
ReturnsPromise<void>Modifiersasync | ||||||||||||||
Intersects
BaseFileSystem & SyncFileSystem & AsyncFileSystem & WritableFileSystemConstructor
new BaseFileSystem(options?)Parameters
| Parameter | Type | Default Value |
|---|---|---|
| options? | FileSystemOptions | {} |
Methods
| Method | Type | ||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| getProjectOptions | () => ProjectOptions | ||||||||||||||||
ModifiersabstractReturnsProjectOptions | |||||||||||||||||
| getAbsolutePath | (path: string) => string | ||||||||||||||||
ModifiersabstractParameters
Returnsstring | |||||||||||||||||
| getRelativePathToWorkspace | (path: string) => string | ||||||||||||||||
ModifiersabstractParameters
Returnsstring | |||||||||||||||||
| getPathname | (path: PathLike, options?: { basePath?: string; rootPath?: string; }) => string | ||||||||||||||||
Parameters
Returnsstring | |||||||||||||||||
| shouldStripInternal | () => boolean | ||||||||||||||||
Whether compilerOptions.stripInternal is enabled in the active tsconfig. Returnsboolean | |||||||||||||||||
| shouldStripInternalAsync | () => Promise<…> | ||||||||||||||||
ReturnsPromise<boolean>Modifiersasync | |||||||||||||||||
| isFilePathExcludedFromTsConfig | (filePath: string, isDirectory?: boolean) => boolean | ||||||||||||||||
Parameters
Returnsboolean | |||||||||||||||||
| isFilePathExcludedFromTsConfigAsync | (filePath: string, isDirectory?: boolean) => Promise<…> | ||||||||||||||||
Parameters
ReturnsPromise<boolean>Modifiersasync | |||||||||||||||||
| isFilePathGitIgnored | (filePath: string) => boolean | ||||||||||||||||
ModifiersabstractParameters
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 | |||||||||||||||||
| getOutlineRanges | (filePath: string) => Promise<…> | ||||||||||||||||
Parameters
ReturnsPromise<Array<OutlineRange>>Modifiersasync | |||||||||||||||||
| getFoldingRanges | (filePath: string) => Promise<…> | ||||||||||||||||
Parameters
ReturnsPromise<Array<OutlineRange>>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 GitFileSystem(options)Parameters
| Parameter | Type | Default Value |
|---|---|---|
| options | GitFileSystemOptions | — |
Properties
| Property | Type | Default Value | |
|---|---|---|---|
| repository | string | — | |
Modifiersreadonly | |||
| cloneDepth? | undefined | number | — | |
Modifiersreadonly | |||
| repositoryIsRemote | boolean | — | |
Modifiersreadonly | |||
| repoRoot | string | — | |
| ref | string | — | |
Modifiersreadonly | |||
| cacheDirectory | string | — | |
Modifiersreadonly | |||
| verbose | boolean | — | |
Modifiersreadonly | |||
| maxBufferBytes | number | — | |
Modifiersreadonly | |||
| maxDepth | number | — | |
Modifiersreadonly | |||
| autoPrepare | boolean | — | |
Modifiersreadonly | |||
| prepareScopeDirectories | Array<string> | — | |
Modifiersreadonly | |||
| prepareTransport | "https" | "ssh" | — | |
Modifiersreadonly | |||
| autoFetch | boolean | — | |
Modifiersreadonly | |||
| fetchRemote | string | — | |
Modifiersreadonly | |||
Methods
| Method | Type | |||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| getProjectOptions | () => { tsConfigFilePath: string; } | |||||||||||||
Returns
| ||||||||||||||
| getGitFileMetadata | (path: string) => Promise<…> | |||||||||||||
Parameters
ReturnsPromise<GitMetadata>Modifiersasync | ||||||||||||||
| getGitExportMetadata | (path: string, _startLine: number, _endLine: number) => Promise<…> | |||||||||||||
Parameters
ReturnsPromise<GitExportMetadata>Modifiersasync | ||||||||||||||
| 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 | ||||||||||||||
| getFileLastModifiedMsSync | (path: string) => number | undefined | |||||||||||||
Parameters
Returnsnumber | undefined | ||||||||||||||
| getFileLastModifiedMs | (path: string) => Promise<…> | |||||||||||||
Parameters
ReturnsPromise<number | undefined>Modifiersasync | ||||||||||||||
| deleteFileSync | (path: string) => void | |||||||||||||
Parameters
Returnsvoid | ||||||||||||||
| deleteFile | (path: string) => Promise<…> | |||||||||||||
Parameters
ReturnsPromise<void>Modifiersasync | ||||||||||||||
| createDirectory | (path: string) => Promise<…> | |||||||||||||
Parameters
ReturnsPromise<void>Modifiersasync | ||||||||||||||
| rename | (source: string, target: string, options?: { overwrite?: boolean; }) => Promise<…> | |||||||||||||
Parameters
ReturnsPromise<void>Modifiersasync | ||||||||||||||
| copy | (source: string, target: string, options?: { overwrite?: boolean; }) => Promise<…> | |||||||||||||
Parameters
ReturnsPromise<void>Modifiersasync | ||||||||||||||
| isFilePathGitIgnored | (filePath: string) => boolean | |||||||||||||
Parameters
Returnsboolean | ||||||||||||||
| close | () => void | |||||||||||||
Returnsvoid | ||||||||||||||
| [Symbol.dispose] | () => void | |||||||||||||
Returnsvoid | ||||||||||||||
| getExportHistory | (options?: ExportHistoryOptions) => ExportHistoryGenerator | |||||||||||||
Get the export history of a repository based on a set of entry files. Parameters
ReturnsExportHistoryGeneratorModifiersasync, generator | ||||||||||||||
| getMetadata | <Path>(filePath: Path) => Promise<…> | |||||||||||||
Get metadata for a file or module. Type Parameters
Parameters
ReturnsPromise<MetadataForPath<Path>>Modifiersasync | ||||||||||||||
| getFileMetadata | (filePath: string) => Promise<…> | |||||||||||||
Get metadata for a file. Parameters
ReturnsPromise<GitFileMetadata>Modifiersasync | ||||||||||||||
| getModuleMetadata | (filePath: string) => Promise<…> | |||||||||||||
Get metadata for a JavaScript module file (exports at current ref only). Parameters
ReturnsPromise<GitModuleMetadata>Modifiersasync | ||||||||||||||
| __@dispose@26161 | () => void | |||||||||||||
Returnsvoid | ||||||||||||||
Extends
BaseFileSystemImplements
AsyncFileSystem, SyncFileSystem, WritableFileSystemConstructor
new GitVirtualFileSystem(options)Parameters
| Parameter | Type | Default Value |
|---|---|---|
| options | GitVirtualFileSystemOptions | — |
Methods
| Method | Type | |||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| clearCache | () => void | |||||||||||||
Returnsvoid | ||||||||||||||
| getGitFileMetadata | (path: string) => Promise<…> | |||||||||||||
Parameters
ReturnsPromise<GitMetadata>Modifiersasync | ||||||||||||||
| getGitExportMetadata | (path: string, startLine: number, endLine: number) => Promise<…> | |||||||||||||
Parameters
ReturnsPromise<GitExportMetadata>Modifiersasync | ||||||||||||||
| getMetadata | <Path>(filePath: Path) => Promise<…> | |||||||||||||
Get metadata for a file or module. Type Parameters
Parameters
ReturnsPromise<MetadataForPath<Path>>Modifiersasync | ||||||||||||||
| getFileMetadata | (filePath: string) => Promise<…> | |||||||||||||
Get metadata for a file. Parameters
ReturnsPromise<GitFileMetadata>Modifiersasync | ||||||||||||||
| getModuleMetadata | (filePath: string) => Promise<…> | |||||||||||||
Get metadata for a JavaScript module file (exports at current ref only). Parameters
ReturnsPromise<GitModuleMetadata>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 | ||||||||||||||
| getExportHistory | (options?: ExportHistoryOptions) => ExportHistoryGenerator | |||||||||||||
Get the export history of a repository based on a set of entry files. Parameters
ReturnsExportHistoryGeneratorModifiersasync, generator | ||||||||||||||
| isFilePathGitIgnored | () => boolean | |||||||||||||
Returnsboolean | ||||||||||||||
| isFilePathExcludedFromTsConfig | () => boolean | |||||||||||||
Returnsboolean | ||||||||||||||
Extends
InMemoryFileSystemImplements
AsyncFileSystem, WritableFileSystemA file system that stores files in memory.
Constructor
new InMemoryFileSystem(files)Parameters
| Parameter | Type | Default Value |
|---|---|---|
| files | { [path: string]: InMemoryFileContent; } | — |
Methods
| Method | Type | |||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| getFileExports | (filePath: string) => Promise<…> | |||||||||||||||||||||||||
Parameters
ReturnsPromise<Array<ModuleExport>>Modifiersasync | ||||||||||||||||||||||||||
| createFile | (path: string, content: InMemoryFileContent) => 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, InMemoryEntry> | ||||||||||||||||||||||||||
| getFileEntry | (path: string) => InMemoryEntry | undefined | |||||||||||||||||||||||||
Parameters
ReturnsInMemoryEntry | 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 | ||||||||||||||||||||||||||
| 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 | ||||||||||||||||||||||||||
| createDirectory | (path: string) => Promise<…> | |||||||||||||||||||||||||
Parameters
ReturnsPromise<void>Modifiersasync | ||||||||||||||||||||||||||
| rename | (source: string, target: string, options?: { overwrite?: boolean; }) => Promise<…> | |||||||||||||||||||||||||
Parameters
ReturnsPromise<void>Modifiersasync | ||||||||||||||||||||||||||
| copy | (source: string, target: string, options?: { overwrite?: boolean; }) => 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
BaseFileSystemImplements
AsyncFileSystem, SyncFileSystem, WritableFileSystemConstructor
new NodeFileSystem(options?)Parameters
| Parameter | Type | Default Value |
|---|---|---|
| options? | FileSystemOptions | {} |
Methods
| Method | Type | |||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 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 | ||||||||||||||
| createDirectory | (path: string) => Promise<…> | |||||||||||||
Parameters
ReturnsPromise<void>Modifiersasync | ||||||||||||||
| rename | (source: string, target: string, options?: { overwrite?: boolean; }) => Promise<…> | |||||||||||||
Parameters
ReturnsPromise<void>Modifiersasync | ||||||||||||||
| copy | (source: string, target: string, options?: { overwrite?: boolean; }) => 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
BaseFileSystemImplements
AsyncFileSystem, SyncFileSystem, WritableFileSystemType Parameters
| Parameter | Constraint | Default |
|---|---|---|
Types | Record<string, any> | Record<string, any> |
LoaderTypes | WithDefaultTypes<Types> | WithDefaultTypes<Types> |
Extends
Omit<DirectoryOptions<Types, LoaderTypes, any, undefined>, "path" | "fileSystem">Properties
| Property | Type | Modifiers |
|---|---|---|
| path? | PathLike | — |
| repository? | RepositoryInput | — |
The repository used for git-backed operations. | ||
| sort? | SortDescriptor<FileSystemEntry<ApplyDirectorySchema<LoaderTypes, NoInferType<Schema>>, undefined>> | — |
Sort callback applied at each directory depth. | ||
| filter? | Filter | — |
Filter entries with a minimatch pattern or predicate. | ||
| schema? | Schema | — |
Directory schema (global or per-extension). | ||
| loader? | Loaders | () => Loaders | — |
Extension loaders, a runtime loader, or an | ||
| 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 | Record<string, any> | Record<string, any> |
LoaderTypes | WithDefaultTypes<Types> | WithDefaultTypes<Types> |
ExportLoaders | Record<
string,
PackageExportLoader<ModuleExports<any>>
> | {} |
Properties
| Property | Type | Modifiers |
|---|---|---|
| name? | string | — |
| path? | PathLike | — |
| directory? | PathLike | Directory<any, any, any, DirectorySchema | undefined, DirectoryFilter<FileSystemEntry<ApplyDirectorySchema<any, DirectorySchema | undefined>, undefined>, ApplyDirectorySchema<any, DirectorySchema | undefined>> | undefined> | — |
| sourcePath? | PathLike | null | — |
| fileSystem? | FileSystem | — |
| exports? | Record<string, PackageExportOptions<Types, LoaderTypes>> | — |
| repository? | RepositoryInput | — |
| 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-sections”). | ||
Constructor
new PackageExportDirectory<Types, LoaderTypes>(exportPath, options, source, isPattern)Type Parameters
| Parameter | Constraint | Default |
|---|---|---|
Types | Record<string, any> | Record<string, any> |
LoaderTypes | WithDefaultTypes<Types> | WithDefaultTypes<Types> |
Parameters
| Parameter | Type | Default Value |
|---|---|---|
| exportPath | string | — |
| options | DirectoryOptions<Types, LoaderTypes, any, undefined> | — |
| source | "manifest" | "override" | — |
| isPattern | boolean | — |
Methods
| Method | Type | |
|---|---|---|
| getExportPath | () => string (+1 overload) | |
Overload 1ReturnsstringOverload 2Returnsstring | ||
| getSource | () => "manifest" | "override" (+1 overload) | |
Overload 1Returns"manifest" | "override"Overload 2Returns"manifest" | "override" | ||
| isPattern | () => boolean (+1 overload) | |
Overload 1ReturnsbooleanOverload 2Returnsboolean | ||
Extends
Directory<Types, LoaderTypes, any, undefined, DirectoryFilter<FileSystemEntry<ApplyDirectorySchema<LoaderTypes, undefined>, undefined>, ApplyDirectorySchema<LoaderTypes, undefined>> | undefined>Constructor
new Package<Types, LoaderTypes, ExportLoaders>(options)Type Parameters
| Parameter | Constraint | Default |
|---|---|---|
Types | Record<string, any> | Record<string, any> |
LoaderTypes | WithDefaultTypes<Types> | WithDefaultTypes<Types> |
ExportLoaders | Record<
string,
PackageExportLoader<ModuleExports<any>>
> | {} |
Parameters
| Parameter | Type | Default Value |
|---|---|---|
| options | PackageOptions<Types, LoaderTypes, ExportLoaders> | — |
Accessors
| Accessor | Type | |
|---|---|---|
| name | undefined | string | |
Methods
| Method | Type | ||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| getExports | () => Array<…> | ||||||||||||||||||||||||||||||||||||||||
ReturnsArray<PackageExportDirectory<Types, LoaderTypes>> | |||||||||||||||||||||||||||||||||||||||||
| resolveExportSources | (config?: ResolveExportSourcesOptions) => Array<…> | ||||||||||||||||||||||||||||||||||||||||
Resolve package exports to their original source files. This method attempts to reverse-engineer built files back to their source files using the following strategies (in order):
Parameters
ReturnsArray<ResolvedExportSource> | |||||||||||||||||||||||||||||||||||||||||
| resolveExportSource | (exportKey: string, options?: ResolveExportSourcesOptions) => ResolvedExportSource | undefined | ||||||||||||||||||||||||||||||||||||||||
Resolve a single export key to its source file(s). Parameters
ReturnsResolvedExportSource | undefined | |||||||||||||||||||||||||||||||||||||||||
| getMainSourcePath | (options?: ResolveExportSourcesOptions) => string | undefined | ||||||||||||||||||||||||||||||||||||||||
Get the source file path for the main export (”.”). This is a convenience method that returns the first source file for the main package export. Parameters
Returnsstring | undefined | |||||||||||||||||||||||||||||||||||||||||
| getStructure | () => Promise<…> | ||||||||||||||||||||||||||||||||||||||||
ReturnsPromise<Array<DirectoryStructure | FileStructure | PackageStructure>>Modifiersasync | |||||||||||||||||||||||||||||||||||||||||
| 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>>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(key, isPattern, source)Parameters
| Parameter | Type | Default Value |
|---|---|---|
| key | string | — |
| isPattern | boolean | — |
| source | "manifest" | "override" | — |
Methods
| Method | Type | |
|---|---|---|
| getImportPath | () => string | |
Returnsstring | ||
| getSource | () => "manifest" | "override" | |
Returns"manifest" | "override" | ||
| isPattern | () => boolean | |
Returnsboolean | ||
Constructor
new PackageManager(nameOrOptions?)Parameters
| Parameter | Type | Default Value |
|---|---|---|
| nameOrOptions? | "npm" | "pnpm" | "yarn" | "bun" | DetectOptions | — |
Create a PackageManager instance.
Accessors
| Accessor | Type | |
|---|---|---|
| installBase | string | |
Get the base install command (e.g., “pnpm add”) | ||
| devFlag | string | |
Get the dev flag (e.g., ”—save-dev”) | ||
| runPrefix | string | |
Get the run prefix (e.g., “pnpm”) | ||
| execPrefix | string | |
Get the exec prefix (e.g., “pnpm dlx”) | ||
| createPrefix | string | |
Get the create prefix (e.g., “pnpm create”) | ||
Properties
| Property | Type | Default Value | |
|---|---|---|---|
| name | "npm" | "pnpm" | "yarn" | "bun" | — | |
ModifiersreadonlyThe package manager name | |||
| source? | undefined | DetectionSource | — | |
ModifiersreadonlyHow this package manager was detected (only set when detected) | |||
| constraint? | undefined | string | — | |
ModifiersreadonlyThe version constraint from package.json (only set when source is ‘packageManager-field’) | |||
Methods
| Method | Type | ||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
| getAvailable | () => Array<…> | ||||||||||
ModifiersstaticGet all package managers available on the system. ReturnsArray<PackageManager> | |||||||||||
| getAll | () => Array<…> | ||||||||||
ModifiersstaticGet all package managers (available or not). ReturnsArray<PackageManager> | |||||||||||
| clearCache | () => void | ||||||||||
ModifiersstaticClear the internal cache. Returnsvoid | |||||||||||
| isValid | (value: unknown) => boolean | ||||||||||
ModifiersstaticCheck if a value is a valid package manager name. Parameters
Returnsboolean | |||||||||||
| isAvailable | () => boolean | ||||||||||
Check if this package manager is available on the system Returnsboolean | |||||||||||
| getVersion | () => string | null | ||||||||||
Get the installed version of this package manager Returnsstring | null | |||||||||||
| command | (variant: CommandVariant, subject: string) => string | ||||||||||
Build a command for a given variant Parameters
Returnsstring | |||||||||||
| install | (packages: string | Array<…>, options?: { dev?: boolean; }) => string | ||||||||||
Build an install command Parameters
Returnsstring | |||||||||||
| run | (script: string, args?: string) => string | ||||||||||
Build a run command Parameters
Returnsstring | |||||||||||
| exec | (binary: string, args?: string) => string | ||||||||||
Build an exec/dlx command Parameters
Returnsstring | |||||||||||
| create | (template: string, args?: string) => string | ||||||||||
Build a create command Parameters
Returnsstring | |||||||||||
Properties
| Property | Type | Modifiers |
|---|---|---|
| baseUrl | string | — |
The base URL of the repository host or full repository URL. | ||
| host | GitHostType | — |
The type of Git host. | ||
| owner? | string | — |
Optional owner and repository, overrides parsing from | ||
| repository? | string | — |
Optional repository name, overrides parsing from | ||
| branch? | string | — |
Optional default branch/ref, used for URLs. | ||
| path? | string | — |
Optional default path prefix inside the repository. | ||
Type
CloneRepositoryOptions | VirtualRepositoryOptionsProperties
| Property | Type | |
|---|---|---|
| exportName? | string | |
Intersects
ExportHistoryOptionsProperties
| Property | Type | Modifiers |
|---|---|---|
| sha | string | — |
The full or abbreviated commit SHA to link to. | ||
Properties
| Property | Type | Modifiers |
|---|---|---|
| tag | string | — |
The tag name of the release (e.g. “v1.2.3” or “r123”). | ||
Constructor
new Repository(repository?)Parameters
| Parameter | Type | Default Value |
|---|---|---|
| repository? | RepositoryOptions | RepositoryConfig | string | — |
Methods
| Method | Type | |||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| getDirectory | (path?: string) => Directory<…> | |||||||||||||
Returns a directory scoped to this repository. Parameters
ReturnsDirectory<{}, MergeRecord<DefaultModuleTypes, {}>, DirectoryLoader, DirectorySchema | undefined, DirectoryFilter<FileSystemEntry<ApplyDirectorySchema<MergeRecord<DefaultModuleTypes, {}>, DirectorySchema | undefined>, undefined>, ApplyDirectorySchema<MergeRecord<DefaultModuleTypes, {}>, DirectorySchema | undefined>> | undefined> | ||||||||||||||
| getFile | <Path>(path: Path) => File<…> | |||||||||||||
Returns a file scoped to this repository. Type Parameters
Parameters
ReturnsFile<Record<string, any>, Path, ExtractFileExtension<Path>> | ||||||||||||||
| getFirstCommitDate | (path: string) => Promise<…> | |||||||||||||
Get the first git commit date of a path in this repository. Parameters
ReturnsPromise<Date | undefined>Modifiersasync | ||||||||||||||
| getLastCommitDate | (path: string) => Promise<…> | |||||||||||||
Get the last git commit date of a path in this repository. Parameters
ReturnsPromise<Date | undefined>Modifiersasync | ||||||||||||||
| getAuthors | (path: string) => Promise<…> | |||||||||||||
Get the git authors for a path in this repository. Parameters
ReturnsPromise<Array<GitAuthor>>Modifiersasync | ||||||||||||||
| getExportHistory | (options?: RepositoryExportHistoryOptions | undefined) => ExportHistoryGenerator | |||||||||||||
Get export history for this repository. Parameters
ReturnsExportHistoryGeneratorModifiersasync, generator | ||||||||||||||
| registerSparsePath | (path?: string) => void | |||||||||||||
Parameters
Returnsvoid | ||||||||||||||
| getFileSystem | () => GitFileSystem | GitVirtualFileSystem | |||||||||||||
ReturnsGitFileSystem | GitVirtualFileSystem | ||||||||||||||
| toString | () => string | |||||||||||||
Returns the string representation of the repository. Returnsstring | ||||||||||||||
| getCommitUrl | (options: GetCommitUrlOptions) => string | |||||||||||||
Constructs a URL pointing to a specific commit in the repository. Parameters
Returnsstring | ||||||||||||||
| getReleaseTagUrl | (options: GetReleaseTagUrlOptions) => string | |||||||||||||
Constructs a URL pointing to a specific release tag in the repository. Parameters
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 | ||||||||||||||
Options for getting export history.
Properties
| Property | Type | Modifiers |
|---|---|---|
| ref? | string | { start: string; end?: string; } | { start?: string; end: string; } | — |
Ref selector used to scope history processing.
| ||
| entry? | string | Array<string> | — |
| limit? | number | — |
| maxDepth? | number | — |
| detectUpdates? | boolean | — |
| updateMode? | "body" | "signature" | — |
Change indicating an export was added.
Properties
| Property | Type | Modifiers |
|---|---|---|
| kind | "Added" | — |
| sha | string | — |
The SHA of the commit. | ||
| unix | number | — |
The Unix timestamp of the commit. | ||
| date | string | — |
The date of the commit. | ||
| release? | string | — |
The release of the commit. | ||
| name | string | — |
The exported name of the symbol. | ||
| localName? | string | — |
The local declaration name when it differs from the export name (e.g. “NodeBuilder” for | ||
| filePath | string | — |
The file path where the export is defined. | ||
| id | string | — |
The ID of the export (format: “path/to/file.ts::exportName”). | ||
Change indicating an export was updated.
Properties
| Property | Type | Modifiers |
|---|---|---|
| kind | "Updated" | — |
| signature | boolean | — |
Whether the signature changed (vs only the body). | ||
| sha | string | — |
The SHA of the commit. | ||
| unix | number | — |
The Unix timestamp of the commit. | ||
| date | string | — |
The date of the commit. | ||
| release? | string | — |
The release of the commit. | ||
| name | string | — |
The exported name of the symbol. | ||
| localName? | string | — |
The local declaration name when it differs from the export name (e.g. “NodeBuilder” for | ||
| filePath | string | — |
The file path where the export is defined. | ||
| id | string | — |
The ID of the export (format: “path/to/file.ts::exportName”). | ||
Change indicating an export was renamed.
Properties
| Property | Type | Modifiers |
|---|---|---|
| kind | "Renamed" | — |
| previousName? | string | — |
The previous export name, if it changed. | ||
| previousFilePath? | string | — |
The previous file path, if the export moved files. | ||
| previousId | string | — |
The previous export ID. | ||
| sha | string | — |
The SHA of the commit. | ||
| unix | number | — |
The Unix timestamp of the commit. | ||
| date | string | — |
The date of the commit. | ||
| release? | string | — |
The release of the commit. | ||
| name | string | — |
The exported name of the symbol. | ||
| localName? | string | — |
The local declaration name when it differs from the export name (e.g. “NodeBuilder” for | ||
| filePath | string | — |
The file path where the export is defined. | ||
| id | string | — |
The ID of the export (format: “path/to/file.ts::exportName”). | ||
Change indicating an export was removed.
Properties
| Property | Type | Modifiers |
|---|---|---|
| kind | "Removed" | — |
| sha | string | — |
The SHA of the commit. | ||
| unix | number | — |
The Unix timestamp of the commit. | ||
| date | string | — |
The date of the commit. | ||
| release? | string | — |
The release of the commit. | ||
| name | string | — |
The exported name of the symbol. | ||
| localName? | string | — |
The local declaration name when it differs from the export name (e.g. “NodeBuilder” for | ||
| filePath | string | — |
The file path where the export is defined. | ||
| id | string | — |
The ID of the export (format: “path/to/file.ts::exportName”). | ||
Change indicating an export was deprecated.
Properties
| Property | Type | Modifiers |
|---|---|---|
| kind | "Deprecated" | — |
| message? | string | — |
The deprecation message, if provided. | ||
| sha | string | — |
The SHA of the commit. | ||
| unix | number | — |
The Unix timestamp of the commit. | ||
| date | string | — |
The date of the commit. | ||
| release? | string | — |
The release of the commit. | ||
| name | string | — |
The exported name of the symbol. | ||
| localName? | string | — |
The local declaration name when it differs from the export name (e.g. “NodeBuilder” for | ||
| filePath | string | — |
The file path where the export is defined. | ||
| id | string | — |
The ID of the export (format: “path/to/file.ts::exportName”). | ||
Type
AddedChange | UpdatedChange | RenamedChange | RemovedChange | DeprecatedChangeReport of export history across commits.
The following criteria is used to identify an export across commits:
- ID is the ultimate defining symbol location when resolvable
- Format: “path/to/file.ts::exportName”
- Re-exports resolve to their source; local exports use defining file
- Same ID across commits = same underlying symbol (enables rename detection)
Properties
| Property | Type | Modifiers |
|---|---|---|
| generatedAt | string | — |
| repo | string | — |
| entryFiles | Array<string> | — |
| exports | Record<string, Array<ExportChange>> | — |
| nameToId | Record<string, Array<string>> | — |
| lastCommitSha? | string | — |
SHA of the last processed commit (for incremental resumption). | ||
| lastExportSnapshot? | Record<string, Record<string, SerializedExportItem>> | — |
Export state at the last commit (for incremental resumption). | ||
| parseWarnings? | Array<string> | — |
Type
"start" | "ensureRepoReady" | "resolveHead" | "gitLogCached" | "buildCommitReleaseMap" | "resolveEntries" | "batch" | "done"Progress event yielded during export history streaming.
Properties
| Property | Type | Modifiers |
|---|---|---|
| type | "progress" | — |
| phase | ExportHistoryPhase | — |
| elapsedMs | number | — |
| batchStart? | number | — |
| batchSize? | number | — |
| totalCommits? | number | — |
| commitsProcessed? | number | — |
| exports? | Record<string, Array<ExportChange>> | — |
Accumulated export changes so far (only present on ‘batch’ events). | ||
AsyncGenerator type for streaming export history with progress events.
Type
ExportHistoryGeneratorRepresents a section within a file.
Properties
| Property | Type | Modifiers |
|---|---|---|
| id | string | — |
The section anchor id. Uses slugified heading text for markdown-derived sections.
Uses the export name for programmatic sections (e.g. file export outlines rendered by | ||
| title | string | — |
The stringified heading text. | ||
| children? | Array<Section> | — |
Nested child sections. | ||
Type
"Workspace" | "Package" | "Directory" | "File" | "ModuleExport"Properties
| Property | Type | Modifiers |
|---|---|---|
| kind | "Workspace" | — |
| packageManager | "npm" | "pnpm" | "yarn" | "bun" | — |
| name | string | — |
| title | string | — |
| slug | string | — |
| path | string | — |
Properties
| Property | Type | Modifiers |
|---|---|---|
| kind | "Package" | — |
| version? | string | — |
| description? | string | — |
| relativePath | string | — |
| name | string | — |
| title | string | — |
| slug | string | — |
| path | string | — |
Properties
| Property | Type | Modifiers |
|---|---|---|
| kind | "Directory" | — |
| depth | number | — |
| relativePath | string | — |
| name | string | — |
| title | string | — |
| slug | string | — |
| path | string | — |
Properties
| Property | Type | Modifiers |
|---|---|---|
| kind | "File" | — |
| extension | string | — |
| depth | number | — |
| relativePath | string | — |
| firstCommitDate? | Date | — |
| lastCommitDate? | Date | — |
| authors? | Array<GitAuthor> | — |
| frontmatter? | Record<string, unknown> | — |
| sections? | Array<Section> | — |
| description? | string | — |
| exports? | Array<ModuleExportStructure> | — |
| name | string | — |
| title | string | — |
| slug | string | — |
| path | string | — |
Properties
| Property | Type | Modifiers |
|---|---|---|
| kind | "ModuleExport" | — |
| relativePath? | string | — |
| description? | string | — |
| tags? | Array<{ name: string; value?: string; }> | — |
| resolvedType? | Kind | — |
| firstCommitDate? | Date | — |
| lastCommitDate? | Date | — |
| name | string | — |
| title | string | — |
| slug | string | — |
| path | string | — |
Type
WorkspaceStructure | PackageStructure | DirectoryStructure | FileStructureConstructor
new Workspace(options?)Parameters
| Parameter | Type | Default Value |
|---|---|---|
| options? | { fileSystem?: FileSystem; rootDirectory?: PathLike; } | {} |
Methods
| Method | Type | |||||||
|---|---|---|---|---|---|---|---|---|
| hasWorkspaces | () => boolean | |||||||
Returnsboolean | ||||||||
| getPackageManager | () => "npm" | "pnpm" | "yarn" | "bun" | |||||||
Returns"npm" | "pnpm" | "yarn" | "bun" | ||||||||
| getPackage | (name: string) => undefined | Package<…> | |||||||
Parameters
Returnsundefined | Package<Record<string, any>, MergeRecord<DefaultModuleTypes, Record<string, any>>, {}> | ||||||||
| getStructure | () => Promise<…> | |||||||
ReturnsPromise<Array<DirectoryStructure | FileStructure | PackageStructure | WorkspaceStructure>>Modifiersasync | ||||||||
| getPackages | () => Array<…> | |||||||
ReturnsArray<Package<Record<string, any>, MergeRecord<DefaultModuleTypes, Record<string, any>>, {}>> | ||||||||