mirror of
https://github.com/vuejs/babel-plugin-jsx.git
synced 2025-12-09 15:09:40 +08:00
chore: improve tsconfig
This commit is contained in:
@@ -169,15 +169,15 @@ const App = {
|
||||
```
|
||||
|
||||
```jsx
|
||||
<input v-model={[val, ['modifier']]} />;
|
||||
;<input v-model={[val, ['modifier']]} />
|
||||
// 或者
|
||||
<input v-model_modifier={val} />
|
||||
;<input v-model_modifier={val} />
|
||||
```
|
||||
|
||||
```jsx
|
||||
<A v-model={[val, 'argument', ['modifier']]} />;
|
||||
;<A v-model={[val, 'argument', ['modifier']]} />
|
||||
// 或者
|
||||
<input v-model:argument_modifier={val} />
|
||||
;<input v-model:argument_modifier={val} />
|
||||
```
|
||||
|
||||
会编译成:
|
||||
|
||||
@@ -173,15 +173,15 @@ const App = {
|
||||
```
|
||||
|
||||
```jsx
|
||||
<input v-model={[val, ['modifier']]} />;
|
||||
;<input v-model={[val, ['modifier']]} />
|
||||
// Or
|
||||
<input v-model_modifier={val} />
|
||||
;<input v-model_modifier={val} />
|
||||
```
|
||||
|
||||
```jsx
|
||||
<A v-model={[val, 'argument', ['modifier']]} />;
|
||||
;<A v-model={[val, 'argument', ['modifier']]} />
|
||||
// Or
|
||||
<input v-model:argument_modifier={val} />
|
||||
;<input v-model:argument_modifier={val} />
|
||||
```
|
||||
|
||||
Will compile to:
|
||||
|
||||
@@ -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<t.Program>) => {
|
||||
let fileHasJSX = false
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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,
|
||||
})
|
||||
|
||||
|
||||
@@ -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,
|
||||
|
||||
11
packages/jsx-explorer/vite.config.js
Normal file
11
packages/jsx-explorer/vite.config.js
Normal file
@@ -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()],
|
||||
})
|
||||
@@ -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"]
|
||||
}
|
||||
|
||||
@@ -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',
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user