diff options
author | Geoffrey Booth <456802+GeoffreyBooth@users.noreply.github.com> | 2022-02-01 01:16:37 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-02-01 01:16:37 +0300 |
commit | 15f1a45c5f52fbf3d35389428846a5c86d684a87 (patch) | |
tree | f4c693c2ee6ce31d2d1027b7fa2970512ed3096c /lib | |
parent | 0ff62b4e03fe7ab7b3022f8bf316d691e6fffb54 (diff) |
module: unflag esm json modules
PR-URL: https://github.com/nodejs/node/pull/41736
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: Guy Bedford <guybedford@gmail.com>
Reviewed-By: Mohammed Keyvanzadeh <mohammadkeyvanzade94@gmail.com>
Reviewed-By: Michaƫl Zasso <targos@protonmail.com>
Reviewed-By: Bradley Farias <bradley.meck@gmail.com>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/internal/modules/esm/get_format.js | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/lib/internal/modules/esm/get_format.js b/lib/internal/modules/esm/get_format.js index 97128901395..ca90cd6a5d1 100644 --- a/lib/internal/modules/esm/get_format.js +++ b/lib/internal/modules/esm/get_format.js @@ -8,7 +8,6 @@ const { const { extname } = require('path'); const { getOptionValue } = require('internal/options'); -const experimentalJsonModules = getOptionValue('--experimental-json-modules'); const experimentalSpecifierResolution = getOptionValue('--experimental-specifier-resolution'); const experimentalWasmModules = getOptionValue('--experimental-wasm-modules'); @@ -20,7 +19,8 @@ const extensionFormatMap = { '__proto__': null, '.cjs': 'commonjs', '.js': 'module', - '.mjs': 'module' + '.json': 'json', + '.mjs': 'module', }; const legacyExtensionFormatMap = { @@ -29,7 +29,7 @@ const legacyExtensionFormatMap = { '.js': 'commonjs', '.json': 'commonjs', '.mjs': 'module', - '.node': 'commonjs' + '.node': 'commonjs', }; let experimentalSpecifierResolutionWarned = false; @@ -37,9 +37,6 @@ let experimentalSpecifierResolutionWarned = false; if (experimentalWasmModules) extensionFormatMap['.wasm'] = legacyExtensionFormatMap['.wasm'] = 'wasm'; -if (experimentalJsonModules) - extensionFormatMap['.json'] = legacyExtensionFormatMap['.json'] = 'json'; - const protocolHandlers = ObjectAssign(ObjectCreate(null), { 'data:'(parsed) { const { 1: mime } = RegExpPrototypeExec( @@ -49,7 +46,7 @@ const protocolHandlers = ObjectAssign(ObjectCreate(null), { const format = ({ '__proto__': null, 'text/javascript': 'module', - 'application/json': experimentalJsonModules ? 'json' : null, + 'application/json': 'json', 'application/wasm': experimentalWasmModules ? 'wasm' : null })[mime] || null; |