broccoli-plugin
Advanced tools
Comparing version 1.1.0 to 1.2.0
# master | ||
# 1.2.0 | ||
* Add `sourceDirectories` feature flag, which introduces `pluginInterface.nodeType` | ||
* Allow for calling `__broccoliGetInfo__()` without argument | ||
# 1.1.0 | ||
@@ -4,0 +9,0 @@ |
16
index.js
@@ -0,1 +1,3 @@ | ||
'use strict' | ||
module.exports = Plugin | ||
@@ -40,3 +42,4 @@ function Plugin(inputNodes, options) { | ||
Plugin.prototype.__broccoliFeatures__ = Object.freeze({ | ||
persistentOutputFlag: true | ||
persistentOutputFlag: true, | ||
sourceDirectories: true | ||
}) | ||
@@ -46,6 +49,7 @@ | ||
Plugin.prototype.__broccoliGetInfo__ = function(builderFeatures) { | ||
this._checkBuilderFeatures(builderFeatures) | ||
builderFeatures = this._checkBuilderFeatures(builderFeatures) | ||
if (!this._baseConstructorCalled) throw new Error('Plugin subclasses must call the superclass constructor: Plugin.call(this, inputNodes)') | ||
return { | ||
nodeType: 'transform', | ||
inputNodes: this._inputNodes, | ||
@@ -62,10 +66,12 @@ setup: this._setup.bind(this), | ||
Plugin.prototype._checkBuilderFeatures = function(builderFeatures) { | ||
if (!builderFeatures || !builderFeatures.persistentOutputFlag) { | ||
if (builderFeatures == null) builderFeatures = this.__broccoliFeatures__ | ||
if (!builderFeatures.persistentOutputFlag || !builderFeatures.sourceDirectories) { | ||
// No builder in the wild implements less than these. | ||
throw new Error('Minimum builderFeatures required: { persistentOutputFlag: true }') | ||
throw new Error('Minimum builderFeatures required: { persistentOutputFlag: true, sourceDirectories: true }') | ||
} | ||
return builderFeatures | ||
} | ||
Plugin.prototype._setup = function(builderFeatures, options) { | ||
this._checkBuilderFeatures(builderFeatures) | ||
builderFeatures = this._checkBuilderFeatures(builderFeatures) | ||
this._builderFeatures = builderFeatures | ||
@@ -72,0 +78,0 @@ this.inputPaths = options.inputPaths |
{ | ||
"name": "broccoli-plugin", | ||
"description": "Base class for all Broccoli plugins", | ||
"version": "1.1.0", | ||
"version": "1.2.0", | ||
"author": "Jo Liss <joliss42@gmail.com>", | ||
@@ -6,0 +6,0 @@ "main": "index.js", |
@@ -0,1 +1,3 @@ | ||
'use strict' | ||
var fs = require('fs') | ||
@@ -13,6 +15,4 @@ var path = require('path') | ||
function ReadCompat(plugin) { | ||
var builderFeatures = { persistentOutputFlag: true } | ||
this.pluginInterface = plugin.__broccoliGetInfo__() | ||
this.pluginInterface = plugin.__broccoliGetInfo__(builderFeatures) | ||
quickTemp.makeOrReuse(this, 'outputPath', this.pluginInterface.name) | ||
@@ -27,3 +27,3 @@ quickTemp.makeOrReuse(this, 'cachePath', this.pluginInterface.name) | ||
this.pluginInterface.setup(builderFeatures, { | ||
this.pluginInterface.setup(null, { | ||
inputPaths: this.inputPaths, | ||
@@ -30,0 +30,0 @@ outputPath: this.outputPath, |
@@ -36,3 +36,3 @@ # The Broccoli Plugin Base Class | ||
### `Plugin(inputNodes, options)` | ||
### `new Plugin(inputNodes, options)` | ||
@@ -39,0 +39,0 @@ Call this base class constructor from your subclass constructor. |
Sorry, the diff of this file is not supported yet
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
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
1
12663
10
163