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

@vercel/nft

Package Overview
Dependencies
Maintainers
24
Versions
61
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@vercel/nft - npm Package Compare versions

Comparing version 0.9.3 to 0.9.4

167

out/utils/wrappers.js

@@ -350,96 +350,89 @@ "use strict";

}
for (const [, m] of modules) {
if (m.params.length === 3 && m.params[2].type === 'Identifier') {
const assignedVars = new Map();
estree_walker_1.walk(m.body, {
enter(node, maybeParent) {
if (node.type === 'FunctionExpression' ||
node.type === 'FunctionDeclaration' ||
node.type === 'ArrowFunctionExpression' ||
node.type === 'BlockStatement' ||
node.type === 'TryStatement') {
if (maybeParent)
return this.skip();
}
if (node.type === 'CallExpression' &&
node.callee.type === 'Identifier' &&
node.callee.name === m.params[2].name &&
node.arguments.length === 1 &&
node.arguments[0].type === 'Literal') {
const externalId = externalMap.get(node.arguments[0].value);
if (externalId) {
const replacement = {
type: 'CallExpression',
callee: {
type: 'Identifier',
name: 'require'
},
arguments: [{
type: 'Literal',
value: externalId
}]
};
const parent = maybeParent;
if (parent.right === node) {
parent.right = replacement;
if (externalMap.size)
for (const [, m] of modules) {
if (m.params.length === 3 && m.params[2].type === 'Identifier') {
const assignedVars = new Map();
estree_walker_1.walk(m.body, {
enter(node, maybeParent) {
if (node.type === 'CallExpression' &&
node.callee.type === 'Identifier' &&
node.callee.name === m.params[2].name &&
node.arguments.length === 1 &&
node.arguments[0].type === 'Literal') {
const externalId = externalMap.get(node.arguments[0].value);
if (externalId) {
const replacement = {
type: 'CallExpression',
callee: {
type: 'Identifier',
name: 'require'
},
arguments: [{
type: 'Literal',
value: externalId
}]
};
const parent = maybeParent;
if (parent.right === node) {
parent.right = replacement;
}
else if (parent.left === node) {
parent.left = replacement;
}
else if (parent.object === node) {
parent.object = replacement;
}
else if (parent.callee === node) {
parent.callee = replacement;
}
else if (parent.arguments && parent.arguments.some((arg) => arg === node)) {
parent.arguments = parent.arguments.map((arg) => arg === node ? replacement : arg);
}
else if (parent.init === node) {
if (parent.type === 'VariableDeclarator' && parent.id.type === 'Identifier')
assignedVars.set(parent.id.name, externalId);
parent.init = replacement;
}
}
else if (parent.left === node) {
parent.left = replacement;
}
else if (parent.object === node) {
parent.object = replacement;
}
else if (parent.callee === node) {
parent.callee = replacement;
}
else if (parent.arguments && parent.arguments.some((arg) => arg === node)) {
parent.arguments = parent.arguments.map((arg) => arg === node ? replacement : arg);
}
else if (parent.init === node) {
if (parent.type === 'VariableDeclarator' && parent.id.type === 'Identifier')
assignedVars.set(parent.id.name, externalId);
parent.init = replacement;
}
}
}
else if (node.type === 'CallExpression' &&
node.callee.type === 'MemberExpression' &&
node.callee.object.type === 'Identifier' &&
node.callee.object.name === m.params[2].name &&
node.callee.property.type === 'Identifier' &&
node.callee.property.name === 'n' &&
node.arguments.length === 1 &&
node.arguments[0].type === 'Identifier' &&
assignedVars.get(node.arguments[0].name)) {
if (maybeParent && maybeParent.init === node) {
maybeParent.init = {
type: 'ObjectExpression',
properties: [{
type: 'ObjectProperty',
method: false,
computed: false,
shorthand: false,
key: {
type: 'Identifier',
name: 'a'
},
value: {
type: 'CallExpression',
callee: {
else if (node.type === 'CallExpression' &&
node.callee.type === 'MemberExpression' &&
node.callee.object.type === 'Identifier' &&
node.callee.object.name === m.params[2].name &&
node.callee.property.type === 'Identifier' &&
node.callee.property.name === 'n' &&
node.arguments.length === 1 &&
node.arguments[0].type === 'Identifier' &&
assignedVars.get(node.arguments[0].name)) {
if (maybeParent && maybeParent.init === node) {
maybeParent.init = {
type: 'ObjectExpression',
properties: [{
type: 'ObjectProperty',
method: false,
computed: false,
shorthand: false,
key: {
type: 'Identifier',
name: 'require'
name: 'a'
},
arguments: [{
type: 'Literal',
value: assignedVars.get(node.arguments[0].name)
}]
}
}]
};
value: {
type: 'CallExpression',
callee: {
type: 'Identifier',
name: 'require'
},
arguments: [{
type: 'Literal',
value: assignedVars.get(node.arguments[0].name)
}]
}
}]
};
}
}
}
}
});
});
}
}
}
}

@@ -446,0 +439,0 @@ }

{
"name": "@vercel/nft",
"version": "0.9.3",
"version": "0.9.4",
"repository": "vercel/nft",

@@ -5,0 +5,0 @@ "license": "MIT",

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