no-mistakes 0.36.0 → 0.36.2

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 (3) hide show
  1. package/index.js +46 -169
  2. package/package.json +1 -1
  3. package/planning.js +25 -72
package/index.js CHANGED
@@ -8,182 +8,59 @@ async function callJson(fn, options) {
8
8
  return JSON.parse(await fn(JSON.stringify(options || {})));
9
9
  }
10
10
 
11
- async function dependencies(options) {
12
- return callJson(native.dependenciesJson, options);
13
- }
14
-
15
- async function dependents(options) {
16
- return callJson(native.dependentsJson, options);
17
- }
18
-
19
- async function related(options) {
20
- return callJson(native.relatedJson, options);
21
- }
22
-
23
- async function analyzeProject(options) {
24
- return callJson(native.analyzeProjectJson, options);
25
- }
26
-
27
- async function symbols(options) {
28
- return callJson(native.symbolsJson, options);
29
- }
30
-
31
- async function importUsages(options) {
32
- return callJson(native.importUsagesJson, options);
33
- }
34
-
35
- async function importers(options) {
36
- return callJson(native.importersJson, options);
37
- }
38
-
39
- async function exportsOf(options) {
40
- return callJson(native.exportsOfJson, options);
41
- }
42
-
43
- async function deadExports(options) {
44
- return callJson(native.deadExportsJson, options);
45
- }
46
-
47
- async function callSites(options) {
48
- return callJson(native.callSitesJson, options);
49
- }
50
-
51
- async function resolveCheck(options) {
52
- return callJson(native.resolveCheckJson, options);
53
- }
54
-
55
- async function fetches(options) {
56
- return callJson(native.fetchesJson, options);
57
- }
58
-
59
- async function check(options) {
60
- return callJson(native.checkJson, options);
61
- }
62
-
63
- async function playwrightCheck(options) {
64
- return callJson(native.playwrightCheckJson, options);
65
- }
66
-
67
- async function playwrightEdges(options) {
68
- return callJson(native.playwrightEdgesJson, options);
69
- }
70
-
71
- async function playwrightRelated(options) {
72
- return callJson(native.playwrightRelatedJson, options);
73
- }
74
-
75
- async function playwrightTests(options) {
76
- return callJson(native.playwrightTestsJson, options);
77
- }
78
-
79
- async function reactAnalyze(options) {
80
- return callJson(native.reactAnalyzeJson, options);
81
- }
82
-
83
- async function reactCheck(options) {
84
- return callJson(native.reactCheckJson, options);
85
- }
86
-
87
- async function reactUsages(options) {
88
- return callJson(native.reactUsagesJson, options);
89
- }
90
-
91
- async function dataPw(options) {
92
- return callJson(native.dataPwJson, options);
93
- }
94
-
95
- async function effects(options) {
96
- return callJson(native.effectsJson, options);
97
- }
98
-
99
- async function rscCallers(options) {
100
- return callJson(native.rscCallersJson, options);
101
- }
102
-
103
- async function registryExtension(options) {
104
- return callJson(native.registryExtensionJson, options);
105
- }
106
-
107
- async function lockfileDiff(options) {
108
- return callJson(native.lockfileDiffJson, options);
109
- }
110
-
111
- async function ciImpact(options) {
112
- return callJson(native.ciImpactJson, options);
113
- }
114
-
115
- async function ciEnv(options) {
116
- return callJson(native.ciEnvJson, options);
117
- }
118
-
119
- async function ciTopology(options) {
120
- return callJson(native.ciTopologyJson, options);
121
- }
122
-
123
- async function impactedChecks(options) {
124
- return callJson(native.impactedChecksJson, options);
125
- }
126
-
127
- async function infraResourceRefs(options) {
128
- return callJson(native.infraResourceRefsJson, options);
129
- }
130
-
131
- async function infraOutputs(options) {
132
- return callJson(native.infraOutputsJson, options);
133
- }
134
-
135
- async function infraTestFor(options) {
136
- return callJson(native.infraTestForJson, options);
137
- }
138
-
139
- async function swiftImporters(options) {
140
- return callJson(native.swiftImportersJson, options);
141
- }
142
-
143
- async function swiftTestTargets(options) {
144
- return callJson(native.swiftTestTargetsJson, options);
145
- }
11
+ function createJsonApis(descriptors) {
12
+ return Object.fromEntries(
13
+ Object.entries(descriptors).map(([apiName, nativeName]) => [
14
+ apiName,
15
+ async (options) => callJson(native[nativeName], options),
16
+ ]),
17
+ );
18
+ }
19
+
20
+ const jsonApis = createJsonApis({
21
+ analyzeProject: "analyzeProjectJson",
22
+ callSites: "callSitesJson",
23
+ check: "checkJson",
24
+ ciEnv: "ciEnvJson",
25
+ ciImpact: "ciImpactJson",
26
+ ciTopology: "ciTopologyJson",
27
+ dataPw: "dataPwJson",
28
+ deadExports: "deadExportsJson",
29
+ dependencies: "dependenciesJson",
30
+ dependents: "dependentsJson",
31
+ effects: "effectsJson",
32
+ exportsOf: "exportsOfJson",
33
+ fetches: "fetchesJson",
34
+ impactedChecks: "impactedChecksJson",
35
+ importUsages: "importUsagesJson",
36
+ importers: "importersJson",
37
+ infraOutputs: "infraOutputsJson",
38
+ infraResourceRefs: "infraResourceRefsJson",
39
+ infraTestFor: "infraTestForJson",
40
+ lockfileDiff: "lockfileDiffJson",
41
+ playwrightCheck: "playwrightCheckJson",
42
+ playwrightEdges: "playwrightEdgesJson",
43
+ playwrightRelated: "playwrightRelatedJson",
44
+ playwrightTests: "playwrightTestsJson",
45
+ reactAnalyze: "reactAnalyzeJson",
46
+ reactCheck: "reactCheckJson",
47
+ reactUsages: "reactUsagesJson",
48
+ registryExtension: "registryExtensionJson",
49
+ related: "relatedJson",
50
+ resolveCheck: "resolveCheckJson",
51
+ rscCallers: "rscCallersJson",
52
+ swiftImporters: "swiftImportersJson",
53
+ swiftTestTargets: "swiftTestTargetsJson",
54
+ symbols: "symbolsJson",
55
+ });
146
56
 
