Socket
Socket
Sign inDemoInstall

@parcel/fs

Package Overview
Dependencies
Maintainers
1
Versions
876
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@parcel/fs - npm Package Compare versions

Comparing version 2.0.0-alpha.2.1 to 2.0.0-alpha.3

index.js

67

lib/index.js

@@ -6,61 +6,30 @@ "use strict";

});
var _exportNames = {
ncp: true
};
exports.ncp = ncp;
Object.defineProperty(exports, "NodeFS", {
enumerable: true,
get: function () {
return _NodeFS.NodeFS;
}
});
Object.defineProperty(exports, "MemoryFS", {
enumerable: true,
get: function () {
return _MemoryFS.MemoryFS;
}
});
Object.defineProperty(exports, "OverlayFS", {
enumerable: true,
get: function () {
return _OverlayFS.OverlayFS;
}
});
var _path = _interopRequireDefault(require("path"));
var _types = require("./types");
Object.keys(_types).forEach(function (key) {
if (key === "default" || key === "__esModule") return;
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
Object.defineProperty(exports, key, {
enumerable: true,
get: function () {
return _types[key];
}
});
});
var _NodeFS = require("./NodeFS");
Object.keys(_NodeFS).forEach(function (key) {
if (key === "default" || key === "__esModule") return;
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
Object.defineProperty(exports, key, {
enumerable: true,
get: function () {
return _NodeFS[key];
}
});
});
var _MemoryFS = require("./MemoryFS");
Object.keys(_MemoryFS).forEach(function (key) {
if (key === "default" || key === "__esModule") return;
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
Object.defineProperty(exports, key, {
enumerable: true,
get: function () {
return _MemoryFS[key];
}
});
});
var _OverlayFS = require("./OverlayFS");
Object.keys(_OverlayFS).forEach(function (key) {
if (key === "default" || key === "__esModule") return;
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
Object.defineProperty(exports, key, {
enumerable: true,
get: function () {
return _OverlayFS[key];
}
});
});
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

@@ -67,0 +36,0 @@

@@ -20,4 +20,6 @@ "use strict";

function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {}; if (desc.get || desc.set) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj.default = obj; return newObj; } }
function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

@@ -222,3 +224,3 @@

