From 4448e8a094b1182f729cae0ea45f19f19505d62a Mon Sep 17 00:00:00 2001 From: Bradley Farias Date: Wed, 30 Sep 2020 15:57:08 -0500 Subject: [PATCH 1/2] doc: importable node protocol URLs --- doc/api/esm.md | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/doc/api/esm.md b/doc/api/esm.md index db77d246287ce0..9a36d6bd0fd8b5 100644 --- a/doc/api/esm.md +++ b/doc/api/esm.md @@ -105,13 +105,27 @@ There are four types of specifiers: Bare specifiers, and the bare specifier portion of deep import specifiers, are strings; but everything else in a specifier is a URL. -Only `file:` and `data:` URLs are supported. A specifier like +`file:`, `node:`, and `data:` URLs are supported. A specifier like `'https://example.com/app.js'` may be supported by browsers but it is not supported in Node.js. Specifiers may not begin with `/` or `//`. These are reserved for potential future use. The root of the current volume may be referenced via `file:///`. +#### `node:` Imports + + + +[`node:` URLs][] are supported as a means to load Node.js builtin modules. This +URL scheme allows for builtin modules to be referenced by valid absolute URL +strings. + +```js +import fs from 'node:fs/promises'; +``` + #### `data:` Imports -[`node:` URLs][] are supported as a means to load Node.js builtin modules. This +`node:` URLs are supported as a means to load Node.js builtin modules. This URL scheme allows for builtin modules to be referenced by valid absolute URL strings.