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

path-scurry

Package Overview
Dependencies
Maintainers
1
Versions
28
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

path-scurry - npm Package Compare versions

Comparing version 1.7.1 to 1.8.0

9

dist/cjs/index.d.ts

@@ -102,2 +102,3 @@ /// <reference types="node" />

};
declare const setAsCwd: unique symbol;
/**

@@ -443,2 +444,9 @@ * Path objects are sort of like a super-powered

realpathSync(): PathBase | undefined;
/**
* Internal method to mark this Path object as the scurry cwd,
* called by {@link PathScurry#chdir}
*
* @internal
*/
[setAsCwd](oldCwd: PathBase): void;
}

@@ -952,2 +960,3 @@ /**

streamSync(entry: string | PathBase, opts: WalkOptions): Minipass<string> | Minipass<PathBase>;
chdir(path?: string | Path): void;
}

@@ -954,0 +963,0 @@ /**

@@ -102,2 +102,3 @@ /// <reference types="node" />

};
declare const setAsCwd: unique symbol;
/**

@@ -443,2 +444,9 @@ * Path objects are sort of like a super-powered

realpathSync(): PathBase | undefined;
/**
* Internal method to mark this Path object as the scurry cwd,
* called by {@link PathScurry#chdir}
*
* @internal
*/
[setAsCwd](oldCwd: PathBase): void;
}

@@ -952,2 +960,3 @@ /**

streamSync(entry: string | PathBase, opts: WalkOptions): Minipass<string> | Minipass<PathBase>;
chdir(path?: string | Path): void;
}

@@ -954,0 +963,0 @@ /**

39

dist/mjs/index.js

@@ -134,2 +134,3 @@ import { LRUCache } from 'lru-cache';

}
const setAsCwd = Symbol('PathScurry setAsCwd');
/**

@@ -414,4 +415,3 @@ * Path objects are sort of like a super-powered

const pv = p.relative();
const rp = pv + (!pv || !p.parent ? '' : this.sep) + name;
return (this.#relative = rp);
return pv + (!pv || !p.parent ? '' : this.sep) + name;
}

@@ -435,4 +435,3 @@ /**

const pv = p.relativePosix();
const rp = pv + (!pv || !p.parent ? '' : '/') + name;
return (this.#relativePosix = rp);
return pv + (!pv || !p.parent ? '' : '/') + name;
}

@@ -1089,2 +1088,29 @@ /**

}
/**
* Internal method to mark this Path object as the scurry cwd,
* called by {@link PathScurry#chdir}
*
* @internal
*/
[setAsCwd](oldCwd) {
if (oldCwd === this)
return;
const changed = new Set([]);
let rp = [];
let p = this;
while (p && p.parent) {
changed.add(p);
p.#relative = rp.join(this.sep);
p.#relativePosix = rp.join('/');
p = p.parent;
rp.push('..');
}
// now un-memoize parents of old cwd
p = oldCwd;
while (p && p.parent && !changed.has(p)) {
p.#relative = undefined;
p.#relativePosix = undefined;
p = p.parent;
}
}
}

@@ -1814,2 +1840,7 @@ /**

}
chdir(path = this.cwd) {
const oldCwd = this.cwd;
this.cwd = typeof path === 'string' ? this.cwd.resolve(path) : path;
this.cwd[setAsCwd](oldCwd);
}
}

@@ -1816,0 +1847,0 @@ /**

2

package.json
{
"name": "path-scurry",
"version": "1.7.1",
"version": "1.8.0",
"description": "walk paths fast and efficiently",

@@ -5,0 +5,0 @@ "author": "Isaac Z. Schlueter <i@izs.me> (https://blog.izs.me)",

@@ -337,2 +337,8 @@ # path-scurry

#### `pw.chdir(path: string)`
Set the new effective current working directory for the scurry
object, so that `path.relative()` and `path.relativePosix()`
return values relative to the new cwd path.
#### `pw.depth(path?: Path | string): number`

@@ -339,0 +345,0 @@

Sorry, the diff of this file is not supported yet

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

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