mirror of
https://github.com/vuejs/babel-plugin-jsx.git
synced 2025-12-11 07:59:55 +08:00
chore: improve tsconfig
This commit is contained in:
@@ -169,15 +169,15 @@ const App = {
|
|||||||
```
|
```
|
||||||
|
|
||||||
```jsx
|
```jsx
|
||||||
<input v-model={[val, ['modifier']]} />;
|
;<input v-model={[val, ['modifier']]} />
|
||||||
// 或者
|
// 或者
|
||||||
<input v-model_modifier={val} />
|
;<input v-model_modifier={val} />
|
||||||
```
|
```
|
||||||
|
|
||||||
```jsx
|
```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
|
```jsx
|
||||||
<input v-model={[val, ['modifier']]} />;
|
;<input v-model={[val, ['modifier']]} />
|
||||||
// Or
|
// Or
|
||||||
<input v-model_modifier={val} />
|
;<input v-model_modifier={val} />
|
||||||
```
|
```
|
||||||
|
|
||||||
```jsx
|
```jsx
|
||||||
<A v-model={[val, 'argument', ['modifier']]} />;
|
;<A v-model={[val, 'argument', ['modifier']]} />
|
||||||
// Or
|
// Or
|
||||||
<input v-model:argument_modifier={val} />
|
;<input v-model:argument_modifier={val} />
|
||||||
```
|
```
|
||||||
|
|
||||||
Will compile to:
|
Will compile to:
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ import type { State, VueJSXPluginOptions } from './interface'
|
|||||||
import type * as BabelCore from '@babel/core'
|
import type * as BabelCore from '@babel/core'
|
||||||
import type { NodePath, Visitor } from '@babel/traverse'
|
import type { NodePath, Visitor } from '@babel/traverse'
|
||||||
|
|
||||||
export { VueJSXPluginOptions }
|
export type { VueJSXPluginOptions }
|
||||||
|
|
||||||
const hasJSX = (parentPath: NodePath<t.Program>) => {
|
const hasJSX = (parentPath: NodePath<t.Program>) => {
|
||||||
let fileHasJSX = false
|
let fileHasJSX = false
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ import {
|
|||||||
} from '@vue/compiler-sfc'
|
} from '@vue/compiler-sfc'
|
||||||
import type * as BabelCore from '@babel/core'
|
import type * as BabelCore from '@babel/core'
|
||||||
|
|
||||||
export { SimpleTypeResolveOptions as Options }
|
export type { SimpleTypeResolveOptions as Options }
|
||||||
|
|
||||||
const plugin: (
|
const plugin: (
|
||||||
api: object,
|
api: object,
|
||||||
|
|||||||
@@ -41,15 +41,15 @@ function main() {
|
|||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
monaco.languages.typescript.typescriptDefaults.setDiagnosticsOptions({
|
monaco.typescript.typescriptDefaults.setDiagnosticsOptions({
|
||||||
noSemanticValidation: true,
|
noSemanticValidation: true,
|
||||||
})
|
})
|
||||||
monaco.languages.typescript.typescriptDefaults.setCompilerOptions({
|
monaco.typescript.typescriptDefaults.setCompilerOptions({
|
||||||
allowJs: true,
|
allowJs: true,
|
||||||
allowNonTsExtensions: true,
|
allowNonTsExtensions: true,
|
||||||
jsx: monaco.languages.typescript.JsxEmit.Preserve,
|
jsx: monaco.typescript.JsxEmit.Preserve,
|
||||||
target: monaco.languages.typescript.ScriptTarget.Latest,
|
target: monaco.typescript.ScriptTarget.Latest,
|
||||||
module: monaco.languages.typescript.ModuleKind.ESNext,
|
module: monaco.typescript.ModuleKind.ESNext,
|
||||||
isolatedModules: true,
|
isolatedModules: true,
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import { createApp, defineComponent, reactive } from 'vue'
|
import { createApp, defineComponent, reactive } from 'vue'
|
||||||
import type { VueJSXPluginOptions } from '@vue/babel-plugin-jsx'
|
import type { VueJSXPluginOptions } from '@vue/babel-plugin-jsx'
|
||||||
|
|
||||||
export { VueJSXPluginOptions }
|
export type { VueJSXPluginOptions }
|
||||||
|
|
||||||
export const compilerOptions: VueJSXPluginOptions = reactive({
|
export const compilerOptions: VueJSXPluginOptions = reactive({
|
||||||
mergeProps: true,
|
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": {
|
"compilerOptions": {
|
||||||
"target": "ESNext",
|
"target": "esnext",
|
||||||
"jsx": "preserve",
|
"jsx": "preserve",
|
||||||
"jsxImportSource": "vue",
|
"jsxImportSource": "vue",
|
||||||
"lib": ["ES2023", "DOM", "DOM.Iterable"],
|
"lib": ["es2023", "DOM"],
|
||||||
|
"moduleDetection": "force",
|
||||||
"customConditions": ["dev"],
|
"customConditions": ["dev"],
|
||||||
"module": "ESNext",
|
"module": "preserve",
|
||||||
"moduleResolution": "bundler",
|
"moduleResolution": "bundler",
|
||||||
"resolveJsonModule": true,
|
"resolveJsonModule": true,
|
||||||
"types": ["vitest/globals"],
|
"types": ["vitest/globals"],
|
||||||
"allowJs": true,
|
|
||||||
"strict": true,
|
"strict": true,
|
||||||
"noUnusedLocals": true,
|
"noUnusedLocals": true,
|
||||||
|
"declaration": true,
|
||||||
"noEmit": true,
|
"noEmit": true,
|
||||||
"esModuleInterop": true,
|
"esModuleInterop": true,
|
||||||
|
"verbatimModuleSyntax": true,
|
||||||
"skipLibCheck": 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'
|
import Jsx from './packages/babel-plugin-jsx/src'
|
||||||
|
|
||||||
export default defineConfig({
|
export default defineConfig({
|
||||||
resolve: {
|
|
||||||
conditions: ['dev'],
|
|
||||||
},
|
|
||||||
esbuild: {
|
esbuild: {
|
||||||
jsx: 'preserve',
|
jsx: 'preserve',
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user