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

yarn-pnp-test

Package Overview
Dependencies
Maintainers
1
Versions
32
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

yarn-pnp-test - npm Package Compare versions

Comparing version 0.1.0-beta.24 to 0.1.0-beta.25

validation.js

2

package.json

@@ -18,3 +18,3 @@ {

},
"version": "0.1.0-beta.24"
"version": "0.1.0-beta.25"
}

@@ -1,6 +0,10 @@

#!/usr/bin/env node
import path from 'path';
const path = require('path');
import { isObject, isObjectWithStringProp } from './validation';
const getBinPath = (packageJson, binName) => {
const getPartialBinPath = (packageJson, binName) => {
if (!isObject(packageJson)) {
throw new Error('package.json not found');
}
if (typeof packageJson.bin === 'string') {

@@ -10,15 +14,10 @@ return packageJson.bin;

if (
typeof packageJson.bin === 'object' &&
packageJson.bin !== null &&
typeof binName !== 'undefined' &&
typeof packageJson.bin[binName] === 'string'
) {
if (isObjectWithStringProp(packageJson.bin, binName)) {
return packageJson.bin[binName];
}
throw new Error('package.json#/bin is invalid');
throw new Error('package.json#/bin invalid');
};
const bin = () => {
const runBinary = (packageName, binName) => {
const { createRequire } = require('module');

@@ -28,4 +27,2 @@

const packageName = process.argv[2];
const packagePath = path.join(packageName, 'package');

@@ -35,12 +32,6 @@

const package = targetRequire(packageResolved);
const packageJson = targetRequire(packageResolved);
if (typeof package !== 'object' || package === null) {
throw new Error('package.json not found');
}
const partialBinPath = getPartialBinPath(packageJson, binName);
const binName = process.argv[3];
const partialBinPath = getBinPath(package, binName);
const binPath = path.join(packageName, partialBinPath);

@@ -55,2 +46,4 @@

bin();
const [packageName, binName] = process.argv.slice(2);
runBinary(packageName, binName);
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