extensionless
Advanced tools
Comparing version 1.1.5 to 1.1.6
{ | ||
"name": "extensionless", | ||
"version": "1.1.5", | ||
"version": "1.1.6", | ||
"type": "module", | ||
"main": "src/index.js", | ||
"description": "Node.js loader for import specifiers as file paths without extensions or, optionally, as directory paths", | ||
"description": "Node.js loader for import specifiers as file paths without extensions or as directory paths", | ||
"license": "MIT", | ||
@@ -8,0 +8,0 @@ "homepage": "https://github.com/barhun/extensionless", |
@@ -1,2 +0,2 @@ | ||
Node.js loader for import specifiers as file paths without extensions or, optionally, as directory paths | ||
Node.js loader for import specifiers as file paths without extensions or as directory paths | ||
@@ -22,5 +22,4 @@ | ||
"extensionless": { | ||
"lookFor": ["mjs", "js", "json"], // default: ["js", "json"] | ||
"resolveDirs": true // default: false | ||
"lookFor": ["mjs", "js", "json"] // default: ["js", "json"] | ||
} | ||
``` |
@@ -17,4 +17,3 @@ import {access, existsSync, readFileSync} from 'fs' | ||
let { | ||
lookFor = ['js', 'json'], | ||
resolveDirs = false | ||
lookFor = ['js', 'json'] | ||
} = pkgJson?.extensionless ?? {} | ||
@@ -25,7 +24,4 @@ | ||
typeof resolveDirs === 'boolean' | ||
|| (console.error('\x1b[33m%s\x1b[0m', `The package.json field 'extensionless.resolveDirs' must be a boolean value!`), process.exit(1)) | ||
let extToSkip = ['.wasm', '.cjs', '.mjs', '.js', '.json'] | ||
let indexFiles = resolveDirs ? lookFor.map(e => `index.${e}`) : [] | ||
let indexFiles = lookFor.map(e => `index.${e}`) | ||
let extensions = lookFor.map(e => `.${e}`).concat(indexFiles.map(p => `${sep}${p}`)) | ||
@@ -32,0 +28,0 @@ let findPostfix = async (specifier, context, isAbs) => { |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
3821
37
25