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

@contrast/dep-hooks

Package Overview
Dependencies
Maintainers
0
Versions
22
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@contrast/dep-hooks - npm Package Compare versions

Comparing version 1.5.0 to 1.6.0

2

lib/export-hook-descriptor.d.ts

@@ -41,3 +41,3 @@ export = ExportHookDescriptor;

*/
static create<T_1 extends Object>(descriptor: string | HookDescriptorOptions<T_1>): import("./export-hook-descriptor")<T_1>;
static create<T_1 extends Object>(descriptor: string | HookDescriptorOptions<T_1>): ExportHookDescriptor<T_1>;
/**

@@ -44,0 +44,0 @@ * @param {HookDescriptorOptions<T>} options

@@ -21,2 +21,3 @@ /*

const { isBuiltin } = require('./helpers');
const { primordials: { StringPrototypeReplace } } = require('@contrast/common');
const DEFAULT_VERSION = '*';

@@ -52,5 +53,7 @@ /** @typedef {import('./package-finder').Metadata} Metadata */

/** @type {string} */
this.name = isBuiltin(name) ? name.replace(/^(node:)?/, 'node:') : name;
// @ts-ignore
this.name = isBuiltin(name) ? StringPrototypeReplace.call(name, /^(node:)?/, 'node:') : name;
/** @type {string=} */
this.file = file?.replace(/\/?(index)?(\.js)?$/, '');
// @ts-ignore
this.file = file ? StringPrototypeReplace.call(file, /\/?(index)?(\.js)?$/, '') : undefined;
/** @type {string} */

@@ -57,0 +60,0 @@ this.shortname = this.file ? path.posix.join(this.name, this.file) : this.name;

@@ -15,3 +15,2 @@ /*

*/
// @ts-check
'use strict';

@@ -21,2 +20,3 @@ Object.defineProperty(exports, "__esModule", { value: true });

const path = require('node:path');
const { primordials: { StringPrototypeReplace, StringPrototypeSubstring, RegExpPrototypeTest } } = require('@contrast/common');
const pathSepRegex = new RegExp(`\\${path.sep}`, 'g');

@@ -33,13 +33,14 @@ /**

function getShortname({ name, packageDir, file, main }) {
const mainPath = path
.join(packageDir, main ?? '')
.replace(pathSepRegex, '\\$&');
const mainPath = StringPrototypeReplace.call(path.join(packageDir, main ?? ''), pathSepRegex, '\\$&');
const mainPathRegex = new RegExp(`^${mainPath}\\${path.sep}?(index)?(\\.js(on)?)?$`);
const normalizedFilename = path.normalize(file);
return mainPathRegex.test(normalizedFilename)
? name
: normalizedFilename
.replace(path.normalize(packageDir), name)
.replace(pathSepRegex, '/')
.replace(/\/?(index)?\.js$/, '');
let normalizedFilename = path.normalize(file);
if (RegExpPrototypeTest.call(mainPathRegex, normalizedFilename)) {
return name;
}
else {
normalizedFilename = StringPrototypeReplace.call(normalizedFilename, path.normalize(packageDir), name);
normalizedFilename = StringPrototypeReplace.call(normalizedFilename, pathSepRegex, '/');
normalizedFilename = StringPrototypeReplace.call(normalizedFilename, /\/?(index)?\.js$/, '');
return normalizedFilename;
}
}

@@ -54,3 +55,3 @@ /**

if (name.startsWith('node:')) {
name = name.substring(5);
name = StringPrototypeSubstring.call(name, 5);
}

@@ -57,0 +58,0 @@ // @ts-expect-error we've set the node version to 14 before this was added.

@@ -15,3 +15,3 @@ /*

*/
// @ts-check
// @ts-nocheck
'use strict';

@@ -23,2 +23,3 @@ Object.defineProperty(exports, "__esModule", { value: true });

const { isBuiltin } = require('./helpers');
const { primordials: { StringPrototypeReplace, StringPrototypeSubstring, JSONParse } } = require('@contrast/common');
/**

@@ -43,6 +44,6 @@ * @typedef {Object} Metadata

if (isBuiltin(filename)) {
filename = filename.replace(/^(node:)?/, 'node:');
filename = StringPrototypeReplace.call(filename, /^(node:)?/, 'node:');
return {
name: filename,
version: process.version.substring(1),
version: StringPrototypeSubstring.call(process.version, 1),
packageDir: filename,

@@ -60,3 +61,3 @@ file: filename,

const json = fs.readFileSync(pdj, 'utf8');
const { name, version, main } = JSON.parse(json);
const { name, version, main } = JSONParse(json);
return {

@@ -63,0 +64,0 @@ name,

{
"name": "@contrast/dep-hooks",
"version": "1.5.0",
"version": "1.6.0",
"description": "Post hooks for Module.prototype.require",

@@ -21,6 +21,7 @@ "license": "SEE LICENSE IN LICENSE",

"dependencies": {
"@contrast/common": "1.26.0",
"@contrast/find-package-json": "^1.1.0",
"@contrast/logger": "1.10.0",
"@contrast/logger": "1.11.0",
"semver": "^7.6.3"
}
}

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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