@vaadin/hilla-generator-plugin-transfertypes 25.3.0-alpha8 → 25.3.0-alpha9
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.
- package/index.js +1 -1
- package/index.js.map +1 -1
- package/package.json +7 -7
package/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
+
import { factory } from "@typescript/typescript6";
|
|
1
2
|
import Plugin from "@vaadin/hilla-generator-core/Plugin.js";
|
|
2
|
-
import { factory } from "typescript";
|
|
3
3
|
function createReplacedTypeMaker(name) {
|
|
4
4
|
return (schema) => ({ dependencies: { imports }, typeArguments }) => {
|
|
5
5
|
let id;
|
package/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":"AAAA,
|
|
1
|
+
{"mappings":"AAAA,SAAS,wCAA0D;AACnE,OAAO,oDAAqD;AAY5D,SAAS,wBAAwBA,MAAiC;AAChE,QAAO,CAAC,WACN,CAAC,EAAE,cAAc,EAAE,SAAS,EAAE,eAAe,KAAK;EAChD,IAAIC;AAEJ,MAAI,UAAU,mBAAmB,QAAQ;GACvC,MAAM,aAAa,OAAO;AAE1B,OAAI,WAAW,OAAO;AACpB,SACE,QAAQ,MAAM,cAAc,WAAW,QAAQ,WAAW,MAAM,IAChE,QAAQ,MAAM,IAAI,WAAW,QAAQ,WAAW,MAAM;GACzD;AAED,OAAI,WAAW,SAAS;AACtB,SACE,QAAQ,QAAQ,cAAc,WAAW,OAAO,IAChD,QAAQ,QAAQ,IAAI,WAAW,QAAQ,WAAW,QAAQ;GAC7D;EACF;AAED,SAAO,QAAQ,wBAAwB,MAAM,MAAM,cAAc;CAClE;AACJ;AAID,MAAMC,gBAA+B,OAAO,YAC1C;CAAC;CAAQ;CAAU;CAAgB;CAAe;AAAa,EAAC,IAAI,CAAC,SAAS,EAC3E,yCAAyC,KAAK,GAC/C,wBAAwB,KAAK,AAC9B,EAAC,CACH;AAED,eAAe,MAAM,4BAA4B,OAAO;CAGtD,IAAa,OAAe;AAC1B,SAAO,OAAO,KAAK;CACpB;CAED,AAAS,QAAQ,EAAE,KAAK,EAAE,YAAY,EAAE,eAA8B,EAAQ;AAC5E,OAAK,MAAM,CAAC,KAAK,MAAM,IAAI,OAAO,QAAQ,cAAc,EAAE;AACxD,iBAAc,IAAI,KAAK,MAAM,YAAY,UAAU,KAAK,CAAC;EAC1D;AAED,MAAI,YAAY,SAAS;GACvB,MAAM,OAAO,OAAO,KAAK,cAAc;AAEvC,cAAW,UAAU,OAAO,YAC1B,OAAO,QAAQ,WAAW,QAAQ,CAAC,OAAO,CAAC,CAAC,IAAI,MAAM,KAAK,SAAS,IAAI,CAAC,CAC1E;EACF;CACF;AACF","names":["name: string","id: Identifier | undefined","replacedTypes: ReplacedTypes"],"sources":["/opt/agent/work/649c11185a3798db/packages/ts/generator-plugin-transfertypes/src/index.ts"],"sourcesContent":["import { factory, type Identifier } from '@typescript/typescript6';\nimport Plugin from '@vaadin/hilla-generator-core/Plugin.js';\nimport type { SharedStorage, TransferTypeMaker } from '@vaadin/hilla-generator-core/SharedStorage.js';\nimport type { OpenAPIV3 } from 'openapi-types';\n\ntype ReplacedTypeMaker = (schema?: OpenAPIV3.ReferenceObject | OpenAPIV3.SchemaObject) => TransferTypeMaker;\n\ntype FromModule = Readonly<{\n module: string;\n named?: string;\n default?: string;\n}>;\n\nfunction createReplacedTypeMaker(name: string): ReplacedTypeMaker {\n return (schema) =>\n ({ dependencies: { imports }, typeArguments }) => {\n let id: Identifier | undefined;\n\n if (schema && 'x-from-module' in schema) {\n const fromModule = schema['x-from-module'] as FromModule;\n\n if (fromModule.named) {\n id =\n imports.named.getIdentifier(fromModule.module, fromModule.named) ??\n imports.named.add(fromModule.module, fromModule.named);\n }\n\n if (fromModule.default) {\n id =\n imports.default.getIdentifier(fromModule.module) ??\n imports.default.add(fromModule.module, fromModule.default);\n }\n }\n\n return factory.createTypeReferenceNode(id ?? name, typeArguments);\n };\n}\n\ntype ReplacedTypes = Readonly<Record<string, ReplacedTypeMaker>>;\n\nconst replacedTypes: ReplacedTypes = Object.fromEntries(\n ['File', 'Signal', 'NumberSignal', 'ValueSignal', 'ListSignal'].map((name) => [\n `com.vaadin.hilla.runtime.transfertypes.${name}`,\n createReplacedTypeMaker(name),\n ]),\n);\n\nexport default class TransferTypesPlugin extends Plugin {\n declare ['constructor']: typeof TransferTypesPlugin;\n\n override get path(): string {\n return import.meta.url;\n }\n\n override execute({ api: { components }, transferTypes }: SharedStorage): void {\n for (const [key, value] of Object.entries(replacedTypes)) {\n transferTypes.set(key, value(components?.schemas?.[key]));\n }\n\n if (components?.schemas) {\n const keys = Object.keys(replacedTypes);\n\n components.schemas = Object.fromEntries(\n Object.entries(components.schemas).filter(([key]) => !keys.includes(key)),\n );\n }\n }\n}\n"],"version":3}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vaadin/hilla-generator-plugin-transfertypes",
|
|
3
|
-
"version": "25.3.0-
|
|
3
|
+
"version": "25.3.0-alpha9",
|
|
4
4
|
"description": "A plugin to replace types in the generated code",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"type": "module",
|
|
@@ -49,12 +49,12 @@
|
|
|
49
49
|
"access": "public"
|
|
50
50
|
},
|
|
51
51
|
"dependencies": {
|
|
52
|
-
"@
|
|
53
|
-
"@vaadin/hilla-generator-
|
|
54
|
-
"@vaadin/hilla-generator-plugin-
|
|
55
|
-
"@vaadin/hilla-generator-
|
|
52
|
+
"@typescript/typescript6": "6.0.2",
|
|
53
|
+
"@vaadin/hilla-generator-core": "25.3.0-alpha9",
|
|
54
|
+
"@vaadin/hilla-generator-plugin-client": "25.3.0-alpha9",
|
|
55
|
+
"@vaadin/hilla-generator-plugin-model": "25.3.0-alpha9",
|
|
56
|
+
"@vaadin/hilla-generator-utils": "25.3.0-alpha9",
|
|
56
57
|
"fast-deep-equal": "3.1.3",
|
|
57
|
-
"openapi-types": "12.1.3"
|
|
58
|
-
"typescript": "npm:@typescript/typescript6@6.0.2"
|
|
58
|
+
"openapi-types": "12.1.3"
|
|
59
59
|
}
|
|
60
60
|
}
|