MCPcopy Create free account
hub / github.com/babel/babel / buildTSConfig

Function buildTSConfig

scripts/generators/tsconfig.ts:259–293  ·  view source on GitHub ↗
(
  pkg: TsPackageInfo,
  hasOverrides: boolean,
  hasScripts: boolean
)

Source from the content-addressed store, hash-verified

257}
258
259function buildTSConfig(
260 pkg: TsPackageInfo,
261 hasOverrides: boolean,
262 hasScripts: boolean
263) {
264 const paths: Record<string, string[]> = {};
265 const referencePaths = new Set();
266
267 for (const name of pkg.dependencies) {
268 // @ts-expect-error name must be a key in tsPkgs
269 const { relative, subExports } = tsPkgs.get(name);
270 for (const [subExport, subExportPath] of subExports) {
271 paths[name + subExport] = ["../../" + relative.slice(2) + subExportPath];
272 }
273 referencePaths.add("../../" + projectsFolders.get(name).slice(2));
274 }
275
276 return {
277 extends: [
278 "../../tsconfig.base.json",
279 "../../tsconfig.paths.json",
280 hasOverrides && "./tsconfig.overrides.json",
281 ].filter(Boolean),
282 include: [
283 "./src/**/*.ts",
284 "./src/**/*.cts",
285 pkg.name === "@babel/register" && "./src/**/*.mts",
286 pkg.name === "@babel/standalone" && "./types.d.ts",
287 hasScripts && "./scripts/**/*.ts",
288 "../../lib/globals.d.ts",
289 "../../scripts/repo-utils/*.d.ts",
290 ].filter(Boolean),
291 references: Array.from(referencePaths, path => ({ path })),
292 };
293}
294
295maybeWriteFile(
296 new URL("tsconfig.paths.json", rootURL),

Callers 1

tsconfig.tsFile · 0.85

Calls 2

getMethod · 0.65
addMethod · 0.45

Tested by

no test coverage detected