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.2 to 0.15.3

4

CHANGELOG.md

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

# v0.15.3
- Add `defiler.resolve`, exposing path resolution via your `resolver`
# v0.15.2

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

29

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, _dependent, _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, _current, _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[_dependent] = null; // (set via proxy) the current immediate dependent (path or generator symbol), for use in _deps, _waitingFor, and the resolver
this[_current] = 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,8 +312,8 @@ 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 { [_dependent]: parent, [_waitingFor]: waitingFor } = this;
if (this[_resolver] && typeof parent === 'string') path$$1 = this[_resolver](parent, path$$1);
let { [_current]: current, [_waitingFor]: waitingFor } = this;
path$$1 = this.resolve(path$$1);
if (typeof path$$1 !== 'string') throw new TypeError('defiler.get: path must be a string')
if (parent) this[_deps].push([parent, path$$1]);
if (current) this[_deps].push([current, path$$1]);
if (!this[_status] && !this.files.has(path$$1)) {
if (parent) waitingFor.set(parent, (waitingFor.get(parent) || 0) + 1);
if (current) waitingFor.set(current, (waitingFor.get(current) || 0) + 1);
if (!this[_whenFound].has(path$$1)) {

@@ -324,3 +324,3 @@ let resolve;

await this[_whenFound].get(path$$1).promise;
if (parent) waitingFor.set(parent, waitingFor.get(parent) - 1);
if (current) waitingFor.set(current, waitingFor.get(current) - 1);
}

@@ -334,5 +334,3 @@ return this.files.get(path$$1)

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

@@ -342,2 +340,9 @@ this[_processFile](file);

// resolve a given path from the file currently being transformed
resolve(path$$1) {
return this[_resolver] && typeof this[_current] === 'string'
? this[_resolver](this[_current], path$$1)
: path$$1
}
// private methods

@@ -443,4 +448,4 @@

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

@@ -447,0 +452,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, _dependent, _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, _current, _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[_dependent] = null; // (set via proxy) the current immediate dependent (path or generator symbol), for use in _deps, _waitingFor, and the resolver
this[_current] = 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,8 +308,8 @@ this[_queue$1] = []; // queue of pending Watcher events to handle

if (Array.isArray(path)) return Promise.all(path.map(path => this.get(path)))
let { [_dependent]: parent, [_waitingFor]: waitingFor } = this;
if (this[_resolver] && typeof parent === 'string') path = this[_resolver](parent, path);
let { [_current]: current, [_waitingFor]: waitingFor } = this;
path = this.resolve(path);
if (typeof path !== 'string') throw new TypeError('defiler.get: path must be a string')
if (parent) this[_deps].push([parent, path]);
if (current) this[_deps].push([current, path]);
if (!this[_status] && !this.files.has(path)) {
if (parent) waitingFor.set(parent, (waitingFor.get(parent) || 0) + 1);
if (current) waitingFor.set(current, (waitingFor.get(current) || 0) + 1);
if (!this[_whenFound].has(path)) {

@@ -320,3 +320,3 @@ let resolve$$1;

await this[_whenFound].get(path).promise;
if (parent) waitingFor.set(parent, waitingFor.get(parent) - 1);
if (current) waitingFor.set(current, waitingFor.get(current) - 1);
}

@@ -330,5 +330,3 @@ return this.files.get(path)

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

@@ -338,2 +336,9 @@ this[_processFile](file);

// resolve a given path from the file currently being transformed
resolve(path) {
return this[_resolver] && typeof this[_current] === 'string'
? this[_resolver](this[_current], path)
: path
}
// private methods

@@ -439,4 +444,4 @@

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

@@ -443,0 +448,0 @@

{
"name": "defiler",
"version": "0.15.2",
"version": "0.15.3",
"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