nestjs-doctor 0.4.11 → 0.4.12
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/dist/api/index.cjs +152 -56
- package/dist/api/index.d.cts +50 -18
- package/dist/api/index.d.cts.map +1 -1
- package/dist/api/index.d.mts +50 -18
- package/dist/api/index.d.mts.map +1 -1
- package/dist/api/index.mjs +147 -56
- package/dist/api/index.mjs.map +1 -1
- package/dist/cli/index.mjs +128 -55
- package/package.json +1 -1
- package/skill/SKILL.md +1 -1
package/dist/api/index.cjs
CHANGED
|
@@ -176,50 +176,78 @@ function isProjectRule(rule) {
|
|
|
176
176
|
|
|
177
177
|
//#endregion
|
|
178
178
|
//#region src/engine/rule-runner.ts
|
|
179
|
-
function
|
|
180
|
-
const diagnostics = [];
|
|
181
|
-
const errors = [];
|
|
179
|
+
function separateRules(rules) {
|
|
182
180
|
const fileRules = [];
|
|
183
181
|
const projectRules = [];
|
|
184
182
|
for (const rule of rules) if (isProjectRule(rule)) projectRules.push(rule);
|
|
185
183
|
else fileRules.push(rule);
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
184
|
+
return {
|
|
185
|
+
fileRules,
|
|
186
|
+
projectRules
|
|
187
|
+
};
|
|
188
|
+
}
|
|
189
|
+
function runFileRulesOnFile(project, filePath, rules) {
|
|
190
|
+
const diagnostics = [];
|
|
191
|
+
const errors = [];
|
|
192
|
+
const sourceFile = project.getSourceFile(filePath);
|
|
193
|
+
if (!sourceFile) return {
|
|
194
|
+
diagnostics,
|
|
195
|
+
errors
|
|
196
|
+
};
|
|
197
|
+
const allLines = sourceFile.getFullText().split("\n");
|
|
198
|
+
for (const rule of rules) {
|
|
199
|
+
const context = {
|
|
200
|
+
sourceFile,
|
|
201
|
+
filePath,
|
|
202
|
+
report(partial) {
|
|
203
|
+
const sourceLines = [];
|
|
204
|
+
const start = Math.max(0, partial.line - 6);
|
|
205
|
+
const end = Math.min(allLines.length, partial.line + 5);
|
|
206
|
+
for (let i = start; i < end; i++) sourceLines.push({
|
|
207
|
+
line: i + 1,
|
|
208
|
+
text: allLines[i]
|
|
209
|
+
});
|
|
210
|
+
diagnostics.push({
|
|
211
|
+
...partial,
|
|
212
|
+
rule: rule.meta.id,
|
|
213
|
+
category: rule.meta.category,
|
|
214
|
+
scope: "file",
|
|
215
|
+
severity: rule.meta.severity,
|
|
216
|
+
sourceLines
|
|
218
217
|
});
|
|
219
218
|
}
|
|
219
|
+
};
|
|
220
|
+
try {
|
|
221
|
+
rule.check(context);
|
|
222
|
+
} catch (error) {
|
|
223
|
+
errors.push({
|
|
224
|
+
ruleId: rule.meta.id,
|
|
225
|
+
error
|
|
226
|
+
});
|
|
220
227
|
}
|
|
221
228
|
}
|
|
222
|
-
|
|
229
|
+
return {
|
|
230
|
+
diagnostics,
|
|
231
|
+
errors
|
|
232
|
+
};
|
|
233
|
+
}
|
|
234
|
+
function runFileRules(project, files, rules) {
|
|
235
|
+
const diagnostics = [];
|
|
236
|
+
const errors = [];
|
|
237
|
+
for (const filePath of files) {
|
|
238
|
+
const result = runFileRulesOnFile(project, filePath, rules);
|
|
239
|
+
diagnostics.push(...result.diagnostics);
|
|
240
|
+
errors.push(...result.errors);
|
|
241
|
+
}
|
|
242
|
+
return {
|
|
243
|
+
diagnostics,
|
|
244
|
+
errors
|
|
245
|
+
};
|
|
246
|
+
}
|
|
247
|
+
function runProjectRules(project, files, rules, options) {
|
|
248
|
+
const diagnostics = [];
|
|
249
|
+
const errors = [];
|
|
250
|
+
for (const rule of rules) {
|
|
223
251
|
const context = {
|
|
224
252
|
project,
|
|
225
253
|
files,
|
|
@@ -250,6 +278,15 @@ function runRules(project, files, rules, options) {
|
|
|
250
278
|
errors
|
|
251
279
|
};
|
|
252
280
|
}
|
|
281
|
+
function runRules(project, files, rules, options) {
|
|
282
|
+
const { fileRules, projectRules } = separateRules(rules);
|
|
283
|
+
const fileResult = runFileRules(project, files, fileRules);
|
|
284
|
+
const projectResult = runProjectRules(project, files, projectRules, options);
|
|
285
|
+
return {
|
|
286
|
+
diagnostics: [...fileResult.diagnostics, ...projectResult.diagnostics],
|
|
287
|
+
errors: [...fileResult.errors, ...projectResult.errors]
|
|
288
|
+
};
|
|
289
|
+
}
|
|
253
290
|
|
|
254
291
|
//#endregion
|
|
255
292
|
//#region src/engine/type-resolver.ts
|
|
@@ -2451,28 +2488,82 @@ function formatRuleError(error) {
|
|
|
2451
2488
|
if (error instanceof Error) return error.message;
|
|
2452
2489
|
return String(error);
|
|
2453
2490
|
}
|
|
2454
|
-
async function
|
|
2455
|
-
const startTime = node_perf_hooks.performance.now();
|
|
2491
|
+
async function prepareScan(targetPath, options = {}) {
|
|
2456
2492
|
const config = await loadConfig(targetPath, options.config);
|
|
2457
2493
|
const { rules: customRules, warnings: customRuleWarnings } = await resolveCustomRules(config, targetPath);
|
|
2458
2494
|
const combinedRules = mergeRules(allRules, customRules, customRuleWarnings);
|
|
2459
|
-
const project = await detectProject(targetPath);
|
|
2460
2495
|
const files = await collectFiles(targetPath, config);
|
|
2461
2496
|
const astProject = createAstParser(files);
|
|
2462
2497
|
const moduleGraph = buildModuleGraph(astProject, files);
|
|
2463
2498
|
const providers = resolveProviders(astProject, files);
|
|
2464
|
-
const {
|
|
2465
|
-
|
|
2466
|
-
|
|
2467
|
-
|
|
2468
|
-
|
|
2469
|
-
|
|
2470
|
-
|
|
2499
|
+
const { fileRules, projectRules } = separateRules(filterRules(config, combinedRules));
|
|
2500
|
+
return {
|
|
2501
|
+
context: {
|
|
2502
|
+
astProject,
|
|
2503
|
+
config,
|
|
2504
|
+
fileRules,
|
|
2505
|
+
files,
|
|
2506
|
+
moduleGraph,
|
|
2507
|
+
projectRules,
|
|
2508
|
+
providers,
|
|
2509
|
+
targetPath
|
|
2510
|
+
},
|
|
2511
|
+
customRuleWarnings
|
|
2512
|
+
};
|
|
2513
|
+
}
|
|
2514
|
+
function updateFile(context, filePath) {
|
|
2515
|
+
const existing = context.astProject.getSourceFile(filePath);
|
|
2516
|
+
if (existing) context.astProject.removeSourceFile(existing);
|
|
2517
|
+
context.astProject.addSourceFileAtPath(filePath);
|
|
2518
|
+
if (!context.files.includes(filePath)) context.files.push(filePath);
|
|
2519
|
+
context.moduleGraph = buildModuleGraph(context.astProject, context.files);
|
|
2520
|
+
context.providers = resolveProviders(context.astProject, context.files);
|
|
2521
|
+
}
|
|
2522
|
+
function scanFile(context, filePath) {
|
|
2523
|
+
const { diagnostics: rawDiagnostics, errors } = runFileRules(context.astProject, [filePath], context.fileRules);
|
|
2524
|
+
return {
|
|
2525
|
+
diagnostics: filterIgnoredDiagnostics(rawDiagnostics, context.config, context.targetPath),
|
|
2526
|
+
errors: errors.map((e) => ({
|
|
2527
|
+
ruleId: e.ruleId,
|
|
2528
|
+
error: formatRuleError(e.error)
|
|
2529
|
+
}))
|
|
2530
|
+
};
|
|
2531
|
+
}
|
|
2532
|
+
function scanAllFiles(context) {
|
|
2533
|
+
const { diagnostics: rawDiagnostics, errors } = runFileRules(context.astProject, context.files, context.fileRules);
|
|
2534
|
+
return {
|
|
2535
|
+
diagnostics: filterIgnoredDiagnostics(rawDiagnostics, context.config, context.targetPath),
|
|
2536
|
+
errors: errors.map((e) => ({
|
|
2537
|
+
ruleId: e.ruleId,
|
|
2538
|
+
error: formatRuleError(e.error)
|
|
2539
|
+
}))
|
|
2540
|
+
};
|
|
2541
|
+
}
|
|
2542
|
+
function scanProject(context) {
|
|
2543
|
+
const options = {
|
|
2544
|
+
moduleGraph: context.moduleGraph,
|
|
2545
|
+
providers: context.providers,
|
|
2546
|
+
config: context.config
|
|
2547
|
+
};
|
|
2548
|
+
const { diagnostics: rawDiagnostics, errors } = runProjectRules(context.astProject, context.files, context.projectRules, options);
|
|
2549
|
+
return {
|
|
2550
|
+
diagnostics: filterIgnoredDiagnostics(rawDiagnostics, context.config, context.targetPath),
|
|
2551
|
+
errors: errors.map((e) => ({
|
|
2552
|
+
ruleId: e.ruleId,
|
|
2553
|
+
error: formatRuleError(e.error)
|
|
2554
|
+
}))
|
|
2555
|
+
};
|
|
2556
|
+
}
|
|
2557
|
+
async function scan(targetPath, options = {}) {
|
|
2558
|
+
const startTime = node_perf_hooks.performance.now();
|
|
2559
|
+
const { context, customRuleWarnings } = await prepareScan(targetPath, options);
|
|
2560
|
+
const fileResult = scanAllFiles(context);
|
|
2561
|
+
const projectResult = scanProject(context);
|
|
2562
|
+
const diagnostics = [...fileResult.diagnostics, ...projectResult.diagnostics];
|
|
2563
|
+
const ruleErrors = [...fileResult.errors, ...projectResult.errors];
|
|
2564
|
+
const project = await detectProject(targetPath);
|
|
2565
|
+
const score = calculateScore(diagnostics, context.files.length);
|
|
2471
2566
|
const summary = buildSummary(diagnostics);
|
|
2472
|
-
const ruleErrors = errors.map((e) => ({
|
|
2473
|
-
ruleId: e.ruleId,
|
|
2474
|
-
error: formatRuleError(e.error)
|
|
2475
|
-
}));
|
|
2476
2567
|
const elapsedMs = node_perf_hooks.performance.now() - startTime;
|
|
2477
2568
|
return {
|
|
2478
2569
|
result: {
|
|
@@ -2480,17 +2571,17 @@ async function scan(targetPath, options = {}) {
|
|
|
2480
2571
|
diagnostics,
|
|
2481
2572
|
project: {
|
|
2482
2573
|
...project,
|
|
2483
|
-
fileCount: files.length,
|
|
2484
|
-
moduleCount: moduleGraph.modules.size
|
|
2574
|
+
fileCount: context.files.length,
|
|
2575
|
+
moduleCount: context.moduleGraph.modules.size
|
|
2485
2576
|
},
|
|
2486
2577
|
summary,
|
|
2487
2578
|
ruleErrors,
|
|
2488
2579
|
elapsedMs
|
|
2489
2580
|
},
|
|
2490
|
-
moduleGraph,
|
|
2581
|
+
moduleGraph: context.moduleGraph,
|
|
2491
2582
|
customRuleWarnings,
|
|
2492
|
-
files,
|
|
2493
|
-
providers
|
|
2583
|
+
files: context.files,
|
|
2584
|
+
providers: context.providers
|
|
2494
2585
|
};
|
|
2495
2586
|
}
|
|
2496
2587
|
function filterRules(config, rules) {
|
|
@@ -2702,4 +2793,9 @@ exports.ScanError = ScanError;
|
|
|
2702
2793
|
exports.ValidationError = ValidationError;
|
|
2703
2794
|
exports.diagnose = diagnose;
|
|
2704
2795
|
exports.diagnoseMonorepo = diagnoseMonorepo;
|
|
2705
|
-
exports.getRules = getRules;
|
|
2796
|
+
exports.getRules = getRules;
|
|
2797
|
+
exports.prepareScan = prepareScan;
|
|
2798
|
+
exports.scanAllFiles = scanAllFiles;
|
|
2799
|
+
exports.scanFile = scanFile;
|
|
2800
|
+
exports.scanProject = scanProject;
|
|
2801
|
+
exports.updateFile = updateFile;
|
package/dist/api/index.d.cts
CHANGED
|
@@ -97,23 +97,6 @@ interface ProjectRule {
|
|
|
97
97
|
}
|
|
98
98
|
type AnyRule = Rule | ProjectRule;
|
|
99
99
|
//#endregion
|
|
100
|
-
//#region src/rules/index.d.ts
|
|
101
|
-
declare function getRules(): AnyRule[];
|
|
102
|
-
//#endregion
|
|
103
|
-
//#region src/types/errors.d.ts
|
|
104
|
-
declare class NestjsDoctorError extends Error {
|
|
105
|
-
constructor(message: string);
|
|
106
|
-
}
|
|
107
|
-
declare class ConfigurationError extends NestjsDoctorError {
|
|
108
|
-
constructor(message: string);
|
|
109
|
-
}
|
|
110
|
-
declare class ScanError extends NestjsDoctorError {
|
|
111
|
-
constructor(message: string);
|
|
112
|
-
}
|
|
113
|
-
declare class ValidationError extends NestjsDoctorError {
|
|
114
|
-
constructor(message: string);
|
|
115
|
-
}
|
|
116
|
-
//#endregion
|
|
117
100
|
//#region src/types/result.d.ts
|
|
118
101
|
interface Score {
|
|
119
102
|
label: string;
|
|
@@ -157,6 +140,55 @@ interface MonorepoResult {
|
|
|
157
140
|
subProjects: SubProjectResult[];
|
|
158
141
|
}
|
|
159
142
|
//#endregion
|
|
143
|
+
//#region src/core/scanner.d.ts
|
|
144
|
+
interface ScanOptions {
|
|
145
|
+
config?: string;
|
|
146
|
+
}
|
|
147
|
+
interface ScanContext {
|
|
148
|
+
astProject: Project;
|
|
149
|
+
config: NestjsDoctorConfig;
|
|
150
|
+
fileRules: Rule[];
|
|
151
|
+
files: string[];
|
|
152
|
+
moduleGraph: ModuleGraph;
|
|
153
|
+
projectRules: ProjectRule[];
|
|
154
|
+
providers: Map<string, ProviderInfo>;
|
|
155
|
+
targetPath: string;
|
|
156
|
+
}
|
|
157
|
+
declare function prepareScan(targetPath: string, options?: ScanOptions): Promise<{
|
|
158
|
+
context: ScanContext;
|
|
159
|
+
customRuleWarnings: string[];
|
|
160
|
+
}>;
|
|
161
|
+
declare function updateFile(context: ScanContext, filePath: string): void;
|
|
162
|
+
declare function scanFile(context: ScanContext, filePath: string): {
|
|
163
|
+
diagnostics: Diagnostic[];
|
|
164
|
+
errors: RuleErrorInfo[];
|
|
165
|
+
};
|
|
166
|
+
declare function scanAllFiles(context: ScanContext): {
|
|
167
|
+
diagnostics: Diagnostic[];
|
|
168
|
+
errors: RuleErrorInfo[];
|
|
169
|
+
};
|
|
170
|
+
declare function scanProject(context: ScanContext): {
|
|
171
|
+
diagnostics: Diagnostic[];
|
|
172
|
+
errors: RuleErrorInfo[];
|
|
173
|
+
};
|
|
174
|
+
//#endregion
|
|
175
|
+
//#region src/rules/index.d.ts
|
|
176
|
+
declare function getRules(): AnyRule[];
|
|
177
|
+
//#endregion
|
|
178
|
+
//#region src/types/errors.d.ts
|
|
179
|
+
declare class NestjsDoctorError extends Error {
|
|
180
|
+
constructor(message: string);
|
|
181
|
+
}
|
|
182
|
+
declare class ConfigurationError extends NestjsDoctorError {
|
|
183
|
+
constructor(message: string);
|
|
184
|
+
}
|
|
185
|
+
declare class ScanError extends NestjsDoctorError {
|
|
186
|
+
constructor(message: string);
|
|
187
|
+
}
|
|
188
|
+
declare class ValidationError extends NestjsDoctorError {
|
|
189
|
+
constructor(message: string);
|
|
190
|
+
}
|
|
191
|
+
//#endregion
|
|
160
192
|
//#region src/api/index.d.ts
|
|
161
193
|
/**
|
|
162
194
|
* Scans a single NestJS project and returns a health diagnostic result.
|
|
@@ -184,5 +216,5 @@ declare function diagnoseMonorepo(path: string, options?: {
|
|
|
184
216
|
config?: string;
|
|
185
217
|
}): Promise<MonorepoResult>;
|
|
186
218
|
//#endregion
|
|
187
|
-
export { type AnyRule, type Category, ConfigurationError, type DiagnoseResult, type DiagnoseSummary, type Diagnostic, type MonorepoResult, type NestjsDoctorConfig, NestjsDoctorError, type ProjectInfo, type ProjectRule, type ProjectRuleContext, type Rule, type RuleContext, type RuleErrorInfo, type RuleMeta, ScanError, type Score, type Severity, type SubProjectResult, ValidationError, diagnose, diagnoseMonorepo, getRules };
|
|
219
|
+
export { type AnyRule, type Category, ConfigurationError, type DiagnoseResult, type DiagnoseSummary, type Diagnostic, type MonorepoResult, type NestjsDoctorConfig, NestjsDoctorError, type ProjectInfo, type ProjectRule, type ProjectRuleContext, type Rule, type RuleContext, type RuleErrorInfo, type RuleMeta, type ScanContext, ScanError, type Score, type Severity, type SubProjectResult, ValidationError, diagnose, diagnoseMonorepo, getRules, prepareScan, scanAllFiles, scanFile, scanProject, updateFile };
|
|
188
220
|
//# sourceMappingURL=index.d.cts.map
|
package/dist/api/index.d.cts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.cts","names":[],"sources":["../../src/engine/type-resolver.ts","../../src/engine/module-graph.ts","../../src/types/diagnostic.ts","../../src/types/config.ts","../../src/rules/types.ts","../../src/
|
|
1
|
+
{"version":3,"file":"index.d.cts","names":[],"sources":["../../src/engine/type-resolver.ts","../../src/engine/module-graph.ts","../../src/types/diagnostic.ts","../../src/types/config.ts","../../src/rules/types.ts","../../src/types/result.ts","../../src/core/scanner.ts","../../src/rules/index.ts","../../src/types/errors.ts","../../src/api/index.ts"],"mappings":";;;UAKiB,YAAA;EAChB,gBAAA,EAAkB,gBAAA;EAClB,YAAA;EACA,QAAA;EACA,IAAA;EACA,iBAAA;AAAA;;;UCAgB,UAAA;EAChB,gBAAA,EAAkB,gBAAA;EAClB,WAAA;EACA,OAAA;EACA,QAAA;EACA,OAAA;EACA,IAAA;EACA,SAAA;AAAA;AAAA,UAGgB,WAAA;EAChB,KAAA,EAAO,GAAA,SAAY,GAAA;EACnB,OAAA,EAAS,GAAA,SAAY,UAAA;EACrB,gBAAA,EAAkB,GAAA,SAAY,UAAA;AAAA;;;KCrBnB,QAAA;AAAA,KACA,QAAA;AAAA,UAMK,UAAA;EAChB,IAAA;EACA,IAAA;AAAA;AAAA,UAGgB,UAAA;EAChB,QAAA,EAAU,QAAA;EACV,MAAA;EACA,QAAA;EACA,IAAA;EACA,IAAA;EACA,OAAA;EACA,IAAA;EACA,KAAA,GAAQ,SAAA;EACR,QAAA,EAAU,QAAA;EACV,WAAA,GAAc,UAAA;AAAA;;;UCtBE,YAAA;EAChB,OAAA;EACA,QAAA,GAAW,QAAA;AAAA;AAAA,UAGK,wBAAA;EAChB,KAAA;EACA,KAAA;AAAA;AAAA,UAGgB,kBAAA;EAChB,UAAA,GAAa,OAAA,CAAQ,MAAA,CAAO,QAAA;EAC5B,cAAA;EACA,OAAA;EACA,MAAA,GAAS,wBAAA;EACT,OAAA;EACA,QAAA;EACA,KAAA,GAAQ,MAAA,SAAe,YAAA;AAAA;;;KCbZ,SAAA;AAAA,UAEK,QAAA;EAChB,QAAA,EAAU,QAAA;EACV,WAAA;EACA,IAAA;EACA,EAAA;EACA,KAAA,GAAQ,SAAA;EACR,QAAA,EAAU,QAAA;AAAA;AAAA,UAGM,WAAA;EAChB,QAA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a,WAAA;EACb,YAAA,EAAc,WAAA;EACd,SAAA,EAAW,GAAA,SAAY,YAAA;EACvB,UAAA;AAAA;AAAA,iBAGqB,WAAA,CACrB,UAAA,UACA,OAAA,GAAS,WAAA,GACP,OAAA;EAAU,OAAA,EAAS,WAAA;EAAa,kBAAA;AAAA;AAAA,iBA2BnB,UAAA,CAAW,OAAA,EAAS,WAAA,EAAa,QAAA;AAAA,iBAgBjC,QAAA,CACf,OAAA,EAAS,WAAA,EACT,QAAA;EACI,WAAA,EAAa,UAAA;EAAc,MAAA,EAAQ,aAAA;AAAA;AAAA,iBAmBxB,YAAA,CAAa,OAAA,EAAS,WAAA;EACrC,WAAA,EAAa,UAAA;EACb,MAAA,EAAQ,aAAA;AAAA;AAAA,iBAoBO,WAAA,CAAY,OAAA,EAAS,WAAA;EACpC,WAAA,EAAa,UAAA;EACb,MAAA,EAAQ,aAAA;AAAA;;;iBC9DO,QAAA,CAAA,GAAY,OAAA;;;cClGf,iBAAA,SAA0B,KAAA;cAC1B,OAAA;AAAA;AAAA,cAMA,kBAAA,SAA2B,iBAAA;cAC3B,OAAA;AAAA;AAAA,cAMA,SAAA,SAAkB,iBAAA;cAClB,OAAA;AAAA;AAAA,cAMA,eAAA,SAAwB,iBAAA;cACxB,OAAA;AAAA;;;;;;;;;;;iBCkDS,QAAA,CACrB,IAAA,UACA,OAAA;EAAW,MAAA;AAAA,IAAsB,OAAA,CAFJ,cAAA;;;;;;;;;;;;iBAoBR,gBAAA,CACrB,IAAA,UACA,OAAA;EAAW,MAAA;AAAA,IAAsB,OAAA,CAFI,cAAA"}
|
package/dist/api/index.d.mts
CHANGED
|
@@ -97,23 +97,6 @@ interface ProjectRule {
|
|
|
97
97
|
}
|
|
98
98
|
type AnyRule = Rule | ProjectRule;
|
|
99
99
|
//#endregion
|
|
100
|
-
//#region src/rules/index.d.ts
|
|
101
|
-
declare function getRules(): AnyRule[];
|
|
102
|
-
//#endregion
|
|
103
|
-
//#region src/types/errors.d.ts
|
|
104
|
-
declare class NestjsDoctorError extends Error {
|
|
105
|
-
constructor(message: string);
|
|
106
|
-
}
|
|
107
|
-
declare class ConfigurationError extends NestjsDoctorError {
|
|
108
|
-
constructor(message: string);
|
|
109
|
-
}
|
|
110
|
-
declare class ScanError extends NestjsDoctorError {
|
|
111
|
-
constructor(message: string);
|
|
112
|
-
}
|
|
113
|
-
declare class ValidationError extends NestjsDoctorError {
|
|
114
|
-
constructor(message: string);
|
|
115
|
-
}
|
|
116
|
-
//#endregion
|
|
117
100
|
//#region src/types/result.d.ts
|
|
118
101
|
interface Score {
|
|
119
102
|
label: string;
|
|
@@ -157,6 +140,55 @@ interface MonorepoResult {
|
|
|
157
140
|
subProjects: SubProjectResult[];
|
|
158
141
|
}
|
|
159
142
|
//#endregion
|
|
143
|
+
//#region src/core/scanner.d.ts
|
|
144
|
+
interface ScanOptions {
|
|
145
|
+
config?: string;
|
|
146
|
+
}
|
|
147
|
+
interface ScanContext {
|
|
148
|
+
astProject: Project;
|
|
149
|
+
config: NestjsDoctorConfig;
|
|
150
|
+
fileRules: Rule[];
|
|
151
|
+
files: string[];
|
|
152
|
+
moduleGraph: ModuleGraph;
|
|
153
|
+
projectRules: ProjectRule[];
|
|
154
|
+
providers: Map<string, ProviderInfo>;
|
|
155
|
+
targetPath: string;
|
|
156
|
+
}
|
|
157
|
+
declare function prepareScan(targetPath: string, options?: ScanOptions): Promise<{
|
|
158
|
+
context: ScanContext;
|
|
159
|
+
customRuleWarnings: string[];
|
|
160
|
+
}>;
|
|
161
|
+
declare function updateFile(context: ScanContext, filePath: string): void;
|
|
162
|
+
declare function scanFile(context: ScanContext, filePath: string): {
|
|
163
|
+
diagnostics: Diagnostic[];
|
|
164
|
+
errors: RuleErrorInfo[];
|
|
165
|
+
};
|
|
166
|
+
declare function scanAllFiles(context: ScanContext): {
|
|
167
|
+
diagnostics: Diagnostic[];
|
|
168
|
+
errors: RuleErrorInfo[];
|
|
169
|
+
};
|
|
170
|
+
declare function scanProject(context: ScanContext): {
|
|
171
|
+
diagnostics: Diagnostic[];
|
|
172
|
+
errors: RuleErrorInfo[];
|
|
173
|
+
};
|
|
174
|
+
//#endregion
|
|
175
|
+
//#region src/rules/index.d.ts
|
|
176
|
+
declare function getRules(): AnyRule[];
|
|
177
|
+
//#endregion
|
|
178
|
+
//#region src/types/errors.d.ts
|
|
179
|
+
declare class NestjsDoctorError extends Error {
|
|
180
|
+
constructor(message: string);
|
|
181
|
+
}
|
|
182
|
+
declare class ConfigurationError extends NestjsDoctorError {
|
|
183
|
+
constructor(message: string);
|
|
184
|
+
}
|
|
185
|
+
declare class ScanError extends NestjsDoctorError {
|
|
186
|
+
constructor(message: string);
|
|
187
|
+
}
|
|
188
|
+
declare class ValidationError extends NestjsDoctorError {
|
|
189
|
+
constructor(message: string);
|
|
190
|
+
}
|
|
191
|
+
//#endregion
|
|
160
192
|
//#region src/api/index.d.ts
|
|
161
193
|
/**
|
|
162
194
|
* Scans a single NestJS project and returns a health diagnostic result.
|
|
@@ -184,5 +216,5 @@ declare function diagnoseMonorepo(path: string, options?: {
|
|
|
184
216
|
config?: string;
|
|
185
217
|
}): Promise<MonorepoResult>;
|
|
186
218
|
//#endregion
|
|
187
|
-
export { type AnyRule, type Category, ConfigurationError, type DiagnoseResult, type DiagnoseSummary, type Diagnostic, type MonorepoResult, type NestjsDoctorConfig, NestjsDoctorError, type ProjectInfo, type ProjectRule, type ProjectRuleContext, type Rule, type RuleContext, type RuleErrorInfo, type RuleMeta, ScanError, type Score, type Severity, type SubProjectResult, ValidationError, diagnose, diagnoseMonorepo, getRules };
|
|
219
|
+
export { type AnyRule, type Category, ConfigurationError, type DiagnoseResult, type DiagnoseSummary, type Diagnostic, type MonorepoResult, type NestjsDoctorConfig, NestjsDoctorError, type ProjectInfo, type ProjectRule, type ProjectRuleContext, type Rule, type RuleContext, type RuleErrorInfo, type RuleMeta, type ScanContext, ScanError, type Score, type Severity, type SubProjectResult, ValidationError, diagnose, diagnoseMonorepo, getRules, prepareScan, scanAllFiles, scanFile, scanProject, updateFile };
|
|
188
220
|
//# sourceMappingURL=index.d.mts.map
|
package/dist/api/index.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.mts","names":[],"sources":["../../src/engine/type-resolver.ts","../../src/engine/module-graph.ts","../../src/types/diagnostic.ts","../../src/types/config.ts","../../src/rules/types.ts","../../src/
|
|
1
|
+
{"version":3,"file":"index.d.mts","names":[],"sources":["../../src/engine/type-resolver.ts","../../src/engine/module-graph.ts","../../src/types/diagnostic.ts","../../src/types/config.ts","../../src/rules/types.ts","../../src/types/result.ts","../../src/core/scanner.ts","../../src/rules/index.ts","../../src/types/errors.ts","../../src/api/index.ts"],"mappings":";;;UAKiB,YAAA;EAChB,gBAAA,EAAkB,gBAAA;EAClB,YAAA;EACA,QAAA;EACA,IAAA;EACA,iBAAA;AAAA;;;UCAgB,UAAA;EAChB,gBAAA,EAAkB,gBAAA;EAClB,WAAA;EACA,OAAA;EACA,QAAA;EACA,OAAA;EACA,IAAA;EACA,SAAA;AAAA;AAAA,UAGgB,WAAA;EAChB,KAAA,EAAO,GAAA,SAAY,GAAA;EACnB,OAAA,EAAS,GAAA,SAAY,UAAA;EACrB,gBAAA,EAAkB,GAAA,SAAY,UAAA;AAAA;;;KCrBnB,QAAA;AAAA,KACA,QAAA;AAAA,UAMK,UAAA;EAChB,IAAA;EACA,IAAA;AAAA;AAAA,UAGgB,UAAA;EAChB,QAAA,EAAU,QAAA;EACV,MAAA;EACA,QAAA;EACA,IAAA;EACA,IAAA;EACA,OAAA;EACA,IAAA;EACA,KAAA,GAAQ,SAAA;EACR,QAAA,EAAU,QAAA;EACV,WAAA,GAAc,UAAA;AAAA;;;UCtBE,YAAA;EAChB,OAAA;EACA,QAAA,GAAW,QAAA;AAAA;AAAA,UAGK,wBAAA;EAChB,KAAA;EACA,KAAA;AAAA;AAAA,UAGgB,kBAAA;EAChB,UAAA,GAAa,OAAA,CAAQ,MAAA,CA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