Skip to content

Commit

Permalink
Merge pull request #713 from stealjs/export-stuff
Browse files Browse the repository at this point in the history
Adds buildResult as resolved value for stealTools.export
  • Loading branch information
matthewp committed May 17, 2017
2 parents 9e6a405 + 96f1248 commit 0dad54e
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 9 deletions.
6 changes: 3 additions & 3 deletions doc/export.md
@@ -1,5 +1,5 @@
@function steal-tools.export export
@parent steal-tools.JS
@parent steal-tools.JS

Export a project's modules to other forms and formats declaratively.

Expand All @@ -20,7 +20,7 @@ values.
@param {Array<{}>} [modules] An array of module data that an [steal-tools.export.output]'s
`modules`, `eachModule`, `graphs`, or `ignore` can be filtered against.

@return {Promise} A promise that resolves when all outputs have been written out.
@return {(Promise<steal-tools.BuildResult>)} A Promise that resolves when all outputs have been written out.

@body

Expand Down Expand Up @@ -67,7 +67,7 @@ The first argument is an [steal-tools.export.object]. Details about its API and

## defaults

As there are times when the same options may need to be set over and over again, the `defaults` option can
As there are times when the same options may need to be set over and over again, the `defaults` option can
contain default values each output can call:

```
Expand Down
6 changes: 5 additions & 1 deletion lib/build/export.js
Expand Up @@ -236,8 +236,12 @@ module.exports = function(config, defaults, modules){

return transformImport(config.steal, config.options)
.then(function(configPluginify){
var buildResult = configPluginify.data;
return Promise.all(config.outputs.map(function(out) {
return processOutput(configPluginify, out);
}));
}))
.then(function(){
return buildResult;
});
});
};
6 changes: 4 additions & 2 deletions lib/build/transform.js
Expand Up @@ -35,7 +35,7 @@ var transformImport = function(config, transformOptions){
logging.setup(transformOptions, config);

return makeGraph(config, transformOptions).then(function(data){

return transformImport.normalizeExports(data.steal.System,
transformOptions)
.then(function(){
Expand All @@ -54,7 +54,8 @@ var transformImport = function(config, transformOptions){
ignoreAllDependencies: false,
removeSourceNodes: true
},transformOptions, options);
var configuration = makeConfiguration(data.loader, data.buildLoader, options);
var configuration = data.configuration =
makeConfiguration(data.loader, data.buildLoader, options);

if(!moduleNames) {
moduleNames = data.loader.main;
Expand Down Expand Up @@ -148,6 +149,7 @@ var transformImport = function(config, transformOptions){
// Set the graph on transform in case anyone needs to use it.
transform.graph = data.graph;
transform.loader = data.loader;
transform.data = data;
return transform;


Expand Down
10 changes: 7 additions & 3 deletions test/export_test.js
Expand Up @@ -11,7 +11,6 @@ var open = testHelpers.open;

describe("export", function(){
it("basics work", function(done){

stealExport({

steal: {
Expand All @@ -38,7 +37,13 @@ describe("export", function(){
minify: false
}
}
}).then(function(){
}).then(function(data){
// Includes all buildResult fields
assert(!!data.configuration, "configuration");
assert(!!data.graph, "graph");
assert(!!data.loader, "loader");
assert(!!data.steal, "steal");

open("test/pluginifier_builder/index.html", function(browser, close){

find(browser,"RESULT", function(result){
Expand All @@ -55,7 +60,6 @@ describe("export", function(){

it("works with multiple mains", function(done){
stealExport({

steal: {
main: [
"pluginifier_builder/pluginify",
Expand Down

0 comments on commit 0dad54e

Please sign in to comment.