lovell / lovell/detect-libc

Fail more gracefully on partially Node.js compatible runtime environments

Open
#25 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement
Dominant language
JavaScript
Stars
78
Forks
17
PR merge metrics
No merged PRs in 30d

Description

Some JavaScript runtime environments have limitations/assumptions, for example:

"Node.js APIs are available under the node: prefix, and this prefix must be used when importing modules, both in your code and the npm packages you depend on." https://developers.cloudflare.com/workers/runtime-apis/nodejs/

We could improve support for these environments by failing more gracefully.

For example, when requireing Node.js modules, an alternative "safe require" function could be used that tries e.g. child_process then node:child_process then otherwise returns null. Failure to require a module should probably lead to APIs also returning null.

Ideally we'll be able to add an integration test for this e.g. by running Wrangler "locally" within CI.

See also https://github.com/lovell/detect-libc/pull/24 for some previous discussion.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by locating the existing Node.js module require paths and the current CI test entry points. Review the linked detect-libc discussion and test the behavior in a partially Node.js-compatible runtime; done means unsupported module imports fail gracefully and the relevant APIs return null, with an integration test if the CI setup permits it.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, node.js
Domain
backend
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.