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

@yarnpkg/pnp

Package Overview
Dependencies
Maintainers
5
Versions
145
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@yarnpkg/pnp - npm Package Compare versions

Comparing version 2.0.0-rc.4 to 2.0.0-rc.5

61

lib/microkernel.js

@@ -426,7 +426,31 @@ module.exports =

async lockPromise(affectedPath, callback) {
const lockPath = `${affectedPath}.lock`;
const lockPath = `${affectedPath}.flock`;
const interval = 1000 / 60;
const timeout = Date.now() + 60 * 1000;
let fd = null;
const startTime = Date.now();
let fd = null; // Even when we detect that a lock file exists, we still look inside to see
// whether the pid that created it is still alive. It's not foolproof
// (there are false positive), but there are no false negative and that's
// all that matters in 99% of the cases.
const isAlive = async () => {
let pid;
try {
[pid] = await this.readJsonPromise(lockPath);
} catch (error) {
// If we can't read the file repeatedly, we assume the process was
// aborted before even writing finishing writing the payload.
return Date.now() - startTime < 500;
}
try {
// "As a special case, a signal of 0 can be used to test for the
// existence of a process" - so we check whether it's alive.
process.kill(pid, 0);
return true;
} catch (error) {
return false;
}
};
while (fd === null) {

@@ -437,3 +461,12 @@ try {

if (error.code === `EEXIST`) {
if (Date.now() < timeout) {
if (!(await isAlive())) {
try {
await this.unlinkPromise(lockPath);
continue;
} catch (error) {// No big deal if we can't remove it. Just fallback to wait for
// it to be eventually released by its owner.
}
}
if (Date.now() - startTime < 60 * 1000) {
await new Promise(resolve => setTimeout(resolve, interval));

@@ -449,2 +482,4 @@ } else {

await this.writePromise(fd, JSON.stringify([process.pid]));
try {

@@ -1042,2 +1077,14 @@ return await callback();

/**
* Returns whether the specified locator is a dependency tree root (in which case it's part of the project) or not
*/
function isDependencyTreeRoot(packageLocator) {
if (packageLocator.name === null) return true;
for (const dependencyTreeRoot of runtimeState.dependencyTreeRoots) if (dependencyTreeRoot.name === packageLocator.name && dependencyTreeRoot.reference === packageLocator.reference) return true;
return false;
}
/**
* Implements the node resolution for folder access and extension selection

@@ -1355,3 +1402,3 @@ */

if (dependencyReference === null) {
if (issuerLocator.name === null) {
if (isDependencyTreeRoot(issuerLocator)) {
throw makeError(ErrorCode.MISSING_PEER_DEPENDENCY, `Something that got detected as your top-level application (because it doesn't seem to belong to any package) tried to access a peer dependency; this isn't allowed as the peer dependency cannot be provided by any parent package\n\nRequired package: ${dependencyName} (via "${request}")\nRequired by: ${issuer}\n`, {

@@ -1371,3 +1418,3 @@ request,

} else if (dependencyReference === undefined) {
if (issuerLocator.name === null) {
if (isDependencyTreeRoot(issuerLocator)) {
throw makeError(ErrorCode.UNDECLARED_DEPENDENCY, `Something that got detected as your top-level application (because it doesn't seem to belong to any package) tried to access a package that is not declared in your dependencies\n\nRequired package: ${dependencyName} (via "${request}")\nRequired by: ${issuer}\n`, {

@@ -1486,3 +1533,3 @@ request,

const packageLocation = NodeFS_NodeFS.fromPortablePath(info.packageLocation);
const nativeInfo = Object.assign({}, info, {
const nativeInfo = Object.assign(Object.assign({}, info), {
packageLocation

@@ -1489,0 +1536,0 @@ });

8

package.json
{
"name": "@yarnpkg/pnp",
"version": "2.0.0-rc.4",
"version": "2.0.0-rc.5",
"main": "./lib/index.js",
"dependencies": {
"@yarnpkg/fslib": "2.0.0-rc.3"
"@yarnpkg/fslib": "2.0.0-rc.4"
},
"devDependencies": {
"@yarnpkg/builder": "2.0.0-rc.7",
"@yarnpkg/pnpify": "2.0.0-rc.5",
"typescript": "^3.5.3",
"@yarnpkg/pnpify": "2.0.0-rc.6",
"typescript": "next",
"webpack": "^4.39.3",

@@ -13,0 +13,0 @@ "webpack-cli": "^3.2.1",

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

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