Skip to content

Commit 7da05b1

Browse files
committed
Build node-fetch-server using esbuild
1 parent b8cc8b6 commit 7da05b1

File tree

6 files changed

+37
-33
lines changed

6 files changed

+37
-33
lines changed

packages/node-fetch-server/.npmignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# Ignore test files within the src directory
2+
src/**/*.test.ts

packages/node-fetch-server/CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,12 @@
22

33
This is the changelog for [`node-fetch-server`](https://github.com/mjackson/remix-the-web/tree/main/packages/node-fetch-server). It follows [semantic versioning](https://semver.org/).
44

5+
## HEAD
6+
7+
- Add `/src` to npm package, so "go to definition" goes to the actual source
8+
- Use one set of types for all built files, instead of separate types for ESM and CJS
9+
- Build using esbuild directly instead of tsup
10+
511
## v0.6.1 (2025-02-07)
612

713
- Update typings and docs for http2 support

packages/node-fetch-server/package.json

Lines changed: 15 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -11,41 +11,35 @@
1111
"homepage": "https://github.com/mjackson/remix-the-web/tree/main/packages/node-fetch-server#readme",
1212
"license": "MIT",
1313
"files": [
14-
"dist",
1514
"LICENSE",
16-
"README.md"
15+
"README.md",
16+
"dist",
17+
"src"
1718
],
1819
"type": "module",
1920
"types": "./dist/node-fetch-server.d.ts",
20-
"main": "./dist/node-fetch-server.js",
21+
"module": "./dist/node-fetch-server.js",
22+
"main": "./dist/node-fetch-server.cjs",
2123
"exports": {
2224
".": {
23-
"module-sync": {
24-
"types": "./dist/node-fetch-server.d.ts",
25-
"default": "./dist/node-fetch-server.js"
26-
},
27-
"import": {
28-
"types": "./dist/node-fetch-server.d.ts",
29-
"default": "./dist/node-fetch-server.js"
30-
},
31-
"require": {
32-
"types": "./dist/node-fetch-server.d.cts",
33-
"default": "./dist/node-fetch-server.cjs"
34-
},
35-
"default": {
36-
"types": "./dist/node-fetch-server.d.ts",
37-
"default": "./dist/node-fetch-server.js"
38-
}
25+
"types": "./dist/node-fetch-server.d.ts",
26+
"import": "./dist/node-fetch-server.js",
27+
"require": "./dist/node-fetch-server.cjs",
28+
"default": "./dist/node-fetch-server.js"
3929
},
4030
"./package.json": "./package.json"
4131
},
4232
"devDependencies": {
4333
"@types/node": "^22.5.0",
44-
"tsup": "^8.3.5"
34+
"esbuild": "^0.20.2"
4535
},
4636
"scripts": {
4737
"bench": "bash ./bench/runner.sh",
48-
"build": "tsup",
38+
"build:types": "tsc --project tsconfig.build.json",
39+
"build:esm": "esbuild src/node-fetch-server.ts --bundle --outfile=dist/node-fetch-server.js --format=esm --platform=node --sourcemap",
40+
"build:cjs": "esbuild src/node-fetch-server.ts --bundle --outfile=dist/node-fetch-server.cjs --format=cjs --platform=node --sourcemap",
41+
"build": "pnpm run build:types && pnpm run build:esm && pnpm run build:cjs",
42+
"clean": "rm -rf dist",
4943
"test": "node --experimental-strip-types --disable-warning=ExperimentalWarning --test ./src/**/*.test.ts",
5044
"prepublishOnly": "pnpm run build"
5145
},
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"extends": "./tsconfig.json",
3+
"compilerOptions": {
4+
"declaration": true,
5+
"emitDeclarationOnly": true,
6+
"declarationMap": true,
7+
"outDir": "./dist"
8+
},
9+
"include": ["src"],
10+
"exclude": ["src/**/*.test.ts"]
11+
}

packages/node-fetch-server/tsup.config.ts

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

pnpm-lock.yaml

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)