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

chore(js-utils): switch from unenv to node-stdlib-browser #2071

Conversation

NathanFlurry
Copy link
Member

Changes

Copy link
Member Author

NathanFlurry commented Feb 22, 2025

Warning

This pull request is not mergeable via GitHub because a downstack PR is open. Once all requirements are satisfied, merge this PR as a stack on Graphite.
Learn more


How to use the Graphite Merge Queue

Add the label merge-queue to this PR to add it to the merge queue.

You must have a Graphite account in order to use the merge queue. Sign up using this link.

An organization admin has enabled the Graphite Merge Queue in this repository.

Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue.

This stack of pull requests is managed by Graphite. Learn more about stacking.

Copy link

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

PR Summary

This PR transitions from unenv to node-stdlib-browser for Node.js polyfills, focusing on stream handling and browser compatibility in the JavaScript utilities.

  • Replaced unenv with node-stdlib-browser, pkg-dir, and readable-stream dependencies in /packages/toolchain/js-utils-embed/js/deno.json
  • Modified stream handling in /examples/javascript/s3-streamer/standalone_test.ts to use transformToByteArray() instead of transformToWebStream()
  • Updated S3 streaming implementation to use native Node.js streams via node:stream import
  • Added explicit version constraints for new dependencies to ensure compatibility

2 file(s) reviewed, 1 comment(s)
Edit PR Review Bot Settings | Greptile

Comment on lines +44 to 47
const webStream1 = await response.Body.transformToByteArray();
console.log("Body type", webStream1.constructor.name);
const s3Stream = Readable.from(webStream1);
const webStream = nodeStreamToWebStream(s3Stream);
Copy link

Choose a reason for hiding this comment

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

logic: transformToByteArray() loads entire response into memory at once, while transformToWebStream() streamed chunks. This could cause memory issues with large files.

Suggested change
const webStream1 = await response.Body.transformToByteArray();
console.log("Body type", webStream1.constructor.name);
const s3Stream = Readable.from(webStream1);
const webStream = nodeStreamToWebStream(s3Stream);
//const webStream1 = await response.Body.transformToByteArray();
//console.log("Body type", webStream1.constructor.name);
//const s3Stream = Readable.from(webStream1);
const webStream = nodeStreamToWebStream(Readable.from(response.Body.transformToWebStream()));

Copy link

Deploying rivet with  Cloudflare Pages  Cloudflare Pages

Latest commit: 1a1dd9a
Status:🚫  Build failed.

View logs

@NathanFlurry NathanFlurry force-pushed the 02-22-chore_js-utils_switch_from_unenv_to_node-stdlib-browser branch from 1a1dd9a to 3b2fd96 Compare February 22, 2025 12:33
@NathanFlurry NathanFlurry force-pushed the 02-22-chore_js-utils_upgrade_to_unenv_2 branch from d3808af to 3a28245 Compare February 22, 2025 12:33
Copy link
Contributor

graphite-app bot commented Feb 22, 2025

Merge activity

  • Feb 22, 7:34 AM EST: A user added this pull request to the Graphite merge queue.
  • Feb 22, 7:35 AM EST: CI is running for this PR on a draft PR: #2072
  • Feb 22, 7:36 AM EST: A user merged this pull request with the Graphite merge queue via draft PR: #2072.

graphite-app bot pushed a commit that referenced this pull request Feb 22, 2025
<!-- Please make sure there is an issue that this PR is correlated to. -->

## Changes

<!-- If there are frontend changes, please include screenshots. -->
@graphite-app graphite-app bot closed this Feb 22, 2025
@graphite-app graphite-app bot deleted the 02-22-chore_js-utils_switch_from_unenv_to_node-stdlib-browser branch February 22, 2025 12:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant