-
-
Notifications
You must be signed in to change notification settings - Fork 3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
replace browserify with rollup and babel (#4293)
* Make browser specific TTY interop explicit instead of a magic bundling configuration * Remove unnessessary browserify ignore of cli related files and chokidar * Extract lookupFiles from utils to avoid node dependencies in browser bundle * Replace browserify with rollup for main library bundling * Polyfill global to check if IE11 will start working * Don't include esm-utils in browser build. Modern syntax breaks IE * Remove duplicate browserify configuration in karma config file * Add custom karma rollup plugin and use it to bundle browser tests * add process.listeners impl * Extract browser-only helper functions from shared utils file to their own files * Add browserslist, babel, babel-preset-env and prepare for modern js * Add mocha.js.map to npm distributed files * Use util function to check if we're running in a browser * Improve documentation of self-built karma-rollup-plugin * Renamed lib/cli/lookupFiles.js to lib/cli/lookup-files.js * Clean up rollup config * Kebab case file names * Remove last traces of unused browserify * fix bundle path under win32 * do not run bundle visualizer in CI * Remove use of mocha.opts in browser testing * Improved naming of rollup plugin to pick values from package.json Co-authored-by: Christopher Hiller <[email protected]> Signed-off-by: Christopher Hiller <[email protected]>
- Loading branch information
Showing
24 changed files
with
4,641 additions
and
636 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
node >= 10 | ||
last 2 Chrome versions | ||
last 2 Edge versions | ||
last 2 Firefox versions | ||
last 2 Safari versions | ||
last 2 Opera versions | ||
unreleased Chrome versions | ||
unreleased Edge versions | ||
unreleased Firefox versions | ||
unreleased Safari versions | ||
unreleased Opera versions | ||
IE 11 |
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
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,39 @@ | ||
'use strict'; | ||
|
||
/** | ||
* Highlight the given string of `js`. | ||
* | ||
* @private | ||
* @param {string} js | ||
* @return {string} | ||
*/ | ||
function highlight(js) { | ||
return js | ||
.replace(/</g, '<') | ||
.replace(/>/g, '>') | ||
.replace(/\/\/(.*)/gm, '<span class="comment">//$1</span>') | ||
.replace(/('.*?')/gm, '<span class="string">$1</span>') | ||
.replace(/(\d+\.\d+)/gm, '<span class="number">$1</span>') | ||
.replace(/(\d+)/gm, '<span class="number">$1</span>') | ||
.replace( | ||
/\bnew[ \t]+(\w+)/gm, | ||
'<span class="keyword">new</span> <span class="init">$1</span>' | ||
) | ||
.replace( | ||
/\b(function|new|throw|return|var|if|else)\b/gm, | ||
'<span class="keyword">$1</span>' | ||
); | ||
} | ||
|
||
/** | ||
* Highlight the contents of tag `name`. | ||
* | ||
* @private | ||
* @param {string} name | ||
*/ | ||
module.exports = function highlightTags(name) { | ||
var code = document.getElementById('mocha').getElementsByTagName(name); | ||
for (var i = 0, len = code.length; i < len; ++i) { | ||
code[i].innerHTML = highlight(code[i].innerHTML); | ||
} | ||
}; |
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,24 @@ | ||
'use strict'; | ||
|
||
/** | ||
* Parse the given `qs`. | ||
* | ||
* @private | ||
* @param {string} qs | ||
* @return {Object<string, string>} | ||
*/ | ||
module.exports = function parseQuery(qs) { | ||
return qs | ||
.replace('?', '') | ||
.split('&') | ||
.reduce(function(obj, pair) { | ||
var i = pair.indexOf('='); | ||
var key = pair.slice(0, i); | ||
var val = pair.slice(++i); | ||
|
||
// Due to how the URLSearchParams API treats spaces | ||
obj[key] = decodeURIComponent(val.replace(/\+/g, '%20')); | ||
|
||
return obj; | ||
}, {}); | ||
}; |
This file was deleted.
Oops, something went wrong.
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
Oops, something went wrong.