Skip to content

Commit

Permalink
Preserve node: protocol (#1932)
Browse files Browse the repository at this point in the history
Node protocol removal was introduced here for CJS:
egoist/tsup#460

The target was set to `es2022` which does not explicitly address Node,
therefore it was removed for ESM too.

Setting the target to `node18.18.0` enabled the protocol for ESM.

The recently added setting allows also to enable it for CJS:

egoist/tsup@e7ced34

This will certainly not work in Node below 14.18, but it should not
anyway.
  • Loading branch information
RobinTail authored Jul 23, 2024
1 parent 81f14a9 commit eaf019d
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 2 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@

## Version 20

### v20.4.1

- Technical update due to improved builder configuration:
- Removed crutches for the `migration/index.d.cts` file;
- Fixed missing `node:` protocol in the imports of core modules in the distributed javascript files.

### v20.4.0

- Feat: middleware testing helper: `testMiddleware()`, similar to `testEndpoint()`:
Expand Down
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,7 @@
"@types/http-errors": "^2.0.2",
"@types/node": "^20.8.4",
"@types/ramda": "^0.30.0",
"@types/semver": "^7.5.8",
"@types/swagger-ui-express": "^4.1.6",
"@types/triple-beam": "^1.3.2",
"@vitest/coverage-istanbul": "^2.0.3",
Expand All @@ -145,6 +146,7 @@
"make-coverage-badge": "^1.2.0",
"mockdate": "^3.0.5",
"prettier": "3.3.3",
"semver": "^7.6.3",
"snakify-ts": "^2.3.0",
"swagger-ui-express": "^5.0.0",
"tsup": "^8.0.0",
Expand Down
7 changes: 6 additions & 1 deletion tsup.config.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
import { defineConfig, Options } from "tsup";
import { version } from "./package.json";
import { version, engines } from "./package.json";
import semver from "semver";

const minNode = semver.minVersion(engines.node)!;

const commons: Options = {
format: ["cjs", "esm"],
Expand All @@ -8,6 +11,8 @@ const commons: Options = {
clean: true,
dts: true,
minify: true,
target: `node${minNode.major}.${minNode.minor}.${minNode.patch}`,
removeNodeProtocol: false, // @todo will be default in v9
};

export default defineConfig([
Expand Down
7 changes: 6 additions & 1 deletion yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -815,6 +815,11 @@
resolved "https://registry.yarnpkg.com/@types/range-parser/-/range-parser-1.2.7.tgz#50ae4353eaaddc04044279812f52c8c65857dbcb"
integrity sha512-hKormJbkJqzQGhziax5PItDUTMAM9uE2XXQmM37dyd4hVM+5aVl7oVxMVUiVQn2oCQFN/LKCZdvSM0pFRqbSmQ==

"@types/semver@^7.5.8":
version "7.5.8"
resolved "https://registry.yarnpkg.com/@types/semver/-/semver-7.5.8.tgz#8268a8c57a3e4abd25c165ecd36237db7948a55e"
integrity sha512-I8EUhyrgfLrcTkzV3TSsGyl1tSuPrEDzr0yd5m90UgNxQkyDXULk3b6MlQqTCpZpNtWe1K0hzclnZkTcLBe2UQ==

"@types/send@*":
version "0.17.4"
resolved "https://registry.yarnpkg.com/@types/send/-/send-0.17.4.tgz#6619cd24e7270793702e4e6a4b958a9010cfc57a"
Expand Down Expand Up @@ -3164,7 +3169,7 @@ semver@^6.3.1:
resolved "https://registry.yarnpkg.com/semver/-/semver-6.3.1.tgz#556d2ef8689146e46dcea4bfdd095f3434dffcb4"
integrity sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA==

semver@^7.5.3, semver@^7.5.4, semver@^7.6.0, semver@^7.6.1:
semver@^7.5.3, semver@^7.5.4, semver@^7.6.0, semver@^7.6.1, semver@^7.6.3:
version "7.6.3"
resolved "https://registry.yarnpkg.com/semver/-/semver-7.6.3.tgz#980f7b5550bc175fb4dc09403085627f9eb33143"
integrity sha512-oVekP1cKtI+CTDvHWYFUcMtsK/00wmAEfyqKfNdARm8u1wNVhSgaX7A8d4UuIlUI5e84iEwOhs7ZPYRmzU9U6A==
Expand Down

0 comments on commit eaf019d

Please sign in to comment.