Skip to content

chore: tidy comments in src/ and fix typos in API error messages - #1714

Merged
johnnyreilly merged 1 commit into
nextfrom
chore/tidy-src-comments
Oct 25, 2026
Merged

johnnyreilly merged 1 commit into
nextfrom
chore/tidy-src-comments

Conversation

@johnnyreilly

Copy link
Copy Markdown
Member

Summary

Comment-only tidy-up of src/, plus three message typo fixes.

Comments that were wrong, now fixed

  • Two comments (recheckAllTransitiveDependants, findTransitiveDependants) explained behaviour via an fs/readFile override in createTypeScriptInstance that no longer exists - rewritten to match the current layering approach.
  • Wrong references: reportPendingTypeScriptDiagnostics "in index.ts" (it's in diagnostics.ts), "index.ts's postCompile hook" (it's addPostCompileHooks), openPrimaryProject's listed callers.
  • reportConfigFileParsingErrors claimed it throws; it returns the message.
  • types.ts used stale names (FilePathKey, ResolvedPathCache), described directImportsCache as per-build (it persists across builds), and contained a mis-encoded ×.

Duplication / excess removed

  • Cache docs in types.ts duplicated the function docs; detail now lives once on the function, with a short pointer from types.ts.
  • "Broken tsconfig is a hard failure" (3 copies) and "node_modules emits nothing" (2 copies) each kept once.
  • Long rationale comments condensed to the essential why (kept the 80%-of-build-time measurement, Windows path/casing gotchas, upstream issue links, and notes on deliberate parity with classic ts-loader).

Message fixes

  • TypeScript TypeScript mode could not resolve project for X. → TypeScript could not resolve a project for X.
  • Could not load TypeScript typeScript API from … → Could not load the TypeScript API from …
  • Info log Using typescript typeScript API with … → Using typescript API with …

None of these strings appear in any test snapshot.

Test plan

  • npm run build
  • npm run lint
  • npm run comparison-tests - all pass

🤖 Generated with Claude Code

Trim, deduplicate and correct comments under src/:
- fix comments that referenced a removed fs/readFile override, wrong
  files/functions, or stale type names
- keep detailed explanations in one place (function docs) with short
  pointers from types.ts
- keep the Windows path / casing gotchas and upstream issue links

Also fix doubled wording in two error messages and an info log
("TypeScript TypeScript mode", "TypeScript typeScript API",
"typescript typeScript API").

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@github-actions

Copy link
Copy Markdown

Benchmark (Ubuntu)

Scenario transpileOnly PR branch median (ms) base branch median (ms) Δ vs base branch
Cold build false 1217.4 1209.3 +0.7%
Incremental rebuild (leaf touch) false 56.3 57.4 -1.8%
Incremental rebuild (hub touch) false 520.8 517.0 +0.7%
Cold build true 432.9 436.2 -0.8%
Incremental rebuild (leaf touch) true 37.9 37.0 +2.4%
Incremental rebuild (hub touch) true 41.8 41.6 +0.5%
Cold build (all orphan files) false 1389.3 1383.9 +0.4%
Incremental rebuild (hub touch, all orphan files) false 562.3 574.6 -2.1%

PR branch = /home/runner/work/ts-loader/ts-loader, base branch = /home/runner/work/ts-loader/ts-loader-main. 2 warmup + 10 measured iterations per scenario, median reported. Report-only - no threshold fails this check.

@github-actions

Copy link
Copy Markdown

Benchmark (macOS)

Scenario transpileOnly PR branch median (ms) base branch median (ms) Δ vs base branch
Cold build false 1240.2 1198.7 +3.5%
Incremental rebuild (leaf touch) false 65.2 62.6 +4.2%
Incremental rebuild (hub touch) false 508.5 487.5 +4.3%
Cold build true 481.0 477.5 +0.7%
Incremental rebuild (leaf touch) true 53.7 53.7 +0.0%
Incremental rebuild (hub touch) true 53.9 52.3 +3.0%
Cold build (all orphan files) false 1295.8 1301.4 -0.4%
Incremental rebuild (hub touch, all orphan files) false 691.1 719.8 -4.0%

PR branch = /Users/runner/work/ts-loader/ts-loader, base branch = /Users/runner/work/ts-loader/ts-loader-main. 2 warmup + 10 measured iterations per scenario, median reported. Report-only - no threshold fails this check.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

The changes are limited to comments and message wording, with no unresolved correctness or maintainability issues identified.

No open issues 🎉

What changed in this PR

This PR tidies comments in ts-loader’s TypeScript API integration and corrects three user-facing messages without changing compilation logic.

Changes:

  • Corrects stale comment references and descriptions of snapshot layering and cache lifetimes.
  • Condenses duplicated explanations while preserving key performance and Windows compatibility details.
  • Fixes wording in two error messages and one informational log.
File Description
src/​typeScriptApi.ts Updates API integration comments and fixes two error messages.
src/​types.ts Corrects type and cache documentation and removes duplication.
src/​index.ts Simplifies lifecycle comments and fixes informational log wording.
src/​colors.ts Condenses comments describing shared color instances.

Review effort: Balanced

@github-actions

Copy link
Copy Markdown

Benchmark (Windows)

Scenario transpileOnly PR branch median (ms) base branch median (ms) Δ vs base branch
Cold build false 1796.2 1799.9 -0.2%
Incremental rebuild (leaf touch) false 64.9 64.9 +0.1%
Incremental rebuild (hub touch) false 752.5 751.3 +0.2%
Cold build true 496.0 497.4 -0.3%
Incremental rebuild (leaf touch) true 43.0 42.9 +0.2%
Incremental rebuild (hub touch) true 44.9 40.3 +11.3%
Cold build (all orphan files) false 2149.0 2129.7 +0.9%
Incremental rebuild (hub touch, all orphan files) false 805.7 803.8 +0.2%

PR branch = C:\source\ts-loader, base branch = C:\source\ts-loader-main. 2 warmup + 10 measured iterations per scenario, median reported. Report-only - no threshold fails this check.

@johnnyreilly
johnnyreilly merged commit 5c0bf5b into next Oct 25, 2026
46 checks passed
@johnnyreilly
johnnyreilly deleted the chore/tidy-src-comments branch October 25, 2026 10:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants