Skip to content

Commit

Permalink
Use noflo-component-loader to build the loader
Browse files Browse the repository at this point in the history
  • Loading branch information
bergie committed Oct 27, 2017
1 parent f00089b commit ea16584
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 240 deletions.
2 changes: 1 addition & 1 deletion package.json
Expand Up @@ -28,7 +28,7 @@
"coffee-loader": "^0.7.2",
"coffee-script": "^1.10.0",
"fbp-loader": "^0.1.1",
"fbp-manifest": "^0.1.13",
"noflo-component-loader": "^0.1.0",
"webpack": "^3.0.0"
},
"devDependencies": {
Expand Down
121 changes: 0 additions & 121 deletions src/build_loader.js

This file was deleted.

25 changes: 17 additions & 8 deletions src/webpack.js
Expand Up @@ -22,19 +22,28 @@ exports.configure = function (options) {
config.plugins = [];
}

// Custom component loader for this build
config.plugins.push(
new webpack.NormalModuleReplacementPlugin(
/\.\/loader\/register/,
require.resolve(options.loaderPath)
)
);

// Configurable ignores
options.ignores.forEach(function (ignore) {
config.plugins.push(new webpack.IgnorePlugin(ignore));
});

// Inject noflo-component-loader
config.module.rules.push({
test: /noflo\/lib\/loader\/register.js$/,
use: [
{
loader: 'noflo-component-loader',
options: {
graph: options.graph,
debug: options.debug,
baseDir: options.baseDir,
manifest: options.manifest,
runtimes: options.runtimes,
}
}
]
});

config.output = {
path: options.destDir,
filename: options.destName + '.js'
Expand Down
7 changes: 0 additions & 7 deletions tasks/noflo_browser.js
Expand Up @@ -11,7 +11,6 @@
var path = require('path');
var webpack = require('../src/webpack');
var createDemos = require('../src/create_demos');
var buildLoader = require('../src/build_loader');
var bluebird = require('bluebird');
var clone = require('clone');

Expand Down Expand Up @@ -130,19 +129,13 @@ module.exports = function(grunt) {
fileOptions.runtimes.push('noflo-browser');
}

var discover = bluebird.promisify(buildLoader.discover);
return discover(fileOptions);
}).then(function (components) {
fileOptions.loaderPath = buildLoader.save(components, grunt, fileOptions);

var config = webpack.configure(fileOptions);

grunt.log.debug('Generated webpack configuration:');
grunt.log.debug(JSON.stringify(config, null, 2));

return bluebird.promisify(webpack.run)(config);
}).then(function () {
grunt.file.delete(fileOptions.loaderPath);
if (fileOptions.generatedEntry) {
grunt.file.delete(fileOptions.webpack.entry);
}
Expand Down
103 changes: 0 additions & 103 deletions templates/componentloader.js

This file was deleted.

0 comments on commit ea16584

Please sign in to comment.