Skip to content

Commit 8aece10

Browse files
committed
chore: init vapor
1 parent 5edc1a5 commit 8aece10

Some content is hidden

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

45 files changed

+6874
-5319
lines changed

.vscode/launch.json

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
{
2+
// Use IntelliSense to learn about possible attributes.
3+
// Hover to view descriptions of existing attributes.
4+
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
5+
"version": "0.2.0",
6+
"configurations": [
7+
{
8+
"type": "node",
9+
"request": "launch",
10+
"name": "Vitest - Debug Current Test File",
11+
"autoAttachChildProcesses": true,
12+
"skipFiles": ["<node_internals>/**", "**/node_modules/**"],
13+
"program": "${workspaceRoot}/node_modules/vitest/vitest.mjs",
14+
"args": ["run", "${relativeFile}"],
15+
"smartStep": true,
16+
"console": "integratedTerminal"
17+
}
18+
]
19+
}

README.md

+6-35
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
[![NPM version](https://img.shields.io/npm/v/unplugin-vue-jsx-vapor?color=a1b858&label=)](https://www.npmjs.com/package/unplugin-vue-jsx-vapor)
44

5-
Convert JSX to Template for compiler-vapor.
5+
Convert JSX to Vapor.
66

77
## Install
88

@@ -16,15 +16,10 @@ npm i unplugin-vue-jsx-vapor
1616
```ts
1717
// vite.config.ts
1818
import VueJsxVapor from 'unplugin-vue-jsx-vapor/vite'
19-
import { compile } from 'vue/vapor'
20-
// or
21-
// import { compile } from '@vue/compiler-dom'
2219

2320
export default defineConfig({
2421
plugins: [
25-
VueJsxVapor({
26-
compile
27-
}),
22+
VueJsxVapor(),
2823
],
2924
})
3025
```
@@ -39,15 +34,10 @@ Example: [`playground/`](./playground/)
3934
```ts
4035
// rollup.config.js
4136
import VueJsxVapor from 'unplugin-vue-jsx-vapor/rollup'
42-
import { compile } from 'vue/vapor'
43-
// or
44-
// import { compile } from '@vue/compiler-dom'
4537

4638
export default {
4739
plugins: [
48-
VueJsxVapor({
49-
compile
50-
}),
40+
VueJsxVapor(),
5141
],
5242
}
5343
```
@@ -62,11 +52,7 @@ export default {
6252
module.exports = {
6353
/* ... */
6454
plugins: [
65-
require('unplugin-vue-jsx-vapor/webpack')({
66-
compile: require('vue/vapor')
67-
// or
68-
// compile: require('@vue/compiler-dom')
69-
}),
55+
require('unplugin-vue-jsx-vapor/webpack')(),
7056
],
7157
}
7258
```
@@ -78,16 +64,10 @@ module.exports = {
7864

7965
```ts
8066
// nuxt.config.js
81-
import { compile } from 'vue/vapor'
82-
// or
83-
// import { compile } from '@vue/compiler-dom'
8467
export default defineNuxtConfig({
8568
modules: [
8669
[
8770
'unplugin-vue-jsx-vapor/nuxt',
88-
{
89-
compile
90-
},
9171
],
9272
],
9373
})
@@ -105,11 +85,7 @@ export default defineNuxtConfig({
10585
module.exports = {
10686
configureWebpack: {
10787
plugins: [
108-
require('unplugin-vue-jsx-vapor/webpack')({
109-
compile: require('vue/vapor')
110-
// or
111-
// compile: require('@vue/compiler-dom')
112-
}),
88+
require('unplugin-vue-jsx-vapor/webpack')(),
11389
],
11490
},
11591
}
@@ -124,15 +100,10 @@ module.exports = {
124100
// esbuild.config.js
125101
import { build } from 'esbuild'
126102
import VueJsxVapor from 'unplugin-vue-jsx-vapor/esbuild'
127-
import { compile } from 'vue/vapor'
128-
// or
129-
// import { compile } from '@vue/compiler-dom'
130103

131104
build({
132105
plugins: [
133-
VueJsxVapor({
134-
compile
135-
})
106+
VueJsxVapor()
136107
],
137108
})
138109
```

eslint.config.js

+5-13
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,10 @@
1-
import antfu from '@antfu/eslint-config'
1+
import { sxzz } from '@sxzz/eslint-config'
22

3-
export default antfu({
3+
export default sxzz({
44
ignores: ['playground'],
55
rules: {
6-
'curly': 'off',
7-
'style/object-property-newline': 'off',
8-
'style/jsx-max-props-per-line': 'off',
9-
'style/jsx-curly-newline': 'off',
10-
'style/jsx-self-closing-comp': 'error',
11-
'style/jsx-one-expression-per-line': [
12-
'error',
13-
{
14-
allow: 'literal',
15-
},
16-
],
6+
'unicorn/filename-case': 'off',
7+
'import/no-default-export': 'off',
8+
'unused-imports/no-unused-vars': 'warn',
179
},
1810
})

package.json

+58-55
Original file line numberDiff line numberDiff line change
@@ -1,76 +1,79 @@
11
{
22
"name": "unplugin-vue-jsx-vapor",
3-
"type": "module",
43
"version": "0.1.20",
54
"packageManager": "[email protected]",
6-
"description": "Convert JSX to Template for compiler-vapor",
7-
"license": "MIT",
8-
"homepage": "https://github.com/zhiyuanzmj/unplugin-vue-jsx-vapor#readme",
9-
"repository": {
10-
"type": "git",
11-
"url": "git+https://github.com/zhiyuanzmj/unplugin-vue-jsx-vapor.git"
12-
},
13-
"bugs": {
14-
"url": "https://github.com/zhiyuanzmj/unplugin-vue-jsx-vapor/issues"
15-
},
5+
"description": "Convert JSX to Vapor",
6+
"type": "module",
167
"keywords": [
178
"unplugin",
189
"vite",
1910
"webpack",
2011
"rollup",
2112
"transform"
2213
],
14+
"license": "MIT",
15+
"homepage": "https://github.com/zhiyuanzmj/unplugin-vue-jsx-vapor#readme",
16+
"bugs": {
17+
"url": "https://github.com/zhiyuanzmj/unplugin-vue-jsx-vapor/issues"
18+
},
19+
"repository": {
20+
"type": "git",
21+
"url": "git+https://github.com/zhiyuanzmj/unplugin-vue-jsx-vapor.git"
22+
},
23+
"files": [
24+
"dist"
25+
],
26+
"main": "dist/index.cjs",
27+
"module": "dist/index.js",
28+
"types": "dist/index.d.ts",
2329
"exports": {
2430
".": {
2531
"types": "./dist/index.d.ts",
26-
"import": "./dist/index.js",
27-
"require": "./dist/index.cjs"
32+
"require": "./dist/index.cjs",
33+
"import": "./dist/index.js"
2834
},
2935
"./astro": {
3036
"types": "./dist/astro.d.ts",
31-
"import": "./dist/astro.js",
32-
"require": "./dist/astro.cjs"
37+
"require": "./dist/astro.cjs",
38+
"import": "./dist/astro.js"
3339
},
3440
"./rspack": {
3541
"types": "./dist/rspack.d.ts",
36-
"import": "./dist/rspack.js",
37-
"require": "./dist/rspack.cjs"
42+
"require": "./dist/rspack.cjs",
43+
"import": "./dist/rspack.js"
3844
},
3945
"./vite": {
4046
"types": "./dist/vite.d.ts",
41-
"import": "./dist/vite.js",
42-
"require": "./dist/vite.cjs"
47+
"require": "./dist/vite.cjs",
48+
"import": "./dist/vite.js"
4349
},
4450
"./webpack": {
4551
"types": "./dist/webpack.d.ts",
46-
"import": "./dist/webpack.js",
47-
"require": "./dist/webpack.cjs"
52+
"require": "./dist/webpack.cjs",
53+
"import": "./dist/webpack.js"
4854
},
4955
"./rollup": {
5056
"types": "./dist/rollup.d.ts",
51-
"import": "./dist/rollup.js",
52-
"require": "./dist/rollup.cjs"
57+
"require": "./dist/rollup.cjs",
58+
"import": "./dist/rollup.js"
5359
},
5460
"./esbuild": {
5561
"types": "./dist/esbuild.d.ts",
56-
"import": "./dist/esbuild.js",
57-
"require": "./dist/esbuild.cjs"
62+
"require": "./dist/esbuild.cjs",
63+
"import": "./dist/esbuild.js"
5864
},
5965
"./nuxt": {
6066
"types": "./dist/nuxt.d.ts",
61-
"import": "./dist/nuxt.js",
62-
"require": "./dist/nuxt.cjs"
67+
"require": "./dist/nuxt.cjs",
68+
"import": "./dist/nuxt.js"
6369
},
6470
"./types": {
6571
"types": "./dist/types.d.ts",
66-
"import": "./dist/types.js",
67-
"require": "./dist/types.cjs"
72+
"require": "./dist/types.cjs",
73+
"import": "./dist/types.js"
6874
},
6975
"./*": "./*"
7076
},
71-
"main": "dist/index.cjs",
72-
"module": "dist/index.js",
73-
"types": "dist/index.d.ts",
7477
"typesVersions": {
7578
"*": {
7679
"*": [
@@ -79,16 +82,12 @@
7982
]
8083
}
8184
},
82-
"files": [
83-
"dist"
84-
],
8585
"scripts": {
8686
"build": "tsup",
8787
"dev": "tsup --watch src",
8888
"build:fix": "esno scripts/postbuild.ts",
8989
"lint": "eslint .",
90-
"play": "npm -C playground/virtual-dom run dev",
91-
"play:vapor": "npm -C playground/vapor run dev",
90+
"play": "npm -C playground run dev",
9291
"prepublishOnly": "npm run build",
9392
"release": "bumpp && npm publish",
9493
"start": "esno src/index.ts",
@@ -123,29 +122,33 @@
123122
}
124123
},
125124
"dependencies": {
126-
"@vue-macros/common": "^1.10.0",
127-
"html-tags": "^3.3.1",
125+
"@vue-macros/common": "^1.10.4",
126+
"@vue-vapor/compiler-vapor": "3.2024.0-63dbc26",
127+
"@vue-vapor/vue": "3.2024.0-63dbc26",
128+
"html-tags": "^4.0.0",
128129
"svg-tags": "^1.0.0",
129-
"unplugin": "^1.5.1"
130+
"unplugin": "^1.10.1"
130131
},
131132
"devDependencies": {
132-
"@antfu/eslint-config": "^2.6.2",
133-
"@nuxt/kit": "^3.8.2",
134-
"@nuxt/schema": "^3.8.2",
135-
"@types/node": "^20.10.3",
133+
"@antfu/eslint-config": "^2.21.1",
134+
"@babel/types": "^7.24.7",
135+
"@nuxt/kit": "^3.12.2",
136+
"@nuxt/schema": "^3.12.2",
137+
"@sxzz/eslint-config": "^3.13.0",
138+
"@types/node": "^20.14.9",
136139
"@types/svg-tags": "^1.0.2",
137-
"bumpp": "^9.2.0",
140+
"bumpp": "^9.4.1",
138141
"chalk": "^5.3.0",
139-
"eslint": "^8.55.0",
140-
"esno": "^4.0.0",
142+
"eslint": "^9.5.0",
143+
"esno": "^4.7.0",
141144
"fast-glob": "^3.3.2",
142-
"nodemon": "^3.0.2",
143-
"rimraf": "^5.0.5",
144-
"rollup": "^4.6.1",
145-
"tsup": "^8.0.1",
146-
"typescript": "^5.3.2",
147-
"vite": "^4.5.1",
148-
"vitest": "^0.34.6",
149-
"webpack": "^5.89.0"
145+
"nodemon": "^3.1.4",
146+
"rimraf": "^5.0.7",
147+
"rollup": "^4.18.0",
148+
"tsup": "^8.1.0",
149+
"typescript": "^5.5.2",
150+
"vite": "^5.3.1",
151+
"vitest": "^1.6.0",
152+
"webpack": "^5.92.1"
150153
}
151154
}

playground/App.vue

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
<script lang="tsx">
2+
import { defineComponent, ref } from 'vue'
3+
4+
export default defineComponent({
5+
setup() {
6+
const count = ref(0)
7+
setInterval(() => {
8+
count.value++
9+
}, 1000)
10+
11+
const Count = () => <div>{count.value * 2}</div>
12+
13+
return (
14+
<>
15+
<Count />
16+
</>
17+
)
18+
},
19+
})
20+
</script>

playground/Count.vue

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
<template>Count</template>
File renamed without changes.

playground/main.ts

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
import { createVaporApp } from 'vue/vapor'
2+
3+
const modules = import.meta.glob<any>('./**/*.(vue|js)')
4+
const mod = (modules[`.${location.pathname}`] || modules['./App.vue'])()
5+
6+
mod.then(({ default: mod }) => {
7+
const app = createVaporApp(mod)
8+
app.mount('#app')
9+
10+
// @ts-expect-error
11+
globalThis.unmount = () => {
12+
app.unmount()
13+
}
14+
})

playground/package.json

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
{
2+
"private": true,
3+
"type": "module",
4+
"scripts": {
5+
"dev": "nodemon -w '../../src/**/*.ts' -e .ts -x vite --port 5174"
6+
},
7+
"dependencies": {
8+
"@vue-macros/define-render": "^1.5.5",
9+
"vite-plugin-vue-devtools": "^7.3.4",
10+
"vue": "npm:@vue-vapor/[email protected]"
11+
},
12+
"devDependencies": {
13+
"@vitejs/plugin-vue": "^5.0.5",
14+
"@vue-macros/volar": "^0.23.0",
15+
"unplugin-vue-jsx-vapor": "workspace:*",
16+
"vite": "^5.3.1",
17+
"vite-plugin-inspect": "^0.8.4"
18+
}
19+
}
File renamed without changes.

0 commit comments

Comments
 (0)