carrick 0.3.152 → 0.3.154
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/contract.d.ts +27 -3
- package/dist/contract.js +8 -0
- package/dist/contract.js.map +1 -1
- package/dist/hook/edit-flow.js +25 -12
- package/dist/hook/edit-flow.js.map +1 -1
- package/dist/hook/late.d.ts +1 -1
- package/dist/hook/late.js +19 -15
- package/dist/hook/late.js.map +1 -1
- package/dist/hook/lead.d.ts +13 -0
- package/dist/hook/lead.js +39 -0
- package/dist/hook/lead.js.map +1 -0
- package/dist/hook/reuse.d.ts +9 -0
- package/dist/hook/reuse.js +15 -0
- package/dist/hook/reuse.js.map +1 -1
- package/dist/hook/stop-wait.js +3 -7
- package/dist/hook/stop-wait.js.map +1 -1
- package/dist/render.d.ts +5 -21
- package/dist/render.js +47 -66
- package/dist/render.js.map +1 -1
- package/package.json +6 -6
- package/plugin/.claude-plugin/plugin.json +1 -1
- package/scripts/install-scanned-deps.sh +25 -2
- package/sidecar/dist/src/capture/index.d.ts +2 -1
- package/sidecar/dist/src/capture/index.js +1 -1
- package/sidecar/dist/src/capture/node-builder.d.ts +6 -0
- package/sidecar/dist/src/capture/reference-redirect.d.ts +16 -1
- package/sidecar/dist/src/capture/reference-redirect.js +137 -3
- package/sidecar/dist/src/default-library.d.ts +39 -0
- package/sidecar/dist/src/default-library.js +132 -0
- package/sidecar/dist/src/definition-resolver.js +2 -0
- package/sidecar/dist/src/index.js +2 -1
- package/sidecar/dist/src/library-claims.d.ts +2 -0
- package/sidecar/dist/src/library-claims.js +176 -17
- package/sidecar/dist/src/position-rows.d.ts +40 -4
- package/sidecar/dist/src/position-rows.js +111 -3
- package/sidecar/dist/src/project-loader.d.ts +11 -3
- package/sidecar/dist/src/project-loader.js +14 -6
- package/sidecar/dist/src/type-inferrer.d.ts +14 -0
- package/sidecar/dist/src/type-inferrer.js +34 -5
- package/sidecar/dist/src/types.d.ts +16 -0
- package/sidecar/dist/src/validators.d.ts +12 -0
- package/sidecar/dist/src/validators.js +2 -0
|
@@ -37,9 +37,10 @@
|
|
|
37
37
|
* A package the owner does not reference stays unresolved, as in the editor.
|
|
38
38
|
* Nothing here writes, and every read goes through the host it wraps.
|
|
39
39
|
*/
|
|
40
|
+
import * as fs from 'node:fs';
|
|
40
41
|
import * as path from 'node:path';
|
|
41
42
|
import ts from 'typescript';
|
|
42
|
-
import { boundedSys, isInsideCheckout, realOf, untrustedReadBound } from './checkout.js';
|
|
43
|
+
import { boundedSys, checkoutRootOf, isInsideCheckout, realOf, untrustedReadBound } from './checkout.js';
|
|
43
44
|
import { sidecarCompilerOptions } from './compiler-options.js';
|
|
44
45
|
import { ProjectGraph } from './project-references.js';
|
|
45
46
|
const DECLARATION = /\.d\.[cm]?ts$/;
|
|
@@ -92,14 +93,19 @@ function declarationLayout(parsed, ignoreCase) {
|
|
|
92
93
|
/**
|
|
93
94
|
* The redirect for a program whose owner reaches `references` (its reference
|
|
94
95
|
* closure, from `ProjectGraph.closureOf`), or `undefined` when there are none.
|
|
96
|
+
* An output two of the projects write from different sources goes to the
|
|
97
|
+
* first one, or, with `ambiguousUnresolved`, to neither: nothing says which
|
|
98
|
+
* the entry is, so the import stays unresolved (carrick#1910).
|
|
95
99
|
*/
|
|
96
|
-
export function referenceRedirect(references, repoRoot) {
|
|
100
|
+
export function referenceRedirect(references, repoRoot, { ambiguousUnresolved = false } = {}) {
|
|
97
101
|
if (references.length === 0)
|
|
98
102
|
return undefined;
|
|
99
103
|
const realOf = realPaths();
|
|
100
104
|
const ignoreCase = !ts.sys.useCaseSensitiveFileNames;
|
|
101
105
|
/** Real path of an output -> its source. */
|
|
102
106
|
const outputs = new Map();
|
|
107
|
+
/** Outputs two projects write from different sources (`ambiguousUnresolved`). */
|
|
108
|
+
const ambiguous = new Set();
|
|
103
109
|
/** Real paths of the directories outputs sit in, up to their project's. */
|
|
104
110
|
const outputDirs = new Set();
|
|
105
111
|
/** Base names of outputs and of their directories: the cheap test first. */
|
|
@@ -124,8 +130,12 @@ export function referenceRedirect(references, repoRoot) {
|
|
|
124
130
|
if (!declaration)
|
|
125
131
|
continue;
|
|
126
132
|
const output = realOf(declaration);
|
|
127
|
-
|
|
133
|
+
const known = outputs.get(output);
|
|
134
|
+
if (known !== undefined) {
|
|
135
|
+
if (ambiguousUnresolved && known !== key)
|
|
136
|
+
ambiguous.add(output);
|
|
128
137
|
continue;
|
|
138
|
+
}
|
|
129
139
|
outputs.set(output, key);
|
|
130
140
|
names.add(path.basename(output));
|
|
131
141
|
for (let dir = path.dirname(output); !outputDirs.has(dir); dir = path.dirname(dir)) {
|
|
@@ -136,6 +146,8 @@ export function referenceRedirect(references, repoRoot) {
|
|
|
136
146
|
}
|
|
137
147
|
}
|
|
138
148
|
}
|
|
149
|
+
for (const output of ambiguous)
|
|
150
|
+
outputs.delete(output);
|
|
139
151
|
const sourceOf = (file) => DECLARATION.test(file) && names.has(path.basename(file)) ? outputs.get(realOf(file)) : undefined;
|
|
140
152
|
const isOutputDir = (dir) => names.has(path.basename(dir)) && outputDirs.has(realOf(dir));
|
|
141
153
|
return {
|
|
@@ -191,6 +203,128 @@ export function referenceRedirectOf(configPath, repoRoot) {
|
|
|
191
203
|
}
|
|
192
204
|
return referenceRedirect(graph.closureOf(graph.named), repoRoot);
|
|
193
205
|
}
|
|
206
|
+
/**
|
|
207
|
+
* The directories of the packages an install links into the checkout, as
|
|
208
|
+
* seen from `fromDir`: every `node_modules/<name>` and
|
|
209
|
+
* `node_modules/@scope/<name>` from `fromDir` up to the checkout root whose
|
|
210
|
+
* real path is inside the checkout, under no `node_modules`, and holds a
|
|
211
|
+
* `package.json`. A link that resolves to `fromDir` or above it is the
|
|
212
|
+
* service itself and is left out.
|
|
213
|
+
*/
|
|
214
|
+
function linkedWorkspacePackages(fromDir, checkoutRoot) {
|
|
215
|
+
const root = realOf(checkoutRoot);
|
|
216
|
+
const from = realOf(fromDir);
|
|
217
|
+
const found = new Set();
|
|
218
|
+
const consider = (link) => {
|
|
219
|
+
let real;
|
|
220
|
+
try {
|
|
221
|
+
if (!fs.lstatSync(link).isSymbolicLink())
|
|
222
|
+
return;
|
|
223
|
+
real = fs.realpathSync(link);
|
|
224
|
+
}
|
|
225
|
+
catch {
|
|
226
|
+
return;
|
|
227
|
+
}
|
|
228
|
+
const rel = path.relative(root, real);
|
|
229
|
+
if (rel === '' || rel.startsWith('..') || path.isAbsolute(rel))
|
|
230
|
+
return;
|
|
231
|
+
if (rel.split(path.sep).includes('node_modules'))
|
|
232
|
+
return;
|
|
233
|
+
const toFrom = path.relative(real, from);
|
|
234
|
+
if (toFrom === '' || (!toFrom.startsWith('..') && !path.isAbsolute(toFrom)))
|
|
235
|
+
return;
|
|
236
|
+
if (fs.existsSync(path.join(real, 'package.json')))
|
|
237
|
+
found.add(real);
|
|
238
|
+
};
|
|
239
|
+
const entries = (dir) => {
|
|
240
|
+
try {
|
|
241
|
+
return fs.readdirSync(dir, { withFileTypes: true });
|
|
242
|
+
}
|
|
243
|
+
catch {
|
|
244
|
+
return [];
|
|
245
|
+
}
|
|
246
|
+
};
|
|
247
|
+
for (let dir = path.resolve(fromDir);; dir = path.dirname(dir)) {
|
|
248
|
+
const modules = path.join(dir, 'node_modules');
|
|
249
|
+
for (const entry of entries(modules)) {
|
|
250
|
+
if (entry.name.startsWith('.'))
|
|
251
|
+
continue;
|
|
252
|
+
const link = path.join(modules, entry.name);
|
|
253
|
+
if (entry.name.startsWith('@')) {
|
|
254
|
+
for (const scoped of entries(link))
|
|
255
|
+
consider(path.join(link, scoped.name));
|
|
256
|
+
}
|
|
257
|
+
else {
|
|
258
|
+
consider(link);
|
|
259
|
+
}
|
|
260
|
+
}
|
|
261
|
+
if (realOf(dir) === root || path.dirname(dir) === dir)
|
|
262
|
+
break;
|
|
263
|
+
}
|
|
264
|
+
return [...found].sort();
|
|
265
|
+
}
|
|
266
|
+
const TSCONFIG_NAME = /^tsconfig(\..+)?\.json$/;
|
|
267
|
+
const projectsByPackage = new Map();
|
|
268
|
+
/** Every `tsconfig*.json` in `packageDir`, parsed, with the projects each references. */
|
|
269
|
+
function packageProjects(packageDir) {
|
|
270
|
+
const cached = projectsByPackage.get(packageDir);
|
|
271
|
+
if (cached)
|
|
272
|
+
return cached;
|
|
273
|
+
const projects = readPackageProjects(packageDir);
|
|
274
|
+
projectsByPackage.set(packageDir, projects);
|
|
275
|
+
return projects;
|
|
276
|
+
}
|
|
277
|
+
function readPackageProjects(packageDir) {
|
|
278
|
+
let names;
|
|
279
|
+
try {
|
|
280
|
+
names = fs.readdirSync(packageDir).filter((name) => TSCONFIG_NAME.test(name)).sort();
|
|
281
|
+
}
|
|
282
|
+
catch {
|
|
283
|
+
return [];
|
|
284
|
+
}
|
|
285
|
+
const projects = [];
|
|
286
|
+
for (const name of names) {
|
|
287
|
+
try {
|
|
288
|
+
const graph = new ProjectGraph(path.join(packageDir, name));
|
|
289
|
+
projects.push(graph.named, ...graph.closureOf(graph.named));
|
|
290
|
+
}
|
|
291
|
+
catch {
|
|
292
|
+
// A config that cannot be read writes nothing anyone can follow.
|
|
293
|
+
}
|
|
294
|
+
}
|
|
295
|
+
return projects;
|
|
296
|
+
}
|
|
297
|
+
/**
|
|
298
|
+
* For the position rows' process only (carrick#1910): `referenceRedirectOf`,
|
|
299
|
+
* with the projects of every workspace package the install links into the
|
|
300
|
+
* checkout added to the reference closure, whether or not the config
|
|
301
|
+
* references them. A package's projects are every `tsconfig*.json` in its
|
|
302
|
+
* root. An output two of them write from different sources is followed to
|
|
303
|
+
* neither. Every other program keeps `referenceRedirectOf`: infer's text is
|
|
304
|
+
* the compat judge's anchor, so widening it would move verdicts.
|
|
305
|
+
*/
|
|
306
|
+
export function workspaceSourceRedirectOf(configPath, repoRoot) {
|
|
307
|
+
let references = [];
|
|
308
|
+
try {
|
|
309
|
+
const graph = new ProjectGraph(configPath);
|
|
310
|
+
references = graph.closureOf(graph.named);
|
|
311
|
+
}
|
|
312
|
+
catch {
|
|
313
|
+
// An unreadable owner config references nothing.
|
|
314
|
+
}
|
|
315
|
+
const seen = new Set([path.resolve(configPath), ...references.map((p) => path.resolve(p.configPath))]);
|
|
316
|
+
const projects = [...references];
|
|
317
|
+
for (const packageDir of linkedWorkspacePackages(path.dirname(configPath), checkoutRootOf(repoRoot))) {
|
|
318
|
+
for (const project of packageProjects(packageDir)) {
|
|
319
|
+
const key = path.resolve(project.configPath);
|
|
320
|
+
if (seen.has(key))
|
|
321
|
+
continue;
|
|
322
|
+
seen.add(key);
|
|
323
|
+
projects.push(project);
|
|
324
|
+
}
|
|
325
|
+
}
|
|
326
|
+
return referenceRedirect(projects, repoRoot, { ambiguousUnresolved: true });
|
|
327
|
+
}
|
|
194
328
|
/**
|
|
195
329
|
* For the capture's anchor program: `host` resolving every import through
|
|
196
330
|
* `redirect`, with the module resolution cache it uses handed to the program.
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The TypeScript default library (`lib.*.d.ts`) every ts-morph project reads
|
|
3
|
+
* (carrick#3509).
|
|
4
|
+
*
|
|
5
|
+
* Without `libFolderPath`, ts-morph serves its own copy of these files from
|
|
6
|
+
* memory, and that copy is minified: comments are stripped and declarations
|
|
7
|
+
* run together, so every member of `lib.dom.d.ts` sits on its line 3. A row's
|
|
8
|
+
* `decl_line` for a library member, and the declarations a verified op names,
|
|
9
|
+
* then point at one line for every member, and a label verified for one
|
|
10
|
+
* member (`BroadcastChannel.addEventListener`) is matched by every other
|
|
11
|
+
* (`Body.json`, `Crypto.randomUUID`).
|
|
12
|
+
*
|
|
13
|
+
* Every project here reads the compiler's own files instead, at the folder
|
|
14
|
+
* ts-morph's copy is at (`/node_modules/typescript/lib`), so the files keep
|
|
15
|
+
* the names they always had (`resolved_file`, `lib:<name>`) and only their
|
|
16
|
+
* text changes. The texts come from the `typescript` package beside the
|
|
17
|
+
* sidecar; the surface lister bundle carries them inlined
|
|
18
|
+
* (`lister/build.mjs`), as it carried ts-morph's copy before.
|
|
19
|
+
*/
|
|
20
|
+
import { type FileSystemHost } from 'ts-morph';
|
|
21
|
+
/** Where every project reads the default library from: ts-morph's own folder name for it. */
|
|
22
|
+
export declare const DEFAULT_LIBRARY_FOLDER = "/node_modules/typescript/lib";
|
|
23
|
+
/** Every `lib.*.d.ts` the compiler ships, by file name. */
|
|
24
|
+
export declare function defaultLibraryTexts(): ReadonlyMap<string, string>;
|
|
25
|
+
/**
|
|
26
|
+
* `inner` (the real file system when none is given) with the default
|
|
27
|
+
* library's folder answered from {@link defaultLibraryTexts}. Every other
|
|
28
|
+
* path goes to `inner` unchanged.
|
|
29
|
+
*/
|
|
30
|
+
export declare function withDefaultLibrary(inner?: FileSystemHost): FileSystemHost;
|
|
31
|
+
/**
|
|
32
|
+
* The options every ts-morph project in the sidecar is built with, over
|
|
33
|
+
* `fileSystem` (the real file system when none is given): the default library
|
|
34
|
+
* read from the compiler's own files.
|
|
35
|
+
*/
|
|
36
|
+
export declare function defaultLibraryOptions(fileSystem?: FileSystemHost): {
|
|
37
|
+
libFolderPath: string;
|
|
38
|
+
fileSystem: FileSystemHost;
|
|
39
|
+
};
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The TypeScript default library (`lib.*.d.ts`) every ts-morph project reads
|
|
3
|
+
* (carrick#3509).
|
|
4
|
+
*
|
|
5
|
+
* Without `libFolderPath`, ts-morph serves its own copy of these files from
|
|
6
|
+
* memory, and that copy is minified: comments are stripped and declarations
|
|
7
|
+
* run together, so every member of `lib.dom.d.ts` sits on its line 3. A row's
|
|
8
|
+
* `decl_line` for a library member, and the declarations a verified op names,
|
|
9
|
+
* then point at one line for every member, and a label verified for one
|
|
10
|
+
* member (`BroadcastChannel.addEventListener`) is matched by every other
|
|
11
|
+
* (`Body.json`, `Crypto.randomUUID`).
|
|
12
|
+
*
|
|
13
|
+
* Every project here reads the compiler's own files instead, at the folder
|
|
14
|
+
* ts-morph's copy is at (`/node_modules/typescript/lib`), so the files keep
|
|
15
|
+
* the names they always had (`resolved_file`, `lib:<name>`) and only their
|
|
16
|
+
* text changes. The texts come from the `typescript` package beside the
|
|
17
|
+
* sidecar; the surface lister bundle carries them inlined
|
|
18
|
+
* (`lister/build.mjs`), as it carried ts-morph's copy before.
|
|
19
|
+
*/
|
|
20
|
+
import { Project } from 'ts-morph';
|
|
21
|
+
import * as fs from 'node:fs';
|
|
22
|
+
import * as path from 'node:path';
|
|
23
|
+
import ts from 'typescript';
|
|
24
|
+
import { sidecarCompilerOptions } from './capture/index.js';
|
|
25
|
+
/** Where every project reads the default library from: ts-morph's own folder name for it. */
|
|
26
|
+
export const DEFAULT_LIBRARY_FOLDER = '/node_modules/typescript/lib';
|
|
27
|
+
/**
|
|
28
|
+
* The bundle's inlined texts, by file name. `lister/build.mjs` defines this
|
|
29
|
+
* one reference (an esbuild define is inlined at every reference, so there is
|
|
30
|
+
* exactly one); the unbundled sidecar has no such global and reads the files
|
|
31
|
+
* from disk.
|
|
32
|
+
*/
|
|
33
|
+
const BUNDLED = globalThis
|
|
34
|
+
.__CARRICK_DEFAULT_LIBRARY__;
|
|
35
|
+
let texts;
|
|
36
|
+
/** Every `lib.*.d.ts` the compiler ships, by file name. */
|
|
37
|
+
export function defaultLibraryTexts() {
|
|
38
|
+
if (texts)
|
|
39
|
+
return texts;
|
|
40
|
+
if (BUNDLED !== undefined) {
|
|
41
|
+
texts = new Map(Object.entries(BUNDLED));
|
|
42
|
+
return texts;
|
|
43
|
+
}
|
|
44
|
+
const folder = path.dirname(ts.getDefaultLibFilePath({}));
|
|
45
|
+
texts = new Map(fs
|
|
46
|
+
.readdirSync(folder)
|
|
47
|
+
.filter((name) => /^lib(\..+)?\.d\.ts$/.test(name))
|
|
48
|
+
.sort()
|
|
49
|
+
.map((name) => [name, fs.readFileSync(path.join(folder, name), 'utf8')]));
|
|
50
|
+
return texts;
|
|
51
|
+
}
|
|
52
|
+
function libraryFileOf(p) {
|
|
53
|
+
const normal = p.split(path.sep).join('/');
|
|
54
|
+
if (path.posix.dirname(normal) !== DEFAULT_LIBRARY_FOLDER)
|
|
55
|
+
return undefined;
|
|
56
|
+
return path.posix.basename(normal);
|
|
57
|
+
}
|
|
58
|
+
function isLibraryFolder(p) {
|
|
59
|
+
return p.split(path.sep).join('/').replace(/\/+$/, '') === DEFAULT_LIBRARY_FOLDER;
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* `inner` (the real file system when none is given) with the default
|
|
63
|
+
* library's folder answered from {@link defaultLibraryTexts}. Every other
|
|
64
|
+
* path goes to `inner` unchanged.
|
|
65
|
+
*/
|
|
66
|
+
export function withDefaultLibrary(inner) {
|
|
67
|
+
const base = inner ??
|
|
68
|
+
new Project({
|
|
69
|
+
compilerOptions: sidecarCompilerOptions({}),
|
|
70
|
+
skipAddingFilesFromTsConfig: true,
|
|
71
|
+
skipFileDependencyResolution: true,
|
|
72
|
+
skipLoadingLibFiles: true,
|
|
73
|
+
}).getFileSystem();
|
|
74
|
+
const missing = (p) => Object.assign(new Error(`ENOENT: no such file or directory, open '${p}'`), { code: 'ENOENT' });
|
|
75
|
+
const read = (p) => {
|
|
76
|
+
const name = libraryFileOf(p);
|
|
77
|
+
return name === undefined ? undefined : defaultLibraryTexts().get(name);
|
|
78
|
+
};
|
|
79
|
+
const isLibraryPath = (p) => libraryFileOf(p) !== undefined || isLibraryFolder(p);
|
|
80
|
+
return new Proxy(base, {
|
|
81
|
+
get(target, prop, receiver) {
|
|
82
|
+
const value = Reflect.get(target, prop, receiver);
|
|
83
|
+
if (typeof value !== 'function')
|
|
84
|
+
return value;
|
|
85
|
+
const fn = value.bind(target);
|
|
86
|
+
switch (prop) {
|
|
87
|
+
case 'readFileSync':
|
|
88
|
+
return (p, e) => {
|
|
89
|
+
if (!isLibraryPath(p))
|
|
90
|
+
return fn(p, e);
|
|
91
|
+
const text = read(p);
|
|
92
|
+
if (text === undefined)
|
|
93
|
+
throw missing(p);
|
|
94
|
+
return text;
|
|
95
|
+
};
|
|
96
|
+
case 'readFile':
|
|
97
|
+
return async (p, e) => {
|
|
98
|
+
if (!isLibraryPath(p))
|
|
99
|
+
return fn(p, e);
|
|
100
|
+
const text = read(p);
|
|
101
|
+
if (text === undefined)
|
|
102
|
+
throw missing(p);
|
|
103
|
+
return text;
|
|
104
|
+
};
|
|
105
|
+
case 'fileExistsSync':
|
|
106
|
+
return (p) => (isLibraryPath(p) ? read(p) !== undefined : fn(p));
|
|
107
|
+
case 'fileExists':
|
|
108
|
+
return async (p) => (isLibraryPath(p) ? read(p) !== undefined : fn(p));
|
|
109
|
+
case 'directoryExistsSync':
|
|
110
|
+
return (p) => isLibraryFolder(p) || (libraryFileOf(p) === undefined && fn(p));
|
|
111
|
+
case 'directoryExists':
|
|
112
|
+
return async (p) => isLibraryFolder(p) || (libraryFileOf(p) === undefined && (await fn(p)));
|
|
113
|
+
case 'readDirSync':
|
|
114
|
+
return (p) => isLibraryFolder(p)
|
|
115
|
+
? [...defaultLibraryTexts().keys()].map((name) => ({ name, isFile: true, isDirectory: false, isSymlink: false }))
|
|
116
|
+
: fn(p);
|
|
117
|
+
case 'realpathSync':
|
|
118
|
+
return (p) => (isLibraryPath(p) ? p : fn(p));
|
|
119
|
+
default:
|
|
120
|
+
return fn;
|
|
121
|
+
}
|
|
122
|
+
},
|
|
123
|
+
});
|
|
124
|
+
}
|
|
125
|
+
/**
|
|
126
|
+
* The options every ts-morph project in the sidecar is built with, over
|
|
127
|
+
* `fileSystem` (the real file system when none is given): the default library
|
|
128
|
+
* read from the compiler's own files.
|
|
129
|
+
*/
|
|
130
|
+
export function defaultLibraryOptions(fileSystem) {
|
|
131
|
+
return { libFolderPath: DEFAULT_LIBRARY_FOLDER, fileSystem: withDefaultLibrary(fileSystem) };
|
|
132
|
+
}
|
|
@@ -36,6 +36,7 @@ import * as path from 'node:path';
|
|
|
36
36
|
import * as fs from 'node:fs';
|
|
37
37
|
import { Project, Node } from 'ts-morph';
|
|
38
38
|
import { sidecarCompilerOptions } from './capture/index.js';
|
|
39
|
+
import { defaultLibraryOptions } from './default-library.js';
|
|
39
40
|
import { expandTypeStructural, } from './type-structural-expander.js';
|
|
40
41
|
export class DefinitionResolver {
|
|
41
42
|
/**
|
|
@@ -58,6 +59,7 @@ export class DefinitionResolver {
|
|
|
58
59
|
}
|
|
59
60
|
try {
|
|
60
61
|
const stubProject = new Project({
|
|
62
|
+
...defaultLibraryOptions(),
|
|
61
63
|
compilerOptions: sidecarCompilerOptions({
|
|
62
64
|
target: 99, // ESNext
|
|
63
65
|
module: 99, // ESNext
|
|
@@ -171,6 +171,7 @@ function handleInit(request) {
|
|
|
171
171
|
scanRoot: request.scan_root,
|
|
172
172
|
tsconfigSnapshot: request.tsconfig_snapshot,
|
|
173
173
|
pinnedDependencies: request.pinned_dependencies,
|
|
174
|
+
workspaceSource: request.workspace_source,
|
|
174
175
|
});
|
|
175
176
|
const result = projectLoader.load();
|
|
176
177
|
if (!result.success) {
|
|
@@ -669,7 +670,7 @@ function handleListLibrarySurface(request) {
|
|
|
669
670
|
const { claimsVerifier } = projectComponents();
|
|
670
671
|
const fromDir = path.resolve(projectLoader.getRepoRoot(), request.from_dir);
|
|
671
672
|
log(`Listing the declared surface of ${request.packages.length} specifier(s) from ${fromDir}`);
|
|
672
|
-
const { surfaces, surface_sha256 } = claimsVerifier.listSurface(fromDir, request.packages, request.max_entries ?? SURFACE_MAX_ENTRIES, request.exports ?? {}, { handlers: request.handlers, types: request.types, resultCandidates: request.result_candidates, maxHandlerMembers: request.max_handler_members });
|
|
673
|
+
const { surfaces, surface_sha256 } = claimsVerifier.listSurface(fromDir, request.packages, request.max_entries ?? SURFACE_MAX_ENTRIES, request.exports ?? {}, { handlers: request.handlers, types: request.types, resultCandidates: request.result_candidates, maxHandlerMembers: request.max_handler_members, foreignMakerBudget: request.foreign_maker_budget });
|
|
673
674
|
return { request_id: request.request_id, status: 'success', surfaces, surface_sha256 };
|
|
674
675
|
}
|
|
675
676
|
catch (err) {
|
|
@@ -234,6 +234,8 @@ export interface SurfaceOptions {
|
|
|
234
234
|
resultCandidates?: boolean;
|
|
235
235
|
/** Handler-parameter members the whole call may list (default `HANDLER_LISTING_BUDGET`, carrick#3016). */
|
|
236
236
|
maxHandlerMembers?: number;
|
|
237
|
+
/** Estimated member makers of foreign values past which they list none (default `FOREIGN_MAKER_BUDGET`, carrick#3745). */
|
|
238
|
+
foreignMakerBudget?: number;
|
|
237
239
|
}
|
|
238
240
|
/** The name a service imports a package by: `@types/scope__name` is `@scope/name`, `@types/name` is `name`. */
|
|
239
241
|
export declare function importedNameOf(installed: string): string;
|