{"name":"vue-component-meta","version":"1.0.0-beta.6","license":"MIT","_id":"vue-component-meta@1.0.0-beta.6","maintainers":[{"name":"johnsoncodehk","email":"johnsoncodehk@gmail.com"}],"homepage":"https://github.com/johnsoncodehk/volar#readme","bugs":{"url":"https://github.com/johnsoncodehk/volar/issues"},"dist":{"shasum":"a105d7b228f0b88992f80a625daffa35e93212be","tarball":"http://registry-npm.ywwl.com/vue-component-meta/download/vue-component-meta-1.0.0-beta.6.tgz","fileCount":7,"integrity":"sha512-QKCsERSqQ8AQVi60OfoH4bMhynZe/zhIVK+YXiiILoMclzpWDOx/mKrMi82H7zeicXmn2WTpF8/TFmWchX+eIw==","signatures":[{"sig":"MEUCIQCQMPioHWpo0KpiYEH999lKM8ks8FzF4DZo5CoeF54pMQIgctTgexiTP1JRurw4HsSb5X0/VS2uBbkzeKEGkppn3Jw=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":28934,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjO/SyACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmqjgA//WyTiz6eVsLnJRdgy4k3ic668fJC/OazYXhaP0SkrMrtWffXZ\r\n45pDMu0KNw82+GcAKavekCTkE198lXDju4d5PR5fv1M07ZoKHu6SQEgj5RfK\r\nsAaI4z2VLLcO4fD1HfukQwyko66FRpre+6J4o7NzXEAyzWR0SumlxGwPOob8\r\nm4d/6L5VTAMI1RTAjaO3NNEKnBtHkDNLJapoFA97saxXX8rG9Zz1Egm5Jtdk\r\nghBcEqV0WMtxYQWU4FiGUjpWTD6uUnPDRkzNBlLXkB1/lErO3d74KnCSR8GN\r\nLd6i6RHMhBQ0JKLt+RPhXXg9H/T1IEbIbPRZlDSIezazGRlMTqZ8pozqNmoB\r\nlmZeIWbotVqhd4uQPyqiu/TXPIT0sLL+wGn0ZeyqxGThaZDVXiicJdejEKGd\r\nqR5jghySAN6G9TckE5B5HTDyz78/ze82eTd86KcLmk1BZ8mVDmlAtuGpc2EK\r\nNxYEXGe0FF/y1RSJ3QroLrnZ5u4O7zJYDf0f2B2DlaZ5nhFMltyt3CD3Et4T\r\nEoEzuhhkfPnuHIUAf3qpRRIt+gnFm2ocXsNvqz7uC3JkzMMpQZV6e1uRpfQB\r\nToWN4n7lUVI/svRdIF7BFer2g8z6OGWQ4bP1y193iSbi4Qs1zmrjmcS5vhhn\r\npNNKEw+EXDOM4gKB3x2Zak+Yb/pgaUqcN3I=\r\n=6qWa\r\n-----END PGP SIGNATURE-----\r\n","size":6738,"noattachment":false,"key":"/vue-component-meta/-/vue-component-meta-1.0.0-beta.6.tgz"},"main":"out/index.js","types":"./out/index.d.ts","gitHead":"501696bea5b7d1cc318ea52e0ba1c200e6ac2e01","_npmUser":{"name":"johnsoncodehk","email":"johnsoncodehk@gmail.com"},"repository":{"url":"git+https://github.com/johnsoncodehk/volar.git","type":"git","directory":"vue-language-tools/vue-component-meta"},"_npmVersion":"lerna/1.11.3/node@v16.15.0+x64 (darwin)","description":"## Usage","directories":{},"_nodeVersion":"16.15.0","dependencies":{"@volar/language-core":"1.0.0-beta.4","@volar/vue-language-core":"1.0.0-beta.6"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"typescript":"*"},"_npmOperationalInternal":{"tmp":"tmp/vue-component-meta_1.0.0-beta.6_1664873650140_0.5239723090065151","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":1664873650299,"_cnpm_publish_time":1664873650299,"dist-tags":{"alpha":"4.0.0-alpha.3","latest":"3.3.14","v3.0":"3.0.11"}}