Skip to content

Commit 3f58e68

Browse files
committed
feat: support unplugin
0 parents  commit 3f58e68

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

71 files changed

+8900
-0
lines changed

.eslintrc

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"extends": "@so1ve",
3+
"rules": {
4+
"@typescript-eslint/restrict-template-expressions": "off",
5+
"no-console": "off",
6+
"vue/component-api-style": "off",
7+
"vue/no-static-inline-styles": "off",
8+
"import/no-duplicates": "off",
9+
"unicorn/no-array-for-each": "off"
10+
}
11+
}

.github/pull.yml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
version: "1"
2+
rules:
3+
- base: main
4+
upstream: so1ve:main
5+
mergeMethod: hardreset
6+
assignees:
7+
- so1ve
8+
reviewers:
9+
- so1ve
10+
conflictReviewers:
11+
- so1ve

.github/workflows/ci.yml

Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
8+
pull_request:
9+
branches:
10+
- main
11+
12+
jobs:
13+
lint:
14+
runs-on: ubuntu-latest
15+
steps:
16+
- uses: actions/checkout@v3
17+
18+
- name: Install pnpm
19+
uses: pnpm/action-setup@v2.2.4
20+
21+
- name: Set node
22+
uses: actions/setup-node@v3
23+
with:
24+
node-version: 18.x
25+
cache: pnpm
26+
27+
- name: Setup
28+
run: npm i -g @antfu/ni
29+
30+
- name: Install
31+
run: nci
32+
33+
- name: Lint
34+
run: nr lint
35+
36+
typecheck:
37+
runs-on: ubuntu-latest
38+
steps:
39+
- uses: actions/checkout@v3
40+
41+
- name: Install pnpm
42+
uses: pnpm/action-setup@v2.2.4
43+
44+
- name: Set node
45+
uses: actions/setup-node@v3
46+
with:
47+
node-version: 18.x
48+
cache: pnpm
49+
50+
- name: Setup
51+
run: npm i -g @antfu/ni
52+
53+
- name: Install
54+
run: nci
55+
56+
- name: Typecheck
57+
run: nr typecheck
58+
59+
test:
60+
runs-on: ${{ matrix.os }}
61+
62+
strategy:
63+
matrix:
64+
node: [16.x, 18.x]
65+
os: [ubuntu-latest, windows-latest, macos-latest]
66+
fail-fast: false
67+
68+
steps:
69+
- uses: actions/checkout@v3
70+
71+
- name: Install pnpm
72+
uses: pnpm/action-setup@v2.2.4
73+
74+
- name: Set node version to ${{ matrix.node }}
75+
uses: actions/setup-node@v3
76+
with:
77+
node-version: ${{ matrix.node }}
78+
cache: pnpm
79+
80+
- name: Setup
81+
run: npm i -g @antfu/ni
82+
83+
- name: Install
84+
run: nci
85+
86+
- name: Build
87+
run: nr build
88+
89+
- name: Test
90+
run: nr test

.github/workflows/release.yml

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

.gitignore

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
.cache
2+
.DS_Store
3+
.idea
4+
*.log
5+
*.tgz
6+
coverage
7+
dist
8+
lib-cov
9+
logs
10+
node_modules
11+
temp

.npmrc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
shamefully-hoist=true
2+
ignore-workspace-root-check=true

.vscode/extensions.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"recommendations": [
3+
"dbaeumer.vscode-eslint"
4+
]
5+
}

