Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
114 commits
Select commit Hold shift + click to select a range
3670e65
feat: add tsgo transpile path
Copilot Jul 26, 2026
53082fb
fix: load tsgo API via ESM import
Copilot Jul 26, 2026
fcc8a21
Restrict execution-test TS matrix to tsgo version
Copilot Jul 26, 2026
47139fd
chore: explicitly use typescript@7.1.0-dev.20260725.1
johnnyreilly Jul 27, 2026
4706cfe
Port build to TypeScript 7 native API
Copilot Jul 27, 2026
14ad7c0
fix: large
johnnyreilly Jul 27, 2026
048c5ce
fix native API execution test defaults
Copilot Jul 27, 2026
6679581
chore: remove test
johnnyreilly Jul 27, 2026
089d51d
fix: remove unused
johnnyreilly Jul 27, 2026
848e5d7
fix: happify ashley
johnnyreilly Jul 27, 2026
65f7d15
fix: use TS7 API in comparison test harness
Copilot Jul 27, 2026
9f57587
fix: getProgram
johnnyreilly Jul 27, 2026
d0c29f8
feat: extra diagnostics
johnnyreilly Jul 27, 2026
6fde73a
feat: match existing formatting
johnnyreilly Jul 27, 2026
b9c52e5
chore: regenerate yarn.lock
johnnyreilly Jul 27, 2026
db6bd05
chore: remove happypack
johnnyreilly Jul 27, 2026
1e68189
fix: aliasResolution
johnnyreilly Jul 27, 2026
291d4d3
chore: bump version
johnnyreilly Jul 28, 2026
0319ac8
fix: colors
johnnyreilly Jul 28, 2026
5e4691e
fix: webpack 4
johnnyreilly Jul 28, 2026
3c7e4f8
chore: rename
johnnyreilly Jul 28, 2026
e539631
chore: remove unused
johnnyreilly Jul 28, 2026
366f2ab
fix: rootDir in tests
johnnyreilly Jul 28, 2026
fdedc66
fix: outputs
johnnyreilly Jul 28, 2026
c495b91
fix: declarationOutput
johnnyreilly Jul 28, 2026
b18a746
fix: declaration tests
johnnyreilly Jul 28, 2026
c8a4470
fix: dependency
johnnyreilly Jul 28, 2026
f7c0809
fix: output
johnnyreilly Jul 28, 2026
20ec609
fix: declarationWathc
johnnyreilly Jul 28, 2026
f75550f
chore: upgrade prettier
johnnyreilly Jul 28, 2026
848c2a3
fix: reportFiels
johnnyreilly Jul 28, 2026
83cefbb
fix: test
johnnyreilly Jul 28, 2026
a9bf2fe
fix: onlyCompileBundledFiles
johnnyreilly Jul 28, 2026
b2fa194
fix: style
johnnyreilly Jul 28, 2026
fd24f44
fix: otherLoadersWatch
johnnyreilly Jul 28, 2026
e8dd7ec
feat: settings.json
johnnyreilly Jul 28, 2026
648600f
fix: output
johnnyreilly Jul 28, 2026
1f0d094
chore: add setings
johnnyreilly Jul 28, 2026
938e4b0
fix: resolveJsonModule
johnnyreilly Jul 28, 2026
7f5e696
fix: tsconfileInvalid
johnnyreilly Jul 28, 2026
bbecdf4
fix: tsconfileInvalidFile
johnnyreilly Jul 28, 2026
e33b3aa
revert last fix
johnnyreilly Jul 28, 2026
45e98d0
Comment out DIAGNOSTIC_CODE_FILE_NOT_FOUND constant
johnnyreilly Jul 29, 2026
9bef513
chore: skip test
johnnyreilly Jul 29, 2026
3ba64cd
fix: yarn comparison-tests --single-test nodeModulesMeaningfulErrorWh…
johnnyreilly Jul 29, 2026
465f17a
fix: output
johnnyreilly Jul 29, 2026
b6011c2
chore: temp files better
johnnyreilly Jul 29, 2026
8e9dd90
feat: virtual file system
johnnyreilly Jul 29, 2026
0495e52
fix: sourceMapsShouldConsiderInputSourceMap
johnnyreilly Jul 29, 2026
c18ad22
fix: allow spike rm
johnnyreilly Jul 29, 2026
d508d26
fix: Windows comparison-test failures in the tsgo API backend
johnnyreilly Jul 29, 2026
92f235b
Merge branch 'main' into copilot/implement-new-tsgo-api-support
johnnyreilly Jul 29, 2026
3bb72dd
docs: edit AGENTS.md / deps for sourceMaps test / time
johnnyreilly Jul 30, 2026
b956f18
Merge branch 'copilot/implement-new-tsgo-api-support' of https://gith…
johnnyreilly Jul 30, 2026
cd50d4d
refactor: remove unverified Windows-fix leftovers proven unnecessary …
johnnyreilly Jul 30, 2026
9fd2675
chore: "target": "es2022"
johnnyreilly Jul 30, 2026
a862571
feat: chalk -> picocolors
johnnyreilly Jul 30, 2026
e55bb7d
feat: picocolors -> styleText
johnnyreilly Jul 30, 2026
837a924
fix: test
johnnyreilly Jul 30, 2026
efa7eb0
fix: eslint -> oxlint
johnnyreilly Jul 30, 2026
3434d3f
feat: styleText -> picocolors
johnnyreilly Jul 30, 2026
30ade78
chore: clean unused
johnnyreilly Aug 1, 2026
739f5a9
chore: knip / upgrade deps
johnnyreilly Aug 3, 2026
1d798ac
fix: execution tests
johnnyreilly Aug 3, 2026
2a99395
chore: remove experimentalWatchApi references
johnnyreilly Aug 3, 2026
3594bf9
chore: remove experimentalWatchApi tests
johnnyreilly Aug 5, 2026
5544bf3
chore: remove reference to watchapi in tests
johnnyreilly Aug 5, 2026
92e5e58
fix: loader options hash
johnnyreilly Aug 5, 2026
9b451d5
fix: loader options hash
johnnyreilly Aug 5, 2026
2b9c9a8
fix: loader options hash
johnnyreilly Aug 5, 2026
d6c2531
chore: update to latest nightly
johnnyreilly Aug 20, 2026
fac7ac7
chore: upgrade lint-staged
johnnyreilly Aug 20, 2026
3b5af16
feat: transpileApi
johnnyreilly Aug 20, 2026
db8b27c
fix: normalize transpileModule/transpileDeclaration fileName for Windows
johnnyreilly Aug 20, 2026
7f1cbd5
fix: transpileDeclaration panics on Windows given an absolute fileName
johnnyreilly Aug 20, 2026
4cb1118
docs: reduce comment verbosity - needs another pass
johnnyreilly Aug 29, 2026
6146ee1
chore: remove workarounds no longer required since https://github.com…
johnnyreilly Aug 29, 2026
fc16076
chore: function expressions to function declarations
johnnyreilly Aug 29, 2026
5019944
feat: knip
johnnyreilly Aug 29, 2026
38d364e
refactor: use API-provided startPosition/endPosition instead of a man…
johnnyreilly Aug 29, 2026
e32bbd6
fix: knip / simplify execution tests
johnnyreilly Aug 29, 2026
86bc387
fix: tests
johnnyreilly Aug 29, 2026
ea547e1
fix: dont alias types
johnnyreilly Aug 29, 2026
1066d18
chore: trim comments
johnnyreilly Aug 29, 2026
4829413
refactor: simplify logger
johnnyreilly Aug 29, 2026
0703360
refactor: simplify logger
johnnyreilly Aug 29, 2026
76b04fe
Change ColorFn type to an interface
johnnyreilly Aug 29, 2026
a50c296
Fix type annotation in ColorFn interface
johnnyreilly Aug 29, 2026
159fe19
chore: onlyCompileBundledFiles/context removed as options
johnnyreilly Aug 30, 2026
8c15df5
refactor: naming
johnnyreilly Aug 30, 2026
76660a3
feat: remove fs-extra
johnnyreilly Aug 30, 2026
bb91cd5
feat: remove rimraf
johnnyreilly Aug 30, 2026
2eb9794
feat: remove mkdirp
johnnyreilly Aug 30, 2026
3e44199
chore: remove compilerOptions loader option
johnnyreilly Aug 30, 2026
ad8b198
test: regenerate snapshots affected by compilerOptions harness defaul…
johnnyreilly Aug 30, 2026
a625166
docs: CHANGELOG
johnnyreilly Aug 30, 2026
4f517a4
fix: resolve .mts/.cts relative imports for dependency tracking
johnnyreilly Aug 30, 2026
05010e2
perf: only force a full snapshot rescan once per build, not per file
johnnyreilly Aug 30, 2026
fa2fcca
perf: memoize direct-import resolution across a build's dependant rec…
johnnyreilly Aug 30, 2026
58e250f
fix: key directImportsCache by FilePathKey, not raw file name
johnnyreilly Aug 30, 2026
9d6e87d
refactor: naming
johnnyreilly Aug 30, 2026
d35d31d
perf: memoize the .d.ts dependency scan across a build
johnnyreilly Aug 30, 2026
d12af3a
refactor: names
johnnyreilly Aug 30, 2026
0d5b0c9
fix: cap orphan-file synthetic projects with LRU eviction
johnnyreilly Aug 30, 2026
3f41eae
fix: canonicalize configFilePath/syntheticConfig* via FilePath
johnnyreilly Aug 30, 2026
1fd89f7
refactor: rename
johnnyreilly Aug 30, 2026
e7f1b70
refactor: names
johnnyreilly Aug 30, 2026
44f3c75
refactor: thread resolvedFilePathCache instead of storing it twice
johnnyreilly Aug 30, 2026
d2ccddb
refactor: rename
johnnyreilly Aug 30, 2026
55400f7
feat: split diagnostics
johnnyreilly Aug 30, 2026
43c4b35
feat: format
johnnyreilly Aug 30, 2026
c3b5b1b
Merge branch 'main' of https://github.com/TypeStrong/ts-loader into c…
johnnyreilly Sep 1, 2026
5256a44
fix: benchmark close issue
johnnyreilly Sep 1, 2026
b9efbc4
fix: bound benchmark scenario wall-clock time to fit CI's job timeout
johnnyreilly Sep 1, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
38 changes: 38 additions & 0 deletions .claude/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
{
"permissions": {
"defaultMode": "dontAsk",
"allow": [
"Edit",
"Write",
"Bash(rm -rf .spike-tmp*)",
"Bash(yarn build *)",
"Bash(yarn lint *)",
"Bash(yarn format *)",
"Bash(yarn test *)",
"Bash(yarn comparison-tests *)",
"Bash(yarn execution-tests *)",
"Bash(yarn clean *)",
"Bash(yarn install *)",
"Bash(git status *)",
"Bash(git diff *)",
"Bash(git log *)",
"Bash(git stash *)",
"Bash(git checkout *)",
"Bash(git clean *)",
"Bash(npm ls *)",
"Bash(npm view *)",
"Bash(npm root *)",
"Bash(npm config *)",
"Bash(node *)",
"Bash(node_modules/.bin/tsc *)",
"Bash(npx tsc *)",
"Bash(npx mocha *)",
"Bash(grep *)",
"Read(//usr/local/lib/node_modules/**)",
"Bash(rm -rf .test)",
"Bash(FORCE_COLOR=1 node node_modules/mocha/bin/_mocha test/comparison-tests/create-and-execute-test.js --reporter spec --test-to-run * --timeout 25000)",
"Bash(node node_modules/mocha/bin/_mocha test/comparison-tests/create-and-execute-test.js --reporter spec --test-to-run * --timeout 25000)",
"Bash(echo \"PID $!\")"
]
}
}
2 changes: 1 addition & 1 deletion .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

