Skip to content
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

Move initial Node.js polyfills to workerd #334

Merged
merged 1 commit into from
Jan 31, 2023

Conversation

jasnell
Copy link
Member

@jasnell jasnell commented Jan 31, 2023

@mikea the key pieces to review here are the changes to the bazel build file and the tsconfig. Everything other than the sample modifications are a straight copy of the TS files.

@jasnell jasnell requested a review from mikea January 31, 2023 16:26
@jasnell jasnell force-pushed the jsnell/move-node-polyfills-to-workerd branch from 9c86202 to c185c5e Compare January 31, 2023 16:31
@@ -30,6 +30,6 @@ wd_api_bundle(
internal_modules = dict([(
m.removesuffix(".ts") + ".js",
"node-internal:" + m.removeprefix("internal/").removesuffix(".ts"),
) for m in internal_modules]),
) for m in internal_modules if not m.endswith(".d.ts")]),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks for taking care of this.

@@ -2,7 +2,7 @@
"compilerOptions": {
"target": "ESNext",
"module": "ESNext",
"lib": [ "ESNext" ],
"lib": [ "ESNext", "DOM" ],
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

todo for myself: replace this with either smaller definition or use generated .d.ts types (preferred).

@@ -0,0 +1,17 @@
import { EventEmitter } from 'node:events';
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you can also easily add an import test to https://github.com/cloudflare/workerd/blob/main/src/workerd/api/node/node-test.c%2B%2B (maybe for async context?)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, I'll be porting the tests we have in the internal ew-test files out to here separately

@jasnell jasnell force-pushed the jsnell/move-node-polyfills-to-workerd branch from c185c5e to f58fa07 Compare January 31, 2023 17:35
@jasnell jasnell merged commit aec2171 into main Jan 31, 2023
@jasnell jasnell deleted the jsnell/move-node-polyfills-to-workerd branch January 31, 2023 20:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants