Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

extensionless

Package Overview
Dependencies
Maintainers
1
Versions
71
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

extensionless - npm Package Compare versions

Comparing version 1.1.3 to 1.1.4

6

package.json
{
"name": "extensionless",
"version": "1.1.3",
"version": "1.1.4",
"type": "module",

@@ -10,4 +10,4 @@ "main": "src/index.js",

"repository": {
"type": "git",
"url": "git+https://github.com/barhun/extensionless.git"
"type": "git",
"url": "git+https://github.com/barhun/extensionless.git"
},

@@ -14,0 +14,0 @@ "scripts": {

@@ -1,2 +0,2 @@

Node.js loader for import specifiers of file paths with no extensions and, optionally, of directory paths
Node.js loader for import specifiers as file paths with no extensions or directory paths

@@ -22,5 +22,5 @@  

"extensionless": {
"lookFor": ["js", "json"], // default: ["mjs", "js", "json"]
"resolveDirs": true // default: false
"lookFor": ["mjs", "js", "json"], // default: ["js", "json"]
"resolveDirs": true // default: false
}
```
```

@@ -17,3 +17,3 @@ import {access, existsSync, readFileSync} from 'fs'

let {
lookFor = ['mjs', 'js', 'json'],
lookFor = ['js', 'json'],
resolveDirs = false

@@ -30,10 +30,8 @@ } = pkgJson?.extensionless ?? {}

let indexFiles = resolveDirs ? lookFor.map(e => `index.${e}`) : []
let postfixes = lookFor.map(e => `.${e}`).concat(indexFiles.map(p => `${sep}${p}`))
let extensions = lookFor.map(e => `.${e}`).concat(indexFiles.map(p => `${sep}${p}`))
let findPostfix = async (specifier, context, isAbs) => {
let postfixCandidates = specifier.endsWith(sep) ? indexFiles
: extToSkip.includes(extname(specifier)) ? [] : postfixes
let postfixes = specifier.endsWith(sep) ? indexFiles : extToSkip.includes(extname(specifier)) ? [] : extensions
for (let postfix of postfixCandidates) {
let path = isAbs ? specifier + postfix
: join(dirname(fileURLToPath(context.parentURL)), specifier + postfix)
for (let postfix of postfixes) {
let path = isAbs ? specifier + postfix : join(dirname(fileURLToPath(context.parentURL)), specifier + postfix)

@@ -40,0 +38,0 @@ if (await new Promise(resolve => access(path, e => resolve(!e)))) {

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc