Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Emit unhandledRejection on Internet Explorer (+ fixes on Windows) (#496)
* Fix build on Windows * Emit unhandledRejection on IE * Fix build tests on Windows Update unhandledRejection test Update test procedure in CONTRIBUTING Update buster config (load es5.js)
- Loading branch information
1 parent
facc6ba
commit 0768dd8
Showing
8 changed files
with
162 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
var path = require('path'); | ||
var fs = require('fs'); | ||
var glob = require('glob'); | ||
var browserify = require('browserify'); | ||
|
||
var POSIX_SEP = path.posix ? path.posix.sep : '/'; | ||
|
||
var ROOT_DIR = path.resolve(__dirname, '..'); | ||
var outputFile = path.resolve(ROOT_DIR, 'test', 'browser', 'tests.js'); | ||
|
||
var entries = glob(path.join(ROOT_DIR, 'test', '**', '*-test.js'), { sync: true }); | ||
if (path.sep !== POSIX_SEP) { | ||
entries = entries.map(function (entry) { | ||
return entry.split(POSIX_SEP).join(path.sep); | ||
}); | ||
} | ||
|
||
browserify({ | ||
entries: entries | ||
}) | ||
.external('buster') | ||
.bundle() | ||
.pipe(fs.createWriteStream(outputFile)); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
var exec = require('child_process').exec; | ||
var path = require('path'); | ||
var fs = require('fs'); | ||
var mkdirp = require('mkdirp'); | ||
var browserify = require('browserify'); | ||
var exorcist = require('exorcist'); | ||
|
||
var ROOT_DIR = path.resolve(__dirname, '..'); | ||
|
||
var CONFIGURATIONS = { | ||
'es6': { | ||
standaloneName: 'Promise', | ||
entries: [ | ||
path.resolve(ROOT_DIR, 'es6-shim', 'Promise.browserify-es6.js') | ||
], | ||
outputDir: 'es6-shim', | ||
outputFilename: 'Promise.js' | ||
}, | ||
'when': { | ||
standaloneName: 'when', | ||
entries: [ | ||
path.resolve(ROOT_DIR, 'build', 'when.browserify.js') | ||
], | ||
outputDir: path.join('dist', 'browser'), | ||
outputFilename: 'when.js' | ||
}, | ||
'debug': { | ||
standaloneName: 'when', | ||
entries: [ | ||
path.resolve(ROOT_DIR, 'build', 'when.browserify-debug.js') | ||
], | ||
outputDir: path.join('dist', 'browser'), | ||
outputFilename: 'when.debug.js' | ||
} | ||
}; | ||
|
||
function revParse(callback) { | ||
exec('git rev-parse HEAD', function(err, stdout, stderr) { | ||
process.stderr.write(stderr); | ||
if (err) { | ||
callback(err); | ||
} else { | ||
callback(null, stdout.replace(/(^\s+)|(\s+$)/g, '')); | ||
} | ||
}); | ||
} | ||
|
||
var configName = process.argv[2]; | ||
var config = CONFIGURATIONS[configName]; | ||
|
||
if (!config) { | ||
console.error('Cannot find configuration "' + configName + '"'); | ||
process.exit(1); | ||
return; | ||
} | ||
|
||
mkdirp(config.outputDir, function(mkdirErr) { | ||
if (mkdirErr) { | ||
console.error(mkdirErr); | ||
process.exit(1); | ||
} else { | ||
revParse(function(revParseErr, rev) { | ||
if (revParseErr) { | ||
console.error(revParseErr); | ||
process.exit(1); | ||
} else { | ||
var rootUrl = 'https://raw.githubusercontent.com/cujojs/when/' + rev; | ||
var outputMapFile = path.resolve(ROOT_DIR, config.outputDir, config.outputFilename + '.map'); | ||
var outputFile = path.resolve(ROOT_DIR, config.outputDir, config.outputFilename); | ||
browserify({ | ||
entries: config.entries | ||
}) | ||
.bundle({ | ||
standalone: config.standaloneName, | ||
detectGlobals: false, | ||
debug: true | ||
}) | ||
.pipe(exorcist(outputMapFile, null, rootUrl, ROOT_DIR)) | ||
.pipe(fs.createWriteStream(outputFile)); | ||
} | ||
}); | ||
} | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters