-
Notifications
You must be signed in to change notification settings - Fork 975
Import Buffer
from node:buffer
explicitly
#349
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
3fa9f5a
to
7dd336c
Compare
Buffer
from node:buffer
explicitlyBuffer
from node:buffer
explicitly
7dd336c
to
2ea8cf7
Compare
2ea8cf7
to
36c9f74
Compare
I tested this with Deno and it worked. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for your contribution and sorry for the delays in PR reviews. Importing type seems off in stdio
, please can you check?
@@ -1,3 +1,4 @@ | |||
import type { Buffer } from "node:buffer"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why this import type?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
probably because it's only used as type in https://github.com/lacolaco/mcp-typescript-sdk/blob/import-node-buffer/src/server/stdio.ts#L27
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Exactly. In this file Buffer
is referred only as an argument type.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it's also used directly. this._readBuffer.append(chunk)
How its been tested?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That ReadBuffer
you mention is imported from shared/stdio.js
, which is modified to use node:buffer
.
What this Issue is concerned with and resolves is a direct reference to the global variable Buffer
. It is fine if the object of type Buffer is derived from node:buffer
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is there a way to add a test to prevent regressions?
Import
Buffer
fromnode:buffer
explicitly to get deno-compatibility.Motivation and Context
How Has This Been Tested?
npm run build
andnpm test
Breaking Changes
No
Types of changes
Checklist
Additional context