This repository has been archived by the owner on Dec 4, 2023. It is now read-only.
forked from mochajs/mocha
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
29 additions
and
2 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
'use strict'; | ||
|
||
/** | ||
* This is a transform stream we're using to strip AMD calls from | ||
* dependencies in our Browserify bundle. | ||
*/ | ||
|
||
var through = require('through2'); | ||
var defineRx = /typeof define === ['"]function['"] && define\.amd/g; | ||
|
||
function createStream() { | ||
return through.obj(function(chunk, enc, next) { | ||
this.push(String(chunk) | ||
.replace(defineRx, 'false')); | ||
next(); | ||
}); | ||
} | ||
|
||
module.exports = function(b) { | ||
function wrap() { | ||
b.pipeline.get('wrap').push(createStream()); | ||
} | ||
|
||
b.on('reset', wrap); | ||
wrap(); | ||
}; |