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

@yarnpkg/fslib

Package Overview
Dependencies
Maintainers
5
Versions
131
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@yarnpkg/fslib - npm Package Compare versions

Comparing version 2.0.0-rc.17 to 2.0.0-rc.18

2

lib/index.d.ts

@@ -16,2 +16,4 @@ /// <reference types="node" />

export { ExtractHintOptions } from './FakeFS';
export { DEFAULT_COMPRESSION_LEVEL } from './ZipFS';
export { ZipCompression } from './ZipFS';
export { FSPath, Path, PortablePath, NativePath, Filename } from './path';

@@ -18,0 +20,0 @@ export { ParsedPath, PathUtils, FormatInputPathObject } from './path';

6

lib/index.js

@@ -12,2 +12,4 @@ "use strict";

exports.normalizeLineEndings = FakeFS_1.normalizeLineEndings;
var ZipFS_1 = require("./ZipFS");
exports.DEFAULT_COMPRESSION_LEVEL = ZipFS_1.DEFAULT_COMPRESSION_LEVEL;
var path_2 = require("./path");

@@ -40,4 +42,4 @@ exports.PortablePath = path_2.PortablePath;

exports.VirtualFS = VirtualFS_1.VirtualFS;
var ZipFS_1 = require("./ZipFS");
exports.ZipFS = ZipFS_1.ZipFS;
var ZipFS_2 = require("./ZipFS");
exports.ZipFS = ZipFS_2.ZipFS;
var ZipOpenFS_1 = require("./ZipOpenFS");

@@ -44,0 +46,0 @@ exports.ZipOpenFS = ZipOpenFS_1.ZipOpenFS;

@@ -13,3 +13,4 @@ "use strict";

// $5: subpath
const VIRTUAL_REGEXP = /^(\/(?:[^\/]+\/)*?\$\$virtual)((?:\/([^\/]+)(?:\/([^\/]+))?)?((?:\/.*)?))$/;
const VIRTUAL_REGEXP = /^(\/(?:[^\/]+\/)*?\$\$virtual)((?:\/((?:[^\/]+-)?[a-f0-9]+)(?:\/([^\/]+))?)?((?:\/.*)?))$/;
const VALID_COMPONENT = /^([^\/]+-)?[a-f0-9]+$/;
class VirtualFS extends ProxiedFS_1.ProxiedFS {

@@ -23,2 +24,4 @@ constructor({ baseFs = new NodeFS_1.NodeFS() } = {}) {

throw new Error(`Assertion failed: Virtual folders must be named "$$virtual"`);
if (!path_1.ppath.basename(component).match(VALID_COMPONENT))
throw new Error(`Assertion failed: Virtual components must be ended by an hexadecimal hash`);
// Obtains the relative distance between the virtual path and its actual target

@@ -37,3 +40,3 @@ const target = path_1.ppath.relative(path_1.ppath.dirname(base), to);

const match = p.match(VIRTUAL_REGEXP);
if (!match)
if (!match || (!match[3] && match[5]))
return p;

@@ -40,0 +43,0 @@ const target = path_1.ppath.dirname(match[1]);

@@ -8,2 +8,4 @@ /// <reference types="node" />

import { FSPath, PortablePath, Filename } from './path';
export declare type ZipCompression = `mixed` | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9;
export declare const DEFAULT_COMPRESSION_LEVEL: ZipCompression;
declare class DirEntry {

@@ -28,2 +30,3 @@ name: Filename;

create?: boolean;
level?: ZipCompression;
};

@@ -36,2 +39,3 @@ export declare class ZipFS extends BasePortableFakeFS {

private readonly zip;
private readonly level;
private readonly listings;

@@ -38,0 +42,0 @@ private readonly entries;

@@ -17,2 +17,3 @@ "use strict";

const path_1 = require("./path");
exports.DEFAULT_COMPRESSION_LEVEL = `mixed`;
const S_IFMT = 0o170000;

@@ -125,2 +126,5 @@ const S_IFDIR = 0o040000;

const pathOptions = opts;
this.level = typeof pathOptions.level !== 'undefined'
? pathOptions.level
: exports.DEFAULT_COMPRESSION_LEVEL;
if (typeof source === `string`) {

@@ -542,3 +546,16 @@ const { baseFs = new NodeFS_1.NodeFS() } = pathOptions;

try {
return this.libzip.file.add(this.zip, target, lzSource, this.libzip.ZIP_FL_OVERWRITE);
const newIndex = this.libzip.file.add(this.zip, target, lzSource, this.libzip.ZIP_FL_OVERWRITE);
if (this.level !== `mixed`) {
// Use store for level 0, and deflate for 1..9
let method;
if (this.level === 0)
method = this.libzip.ZIP_CM_STORE;
else
method = this.libzip.ZIP_CM_DEFLATE;
const rc = this.libzip.file.setCompression(this.zip, newIndex, 0, method, this.level);
if (rc === -1) {
throw new Error(this.libzip.error.strerror(this.libzip.getError(this.zip)));
}
}
return newIndex;
}

@@ -545,0 +562,0 @@ catch (error) {

{
"name": "@yarnpkg/fslib",
"version": "2.0.0-rc.17",
"version": "2.0.0-rc.18",
"main": "./lib/index.js",
"sideEffects": false,
"dependencies": {
"@yarnpkg/libzip": "^2.0.0-rc.10"
"@yarnpkg/libzip": "^2.0.0-rc.11"
},

@@ -9,0 +9,0 @@ "scripts": {

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