@vaadin/hilla-generator-utils
Advanced tools
Comparing version 24.4.0-alpha3 to 24.4.0-alpha4
@@ -1,6 +0,6 @@ | ||
import { type Node, type SourceFile, type Statement, type TransformerFactory } from 'typescript'; | ||
import { type Node, type VisitResult, type SourceFile, type Statement, type TransformerFactory } from 'typescript'; | ||
export type TemplateSelector<T> = (statements: readonly Statement[]) => T; | ||
export declare function template(code: string, transformers?: ReadonlyArray<TransformerFactory<SourceFile>>): readonly Statement[]; | ||
export declare function template<T>(code: string, selector: TemplateSelector<T>, transformers?: ReadonlyArray<TransformerFactory<SourceFile>>): T; | ||
export declare function transform<T extends Node>(transformer: (node: Node) => Node): TransformerFactory<T>; | ||
export declare function transform<T extends Node>(transformer: (node: Node) => VisitResult<Node | undefined>): TransformerFactory<T>; | ||
//# sourceMappingURL=ast.d.ts.map |
@@ -21,3 +21,9 @@ import ts, { | ||
return (context) => (root) => { | ||
const visitor = (node) => ts.visitEachChild(transformer(node), visitor, context); | ||
const visitor = (node) => { | ||
const transformed = transformer(node); | ||
if (transformed !== node) { | ||
return transformed; | ||
} | ||
return ts.visitEachChild(transformed, visitor, context); | ||
}; | ||
return ts.visitEachChild(root, visitor, context); | ||
@@ -24,0 +30,0 @@ }; |
{ | ||
"name": "@vaadin/hilla-generator-utils", | ||
"version": "24.4.0-alpha3", | ||
"version": "24.4.0-alpha4", | ||
"description": "A set of utils for developing Hilla generator plugins", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
79630
729