readdir(dir, opts) {
readdirSync(dir, opts) {
dir = this._normalizePath(dir);

@@ -257,5 +259,9 @@

return Promise.resolve(res);
return res;
}
readdir(dir, opts) {
return Promise.resolve(this.readdirSync(dir, opts));
}
async unlink(filePath) {

@@ -262,0 +268,0 @@ filePath = this._normalizePath(filePath);

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

_defineProperty(this, "existsSync", _fs.default.existsSync);
_defineProperty(this, "readdirSync", _fs.default.readdirSync);
}

@@ -69,0 +71,0 @@

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

_defineProperty(this, "copyFile", write('copyFile'));
_defineProperty(this, "stat", read('stat'));

@@ -109,2 +107,10 @@

async copyFile(source, destination) {
if (await this.writable.exists(source)) {
await this.writable.writeFile(destination, (await this.writable.readFile(source)));
} else {
await this.writable.writeFile(destination, (await this.readable.readFile(source)));
}
}
async exists(filePath) {

@@ -132,2 +138,20 @@ return (await this.writable.exists(filePath)) || this.readable.exists(filePath);

readdirSync(path, opts) {
// Read from both filesystems and merge the results
let writable = [];
let readable = [];
try {
writable = this.writable.readdirSync(path, opts);
} catch (err) {// do nothing
}
try {
readable = this.readable.readdirSync(path, opts);
} catch (err) {// do nothing
}
return Array.from(new Set([...writable, ...readable]));
}
async watch(dir, fn, opts) {

@@ -134,0 +158,0 @@ let writableSubscription = await this.writable.watch(dir, fn, opts);

{
"name": "@parcel/fs",
"version": "2.0.0-alpha.2.1",
"version": "2.0.0-alpha.3",
"description": "Blazing fast, zero configuration web application bundler",
"main": "lib/index.js",
"license": "MIT",
"publishConfig": {
"access": "public"
},
"repository": {

@@ -11,12 +13,11 @@ "type": "git",

},
"main": "lib/index.js",
"source": "src/index.js",
"engines": {
"node": ">= 10.0.0"
},
"publishConfig": {
"access": "public"
},
"dependencies": {
"@parcel/utils": "^2.0.0-alpha.2.1",
"@parcel/watcher": "^2.0.0-alpha.3",
"@parcel/workers": "^2.0.0-alpha.2.1",
"@parcel/utils": "^2.0.0-alpha.3",
"@parcel/watcher": "^2.0.0-alpha.4",
"@parcel/workers": "^2.0.0-alpha.3",
"mkdirp": "^0.5.1",

@@ -27,3 +28,3 @@ "ncp": "^2.0.0",

},
"gitHead": "2c01341d81c41a70cb33acb51fff621353b3e494"
}
"gitHead": "d4b611ac4495787fa31dac40dda15eedb6e31492"
}

@@ -6,6 +6,6 @@ // @flow strict-local

export * from './types';
export * from './NodeFS';
export * from './MemoryFS';
export * from './OverlayFS';
export type * from './types';
export {NodeFS} from './NodeFS';
export {MemoryFS} from './MemoryFS';
export {OverlayFS} from './OverlayFS';

@@ -12,0 +12,0 @@ // Recursively copies a directory from the sourceFS to the destinationFS

@@ -211,3 +211,3 @@ // @flow

readdir(dir: FilePath, opts?: ReaddirOptions): Promise<any> {
readdirSync(dir: FilePath, opts?: ReaddirOptions): any {
dir = this._normalizePath(dir);

@@ -249,5 +249,9 @@ if (!this.dirs.has(dir)) {

return Promise.resolve(res);
return res;
}
readdir(dir: FilePath, opts?: ReaddirOptions): Promise<any> {
return Promise.resolve(this.readdirSync(dir, opts));
}
async unlink(filePath: FilePath) {

@@ -254,0 +258,0 @@ filePath = this._normalizePath(filePath);

@@ -43,2 +43,3 @@ // @flow

existsSync = fs.existsSync;
readdirSync = (fs.readdirSync: any);

@@ -45,0 +46,0 @@ async realpath(originalPath: string): Promise<string> {

@@ -71,3 +71,15 @@ // @flow

writeFile = write('writeFile');
copyFile = write('copyFile');
async copyFile(source: FilePath, destination: FilePath) {
if (await this.writable.exists(source)) {
await this.writable.writeFile(
destination,
await this.writable.readFile(source)
);
} else {
await this.writable.writeFile(
destination,
await this.readable.readFile(source)
);
}
}
stat = read('stat');

@@ -114,2 +126,21 @@ unlink = write('unlink');

readdirSync(path: FilePath, opts?: ReaddirOptions): any {
// Read from both filesystems and merge the results
let writable = [];
let readable = [];
try {
writable = this.writable.readdirSync(path, opts);
} catch (err) {
// do nothing
}
try {
readable = this.readable.readdirSync(path, opts);
} catch (err) {
// do nothing
}
return Array.from(new Set([...writable, ...readable]));
}
async watch(

@@ -116,0 +147,0 @@ dir: FilePath,

@@ -38,2 +38,4 @@ // @flow

readdir(path: FilePath, opts: {withFileTypes: true, ...}): Promise<Dirent[]>;
readdirSync(path: FilePath, opts?: {withFileTypes?: false, ...}): FilePath[];
readdirSync(path: FilePath, opts: {withFileTypes: true, ...}): Dirent[];
unlink(path: FilePath): Promise<void>;

@@ -40,0 +42,0 @@ realpath(path: FilePath): Promise<FilePath>;

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