Skip to content

Commit fd298db

Browse files
committed
chore: fix typecheck
1 parent df18743 commit fd298db

File tree

3 files changed

+6
-28
lines changed

3 files changed

+6
-28
lines changed

packages/compiler/src/compile.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { parse } from '@babel/parser'
22
import { extend, isString } from '@vue/shared'
33
import { generate, type VaporCodegenResult } from './generate'
4-
import { IRNodeTypes, type HackOptions, type RootNode } from './ir'
4+
import { IRNodeTypes, type RootNode } from './ir'
55
import {
66
transform,
77
type DirectiveTransform,
@@ -84,7 +84,7 @@ export function compile(
8484
return generate(ir, resolvedOptions)
8585
}
8686

87-
export type CompilerOptions = HackOptions<TransformOptions>
87+
export type CompilerOptions = TransformOptions
8888
export type TransformPreset = [
8989
NodeTransform[],
9090
Record<string, DirectiveTransform>,

packages/compiler/src/ir/index.ts

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
1-
import type { DirectiveTransform, NodeTransform } from '../transform'
21
import type { SimpleExpressionNode } from '../utils'
32

43
import type { IRProp, IRProps, IRSlots } from './component'
54
import type { JSXFragment, Node, SourceLocation } from '@babel/types'
6-
import type { Prettify } from '@vue/shared'
75

86
export * from './component'
97

@@ -284,19 +282,6 @@ export interface IREffect {
284282
operations: OperationNode[]
285283
}
286284

287-
type Overwrite<T, U> = Pick<T, Exclude<keyof T, keyof U>> &
288-
Pick<U, Extract<keyof U, keyof T>>
289-
290-
export type HackOptions<T> = Prettify<
291-
Overwrite<
292-
T,
293-
{
294-
nodeTransforms?: NodeTransform[]
295-
directiveTransforms?: Record<string, DirectiveTransform | undefined>
296-
}
297-
>
298-
>
299-
300285
export type InsertionStateTypes =
301286
| IfIRNode
302287
| ForIRNode

packages/compiler/src/transform.ts

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ import {
33
DynamicFlag,
44
IRNodeTypes,
55
type BlockIRNode,
6-
type HackOptions,
76
type IRDynamicInfo,
87
type IRSlots,
98
type OperationNode,
@@ -22,7 +21,7 @@ import {
2221
type CompilerError,
2322
type SimpleExpressionNode,
2423
} from './utils'
25-
import type { ParserPlugin } from '@babel/parser'
24+
import type { CodegenOptions } from './generate'
2625
import type { JSXAttribute, JSXElement, JSXFragment } from '@babel/types'
2726

2827
export type NodeTransform = (
@@ -55,21 +54,14 @@ export type StructuralDirectiveTransform = (
5554
context: TransformContext,
5655
) => void | (() => void)
5756

58-
export type TransformOptions = HackOptions<{
57+
export type TransformOptions = CodegenOptions & {
5958
source?: string
60-
templates?: string[]
6159
/**
6260
* Whether to compile components to createComponentWithFallback.
6361
* @default false
6462
*/
6563
withFallback?: boolean
6664
onError?: (error: CompilerError) => void
67-
/**
68-
* A list of parser plugins to enable for `@babel/parser`, which is used to
69-
* parse expressions in bindings and interpolations.
70-
* https://babeljs.io/docs/en/next/babel-parser#plugins
71-
*/
72-
expressionPlugins?: ParserPlugin[]
7365
/**
7466
* An array of node transforms to be applied to every AST node.
7567
*/
@@ -93,9 +85,10 @@ export type TransformOptions = HackOptions<{
9385
* @default 'index.jsx'
9486
*/
9587
filename?: string
96-
}>
88+
}
9789
const defaultOptions: Required<TransformOptions> = {
9890
source: '',
91+
sourceMap: false,
9992
filename: 'index.jsx',
10093
nodeTransforms: [],
10194
directiveTransforms: {},

0 commit comments

Comments
 (0)