diff --git a/packages/babel-plugin-jsx/README-zh_CN.md b/packages/babel-plugin-jsx/README-zh_CN.md index 5803b2d..bf8c92d 100644 --- a/packages/babel-plugin-jsx/README-zh_CN.md +++ b/packages/babel-plugin-jsx/README-zh_CN.md @@ -169,15 +169,15 @@ const App = { ``` ```jsx -; +; // 或者 - +; ``` ```jsx -; +; // 或者 - +; ``` 会编译成: diff --git a/packages/babel-plugin-jsx/README.md b/packages/babel-plugin-jsx/README.md index f1a2ffd..b06f010 100644 --- a/packages/babel-plugin-jsx/README.md +++ b/packages/babel-plugin-jsx/README.md @@ -173,15 +173,15 @@ const App = { ``` ```jsx -; +; // Or - +; ``` ```jsx -; +; // Or - +; ``` Will compile to: diff --git a/packages/babel-plugin-jsx/src/index.ts b/packages/babel-plugin-jsx/src/index.ts index bea3fff..8e5cb38 100644 --- a/packages/babel-plugin-jsx/src/index.ts +++ b/packages/babel-plugin-jsx/src/index.ts @@ -11,7 +11,7 @@ import type { State, VueJSXPluginOptions } from './interface' import type * as BabelCore from '@babel/core' import type { NodePath, Visitor } from '@babel/traverse' -export { VueJSXPluginOptions } +export type { VueJSXPluginOptions } const hasJSX = (parentPath: NodePath) => { let fileHasJSX = false diff --git a/packages/babel-plugin-resolve-type/src/index.ts b/packages/babel-plugin-resolve-type/src/index.ts index b564020..8aa8eb3 100644 --- a/packages/babel-plugin-resolve-type/src/index.ts +++ b/packages/babel-plugin-resolve-type/src/index.ts @@ -10,7 +10,7 @@ import { } from '@vue/compiler-sfc' import type * as BabelCore from '@babel/core' -export { SimpleTypeResolveOptions as Options } +export type { SimpleTypeResolveOptions as Options } const plugin: ( api: object, diff --git a/packages/jsx-explorer/src/index.ts b/packages/jsx-explorer/src/index.ts index 19482a3..c328d48 100644 --- a/packages/jsx-explorer/src/index.ts +++ b/packages/jsx-explorer/src/index.ts @@ -41,15 +41,15 @@ function main() { }, } - monaco.languages.typescript.typescriptDefaults.setDiagnosticsOptions({ + monaco.typescript.typescriptDefaults.setDiagnosticsOptions({ noSemanticValidation: true, }) - monaco.languages.typescript.typescriptDefaults.setCompilerOptions({ + monaco.typescript.typescriptDefaults.setCompilerOptions({ allowJs: true, allowNonTsExtensions: true, - jsx: monaco.languages.typescript.JsxEmit.Preserve, - target: monaco.languages.typescript.ScriptTarget.Latest, - module: monaco.languages.typescript.ModuleKind.ESNext, + jsx: monaco.typescript.JsxEmit.Preserve, + target: monaco.typescript.ScriptTarget.Latest, + module: monaco.typescript.ModuleKind.ESNext, isolatedModules: true, }) diff --git a/packages/jsx-explorer/src/options.tsx b/packages/jsx-explorer/src/options.tsx index d91830e..fc41ef5 100644 --- a/packages/jsx-explorer/src/options.tsx +++ b/packages/jsx-explorer/src/options.tsx @@ -1,7 +1,7 @@ import { createApp, defineComponent, reactive } from 'vue' import type { VueJSXPluginOptions } from '@vue/babel-plugin-jsx' -export { VueJSXPluginOptions } +export type { VueJSXPluginOptions } export const compilerOptions: VueJSXPluginOptions = reactive({ mergeProps: true, diff --git a/packages/jsx-explorer/vite.config.js b/packages/jsx-explorer/vite.config.js new file mode 100644 index 0000000..1486803 --- /dev/null +++ b/packages/jsx-explorer/vite.config.js @@ -0,0 +1,11 @@ +import VueJSX from '@vitejs/plugin-vue-jsx' +import { defaultClientConditions, defineConfig } from 'vite' +export default defineConfig({ + resolve: { + conditions: ['dev', ...defaultClientConditions], + }, + define: { + 'process.env.BABEL_TYPES_8_BREAKING': 'false', + }, + plugins: [VueJSX()], +}) diff --git a/tsconfig.json b/tsconfig.json index 565e8f4..2e7213f 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,19 +1,22 @@ { "compilerOptions": { - "target": "ESNext", + "target": "esnext", "jsx": "preserve", "jsxImportSource": "vue", - "lib": ["ES2023", "DOM", "DOM.Iterable"], + "lib": ["es2023", "DOM"], + "moduleDetection": "force", "customConditions": ["dev"], - "module": "ESNext", + "module": "preserve", "moduleResolution": "bundler", "resolveJsonModule": true, "types": ["vitest/globals"], - "allowJs": true, "strict": true, "noUnusedLocals": true, + "declaration": true, "noEmit": true, "esModuleInterop": true, + "verbatimModuleSyntax": true, "skipLibCheck": true - } + }, + "include": ["packages/*/src", "packages/*/test", "vitest.config.ts"] } diff --git a/vitest.config.ts b/vitest.config.ts index 169fbf2..3db13bf 100644 --- a/vitest.config.ts +++ b/vitest.config.ts @@ -3,9 +3,6 @@ import { defineConfig } from 'vitest/config' import Jsx from './packages/babel-plugin-jsx/src' export default defineConfig({ - resolve: { - conditions: ['dev'], - }, esbuild: { jsx: 'preserve', },