@vaadin/hilla-generator-plugin-backbone 25.2.0-alpha3 → 25.2.0-alpha5

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.
@@ -1 +1 @@
1
- {"mappings":"AAAA,SAAS,2BAA4B;AAErC,SAIE,8BACA,mCACA,iBACA,kBACA,eACA,cACA,kBACA,gBACA,mBAEA,yCACA,0EAC8C;AAEhD,OAAO,yEAA0E;AACjF,OAAO,wFAAyF;AAChG,OAAO,4EAA6E;AACpF,OAAO,oBAOa;AACpB,OAAO,mDAAoD;AAC3D,SAAS,sCAAuC;AAEhD,OAAO,MAAM,gBAAgB;CAC3B,AAASA;CACT,AAASC;CACT,AAASC;CACT,AAASC;CACT,AAASC,qBAAqB,IAAI,YAAY,EAAE,WAAW,KAAM;CACjE,AAASC;CACT,AAASC;CACT,AAASC;CAET,YAAYC,MAAcC,WAAmBC,SAAwBC,OAAe;AAClF,OAAKX,aAAa;AAClB,OAAKM,SAAS;AACd,OAAKJ,sBAAsB;AAC3B,OAAKC,QAAQ,2BAA2B,KAAK;AAC7C,OAAKI,QAAQ,wCAAwC,KAAK;AAC1D,OAAKN,gBAAgB,IAAI,kBAAkB,IAAI,YAAY;GAAE,WAAW;GAAO,YAAY,QAAQ,KAAKM,MAAM;EAAE;AAChH,OAAKF,iBAAiB,QAAQ;CAC/B;CAED,IAAIO,MAAkB;EACpB,MAAM,KAAK,GAAG,QAAQ,iBAAiB,KAAKT,MAAM;AAElD,OAAKF,cAAc,QAAQ,QAAQ,IAAI,GAAG;AAE1C,SAAO;CACR;CAED,UAAsB;AACpB,OAAKK,OAAO,OAAO,OAAO,qBAAqB,KAAKH,MAAM,EAAE;EAE5D,MAAM,cAAc,aAAa,KAAKH,WAAW,GAC7C,KAAKa,aAAa,KAAKb,WAAW,GAClC,KAAKc,sBAAsB,KAAKd,WAAW;EAE/C,MAAM,aAAa,cAAc,CAAC,WAAY,IAAG,CAAE;EAEnD,MAAM,E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CACE,GAAG,QAAQ,qBAAqB,GAAG,WAAW,gBAAgB,CAC5D,GAAG,QAAQ,kCAAkC,YAAY,UAAU,AACpE,EAAC,AACH,GACD,YAAY,QACb;EAEJ;AAED,SAAO,KAAKD,cAAc,OAAO;CAClC;CAED,oBAAoBE,QAAqC;EACvD,MAAM,EAAE,SAAS,OAAO,GAAG,KAAKnB;EAEhC,MAAM,YAAY,kCAAkC,OAAO;EAC3D,MAAM,OAAO,MAAM,mBAAmB,6BAA6B,OAAO,CAAC;AAE3E,SAAO,QAAQ,QAAQ,cAAc,KAAK,IAAI,QAAQ,QAAQ,IAAI,MAAM,WAAW,KAAK;CACzF;CAED,qBAAqB,EAAE,YAA0B,EAA0B;AACzE,SAAO,OAAO,QAAQ,cAAc,CAAE,EAAC,CAAC,IAAI,CAAC,CAAC,MAAM,OAAO,KAAK;GAC9D,MAAM,CAAC,KAAK,GAAG,IAAI,oBAAoB,QAAQ,KAAKA,eAAe,KAAKI,gBAAgB,SAAS;AAEjG,UAAO,GAAG,QAAQ,wBAChB,WACA,MACA,iBAAiB,OAAO,GAAG,GAAG,QAAQ,YAAY,GAAG,WAAW,cAAc,GAAG,WACjF,KACD;EACF,EAAC;CACH;CAED,OAAOW,uBAAuBD,QAAiE;AAC7F,SAAO,mBAAmB,OAAO,EAC7B,IAAI,OAAO,CACZ,IAAI,CAAC,SACJ,GAAG,QAAQ,+BACT,WACA,MACA,WACA,GAAG,QAAQ,sBAAsB,GAAG,WAAW,eAAe,CAC/D,CACF;CACJ;AACF","names":["#component","#dependencies","#fullyQualifiedName","#name","#outputPathManager","#transferTypes","#owner","#path","name: string","component: Schema","storage: SharedStorage","owner: Plugin","#id","#processEnum","#processExtendedClass","schema: Schema","#processTypeParameters","#processTypeElements","#processClass","#processParentClass","schema: ReferenceSchema"],"sources":["/opt/agent/work/649c11185a3798db/packages/ts/generator-plugin-backbone/src/EntityProcessor.ts"],"sourcesContent":["import { dirname } from 'path/posix';\nimport type Plugin from '@vaadin/hilla-generator-core/Plugin.js';\nimport {\n type EnumSchema,\n type ReferenceSchema,\n type Schema,\n convertReferenceSchemaToPath,\n convertReferenceSchemaToSpecifier,\n decomposeSchema,\n isComposedSchema,\n isEmptyObject,\n isEnumSchema,\n isNullableSchema,\n isObjectSchema,\n isReferenceSchema,\n type ObjectSchema,\n convertFullyQualifiedNameToRelativePath,\n simplifyFullyQualifiedName,\n} from '@vaadin/hilla-generator-core/Schema.js';\nimport type { SharedStorage, TransferTypes } from '@vaadin/hilla-generator-core/SharedStorage.js';\nimport createSourceFile from '@vaadin/hilla-generator-utils/createSourceFile.js';\nimport DependencyManager from '@vaadin/hilla-generator-utils/dependencies/DependencyManager.js';\nimport PathManager from '@vaadin/hilla-generator-utils/dependencies/PathManager.js';\nimport ts, {\n type Identifier,\n type InterfaceDeclaration,\n type SourceFile,\n type Statement,\n type TypeElement,\n type TypeParameterDeclaration,\n} from 'typescript';\nimport TypeSchemaProcessor from './TypeSchemaProcessor.js';\nimport { findTypeParameters } from './utils.js';\n\nexport class EntityProcessor {\n readonly #component: Schema;\n readonly #dependencies;\n readonly #fullyQualifiedName: string;\n readonly #name: string;\n readonly #outputPathManager = new PathManager({ extension: 'ts' });\n readonly #transferTypes: TransferTypes;\n readonly #owner: Plugin;\n readonly #path: string;\n\n constructor(name: string, component: Schema, storage: SharedStorage, owner: Plugin) {\n this.#component = component;\n this.#owner = owner;\n this.#fullyQualifiedName = name;\n this.#name = simplifyFullyQualifiedName(name);\n this.#path = convertFullyQualifiedNameToRelativePath(name);\n this.#dependencies = new DependencyManager(new PathManager({ extension: '.js', relativeTo: dirname(this.#path) }));\n this.#transferTypes = storage.transferTypes;\n }\n\n get #id(): Identifier {\n const id = ts.factory.createIdentifier(this.#name);\n\n this.#dependencies.exports.default.set(id);\n\n return id;\n }\n\n process(): SourceFile {\n this.#owner.logger.debug(`Processing entity: ${this.#name}`);\n\n const declaration = isEnumSchema(this.#component)\n ? this.#processEnum(this.#component)\n : this.#processExtendedClass(this.#component);\n\n const statements = declaration ? [declaration] : [];\n\n const { exports, imports } = this.#dependencies;\n\n return createSourceFile(\n [...imports.toCode(), ...statements, ...exports.toCode()],\n this.#outputPathManager.createRelativePath(this.#path),\n );\n }\n\n #processClass(schema: Schema): InterfaceDeclaration | undefined {\n const { logger } = this.#owner;\n\n if (!isObjectSchema(schema)) {\n logger.debug(schema, `Component is not an object: '${this.#fullyQualifiedName}'`);\n return undefined;\n }\n\n if (isEmptyObject(schema)) {\n logger.debug(`Component has no properties:' ${this.#fullyQualifiedName}'`);\n }\n\n return ts.factory.createInterfaceDeclaration(\n undefined,\n this.#id,\n EntityProcessor.#processTypeParameters(schema),\n undefined,\n this.#processTypeElements(schema as ObjectSchema),\n );\n }\n\n #processEnum({ enum: members }: EnumSchema): Statement {\n return ts.factory.createEnumDeclaration(\n undefined,\n this.#id,\n members.map((member) => ts.factory.createEnumMember(member, ts.factory.createStringLiteral(member))),\n );\n }\n\n #processExtendedClass(schema: Schema): Statement | undefined {\n const { logger } = this.#owner;\n\n if (isComposedSchema(schema)) {\n const decomposed = decomposeSchema(schema);\n\n if (decomposed.length > 2) {\n logger.debug(\n schema,\n `Schema for '${this.#fullyQualifiedName}' has more than two components. This plugin will ignore it.`,\n );\n return undefined;\n }\n\n const [parent, child] = decomposed;\n\n if (!isReferenceSchema(parent)) {\n logger.debug(parent, 'Only reference schema allowed for parent class');\n return undefined;\n }\n\n const declaration = this.#processClass(child);\n const identifier = this.#processParentClass(parent);\n\n return (\n declaration &&\n ts.factory.updateInterfaceDeclaration(\n declaration,\n declaration.modifiers,\n declaration.name,\n declaration.typeParameters,\n [\n ts.factory.createHeritageClause(ts.SyntaxKind.ExtendsKeyword, [\n ts.factory.createExpressionWithTypeArguments(identifier, undefined),\n ]),\n ],\n declaration.members,\n )\n );\n }\n\n return this.#processClass(schema);\n }\n\n #processParentClass(schema: ReferenceSchema): Identifier {\n const { imports, paths } = this.#dependencies;\n\n const specifier = convertReferenceSchemaToSpecifier(schema);\n const path = paths.createRelativePath(convertReferenceSchemaToPath(schema));\n\n return imports.default.getIdentifier(path) ?? imports.default.add(path, specifier, true);\n }\n\n #processTypeElements({ properties }: ObjectSchema): readonly TypeElement[] {\n return Object.entries(properties ?? {}).map(([name, schema]) => {\n const [type] = new TypeSchemaProcessor(schema, this.#dependencies, this.#transferTypes).process();\n\n return ts.factory.createPropertySignature(\n undefined,\n name,\n isNullableSchema(schema) ? ts.factory.createToken(ts.SyntaxKind.QuestionToken) : undefined,\n type,\n );\n });\n }\n\n static #processTypeParameters(schema: Schema): readonly TypeParameterDeclaration[] | undefined {\n return findTypeParameters(schema)\n ?.map(String)\n .map((name) =>\n ts.factory.createTypeParameterDeclaration(\n undefined,\n name,\n undefined,\n ts.factory.createKeywordTypeNode(ts.SyntaxKind.UnknownKeyword),\n ),\n );\n }\n}\n"],"version":3}
1
+ {"mappings":"AAAA,SAAS,2BAA4B;AAErC,SAIE,8BACA,mCACA,iBACA,kBACA,eACA,cACA,kBACA,gBACA,mBAEA,yCACA,0EAC8C;AAEhD,OAAO,yEAA0E;AACjF,OAAO,wFAAyF;AAChG,OAAO,4EAA6E;AACpF,OAAO,oBAOa;AACpB,OAAO,mDAAoD;AAC3D,SAAS,sCAAuC;AAEhD,OAAO,MAAM,gBAAgB;CAC3B,AAASA;CACT,AAASC;CACT,AAASC;CACT,AAASC;CACT,AAASC,qBAAqB,IAAI,YAAY,EAAE,WAAW,KAAM;CACjE,AAASC;CACT,AAASC;CACT,AAASC;CAET,YAAYC,MAAcC,WAAmBC,SAAwBC,OAAe;AAClF,OAAKX,aAAa;AAClB,OAAKM,SAAS;AACd,OAAKJ,sBAAsB;AAC3B,OAAKC,QAAQ,2BAA2B,KAAK;AAC7C,OAAKI,QAAQ,wCAAwC,KAAK;AAC1D,OAAKN,gBAAgB,IAAI,kBAAkB,IAAI,YAAY;GAAE,WAAW;GAAO,YAAY,QAAQ,KAAKM,MAAM;EAAE;AAChH,OAAKF,iBAAiB,QAAQ;CAC/B;CA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Q,+BACT,WACA,MACA,WACA,GAAG,QAAQ,sBAAsB,GAAG,WAAW,eAAe,CAC/D,CACF;CACJ;AACF","names":["#component","#dependencies","#fullyQualifiedName","#name","#outputPathManager","#transferTypes","#owner","#path","name: string","component: Schema","storage: SharedStorage","owner: Plugin","#id","#processEnum","#processExtendedClass","schema: Schema","#processTypeParameters","#processTypeElements","#processClass","#processParentClass","schema: ReferenceSchema"],"sources":["/opt/agent/work/649c11185a3798db/packages/ts/generator-plugin-backbone/src/EntityProcessor.ts"],"sourcesContent":["import { dirname } from 'path/posix';\nimport type Plugin from '@vaadin/hilla-generator-core/Plugin.js';\nimport {\n type EnumSchema,\n type ReferenceSchema,\n type Schema,\n convertReferenceSchemaToPath,\n convertReferenceSchemaToSpecifier,\n decomposeSchema,\n isComposedSchema,\n isEmptyObject,\n isEnumSchema,\n isNullableSchema,\n isObjectSchema,\n isReferenceSchema,\n type ObjectSchema,\n convertFullyQualifiedNameToRelativePath,\n simplifyFullyQualifiedName,\n} from '@vaadin/hilla-generator-core/Schema.js';\nimport type { SharedStorage, TransferTypes } from '@vaadin/hilla-generator-core/SharedStorage.js';\nimport createSourceFile from '@vaadin/hilla-generator-utils/createSourceFile.js';\nimport DependencyManager from '@vaadin/hilla-generator-utils/dependencies/DependencyManager.js';\nimport PathManager from '@vaadin/hilla-generator-utils/dependencies/PathManager.js';\nimport ts, {\n type Identifier,\n type InterfaceDeclaration,\n type SourceFile,\n type Statement,\n type TypeElement,\n type TypeParameterDeclaration,\n} from 'typescript';\nimport TypeSchemaProcessor from './TypeSchemaProcessor.js';\nimport { findTypeParameters } from './utils.js';\n\nexport class EntityProcessor {\n readonly #component: Schema;\n readonly #dependencies;\n readonly #fullyQualifiedName: string;\n readonly #name: string;\n readonly #outputPathManager = new PathManager({ extension: 'ts' });\n readonly #transferTypes: TransferTypes;\n readonly #owner: Plugin;\n readonly #path: string;\n\n constructor(name: string, component: Schema, storage: SharedStorage, owner: Plugin) {\n this.#component = component;\n this.#owner = owner;\n this.#fullyQualifiedName = name;\n this.#name = simplifyFullyQualifiedName(name);\n this.#path = convertFullyQualifiedNameToRelativePath(name);\n this.#dependencies = new DependencyManager(new PathManager({ extension: '.js', relativeTo: dirname(this.#path) }));\n this.#transferTypes = storage.transferTypes;\n }\n\n get #id(): Identifier {\n const id = ts.factory.createIdentifier(this.#name);\n\n this.#dependencies.exports.default.set(id);\n\n return id;\n }\n\n process(): SourceFile {\n this.#owner.logger.debug(`Processing entity: ${this.#name}`);\n\n const declaration = isEnumSchema(this.#component)\n ? this.#processEnum(this.#component)\n : this.#processExtendedClass(this.#component);\n\n const statements = declaration ? [declaration] : [];\n\n const { exports, imports } = this.#dependencies;\n\n return createSourceFile(\n [...imports.toCode(), ...statements, ...exports.toCode()],\n this.#outputPathManager.createRelativePath(this.#path),\n );\n }\n\n #processClass(schema: Schema): InterfaceDeclaration | undefined {\n const { logger } = this.#owner;\n\n if (!isObjectSchema(schema)) {\n logger.debug(schema, `Component is not an object: '${this.#fullyQualifiedName}'`);\n return undefined;\n }\n\n if (isEmptyObject(schema)) {\n logger.debug(`Component has no properties:' ${this.#fullyQualifiedName}'`);\n }\n\n return ts.factory.createInterfaceDeclaration(\n undefined,\n this.#id,\n EntityProcessor.#processTypeParameters(schema),\n undefined,\n this.#processTypeElements(schema),\n );\n }\n\n #processEnum({ enum: members }: EnumSchema): Statement {\n return ts.factory.createEnumDeclaration(\n undefined,\n this.#id,\n members.map((member) => ts.factory.createEnumMember(member, ts.factory.createStringLiteral(member))),\n );\n }\n\n #processExtendedClass(schema: Schema): Statement | undefined {\n const { logger } = this.#owner;\n\n if (isComposedSchema(schema)) {\n const decomposed = decomposeSchema(schema);\n\n if (decomposed.length > 2) {\n logger.debug(\n schema,\n `Schema for '${this.#fullyQualifiedName}' has more than two components. This plugin will ignore it.`,\n );\n return undefined;\n }\n\n const [parent, child] = decomposed;\n\n if (!isReferenceSchema(parent)) {\n logger.debug(parent, 'Only reference schema allowed for parent class');\n return undefined;\n }\n\n const declaration = this.#processClass(child);\n const identifier = this.#processParentClass(parent);\n\n return (\n declaration &&\n ts.factory.updateInterfaceDeclaration(\n declaration,\n declaration.modifiers,\n declaration.name,\n declaration.typeParameters,\n [\n ts.factory.createHeritageClause(ts.SyntaxKind.ExtendsKeyword, [\n ts.factory.createExpressionWithTypeArguments(identifier, undefined),\n ]),\n ],\n declaration.members,\n )\n );\n }\n\n return this.#processClass(schema);\n }\n\n #processParentClass(schema: ReferenceSchema): Identifier {\n const { imports, paths } = this.#dependencies;\n\n const specifier = convertReferenceSchemaToSpecifier(schema);\n const path = paths.createRelativePath(convertReferenceSchemaToPath(schema));\n\n return imports.default.getIdentifier(path) ?? imports.default.add(path, specifier, true);\n }\n\n #processTypeElements({ properties }: ObjectSchema): readonly TypeElement[] {\n return Object.entries(properties ?? {}).map(([name, schema]) => {\n const [type] = new TypeSchemaProcessor(schema, this.#dependencies, this.#transferTypes).process();\n\n return ts.factory.createPropertySignature(\n undefined,\n name,\n isNullableSchema(schema) ? ts.factory.createToken(ts.SyntaxKind.QuestionToken) : undefined,\n type,\n );\n });\n }\n\n static #processTypeParameters(schema: Schema): readonly TypeParameterDeclaration[] | undefined {\n return findTypeParameters(schema)\n ?.map(String)\n .map((name) =>\n ts.factory.createTypeParameterDeclaration(\n undefined,\n name,\n undefined,\n ts.factory.createKeywordTypeNode(ts.SyntaxKind.UnknownKeyword),\n ),\n );\n }\n}\n"],"version":3}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vaadin/hilla-generator-plugin-backbone",
3
- "version": "25.2.0-alpha3",
3
+ "version": "25.2.0-alpha5",
4
4
  "description": "A Hilla TypeScript Generator plugin to generate basic code",
5
5
  "main": "index.js",
6
6
  "type": "module",
@@ -49,11 +49,11 @@
49
49
  "access": "public"
50
50
  },
51
51
  "dependencies": {
52
- "@vaadin/hilla-generator-core": "25.2.0-alpha3",
53
- "@vaadin/hilla-generator-plugin-client": "25.2.0-alpha3",
54
- "@vaadin/hilla-generator-utils": "25.2.0-alpha3",
52
+ "@vaadin/hilla-generator-core": "25.2.0-alpha5",
53
+ "@vaadin/hilla-generator-plugin-client": "25.2.0-alpha5",
54
+ "@vaadin/hilla-generator-utils": "25.2.0-alpha5",
55
55
  "fast-deep-equal": "3.1.3",
56
56
  "openapi-types": "12.1.3",
57
- "typescript": "5.9.3"
57
+ "typescript": "6.0.3"
58
58
  }
59
59
  }