mobx-tanstack-query-api 0.0.83 → 0.0.85

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
- {"version":3,"file":"endpoint-jsdoc.tmpl.d.ts","sourceRoot":"","sources":["../../../src/codegen/templates/endpoint-jsdoc.tmpl.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAEhD,OAAO,EAAE,sBAAsB,EAAE,MAAM,aAAa,CAAC;AAErD,MAAM,WAAW,uBAAuB;IACtC,KAAK,EAAE,SAAS,CAAC;IACjB,aAAa,EAAE,SAAS,CAAC;IACzB,SAAS,EAAE,sBAAsB,CAAC;IAClC,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,eAAO,MAAM,iBAAiB,GAAI,mCAI/B,uBAAuB,WAkHzB,CAAC"}
1
+ {"version":3,"file":"endpoint-jsdoc.tmpl.d.ts","sourceRoot":"","sources":["../../../src/codegen/templates/endpoint-jsdoc.tmpl.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAEhD,OAAO,EAAE,sBAAsB,EAAE,MAAM,aAAa,CAAC;AAErD,MAAM,WAAW,uBAAuB;IACtC,KAAK,EAAE,SAAS,CAAC;IACjB,aAAa,EAAE,SAAS,CAAC;IACzB,SAAS,EAAE,sBAAsB,CAAC;IAClC,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,eAAO,MAAM,iBAAiB,GAAI,mCAI/B,uBAAuB,WA2HzB,CAAC"}
@@ -1,3 +1,4 @@
1
+ import { splitTextByLines } from 'yummies/text';
1
2
  export const endpointJSDocTmpl = ({ route, configuration, offset = 0, }) => {
2
3
  const { routeName } = route;
3
4
  const rawRoute = route.raw;
@@ -6,10 +7,19 @@ export const endpointJSDocTmpl = ({ route, configuration, offset = 0, }) => {
6
7
  const { _, formatDescription } = utils;
7
8
  const jsDocLines = [];
8
9
  if (rawRoute.description) {
9
- jsDocLines.push({
10
- name: 'description',
11
- content: formatDescription(rawRoute.description, true),
12
- });
10
+ const descriptionLines = splitTextByLines(rawRoute.description, 60)
11
+ .filter(Boolean)
12
+ .map((line) => ({
13
+ content: formatDescription(line, true),
14
+ }));
15
+ if (descriptionLines.length > 0) {
16
+ jsDocLines.push(...descriptionLines, { content: '' });
17
+ }
18
+ else {
19
+ jsDocLines.push({
20
+ content: 'No description',
21
+ });
22
+ }
13
23
  }
14
24
  else {
15
25
  jsDocLines.push({
@@ -1 +1 @@
1
- {"version":3,"file":"endpoint-per-file.tmpl.d.ts","sourceRoot":"","sources":["../../../src/codegen/templates/endpoint-per-file.tmpl.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAC;AAEvD,OAAO,KAAK,EACV,mBAAmB,EACnB,gBAAgB,EAChB,cAAc,EACd,sBAAsB,EACtB,QAAQ,EACT,MAAM,aAAa,CAAC;AAOrB,MAAM,WAAW,yBAA0B,SAAQ,SAAS;IAC1D,KAAK,EAAE,SAAS,CAAC;IACjB,aAAa,EAAE,SAAS,CAAC;IACzB,SAAS,EAAE,sBAAsB,CAAC;IAClC,cAAc,EAAE,cAAc,CAAC;IAC/B,gBAAgB,EAAE,mBAAmB,CAAC;IACtC,KAAK,EAAE,gBAAgB,CAAC;IACxB,yBAAyB,EAAE,MAAM,CAAC;IAClC,SAAS,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;IACzB,QAAQ,EAAE,KAAK,CAAC,QAAQ,CAAC,CAAC;CAC3B;AAED,eAAO,MAAM,mBAAmB,GAAU,gIAUvC,yBAAyB;;;EA+G3B,CAAC"}
1
+ {"version":3,"file":"endpoint-per-file.tmpl.d.ts","sourceRoot":"","sources":["../../../src/codegen/templates/endpoint-per-file.tmpl.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAC;AAEvD,OAAO,KAAK,EACV,mBAAmB,EACnB,gBAAgB,EAChB,cAAc,EACd,sBAAsB,EACtB,QAAQ,EACT,MAAM,aAAa,CAAC;AAOrB,MAAM,WAAW,yBAA0B,SAAQ,SAAS;IAC1D,KAAK,EAAE,SAAS,CAAC;IACjB,aAAa,EAAE,SAAS,CAAC;IACzB,SAAS,EAAE,sBAAsB,CAAC;IAClC,cAAc,EAAE,cAAc,CAAC;IAC/B,gBAAgB,EAAE,mBAAmB,CAAC;IACtC,KAAK,EAAE,gBAAgB,CAAC;IACxB,yBAAyB,EAAE,MAAM,CAAC;IAClC,SAAS,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;IACzB,QAAQ,EAAE,KAAK,CAAC,QAAQ,CAAC,CAAC;CAC3B;AAED,eAAO,MAAM,mBAAmB,GAAU,gIAUvC,yBAAyB;;;EA8G3B,CAAC"}
@@ -76,7 +76,6 @@ export const endpointPerFileTmpl = async ({ route, configuration, apiParams, for
76
76
  configuration,
77
77
  apiParams,
78
78
  })}
79
- /*#__PURE__*/
80
79
  export const ${_.camelCase(route.routeName.usage)} = ${requestInfoInstanceContent}
81
80
  `),
82
81
  };
@@ -1 +1 @@
1
- {"version":3,"file":"remove-unused-types.d.ts","sourceRoot":"","sources":["../../../src/codegen/utils/remove-unused-types.ts"],"names":[],"mappings":"AA6GA,eAAO,MAAM,iBAAiB,GAAU,SAAS;IAAE,GAAG,EAAE,MAAM,CAAA;CAAE,kBAK/D,CAAC"}
1
+ {"version":3,"file":"remove-unused-types.d.ts","sourceRoot":"","sources":["../../../src/codegen/utils/remove-unused-types.ts"],"names":[],"mappings":"AAqIA,eAAO,MAAM,iBAAiB,GAAU,SAAS;IAAE,GAAG,EAAE,MAAM,CAAA;CAAE,kBAK/D,CAAC"}
@@ -1,5 +1,5 @@
1
1
  /* eslint-disable no-constant-condition */
2
- import { Project, SyntaxKind } from 'ts-morph';
2
+ import { Project, SyntaxKind, Node } from 'ts-morph';
3
3
  import path from 'node:path';
4
4
  const removeUnusedTypesItteration = async ({ dir }) => {
5
5
  const project = new Project();
@@ -14,7 +14,8 @@ const removeUnusedTypesItteration = async ({ dir }) => {
14
14
  const candidateTypes = new Map();
15
15
  for (const [name, declarations] of exportedDeclarations) {
16
16
  const validDeclarations = declarations.filter((decl) => decl.getKind() === SyntaxKind.InterfaceDeclaration ||
17
- decl.getKind() === SyntaxKind.TypeAliasDeclaration);
17
+ decl.getKind() === SyntaxKind.TypeAliasDeclaration ||
18
+ decl.getKind() === SyntaxKind.EnumDeclaration);
18
19
  if (validDeclarations.length > 0) {
19
20
  candidateTypes.set(name, validDeclarations);
20
21
  }
@@ -33,16 +34,35 @@ const removeUnusedTypesItteration = async ({ dir }) => {
33
34
  usedTypes.add(name);
34
35
  }
35
36
  }
37
+ const memberAccessExpressions = file.getDescendantsOfKind(SyntaxKind.PropertyAccessExpression);
38
+ for (const expr of memberAccessExpressions) {
39
+ const expression = expr.getExpression();
40
+ if (Node.isIdentifier(expression)) {
41
+ const name = expression.getText();
42
+ if (candidateTypes.has(name)) {
43
+ usedTypes.add(name);
44
+ }
45
+ }
46
+ }
36
47
  }
37
48
  const dependencyGraph = new Map();
38
49
  for (const [name, declarations] of candidateTypes) {
39
50
  const dependencies = new Set();
40
51
  for (const decl of declarations) {
41
- const identifiers = decl.getDescendantsOfKind(SyntaxKind.Identifier);
42
- for (const ident of identifiers) {
43
- const refName = ident.getText();
44
- if (candidateTypes.has(refName)) {
45
- dependencies.add(refName);
52
+ const typeReferences = decl.getDescendantsOfKind(SyntaxKind.TypeReference);
53
+ for (const ref of typeReferences) {
54
+ const typeName = ref.getTypeName().getText();
55
+ if (candidateTypes.has(typeName)) {
56
+ dependencies.add(typeName);
57
+ }
58
+ }
59
+ if (decl.getKind() === SyntaxKind.EnumDeclaration) {
60
+ const initializers = decl.getDescendantsOfKind(SyntaxKind.Identifier);
61
+ for (const init of initializers) {
62
+ const text = init.getText();
63
+ if (candidateTypes.has(text)) {
64
+ dependencies.add(text);
65
+ }
46
66
  }
47
67
  }
48
68
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mobx-tanstack-query-api",
3
- "version": "0.0.83",
3
+ "version": "0.0.85",
4
4
  "keywords": [],
5
5
  "author": "js2me",
6
6
  "license": "MIT",
@@ -26,7 +26,7 @@
26
26
  "mobx-tanstack-query": "^5.3.1",
27
27
  "swagger-typescript-api": "13.2.1",
28
28
  "ts-morph": "^26.0.0",
29
- "yummies": "^3.2.9"
29
+ "yummies": "^3.3.0"
30
30
  },
31
31
  "devDependencies": {
32
32
  "@types/node": "^20.17.11",