mirror of
https://github.com/vuejs/babel-plugin-jsx.git
synced 2025-08-14 03:03:20 +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 syntaxJsx = /*#__PURE__*/ interopDefault(_syntaxJsx);
|
||||||
const template = /*#__PURE__*/ interopDefault(_template);
|
const template = /*#__PURE__*/ interopDefault(_template);
|
||||||
|
|
||||||
export default declare<VueJSXPluginOptions, BabelCore.PluginObj<State>>(
|
const plugin: (
|
||||||
(api, opt, dirname) => {
|
api: object,
|
||||||
|
options: VueJSXPluginOptions | null | undefined,
|
||||||
|
dirname: string
|
||||||
|
) => BabelCore.PluginObj<State> = declare<
|
||||||
|
VueJSXPluginOptions,
|
||||||
|
BabelCore.PluginObj<State>
|
||||||
|
>((api, opt, dirname) => {
|
||||||
const { types } = api;
|
const { types } = api;
|
||||||
let resolveType: BabelCore.PluginObj<BabelCore.PluginPass> | undefined;
|
let resolveType: BabelCore.PluginObj<BabelCore.PluginPass> | undefined;
|
||||||
if (opt.resolveType) {
|
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 { 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 ctx: SimpleTypeResolveContext | undefined;
|
||||||
let helpers: Set<string> | undefined;
|
let helpers: Set<string> | undefined;
|
||||||
|
|
||||||
@ -98,9 +103,11 @@ export default declare<SimpleTypeResolveOptions>(({ types: t }, options) => {
|
|||||||
) {
|
) {
|
||||||
const id = path.get('id');
|
const id = path.get('id');
|
||||||
const init = path.get('init');
|
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;
|
if (!checkDefineComponent(init)) return;
|
||||||
|
|
||||||
const nameProperty = t.objectProperty(
|
const nameProperty = t.objectProperty(
|
||||||
@ -178,7 +185,9 @@ export default declare<SimpleTypeResolveOptions>(({ types: t }, options) => {
|
|||||||
t.objectProperty(t.identifier('emits'), ast)
|
t.objectProperty(t.identifier('emits'), ast)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
export default plugin;
|
||||||
|
|
||||||
function getTypeAnnotation(node: BabelCore.types.Node) {
|
function getTypeAnnotation(node: BabelCore.types.Node) {
|
||||||
if (
|
if (
|
||||||
|
@ -1,10 +1,13 @@
|
|||||||
import { defineConfig } from 'tsdown';
|
import { defineConfig } from 'tsdown';
|
||||||
|
|
||||||
export default defineConfig({
|
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'],
|
entry: ['src/index.ts'],
|
||||||
format: ['cjs', 'esm'],
|
format: ['cjs', 'esm'],
|
||||||
dts: true,
|
dts: { oxc: true },
|
||||||
target: 'es2015',
|
target: 'es2015',
|
||||||
platform: 'neutral',
|
platform: 'neutral',
|
||||||
});
|
});
|
||||||
|
Reference in New Issue
Block a user