pasika 0.10.21 → 0.10.22

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.
@@ -63,6 +63,17 @@ function isExported(node) {
63
63
  if (!ts.canHaveModifiers(node)) return false;
64
64
  return (ts.getModifiers(node) ?? []).some((modifier) => modifier.kind === ts.SyntaxKind.ExportKeyword);
65
65
  }
66
+ function namedExportedLocalNames(sourceFile) {
67
+ const names = /* @__PURE__ */ new Set();
68
+ for (const statement of sourceFile.statements) {
69
+ if (!ts.isExportDeclaration(statement) || statement.moduleSpecifier || !statement.exportClause) continue;
70
+ if (!ts.isNamedExports(statement.exportClause)) continue;
71
+ for (const element of statement.exportClause.elements) {
72
+ names.add((element.propertyName ?? element.name).text);
73
+ }
74
+ }
75
+ return names;
76
+ }
66
77
  function containsJsx(node) {
67
78
  let found = false;
68
79
  const visit = (child) => {
@@ -120,16 +131,20 @@ function componentFromVariable(node) {
120
131
  function parseComponentInfo(text, filename, options) {
121
132
  const sourceFile = ts.createSourceFile(path.resolve(filename), text, ts.ScriptTarget.Latest, true, ts.ScriptKind.TSX);
122
133
  const components = [];
134
+ const namedExports = namedExportedLocalNames(sourceFile);
123
135
  for (const statement of sourceFile.statements) {
124
- const exported = isExported(statement);
125
- if (!exported && !options?.includeNonExported) continue;
136
+ const statementExported = isExported(statement);
126
137
  if (ts.isFunctionDeclaration(statement)) {
138
+ const name = statement.name?.text;
139
+ if (!options?.includeNonExported && !statementExported && (!name || !namedExports.has(name))) continue;
127
140
  const component = componentFromFunction(statement);
128
141
  if (component) components.push(component);
129
142
  continue;
130
143
  }
131
144
  if (ts.isVariableStatement(statement)) {
132
145
  for (const declaration of statement.declarationList.declarations) {
146
+ const name = ts.isIdentifier(declaration.name) ? declaration.name.text : void 0;
147
+ if (!options?.includeNonExported && !statementExported && (!name || !namedExports.has(name))) continue;
133
148
  const component = componentFromVariable(declaration);
134
149
  if (component) components.push(component);
135
150
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pasika",
3
- "version": "0.10.21",
3
+ "version": "0.10.22",
4
4
  "description": "Reusable agent setup package",
5
5
  "repository": {
6
6
  "type": "git",