From 3f69d21b5cddeb940a1b9d640bf4640b45dafb8d Mon Sep 17 00:00:00 2001 From: Daeyeon Jeong Date: Sun, 6 Nov 2022 06:53:23 +0900 Subject: [PATCH] doc: add `node:` prefix for examples MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 PR-URL: https://github.com/nodejs/node/pull/45328 Reviewed-By: Michaƫl Zasso Reviewed-By: Luigi Pinca Reviewed-By: Colin Ihrig Reviewed-By: Antoine du Hamel Reviewed-By: Filip Skokan Reviewed-By: Yagiz Nizipli --- doc/api/diagnostics_channel.md | 8 ++++---- doc/api/v8.md | 10 +++++----- doc/api/webstreams.md | 4 ++-- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/doc/api/diagnostics_channel.md b/doc/api/diagnostics_channel.md index 761a0567a1435b..1a146b4d30e7bd 100644 --- a/doc/api/diagnostics_channel.md +++ b/doc/api/diagnostics_channel.md @@ -164,7 +164,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 @@ -172,7 +172,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 @@ -194,7 +194,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 @@ -206,7 +206,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 880f3aae70f999..28b3d7174175fc 100644 --- a/doc/api/v8.md +++ b/doc/api/v8.md @@ -919,17 +919,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 20ae0ad9721a72..740780389d59f0 100644 --- a/doc/api/webstreams.md +++ b/doc/api/webstreams.md @@ -1476,8 +1476,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!']);