File tree Expand file tree Collapse file tree 14 files changed +111
-126
lines changed Expand file tree Collapse file tree 14 files changed +111
-126
lines changed Original file line number Diff line number Diff line change 11
11
" rollup" ,
12
12
" transform" ,
13
13
" vue-jsx" ,
14
- " volar"
14
+ " volar" ,
15
+ " vapor"
15
16
],
16
17
"license" : " MIT" ,
17
18
"homepage" : " https://github.com/unplugin/unplugin-vue-jsx-vapor#readme" ,
25
26
"files" : [
26
27
" dist"
27
28
],
29
+ "main" : " dist/index.cjs" ,
30
+ "module" : " dist/index.js" ,
31
+ "types" : " dist/index.d.ts" ,
28
32
"exports" : {
29
33
"." : {
30
34
"dev" : " ./src/index.ts" ,
182
186
"@vue-jsx-vapor/compiler" : " workspace:*" ,
183
187
"@vue-macros/volar" : " 3.0.0-beta.4" ,
184
188
"magic-string-stack" : " ^0.1.1" ,
189
+ "ts-macro" : " 0.1.19" ,
185
190
"unplugin" : " ^1.11.0" ,
186
191
"unplugin-utils" : " ^0.2.4"
187
192
},
195
200
"unplugin-raw" : " ^0.3.1" ,
196
201
"vite" : " ^6.0.0" ,
197
202
"vitest" : " ^1.6.0" ,
203
+ "vue" : " catalog:" ,
198
204
"webpack" : " ^5.92.1"
199
205
}
200
206
}
Original file line number Diff line number Diff line change 1
- import unplugin from '.'
1
+ import unplugin from './core/unplugin '
2
2
import type { Options } from './types'
3
3
4
4
export default ( options : Options ) => ( {
Original file line number Diff line number Diff line change
1
+ import { type UnpluginFactory , createUnplugin } from 'unplugin'
2
+ import { createFilter , transformWithEsbuild } from 'vite'
3
+ import { plugin } from './plugin'
4
+ import type { Options } from '../types'
5
+
6
+ export const unpluginFactory : UnpluginFactory < Options | undefined > = (
7
+ options = { } ,
8
+ meta ,
9
+ ) => {
10
+ return [
11
+ plugin ( options , meta ) ,
12
+ options . interop
13
+ ? { name : 'interop' }
14
+ : {
15
+ name : 'unplugin-esbuild' ,
16
+ transformInclude : createFilter (
17
+ options ?. include || / \. [ j t ] s x $ / ,
18
+ options ?. exclude ,
19
+ ) ,
20
+ transform ( code , id ) {
21
+ return transformWithEsbuild ( code , id , {
22
+ target : 'esnext' ,
23
+ charset : 'utf8' ,
24
+ minify : false ,
25
+ minifyIdentifiers : false ,
26
+ minifySyntax : false ,
27
+ minifyWhitespace : false ,
28
+ treeShaking : false ,
29
+ keepNames : false ,
30
+ supported : {
31
+ 'dynamic-import' : true ,
32
+ 'import-meta' : true ,
33
+ } ,
34
+ } )
35
+ } ,
36
+ } ,
37
+ ]
38
+ }
39
+
40
+ export const unplugin = /* #__PURE__ */ createUnplugin ( unpluginFactory )
41
+
42
+ export default unplugin
Original file line number Diff line number Diff line change 1
1
import { createEsbuildPlugin } from 'unplugin'
2
- import { unpluginFactory } from '.'
2
+ import { unpluginFactory } from './core/unplugin '
3
3
4
4
export default createEsbuildPlugin ( unpluginFactory )
Original file line number Diff line number Diff line change 1
- import { type UnpluginFactory , createUnplugin } from 'unplugin'
2
- import { createFilter , transformWithEsbuild } from 'vite'
3
- import { plugin } from './core/plugin'
4
- import type { Options } from './types'
5
-
6
- export const unpluginFactory : UnpluginFactory < Options | undefined > = (
7
- options = { } ,
8
- meta ,
9
- ) => {
10
- return [
11
- plugin ( options , meta ) ,
12
- options . interop
13
- ? { name : 'interop' }
14
- : {
15
- name : 'unplugin-esbuild' ,
16
- transformInclude : createFilter (
17
- options ?. include || / \. [ j t ] s x $ / ,
18
- options ?. exclude ,
19
- ) ,
20
- transform ( code , id ) {
21
- return transformWithEsbuild ( code , id , {
22
- target : 'esnext' ,
23
- charset : 'utf8' ,
24
- minify : false ,
25
- minifyIdentifiers : false ,
26
- minifySyntax : false ,
27
- minifyWhitespace : false ,
28
- treeShaking : false ,
29
- keepNames : false ,
30
- supported : {
31
- 'dynamic-import' : true ,
32
- 'import-meta' : true ,
33
- } ,
34
- } )
35
- } ,
36
- } ,
37
- ]
38
- }
39
-
40
- export const unplugin = /* #__PURE__ */ createUnplugin ( unpluginFactory )
41
-
42
- export default unplugin
1
+ export { shallowRef as useRef } from 'vue'
Original file line number Diff line number Diff line change 1
1
import { createRollupPlugin } from 'unplugin'
2
- import { unpluginFactory } from '.'
2
+ import { unpluginFactory } from './core/unplugin '
3
3
4
4
export default createRollupPlugin ( unpluginFactory )
Original file line number Diff line number Diff line change 1
1
import { createRspackPlugin } from 'unplugin'
2
- import { unpluginFactory } from '.'
2
+ import { unpluginFactory } from './core/unplugin '
3
3
4
4
export default createRspackPlugin ( unpluginFactory )
Original file line number Diff line number Diff line change @@ -7,4 +7,9 @@ export interface Options {
7
7
exclude ?: FilterPattern
8
8
interop ?: boolean
9
9
compile ?: CompilerOptions
10
+ ref ?:
11
+ | {
12
+ alias ?: string [ ]
13
+ }
14
+ | boolean
10
15
}
Original file line number Diff line number Diff line change 1
1
import { createVitePlugin } from 'unplugin'
2
- import { unpluginFactory } from '.'
2
+ import { unpluginFactory } from './core/unplugin '
3
3
4
4
export default createVitePlugin ( unpluginFactory )
Original file line number Diff line number Diff line change 1
- import plugin from '@vue-macros/volar/jsx-directive'
1
+ import jsxDirective from '@vue-macros/volar/jsx-directive'
2
+ import jsxRef from '@vue-macros/volar/jsx-ref'
3
+ import { type PluginReturn , createPlugin } from 'ts-macro'
4
+ import type { Options } from './types'
5
+
6
+ const plugin : PluginReturn < Options | undefined , true > = createPlugin (
7
+ ( ctx , options ) => {
8
+ return [
9
+ jsxDirective ( ) ( ctx ) ,
10
+ options ?. ref === false
11
+ ? [ ]
12
+ : jsxRef ( options ?. ref === true ? undefined : options ?. ref ) ( ctx ) ,
13
+ ] . flat ( )
14
+ } ,
15
+ )
16
+
2
17
export default plugin
Original file line number Diff line number Diff line change 1
1
import { createWebpackPlugin } from 'unplugin'
2
- import { unpluginFactory } from '.'
2
+ import { unpluginFactory } from './core/unplugin '
3
3
4
4
export default createWebpackPlugin ( unpluginFactory )
Original file line number Diff line number Diff line change @@ -9,6 +9,7 @@ export default {
9
9
watch : ! ! process . env . DEV ,
10
10
dts : ! process . env . DEV ,
11
11
cjsInterop : true ,
12
+ external : [ 'vue' ] ,
12
13
onSuccess : 'npm run build:fix' ,
13
14
define : {
14
15
__DEV__ : 'true' ,
Original file line number Diff line number Diff line change 1
1
import { type Ref , ref } from 'vue'
2
+ import { useRef } from 'unplugin-vue-jsx-vapor'
2
3
import Count2 from './count'
3
4
import If from './if'
4
5
import For from './for'
@@ -19,11 +20,14 @@ export default () => {
19
20
return < div > { value . value } </ div >
20
21
}
21
22
23
+ const inputRef = useRef ( )
24
+
22
25
return (
23
26
< >
24
27
< fieldset >
25
28
< legend > Component</ legend >
26
29
< input
30
+ ref = { inputRef }
27
31
value_prop = { count . value }
28
32
onInput = { ( e ) => ( count . value = e . target . value ) }
29
33
/>
You can’t perform that action at this time.
0 commit comments