Skip to content

Commit 2ff3044

Browse files
committed
Upgrade to TypeScript 5.7.2
Also, use node's built-in type stripping instead of @swc-node/register. Also, add support for node:test runner VS Code plugin.
1 parent c46c3d1 commit 2ff3044

File tree

94 files changed

+243
-603
lines changed

Some content is hidden

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

94 files changed

+243
-603
lines changed

.vscode/settings.json

+8-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
11
{
2-
"deno.enablePaths": ["./packages/multipart-parser/examples/deno"]
2+
"deno.enablePaths": ["./packages/multipart-parser/examples/deno"],
3+
"nodejs-testing.extensions": [
4+
{
5+
"extensions": ["ts"],
6+
"parameters": ["--experimental-strip-types", "--disable-warning=ExperimentalWarning"]
7+
}
8+
],
9+
"typescript.tsdk": "node_modules/typescript/lib"
310
}

package.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@
33
"private": true,
44
"packageManager": "[email protected]",
55
"devDependencies": {
6-
"prettier": "^3.3.3"
6+
"prettier": "^3.3.3",
7+
"typescript": "^5.7.2"
78
},
89
"engines": {
910
"node": ">=22"

packages/fetch-proxy/package.json

+2-4
Original file line numberDiff line numberDiff line change
@@ -43,14 +43,12 @@
4343
"@mjackson/headers": "workspace:^"
4444
},
4545
"devDependencies": {
46-
"@swc-node/register": "^1.10.9",
4746
"@types/node": "^20.14.10",
48-
"tsup": "^8.3.5",
49-
"typescript": "^5.6.3"
47+
"tsup": "^8.3.5"
5048
},
5149
"scripts": {
5250
"build": "tsup",
53-
"test": "node --import @swc-node/register/esm-register --test ./src/**/*.spec.ts",
51+
"test": "node --experimental-strip-types --disable-warning=ExperimentalWarning --test ./src/**/*.test.ts",
5452
"prepare": "pnpm run build"
5553
},
5654
"keywords": [
+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
export { type FetchProxyOptions, type FetchProxy, createFetchProxy } from './lib/fetch-proxy.js';
1+
export { type FetchProxyOptions, type FetchProxy, createFetchProxy } from './lib/fetch-proxy.ts';

packages/fetch-proxy/src/lib/fetch-proxy.spec.ts renamed to packages/fetch-proxy/src/lib/fetch-proxy.test.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import * as assert from 'node:assert/strict';
22
import { describe, it } from 'node:test';
33

4-
import { FetchProxyOptions, createFetchProxy } from './fetch-proxy.js';
4+
import { type FetchProxyOptions, createFetchProxy } from './fetch-proxy.ts';
55

66
async function runProxy(
77
request: Request,

packages/fetch-proxy/tsconfig.json

+8-4
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,12 @@
11
{
22
"compilerOptions": {
3-
"lib": ["DOM", "ES2020"],
4-
"module": "NodeNext",
5-
"moduleResolution": "NodeNext",
6-
"strict": true
3+
"strict": true,
4+
"lib": ["DOM", "DOM.Iterable", "ES2020"],
5+
"module": "ES2022",
6+
"moduleResolution": "Bundler",
7+
"target": "ESNext",
8+
"allowImportingTsExtensions": true,
9+
"rewriteRelativeImportExtensions": true,
10+
"verbatimModuleSyntax": true
711
}
812
}

packages/fetch-proxy/tsconfig.lib.json

-9
This file was deleted.

packages/fetch-proxy/tsconfig.spec.json

-7
This file was deleted.

packages/file-storage/package.json

+2-4
Original file line numberDiff line numberDiff line change
@@ -79,14 +79,12 @@
7979
"@mjackson/lazy-file": "workspace:^"
8080
},
8181
"devDependencies": {
82-
"@swc-node/register": "^1.10.9",
8382
"@types/node": "^20.14.10",
84-
"tsup": "^8.3.5",
85-
"typescript": "^5.6.3"
83+
"tsup": "^8.3.5"
8684
},
8785
"scripts": {
8886
"build": "tsup",
89-
"test": "node --import @swc-node/register/esm-register --test ./src/**/*.spec.ts",
87+
"test": "node --experimental-strip-types --disable-warning=ExperimentalWarning --test ./src/**/*.test.ts",
9088
"prepare": "pnpm run build"
9189
},
9290
"keywords": [

packages/file-storage/src/lib/local-file-storage.spec.ts renamed to packages/file-storage/src/lib/local-file-storage.test.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { after, describe, it } from 'node:test';
33
import * as fs from 'node:fs';
44
import * as path from 'node:path';
55

6-
import { LocalFileStorage } from './local-file-storage.js';
6+
import { LocalFileStorage } from './local-file-storage.ts';
77

88
const __dirname = new URL('.', import.meta.url).pathname;
99

packages/file-storage/src/lib/local-file-storage.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import * as fsp from 'node:fs/promises';
33
import * as path from 'node:path';
44
import { openFile, writeFile } from '@mjackson/lazy-file/fs';
55

6-
import { FileStorage } from './file-storage.js';
6+
import { type FileStorage } from './file-storage.ts';
77

88
/**
99
* A `FileStorage` that is backed by the local filesystem.

packages/file-storage/src/lib/memory-file-storage.spec.ts renamed to packages/file-storage/src/lib/memory-file-storage.test.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import * as assert from 'node:assert/strict';
22
import { describe, it } from 'node:test';
33

4-
import { MemoryFileStorage } from './memory-file-storage.js';
4+
import { MemoryFileStorage } from './memory-file-storage.ts';
55

66
describe('MemoryFileStorage', () => {
77
it('stores and retrieves files', async () => {

packages/file-storage/src/lib/memory-file-storage.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { FileStorage } from './file-storage.js';
1+
import { type FileStorage } from './file-storage.ts';
22

33
/**
44
* A simple, in-memory implementation of the `FileStorage` interface.

packages/file-storage/tsconfig.json

+8-4
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,12 @@
11
{
22
"compilerOptions": {
3-
"lib": ["DOM", "ES2020"],
4-
"module": "NodeNext",
5-
"moduleResolution": "NodeNext",
6-
"strict": true
3+
"strict": true,
4+
"lib": ["DOM", "DOM.Iterable", "ES2020"],
5+
"module": "ES2022",
6+
"moduleResolution": "Bundler",
7+
"target": "ESNext",
8+
"allowImportingTsExtensions": true,
9+
"rewriteRelativeImportExtensions": true,
10+
"verbatimModuleSyntax": true
711
}
812
}

packages/file-storage/tsconfig.lib.json

-9
This file was deleted.

packages/file-storage/tsconfig.spec.json

-8
This file was deleted.

packages/form-data-parser/package.json

+2-4
Original file line numberDiff line numberDiff line change
@@ -43,14 +43,12 @@
4343
"@mjackson/multipart-parser": "workspace:^"
4444
},
4545
"devDependencies": {
46-
"@swc-node/register": "^1.10.9",
4746
"@types/node": "^22.4.1",
48-
"tsup": "^8.3.5",
49-
"typescript": "^5.6.3"
47+
"tsup": "^8.3.5"
5048
},
5149
"scripts": {
5250
"build": "tsup",
53-
"test": "node --import @swc-node/register/esm-register --test ./src/**/*.spec.ts",
51+
"test": "node --experimental-strip-types --disable-warning=ExperimentalWarning --test ./src/**/*.test.ts",
5452
"prepare": "pnpm run build"
5553
},
5654
"keywords": [
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
export { FileUpload, type FileUploadHandler, parseFormData } from './lib/form-data.js';
1+
export { FileUpload, type FileUploadHandler, parseFormData } from './lib/form-data.ts';

packages/form-data-parser/src/lib/form-data.spec.ts renamed to packages/form-data-parser/src/lib/form-data.test.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import * as assert from 'node:assert/strict';
22
import { describe, it, mock } from 'node:test';
33

4-
import { FileUploadHandler, parseFormData } from './form-data.js';
4+
import { type FileUploadHandler, parseFormData } from './form-data.ts';
55

66
describe('parseFormData', () => {
77
it('parses a application/x-www-form-urlencoded request', async () => {

packages/form-data-parser/src/lib/form-data.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import {
22
isMultipartRequest,
33
parseMultipartRequest,
4-
MultipartParserOptions,
4+
type MultipartParserOptions,
55
MultipartPart,
66
} from '@mjackson/multipart-parser';
77

+8-4
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,12 @@
11
{
22
"compilerOptions": {
3-
"lib": ["DOM", "ES2020"],
4-
"module": "NodeNext",
5-
"moduleResolution": "NodeNext",
6-
"strict": true
3+
"strict": true,
4+
"lib": ["DOM", "DOM.Iterable", "ES2020"],
5+
"module": "ES2022",
6+
"moduleResolution": "Bundler",
7+
"target": "ESNext",
8+
"allowImportingTsExtensions": true,
9+
"rewriteRelativeImportExtensions": true,
10+
"verbatimModuleSyntax": true
711
}
812
}

packages/form-data-parser/tsconfig.lib.json

-9
This file was deleted.

packages/form-data-parser/tsconfig.spec.json

-8
This file was deleted.

packages/headers/package.json

+2-4
Original file line numberDiff line numberDiff line change
@@ -40,14 +40,12 @@
4040
"./package.json": "./package.json"
4141
},
4242
"devDependencies": {
43-
"@swc-node/register": "^1.10.9",
4443
"@types/node": "^20.14.10",
45-
"tsup": "^8.3.5",
46-
"typescript": "^5.6.3"
44+
"tsup": "^8.3.5"
4745
},
4846
"scripts": {
4947
"build": "tsup",
50-
"test": "node --import @swc-node/register/esm-register --test ./src/**/*.spec.ts",
48+
"test": "node --experimental-strip-types --disable-warning=ExperimentalWarning --test ./src/**/*.test.ts",
5149
"prepare": "pnpm run build"
5250
},
5351
"keywords": [

packages/headers/src/headers.ts

+11-7
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,12 @@
1-
export { AcceptLanguageInit, AcceptLanguage } from './lib/accept-language.js';
2-
export { CacheControlInit, CacheControl } from './lib/cache-control.js';
3-
export { ContentDispositionInit, ContentDisposition } from './lib/content-disposition.js';
4-
export { ContentTypeInit, ContentType } from './lib/content-type.js';
5-
export { CookieInit, Cookie } from './lib/cookie.js';
6-
export { SetCookieInit, SetCookie } from './lib/set-cookie.js';
1+
export { type AcceptLanguageInit, AcceptLanguage } from './lib/accept-language.ts';
2+
export { type CacheControlInit, CacheControl } from './lib/cache-control.ts';
3+
export { type ContentDispositionInit, ContentDisposition } from './lib/content-disposition.ts';
4+
export { type ContentTypeInit, ContentType } from './lib/content-type.ts';
5+
export { type CookieInit, Cookie } from './lib/cookie.ts';
6+
export { type SetCookieInit, SetCookie } from './lib/set-cookie.ts';
77

8-
export { SuperHeaders as default, SuperHeadersInit, SuperHeaders } from './lib/super-headers.js';
8+
export {
9+
type SuperHeadersInit,
10+
SuperHeaders,
11+
SuperHeaders as default,
12+
} from './lib/super-headers.ts';

packages/headers/src/lib/accept-language.spec.ts renamed to packages/headers/src/lib/accept-language.test.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import * as assert from 'node:assert/strict';
22
import { describe, it } from 'node:test';
33

4-
import { AcceptLanguage } from './accept-language.js';
4+
import { AcceptLanguage } from './accept-language.ts';
55

66
describe('Accept-Language', () => {
77
it('initializes with an empty string', () => {

packages/headers/src/lib/accept-language.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
import { HeaderValue } from './header-value.js';
2-
import { parseParams } from './param-values.js';
3-
import { isIterable } from './utils.js';
1+
import { type HeaderValue } from './header-value.ts';
2+
import { parseParams } from './param-values.ts';
3+
import { isIterable } from './utils.ts';
44

55
export type AcceptLanguageInit =
66
| Iterable<string | [string] | [string, number | undefined]>

packages/headers/src/lib/cache-control.spec.ts renamed to packages/headers/src/lib/cache-control.test.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import * as assert from 'node:assert/strict';
22
import { describe, it } from 'node:test';
33

4-
import { CacheControl } from './cache-control.js';
4+
import { CacheControl } from './cache-control.ts';
55

66
describe('CacheControl', () => {
77
it('initializes with an empty string', () => {

packages/headers/src/lib/cache-control.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import { HeaderValue } from './header-value.js';
2-
import { parseParams } from './param-values.js';
1+
import { type HeaderValue } from './header-value.ts';
2+
import { parseParams } from './param-values.ts';
33

44
// Taken from https://github.com/jjenzz/pretty-cache-header by jjenzz
55
// License: MIT https://github.com/jjenzz/pretty-cache-header/blob/main/LICENSE

packages/headers/src/lib/content-disposition.spec.ts renamed to packages/headers/src/lib/content-disposition.test.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import * as assert from 'node:assert/strict';
22
import { describe, it } from 'node:test';
33

4-
import { ContentDisposition } from './content-disposition.js';
4+
import { ContentDisposition } from './content-disposition.ts';
55

66
describe('ContentDisposition', () => {
77
it('initializes with an empty string', () => {

packages/headers/src/lib/content-disposition.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import { HeaderValue } from './header-value.js';
2-
import { parseParams, quote } from './param-values.js';
1+
import { type HeaderValue } from './header-value.ts';
2+
import { parseParams, quote } from './param-values.ts';
33

44
export interface ContentDispositionInit {
55
/**

packages/headers/src/lib/content-type.spec.ts renamed to packages/headers/src/lib/content-type.test.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import * as assert from 'node:assert/strict';
22
import { describe, it } from 'node:test';
33

4-
import { ContentType } from './content-type.js';
4+
import { ContentType } from './content-type.ts';
55

66
describe('ContentType', () => {
77
it('initializes with an empty string', () => {

packages/headers/src/lib/content-type.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import { HeaderValue } from './header-value.js';
2-
import { parseParams, quote } from './param-values.js';
1+
import { type HeaderValue } from './header-value.ts';
2+
import { parseParams, quote } from './param-values.ts';
33

44
export interface ContentTypeInit {
55
/**

packages/headers/src/lib/cookie.spec.ts renamed to packages/headers/src/lib/cookie.test.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import * as assert from 'node:assert/strict';
22
import { describe, it } from 'node:test';
33

4-
import { Cookie } from './cookie.js';
4+
import { Cookie } from './cookie.ts';
55

66
describe('Cookie', () => {
77
it('initializes with an empty string', () => {

packages/headers/src/lib/cookie.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
import { HeaderValue } from './header-value.js';
2-
import { parseParams, quote } from './param-values.js';
3-
import { isIterable } from './utils.js';
1+
import { type HeaderValue } from './header-value.ts';
2+
import { parseParams, quote } from './param-values.ts';
3+
import { isIterable } from './utils.ts';
44

55
export type CookieInit = Iterable<[string, string]> | Record<string, string>;
66

packages/headers/src/lib/header-names.spec.ts renamed to packages/headers/src/lib/header-names.test.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import * as assert from 'node:assert/strict';
22
import { describe, it } from 'node:test';
33

4-
import { canonicalHeaderName } from './header-names.js';
4+
import { canonicalHeaderName } from './header-names.ts';
55

66
describe('normalizeHeaderName', () => {
77
it('handles common headers correctly', () => {

packages/headers/src/lib/param-values.spec.ts renamed to packages/headers/src/lib/param-values.test.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import * as assert from 'node:assert/strict';
22
import { describe, it } from 'node:test';
33

4-
import { parseParams } from './param-values.js';
4+
import { parseParams } from './param-values.ts';
55

66
describe('parseParams', () => {
77
it('correctly parses a string of parameters for a Content-Type header', () => {

packages/headers/src/lib/set-cookie.spec.ts renamed to packages/headers/src/lib/set-cookie.test.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import * as assert from 'node:assert/strict';
22
import { describe, it } from 'node:test';
33

4-
import { SetCookie } from './set-cookie.js';
4+
import { SetCookie } from './set-cookie.ts';
55

66
describe('SetCookie', () => {
77
it('initializes with an empty string', () => {

0 commit comments

Comments
 (0)