@@ -65,7 +65,39 @@ export interface BindingMetadata {
6565 [ key : string ] : 'data' | 'props' | 'setup' | 'options'
6666}
6767
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 {
69101 /**
70102 * An array of node transforms to be applied to every AST node.
71103 */
@@ -128,26 +160,15 @@ export interface TransformOptions {
128160 * SFC scoped styles ID
129161 */
130162 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
137163 /**
138164 * SFC `<style vars>` injection string
139165 * needed to render inline CSS variables on component root
140166 */
141167 ssrCssVars ?: string
142- /**
143- * Optional binding metadata analyzed from script - used to optimize
144- * binding access when `prefixIdentifiers` is enabled.
145- */
146- bindingMetadata ?: BindingMetadata
147168 onError ?: ( error : CompilerError ) => void
148169}
149170
150- export interface CodegenOptions {
171+ export interface CodegenOptions extends SharedTransformCodegenOptions {
151172 /**
152173 * - `module` mode will generate ES module import statements for helpers
153174 * and export the render function as the default export.
@@ -189,11 +210,6 @@ export interface CodegenOptions {
189210 * @default 'Vue'
190211 */
191212 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
197213}
198214
199215export type CompilerOptions = ParserOptions & TransformOptions & CodegenOptions
0 commit comments