@vaadin/hilla-generator-plugin-subtypes 24.6.4 → 24.7.0-alpha10

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,7 +1,7 @@
1
- import ts from 'typescript';
1
+ import { type SourceFile } from 'typescript';
2
2
  export declare class ModelFixProcessor {
3
3
  #private;
4
- constructor(source: ts.SourceFile);
5
- process(): ts.SourceFile;
4
+ constructor(source: SourceFile);
5
+ process(): SourceFile;
6
6
  }
7
7
  //# sourceMappingURL=ModelFixProcessor.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"ModelFixProcessor.d.ts","sourceRoot":"","sources":["src/ModelFixProcessor.ts"],"names":[],"mappings":"AACA,OAAO,EAA0D,MAAM,YAAY,CAAC;AASpF,qBAAa,iBAAiB;;gBAGhB,MAAM,EAAE,EAAE,CAAC,UAAU;IAIjC,OAAO,IAAI,EAAE,CAAC,UAAU;CAsBzB"}
1
+ {"version":3,"file":"ModelFixProcessor.d.ts","sourceRoot":"","sources":["src/ModelFixProcessor.ts"],"names":[],"mappings":"AACA,OAAW,EAAqB,KAAK,UAAU,EAAE,MAAM,YAAY,CAAC;AASpE,qBAAa,iBAAiB;;gBAGhB,MAAM,EAAE,UAAU;IAI9B,OAAO,IAAI,UAAU;CAsBtB"}
@@ -1 +1 @@
1
- {"version":3,"file":"ModelFixProcessor.js","sourceRoot":"","sources":["src/ModelFixProcessor.ts"],"names":[],"mappings":"AAAA,OAAO,gBAAgB,MAAM,mDAAmD,CAAC;AACjF,OAAO,EAAE,EAAE,EAAsD,MAAM,YAAY,CAAC;AAEpF,SAAS,oBAAoB,CAAC,IAAqB;IACjD,IAAI,EAAE,CAAC,YAAY,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,eAAe,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,gBAAgB,CAAC,IAAI,CAAC,EAAE,CAAC;QACnF,OAAO,IAAI,CAAC,IAAI,CAAC;IACnB,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC;AAED,MAAM,OAAO,iBAAiB;IACnB,OAAO,CAAgB;IAEhC,YAAY,MAAqB;QAC/B,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC;IACxB,CAAC;IAED,OAAO;QACL,MAAM,UAAU,GAAG,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,SAAS,EAAE,EAAE;YAC3D,gDAAgD;YAChD,IAAI,EAAE,CAAC,kBAAkB,CAAC,SAAS,CAAC,EAAE,CAAC;gBACrC,MAAM,OAAO,GAAG,SAAS,CAAC,OAAO,CAAC,MAAM,CACtC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,aAAa,CAAC,MAAM,CAAC,IAAI,oBAAoB,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,OAAO,CAAC,CACzF,CAAC;gBAEF,OAAO,EAAE,CAAC,OAAO,CAAC,sBAAsB,CACtC,SAAS,CAAC,SAAS,EACnB,SAAS,CAAC,IAAI,EACd,SAAS,CAAC,cAAc,EACxB,SAAS,CAAC,eAAe,EACzB,OAAO,CACR,CAAC;YACJ,CAAC;YAED,OAAO,SAAS,CAAC;QACnB,CAAC,CAAC,CAAC;QAEH,OAAO,gBAAgB,CAAC,UAAU,EAAE,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;IAC7D,CAAC;CACF","sourcesContent":["import createSourceFile from '@vaadin/hilla-generator-utils/createSourceFile.js';\nimport ts, { type ClassDeclaration, type GetAccessorDeclaration } from 'typescript';\n\nfunction propertyNameToString(node: ts.PropertyName): string | null {\n if (ts.isIdentifier(node) || ts.isStringLiteral(node) || ts.isNumericLiteral(node)) {\n return node.text;\n }\n return null;\n}\n\nexport class ModelFixProcessor {\n readonly #source: ts.SourceFile;\n\n constructor(source: ts.SourceFile) {\n this.#source = source;\n }\n\n process(): ts.SourceFile {\n const statements = this.#source.statements.map((statement) => {\n // filter out the @type property from all models\n if (ts.isClassDeclaration(statement)) {\n const members = statement.members.filter(\n (member) => !(ts.isGetAccessor(member) && propertyNameToString(member.name) === '@type'),\n );\n\n return ts.factory.createClassDeclaration(\n statement.modifiers,\n statement.name,\n statement.typeParameters,\n statement.heritageClauses,\n members,\n );\n }\n\n return statement;\n });\n\n return createSourceFile(statements, this.#source.fileName);\n }\n}\n"]}
1
+ {"version":3,"file":"ModelFixProcessor.js","sourceRoot":"","sources":["src/ModelFixProcessor.ts"],"names":[],"mappings":"AAAA,OAAO,gBAAgB,MAAM,mDAAmD,CAAC;AACjF,OAAO,EAAE,EAAE,EAAsC,MAAM,YAAY,CAAC;AAEpE,SAAS,oBAAoB,CAAC,IAAkB;IAC9C,IAAI,EAAE,CAAC,YAAY,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,eAAe,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,gBAAgB,CAAC,IAAI,CAAC,EAAE,CAAC;QACnF,OAAO,IAAI,CAAC,IAAI,CAAC;IACnB,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC;AAED,MAAM,OAAO,iBAAiB;IACnB,OAAO,CAAa;IAE7B,YAAY,MAAkB;QAC5B,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC;IACxB,CAAC;IAED,OAAO;QACL,MAAM,UAAU,GAAG,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,SAAS,EAAE,EAAE;YAC3D,gDAAgD;YAChD,IAAI,EAAE,CAAC,kBAAkB,CAAC,SAAS,CAAC,EAAE,CAAC;gBACrC,MAAM,OAAO,GAAG,SAAS,CAAC,OAAO,CAAC,MAAM,CACtC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,aAAa,CAAC,MAAM,CAAC,IAAI,oBAAoB,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,OAAO,CAAC,CACzF,CAAC;gBAEF,OAAO,EAAE,CAAC,OAAO,CAAC,sBAAsB,CACtC,SAAS,CAAC,SAAS,EACnB,SAAS,CAAC,IAAI,EACd,SAAS,CAAC,cAAc,EACxB,SAAS,CAAC,eAAe,EACzB,OAAO,CACR,CAAC;YACJ,CAAC;YAED,OAAO,SAAS,CAAC;QACnB,CAAC,CAAC,CAAC;QAEH,OAAO,gBAAgB,CAAC,UAAU,EAAE,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;IAC7D,CAAC;CACF","sourcesContent":["import createSourceFile from '@vaadin/hilla-generator-utils/createSourceFile.js';\nimport ts, { type PropertyName, type SourceFile } from 'typescript';\n\nfunction propertyNameToString(node: PropertyName): string | null {\n if (ts.isIdentifier(node) || ts.isStringLiteral(node) || ts.isNumericLiteral(node)) {\n return node.text;\n }\n return null;\n}\n\nexport class ModelFixProcessor {\n readonly #source: SourceFile;\n\n constructor(source: SourceFile) {\n this.#source = source;\n }\n\n process(): SourceFile {\n const statements = this.#source.statements.map((statement) => {\n // filter out the @type property from all models\n if (ts.isClassDeclaration(statement)) {\n const members = statement.members.filter(\n (member) => !(ts.isGetAccessor(member) && propertyNameToString(member.name) === '@type'),\n );\n\n return ts.factory.createClassDeclaration(\n statement.modifiers,\n statement.name,\n statement.typeParameters,\n statement.heritageClauses,\n members,\n );\n }\n\n return statement;\n });\n\n return createSourceFile(statements, this.#source.fileName);\n }\n}\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vaadin/hilla-generator-plugin-subtypes",
3
- "version": "24.6.4",
3
+ "version": "24.7.0-alpha10",
4
4
  "description": "A Hilla TypeScript Generator plugin to support JsonSubTypes",
5
5
  "main": "index.js",
6
6
  "type": "module",
@@ -14,9 +14,10 @@
14
14
  "build:copy": "cd src && copyfiles **/*.d.ts ..",
15
15
  "lint": "eslint src test",
16
16
  "lint:fix": "eslint src test --fix",
17
- "test": "mocha test/**/*.spec.ts --config ../../../.mocharc.cjs",
18
- "test:update": "npm run test -- --update",
19
- "test:coverage": "c8 --experimental-monocart -c ../../../.c8rc.json npm test",
17
+ "test": "vitest --run",
18
+ "test:coverage": "vitest --run --coverage",
19
+ "test:update": "vitest --run --update",
20
+ "test:watch": "vitest",
20
21
  "typecheck": "tsc --noEmit"
21
22
  },
22
23
  "exports": {
@@ -50,32 +51,12 @@
50
51
  "access": "public"
51
52
  },
52
53
  "dependencies": {
53
- "@vaadin/hilla-generator-core": "24.6.4",
54
- "@vaadin/hilla-generator-plugin-client": "24.6.4",
55
- "@vaadin/hilla-generator-plugin-model": "24.6.4",
56
- "@vaadin/hilla-generator-utils": "24.6.4",
54
+ "@vaadin/hilla-generator-core": "24.7.0-alpha10",
55
+ "@vaadin/hilla-generator-plugin-client": "24.7.0-alpha10",
56
+ "@vaadin/hilla-generator-plugin-model": "24.7.0-alpha10",
57
+ "@vaadin/hilla-generator-utils": "24.7.0-alpha10",
57
58
  "fast-deep-equal": "^3.1.3",
58
59
  "openapi-types": "^12.1.3",
59
- "typescript": "5.7.2"
60
- },
61
- "devDependencies": {
62
- "@types/chai": "^4.3.6",
63
- "@types/mocha": "^10.0.2",
64
- "@types/node": "^20.7.1",
65
- "@types/sinon": "^10.0.17",
66
- "@types/sinon-chai": "^3.2.10",
67
- "@vaadin/hilla-generator-core": "24.6.4",
68
- "@vaadin/hilla-generator-plugin-client": "24.6.4",
69
- "@vaadin/hilla-generator-plugin-model": "24.6.4",
70
- "c8": "^10.1.2",
71
- "chai": "^4.3.10",
72
- "concurrently": "^8.2.1",
73
- "copyfiles": "^2.4.1",
74
- "mocha": "^10.8.2",
75
- "monocart-coverage-reports": "^2.11.5",
76
- "pino": "^8.21.0",
77
- "sinon": "^16.1.3",
78
- "sinon-chai": "^3.7.0",
79
- "type-fest": "^4.3.2"
60
+ "typescript": "5.7.3"
80
61
  }
81
62
  }