Filesystem
Extension Discovery Module
Extension discovery from the filesystem.
Scans the _extensions directory to find installed Quarto extensions.
Interfaces
DiscoveryOptions
Defined in: packages/core/src/filesystem/discovery.ts:36
Options for extension discovery.
Properties
| Property | Type | Description | Defined in |
|---|---|---|---|
includeInvalid? |
boolean |
Include extensions without valid manifests. | packages/core/src/filesystem/discovery.ts:38 |
InstalledExtension
Defined in: packages/core/src/filesystem/discovery.ts:22
An installed extension discovered on the filesystem.
Properties
| Property | Type | Description | Defined in |
|---|---|---|---|
directory |
string |
Full path to the extension directory. | packages/core/src/filesystem/discovery.ts:30 |
id |
ExtensionId |
Extension identifier. | packages/core/src/filesystem/discovery.ts:24 |
manifest |
ExtensionManifest |
Parsed manifest data. | packages/core/src/filesystem/discovery.ts:26 |
manifestPath |
string |
Full path to the manifest file. | packages/core/src/filesystem/discovery.ts:28 |
Functions
discoverInstalledExtensions()
TypeScript
function discoverInstalledExtensions(projectDir, options): Promise<InstalledExtension[]>;Defined in: packages/core/src/filesystem/discovery.ts:81
Discover all installed extensions in a project.
Scans the _extensions directory for extensions in both formats:
- _extensions/owner/name/_extension.yml (with owner)
- _extensions/name/_extension.yml (without owner)
Parameters
| Parameter | Type | Description |
|---|---|---|
projectDir |
string |
Project root directory |
options |
DiscoveryOptions |
Discovery options |
Returns
Promise<<code><a href="#installedextension" style="text-decoration-line: underline; text-decoration-style: dashed; text-decoration-thickness: 1px; text-decoration-color: currentColor;">InstalledExtension</a>[]</code>{=html}>
Array of installed extensions
Example
TypeScript
const extensions = await discoverInstalledExtensions("./my-project");
for (const ext of extensions) {
console.log(`${ext.id.owner ?? ""}/${ext.id.name}: ${ext.manifest.version}`);
}discoverInstalledExtensionsSync()
TypeScript
function discoverInstalledExtensionsSync(projectDir, options): InstalledExtension[];Defined in: packages/core/src/filesystem/discovery.ts:189
Synchronous version of discoverInstalledExtensions.
Parameters
| Parameter | Type | Description |
|---|---|---|
projectDir |
string |
Project root directory |
options |
DiscoveryOptions |
Discovery options |
Returns
Array of installed extensions
findInstalledExtension()
TypeScript
function findInstalledExtension(projectDir, extensionId): Promise<InstalledExtension | null>;Defined in: packages/core/src/filesystem/discovery.ts:293
Find a specific installed extension by ID.
Parameters
| Parameter | Type | Description |
|---|---|---|
projectDir |
string |
Project root directory |
extensionId |
ExtensionId |
Extension ID to find |
Returns
Promise<InstalledExtension | null>
InstalledExtension or null if not found
getExtensionInstallPath()
TypeScript
function getExtensionInstallPath(projectDir, extensionId): string;Defined in: packages/core/src/filesystem/discovery.ts:329
Get the installation path for an extension.
Parameters
| Parameter | Type | Description |
|---|---|---|
projectDir |
string |
Project root directory |
extensionId |
ExtensionId |
Extension ID |
Returns
string
Path where the extension should be installed
getExtensionsDir()
TypeScript
function getExtensionsDir(projectDir): string;Defined in: packages/core/src/filesystem/discovery.ts:47
Get the extensions directory path for a project.
Parameters
| Parameter | Type | Description |
|---|---|---|
projectDir |
string |
Project root directory |
Returns
string
Path to _extensions directory
hasExtensionsDir()
TypeScript
function hasExtensionsDir(projectDir): boolean;Defined in: packages/core/src/filesystem/discovery.ts:57
Check if an extensions directory exists.
Parameters
| Parameter | Type | Description |
|---|---|---|
projectDir |
string |
Project root directory |
Returns
boolean
True if _extensions directory exists
Manifest Parsing Module
Manifest parsing for _extension.yml files.
Provides functions to read, parse, and write Quarto extension manifests.
Interfaces
ManifestReadResult
Defined in: packages/core/src/filesystem/manifest.ts:23
Result of reading a manifest file.
Properties
| Property | Type | Description | Defined in |
|---|---|---|---|
filename |
string |
Filename used (e.g., “_extension.yml”). | packages/core/src/filesystem/manifest.ts:29 |
manifest |
ExtensionManifest |
Parsed manifest data. | packages/core/src/filesystem/manifest.ts:25 |
manifestPath |
string |
Full path to the manifest file. | packages/core/src/filesystem/manifest.ts:27 |
Functions
findManifestFile()
TypeScript
function findManifestFile(directory): string | null;Defined in: packages/core/src/filesystem/manifest.ts:38
Find the manifest file in a directory.
Parameters
| Parameter | Type | Description |
|---|---|---|
directory |
string |
Directory to search |
Returns
string | null
Path to manifest file or null if not found
hasManifest()
TypeScript
function hasManifest(directory): boolean;Defined in: packages/core/src/filesystem/manifest.ts:127
Check if a directory contains a manifest file.
Parameters
| Parameter | Type | Description |
|---|---|---|
directory |
string |
Directory to check |
Returns
boolean
True if manifest exists
parseManifestContent()
TypeScript
function parseManifestContent(content, sourcePath?): ExtensionManifest;Defined in: packages/core/src/filesystem/manifest.ts:78
Parse manifest content from a YAML string.
Parameters
| Parameter | Type | Description |
|---|---|---|
content |
string |
YAML content |
sourcePath? |
string |
Source path for error messages (optional) |
Returns
Parsed manifest
Throws
ManifestError if parsing fails
parseManifestFile()
TypeScript
function parseManifestFile(manifestPath): ExtensionManifest;Defined in: packages/core/src/filesystem/manifest.ts:55
Parse a manifest file from a path.
Parameters
| Parameter | Type | Description |
|---|---|---|
manifestPath |
string |
Full path to the manifest file |
Returns
Parsed manifest
Throws
ManifestError if parsing fails
readManifest()
TypeScript
function readManifest(directory): ManifestReadResult | null;Defined in: packages/core/src/filesystem/manifest.ts:104
Read a manifest from a directory.
Parameters
| Parameter | Type | Description |
|---|---|---|
directory |
string |
Directory containing the manifest |
Returns
ManifestReadResult | null
ManifestReadResult or null if no manifest found
updateManifestSource()
TypeScript
function updateManifestSource(manifestPath, source): void;Defined in: packages/core/src/filesystem/manifest.ts:192
Update the source field in an existing manifest file.
Parameters
| Parameter | Type | Description |
|---|---|---|
manifestPath |
string |
Path to the manifest file |
source |
string |
New source value |
Returns
void
writeManifest()
TypeScript
function writeManifest(manifestPath, manifest): void;Defined in: packages/core/src/filesystem/manifest.ts:137
Write a manifest to a file.
Parameters
| Parameter | Type | Description |
|---|---|---|
manifestPath |
string |
Path to write the manifest |
manifest |
ExtensionManifest |
Manifest data to write |
Returns
void
Directory Walking Module
Directory walking and file collection utilities.
Provides recursive directory traversal and file copying operations.
Interfaces
WalkEntry
Defined in: packages/core/src/filesystem/walk.ts:16
Entry information for directory walking.
Properties
| Property | Type | Description | Defined in |
|---|---|---|---|
isDirectory |
boolean |
Whether entry is a directory. | packages/core/src/filesystem/walk.ts:22 |
name |
string |
Entry name (basename). | packages/core/src/filesystem/walk.ts:20 |
path |
string |
Full path to the entry. | packages/core/src/filesystem/walk.ts:18 |
Type Aliases
WalkCallback()
TypeScript
type WalkCallback = (entry) => boolean | void | Promise<boolean | void>;Defined in: packages/core/src/filesystem/walk.ts:29
Callback for directory walking. Return false to skip processing children of a directory.
Parameters
| Parameter | Type |
|---|---|
entry |
WalkEntry |
Returns
boolean | void | Promise<boolean | void>
Functions
collectFiles()
TypeScript
function collectFiles(directory): Promise<string[]>;Defined in: packages/core/src/filesystem/walk.ts:62
Collect all file paths in a directory recursively.
Parameters
| Parameter | Type | Description |
|---|---|---|
directory |
string |
Directory to walk |
Returns
Promise<string[]>
Array of file paths
copyDirectory()
TypeScript
function copyDirectory(sourceDir, targetDir): Promise<string[]>;Defined in: packages/core/src/filesystem/walk.ts:81
Copy a directory recursively.
Parameters
| Parameter | Type | Description |
|---|---|---|
sourceDir |
string |
Source directory |
targetDir |
string |
Target directory |
Returns
Promise<string[]>
Array of created file paths
walkDirectory()
TypeScript
function walkDirectory(directory, callback): Promise<void>;Defined in: packages/core/src/filesystem/walk.ts:37
Walk a directory recursively, calling the callback for each entry.
Parameters
| Parameter | Type | Description |
|---|---|---|
directory |
string |
Directory to walk |
callback |
WalkCallback |
Callback for each entry |
Returns
Promise<void>