New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

esmac

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

esmac - npm Package Compare versions

Comparing version 1.0.3 to 2.0.0

30

lib/specifiers/package.js

@@ -9,4 +9,10 @@ const findUp = require('find-up')

) => {
const [ pjsonFile, pjson ] = resolve(expand(target)) || []
const packageName = extractPackageName(request)
if (!packageName) {
return false
}
const [ pjsonFile, pjson ] = resolve(expand(target), packageName) || []
if (!pjsonFile) {

@@ -19,8 +25,7 @@ return false

// TODO: it's more nuanced than startsWith, we need at least a \b
return request.startsWith(pjson.name)
return true
}
// see https://nodejs.org/api/esm.html#esm_resolver_algorithm_specification
const findNamedManifestOnDisk = (file) => {
const findNamedManifestOnDisk = (file, name) => {
const pjsonFile = findUp.sync('package.json', { cwd: path.dirname(file) })

@@ -34,3 +39,3 @@

if (pjson.name) {
if (pjson.name && pjson.name === name) {
return [pjsonFile, pjson]

@@ -44,1 +49,16 @@ }

const identity = x => x
const extractPackageName = specifier => {
if (specifier.startsWith('@')) {
const scope = specifier.split('/').slice(0, 2).join('/')
if (scope.endsWith('/')) {
return null
}
return scope
}
else {
return specifier.split('/')[0]
}
}

2

package.json
{
"name": "esmac",
"version": "1.0.3",
"version": "2.0.0",
"description": "Control access to ES modules",

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

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