// Add the IDs of extensions you want installed when the container is created.
"extensions": [
"dbaeumer.vscode-eslint",
"oxc.oxc-vscode",
"esbenp.prettier-vscode"
],

Expand Down
28 changes: 26 additions & 2 deletions .github/workflows/push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ jobs:
strategy:
matrix:
node: [26, 24, 22]
ts: [5.6.2, 5.7.2, 5.8.2, 5.9.2, 6.0.2] # next excluded for now
ts: [7.1.0-dev.20260829.1, next]
webpack: [4, 5]
runs-on: ubuntu-latest
steps:
Expand Down Expand Up @@ -85,7 +85,7 @@ jobs:
strategy:
matrix:
node: [26, 24, 22]
ts: [5.6.2, 5.7.2, 5.8.2, 5.9.2, 6.0.2] # next excluded for now
ts: [7.1.0-dev.20260829.1, next]
webpack: [4, 5]
runs-on: windows-latest
steps:
Expand Down Expand Up @@ -134,3 +134,27 @@ jobs:

- name: lint
run: yarn lint

format:
name: Format
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7

- name: install
run: yarn install

- name: format:check
run: yarn format:check

knip:
name: Knip
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7

- name: install
run: yarn install

- name: knip
run: yarn knip
6 changes: 3 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,13 @@ npm-debug.log
!/test/**/expectedOutput-transpile/**
/**/node_modules
/dist
/dist-2018
/test/execution-tests/**/dist
/**/.happypack
/**/.cache-loader
!build.js
/**/debug.log
.pnp
.pnp.js
!.eslintrc.js
.vs/**
.pnpm-store
.pnpm-store
.spike-tmp
30 changes: 30 additions & 0 deletions .oxlintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
{
"$schema": "./node_modules/oxlint/configuration_schema.json",
"plugins": ["typescript", "unicorn", "oxc"],
"categories": {
"correctness": "error"
},
"options": {
"typeAware": true,
"typeCheck": true
},
"rules": {
"typescript/unbound-method": "off",
"typescript/consistent-type-imports": "error",
"no-unused-vars": [
"error",
{
"args": "all",
"argsIgnorePattern": "^_",
"caughtErrors": "all",
"caughtErrorsIgnorePattern": "^_",
"destructuredArrayIgnorePattern": "^_",
"varsIgnorePattern": "^_",
"ignoreRestSiblings": true
}
]
},
"env": {
"builtin": true
}
}
2 changes: 1 addition & 1 deletion .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"recommendations": [
"dbaeumer.vscode-eslint",
"oxc.oxc-vscode",
"esbenp.prettier-vscode"
]
}
3 changes: 2 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,6 @@
"sed": true,
"yarn": true,
"git check-ignore": true
}
},
"editor.formatOnSave": true
}
47 changes: 43 additions & 4 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,20 +6,31 @@ ts-loader is a TypeScript loader for webpack, enabling webpack to compile `.ts`

Use `yarn` (not npm).

## Style

Prefer function declarations for named functions, especially reusable helpers. Use `function name(...) {}` instead of `const name = (...) => {}` when the function needs a name, as this is generally preferred for readability and consistency.

Prefer `interface` over `type` for object shapes when possible, as interfaces have better performance and tooling support in TypeScript.

## Comments

Keep comments in `src/` sparse: only the non-obvious _why_ (a Windows-only path quirk, an undocumented API behavior, a deliberate divergence from classic ts-loader's output) earns one, and it should be as short as it can be while still saying that. Don't add a comment that restates what a well-named identifier or the code's own shape already makes clear. Before trimming or removing an existing comment, weigh what it would cost to rediscover - some encode a hard-won finding (a repro script, a real Windows CI failure) that isn't obvious from the code alone; when in doubt, shorten rather than delete. `src/typeScriptApi.ts` is the densest file by necessity (most of ts-loader's TypeScript-API-specific behavior lives there); see "Testing on Windows CI" below for its most common recurring gotcha.

## Key commands

Note: test scripts clean test directories first using `git clean -xfd`.

```bash
yarn build # compile src/ → dist/ (tsc --project "./src")
yarn lint # type-check + ESLint (no separate typecheck script)
yarn lint # type-check + oxlint (no separate typecheck script)
yarn test # full test suite (comparison + execution tests)
yarn comparison-tests # fast subset: compare webpack output against snapshots
yarn execution-tests # run compiled code via Karma/Jasmine
yarn benchmark # compare this build's compile speed against another ts-loader checkout
```

To run a single test:

```bash
yarn comparison-tests -- --single-test <testName>
yarn execution-tests -- --single-test <testName> --watch
Expand All @@ -36,7 +47,7 @@ Full docs: [`test/comparison-tests/README.md`](test/comparison-tests/README.md)
**Flaky tests**: place an empty `_FLAKY_` file in the test directory to allow occasional failures without blocking the build.

```bash
yarn comparison-tests # all tests
yarn comparison-tests # all tests
yarn comparison-tests -- --single-test <name> # one test
yarn comparison-tests -- --save-output # regenerate all snapshots
yarn comparison-tests -- --save-output --single-test <name> # regenerate one snapshot
Expand All @@ -53,9 +64,12 @@ Full docs: [`test/execution-tests/README.md`](test/execution-tests/README.md)
Tests prefixed with a TypeScript version (e.g. `2.0.3_es2016`) are skipped when the installed TypeScript is older than that prefix.

Every `webpack.config.js` in this pack must include this alias so the local ts-loader is resolved:

```js
// for test harness purposes only
module.exports.resolveLoader = { alias: { 'ts-loader': path.join(__dirname, "../../../index.js") } }
module.exports.resolveLoader = {
alias: { 'ts-loader': path.join(__dirname, '../../../index.js') },
};
```

```bash
Expand All @@ -64,6 +78,31 @@ yarn execution-tests -- --single-test <name> # one test
yarn execution-tests -- --single-test <name> --watch # watch mode (open http://localhost:9876/)
```

## Testing on Windows CI

macOS/Linux passing locally does **not** mean Windows passes — this codebase has repeatedly had Windows-only comparison-test failures with no macOS/Linux equivalent. The recurring root cause: `src/typeScriptApi.ts` calls into the TypeScript API (`typescript/unstable/sync`), whose `program.getSourceFileNames()`/`getConfigFileNames()`/internal lookups return forward-slash-normalized paths on every OS (the long-standing TS compiler convention), while Node's own `path.resolve`/`path.join`/`path.normalize` return OS-native (backslash on Windows) paths. Any place that builds a path with Node's `path` module and then compares it against, or hands it to, something expecting the API's own spelling — a `Set`/`Map` keyed by API-returned names, or webpack's `addDependency`/`addBuildDependency` (which rejects non-native absolute paths) — silently breaks on Windows only. When investigating a new Windows-only failure, check for this pattern first (search for `path.resolve`/`path.join`/`path.normalize` near any `program.get*`/`toComparablePath` usage in `src/typeScriptApi.ts`).

### Windows test probe workflow

`.github/workflows/windows-test-probe.yml` (registered on `main`, so dispatchable against any branch/ref) runs just the Windows comparison tests via `workflow_dispatch` — much faster than the full `push.yml` matrix (which also runs the Ubuntu suite and the full Node/TS/webpack execution-test matrix). Use it to iterate on Windows-only failures without asking a human to relay CI output.

Requires `gh` CLI authenticated with the `workflow` scope (`gh auth login`, then `gh auth refresh -s workflow` if `gh auth status` doesn't already list `workflow` — both scopes need a human to complete the browser device-flow prompt, they can't be scripted).

````bash
# trigger — omit both inputs to run the full comparison-test suite
gh workflow run windows-test-probe.yml --repo TypeStrong/ts-loader \
--ref <branch> -f single_test=<name> # one test
gh workflow run windows-test-probe.yml --repo TypeStrong/ts-loader \
--ref <branch> -f match_test='^(testA|testB)$' # several, by regex

# the trigger command prints the run URL directly - grab the numeric id from it, then:
gh run watch <run-id> --repo TypeStrong/ts-loader --exit-status # blocks until done

# `gh run watch` can itself fail on a transient network blip even when the run
# succeeded - always verify conclusion this way rather than trusting its exit code
gh run view <run-id> --repo TypeStrong/ts-loader --json status,conclusion

gh run view <run-id> --repo TypeStrong/ts-loader --log-failed # full failure log text
## Benchmark tests (`test/benchmark-tests/`)

Answers "did this get faster or slower?", not "is the output correct?" - the comparison/execution packs never record timing, so this is a separate harness. It generates a synthetic project on the fly and times ts-loader compiling it (cold build, and incremental rebuild after touching a low-fan-out vs. high-fan-out file, under both `transpileOnly: true`/`false`), comparing two ts-loader checkouts (this build vs. another, e.g. `main`) back-to-back in one process so the relative numbers are meaningful despite noisy CI hosts.
Expand All @@ -75,6 +114,6 @@ Full docs: [`test/benchmark-tests/README.md`](test/benchmark-tests/README.md)
```bash
yarn benchmark -- --root-a . --root-b . # sanity check against itself, expect ~0% deltas
yarn benchmark -- --root-a . --root-b ../ts-loader-main # compare against another built checkout
```
````

Always add or update tests when fixing bugs or adding features — see [CONTRIBUTING.md](CONTRIBUTING.md).
Loading
Loading