compiler-core.d.ts 42 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174
  1. import { BlockStatement as BlockStatement_2 } from '@babel/types';
  2. import { Function as Function_2 } from '@babel/types';
  3. import { generateCodeFrame } from '@vue/shared';
  4. import { Identifier } from '@babel/types';
  5. import { Node as Node_3 } from '@babel/types';
  6. import { ObjectProperty } from '@babel/types';
  7. import { ParserPlugin } from '@babel/parser';
  8. import { Program } from '@babel/types';
  9. import { RawSourceMap } from 'source-map';
  10. import { SourceMapGenerator } from 'source-map';
  11. export declare function advancePositionWithClone(pos: Position, source: string, numberOfCharacters?: number): Position;
  12. export declare function advancePositionWithMutation(pos: Position, source: string, numberOfCharacters?: number): Position;
  13. export declare interface ArrayExpression extends Node_2 {
  14. type: NodeTypes.JS_ARRAY_EXPRESSION;
  15. elements: Array<string | Node_2>;
  16. }
  17. export declare function assert(condition: boolean, msg?: string): void;
  18. export declare interface AssignmentExpression extends Node_2 {
  19. type: NodeTypes.JS_ASSIGNMENT_EXPRESSION;
  20. left: SimpleExpressionNode;
  21. right: JSChildNode;
  22. }
  23. export declare interface AttributeNode extends Node_2 {
  24. type: NodeTypes.ATTRIBUTE;
  25. name: string;
  26. value: TextNode | undefined;
  27. }
  28. export declare const BASE_TRANSITION: unique symbol;
  29. export declare function baseCompile(template: string | RootNode, options?: CompilerOptions): CodegenResult;
  30. export declare interface BaseElementNode extends Node_2 {
  31. type: NodeTypes.ELEMENT;
  32. ns: Namespace;
  33. tag: string;
  34. tagType: ElementTypes;
  35. isSelfClosing: boolean;
  36. props: Array<AttributeNode | DirectiveNode>;
  37. children: TemplateChildNode[];
  38. }
  39. export declare function baseParse(content: string, options?: ParserOptions): RootNode;
  40. export declare type BindingMetadata = {
  41. [key: string]: BindingTypes | undefined;
  42. } & {
  43. __isScriptSetup?: boolean;
  44. };
  45. export declare const enum BindingTypes {
  46. /**
  47. * returned from data()
  48. */
  49. DATA = "data",
  50. /**
  51. * decalred as a prop
  52. */
  53. PROPS = "props",
  54. /**
  55. * a let binding (may or may not be a ref)
  56. */
  57. SETUP_LET = "setup-let",
  58. /**
  59. * a const binding that can never be a ref.
  60. * these bindings don't need `unref()` calls when processed in inlined
  61. * template expressions.
  62. */
  63. SETUP_CONST = "setup-const",
  64. /**
  65. * a const binding that may be a ref.
  66. */
  67. SETUP_MAYBE_REF = "setup-maybe-ref",
  68. /**
  69. * bindings that are guaranteed to be refs
  70. */
  71. SETUP_REF = "setup-ref",
  72. /**
  73. * declared by other options, e.g. computed, inject
  74. */
  75. OPTIONS = "options"
  76. }
  77. export declare type BlockCodegenNode = VNodeCall | RenderSlotCall;
  78. export declare interface BlockStatement extends Node_2 {
  79. type: NodeTypes.JS_BLOCK_STATEMENT;
  80. body: (JSChildNode | IfStatement)[];
  81. }
  82. export declare function buildProps(node: ElementNode, context: TransformContext, props?: ElementNode['props'], ssr?: boolean): {
  83. props: PropsExpression | undefined;
  84. directives: DirectiveNode[];
  85. patchFlag: number;
  86. dynamicPropNames: string[];
  87. };
  88. export declare function buildSlots(node: ElementNode, context: TransformContext, buildSlotFn?: SlotFnBuilder): {
  89. slots: SlotsExpression;
  90. hasDynamicSlots: boolean;
  91. };
  92. export declare interface CacheExpression extends Node_2 {
  93. type: NodeTypes.JS_CACHE_EXPRESSION;
  94. index: number;
  95. value: JSChildNode;
  96. isVNode: boolean;
  97. }
  98. export declare interface CallExpression extends Node_2 {
  99. type: NodeTypes.JS_CALL_EXPRESSION;
  100. callee: string | symbol;
  101. arguments: (string | symbol | JSChildNode | SSRCodegenNode | TemplateChildNode | TemplateChildNode[])[];
  102. }
  103. export declare const CAMELIZE: unique symbol;
  104. export declare const CAPITALIZE: unique symbol;
  105. export declare function checkCompatEnabled(key: CompilerDeprecationTypes, context: ParserContext | TransformContext, loc: SourceLocation | null, ...args: any[]): boolean;
  106. export declare interface CodegenContext extends Omit<Required<CodegenOptions>, 'bindingMetadata' | 'inline'> {
  107. source: string;
  108. code: string;
  109. line: number;
  110. column: number;
  111. offset: number;
  112. indentLevel: number;
  113. pure: boolean;
  114. map?: SourceMapGenerator;
  115. helper(key: symbol): string;
  116. push(code: string, node?: CodegenNode): void;
  117. indent(): void;
  118. deindent(withoutNewLine?: boolean): void;
  119. newline(): void;
  120. }
  121. declare type CodegenNode = TemplateChildNode | JSChildNode | SSRCodegenNode;
  122. export declare interface CodegenOptions extends SharedTransformCodegenOptions {
  123. /**
  124. * - `module` mode will generate ES module import statements for helpers
  125. * and export the render function as the default export.
  126. * - `function` mode will generate a single `const { helpers... } = Vue`
  127. * statement and return the render function. It expects `Vue` to be globally
  128. * available (or passed by wrapping the code with an IIFE). It is meant to be
  129. * used with `new Function(code)()` to generate a render function at runtime.
  130. * @default 'function'
  131. */
  132. mode?: 'module' | 'function';
  133. /**
  134. * Generate source map?
  135. * @default false
  136. */
  137. sourceMap?: boolean;
  138. /**
  139. * SFC scoped styles ID
  140. */
  141. scopeId?: string | null;
  142. /**
  143. * Option to optimize helper import bindings via variable assignment
  144. * (only used for webpack code-split)
  145. * @default false
  146. */
  147. optimizeImports?: boolean;
  148. /**
  149. * Customize where to import runtime helpers from.
  150. * @default 'vue'
  151. */
  152. runtimeModuleName?: string;
  153. /**
  154. * Customize the global variable name of `Vue` to get helpers from
  155. * in function mode
  156. * @default 'Vue'
  157. */
  158. runtimeGlobalName?: string;
  159. }
  160. export declare interface CodegenResult {
  161. code: string;
  162. preamble: string;
  163. ast: RootNode;
  164. map?: RawSourceMap;
  165. }
  166. export declare interface CommentNode extends Node_2 {
  167. type: NodeTypes.COMMENT;
  168. content: string;
  169. }
  170. declare type CompilerCompatConfig = Partial<Record<CompilerDeprecationTypes, boolean | 'suppress-warning'>> & {
  171. MODE?: 2 | 3;
  172. };
  173. declare interface CompilerCompatOptions {
  174. compatConfig?: CompilerCompatConfig;
  175. }
  176. export declare const enum CompilerDeprecationTypes {
  177. COMPILER_IS_ON_ELEMENT = "COMPILER_IS_ON_ELEMENT",
  178. COMPILER_V_BIND_SYNC = "COMPILER_V_BIND_SYNC",
  179. COMPILER_V_BIND_PROP = "COMPILER_V_BIND_PROP",
  180. COMPILER_V_BIND_OBJECT_ORDER = "COMPILER_V_BIND_OBJECT_ORDER",
  181. COMPILER_V_ON_NATIVE = "COMPILER_V_ON_NATIVE",
  182. COMPILER_V_IF_V_FOR_PRECEDENCE = "COMPILER_V_IF_V_FOR_PRECEDENCE",
  183. COMPILER_V_FOR_REF = "COMPILER_V_FOR_REF",
  184. COMPILER_NATIVE_TEMPLATE = "COMPILER_NATIVE_TEMPLATE",
  185. COMPILER_INLINE_TEMPLATE = "COMPILER_INLINE_TEMPLATE",
  186. COMPILER_FILTERS = "COMPILER_FILTER"
  187. }
  188. export declare interface CompilerError extends SyntaxError {
  189. code: number | string;
  190. loc?: SourceLocation;
  191. }
  192. export declare type CompilerOptions = ParserOptions & TransformOptions & CodegenOptions;
  193. export declare interface ComponentNode extends BaseElementNode {
  194. tagType: ElementTypes.COMPONENT;
  195. codegenNode: VNodeCall | CacheExpression | MemoExpression | undefined;
  196. ssrCodegenNode?: CallExpression;
  197. }
  198. export declare interface CompoundExpressionNode extends Node_2 {
  199. type: NodeTypes.COMPOUND_EXPRESSION;
  200. children: (SimpleExpressionNode | CompoundExpressionNode | InterpolationNode | TextNode | string | symbol)[];
  201. /**
  202. * an expression parsed as the params of a function will track
  203. * the identifiers declared inside the function body.
  204. */
  205. identifiers?: string[];
  206. isHandlerKey?: boolean;
  207. }
  208. export declare interface ConditionalDynamicSlotNode extends ConditionalExpression {
  209. consequent: DynamicSlotNode;
  210. alternate: DynamicSlotNode | SimpleExpressionNode;
  211. }
  212. export declare interface ConditionalExpression extends Node_2 {
  213. type: NodeTypes.JS_CONDITIONAL_EXPRESSION;
  214. test: JSChildNode;
  215. consequent: JSChildNode;
  216. alternate: JSChildNode;
  217. newline: boolean;
  218. }
  219. /**
  220. * Static types have several levels.
  221. * Higher levels implies lower levels. e.g. a node that can be stringified
  222. * can always be hoisted and skipped for patch.
  223. */
  224. export declare const enum ConstantTypes {
  225. NOT_CONSTANT = 0,
  226. CAN_SKIP_PATCH = 1,
  227. CAN_HOIST = 2,
  228. CAN_STRINGIFY = 3
  229. }
  230. export declare interface CoreCompilerError extends CompilerError {
  231. code: ErrorCodes;
  232. }
  233. export declare const CREATE_BLOCK: unique symbol;
  234. export declare const CREATE_COMMENT: unique symbol;
  235. export declare const CREATE_ELEMENT_BLOCK: unique symbol;
  236. export declare const CREATE_ELEMENT_VNODE: unique symbol;
  237. export declare const CREATE_SLOTS: unique symbol;
  238. export declare const CREATE_STATIC: unique symbol;
  239. export declare const CREATE_TEXT: unique symbol;
  240. export declare const CREATE_VNODE: unique symbol;
  241. export declare function createArrayExpression(elements: ArrayExpression['elements'], loc?: SourceLocation): ArrayExpression;
  242. export declare function createAssignmentExpression(left: AssignmentExpression['left'], right: AssignmentExpression['right']): AssignmentExpression;
  243. export declare function createBlockStatement(body: BlockStatement['body']): BlockStatement;
  244. export declare function createCacheExpression(index: number, value: JSChildNode, isVNode?: boolean): CacheExpression;
  245. export declare function createCallExpression<T extends CallExpression['callee']>(callee: T, args?: CallExpression['arguments'], loc?: SourceLocation): InferCodegenNodeType<T>;
  246. export declare function createCompilerError<T extends number>(code: T, loc?: SourceLocation, messages?: {
  247. [code: number]: string;
  248. }, additionalMessage?: string): InferCompilerError<T>;
  249. export declare function createCompoundExpression(children: CompoundExpressionNode['children'], loc?: SourceLocation): CompoundExpressionNode;
  250. export declare function createConditionalExpression(test: ConditionalExpression['test'], consequent: ConditionalExpression['consequent'], alternate: ConditionalExpression['alternate'], newline?: boolean): ConditionalExpression;
  251. export declare function createForLoopParams({ value, key, index }: ForParseResult, memoArgs?: ExpressionNode[]): ExpressionNode[];
  252. export declare function createFunctionExpression(params: FunctionExpression['params'], returns?: FunctionExpression['returns'], newline?: boolean, isSlot?: boolean, loc?: SourceLocation): FunctionExpression;
  253. export declare function createIfStatement(test: IfStatement['test'], consequent: IfStatement['consequent'], alternate?: IfStatement['alternate']): IfStatement;
  254. export declare function createInterpolation(content: InterpolationNode['content'] | string, loc: SourceLocation): InterpolationNode;
  255. export declare function createObjectExpression(properties: ObjectExpression['properties'], loc?: SourceLocation): ObjectExpression;
  256. export declare function createObjectProperty(key: Property['key'] | string, value: Property['value']): Property;
  257. export declare function createReturnStatement(returns: ReturnStatement['returns']): ReturnStatement;
  258. export declare function createRoot(children: TemplateChildNode[], loc?: SourceLocation): RootNode;
  259. export declare function createSequenceExpression(expressions: SequenceExpression['expressions']): SequenceExpression;
  260. export declare function createSimpleExpression(content: SimpleExpressionNode['content'], isStatic?: SimpleExpressionNode['isStatic'], loc?: SourceLocation, constType?: ConstantTypes): SimpleExpressionNode;
  261. export declare function createStructuralDirectiveTransform(name: string | RegExp, fn: StructuralDirectiveTransform): NodeTransform;
  262. export declare function createTemplateLiteral(elements: TemplateLiteral['elements']): TemplateLiteral;
  263. export declare function createTransformContext(root: RootNode, { filename, prefixIdentifiers, hoistStatic, cacheHandlers, nodeTransforms, directiveTransforms, transformHoist, isBuiltInComponent, isCustomElement, expressionPlugins, scopeId, slotted, ssr, inSSR, ssrCssVars, bindingMetadata, inline, isTS, onError, onWarn, compatConfig }: TransformOptions): TransformContext;
  264. export declare function createVNodeCall(context: TransformContext | null, tag: VNodeCall['tag'], props?: VNodeCall['props'], children?: VNodeCall['children'], patchFlag?: VNodeCall['patchFlag'], dynamicProps?: VNodeCall['dynamicProps'], directives?: VNodeCall['directives'], isBlock?: VNodeCall['isBlock'], disableTracking?: VNodeCall['disableTracking'], isComponent?: VNodeCall['isComponent'], loc?: SourceLocation): VNodeCall;
  265. export declare interface DirectiveArgumentNode extends ArrayExpression {
  266. elements: [string] | [string, ExpressionNode] | [string, ExpressionNode, ExpressionNode] | [string, ExpressionNode, ExpressionNode, ObjectExpression];
  267. }
  268. export declare interface DirectiveArguments extends ArrayExpression {
  269. elements: DirectiveArgumentNode[];
  270. }
  271. export declare interface DirectiveNode extends Node_2 {
  272. type: NodeTypes.DIRECTIVE;
  273. name: string;
  274. exp: ExpressionNode | undefined;
  275. arg: ExpressionNode | undefined;
  276. modifiers: string[];
  277. /**
  278. * optional property to cache the expression parse result for v-for
  279. */
  280. parseResult?: ForParseResult;
  281. }
  282. export declare type DirectiveTransform = (dir: DirectiveNode, node: ElementNode, context: TransformContext, augmentor?: (ret: DirectiveTransformResult) => DirectiveTransformResult) => DirectiveTransformResult;
  283. declare interface DirectiveTransformResult {
  284. props: Property[];
  285. needRuntime?: boolean | symbol;
  286. ssrTagParts?: TemplateLiteral['elements'];
  287. }
  288. export declare interface DynamicSlotEntries extends ArrayExpression {
  289. elements: (ConditionalDynamicSlotNode | ListDynamicSlotNode)[];
  290. }
  291. export declare interface DynamicSlotFnProperty extends Property {
  292. value: SlotFunctionExpression;
  293. }
  294. export declare interface DynamicSlotNode extends ObjectExpression {
  295. properties: [Property, DynamicSlotFnProperty];
  296. }
  297. export declare interface DynamicSlotsExpression extends CallExpression {
  298. callee: typeof CREATE_SLOTS;
  299. arguments: [SlotsObjectExpression, DynamicSlotEntries];
  300. }
  301. export declare type ElementNode = PlainElementNode | ComponentNode | SlotOutletNode | TemplateNode;
  302. export declare const enum ElementTypes {
  303. ELEMENT = 0,
  304. COMPONENT = 1,
  305. SLOT = 2,
  306. TEMPLATE = 3
  307. }
  308. export declare const enum ErrorCodes {
  309. ABRUPT_CLOSING_OF_EMPTY_COMMENT = 0,
  310. CDATA_IN_HTML_CONTENT = 1,
  311. DUPLICATE_ATTRIBUTE = 2,
  312. END_TAG_WITH_ATTRIBUTES = 3,
  313. END_TAG_WITH_TRAILING_SOLIDUS = 4,
  314. EOF_BEFORE_TAG_NAME = 5,
  315. EOF_IN_CDATA = 6,
  316. EOF_IN_COMMENT = 7,
  317. EOF_IN_SCRIPT_HTML_COMMENT_LIKE_TEXT = 8,
  318. EOF_IN_TAG = 9,
  319. INCORRECTLY_CLOSED_COMMENT = 10,
  320. INCORRECTLY_OPENED_COMMENT = 11,
  321. INVALID_FIRST_CHARACTER_OF_TAG_NAME = 12,
  322. MISSING_ATTRIBUTE_VALUE = 13,
  323. MISSING_END_TAG_NAME = 14,
  324. MISSING_WHITESPACE_BETWEEN_ATTRIBUTES = 15,
  325. NESTED_COMMENT = 16,
  326. UNEXPECTED_CHARACTER_IN_ATTRIBUTE_NAME = 17,
  327. UNEXPECTED_CHARACTER_IN_UNQUOTED_ATTRIBUTE_VALUE = 18,
  328. UNEXPECTED_EQUALS_SIGN_BEFORE_ATTRIBUTE_NAME = 19,
  329. UNEXPECTED_NULL_CHARACTER = 20,
  330. UNEXPECTED_QUESTION_MARK_INSTEAD_OF_TAG_NAME = 21,
  331. UNEXPECTED_SOLIDUS_IN_TAG = 22,
  332. X_INVALID_END_TAG = 23,
  333. X_MISSING_END_TAG = 24,
  334. X_MISSING_INTERPOLATION_END = 25,
  335. X_MISSING_DIRECTIVE_NAME = 26,
  336. X_MISSING_DYNAMIC_DIRECTIVE_ARGUMENT_END = 27,
  337. X_V_IF_NO_EXPRESSION = 28,
  338. X_V_IF_SAME_KEY = 29,
  339. X_V_ELSE_NO_ADJACENT_IF = 30,
  340. X_V_FOR_NO_EXPRESSION = 31,
  341. X_V_FOR_MALFORMED_EXPRESSION = 32,
  342. X_V_FOR_TEMPLATE_KEY_PLACEMENT = 33,
  343. X_V_BIND_NO_EXPRESSION = 34,
  344. X_V_ON_NO_EXPRESSION = 35,
  345. X_V_SLOT_UNEXPECTED_DIRECTIVE_ON_SLOT_OUTLET = 36,
  346. X_V_SLOT_MIXED_SLOT_USAGE = 37,
  347. X_V_SLOT_DUPLICATE_SLOT_NAMES = 38,
  348. X_V_SLOT_EXTRANEOUS_DEFAULT_SLOT_CHILDREN = 39,
  349. X_V_SLOT_MISPLACED = 40,
  350. X_V_MODEL_NO_EXPRESSION = 41,
  351. X_V_MODEL_MALFORMED_EXPRESSION = 42,
  352. X_V_MODEL_ON_SCOPE_VARIABLE = 43,
  353. X_INVALID_EXPRESSION = 44,
  354. X_KEEP_ALIVE_INVALID_CHILDREN = 45,
  355. X_PREFIX_ID_NOT_SUPPORTED = 46,
  356. X_MODULE_MODE_NOT_SUPPORTED = 47,
  357. X_CACHE_HANDLER_NOT_SUPPORTED = 48,
  358. X_SCOPE_ID_NOT_SUPPORTED = 49,
  359. __EXTEND_POINT__ = 50
  360. }
  361. declare interface ErrorHandlingOptions {
  362. onWarn?: (warning: CompilerError) => void;
  363. onError?: (error: CompilerError) => void;
  364. }
  365. export declare type ExpressionNode = SimpleExpressionNode | CompoundExpressionNode;
  366. export declare function extractIdentifiers(param: Node_3, nodes?: Identifier[]): Identifier[];
  367. export declare function findDir(node: ElementNode, name: string | RegExp, allowEmpty?: boolean): DirectiveNode | undefined;
  368. export declare function findProp(node: ElementNode, name: string, dynamicOnly?: boolean, allowEmpty?: boolean): ElementNode['props'][0] | undefined;
  369. export declare interface ForCodegenNode extends VNodeCall {
  370. isBlock: true;
  371. tag: typeof FRAGMENT;
  372. props: undefined;
  373. children: ForRenderListExpression;
  374. patchFlag: string;
  375. disableTracking: boolean;
  376. }
  377. export declare interface ForIteratorExpression extends FunctionExpression {
  378. returns: BlockCodegenNode;
  379. }
  380. export declare interface ForNode extends Node_2 {
  381. type: NodeTypes.FOR;
  382. source: ExpressionNode;
  383. valueAlias: ExpressionNode | undefined;
  384. keyAlias: ExpressionNode | undefined;
  385. objectIndexAlias: ExpressionNode | undefined;
  386. parseResult: ForParseResult;
  387. children: TemplateChildNode[];
  388. codegenNode?: ForCodegenNode;
  389. }
  390. declare interface ForParseResult {
  391. source: ExpressionNode;
  392. value: ExpressionNode | undefined;
  393. key: ExpressionNode | undefined;
  394. index: ExpressionNode | undefined;
  395. }
  396. export declare interface ForRenderListExpression extends CallExpression {
  397. callee: typeof RENDER_LIST;
  398. arguments: [ExpressionNode, ForIteratorExpression];
  399. }
  400. export declare const FRAGMENT: unique symbol;
  401. export declare interface FunctionExpression extends Node_2 {
  402. type: NodeTypes.JS_FUNCTION_EXPRESSION;
  403. params: ExpressionNode | string | (ExpressionNode | string)[] | undefined;
  404. returns?: TemplateChildNode | TemplateChildNode[] | JSChildNode;
  405. body?: BlockStatement | IfStatement;
  406. newline: boolean;
  407. /**
  408. * This flag is for codegen to determine whether it needs to generate the
  409. * withScopeId() wrapper
  410. */
  411. isSlot: boolean;
  412. /**
  413. * __COMPAT__ only, indicates a slot function that should be excluded from
  414. * the legacy $scopedSlots instance property.
  415. */
  416. isNonScopedSlot?: boolean;
  417. }
  418. export declare function generate(ast: RootNode, options?: CodegenOptions & {
  419. onContextCreated?: (context: CodegenContext) => void;
  420. }): CodegenResult;
  421. export { generateCodeFrame }
  422. export declare function getBaseTransformPreset(prefixIdentifiers?: boolean): TransformPreset;
  423. export declare function getInnerRange(loc: SourceLocation, offset: number, length?: number): SourceLocation;
  424. export declare function getMemoedVNodeCall(node: BlockCodegenNode | MemoExpression): VNodeCall | RenderSlotCall;
  425. export declare function getVNodeBlockHelper(ssr: boolean, isComponent: boolean): typeof CREATE_BLOCK | typeof CREATE_ELEMENT_BLOCK;
  426. export declare function getVNodeHelper(ssr: boolean, isComponent: boolean): typeof CREATE_VNODE | typeof CREATE_ELEMENT_VNODE;
  427. export declare const GUARD_REACTIVE_PROPS: unique symbol;
  428. export declare function hasDynamicKeyVBind(node: ElementNode): boolean;
  429. export declare function hasScopeRef(node: TemplateChildNode | IfBranchNode | ExpressionNode | undefined, ids: TransformContext['identifiers']): boolean;
  430. export declare const helperNameMap: any;
  431. export declare type HoistTransform = (children: TemplateChildNode[], context: TransformContext, parent: ParentNode_2) => void;
  432. export declare interface IfBranchNode extends Node_2 {
  433. type: NodeTypes.IF_BRANCH;
  434. condition: ExpressionNode | undefined;
  435. children: TemplateChildNode[];
  436. userKey?: AttributeNode | DirectiveNode;
  437. }
  438. export declare interface IfConditionalExpression extends ConditionalExpression {
  439. consequent: BlockCodegenNode | MemoExpression;
  440. alternate: BlockCodegenNode | IfConditionalExpression | MemoExpression;
  441. }
  442. export declare interface IfNode extends Node_2 {
  443. type: NodeTypes.IF;
  444. branches: IfBranchNode[];
  445. codegenNode?: IfConditionalExpression | CacheExpression;
  446. }
  447. export declare interface IfStatement extends Node_2 {
  448. type: NodeTypes.JS_IF_STATEMENT;
  449. test: ExpressionNode;
  450. consequent: BlockStatement;
  451. alternate: IfStatement | BlockStatement | ReturnStatement | undefined;
  452. }
  453. declare interface ImportItem {
  454. exp: string | ExpressionNode;
  455. path: string;
  456. }
  457. declare type InferCodegenNodeType<T> = T extends typeof RENDER_SLOT ? RenderSlotCall : CallExpression;
  458. declare type InferCompilerError<T> = T extends ErrorCodes ? CoreCompilerError : CompilerError;
  459. export declare function injectProp(node: VNodeCall | RenderSlotCall, prop: Property, context: TransformContext): void;
  460. export declare interface InterpolationNode extends Node_2 {
  461. type: NodeTypes.INTERPOLATION;
  462. content: ExpressionNode;
  463. }
  464. export declare const IS_MEMO_SAME: unique symbol;
  465. export declare const IS_REF: unique symbol;
  466. export declare function isBindKey(arg: DirectiveNode['arg'], name: string): boolean;
  467. export declare const isBuiltInType: (tag: string, expected: string) => boolean;
  468. export declare function isCoreComponent(tag: string): symbol | void;
  469. export declare const isFunctionType: (node: Node_3) => node is Function_2;
  470. export declare function isInDestructureAssignment(parent: Node_3, parentStack: Node_3[]): boolean;
  471. /**
  472. * Simple lexer to check if an expression is a member expression. This is
  473. * lax and only checks validity at the root level (i.e. does not validate exps
  474. * inside square brackets), but it's ok since these are only used on template
  475. * expressions and false positives are invalid expressions in the first place.
  476. */
  477. export declare const isMemberExpression: (path: string) => boolean;
  478. export declare function isReferencedIdentifier(id: Identifier, parent: Node_3 | null, parentStack: Node_3[]): boolean;
  479. export declare const isSimpleIdentifier: (name: string) => boolean;
  480. export declare function isSlotOutlet(node: RootNode | TemplateChildNode): node is SlotOutletNode;
  481. export declare const isStaticExp: (p: JSChildNode) => p is SimpleExpressionNode;
  482. export declare const isStaticProperty: (node: Node_3) => node is ObjectProperty;
  483. export declare const isStaticPropertyKey: (node: Node_3, parent: Node_3) => boolean;
  484. export declare function isTemplateNode(node: RootNode | TemplateChildNode): node is TemplateNode;
  485. export declare function isText(node: TemplateChildNode): node is TextNode | InterpolationNode;
  486. export declare function isVSlot(p: ElementNode['props'][0]): p is DirectiveNode;
  487. export declare type JSChildNode = VNodeCall | CallExpression | ObjectExpression | ArrayExpression | ExpressionNode | FunctionExpression | ConditionalExpression | CacheExpression | AssignmentExpression | SequenceExpression;
  488. export declare const KEEP_ALIVE: unique symbol;
  489. export declare interface ListDynamicSlotIterator extends FunctionExpression {
  490. returns: DynamicSlotNode;
  491. }
  492. export declare interface ListDynamicSlotNode extends CallExpression {
  493. callee: typeof RENDER_LIST;
  494. arguments: [ExpressionNode, ListDynamicSlotIterator];
  495. }
  496. export declare const locStub: SourceLocation;
  497. export declare function makeBlock(node: VNodeCall, { helper, removeHelper, inSSR }: TransformContext): void;
  498. export declare interface MemoExpression extends CallExpression {
  499. callee: typeof WITH_MEMO;
  500. arguments: [ExpressionNode, MemoFactory, string, string];
  501. }
  502. declare interface MemoFactory extends FunctionExpression {
  503. returns: BlockCodegenNode;
  504. }
  505. export declare const MERGE_PROPS: unique symbol;
  506. declare type MergedParserOptions = Omit<Required<ParserOptions>, OptionalOptions> & Pick<ParserOptions, OptionalOptions>;
  507. export declare type Namespace = number;
  508. export declare const enum Namespaces {
  509. HTML = 0
  510. }
  511. declare interface Node_2 {
  512. type: NodeTypes;
  513. loc: SourceLocation;
  514. }
  515. export { Node_2 as Node }
  516. export declare type NodeTransform = (node: RootNode | TemplateChildNode, context: TransformContext) => void | (() => void) | (() => void)[];
  517. export declare const enum NodeTypes {
  518. ROOT = 0,
  519. ELEMENT = 1,
  520. TEXT = 2,
  521. COMMENT = 3,
  522. SIMPLE_EXPRESSION = 4,
  523. INTERPOLATION = 5,
  524. ATTRIBUTE = 6,
  525. DIRECTIVE = 7,
  526. COMPOUND_EXPRESSION = 8,
  527. IF = 9,
  528. IF_BRANCH = 10,
  529. FOR = 11,
  530. TEXT_CALL = 12,
  531. VNODE_CALL = 13,
  532. JS_CALL_EXPRESSION = 14,
  533. JS_OBJECT_EXPRESSION = 15,
  534. JS_PROPERTY = 16,
  535. JS_ARRAY_EXPRESSION = 17,
  536. JS_FUNCTION_EXPRESSION = 18,
  537. JS_CONDITIONAL_EXPRESSION = 19,
  538. JS_CACHE_EXPRESSION = 20,
  539. JS_BLOCK_STATEMENT = 21,
  540. JS_TEMPLATE_LITERAL = 22,
  541. JS_IF_STATEMENT = 23,
  542. JS_ASSIGNMENT_EXPRESSION = 24,
  543. JS_SEQUENCE_EXPRESSION = 25,
  544. JS_RETURN_STATEMENT = 26
  545. }
  546. export declare const noopDirectiveTransform: DirectiveTransform;
  547. export declare const NORMALIZE_CLASS: unique symbol;
  548. export declare const NORMALIZE_PROPS: unique symbol;
  549. export declare const NORMALIZE_STYLE: unique symbol;
  550. export declare interface ObjectExpression extends Node_2 {
  551. type: NodeTypes.JS_OBJECT_EXPRESSION;
  552. properties: Array<Property>;
  553. }
  554. export declare const OPEN_BLOCK: unique symbol;
  555. declare type OptionalOptions = 'whitespace' | 'isNativeTag' | 'isBuiltInComponent' | keyof CompilerCompatOptions;
  556. declare type ParentNode_2 = RootNode | ElementNode | IfBranchNode | ForNode;
  557. export { ParentNode_2 as ParentNode }
  558. declare interface ParserContext {
  559. options: MergedParserOptions;
  560. readonly originalSource: string;
  561. source: string;
  562. offset: number;
  563. line: number;
  564. column: number;
  565. inPre: boolean;
  566. inVPre: boolean;
  567. onWarn: NonNullable<ErrorHandlingOptions['onWarn']>;
  568. }
  569. export declare interface ParserOptions extends ErrorHandlingOptions, CompilerCompatOptions {
  570. /**
  571. * e.g. platform native elements, e.g. `<div>` for browsers
  572. */
  573. isNativeTag?: (tag: string) => boolean;
  574. /**
  575. * e.g. native elements that can self-close, e.g. `<img>`, `<br>`, `<hr>`
  576. */
  577. isVoidTag?: (tag: string) => boolean;
  578. /**
  579. * e.g. elements that should preserve whitespace inside, e.g. `<pre>`
  580. */
  581. isPreTag?: (tag: string) => boolean;
  582. /**
  583. * Platform-specific built-in components e.g. `<Transition>`
  584. */
  585. isBuiltInComponent?: (tag: string) => symbol | void;
  586. /**
  587. * Separate option for end users to extend the native elements list
  588. */
  589. isCustomElement?: (tag: string) => boolean | void;
  590. /**
  591. * Get tag namespace
  592. */
  593. getNamespace?: (tag: string, parent: ElementNode | undefined) => Namespace;
  594. /**
  595. * Get text parsing mode for this element
  596. */
  597. getTextMode?: (node: ElementNode, parent: ElementNode | undefined) => TextModes;
  598. /**
  599. * @default ['{{', '}}']
  600. */
  601. delimiters?: [string, string];
  602. /**
  603. * Whitespace handling strategy
  604. */
  605. whitespace?: 'preserve' | 'condense';
  606. /**
  607. * Only needed for DOM compilers
  608. */
  609. decodeEntities?: (rawText: string, asAttr: boolean) => string;
  610. /**
  611. * Whether to keep comments in the templates AST.
  612. * This defaults to `true` in development and `false` in production builds.
  613. */
  614. comments?: boolean;
  615. }
  616. export declare interface PlainElementNode extends BaseElementNode {
  617. tagType: ElementTypes.ELEMENT;
  618. codegenNode: VNodeCall | SimpleExpressionNode | CacheExpression | MemoExpression | undefined;
  619. ssrCodegenNode?: TemplateLiteral;
  620. }
  621. export declare const POP_SCOPE_ID: unique symbol;
  622. export declare interface Position {
  623. offset: number;
  624. line: number;
  625. column: number;
  626. }
  627. export declare function processExpression(node: SimpleExpressionNode, context: TransformContext, asParams?: boolean, asRawStatements?: boolean): ExpressionNode;
  628. export declare function processFor(node: ElementNode, dir: DirectiveNode, context: TransformContext, processCodegen?: (forNode: ForNode) => (() => void) | undefined): (() => void) | undefined;
  629. export declare function processIf(node: ElementNode, dir: DirectiveNode, context: TransformContext, processCodegen?: (node: IfNode, branch: IfBranchNode, isRoot: boolean) => (() => void) | undefined): (() => void) | undefined;
  630. export declare function processSlotOutlet(node: SlotOutletNode, context: TransformContext): SlotOutletProcessResult;
  631. export declare interface Property extends Node_2 {
  632. type: NodeTypes.JS_PROPERTY;
  633. key: ExpressionNode;
  634. value: JSChildNode;
  635. }
  636. declare type PropsExpression = ObjectExpression | CallExpression | ExpressionNode;
  637. export declare const PUSH_SCOPE_ID: unique symbol;
  638. export declare function registerRuntimeHelpers(helpers: any): void;
  639. export declare const RENDER_LIST: unique symbol;
  640. export declare const RENDER_SLOT: unique symbol;
  641. export declare interface RenderSlotCall extends CallExpression {
  642. callee: typeof RENDER_SLOT;
  643. arguments: [string, string | ExpressionNode] | [string, string | ExpressionNode, PropsExpression] | [
  644. string,
  645. string | ExpressionNode,
  646. PropsExpression | '{}',
  647. TemplateChildNode[]
  648. ];
  649. }
  650. export declare const RESOLVE_COMPONENT: unique symbol;
  651. export declare const RESOLVE_DIRECTIVE: unique symbol;
  652. export declare const RESOLVE_DYNAMIC_COMPONENT: unique symbol;
  653. export declare const RESOLVE_FILTER: unique symbol;
  654. export declare function resolveComponentType(node: ComponentNode, context: TransformContext, ssr?: boolean): string | symbol | CallExpression;
  655. export declare interface ReturnStatement extends Node_2 {
  656. type: NodeTypes.JS_RETURN_STATEMENT;
  657. returns: TemplateChildNode | TemplateChildNode[] | JSChildNode;
  658. }
  659. export declare interface RootNode extends Node_2 {
  660. type: NodeTypes.ROOT;
  661. children: TemplateChildNode[];
  662. helpers: symbol[];
  663. components: string[];
  664. directives: string[];
  665. hoists: (JSChildNode | null)[];
  666. imports: ImportItem[];
  667. cached: number;
  668. temps: number;
  669. ssrHelpers?: symbol[];
  670. codegenNode?: TemplateChildNode | JSChildNode | BlockStatement;
  671. filters?: string[];
  672. }
  673. export declare interface SequenceExpression extends Node_2 {
  674. type: NodeTypes.JS_SEQUENCE_EXPRESSION;
  675. expressions: JSChildNode[];
  676. }
  677. export declare const SET_BLOCK_TRACKING: unique symbol;
  678. declare interface SharedTransformCodegenOptions {
  679. /**
  680. * Transform expressions like {{ foo }} to `_ctx.foo`.
  681. * If this option is false, the generated code will be wrapped in a
  682. * `with (this) { ... }` block.
  683. * - This is force-enabled in module mode, since modules are by default strict
  684. * and cannot use `with`
  685. * @default mode === 'module'
  686. */
  687. prefixIdentifiers?: boolean;
  688. /**
  689. * Control whether generate SSR-optimized render functions instead.
  690. * The resulting function must be attached to the component via the
  691. * `ssrRender` option instead of `render`.
  692. *
  693. * When compiler generates code for SSR's fallback branch, we need to set it to false:
  694. * - context.ssr = false
  695. *
  696. * see `subTransform` in `ssrTransformCompoent.ts`
  697. */
  698. ssr?: boolean;
  699. /**
  700. * Indicates whether the compiler generates code for SSR,
  701. * it is always true when generating code for SSR,
  702. * regardless of whether we are generating code for SSR's fallback branch,
  703. * this means that when the compiler generates code for SSR's fallback branch:
  704. * - context.ssr = false
  705. * - context.inSSR = true
  706. */
  707. inSSR?: boolean;
  708. /**
  709. * Optional binding metadata analyzed from script - used to optimize
  710. * binding access when `prefixIdentifiers` is enabled.
  711. */
  712. bindingMetadata?: BindingMetadata;
  713. /**
  714. * Compile the function for inlining inside setup().
  715. * This allows the function to directly access setup() local bindings.
  716. */
  717. inline?: boolean;
  718. /**
  719. * Indicates that transforms and codegen should try to output valid TS code
  720. */
  721. isTS?: boolean;
  722. /**
  723. * Filename for source map generation.
  724. * Also used for self-recursive reference in templates
  725. * @default 'template.vue.html'
  726. */
  727. filename?: string;
  728. }
  729. export declare interface SimpleExpressionNode extends Node_2 {
  730. type: NodeTypes.SIMPLE_EXPRESSION;
  731. content: string;
  732. isStatic: boolean;
  733. constType: ConstantTypes;
  734. /**
  735. * Indicates this is an identifier for a hoist vnode call and points to the
  736. * hoisted node.
  737. */
  738. hoisted?: JSChildNode;
  739. /**
  740. * an expression parsed as the params of a function will track
  741. * the identifiers declared inside the function body.
  742. */
  743. identifiers?: string[];
  744. isHandlerKey?: boolean;
  745. }
  746. export declare type SlotFnBuilder = (slotProps: ExpressionNode | undefined, slotChildren: TemplateChildNode[], loc: SourceLocation) => FunctionExpression;
  747. export declare interface SlotFunctionExpression extends FunctionExpression {
  748. returns: TemplateChildNode[];
  749. }
  750. export declare interface SlotOutletNode extends BaseElementNode {
  751. tagType: ElementTypes.SLOT;
  752. codegenNode: RenderSlotCall | CacheExpression | undefined;
  753. ssrCodegenNode?: CallExpression;
  754. }
  755. declare interface SlotOutletProcessResult {
  756. slotName: string | ExpressionNode;
  757. slotProps: PropsExpression | undefined;
  758. }
  759. export declare type SlotsExpression = SlotsObjectExpression | DynamicSlotsExpression;
  760. export declare interface SlotsObjectExpression extends ObjectExpression {
  761. properties: SlotsObjectProperty[];
  762. }
  763. export declare interface SlotsObjectProperty extends Property {
  764. value: SlotFunctionExpression;
  765. }
  766. export declare interface SourceLocation {
  767. start: Position;
  768. end: Position;
  769. source: string;
  770. }
  771. export declare type SSRCodegenNode = BlockStatement | TemplateLiteral | IfStatement | AssignmentExpression | ReturnStatement | SequenceExpression;
  772. export declare type StructuralDirectiveTransform = (node: ElementNode, dir: DirectiveNode, context: TransformContext) => void | (() => void);
  773. export declare const SUSPENSE: unique symbol;
  774. export declare const TELEPORT: unique symbol;
  775. export declare type TemplateChildNode = ElementNode | InterpolationNode | CompoundExpressionNode | TextNode | CommentNode | IfNode | IfBranchNode | ForNode | TextCallNode;
  776. export declare interface TemplateLiteral extends Node_2 {
  777. type: NodeTypes.JS_TEMPLATE_LITERAL;
  778. elements: (string | JSChildNode)[];
  779. }
  780. export declare interface TemplateNode extends BaseElementNode {
  781. tagType: ElementTypes.TEMPLATE;
  782. codegenNode: undefined;
  783. }
  784. export declare type TemplateTextChildNode = TextNode | InterpolationNode | CompoundExpressionNode;
  785. export declare interface TextCallNode extends Node_2 {
  786. type: NodeTypes.TEXT_CALL;
  787. content: TextNode | InterpolationNode | CompoundExpressionNode;
  788. codegenNode: CallExpression | SimpleExpressionNode;
  789. }
  790. export declare const enum TextModes {
  791. DATA = 0,
  792. RCDATA = 1,
  793. RAWTEXT = 2,
  794. CDATA = 3,
  795. ATTRIBUTE_VALUE = 4
  796. }
  797. export declare interface TextNode extends Node_2 {
  798. type: NodeTypes.TEXT;
  799. content: string;
  800. }
  801. export declare const TO_DISPLAY_STRING: unique symbol;
  802. export declare const TO_HANDLER_KEY: unique symbol;
  803. export declare const TO_HANDLERS: unique symbol;
  804. export declare function toValidAssetId(name: string, type: 'component' | 'directive' | 'filter'): string;
  805. export declare const trackSlotScopes: NodeTransform;
  806. export declare const trackVForSlotScopes: NodeTransform;
  807. export declare function transform(root: RootNode, options: TransformOptions): void;
  808. export declare const transformBind: DirectiveTransform;
  809. export declare interface TransformContext extends Required<Omit<TransformOptions, 'filename' | keyof CompilerCompatOptions>>, CompilerCompatOptions {
  810. selfName: string | null;
  811. root: RootNode;
  812. helpers: Map<symbol, number>;
  813. components: Set<string>;
  814. directives: Set<string>;
  815. hoists: (JSChildNode | null)[];
  816. imports: ImportItem[];
  817. temps: number;
  818. cached: number;
  819. identifiers: {
  820. [name: string]: number | undefined;
  821. };
  822. scopes: {
  823. vFor: number;
  824. vSlot: number;
  825. vPre: number;
  826. vOnce: number;
  827. };
  828. parent: ParentNode_2 | null;
  829. childIndex: number;
  830. currentNode: RootNode | TemplateChildNode | null;
  831. inVOnce: boolean;
  832. helper<T extends symbol>(name: T): T;
  833. removeHelper<T extends symbol>(name: T): void;
  834. helperString(name: symbol): string;
  835. replaceNode(node: TemplateChildNode): void;
  836. removeNode(node?: TemplateChildNode): void;
  837. onNodeRemoved(): void;
  838. addIdentifiers(exp: ExpressionNode | string): void;
  839. removeIdentifiers(exp: ExpressionNode | string): void;
  840. hoist(exp: string | JSChildNode | ArrayExpression): SimpleExpressionNode;
  841. cache<T extends JSChildNode>(exp: T, isVNode?: boolean): CacheExpression | T;
  842. constantCache: Map<TemplateChildNode, ConstantTypes>;
  843. filters?: Set<string>;
  844. }
  845. export declare const transformElement: NodeTransform;
  846. export declare const transformExpression: NodeTransform;
  847. export declare const transformModel: DirectiveTransform;
  848. export declare const transformOn: DirectiveTransform;
  849. export declare interface TransformOptions extends SharedTransformCodegenOptions, ErrorHandlingOptions, CompilerCompatOptions {
  850. /**
  851. * An array of node transforms to be applied to every AST node.
  852. */
  853. nodeTransforms?: NodeTransform[];
  854. /**
  855. * An object of { name: transform } to be applied to every directive attribute
  856. * node found on element nodes.
  857. */
  858. directiveTransforms?: Record<string, DirectiveTransform | undefined>;
  859. /**
  860. * An optional hook to transform a node being hoisted.
  861. * used by compiler-dom to turn hoisted nodes into stringified HTML vnodes.
  862. * @default null
  863. */
  864. transformHoist?: HoistTransform | null;
  865. /**
  866. * If the pairing runtime provides additional built-in elements, use this to
  867. * mark them as built-in so the compiler will generate component vnodes
  868. * for them.
  869. */
  870. isBuiltInComponent?: (tag: string) => symbol | void;
  871. /**
  872. * Used by some transforms that expects only native elements
  873. */
  874. isCustomElement?: (tag: string) => boolean | void;
  875. /**
  876. * Transform expressions like {{ foo }} to `_ctx.foo`.
  877. * If this option is false, the generated code will be wrapped in a
  878. * `with (this) { ... }` block.
  879. * - This is force-enabled in module mode, since modules are by default strict
  880. * and cannot use `with`
  881. * @default mode === 'module'
  882. */
  883. prefixIdentifiers?: boolean;
  884. /**
  885. * Hoist static VNodes and props objects to `_hoisted_x` constants
  886. * @default false
  887. */
  888. hoistStatic?: boolean;
  889. /**
  890. * Cache v-on handlers to avoid creating new inline functions on each render,
  891. * also avoids the need for dynamically patching the handlers by wrapping it.
  892. * e.g `@click="foo"` by default is compiled to `{ onClick: foo }`. With this
  893. * option it's compiled to:
  894. * ```js
  895. * { onClick: _cache[0] || (_cache[0] = e => _ctx.foo(e)) }
  896. * ```
  897. * - Requires "prefixIdentifiers" to be enabled because it relies on scope
  898. * analysis to determine if a handler is safe to cache.
  899. * @default false
  900. */
  901. cacheHandlers?: boolean;
  902. /**
  903. * A list of parser plugins to enable for `@babel/parser`, which is used to
  904. * parse expressions in bindings and interpolations.
  905. * https://babeljs.io/docs/en/next/babel-parser#plugins
  906. */
  907. expressionPlugins?: ParserPlugin[];
  908. /**
  909. * SFC scoped styles ID
  910. */
  911. scopeId?: string | null;
  912. /**
  913. * Indicates this SFC template has used :slotted in its styles
  914. * Defaults to `true` for backwards compatibility - SFC tooling should set it
  915. * to `false` if no `:slotted` usage is detected in `<style>`
  916. */
  917. slotted?: boolean;
  918. /**
  919. * SFC `<style vars>` injection string
  920. * Should already be an object expression, e.g. `{ 'xxxx-color': color }`
  921. * needed to render inline CSS variables on component root
  922. */
  923. ssrCssVars?: string;
  924. }
  925. export declare type TransformPreset = [
  926. NodeTransform[],
  927. Record<string, DirectiveTransform>
  928. ];
  929. export declare function traverseNode(node: RootNode | TemplateChildNode, context: TransformContext): void;
  930. export declare const UNREF: unique symbol;
  931. export declare interface VNodeCall extends Node_2 {
  932. type: NodeTypes.VNODE_CALL;
  933. tag: string | symbol | CallExpression;
  934. props: PropsExpression | undefined;
  935. children: TemplateChildNode[] | TemplateTextChildNode | SlotsExpression | ForRenderListExpression | SimpleExpressionNode | undefined;
  936. patchFlag: string | undefined;
  937. dynamicProps: string | SimpleExpressionNode | undefined;
  938. directives: DirectiveArguments | undefined;
  939. isBlock: boolean;
  940. disableTracking: boolean;
  941. isComponent: boolean;
  942. }
  943. export declare function walkBlockDeclarations(block: BlockStatement_2 | Program, onIdent: (node: Identifier) => void): void;
  944. export declare function walkFunctionParams(node: Function_2, onIdent: (id: Identifier) => void): void;
  945. export declare function walkIdentifiers(root: Node_3, onIdentifier: (node: Identifier, parent: Node_3, parentStack: Node_3[], isReference: boolean, isLocal: boolean) => void, includeAll?: boolean, parentStack?: Node_3[], knownIds?: Record<string, number>): void;
  946. export declare function warnDeprecation(key: CompilerDeprecationTypes, context: ParserContext | TransformContext, loc: SourceLocation | null, ...args: any[]): void;
  947. export declare const WITH_CTX: unique symbol;
  948. export declare const WITH_DIRECTIVES: unique symbol;
  949. export declare const WITH_MEMO: unique symbol;
  950. export { }