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

defiler

Package Overview
Dependencies
Maintainers
1
Versions
58
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

defiler - npm Package Compare versions

Comparing version 0.15.1 to 0.15.2

4

CHANGELOG.md

@@ -0,1 +1,5 @@

# v0.15.2
- If file A's processing creates a virtual file B which depends on file C, then when file C changes, re-transform file B starting from what was originally created by file A
# v0.15.1

@@ -2,0 +6,0 @@

39

dist/index.cjs.js

@@ -218,3 +218,3 @@ 'use strict';

// prettier-ignore
let { _origData, _status, _watchers: _watchers$1, _transform, _generators, _resolver, _active, _waitingFor, _whenFound, _deps, _queue: _queue$1, _isProcessing: _isProcessing$1, _startWave, _endWave, _enqueue: _enqueue$1, _processPhysicalFile, _processFile, _processGenerator, _checkWave, _parent, _newProxy, _processDependents, _markFound } = symbols;
let { _origData, _status, _watchers: _watchers$1, _transform, _generators, _resolver, _active, _waitingFor, _whenFound, _deps, _queue: _queue$1, _isProcessing: _isProcessing$1, _startWave, _endWave, _enqueue: _enqueue$1, _processPhysicalFile, _processFile, _processGenerator, _checkWave, _dependent, _newProxy, _processDependents, _markFound } = symbols;

