{"name":"vue-component-meta","version":"0.40.11","license":"MIT","_id":"vue-component-meta@0.40.11","maintainers":[{"name":"johnsoncodehk","email":"johnsoncodehk@gmail.com"}],"homepage":"https://github.com/johnsoncodehk/volar#readme","bugs":{"url":"https://github.com/johnsoncodehk/volar/issues"},"dist":{"shasum":"8c77f5f4c2809923090fb928e613e536bc898795","tarball":"http://registry-npm.ywwl.com/vue-component-meta/download/vue-component-meta-0.40.11.tgz","fileCount":7,"integrity":"sha512-s4I6uVAmre0c6yw3tc2Y5ySV1PtL8HdCK5JSve7ZuYPqJpey0yBOIntwM7Bjo+IlOKOKYoAwVwKTJUbtz5xoaA==","signatures":[{"sig":"MEQCIDx6x5MBLmvMAqN2iB7uNhGUme3PcLnWkxZlB01L8LiiAiBNBCFJMx/ecXWE9xXbZVhGj1+z1mxTaTxUhyGl0xUhfg==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":28889,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjGM80ACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmqrWQ/6AhJKcE07euO1KpnIoACBmMsmlsed6xveiIAkTyrGpnpVC6FG\r\nai0GZ4pmugRsaro9nvXhzb/TZdgzyKy0HRRP7486DaWjm16632NZo1Nsokbm\r\nyfZOnabM9LxvI4YVwWuLpmEdru7B9lAgyBoxQdKn/32FDOe4R0v7097za934\r\nMbipid199CSkVahEDcLtFWRnc3J9z9Z2WMGK6bYGdEWNy0bhEXtySob7pAfj\r\n16w3qSGxBPPX74yFBsxxjcTujM7DZ6Z6gtbEv09enNTF8B4JENZPOPkob/1u\r\nvS0Tnuogtlm9QrYCMwuRzeau7Z4EL2+7Ac+feG31TurKpROxMyN7Xwohpxrd\r\njEzv+UMSOVP3BQuxi86IvIViQeOp0mag1RYgpEm9VyO6vORg6BKzQfbEiOsL\r\n8mq7UFI8MRYxBmVvJihRakTz9NJ9t7TVPN+IlzsBlM7lBeUSEfkxuYDpVdnV\r\ngdtG/YmJX9i1VlYjWBFALbC1DF2RvrGgU5KsZpGcDkZtehnw9yX0GbTCZOxS\r\njQNdUdwPNAn6Zvc2RwFh7e7RfbwzHDGWo1nIjN254NCLk3rNVARHEtnrU6XC\r\n/2PLqA9wK9c2A5WtXl6vPUWIr4O9+/fJLe1s4JQlmuNdTpLphcYBfNafD4hC\r\n+Z2vZjJu1W+QYXO/cwrqAJhOXCQdhBlKRXo=\r\n=gpO8\r\n-----END PGP SIGNATURE-----\r\n","size":6724,"noattachment":false,"key":"/vue-component-meta/-/vue-component-meta-0.40.11.tgz"},"main":"out/index.js","types":"./out/index.d.ts","gitHead":"42c62e24e00d6508586559d3d0c6971a3c63d946","_npmUser":{"name":"johnsoncodehk","email":"johnsoncodehk@gmail.com"},"repository":{"url":"git+https://github.com/johnsoncodehk/volar.git","type":"git","directory":"packages/vue-component-meta"},"_npmVersion":"lerna/1.11.2/node@v16.15.0+x64 (darwin)","description":"## Usage","directories":{},"_nodeVersion":"16.15.0","dependencies":{"@volar/vue-language-core":"0.40.11"},"_hasShrinkwrap":false,"peerDependencies":{"typescript":"*"},"_npmOperationalInternal":{"tmp":"tmp/vue-component-meta_0.40.11_1662570292381_0.7212445147128312","host":"s3://npm-registry-packages"},"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":1662570292517,"_cnpm_publish_time":1662570292517,"dist-tags":{"alpha":"4.0.0-alpha.3","latest":"3.3.14","v3.0":"3.0.11"}}