limina 0.0.2 → 0.0.4

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.
@@ -1,4 +1,4 @@
1
- import { c as getCheckerAdapter, h as toRelativePath, l as isPathInsideDirectory, m as toPosixPath, o as collectMissingCheckerPeerDependencies, r as getActiveCheckers, s as formatMissingCheckerPeerDependencies, u as normalizeAbsolutePath } from "./dep-jgc7X0zw.js";
1
+ import { c as getCheckerAdapter, d as normalizeAbsolutePath, g as toRelativePath, h as toPosixPath, l as normalizeExtensions, o as collectMissingCheckerPeerDependencies, r as getActiveCheckers, s as formatMissingCheckerPeerDependencies, u as isPathInsideDirectory } from "./dep-DzYrmtQJ.js";
2
2
  import { builtinModules, createRequire } from "node:module";
3
3
  import { createElapsedTimer, formatErrorMessage, formatErrorMessage as formatErrorMessage$1 } from "logaria/helper";
4
4
  import { existsSync, readFileSync, statSync } from "node:fs";
@@ -11,7 +11,6 @@ import readline from "node:readline";
11
11
  import * as prompts from "@clack/prompts";
12
12
  import { mkdir, writeFile } from "node:fs/promises";
13
13
  import { parse } from "yaml";
14
- import { availableParallelism } from "node:os";
15
14
 
16
15
  //#region src/tsconfig.ts
17
16
  const dtsConfigFilePattern = /^tsconfig(?:\..+)?\.dts\.json$/u;
@@ -31,7 +30,7 @@ function escapeRegExp(value) {
31
30
  return value.replace(/[.*+?^${}()|[\]\\]/gu, "\\$&");
32
31
  }
33
32
  function createExtensionPattern(extensions) {
34
- if (extensions.length === 0) return /$./u;
33
+ if (extensions.length === 0) return /(?!)/u;
35
34
  return new RegExp(`(?:${extensions.sort((left, right) => right.length - left.length).map(escapeRegExp).join("|")})$`, "u");
36
35
  }
37
36
  function createExtraFileExtensions(extensions) {
@@ -141,13 +140,6 @@ function collectReferencePathInfosFromConfigObject(rootDir, configPath, configOb
141
140
  references: referenceInfos
142
141
  };
143
142
  }
144
- function isNonEmptyStringArray(value) {
145
- return Array.isArray(value) && value.some((item) => typeof item === "string");
146
- }
147
- function hasOwnTypecheckInputs(configObject) {
148
- if (!Object.hasOwn(configObject, "files") && !Object.hasOwn(configObject, "include")) return true;
149
- return isNonEmptyStringArray(configObject.files) || isNonEmptyStringArray(configObject.include);
150
- }
151
143
  function isDtsConfigPath(configPath) {
152
144
  return dtsConfigFilePattern.test(path.basename(configPath));
153
145
  }
@@ -169,91 +161,6 @@ function isOrdinaryTypecheckConfigPath(configPath) {
169
161
  const fileName = path.basename(configPath);
170
162
  return tsconfigFilePattern.test(fileName) && !isReservedTypeScriptConfigFile(fileName);
171
163
  }
