{"name":"@vue/language-core","version":"3.0.5","license":"MIT","_id":"@vue/language-core@3.0.5","maintainers":[{"name":"johnsoncodehk","email":"johnsoncodehk@gmail.com"},{"name":"kazariex","email":"mimorimaboroshi@gmail.com"}],"dist":{"shasum":"c296c65e7b2e6d69fbf2088f0208a55362825323","tarball":"http://registry-npm.ywwl.com/@vue/language-core/download/@vue/language-core-3.0.5.tgz","fileCount":158,"integrity":"sha512-gCEjn9Ik7I/seHVNIEipOm8W+f3/kg60e8s1IgIkMYma2wu9ZGUTMv3mSL2bX+Md2L8fslceJ4SU8j1fgSRoiw==","signatures":[{"sig":"MEYCIQDQmbJ5bAvjnCH26eyFo98EmPHKKAeqZjIRzewOr38IzQIhAMKhtT+GGQWbjWidEacgls6Yg7Ca7fGvPyd5PsPdg5FN","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":372496,"size":74667,"noattachment":false,"key":"/@vue/language-core/-/@vue/language-core-3.0.5.tgz"},"gitHead":"036b6b1882179d35586e16f2a5cba5150e5d18e6","_npmUser":{"name":"kazariex","email":"mimorimaboroshi@gmail.com"},"repository":{"url":"https://github.com/vuejs/language-tools.git","type":"git","directory":"packages/language-core"},"_npmVersion":"lerna/4.1.2/node@v23.11.0+arm64 (darwin)","directories":{},"sideEffects":false,"_nodeVersion":"23.11.0","dependencies":{"picomatch":"^4.0.2","@vue/shared":"^3.5.0","alien-signals":"^2.0.5","muggle-string":"^0.4.1","path-browserify":"^1.0.1","@vue/compiler-dom":"^3.5.0","@vue/compiler-vue2":"^2.7.16","@volar/language-core":"2.4.22"},"_hasShrinkwrap":false,"devDependencies":{"@types/node":"^22.10.4","@types/picomatch":"^4.0.0","@volar/typescript":"2.4.22","@vue/compiler-sfc":"^3.5.0","@types/path-browserify":"^1.0.1"},"peerDependencies":{"typescript":"*"},"peerDependenciesMeta":{"typescript":{"optional":true}},"_npmOperationalInternal":{"tmp":"tmp/language-core_3.0.5_1754065223761_0.9356369345443971","host":"s3://npm-registry-packages-npm-production"},"readme":"# @vue/language-core\n\n<p>\n  <a href=\"https://www.npmjs.com/package/@vue/language-core\"><img src=\"https://img.shields.io/npm/v/@vue/language-core.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\nThe core module for Vue Language Tools, responsible for parsing Vue Single File Components (SFCs) and transforming them into virtual code structures that TypeScript can understand. This package is a low-level dependency for `@vue/language-server` and `vue-tsc`.\n\n## Installation\n\n```bash\nnpm install @vue/language-core\n```\n\n## Core API\n\n### `createVueLanguagePlugin`\n\nCreates a Vue language plugin for integration with Volar language services.\n\n```typescript\nimport { createVueLanguagePlugin } from '@vue/language-core';\nimport type { LanguagePlugin } from '@volar/language-core';\nimport ts from 'typescript';\n\nconst plugin: LanguagePlugin<string> = createVueLanguagePlugin(\n  ts,\n  compilerOptions,    // ts.CompilerOptions\n  vueCompilerOptions, // VueCompilerOptions\n  (scriptId) => scriptId  // asFileName: Converts scriptId to a file name\n);\n```\n\n### `createParsedCommandLine`\n\nParses TypeScript and Vue compiler options from `tsconfig.json`.\n\n```typescript\nimport { createParsedCommandLine } from '@vue/language-core';\nimport ts from 'typescript';\n\nconst parsed = createParsedCommandLine(ts, ts.sys, '/path/to/tsconfig.json');\n// parsed.options: ts.CompilerOptions\n// parsed.vueOptions: VueCompilerOptions\n```\n\n### `parse`\n\nParses Vue SFC source code and returns an `SFCParseResult`.\n\n```typescript\nimport { parse } from '@vue/language-core';\n\nconst result = parse(`\n<template>\n  <div>{{ msg }}</div>\n</template>\n<script setup lang=\"ts\">\nconst msg = 'Hello'\n</script>\n`);\n\n// result.descriptor.template\n// result.descriptor.scriptSetup\n// result.descriptor.styles\n// result.errors\n```\n\n## `vueCompilerOptions`\n\nConfigure Vue compiler behavior through the `vueCompilerOptions` field in `tsconfig.json`:\n\n```jsonc\n{\n  \"compilerOptions\": { /* ... */ },\n  \"vueCompilerOptions\": {\n    \"target\": 3.5,\n    \"strictTemplates\": true,\n    \"plugins\": [\"@vue/language-plugin-pug\"]\n  }\n}\n```\n\n### File Handling Options\n\n| Option | Type | Default | Description |\n| :--- | :--- | :--- | :--- |\n| `target` | `number \\| 'auto'` | `'auto'` | Vue version. `'auto'` reads from `node_modules/vue/package.json`. |\n| `extensions` | `string[]` | `['.vue']` | File extensions to be treated as Vue SFCs. |\n| `vitePressExtensions` | `string[]` | `[]` | File extensions to be treated as VitePress Markdown. |\n| `petiteVueExtensions` | `string[]` | `[]` | File extensions to be treated as Petite Vue HTML. |\n| `plugins` | `string[]` | `[]` | Custom language plugins, e.g., [`@vue/language-plugin-pug`](../language-plugin-pug). |\n\n### Type Checking Options\n\n| Option | Type | Default | Description |\n| :--- | :--- | :--- | :--- |\n| `strictTemplates` | `boolean` | `false` | A convenience option that enables the four `check*` options below and `strictVModel`. |\n| `checkUnknownProps` | `boolean` | `false` | Check for unknown props. |\n| `checkUnknownEvents` | `boolean` | `false` | Check for unknown events. |\n| `checkUnknownComponents` | `boolean` | `false` | Check for unknown components. |\n| `checkUnknownDirectives` | `boolean` | `false` | Check for unknown directives. |\n| `strictVModel` | `boolean` | `false` | Strictly check v-model bindings. |\n| `strictCssModules` | `boolean` | `false` | Strictly check CSS Modules class names (not affected by `strictTemplates`). |\n\n### Advanced Options\n\n| Option | Type | Default | Description |\n| :--- | :--- | :--- | :--- |\n| `lib` | `string` | `'vue'` | Vue package name, used for generating import statements. |\n| `skipTemplateCodegen` | `boolean` | `false` | Skip virtual code generation for templates. |\n| `vapor` | `boolean` | `false` | Enable Vapor mode for all Vue SFCs. |\n| `fallthroughAttributes` | `boolean` | `false` | Enable type inference for fallthrough attributes. |\n| `checkRequiredFallthroughAttributes` | `boolean` | `false` | Check required fallthrough attributes. |\n| `jsxSlots` | `boolean` | `false` | Use JSX-style slots types. |\n| `dataAttributes` | `string[]` | `[]` | Allowed data-* attribute patterns. |\n| `htmlAttributes` | `string[]` | `['aria-*']` | Allowed HTML attribute patterns. |\n| `resolveStyleImports` | `boolean` | `false` | Resolve import statements in styles. |\n| `resolveStyleClassNames` | `boolean \\| 'scoped'` | `'scoped'` | Resolve class names in styles. |\n\n## Built-in Plugins\n\nThis package includes the following built-in plugins to handle different file types and blocks:\n\n### File Parsing Plugins\n\n| Plugin | Function | Controlled By |\n| :--- | :--- | :--- |\n| `file-vue` | Parses `.vue` files into an SFC structure. | `extensions` |\n| `file-md` | Parses Markdown files into an SFC structure. | `vitePressExtensions` |\n| `file-html` | Parses HTML files into an SFC structure. | `petiteVueExtensions` |\n\n### Virtual Code Generation Plugins\n\n| Plugin | Function |\n| :--- | :--- |\n| `vue-tsx` | Generates TypeScript virtual code from an SFC. |\n| `vue-template-html` | Compiles HTML templates. |\n| `vue-template-inline-ts` | Handles TypeScript expressions in templates. |\n| `vue-template-inline-css` | Handles inline styles in templates. |\n| `vue-style-css` | Compiles CSS styles. |\n| `vue-script-js` | Handles JavaScript script blocks. |\n\n### Embedded Code Extraction Plugins\n\n| Plugin | Function |\n| :--- | :--- |\n| `vue-sfc-template` | Extracts the `<template>` block. |\n| `vue-sfc-styles` | Extracts `<style>` blocks. |\n| `vue-sfc-scripts` | Extracts `<script>` blocks (for formatting). |\n| `vue-sfc-customblocks` | Extracts custom blocks. |\n\n## Related Packages\n\n- [`@vue/language-server`](../language-server) - Language Server\n- [`@vue/language-service`](../language-service) - Language Service\n- [`vue-tsc`](../tsc) - Command-line Type Checker\n\n## License\n\n[MIT](https://github.com/vuejs/language-tools/blob/master/LICENSE) License\n","publish_time":1754065224005,"_cnpm_publish_time":1754065224005,"dist-tags":{"alpha":"4.0.0-alpha.3","latest":"3.3.14","v3.0":"3.0.11"}}