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

broccoli

Package Overview
Dependencies
Maintainers
3
Versions
72
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

broccoli - npm Package Compare versions

Comparing version 2.0.0-beta.1 to 2.0.0-beta.2

prettier.config.js

11

.eslintrc.js

@@ -12,3 +12,3 @@ module.exports = {

rules: {
'strict': 'error',
strict: 'error',
'no-var': 'error',

@@ -18,10 +18,3 @@ 'no-console': 'off',

'object-shorthand': 'error',
'prettier/prettier': [
'error',
{
singleQuote: true,
trailingComma: 'es5',
printWidth: 100,
},
],
'prettier/prettier': ['error', require('./prettier.config')],
},

@@ -28,0 +21,0 @@ overrides: [

# master
# 2.0.0-beta.2
* Update internal dependencies to latest versions.
* Remove usages of `RSVP` (in favor of using native promises).
# 2.0.0-beta.1

@@ -4,0 +9,0 @@

'use strict';
const promiseFinally = require('promise.prototype.finally');
const path = require('path');
const fs = require('fs');
const RSVP = require('rsvp');
const EventEmitter = require('events').EventEmitter;
const tmp = require('tmp');

@@ -45,4 +46,5 @@ const heimdall = require('heimdalljs');

module.exports = class Builder {
module.exports = class Builder extends EventEmitter {
constructor(outputNode, options) {
super();
if (options == null) options = {};

@@ -90,8 +92,6 @@

if (this._cancelationRequest) {
return RSVP.Promise.reject(
new BuilderError('Cannot start a build if one is already running')
);
return Promise.reject(new BuilderError('Cannot start a build if one is already running'));
}
let promise = RSVP.Promise.resolve();
let promise = Promise.resolve();

@@ -109,12 +109,14 @@ this.buildId++;

// from this node, but not from previous nodes.
return RSVP.resolve()
.then(() => this._cancelationRequest.throwIfRequested())
.then(() => this.trigger('beginNode', nw))
.then(() => nw.build())
.finally(() => {
return promiseFinally(
Promise.resolve()
.then(() => this._cancelationRequest.throwIfRequested())
.then(() => this.emit('beginNode', nw))
.then(() => nw.build()),
() => {
if (this._cancelationRequest.isCancelled) {
return;
}
this.trigger('endNode', nw);
})
this.emit('endNode', nw);
}
)
.then(() => this._cancelationRequest.throwIfRequested())

@@ -129,13 +131,15 @@ .catch(err => {

return promise
.then(() => {
return this.outputNodeWrapper;
})
.then(outputNodeWrapper => {
this.buildHeimdallTree(outputNodeWrapper);
return outputNodeWrapper;
})
.finally(() => {
return promiseFinally(
promise
.then(() => {
return this.outputNodeWrapper;
})
.then(outputNodeWrapper => {
this.buildHeimdallTree(outputNodeWrapper);
return outputNodeWrapper;
}),
() => {
this._cancelationRequest = null;
});
}
);
}

@@ -146,3 +150,3 @@

// No current build, so no cancellation
return RSVP.Promise.resolve();
return Promise.resolve();
}

@@ -440,4 +444,2 @@

RSVP.EventTarget.mixin(module.exports.prototype);
module.exports.BuilderError = BuilderError;

@@ -444,0 +446,0 @@ module.exports.InvalidNodeError = broccoliNodeInfo.InvalidNodeError;

'use strict';
const RSVP = require('rsvp');
const promiseFinally = require('promise.prototype.finally');
const TreeSync = require('tree-sync');

@@ -60,3 +60,3 @@ const childProcess = require('child_process');

const server = broccoli.server.serve(watcher, options.host, parseInt(options.port, 10));
actionPromise = (server && server.closingPromise) || RSVP.resolve();
actionPromise = (server && server.closingPromise) || Promise.resolve();
});

@@ -121,14 +121,13 @@

actionPromise = watcher
.start()
.catch(err => console.log((err && err.stack) || err))
.finally(() => {
actionPromise = promiseFinally(
watcher.start().catch(err => console.log((err && err.stack) || err)),
() => {
builder.cleanup();
process.exit(0);
})
.catch(err => {
console.log('Cleanup error:');
console.log((err && err.stack) || err);
process.exit(1);
});
}
).catch(err => {
console.log('Cleanup error:');
console.log((err && err.stack) || err);
process.exit(1);
});
});

@@ -143,3 +142,3 @@

return actionPromise || RSVP.resolve();
return actionPromise || Promise.resolve();
};

@@ -146,0 +145,0 @@

