@jay-framework/compiler-analyze-exported-types 0.24.6 → 0.25.0

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.
Files changed (2) hide show
  1. package/dist/index.js +28 -9
  2. package/package.json +6 -6
package/dist/index.js CHANGED
@@ -34,6 +34,7 @@ const {
34
34
  isInterfaceDeclaration,
35
35
  isNamedImports,
36
36
  isTypeAliasDeclaration,
37
+ isVariableDeclaration,
37
38
  isVariableStatement,
38
39
  parseConfigFileTextToJson
39
40
  } = c;
@@ -127,6 +128,26 @@ function findRootCallIdentifier(node) {
127
128
  }
128
129
  return void 0;
129
130
  }
131
+ function chainRootsAtMakeJayStackComponent(initializer, tsTypeChecker, makeJayStackSymbol, seen = /* @__PURE__ */ new Set()) {
132
+ if (!isCallExpression(initializer)) return false;
133
+ const rootIdentifier = findRootCallIdentifier(initializer);
134
+ if (!rootIdentifier) return false;
135
+ const rootType = tsTypeChecker.getTypeAtLocation(rootIdentifier);
136
+ if (rootType.symbol === makeJayStackSymbol) return true;
137
+ const symbol = tsTypeChecker.getSymbolAtLocation(rootIdentifier);
138
+ if (!symbol || seen.has(symbol)) return false;
139
+ seen.add(symbol);
140
+ const declaration = symbol.valueDeclaration;
141
+ if (declaration && isVariableDeclaration(declaration) && declaration.initializer) {
142
+ return chainRootsAtMakeJayStackComponent(
143
+ declaration.initializer,
144
+ tsTypeChecker,
145
+ makeJayStackSymbol,
146
+ seen
147
+ );
148
+ }
149
+ return false;
150
+ }
130
151
  function isExportedStatement(statement) {
131
152
  return Boolean(
132
153
  statement.modifiers && statement.modifiers.find(
@@ -207,15 +228,13 @@ function analyzeExportedTypes(filename, options = {}) {
207
228
  types.push(getComponentType(tsTypeChecker, name, componentType));
208
229
  return;
209
230
  }
210
- if (MAKE_JAY_STACK_COMPONENT2.symbol) {
211
- const rootIdentifier = findRootCallIdentifier(declaration.initializer);
212
- if (rootIdentifier) {
213
- const rootType = tsTypeChecker.getTypeAtLocation(rootIdentifier);
214
- if (rootType.symbol === MAKE_JAY_STACK_COMPONENT2.symbol) {
215
- types.push(new JayComponentType(name, [], true));
216
- return;
217
- }
218
- }
231
+ if (MAKE_JAY_STACK_COMPONENT2.symbol && chainRootsAtMakeJayStackComponent(
232
+ declaration.initializer,
233
+ tsTypeChecker,
234
+ MAKE_JAY_STACK_COMPONENT2.symbol
235
+ )) {
236
+ types.push(new JayComponentType(name, [], true));
237
+ return;
219
238
  }
220
239
  }
221
240
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jay-framework/compiler-analyze-exported-types",
3
- "version": "0.24.6",
3
+ "version": "0.25.0",
4
4
  "description": "",
5
5
  "license": "Apache-2.0",
6
6
  "main": "dist/index.js",
@@ -25,10 +25,10 @@
25
25
  },
26
26
  "author": "",
27
27
  "dependencies": {
28
- "@jay-framework/compiler-shared": "^0.24.6",
29
- "@jay-framework/component": "^0.24.6",
30
- "@jay-framework/runtime": "^0.24.6",
31
- "@jay-framework/secure": "^0.24.6",
28
+ "@jay-framework/compiler-shared": "^0.25.0",
29
+ "@jay-framework/component": "^0.25.0",
30
+ "@jay-framework/runtime": "^0.25.0",
31
+ "@jay-framework/secure": "^0.25.0",
32
32
  "@types/js-yaml": "^4.0.9",
33
33
  "change-case": "^4.1.2",
34
34
  "js-yaml": "^4.1.0",
@@ -38,7 +38,7 @@
38
38
  },
39
39
  "devDependencies": {
40
40
  "@caiogondim/strip-margin": "^1.0.0",
41
- "@jay-framework/dev-environment": "^0.24.6",
41
+ "@jay-framework/dev-environment": "^0.25.0",
42
42
  "@testing-library/jest-dom": "^6.2.0",
43
43
  "@types/js-beautify": "^1",
44
44
  "@types/node": "^20.11.5",