172
- function collectTypecheckTargetProjectPaths(options) {
173
- const rootConfigPath = normalizeAbsolutePath(options.rootConfigPath);
174
- const reportedCycles = /* @__PURE__ */ new Set();
175
- const seen = /* @__PURE__ */ new Set();
176
- const problems = [];
177
- const projectPaths = [];
178
- const targetProjectPaths = [];
179
- const formatConfigPath = (configPath) => toRelativePath(options.rootDir, configPath);
180
- const addCycleProblem = (referencePath, stack) => {
181
- const cycleStartIndex = stack.indexOf(referencePath);
182
- const cyclePaths = cycleStartIndex === -1 ? [...stack, referencePath] : [...stack.slice(cycleStartIndex), referencePath];
183
- const cycleKey = cyclePaths.join("\0");
184
- if (reportedCycles.has(cycleKey)) return;
185
- reportedCycles.add(cycleKey);
186
- problems.push([
187
- "Circular reference in ordinary tsconfig references:",
188
- ` cycle: ${cyclePaths.map(formatConfigPath).join(" -> ")}`,
189
- " reason: ordinary tsconfig references used by limina checker typecheck must form an acyclic graph.",
190
- " fix: remove one reference from the cycle, or move shared options into extends instead of references."
191
- ].join("\n"));
192
- };
193
- const visitProject = (projectPath, stack) => {
194
- if (stack.includes(projectPath)) {
195
- addCycleProblem(projectPath, stack);
196
- return;
197
- }
198
- if (seen.has(projectPath)) return;
199
- if (!existsSync(projectPath)) {
200
- problems.push(["Ordinary tsconfig reference graph references a missing tsconfig:", ` config: ${formatConfigPath(projectPath)}`].join("\n"));
201
- return;
202
- }
203
- if (!isOrdinaryTypecheckConfigPath(projectPath)) {
204
- problems.push([
205
- "Invalid config in ordinary tsconfig reference graph:",
206
- ` config: ${formatConfigPath(projectPath)}`,
207
- " reason: ordinary tsconfig references must stay on ordinary tsconfig*.json files; tsconfig*.build.json graph aggregators and tsconfig*.dts.json declaration leaves belong to checker entries."
208
- ].join("\n"));
209
- return;
210
- }
211
- seen.add(projectPath);
212
- projectPaths.push(projectPath);
213
- const configObject = readJsonConfigFile(options.rootDir, projectPath);
214
- const referenceCollection = collectReferencePathInfosFromConfigObject(options.rootDir, projectPath, configObject);
215
- const referencePaths = referenceCollection.references.map((reference) => reference.resolvedPath);
216
- problems.push(...referenceCollection.problems);
217
- if (referencePaths.length === 0 || hasOwnTypecheckInputs(configObject)) targetProjectPaths.push(projectPath);
218
- const nextStack = [...stack, projectPath];
219
- for (const referencePath of referencePaths) {
220
- if (isBuildGraphConfigPath(referencePath) || isDtsConfigPath(referencePath)) {
221
- problems.push([
222
- "Invalid reference in ordinary tsconfig reference graph:",
223
- ` from: ${formatConfigPath(projectPath)}`,
224
- ` to: ${formatConfigPath(referencePath)}`,
225
- " reason: ordinary tsconfig references must stay on ordinary tsconfig*.json files; build graph configs and declaration leaves are checked through checker entries."
226
- ].join("\n"));
227
- continue;
228
- }
229
- if (!isOrdinaryTypecheckConfigPath(referencePath)) {
230
- problems.push([
231
- "Invalid reference in ordinary tsconfig reference graph:",
232
- ` from: ${formatConfigPath(projectPath)}`,
233
- ` to: ${formatConfigPath(referencePath)}`,
234
- " reason: referenced config must be an ordinary tsconfig*.json file."
235
- ].join("\n"));
236
- continue;
237
- }
238
- if (nextStack.includes(referencePath)) {
239
- addCycleProblem(referencePath, nextStack);
240
- continue;
241
- }
242
- visitProject(referencePath, nextStack);
243
- }
244
- };
245
- visitProject(rootConfigPath, []);
246
- if (problems.length === 0 && targetProjectPaths.length === 0) problems.push([
247
- "Ordinary tsconfig reference graph has no tsconfig targets:",
248
- ` root: ${toRelativePath(options.rootDir, rootConfigPath)}`,
249
- " reason: limina checker typecheck runs ordinary tsconfig*.json files without references, plus configs that have references and their own source inputs."
250
- ].join("\n"));
251
- return {
252
- problems,
253
- projectPaths,
254
- targetProjectPaths
255
- };
256
- }
257
164
  function collectGraphProjectRouteFromRoot(options) {
258
165
  const rootGraphConfigPath = normalizeAbsolutePath(options.rootConfigPath);
259
166
  const seen = /* @__PURE__ */ new Set();
@@ -322,7 +229,7 @@ function collectGraphProjectRoutes(config) {
322
229
  const routes = [];
323
230
  const problems = [];
324
231
  for (const checker of getActiveCheckers(config)) {
325
- if (!getCheckerAdapter(checker.preset)?.graph) continue;
232
+ if (!getCheckerAdapter(checker.preset)?.sourceGraph) continue;
326
233
  const rootConfigPath = resolveProjectConfigPath(config.rootDir, checker.entry);
327
234
  if (!existsSync(rootConfigPath)) {
328
235
  problems.push([
@@ -339,6 +246,7 @@ function collectGraphProjectRoutes(config) {
339
246
  problems.push(...routeCollection.problems);
340
247
  routes.push({
341
248
  checkerName: checker.name,
249
+ extensions: checker.extensions,
342
250
  projectPaths: routeCollection.projectPaths,
343
251
  rootConfigPath
344
252
  });
@@ -368,6 +276,7 @@ function collectCheckerEntryProjectRoutes(config) {
368
276
  problems.push(...routeCollection.problems);
369
277
  routes.push({
370
278
  checkerName: checker.name,
279
+ extensions: checker.extensions,
371
280
  projectPaths: routeCollection.projectPaths,
372
281
  rootConfigPath
373
282
  });
@@ -384,8 +293,18 @@ function collectGraphProjectRoute(config) {
384
293
  projectPaths: [...new Set(routeCollection.routes.flatMap((route) => route.projectPaths))].sort()
385
294
  };
386
295
  }
387
- function parseProjectFileNames(config, configPath, pattern = /\.(?:[cm]?tsx?|d\.[cm]?ts|json)$/u) {
388
- return parseProjectFileNamesForExtensions(config, configPath, [], pattern);
296
+ function collectSourceGraphProjectExtensions(config) {
297
+ const routeCollection = collectGraphProjectRoutes(config);
298
+ const projectExtensionsByPath = /* @__PURE__ */ new Map();
299
+ const typeScriptExtensions = getCheckerAdapter("tsc")?.defaultExtensions ?? [];
300
+ for (const route of routeCollection.routes) {
301
+ const routeExtensions = normalizeExtensions([...typeScriptExtensions, ...route.extensions]);
302
+ for (const projectPath of route.projectPaths) projectExtensionsByPath.set(projectPath, normalizeExtensions([...projectExtensionsByPath.get(projectPath) ?? [], ...routeExtensions]));
303
+ }
304
+ return {
305
+ problems: routeCollection.problems,
306
+ projectExtensionsByPath
307
+ };
389
308
  }
390
309
  function parseProjectFileNamesForExtensions(config, configPath, extensions, pattern = createExtensionPattern(extensions)) {
391
310
  const diagnostics = [];
@@ -586,6 +505,22 @@ function getDependencySections(importer) {
586
505
  importer.peerDependencies
587
506
  ].filter((section) => Boolean(section));
588
507
  }
508
+ function getPublishDependencySections(importer) {
509
+ return [
510
+ {
511
+ dependencies: importer.dependencies,
512
+ name: "dependencies"
513
+ },
514
+ {
515
+ dependencies: importer.peerDependencies,
516
+ name: "peerDependencies"
517
+ },
518
+ {
519
+ dependencies: importer.optionalDependencies,
520
+ name: "optionalDependencies"
521
+ }
522
+ ].filter((section) => Boolean(section.dependencies));
523
+ }
589
524
  function isWorkspaceDependencySpecifier(specifier) {
590
525
  return specifier.startsWith("workspace:");
591
526
  }
@@ -663,9 +598,9 @@ function readProjectLabel(config, configPath) {
663
598
  ].join("\n")
664
599
  };
665
600
  }
666
- function parseProject(config, configPath) {
601
+ function parseProject(config, configPath, extensions) {
667
602
  const diagnostics = [];
668
- const parsed = ts.getParsedCommandLineOfConfigFile(configPath, {}, {
603
+ const parsed = extensions ? ts.parseJsonConfigFileContent(readJsonConfig(config, configPath), ts.sys, path.dirname(configPath), {}, configPath, void 0, createExtraFileExtensions(extensions)) : ts.getParsedCommandLineOfConfigFile(configPath, {}, {
669
604
  ...ts.sys,
670
605
  onUnRecoverableConfigFileDiagnostic: (diagnostic) => {
671
606
  diagnostics.push(diagnostic);
@@ -682,9 +617,20 @@ function parseProject(config, configPath) {
682
617
  getNewLine: () => "\n"
683
618
  }));
684
619
  const labelInfo = readProjectLabel(config, configPath);
620
+ const projectExtensions = extensions ?? [
621
+ ".ts",
622
+ ".tsx",
623
+ ".cts",
624
+ ".mts",
625
+ ".d.ts",
626
+ ".d.cts",
627
+ ".d.mts"
628
+ ];
629
+ const filePattern = createExtensionPattern(projectExtensions);
685
630
  return {
686
631
  configPath: normalizeAbsolutePath(configPath),
687
- fileNames: parsed.fileNames.filter((fileName) => /\.(?:[cm]?tsx?|d\.[cm]?ts)$/u.test(fileName)).map(normalizeAbsolutePath),
632
+ extensions: projectExtensions,
633
+ fileNames: parsed.fileNames.filter((fileName) => filePattern.test(fileName)).map(normalizeAbsolutePath),
688
634
  label: labelInfo.label,
689
635
  labelProblem: labelInfo.labelProblem,
690
636
  options: parsed.options,
@@ -699,15 +645,27 @@ function getSourceFileKind(filePath) {
699
645
  function stringLiteralValue(node) {
700
646
  return node && ts.isStringLiteralLike(node) ? node.text : null;
701
647
  }
702
- function collectImportsFromFile(filePath) {
703
- const sourceText = readFileSync(filePath, "utf8");
704
- const sourceFile = ts.createSourceFile(filePath, sourceText, ts.ScriptTarget.Latest, true, getSourceFileKind(filePath));
648
+ function getVueCompilerSfc(rootDir) {
649
+ const requireFromRoot = createRequire(path.join(rootDir, "package.json"));
650
+ try {
651
+ return requireFromRoot("@vue/compiler-sfc");
652
+ } catch (error) {
653
+ if (error && typeof error === "object" && "code" in error && error.code === "MODULE_NOT_FOUND") throw new Error("Vue source graph support requires @vue/compiler-sfc. Fix: pnpm add -D @vue/compiler-sfc");
654
+ throw error;
655
+ }
656
+ }
657
+ function getVueBlockScriptKind(block) {
658
+ return block.lang === "tsx" || block.lang === "jsx" ? ts.ScriptKind.TSX : ts.ScriptKind.TS;
659
+ }
660
+ function collectImportsFromSourceText(options) {
661
+ const sourceFile = ts.createSourceFile(options.filePath, options.sourceText, ts.ScriptTarget.Latest, true, options.scriptKind);
705
662
  const imports = [];
663
+ const lineOffset = options.lineOffset ?? 0;
706
664
  const addImport = (specifier, node) => {
707
665
  const location = sourceFile.getLineAndCharacterOfPosition(node.getStart(sourceFile));
708
666
  imports.push({
709
- filePath,
710
- line: location.line + 1,
667
+ filePath: options.filePath,
668
+ line: lineOffset + location.line + 1,
711
669
  specifier
712
670
  });
713
671
  };
@@ -727,9 +685,37 @@ function collectImportsFromFile(filePath) {
727
685
  visit(sourceFile);
728
686
  return imports;
729
687
  }
730
- function resolveInternalImport(specifier, containingFile, options) {
688
+ function collectVueImportsFromFile(filePath, rootDir) {
689
+ const sourceText = readFileSync(filePath, "utf8");
690
+ const result = getVueCompilerSfc(rootDir).parse(sourceText, { filename: filePath });
691
+ if (result.errors.length > 0) throw new Error(`Failed to parse Vue SFC imports for ${toRelativePath(rootDir, filePath)}: ${String(result.errors[0])}`);
692
+ return [result.descriptor.script, result.descriptor.scriptSetup].filter((block) => Boolean(block && !block.src)).flatMap((block) => collectImportsFromSourceText({
693
+ filePath,
694
+ lineOffset: block.loc.start.line - 1,
695
+ scriptKind: getVueBlockScriptKind(block),
696
+ sourceText: block.content
697
+ }));
698
+ }
699
+ function collectImportsFromFile(filePath, rootDir) {
700
+ if (filePath.endsWith(".vue")) return collectVueImportsFromFile(filePath, rootDir);
701
+ return collectImportsFromSourceText({
702
+ filePath,
703
+ scriptKind: getSourceFileKind(filePath),
704
+ sourceText: readFileSync(filePath, "utf8")
705
+ });
706
+ }
707
+ function resolveInternalImport(specifier, containingFile, options, extensions = []) {
731
708
  const resolved = ts.resolveModuleName(specifier, containingFile, options, ts.sys).resolvedModule;
732
- return resolved?.resolvedFileName ? normalizeAbsolutePath(resolved.resolvedFileName) : null;
709
+ if (resolved?.resolvedFileName) return normalizeAbsolutePath(resolved.resolvedFileName);
710
+ if (!isRelativeSpecifier$1(specifier)) return null;
711
+ const resolvedSpecifierPath = path.resolve(path.dirname(containingFile), specifier);
712
+ const candidatePaths = path.extname(specifier) ? [resolvedSpecifierPath] : extensions.flatMap((extension) => [`${resolvedSpecifierPath}${extension}`, path.join(resolvedSpecifierPath, `index${extension}`)]);
713
+ for (const candidatePath of candidatePaths) {
714
+ if (!existsSync(candidatePath)) continue;
715
+ if (!statSync(candidatePath).isFile()) continue;
716
+ return normalizeAbsolutePath(candidatePath);
717
+ }
718
+ return null;
733
719
  }
734
720
  function chooseOwningProject(projectPaths) {
735
721
  return [...projectPaths].sort((left, right) => {
@@ -1068,6 +1054,7 @@ const InitLogger = logger.getLoggerByGroup("task.init");
1068
1054
  const PackageLogger = logger.getLoggerByGroup("task.package");
1069
1055
  const PathsLogger = logger.getLoggerByGroup("task.paths");
1070
1056
  const ProofLogger = logger.getLoggerByGroup("task.proof");
1057
+ const ReleaseLogger = logger.getLoggerByGroup("task.release");
1071
1058
  const SourceLogger = logger.getLoggerByGroup("task.source");
1072
1059
  const TypecheckLogger = logger.getLoggerByGroup("task.typecheck");
1073
1060
  function clearCliScreen() {
@@ -1437,7 +1424,7 @@ function inferProjectReferences(options) {
1437
1424
  const referencePaths = /* @__PURE__ */ new Set();
1438
1425
  for (const fileName of project.fileNames) {
1439
1426
  if (!/\.(?:[cm]?tsx?|d\.[cm]?ts)$/u.test(fileName)) continue;
1440
- for (const importRecord of collectImportsFromFile(fileName)) {
1427
+ for (const importRecord of collectImportsFromFile(fileName, options.config.rootDir)) {
1441
1428
  const resolvedFilePath = resolveImportWithTypeScript({
1442
1429
  cache: resolutionCache,
1443
1430
  host,
@@ -1622,11 +1609,14 @@ function findOwnerForFile(filePath, owners) {
1622
1609
  function isUrlOrDataOrFileSpecifier(specifier) {
1623
1610
  return specifier.startsWith("data:") || specifier.startsWith("file:") || specifier.startsWith("http:") || specifier.startsWith("https:");
1624
1611
  }
1612
+ function isVirtualModuleSpecifier(specifier) {
1613
+ return specifier.startsWith("virtual:");
1614
+ }
1625
1615
  function isPackageImportSpecifier(specifier) {
1626
1616
  return specifier.startsWith("#");
1627
1617
  }
1628
1618
  function isBarePackageSpecifier(specifier) {
1629
- return !isRelativeSpecifier$1(specifier) && !isPackageImportSpecifier(specifier) && !isUrlOrDataOrFileSpecifier(specifier) && !path.isAbsolute(specifier);
1619
+ return !isRelativeSpecifier$1(specifier) && !isPackageImportSpecifier(specifier) && !isUrlOrDataOrFileSpecifier(specifier) && !isVirtualModuleSpecifier(specifier) && !path.isAbsolute(specifier);
1630
1620
  }
1631
1621
  function isDependencyAuthorized(manifest, packageName) {
1632
1622
  return Boolean(manifest.dependencies?.[packageName] || manifest.devDependencies?.[packageName]);
@@ -1734,7 +1724,7 @@ function createSourceProjectEntries(config, projects) {
1734
1724
  return projects.filter((project) => isDtsProjectConfig(project.configPath)).map((project) => {
1735
1725
  const typecheckConfigPath = getTypecheckConfigPath(project.configPath);
1736
1726
  const fileNames = new Set(project.fileNames);
1737
- if (existsSync(typecheckConfigPath)) for (const fileName of parseProject(config, typecheckConfigPath).fileNames) fileNames.add(fileName);
1727
+ if (existsSync(typecheckConfigPath)) for (const fileName of parseProject(config, typecheckConfigPath, project.extensions).fileNames) fileNames.add(fileName);
1738
1728
  return {
1739
1729
  fileNames: [...fileNames].sort(),
1740
1730
  project
@@ -1742,8 +1732,8 @@ function createSourceProjectEntries(config, projects) {
1742
1732
  });
1743
1733
  }
1744
1734
  async function runSourceCheckInternal(config, options = {}) {
1745
- const graphRoute = collectGraphProjectRoute(config);
1746
- const projects = graphRoute.projectPaths.map((projectPath) => parseProject(config, projectPath));
1735
+ const graphRoute = collectSourceGraphProjectExtensions(config);
1736
+ const projects = [...graphRoute.projectExtensionsByPath.keys()].sort().map((projectPath) => parseProject(config, projectPath, graphRoute.projectExtensionsByPath.get(projectPath)));
1747
1737
  const sourceProjectEntries = createSourceProjectEntries(config, projects);
1748
1738
  const packages = await collectWorkspacePackages(config);
1749
1739
  const packageOwners = await collectPackageOwners(config);
@@ -1763,7 +1753,7 @@ async function runSourceCheckInternal(config, options = {}) {
1763
1753
  if (existsSync(typecheckConfigPath)) addProjectOwnerProblems({
1764
1754
  config,
1765
1755
  configPath: typecheckConfigPath,
1766
- fileNames: parseProject(config, typecheckConfigPath).fileNames,
1756
+ fileNames: parseProject(config, typecheckConfigPath, project.extensions).fileNames,
1767
1757
  owners: packageOwners,
1768
1758
  problems,
1769
1759
  role: "typecheck companion"
@@ -1772,8 +1762,8 @@ async function runSourceCheckInternal(config, options = {}) {
1772
1762
  for (const { fileNames, project } of sourceProjectEntries) for (const filePath of fileNames) {
1773
1763
  const owner = findOwnerForFile(filePath, packageOwners);
1774
1764
  if (!owner) continue;
1775
- for (const importRecord of collectImportsFromFile(filePath)) {
1776
- const resolvedFilePath = resolveInternalImport(importRecord.specifier, filePath, project.options);
1765
+ for (const importRecord of collectImportsFromFile(filePath, config.rootDir)) {
1766
+ const resolvedFilePath = resolveInternalImport(importRecord.specifier, filePath, project.options, project.extensions);
1777
1767
  if (isRelativeSpecifier$1(importRecord.specifier)) {
1778
1768
  if (!resolvedFilePath) continue;
1779
1769
  const targetOwner = findOwnerForFile(resolvedFilePath, packageOwners);
@@ -1797,7 +1787,7 @@ async function runSourceCheckInternal(config, options = {}) {
1797
1787
  });
1798
1788
  continue;
1799
1789
  }
1800
- if (isUrlOrDataOrFileSpecifier(importRecord.specifier)) continue;
1790
+ if (isUrlOrDataOrFileSpecifier(importRecord.specifier) || isVirtualModuleSpecifier(importRecord.specifier)) continue;
1801
1791
  if (!isBarePackageSpecifier(importRecord.specifier)) continue;
1802
1792
  if (isNodeBuiltinSpecifier(importRecord.specifier)) continue;
1803
1793
  const packageName = getPackageRootSpecifier(importRecord.specifier);
@@ -1846,14 +1836,9 @@ async function runSourceCheck(config, options = {}) {
1846
1836
 
1847
1837
  //#endregion
1848
1838
  //#region src/commands/typecheck.ts
1849
- function normalizeConcurrency(value) {
1850
- if (value === void 0) return Math.max(1, availableParallelism());
1851
- if (!Number.isInteger(value) || value < 1) throw new Error("Typecheck concurrency must be a positive integer.");
1852
- return value;
1853
- }
1854
1839
  function getExecutionCheckers(options) {
1855
1840
  return options.checkers.filter((checker) => {
1856
- return getCheckerAdapter(checker.preset)?.supportedExecutions.includes(options.executionKind);
1841
+ return getCheckerAdapter(checker.preset)?.execution === options.executionKind;
1857
1842
  });
1858
1843
  }
1859
1844
  function collectCheckerPeerDependencyProblems(options) {
@@ -1875,49 +1860,14 @@ function createCheckerTarget(options) {
1875
1860
  executionKind: options.executionKind
1876
1861
  };
1877
1862
  }
1878
- function collectCompanionTypecheckTargets(options) {
1879
- const entryConfigPath = resolveProjectConfigPath(options.projectRootDir, options.checker.entry);
1880
- if (!existsSync(entryConfigPath)) return {
1881
- entryConfigPath,
1882
- problems: [[
1883
- "Checker entry references a missing tsconfig:",
1884
- ` checker: ${options.checker.name}`,
1885
- ` config: ${toRelativePath(options.projectRootDir, entryConfigPath)}`
1886
- ].join("\n")],
1887
- targetProjectPaths: []
1888
- };
1889
- const routeCollection = collectGraphProjectRouteFromRoot({
1890
- rootConfigPath: entryConfigPath,
1891
- rootDir: options.projectRootDir
1892
- });
1893
- const dtsConfigPaths = routeCollection.projectPaths.filter(isDtsConfigPath);
1894
- const targetProjectPaths = [...new Set(dtsConfigPaths.map(getDtsCompanionConfigPath))].sort();
1895
- const problems = [...routeCollection.problems];
1896
- if (dtsConfigPaths.length === 0) problems.push([
1897
- "Checker entry has no declaration leaf targets:",
1898
- ` checker: ${options.checker.name}`,
1899
- ` entry: ${toRelativePath(options.projectRootDir, entryConfigPath)}`,
1900
- " reason: checker:typecheck derives targets from tsconfig*.dts.json leaves reachable from the checker entry."
1901
- ].join("\n"));
1902
- for (const configPath of targetProjectPaths) {
1903
- if (existsSync(configPath)) continue;
1904
- problems.push([
1905
- "DTS leaf companion config is missing:",
1906
- ` checker: ${options.checker.name}`,
1907
- ` expected: ${toRelativePath(options.projectRootDir, configPath)}`,
1908
- " reason: checker:typecheck runs the strict local tsconfig companion for each reachable declaration leaf."
1909
- ].join("\n"));
1910
- }
1911
- return {
1912
- entryConfigPath,
1913
- problems,
1914
- targetProjectPaths
1915
- };
1916
- }
1917
1863
  function createDefaultRunner() {
1918
1864
  return async (target) => await new Promise((resolve) => {
1919
1865
  const child = spawn(target.command, target.args, {
1920
1866
  cwd: target.cwd,
1867
+ env: {
1868
+ ...process.env,
1869
+ PATH: [path.join(target.cwd, "node_modules/.bin"), process.env.PATH].filter(Boolean).join(path.delimiter)
1870
+ },
1921
1871
  shell: process.platform === "win32",
1922
1872
  stdio: "inherit"
1923
1873
  });
@@ -1962,138 +1912,106 @@ async function runWithConcurrency(targets, concurrency, runner, options = {}) {
1962
1912
  }));
1963
1913
  return results;
1964
1914
  }
1965
- async function runCheckerTypecheckInternal(options) {
1915
+ async function runCheckerBuildInternal(options) {
1966
1916
  const cwd = path.resolve(options.cwd ?? process.cwd());
1967
1917
  const projectRootDir = normalizeAbsolutePath(options.config.rootDir);
1968
1918
  const allCheckers = getActiveCheckers(options.config);
1969
1919
  const checkers = getExecutionCheckers({
1970
1920
  checkers: allCheckers,
1971
- executionKind: "typecheck"
1921
+ executionKind: "build"
1972
1922
  });
1973
1923
  const flowDepth = options.flowDepth ?? 0;
1974
- const concurrency = normalizeConcurrency(options.concurrency);
1924
+ const rootConfigPaths = [];
1975
1925
  const problems = collectCheckerPeerDependencyProblems({
1976
1926
  checkers: allCheckers,
1977
1927
  projectRootDir,
1978
1928
  resolvePackage: options.checkerPackageResolver
1979
1929
  });
1980
- const rootConfigPaths = [];
1981
- const targetProjectPaths = [];
1982
- const targets = [];
1983
1930
  if (problems.length > 0) {
1984
1931
  options.flow?.fail("checker dependency preflight failed", { depth: flowDepth + 1 });
1985
1932
  TypecheckLogger.error(problems.join("\n\n"));
1986
1933
  return {
1987
1934
  passed: false,
1988
1935
  projectRootDir,
1989
- results: [],
1990
- rootConfigPaths,
1991
- targetProjectPaths
1936
+ rootConfigPaths
1992
1937
  };
1993
1938
  }
1994
- if (checkers.length === 0) problems.push(["No checker typecheck entries configured:", " reason: configure config.checkers.<name>.entry with a preset that supports checker:typecheck."].join("\n"));
1995
- for (const checker of checkers) {
1996
- const targetCollection = collectCompanionTypecheckTargets({
1997
- checker,
1998
- projectRootDir
1999
- });
2000
- problems.push(...targetCollection.problems);
2001
- rootConfigPaths.push(targetCollection.entryConfigPath);
2002
- targetProjectPaths.push(...targetCollection.targetProjectPaths);
2003
- targets.push(...targetCollection.targetProjectPaths.map((configPath) => createCheckerTarget({
1939
+ const targets = checkers.flatMap((checker) => {
1940
+ const configPath = resolveProjectConfigPath(projectRootDir, checker.entry);
1941
+ rootConfigPaths.push(configPath);
1942
+ return [createCheckerTarget({
2004
1943
  checker,
2005
1944
  commandOverride: options.tscCommand,
2006
1945
  configPath,
2007
- executionKind: "typecheck",
1946
+ executionKind: "build",
2008
1947
  projectRootDir
2009
- })));
2010
- }
2011
- if (problems.length > 0) {
2012
- options.flow?.fail("typecheck target discovery failed", { depth: flowDepth + 1 });
2013
- TypecheckLogger.error(problems.join("\n\n"));
2014
- return {
2015
- passed: false,
2016
- projectRootDir,
2017
- results: [],
2018
- rootConfigPaths,
2019
- targetProjectPaths
2020
- };
2021
- }
2022
- options.flow?.info(`found ${targets.length} typecheck target config(s) across ${checkers.length} checker(s); concurrency ${concurrency}`, { depth: flowDepth + 1 });
1948
+ })];
1949
+ });
1950
+ options.flow?.info(`found ${targets.length} checker build entry(s)`, { depth: flowDepth + 1 });
2023
1951
  TypecheckLogger.info([
2024
- `Running checker typechecks for ${targets.length} target config(s).`,
1952
+ `Running build checks for ${targets.length} checker entry(s).`,
2025
1953
  `CWD: ${toRelativePath(cwd, projectRootDir)}`,
2026
1954
  `Entries: ${rootConfigPaths.map((configPath) => toRelativePath(projectRootDir, configPath)).join(", ")}`
2027
1955
  ].join("\n"));
2028
- const targetFlowStates = /* @__PURE__ */ new Map();
2029
- const results = await runWithConcurrency(targets, concurrency, options.runner ?? createDefaultRunner(), {
1956
+ const targetTasks = /* @__PURE__ */ new Map();
1957
+ const failedResults = (await runWithConcurrency(targets, 1, options.runner ?? createDefaultRunner(), {
2030
1958
  onTargetResult: (target, result) => {
2031
- if (!options.flow) return;
2032
- const flowState = targetFlowStates.get(target.configPath);
2033
- if (!flowState) return;
2034
- const resultOptions = {
2035
- depth: flowDepth + 1,
2036
- elapsedTimeMs: performance.now() - flowState.startedAt
2037
- };
2038
- if (result.status === 0) options.flow.pass(flowState.label, resultOptions);
1959
+ const task = targetTasks.get(target.configPath);
1960
+ if (!task) return;
1961
+ if (result.status === 0) task.pass();
2039
1962
  else {
2040
1963
  const suffix = result.error ? formatErrorMessage$1(result.error) : `exited with code ${result.status}`;
2041
- options.flow.fail(flowState.label, {
2042
- ...resultOptions,
2043
- error: suffix
2044
- });
1964
+ task.fail(void 0, { error: suffix });
2045
1965
  }
2046
1966
  },
2047
1967
  onTargetStart: (target) => {
2048
1968
  if (!options.flow) return;
2049
- targetFlowStates.set(target.configPath, {
2050
- label: target.label ?? `checker: ${toRelativePath(projectRootDir, target.configPath)}`,
2051
- startedAt: performance.now()
2052
- });
1969
+ targetTasks.set(target.configPath, options.flow.start(target.label ?? `checker build: ${toRelativePath(projectRootDir, target.configPath)}`, {
1970
+ collapseOnSuccess: false,
1971
+ depth: flowDepth + 1
1972
+ }));
2053
1973
  }
2054
- });
2055
- const failedResults = results.filter((result) => result.status !== 0);
2056
- if (failedResults.length > 0) TypecheckLogger.error([`Typecheck failed for ${failedResults.length} config(s):`, ...failedResults.map((result) => {
1974
+ })).filter((result) => result.status !== 0);
1975
+ const passed = failedResults.length === 0;
1976
+ if (!passed) TypecheckLogger.error(["build checks failed:", ...failedResults.map((result) => {
2057
1977
  const suffix = result.error ? `: ${formatErrorMessage$1(result.error)}` : ` exited with code ${result.status}`;
2058
1978
  return ` ${toRelativePath(projectRootDir, result.configPath)}${suffix}`;
2059
1979
  })].join("\n"));
2060
- else if (!options.flow?.interactive) TypecheckLogger.success(`Checked ${targets.length} typecheck target config(s) from ${rootConfigPaths.length} checker entry(s).`);
1980
+ else if (!options.flow?.interactive) TypecheckLogger.success(`Checked ${targets.length} checker build entry(s).`);
2061
1981
  return {
2062
- passed: failedResults.length === 0,
1982
+ passed,
2063
1983
  projectRootDir,
2064
- results,
2065
- rootConfigPaths,
2066
- targetProjectPaths
1984
+ rootConfigPaths
2067
1985
  };
2068
1986
  }
2069
- async function runCheckerTypecheck(options) {
1987
+ async function runCheckerBuild(options) {
2070
1988
  if (options.clearScreen ?? true) clearCliScreen();
2071
1989
  const elapsed = createElapsedTimer();
2072
- const task = options.flow?.start("checker typecheck", { depth: options.flowDepth ?? 0 });
2073
- TypecheckLogger.info("checker typecheck started");
1990
+ const task = options.flow?.start("checker build", { depth: options.flowDepth ?? 0 });
1991
+ TypecheckLogger.info("checker build started");
2074
1992
  try {
2075
- const result = await runCheckerTypecheckInternal(options);
1993
+ const result = await runCheckerBuildInternal(options);
2076
1994
  if (result.passed) {
2077
- if (!options.flow?.interactive) TypecheckLogger.success("checker typecheck finished", elapsed());
1995
+ if (!options.flow?.interactive) TypecheckLogger.success("checker build finished", elapsed());
2078
1996
  task?.pass();
2079
1997
  } else {
2080
- TypecheckLogger.error("checker typecheck finished with failures", elapsed());
2081
- task?.fail("checker typecheck finished with failures");
1998
+ TypecheckLogger.error("checker build finished with failures", elapsed());
1999
+ task?.fail("checker build finished with failures");
2082
2000
  }
2083
2001
  return result;
2084
2002
  } catch (error) {
2085
- TypecheckLogger.error(`checker typecheck failed: ${formatErrorMessage$1(error)}`, elapsed());
2086
- task?.fail("checker typecheck failed", { error });
2003
+ TypecheckLogger.error(`checker build failed: ${formatErrorMessage$1(error)}`, elapsed());
2004
+ task?.fail("checker build failed", { error });
2087
2005
  throw error;
2088
2006
  }
2089
2007
  }
2090
- async function runCheckerBuildInternal(options) {
2008
+ async function runCheckerTypecheckInternal(options) {
2091
2009
  const cwd = path.resolve(options.cwd ?? process.cwd());
2092
2010
  const projectRootDir = normalizeAbsolutePath(options.config.rootDir);
2093
2011
  const allCheckers = getActiveCheckers(options.config);
2094
2012
  const checkers = getExecutionCheckers({
2095
2013
  checkers: allCheckers,
2096
- executionKind: "build"
2014
+ executionKind: "typecheck"
2097
2015
  });
2098
2016
  const flowDepth = options.flowDepth ?? 0;
2099
2017
  const rootConfigPaths = [];
@@ -2111,20 +2029,29 @@ async function runCheckerBuildInternal(options) {
2111
2029
  rootConfigPaths
2112
2030
  };
2113
2031
  }
2114
- const targets = checkers.flatMap((checker) => {
2032
+ const targets = checkers.map((checker) => {
2115
2033
  const configPath = resolveProjectConfigPath(projectRootDir, checker.entry);
2116
2034
  rootConfigPaths.push(configPath);
2117
- return [createCheckerTarget({
2035
+ return createCheckerTarget({
2118
2036
  checker,
2119
2037
  commandOverride: options.tscCommand,
2120
2038
  configPath,
2121
- executionKind: "build",
2039
+ executionKind: "typecheck",
2122
2040
  projectRootDir
2123
- })];
2041
+ });
2124
2042
  });
2125
- options.flow?.info(`found ${targets.length} checker build entry(s)`, { depth: flowDepth + 1 });
2043
+ if (targets.length === 0) {
2044
+ options.flow?.info("no source-only checker entries configured", { depth: flowDepth + 1 });
2045
+ if (!options.flow?.interactive) TypecheckLogger.success("No source-only checker entries configured.");
2046
+ return {
2047
+ passed: true,
2048
+ projectRootDir,
2049
+ rootConfigPaths
2050
+ };
2051
+ }
2052
+ options.flow?.info(`found ${targets.length} checker typecheck entry(s)`, { depth: flowDepth + 1 });
2126
2053
  TypecheckLogger.info([
2127
- `Running build checks for ${targets.length} checker entry(s).`,
2054
+ `Running typecheck for ${targets.length} checker entry(s).`,
2128
2055
  `CWD: ${toRelativePath(cwd, projectRootDir)}`,
2129
2056
  `Entries: ${rootConfigPaths.map((configPath) => toRelativePath(projectRootDir, configPath)).join(", ")}`
2130
2057
  ].join("\n"));
@@ -2141,42 +2068,42 @@ async function runCheckerBuildInternal(options) {
2141
2068
  },
2142
2069
  onTargetStart: (target) => {
2143
2070
  if (!options.flow) return;
2144
- targetTasks.set(target.configPath, options.flow.start(target.label ?? `checker build: ${toRelativePath(projectRootDir, target.configPath)}`, {
2071
+ targetTasks.set(target.configPath, options.flow.start(target.label ?? `checker typecheck: ${toRelativePath(projectRootDir, target.configPath)}`, {
2145
2072
  collapseOnSuccess: false,
2146
2073
  depth: flowDepth + 1
2147
2074
  }));
2148
2075
  }
2149
2076
  })).filter((result) => result.status !== 0);
2150
2077
  const passed = failedResults.length === 0;
2151
- if (!passed) TypecheckLogger.error(["build checks failed:", ...failedResults.map((result) => {
2078
+ if (!passed) TypecheckLogger.error(["typecheck checks failed:", ...failedResults.map((result) => {
2152
2079
  const suffix = result.error ? `: ${formatErrorMessage$1(result.error)}` : ` exited with code ${result.status}`;
2153
2080
  return ` ${toRelativePath(projectRootDir, result.configPath)}${suffix}`;
2154
2081
  })].join("\n"));
2155
- else if (!options.flow?.interactive) TypecheckLogger.success(`Checked ${targets.length} checker build entry(s).`);
2082
+ else if (!options.flow?.interactive) TypecheckLogger.success(`Checked ${targets.length} checker typecheck entry(s).`);
2156
2083
  return {
2157
2084
  passed,
2158
2085
  projectRootDir,
2159
2086
  rootConfigPaths
2160
2087
  };
2161
2088
  }
2162
- async function runCheckerBuild(options) {
2089
+ async function runCheckerTypecheck(options) {
2163
2090
  if (options.clearScreen ?? true) clearCliScreen();
2164
2091
  const elapsed = createElapsedTimer();
2165
- const task = options.flow?.start("checker build", { depth: options.flowDepth ?? 0 });
2166
- TypecheckLogger.info("checker build started");
2092
+ const task = options.flow?.start("checker typecheck", { depth: options.flowDepth ?? 0 });
2093
+ TypecheckLogger.info("checker typecheck started");
2167
2094
  try {
2168
- const result = await runCheckerBuildInternal(options);
2095
+ const result = await runCheckerTypecheckInternal(options);
2169
2096
  if (result.passed) {
2170
- if (!options.flow?.interactive) TypecheckLogger.success("checker build finished", elapsed());
2097
+ if (!options.flow?.interactive) TypecheckLogger.success("checker typecheck finished", elapsed());
2171
2098
  task?.pass();
2172
2099
  } else {
2173
- TypecheckLogger.error("checker build finished with failures", elapsed());
2174
- task?.fail("checker build finished with failures");
2100
+ TypecheckLogger.error("checker typecheck finished with failures", elapsed());
2101
+ task?.fail("checker typecheck finished with failures");
2175
2102
  }
2176
2103
  return result;
2177
2104
  } catch (error) {
2178
- TypecheckLogger.error(`checker build failed: ${formatErrorMessage$1(error)}`, elapsed());
2179
- task?.fail("checker build failed", { error });
2105
+ TypecheckLogger.error(`checker typecheck failed: ${formatErrorMessage$1(error)}`, elapsed());
2106
+ task?.fail("checker typecheck failed", { error });
2180
2107
  throw error;
2181
2108
  }
2182
2109
  }
@@ -2471,4 +2398,4 @@ function createLiminaFlowReporter(options = {}) {
2471
2398
  }
2472
2399
 
2473
2400
  //#endregion
2474
- export { shouldResolveThroughGraph as A, createExtensionPattern as B, formatArtifactDependencyPolicy as C, isRelativeSpecifier$1 as D, isDtsProjectConfig as E, collectCheckerEntryProjectRoutes as F, isDtsConfigPath as G, formatReferences as H, collectGraphProjectRoute as I, parseProjectFileNamesForExtensions as J, isOrdinaryTypecheckConfigPath as K, collectGraphProjectRouteFromRoot as L, collectWorkspacePackages as M, findPackageForSpecifier as N, parseProject as O, getPackageRootSpecifier as P, collectGraphProjectRoutes as R, findTargetProject as S, inferPackageProject as T, getDtsCompanionConfigPath as U, createFormatHost as V, getRawReferencePaths as W, resolveProjectConfigPath as X, readJsonConfig as Y, resolveReferencePath as Z, normalizeGraphRules as _, runSourceCheck as a, findImporterForFile as b, GraphLogger as c, ProofLogger as d, clearCliScreen as f, getDeniedRefRule as g, getDeniedDepRuleForSpecifier as h, runCheckerTypecheck as i, collectImporters as j, resolveInternalImport as k, PackageLogger as l, getDeniedDepRuleForPackage as m, createLiminaFlowReporter as n, runInit as o, formatErrorMessage$1 as p, parseProjectFileNames as q, runCheckerBuild as r, CliLogger as s, LiminaFlowReporter as t, PathsLogger as u, collectImportsFromFile as v, getTypecheckConfigPath as w, findPackageForFile as x, createFileOwnerLookup as y, collectTypecheckTargetProjectPaths as z };
2401
+ export { resolveReferencePath as $, resolveInternalImport as A, collectGraphProjectRouteFromRoot as B, findTargetProject as C, isDtsProjectConfig as D, inferPackageProject as E, getPackageRootSpecifier as F, createFormatHost as G, collectSourceGraphProjectExtensions as H, getPublishDependencySections as I, getRawReferencePaths as J, formatReferences as K, isWorkspaceDependencySpecifier as L, collectImporters as M, collectWorkspacePackages as N, isRelativeSpecifier$1 as O, findPackageForSpecifier as P, resolveProjectConfigPath as Q, collectCheckerEntryProjectRoutes as R, findPackageForFile as S, getTypecheckConfigPath as T, createExtensionPattern as U, collectGraphProjectRoutes as V, createExtraFileExtensions as W, parseProjectFileNamesForExtensions as X, isOrdinaryTypecheckConfigPath as Y, readJsonConfig as Z, getDeniedRefRule as _, runSourceCheck as a, createFileOwnerLookup as b, GraphLogger as c, ProofLogger as d, ReleaseLogger as f, getDeniedDepRuleForSpecifier as g, getDeniedDepRuleForPackage as h, runCheckerTypecheck as i, shouldResolveThroughGraph as j, parseProject as k, PackageLogger as l, formatErrorMessage$1 as m, createLiminaFlowReporter as n, runInit as o, clearCliScreen as p, getDtsCompanionConfigPath as q, runCheckerBuild as r, CliLogger as s, LiminaFlowReporter as t, PathsLogger as u, normalizeGraphRules as v, formatArtifactDependencyPolicy as w, findImporterForFile as x, collectImportsFromFile as y, collectGraphProjectRoute as z };