-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Rollup and babel in build pipeline #4293
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
24 commits
Select commit
Hold shift + click to select a range
65a61ed
Make browser specific TTY interop explicit instead of a magic bundlin…
Munter 8175492
Remove unnessessary browserify ignore of cli related files and chokidar
Munter 4ccc4c2
Extract lookupFiles from utils to avoid node dependencies in browser …
Munter 8d689fc
Replace browserify with rollup for main library bundling
Munter b0ec4b9
Polyfill global to check if IE11 will start working
Munter 606f4dd
Don't include esm-utils in browser build. Modern syntax breaks IE
Munter d25a7cc
Remove duplicate browserify configuration in karma config file
Munter 5c4b56a
Add custom karma rollup plugin and use it to bundle browser tests
Munter 5e229d4
add process.listeners impl
boneskull fe283dd
Extract browser-only helper functions from shared utils file to their…
Munter 7fcd39a
Add browserslist, babel, babel-preset-env and prepare for modern js
Munter eedd4e6
Add mocha.js.map to npm distributed files
Munter 822515a
Use util function to check if we're running in a browser
Munter 052acb6
Improve documentation of self-built karma-rollup-plugin
Munter eaf7220
Renamed lib/cli/lookupFiles.js to lib/cli/lookup-files.js
Munter 1a6176c
Clean up rollup config
Munter ac4aa46
Kebab case file names
Munter b8c30ed
Remove last traces of unused browserify
Munter 5b08dec
fix bundle path under win32
boneskull ea59f88
do not run bundle visualizer in CI
boneskull 6be6606
Remove use of mocha.opts in browser testing
Munter 207ef63
Replace package.json browser field with manual rollup exclusion and a…
Munter f01aeba
Improved naming of rollup plugin to pick values from package.json
Munter 7739689
Revert "Replace package.json browser field with manual rollup exclusi…
Munter File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 |
|---|---|---|
|
|
@@ -5,8 +5,9 @@ extends: | |
| env: | ||
| node: true | ||
| browser: true | ||
| es6: true | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. is this needed with |
||
| parserOptions: | ||
| ecmaVersion: 5 | ||
| ecmaVersion: 2018 | ||
| ecmaFeatures: | ||
| jsx: false | ||
| sourceType: script | ||
|
|
@@ -37,8 +38,6 @@ overrides: | |
| - 'test/integration/helpers.js' | ||
| - 'test/integration/options/watch.spec.js' | ||
| - 'test/node-unit/**/*.js' | ||
| parserOptions: | ||
| ecmaVersion: 2018 | ||
| env: | ||
| browser: false | ||
| rules: | ||
|
|
@@ -48,6 +47,8 @@ overrides: | |
| property: 'assign' | ||
| - files: | ||
| - esm-utils.js | ||
| - rollup.config.js | ||
| - scripts/pick-from-package-json.js | ||
| parserOptions: | ||
| ecmaVersion: 2018 | ||
| sourceType: module | ||
|
|
||
This file contains hidden or 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 hidden or 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 hidden or 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 |
|---|---|---|
|
|
@@ -3,6 +3,7 @@ | |
| const fs = require('fs'); | ||
| const path = require('path'); | ||
| const os = require('os'); | ||
| const rollupPlugin = require('./scripts/karma-rollup-plugin'); | ||
| const baseBundleDirpath = path.join(__dirname, '.karma'); | ||
|
|
||
| const hostname = os.hostname(); | ||
|
|
@@ -18,51 +19,31 @@ const browserPlatformPairs = { | |
| module.exports = config => { | ||
| let bundleDirpath; | ||
| const cfg = { | ||
| frameworks: ['browserify', 'mocha'], | ||
| frameworks: ['rollup', 'mocha'], | ||
| files: [ | ||
| // we use the BDD interface for all of the tests that | ||
| // aren't interface-specific. | ||
| 'test/unit/*.spec.js' | ||
| ], | ||
| preprocessors: { | ||
| 'test/**/*.js': ['browserify'] | ||
| }, | ||
| browserify: { | ||
| debug: true, | ||
| configure: function configure(b) { | ||
| b.ignore('chokidar') | ||
| .ignore('fs') | ||
| .ignore('glob') | ||
| .ignore('path') | ||
| .ignore('supports-color') | ||
| .ignore('./lib/esm-utils.js') | ||
| .ignore('./lib/cli/*.js') | ||
| .ignore('./lib/nodejs/serializer.js') | ||
| .ignore('./lib/nodejs/worker.js') | ||
| .ignore('./lib/nodejs/buffered-worker-pool.js') | ||
| .ignore('./lib/nodejs/parallel-buffered-runner.js') | ||
| .ignore('./lib/nodejs/reporters/parallel-buffered.js') | ||
| .on('bundled', (err, content) => { | ||
| if (err) { | ||
| throw err; | ||
| } | ||
| if (bundleDirpath) { | ||
| // write bundle to directory for debugging | ||
| fs.writeFileSync( | ||
| path.join(bundleDirpath, `mocha.${Date.now()}.js`), | ||
| content | ||
| ); | ||
| } | ||
| }); | ||
| } | ||
| plugins: [ | ||
| 'karma-mocha', | ||
| 'karma-mocha-reporter', | ||
| 'karma-sauce-launcher', | ||
| 'karma-chrome-launcher', | ||
| rollupPlugin | ||
| ], | ||
| rollup: { | ||
| configFile: 'rollup.config.js', | ||
| include: ['test/**'], | ||
| bundlePath: bundleDirpath | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nice |
||
| }, | ||
| reporters: ['mocha'], | ||
| colors: true, | ||
|
Munter marked this conversation as resolved.
|
||
| browsers: ['ChromeHeadless'], | ||
| logLevel: config.LOG_INFO, | ||
| client: { | ||
| mocha: { | ||
| opts: require.resolve('./test/browser-specific/mocha.opts') | ||
| reporter: 'html' | ||
| } | ||
| }, | ||
| mochaReporter: { | ||
|
|
||
This file contains hidden or 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 hidden or 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 hidden or 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.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.