mirror of
https://github.com/vuejs/babel-plugin-jsx.git
synced 2025-04-24 02:22:33 +08:00
fix(plugin-jsx): interop default
This commit is contained in:
parent
baf379274a
commit
9dccd01438
@ -2,6 +2,7 @@
|
|||||||
"name": "vue-jsx-monorepo",
|
"name": "vue-jsx-monorepo",
|
||||||
"private": true,
|
"private": true,
|
||||||
"packageManager": "pnpm@8.14.1",
|
"packageManager": "pnpm@8.14.1",
|
||||||
|
"type": "module",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"build": "pnpm run -r build",
|
"build": "pnpm run -r build",
|
||||||
"test": "vitest",
|
"test": "vitest",
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
import * as t from '@babel/types';
|
import * as t from '@babel/types';
|
||||||
import type * as BabelCore from '@babel/core';
|
import type * as BabelCore from '@babel/core';
|
||||||
import template from '@babel/template';
|
import _template from '@babel/template';
|
||||||
// @ts-expect-error
|
// @ts-expect-error
|
||||||
import syntaxJsx from '@babel/plugin-syntax-jsx';
|
import _syntaxJsx from '@babel/plugin-syntax-jsx';
|
||||||
// @ts-expect-error
|
// @ts-expect-error
|
||||||
import { addNamed, addNamespace, isModule } from '@babel/helper-module-imports';
|
import { addNamed, addNamespace, isModule } from '@babel/helper-module-imports';
|
||||||
import { type NodePath } from '@babel/traverse';
|
import { type NodePath } from '@babel/traverse';
|
||||||
@ -31,9 +31,17 @@ const hasJSX = (parentPath: NodePath<t.Program>) => {
|
|||||||
|
|
||||||
const JSX_ANNOTATION_REGEX = /\*?\s*@jsx\s+([^\s]+)/;
|
const JSX_ANNOTATION_REGEX = /\*?\s*@jsx\s+([^\s]+)/;
|
||||||
|
|
||||||
|
/* #__NO_SIDE_EFFECTS__ */
|
||||||
|
function interopDefault(m: any) {
|
||||||
|
return m.default || m;
|
||||||
|
}
|
||||||
|
|
||||||
|
const syntaxJsx = /*#__PURE__*/ interopDefault(_syntaxJsx);
|
||||||
|
const template = /*#__PURE__*/ interopDefault(_template);
|
||||||
|
|
||||||
export default ({ types }: typeof BabelCore): BabelCore.PluginObj<State> => ({
|
export default ({ types }: typeof BabelCore): BabelCore.PluginObj<State> => ({
|
||||||
name: 'babel-plugin-jsx',
|
name: 'babel-plugin-jsx',
|
||||||
inherits: syntaxJsx,
|
inherits: /*#__PURE__*/ interopDefault(syntaxJsx),
|
||||||
visitor: {
|
visitor: {
|
||||||
...transformVueJSX,
|
...transformVueJSX,
|
||||||
...sugarFragment,
|
...sugarFragment,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user