'use strict';
const EventEmitter = require('events').EventEmitter;
const RSVP = require('rsvp');
class Watcher {
class Watcher extends EventEmitter {
constructor(builder) {
super();
this.builder = builder;

@@ -13,7 +13,12 @@ this.currentBuild = null;

start() {
this._lifetimeDeferred = RSVP.defer();
let lifetime = (this._lifetimeDeferred = {});
lifetime.promise = new Promise((resolve, reject) => {
lifetime.resolve = resolve;
lifetime.reject = reject;
});
this.currentBuild = this.builder.build();
this.currentBuild
.then(() => this.trigger('buildSuccess'))
.catch(err => this.trigger('buildFailure', err));
.then(() => this.emit('buildSuccess'))
.catch(err => this.emit('buildFailure', err));
return this._lifetimeDeferred.promise;

@@ -27,4 +32,2 @@ }

RSVP.EventTarget.mixin(Watcher.prototype);
module.exports = Watcher;

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

onBuildSuccess(builder) {
printSlowNodes(builder.outputNodeWrapper);
printSlowNodes(builder.outputNodeWrapper.__heimdall__);
console.log(

@@ -10,0 +10,0 @@ 'Built - ' +

'use strict';
const promiseFinally = require('promise.prototype.finally');
const http = require('http');

@@ -41,15 +42,14 @@

server.closingPromise = server.watcher
.start()
.catch(err => console.log((err && err.stack) || err))
.finally(() => {
server.closingPromise = promiseFinally(
server.watcher.start().catch(err => console.log((err && err.stack) || err)),
() => {
server.builder.cleanup();
server.http.close();
process.exit(0);
})
.catch(err => {
console.log('Cleanup error:');
console.log((err && err.stack) || err);
process.exit(1);
});
}
).catch(err => {
console.log('Cleanup error:');
console.log((err && err.stack) || err);
process.exit(1);
});

@@ -56,0 +56,0 @@ server.http.listen(parseInt(port, 10), host);

'use strict';
const EventEmitter = require('events').EventEmitter;
const sane = require('sane');
const RSVP = require('rsvp');
const logger = require('heimdalljs-logger')('broccoli:watcherAdapter');

@@ -14,8 +14,9 @@

logger.debug(event, root + '/' + filepath);
adapter.trigger('change');
adapter.emit('change');
});
}
class WatcherAdapter {
class WatcherAdapter extends EventEmitter {
constructor(options) {
super();
this.options = options || {};

@@ -42,3 +43,3 @@ this.options.filter = this.options.filter || defaultFilterFunction;

logger.debug('error', err);
this.trigger('error', err);
this.emit('error', err);
});

@@ -71,3 +72,2 @@

module.exports = WatcherAdapter;
RSVP.EventTarget.mixin(WatcherAdapter.prototype);
module.exports.bindFileEvent = bindFileEvent;
'use strict';
const RSVP = require('rsvp');
const promiseFinally = require('promise.prototype.finally');
const EventEmitter = require('events').EventEmitter;
const WatcherAdapter = require('./watcher_adapter');

@@ -11,4 +12,5 @@ const logger = require('heimdalljs-logger')('broccoli:watcher');

class Watcher {
class Watcher extends EventEmitter {
constructor(builder, options) {
super();
this.options = options || {};

@@ -28,7 +30,11 @@ if (this.options.debounce == null) this.options.debounce = 100;

throw new Error('Watcher.prototype.start() must not be called more than once');
this._lifetimeDeferred = RSVP.defer();
let lifetime = (this._lifetimeDeferred = {});
lifetime.promise = new Promise((resolve, reject) => {
lifetime.resolve = resolve;
lifetime.reject = reject;
});
this.watcherAdapter.on('change', this._change.bind(this));
this.watcherAdapter.on('error', this._error.bind(this));
RSVP.resolve()
Promise.resolve()
.then(() => {

@@ -59,9 +65,9 @@ return this.watcherAdapter.watch(this.builder.watchedPaths);

// Wait for current build, and ignore build failure
RSVP.resolve(this.currentBuild)
Promise.resolve(this.currentBuild)
.catch(() => {})
.then(() => {
if (this._quitting) return;
const buildPromise = new RSVP.Promise(resolve => {
const buildPromise = new Promise(resolve => {
logger.debug('debounce');
this.trigger('debounce');
this.emit('debounce');
setTimeout(resolve, this.options.debounce);

@@ -80,3 +86,3 @@ }).then(() => {

logger.debug('buildStart');
this.trigger('buildStart');
this.emit('buildStart');
const buildPromise = this.builder.build();

@@ -89,7 +95,7 @@ // Trigger change/error events. Importantly, if somebody else chains to

logger.debug('buildSuccess');
this.trigger('buildSuccess');
this.emit('buildSuccess');
},
err => {
logger.debug('buildFailure');
this.trigger('buildFailure', err);
this.emit('buildFailure', err);
}

@@ -123,12 +129,12 @@ );

return RSVP.resolve()
.then(() => this.watcherAdapter.quit())
.finally(() => {
return promiseFinally(
promiseFinally(Promise.resolve().then(() => this.watcherAdapter.quit()), () => {
// Wait for current build, and ignore build failure
return RSVP.resolve(this.currentBuild).catch(() => {});
})
.finally(() => logger.debug('quitEnd'));
return Promise.resolve(this.currentBuild).catch(() => {});
}),
() => logger.debug('quitEnd')
);
}
}
RSVP.EventTarget.mixin(Watcher.prototype);
module.exports = Watcher;

@@ -5,3 +5,2 @@ 'use strict';

const fs = require('fs');
const RSVP = require('rsvp');
const undefinedToNull = require('../utils/undefined-to-null');

@@ -23,3 +22,3 @@ const rimraf = require('rimraf');

return new RSVP.Promise(resolve => {
return new Promise(resolve => {
startTime = process.hrtime();

@@ -26,0 +25,0 @@

{
"name": "broccoli",
"version": "2.0.0-beta.2",
"description": "Fast client-side asset builder",
"version": "2.0.0-beta.1",
"author": "Jo Liss <joliss42@gmail.com>",
"main": "lib/index.js",
"license": "MIT",
"keywords": [
"asset",
"browser",
"build",
"builder",
"build",
"frontend",
"browser",
"asset",
"pipeline"
],
"homepage": "https://github.com/broccolijs/broccoli",
"license": "MIT",
"author": "Jo Liss <joliss42@gmail.com>",
"main": "lib/index.js",
"repository": {

@@ -20,16 +21,22 @@ "type": "git",

},
"homepage": "https://github.com/broccolijs/broccoli",
"scripts": {
"lint": "eslint lib test",
"lint:fix": "eslint --fix lib test",
"pretest": "multidep test/multidep.json",
"test": "mocha",
"test:debug": "mocha --inspect-brk"
},
"dependencies": {
"broccoli-node-info": "1.1.0",
"broccoli-slow-trees": "^2.0.0",
"broccoli-slow-trees": "^3.0.1",
"broccoli-source": "^1.1.0",
"commander": "^2.11.0",
"connect": "^3.6.5",
"commander": "^2.15.1",
"connect": "^3.6.6",
"findup-sync": "^2.0.0",
"handlebars": "^4.0.11",
"heimdalljs": "^0.2.3",
"heimdalljs": "^0.2.5",
"heimdalljs-logger": "^0.1.9",
"mime": "^1.5.0",
"mime": "^2.3.1",
"promise.prototype.finally": "^3.1.0",
"rimraf": "^2.6.2",
"rsvp": "^4.7.0",
"sane": "^2.2.0",

@@ -44,27 +51,20 @@ "tmp": "0.0.33",

"chai-as-promised": "^7.1.1",
"eslint-config-prettier": "^2.8.0",
"eslint-plugin-mocha": "^4.11.0",
"eslint-plugin-node": "^5.2.1",
"eslint-plugin-prettier": "^2.3.1",
"eslint-config-prettier": "^2.9.0",
"eslint-plugin-mocha": "^5.0.0",
"eslint-plugin-node": "^6.0.1",
"eslint-plugin-prettier": "^2.6.0",
"fixturify": "^0.3.4",
"mocha": "^4.0.1",
"mocha": "^5.2.0",
"mocha-eslint": "^4.1.0",
"multidep": "^2.0.2",
"portfinder": "^1.0.13",
"prettier": "^1.8.2",
"semver": "^5.4.1",
"sinon": "^4.1.2",
"sinon-chai": "^2.14.0",
"symlink-or-copy": "^1.1.8"
"prettier": "^1.13.5",
"semver": "^5.5.0",
"sinon": "^5.1.1",
"sinon-chai": "^3.1.0",
"symlink-or-copy": "^1.2.0"
},
"engines": {
"node": ">= 4"
},
"scripts": {
"lint": "eslint lib test",
"lint:fix": "eslint --fix lib test",
"pretest": "multidep test/multidep.json",
"test": "mocha",
"test:debug": "mocha --inspect-brk"
"node": ">= 6"
}
}
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