@vue-jsx-vapor/compiler 2.4.8 → 2.5.1
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 +1376 -82
- package/dist/index.d.cts +36 -11
- package/dist/index.d.ts +36 -11
- package/dist/index.js +1378 -85
- package/package.json +5 -4
package/dist/index.d.cts
CHANGED
@@ -1,5 +1,4 @@
|
|
1
|
-
import {
|
2
|
-
import { CommentNode, CompilerCompatOptions, CompilerOptions as CompilerOptions$1, CompoundExpressionNode, DirectiveNode, SimpleExpressionNode, TransformOptions as TransformOptions$1 } from "@vue/compiler-dom";
|
1
|
+
import { BaseCodegenResult, CodegenOptions as CodegenOptions$1, CommentNode, CompilerCompatOptions, CompilerOptions as CompilerOptions$1, CompoundExpressionNode, DirectiveNode, SimpleExpressionNode, TransformOptions as TransformOptions$1 } from "@vue/compiler-dom";
|
3
2
|
import { JSXAttribute, JSXElement, JSXFragment, Node } from "@babel/types";
|
4
3
|
import { Prettify } from "@vue/shared";
|
5
4
|
|
@@ -17,7 +16,9 @@ interface DirectiveTransformResult {
|
|
17
16
|
modelModifiers?: string[];
|
18
17
|
}
|
19
18
|
type StructuralDirectiveTransform = (node: JSXElement, dir: JSXAttribute, context: TransformContext) => void | (() => void);
|
20
|
-
type TransformOptions = HackOptions<TransformOptions$1
|
19
|
+
type TransformOptions = HackOptions<TransformOptions$1> & {
|
20
|
+
templates?: string[];
|
21
|
+
};
|
21
22
|
declare class TransformContext<T extends BlockIRNode['node'] = BlockIRNode['node']> {
|
22
23
|
ir: RootIRNode;
|
23
24
|
node: T;
|
@@ -25,7 +26,7 @@ declare class TransformContext<T extends BlockIRNode['node'] = BlockIRNode['node
|
|
25
26
|
root: TransformContext<RootNode>;
|
26
27
|
index: number;
|
27
28
|
block: BlockIRNode;
|
28
|
-
options: Required<Omit<TransformOptions, 'filename' | keyof CompilerCompatOptions>>;
|
29
|
+
options: Required<Omit<TransformOptions, 'filename' | 'inline' | 'bindingMetadata' | 'prefixIdentifiers' | keyof CompilerCompatOptions>>;
|
29
30
|
template: string;
|
30
31
|
childrenTemplate: (string | null)[];
|
31
32
|
dynamic: IRDynamicInfo;
|
@@ -92,7 +93,7 @@ interface IRSlotDynamicLoop {
|
|
92
93
|
slotType: IRSlotType.LOOP;
|
93
94
|
name: SimpleExpressionNode;
|
94
95
|
fn: SlotBlockIRNode;
|
95
|
-
loop: IRFor
|
96
|
+
loop: IRFor;
|
96
97
|
}
|
97
98
|
interface IRSlotDynamicConditional {
|
98
99
|
slotType: IRSlotType.CONDITIONAL;
|
@@ -152,7 +153,7 @@ interface RootIRNode {
|
|
152
153
|
type: IRNodeTypes.ROOT;
|
153
154
|
node: RootNode;
|
154
155
|
source: string;
|
155
|
-
|
156
|
+
templates: string[];
|
156
157
|
rootTemplateIndex?: number;
|
157
158
|
component: Set<string>;
|
158
159
|
directive: Set<string>;
|
@@ -341,14 +342,38 @@ type VaporDirectiveNode = Overwrite<DirectiveNode, {
|
|
341
342
|
type InsertionStateTypes = IfIRNode | ForIRNode | SlotOutletIRNode | CreateComponentIRNode;
|
342
343
|
declare function isBlockOperation(op: OperationNode): op is InsertionStateTypes;
|
343
344
|
//#endregion
|
344
|
-
//#region src/
|
345
|
-
|
345
|
+
//#region src/generate.d.ts
|
346
|
+
type CodegenOptions = Omit<CodegenOptions$1, 'optimizeImports' | 'inline' | 'bindingMetadata' | 'prefixIdentifiers'> & {
|
347
|
+
templates?: string[];
|
348
|
+
};
|
349
|
+
declare class CodegenContext {
|
350
|
+
ir: RootIRNode;
|
351
|
+
options: Required<CodegenOptions>;
|
352
|
+
helpers: Set<string>;
|
353
|
+
helper: (name: string) => string;
|
354
|
+
delegates: Set<string>;
|
355
|
+
identifiers: Record<string, (string | SimpleExpressionNode)[]>;
|
356
|
+
seenInlineHandlerNames: Record<string, number>;
|
357
|
+
block: BlockIRNode;
|
358
|
+
withId<T>(fn: () => T, map: Record<string, string | SimpleExpressionNode | null>): T;
|
359
|
+
enterBlock(block: BlockIRNode): () => BlockIRNode;
|
360
|
+
scopeLevel: number;
|
361
|
+
enterScope(): [level: number, exit: () => number];
|
362
|
+
constructor(ir: RootIRNode, options: CodegenOptions);
|
363
|
+
}
|
364
|
+
interface VaporCodegenResult extends Omit<BaseCodegenResult, 'preamble'> {
|
346
365
|
ast: RootIRNode;
|
347
|
-
|
366
|
+
helpers: Set<string>;
|
367
|
+
templates: string[];
|
368
|
+
delegates: Set<string>;
|
348
369
|
}
|
349
|
-
declare function
|
370
|
+
declare function generate(ir: RootIRNode, options?: CodegenOptions): VaporCodegenResult;
|
371
|
+
//#endregion
|
372
|
+
//#region src/compile.d.ts
|
373
|
+
declare function compile(source: JSXElement | JSXFragment | string, options?: CompilerOptions): VaporCodegenResult;
|
350
374
|
type CompilerOptions = HackOptions<CompilerOptions$1> & {
|
351
375
|
source?: string;
|
376
|
+
templates?: string[];
|
352
377
|
};
|
353
378
|
type TransformPreset = [NodeTransform[], Record<string, DirectiveTransform>];
|
354
379
|
//#endregion
|
@@ -397,4 +422,4 @@ declare const transformVOnce: NodeTransform;
|
|
397
422
|
//#region src/transforms/vText.d.ts
|
398
423
|
declare const transformVText: DirectiveTransform;
|
399
424
|
//#endregion
|
400
|
-
export { BaseIRNode, BlockIRNode, CompilerOptions, CreateComponentIRNode, CreateNodesIRNode, DeclareOldRefIRNode, DirectiveIRNode, DirectiveTransform, DirectiveTransformResult, DynamicFlag, ForIRNode, GetTextChildIRNode, HackOptions, 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, VaporDirectiveNode, compile, createStructuralDirectiveTransform, generate, isBlockOperation, transform, transformChildren, transformElement, transformNode, transformTemplateRef, transformText, transformVBind, transformVFor, transformVHtml, transformVIf, transformVModel, transformVOn, transformVOnce, transformVShow, transformVSlot, transformVSlots, transformVText };
|
425
|
+
export { BaseIRNode, BlockIRNode, CodegenContext, CodegenOptions, CompilerOptions, CreateComponentIRNode, CreateNodesIRNode, DeclareOldRefIRNode, DirectiveIRNode, DirectiveTransform, DirectiveTransformResult, DynamicFlag, ForIRNode, GetTextChildIRNode, HackOptions, 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, VaporDirectiveNode, 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,6 +1,5 @@
|
|
1
|
-
import { IRFor as IRFor$1, VaporCodegenResult, generate } from "@vue/compiler-vapor";
|
2
1
|
import { Prettify } from "@vue/shared";
|
3
|
-
import { CommentNode, CompilerCompatOptions, CompilerOptions as CompilerOptions$1, CompoundExpressionNode, DirectiveNode, SimpleExpressionNode, TransformOptions as TransformOptions$1 } from "@vue/compiler-dom";
|
2
|
+
import { BaseCodegenResult, CodegenOptions as CodegenOptions$1, CommentNode, CompilerCompatOptions, CompilerOptions as CompilerOptions$1, CompoundExpressionNode, DirectiveNode, SimpleExpressionNode, TransformOptions as TransformOptions$1 } from "@vue/compiler-dom";
|
4
3
|
import { JSXAttribute, JSXElement, JSXFragment, Node } from "@babel/types";
|
5
4
|
|
6
5
|
//#region src/transform.d.ts
|
@@ -17,7 +16,9 @@ interface DirectiveTransformResult {
|
|
17
16
|
modelModifiers?: string[];
|
18
17
|
}
|
19
18
|
type StructuralDirectiveTransform = (node: JSXElement, dir: JSXAttribute, context: TransformContext) => void | (() => void);
|
20
|
-
type TransformOptions = HackOptions<TransformOptions$1
|
19
|
+
type TransformOptions = HackOptions<TransformOptions$1> & {
|
20
|
+
templates?: string[];
|
21
|
+
};
|
21
22
|
declare class TransformContext<T extends BlockIRNode['node'] = BlockIRNode['node']> {
|
22
23
|
ir: RootIRNode;
|
23
24
|
node: T;
|
@@ -25,7 +26,7 @@ declare class TransformContext<T extends BlockIRNode['node'] = BlockIRNode['node
|
|
25
26
|
root: TransformContext<RootNode>;
|
26
27
|
index: number;
|
27
28
|
block: BlockIRNode;
|
28
|
-
options: Required<Omit<TransformOptions, 'filename' | keyof CompilerCompatOptions>>;
|
29
|
+
options: Required<Omit<TransformOptions, 'filename' | 'inline' | 'bindingMetadata' | 'prefixIdentifiers' | keyof CompilerCompatOptions>>;
|
29
30
|
template: string;
|
30
31
|
childrenTemplate: (string | null)[];
|
31
32
|
dynamic: IRDynamicInfo;
|
@@ -92,7 +93,7 @@ interface IRSlotDynamicLoop {
|
|
92
93
|
slotType: IRSlotType.LOOP;
|
93
94
|
name: SimpleExpressionNode;
|
94
95
|
fn: SlotBlockIRNode;
|
95
|
-
loop: IRFor
|
96
|
+
loop: IRFor;
|
96
97
|
}
|
97
98
|
interface IRSlotDynamicConditional {
|
98
99
|
slotType: IRSlotType.CONDITIONAL;
|
@@ -152,7 +153,7 @@ interface RootIRNode {
|
|
152
153
|
type: IRNodeTypes.ROOT;
|
153
154
|
node: RootNode;
|
154
155
|
source: string;
|
155
|
-
|
156
|
+
templates: string[];
|
156
157
|
rootTemplateIndex?: number;
|
157
158
|
component: Set<string>;
|
158
159
|
directive: Set<string>;
|
@@ -341,14 +342,38 @@ type VaporDirectiveNode = Overwrite<DirectiveNode, {
|
|
341
342
|
type InsertionStateTypes = IfIRNode | ForIRNode | SlotOutletIRNode | CreateComponentIRNode;
|
342
343
|
declare function isBlockOperation(op: OperationNode): op is InsertionStateTypes;
|
343
344
|
//#endregion
|
344
|
-
//#region src/
|
345
|
-
|
345
|
+
//#region src/generate.d.ts
|
346
|
+
type CodegenOptions = Omit<CodegenOptions$1, 'optimizeImports' | 'inline' | 'bindingMetadata' | 'prefixIdentifiers'> & {
|
347
|
+
templates?: string[];
|
348
|
+
};
|
349
|
+
declare class CodegenContext {
|
350
|
+
ir: RootIRNode;
|
351
|
+
options: Required<CodegenOptions>;
|
352
|
+
helpers: Set<string>;
|
353
|
+
helper: (name: string) => string;
|
354
|
+
delegates: Set<string>;
|
355
|
+
identifiers: Record<string, (string | SimpleExpressionNode)[]>;
|
356
|
+
seenInlineHandlerNames: Record<string, number>;
|
357
|
+
block: BlockIRNode;
|
358
|
+
withId<T>(fn: () => T, map: Record<string, string | SimpleExpressionNode | null>): T;
|
359
|
+
enterBlock(block: BlockIRNode): () => BlockIRNode;
|
360
|
+
scopeLevel: number;
|
361
|
+
enterScope(): [level: number, exit: () => number];
|
362
|
+
constructor(ir: RootIRNode, options: CodegenOptions);
|
363
|
+
}
|
364
|
+
interface VaporCodegenResult extends Omit<BaseCodegenResult, 'preamble'> {
|
346
365
|
ast: RootIRNode;
|
347
|
-
|
366
|
+
helpers: Set<string>;
|
367
|
+
templates: string[];
|
368
|
+
delegates: Set<string>;
|
348
369
|
}
|
349
|
-
declare function
|
370
|
+
declare function generate(ir: RootIRNode, options?: CodegenOptions): VaporCodegenResult;
|
371
|
+
//#endregion
|
372
|
+
//#region src/compile.d.ts
|
373
|
+
declare function compile(source: JSXElement | JSXFragment | string, options?: CompilerOptions): VaporCodegenResult;
|
350
374
|
type CompilerOptions = HackOptions<CompilerOptions$1> & {
|
351
375
|
source?: string;
|
376
|
+
templates?: string[];
|
352
377
|
};
|
353
378
|
type TransformPreset = [NodeTransform[], Record<string, DirectiveTransform>];
|
354
379
|
//#endregion
|
@@ -397,4 +422,4 @@ declare const transformVOnce: NodeTransform;
|
|
397
422
|
//#region src/transforms/vText.d.ts
|
398
423
|
declare const transformVText: DirectiveTransform;
|
399
424
|
//#endregion
|
400
|
-
export { BaseIRNode, BlockIRNode, CompilerOptions, CreateComponentIRNode, CreateNodesIRNode, DeclareOldRefIRNode, DirectiveIRNode, DirectiveTransform, DirectiveTransformResult, DynamicFlag, ForIRNode, GetTextChildIRNode, HackOptions, 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, VaporDirectiveNode, compile, createStructuralDirectiveTransform, generate, isBlockOperation, transform, transformChildren, transformElement, transformNode, transformTemplateRef, transformText, transformVBind, transformVFor, transformVHtml, transformVIf, transformVModel, transformVOn, transformVOnce, transformVShow, transformVSlot, transformVSlots, transformVText };
|
425
|
+
export { BaseIRNode, BlockIRNode, CodegenContext, CodegenOptions, CompilerOptions, CreateComponentIRNode, CreateNodesIRNode, DeclareOldRefIRNode, DirectiveIRNode, DirectiveTransform, DirectiveTransformResult, DynamicFlag, ForIRNode, GetTextChildIRNode, HackOptions, 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, VaporDirectiveNode, compile, createStructuralDirectiveTransform, generate, isBlockOperation, transform, transformChildren, transformElement, transformNode, transformTemplateRef, transformText, transformVBind, transformVFor, transformVHtml, transformVIf, transformVModel, transformVOn, transformVOnce, transformVShow, transformVSlot, transformVSlots, transformVText };
|