@vue-jsx-vapor/compiler 2.6.6 → 2.6.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +629 -287
 - package/dist/index.d.cts +80 -22
 - package/dist/index.d.ts +80 -22
 - package/dist/index.js +594 -252
 - package/package.json +4 -3
 
    
        package/dist/index.d.cts
    CHANGED
    
    | 
         @@ -1,7 +1,14 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
            import {  
     | 
| 
       2 
     | 
    
         
            -
            import {  
     | 
| 
       3 
     | 
    
         
            -
            import {  
     | 
| 
      
 1 
     | 
    
         
            +
            import { JSXAttribute, JSXElement, JSXFragment, Node, SourceLocation } from "@babel/types";
         
     | 
| 
      
 2 
     | 
    
         
            +
            import { ParserPlugin } from "@babel/parser";
         
     | 
| 
      
 3 
     | 
    
         
            +
            import { RawSourceMap } from "source-map-js";
         
     | 
| 
       4 
4 
     | 
    
         | 
| 
      
 5 
     | 
    
         
            +
            //#region src/utils/error.d.ts
         
     | 
| 
      
 6 
     | 
    
         
            +
             
     | 
| 
      
 7 
     | 
    
         
            +
            interface CompilerError extends SyntaxError {
         
     | 
| 
      
 8 
     | 
    
         
            +
              code: number | string;
         
     | 
| 
      
 9 
     | 
    
         
            +
              loc?: SourceLocation | null;
         
     | 
| 
      
 10 
     | 
    
         
            +
            }
         
     | 
| 
      
 11 
     | 
    
         
            +
            //#endregion
         
     | 
| 
       5 
12 
     | 
    
         
             
            //#region src/transform.d.ts
         
     | 
| 
       6 
13 
     | 
    
         
             
            type NodeTransform = (node: BlockIRNode['node'], context: TransformContext<BlockIRNode['node']>) => void | (() => void) | (() => void)[];
         
     | 
| 
       7 
14 
     | 
    
         
             
            type DirectiveTransform = (dir: JSXAttribute, node: JSXElement, context: TransformContext<JSXElement>) => DirectiveTransformResult | void;
         
     | 
| 
         @@ -16,14 +23,31 @@ interface DirectiveTransformResult { 
     | 
|
| 
       16 
23 
     | 
    
         
             
              modelModifiers?: string[];
         
     | 
| 
       17 
24 
     | 
    
         
             
            }
         
     | 
| 
       18 
25 
     | 
    
         
             
            type StructuralDirectiveTransform = (node: JSXElement, dir: JSXAttribute, context: TransformContext) => void | (() => void);
         
     | 
| 
       19 
     | 
    
         
            -
            type TransformOptions =  
     | 
| 
      
 26 
     | 
    
         
            +
            type TransformOptions = CodegenOptions & {
         
     | 
| 
       20 
27 
     | 
    
         
             
              source?: string;
         
     | 
| 
       21 
     | 
    
         
            -
              templates?: string[];
         
     | 
| 
       22 
28 
     | 
    
         
             
              /**
         
     | 
| 
       23 
     | 
    
         
            -
               *  
     | 
| 
      
 29 
     | 
    
         
            +
               * Whether to compile components to createComponentWithFallback.
         
     | 
| 
       24 
30 
     | 
    
         
             
               * @default false
         
     | 
| 
       25 
31 
     | 
    
         
             
               */
         
     | 
| 
       26 
32 
     | 
    
         
             
              withFallback?: boolean;
         
     | 
| 
      
 33 
     | 
    
         
            +
              /**
         
     | 
| 
      
 34 
     | 
    
         
            +
               * Indicates that transforms and codegen should try to output valid TS code
         
     | 
| 
      
 35 
     | 
    
         
            +
               */
         
     | 
| 
      
 36 
     | 
    
         
            +
              isTS?: boolean;
         
     | 
| 
      
 37 
     | 
    
         
            +
              /**
         
     | 
| 
      
 38 
     | 
    
         
            +
               * An array of node transforms to be applied to every AST node.
         
     | 
| 
      
 39 
     | 
    
         
            +
               */
         
     | 
| 
      
 40 
     | 
    
         
            +
              nodeTransforms?: NodeTransform[];
         
     | 
| 
      
 41 
     | 
    
         
            +
              /**
         
     | 
| 
      
 42 
     | 
    
         
            +
               * An object of { name: transform } to be applied to every directive attribute
         
     | 
| 
      
 43 
     | 
    
         
            +
               * node found on element nodes.
         
     | 
| 
      
 44 
     | 
    
         
            +
               */
         
     | 
| 
      
 45 
     | 
    
         
            +
              directiveTransforms?: Record<string, DirectiveTransform | undefined>;
         
     | 
| 
      
 46 
     | 
    
         
            +
              /**
         
     | 
| 
      
 47 
     | 
    
         
            +
               * Separate option for end users to extend the native elements list
         
     | 
| 
      
 48 
     | 
    
         
            +
               */
         
     | 
| 
      
 49 
     | 
    
         
            +
              isCustomElement?: (tag: string) => boolean | void;
         
     | 
| 
      
 50 
     | 
    
         
            +
              onError?: (error: CompilerError) => void;
         
     | 
| 
       27 
51 
     | 
    
         
             
            };
         
     | 
| 
       28 
52 
     | 
    
         
             
            declare class TransformContext<T extends BlockIRNode['node'] = BlockIRNode['node']> {
         
     | 
| 
       29 
53 
     | 
    
         
             
              ir: RootIRNode;
         
     | 
| 
         @@ -32,13 +56,12 @@ declare class TransformContext<T extends BlockIRNode['node'] = BlockIRNode['node 
     | 
|
| 
       32 
56 
     | 
    
         
             
              root: TransformContext<RootNode>;
         
     | 
| 
       33 
57 
     | 
    
         
             
              index: number;
         
     | 
| 
       34 
58 
     | 
    
         
             
              block: BlockIRNode;
         
     | 
| 
       35 
     | 
    
         
            -
              options: Required< 
     | 
| 
      
 59 
     | 
    
         
            +
              options: Required<TransformOptions>;
         
     | 
| 
       36 
60 
     | 
    
         
             
              template: string;
         
     | 
| 
       37 
61 
     | 
    
         
             
              childrenTemplate: (string | null)[];
         
     | 
| 
       38 
62 
     | 
    
         
             
              dynamic: IRDynamicInfo;
         
     | 
| 
       39 
63 
     | 
    
         
             
              inVOnce: boolean;
         
     | 
| 
       40 
64 
     | 
    
         
             
              inVFor: number;
         
     | 
| 
       41 
     | 
    
         
            -
              comment: CommentNode[];
         
     | 
| 
       42 
65 
     | 
    
         
             
              component: Set<string>;
         
     | 
| 
       43 
66 
     | 
    
         
             
              directive: Set<string>;
         
     | 
| 
       44 
67 
     | 
    
         
             
              slots: IRSlots[];
         
     | 
| 
         @@ -57,6 +80,14 @@ declare function transform(node: RootNode, options?: TransformOptions): RootIRNo 
     | 
|
| 
       57 
80 
     | 
    
         
             
            declare function transformNode(context: TransformContext<BlockIRNode['node']>): void;
         
     | 
| 
       58 
81 
     | 
    
         
             
            declare function createStructuralDirectiveTransform(name: string | string[], fn: StructuralDirectiveTransform): NodeTransform;
         
     | 
| 
       59 
82 
     | 
    
         
             
            //#endregion
         
     | 
| 
      
 83 
     | 
    
         
            +
            //#region src/utils/expression.d.ts
         
     | 
| 
      
 84 
     | 
    
         
            +
            interface SimpleExpressionNode {
         
     | 
| 
      
 85 
     | 
    
         
            +
              content: string;
         
     | 
| 
      
 86 
     | 
    
         
            +
              isStatic: boolean;
         
     | 
| 
      
 87 
     | 
    
         
            +
              loc: SourceLocation | null | undefined;
         
     | 
| 
      
 88 
     | 
    
         
            +
              ast?: Node;
         
     | 
| 
      
 89 
     | 
    
         
            +
            }
         
     | 
| 
      
 90 
     | 
    
         
            +
            //#endregion
         
     | 
| 
       60 
91 
     | 
    
         
             
            //#region src/ir/component.d.ts
         
     | 
| 
       61 
92 
     | 
    
         
             
            interface IRProp extends Omit<DirectiveTransformResult, 'value'> {
         
     | 
| 
       62 
93 
     | 
    
         
             
              values: SimpleExpressionNode[];
         
     | 
| 
         @@ -220,6 +251,7 @@ interface SetTextIRNode extends BaseIRNode { 
     | 
|
| 
       220 
251 
     | 
    
         
             
            interface SetNodesIRNode extends BaseIRNode {
         
     | 
| 
       221 
252 
     | 
    
         
             
              type: IRNodeTypes.SET_NODES;
         
     | 
| 
       222 
253 
     | 
    
         
             
              element: number;
         
     | 
| 
      
 254 
     | 
    
         
            +
              once: boolean;
         
     | 
| 
       223 
255 
     | 
    
         
             
              values: SimpleExpressionNode[];
         
     | 
| 
       224 
256 
     | 
    
         
             
              generated?: boolean;
         
     | 
| 
       225 
257 
     | 
    
         
             
            }
         
     | 
| 
         @@ -254,6 +286,7 @@ interface SetTemplateRefIRNode extends BaseIRNode { 
     | 
|
| 
       254 
286 
     | 
    
         
             
            interface CreateNodesIRNode extends BaseIRNode {
         
     | 
| 
       255 
287 
     | 
    
         
             
              type: IRNodeTypes.CREATE_NODES;
         
     | 
| 
       256 
288 
     | 
    
         
             
              id: number;
         
     | 
| 
      
 289 
     | 
    
         
            +
              once: boolean;
         
     | 
| 
       257 
290 
     | 
    
         
             
              values?: SimpleExpressionNode[];
         
     | 
| 
       258 
291 
     | 
    
         
             
            }
         
     | 
| 
       259 
292 
     | 
    
         
             
            interface InsertNodeIRNode extends BaseIRNode {
         
     | 
| 
         @@ -270,7 +303,7 @@ interface PrependNodeIRNode extends BaseIRNode { 
     | 
|
| 
       270 
303 
     | 
    
         
             
            interface DirectiveIRNode extends BaseIRNode {
         
     | 
| 
       271 
304 
     | 
    
         
             
              type: IRNodeTypes.DIRECTIVE;
         
     | 
| 
       272 
305 
     | 
    
         
             
              element: number;
         
     | 
| 
       273 
     | 
    
         
            -
              dir:  
     | 
| 
      
 306 
     | 
    
         
            +
              dir: DirectiveNode;
         
     | 
| 
       274 
307 
     | 
    
         
             
              name: string;
         
     | 
| 
       275 
308 
     | 
    
         
             
              builtin?: boolean;
         
     | 
| 
       276 
309 
     | 
    
         
             
              asset?: boolean;
         
     | 
| 
         @@ -336,20 +369,43 @@ interface IREffect { 
     | 
|
| 
       336 
369 
     | 
    
         
             
              expressions: SimpleExpressionNode[];
         
     | 
| 
       337 
370 
     | 
    
         
             
              operations: OperationNode[];
         
     | 
| 
       338 
371 
     | 
    
         
             
            }
         
     | 
| 
       339 
     | 
    
         
            -
            type Overwrite<T, U> = Pick<T, Exclude<keyof T, keyof U>> & Pick<U, Extract<keyof U, keyof T>>;
         
     | 
| 
       340 
     | 
    
         
            -
            type HackOptions<T> = Prettify<Overwrite<T, {
         
     | 
| 
       341 
     | 
    
         
            -
              nodeTransforms?: NodeTransform[];
         
     | 
| 
       342 
     | 
    
         
            -
              directiveTransforms?: Record<string, DirectiveTransform | undefined>;
         
     | 
| 
       343 
     | 
    
         
            -
            }>>;
         
     | 
| 
       344 
     | 
    
         
            -
            type VaporDirectiveNode = Overwrite<DirectiveNode, {
         
     | 
| 
       345 
     | 
    
         
            -
              exp: Exclude<DirectiveNode['exp'], CompoundExpressionNode>;
         
     | 
| 
       346 
     | 
    
         
            -
              arg: Exclude<DirectiveNode['arg'], CompoundExpressionNode>;
         
     | 
| 
       347 
     | 
    
         
            -
            }>;
         
     | 
| 
       348 
372 
     | 
    
         
             
            type InsertionStateTypes = IfIRNode | ForIRNode | SlotOutletIRNode | CreateComponentIRNode;
         
     | 
| 
       349 
373 
     | 
    
         
             
            declare function isBlockOperation(op: OperationNode): op is InsertionStateTypes;
         
     | 
| 
      
 374 
     | 
    
         
            +
            interface DirectiveNode {
         
     | 
| 
      
 375 
     | 
    
         
            +
              /**
         
     | 
| 
      
 376 
     | 
    
         
            +
               * the normalized name without prefix or shorthands, e.g. "bind", "on"
         
     | 
| 
      
 377 
     | 
    
         
            +
               */
         
     | 
| 
      
 378 
     | 
    
         
            +
              name: string;
         
     | 
| 
      
 379 
     | 
    
         
            +
              /**
         
     | 
| 
      
 380 
     | 
    
         
            +
               * the raw attribute name, preserving shorthand, and including arg & modifiers
         
     | 
| 
      
 381 
     | 
    
         
            +
               * this is only used during parse.
         
     | 
| 
      
 382 
     | 
    
         
            +
               */
         
     | 
| 
      
 383 
     | 
    
         
            +
              rawName?: string;
         
     | 
| 
      
 384 
     | 
    
         
            +
              exp: SimpleExpressionNode | undefined;
         
     | 
| 
      
 385 
     | 
    
         
            +
              arg: SimpleExpressionNode | undefined;
         
     | 
| 
      
 386 
     | 
    
         
            +
              modifiers: SimpleExpressionNode[];
         
     | 
| 
      
 387 
     | 
    
         
            +
              loc: SourceLocation;
         
     | 
| 
      
 388 
     | 
    
         
            +
            }
         
     | 
| 
       350 
389 
     | 
    
         
             
            //#endregion
         
     | 
| 
       351 
390 
     | 
    
         
             
            //#region src/generate.d.ts
         
     | 
| 
       352 
     | 
    
         
            -
            type CodegenOptions =  
     | 
| 
      
 391 
     | 
    
         
            +
            type CodegenOptions = {
         
     | 
| 
      
 392 
     | 
    
         
            +
              /**
         
     | 
| 
      
 393 
     | 
    
         
            +
               * Generate source map?
         
     | 
| 
      
 394 
     | 
    
         
            +
               * @default false
         
     | 
| 
      
 395 
     | 
    
         
            +
               */
         
     | 
| 
      
 396 
     | 
    
         
            +
              sourceMap?: boolean;
         
     | 
| 
      
 397 
     | 
    
         
            +
              /**
         
     | 
| 
      
 398 
     | 
    
         
            +
               * Filename for source map generation.
         
     | 
| 
      
 399 
     | 
    
         
            +
               * Also used for self-recursive reference in templates
         
     | 
| 
      
 400 
     | 
    
         
            +
               * @default 'index.jsx'
         
     | 
| 
      
 401 
     | 
    
         
            +
               */
         
     | 
| 
      
 402 
     | 
    
         
            +
              filename?: string;
         
     | 
| 
      
 403 
     | 
    
         
            +
              /**
         
     | 
| 
      
 404 
     | 
    
         
            +
               * A list of parser plugins to enable for `@babel/parser`, which is used to
         
     | 
| 
      
 405 
     | 
    
         
            +
               * parse expressions in bindings and interpolations.
         
     | 
| 
      
 406 
     | 
    
         
            +
               * https://babeljs.io/docs/en/next/babel-parser#plugins
         
     | 
| 
      
 407 
     | 
    
         
            +
               */
         
     | 
| 
      
 408 
     | 
    
         
            +
              expressionPlugins?: ParserPlugin[];
         
     | 
| 
       353 
409 
     | 
    
         
             
              templates?: string[];
         
     | 
| 
       354 
410 
     | 
    
         
             
            };
         
     | 
| 
       355 
411 
     | 
    
         
             
            declare class CodegenContext {
         
     | 
| 
         @@ -366,17 +422,19 @@ declare class CodegenContext { 
     | 
|
| 
       366 
422 
     | 
    
         
             
              enterScope(): [level: number, exit: () => number];
         
     | 
| 
       367 
423 
     | 
    
         
             
              constructor(ir: RootIRNode, options: CodegenOptions);
         
     | 
| 
       368 
424 
     | 
    
         
             
            }
         
     | 
| 
       369 
     | 
    
         
            -
            interface VaporCodegenResult  
     | 
| 
      
 425 
     | 
    
         
            +
            interface VaporCodegenResult {
         
     | 
| 
       370 
426 
     | 
    
         
             
              ast: RootIRNode;
         
     | 
| 
       371 
427 
     | 
    
         
             
              helpers: Set<string>;
         
     | 
| 
       372 
428 
     | 
    
         
             
              templates: string[];
         
     | 
| 
       373 
429 
     | 
    
         
             
              delegates: Set<string>;
         
     | 
| 
      
 430 
     | 
    
         
            +
              code: string;
         
     | 
| 
      
 431 
     | 
    
         
            +
              map?: RawSourceMap;
         
     | 
| 
       374 
432 
     | 
    
         
             
            }
         
     | 
| 
       375 
433 
     | 
    
         
             
            declare function generate(ir: RootIRNode, options?: CodegenOptions): VaporCodegenResult;
         
     | 
| 
       376 
434 
     | 
    
         
             
            //#endregion
         
     | 
| 
       377 
435 
     | 
    
         
             
            //#region src/compile.d.ts
         
     | 
| 
       378 
436 
     | 
    
         
             
            declare function compile(source: JSXElement | JSXFragment | string, options?: CompilerOptions): VaporCodegenResult;
         
     | 
| 
       379 
     | 
    
         
            -
            type CompilerOptions =  
     | 
| 
      
 437 
     | 
    
         
            +
            type CompilerOptions = TransformOptions;
         
     | 
| 
       380 
438 
     | 
    
         
             
            type TransformPreset = [NodeTransform[], Record<string, DirectiveTransform>];
         
     | 
| 
       381 
439 
     | 
    
         
             
            //#endregion
         
     | 
| 
       382 
440 
     | 
    
         
             
            //#region src/transforms/transformText.d.ts
         
     | 
| 
         @@ -424,4 +482,4 @@ declare const transformVOnce: NodeTransform; 
     | 
|
| 
       424 
482 
     | 
    
         
             
            //#region src/transforms/vText.d.ts
         
     | 
| 
       425 
483 
     | 
    
         
             
            declare const transformVText: DirectiveTransform;
         
     | 
| 
       426 
484 
     | 
    
         
             
            //#endregion
         
     | 
| 
       427 
     | 
    
         
            -
            export { BaseIRNode, BlockIRNode, CodegenContext, CodegenOptions, CompilerOptions, CreateComponentIRNode, CreateNodesIRNode, DeclareOldRefIRNode, DirectiveIRNode, DirectiveTransform, DirectiveTransformResult, DynamicFlag, ForIRNode, GetTextChildIRNode,  
     | 
| 
      
 485 
     | 
    
         
            +
            export { BaseIRNode, BlockIRNode, CodegenContext, CodegenOptions, CompilerOptions, CreateComponentIRNode, CreateNodesIRNode, DeclareOldRefIRNode, DirectiveIRNode, DirectiveNode, DirectiveTransform, DirectiveTransformResult, DynamicFlag, ForIRNode, GetTextChildIRNode, IRDynamicInfo, IRDynamicPropsKind, IREffect, IRFor, IRNode, IRNodeTypes, IRProp, IRProps, IRPropsDynamicAttribute, IRPropsDynamicExpression, IRPropsStatic, IRSlotDynamic, IRSlotDynamicBasic, IRSlotDynamicConditional, IRSlotDynamicLoop, IRSlotType, IRSlots, IRSlotsExpression, IRSlotsStatic, IfIRNode, InsertNodeIRNode, InsertionStateTypes, KeyOverride, NodeTransform, OperationNode, PrependNodeIRNode, RootIRNode, RootNode, SetDynamicEventsIRNode, SetDynamicPropsIRNode, SetEventIRNode, SetHtmlIRNode, SetNodesIRNode, SetPropIRNode, SetTemplateRefIRNode, SetTextIRNode, SlotBlockIRNode, SlotOutletIRNode, StructuralDirectiveTransform, TransformContext, TransformOptions, TransformPreset, VaporCodegenResult, compile, createStructuralDirectiveTransform, generate, isBlockOperation, transform, transformChildren, transformElement, transformNode, transformTemplateRef, transformText, transformVBind, transformVFor, transformVHtml, transformVIf, transformVModel, transformVOn, transformVOnce, transformVShow, transformVSlot, transformVSlots, transformVText };
         
     | 
    
        package/dist/index.d.ts
    CHANGED
    
    | 
         @@ -1,7 +1,14 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
            import {  
     | 
| 
       2 
     | 
    
         
            -
            import {  
     | 
| 
       3 
     | 
    
         
            -
            import { JSXAttribute, JSXElement, JSXFragment, Node } from "@babel/types";
         
     | 
| 
      
 1 
     | 
    
         
            +
            import { ParserPlugin } from "@babel/parser";
         
     | 
| 
      
 2 
     | 
    
         
            +
            import { RawSourceMap } from "source-map-js";
         
     | 
| 
      
 3 
     | 
    
         
            +
            import { JSXAttribute, JSXElement, JSXFragment, Node, SourceLocation } from "@babel/types";
         
     | 
| 
       4 
4 
     | 
    
         | 
| 
      
 5 
     | 
    
         
            +
            //#region src/utils/error.d.ts
         
     | 
| 
      
 6 
     | 
    
         
            +
             
     | 
| 
      
 7 
     | 
    
         
            +
            interface CompilerError extends SyntaxError {
         
     | 
| 
      
 8 
     | 
    
         
            +
              code: number | string;
         
     | 
| 
      
 9 
     | 
    
         
            +
              loc?: SourceLocation | null;
         
     | 
| 
      
 10 
     | 
    
         
            +
            }
         
     | 
| 
      
 11 
     | 
    
         
            +
            //#endregion
         
     | 
| 
       5 
12 
     | 
    
         
             
            //#region src/transform.d.ts
         
     | 
| 
       6 
13 
     | 
    
         
             
            type NodeTransform = (node: BlockIRNode['node'], context: TransformContext<BlockIRNode['node']>) => void | (() => void) | (() => void)[];
         
     | 
| 
       7 
14 
     | 
    
         
             
            type DirectiveTransform = (dir: JSXAttribute, node: JSXElement, context: TransformContext<JSXElement>) => DirectiveTransformResult | void;
         
     | 
| 
         @@ -16,14 +23,31 @@ interface DirectiveTransformResult { 
     | 
|
| 
       16 
23 
     | 
    
         
             
              modelModifiers?: string[];
         
     | 
| 
       17 
24 
     | 
    
         
             
            }
         
     | 
| 
       18 
25 
     | 
    
         
             
            type StructuralDirectiveTransform = (node: JSXElement, dir: JSXAttribute, context: TransformContext) => void | (() => void);
         
     | 
| 
       19 
     | 
    
         
            -
            type TransformOptions =  
     | 
| 
      
 26 
     | 
    
         
            +
            type TransformOptions = CodegenOptions & {
         
     | 
| 
       20 
27 
     | 
    
         
             
              source?: string;
         
     | 
| 
       21 
     | 
    
         
            -
              templates?: string[];
         
     | 
| 
       22 
28 
     | 
    
         
             
              /**
         
     | 
| 
       23 
     | 
    
         
            -
               *  
     | 
| 
      
 29 
     | 
    
         
            +
               * Whether to compile components to createComponentWithFallback.
         
     | 
| 
       24 
30 
     | 
    
         
             
               * @default false
         
     | 
| 
       25 
31 
     | 
    
         
             
               */
         
     | 
| 
       26 
32 
     | 
    
         
             
              withFallback?: boolean;
         
     | 
| 
      
 33 
     | 
    
         
            +
              /**
         
     | 
| 
      
 34 
     | 
    
         
            +
               * Indicates that transforms and codegen should try to output valid TS code
         
     | 
| 
      
 35 
     | 
    
         
            +
               */
         
     | 
| 
      
 36 
     | 
    
         
            +
              isTS?: boolean;
         
     | 
| 
      
 37 
     | 
    
         
            +
              /**
         
     | 
| 
      
 38 
     | 
    
         
            +
               * An array of node transforms to be applied to every AST node.
         
     | 
| 
      
 39 
     | 
    
         
            +
               */
         
     | 
| 
      
 40 
     | 
    
         
            +
              nodeTransforms?: NodeTransform[];
         
     | 
| 
      
 41 
     | 
    
         
            +
              /**
         
     | 
| 
      
 42 
     | 
    
         
            +
               * An object of { name: transform } to be applied to every directive attribute
         
     | 
| 
      
 43 
     | 
    
         
            +
               * node found on element nodes.
         
     | 
| 
      
 44 
     | 
    
         
            +
               */
         
     | 
| 
      
 45 
     | 
    
         
            +
              directiveTransforms?: Record<string, DirectiveTransform | undefined>;
         
     | 
| 
      
 46 
     | 
    
         
            +
              /**
         
     | 
| 
      
 47 
     | 
    
         
            +
               * Separate option for end users to extend the native elements list
         
     | 
| 
      
 48 
     | 
    
         
            +
               */
         
     | 
| 
      
 49 
     | 
    
         
            +
              isCustomElement?: (tag: string) => boolean | void;
         
     | 
| 
      
 50 
     | 
    
         
            +
              onError?: (error: CompilerError) => void;
         
     | 
| 
       27 
51 
     | 
    
         
             
            };
         
     | 
| 
       28 
52 
     | 
    
         
             
            declare class TransformContext<T extends BlockIRNode['node'] = BlockIRNode['node']> {
         
     | 
| 
       29 
53 
     | 
    
         
             
              ir: RootIRNode;
         
     | 
| 
         @@ -32,13 +56,12 @@ declare class TransformContext<T extends BlockIRNode['node'] = BlockIRNode['node 
     | 
|
| 
       32 
56 
     | 
    
         
             
              root: TransformContext<RootNode>;
         
     | 
| 
       33 
57 
     | 
    
         
             
              index: number;
         
     | 
| 
       34 
58 
     | 
    
         
             
              block: BlockIRNode;
         
     | 
| 
       35 
     | 
    
         
            -
              options: Required< 
     | 
| 
      
 59 
     | 
    
         
            +
              options: Required<TransformOptions>;
         
     | 
| 
       36 
60 
     | 
    
         
             
              template: string;
         
     | 
| 
       37 
61 
     | 
    
         
             
              childrenTemplate: (string | null)[];
         
     | 
| 
       38 
62 
     | 
    
         
             
              dynamic: IRDynamicInfo;
         
     | 
| 
       39 
63 
     | 
    
         
             
              inVOnce: boolean;
         
     | 
| 
       40 
64 
     | 
    
         
             
              inVFor: number;
         
     | 
| 
       41 
     | 
    
         
            -
              comment: CommentNode[];
         
     | 
| 
       42 
65 
     | 
    
         
             
              component: Set<string>;
         
     | 
| 
       43 
66 
     | 
    
         
             
              directive: Set<string>;
         
     | 
| 
       44 
67 
     | 
    
         
             
              slots: IRSlots[];
         
     | 
| 
         @@ -57,6 +80,14 @@ declare function transform(node: RootNode, options?: TransformOptions): RootIRNo 
     | 
|
| 
       57 
80 
     | 
    
         
             
            declare function transformNode(context: TransformContext<BlockIRNode['node']>): void;
         
     | 
| 
       58 
81 
     | 
    
         
             
            declare function createStructuralDirectiveTransform(name: string | string[], fn: StructuralDirectiveTransform): NodeTransform;
         
     | 
| 
       59 
82 
     | 
    
         
             
            //#endregion
         
     | 
| 
      
 83 
     | 
    
         
            +
            //#region src/utils/expression.d.ts
         
     | 
| 
      
 84 
     | 
    
         
            +
            interface SimpleExpressionNode {
         
     | 
| 
      
 85 
     | 
    
         
            +
              content: string;
         
     | 
| 
      
 86 
     | 
    
         
            +
              isStatic: boolean;
         
     | 
| 
      
 87 
     | 
    
         
            +
              loc: SourceLocation | null | undefined;
         
     | 
| 
      
 88 
     | 
    
         
            +
              ast?: Node;
         
     | 
| 
      
 89 
     | 
    
         
            +
            }
         
     | 
| 
      
 90 
     | 
    
         
            +
            //#endregion
         
     | 
| 
       60 
91 
     | 
    
         
             
            //#region src/ir/component.d.ts
         
     | 
| 
       61 
92 
     | 
    
         
             
            interface IRProp extends Omit<DirectiveTransformResult, 'value'> {
         
     | 
| 
       62 
93 
     | 
    
         
             
              values: SimpleExpressionNode[];
         
     | 
| 
         @@ -220,6 +251,7 @@ interface SetTextIRNode extends BaseIRNode { 
     | 
|
| 
       220 
251 
     | 
    
         
             
            interface SetNodesIRNode extends BaseIRNode {
         
     | 
| 
       221 
252 
     | 
    
         
             
              type: IRNodeTypes.SET_NODES;
         
     | 
| 
       222 
253 
     | 
    
         
             
              element: number;
         
     | 
| 
      
 254 
     | 
    
         
            +
              once: boolean;
         
     | 
| 
       223 
255 
     | 
    
         
             
              values: SimpleExpressionNode[];
         
     | 
| 
       224 
256 
     | 
    
         
             
              generated?: boolean;
         
     | 
| 
       225 
257 
     | 
    
         
             
            }
         
     | 
| 
         @@ -254,6 +286,7 @@ interface SetTemplateRefIRNode extends BaseIRNode { 
     | 
|
| 
       254 
286 
     | 
    
         
             
            interface CreateNodesIRNode extends BaseIRNode {
         
     | 
| 
       255 
287 
     | 
    
         
             
              type: IRNodeTypes.CREATE_NODES;
         
     | 
| 
       256 
288 
     | 
    
         
             
              id: number;
         
     | 
| 
      
 289 
     | 
    
         
            +
              once: boolean;
         
     | 
| 
       257 
290 
     | 
    
         
             
              values?: SimpleExpressionNode[];
         
     | 
| 
       258 
291 
     | 
    
         
             
            }
         
     | 
| 
       259 
292 
     | 
    
         
             
            interface InsertNodeIRNode extends BaseIRNode {
         
     | 
| 
         @@ -270,7 +303,7 @@ interface PrependNodeIRNode extends BaseIRNode { 
     | 
|
| 
       270 
303 
     | 
    
         
             
            interface DirectiveIRNode extends BaseIRNode {
         
     | 
| 
       271 
304 
     | 
    
         
             
              type: IRNodeTypes.DIRECTIVE;
         
     | 
| 
       272 
305 
     | 
    
         
             
              element: number;
         
     | 
| 
       273 
     | 
    
         
            -
              dir:  
     | 
| 
      
 306 
     | 
    
         
            +
              dir: DirectiveNode;
         
     | 
| 
       274 
307 
     | 
    
         
             
              name: string;
         
     | 
| 
       275 
308 
     | 
    
         
             
              builtin?: boolean;
         
     | 
| 
       276 
309 
     | 
    
         
             
              asset?: boolean;
         
     | 
| 
         @@ -336,20 +369,43 @@ interface IREffect { 
     | 
|
| 
       336 
369 
     | 
    
         
             
              expressions: SimpleExpressionNode[];
         
     | 
| 
       337 
370 
     | 
    
         
             
              operations: OperationNode[];
         
     | 
| 
       338 
371 
     | 
    
         
             
            }
         
     | 
| 
       339 
     | 
    
         
            -
            type Overwrite<T, U> = Pick<T, Exclude<keyof T, keyof U>> & Pick<U, Extract<keyof U, keyof T>>;
         
     | 
| 
       340 
     | 
    
         
            -
            type HackOptions<T> = Prettify<Overwrite<T, {
         
     | 
| 
       341 
     | 
    
         
            -
              nodeTransforms?: NodeTransform[];
         
     | 
| 
       342 
     | 
    
         
            -
              directiveTransforms?: Record<string, DirectiveTransform | undefined>;
         
     | 
| 
       343 
     | 
    
         
            -
            }>>;
         
     | 
| 
       344 
     | 
    
         
            -
            type VaporDirectiveNode = Overwrite<DirectiveNode, {
         
     | 
| 
       345 
     | 
    
         
            -
              exp: Exclude<DirectiveNode['exp'], CompoundExpressionNode>;
         
     | 
| 
       346 
     | 
    
         
            -
              arg: Exclude<DirectiveNode['arg'], CompoundExpressionNode>;
         
     | 
| 
       347 
     | 
    
         
            -
            }>;
         
     | 
| 
       348 
372 
     | 
    
         
             
            type InsertionStateTypes = IfIRNode | ForIRNode | SlotOutletIRNode | CreateComponentIRNode;
         
     | 
| 
       349 
373 
     | 
    
         
             
            declare function isBlockOperation(op: OperationNode): op is InsertionStateTypes;
         
     | 
| 
      
 374 
     | 
    
         
            +
            interface DirectiveNode {
         
     | 
| 
      
 375 
     | 
    
         
            +
              /**
         
     | 
| 
      
 376 
     | 
    
         
            +
               * the normalized name without prefix or shorthands, e.g. "bind", "on"
         
     | 
| 
      
 377 
     | 
    
         
            +
               */
         
     | 
| 
      
 378 
     | 
    
         
            +
              name: string;
         
     | 
| 
      
 379 
     | 
    
         
            +
              /**
         
     | 
| 
      
 380 
     | 
    
         
            +
               * the raw attribute name, preserving shorthand, and including arg & modifiers
         
     | 
| 
      
 381 
     | 
    
         
            +
               * this is only used during parse.
         
     | 
| 
      
 382 
     | 
    
         
            +
               */
         
     | 
| 
      
 383 
     | 
    
         
            +
              rawName?: string;
         
     | 
| 
      
 384 
     | 
    
         
            +
              exp: SimpleExpressionNode | undefined;
         
     | 
| 
      
 385 
     | 
    
         
            +
              arg: SimpleExpressionNode | undefined;
         
     | 
| 
      
 386 
     | 
    
         
            +
              modifiers: SimpleExpressionNode[];
         
     | 
| 
      
 387 
     | 
    
         
            +
              loc: SourceLocation;
         
     | 
| 
      
 388 
     | 
    
         
            +
            }
         
     | 
| 
       350 
389 
     | 
    
         
             
            //#endregion
         
     | 
| 
       351 
390 
     | 
    
         
             
            //#region src/generate.d.ts
         
     | 
| 
       352 
     | 
    
         
            -
            type CodegenOptions =  
     | 
| 
      
 391 
     | 
    
         
            +
            type CodegenOptions = {
         
     | 
| 
      
 392 
     | 
    
         
            +
              /**
         
     | 
| 
      
 393 
     | 
    
         
            +
               * Generate source map?
         
     | 
| 
      
 394 
     | 
    
         
            +
               * @default false
         
     | 
| 
      
 395 
     | 
    
         
            +
               */
         
     | 
| 
      
 396 
     | 
    
         
            +
              sourceMap?: boolean;
         
     | 
| 
      
 397 
     | 
    
         
            +
              /**
         
     | 
| 
      
 398 
     | 
    
         
            +
               * Filename for source map generation.
         
     | 
| 
      
 399 
     | 
    
         
            +
               * Also used for self-recursive reference in templates
         
     | 
| 
      
 400 
     | 
    
         
            +
               * @default 'index.jsx'
         
     | 
| 
      
 401 
     | 
    
         
            +
               */
         
     | 
| 
      
 402 
     | 
    
         
            +
              filename?: string;
         
     | 
| 
      
 403 
     | 
    
         
            +
              /**
         
     | 
| 
      
 404 
     | 
    
         
            +
               * A list of parser plugins to enable for `@babel/parser`, which is used to
         
     | 
| 
      
 405 
     | 
    
         
            +
               * parse expressions in bindings and interpolations.
         
     | 
| 
      
 406 
     | 
    
         
            +
               * https://babeljs.io/docs/en/next/babel-parser#plugins
         
     | 
| 
      
 407 
     | 
    
         
            +
               */
         
     | 
| 
      
 408 
     | 
    
         
            +
              expressionPlugins?: ParserPlugin[];
         
     | 
| 
       353 
409 
     | 
    
         
             
              templates?: string[];
         
     | 
| 
       354 
410 
     | 
    
         
             
            };
         
     | 
| 
       355 
411 
     | 
    
         
             
            declare class CodegenContext {
         
     | 
| 
         @@ -366,17 +422,19 @@ declare class CodegenContext { 
     | 
|
| 
       366 
422 
     | 
    
         
             
              enterScope(): [level: number, exit: () => number];
         
     | 
| 
       367 
423 
     | 
    
         
             
              constructor(ir: RootIRNode, options: CodegenOptions);
         
     | 
| 
       368 
424 
     | 
    
         
             
            }
         
     | 
| 
       369 
     | 
    
         
            -
            interface VaporCodegenResult  
     | 
| 
      
 425 
     | 
    
         
            +
            interface VaporCodegenResult {
         
     | 
| 
       370 
426 
     | 
    
         
             
              ast: RootIRNode;
         
     | 
| 
       371 
427 
     | 
    
         
             
              helpers: Set<string>;
         
     | 
| 
       372 
428 
     | 
    
         
             
              templates: string[];
         
     | 
| 
       373 
429 
     | 
    
         
             
              delegates: Set<string>;
         
     | 
| 
      
 430 
     | 
    
         
            +
              code: string;
         
     | 
| 
      
 431 
     | 
    
         
            +
              map?: RawSourceMap;
         
     | 
| 
       374 
432 
     | 
    
         
             
            }
         
     | 
| 
       375 
433 
     | 
    
         
             
            declare function generate(ir: RootIRNode, options?: CodegenOptions): VaporCodegenResult;
         
     | 
| 
       376 
434 
     | 
    
         
             
            //#endregion
         
     | 
| 
       377 
435 
     | 
    
         
             
            //#region src/compile.d.ts
         
     | 
| 
       378 
436 
     | 
    
         
             
            declare function compile(source: JSXElement | JSXFragment | string, options?: CompilerOptions): VaporCodegenResult;
         
     | 
| 
       379 
     | 
    
         
            -
            type CompilerOptions =  
     | 
| 
      
 437 
     | 
    
         
            +
            type CompilerOptions = TransformOptions;
         
     | 
| 
       380 
438 
     | 
    
         
             
            type TransformPreset = [NodeTransform[], Record<string, DirectiveTransform>];
         
     | 
| 
       381 
439 
     | 
    
         
             
            //#endregion
         
     | 
| 
       382 
440 
     | 
    
         
             
            //#region src/transforms/transformText.d.ts
         
     | 
| 
         @@ -424,4 +482,4 @@ declare const transformVOnce: NodeTransform; 
     | 
|
| 
       424 
482 
     | 
    
         
             
            //#region src/transforms/vText.d.ts
         
     | 
| 
       425 
483 
     | 
    
         
             
            declare const transformVText: DirectiveTransform;
         
     | 
| 
       426 
484 
     | 
    
         
             
            //#endregion
         
     | 
| 
       427 
     | 
    
         
            -
            export { BaseIRNode, BlockIRNode, CodegenContext, CodegenOptions, CompilerOptions, CreateComponentIRNode, CreateNodesIRNode, DeclareOldRefIRNode, DirectiveIRNode, DirectiveTransform, DirectiveTransformResult, DynamicFlag, ForIRNode, GetTextChildIRNode,  
     | 
| 
      
 485 
     | 
    
         
            +
            export { BaseIRNode, BlockIRNode, CodegenContext, CodegenOptions, CompilerOptions, CreateComponentIRNode, CreateNodesIRNode, DeclareOldRefIRNode, DirectiveIRNode, DirectiveNode, DirectiveTransform, DirectiveTransformResult, DynamicFlag, ForIRNode, GetTextChildIRNode, IRDynamicInfo, IRDynamicPropsKind, IREffect, IRFor, IRNode, IRNodeTypes, IRProp, IRProps, IRPropsDynamicAttribute, IRPropsDynamicExpression, IRPropsStatic, IRSlotDynamic, IRSlotDynamicBasic, IRSlotDynamicConditional, IRSlotDynamicLoop, IRSlotType, IRSlots, IRSlotsExpression, IRSlotsStatic, IfIRNode, InsertNodeIRNode, InsertionStateTypes, KeyOverride, NodeTransform, OperationNode, PrependNodeIRNode, RootIRNode, RootNode, SetDynamicEventsIRNode, SetDynamicPropsIRNode, SetEventIRNode, SetHtmlIRNode, SetNodesIRNode, SetPropIRNode, SetTemplateRefIRNode, SetTextIRNode, SlotBlockIRNode, SlotOutletIRNode, StructuralDirectiveTransform, TransformContext, TransformOptions, TransformPreset, VaporCodegenResult, compile, createStructuralDirectiveTransform, generate, isBlockOperation, transform, transformChildren, transformElement, transformNode, transformTemplateRef, transformText, transformVBind, transformVFor, transformVHtml, transformVIf, transformVModel, transformVOn, transformVOnce, transformVShow, transformVSlot, transformVSlots, transformVText };
         
     |