bumpcheck 0.0.0-stage → 0.1.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/LICENSE +15 -0
- package/README.md +199 -2
- package/dist/cli.d.ts +2 -0
- package/dist/cli.js +95 -0
- package/dist/cli.js.map +1 -0
- package/dist/git.d.ts +16 -0
- package/dist/git.js +70 -0
- package/dist/git.js.map +1 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.js +5 -0
- package/dist/index.js.map +1 -0
- package/dist/npm/analyze.d.ts +18 -0
- package/dist/npm/analyze.js +190 -0
- package/dist/npm/analyze.js.map +1 -0
- package/dist/npm/diagnostics.d.ts +21 -0
- package/dist/npm/diagnostics.js +269 -0
- package/dist/npm/diagnostics.js.map +1 -0
- package/dist/npm/exports.d.ts +22 -0
- package/dist/npm/exports.js +101 -0
- package/dist/npm/exports.js.map +1 -0
- package/dist/npm/imports.d.ts +29 -0
- package/dist/npm/imports.js +215 -0
- package/dist/npm/imports.js.map +1 -0
- package/dist/npm/program.d.ts +32 -0
- package/dist/npm/program.js +187 -0
- package/dist/npm/program.js.map +1 -0
- package/dist/registry/provider.d.ts +50 -0
- package/dist/registry/provider.js +164 -0
- package/dist/registry/provider.js.map +1 -0
- package/dist/report/render.d.ts +5 -0
- package/dist/report/render.js +227 -0
- package/dist/report/render.js.map +1 -0
- package/dist/types.d.ts +99 -0
- package/dist/types.js +6 -0
- package/dist/types.js.map +1 -0
- package/package.json +51 -4
|
@@ -0,0 +1,215 @@
|
|
|
1
|
+
import path from 'node:path';
|
|
2
|
+
import ts from 'typescript';
|
|
3
|
+
import { isInside, isTargetSpecifier } from './program.js';
|
|
4
|
+
export function toLocation(repoRoot, sf, node) {
|
|
5
|
+
const { line, character } = sf.getLineAndCharacterOfPosition(node.getStart(sf));
|
|
6
|
+
return { file: relPosix(repoRoot, sf.fileName), line: line + 1, column: character + 1 };
|
|
7
|
+
}
|
|
8
|
+
export function relPosix(root, file) {
|
|
9
|
+
return path.relative(root, file).split(path.sep).join('/');
|
|
10
|
+
}
|
|
11
|
+
function specifierOf(node) {
|
|
12
|
+
return node && ts.isStringLiteralLike(node) ? node.text : undefined;
|
|
13
|
+
}
|
|
14
|
+
function isRequireCall(node) {
|
|
15
|
+
return (ts.isCallExpression(node) &&
|
|
16
|
+
ts.isIdentifier(node.expression) &&
|
|
17
|
+
node.expression.text === 'require' &&
|
|
18
|
+
node.arguments.length === 1 &&
|
|
19
|
+
ts.isStringLiteralLike(node.arguments[0]));
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Finds every import of the target package in repo source files and records
|
|
23
|
+
* the exported names that are actually used. Namespace imports are followed
|
|
24
|
+
* to their member accesses; anything we cannot reduce to a name is reported
|
|
25
|
+
* as unanalyzed rather than guessed.
|
|
26
|
+
*/
|
|
27
|
+
export function scanImports(repoRoot, built, pkg, overlay) {
|
|
28
|
+
const { program, checker } = built;
|
|
29
|
+
const refs = new Map();
|
|
30
|
+
const unanalyzed = new Map();
|
|
31
|
+
const files = new Set();
|
|
32
|
+
const localNames = new Map();
|
|
33
|
+
const addRef = (specifier, name, loc) => {
|
|
34
|
+
const key = `${specifier}\u0000${name}`;
|
|
35
|
+
const existing = refs.get(key);
|
|
36
|
+
if (existing)
|
|
37
|
+
existing.locations.push(loc);
|
|
38
|
+
else
|
|
39
|
+
refs.set(key, { name, specifier, locations: [loc] });
|
|
40
|
+
};
|
|
41
|
+
const addUnanalyzed = (reason, loc) => {
|
|
42
|
+
const existing = unanalyzed.get(reason);
|
|
43
|
+
if (existing)
|
|
44
|
+
existing.locations.push(loc);
|
|
45
|
+
else
|
|
46
|
+
unanalyzed.set(reason, { reason, locations: [loc] });
|
|
47
|
+
};
|
|
48
|
+
const bindLocal = (sf, local, name, specifier) => {
|
|
49
|
+
let m = localNames.get(sf.fileName);
|
|
50
|
+
if (!m)
|
|
51
|
+
localNames.set(sf.fileName, (m = new Map()));
|
|
52
|
+
m.set(local, { name, specifier });
|
|
53
|
+
};
|
|
54
|
+
for (const sf of program.getSourceFiles()) {
|
|
55
|
+
if (sf.isDeclarationFile)
|
|
56
|
+
continue;
|
|
57
|
+
if (!isInside(repoRoot, sf.fileName) || isInside(overlay, sf.fileName))
|
|
58
|
+
continue;
|
|
59
|
+
if (sf.fileName.includes(`${path.sep}node_modules${path.sep}`))
|
|
60
|
+
continue;
|
|
61
|
+
/** Namespace-style bindings in this file: local symbol -> specifier. */
|
|
62
|
+
const namespaces = new Map();
|
|
63
|
+
let touched = false;
|
|
64
|
+
const visitTop = (node) => {
|
|
65
|
+
if (ts.isImportDeclaration(node)) {
|
|
66
|
+
const spec = specifierOf(node.moduleSpecifier);
|
|
67
|
+
if (!spec || !isTargetSpecifier(spec, pkg))
|
|
68
|
+
return;
|
|
69
|
+
touched = true;
|
|
70
|
+
const clause = node.importClause;
|
|
71
|
+
if (!clause) {
|
|
72
|
+
// Side-effect import; no symbols to track.
|
|
73
|
+
return;
|
|
74
|
+
}
|
|
75
|
+
if (clause.name) {
|
|
76
|
+
addRef(spec, 'default', toLocation(repoRoot, sf, clause.name));
|
|
77
|
+
bindLocal(sf, clause.name.text, 'default', spec);
|
|
78
|
+
}
|
|
79
|
+
const nb = clause.namedBindings;
|
|
80
|
+
if (nb && ts.isNamedImports(nb)) {
|
|
81
|
+
for (const el of nb.elements) {
|
|
82
|
+
const exported = (el.propertyName ?? el.name).text;
|
|
83
|
+
addRef(spec, exported, toLocation(repoRoot, sf, el));
|
|
84
|
+
bindLocal(sf, el.name.text, exported, spec);
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
else if (nb && ts.isNamespaceImport(nb)) {
|
|
88
|
+
const sym = checker.getSymbolAtLocation(nb.name);
|
|
89
|
+
if (sym)
|
|
90
|
+
namespaces.set(sym, spec);
|
|
91
|
+
}
|
|
92
|
+
return;
|
|
93
|
+
}
|
|
94
|
+
if (ts.isImportEqualsDeclaration(node) && ts.isExternalModuleReference(node.moduleReference)) {
|
|
95
|
+
const spec = specifierOf(node.moduleReference.expression);
|
|
96
|
+
if (!spec || !isTargetSpecifier(spec, pkg))
|
|
97
|
+
return;
|
|
98
|
+
touched = true;
|
|
99
|
+
const sym = checker.getSymbolAtLocation(node.name);
|
|
100
|
+
if (sym)
|
|
101
|
+
namespaces.set(sym, spec);
|
|
102
|
+
return;
|
|
103
|
+
}
|
|
104
|
+
if (ts.isExportDeclaration(node)) {
|
|
105
|
+
const spec = specifierOf(node.moduleSpecifier);
|
|
106
|
+
if (!spec || !isTargetSpecifier(spec, pkg))
|
|
107
|
+
return;
|
|
108
|
+
touched = true;
|
|
109
|
+
if (node.exportClause && ts.isNamedExports(node.exportClause)) {
|
|
110
|
+
for (const el of node.exportClause.elements) {
|
|
111
|
+
addRef(spec, (el.propertyName ?? el.name).text, toLocation(repoRoot, sf, el));
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
else {
|
|
115
|
+
addUnanalyzed(`re-exports everything from "${spec}"`, toLocation(repoRoot, sf, node));
|
|
116
|
+
}
|
|
117
|
+
return;
|
|
118
|
+
}
|
|
119
|
+
if (ts.isVariableStatement(node)) {
|
|
120
|
+
for (const decl of node.declarationList.declarations) {
|
|
121
|
+
const init = decl.initializer;
|
|
122
|
+
if (!init || !isRequireCall(init))
|
|
123
|
+
continue;
|
|
124
|
+
const spec = init.arguments[0].text;
|
|
125
|
+
if (!isTargetSpecifier(spec, pkg))
|
|
126
|
+
continue;
|
|
127
|
+
touched = true;
|
|
128
|
+
if (ts.isObjectBindingPattern(decl.name)) {
|
|
129
|
+
for (const el of decl.name.elements) {
|
|
130
|
+
if (el.dotDotDotToken) {
|
|
131
|
+
addUnanalyzed(`rest-destructures "${spec}"`, toLocation(repoRoot, sf, el));
|
|
132
|
+
continue;
|
|
133
|
+
}
|
|
134
|
+
const prop = el.propertyName ?? el.name;
|
|
135
|
+
const exported = ts.isIdentifier(prop) ? prop.text : undefined;
|
|
136
|
+
if (!exported) {
|
|
137
|
+
addUnanalyzed(`computed destructure of "${spec}"`, toLocation(repoRoot, sf, el));
|
|
138
|
+
continue;
|
|
139
|
+
}
|
|
140
|
+
addRef(spec, exported, toLocation(repoRoot, sf, el));
|
|
141
|
+
if (ts.isIdentifier(el.name))
|
|
142
|
+
bindLocal(sf, el.name.text, exported, spec);
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
else if (ts.isIdentifier(decl.name)) {
|
|
146
|
+
const sym = checker.getSymbolAtLocation(decl.name);
|
|
147
|
+
if (sym)
|
|
148
|
+
namespaces.set(sym, spec);
|
|
149
|
+
}
|
|
150
|
+
else {
|
|
151
|
+
addUnanalyzed(`unusual require() binding of "${spec}"`, toLocation(repoRoot, sf, decl));
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
};
|
|
156
|
+
ts.forEachChild(sf, visitTop);
|
|
157
|
+
// Second pass: dynamic imports, inline require().member, namespace member access.
|
|
158
|
+
const visitAll = (node) => {
|
|
159
|
+
if (ts.isCallExpression(node) && node.expression.kind === ts.SyntaxKind.ImportKeyword) {
|
|
160
|
+
const spec = specifierOf(node.arguments[0]);
|
|
161
|
+
if (spec && isTargetSpecifier(spec, pkg)) {
|
|
162
|
+
touched = true;
|
|
163
|
+
addUnanalyzed(`dynamic import("${spec}")`, toLocation(repoRoot, sf, node));
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
else if (isRequireCall(node) && !(node.parent && ts.isVariableDeclaration(node.parent))) {
|
|
167
|
+
const spec = node.arguments[0].text;
|
|
168
|
+
if (isTargetSpecifier(spec, pkg)) {
|
|
169
|
+
touched = true;
|
|
170
|
+
const parent = node.parent;
|
|
171
|
+
if (parent && ts.isPropertyAccessExpression(parent) && parent.expression === node) {
|
|
172
|
+
addRef(spec, parent.name.text, toLocation(repoRoot, sf, parent.name));
|
|
173
|
+
}
|
|
174
|
+
else {
|
|
175
|
+
addUnanalyzed(`inline require("${spec}") used as a whole`, toLocation(repoRoot, sf, node));
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
else if (ts.isIdentifier(node) && namespaces.size > 0) {
|
|
180
|
+
const sym = checker.getSymbolAtLocation(node);
|
|
181
|
+
const spec = sym ? namespaces.get(sym) : undefined;
|
|
182
|
+
if (spec) {
|
|
183
|
+
const parent = node.parent;
|
|
184
|
+
const isBinding = (parent && ts.isImportClause(parent)) ||
|
|
185
|
+
(parent && ts.isNamespaceImport(parent)) ||
|
|
186
|
+
(parent && ts.isImportEqualsDeclaration(parent)) ||
|
|
187
|
+
(parent && ts.isVariableDeclaration(parent) && parent.name === node);
|
|
188
|
+
if (!isBinding) {
|
|
189
|
+
if (parent && ts.isPropertyAccessExpression(parent) && parent.expression === node) {
|
|
190
|
+
addRef(spec, parent.name.text, toLocation(repoRoot, sf, parent.name));
|
|
191
|
+
}
|
|
192
|
+
else if (parent && ts.isQualifiedName(parent) && parent.left === node) {
|
|
193
|
+
addRef(spec, parent.right.text, toLocation(repoRoot, sf, parent.right));
|
|
194
|
+
}
|
|
195
|
+
else {
|
|
196
|
+
addUnanalyzed(`uses the whole module "${spec}" as a value`, toLocation(repoRoot, sf, node));
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
ts.forEachChild(node, visitAll);
|
|
202
|
+
};
|
|
203
|
+
visitAll(sf);
|
|
204
|
+
if (touched)
|
|
205
|
+
files.add(relPosix(repoRoot, sf.fileName));
|
|
206
|
+
}
|
|
207
|
+
const sortedRefs = [...refs.values()].sort((a, b) => a.specifier === b.specifier ? a.name.localeCompare(b.name) : a.specifier.localeCompare(b.specifier));
|
|
208
|
+
return {
|
|
209
|
+
files: [...files].sort(),
|
|
210
|
+
refs: sortedRefs,
|
|
211
|
+
unanalyzed: [...unanalyzed.values()],
|
|
212
|
+
localNames,
|
|
213
|
+
};
|
|
214
|
+
}
|
|
215
|
+
//# sourceMappingURL=imports.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
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,KAAK,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,aAAa,CAAC,CAAC,CAAC,SAAS,CAAC,CACpG,CAAC;IACF,OAAO;QACL,KAAK,EAAE,CAAC,GAAG,KAAK,CAAC,CAAC,IAAI,EAAE;QACxB,IAAI,EAAE,UAAU;QAChB,UAAU,EAAE,CAAC,GAAG,UAAU,CAAC,MAAM,EAAE,CAAC;QACpC,UAAU;KACX,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import ts from 'typescript';
|
|
2
|
+
export interface RepoConfig {
|
|
3
|
+
options: ts.CompilerOptions;
|
|
4
|
+
fileNames: string[];
|
|
5
|
+
/** Where the options came from, for the report's meta. */
|
|
6
|
+
source: 'tsconfig' | 'default';
|
|
7
|
+
/** Config problems that change what can be proven, e.g. an unresolved `extends`. */
|
|
8
|
+
warnings: string[];
|
|
9
|
+
}
|
|
10
|
+
export interface Target {
|
|
11
|
+
pkg: string;
|
|
12
|
+
/** Overlay root containing `node_modules/<pkg>`. */
|
|
13
|
+
overlay: string;
|
|
14
|
+
}
|
|
15
|
+
export interface BuiltProgram {
|
|
16
|
+
program: ts.Program;
|
|
17
|
+
checker: ts.TypeChecker;
|
|
18
|
+
/** Resolve a specifier (`pkg` or `pkg/sub`) against the overlay. */
|
|
19
|
+
resolveTarget(specifier: string): ts.ResolvedModuleWithFailedLookupLocations;
|
|
20
|
+
}
|
|
21
|
+
export declare function isInside(root: string, file: string): boolean;
|
|
22
|
+
export declare function isTargetSpecifier(specifier: string, pkg: string): boolean;
|
|
23
|
+
/** `@scope/name/sub` -> `@scope/name`; `name/sub` -> `name`; relative -> undefined. */
|
|
24
|
+
export declare function packageNameOf(specifier: string): string | undefined;
|
|
25
|
+
export declare function walkSources(root: string): string[];
|
|
26
|
+
export declare function loadRepoConfig(repoRoot: string): RepoConfig;
|
|
27
|
+
/**
|
|
28
|
+
* Builds a program over the repo where every import of the target package is
|
|
29
|
+
* resolved from the overlay instead of the repo's own node_modules. Files
|
|
30
|
+
* inside the overlay resolve normally, so the package's own dependencies work.
|
|
31
|
+
*/
|
|
32
|
+
export declare function buildProgram(repoRoot: string, config: RepoConfig, target: Target): BuiltProgram;
|
|
@@ -0,0 +1,187 @@
|
|
|
1
|
+
import path from 'node:path';
|
|
2
|
+
import { readFileSync, readdirSync, statSync } from 'node:fs';
|
|
3
|
+
import semver from 'semver';
|
|
4
|
+
import ts from 'typescript';
|
|
5
|
+
const SOURCE_EXT = new Set(['.ts', '.tsx', '.mts', '.cts', '.js', '.jsx', '.mjs', '.cjs']);
|
|
6
|
+
const SKIP_DIRS = new Set(['node_modules', '.git', 'dist', 'build', 'out', 'coverage', '.next', '.turbo']);
|
|
7
|
+
export function isInside(root, file) {
|
|
8
|
+
const rel = path.relative(root, file);
|
|
9
|
+
return rel !== '' && !rel.startsWith('..') && !path.isAbsolute(rel);
|
|
10
|
+
}
|
|
11
|
+
export function isTargetSpecifier(specifier, pkg) {
|
|
12
|
+
return specifier === pkg || specifier.startsWith(pkg + '/');
|
|
13
|
+
}
|
|
14
|
+
/** `@scope/name/sub` -> `@scope/name`; `name/sub` -> `name`; relative -> undefined. */
|
|
15
|
+
export function packageNameOf(specifier) {
|
|
16
|
+
if (specifier.startsWith('.') || specifier.startsWith('/') || specifier.startsWith('node:'))
|
|
17
|
+
return undefined;
|
|
18
|
+
const parts = specifier.split('/');
|
|
19
|
+
return specifier.startsWith('@') ? (parts.length >= 2 ? `${parts[0]}/${parts[1]}` : undefined) : parts[0];
|
|
20
|
+
}
|
|
21
|
+
function readManifest(file) {
|
|
22
|
+
try {
|
|
23
|
+
return JSON.parse(readFileSync(file, 'utf8'));
|
|
24
|
+
}
|
|
25
|
+
catch {
|
|
26
|
+
return undefined;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Options we always force. We never emit, we never check library files, and
|
|
31
|
+
* we do not want incremental state leaking across the two runs.
|
|
32
|
+
*/
|
|
33
|
+
function sanitize(options) {
|
|
34
|
+
const out = { ...options };
|
|
35
|
+
out.noEmit = true;
|
|
36
|
+
out.skipLibCheck = true;
|
|
37
|
+
delete out.incremental;
|
|
38
|
+
delete out.composite;
|
|
39
|
+
delete out.tsBuildInfoFile;
|
|
40
|
+
delete out.outDir;
|
|
41
|
+
delete out.outFile;
|
|
42
|
+
delete out.declaration;
|
|
43
|
+
delete out.declarationDir;
|
|
44
|
+
delete out.declarationMap;
|
|
45
|
+
delete out.sourceMap;
|
|
46
|
+
delete out.emitDeclarationOnly;
|
|
47
|
+
return out;
|
|
48
|
+
}
|
|
49
|
+
export function walkSources(root) {
|
|
50
|
+
const out = [];
|
|
51
|
+
const stack = [root];
|
|
52
|
+
while (stack.length) {
|
|
53
|
+
const dir = stack.pop();
|
|
54
|
+
for (const entry of readdirSync(dir)) {
|
|
55
|
+
if (SKIP_DIRS.has(entry))
|
|
56
|
+
continue;
|
|
57
|
+
const full = path.join(dir, entry);
|
|
58
|
+
let st;
|
|
59
|
+
try {
|
|
60
|
+
st = statSync(full);
|
|
61
|
+
}
|
|
62
|
+
catch {
|
|
63
|
+
continue;
|
|
64
|
+
}
|
|
65
|
+
if (st.isDirectory())
|
|
66
|
+
stack.push(full);
|
|
67
|
+
else if (SOURCE_EXT.has(path.extname(entry)) && !entry.endsWith('.d.ts'))
|
|
68
|
+
out.push(full);
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
return out.sort();
|
|
72
|
+
}
|
|
73
|
+
function parseConfig(configPath) {
|
|
74
|
+
const raw = ts.readConfigFile(configPath, ts.sys.readFile);
|
|
75
|
+
if (raw.error)
|
|
76
|
+
return undefined;
|
|
77
|
+
return ts.parseJsonConfigFileContent(raw.config, ts.sys, path.dirname(configPath), undefined, configPath);
|
|
78
|
+
}
|
|
79
|
+
function configWarnings(configPath, parsed) {
|
|
80
|
+
return parsed.errors
|
|
81
|
+
.filter((e) => e.category === ts.DiagnosticCategory.Error)
|
|
82
|
+
.map((e) => ts.flattenDiagnosticMessageText(e.messageText, ' '))
|
|
83
|
+
.filter((m) => /extends|not found|cannot read/i.test(m))
|
|
84
|
+
.map((m) => `${path.basename(configPath)}: ${m} (analyzed without it; strictness may differ from your build)`);
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* A config that lists files is one project. A solution-style config, with
|
|
88
|
+
* `files: []` and `references` as Vite templates ship, owns no files, so the
|
|
89
|
+
* projects it references stand in for it.
|
|
90
|
+
*/
|
|
91
|
+
function collectProjects(configPath, seen) {
|
|
92
|
+
if (seen.has(configPath))
|
|
93
|
+
return [];
|
|
94
|
+
seen.add(configPath);
|
|
95
|
+
const parsed = parseConfig(configPath);
|
|
96
|
+
if (!parsed)
|
|
97
|
+
return [];
|
|
98
|
+
if (parsed.fileNames.length > 0) {
|
|
99
|
+
return [{ config: configPath, fileNames: parsed.fileNames, options: parsed.options, warnings: configWarnings(configPath, parsed) }];
|
|
100
|
+
}
|
|
101
|
+
return (parsed.projectReferences ?? []).flatMap((ref) => collectProjects(ts.resolveProjectReferencePath(ref), seen));
|
|
102
|
+
}
|
|
103
|
+
export function loadRepoConfig(repoRoot) {
|
|
104
|
+
const configPath = ts.findConfigFile(repoRoot, ts.sys.fileExists, 'tsconfig.json');
|
|
105
|
+
if (configPath && (isInside(repoRoot, configPath) || path.dirname(configPath) === repoRoot)) {
|
|
106
|
+
const projects = collectProjects(configPath, new Set());
|
|
107
|
+
const first = projects[0];
|
|
108
|
+
if (first) {
|
|
109
|
+
const warnings = projects.flatMap((p) => p.warnings);
|
|
110
|
+
if (first.config !== configPath) {
|
|
111
|
+
// tsc -b checks each referenced project with its own options. One
|
|
112
|
+
// program cannot, so the first project's options apply to all.
|
|
113
|
+
const names = projects.map((p) => path.relative(repoRoot, p.config)).join(', ');
|
|
114
|
+
warnings.push(`${path.basename(configPath)}: no files of its own; analyzed the ${projects.length} project${projects.length === 1 ? '' : 's'} it references (${names}) as one program with the options of ${path.relative(repoRoot, first.config)} (tsc -b checks each on its own; strictness may differ from your build)`);
|
|
115
|
+
}
|
|
116
|
+
const fileNames = [...new Set(projects.flatMap((p) => p.fileNames))];
|
|
117
|
+
return { options: sanitize(first.options), fileNames, source: 'tsconfig', warnings };
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
return {
|
|
121
|
+
options: sanitize({
|
|
122
|
+
allowJs: true,
|
|
123
|
+
checkJs: true,
|
|
124
|
+
strict: true,
|
|
125
|
+
target: ts.ScriptTarget.ES2022,
|
|
126
|
+
module: ts.ModuleKind.ESNext,
|
|
127
|
+
moduleResolution: ts.ModuleResolutionKind.Bundler,
|
|
128
|
+
jsx: ts.JsxEmit.Preserve,
|
|
129
|
+
esModuleInterop: true,
|
|
130
|
+
resolveJsonModule: true,
|
|
131
|
+
}),
|
|
132
|
+
fileNames: walkSources(repoRoot),
|
|
133
|
+
source: 'default',
|
|
134
|
+
warnings: [],
|
|
135
|
+
};
|
|
136
|
+
}
|
|
137
|
+
/**
|
|
138
|
+
* Builds a program over the repo where every import of the target package is
|
|
139
|
+
* resolved from the overlay instead of the repo's own node_modules. Files
|
|
140
|
+
* inside the overlay resolve normally, so the package's own dependencies work.
|
|
141
|
+
*/
|
|
142
|
+
export function buildProgram(repoRoot, config, target) {
|
|
143
|
+
const host = ts.createCompilerHost(config.options, true);
|
|
144
|
+
const anchor = path.join(target.overlay, '__bumpcheck_anchor__.ts');
|
|
145
|
+
const repoCache = ts.createModuleResolutionCache(repoRoot, host.getCanonicalFileName, config.options);
|
|
146
|
+
const overlayCache = ts.createModuleResolutionCache(target.overlay, host.getCanonicalFileName, config.options);
|
|
147
|
+
const resolveTarget = (specifier) => ts.resolveModuleName(specifier, anchor, config.options, host, overlayCache);
|
|
148
|
+
// The package's own dependencies come from the repo when the repo's
|
|
149
|
+
// installed version satisfies the declared range, which is what npm's
|
|
150
|
+
// dedupe does. Otherwise two copies of a shared dependency (say
|
|
151
|
+
// @nestjs/common) would produce "types have separate declarations" errors
|
|
152
|
+
// that no real install has.
|
|
153
|
+
const manifest = readManifest(path.join(target.overlay, 'node_modules', target.pkg, 'package.json'));
|
|
154
|
+
const ranges = {
|
|
155
|
+
...manifest?.optionalDependencies,
|
|
156
|
+
...manifest?.dependencies,
|
|
157
|
+
...manifest?.peerDependencies,
|
|
158
|
+
};
|
|
159
|
+
const repoAnchor = path.join(repoRoot, '__bumpcheck_anchor__.ts');
|
|
160
|
+
const repoVersions = new Map();
|
|
161
|
+
const repoSatisfies = (name) => {
|
|
162
|
+
const range = ranges[name];
|
|
163
|
+
if (!range)
|
|
164
|
+
return false;
|
|
165
|
+
if (!repoVersions.has(name)) {
|
|
166
|
+
repoVersions.set(name, readManifest(path.join(repoRoot, 'node_modules', name, 'package.json'))?.version);
|
|
167
|
+
}
|
|
168
|
+
const version = repoVersions.get(name);
|
|
169
|
+
return !!version && semver.satisfies(version, range, { includePrerelease: true });
|
|
170
|
+
};
|
|
171
|
+
host.resolveModuleNameLiterals = (literals, containingFile, redirectedReference, options) => literals.map((lit) => {
|
|
172
|
+
const fromOverlay = isInside(target.overlay, containingFile);
|
|
173
|
+
if (isTargetSpecifier(lit.text, target.pkg) && !fromOverlay) {
|
|
174
|
+
return resolveTarget(lit.text);
|
|
175
|
+
}
|
|
176
|
+
if (fromOverlay) {
|
|
177
|
+
const dep = packageNameOf(lit.text);
|
|
178
|
+
if (dep && dep !== target.pkg && repoSatisfies(dep)) {
|
|
179
|
+
return ts.resolveModuleName(lit.text, repoAnchor, options, host, repoCache, redirectedReference);
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
return ts.resolveModuleName(lit.text, containingFile, options, host, repoCache, redirectedReference);
|
|
183
|
+
});
|
|
184
|
+
const program = ts.createProgram({ rootNames: config.fileNames, options: config.options, host });
|
|
185
|
+
return { program, checker: program.getTypeChecker(), resolveTarget };
|
|
186
|
+
}
|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
|
+
/**
|
|
2
|
+
* A PackageProvider materializes `<pkg>@<version>` into an overlay directory
|
|
3
|
+
* shaped like `<overlay>/node_modules/<pkg>/...`, with the package's own
|
|
4
|
+
* dependencies installed beside it so its declaration files resolve.
|
|
5
|
+
*
|
|
6
|
+
* Returning the overlay root (not the package dir) lets TypeScript's normal
|
|
7
|
+
* node_modules walk do the rest.
|
|
8
|
+
*/
|
|
9
|
+
export interface PackageProvider {
|
|
10
|
+
ensure(pkg: string, version: string): Promise<string>;
|
|
11
|
+
}
|
|
12
|
+
export interface NpmProviderOptions {
|
|
13
|
+
cacheDir?: string;
|
|
14
|
+
registry?: string;
|
|
15
|
+
/** Override for tests or exotic setups. Defaults to `npm` on PATH. */
|
|
16
|
+
npmBinary?: string;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Installs the exact version with npm into a per-version overlay and caches it.
|
|
20
|
+
* Scripts never run. Peer dependencies are installed so declaration files
|
|
21
|
+
* that import them still resolve.
|
|
22
|
+
*/
|
|
23
|
+
export declare class NpmProvider implements PackageProvider {
|
|
24
|
+
private readonly cacheDir;
|
|
25
|
+
private readonly registry;
|
|
26
|
+
private readonly npm;
|
|
27
|
+
private readonly inflight;
|
|
28
|
+
constructor(opts?: NpmProviderOptions);
|
|
29
|
+
ensure(pkg: string, version: string): Promise<string>;
|
|
30
|
+
private install;
|
|
31
|
+
}
|
|
32
|
+
/** `@scope/name` becomes `@types/scope__name`, as DefinitelyTyped does. */
|
|
33
|
+
export declare function definitelyTypedName(pkg: string): string;
|
|
34
|
+
/**
|
|
35
|
+
* Copies a local directory into an overlay. Used by tests and for air-gapped
|
|
36
|
+
* runs where the package contents are already on disk.
|
|
37
|
+
*/
|
|
38
|
+
export interface LocalSource {
|
|
39
|
+
dir: string;
|
|
40
|
+
/** Extra packages to place beside it in the overlay, as a real install would. */
|
|
41
|
+
deps?: Record<string, string>;
|
|
42
|
+
}
|
|
43
|
+
export declare class LocalProvider implements PackageProvider {
|
|
44
|
+
private readonly sources;
|
|
45
|
+
private readonly workDir;
|
|
46
|
+
private readonly inflight;
|
|
47
|
+
constructor(sources: Record<string, string | LocalSource>, workDir: string);
|
|
48
|
+
ensure(pkg: string, version: string): Promise<string>;
|
|
49
|
+
private materialize;
|
|
50
|
+
}
|