{"_id":"@api-extractor-tools/change-detector-core","_rev":"4-91e3df950d23b10ffd51ef89e999bc3d","name":"@api-extractor-tools/change-detector-core","dist-tags":{"alpha":"0.1.0-alpha.0","latest":"0.1.0"},"versions":{"0.1.0-alpha.0":{"name":"@api-extractor-tools/change-detector-core","version":"0.1.0-alpha.0","keywords":["typescript","api","semver","change-detection","isomorphic"],"author":"","license":"MIT","_id":"@api-extractor-tools/change-detector-core@0.1.0-alpha.0","maintainers":[{"name":"northm","email":"michael.l.north@gmail.com"}],"dist":{"shasum":"3645e32302b1f334e36922b094de6c4f7b863789","tarball":"https://registry.npmjs.org/@api-extractor-tools/change-detector-core/-/change-detector-core-0.1.0-alpha.0.tgz","fileCount":45,"integrity":"sha512-JMPXWBSUtch47t7WEvXoAOmAF437P44lTp+un68OL0QxRDbtpwqtTpks/wUk3hvwsmsjWHhIOAwdlrp3Nnr+kQ==","signatures":[{"sig":"MEYCIQDDO/bL5YOSUjp1SZTVoLM2CySQmZ8Hj9qgVgvtPBXLkwIhAKdwNHmT6jeWlOnpbqClTvhah/9MZfFtzpD64qYCRdbe","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":280320},"main":"dist/cjs/index.js","_from":"file:api-extractor-tools-change-detector-core-0.1.0-alpha.0.tgz","types":"dist/esm/index.d.ts","module":"dist/esm/index.js","exports":{".":{"types":"./dist/esm/index.d.ts","import":"./dist/esm/index.js","require":"./dist/cjs/index.js"}},"scripts":{"test":"vitest run","build":"pnpm build:esm && pnpm build:cjs","check":"pnpm check:eslint && pnpm check:typecheck-tests","build:cjs":"tsc -p tsconfig.cjs.json","build:esm":"tsc -p tsconfig.esm.json","check:eslint":"eslint src","test:coverage":"vitest run --coverage","check:typecheck-tests":"tsc -p test/tsconfig.json"},"_npmUser":{"name":"northm","email":"michael.l.north@gmail.com"},"_resolved":"/tmp/1c859aabd9e3bbd0b47f4f524bffda7e/api-extractor-tools-change-detector-core-0.1.0-alpha.0.tgz","_integrity":"sha512-JMPXWBSUtch47t7WEvXoAOmAF437P44lTp+un68OL0QxRDbtpwqtTpks/wUk3hvwsmsjWHhIOAwdlrp3Nnr+kQ==","_npmVersion":"10.8.2","description":"Isomorphic core for detecting changes between TypeScript declaration files (browser + Node.js)","directories":{},"_nodeVersion":"20.19.6","dependencies":{"typescript":"5.8.3"},"_hasShrinkwrap":false,"devDependencies":{"vitest":"^4.0.15","@vitest/coverage-v8":"^4.0.15"},"_npmOperationalInternal":{"tmp":"tmp/change-detector-core_0.1.0-alpha.0_1765153642029_0.5252683713199002","host":"s3://npm-registry-packages-npm-production"}},"0.1.0-alpha.1":{"name":"@api-extractor-tools/change-detector-core","version":"0.1.0-alpha.1","keywords":["typescript","api","semver","change-detection","isomorphic"],"author":"","license":"MIT","_id":"@api-extractor-tools/change-detector-core@0.1.0-alpha.1","maintainers":[{"name":"northm","email":"michael.l.north@gmail.com"}],"dist":{"shasum":"c34bb2937453631ef0fe7b4e292936cc3db2d43b","tarball":"https://registry.npmjs.org/@api-extractor-tools/change-detector-core/-/change-detector-core-0.1.0-alpha.1.tgz","fileCount":81,"integrity":"sha512-SorfgYqCcUOzjGoo/nY9MnHD3trRBRSmDA031/eVyp/oNy+/+gJToiFECzSMmzJRmVpUvdpGP3b+gEaLowKrcQ==","signatures":[{"sig":"MEYCIQDRUtZ3EkPJWZxXTlFyoG+QlvslBc0XICseCiQlvn4eYQIhAKRcU/BrA/KYGFq8iOHoTeFumChGyYnVumrlJudI64mK","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":628804},"main":"dist/cjs/index.js","_from":"file:api-extractor-tools-change-detector-core-0.1.0-alpha.1.tgz","types":"dist/esm/index.d.ts","module":"dist/esm/index.js","exports":{".":{"types":"./dist/esm/index.d.ts","import":"./dist/esm/index.js","require":"./dist/cjs/index.js"}},"scripts":{"test":"vitest run","build":"pnpm build:esm && pnpm build:cjs","check":"pnpm check:eslint && pnpm check:typecheck-tests","build:cjs":"tsc -p tsconfig.cjs.json","build:esm":"tsc -p tsconfig.esm.json","check:eslint":"eslint src","test:coverage":"vitest run --coverage","check:typecheck-tests":"tsc -p test/tsconfig.json"},"_npmUser":{"name":"northm","email":"michael.l.north@gmail.com"},"_resolved":"/tmp/a3236ae22a9fafb3f02edc44c295aa20/api-extractor-tools-change-detector-core-0.1.0-alpha.1.tgz","_integrity":"sha512-SorfgYqCcUOzjGoo/nY9MnHD3trRBRSmDA031/eVyp/oNy+/+gJToiFECzSMmzJRmVpUvdpGP3b+gEaLowKrcQ==","_npmVersion":"10.8.2","description":"Isomorphic core for detecting changes between TypeScript declaration files (browser + Node.js)","directories":{},"_nodeVersion":"20.19.6","dependencies":{"typescript":"5.8.3","@microsoft/tsdoc":"^0.16.0"},"_hasShrinkwrap":false,"devDependencies":{"vitest":"^4.0.15","@types/node":"^22.19.1","@vitest/coverage-v8":"^4.0.15"},"_npmOperationalInternal":{"tmp":"tmp/change-detector-core_0.1.0-alpha.1_1765481036297_0.3838846611549629","host":"s3://npm-registry-packages-npm-production"}},"0.1.0-alpha.2":{"name":"@api-extractor-tools/change-detector-core","version":"0.1.0-alpha.2","keywords":["typescript","api","semver","change-detection","isomorphic"],"author":"","license":"MIT","_id":"@api-extractor-tools/change-detector-core@0.1.0-alpha.2","maintainers":[{"name":"northm","email":"michael.l.north@gmail.com"}],"dist":{"shasum":"63da5f192bf00320bbfa3c564fc78953d1a085d2","tarball":"https://registry.npmjs.org/@api-extractor-tools/change-detector-core/-/change-detector-core-0.1.0-alpha.2.tgz","fileCount":427,"integrity":"sha512-i+d5FlW4Ieh3m91cN1EzWKwxP5g5Wrzl0oGDLIU67brKzGcsJWFtXYP01/g7Efj1itvivoOifSkZOxNCkNPWRA==","signatures":[{"sig":"MEUCIC8xuIt4WZb4Zni9+UAQTynFq1x8T8ZHFdXEtYIABLviAiEAxZ8ZPNnO58CTBOHXm2VN36w3MmVMc+gYQdKJSJIZEpE=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":1624163},"main":"dist/cjs/index.js","_from":"file:api-extractor-tools-change-detector-core-0.1.0-alpha.2.tgz","types":"dist/esm/index.d.ts","module":"dist/esm/index.js","exports":{".":{"types":"./dist/esm/index.d.ts","import":"./dist/esm/index.js","require":"./dist/cjs/index.js"},"./ast":{"types":"./dist/esm/ast/index.d.ts","import":"./dist/esm/ast/index.js","require":"./dist/cjs/ast/index.js"},"./rules":{"types":"./dist/esm/rules.d.ts","import":"./dist/esm/rules.js","require":"./dist/cjs/rules.js"},"./plugins":{"types":"./dist/esm/plugins.d.ts","import":"./dist/esm/plugins.js","require":"./dist/cjs/plugins.js"}},"scripts":{"test":"vitest run && pnpm test:types","build":"pnpm build:esm && pnpm build:cjs","check":"pnpm check:eslint && pnpm check:typecheck-tests && pnpm check:api-report","clean":"rm -rf dist","build:cjs":"tsc -p tsconfig.cjs.json","build:esm":"tsc -p tsconfig.esm.json","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/c98a9740ac5a5ae09e3014b6aceeba20/api-extractor-tools-change-detector-core-0.1.0-alpha.2.tgz","_integrity":"sha512-i+d5FlW4Ieh3m91cN1EzWKwxP5g5Wrzl0oGDLIU67brKzGcsJWFtXYP01/g7Efj1itvivoOifSkZOxNCkNPWRA==","_npmVersion":"10.8.2","description":"Isomorphic core for detecting changes between TypeScript declaration files (browser + Node.js)","directories":{},"_nodeVersion":"20.19.6","dependencies":{"typescript":"5.8.3","@microsoft/tsdoc":"^0.16.0","@typescript-eslint/typescript-estree":"^8.49.0"},"typesVersions":{"*":{"ast":["./dist/esm/ast/index.d.ts"],"rules":["./dist/esm/rules.d.ts"],"plugins":["./dist/esm/plugins.d.ts"]}},"_hasShrinkwrap":false,"devDependencies":{"tsd":"^0.33.0","zod":"^4.1.13","pkg-up":"^4.0.0","vitest":"^4.0.15","@types/node":"^22.19.1","@vitest/coverage-v8":"^4.0.15","@microsoft/api-extractor":"^7.55.2"},"_npmOperationalInternal":{"tmp":"tmp/change-detector-core_0.1.0-alpha.2_1767304041935_0.9803165312845619","host":"s3://npm-registry-packages-npm-production"}},"0.1.0":{"name":"@api-extractor-tools/change-detector-core","version":"0.1.0","description":"Isomorphic core for detecting changes between TypeScript declaration files (browser + Node.js)","main":"dist/cjs/index.js","module":"dist/esm/index.js","types":"dist/esm/index.d.ts","keywords":["typescript","api","semver","change-detection","isomorphic"],"author":"","license":"MIT","dependencies":{"@microsoft/tsdoc":"^0.16.0","@typescript-eslint/typescript-estree":"^8.49.0","typescript":"5.8.3"},"devDependencies":{"@microsoft/api-extractor":"^7.55.2","@types/node":"^22.19.1","@vitest/coverage-v8":"^4.0.15","pkg-up":"^4.0.0","tsd":"^0.33.0","vitest":"^4.0.15","zod":"^4.1.13"},"exports":{".":{"types":"./dist/esm/index.d.ts","import":"./dist/esm/index.js","require":"./dist/cjs/index.js"},"./ast":{"types":"./dist/esm/ast/index.d.ts","import":"./dist/esm/ast/index.js","require":"./dist/cjs/ast/index.js"},"./rules":{"types":"./dist/esm/rules.d.ts","import":"./dist/esm/rules.js","require":"./dist/cjs/rules.js"},"./plugins":{"types":"./dist/esm/plugins.d.ts","import":"./dist/esm/plugins.js","require":"./dist/cjs/plugins.js"}},"typesVersions":{"*":{"ast":["./dist/esm/ast/index.d.ts"],"rules":["./dist/esm/rules.d.ts"],"plugins":["./dist/esm/plugins.d.ts"]}},"scripts":{"clean":"rm -rf dist","build":"pnpm build:esm && pnpm build:cjs","build:esm":"tsc -p tsconfig.esm.json","build:cjs":"tsc -p tsconfig.cjs.json","test":"vitest run && pnpm test:types","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/change-detector-core@0.1.0","_integrity":"sha512-cOeXn7e4rlr+fAwZKz99SJzwGacP+z9vFrWG6+8CXa9yKKulmwkNeRIIvaWqdqIpdE4pNrh159JhaeogC7/RKg==","_resolved":"/tmp/13556b44f9c2b766a036fa97ac98f6eb/api-extractor-tools-change-detector-core-0.1.0.tgz","_from":"file:api-extractor-tools-change-detector-core-0.1.0.tgz","_nodeVersion":"20.20.0","_npmVersion":"10.8.2","dist":{"integrity":"sha512-cOeXn7e4rlr+fAwZKz99SJzwGacP+z9vFrWG6+8CXa9yKKulmwkNeRIIvaWqdqIpdE4pNrh159JhaeogC7/RKg==","shasum":"f3fbd3d196b8057145c5e49a3d35438a70d985c5","tarball":"https://registry.npmjs.org/@api-extractor-tools/change-detector-core/-/change-detector-core-0.1.0.tgz","fileCount":427,"unpackedSize":1624155,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIQD/AdIO2ZD5ORtfPIj2j9Vtc2w4tugLRQsUDXSyCFc7+gIgALLAsCRzX6xRJAwfN1SfCDBZ6WBzRuiY5HOesEseqWE="}]},"_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/change-detector-core_0.1.0_1771015666905_0.5758560864305369"},"_hasShrinkwrap":false}},"time":{"created":"2025-12-08T00:27:21.960Z","modified":"2026-02-13T20:47:47.257Z","0.1.0-alpha.0":"2025-12-08T00:27:22.186Z","0.1.0-alpha.1":"2025-12-11T19:23:56.436Z","0.1.0-alpha.2":"2026-01-01T21:47:22.112Z","0.1.0":"2026-02-13T20:47:47.124Z"},"license":"MIT","keywords":["typescript","api","semver","change-detection","isomorphic"],"description":"Isomorphic core for detecting changes between TypeScript declaration files (browser + Node.js)","maintainers":[{"name":"northm","email":"michael.l.north@gmail.com"}],"readme":"# Change Detector Core\n\n[![npm version](https://img.shields.io/npm/v/%40api-extractor-tools%2Fchange-detector-core)](https://www.npmjs.com/package/@api-extractor-tools/change-detector-core)\n\nIsomorphic core library for detecting and analyzing changes between TypeScript declaration files. This package provides the core comparison logic that works in both Node.js and browser environments.\n\n## Overview\n\nThis package is the foundation of `@api-extractor-tools/change-detector`, extracted to enable browser-based usage (e.g., in interactive demos and playgrounds). It provides:\n\n- **In-memory TypeScript parsing** - Parse `.d.ts` content from strings without file system access\n- **Symbol comparison** - Detect additions, removals, and modifications of exported symbols\n- **Change classification** - Categorize changes by semantic versioning impact (major/minor/none)\n- **Report generation** - Format comparison results as text, markdown, or JSON\n\n## Installation\n\n```bash\nnpm install @api-extractor-tools/change-detector-core\n# or\npnpm add @api-extractor-tools/change-detector-core\n```\n\n## Usage\n\n### Basic Comparison\n\n```typescript\nimport { compareDeclarations } from '@api-extractor-tools/change-detector-core'\nimport * as ts from 'typescript'\n\nconst oldContent = `export declare function greet(name: string): string;`\nconst newContent = `export declare function greet(name: string, prefix?: string): string;`\n\nconst report = compareDeclarations({ oldContent, newContent }, ts)\n\nconsole.log(report.releaseType) // 'minor'\nconsole.log(report.changes.nonBreaking) // [{ category: 'param-added-optional', ... }]\n```\n\n### Report Formatting\n\n```typescript\nimport {\n  compareDeclarations,\n  formatReportAsText,\n  formatReportAsMarkdown,\n  reportToJSON,\n} from '@api-extractor-tools/change-detector-core'\nimport * as ts from 'typescript'\n\nconst report = compareDeclarations({ oldContent, newContent }, ts)\n\n// Plain text format\nconsole.log(formatReportAsText(report))\n\n// Markdown format (great for PRs and documentation)\nconsole.log(formatReportAsMarkdown(report))\n\n// JSON format (for programmatic consumption)\nconst json = reportToJSON(report)\n```\n\n### Low-Level APIs\n\nFor more control, you can use the lower-level parsing and comparison functions:\n\n```typescript\nimport {\n  parseDeclarationString,\n  compareDeclarationResults,\n  classifyChanges,\n} from '@api-extractor-tools/change-detector-core'\nimport * as ts from 'typescript'\n\n// Parse declarations separately\nconst oldResult = parseDeclarationString(oldContent, ts, 'old.d.ts')\nconst newResult = parseDeclarationString(newContent, ts, 'new.d.ts')\n\n// Compare parsed results\nconst changes = compareDeclarationResults(oldResult, newResult, ts)\n\n// Classify changes\nconst classified = classifyChanges(\n  changes,\n  oldResult.symbols.size,\n  newResult.symbols.size,\n)\n```\n\n## API\n\n### Main Functions\n\n| Function                                         | Description                                              |\n| ------------------------------------------------ | -------------------------------------------------------- |\n| `compareDeclarations(options, ts)`               | Compare two declaration strings and return a full report |\n| `parseDeclarationString(content, ts, filename?)` | Parse a declaration string into symbols                  |\n| `compareDeclarationResults(old, new, ts)`        | Compare two parsed declaration results                   |\n| `classifyChanges(changes, oldCount, newCount)`   | Classify changes and compute statistics                  |\n\n### Formatting Functions\n\n| Function                         | Description                                  |\n| -------------------------------- | -------------------------------------------- |\n| `formatReportAsText(report)`     | Format report as plain text                  |\n| `formatReportAsMarkdown(report)` | Format report as markdown                    |\n| `reportToJSON(report)`           | Convert report to a JSON-serializable object |\n\n### Types\n\n| Type               | Description                                                                  |\n| ------------------ | ---------------------------------------------------------------------------- |\n| `ComparisonReport` | Full comparison report with changes and statistics                           |\n| `Change`           | Individual change record with category and explanation                       |\n| `ReleaseType`      | `'major' \\| 'minor' \\| 'none'`                                               |\n| `ChangeCategory`   | Specific type of change (e.g., `'symbol-removed'`, `'param-added-optional'`) |\n\n## Browser Usage\n\nThis package is designed to work in browsers. The key requirement is providing the TypeScript compiler:\n\n```typescript\n// In a browser environment, you might load TypeScript from a CDN\nimport * as ts from 'typescript' // or load from CDN\n\nimport { compareDeclarations } from '@api-extractor-tools/change-detector-core'\n\n// Works the same as in Node.js\nconst report = compareDeclarations({ oldContent, newContent }, ts)\n```\n\n## Plugin System\n\nThe change-detector supports a unified plugin architecture for extending its capabilities:\n\n### Plugin Capabilities\n\n| Capability           | Description                                                   |\n| -------------------- | ------------------------------------------------------------- |\n| **Input Processors** | Convert different formats to symbols (GraphQL, OpenAPI, etc.) |\n| **Policies**         | Custom versioning rules for change classification             |\n| **Reporters**        | Custom output formats (PR comments, CI integration, etc.)     |\n| **Validators**       | Pre-comparison validation rules                               |\n\n### Using Plugins\n\n```typescript\nimport { createPluginRegistry } from '@api-extractor-tools/change-detector-core'\nimport graphqlPlugin from '@api-extractor-tools/input-processor-graphql'\n\n// Create registry and register plugins\nconst registry = createPluginRegistry()\nregistry.register(graphqlPlugin)\n\n// Look up capabilities\nconst processor = registry.getInputProcessor('graphql:schema')\nconst processors = registry.findInputProcessorsForExtension('.graphql')\n```\n\n### Creating Plugins\n\nPlugins implement the `ChangeDetectorPlugin` interface:\n\n```typescript\nimport type { ChangeDetectorPlugin } from '@api-extractor-tools/change-detector-core'\n\nconst myPlugin: ChangeDetectorPlugin = {\n  metadata: {\n    id: 'my-plugin',\n    name: 'My Plugin',\n    version: '1.0.0',\n  },\n  inputProcessors: [\n    /* ... */\n  ],\n  policies: [\n    /* ... */\n  ],\n  reporters: [\n    /* ... */\n  ],\n  validators: [\n    /* ... */\n  ],\n}\n\nexport default myPlugin\n```\n\nFor detailed documentation, see:\n\n- [Plugin Architecture](./PLUGIN_ARCHITECTURE.md) - Architecture overview\n- [Plugin Development Guide](./PLUGIN_DEVELOPMENT.md) - How to create plugins\n\n## Relationship to `@api-extractor-tools/change-detector`\n\n- **`change-detector-core`** - Isomorphic core (this package), works everywhere\n- **`change-detector`** - Full package with file-based APIs and CLI, Node.js only\n\nIf you need to:\n\n- Compare declaration **files** from disk → use `change-detector`\n- Use the **CLI** → use `change-detector`\n- Run in a **browser** → use `change-detector-core`\n- Build **custom tooling** → use `change-detector-core`\n\n## License\n\nMIT\n","readmeFilename":"README.md"}