cognitive-complexity-ts 0.6.2 → 0.6.4

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/README.md CHANGED
@@ -14,13 +14,13 @@ npm install cognitive-complexity-ts
14
14
 
15
15
  ```bash
16
16
  # UI output (any of the following)
17
+ npx ccts [file path]
18
+ npx cognitive-complexity-ts [file path]
17
19
  npx cognitive-complexity-ts-ui [file path]
18
20
  npx ccts-ui [file path]
19
21
 
20
22
  # JSON output (any of the following)
21
- npx cognitive-complexity-ts [file path]
22
23
  npx cognitive-complexity-ts-json [file path]
23
- npx ccts [file path]
24
24
  npx ccts-json [file path]
25
25
 
26
26
  ```
@@ -13,10 +13,10 @@ export interface FileOutput {
13
13
  score: number;
14
14
  inner: ContainerOutput[];
15
15
  }
16
- export declare type FolderOutput = {
16
+ export type FolderOutput = {
17
17
  [name: string]: FileOutput | FolderOutput;
18
18
  };
19
- export declare type ProgramOutput = FolderOutput;
19
+ export type ProgramOutput = FolderOutput;
20
20
  export interface ScoreAndInner {
21
21
  score: number;
22
22
  inner: ContainerOutput[];
package/build/src/api.js CHANGED
@@ -1,7 +1,11 @@
1
1
  "use strict";
2
2
  var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
3
  if (k2 === undefined) k2 = k;
4
- Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
5
9
  }) : (function(o, m, k, k2) {
6
10
  if (k2 === undefined) k2 = k;
7
11
  o[k2] = m[k];
@@ -27,7 +27,7 @@ class Scope {
27
27
  scopeToAdd(node, variableBeingDefined) {
28
28
  const local = [];
29
29
  const object = [];
30
- const introducedLocal = node_naming_1.getIntroducedLocalName(node);
30
+ const introducedLocal = (0, node_naming_1.getIntroducedLocalName)(node);
31
31
  if (introducedLocal !== undefined) {
32
32
  local.push(introducedLocal);
33
33
  }
@@ -40,7 +40,7 @@ class Scope {
40
40
  object.push(variableBeingDefined + "." + name);
41
41
  }
42
42
  }
43
- const maybeExpression = node_naming_1.getExpressionToAccessObjectMember(node);
43
+ const maybeExpression = (0, node_naming_1.getExpressionToAccessObjectMember)(node);
44
44
  if (maybeExpression !== undefined) {
45
45
  object.push(maybeExpression);
46
46
  if (variableBeingDefined) {
@@ -1,7 +1,11 @@
1
1
  "use strict";
2
2
  var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
3
  if (k2 === undefined) k2 = k;
4
- Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
5
9
  }) : (function(o, m, k, k2) {
6
10
  if (k2 === undefined) k2 = k;
7
11
  o[k2] = m[k];
@@ -40,10 +44,10 @@ function aggregateCostOfChildren(children, childDepth, topLevel, scope, variable
40
44
  const childCost = nodeCost(child, topLevel, childDepth, scope, variableBeingDefined);
41
45
  score += childCost.score;
42
46
  // a function/class/namespace/type is part of the inner scope we want to output
43
- const name = node_naming_1.chooseContainerName(child, variableBeingDefined);
47
+ const name = (0, node_naming_1.chooseContainerName)(child, variableBeingDefined);
44
48
  if (name !== undefined) {
45
49
  inner.push({
46
- ...node_inspection_1.getColumnAndLine(child),
50
+ ...(0, node_inspection_1.getColumnAndLine)(child),
47
51
  ...childCost,
48
52
  name,
49
53
  });
@@ -87,7 +91,7 @@ function costOfDepth(node, depth) {
87
91
  }
88
92
  function inherentCost(node, scope) {
89
93
  // certain language features carry and inherent cost
90
- if (node_inspection_1.isSequenceOfDifferentBooleanOperations(node)
94
+ if ((0, node_inspection_1.isSequenceOfDifferentBooleanOperations)(node)
91
95
  || ts.isCatchClause(node)
92
96
  || ts.isConditionalExpression(node)
93
97
  || ts.isConditionalTypeNode(node)
@@ -98,10 +102,10 @@ function inherentCost(node, scope) {
98
102
  || ts.isMappedTypeNode(node)
99
103
  || ts.isSwitchStatement(node)
100
104
  || ts.isWhileStatement(node)
101
- || node_inspection_1.isBreakOrContinueToLabel(node)) {
105
+ || (0, node_inspection_1.isBreakOrContinueToLabel)(node)) {
102
106
  return 1;
103
107
  }
104
- const calledName = node_naming_1.getNameIfCalledNode(node);
108
+ const calledName = (0, node_naming_1.getNameIfCalledNode)(node);
105
109
  if (calledName !== undefined) {
106
110
  return scope.includes(calledName) ? 1 : 0;
107
111
  }
@@ -122,7 +126,7 @@ function inherentCost(node, scope) {
122
126
  }
123
127
  return score;
124
128
  }
125
- if (node_inspection_1.isBinaryTypeOperator(node)) {
129
+ if ((0, node_inspection_1.isBinaryTypeOperator)(node)) {
126
130
  // This node naturally represents a sequence of binary type operators.
127
131
  // (unlike normal binary operators)
128
132
  let score = 1;
@@ -132,7 +136,7 @@ function inherentCost(node, scope) {
132
136
  // Binary sub-expressions at either end of the syntax list
133
137
  // do not break this sequence of operators in the code; they merely bookend it.
134
138
  const syntaxList = node.getChildren()[0];
135
- const numOfSequenceInterrupts = util_1.countNotAtTheEnds(syntaxList.getChildren(), node_inspection_1.isBinaryTypeOperator);
139
+ const numOfSequenceInterrupts = (0, util_1.countNotAtTheEnds)(syntaxList.getChildren(), node_inspection_1.isBinaryTypeOperator);
136
140
  score += numOfSequenceInterrupts;
137
141
  return score;
138
142
  }
@@ -150,7 +154,7 @@ function nodeCost(node, topLevel, depth = 0, scope = new Scope_1.Scope([], []),
150
154
  // get the ancestors container names from the perspective of this node's children
151
155
  const namedAncestorsOfChildren = scope
152
156
  .maybeAdd(node, variableBeingDefined);
153
- const { same, below } = depth_1.whereAreChildren(node);
157
+ const { same, below } = (0, depth_1.whereAreChildren)(node);
154
158
  /**
155
159
  * The name being introduced (if there is one)
156
160
  * for a variable whose declaration this scope is directly inside of.
@@ -160,15 +164,15 @@ function nodeCost(node, topLevel, depth = 0, scope = new Scope_1.Scope([], []),
160
164
  * let a = f( $undefined$ () => {} );
161
165
  * let a = () => { $undefined$ };
162
166
  */
163
- let newVariableBeingDefined = node_naming_1.getNameOfAssignment(node);
167
+ let newVariableBeingDefined = (0, node_naming_1.getNameOfAssignment)(node);
164
168
  if (newVariableBeingDefined === undefined
165
- && node_inspection_1.passThroughNameBeingAssigned(node)) {
169
+ && (0, node_inspection_1.passThroughNameBeingAssigned)(node)) {
166
170
  newVariableBeingDefined = variableBeingDefined;
167
171
  }
168
172
  const costOfSameDepthChildren = aggregateCostOfChildren(same, depth, topLevel, namedAncestorsOfChildren, newVariableBeingDefined);
169
173
  // The nodes below this node have the same depth number,
170
174
  // iff this node is top level and it is a container.
171
- const container = node_inspection_1.isContainer(node);
175
+ const container = (0, node_inspection_1.isContainer)(node);
172
176
  const depthOfBelow = depth + (topLevel && container ? 0 : 1);
173
177
  const costOfBelowChildren = aggregateCostOfChildren(below, depthOfBelow, false, namedAncestorsOfChildren, newVariableBeingDefined);
174
178
  score += costOfSameDepthChildren.score;
@@ -2,9 +2,9 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.logNode = exports.testLog = void 0;
4
4
  const util_1 = require("util");
5
- exports.testLog = util_1.debuglog("test");
5
+ exports.testLog = (0, util_1.debuglog)("test");
6
6
  function logNode(child) {
7
- exports.testLog(child.getFullText());
7
+ (0, exports.testLog)(child.getFullText());
8
8
  }
9
9
  exports.logNode = logNode;
10
10
  //# sourceMappingURL=debug.js.map
@@ -4,7 +4,11 @@
4
4
  */
5
5
  var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
6
6
  if (k2 === undefined) k2 = k;
7
- Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
7
+ var desc = Object.getOwnPropertyDescriptor(m, k);
8
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
9
+ desc = { enumerable: true, get: function() { return m[k]; } };
10
+ }
11
+ Object.defineProperty(o, k2, desc);
8
12
  }) : (function(o, m, k, k2) {
9
13
  if (k2 === undefined) k2 = k;
10
14
  o[k2] = m[k];
@@ -47,7 +51,7 @@ function whereAreChildren(node) {
47
51
  else if (ts.isDoStatement(node)) {
48
52
  return doStatement(node);
49
53
  }
50
- else if (node_inspection_1.isForLikeStatement(node)) {
54
+ else if ((0, node_inspection_1.isForLikeStatement)(node)) {
51
55
  return forLikeStatement(node);
52
56
  }
53
57
  else if (ts.isFunctionDeclaration(node)) {
@@ -1,7 +1,7 @@
1
1
  import * as ts from "typescript";
2
2
  import { ColumnAndLine } from "../../shared/types";
3
- export declare type ForLikeStatement = ts.ForStatement | ts.ForInOrOfStatement;
4
- export declare type FunctionNode = ts.AccessorDeclaration | ts.ArrowFunction | ts.FunctionDeclaration | ts.FunctionExpression | ts.MethodDeclaration;
3
+ export type ForLikeStatement = ts.ForStatement | ts.ForInOrOfStatement;
4
+ export type FunctionNode = ts.AccessorDeclaration | ts.ArrowFunction | ts.FunctionDeclaration | ts.FunctionExpression | ts.MethodDeclaration;
5
5
  export declare function getColumnAndLine(node: ts.Node): ColumnAndLine;
6
6
  export declare function getIdentifier(node: ts.Node): string | undefined;
7
7
  export declare function getFirstNonParenthesizedAncestor(node: ts.Node): ts.Node;
@@ -1,7 +1,11 @@
1
1
  "use strict";
2
2
  var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
3
  if (k2 === undefined) k2 = k;
4
- Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
5
9
  }) : (function(o, m, k, k2) {
6
10
  if (k2 === undefined) k2 = k;
7
11
  o[k2] = m[k];
@@ -33,7 +37,7 @@ function getColumnAndLine(node) {
33
37
  exports.getColumnAndLine = getColumnAndLine;
34
38
  function getIdentifier(node) {
35
39
  for (const child of node.getChildren()) {
36
- if (ts.isIdentifierOrPrivateIdentifier(child) || ts.isComputedPropertyName(child)) {
40
+ if (ts.isMemberName(child) || ts.isComputedPropertyName(child)) {
37
41
  return child.getText();
38
42
  }
39
43
  }
@@ -65,7 +69,7 @@ exports.isBinaryTypeOperator = isBinaryTypeOperator;
65
69
  function isBreakOrContinueToLabel(node) {
66
70
  if (ts.isBreakOrContinueStatement(node)) {
67
71
  for (const child of node.getChildren()) {
68
- if (ts.isIdentifierOrPrivateIdentifier(child)) {
72
+ if (ts.isMemberName(child)) {
69
73
  return true;
70
74
  }
71
75
  }
@@ -131,7 +135,7 @@ function passThroughNameBeingAssigned(node) {
131
135
  }
132
136
  exports.passThroughNameBeingAssigned = passThroughNameBeingAssigned;
133
137
  function report(node, depth = 0) {
134
- const toLog = [util_1.repeat("\t", depth), ts.SyntaxKind[node.kind], node.kind];
138
+ const toLog = [(0, util_1.repeat)("\t", depth), ts.SyntaxKind[node.kind], node.kind];
135
139
  console.error(...toLog);
136
140
  for (const child of node.getChildren()) {
137
141
  report(child, depth + 1);
@@ -1,7 +1,11 @@
1
1
  "use strict";
2
2
  var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
3
  if (k2 === undefined) k2 = k;
4
- Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
5
9
  }) : (function(o, m, k, k2) {
6
10
  if (k2 === undefined) k2 = k;
7
11
  o[k2] = m[k];
@@ -25,7 +29,7 @@ const node_util_1 = require("../util/node-util");
25
29
  const node_inspection_1 = require("./node-inspection");
26
30
  function chooseContainerName(node, variableBeingDefined) {
27
31
  var _a, _b;
28
- if (node_inspection_1.isFunctionNode(node)) {
32
+ if ((0, node_inspection_1.isFunctionNode)(node)) {
29
33
  return (_b = (_a = getFunctionNodeName(node)) !== null && _a !== void 0 ? _a : variableBeingDefined) !== null && _b !== void 0 ? _b : "";
30
34
  }
31
35
  if (ts.isClassDeclaration(node)) {
@@ -51,7 +55,7 @@ function chooseContainerName(node, variableBeingDefined) {
51
55
  exports.chooseContainerName = chooseContainerName;
52
56
  function getIntroducedLocalName(node) {
53
57
  if (ts.isVariableDeclaration(node)) {
54
- return node_inspection_1.getIdentifier(node);
58
+ return (0, node_inspection_1.getIdentifier)(node);
55
59
  }
56
60
  if (ts.isClassDeclaration(node)) {
57
61
  return getClassDeclarationName(node);
@@ -105,7 +109,7 @@ function getNameOfAssignment(node) {
105
109
  || ts.isEnumDeclaration(node)
106
110
  || ts.isEnumMember(node)
107
111
  || ts.isCallSignatureDeclaration(node)) {
108
- return node_inspection_1.getIdentifier(node);
112
+ return (0, node_inspection_1.getIdentifier)(node);
109
113
  }
110
114
  if (ts.isTypeAliasDeclaration(node)) {
111
115
  return getTypeAliasName(node);
@@ -140,7 +144,7 @@ exports.getExpressionToAccessObjectMember = getExpressionToAccessObjectMember;
140
144
  */
141
145
  function getAccessorIdentifierName(node) {
142
146
  for (const child of node.getChildren()) {
143
- if (ts.isIdentifierOrPrivateIdentifier(child)) {
147
+ if (ts.isMemberName(child)) {
144
148
  return [child.getText(), true];
145
149
  }
146
150
  if (ts.isComputedPropertyName(child)) {
@@ -150,7 +154,7 @@ function getAccessorIdentifierName(node) {
150
154
  throw new node_util_1.UnreachableNodeState(node, "The accessor was expected to have an identifier or computed property name.");
151
155
  }
152
156
  function getIdentifierDespiteBrackets(node) {
153
- if (ts.isIdentifierOrPrivateIdentifier(node) || ts.isElementAccessExpression(node)) {
157
+ if (ts.isMemberName(node) || ts.isElementAccessExpression(node)) {
154
158
  return node.getText();
155
159
  }
156
160
  if (ts.isParenthesizedExpression(node)) {
@@ -165,7 +169,7 @@ function getCalledFunctionName(node) {
165
169
  return name !== null && name !== void 0 ? name : "";
166
170
  }
167
171
  function getClassDeclarationName(node) {
168
- const name = node_inspection_1.getIdentifier(node);
172
+ const name = (0, node_inspection_1.getIdentifier)(node);
169
173
  return name !== null && name !== void 0 ? name : ""; // anonymous class
170
174
  }
171
175
  function getClassExpressionName(node, variableBeingDefined = undefined) {
@@ -188,7 +192,7 @@ function getFunctionNodeName(func) {
188
192
  }
189
193
  if (ts.isFunctionExpression(func)) {
190
194
  const maybeIdentifier = func.getChildren()[1];
191
- if (ts.isIdentifierOrPrivateIdentifier(maybeIdentifier)) {
195
+ if (ts.isMemberName(maybeIdentifier)) {
192
196
  return maybeIdentifier.getText();
193
197
  }
194
198
  else {
@@ -219,7 +223,7 @@ function getModuleDeclarationName(node) {
219
223
  */
220
224
  function getMethodDeclarationName(node) {
221
225
  for (const child of node.getChildren()) {
222
- if (ts.isIdentifierOrPrivateIdentifier(child)) {
226
+ if (ts.isMemberName(child)) {
223
227
  return [child.getText(), true];
224
228
  }
225
229
  if (ts.isComputedPropertyName(child)) {
@@ -229,14 +233,14 @@ function getMethodDeclarationName(node) {
229
233
  throw new node_util_1.UnreachableNodeState(node, "Method has no identifier.");
230
234
  }
231
235
  function getNewedConstructorName(node) {
232
- return node_inspection_1.getTextWithoutBrackets(node.getChildAt(1));
236
+ return (0, node_inspection_1.getTextWithoutBrackets)(node.getChildAt(1));
233
237
  }
234
238
  function getTypeAliasName(node) {
235
239
  return node.getChildAt(1).getText();
236
240
  }
237
241
  function maybeGetFirstIdentifierName(node) {
238
242
  const name = node.getChildren()
239
- .find(child => ts.isIdentifierOrPrivateIdentifier(child));
243
+ .find(child => ts.isMemberName(child));
240
244
  return name === null || name === void 0 ? void 0 : name.getText();
241
245
  }
242
246
  //# sourceMappingURL=node-naming.js.map
@@ -4,7 +4,11 @@
4
4
  */
5
5
  var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
6
6
  if (k2 === undefined) k2 = k;
7
- Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
7
+ var desc = Object.getOwnPropertyDescriptor(m, k);
8
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
9
+ desc = { enumerable: true, get: function() { return m[k]; } };
10
+ }
11
+ Object.defineProperty(o, k2, desc);
8
12
  }) : (function(o, m, k, k2) {
9
13
  if (k2 === undefined) k2 = k;
10
14
  o[k2] = m[k];
@@ -51,13 +55,13 @@ exports.getFileOutput = getFileOutput;
51
55
  // API
52
56
  function getSourceOutput(sourceCode, fileName = "") {
53
57
  const parsedFile = ts.createSourceFile(fileName, sourceCode, ts.ScriptTarget.Latest, true);
54
- return cognitive_complexity_1.fileCost(parsedFile);
58
+ return (0, cognitive_complexity_1.fileCost)(parsedFile);
55
59
  }
56
60
  exports.getSourceOutput = getSourceOutput;
57
61
  // API
58
62
  async function getFolderOutput(folderPath) {
59
63
  const folderContents = await fs_1.promises.readdir(folderPath, { withFileTypes: true });
60
- return util_1.createObjectOfPromisedValues(folderContents, entry => entry.name, (entry) => {
64
+ return (0, util_1.createObjectOfPromisedValues)(folderContents, entry => entry.name, (entry) => {
61
65
  if (entry.isDirectory()) {
62
66
  return getFolderOutput(folderPath + "/" + entry.name);
63
67
  }
package/build/src/json.js CHANGED
@@ -1,7 +1,11 @@
1
1
  "use strict";
2
2
  var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
3
  if (k2 === undefined) k2 = k;
4
- Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
5
9
  }) : (function(o, m, k, k2) {
6
10
  if (k2 === undefined) k2 = k;
7
11
  o[k2] = m[k];
@@ -38,7 +42,7 @@ async function main() {
38
42
  }
39
43
  async function printCognitiveComplexityJson(fullPath) {
40
44
  const relativePath = path.relative(process.cwd(), fullPath);
41
- const programOutputStr = await output_1.programOutput(relativePath);
42
- console.log(js_beautify_1.js_beautify(programOutputStr));
45
+ const programOutputStr = await (0, output_1.programOutput)(relativePath);
46
+ console.log((0, js_beautify_1.js_beautify)(programOutputStr));
43
47
  }
44
48
  //# sourceMappingURL=json.js.map
@@ -1,7 +1,11 @@
1
1
  "use strict";
2
2
  var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
3
  if (k2 === undefined) k2 = k;
4
- Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
5
9
  }) : (function(o, m, k, k2) {
6
10
  if (k2 === undefined) k2 = k;
7
11
  o[k2] = m[k];
@@ -49,7 +53,7 @@ function cached(res) {
49
53
  }
50
54
  async function doesFileExistInFolder(filePath, folderPath) {
51
55
  return isPathInsideDir(filePath, folderPath)
52
- && await util_1.doesNotThrow(fs_1.promises.access(filePath))
56
+ && await (0, util_1.doesNotThrow)(fs_1.promises.access(filePath))
53
57
  && (await fs_1.promises.stat(filePath)).isFile();
54
58
  }
55
59
  function endWith404(res) {
package/build/src/ui.js CHANGED
@@ -11,13 +11,13 @@ const ui_server_1 = require("./ui-server/ui-server");
11
11
  const helpText = "Arguments: [-h | --help] [--port <NUMBER>] [FILE]...";
12
12
  main();
13
13
  async function main() {
14
- const args = minimist_1.default(process.argv.slice(2));
14
+ const args = (0, minimist_1.default)(process.argv.slice(2));
15
15
  if (args["h"] || args["help"]) {
16
16
  console.log(helpText);
17
17
  return;
18
18
  }
19
19
  const givenPort = parseInt(args["port"]);
20
- const port = util_1.nonNaN(givenPort, 5678);
20
+ const port = (0, util_1.nonNaN)(givenPort, 5678);
21
21
  const url = `http://localhost:${port}`;
22
22
  const inputFiles = args["_"];
23
23
  if (inputFiles.length === 0) {
@@ -26,14 +26,14 @@ async function main() {
26
26
  return;
27
27
  }
28
28
  const combinedOutputsJson = await generateComplexityJson(inputFiles);
29
- const server = ui_server_1.createUiServer(combinedOutputsJson);
29
+ const server = (0, ui_server_1.createUiServer)(combinedOutputsJson);
30
30
  server.listen(port, () => {
31
31
  console.log(`Server started at ${url}`);
32
- open_1.default(url);
32
+ (0, open_1.default)(url);
33
33
  });
34
34
  }
35
35
  async function generateComplexityJson(inputFiles) {
36
- const combinedOutputs = await util_1.keysToAsyncValues(inputFiles, file => output_1.getFileOrFolderOutput(file));
36
+ const combinedOutputs = await (0, util_1.keysToAsyncValues)(inputFiles, file => (0, output_1.getFileOrFolderOutput)(file));
37
37
  return JSON.stringify(combinedOutputs);
38
38
  }
39
39
  //# sourceMappingURL=ui.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cognitive-complexity-ts",
3
- "version": "0.6.2",
3
+ "version": "0.6.4",
4
4
  "description": "",
5
5
  "keywords": [
6
6
  "typescript",
@@ -49,7 +49,7 @@
49
49
  "minimist": "^1.2.5",
50
50
  "open": "^7.1.0",
51
51
  "source-map-support": "^0.5.19",
52
- "typescript": "^4.1.5"
52
+ "typescript": "^5.2.2"
53
53
  },
54
54
  "devDependencies": {
55
55
  "@types/deep-diff": "^1.0.0",