Skip to content

Commit 82f07ba

Browse files
committed
extract ModuleFormat type
1 parent fa0ef03 commit 82f07ba

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

lib/internal/modules/cjs/loader.js

+6-2
Original file line numberDiff line numberDiff line change
@@ -1108,10 +1108,14 @@ function resolveForCJSWithHooks(specifier, parent, isMain) {
11081108
* @typedef {import('internal/modules/customization_hooks').ModuleLoadResult} ModuleLoadResult;
11091109
*/
11101110

1111+
/**
1112+
* @typedef {'module'|'commonjs'|'commonjs-typescript'|'module-typescript'|'typescript'} ModuleFormat;
1113+
*/
1114+
11111115
/**
11121116
* Load the source code of a module based on format.
11131117
* @param {string} filename Filename of the module.
1114-
* @param {string|undefined|null} format Format of the module.
1118+
* @param {ModuleFormat|undefined|null} format Format of the module.
11151119
* @returns {string|null}
11161120
*/
11171121
function defaultLoadImpl(filename, format) {
@@ -1682,7 +1686,7 @@ function wrapSafe(filename, content, cjsModuleInstance, format) {
16821686
* `exports`) to the file. Returns exception, if any.
16831687
* @param {string} content The source code of the module
16841688
* @param {string} filename The file path of the module
1685-
* @param {'module'|'commonjs'|'commonjs-typescript'|'module-typescript'|'typescript'} format Intended format of the module.
1689+
* @param {ModuleFormat} format Intended format of the module.
16861690
*/
16871691
Module.prototype._compile = function(content, filename, format) {
16881692
if (format === 'commonjs-typescript' || format === 'module-typescript' || format === 'typescript') {

0 commit comments

Comments
 (0)