@@ -267,3 +267,3 @@ class Defiler extends EventEmitter {

this[_whenFound] = new Map(); // original paths -> { promise, resolve } objects for when awaited files become available
this[_parent] = null; // (set via proxy) the current immediate dependent (path or generator symbol), for use in _deps, _waitingFor, and the resolver
this[_dependent] = null; // (set via proxy) the current immediate dependent (path or generator symbol), for use in _deps, _waitingFor, and the resolver
this[_deps] = []; // array of [dependent, dependency] pairs, specifying changes to which files should trigger re-processing which other files

@@ -312,3 +312,3 @@ this[_queue$1] = []; // queue of pending Watcher events to handle

if (Array.isArray(path$$1)) return Promise.all(path$$1.map(path$$1 => this.get(path$$1)))
let { [_parent]: parent, [_waitingFor]: waitingFor } = this;
let { [_dependent]: parent, [_waitingFor]: waitingFor } = this;
if (this[_resolver] && typeof parent === 'string') path$$1 = this[_resolver](parent, path$$1);

@@ -333,5 +333,6 @@ if (typeof path$$1 !== 'string') throw new TypeError('defiler.get: path must be a string')

if (typeof file !== 'object') throw new TypeError('defiler.add: file must be an object')
if (this[_resolver] && typeof this[_parent] === 'string') {
file.path = this[_resolver](this[_parent], file.path);
if (this[_resolver] && typeof this[_dependent] === 'string') {
file.path = this[_resolver](this[_dependent], file.path);
}
this[_origData].set(file.path, file);
this[_processFile](file);

@@ -403,14 +404,2 @@ }

// re-process all files that depend on a particular path
[_processDependents](path$$1) {
let dependents = new Set();
for (let [dependent, dep] of this[_deps]) if (dep === path$$1) dependents.add(dependent);
this[_deps] = this[_deps].filter(([dependent]) => !dependents.has(dependent));
if (!dependents.size && !this[_active].size) this[_endWave]();
for (let dependent of dependents) {
if (this[_origData].has(dependent)) this[_processFile](this[_origData].get(dependent));
else if (this[_generators].has(dependent)) this[_processGenerator](dependent);
}
}
// run the generator given by the symbol

@@ -430,2 +419,14 @@ async [_processGenerator](symbol) {

// re-process all files that depend on a particular path
[_processDependents](path$$1) {
let dependents = new Set();
for (let [dependent, dep] of this[_deps]) if (dep === path$$1) dependents.add(dependent);
this[_deps] = this[_deps].filter(([dependent]) => !dependents.has(dependent));
if (!dependents.size && !this[_active].size) this[_endWave]();
for (let dependent of dependents) {
if (this[_origData].has(dependent)) this[_processFile](this[_origData].get(dependent));
else if (this[_generators].has(dependent)) this[_processGenerator](dependent);
}
}
// check whether this wave is complete, and, if not, whether we need to break a deadlock

@@ -442,4 +443,4 @@ [_checkWave]() {

// create a defiler Proxy for the given path or generator symbol
[_newProxy](path$$1) {
return new Proxy(this, { get: (_, key) => (key === _parent ? path$$1 : this[key]) })
[_newProxy](dependent) {
return new Proxy(this, { get: (_, key) => (key === _dependent ? dependent : this[key]) })
}

@@ -446,0 +447,0 @@

@@ -214,3 +214,3 @@ import { readdir, readFile, stat, watch } from 'fs';

// prettier-ignore
let { _origData, _status, _watchers: _watchers$1, _transform, _generators, _resolver, _active, _waitingFor, _whenFound, _deps, _queue: _queue$1, _isProcessing: _isProcessing$1, _startWave, _endWave, _enqueue: _enqueue$1, _processPhysicalFile, _processFile, _processGenerator, _checkWave, _parent, _newProxy, _processDependents, _markFound } = symbols;
let { _origData, _status, _watchers: _watchers$1, _transform, _generators, _resolver, _active, _waitingFor, _whenFound, _deps, _queue: _queue$1, _isProcessing: _isProcessing$1, _startWave, _endWave, _enqueue: _enqueue$1, _processPhysicalFile, _processFile, _processGenerator, _checkWave, _dependent, _newProxy, _processDependents, _markFound } = symbols;

@@ -263,3 +263,3 @@ class Defiler extends EventEmitter {

this[_whenFound] = new Map(); // original paths -> { promise, resolve } objects for when awaited files become available
this[_parent] = null; // (set via proxy) the current immediate dependent (path or generator symbol), for use in _deps, _waitingFor, and the resolver
this[_dependent] = null; // (set via proxy) the current immediate dependent (path or generator symbol), for use in _deps, _waitingFor, and the resolver
this[_deps] = []; // array of [dependent, dependency] pairs, specifying changes to which files should trigger re-processing which other files

@@ -308,3 +308,3 @@ this[_queue$1] = []; // queue of pending Watcher events to handle

if (Array.isArray(path)) return Promise.all(path.map(path => this.get(path)))
let { [_parent]: parent, [_waitingFor]: waitingFor } = this;
let { [_dependent]: parent, [_waitingFor]: waitingFor } = this;
if (this[_resolver] && typeof parent === 'string') path = this[_resolver](parent, path);

@@ -329,5 +329,6 @@ if (typeof path !== 'string') throw new TypeError('defiler.get: path must be a string')

if (typeof file !== 'object') throw new TypeError('defiler.add: file must be an object')
if (this[_resolver] && typeof this[_parent] === 'string') {
file.path = this[_resolver](this[_parent], file.path);
if (this[_resolver] && typeof this[_dependent] === 'string') {
file.path = this[_resolver](this[_dependent], file.path);
}
this[_origData].set(file.path, file);
this[_processFile](file);

@@ -399,14 +400,2 @@ }

// re-process all files that depend on a particular path
[_processDependents](path) {
let dependents = new Set();
for (let [dependent, dep] of this[_deps]) if (dep === path) dependents.add(dependent);
this[_deps] = this[_deps].filter(([dependent]) => !dependents.has(dependent));
if (!dependents.size && !this[_active].size) this[_endWave]();
for (let dependent of dependents) {
if (this[_origData].has(dependent)) this[_processFile](this[_origData].get(dependent));
else if (this[_generators].has(dependent)) this[_processGenerator](dependent);
}
}
// run the generator given by the symbol

@@ -426,2 +415,14 @@ async [_processGenerator](symbol) {

// re-process all files that depend on a particular path
[_processDependents](path) {
let dependents = new Set();
for (let [dependent, dep] of this[_deps]) if (dep === path) dependents.add(dependent);
this[_deps] = this[_deps].filter(([dependent]) => !dependents.has(dependent));
if (!dependents.size && !this[_active].size) this[_endWave]();
for (let dependent of dependents) {
if (this[_origData].has(dependent)) this[_processFile](this[_origData].get(dependent));
else if (this[_generators].has(dependent)) this[_processGenerator](dependent);
}
}
// check whether this wave is complete, and, if not, whether we need to break a deadlock

@@ -438,4 +439,4 @@ [_checkWave]() {

// create a defiler Proxy for the given path or generator symbol
[_newProxy](path) {
return new Proxy(this, { get: (_, key) => (key === _parent ? path : this[key]) })
[_newProxy](dependent) {
return new Proxy(this, { get: (_, key) => (key === _dependent ? dependent : this[key]) })
}

@@ -442,0 +443,0 @@

{
"name": "defiler",
"version": "0.15.1",
"version": "0.15.2",
"description": "A small, strange building block",

@@ -5,0 +5,0 @@ "keywords": ["build", "framework", "async", "watch"],

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