@@ -65,7 +65,39 @@ export interface BindingMetadata {
65
65
[ key : string ] : 'data' | 'props' | 'setup' | 'options'
66
66
}
67
67
68
- export interface TransformOptions {
68
+ interface SharedTransformCodegenOptions {
69
+ /**
70
+ * Transform expressions like {{ foo }} to `_ctx.foo`.
71
+ * If this option is false, the generated code will be wrapped in a
72
+ * `with (this) { ... }` block.
73
+ * - This is force-enabled in module mode, since modules are by default strict
74
+ * and cannot use `with`
75
+ * @default mode === 'module'
76
+ */
77
+ prefixIdentifiers ?: boolean
78
+ /**
79
+ * Generate SSR-optimized render functions instead.
80
+ * The resulting function must be attached to the component via the
81
+ * `ssrRender` option instead of `render`.
82
+ */
83
+ ssr ?: boolean
84
+ /**
85
+ * Optional binding metadata analyzed from script - used to optimize
86
+ * binding access when `prefixIdentifiers` is enabled.
87
+ */
88
+ bindingMetadata ?: BindingMetadata
89
+ /**
90
+ * Compile the function for inlining inside setup().
91
+ * This allows the function to directly access setup() local bindings.
92
+ */
93
+ inline ?: boolean
94
+ /**
95
+ * Identifier for props in setup() inline mode.
96
+ */
97
+ inlinePropsIdentifier ?: string
98
+ }
99
+
100
+ export interface TransformOptions extends SharedTransformCodegenOptions {
69
101
/**
70
102
* An array of node transforms to be applied to every AST node.
71
103
*/
@@ -128,26 +160,15 @@ export interface TransformOptions {
128
160
* SFC scoped styles ID
129
161
*/
130
162
scopeId ?: string | null
131
- /**
132
- * Generate SSR-optimized render functions instead.
133
- * The resulting function must be attached to the component via the
134
- * `ssrRender` option instead of `render`.
135
- */
136
- ssr ?: boolean
137
163
/**
138
164
* SFC `<style vars>` injection string
139
165
* needed to render inline CSS variables on component root
140
166
*/
141
167
ssrCssVars ?: string
142
- /**
143
- * Optional binding metadata analyzed from script - used to optimize
144
- * binding access when `prefixIdentifiers` is enabled.
145
- */
146
- bindingMetadata ?: BindingMetadata
147
168
onError ?: ( error : CompilerError ) => void
148
169
}
149
170
150
- export interface CodegenOptions {
171
+ export interface CodegenOptions extends SharedTransformCodegenOptions {
151
172
/**
152
173
* - `module` mode will generate ES module import statements for helpers
153
174
* and export the render function as the default export.
@@ -189,11 +210,6 @@ export interface CodegenOptions {
189
210
* @default 'Vue'
190
211
*/
191
212
runtimeGlobalName ?: string
192
- // we need to know this during codegen to generate proper preambles
193
- prefixIdentifiers ?: boolean
194
- bindingMetadata ?: BindingMetadata
195
- // generate ssr-specific code?
196
- ssr ?: boolean
197
213
}
198
214
199
215
export type CompilerOptions = ParserOptions & TransformOptions & CodegenOptions
0 commit comments