# @ctrlc/vite-plugin-vue-setup-extend

> vite vue3 插件 扩展script标签 name inheritAttrs 等属性

Latest version **1.2.0** (published 2024-03-03) · MIT license · 0 weekly downloads

## Install

```sh
npm install @ctrlc/vite-plugin-vue-setup-extend
pnpm add @ctrlc/vite-plugin-vue-setup-extend
yarn add @ctrlc/vite-plugin-vue-setup-extend
bun add @ctrlc/vite-plugin-vue-setup-extend
```

## Health

**Score 20/100 (F)** — status: abandoned.

Positive: esm support; no vulnerabilities.

Warnings: low downloads; no types.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.2.0 |
| Published | 2024-03-03 |
| First published | 2023-02-04 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | ESM + CommonJS |
| Dependencies | 3 |
| Unpacked size | 6.4 KB |
| Known vulnerabilities | 0 (+13 in 1 direct dependencies) |
| Install scripts | no |
| Author | zhuqing.yang |
| Maintainers | yangzhuqing |
| Keywords | vite-setup, rollup-plugin, vite-plugin |

## Links

- npm: https://www.npmjs.com/package/@ctrlc/vite-plugin-vue-setup-extend
- Repository: https://gitee.com/ctrlc-git/ctrlc-vite-setup-extend
- npm.io page: https://npm.io/package/@ctrlc/vite-plugin-vue-setup-extend

## Dependencies (3)

- [vue](https://npm.io/package/vue.md) ^3.3.4
- [vite](https://npm.io/package/vite.md) ^3.2.7
- [magic-string](https://npm.io/package/magic-string.md) ^0.28.0

## Alternatives

- [raw-loader](https://npm.io/package/raw-loader.md) — 4.3M weekly downloads
- [plop](https://npm.io/package/plop.md) — 1.4M weekly downloads
- [webpack-deadcode-plugin](https://npm.io/package/webpack-deadcode-plugin.md) — 80.3K weekly downloads
- [@storybook/preact-vite](https://npm.io/package/@storybook/preact-vite.md) — 54.2K weekly downloads
- [vite-plugin-transform](https://npm.io/package/vite-plugin-transform.md) — 2.4K weekly downloads

## Recent versions

- 1.2.0 (latest) — 2024-03-03
- 1.1.3 — 2024-03-03
- 1.1.2 — 2023-08-20
- 1.1.1 — 2023-08-20
- 1.1.0 — 2023-03-01
- 1.0.2 — 2023-02-15
- 1.0.1 — 2023-02-04

## README

# `@ctrlc/vite-plugin-vue-setup-extend`

> 用于`vue3`在`<script setup>`语法时，扩展`name`以及`inheritAttrs`属性, 用于显式声明组件展示时的名称、用于控制是否启用默认的组件`attribute`透传行为

## 使用手册

### 安装

```bash
npm i @ctrlc/vite-plugin-vue-setup-extend -D
```

### 语法

```JS
vueScriptExtend(Options)
```

### 配置项

参数|类型|默认值|说明
----|---|-------|---
Options.include| FilterPattern | undefined | rollup过滤模式
Options.exclude| FilterPattern | undefined | rollup过滤模式
Options.hasMap| boolean | true | 是否启用 magic-string map方法 优化控制台日志
Options.hires| boolean | true | magic-string 配置参数

### 示例

在`vite.config.ts`文件中引入插件：

```js
...
import vue from '@vitejs/plugin-vue'
import vueScriptExtend from '@ctrlc/vite-plugin-vue-setup-extend';

export default defineConfig({
  plugins: [vue(), vueScriptExtend()],
})
```

```html
<template>
  <div>hello world</div>
</template>
<!-- 扩展 setup模式 script属性 -->
<script lang="ts" setup name="App" inherit-attrs="false">
  // code here
</script>
```

编译后转义为

```js
import { defineComponent } from 'vue'

export default defineComponent({
  name: "App",
  inheritAttrs: false,
})

```

## 文档

* [文档](https://gitee.com/ctrlc-git/ctrlc-vite-setup-extend.git)

---
_Source: https://npm.io/package/@ctrlc/vite-plugin-vue-setup-extend · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
