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

@contrast/require-hook

Package Overview
Dependencies
Maintainers
10
Versions
36
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@contrast/require-hook - npm Package Compare versions

Comparing version 2.0.10 to 2.0.11

42

lib/export-handler-registry.js

@@ -7,2 +7,3 @@ 'use strict';

const { getShortname } = require('./helpers');
const fs = require('fs');

@@ -226,2 +227,11 @@ const PackageFinder = require('./package-finder');

/**
* Returns true if the file exists and false if it doesn't.
* @param {string}
* @return {Boolean}
*/
doesFileExist(filename) {
return fs.existsSync(filename);
}
/**
* Iterates all descriptors pertaining to the currently-loading export. It

@@ -238,3 +248,4 @@ * builds into the set of resolved paths the metadata and handlers for each

*/
buildFromRegistry({ request, metadata, parent, registered }) {
// eslint-disable-next-line complexity
buildFromRegistry({ request, metadata, registered }) {
const fileHandlers = {};

@@ -257,13 +268,14 @@

if (info.file) {
let relativeFile = request;
if (request !== `${metadata.name}/${info.file}`) {
relativeFile = `${request}/${info.file}`;
const absoluteFile = path.resolve(
metadata.packageDir || '',
info.file.endsWith('.js') ? info.file : `${info.file}.js`
);
if (!this.doesFileExist(absoluteFile)) {
this.logger.trace(`Unable to resolve file ${absoluteFile}`);
continue;
}
try {
const absoluteFile = this.resolveFilename(
relativeFile,
parent,
false
);
addNonDuplicatedHandlers(fileHandlers, absoluteFile, {

@@ -280,11 +292,9 @@ metadata,

} catch (error) {
if (error.code === 'MODULE_NOT_FOUND') {
this.logger.trace(`cannot resolve relative file ${relativeFile}`);
} else {
this.logger.warn(error);
}
this.logger.warn(error);
}
} else {
addNonDuplicatedHandlers(fileHandlers, request, { metadata, handlers });
continue;
}
addNonDuplicatedHandlers(fileHandlers, request, { metadata, handlers });
}

@@ -291,0 +301,0 @@

@@ -34,4 +34,2 @@ 'use strict';

this.resets = new Set();
this.install();
}

@@ -38,0 +36,0 @@

{
"name": "@contrast/require-hook",
"version": "2.0.10",
"version": "2.0.11",
"description": "Post hooks for Module.prototype.require",

@@ -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