147
57
  async function version() {
148
58
  return native.version();
149
59
  }
150
60
 
151
61
  module.exports = {
152
- analyzeProject,
153
- callSites,
154
- check,
155
- ciEnv,
156
- ciImpact,
157
- ciTopology,
158
62
  createWorkflowTopologyIndex,
159
- dataPw,
160
- deadExports,
161
- dependencies,
162
- dependents,
163
- effects,
164
- exportsOf,
165
- fetches,
166
- impactedChecks,
167
- importUsages,
168
- importers,
169
- infraOutputs,
170
- infraResourceRefs,
171
- infraTestFor,
172
- lockfileDiff,
173
- playwrightCheck,
174
- playwrightEdges,
175
- playwrightRelated,
176
- playwrightTests,
177
- reactAnalyze,
178
- reactCheck,
179
- reactUsages,
180
- registryExtension,
181
- related,
182
- resolveCheck,
183
- rscCallers,
184
- swiftImporters,
185
- swiftTestTargets,
186
- symbols,
187
63
  version,
64
+ ...jsonApis,
188
65
  ...planning,
189
66
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "no-mistakes",
3
- "version": "0.36.0",
3
+ "version": "0.36.2",
4
4
  "description": "Static codebase analysis tools for TS/JS dependencies, dependents, and symbols",
5
5
  "license": "MIT",
6
6
  "repository": {
package/planning.js CHANGED
@@ -6,90 +6,43 @@ async function callJson(fn, options) {
6
6
  return JSON.parse(await fn(JSON.stringify(options || {})));
7
7
  }
8
8
 
9
- async function testsTargets(options) {
10
- return callJson(native.testsTargetsJson, options);
11
- }
12
-
13
- async function testsPlan(options) {
14
- return callJson(native.testsPlanJson, options);
15
- }
16
-
17
- async function testsImpact(options) {
18
- return callJson(native.testsImpactJson, options);
19
- }
20
-
21
- async function testsWhy(options) {
22
- return callJson(native.testsWhyJson, options);
9
+ function createJsonApis(descriptors) {
10
+ return Object.fromEntries(
11
+ Object.entries(descriptors).map(([apiName, nativeName]) => [
12
+ apiName,
13
+ async (options) => callJson(native[nativeName], options),
14
+ ]),
15
+ );
23
16
  }
24
17
 
25
18
  async function testsComment(options) {
26
19
  return native.testsCommentMarkdown(JSON.stringify(options || {}));
27
20
  }
28
21
 
29
- async function testsGraph(options) {
30
- return callJson(native.testsGraphJson, options);
31
- }
32
-
33
22
  async function testsGraphMermaid(options) {
34
23
  return native.testsGraphMermaid(JSON.stringify(options || {}));
35
24
  }
36
25
 
37
- async function queues(options) {
38
- return callJson(native.queuesJson, options);
39
- }
40
-
41
- async function queueEdges(options) {
42
- return callJson(native.queueEdgesJson, options);
43
- }
44
-
45
- async function queueRelated(options) {
46
- return callJson(native.queueRelatedJson, options);
47
- }
48
-
49
- async function queueCheck(options) {
50
- return callJson(native.queueCheckJson, options);
51
- }
52
-
53
- async function serverRoutes(options) {
54
- return callJson(native.serverRoutesJson, options);
55
- }
56
-
57
- async function serverRouteList(options) {
58
- return callJson(native.serverRouteListJson, options);
59
- }
60
-
61
- async function serverRouteEdges(options) {
62
- return callJson(native.serverRouteEdgesJson, options);
63
- }
64
-
65
- async function serverRouteRelated(options) {
66
- return callJson(native.serverRouteRelatedJson, options);
67
- }
68
-
69
- async function serverContracts(options) {
70
- return callJson(native.serverContractsJson, options);
71
- }
72
-
73
- async function flow(options) {
74
- return callJson(native.flowJson, options);
75
- }
26
+ const jsonApis = createJsonApis({
27
+ flow: "flowJson",
28
+ queueCheck: "queueCheckJson",
29
+ queueEdges: "queueEdgesJson",
30
+ queueRelated: "queueRelatedJson",
31
+ queues: "queuesJson",
32
+ serverContracts: "serverContractsJson",
33
+ serverRouteEdges: "serverRouteEdgesJson",
34
+ serverRouteList: "serverRouteListJson",
35
+ serverRouteRelated: "serverRouteRelatedJson",
36
+ serverRoutes: "serverRoutesJson",
37
+ testsGraph: "testsGraphJson",
38
+ testsImpact: "testsImpactJson",
39
+ testsPlan: "testsPlanJson",
40
+ testsTargets: "testsTargetsJson",
41
+ testsWhy: "testsWhyJson",
42
+ });
76
43
 
77
44
  module.exports = {
78
- flow,
79
- queueCheck,
80
- queueEdges,
81
- queueRelated,
82
- queues,
83
- serverContracts,
84
- serverRouteEdges,
85
- serverRouteList,
86
- serverRouteRelated,
87
- serverRoutes,
88
45
  testsComment,
89
- testsGraph,
90
46
  testsGraphMermaid,
91
- testsImpact,
92
- testsPlan,
93
- testsTargets,
94
- testsWhy,
47
+ ...jsonApis,
95
48
  };