New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@vaadin/hilla-generator-core

Package Overview
Dependencies
Maintainers
12
Versions
132
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

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

Comparing version

to
24.7.0-alpha11

1

Generator.d.ts
import type LoggerFactory from '@vaadin/hilla-generator-utils/LoggerFactory.js';
import File from './File.js';
import type { PluginConstructor } from './Plugin.js';

@@ -4,0 +3,0 @@ export type GeneratorContext = Readonly<{

4

Generator.js
import SwaggerParser from "@apidevtools/swagger-parser";
import ts from "typescript";
import File from "./File.js";
import PluginManager from "./PluginManager.js";

@@ -25,3 +24,4 @@ import ReferenceResolver from "./ReferenceResolver.js";

pluginStorage: /* @__PURE__ */ new Map(),
sources: []
sources: [],
transferTypes: /* @__PURE__ */ new Map()
};

@@ -28,0 +28,0 @@ this.#logger.global.debug("Executing plugins");

{
"name": "@vaadin/hilla-generator-core",
"version": "24.7.0-alpha10",
"version": "24.7.0-alpha11",
"description": "A Hilla tool to generate TypeScript code from the OpenAPI document",

@@ -47,5 +47,2 @@ "main": "index.js",

"types": "./SharedStorage.d.ts"
},
"./utils.js": {
"default": "./utils.js"
}

@@ -77,3 +74,3 @@ },

"@apidevtools/swagger-parser": "10.1.1",
"@vaadin/hilla-generator-utils": "24.7.0-alpha10",
"@vaadin/hilla-generator-utils": "24.7.0-alpha11",
"meow": "13.2.0",

@@ -80,0 +77,0 @@ "openapi-types": "12.1.3",

@@ -5,3 +5,3 @@ import type LoggerFactory from '@vaadin/hilla-generator-utils/LoggerFactory.js';

