mirror of
https://github.com/vuejs/babel-plugin-jsx.git
synced 2025-08-13 18:53:19 +08:00
chore: emit dts by oxc
This commit is contained in:
@ -40,8 +40,14 @@ function interopDefault(m: any) {
|
||||
const syntaxJsx = /*#__PURE__*/ interopDefault(_syntaxJsx);
|
||||
const template = /*#__PURE__*/ interopDefault(_template);
|
||||
|
||||
export default declare<VueJSXPluginOptions, BabelCore.PluginObj<State>>(
|
||||
(api, opt, dirname) => {
|
||||
const plugin: (
|
||||
api: object,
|
||||
options: VueJSXPluginOptions | null | undefined,
|
||||
dirname: string
|
||||
) => BabelCore.PluginObj<State> = declare<
|
||||
VueJSXPluginOptions,
|
||||
BabelCore.PluginObj<State>
|
||||
>((api, opt, dirname) => {
|
||||
const { types } = api;
|
||||
let resolveType: BabelCore.PluginObj<BabelCore.PluginPass> | undefined;
|
||||
if (opt.resolveType) {
|
||||
@ -194,5 +200,6 @@ export default declare<VueJSXPluginOptions, BabelCore.PluginObj<State>>(
|
||||
},
|
||||
},
|
||||
};
|
||||
}
|
||||
);
|
||||
});
|
||||
|
||||
export default plugin;
|
||||
|
@ -12,7 +12,12 @@ import { declare } from '@babel/helper-plugin-utils';
|
||||
|
||||
export { SimpleTypeResolveOptions as Options };
|
||||
|
||||
export default declare<SimpleTypeResolveOptions>(({ types: t }, options) => {
|
||||
const plugin: (
|
||||
api: object,
|
||||
options: SimpleTypeResolveOptions | null | undefined,
|
||||
dirname: string
|
||||
) => BabelCore.PluginObj<BabelCore.PluginPass> =
|
||||
declare<SimpleTypeResolveOptions>(({ types: t }, options) => {
|
||||
let ctx: SimpleTypeResolveContext | undefined;
|
||||
let helpers: Set<string> | undefined;
|
||||
|
||||
@ -98,9 +103,11 @@ export default declare<SimpleTypeResolveOptions>(({ types: t }, options) => {
|
||||
) {
|
||||
const id = path.get('id');
|
||||
const init = path.get('init');
|
||||
if (!id || !id.isIdentifier() || !init || !init.isCallExpression()) return;
|
||||
if (!id || !id.isIdentifier() || !init || !init.isCallExpression())
|
||||
return;
|
||||
|
||||
if (!init.get('callee')?.isIdentifier({ name: 'defineComponent' })) return;
|
||||
if (!init.get('callee')?.isIdentifier({ name: 'defineComponent' }))
|
||||
return;
|
||||
if (!checkDefineComponent(init)) return;
|
||||
|
||||
const nameProperty = t.objectProperty(
|
||||
@ -178,7 +185,9 @@ export default declare<SimpleTypeResolveOptions>(({ types: t }, options) => {
|
||||
t.objectProperty(t.identifier('emits'), ast)
|
||||
);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
export default plugin;
|
||||
|
||||
function getTypeAnnotation(node: BabelCore.types.Node) {
|
||||
if (
|
||||
|
@ -1,10 +1,13 @@
|
||||
import { defineConfig } from 'tsdown';
|
||||
|
||||
export default defineConfig({
|
||||
workspace: ['./packages/babel-plugin-jsx', './packages/babel-plugin-resolve-type'],
|
||||
workspace: [
|
||||
'./packages/babel-plugin-jsx',
|
||||
'./packages/babel-plugin-resolve-type',
|
||||
],
|
||||
entry: ['src/index.ts'],
|
||||
format: ['cjs', 'esm'],
|
||||
dts: true,
|
||||
dts: { oxc: true },
|
||||
target: 'es2015',
|
||||
platform: 'neutral',
|
||||
});
|
||||
|
Reference in New Issue
Block a user