@akanjs/devkit 0.0.66 → 0.0.68

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@akanjs/devkit",
3
- "version": "0.0.66",
3
+ "version": "0.0.68",
4
4
  "type": "module",
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -1,4 +1,3 @@
1
- #!/usr/bin/env ts-node
2
1
  var __create = Object.create;
3
2
  var __defProp = Object.defineProperty;
4
3
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
@@ -126,10 +125,29 @@ class TypeScriptDependencyScanner {
126
125
  if (ts.isStringLiteral(moduleSpecifier))
127
126
  imports.push(moduleSpecifier.text);
128
127
  }
128
+ if (ts.isCallExpression(node)) {
129
+ if (node.expression.kind === ts.SyntaxKind.ImportKeyword) {
130
+ if (node.arguments.length > 0) {
131
+ const arg = node.arguments[0];
132
+ if (ts.isStringLiteral(arg))
133
+ imports.push(arg.text);
134
+ }
135
+ }
136
+ if (ts.isArrowFunction(node.expression) && node.expression.body) {
137
+ const body = node.expression.body;
138
+ if (ts.isCallExpression(body) && body.expression.kind === ts.SyntaxKind.ImportKeyword) {
139
+ if (body.arguments.length > 0) {
140
+ const arg = body.arguments[0];
141
+ if (ts.isStringLiteral(arg))
142
+ imports.push(arg.text);
143
+ }
144
+ }
145
+ }
146
+ }
129
147
  ts.forEachChild(node, visit);
130
148
  };
131
149
  visit(sourceFile);
132
- return imports;
150
+ return [...new Set(imports)];
133
151
  }
134
152
  generateDependencyGraph() {
135
153
  let graph = "Dependency Graph:\n\n";
@@ -1,4 +1,3 @@
1
- #!/usr/bin/env ts-node
2
1
  export declare class TypeScriptDependencyScanner {
3
2
  #private;
4
3
  readonly directory: string;
@@ -1,4 +1,3 @@
1
- #!/usr/bin/env ts-node
2
1
  import * as fs from "fs";
3
2
  import * as path from "path";
4
3
  import * as ts from "typescript";
@@ -94,10 +93,29 @@ class TypeScriptDependencyScanner {
94
93
  if (ts.isStringLiteral(moduleSpecifier))
95
94
  imports.push(moduleSpecifier.text);
96
95
  }
96
+ if (ts.isCallExpression(node)) {
97
+ if (node.expression.kind === ts.SyntaxKind.ImportKeyword) {
98
+ if (node.arguments.length > 0) {
99
+ const arg = node.arguments[0];
100
+ if (ts.isStringLiteral(arg))
101
+ imports.push(arg.text);
102
+ }
103
+ }
104
+ if (ts.isArrowFunction(node.expression) && node.expression.body) {
105
+ const body = node.expression.body;
106
+ if (ts.isCallExpression(body) && body.expression.kind === ts.SyntaxKind.ImportKeyword) {
107
+ if (body.arguments.length > 0) {
108
+ const arg = body.arguments[0];
109
+ if (ts.isStringLiteral(arg))
110
+ imports.push(arg.text);
111
+ }
112
+ }
113
+ }
114
+ }
97
115
  ts.forEachChild(node, visit);
98
116
  };
99
117
  visit(sourceFile);
100
- return imports;
118
+ return [...new Set(imports)];
101
119
  }
102
120
  generateDependencyGraph() {
103
121
  let graph = "Dependency Graph:\n\n";