Skip to content

Commit b6c825a

Browse files
committed
chore: init
0 parents  commit b6c825a

37 files changed

+7659
-0
lines changed

.editorconfig

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
root = true
2+
3+
[*]
4+
indent_size = 2
5+
end_of_line = lf
6+
insert_final_newline = true

.gitattributes

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
* text=auto eol=lf

.github/FUNDING.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
github: sxzz

.github/renovate.json5

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
extends: ['github>sxzz/renovate-config'],
3+
}

.github/workflows/release.yml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
name: Release
2+
3+
permissions:
4+
contents: write
5+
6+
on:
7+
push:
8+
tags:
9+
- 'v*'
10+
11+
jobs:
12+
release:
13+
runs-on: ubuntu-latest
14+
steps:
15+
- uses: actions/checkout@v4
16+
with:
17+
fetch-depth: 0
18+
19+
- name: Set node
20+
uses: actions/setup-node@v3
21+
with:
22+
node-version: lts/*
23+
24+
- run: npx changelogithub
25+
env:
26+
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}

.github/workflows/unit-test.yml

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
name: Unit Test
2+
3+
on:
4+
push:
5+
branches: [main]
6+
pull_request:
7+
branches: [main]
8+
9+
jobs:
10+
lint:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- uses: actions/checkout@v4
14+
- name: Set node
15+
uses: actions/setup-node@v3
16+
with:
17+
node-version: lts/*
18+
19+
- name: Setup
20+
run: npm i -g @antfu/ni
21+
22+
- name: Install
23+
run: nci
24+
25+
- name: Lint
26+
run: nr lint
27+
28+
test:
29+
runs-on: ${{ matrix.os }}
30+
31+
strategy:
32+
matrix:
33+
os: [ubuntu-latest, windows-latest]
34+
node: [16, 18]
35+
fail-fast: false
36+
37+
steps:
38+
- uses: actions/checkout@v4
39+
- name: Set node ${{ matrix.node }}
40+
uses: actions/setup-node@v3
41+
with:
42+
node-version: ${{ matrix.node }}
43+
44+
- name: Setup
45+
run: npm i -g @antfu/ni
46+
47+
- name: Install
48+
run: nci
49+
50+
- name: Build
51+
run: nr build
52+
53+
- name: Test
54+
run: nr test

.gitignore

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
node_modules
2+
.DS_Store
3+
dist
4+
*.log
5+
.vercel
6+
.eslintcache
7+
.vite-inspect

.vscode/settings.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"editor.formatOnSave": true,
3+
"eslint.experimental.useFlatConfig": true
4+
}

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
The MIT License (MIT)
2+
3+
Copyright © 2023-PRESENT zhiyuanzmj (https://github.com/zhiyuanzmj)
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

README.md

Lines changed: 150 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,150 @@
1+
# unplugin-vue-reactivity-function [![npm](https://img.shields.io/npm/v/unplugin-vue-reactivity-function.svg)](https://npmjs.com/package/unplugin-vue-reactivity-function)
2+
3+
[![Unit Test](https://github.com/unplugin/unplugin-vue-reactivity-function/actions/workflows/unit-test.yml/badge.svg)](https://github.com/unplugin/unplugin-vue-reactivity-function/actions/workflows/unit-test.yml)
4+
5+
Named export for Vue SFC.
6+
7+
## Installation
8+
9+
```bash
10+
npm i -D unplugin-vue-reactivity-function
11+
```
12+
13+
<details>
14+
<summary>Vite</summary><br>
15+
16+
```ts
17+
// vite.config.ts
18+
import VueReactivityFunction from 'unplugin-vue-reactivity-function/vite'
19+
20+
export default defineConfig({
21+
plugins: [VueReactivityFunction()],
22+
})
23+
```
24+
25+
<br></details>
26+
27+
<details>
28+
<summary>Rollup</summary><br>
29+
30+
```ts
31+
// rollup.config.js
32+
import VueReactivityFunction from 'unplugin-vue-reactivity-function/rollup'
33+
34+
export default {
35+
plugins: [VueReactivityFunction()],
36+
}
37+
```
38+
39+
<br></details>
40+
41+
<details>
42+
<summary>esbuild</summary><br>
43+
44+
```ts
45+
// esbuild.config.js
46+
import { build } from 'esbuild'
47+
48+
build({
49+
plugins: [require('unplugin-vue-reactivity-function/esbuild')()],
50+
})
51+
```
52+
53+
<br></details>
54+
55+
<details>
56+
<summary>Webpack</summary><br>
57+
58+
```ts
59+
// webpack.config.js
60+
module.exports = {
61+
/* ... */
62+
plugins: [require('unplugin-vue-reactivity-function/webpack')()],
63+
}
64+
```
65+
66+
<br></details>
67+
68+
<details>
69+
<summary>Vue CLI</summary><br>
70+
71+
```ts
72+
// vue.config.js
73+
module.exports = {
74+
configureWebpack: {
75+
plugins: [require('unplugin-vue-reactivity-function/webpack')()],
76+
},
77+
}
78+
```
79+
80+
<br></details>
81+
82+
## Usage
83+
84+
```vue
85+
<script setup lang="tsx">
86+
import { useBase64 } from '@vueuse/core'
87+
88+
function log(...logs: Ref<any>[]) {
89+
console.log(logs)
90+
}
91+
92+
const defaultText = $ref('vue')
93+
const text = $inject('text', defaultText)
94+
// is equivalent to:
95+
const text = $(inject('text', $$(defaultText)))
96+
97+
const { base64 } = $useBase64(text)
98+
// is equivalent to:
99+
const { base64 } = $(useBase64($$(text)))
100+
101+
$watch(base64, () => {
102+
$log(base64)
103+
})
104+
// is equivalent to:
105+
watch($$(base64), () => {
106+
log($$(base64))
107+
})
108+
109+
const stop = $$watch(base64, () => {
110+
$log(base64)
111+
})
112+
// is equivalent to:
113+
const stop = watch($$(base64), () => {
114+
log($$(base64))
115+
})
116+
stop()
117+
118+
$defineExpose({
119+
base64,
120+
})
121+
// is equivalent to:
122+
defineExpose({
123+
base64: $$(base64),
124+
})
125+
</script>
126+
```
127+
128+
### Volar
129+
130+
```jsonc
131+
// tsconfig.json
132+
{
133+
// ...
134+
"vueCompilerOptions": {
135+
"plugins": ["unplugin-vue-reactivity-function/volar"]
136+
}
137+
}
138+
```
139+
140+
## Sponsors
141+
142+
<p align="center">
143+
<a href="https://cdn.jsdelivr.net/gh/sxzz/sponsors/sponsors.svg">
144+
<img src='https://cdn.jsdelivr.net/gh/sxzz/sponsors/sponsors.svg'/>
145+
</a>
146+
</p>
147+
148+
## License
149+
150+
[MIT](./LICENSE) License © 2023-PRESENT [zhiyuanzmj](https://github.com/zhiyuanzmj)

0 commit comments

Comments
 (0)