@vaadin/hilla-generator-utils
Advanced tools
Comparing version 24.4.0-alpha2 to 24.4.0-alpha20
@@ -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-alpha2", | ||
"version": "24.4.0-alpha20", | ||
"description": "A set of utils for developing Hilla generator plugins", | ||
@@ -23,35 +23,13 @@ "main": "index.js", | ||
"exports": { | ||
"./dependencies/DependencyManager.js": { | ||
"default": "./dependencies/DependencyManager.js" | ||
}, | ||
"./dependencies/ExportManager.js": { | ||
"default": "./dependencies/ExportManager.js" | ||
}, | ||
"./dependencies/ImportManager.js": { | ||
"default": "./dependencies/ImportManager.js" | ||
}, | ||
"./dependencies/PathManager.js": { | ||
"default": "./dependencies/PathManager.js" | ||
}, | ||
"./testing/snapshotMatcher.js": { | ||
"default": "./testing/snapshotMatcher.js" | ||
}, | ||
"./ast.js": { | ||
"default": "./ast.js" | ||
}, | ||
"./createFullyUniqueIdentifier.js": { | ||
"default": "./createFullyUniqueIdentifier.js" | ||
}, | ||
"./createSourceFile.js": { | ||
"default": "./createSourceFile.js" | ||
}, | ||
"./memoize.js": { | ||
"default": "./memoize.js" | ||
}, | ||
"./LoggerFactory.js": { | ||
"default": "./LoggerFactory.js" | ||
}, | ||
"./PluginError.js": { | ||
"default": "./PluginError.js" | ||
} | ||
"./dependencies/DependencyManager.js": "./dependencies/DependencyManager.js", | ||
"./dependencies/ExportManager.js": "./dependencies/ExportManager.js", | ||
"./dependencies/ImportManager.js": "./dependencies/ImportManager.js", | ||
"./dependencies/PathManager.js": "./dependencies/PathManager.js", | ||
"./testing/snapshotMatcher.js": "./testing/snapshotMatcher.js", | ||
"./ast.js": "./ast.js", | ||
"./createFullyUniqueIdentifier.js": "./createFullyUniqueIdentifier.js", | ||
"./createSourceFile.js": "./createSourceFile.js", | ||
"./memoize.js": "./memoize.js", | ||
"./LoggerFactory.js": "./LoggerFactory.js", | ||
"./PluginError.js": "./PluginError.js" | ||
}, | ||
@@ -58,0 +36,0 @@ "repository": { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
79217
728
57