.vscode/settings.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"typescript.tsdk": "node_modules/typescript/lib",
3+
"editor.codeActionsOnSave": {
4+
"source.fixAll.eslint": true
5+
}
6+
}

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2022 Ray <https://github.com/so1ve>
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: 154 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,154 @@
1+
# unplugin-vue2
2+
3+
[![NPM version](https://img.shields.io/npm/v/unplugin-vue2?color=a1b858&label=)](https://www.npmjs.com/package/unplugin-vue2)
4+
5+
## 💎 Features
6+
7+
- ⚡️ Supports Vite, Webpack, Vue CLI, Rollup, esbuild and more, powered by unplugin.
8+
9+
## 📦 Installation
10+
11+
```bash
12+
$ npm install unplugin-vue2 -D
13+
$ yarn add unplugin-vue2 -D
14+
$ pnpm add unplugin-vue2 -D
15+
```
16+
17+
## 🚀 Usage
18+
19+
<details>
20+
<summary>Vite</summary><br>
21+
22+
```ts
23+
// vite.config.ts
24+
import UnpluginVue2 from "unplugin-vue2/vite";
25+
26+
export default defineConfig({
27+
plugins: [
28+
UnpluginVue2({/* options */}),
29+
],
30+
});
31+
```
32+
33+
<br></details>
34+
35+
<details>
36+
<summary>Rollup</summary><br>
37+
38+
```ts
39+
// rollup.config.js
40+
import UnpluginVue2 from "unplugin-vue2/rollup";
41+
42+
export default {
43+
plugins: [
44+
UnpluginVue2({/* options */}),
45+
// other plugins
46+
],
47+
};
48+
```
49+
50+
<br></details>
51+
52+
53+
<details>
54+
<summary>Webpack</summary><br>
55+
56+
```ts
57+
// webpack.config.js
58+
module.exports = {
59+
/* ... */
60+
plugins: [
61+
require("unplugin-vue2/webpack")({/* options */}),
62+
],
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: [
76+
require("unplugin-vue2/webpack")({/* options */}),
77+
],
78+
},
79+
};
80+
```
81+
82+
<br></details>
83+
84+
<details>
85+
<summary>Quasar</summary><br>
86+
87+
```ts
88+
// quasar.conf.js [Vite]
89+
module.exports = {
90+
vitePlugins: [
91+
["unplugin-vue2/vite", {/* options */}],
92+
],
93+
};
94+
```
95+
96+
```ts
97+
// quasar.conf.js [Webpack]
98+
const UnpluginVue2Plugin = require("unplugin-vue2/webpack");
99+
module.exports = {
100+
build: {
101+
chainWebpack(chain) {
102+
chain.plugin("unplugin-vue2").use(
103+
UnpluginVue2Plugin({/* options */}),
104+
);
105+
},
106+
},
107+
};
108+
```
109+
110+
<br></details>
111+
112+
<details>
113+
<summary>esbuild</summary><br>
114+
115+
```ts
116+
// esbuild.config.js
117+
import { build } from "esbuild";
118+
119+
build({
120+
/* ... */
121+
plugins: [
122+
require("unplugin-vue2/esbuild")({
123+
/* options */
124+
}),
125+
],
126+
});
127+
```
128+
129+
<br></details>
130+
131+
## 👍 Alternatives
132+
133+
- [@vitejs/plugin-vue](https://github.com/vitejs/vite-plugin-vue/tree/main/packages/plugin-vue) - For Vite and Vue 3.
134+
- [@vitejs/plugin-vue2](https://github.com/vitejs/vite-plugin-vue2) - For Vite and Vue 2.
135+
- ~~[vite-plugin-vue2](https://github.com/underfin/vite-plugin-vue2) - For Vite and Vue 2.~~
136+
- ~~[rollup-plugin-vue](https://github.com/vuejs/rollup-plugin-vue)~~ - ⚠️ no longer maintained.
137+
- [unplugin-vue](https://github.com/sxzz/unplugin-vue) - For Vue3.
138+
- [vue-loader](https://github.com/vuejs/vue-loader) - For Webpack.
139+
- [esbuild-plugin-vue](https://github.com/egoist/esbuild-plugin-vue) - For esbuild and Vue 3.
140+
- [esbuild-vue](https://github.com/apeschar/esbuild-vue) - For esbuild and Vue 2.
141+
142+
## 📚 Credits
143+
144+
- [Vite](https://github.com/vitejs/vite) - Next generation frontend tooling. It's fast!
145+
- [unplugin](https://github.com/unjs/unplugin) - Unified plugin system for Vite, Rollup, Webpack, and more
146+
147+
## 🙇‍ Thanks
148+
149+
Thanks to [Vite](https://github.com/vitejs/vite). This project is inherited from [@vitejs/plugin-vue2@2.2.0](https://github.com/vitejs/vite-plugin-vue2/tree/v2.2.0).
150+
Thanks to [unplugin-vue](https://github.com/sxzz/unplugin-vue) for this idea (porting @vitejs/plugin-vue2 to unplugin).
151+
152+
## 📝 License
153+
154+
[MIT](./LICENSE). Made with ❤️ by [Ray](https://github.com/so1ve)

0 commit comments

Comments
 (0)