Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nodejs/node.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaeyeon Jeong <daeyeon.dev@gmail.com>2022-11-06 00:53:23 +0300
committerGitHub <noreply@github.com>2022-11-06 00:53:23 +0300
commit11ffb7e2974f321d8253d8631dc7497e16e0fdef (patch)
tree9945363ddf8de7267fbe4c777e40cfea6f4fde35
parent28bf0317c2e2e745f38275d930e3ead9e301ee1a (diff)
doc: add `node:` prefix for examples
Core modules are currently distinguished with the `node:` prefix. This updates a few examples in docs to use the prefix for consistency. Signed-off-by: Daeyeon Jeong <daeyeon.dev@gmail.com> PR-URL: https://github.com/nodejs/node/pull/45328 Reviewed-By: Michaƫl Zasso <targos@protonmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com> Reviewed-By: Filip Skokan <panva.ip@gmail.com> Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com>
-rw-r--r--doc/api/diagnostics_channel.md8
-rw-r--r--doc/api/v8.md10
-rw-r--r--doc/api/webstreams.md4
3 files changed, 11 insertions, 11 deletions
diff --git a/doc/api/diagnostics_channel.md b/doc/api/diagnostics_channel.md
index 25dac82b116..019fe9a6614 100644
--- a/doc/api/diagnostics_channel.md
+++ b/doc/api/diagnostics_channel.md
@@ -173,7 +173,7 @@ will be run synchronously whenever a message is published to the channel. Any
errors thrown in the message handler will trigger an [`'uncaughtException'`][].
```mjs
-import diagnostics_channel from 'diagnostics_channel';
+import diagnostics_channel from 'node:diagnostics_channel';
diagnostics_channel.subscribe('my-channel', (message, name) => {
// Received data
@@ -181,7 +181,7 @@ diagnostics_channel.subscribe('my-channel', (message, name) => {
```
```cjs
-const diagnostics_channel = require('diagnostics_channel');
+const diagnostics_channel = require('node:diagnostics_channel');
diagnostics_channel.subscribe('my-channel', (message, name) => {
// Received data
@@ -204,7 +204,7 @@ Remove a message handler previously registered to this channel with
[`diagnostics_channel.subscribe(name, onMessage)`][].
```mjs
-import diagnostics_channel from 'diagnostics_channel';
+import diagnostics_channel from 'node:diagnostics_channel';
function onMessage(message, name) {
// Received data
@@ -216,7 +216,7 @@ diagnostics_channel.unsubscribe('my-channel', onMessage);
```
```cjs
-const diagnostics_channel = require('diagnostics_channel');
+const diagnostics_channel = require('node:diagnostics_channel');
function onMessage(message, name) {
// Received data
diff --git a/doc/api/v8.md b/doc/api/v8.md
index ec167ffcfb6..ed63f44f01b 100644
--- a/doc/api/v8.md
+++ b/doc/api/v8.md
@@ -923,17 +923,17 @@ contains the following script:
```cjs
'use strict';
-const fs = require('fs');
-const zlib = require('zlib');
-const path = require('path');
-const assert = require('assert');
+const fs = require('node:fs');
+const zlib = require('node:zlib');
+const path = require('node:path');
+const assert = require('node:assert');
const {
isBuildingSnapshot,
addSerializeCallback,
addDeserializeCallback,
setDeserializeMainFunction
-} = require('v8').startupSnapshot;
+} = require('node:v8').startupSnapshot;
const filePath = path.resolve(__dirname, '../x1024.txt');
const storage = {};
diff --git a/doc/api/webstreams.md b/doc/api/webstreams.md
index 6a710b42061..970d147be49 100644
--- a/doc/api/webstreams.md
+++ b/doc/api/webstreams.md
@@ -1478,8 +1478,8 @@ console.log(`from readable: ${data.byteLength}`);
```cjs
const { arrayBuffer } = require('node:stream/consumers');
-const { Readable } = require('stream');
-const { TextEncoder } = require('util');
+const { Readable } = require('node:stream');
+const { TextEncoder } = require('node:util');
const encoder = new TextEncoder();
const dataArray = encoder.encode(['hello world from consumers!']);