@conduitry/defiler
Advanced tools
Comparing version 0.0.1 to 0.0.2
{ | ||
"name": "@conduitry/defiler", | ||
"version": "0.0.1", | ||
"version": "0.0.2", | ||
"description": "A small, strange building block", | ||
"main": "index.js", | ||
"main": "./dist/index.cjs.js", | ||
"module": "./src/index.es.js", | ||
"scripts": { | ||
"test": "echo \"Error: no test specified\" && exit 1" | ||
"build": "rollup -c", | ||
"eslint": "eslint", | ||
"prettier": "prettier", | ||
"lint": "eslint src", | ||
"format": "prettier --write --print-width 160 --use-tabs --no-semi --single-quote --trailing-comma es5 \"src/**/*.js\"" | ||
}, | ||
"devDependencies": { | ||
"eslint": "^3.19.0", | ||
"prettier": "^1.2.2", | ||
"rollup": "^0.41.6" | ||
}, | ||
"repository": { | ||
@@ -10,0 +20,0 @@ "type": "git", |
import EventEmitter from 'events' | ||
import { readFile, stat } from 'fs.promise' | ||
import { readFile, stat } from 'fs' | ||
import { relative } from 'path' | ||
import File from './File.js' | ||
@@ -12,3 +13,2 @@ | ||
export default class Defiler extends EventEmitter { | ||
constructor() { | ||
@@ -45,3 +45,3 @@ super() | ||
get origPaths() { | ||
return [ ...(this._filePromises || this._origFiles).keys() ].sort() | ||
return [...(this._filePromises || this._origFiles).keys()].sort() | ||
} | ||
@@ -54,3 +54,3 @@ | ||
this._gazes.push({ gaze, rootPath, read }) | ||
this._gazePromises.push(new Promise(resolve => gaze.on('ready', resolve))) | ||
this._gazePromises.push(new Promise(res => gaze.on('ready', res))) | ||
return this | ||
@@ -93,4 +93,3 @@ } | ||
this._checkBeforeExec('exec') | ||
this._ready = new Promise(async resolve => { | ||
this._ready = new Promise(async res => { | ||
await Promise.all(this._gazePromises) | ||
@@ -135,3 +134,3 @@ this._gazePromises = null | ||
let origins = new Set() | ||
for (let [ origin, deps ] of this._dependencies.entries()) { | ||
for (let [origin, deps] of this._dependencies.entries()) { | ||
if (deps.has(file.path)) { | ||
@@ -148,3 +147,3 @@ origins.add(origin) | ||
this._filePromises = null | ||
resolve() | ||
res() | ||
}) | ||
@@ -166,3 +165,3 @@ | ||
} else { | ||
this._dependencies.set(origin, new Set([ path ])) | ||
this._dependencies.set(origin, new Set([path])) | ||
} | ||
@@ -215,3 +214,3 @@ } | ||
async _processPhysicalFile(absolutePath, rootPath, read) { | ||
let fileStat = await stat(absolutePath) | ||
let fileStat = await new Promise((res, rej) => stat(absolutePath, (err, data) => (err ? rej(err) : res(data)))) | ||
if (!fileStat.isFile()) { | ||
@@ -224,3 +223,3 @@ return | ||
if (read) { | ||
origFile.bytes = await readFile(absolutePath) | ||
origFile.bytes = await new Promise((res, rej) => readFile(absolutePath, (err, data) => (err ? rej(err) : res(data)))) | ||
} | ||
@@ -286,3 +285,2 @@ this._origFiles.set(path, origFile) | ||
} | ||
} |
export default class File { | ||
constructor(path) { | ||
@@ -52,3 +51,2 @@ this.path = path | ||
} | ||
} |
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
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
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
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 2 instances in 1 package
No tests
QualityPackage does not have any tests. This is a strong signal of a poorly maintained or low quality package.
Found 1 instance in 1 package
9
1
1
14535
3
288