import type ReferenceResolver from './ReferenceResolver.js';
import type SharedStorage from './SharedStorage.js';
import type { SharedStorage } from './SharedStorage.js';
export default abstract class Plugin {

@@ -13,5 +13,5 @@ readonly resolver: ReferenceResolver;

abstract get path(): string;
abstract execute(storage: SharedStorage): Promise<void>;
abstract execute(storage: SharedStorage): Promise<void> | void;
}
export type PluginConstructor = Constructor<Plugin, ConstructorParameters<typeof Plugin>>;
//# sourceMappingURL=Plugin.d.ts.map
import type LoggerFactory from '@vaadin/hilla-generator-utils/LoggerFactory.js';
import type { PluginConstructor } from './Plugin.js';
import type ReferenceResolver from './ReferenceResolver.js';
import type SharedStorage from './SharedStorage.js';
import type { SharedStorage } from './SharedStorage.js';
export default class PluginManager {

@@ -6,0 +6,0 @@ #private;

@@ -5,2 +5,4 @@ class PluginManager {

const standardPlugins = [
"TransferTypesPlugin",
// should go before Backbone Plugin
"BackbonePlugin",

@@ -7,0 +9,0 @@ "ClientPlugin",

import type SwaggerParser from '@apidevtools/swagger-parser';
import type { OpenAPIV3 } from 'openapi-types';
import type { ReadonlyDeep } from 'type-fest';
export default class ReferenceResolver {
#private;
constructor(parser: SwaggerParser);
resolve<T extends ReadonlyDeep<object>>(obj: ReadonlyDeep<OpenAPIV3.ReferenceObject> | T): T;
resolve<T extends object>(obj: OpenAPIV3.ReferenceObject | T): T;
}
//# sourceMappingURL=ReferenceResolver.d.ts.map
import type { OpenAPIV3 } from 'openapi-types';
import type { ReadonlyDeep } from 'type-fest';
import { type Nullified } from './utils.js';
export type ReferenceSchema = ReadonlyDeep<OpenAPIV3.ReferenceObject>;
export type ArraySchema = ReadonlyDeep<OpenAPIV3.ArraySchemaObject>;
export type NonArraySchema = ReadonlyDeep<OpenAPIV3.NonArraySchemaObject>;
export type Nullified<T, K extends keyof T> = T & Record<K, undefined>;
export type ReferenceSchema = OpenAPIV3.ReferenceObject;
export type ArraySchema = OpenAPIV3.ArraySchemaObject;
export type NonArraySchema = OpenAPIV3.NonArraySchemaObject;
export type RegularSchema = ArraySchema | NonArraySchema;

@@ -55,5 +54,8 @@ export type NullableSchema = Readonly<Required<Pick<RegularSchema, 'nullable'>>> & RegularSchema;

export declare function isMapSchema(schema: Schema): schema is MapSchema;
export declare function simplifyFullyQualifiedName(name: string): string;
export declare function convertReferenceSchemaToSpecifier({ $ref }: ReferenceSchema): string;
export declare function convertReferenceSchemaToPath({ $ref }: ReferenceSchema): string;
export declare function resolveReference(schemas: ReadonlyDeep<OpenAPIV3.ComponentsObject>['schemas'], { $ref }: ReferenceSchema): Schema | undefined;
export declare function convertReferenceSchemaToFullyQualifiedName({ $ref }: ReferenceSchema): string;
export declare function convertFullyQualifiedNameToRelativePath(name: string): string;
export declare function convertReferenceSchemaToPath(schema: ReferenceSchema): string;
export declare function resolveReference(schemas: OpenAPIV3.ComponentsObject['schemas'], { $ref }: ReferenceSchema): Schema | undefined;
//# sourceMappingURL=Schema.d.ts.map

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

import { convertFullyQualifiedNameToRelativePath, simplifyFullyQualifiedName } from "./utils.js";
function isReferenceSchema(schema) {

@@ -68,2 +67,5 @@ return "$ref" in schema;

}
function simplifyFullyQualifiedName(name) {
return name.substring(name.lastIndexOf(name.includes("$") ? "$" : ".") + 1, name.length);
}
function convertReferenceSchemaToSpecifier({ $ref }) {

@@ -73,5 +75,11 @@ return simplifyFullyQualifiedName($ref);

const COMPONENTS_SCHEMAS_REF_LENGTH = "#/components/schemas/".length;
function convertReferenceSchemaToPath({ $ref }) {
return convertFullyQualifiedNameToRelativePath($ref.substring(COMPONENTS_SCHEMAS_REF_LENGTH));
function convertReferenceSchemaToFullyQualifiedName({ $ref }) {
return $ref.substring(COMPONENTS_SCHEMAS_REF_LENGTH);
}
function convertFullyQualifiedNameToRelativePath(name) {
return name.replace(/[$.]/gu, "/");
}
function convertReferenceSchemaToPath(schema) {
return convertFullyQualifiedNameToRelativePath(convertReferenceSchemaToFullyQualifiedName(schema));
}
function resolveReference(schemas, { $ref }) {

@@ -88,2 +96,4 @@ if (schemas) {

export {
convertFullyQualifiedNameToRelativePath,
convertReferenceSchemaToFullyQualifiedName,
convertReferenceSchemaToPath,

@@ -110,4 +120,5 @@ convertReferenceSchemaToSpecifier,

isStringSchema,
resolveReference
resolveReference,
simplifyFullyQualifiedName
};
//# sourceMappingURL=Schema.js.map
import type { $Refs } from '@apidevtools/swagger-parser';
import type { OpenAPIV3 } from 'openapi-types';
import type { ReadonlyDeep } from 'type-fest';
import type { SourceFile } from 'typescript';
import type { SourceFile, TypeNode } from 'typescript';
type SharedStorage = Readonly<{
api: ReadonlyDeep<OpenAPIV3.Document>;
export type TransferTypeMaker = (typeArguments: readonly TypeNode[] | undefined) => TypeNode;
export type TransferTypes = Map<string, TransferTypeMaker>;
export type SharedStorage = Readonly<{
api: OpenAPIV3.Document;
apiRefs: $Refs;
outputDir?: string;
pluginStorage: Map<string, unknown>;
sources: SourceFile[];
pluginStorage: Map<string, unknown>;
outputDir?: string;
transferTypes: TransferTypes;
}>;
export default SharedStorage;

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

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