no-mistakes 0.47.0 → 0.48.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.
package/README.md CHANGED
@@ -43,8 +43,6 @@ const {
43
43
  root: process.cwd(),
44
44
  files: ["src/main.mts"],
45
45
  relationships: ["import"],
46
- timeout: 30,
47
- lockTimeout: 30,
48
46
  });
49
47
  const tests = await dependents({
50
48
  root: process.cwd(),
@@ -121,10 +119,11 @@ const {
121
119
 
122
120
  CLI and Node analyses share a per-user machine-wide lock. CLI flags
123
121
  `--timeout`, `--lock-timeout`, and `--fail-on-lock` have Node equivalents
124
- `timeout`, `lockTimeout`, and `failOnLock`. Both timeouts default to 30 seconds;
125
- `0` disables either CLI timeout, while `0` or `null` disables it in Node.
126
- Waiting does not alter successful output, and Node lock/timeout failures reject
127
- the returned Promise.
122
+ `timeout`, `lockTimeout`, and `failOnLock`. CLI timeouts default to 30 seconds;
123
+ Node/N-API omits both deadlines unless you set them. `0` disables either CLI
124
+ timeout, while `0` or `null` disables it in Node. While waiting, stderr reports
125
+ the holder pid and elapsed seconds. Waiting does not alter successful output,
126
+ and Node lock/timeout failures reject the returned Promise.
128
127
 
129
128
  Dependency graph, query, and test-planning resolution is per workspace by
130
129
  default: when `tsconfig` is omitted, each import uses the config that owns its
package/flow-types.d.ts CHANGED
@@ -15,7 +15,14 @@ export interface FlowOptions {
15
15
 
16
16
  export interface FlowNode {
17
17
  id: string;
18
- kind: "file" | "symbol" | "module" | "queue-job" | "workflow-job" | "workflow-step";
18
+ kind:
19
+ | "file"
20
+ | "symbol"
21
+ | "module"
22
+ | "queue-job"
23
+ | "workflow-job"
24
+ | "workflow-step"
25
+ | "trpc-procedure";
19
26
  depth: number;
20
27
  file?: string;
21
28
  symbol?: string;
@@ -27,6 +34,10 @@ export interface FlowNode {
27
34
  job?: string;
28
35
  /** Zero-based step index for a virtual GitHub Actions workflow step node. */
29
36
  step?: number;
37
+ /** Router file for a virtual tRPC procedure node. */
38
+ routerFile?: string;
39
+ /** Dotted procedure path for a virtual tRPC procedure node (`user.get`). */
40
+ procedure?: string;
30
41
  }
31
42
 
32
43
  export interface FlowEdge {
package/index.d.ts CHANGED
@@ -24,6 +24,7 @@ import type {
24
24
  ResolveCheckFilesOptions,
25
25
  ResolveCheckResult,
26
26
  ResolveCheckBatchResult,
27
+ ResolvedConfig,
27
28
  GraphEdge,
28
29
  PlaywrightOptions,
29
30
  PlaywrightRelatedOptions,
@@ -98,6 +99,9 @@ export function resolveCheck(
98
99
  export function fetches(options?: WithInvocationOptions<FetchesOptions>): Promise<FetchReport>;
99
100
  export function flow(options: WithInvocationOptions<FlowOptions>): Promise<FlowReport>;
100
101
  export function check(options?: WithInvocationOptions<CheckOptions>): Promise<CheckReport>;
102
+ export function resolveConfig(
103
+ options?: WithInvocationOptions<ProjectOptions>,
104
+ ): Promise<ResolvedConfig>;
101
105
  export function validateMermaidMarkdown(
102
106
  options: WithInvocationOptions<MermaidValidationOptions>,
103
107
  ): Promise<MermaidValidationResult>;
package/index.js CHANGED
@@ -7,7 +7,8 @@ const planning = require("./planning");
7
7
  const { createWorkflowTopologyIndex } = require("./workflow-topology-index");
8
8
 
9
9
  async function callJson(fn, options) {
10
- return JSON.parse(await fn(JSON.stringify(options || {})));
10
+ const input = Buffer.from(JSON.stringify(options || {}));
11
+ return JSON.parse(await fn(input));
11
12
  }
12
13
 
13
14
  function createJsonApis(descriptors) {
@@ -23,6 +24,7 @@ const jsonApis = createJsonApis({
23
24
  analyzeProject: "analyzeProjectJson",
24
25
  callSites: "callSitesJson",
25
26
  check: "checkJson",
27
+ resolveConfig: "resolveConfigJson",
26
28
  ciEnv: "ciEnvJson",
27
29
  ciImpact: "ciImpactJson",
28
30
  ciTopology: "ciTopologyJson",
@@ -66,6 +68,7 @@ module.exports.version = version;
66
68
  module.exports.analyzeProject = jsonApis.analyzeProject;
67
69
  module.exports.callSites = jsonApis.callSites;
68
70
  module.exports.check = jsonApis.check;
71
+ module.exports.resolveConfig = jsonApis.resolveConfig;
69
72
  module.exports.ciEnv = jsonApis.ciEnv;
70
73
  module.exports.ciImpact = jsonApis.ciImpact;
71
74
  module.exports.ciTopology = jsonApis.ciTopology;
package/index.mjs ADDED
@@ -0,0 +1,64 @@
1
+ import { createRequire } from "node:module";
2
+
3
+ const require = createRequire(import.meta.url);
4
+ const cjs = require("./index.js");
5
+
6
+ export const {
7
+ analyzeProject,
8
+ callSites,
9
+ check,
10
+ ciEnv,
11
+ ciImpact,
12
+ ciTopology,
13
+ createWorkflowTopologyIndex,
14
+ dataPw,
15
+ deadExports,
16
+ dependencies,
17
+ dependents,
18
+ effects,
19
+ exportsOf,
20
+ fetches,
21
+ flow,
22
+ impactedChecks,
23
+ importUsages,
24
+ importers,
25
+ infraOutputs,
26
+ infraResourceRefs,
27
+ infraTestFor,
28
+ lockfileDiff,
29
+ playwrightCheck,
30
+ playwrightEdges,
31
+ playwrightRelated,
32
+ playwrightTests,
33
+ queueCheck,
34
+ queueEdges,
35
+ queueRelated,
36
+ queues,
37
+ reactAnalyze,
38
+ reactCheck,
39
+ reactUsages,
40
+ registryExtension,
41
+ related,
42
+ resolveCheck,
43
+ resolveConfig,
44
+ rscCallers,
45
+ serverContracts,
46
+ serverRouteEdges,
47
+ serverRouteList,
48
+ serverRouteRelated,
49
+ serverRoutes,
50
+ swiftImporters,
51
+ swiftTestTargets,
52
+ symbols,
53
+ testsComment,
54
+ testsGraph,
55
+ testsGraphMermaid,
56
+ testsImpact,
57
+ testsPlan,
58
+ testsTargets,
59
+ testsWhy,
60
+ validateMermaidMarkdown,
61
+ version,
62
+ } = cjs;
63
+
64
+ export default cjs;
@@ -1,8 +1,8 @@
1
1
  /** Controls shared by every analysis invocation. Durations are in seconds. */
2
2
  export interface InvocationOptions {
3
- /** Command execution timeout. Defaults to 30; 0 or null disables it. */
3
+ /** Command execution timeout in whole non-negative seconds. Omit, `0`, or `null` disables it. CLI default remains 30. */
4
4
  timeout?: number | null;
5
- /** Maximum time to wait for the machine-wide lock. Defaults to 30; 0 or null waits indefinitely. */
5
+ /** Maximum time to wait for the machine-wide lock, in whole non-negative seconds. Omit, `0`, or `null` waits indefinitely. CLI default remains 30. */
6
6
  lockTimeout?: number | null;
7
7
  /** Fail immediately instead of waiting when another invocation holds the lock. */
8
8
  failOnLock?: boolean;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "no-mistakes",
3
- "version": "0.47.0",
3
+ "version": "0.48.0",
4
4
  "description": "Static codebase analysis tools for TS/JS dependencies, dependents, and symbols",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -15,6 +15,7 @@
15
15
  "bin/",
16
16
  "*.d.ts",
17
17
  "index.js",
18
+ "index.mjs",
18
19
  "planning.js",
19
20
  "workflow-topology-index.js",
20
21
  "scripts/install.js",
@@ -24,6 +25,15 @@
24
25
  ],
25
26
  "main": "index.js",
26
27
  "types": "index.d.ts",
28
+ "exports": {
29
+ ".": {
30
+ "types": "./index.d.ts",
31
+ "import": "./index.mjs",
32
+ "require": "./index.js"
33
+ },
34
+ "./planning.js": "./planning.js",
35
+ "./workflow-topology-index.js": "./workflow-topology-index.js"
36
+ },
27
37
  "publishConfig": {
28
38
  "access": "public"
29
39
  },
package/planning.js CHANGED
@@ -3,7 +3,8 @@
3
3
  const native = require(process.env.NO_MISTAKES_TEST_NAPI_ADDON_PATH || "./bin/no-mistakes.node");
4
4
 
5
5
  async function callJson(fn, options) {
6
- return JSON.parse(await fn(JSON.stringify(options || {})));
6
+ const input = Buffer.from(JSON.stringify(options || {}));
7
+ return JSON.parse(await fn(input));
7
8
  }
8
9
 
9
10
  function createJsonApis(descriptors) {
@@ -16,11 +17,13 @@ function createJsonApis(descriptors) {
16
17
  }
17
18
 
18
19
  async function testsComment(options) {
19
- return native.testsCommentMarkdown(JSON.stringify(options || {}));
20
+ const input = Buffer.from(JSON.stringify(options || {}));
21
+ return String(await native.testsCommentMarkdown(input));
20
22
  }
21
23
 
22
24
  async function testsGraphMermaid(options) {
23
- return native.testsGraphMermaid(JSON.stringify(options || {}));
25
+ const input = Buffer.from(JSON.stringify(options || {}));
26
+ return String(await native.testsGraphMermaid(input));
24
27
  }
25
28
 
26
29
  const jsonApis = createJsonApis({
@@ -0,0 +1,50 @@
1
+ import type { TestPlanFramework } from "./test-types";
2
+
3
+ export interface ResolvedConfig {
4
+ configPath?: string | null;
5
+ frontendApps: ResolvedFrontendApp[];
6
+ playwright: ResolvedPlaywright;
7
+ vitestFullSuiteTriggers: ResolvedTrigger[];
8
+ fullSuiteTriggers: ResolvedFrameworkTriggers[];
9
+ }
10
+
11
+ export interface ResolvedFrontendApp {
12
+ project?: string | null;
13
+ root: string;
14
+ routeRoot: string;
15
+ selectorRoots: string[];
16
+ }
17
+
18
+ export interface ResolvedPlaywright {
19
+ coverageRoutes: boolean;
20
+ coverageSelectors: boolean;
21
+ frontendRoot?: string | null;
22
+ selectorRoots: string[];
23
+ apps: ResolvedPlaywrightApp[];
24
+ }
25
+
26
+ export interface ResolvedPlaywrightApp {
27
+ playwrightProject: string;
28
+ project?: string | null;
29
+ frontendRoot?: string | null;
30
+ selectorRoots: string[];
31
+ rewrites: ResolvedRewrite[];
32
+ ignoreRoutes: string[];
33
+ }
34
+
35
+ export interface ResolvedRewrite {
36
+ source: string;
37
+ destination: string;
38
+ }
39
+
40
+ export interface ResolvedTrigger {
41
+ name: string;
42
+ paths: string[];
43
+ targets: string[];
44
+ source: "triggers" | "projects";
45
+ }
46
+
47
+ export interface ResolvedFrameworkTriggers {
48
+ framework: TestPlanFramework;
49
+ triggers: ResolvedTrigger[];
50
+ }
package/test-types.d.ts CHANGED
@@ -10,7 +10,10 @@ export type TestPlanFramework =
10
10
  | "go"
11
11
  | "cargo"
12
12
  | "rails"
13
- | "php";
13
+ | "php"
14
+ | "java"
15
+ | "kotlin"
16
+ | "jest";
14
17
 
15
18
  interface TestsPlanOptionsBase {
16
19
  framework?: TestPlanFramework;
@@ -36,6 +39,8 @@ interface TestsPlanOptionsBase {
36
39
  limitPercent?: number;
37
40
  limitFiles?: number;
38
41
  globalConfigFallback?: boolean;
42
+ /** Include the markdown PR comment as `comment` on the returned plan. */
43
+ includeComment?: boolean;
39
44
  }
40
45
 
41
46
  /**
@@ -86,11 +91,31 @@ export interface TestsTargetsOptions {
86
91
  export interface TestPlan {
87
92
  /** Complete deterministic changed-file inventory, relative to the request root. */
88
93
  changed_files: string[];
94
+ /** @deprecated Prefer `changedFiles` once both keys are present. */
95
+ changedFiles?: string[];
89
96
  selected_tests: SelectedTest[];
97
+ selectedTests?: SelectedTest[];
90
98
  groups?: TestPlanGroup[];
91
99
  warnings: TestPlanWarning[];
92
100
  fallback_triggered: boolean;
101
+ fallbackTriggered?: boolean;
93
102
  fallback_reason?: string | null;
103
+ fallbackReason?: string | null;
104
+ execution_targets?: GroupedExecutionTarget[];
105
+ executionTargets?: GroupedExecutionTarget[];
106
+ comment?: string | null;
107
+ }
108
+
109
+ export interface GroupedExecutionTarget {
110
+ runner: TestPlanFramework;
111
+ config?: string | null;
112
+ project?: string | null;
113
+ baseCommand?: string[];
114
+ base_command: string[];
115
+ runnerArgs?: string[];
116
+ runner_args: string[];
117
+ testFiles?: string[];
118
+ test_files: string[];
94
119
  }
95
120
 
96
121
  export interface SelectedTest {
@@ -31,7 +31,10 @@ export type Relationship =
31
31
  | "rust"
32
32
  | "ruby"
33
33
  | "php"
34
+ | "java"
35
+ | "kotlin"
34
36
  | "resource"
37
+ | "trpc"
35
38
  | "all";
36
39
 
37
40
  export interface TraverseOptions {
@@ -59,6 +62,10 @@ export interface DependencyFile {
59
62
  job?: string;
60
63
  /** Zero-based step index for a virtual GitHub Actions workflow step node. */
61
64
  step?: number;
65
+ /** Router file for a virtual tRPC procedure node. */
66
+ routerFile?: string;
67
+ /** Dotted procedure path for a virtual tRPC procedure node (`user.get`). */
68
+ procedure?: string;
62
69
  module?: string;
63
70
  depth: number;
64
71
  via?: string[];
package/types.d.ts CHANGED
@@ -11,3 +11,4 @@ export * from "./workflow-topology-types";
11
11
  export * from "./query-types";
12
12
  export * from "./named-query-types";
13
13
  export * from "./mermaid-types";
14
+ export * from "./resolve-config-types";