{"name":"@vitejs/plugin-vue","version":"6.0.3","keywords":["vite","vite-plugin","vue"],"author":{"name":"Evan You"},"license":"MIT","_id":"@vitejs/plugin-vue@6.0.3","maintainers":[{"name":"yyx990803","email":"yyx990803@gmail.com"},{"name":"patak","email":"hey.patak@gmail.com"},{"name":"antfu","email":"anthonyfu117@hotmail.com"},{"name":"vitebot","email":"vite@voidzero.dev"},{"name":"sxzz","email":"sxzz@sxzz.moe"}],"homepage":"https://github.com/vitejs/vite-plugin-vue/tree/main/packages/plugin-vue#readme","bugs":{"url":"https://github.com/vitejs/vite-plugin-vue/issues"},"dist":{"shasum":"b857c5dcbc5cfb30bf5d7f9d6e274afcca2d46d1","tarball":"http://registry-npm.ywwl.com/@vitejs/plugin-vue/download/@vitejs/plugin-vue-6.0.3.tgz","fileCount":5,"integrity":"sha512-TlGPkLFLVOY3T7fZrwdvKpjprR3s4fxRln0ORDo1VQ7HHyxJwTlrjKU3kpVWTlaAjIEuCTokmjkZnr8Tpc925w==","signatures":[{"sig":"MEQCID5RsKOeCYg6EluEC6CndnpxH2BgNfRE9TSNx+Rx/LwLAiB3yOzis8Kb+GoZSsrfXbT9ed8aV0ll+OiKop3ShXMH1Q==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@vitejs%2fplugin-vue@6.0.3","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"unpackedSize":74779,"size":22479,"noattachment":false,"key":"/@vitejs/plugin-vue/-/@vitejs/plugin-vue-6.0.3.tgz"},"type":"module","_from":"file:vitejs-plugin-vue-6.0.3.tgz","tsdown":{"dts":{"tsgo":true}},"engines":{"node":"^20.19.0 || >=22.12.0"},"exports":{".":"./dist/index.mjs","./package.json":"./package.json"},"scripts":{"dev":"tsdown --watch","build":"tsdown"},"_npmUser":{"name":"GitHub Actions","email":"npm-oidc-no-reply@github.com","trustedPublisher":{"id":"github","oidcConfigId":"oidc:c46a2df0-6d07-4e58-bb52-a174d20ac7a9"}},"_resolved":"/tmp/ec2359867fe216835e17b2c32f3ae75c/vitejs-plugin-vue-6.0.3.tgz","_integrity":"sha512-TlGPkLFLVOY3T7fZrwdvKpjprR3s4fxRln0ORDo1VQ7HHyxJwTlrjKU3kpVWTlaAjIEuCTokmjkZnr8Tpc925w==","repository":{"url":"git+https://github.com/vitejs/vite-plugin-vue.git","type":"git","directory":"packages/plugin-vue"},"_npmVersion":"11.7.0","description":"The official plugin for Vue SFC support in Vite.","directories":{},"_nodeVersion":"24.11.1","dependencies":{"@rolldown/pluginutils":"1.0.0-beta.53"},"_hasShrinkwrap":false,"devDependencies":{"vue":"^3.5.25","obug":"^2.1.1","vite":"^7.2.6","slash":"^5.1.0","rollup":"^4.53.3","tsdown":"^0.17.0-beta.6","source-map-js":"^1.2.1","@jridgewell/gen-mapping":"^0.3.13","@jridgewell/trace-mapping":"^0.3.31"},"peerDependencies":{"vue":"^3.2.25","vite":"^5.0.0 || ^6.0.0 || ^7.0.0 || ^8.0.0-0"},"_npmOperationalInternal":{"tmp":"tmp/plugin-vue_6.0.3_1765527443206_0.7183293790202103","host":"s3://npm-registry-packages-npm-production"},"readme":"# @vitejs/plugin-vue [![npm](https://img.shields.io/npm/v/@vitejs/plugin-vue.svg)](https://npmjs.com/package/@vitejs/plugin-vue)\n\n> Note: as of `vue` 3.2.13+ and `@vitejs/plugin-vue` 1.9.0+, `@vue/compiler-sfc` is no longer required as a peer dependency.\n\n```js\n// vite.config.js\nimport vue from '@vitejs/plugin-vue'\n\nexport default {\n  plugins: [vue()],\n}\n```\n\nFor JSX / TSX support, [`@vitejs/plugin-vue-jsx`](https://github.com/vitejs/vite-plugin-vue/tree/main/packages/plugin-vue-jsx) is also needed.\n\n## Options\n\n```ts\nexport interface Options {\n  include?: string | RegExp | (string | RegExp)[]\n  exclude?: string | RegExp | (string | RegExp)[]\n\n  isProduction?: boolean\n\n  /**\n   * Requires @vitejs/plugin-vue@^5.1.0\n   */\n  features?: {\n    /**\n     * Enable reactive destructure for `defineProps`.\n     * - Available in Vue 3.4 and later.\n     * - **default:** `false` in Vue 3.4 (**experimental**), `true` in Vue 3.5+\n     */\n    propsDestructure?: boolean\n    /**\n     * Transform Vue SFCs into custom elements.\n     * - `true`: all `*.vue` imports are converted into custom elements\n     * - `string | RegExp`: matched files are converted into custom elements\n     * - **default:** /\\.ce\\.vue$/\n     */\n    customElement?: boolean | string | RegExp | (string | RegExp)[]\n    /**\n     * Set to `false` to disable Options API support and allow related code in\n     * Vue core to be dropped via dead-code elimination in production builds,\n     * resulting in smaller bundles.\n     * - **default:** `true`\n     */\n    optionsAPI?: boolean\n    /**\n     * Set to `true` to enable devtools support in production builds.\n     * Results in slightly larger bundles.\n     * - **default:** `false`\n     */\n    prodDevtools?: boolean\n    /**\n     * Set to `true` to enable detailed information for hydration mismatch\n     * errors in production builds. Results in slightly larger bundles.\n     * - **default:** `false`\n     */\n    prodHydrationMismatchDetails?: boolean\n    /**\n     * Customize the component ID generation strategy.\n     * - `'filepath'`: hash the file path (relative to the project root)\n     * - `'filepath-source'`: hash the file path and the source code\n     * - `function`: custom function that takes the file path, source code,\n     *   whether in production mode, and the default hash function as arguments\n     * - **default:** `'filepath'` in development, `'filepath-source'` in production\n     */\n    componentIdGenerator?:\n      | 'filepath'\n      | 'filepath-source'\n      | ((\n          filepath: string,\n          source: string,\n          isProduction: boolean | undefined,\n          getHash: (text: string) => string,\n        ) => string)\n  }\n\n  // `script`, `template` and `style` are lower-level compiler options\n  // to pass on to respective APIs of `vue/compiler-sfc`\n\n  script?: Partial<\n    Omit<\n      SFCScriptCompileOptions,\n      | 'id'\n      | 'isProd'\n      | 'inlineTemplate'\n      | 'templateOptions'\n      | 'sourceMap'\n      | 'genDefaultAs'\n      | 'customElement'\n    >\n  >\n\n  template?: Partial<\n    Omit<\n      SFCTemplateCompileOptions,\n      | 'id'\n      | 'source'\n      | 'ast'\n      | 'filename'\n      | 'scoped'\n      | 'slotted'\n      | 'isProd'\n      | 'inMap'\n      | 'ssr'\n      | 'ssrCssVars'\n      | 'preprocessLang'\n    >\n  >\n\n  style?: Partial<\n    Omit<\n      SFCStyleCompileOptions,\n      | 'filename'\n      | 'id'\n      | 'isProd'\n      | 'source'\n      | 'scoped'\n      | 'cssDevSourcemap'\n      | 'postcssOptions'\n      | 'map'\n      | 'postcssPlugins'\n      | 'preprocessCustomRequire'\n      | 'preprocessLang'\n      | 'preprocessOptions'\n    >\n  >\n\n  /**\n   * Use custom compiler-sfc instance. Can be used to force a specific version.\n   */\n  compiler?: typeof _compiler\n\n  /**\n   * @deprecated moved to `features.customElement`.\n   */\n  customElements?: boolean | string | RegExp | (string | RegExp)[]\n}\n```\n\n## Asset URL handling\n\nWhen `@vitejs/plugin-vue` compiles the `<template>` blocks in SFCs, it also converts any encountered asset URLs into ESM imports.\n\nFor example, the following template snippet:\n\n```vue\n<img src=\"../image.png\" />\n```\n\nIs the same as:\n\n```vue\n<script setup>\nimport _imports_0 from '../image.png'\n</script>\n\n<img :src=\"_imports_0\" />\n```\n\nBy default the following tag/attribute combinations are transformed, and can be configured using the `template.transformAssetUrls` option.\n\n```js\n{\n  video: ['src', 'poster'],\n  source: ['src'],\n  img: ['src'],\n  image: ['xlink:href', 'href'],\n  use: ['xlink:href', 'href']\n}\n```\n\nNote that only attribute values that are static strings are transformed. Otherwise, you'd need to import the asset manually, e.g. `import imgUrl from '../image.png'`.\n\n## Example for passing options to `vue/compiler-sfc`:\n\n```ts\nimport vue from '@vitejs/plugin-vue'\n\nexport default {\n  plugins: [\n    vue({\n      template: {\n        compilerOptions: {\n          // ...\n        },\n        transformAssetUrls: {\n          // ...\n        },\n      },\n    }),\n  ],\n}\n```\n\n## Example for transforming custom blocks\n\n```ts\nimport vue from '@vitejs/plugin-vue'\nimport yaml from 'js-yaml'\n\nconst vueI18nPlugin = {\n  name: 'vue-i18n',\n  transform(code, id) {\n    // if .vue file don't have <i18n> block, just return\n    if (!/vue&type=i18n/.test(id)) {\n      return\n    }\n    // parse yaml\n    if (/\\.ya?ml$/.test(id)) {\n      code = JSON.stringify(yaml.load(code.trim()))\n    }\n    // mount the value on the i18n property of the component instance\n    return `export default Comp => {\n      Comp.i18n = ${code}\n    }`\n  },\n}\n\nexport default {\n  plugins: [vue(), vueI18nPlugin],\n}\n```\n\nCreate a file named `Demo.vue`, add `lang=\"yaml\"` to the `<i18n>` blocks, then you can use the syntax of `YAML`:\n\n```vue\n<template>Hello</template>\n\n<i18n lang=\"yaml\">\nmessage: 'world'\nfullWord: 'hello world'\n</i18n>\n```\n\n`message` is mounted on the i18n property of the component instance, you can use like this:\n\n```vue\n<script setup lang=\"ts\">\nimport Demo from 'components/Demo.vue'\n</script>\n\n<template>\n  <Demo /> {{ Demo.i18n.message }}\n  <div>{{ Demo.i18n.fullWord }}</div>\n</template>\n```\n\n## Using Vue SFCs as Custom Elements\n\n> Requires `vue@^3.2.0` & `@vitejs/plugin-vue@^1.4.0`\n\nVue 3.2 introduces the `defineCustomElement` method, which works with SFCs. By default, `<style>` tags inside SFCs are extracted and merged into CSS files during build. However when shipping a library of custom elements, it may be desirable to inline the styles as JavaScript strings and inject them into the custom elements' shadow root instead.\n\nStarting in 1.4.0, files ending with `*.ce.vue` will be compiled in \"custom elements\" mode: its `<style>` tags are compiled into inlined CSS strings and attached to the component as its `styles` property:\n\n```js\nimport { defineCustomElement } from 'vue'\nimport Example from './Example.ce.vue'\n\nconsole.log(Example.styles) // ['/* css content */']\n\n// register\ncustomElements.define('my-example', defineCustomElement(Example))\n```\n\nNote in custom elements mode there is no need to use `<style scoped>` since the CSS is already scoped inside the shadow DOM.\n\nThe `customElement` plugin option can be used to configure the behavior:\n\n- `{ customElement: true }` will import all `*.vue` files in custom element mode.\n- Use a string or regex pattern to change how files should be loaded as Custom Elements (this check is applied after `include` and `exclude` matches).\n\n## License\n\nMIT\n","publish_time":1765527443360,"_cnpm_publish_time":1765527443360,"dist-tags":{"alpha":"5.0.0-alpha.0","beta":"6.0.0-beta.2","latest":"6.0.10","previous":"4.6.2"}}