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.3.3 to 1.3.4

2

package.json
{
"name": "extensionless",
"version": "1.3.3",
"version": "1.3.4",
"type": "module",

@@ -5,0 +5,0 @@ "main": "src/index.js",

@@ -23,13 +23,12 @@ import {access, existsSync, readFileSync} from 'fs'

let indexFiles = [lookFor.map(e => `index.${e}`), ['index.json']], empty = [[], []]
let indexFiles = [lookFor.map(e => `index.${e}`), ['index.json']]
let candidates = indexFiles.map(i => i.map(f => extname(f)).concat(i.map(f => `/${f}`)))
let relSpecs = ['.', '..'], relPres = ['./', '../', '.\\', '..\\']
let extToSkip = ['.js', '.cjs', '.mjs', '.json', '.node', '.wasm']
let relSpecs = ['.', '..'], prefixes = ['./', '../', 'file://', '.\\', '..\\']
let extToSkip = ['.js', '.cjs', '.mjs', '.json', '.node', '.wasm'], empty = [[], []]
export async function resolve(specifier, {importAssertions, parentURL}, nextResolve) {
let isAbs = isAbsolute(specifier)
let isRel = relSpecs.includes(specifier) || relPres.some(p => specifier.startsWith(p))
if (!specifier.startsWith('file://') && !isAbs && !isRel) {
if (!isAbs && !relSpecs.includes(specifier) && !prefixes.some(p => specifier.startsWith(p))) {
return await nextResolve(specifier)

@@ -39,8 +38,9 @@ }

let selfURL = new URL((isAbs ? 'file://' : '') + specifier, parentURL).href
let postfixes = selfURL.endsWith('/') ? indexFiles
: extToSkip.includes(extname(selfURL)) ? empty : candidates
let postfixes = selfURL.endsWith('/') ? indexFiles : extToSkip.includes(extname(selfURL)) ? empty : candidates
for (let postfix of postfixes[+(importAssertions?.type === 'json')]) {
if (await new Promise(r => access(new URL(selfURL + postfix), e => r(!e)))) {
return await nextResolve(selfURL + postfix)
let testURL = selfURL + postfix
if (await new Promise(r => access(new URL(testURL), e => r(!e)))) {
return await nextResolve(testURL)
}

@@ -47,0 +47,0 @@ }

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