Skip to content

docs: import process and Buffer instead of using globals - #1145

Merged
43081j merged 2 commits into
e18e:mainfrom
unrevised6419:docs/import-node-globals
Oct 5, 2026
Merged

43081j merged 2 commits into
e18e:mainfrom
unrevised6419:docs/import-node-globals

Conversation

@unrevised6419

@unrevised6419 unrevised6419 commented Oct 5, 2026 •

Copy link
Copy Markdown
Contributor

🔗 Linked issue

Resolves #1144

📚 Description

Code examples now import Node.js built-ins explicitly instead of relying on globals, as proposed in #1144.

  • process: added import process from 'node:process' to the examples in dotenv, globby, fast-glob, resolve, is-path-in-cwd, parseargs, cli-builders and node-telegram-bot-api. The process.* calls themselves are unchanged.
  • Buffer: added import { Buffer } from 'node:buffer' to get-stream and stream-buffers, matching the docs that already import it.
  • manifests/preferred.json: added nodeFeatureId (node:process / loadEnvFile) to process.loadEnvFile, like the Buffer entries.

Left as is: prose mentions of process.cwd() etc., the node -e one-liner in rimraf.md, and the short example snippets in manifests/micro-utilities.json (see review discussion).

🤖 Generated with Claude Code

Examples in docs and micro-utility snippets now import `process` from
`node:process` and `Buffer` from `node:buffer` rather than relying on
Node.js globals. Also adds a `nodeFeatureId` to `process.loadEnvFile`.

Refs e18e#1144

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@43081j

43081j commented Oct 5, 2026

Copy link
Copy Markdown
Contributor

i'm not sure if we should update the micro-utilities examples (in the manifest itself). those examples are meant to be used in places that want to hint at the fix rather than give an exhaustive one (e.g. npmx, maybe ESLint output, etc.).

so its probably fine to leave it out there as people can infer it means node:process.

@ghostdevv what do you think?

Per review, the micro-utility examples are meant as hints for tools
like npmx or ESLint output, so they keep using the globals.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@unrevised6419

Copy link
Copy Markdown
Contributor Author

Makes sense, I dropped the micro-utilities.json changes in 50a99fe, so those snippets keep their short form. The PR now only touches the docs and adds a nodeFeatureId to process.loadEnvFile.

@43081j
43081j merged commit 9ac2dfb into e18e:main Oct 5, 2026
5 checks passed
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.

Docs: import Node.js built-ins instead of using process / Buffer globals in examples

2 participants