# @yuntian001/vue-setup-extend

> Make the vue script setup syntax support the attribute

Latest version **1.0.0** (published 2022-10-08) · MIT license · 0 weekly downloads

## Install

```sh
npm install @yuntian001/vue-setup-extend
pnpm add @yuntian001/vue-setup-extend
yarn add @yuntian001/vue-setup-extend
bun add @yuntian001/vue-setup-extend
```

## Health

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

Positive: has types; esm support; no vulnerabilities; high quality score.

Warnings: low downloads.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.0 |
| Published | 2022-10-08 |
| First published | 2022-10-08 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 2 |
| Unpacked size | 9.1 MB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | yuntian001 |
| Maintainers | yuntian001 |
| Keywords | vue, setup, vite |

## Links

- npm: https://www.npmjs.com/package/@yuntian001/vue-setup-extend
- Repository: https://github.com/yuntian001/vue-setup-extend
- Homepage: https://github.com/yuntian001/vue-setup-extend#readme
- Issues: https://github.com/yuntian001/vue-setup-extend/issues
- npm.io page: https://npm.io/package/@yuntian001/vue-setup-extend

## Dependencies (2)

- [xregexp](https://npm.io/package/xregexp.md) ^5.1.1
- [magic-string](https://npm.io/package/magic-string.md) ^0.26.6

## 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.0.0 (latest) — 2022-10-08
- 1.0.0-beta.0 (beta) — 2022-10-08

## README

# vueSetupExtend
 方便给vue `<script setup>` 标签语法设置自定义属性。

## 快速开始
`npm install @yuntian001/vue-setup-extend -D`

`vite.config.ts`
```
import { defineConfig, Plugin } from 'vite'
import vue from '@vitejs/plugin-vue'
import { vueSetUpExtend } from '@yuntian001/vue-setup-extend';

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

```

## 规则

::: warning 注意
当代码中存在`<script lang="ts>`标签时，插件不会执行
:::

```
 <script lang="ts" setup name="App" auth="{{'type'+(3+4)}}" >
  const test = 1
</script>
 ```
 会生成
 ```
<script lang="ts>
  import { defineComponent } from 'vue';
  export default defineComponent({name:'App',auth:'type'+(3+4)});
</script>
 <script lang="ts" setup>
  const test = 1
</script>
 ```

 ## 配置参数


|  config     | 类型 |说明|
| ----------- | ----------- | ----------- | 
| exclude | string[] | 需要排除的attribute |
| setLangImport | boolean | 为true时会自动提取`<script setup lang="ts">`中形如`useLocalesI18n({}, [(locale: string) => import(`./lang/${locale}.json`), 'compnentLang'])`的语言加载函数设置为`langImport`属性,为[meadmin-template](https://github.com/meadmin-cn/meadmin-template)专用，无需关注。 |
| setComponents | boolean | 为true时会自动生成getComponents属性,值为：`()=>[component1,component2...]`。可用其获取所有引用的组件，为[meadmin-template](https://github.com/meadmin-cn/meadmin-template)专用，无需关注。 |

config默认值为:`{ exclude: ['lang', 'setup'] }`

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