Socket
Book a DemoInstallSign in
Socket

@vaadin/hilla-generator-utils

Package Overview
Dependencies
Maintainers
12
Versions
180
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@vaadin/hilla-generator-utils - npm Package Compare versions

Comparing version

to
24.5.0-alpha10

1

ast.d.ts

@@ -6,2 +6,3 @@ import { type Node, type VisitResult, type SourceFile, type Statement, type TransformerFactory } from 'typescript';

export declare function transform<T extends Node>(transformer: (node: Node) => VisitResult<Node | undefined>): TransformerFactory<T>;
export declare function traverse<T extends Node>(node: Node, visitor: (node: Node) => T | undefined): T | undefined;
//# sourceMappingURL=ast.d.ts.map

@@ -31,6 +31,13 @@ import ts, {

}
function traverse(node, visitor) {
function _visitor(n) {
return visitor(n) ?? ts.forEachChild(n, _visitor);
}
return _visitor(node);
}
export {
template,
transform
transform,
traverse
};
//# sourceMappingURL=ast.js.map

2

createSourceFile.js
import ts, {} from "typescript";
function createSourceFile(statements, fileName) {
const sourceFile = ts.createSourceFile(fileName, "", ts.ScriptTarget.ES2019, void 0, ts.ScriptKind.TS);
const sourceFile = ts.createSourceFile(fileName, "", ts.ScriptTarget.ES2021, void 0, ts.ScriptKind.TS);
return ts.factory.updateSourceFile(sourceFile, statements);

@@ -5,0 +5,0 @@ }

@@ -8,5 +8,6 @@ import ts, { type Identifier, type ImportDeclaration, type Statement } from 'typescript';

add(path: string, specifier: string, isType?: boolean, uniqueId?: Identifier): Identifier;
remove(path: string, specifier: string): void;
clear(): void;
getIdentifier(path: string, specifier: string): Identifier | undefined;
identifiers(): IterableIterator<readonly [path: string, specifier: string, id: Identifier, isType: boolean]>;
iter(): IterableIterator<readonly [path: string, specifier: string, id: Identifier, isType: boolean]>;
isType(path: string, specifier: string): boolean | undefined;

@@ -16,2 +17,3 @@ paths(): IterableIterator<string>;

statementRecords(): IterableIterator<StatementRecord<ImportDeclaration>>;
[Symbol.iterator](): IterableIterator<readonly [path: string, specifier: string, id: Identifier, isType: boolean]>;
}

@@ -23,5 +25,7 @@ export declare class NamespaceImportManager extends StatementRecordManager<ImportDeclaration> {

getIdentifier(path: string): Identifier | undefined;
identifiers(): IterableIterator<Identifier>;
iter(): IterableIterator<readonly [path: string, id: Identifier]>;
paths(): IterableIterator<string>;
statementRecords(): IterableIterator<StatementRecord<ImportDeclaration>>;
remove(path: string): void;
[Symbol.iterator](): IterableIterator<readonly [path: string, id: Identifier]>;
}

@@ -32,7 +36,9 @@ export declare class DefaultImportManager extends StatementRecordManager<ImportDeclaration> {

getIdentifier(path: string): Identifier | undefined;
remove(path: string): void;
clear(): void;
identifiers(): IterableIterator<readonly [id: Identifier, isType: boolean]>;
iter(): IterableIterator<readonly [path: string, id: Identifier, isType: boolean]>;
isType(path: string): boolean | undefined;
paths(): IterableIterator<string>;
statementRecords(): IterableIterator<StatementRecord<ImportDeclaration>>;
[Symbol.iterator](): IterableIterator<readonly [path: string, id: Identifier, isType: boolean]>;
}

@@ -39,0 +45,0 @@ export default class ImportManager implements CodeConvertable<readonly Statement[]> {

@@ -21,2 +21,11 @@ import ts, {} from "typescript";

}
remove(path, specifier) {
const specifiers = this.#map.get(path);
if (specifiers) {
specifiers.delete(specifier);
if (specifiers.size === 0) {
this.#map.delete(path);
}
}
}
clear() {

@@ -28,8 +37,4 @@ this.#map.clear();

}
*identifiers() {
for (const [path, specifiers] of this.#map) {
for (const [specifier, { id, isType }] of specifiers) {
yield [path, specifier, id, isType];
}
}
iter() {
return this[Symbol.iterator]();
}

@@ -72,2 +77,9 @@ isType(path, specifier) {

}
*[Symbol.iterator]() {
for (const [path, specifiers] of this.#map) {
for (const [specifier, { id, isType }] of specifiers) {
yield [path, specifier, id, isType];
}
}
}
}

@@ -87,6 +99,4 @@ class NamespaceImportManager extends StatementRecordManager {

}
*identifiers() {
for (const id of this.#map.values()) {
yield id;
}
iter() {
return this[Symbol.iterator]();
}

@@ -108,2 +118,10 @@ paths() {

}
remove(path) {
this.#map.delete(path);
}
*[Symbol.iterator]() {
for (const [path, id] of this.#map) {
yield [path, id];
}
}
}

@@ -120,9 +138,12 @@ class DefaultImportManager extends StatementRecordManager {

}
remove(path) {
if (this.#map.has(path)) {
this.#map.delete(path);
}
}
clear() {
this.#map.clear();
}
*identifiers() {
for (const { id, isType } of this.#map.values()) {
yield [id, isType];
}
iter() {
return this[Symbol.iterator]();
}

@@ -147,2 +168,7 @@ isType(path) {

}
*[Symbol.iterator]() {
for (const [path, { id, isType }] of this.#map) {
yield [path, id, isType];
}
}
}

@@ -149,0 +175,0 @@ class ImportManager {

{
"name": "@vaadin/hilla-generator-utils",
"version": "24.5.0-alpha1",
"version": "24.5.0-alpha10",
"description": "A set of utils for developing Hilla generator plugins",

@@ -19,3 +19,3 @@ "main": "index.js",

"test": "mocha test/**/*.spec.ts --config ../../../.mocharc.cjs",
"test:coverage": "c8 -c ../../../.c8rc.json npm test",
"test:coverage": "c8 --experimental-monocart -c ../../../.c8rc.json npm test",
"typecheck": "tsc --noEmit"

@@ -63,3 +63,3 @@ },

"pino-pretty": "^10.2.0",
"typescript": "5.3.2"
"typescript": "5.5.2"
},

@@ -72,7 +72,9 @@ "devDependencies": {

"@types/sinon-chai": "^3.2.10",
"c8": "^8.0.1",
"c8": "^10.1.2",
"chai": "^4.3.10",
"chai-like": "^1.1.1",
"concurrently": "^8.2.1",
"copyfiles": "^2.4.1",
"mocha": "^10.2.0",
"monocart-coverage-reports": "^2.8.4",
"sinon": "^16.0.0",

@@ -79,0 +81,0 @@ "sinon-chai": "^3.7.0",

@@ -1,2 +0,1 @@

/// <reference types="chai" />
declare global {

@@ -3,0 +2,0 @@ export namespace Chai {

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.