Skip to content

Commit 4dcd797

Browse files
committed
fix: avoid package json module import in runtime code of the framework.
1 parent ed9990b commit 4dcd797

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

express-zod-api/src/server-helpers.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@ import { lastResortHandler } from "./last-resort.ts";
99
import { ResultHandlerError } from "./errors.ts";
1010
import { ensureError } from "./common-helpers.ts";
1111
import { monitor } from "./graceful-shutdown.ts";
12-
import manifest from "../package.json" with { type: "json" };
1312

14-
export const localsID = Symbol.for(manifest.name);
13+
// eslint-disable-next-line no-restricted-syntax -- substituted by TSDOWN
14+
export const localsID = Symbol.for(process.env.TSDOWN_SELF!);
1515

1616
type EquippedRequest = Request<
1717
unknown,

express-zod-api/tsdown.config.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ export default defineConfig({
66
minify: true,
77
attw: { profile: "esmOnly", level: "error" },
88
define: {
9+
"process.env.TSDOWN_SELF": `"${manifest.name}"`, // used by localsID
910
"process.env.TSDOWN_BUILD": `"v${manifest.version}"`, // @since v25.0.0 is pure ESM
1011
"process.env.TSDOWN_STATIC": `"static"`, // used by isProduction()
1112
},

0 commit comments

Comments
 (0)