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:
authorGuy Bedford <guybedford@gmail.com>2018-02-06 12:19:04 +0300
committerRuben Bridgewater <ruben@bridgewater.de>2018-02-07 17:02:01 +0300
commit93df1169ea451983f09611c0acc9d3c98760dd28 (patch)
tree36ba27cb3ec643a1af6ea938ef17b438a46339d7
parentb8f7f84fc233a5876b1d275fed63775bdbb7932f (diff)
lib,doc: revert format name to cjs over commonjs
PR-URL: https://github.com/nodejs/node/pull/18596 Reviewed-By: Michaƫl Zasso <targos@protonmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Tiancheng "Timothy" Gu <timothygu99@gmail.com> Reviewed-By: Myles Borins <myles.borins@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
-rw-r--r--doc/api/esm.md2
-rw-r--r--lib/internal/loader/DefaultResolve.js2
-rw-r--r--lib/internal/loader/Translators.js2
3 files changed, 3 insertions, 3 deletions
diff --git a/doc/api/esm.md b/doc/api/esm.md
index 10f20958593..2cfa5a9f29c 100644
--- a/doc/api/esm.md
+++ b/doc/api/esm.md
@@ -137,7 +137,7 @@ module. This can be one of the following:
| `format` | Description |
| --- | --- |
| `"esm"` | Load a standard JavaScript module |
-| `"commonjs"` | Load a node-style CommonJS module |
+| `"cjs"` | Load a node-style CommonJS module |
| `"builtin"` | Load a node builtin CommonJS module |
| `"json"` | Load a JSON file |
| `"addon"` | Load a [C++ Addon][addons] |
diff --git a/lib/internal/loader/DefaultResolve.js b/lib/internal/loader/DefaultResolve.js
index faadf0bc99e..69dd9537c18 100644
--- a/lib/internal/loader/DefaultResolve.js
+++ b/lib/internal/loader/DefaultResolve.js
@@ -44,7 +44,7 @@ const extensionFormatMap = {
'.mjs': 'esm',
'.json': 'json',
'.node': 'addon',
- '.js': 'commonjs'
+ '.js': 'cjs'
};
function resolve(specifier, parentURL) {
diff --git a/lib/internal/loader/Translators.js b/lib/internal/loader/Translators.js
index f1db8334dd5..d2f28774177 100644
--- a/lib/internal/loader/Translators.js
+++ b/lib/internal/loader/Translators.js
@@ -32,7 +32,7 @@ translators.set('esm', async (url) => {
// Strategy for loading a node-style CommonJS module
const isWindows = process.platform === 'win32';
const winSepRegEx = /\//g;
-translators.set('commonjs', async (url) => {
+translators.set('cjs', async (url) => {
debug(`Translating CJSModule ${url}`);
const pathname = internalURLModule.getPathFromURL(new URL(url));
const module = CJSModule._cache[