{"name":"vue-component-meta","version":"2.2.4","license":"MIT","_id":"vue-component-meta@2.2.4","maintainers":[{"name":"johnsoncodehk","email":"johnsoncodehk@gmail.com"},{"name":"kazariex","email":"mimorimaboroshi@gmail.com"}],"dist":{"shasum":"330678c7d9f7d6ceccb3218dba673095be6311ed","tarball":"http://registry-npm.ywwl.com/vue-component-meta/download/vue-component-meta-2.2.4.tgz","fileCount":9,"integrity":"sha512-Nv2B3+PwSH84ZpJDvOdn+kvkWv0kJAke6VljiFDatpE169C4Gt8oEUPoF5LdUkrdpjbWa4vvIDV4uueA8RSnaQ==","signatures":[{"sig":"MEQCIAOyLixZAAAagxcb0Yh8LKchlZG+mw8UQeszT+zM98R9AiAgYhNf6izBDtuHW58xMIweB5KHgkRg9Cw3dUm+tE/6nQ==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":43456,"size":10188,"noattachment":false,"key":"/vue-component-meta/-/vue-component-meta-2.2.4.tgz"},"gitHead":"c28986596935cb43979c9d437c25f292bdb36cef","_npmUser":{"name":"johnsoncodehk","email":"johnsoncodehk@gmail.com"},"repository":{"url":"https://github.com/vuejs/language-tools.git","type":"git","directory":"packages/component-meta"},"_npmVersion":"lerna/3.11.0/node@v23.0.0+x64 (win32)","directories":{},"sideEffects":false,"_nodeVersion":"23.0.0","dependencies":{"path-browserify":"^1.0.1","@volar/typescript":"~2.4.11","@vue/language-core":"2.2.4","vue-component-type-helpers":"2.2.4"},"_hasShrinkwrap":false,"devDependencies":{"@types/node":"^22.10.4","@types/path-browserify":"^1.0.1"},"peerDependencies":{"typescript":"*"},"peerDependenciesMeta":{"typescript":{"optional":true}},"_npmOperationalInternal":{"tmp":"tmp/vue-component-meta_2.2.4_1740314187689_0.11464163894282109","host":"s3://npm-registry-packages-npm-production"},"readme":"# vue-component-meta\n\n<p>\n  <a href=\"https://www.npmjs.com/package/vue-component-meta\"><img src=\"https://img.shields.io/npm/v/vue-component-meta.svg?labelColor=18181B&color=1584FC\" alt=\"NPM version\"></a>\n  <a href=\"https://github.com/vuejs/language-tools/blob/master/LICENSE\"><img src=\"https://img.shields.io/github/license/vuejs/language-tools.svg?labelColor=18181B&color=1584FC\" alt=\"License\"></a>\n</p>\n\nStatically extract metadata such as props, events, slots, and exposed from Vue components. Useful for auto-generating component documentation or displaying component APIs in tools like Storybook.\n\n## Installation\n\n```bash\nnpm install vue-component-meta typescript\n```\n\n## Usage\n\n### Create a Checker from tsconfig.json\n\n```typescript\nimport { createChecker } from 'vue-component-meta';\n\nconst checker = createChecker('/path/to/tsconfig.json', {\n  schema: true, // Enable schema parsing\n});\n\nconst meta = checker.getComponentMeta('/path/to/MyComponent.vue');\n```\n\n### Create a Checker from JSON Configuration\n\n```typescript\nimport { createCheckerByJson } from 'vue-component-meta';\n\nconst checker = createCheckerByJson('/project/root', {\n  include: ['src/**/*.vue'],\n  compilerOptions: { /* ... */ },\n  vueCompilerOptions: { /* ... */ },\n});\n```\n\n## API\n\n### `checker.getComponentMeta(filePath, exportName?)`\n\nGet the metadata of a component. `exportName` defaults to `'default'`.\n\nThe returned `ComponentMeta` object contains:\n\n```typescript\ninterface ComponentMeta {\n  name?: string;\n  description?: string;\n  type: TypeMeta;\n  props: PropertyMeta[];\n  events: EventMeta[];\n  slots: SlotMeta[];\n  exposed: ExposeMeta[];\n}\n```\n\n### `checker.getExportNames(filePath)`\n\nGet all export names of a file.\n\n### `checker.updateFile(filePath, content)`\n\nUpdate file content (for virtual files or live editing).\n\n### `checker.deleteFile(filePath)`\n\nRemove a file from the project.\n\n### `checker.reload()`\n\nReload the tsconfig.json configuration.\n\n### `checker.clearCache()`\n\nClear cached file content.\n\n### `checker.getProgram()`\n\nGet the underlying TypeScript Program instance.\n\n## Metadata Structures\n\n### PropertyMeta (Props)\n\n```typescript\ninterface PropertyMeta {\n  name: string;\n  description: string;      // Read from JSDoc\n  type: string;             // Type string\n  default?: string;         // Default value\n  required: boolean;\n  global: boolean;          // Whether it's a global prop\n  tags: { name: string; text?: string }[];  // JSDoc tags\n  schema: PropertyMetaSchema;\n  getDeclarations(): Declaration[];\n  getTypeObject(): ts.Type;\n}\n```\n\n### EventMeta\n\n```typescript\ninterface EventMeta {\n  name: string;\n  description: string;\n  type: string;\n  signature: string;\n  tags: { name: string; text?: string }[];\n  schema: PropertyMetaSchema[];\n  getDeclarations(): Declaration[];\n  getTypeObject(): ts.Type | undefined;\n}\n```\n\n### SlotMeta\n\n```typescript\ninterface SlotMeta {\n  name: string;\n  description: string;\n  type: string;\n  tags: { name: string; text?: string }[];\n  schema: PropertyMetaSchema;\n  getDeclarations(): Declaration[];\n  getTypeObject(): ts.Type;\n}\n```\n\n### ExposeMeta\n\n```typescript\ninterface ExposeMeta {\n  name: string;\n  description: string;\n  type: string;\n  tags: { name: string; text?: string }[];\n  schema: PropertyMetaSchema;\n  getDeclarations(): Declaration[];\n  getTypeObject(): ts.Type;\n}\n```\n\n## Options\n\n```typescript\ninterface MetaCheckerOptions {\n  schema?: boolean | {\n    ignore?: (string | ((name: string, type: ts.Type, typeChecker: ts.TypeChecker) => boolean))[];\n  };\n  printer?: ts.PrinterOptions;\n}\n```\n\n### `schema`\n\nControls whether to parse the schema structure of types. Set to `true` to enable, or pass an object to configure types to ignore.\n\n```typescript\nconst checker = createChecker(tsconfig, {\n  schema: {\n    ignore: ['HTMLElement', (name) => name.startsWith('Internal')],\n  },\n});\n```\n\n## Related Packages\n\n- [`vue-component-type-helpers`](../component-type-helpers) - Type helper utilities\n\n## License\n\n[MIT](https://github.com/vuejs/language-tools/blob/master/LICENSE) License\n","publish_time":1740314187970,"_cnpm_publish_time":1740314187970,"dist-tags":{"alpha":"4.0.0-alpha.3","latest":"3.3.14","v3.0":"3.0.11"}}