Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions docs/modules/cli-builders.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ description: Modern alternatives to packages for building CLI applications
[`sade`](https://github.com/lukeed/sade) is a small but powerful tool for building CLI applications for Node.js

```ts
import process from 'node:process'
import sade from 'sade'

const prog = sade('my-cli')
Expand Down
1 change: 1 addition & 0 deletions docs/modules/dotenv.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ It throws if the file is missing. Defaults to `.env` in the current working dire

```ts
import dotenv from 'dotenv' // [!code --]
import process from 'node:process' // [!code ++]

dotenv.config({ path: '.env' }) // [!code --]
process.loadEnvFile('.env') // [!code ++]
Expand Down
1 change: 1 addition & 0 deletions docs/modules/fast-glob.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ Example:
```ts
import fg from 'fast-glob' // [!code --]
import { glob } from 'tinyglobby' // [!code ++]
import process from 'node:process'

const files = await fg('**/*.ts', { // [!code --]
const files = await glob('**/*.ts', { // [!code ++]
Expand Down
4 changes: 4 additions & 0 deletions docs/modules/get-stream.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ description: Modern alternatives to the get-stream package
You can convert a stream to a string by using `Buffer.from` and a `for await`:

```ts
import { Buffer } from 'node:buffer'

async function streamToString(stream) {
const chunks = []
for await (const chunk of stream) {
Expand Down Expand Up @@ -41,6 +43,8 @@ async function streamToArray(stream) {
You can convert a stream to a `Buffer` using [`Array.fromAsync`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/fromAsync) with a mapper:

```ts
import { Buffer } from 'node:buffer'

async function streamToBuffer(stream) {
const chunks = await Array.fromAsync(stream, (chunk) => Buffer.from(chunk))
return Buffer.concat(chunks)
Expand Down
1 change: 1 addition & 0 deletions docs/modules/globby.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ If you don’t need `.gitignore` handling, prefer [`tinyglobby`](https://github.

```ts
import { execSync } from 'node:child_process'
import process from 'node:process'
import { glob, escapePath } from 'tinyglobby'

async function globWithGitignore(patterns, options = {}) {
Expand Down
1 change: 1 addition & 0 deletions docs/modules/is-path-in-cwd.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ description: Native alternatives to the is-path-in-cwd package for checking whet

```ts
import path from 'node:path'
import process from 'node:process'

const isPathInside = (childPath, parentPath) => {
const relation = path.relative(parentPath, childPath)
Expand Down
1 change: 1 addition & 0 deletions docs/modules/node-telegram-bot-api.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ description: Modern alternatives to the node-telegram-bot-api package
Example:

```ts
import process from 'node:process'
import { Bot } from 'grammy'

const bot = new Bot(process.env.TOKEN)
Expand Down
2 changes: 2 additions & 0 deletions docs/modules/parseargs.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ description: Modern alternatives to CLI argument parsing packages using Node.js
Example:

```ts
import process from 'node:process'
import { parseArgs } from 'node:util'

const { values, positionals } = parseArgs({
Expand All @@ -33,6 +34,7 @@ const { values, positionals } = parseArgs({
Example:

```ts
import process from 'node:process'
import mri from 'mri'

const options = mri(process.argv.slice(2), {
Expand Down
1 change: 1 addition & 0 deletions docs/modules/resolve.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ const path = resolveModulePath('my-module')
[`oxc-resolver`](https://github.com/oxc-project/oxc-resolver)

```ts
import process from 'node:process'
import { ResolverFactory } from 'oxc-resolver'

const resolver = new ResolverFactory()
Expand Down
2 changes: 2 additions & 0 deletions docs/modules/stream-buffers.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ Push data over time example:

```ts
import streamBuffers from 'stream-buffers' // [!code --]
import { Buffer } from 'node:buffer'
import { Readable } from 'node:stream' // [!code ++]

const rs = new streamBuffers.ReadableStreamBuffer() // [!code --]
Expand All @@ -62,6 +63,7 @@ Control chunk size and frequency example:

<!-- prettier-ignore -->
```ts
import { Buffer } from 'node:buffer'
import streamBuffers from 'stream-buffers' // [!code --]
import { Readable } from 'node:stream' // [!code ++]
import { setTimeout } from 'node:timers/promises' // [!code ++]
Expand Down
4 changes: 4 additions & 0 deletions manifests/preferred.json
Original file line number Diff line number Diff line change
Expand Up @@ -3666,6 +3666,10 @@
"process.loadEnvFile": {
"id": "process.loadEnvFile",
"type": "native",
"nodeFeatureId": {
"moduleName": "node:process",
"exportName": "loadEnvFile"
},
"url": {"type": "node", "id": "api/process.html#processloadenvfilepath"}
},
"react-helmet-async": {
Expand Down
Loading