Skip to content

Commit fb4e567

Browse files
raman325claude
andcommitted
fix: use createRequire instead of import attributes for JSON import
Avoids Node version compatibility issues with `with { type: "json" }` (Node 22+) vs `assert { type: "json" }` (deprecated, errors on Node 22+). Uses the same createRequire pattern already established in const.ts and server.ts. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent d5eb561 commit fb4e567

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/lib/introspect/message_handler.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,13 @@
1+
import { createRequire } from "node:module";
12
import { UnknownCommandError } from "../error.js";
2-
import incomingMessageSchema from "../generated/incoming_message_schema.json" with { type: "json" };
33
import { MessageHandler } from "../message_handler.js";
44
import { IntrospectCommand } from "./command.js";
55
import { IncomingMessageIntrospect } from "./incoming_message.js";
66
import { IntrospectResultTypes } from "./outgoing_message.js";
77

8+
const require = createRequire(import.meta.url);
9+
const incomingMessageSchema = require("../generated/incoming_message_schema.json");
10+
811
export class IntrospectMessageHandler implements MessageHandler {
912
async handle(
1013
message: IncomingMessageIntrospect,

0 commit comments

Comments
 (0)