Skip to content

Commit ba825c2

Browse files
authored
chore: TypeScript 5.9 upgrade (#1676)
* feat: upgrade typescript * fix: add skipLibCheck to deal with webpack / typescript incompatibilities * chore: stub new tests * fix: add skipLibCheck to deal with webpack / typescript incompatibilities * fix: upgrade test output * chore: yarn lock * chore: upgrade to [email protected] * chore: regenerate output after webpack upgrade * chore: remove 4.x TypeScript tests and add 5.9.2 to matrix * chore: upgrade version
1 parent 847a249 commit ba825c2

File tree

2,163 files changed

+60168
-60020
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

2,163 files changed

+60168
-60020
lines changed

.github/workflows/push.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ jobs:
4949
strategy:
5050
matrix:
5151
node: [20, 22]
52-
ts: [4.4.2, 4.5.2, 4.6.2, 4.7.3, 4.8.2, 4.9.3, 5.0.4, 5.1.3, 5.2.2, 5.3.3, 5.4.2, 5.5.3, 5.6.2, 5.7.2, 5.8.2, next]
52+
ts: [5.0.4, 5.1.3, 5.2.2, 5.3.3, 5.4.2, 5.5.3, 5.6.2, 5.7.2, 5.8.2, 5.9.2, next]
5353
runs-on: ubuntu-latest
5454
steps:
5555
- uses: actions/checkout@v3
@@ -76,7 +76,7 @@ jobs:
7676
strategy:
7777
matrix:
7878
node: [20, 22]
79-
ts: [4.4.2, 4.5.2, 4.6.2, 4.7.3, 4.8.2, 4.9.3, 5.0.4, 5.1.3, 5.2.2, 5.3.3, 5.4.2, 5.5.3, 5.6.2, 5.7.2, 5.8.2, next]
79+
ts: [5.0.4, 5.1.3, 5.2.2, 5.3.3, 5.4.2, 5.5.3, 5.6.2, 5.7.2, 5.8.2, 5.9.2, next]
8080
runs-on: windows-latest
8181
steps:
8282
- uses: actions/checkout@v3

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
# Changelog
22

3+
## 9.5.3
4+
* [chore: typescript 5.9 upgrade](https://github.com/TypeStrong/ts-loader/pull/1676) - thanks @johnnyreilly
5+
36
## 9.5.2
47
* [fix: add more detailed error messages](https://github.com/TypeStrong/ts-loader/pull/1665) - thanks @hai-x
58

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "ts-loader",
3-
"version": "9.5.2",
3+
"version": "9.5.3",
44
"description": "TypeScript loader for webpack",
55
"main": "index.js",
66
"types": "dist",
@@ -94,7 +94,7 @@
9494
"mocha": "^6.0.0",
9595
"prettier": "^2.0.5",
9696
"rimraf": "^2.6.2",
97-
"typescript": "^5.8.2",
97+
"typescript": "^5.9.2",
9898
"webpack": "^5.74.0",
9999
"webpack-cli": "^4.10.0"
100100
},

src/after-compile.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -462,7 +462,7 @@ function removeCompilationTSLoaderErrors(
462462
loaderOptions: LoaderOptions
463463
) {
464464
compilation.errors = compilation.errors.filter(
465-
error => error.details !== tsLoaderSource(loaderOptions)
465+
error => error instanceof webpack.WebpackError && error.details !== tsLoaderSource(loaderOptions)
466466
);
467467
}
468468

src/index.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -298,6 +298,7 @@ function makeLoaderOptions(
298298
const hasForkTsCheckerWebpackPlugin =
299299
loaderContext._compiler?.options.plugins.some(
300300
plugin =>
301+
plugin !== null &&
301302
typeof plugin === 'object' &&
302303
plugin.constructor?.name === 'ForkTsCheckerWebpackPlugin'
303304
);
@@ -477,7 +478,7 @@ function getEmit(
477478

478479
addDependenciesFromSolutionBuilder(instance, filePath, addDependency);
479480

480-
loaderContext._module!.buildMeta.tsLoaderDefinitionFileVersions =
481+
if (loaderContext._module && loaderContext._module.buildMeta) loaderContext._module.buildMeta.tsLoaderDefinitionFileVersions =
481482
dependencies.map(
482483
defFilePath =>
483484
path.relative(loaderContext.rootContext, defFilePath) +

src/instances.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ function successfulTypeScriptInstance(
141141
error: makeError(
142142
loaderOptions,
143143
colors.red('error while reading tsconfig.json:' + EOL + message),
144-
file
144+
file ?? ''
145145
),
146146
};
147147
}

src/watch-run.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,10 +102,14 @@ function updateFile(
102102
loader.loadModule(request, (err, source) => {
103103
if (err) {
104104
reject(err);
105-
} else {
105+
} else if (typeof source === 'string') {
106106
const text = JSON.parse(source);
107107
updateFileWithText(instance, key, filePath, () => text);
108108
resolve();
109+
} else if (Buffer.isBuffer(source)) {
110+
const text = JSON.parse(source.toString('utf8'));
111+
updateFileWithText(instance, key, filePath, () => text);
112+
resolve();
109113
}
110114
});
111115
} else {

test/comparison-tests/aliasResolution/expectedOutput-5.8/bundle.js

Lines changed: 0 additions & 67 deletions
This file was deleted.

test/comparison-tests/aliasResolution/expectedOutput-5.8/output.txt

Lines changed: 0 additions & 17 deletions
This file was deleted.

test/comparison-tests/aliasResolution/expectedOutput-5.8/patch0/bundle.js

Lines changed: 0 additions & 67 deletions
This file was deleted.

0 commit comments

Comments
 (0)