{"name":"vue-component-meta","version":"1.0.0-beta.1","license":"MIT","_id":"vue-component-meta@1.0.0-beta.1","maintainers":[{"name":"johnsoncodehk","email":"johnsoncodehk@gmail.com"}],"homepage":"https://github.com/johnsoncodehk/volar#readme","bugs":{"url":"https://github.com/johnsoncodehk/volar/issues"},"dist":{"shasum":"48932a4a7a5249740a34f66272bc008fd9cee5de","tarball":"http://registry-npm.ywwl.com/vue-component-meta/download/vue-component-meta-1.0.0-beta.1.tgz","fileCount":7,"integrity":"sha512-kaUWlNiAkC7tdR/4s+SJGdlqOYxe7ZHrgoxhcrwJbrkFnop+I0n4kjurhkkx3sVyzRAoDj3Cq2wPXmjjx9J3Jg==","signatures":[{"sig":"MEUCIBz8zET+QawWi8gxHm2lE60rBTEi2a1UJ16YrQLSzUE3AiEAjULLJmgGvAq58rM72tPlP616IUbFGOIFeNhmLJh9nGk=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":28924,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjMkz1ACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmqyIw//bo6lQHO+bOtjU2Y93uxm77Fu/57/nbfW4cltlWs6IrQMb/LV\r\nY9wIpb2p3UrqHGWk9bB2e30KF8dr7+yIhH2oe2F/6P4Lr6cNYRAqgjOjDWAN\r\nHbp2Vu6TVSF/jXNd8PMgwLzYHVLJO1u/lSsuECm8wBvyeZ8dXeTRv1cB0JIh\r\nM2QyuFRmA2SKQvHz6JJ2IcROrMiBR1ROB3U3tGJr1z7R0LUNN5WxnDheuOUm\r\nAvcQmRjVf+d8CfD40N18w8YFBZesz5KMY/lt9IYGnMWFa3+uJcP6345GonlD\r\nhvPyAQAx+HwK/ZGoTljs8jGMKicou7MG47k2YpjpseIVhwvC1G4AvBJPgpd9\r\n6ID9h2Mo7lPoAZMrUfLxA9E7eiwoitpgtySq4tTKptTJXHpigMI2ElQw3ZWZ\r\nbFYaL5yVRnw+pD850Kv67UYbNHIIJRdgbvh9vCeWYTArt9ztB3CjpasrUry2\r\nxQyHCah+KeRH1sp3y7CwmmeJk5mdFgDMumhcJbBbZ+iGfS3YxdPRcQmNPibW\r\nAaItjDaIf+N+Xf/oa3kYyT7Gu9aV5rT/oJH4N4ElPDZaKFtXO1i853yTic0R\r\n64752Q2JPg3NfpZeucjA+yXhHnXxQGn43tqw8IKlEYm0x4tQayhTdGiTcd8A\r\nwJmZB8DwMeXXUw3Jsziofn5+dQ1r6V/ACuc=\r\n=5wDi\r\n-----END PGP SIGNATURE-----\r\n","size":6732,"noattachment":false,"key":"/vue-component-meta/-/vue-component-meta-1.0.0-beta.1.tgz"},"main":"out/index.js","types":"./out/index.d.ts","gitHead":"3421929c584e8fafd772b2386c12ffe9b48355f2","_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.3/node@v16.15.0+x64 (darwin)","description":"## Usage","directories":{},"_nodeVersion":"16.15.0","dependencies":{"@volar/language-core":"1.0.0-beta.1","@volar/vue-language-core":"1.0.0-beta.1"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"typescript":"*"},"_npmOperationalInternal":{"tmp":"tmp/vue-component-meta_1.0.0-beta.1_1664240885218_0.4908295853853153","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":1664240885371,"_cnpm_publish_time":1664240885371,"dist-tags":{"alpha":"4.0.0-alpha.3","latest":"3.3.14","v3.0":"3.0.11"}}