{"_id":"@api-extractor-tools/extractor-lib","_rev":"3-5f4a7c7388a46b82a562088ad156a2bc","name":"@api-extractor-tools/extractor-lib","dist-tags":{"alpha":"0.1.0-alpha.1","latest":"0.1.0"},"versions":{"0.1.0-alpha.1":{"name":"@api-extractor-tools/extractor-lib","version":"0.1.0-alpha.1","keywords":["typescript","api-extractor","virtual-filesystem","testing"],"author":"","license":"MIT","_id":"@api-extractor-tools/extractor-lib@0.1.0-alpha.1","maintainers":[{"name":"northm","email":"michael.l.north@gmail.com"}],"dist":{"shasum":"de034fbe4ee1391c8d66169214820de01732b71f","tarball":"https://registry.npmjs.org/@api-extractor-tools/extractor-lib/-/extractor-lib-0.1.0-alpha.1.tgz","fileCount":7,"integrity":"sha512-pME0ggvxYdpuFJowI218zTNOAKvp3GjS+g99uxIe3HAdNLK7Xs77RLddzy/bH6at+uCfAOVPkhIdzJ1tW1PRgw==","signatures":[{"sig":"MEQCIHE0l7c0I84GAnDzvfnDjcvsAnZ8PSIWQXUXYBOaeeW0AiA/iJOGjrpptFf44lYui+n9JG7Ltkj5pkjbkTToBrRz/g==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":345451},"main":"dist/index.cjs","_from":"file:api-extractor-tools-extractor-lib-0.1.0-alpha.1.tgz","types":"dist/index.d.mts","module":"dist/index.mjs","exports":{".":{"types":"./dist/index.d.mts","import":"./dist/index.mjs","require":"./dist/index.cjs"}},"scripts":{"test":"vitest run","build":"tsup","check":"pnpm check:eslint && pnpm check:typecheck-tests && pnpm check:api-report","clean":"rm -rf dist","test:types":"tsd --files 'test/**/*.test-d.ts'","check:eslint":"eslint src test","test:coverage":"vitest run --coverage","check:api-report":"api-extractor run","generate:api-report":"api-extractor run --local --verbose","check:typecheck-tests":"tsc -p test/tsconfig.json"},"_npmUser":{"name":"northm","email":"michael.l.north@gmail.com"},"_resolved":"/tmp/00885410af7119bb18bf6289f47c63d4/api-extractor-tools-extractor-lib-0.1.0-alpha.1.tgz","_integrity":"sha512-pME0ggvxYdpuFJowI218zTNOAKvp3GjS+g99uxIe3HAdNLK7Xs77RLddzy/bH6at+uCfAOVPkhIdzJ1tW1PRgw==","_npmVersion":"10.8.2","description":"Library for running API Extractor with virtual filesystem support","directories":{},"_nodeVersion":"20.20.0","dependencies":{"@microsoft/api-extractor":"^7.55.2","@rushstack/node-core-library":"^5.12.0"},"_hasShrinkwrap":false,"devDependencies":{"tsd":"^0.33.0","tsup":"^8.4.0","vitest":"^4.0.15","@types/node":"^22.19.1"},"peerDependencies":{"typescript":">=5.0.0"},"_npmOperationalInternal":{"tmp":"tmp/extractor-lib_0.1.0-alpha.1_1769146507805_0.43096193882313716","host":"s3://npm-registry-packages-npm-production"}},"0.1.0-alpha.2":{"name":"@api-extractor-tools/extractor-lib","version":"0.1.0-alpha.2","keywords":["typescript","api-extractor","virtual-filesystem","testing"],"author":"","license":"MIT","_id":"@api-extractor-tools/extractor-lib@0.1.0-alpha.2","maintainers":[{"name":"northm","email":"michael.l.north@gmail.com"}],"dist":{"shasum":"d8301cb050faec281b56c4ece4c5b51f2d559419","tarball":"https://registry.npmjs.org/@api-extractor-tools/extractor-lib/-/extractor-lib-0.1.0-alpha.2.tgz","fileCount":8,"integrity":"sha512-Lh++M4VQW3/7WdjQYPmhLp4AIJPKyLCHf7MU3M4EhZpSVOQdgRY/sC4/a4GDs5corXG7MRkT2iTVHYMf75dmHQ==","signatures":[{"sig":"MEQCIGiUq/5nAw7dI/rZNOVVPF717Ls3bZPKiv6edFXPr0IiAiAbLUpCoQoZW7ynhOJcT/ZcB6+ELf/Tj+t8W8Yvd7XaqA==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":365496},"main":"dist/index.cjs","_from":"file:api-extractor-tools-extractor-lib-0.1.0-alpha.2.tgz","types":"dist/index.d.mts","module":"dist/index.mjs","exports":{".":{"types":"./dist/index.d.mts","import":"./dist/index.mjs","require":"./dist/index.cjs"}},"scripts":{"test":"vitest run","build":"tsup","check":"pnpm check:eslint && pnpm check:typecheck-tests && pnpm check:api-report","clean":"rm -rf dist","test:types":"tsd --files 'test/**/*.test-d.ts'","check:eslint":"eslint src test","test:coverage":"vitest run --coverage","check:api-report":"api-extractor run","generate:api-report":"api-extractor run --local --verbose","check:typecheck-tests":"tsc -p test/tsconfig.json"},"_npmUser":{"name":"northm","email":"michael.l.north@gmail.com"},"_resolved":"/tmp/51e0d89a93181aa1d156060b2151e0b7/api-extractor-tools-extractor-lib-0.1.0-alpha.2.tgz","_integrity":"sha512-Lh++M4VQW3/7WdjQYPmhLp4AIJPKyLCHf7MU3M4EhZpSVOQdgRY/sC4/a4GDs5corXG7MRkT2iTVHYMf75dmHQ==","_npmVersion":"10.8.2","description":"Library for running API Extractor with virtual filesystem support","directories":{},"_nodeVersion":"20.20.0","dependencies":{"@microsoft/api-extractor":"^7.55.2","@rushstack/node-core-library":"^5.12.0"},"_hasShrinkwrap":false,"devDependencies":{"tsd":"^0.33.0","tsup":"^8.4.0","vitest":"^4.0.15","@types/node":"^22.19.1"},"peerDependencies":{"typescript":">=5.0.0"},"_npmOperationalInternal":{"tmp":"tmp/extractor-lib_0.1.0-alpha.2_1769149654818_0.41549862440968766","host":"s3://npm-registry-packages-npm-production"}},"0.1.0":{"name":"@api-extractor-tools/extractor-lib","version":"0.1.0","description":"Library for running API Extractor with virtual filesystem support","main":"dist/index.cjs","module":"dist/index.mjs","types":"dist/index.d.mts","keywords":["typescript","api-extractor","virtual-filesystem","testing"],"author":"","license":"MIT","dependencies":{"@microsoft/api-extractor":"^7.55.2","@rushstack/node-core-library":"^5.12.0"},"peerDependencies":{"typescript":">=5.0.0"},"devDependencies":{"@types/node":"^22.19.1","tsd":"^0.33.0","tsup":"^8.4.0","vitest":"^4.0.15"},"exports":{".":{"types":"./dist/index.d.mts","import":"./dist/index.mjs","require":"./dist/index.cjs"}},"scripts":{"clean":"rm -rf dist","build":"tsup","test":"vitest run","test:types":"tsd --files 'test/**/*.test-d.ts'","test:coverage":"vitest run --coverage","generate:api-report":"api-extractor run --local --verbose","check:eslint":"eslint src test","check:typecheck-tests":"tsc -p test/tsconfig.json","check":"pnpm check:eslint && pnpm check:typecheck-tests && pnpm check:api-report","check:api-report":"api-extractor run"},"_id":"@api-extractor-tools/extractor-lib@0.1.0","_integrity":"sha512-oNQtfcqaQFJn8yZy75Kc05/lJOwq/Yr2CR2FiD66IVsOdUvlONZ+KJZqHmLWwXqGK2GPQW+qw/IWXbkXwGJNlw==","_resolved":"/tmp/9280841873cd5e17f8f94d43ef5be6bb/api-extractor-tools-extractor-lib-0.1.0.tgz","_from":"file:api-extractor-tools-extractor-lib-0.1.0.tgz","_nodeVersion":"20.20.0","_npmVersion":"10.8.2","dist":{"integrity":"sha512-oNQtfcqaQFJn8yZy75Kc05/lJOwq/Yr2CR2FiD66IVsOdUvlONZ+KJZqHmLWwXqGK2GPQW+qw/IWXbkXwGJNlw==","shasum":"892f7a65f47831b3e809aed145a416964b2e8d2f","tarball":"https://registry.npmjs.org/@api-extractor-tools/extractor-lib/-/extractor-lib-0.1.0.tgz","fileCount":8,"unpackedSize":365488,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIQDWzjfaY7ECOgTYVmstw5M1zqu8p/kGzDjU6fe30bWX3AIgAMEKf1o6+l3ruzOwvXKiyravNGPXcHg7c+/6mKo4bmg="}]},"_npmUser":{"name":"northm","email":"michael.l.north@gmail.com"},"directories":{},"maintainers":[{"name":"northm","email":"michael.l.north@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/extractor-lib_0.1.0_1771015666477_0.7520491039884607"},"_hasShrinkwrap":false}},"time":{"created":"2026-01-23T05:35:07.706Z","modified":"2026-02-13T20:47:46.776Z","0.1.0-alpha.1":"2026-01-23T05:35:07.961Z","0.1.0-alpha.2":"2026-01-23T06:27:34.987Z","0.1.0":"2026-02-13T20:47:46.632Z"},"license":"MIT","keywords":["typescript","api-extractor","virtual-filesystem","testing"],"description":"Library for running API Extractor with virtual filesystem support","maintainers":[{"name":"northm","email":"michael.l.north@gmail.com"}],"readme":"# @api-extractor-tools/extractor-lib\n\nRun [API Extractor](https://api-extractor.com/) with a virtual filesystem - no real files required.\n\n## Features\n\n- **Virtual Filesystem**: Run API Extractor entirely in memory, without touching the disk\n- **Custom TypeScript Lib Files**: Provide your own lib files for browser environments or custom setups\n- **Programmatic API**: Full control over extraction with a clean, typed API\n- **Multiple Output Formats**: Generate .d.ts rollups, API reports (.api.md), and doc models (.api.json)\n- **Release Tag Filtering**: Separate outputs for `@public`, `@beta`, `@alpha`, and `@internal` APIs\n\n## Installation\n\n```bash\nnpm install @api-extractor-tools/extractor-lib\n# or\npnpm add @api-extractor-tools/extractor-lib\n```\n\nTypeScript is a peer dependency:\n\n```bash\nnpm install typescript\n```\n\n## Quick Start\n\n```typescript\nimport * as ts from 'typescript'\nimport { extract, InMemoryFileSystem } from '@api-extractor-tools/extractor-lib'\n\n// Create a virtual filesystem with your declaration files\nconst fs = new InMemoryFileSystem()\nfs.writeFile(\n  '/project/dist/index.d.ts',\n  `\n/**\n * Greets the user\n * @public\n */\nexport declare function greet(name: string): string;\n`,\n)\n\n// Run API Extractor\nconst result = extract(\n  {\n    mainEntryPointFilePath: '/project/dist/index.d.ts',\n    packageName: '@my/package',\n    compilerOptions: {\n      target: ts.ScriptTarget.ES2022,\n      module: ts.ModuleKind.ESNext,\n      moduleResolution: ts.ModuleResolutionKind.Bundler,\n      declaration: true,\n    },\n    dtsRollup: {\n      enabled: true,\n      publicTrimmedFilePath: '/project/dist/public.d.ts',\n    },\n    projectFolder: '/project',\n  },\n  fs,\n  { typescript: ts },\n)\n\nif (result.succeeded) {\n  console.log('Generated rollup:', result.outputs.dtsRollup?.public)\n} else {\n  console.error(`Extraction failed with ${result.errorCount} errors`)\n}\n```\n\n## Examples\n\n### Generate API Report (.api.md)\n\nAPI reports are markdown files that document your public API surface. They're useful for tracking API changes over time.\n\n````typescript\nimport * as ts from 'typescript'\nimport { extract, InMemoryFileSystem } from '@api-extractor-tools/extractor-lib'\n\nconst fs = new InMemoryFileSystem()\nfs.writeFile(\n  '/project/dist/index.d.ts',\n  `\n/**\n * Configuration options for the widget\n * @public\n */\nexport interface WidgetConfig {\n  /** Widget title */\n  title: string;\n  /** Enable animations */\n  animated?: boolean;\n}\n\n/**\n * Create a new widget instance\n * @param config - Widget configuration\n * @returns The created widget\n * @public\n */\nexport declare function createWidget(config: WidgetConfig): Widget;\n\n/**\n * Widget instance\n * @public\n */\nexport declare class Widget {\n  readonly config: WidgetConfig;\n  render(): void;\n  destroy(): void;\n}\n`,\n)\n\nconst result = extract(\n  {\n    mainEntryPointFilePath: '/project/dist/index.d.ts',\n    packageName: '@my/widgets',\n    packageVersion: '1.0.0',\n    compilerOptions: {\n      target: ts.ScriptTarget.ES2022,\n      module: ts.ModuleKind.ESNext,\n      moduleResolution: ts.ModuleResolutionKind.Bundler,\n      declaration: true,\n    },\n    apiReport: {\n      enabled: true,\n      outputPath: '/project/temp/widgets.api.md',\n    },\n    projectFolder: '/project',\n  },\n  fs,\n  { typescript: ts },\n)\n\nconsole.log('API Report:\\n', result.outputs.apiReport)\n// Output:\n// ## API Report File for \"@my/widgets\"\n//\n// ```ts\n// // @public\n// export function createWidget(config: WidgetConfig): Widget;\n//\n// // @public\n// export class Widget {\n//     readonly config: WidgetConfig;\n//     destroy(): void;\n//     render(): void;\n// }\n// ...\n````\n\n### Generate Doc Model (.api.json)\n\nDoc models are JSON files used by [API Documenter](https://api-extractor.com/pages/setup/generating_docs/) to generate documentation sites.\n\n```typescript\nconst result = extract(\n  {\n    mainEntryPointFilePath: '/project/dist/index.d.ts',\n    packageName: '@my/package',\n    compilerOptions: {\n      target: ts.ScriptTarget.ES2022,\n      module: ts.ModuleKind.ESNext,\n      moduleResolution: ts.ModuleResolutionKind.Bundler,\n      declaration: true,\n    },\n    docModel: {\n      enabled: true,\n      outputPath: '/project/temp/package.api.json',\n    },\n    projectFolder: '/project',\n  },\n  fs,\n  { typescript: ts },\n)\n\n// Parse and use the doc model\nconst docModel = JSON.parse(result.outputs.docModel!)\nconsole.log('Package name:', docModel.name)\n```\n\n### Multiple Rollup Variants (Release Tags)\n\nGenerate separate `.d.ts` rollups for different API stability levels:\n\n```typescript\nconst fs = new InMemoryFileSystem()\nfs.writeFile(\n  '/project/dist/index.d.ts',\n  `\n/**\n * Stable, production-ready API\n * @public\n */\nexport declare function stableApi(): void;\n\n/**\n * Feature in beta testing\n * @beta\n */\nexport declare function betaFeature(): void;\n\n/**\n * Experimental feature, may change\n * @alpha\n */\nexport declare function experimentalFeature(): void;\n\n/**\n * Internal implementation detail\n * @internal\n */\nexport declare function _internalHelper(): void;\n`,\n)\n\nconst result = extract(\n  {\n    mainEntryPointFilePath: '/project/dist/index.d.ts',\n    packageName: '@my/package',\n    compilerOptions: {\n      target: ts.ScriptTarget.ES2022,\n      module: ts.ModuleKind.ESNext,\n      moduleResolution: ts.ModuleResolutionKind.Bundler,\n      declaration: true,\n    },\n    dtsRollup: {\n      enabled: true,\n      // Each variant includes its level and all more stable levels\n      publicTrimmedFilePath: '/project/dist/public.d.ts', // @public only\n      betaTrimmedFilePath: '/project/dist/beta.d.ts', // @public + @beta\n      alphaTrimmedFilePath: '/project/dist/alpha.d.ts', // @public + @beta + @alpha\n      untrimmedFilePath: '/project/dist/internal.d.ts', // Everything\n    },\n    projectFolder: '/project',\n  },\n  fs,\n  { typescript: ts },\n)\n\n// Public rollup only contains stableApi()\nconsole.log('Public API:', result.outputs.dtsRollup?.public)\n\n// Beta rollup contains stableApi() and betaFeature()\nconsole.log('Beta API:', result.outputs.dtsRollup?.beta)\n\n// Alpha rollup contains stableApi(), betaFeature(), and experimentalFeature()\nconsole.log('Alpha API:', result.outputs.dtsRollup?.alpha)\n\n// Untrimmed contains everything including _internalHelper()\nconsole.log('Internal API:', result.outputs.dtsRollup?.untrimmed)\n```\n\n### Custom Lib Files for Browser Environments\n\nWhen running in a browser or bundled environment where TypeScript's lib files aren't available on the filesystem, you can provide them via a custom `ILibFileProvider`:\n\n```typescript\nimport * as ts from 'typescript'\nimport {\n  extract,\n  InMemoryFileSystem,\n  createVirtualCompilerHost,\n  createProgram,\n  type ILibFileProvider,\n} from '@api-extractor-tools/extractor-lib'\n\n// Create a custom lib file provider with minimal definitions\nconst customLibProvider: ILibFileProvider = {\n  getLibFileContent(fileName: string): string | undefined {\n    // Provide minimal lib definitions for browser environments\n    if (fileName === 'lib.es2022.d.ts' || fileName === 'lib.d.ts') {\n      return `\n        // Minimal type definitions\n        interface Array<T> {\n          length: number;\n          [n: number]: T;\n          push(...items: T[]): number;\n          map<U>(fn: (item: T) => U): U[];\n        }\n        interface String {\n          length: number;\n          charAt(index: number): string;\n        }\n        interface Number {}\n        interface Boolean {}\n        interface Object {}\n        interface Function {}\n        interface RegExp {}\n        interface Symbol {}\n        interface Promise<T> {\n          then<U>(fn: (value: T) => U): Promise<U>;\n        }\n        declare function parseInt(s: string): number;\n        declare function parseFloat(s: string): number;\n      `\n    }\n    return undefined\n  },\n\n  getDefaultLibFileName(options: ts.CompilerOptions): string {\n    // Return appropriate lib file based on target\n    const target = options.target ?? ts.ScriptTarget.ES5\n    if (target >= ts.ScriptTarget.ES2022) return 'lib.es2022.d.ts'\n    return 'lib.d.ts'\n  },\n\n  getAllLibFileNames(): string[] {\n    return ['lib.d.ts', 'lib.es2022.d.ts']\n  },\n}\n\n// Use with createProgram for virtual compilation\nconst fs = new InMemoryFileSystem()\nfs.writeFile(\n  '/project/src/index.ts',\n  `\nexport function greet(name: string): string {\n  return 'Hello, ' + name;\n}\n`,\n)\n\nconst program = createProgram({\n  typescript: ts,\n  fs,\n  rootDir: '/project',\n  entryPoints: ['/project/src/index.ts'],\n  compilerOptions: {\n    target: ts.ScriptTarget.ES2022,\n    module: ts.ModuleKind.ESNext,\n    declaration: true,\n  },\n  libFileProvider: customLibProvider,\n})\n\n// Check for compilation errors\nconst diagnostics = ts.getPreEmitDiagnostics(program)\nconsole.log(`Found ${diagnostics.length} diagnostic messages`)\n```\n\n### Using Built-in Lib File Provider\n\nFor Node.js environments, use the built-in `createLibFileProvider` which reads lib files from your TypeScript installation:\n\n```typescript\nimport * as ts from 'typescript'\nimport {\n  createProgram,\n  createLibFileProvider,\n  InMemoryFileSystem,\n} from '@api-extractor-tools/extractor-lib'\n\nconst fs = new InMemoryFileSystem()\nfs.writeFile(\n  '/project/src/index.ts',\n  `\nexport const values: number[] = [1, 2, 3];\nexport const doubled = values.map(x => x * 2);\n`,\n)\n\n// Create a lib file provider that reads from the TypeScript installation\nconst libProvider = createLibFileProvider(ts)\n\n// List available lib files\nconsole.log('Available libs:', libProvider.getAllLibFileNames())\n// ['lib.d.ts', 'lib.dom.d.ts', 'lib.es2015.d.ts', ...]\n\nconst program = createProgram({\n  typescript: ts,\n  fs,\n  rootDir: '/project',\n  entryPoints: ['/project/src/index.ts'],\n  compilerOptions: {\n    target: ts.ScriptTarget.ES2022,\n    module: ts.ModuleKind.ESNext,\n    declaration: true,\n  },\n  libFileProvider: libProvider,\n})\n```\n\n### Extract Specific Lib Files\n\nExtract and bundle specific TypeScript lib files for offline use:\n\n```typescript\nimport * as ts from 'typescript'\nimport {\n  extractLibFiles,\n  extractRequiredLibFiles,\n  getRequiredLibFileNames,\n} from '@api-extractor-tools/extractor-lib'\n\n// Extract specific lib files by name\nconst libs = extractLibFiles(ts, ['lib.es2022.d.ts', 'lib.dom.d.ts'])\nconsole.log(\n  'Extracted lib.es2022.d.ts:',\n  libs.get('lib.es2022.d.ts')?.length,\n  'bytes',\n)\n\n// Get lib file names required for specific compiler options\nconst compilerOptions: ts.CompilerOptions = {\n  target: ts.ScriptTarget.ES2022,\n  lib: ['ES2022', 'DOM'],\n}\n\nconst requiredLibs = getRequiredLibFileNames(ts, compilerOptions)\nconsole.log('Required libs:', requiredLibs)\n// ['lib.es2022.d.ts', 'lib.dom.d.ts']\n\n// Extract all required lib files at once\nconst allRequiredLibs = extractRequiredLibFiles(ts, compilerOptions)\nconsole.log('Extracted', allRequiredLibs.size, 'lib files')\n```\n\n### Message Handling and Filtering\n\nHandle extraction messages for logging, filtering, or custom error handling:\n\n```typescript\nimport * as ts from 'typescript'\nimport { extract, InMemoryFileSystem } from '@api-extractor-tools/extractor-lib'\n\nconst fs = new InMemoryFileSystem()\nfs.writeFile(\n  '/project/dist/index.d.ts',\n  `\n// Function without @public/@beta/@alpha tag - will generate a warning\nexport declare function undocumentedFn(): void;\n`,\n)\n\nconst messages: Array<{ id: string; text: string; level: string }> = []\n\nconst result = extract(\n  {\n    mainEntryPointFilePath: '/project/dist/index.d.ts',\n    packageName: '@my/package',\n    compilerOptions: {\n      target: ts.ScriptTarget.ES2022,\n      module: ts.ModuleKind.ESNext,\n      moduleResolution: ts.ModuleResolutionKind.Bundler,\n      declaration: true,\n    },\n    dtsRollup: {\n      enabled: true,\n      publicTrimmedFilePath: '/project/dist/public.d.ts',\n    },\n    // Configure message reporting\n    messages: {\n      extractorMessageReporting: {\n        // Suppress \"missing release tag\" warnings\n        'ae-missing-release-tag': { logLevel: 'none' },\n        // Treat forgotten exports as errors\n        'ae-forgotten-export': { logLevel: 'error' },\n      },\n    },\n    projectFolder: '/project',\n  },\n  fs,\n  {\n    typescript: ts,\n    // Callback for each message\n    messageCallback: (msg) => {\n      messages.push({\n        id: msg.messageId,\n        text: msg.text,\n        level: msg.logLevel,\n      })\n    },\n  },\n)\n\nconsole.log(`Extraction ${result.succeeded ? 'succeeded' : 'failed'}`)\nconsole.log(`Errors: ${result.errorCount}, Warnings: ${result.warningCount}`)\nconsole.log('All messages:', messages)\n```\n\n### Multi-File Packages\n\nHandle packages with multiple declaration files:\n\n```typescript\nimport * as ts from 'typescript'\nimport { extract, InMemoryFileSystem } from '@api-extractor-tools/extractor-lib'\n\nconst fs = new InMemoryFileSystem()\n\n// Main entry point\nfs.writeFile(\n  '/project/dist/index.d.ts',\n  `\nexport { User, createUser } from './user.js';\nexport { Product, createProduct } from './product.js';\nexport { formatCurrency } from './utils.js';\n`,\n)\n\n// User module\nfs.writeFile(\n  '/project/dist/user.d.ts',\n  `\n/**\n * User entity\n * @public\n */\nexport interface User {\n  id: string;\n  name: string;\n  email: string;\n}\n\n/**\n * Create a new user\n * @public\n */\nexport declare function createUser(name: string, email: string): User;\n`,\n)\n\n// Product module\nfs.writeFile(\n  '/project/dist/product.d.ts',\n  `\n/**\n * Product entity\n * @public\n */\nexport interface Product {\n  id: string;\n  name: string;\n  price: number;\n}\n\n/**\n * Create a new product\n * @public\n */\nexport declare function createProduct(name: string, price: number): Product;\n`,\n)\n\n// Utils module\nfs.writeFile(\n  '/project/dist/utils.d.ts',\n  `\n/**\n * Format a number as currency\n * @public\n */\nexport declare function formatCurrency(amount: number, currency?: string): string;\n`,\n)\n\nconst result = extract(\n  {\n    mainEntryPointFilePath: '/project/dist/index.d.ts',\n    packageName: '@my/store',\n    compilerOptions: {\n      target: ts.ScriptTarget.ES2022,\n      module: ts.ModuleKind.ESNext,\n      moduleResolution: ts.ModuleResolutionKind.Bundler,\n      declaration: true,\n    },\n    dtsRollup: {\n      enabled: true,\n      publicTrimmedFilePath: '/project/dist/store.d.ts',\n    },\n    projectFolder: '/project',\n  },\n  fs,\n  { typescript: ts },\n)\n\n// The rollup combines all exports into a single file\nconsole.log('Combined rollup:', result.outputs.dtsRollup?.public)\n```\n\n### Initialize Filesystem from Object\n\nCreate an `InMemoryFileSystem` with initial files:\n\n```typescript\nimport { InMemoryFileSystem } from '@api-extractor-tools/extractor-lib'\n\n// Initialize with a file map\nconst fs = new InMemoryFileSystem({\n  '/project/dist/index.d.ts': `\n    export declare function hello(): string;\n  `,\n  '/project/dist/utils.d.ts': `\n    export declare function helper(): void;\n  `,\n  '/project/package.json': JSON.stringify({\n    name: '@my/package',\n    version: '1.0.0',\n  }),\n})\n\n// Check files exist\nconsole.log(fs.exists('/project/dist/index.d.ts')) // true\nconsole.log(fs.readDirectory('/project/dist')) // ['index.d.ts', 'utils.d.ts']\n```\n\n### Verbose Output\n\nEnable verbose logging for debugging:\n\n```typescript\nconst result = extract(\n  {\n    mainEntryPointFilePath: '/project/dist/index.d.ts',\n    packageName: '@my/package',\n    compilerOptions: {\n      /* ... */\n    },\n    dtsRollup: {\n      enabled: true,\n      publicTrimmedFilePath: '/project/dist/public.d.ts',\n    },\n    projectFolder: '/project',\n  },\n  fs,\n  {\n    typescript: ts,\n    verbose: true, // Enable verbose output\n  },\n)\n```\n\n## API Reference\n\n### `extract(config, fs, options?)`\n\nMain function to run API Extractor with a virtual filesystem.\n\n**Parameters:**\n\n- `config: IExtractorLibConfig` - Configuration for the extraction\n- `fs: IVirtualFileSystem` - Virtual filesystem containing source files\n- `options?: IExtractOptions` - Optional settings\n\n**Returns:** `IExtractorLibResult` - Result containing outputs and diagnostics\n\n### `InMemoryFileSystem`\n\nIn-memory implementation of `IVirtualFileSystem`.\n\n```typescript\nconst fs = new InMemoryFileSystem(\n  files?: Record<string, string>,  // Initial files\n  cwd?: string                      // Current working directory (default: '/')\n)\n\nfs.exists(path)          // Check if path exists\nfs.readFile(path)        // Read file contents\nfs.writeFile(path, data) // Write file\nfs.readDirectory(path)   // List directory contents\nfs.isFile(path)          // Check if path is a file\nfs.isDirectory(path)     // Check if path is a directory\nfs.resolvePath(...segs)  // Resolve path segments\nfs.dirname(path)         // Get directory name\nfs.basename(path)        // Get base name\nfs.join(...segs)         // Join path segments\nfs.extname(path)         // Get file extension\nfs.normalize(path)       // Normalize path\n```\n\n### `createProgram(options)`\n\nCreate a TypeScript program from virtual files.\n\n```typescript\nconst program = createProgram({\n  typescript: ts,                    // TypeScript module\n  fs: InMemoryFileSystem,           // Virtual filesystem\n  rootDir: string,                  // Root directory\n  entryPoints: string[],            // Entry point files\n  compilerOptions: ts.CompilerOptions,\n  libFileProvider?: ILibFileProvider,\n})\n```\n\n### `createLibFileProvider(typescript)`\n\nCreate a lib file provider that reads from the TypeScript installation.\n\n```typescript\nconst provider = createLibFileProvider(ts)\nprovider.getLibFileContent('lib.es2022.d.ts') // Get lib file content\nprovider.getDefaultLibFileName(options) // Get default lib for options\nprovider.getAllLibFileNames() // List all available libs\n```\n\n### `createVirtualCompilerHost(typescript, options)`\n\nCreate a TypeScript compiler host using a virtual filesystem.\n\n```typescript\nconst host = createVirtualCompilerHost(ts, {\n  fs: InMemoryFileSystem,\n  compilerOptions: ts.CompilerOptions,\n  basePath: string,\n  libFileProvider?: ILibFileProvider,\n})\n```\n\n## Configuration\n\n### `IExtractorLibConfig`\n\n| Property                 | Type                      | Required | Description                                   |\n| ------------------------ | ------------------------- | -------- | --------------------------------------------- |\n| `mainEntryPointFilePath` | `string`                  | Yes      | Entry point .d.ts file path                   |\n| `packageName`            | `string`                  | Yes      | Package name (e.g., `@my/package`)            |\n| `packageVersion`         | `string`                  | No       | Package version (default: `0.0.0`)            |\n| `compilerOptions`        | `ts.CompilerOptions`      | Yes      | TypeScript compiler options                   |\n| `program`                | `ts.Program`              | No       | Pre-configured TypeScript program             |\n| `bundledPackages`        | `string[]`                | No       | Packages to inline                            |\n| `apiReport`              | `IApiReportConfig`        | No       | API report settings                           |\n| `docModel`               | `IDocModelConfig`         | No       | Doc model settings                            |\n| `dtsRollup`              | `IDtsRollupConfig`        | No       | DTS rollup settings                           |\n| `messages`               | `IMessageReportingConfig` | No       | Message reporting rules                       |\n| `projectFolder`          | `string`                  | No       | Project folder (default: entry point dirname) |\n\n### `IDtsRollupConfig`\n\n| Property                | Type      | Description                                    |\n| ----------------------- | --------- | ---------------------------------------------- |\n| `enabled`               | `boolean` | Enable rollup generation                       |\n| `publicTrimmedFilePath` | `string`  | Output path for `@public` only                 |\n| `betaTrimmedFilePath`   | `string`  | Output path for `@public` + `@beta`            |\n| `alphaTrimmedFilePath`  | `string`  | Output path for `@public` + `@beta` + `@alpha` |\n| `untrimmedFilePath`     | `string`  | Output path for all declarations               |\n\n## License\n\nMIT\n","readmeFilename":"README.md"}