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 1111 " rollup" ,
1212 " transform" ,
1313 " vue-jsx" ,
14- " volar"
14+ " volar" ,
15+ " vapor"
1516 ],
1617 "license" : " MIT" ,
1718 "homepage" : " https://github.com/unplugin/unplugin-vue-jsx-vapor#readme" ,
2526 "files" : [
2627 " dist"
2728 ],
29+ "main" : " dist/index.cjs" ,
30+ "module" : " dist/index.js" ,
31+ "types" : " dist/index.d.ts" ,
2832 "exports" : {
2933 "." : {
3034 "dev" : " ./src/index.ts" ,
182186 "@vue-jsx-vapor/compiler" : " workspace:*" ,
183187 "@vue-macros/volar" : " 3.0.0-beta.4" ,
184188 "magic-string-stack" : " ^0.1.1" ,
189+ "ts-macro" : " 0.1.19" ,
185190 "unplugin" : " ^1.11.0" ,
186191 "unplugin-utils" : " ^0.2.4"
187192 },
195200 "unplugin-raw" : " ^0.3.1" ,
196201 "vite" : " ^6.0.0" ,
197202 "vitest" : " ^1.6.0" ,
203+ "vue" : " catalog:" ,
198204 "webpack" : " ^5.92.1"
199205 }
200206}
Original file line number Diff line number Diff line change 1- import unplugin from '.'
1+ import unplugin from './core/unplugin '
22import type { Options } from './types'
33
44export 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 11import { createEsbuildPlugin } from 'unplugin'
2- import { unpluginFactory } from '.'
2+ import { unpluginFactory } from './core/unplugin '
33
44export 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 11import { createRollupPlugin } from 'unplugin'
2- import { unpluginFactory } from '.'
2+ import { unpluginFactory } from './core/unplugin '
33
44export default createRollupPlugin ( unpluginFactory )
Original file line number Diff line number Diff line change 11import { createRspackPlugin } from 'unplugin'
2- import { unpluginFactory } from '.'
2+ import { unpluginFactory } from './core/unplugin '
33
44export default createRspackPlugin ( unpluginFactory )
Original file line number Diff line number Diff line change @@ -7,4 +7,9 @@ export interface Options {
77 exclude ?: FilterPattern
88 interop ?: boolean
99 compile ?: CompilerOptions
10+ ref ?:
11+ | {
12+ alias ?: string [ ]
13+ }
14+ | boolean
1015}
Original file line number Diff line number Diff line change 11import { createVitePlugin } from 'unplugin'
2- import { unpluginFactory } from '.'
2+ import { unpluginFactory } from './core/unplugin '
33
44export 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+
217export default plugin
You can’t perform that action at this time.
0 commit comments