depvitals 0.3.0 → 0.4.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 +72 -3
- package/dist/cli/entry.js +8 -21
- package/dist/cli/entry.js.map +1 -1
- package/dist/cli/parseCliArgs.d.ts +5 -2
- package/dist/cli/parseCliArgs.d.ts.map +1 -1
- package/dist/cli/parseCliArgs.js +51 -36
- package/dist/cli/parseCliArgs.js.map +1 -1
- package/dist/cli/runCli.d.ts +4 -5
- package/dist/cli/runCli.d.ts.map +1 -1
- package/dist/cli/runCli.js +39 -49
- package/dist/cli/runCli.js.map +1 -1
- package/dist/config/ignoreDependencies.d.ts +2 -0
- package/dist/config/ignoreDependencies.d.ts.map +1 -1
- package/dist/config/ignoreDependencies.js +5 -1
- package/dist/config/ignoreDependencies.js.map +1 -1
- package/dist/config/readProjectConfig.d.ts +5 -0
- package/dist/config/readProjectConfig.d.ts.map +1 -1
- package/dist/config/readProjectConfig.js +24 -10
- package/dist/config/readProjectConfig.js.map +1 -1
- package/dist/core/analyzeProject.d.ts +35 -0
- package/dist/core/analyzeProject.d.ts.map +1 -1
- package/dist/core/analyzeProject.js +161 -25
- package/dist/core/analyzeProject.js.map +1 -1
- package/dist/core/evidence.d.ts +67 -0
- package/dist/core/evidence.d.ts.map +1 -0
- package/dist/core/evidence.js +115 -0
- package/dist/core/evidence.js.map +1 -0
- package/dist/core/scanContext.d.ts +20 -0
- package/dist/core/scanContext.d.ts.map +1 -0
- package/dist/core/scanContext.js +43 -0
- package/dist/core/scanContext.js.map +1 -0
- package/dist/detectors/eslintManifestConfig.d.ts +18 -0
- package/dist/detectors/eslintManifestConfig.d.ts.map +1 -1
- package/dist/detectors/eslintManifestConfig.js +55 -76
- package/dist/detectors/eslintManifestConfig.js.map +1 -1
- package/dist/detectors/eslintRcJsonConfig.d.ts +8 -2
- package/dist/detectors/eslintRcJsonConfig.d.ts.map +1 -1
- package/dist/detectors/eslintRcJsonConfig.js +25 -11
- package/dist/detectors/eslintRcJsonConfig.js.map +1 -1
- package/dist/detectors/jestManifestConfig.d.ts +15 -3
- package/dist/detectors/jestManifestConfig.d.ts.map +1 -1
- package/dist/detectors/jestManifestConfig.js +57 -79
- package/dist/detectors/jestManifestConfig.js.map +1 -1
- package/dist/reporters/jsonReporter.d.ts +39 -0
- package/dist/reporters/jsonReporter.d.ts.map +1 -0
- package/dist/reporters/jsonReporter.js +91 -0
- package/dist/reporters/jsonReporter.js.map +1 -0
- package/dist/reporters/terminalReporter.d.ts +15 -4
- package/dist/reporters/terminalReporter.d.ts.map +1 -1
- package/dist/reporters/terminalReporter.js +64 -4
- package/dist/reporters/terminalReporter.js.map +1 -1
- package/dist/scanner/moduleSpecifiers.d.ts +10 -0
- package/dist/scanner/moduleSpecifiers.d.ts.map +1 -1
- package/dist/scanner/moduleSpecifiers.js +46 -8
- package/dist/scanner/moduleSpecifiers.js.map +1 -1
- package/dist/scanner/projectManifest.d.ts +9 -0
- package/dist/scanner/projectManifest.d.ts.map +1 -1
- package/dist/scanner/projectManifest.js +7 -1
- package/dist/scanner/projectManifest.js.map +1 -1
- package/dist/scanner/scriptUsage.d.ts +13 -0
- package/dist/scanner/scriptUsage.d.ts.map +1 -1
- package/dist/scanner/scriptUsage.js +102 -32
- package/dist/scanner/scriptUsage.js.map +1 -1
- package/dist/scanner/sourceFiles.d.ts +5 -0
- package/dist/scanner/sourceFiles.d.ts.map +1 -1
- package/dist/scanner/sourceFiles.js +7 -0
- package/dist/scanner/sourceFiles.js.map +1 -1
- package/package.json +4 -2
- package/schemas/README.md +47 -0
- package/schemas/examples/README.md +27 -0
- package/schemas/examples/explain-excluded.json +53 -0
- package/schemas/examples/explain-missing.json +65 -0
- package/schemas/examples/explain-node-preload.json +70 -0
- package/schemas/examples/explain-unknown.json +53 -0
- package/schemas/examples/scan-clean.json +40 -0
- package/schemas/examples/scan-findings.json +80 -0
- package/schemas/report-v1.schema.json +376 -0
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/** Internal per-invocation inputs. No global cache or atomic filesystem snapshot is implied. */
|
|
2
|
+
import { type ProjectConfig } from '../config/readProjectConfig.js';
|
|
3
|
+
import { type LegacyEslintPrecedence } from '../detectors/eslintManifestConfig.js';
|
|
4
|
+
import { type ProjectManifest } from '../scanner/projectManifest.js';
|
|
5
|
+
import { type ConfigEvidence } from './evidence.js';
|
|
6
|
+
export type ScanContext = {
|
|
7
|
+
readonly manifest: ProjectManifest;
|
|
8
|
+
readonly rawManifest: Readonly<Record<string, unknown>>;
|
|
9
|
+
readonly config: ProjectConfig;
|
|
10
|
+
readonly rootEntries: readonly string[];
|
|
11
|
+
readonly eslintPrecedence: LegacyEslintPrecedence;
|
|
12
|
+
readonly jestConfigBarrier: boolean;
|
|
13
|
+
readonly configEvidence: readonly {
|
|
14
|
+
readonly packageName: string;
|
|
15
|
+
readonly evidence: ConfigEvidence;
|
|
16
|
+
}[];
|
|
17
|
+
};
|
|
18
|
+
/** Validate root/manifest, then strict policy, then collect only the selected detector sources. */
|
|
19
|
+
export declare function createScanContext(projectRoot: string): Promise<ScanContext>;
|
|
20
|
+
//# sourceMappingURL=scanContext.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"scanContext.d.ts","sourceRoot":"","sources":["../../src/core/scanContext.ts"],"names":[],"mappings":"AAAA,gGAAgG;AAChG,OAAO,EAA6B,KAAK,aAAa,EAAE,MAAM,gCAAgC,CAAC;AAC/F,OAAO,EAGL,KAAK,sBAAsB,EAC5B,MAAM,sCAAsC,CAAC;AAM9C,OAAO,EAA2B,KAAK,eAAe,EAAE,MAAM,+BAA+B,CAAC;AAC9F,OAAO,EAAmC,KAAK,cAAc,EAAE,MAAM,eAAe,CAAC;AAErF,MAAM,MAAM,WAAW,GAAG;IACxB,QAAQ,CAAC,QAAQ,EAAE,eAAe,CAAC;IACnC,QAAQ,CAAC,WAAW,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;IACxD,QAAQ,CAAC,MAAM,EAAE,aAAa,CAAC;IAC/B,QAAQ,CAAC,WAAW,EAAE,SAAS,MAAM,EAAE,CAAC;IACxC,QAAQ,CAAC,gBAAgB,EAAE,sBAAsB,CAAC;IAClD,QAAQ,CAAC,iBAAiB,EAAE,OAAO,CAAC;IACpC,QAAQ,CAAC,cAAc,EAAE,SAAS;QAChC,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;QAC7B,QAAQ,CAAC,QAAQ,EAAE,cAAc,CAAC;KACnC,EAAE,CAAC;CACL,CAAC;AAEF,mGAAmG;AACnG,wBAAsB,iBAAiB,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,CAAC,CAmCjF"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/** Internal per-invocation inputs. No global cache or atomic filesystem snapshot is implied. */
|
|
2
|
+
import { readProjectConfigSnapshot } from '../config/readProjectConfig.js';
|
|
3
|
+
import { collectEslintConfigUsage, legacyEslintPrecedenceFromEntries, } from '../detectors/eslintManifestConfig.js';
|
|
4
|
+
import { collectEslintRcJsonUsageForManifest } from '../detectors/eslintRcJsonConfig.js';
|
|
5
|
+
import { collectJestConfigUsage, hasRootJestConfigEntries, } from '../detectors/jestManifestConfig.js';
|
|
6
|
+
import { loadProjectManifestData } from '../scanner/projectManifest.js';
|
|
7
|
+
import { compareEvidence, compareStrings } from './evidence.js';
|
|
8
|
+
/** Validate root/manifest, then strict policy, then collect only the selected detector sources. */
|
|
9
|
+
export async function createScanContext(projectRoot) {
|
|
10
|
+
const { manifest, raw } = await loadProjectManifestData(projectRoot);
|
|
11
|
+
const { config, rootEntries } = await readProjectConfigSnapshot(manifest.root);
|
|
12
|
+
const eslintPrecedence = legacyEslintPrecedenceFromEntries(rootEntries);
|
|
13
|
+
const jestConfigBarrier = hasRootJestConfigEntries(rootEntries);
|
|
14
|
+
const configEvidence = [];
|
|
15
|
+
if (!eslintPrecedence.hardBarrier) {
|
|
16
|
+
if (eslintPrecedence.legacyRcJsonEntryName !== undefined) {
|
|
17
|
+
const occurrences = await collectEslintRcJsonUsageForManifest(manifest, eslintPrecedence);
|
|
18
|
+
for (const occurrence of occurrences)
|
|
19
|
+
configEvidence.push(occurrence);
|
|
20
|
+
}
|
|
21
|
+
else if (!eslintPrecedence.legacyRcByName) {
|
|
22
|
+
const occurrences = collectEslintConfigUsage(raw['eslintConfig'], manifest.declaredDependencyNames);
|
|
23
|
+
for (const occurrence of occurrences)
|
|
24
|
+
configEvidence.push(occurrence);
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
if (!jestConfigBarrier) {
|
|
28
|
+
const occurrences = collectJestConfigUsage(raw['jest'], manifest.declaredDependencyNames);
|
|
29
|
+
for (const occurrence of occurrences)
|
|
30
|
+
configEvidence.push(occurrence);
|
|
31
|
+
}
|
|
32
|
+
configEvidence.sort((a, b) => compareStrings(a.packageName, b.packageName) || compareEvidence(a.evidence, b.evidence));
|
|
33
|
+
return {
|
|
34
|
+
manifest,
|
|
35
|
+
rawManifest: raw,
|
|
36
|
+
config,
|
|
37
|
+
rootEntries,
|
|
38
|
+
eslintPrecedence,
|
|
39
|
+
jestConfigBarrier,
|
|
40
|
+
configEvidence,
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
//# sourceMappingURL=scanContext.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"scanContext.js","sourceRoot":"","sources":["../../src/core/scanContext.ts"],"names":[],"mappings":"AAAA,gGAAgG;AAChG,OAAO,EAAE,yBAAyB,EAAsB,MAAM,gCAAgC,CAAC;AAC/F,OAAO,EACL,wBAAwB,EACxB,iCAAiC,GAElC,MAAM,sCAAsC,CAAC;AAC9C,OAAO,EAAE,mCAAmC,EAAE,MAAM,oCAAoC,CAAC;AACzF,OAAO,EACL,sBAAsB,EACtB,wBAAwB,GACzB,MAAM,oCAAoC,CAAC;AAC5C,OAAO,EAAE,uBAAuB,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cAAc,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;IACxE,CAAC;IACD,cAAc,CAAC,IAAI,CACjB,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CACP,cAAc,CAAC,CAAC,CAAC,WAAW,EAAE,CAAC,CAAC,WAAW,CAAC,IAAI,eAAe,CAAC,CAAC,CAAC,QAAQ,EAAE,CAAC,CAAC,QAAQ,CAAC,CAC1F,CAAC;IACF,OAAO;QACL,QAAQ;QACR,WAAW,EAAE,GAAG;QAChB,MAAM;QACN,WAAW;QACX,gBAAgB;QAChB,iBAAiB;QACjB,cAAc;KACf,CAAC;AACJ,CAAC"}
|
|
@@ -31,6 +31,7 @@
|
|
|
31
31
|
* interpreted or executed. The precedence is computed once by {@link readLegacyEslintPrecedence},
|
|
32
32
|
* shared by both legacy readers, so the two sources obey exactly one set of rules.
|
|
33
33
|
*/
|
|
34
|
+
import { type ConfigEvidence } from '../core/evidence.js';
|
|
34
35
|
/**
|
|
35
36
|
* The legacy ESLint precedence state for one project root, computed once by both readers so the two
|
|
36
37
|
* legacy sources obey exactly one set of rules.
|
|
@@ -62,6 +63,8 @@ export type LegacyEslintPrecedence = {
|
|
|
62
63
|
* @param projectRoot - Project directory to inspect; resolved to an absolute path.
|
|
63
64
|
*/
|
|
64
65
|
export declare function readLegacyEslintPrecedence(projectRoot: string): Promise<LegacyEslintPrecedence>;
|
|
66
|
+
/** Pure precedence over validated root entry names, shared by one CLI scan. */
|
|
67
|
+
export declare function legacyEslintPrecedenceFromEntries(entries: readonly string[]): LegacyEslintPrecedence;
|
|
65
68
|
/**
|
|
66
69
|
* Match the allowlisted subset of one legacy `eslintConfig` value against the declared packages.
|
|
67
70
|
*
|
|
@@ -75,6 +78,19 @@ export declare function readLegacyEslintPrecedence(projectRoot: string): Promise
|
|
|
75
78
|
* @param declaredPackageNames - Declared dependency names, the only names this may return.
|
|
76
79
|
*/
|
|
77
80
|
export declare function findEslintConfigUsage(eslintConfig: unknown, declaredPackageNames: ReadonlySet<string>): ReadonlySet<string>;
|
|
81
|
+
/** Internal package owner and the exact recognized configuration occurrence. */
|
|
82
|
+
export type EslintConfigOccurrence = {
|
|
83
|
+
readonly packageName: string;
|
|
84
|
+
readonly evidence: ConfigEvidence;
|
|
85
|
+
};
|
|
86
|
+
/**
|
|
87
|
+
* Pure collector shared by the manifest/rc readers and the later validated-context handoff.
|
|
88
|
+
* Location comes from the reader, not a string search. Array indices are retained before filtering.
|
|
89
|
+
*/
|
|
90
|
+
export declare function collectEslintConfigUsage(eslintConfig: unknown, declaredPackageNames: ReadonlySet<string>, location?: {
|
|
91
|
+
readonly file: string;
|
|
92
|
+
readonly pointerTokens: readonly string[];
|
|
93
|
+
}): readonly EslintConfigOccurrence[];
|
|
78
94
|
/**
|
|
79
95
|
* Collect the legacy `package.json#eslintConfig` hints for the project rooted at `projectRoot`.
|
|
80
96
|
*
|
|
@@ -95,6 +111,8 @@ export declare function findEslintConfigUsage(eslintConfig: unknown, declaredPac
|
|
|
95
111
|
* @param projectRoot - Project directory to inspect; resolved to an absolute path.
|
|
96
112
|
*/
|
|
97
113
|
export declare function findEslintManifestUsage(projectRoot: string): Promise<ReadonlySet<string>>;
|
|
114
|
+
/** Collect active manifest facts using the same mandatory gates and reads as the legacy wrapper. */
|
|
115
|
+
export declare function collectEslintManifestUsage(projectRoot: string): Promise<readonly EslintConfigOccurrence[]>;
|
|
98
116
|
/**
|
|
99
117
|
* Whether the project rooted at `projectRoot` contains a modern flat-config entrypoint (see
|
|
100
118
|
* {@link FLAT_CONFIG_ENTRY_NAMES}).
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"eslintManifestConfig.d.ts","sourceRoot":"","sources":["../../src/detectors/eslintManifestConfig.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;
|
|
1
|
+
{"version":3,"file":"eslintManifestConfig.d.ts","sourceRoot":"","sources":["../../src/detectors/eslintManifestConfig.ts"],"names":[],"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;AAED,oGAAoG;AACpG,wBAAsB,0BAA0B,CAC9C,WAAW,EAAE,MAAM,GAClB,OAAO,CAAC,SAAS,sBAAsB,EAAE,CAAC,CA2B5C;AAaD;;;;;;;;;;;GAWG;AACH,wBAAsB,kBAAkB,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAU9E"}
|
|
@@ -33,6 +33,7 @@
|
|
|
33
33
|
*/
|
|
34
34
|
import { readdir } from 'node:fs/promises';
|
|
35
35
|
import { resolve } from 'node:path';
|
|
36
|
+
import { compareEvidence, compareStrings, jsonPointer, } from '../core/evidence.js';
|
|
36
37
|
import { loadProjectManifest, ProjectManifestError, readManifestText, } from '../scanner/projectManifest.js';
|
|
37
38
|
import { assertReadableRoot, SourceFilesError } from '../scanner/sourceFiles.js';
|
|
38
39
|
/**
|
|
@@ -142,6 +143,10 @@ export async function readLegacyEslintPrecedence(projectRoot) {
|
|
|
142
143
|
legacyRcJsonEntryName: undefined,
|
|
143
144
|
};
|
|
144
145
|
}
|
|
146
|
+
return legacyEslintPrecedenceFromEntries(entries);
|
|
147
|
+
}
|
|
148
|
+
/** Pure precedence over validated root entry names, shared by one CLI scan. */
|
|
149
|
+
export function legacyEslintPrecedenceFromEntries(entries) {
|
|
145
150
|
const has = (names) => entries.some((entry) => names.has(entry.toLowerCase()));
|
|
146
151
|
// The legacy `.eslintrc.json` name is matched case-insensitively (Windows/macOS resolve the
|
|
147
152
|
// same file under a different casing), so remember the actual entry that was found. The JSON
|
|
@@ -170,21 +175,50 @@ export async function readLegacyEslintPrecedence(projectRoot) {
|
|
|
170
175
|
* @param declaredPackageNames - Declared dependency names, the only names this may return.
|
|
171
176
|
*/
|
|
172
177
|
export function findEslintConfigUsage(eslintConfig, declaredPackageNames) {
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
178
|
+
return new Set(collectEslintConfigUsage(eslintConfig, declaredPackageNames).map(({ packageName }) => packageName));
|
|
179
|
+
}
|
|
180
|
+
/**
|
|
181
|
+
* Pure collector shared by the manifest/rc readers and the later validated-context handoff.
|
|
182
|
+
* Location comes from the reader, not a string search. Array indices are retained before filtering.
|
|
183
|
+
*/
|
|
184
|
+
export function collectEslintConfigUsage(eslintConfig, declaredPackageNames, location = {
|
|
185
|
+
file: 'package.json',
|
|
186
|
+
pointerTokens: ['eslintConfig'],
|
|
187
|
+
}) {
|
|
188
|
+
if (!isPlainRecord(eslintConfig))
|
|
189
|
+
return [];
|
|
190
|
+
const occurrences = [];
|
|
191
|
+
const collectField = (field, table) => {
|
|
192
|
+
const add = (value, index) => {
|
|
193
|
+
if (typeof value !== 'string')
|
|
194
|
+
return;
|
|
195
|
+
const packageName = table.get(value);
|
|
196
|
+
if (packageName !== undefined && declaredPackageNames.has(packageName)) {
|
|
197
|
+
occurrences.push({
|
|
198
|
+
packageName,
|
|
199
|
+
evidence: {
|
|
200
|
+
kind: 'config',
|
|
201
|
+
file: location.file,
|
|
202
|
+
pointer: jsonPointer(...location.pointerTokens, field, ...(index === undefined ? [] : [String(index)])),
|
|
203
|
+
value,
|
|
204
|
+
detector: 'eslint',
|
|
205
|
+
},
|
|
206
|
+
});
|
|
207
|
+
}
|
|
208
|
+
};
|
|
209
|
+
const value = eslintConfig[field];
|
|
210
|
+
if (field === 'extends' && typeof value === 'string') {
|
|
211
|
+
add(value);
|
|
184
212
|
}
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
213
|
+
else if (Array.isArray(value)) {
|
|
214
|
+
for (const [index, item] of value.entries())
|
|
215
|
+
add(item, index);
|
|
216
|
+
}
|
|
217
|
+
};
|
|
218
|
+
collectField('extends', EXTENDS_PACKAGE_NAMES);
|
|
219
|
+
collectField('plugins', PLUGIN_PACKAGE_NAMES);
|
|
220
|
+
// A field/index identifies exactly one item; repeated values at other indices stay distinct.
|
|
221
|
+
return occurrences.sort((a, b) => compareStrings(a.packageName, b.packageName) || compareEvidence(a.evidence, b.evidence));
|
|
188
222
|
}
|
|
189
223
|
/**
|
|
190
224
|
* Collect the legacy `package.json#eslintConfig` hints for the project rooted at `projectRoot`.
|
|
@@ -206,10 +240,14 @@ export function findEslintConfigUsage(eslintConfig, declaredPackageNames) {
|
|
|
206
240
|
* @param projectRoot - Project directory to inspect; resolved to an absolute path.
|
|
207
241
|
*/
|
|
208
242
|
export async function findEslintManifestUsage(projectRoot) {
|
|
243
|
+
return new Set((await collectEslintManifestUsage(projectRoot)).map(({ packageName }) => packageName));
|
|
244
|
+
}
|
|
245
|
+
/** Collect active manifest facts using the same mandatory gates and reads as the legacy wrapper. */
|
|
246
|
+
export async function collectEslintManifestUsage(projectRoot) {
|
|
209
247
|
const root = resolve(projectRoot);
|
|
210
248
|
const precedence = await readLegacyEslintPrecedence(root);
|
|
211
249
|
if (precedence.hardBarrier || precedence.legacyRcByName) {
|
|
212
|
-
return
|
|
250
|
+
return [];
|
|
213
251
|
}
|
|
214
252
|
let packageJsonPath;
|
|
215
253
|
let declaredPackageNames;
|
|
@@ -220,11 +258,11 @@ export async function findEslintManifestUsage(projectRoot) {
|
|
|
220
258
|
}
|
|
221
259
|
catch (error) {
|
|
222
260
|
if (error instanceof ProjectManifestError || error instanceof SourceFilesError) {
|
|
223
|
-
return
|
|
261
|
+
return [];
|
|
224
262
|
}
|
|
225
263
|
throw error;
|
|
226
264
|
}
|
|
227
|
-
return
|
|
265
|
+
return collectEslintConfigUsage(await readEslintConfigValue(packageJsonPath), declaredPackageNames);
|
|
228
266
|
}
|
|
229
267
|
/**
|
|
230
268
|
* Whether the on-disk directory entries contain a modern flat-config entrypoint (see
|
|
@@ -283,69 +321,10 @@ async function readEslintConfigValue(packageJsonPath) {
|
|
|
283
321
|
}
|
|
284
322
|
return isPlainRecord(parsed) ? parsed['eslintConfig'] : undefined;
|
|
285
323
|
}
|
|
286
|
-
/**
|
|
287
|
-
* The string values of `extends`, which ESLint accepts as one string or as an array.
|
|
288
|
-
*
|
|
289
|
-
* Non-string array entries contribute nothing on their own, so a malformed array still yields no
|
|
290
|
-
* evidence for the malformed entries. Any other shape (number, object, `null`, ...) contributes
|
|
291
|
-
* nothing at all.
|
|
292
|
-
*/
|
|
293
|
-
function extendsValues(value) {
|
|
294
|
-
if (typeof value === 'string') {
|
|
295
|
-
return [value];
|
|
296
|
-
}
|
|
297
|
-
return stringItems(value);
|
|
298
|
-
}
|
|
299
|
-
/**
|
|
300
|
-
* The string values of `plugins`, which ESLint accepts only as an array.
|
|
301
|
-
*
|
|
302
|
-
* A bare string such as `"react"` is not a valid `plugins` value and is deliberately not accepted,
|
|
303
|
-
* so a typo-shaped value never becomes evidence.
|
|
304
|
-
*/
|
|
305
|
-
function pluginsValues(value) {
|
|
306
|
-
return stringItems(value);
|
|
307
|
-
}
|
|
308
|
-
/**
|
|
309
|
-
* The string entries of an array value; a non-array value contributes nothing.
|
|
310
|
-
*/
|
|
311
|
-
function stringItems(value) {
|
|
312
|
-
if (!Array.isArray(value)) {
|
|
313
|
-
return [];
|
|
314
|
-
}
|
|
315
|
-
return value.filter((entry) => typeof entry === 'string');
|
|
316
|
-
}
|
|
317
|
-
/**
|
|
318
|
-
* Look every value up in one fixed allowlist table.
|
|
319
|
-
*
|
|
320
|
-
* Lookup is exact-string only: no prefix, suffix, substring or case-insensitive matching, so
|
|
321
|
-
* `prettier/react`, `eslint-config-unknown` and `React` never match an entry.
|
|
322
|
-
*/
|
|
323
|
-
function matchTable(values, table) {
|
|
324
|
-
const matched = [];
|
|
325
|
-
for (const value of values) {
|
|
326
|
-
const mapped = table.get(value);
|
|
327
|
-
if (mapped !== undefined) {
|
|
328
|
-
matched.push(mapped);
|
|
329
|
-
}
|
|
330
|
-
}
|
|
331
|
-
return matched;
|
|
332
|
-
}
|
|
333
324
|
/**
|
|
334
325
|
* A JSON object (not an array, not `null`) whose keys are strings.
|
|
335
326
|
*/
|
|
336
327
|
function isPlainRecord(value) {
|
|
337
328
|
return typeof value === 'object' && value !== null && !Array.isArray(value);
|
|
338
329
|
}
|
|
339
|
-
/**
|
|
340
|
-
* Locale-independent lexicographic ordering, so the same configuration always yields the same order.
|
|
341
|
-
*/
|
|
342
|
-
function compareNames(a, b) {
|
|
343
|
-
if (a < b) {
|
|
344
|
-
return -1;
|
|
345
|
-
}
|
|
346
|
-
if (a > b) {
|
|
347
|
-
return 1;
|
|
348
|
-
}
|
|
349
|
-
return 0;
|
|
350
|
-
}
|
|
351
330
|
//# sourceMappingURL=eslintManifestConfig.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"eslintManifestConfig.js","sourceRoot":"","sources":["../../src/detectors/eslintManifestConfig.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAC3C,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEpC,OAAO,EACL,mBAAmB,EACnB,oBAAoB,EACpB,gBAAgB,GACjB,MAAM,+BAA+B,CAAC;AACvC,OAAO,EAAE,kBAAkB,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAEjF;;;;;;;;;;;;;;;;;;;GAmBG;AACH,MAAM,qBAAqB,GAAgC,IAAI,GAAG,CAAC;IACjE,CAAC,UAAU,EAAE,wBAAwB,CAAC;IACtC,CAAC,QAAQ,EAAE,sBAAsB,CAAC;IAClC,CAAC,0BAA0B,EAAE,qBAAqB,CAAC;IACnD,CAAC,wBAAwB,EAAE,wBAAwB,CAAC;IACpD,CAAC,sBAAsB,EAAE,sBAAsB,CAAC;CACjD,CAAC,CAAC;AAEH;;;;;;;;;GASG;AACH,MAAM,oBAAoB,GAAgC,IAAI,GAAG,CAAC;IAChE,CAAC,OAAO,EAAE,qBAAqB,CAAC;IAChC,CAAC,qBAAqB,EAAE,qBAAqB,CAAC;CAC/C,CAAC,C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B,CAAC,WAAmB;IAC1D,IAAI,OAAiB,CAAC;IACtB,IAAI,CAAC;QACH,MAAM,kBAAkB,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC,CAAC;QAC/C,OAAO,GAAG,MAAM,OAAO,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC,CAAC;IAChD,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,KAAK,CAAC;IACf,CAAC;IAED,OAAO,yBAAyB,CAAC,OAAO,CAAC,CAAC;AAC5C,CAAC;AAED;;;;;;GAMG;AACH,KAAK,UAAU,qBAAqB,CAAC,eAAuB;IAC1D,IAAI,IAAY,CAAC;IAEjB,IAAI,CAAC;QACH,IAAI,GAAG,MAAM,gBAAgB,CAAC,eAAe,CAAC,CAAC;IACjD,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,SAAS,CAAC;IACnB,CAAC;IAED,IAAI,MAAe,CAAC;IAEpB,IAAI,CAAC;QACH,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IAC5B,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,SAAS,CAAC;IACnB,CAAC;IAED,OAAO,aAAa,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;AACpE,CAAC;AAED;;GAEG;AACH,SAAS,aAAa,CAAC,KAAc;IACnC,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;AAC9E,CAAC"}
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
*
|
|
4
4
|
* This module adds exactly one static data source to the ESLint rules proven in Step 57: the single
|
|
5
5
|
* file `<projectRoot>/.eslintrc.json`. Its parsed JSON document is handed to the same pure matcher
|
|
6
|
-
* ({@link
|
|
6
|
+
* ({@link collectEslintConfigUsage}) that reads `package.json#eslintConfig`, so the fixed allowlists,
|
|
7
7
|
* the exact-string lookup and the "declared packages only" rule are reused instead of duplicated.
|
|
8
8
|
* The result is a set of configuration-only package names for the Step 56 analyzer seam, so a
|
|
9
9
|
* recognized name can only suppress an `unused` finding and can never create a `missing` one.
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
* document, so it is removed before parsing;
|
|
22
22
|
* - traverse parent directories, nested packages or workspaces looking for further config files, or
|
|
23
23
|
* resolve `extends` references to other configuration files;
|
|
24
|
-
* - read anything besides the `extends`/`plugins` subset that {@link
|
|
24
|
+
* - read anything besides the `extends`/`plugins` subset that {@link collectEslintConfigUsage} accepts;
|
|
25
25
|
* every other ESLint field (`env`, `globals`, `rules`, `parserOptions`, `overrides`, ...) is
|
|
26
26
|
* ignored, and no unknown value produces evidence;
|
|
27
27
|
* - report anything about a package the manifest does not declare, or mutate the analyzed project.
|
|
@@ -46,6 +46,8 @@
|
|
|
46
46
|
* helper both legacy readers share; the barrier is presence-based and never reads the displaced
|
|
47
47
|
* source for evidence, so two contradictory legacy sources are never unioned.
|
|
48
48
|
*/
|
|
49
|
+
import { type ProjectManifest } from '../scanner/projectManifest.js';
|
|
50
|
+
import { type EslintConfigOccurrence, type LegacyEslintPrecedence } from './eslintManifestConfig.js';
|
|
49
51
|
/**
|
|
50
52
|
* Why a present `.eslintrc.json` could not be used as a configuration data source.
|
|
51
53
|
*
|
|
@@ -82,4 +84,8 @@ export declare class EslintRcJsonError extends Error {
|
|
|
82
84
|
* parsed as JSON. Absent, skipped and unusable-but-parsable files return the empty set.
|
|
83
85
|
*/
|
|
84
86
|
export declare function findEslintRcJsonUsage(projectRoot: string): Promise<ReadonlySet<string>>;
|
|
87
|
+
/** Retain the active rc entry's actual casing and pointers without additional filesystem reads. */
|
|
88
|
+
export declare function collectEslintRcJsonUsage(projectRoot: string): Promise<readonly EslintConfigOccurrence[]>;
|
|
89
|
+
/** Read the active rc using the same validated inventory and precedence as the other channels. */
|
|
90
|
+
export declare function collectEslintRcJsonUsageForManifest(manifest: ProjectManifest, precedence: LegacyEslintPrecedence): Promise<readonly EslintConfigOccurrence[]>;
|
|
85
91
|
//# sourceMappingURL=eslintRcJsonConfig.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"eslintRcJsonConfig.d.ts","sourceRoot":"","sources":["../../src/detectors/eslintRcJsonConfig.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+CG;
|
|
1
|
+
{"version":3,"file":"eslintRcJsonConfig.d.ts","sourceRoot":"","sources":["../../src/detectors/eslintRcJsonConfig.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+CG;AAKH,OAAO,EAGL,KAAK,eAAe,EACrB,MAAM,+BAA+B,CAAC;AAEvC,OAAO,EAGL,KAAK,sBAAsB,EAC3B,KAAK,sBAAsB,EAC5B,MAAM,2BAA2B,CAAC;AAUnC;;;;;;;;;GASG;AACH,MAAM,MAAM,qBAAqB,GAAG,YAAY,GAAG,cAAc,CAAC;AAElE;;;;;;;GAOG;AACH,qBAAa,iBAAkB,SAAQ,KAAK;IAC1C,QAAQ,CAAC,IAAI,EAAE,qBAAqB,CAAC;gBAEzB,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,qBAAqB,EAAE,KAAK,CAAC,EAAE,OAAO;CAK1E;AAED;;;;;;;;;;;GAWG;AACH,wBAAsB,qBAAqB,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC,CAI7F;AAED,mGAAmG;AACnG,wBAAsB,wBAAwB,CAC5C,WAAW,EAAE,MAAM,GAClB,OAAO,CAAC,SAAS,sBAAsB,EAAE,CAAC,CA0B5C;AAED,kGAAkG;AAClG,wBAAsB,mCAAmC,CACvD,QAAQ,EAAE,eAAe,EACzB,UAAU,EAAE,sBAAsB,GACjC,OAAO,CAAC,SAAS,sBAAsB,EAAE,CAAC,CAmC5C"}
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
*
|
|
4
4
|
* This module adds exactly one static data source to the ESLint rules proven in Step 57: the single
|
|
5
5
|
* file `<projectRoot>/.eslintrc.json`. Its parsed JSON document is handed to the same pure matcher
|
|
6
|
-
* ({@link
|
|
6
|
+
* ({@link collectEslintConfigUsage}) that reads `package.json#eslintConfig`, so the fixed allowlists,
|
|
7
7
|
* the exact-string lookup and the "declared packages only" rule are reused instead of duplicated.
|
|
8
8
|
* The result is a set of configuration-only package names for the Step 56 analyzer seam, so a
|
|
9
9
|
* recognized name can only suppress an `unused` finding and can never create a `missing` one.
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
* document, so it is removed before parsing;
|
|
22
22
|
* - traverse parent directories, nested packages or workspaces looking for further config files, or
|
|
23
23
|
* resolve `extends` references to other configuration files;
|
|
24
|
-
* - read anything besides the `extends`/`plugins` subset that {@link
|
|
24
|
+
* - read anything besides the `extends`/`plugins` subset that {@link collectEslintConfigUsage} accepts;
|
|
25
25
|
* every other ESLint field (`env`, `globals`, `rules`, `parserOptions`, `overrides`, ...) is
|
|
26
26
|
* ignored, and no unknown value produces evidence;
|
|
27
27
|
* - report anything about a package the manifest does not declare, or mutate the analyzed project.
|
|
@@ -48,9 +48,9 @@
|
|
|
48
48
|
*/
|
|
49
49
|
import { lstat, readFile } from 'node:fs/promises';
|
|
50
50
|
import { join, resolve } from 'node:path';
|
|
51
|
-
import { loadProjectManifest, ProjectManifestError } from '../scanner/projectManifest.js';
|
|
51
|
+
import { loadProjectManifest, ProjectManifestError, } from '../scanner/projectManifest.js';
|
|
52
52
|
import { SourceFilesError } from '../scanner/sourceFiles.js';
|
|
53
|
-
import {
|
|
53
|
+
import { collectEslintConfigUsage, readLegacyEslintPrecedence, } from './eslintManifestConfig.js';
|
|
54
54
|
/**
|
|
55
55
|
* The one file name this reader looks for, relative to the resolved project root.
|
|
56
56
|
*
|
|
@@ -87,27 +87,38 @@ export class EslintRcJsonError extends Error {
|
|
|
87
87
|
* parsed as JSON. Absent, skipped and unusable-but-parsable files return the empty set.
|
|
88
88
|
*/
|
|
89
89
|
export async function findEslintRcJsonUsage(projectRoot) {
|
|
90
|
+
return new Set((await collectEslintRcJsonUsage(projectRoot)).map(({ packageName }) => packageName));
|
|
91
|
+
}
|
|
92
|
+
/** Retain the active rc entry's actual casing and pointers without additional filesystem reads. */
|
|
93
|
+
export async function collectEslintRcJsonUsage(projectRoot) {
|
|
90
94
|
const root = resolve(projectRoot);
|
|
91
95
|
// A hard barrier disables every legacy hint, external file included. Precedence is computed once
|
|
92
96
|
// by a helper both legacy readers share, so this file always wins over `package.json#eslintConfig`
|
|
93
97
|
// and the two legacy sources are never combined into one hint set.
|
|
94
98
|
const precedence = await readLegacyEslintPrecedence(root);
|
|
95
99
|
if (precedence.hardBarrier) {
|
|
96
|
-
return
|
|
100
|
+
return [];
|
|
97
101
|
}
|
|
98
|
-
let
|
|
102
|
+
let manifest;
|
|
99
103
|
try {
|
|
100
|
-
|
|
101
|
-
declaredPackageNames = manifest.declaredDependencyNames;
|
|
104
|
+
manifest = await loadProjectManifest(root);
|
|
102
105
|
}
|
|
103
106
|
catch (error) {
|
|
104
107
|
if (error instanceof ProjectManifestError || error instanceof SourceFilesError) {
|
|
105
108
|
// Manifest failures stay with the manifest loader and the analyzer, which report them as they
|
|
106
109
|
// always have; this detector never duplicates that diagnosis.
|
|
107
|
-
return
|
|
110
|
+
return [];
|
|
108
111
|
}
|
|
109
112
|
throw error;
|
|
110
113
|
}
|
|
114
|
+
return collectEslintRcJsonUsageForManifest(manifest, precedence);
|
|
115
|
+
}
|
|
116
|
+
/** Read the active rc using the same validated inventory and precedence as the other channels. */
|
|
117
|
+
export async function collectEslintRcJsonUsageForManifest(manifest, precedence) {
|
|
118
|
+
if (precedence.hardBarrier)
|
|
119
|
+
return [];
|
|
120
|
+
const root = manifest.root;
|
|
121
|
+
const declaredPackageNames = manifest.declaredDependencyNames;
|
|
111
122
|
// Reuse the on-disk entry name when the legacy `.eslintrc.json` was found under a different
|
|
112
123
|
// casing, so the reader opens the file that actually exists instead of assuming the canonical
|
|
113
124
|
// lowercase spelling.
|
|
@@ -115,7 +126,7 @@ export async function findEslintRcJsonUsage(projectRoot) {
|
|
|
115
126
|
const eslintRcPath = join(root, eslintRcFilename);
|
|
116
127
|
const text = await readEslintRcText(eslintRcPath);
|
|
117
128
|
if (text === undefined) {
|
|
118
|
-
return
|
|
129
|
+
return [];
|
|
119
130
|
}
|
|
120
131
|
let parsed;
|
|
121
132
|
try {
|
|
@@ -127,7 +138,10 @@ export async function findEslintRcJsonUsage(projectRoot) {
|
|
|
127
138
|
}
|
|
128
139
|
// The whole document is the legacy config object, so the proven matcher is reused verbatim. A
|
|
129
140
|
// top-level value that is not an object simply matches nothing, and nothing undeclared is added.
|
|
130
|
-
return
|
|
141
|
+
return collectEslintConfigUsage(parsed, declaredPackageNames, {
|
|
142
|
+
file: eslintRcFilename,
|
|
143
|
+
pointerTokens: [],
|
|
144
|
+
});
|
|
131
145
|
}
|
|
132
146
|
/**
|
|
133
147
|
* Read `.eslintrc.json` as text, returning `undefined` when there is no usable file.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"eslintRcJsonConfig.js","sourceRoot":"","sources":["../../src/detectors/eslintRcJsonConfig.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+CG;AAEH,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AACnD,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAE1C,OAAO,
|
|
1
|
+
{"version":3,"file":"eslintRcJsonConfig.js","sourceRoot":"","sources":["../../src/detectors/eslintRcJsonConfig.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+CG;AAEH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SAAS,iBAAiB,CAAC,YAAoB,EAAE,KAAc;IAC7D,OAAO,IAAI,iBAAiB,CAC1B,kBAAkB,iBAAiB,OAAO,YAAY,EAAE,EACxD,YAAY,EACZ,KAAK,CACN,CAAC;AACJ,CAAC;AAED;;GAEG;AACH,SAAS,eAAe,CAAC,KAAc;IACrC,OAAO,KAAK,YAAY,KAAK,IAAI,MAAM,IAAI,KAAK,IAAI,KAAK,CAAC,IAAI,KAAK,QAAQ,CAAC;AAC9E,CAAC"}
|
|
@@ -11,9 +11,9 @@
|
|
|
11
11
|
* - execute Jest, `import()`/`require()` its configuration loader, or evaluate any target code;
|
|
12
12
|
* - implement the Jest configuration schema. Only `preset`, `testEnvironment` and `transform` are
|
|
13
13
|
* read, and only through the fixed allowlists below;
|
|
14
|
-
* -
|
|
15
|
-
*
|
|
16
|
-
*
|
|
14
|
+
* - use `transform` map keys as package evidence. Keys are retained only in JSON pointers; they
|
|
15
|
+
* select the transformer field and never name a package, even when a key literally reads
|
|
16
|
+
* `"ts-jest"`. No regular expression is evaluated here;
|
|
17
17
|
* - expand Jest shorthands. In particular `testEnvironment: "jsdom"` is *not* credited to
|
|
18
18
|
* `jest-environment-jsdom`: whether that shorthand is a package reference at all depends on the
|
|
19
19
|
* Jest major version in use, which DepVitals does not read, so it stays outside the supported
|
|
@@ -36,6 +36,7 @@
|
|
|
36
36
|
* use. Ignoring is deliberate — an unusable `jest` block is not an error, and diagnosing one here would
|
|
37
37
|
* duplicate the manifest loader.
|
|
38
38
|
*/
|
|
39
|
+
import { type ConfigEvidence } from '../core/evidence.js';
|
|
39
40
|
/**
|
|
40
41
|
* Match the allowlisted subset of one `jest` configuration against the declared packages.
|
|
41
42
|
*
|
|
@@ -49,6 +50,13 @@
|
|
|
49
50
|
* @param declaredPackageNames - Declared dependency names, the only names this may return.
|
|
50
51
|
*/
|
|
51
52
|
export declare function findJestConfigUsage(jestConfig: unknown, declaredPackageNames: ReadonlySet<string>): ReadonlySet<string>;
|
|
53
|
+
/** Internal package owner plus one exact recognized Jest configuration value. */
|
|
54
|
+
export type JestConfigOccurrence = {
|
|
55
|
+
readonly packageName: string;
|
|
56
|
+
readonly evidence: ConfigEvidence;
|
|
57
|
+
};
|
|
58
|
+
/** Pure collector for standalone readers and the later shared validated-context handoff. */
|
|
59
|
+
export declare function collectJestConfigUsage(jestConfig: unknown, declaredPackageNames: ReadonlySet<string>): readonly JestConfigOccurrence[];
|
|
52
60
|
/**
|
|
53
61
|
* Collect the `package.json#jest` hints for the project rooted at `projectRoot`.
|
|
54
62
|
*
|
|
@@ -64,6 +72,8 @@ export declare function findJestConfigUsage(jestConfig: unknown, declaredPackage
|
|
|
64
72
|
* @param projectRoot - Project directory to inspect; resolved to an absolute path.
|
|
65
73
|
*/
|
|
66
74
|
export declare function findJestManifestUsage(projectRoot: string): Promise<ReadonlySet<string>>;
|
|
75
|
+
/** Retain manifest facts through the existing barrier, validation and text-read path. */
|
|
76
|
+
export declare function collectJestManifestUsage(projectRoot: string): Promise<readonly JestConfigOccurrence[]>;
|
|
67
77
|
/**
|
|
68
78
|
* Whether a root Jest configuration file name exists in the project root.
|
|
69
79
|
*
|
|
@@ -73,4 +83,6 @@ export declare function findJestManifestUsage(projectRoot: string): Promise<Read
|
|
|
73
83
|
* macOS) cannot hide a root Jest config from this guard.
|
|
74
84
|
*/
|
|
75
85
|
export declare function hasRootJestConfigEntry(root: string): Promise<boolean>;
|
|
86
|
+
/** Pure barrier decision for a shared per-scan root listing. */
|
|
87
|
+
export declare function hasRootJestConfigEntries(entries: readonly string[]): boolean;
|
|
76
88
|
//# sourceMappingURL=jestManifestConfig.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"jestManifestConfig.d.ts","sourceRoot":"","sources":["../../src/detectors/jestManifestConfig.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqCG;
|
|
1
|
+
{"version":3,"file":"jestManifestConfig.d.ts","sourceRoot":"","sources":["../../src/detectors/jestManifestConfig.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqCG;AAKH,OAAO,EAIL,KAAK,cAAc,EACpB,MAAM,qBAAqB,CAAC;AAqE7B;;;;;;;;;;;GAWG;AACH,wBAAgB,mBAAmB,CACjC,UAAU,EAAE,OAAO,EACnB,oBAAoB,EAAE,WAAW,CAAC,MAAM,CAAC,GACxC,WAAW,CAAC,MAAM,CAAC,CAIrB;AAED,iFAAiF;AACjF,MAAM,MAAM,oBAAoB,GAAG;IACjC,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,QAAQ,EAAE,cAAc,CAAC;CACnC,CAAC;AAEF,4FAA4F;AAC5F,wBAAgB,sBAAsB,CACpC,UAAU,EAAE,OAAO,EACnB,oBAAoB,EAAE,WAAW,CAAC,MAAM,CAAC,GACxC,SAAS,oBAAoB,EAAE,CA6CjC;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAsB,qBAAqB,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC,CAI7F;AAED,yFAAyF;AACzF,wBAAsB,wBAAwB,CAC5C,WAAW,EAAE,MAAM,GAClB,OAAO,CAAC,SAAS,oBAAoB,EAAE,CAAC,CAuB1C;AAED;;;;;;;GAOG;AACH,wBAAsB,sBAAsB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAW3E;AAED,gEAAgE;AAChE,wBAAgB,wBAAwB,CAAC,OAAO,EAAE,SAAS,MAAM,EAAE,GAAG,OAAO,CAE5E"}
|