Skip to content

Commit e5c4f66

Browse files
committed
feat: export all apis
1 parent c3190f1 commit e5c4f66

File tree

27 files changed

+72
-33
lines changed

27 files changed

+72
-33
lines changed

.changeset/tender-planes-smash.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
---
2+
'@vue-macros/reactivity-transform': minor
3+
'@vue-macros/define-props-refs': minor
4+
'@vue-macros/setup-component': minor
5+
'unplugin-vue-define-options': minor
6+
'@vue-macros/named-template': minor
7+
'@vue-macros/better-define': minor
8+
'@vue-macros/define-render': minor
9+
'@vue-macros/single-define': minor
10+
'@vue-macros/define-model': minor
11+
'@vue-macros/define-props': minor
12+
'@vue-macros/define-slots': minor
13+
'@vue-macros/export-props': minor
14+
'@vue-macros/hoist-static': minor
15+
'@vue-macros/short-vmodel': minor
16+
'@vue-macros/setup-block': minor
17+
'@vue-macros/short-emits': minor
18+
'@vue-macros/setup-sfc': minor
19+
---
20+
21+
export all apis

packages/better-define/src/api.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export * from './core'

packages/define-model/src/api.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export * from './core'

packages/define-model/src/core/index.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@ import type {
2828
VariableDeclaration,
2929
} from '@babel/types'
3030

31+
export * from './helper'
32+
3133
export function transformDefineModel(
3234
code: string,
3335
id: string,

packages/define-model/src/index.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
import { createUnplugin } from 'unplugin'
22
import {
3-
BaseOptions,
4-
MarkRequired,
53
REGEX_SETUP_SFC,
64
REGEX_VUE_SFC,
75
REGEX_VUE_SUB,
@@ -17,6 +15,7 @@ import {
1715
useVmodelHelperCode,
1816
useVmodelHelperId,
1917
} from './core/helper'
18+
import type { BaseOptions, MarkRequired } from '@vue-macros/common'
2019
import type { UnpluginContextMeta } from 'unplugin'
2120

2221
export interface Options extends BaseOptions {

packages/define-options/src/api.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export * from './core'

packages/define-options/src/core/transform.ts

Lines changed: 20 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import {
1010
} from '@vue-macros/common'
1111
import { walkAST } from 'ast-walker-scope'
1212
import { filterMacro, hasPropsOrEmits } from './utils'
13-
import type { ExportDefaultDeclaration, Statement } from '@babel/types'
13+
import type { ExportDefaultDeclaration, Program, Statement } from '@babel/types'
1414

1515
export function transformDefineOptions(code: string, id: string) {
1616
if (!code.includes(DEFINE_OPTIONS)) return
@@ -70,7 +70,7 @@ export function transformDefineOptions(code: string, id: string) {
7070
return getTransformResult(s, id)
7171
}
7272

73-
const checkDefaultExport = (stmts: Statement[]) => {
73+
export const checkDefaultExport = (stmts: Statement[]) => {
7474
const hasDefaultExport = stmts.some(
7575
(node): node is ExportDefaultDeclaration =>
7676
node.type === 'ExportDefaultDeclaration'
@@ -81,28 +81,26 @@ const checkDefaultExport = (stmts: Statement[]) => {
8181
)
8282
}
8383

84-
const getIdentifiers = (stmts: Statement[]) => {
84+
export const getIdentifiers = (stmts: Statement[]) => {
8585
let ids: string[] = []
86-
walkAST(
87-
{
88-
type: 'Program',
89-
body: stmts,
90-
directives: [],
91-
sourceType: 'module',
92-
sourceFile: '',
86+
const program: Program = {
87+
type: 'Program',
88+
body: stmts,
89+
directives: [],
90+
sourceType: 'module',
91+
sourceFile: '',
92+
}
93+
walkAST(program, {
94+
enter(node) {
95+
if (node.type === 'BlockStatement') {
96+
this.skip()
97+
}
9398
},
94-
{
95-
enter(node) {
96-
if (node.type === 'BlockStatement') {
97-
this.skip()
98-
}
99-
},
100-
leave(node) {
101-
if (node.type !== 'Program') return
102-
ids = Object.keys(this.scope)
103-
},
104-
}
105-
)
99+
leave(node) {
100+
if (node.type !== 'Program') return
101+
ids = Object.keys(this.scope)
102+
},
103+
})
106104

107105
return ids
108106
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export * from './core'

packages/define-props/src/api.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export * from './core'

packages/define-render/src/api.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export * from './core'

0 commit comments

Comments
 (0)