Comparing version 1.2.0 to 2.0.0
27
index.js
@@ -7,3 +7,3 @@ 'use strict'; | ||
var File = require('vinyl'); | ||
var through = require('through2'); | ||
const { PassThrough } = require('stream') | ||
@@ -13,2 +13,11 @@ exports.create = function () { | ||
function createFile(filepath) { | ||
return new File({ | ||
cwd: process.cwd(), | ||
base: process.cwd(), | ||
path: filepath, | ||
contents: null | ||
}); | ||
} | ||
function load(filepath) { | ||
@@ -19,8 +28,3 @@ var file; | ||
} catch (err) { | ||
file = new File({ | ||
cwd: process.cwd(), | ||
base: process.cwd(), | ||
path: filepath, | ||
contents: null | ||
}); | ||
file = createFile(filepath); | ||
} | ||
@@ -41,2 +45,7 @@ store[filepath] = file; | ||
Store.prototype.existsInMemory = function (filepath) { | ||
filepath = path.resolve(filepath); | ||
return !!store[filepath]; | ||
}; | ||
Store.prototype.add = function (file) { | ||
@@ -56,5 +65,5 @@ store[file.path] = file; | ||
Store.prototype.stream = function () { | ||
var stream = through.obj(); | ||
const stream = new PassThrough({objectMode: true, autoDestroy: true}); | ||
setImmediate(function () { | ||
this.each(stream.write.bind(stream)); | ||
this.each((file) => stream.write(file)); | ||
stream.end(); | ||
@@ -61,0 +70,0 @@ }.bind(this)); |
{ | ||
"name": "mem-fs", | ||
"version": "1.2.0", | ||
"version": "2.0.0", | ||
"description": "Simple in-memory vinyl file store", | ||
@@ -15,3 +15,2 @@ "scripts": { | ||
"dependencies": { | ||
"through2": "^3.0.0", | ||
"vinyl": "^2.0.1", | ||
@@ -21,4 +20,7 @@ "vinyl-file": "^3.0.0" | ||
"devDependencies": { | ||
"mocha": "^5.0.0" | ||
"mocha": "^8.3.2" | ||
}, | ||
"engines": { | ||
"node": ">=12" | ||
} | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
3095
2
60
1
- Removedthrough2@^3.0.0
- Removedreadable-stream@3.6.2(transitive)
- Removedsafe-buffer@5.2.1(transitive)
- Removedstring_decoder@1.3.0(transitive)
- Removedthrough2@3.0.2(transitive)