From 2f9901da295fc87737338a843d71249f730d20ad Mon Sep 17 00:00:00 2001 From: Martin Date: Tue, 14 Mar 2017 16:37:24 +0500 Subject: [PATCH 01/63] invalid json: add failing test --- test/json.js | 10 ++++++++++ test/json/invalid.js | 2 ++ test/json/invalid.json | 3 +++ 3 files changed, 15 insertions(+) create mode 100644 test/json/invalid.js create mode 100644 test/json/invalid.json diff --git a/test/json.js b/test/json.js index ffa5333f4..a942791c0 100644 --- a/test/json.js +++ b/test/json.js @@ -42,3 +42,13 @@ test('evil json', function (t) { vm.runInNewContext(src, c); }); }); + +test('invalid json', function (t) { + var b = browserify(); + t.plan(1); + b.add(__dirname + '/json/invalid.js'); + b.bundle(function (err, src) { + //console.log(src); + t.ok(err); + }); +}); diff --git a/test/json/invalid.js b/test/json/invalid.js new file mode 100644 index 000000000..36ef338f4 --- /dev/null +++ b/test/json/invalid.js @@ -0,0 +1,2 @@ +ex(require('./invalid.json')); +ex(require('./invalid')); diff --git a/test/json/invalid.json b/test/json/invalid.json new file mode 100644 index 000000000..fb73e57aa --- /dev/null +++ b/test/json/invalid.json @@ -0,0 +1,3 @@ +{ + key: "value" +} \ No newline at end of file From 49c5649c27dec227e0c67271c2aea511bfc6dbd4 Mon Sep 17 00:00:00 2001 From: Martin Date: Tue, 14 Mar 2017 17:51:34 +0500 Subject: [PATCH 02/63] stop on invalid json --- index.js | 9 ++++++++- test/json.js | 1 - 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/index.js b/index.js index b8bf81d25..c364de45d 100644 --- a/index.js +++ b/index.js @@ -656,7 +656,14 @@ Browserify.prototype._recorder = function (opts) { Browserify.prototype._json = function () { return through.obj(function (row, enc, next) { if (/\.json$/.test(row.file)) { - row.source = 'module.exports=' + sanitize(row.source); + var sanitizedString = sanitize(row.source); + try { + // check json validity + JSON.parse(sanitizedString); + row.source = 'module.exports=' + sanitizedString; + } catch (e) { + this.emit('error', syntaxError(e.message, row.file || row.id)); + } } this.push(row); next(); diff --git a/test/json.js b/test/json.js index a942791c0..64549edeb 100644 --- a/test/json.js +++ b/test/json.js @@ -48,7 +48,6 @@ test('invalid json', function (t) { t.plan(1); b.add(__dirname + '/json/invalid.js'); b.bundle(function (err, src) { - //console.log(src); t.ok(err); }); }); From 5d803b8cad9cc49afde72f276b1348f7b238aebc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9e=20Kooi?= Date: Fri, 16 Feb 2018 15:43:53 +0100 Subject: [PATCH 03/63] fix emitting json syntax error --- index.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/index.js b/index.js index c364de45d..b46ed9100 100644 --- a/index.js +++ b/index.js @@ -661,8 +661,10 @@ Browserify.prototype._json = function () { // check json validity JSON.parse(sanitizedString); row.source = 'module.exports=' + sanitizedString; - } catch (e) { - this.emit('error', syntaxError(e.message, row.file || row.id)); + } catch (err) { + err.message = 'While parsing ' + (row.file || row.id) + ': ' + err.message + this.emit('error', err); + return; } } this.push(row); From 2d896a9fcb1ba3227d413e242c2b825460de2db7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9e=20Kooi?= Date: Wed, 28 Feb 2018 10:35:54 +0100 Subject: [PATCH 04/63] Try adding appveyor --- appveyor.yml | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 appveyor.yml diff --git a/appveyor.yml b/appveyor.yml new file mode 100644 index 000000000..ad7043c0d --- /dev/null +++ b/appveyor.yml @@ -0,0 +1,26 @@ +environment: + matrix: + - nodejs_version: "9" + - nodejs_version: "8" + - nodejs_version: "6" + - nodejs_version: "4" + - nodejs_version: "0.12" + - nodejs_version: "0.10" + +# Install scripts. (runs after repo cloning) +install: + # Get the latest stable version of Node.js or io.js + - ps: Install-Product node $env:nodejs_version + # install modules + - npm install + +# Post-install test scripts. +test_script: + # Output useful info for debugging. + - node --version + - npm --version + # run tests + - npm test + +# Don't actually build. +build: off From c5120b75dd9c6c54d550bf151adb4f9b7583ee87 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9e=20Kooi?= Date: Wed, 21 Mar 2018 16:58:28 +0100 Subject: [PATCH 05/63] Fix tests on Windows. - Use path.join in more places in tests so they can run on windows - Fix noParse check on windows - Fix regex in multi_entry test for windows paths - Skip symlink tests on windows - Fix ignore check on windows - Fix paths in noparse and ignore tests on windows. --- index.js | 4 +- test/delay.js | 5 +- test/entry.js | 5 +- test/entry_expose.js | 1 - test/entry_relative.js | 5 +- test/file_event.js | 2 +- test/global_noparse.js | 3 +- test/ignore.js | 181 +++++++++++++++--------------- test/multi_entry.js | 9 +- test/multi_entry_cross_require.js | 7 +- test/multi_symlink.js | 2 +- test/noparse.js | 4 +- test/preserve-symlinks.js | 8 +- test/shared_symlink.js | 2 +- test/symlink_dedupe.js | 2 +- test/tr_symlink.js | 2 +- 16 files changed, 124 insertions(+), 118 deletions(-) diff --git a/index.js b/index.js index b8bf81d25..82c9c4a19 100644 --- a/index.js +++ b/index.js @@ -498,7 +498,7 @@ Browserify.prototype._createDeps = function (opts) { return cb(null, paths.empty, {}); } if (file && self._ignore.length) { - var nm = file.split('/node_modules/')[1]; + var nm = file.replace(/\\/g, '/').split('/node_modules/')[1]; if (nm) { nm = nm.split('/')[0]; if (self._ignore.indexOf(nm) >= 0) { @@ -576,7 +576,7 @@ Browserify.prototype._createDeps = function (opts) { if (no.indexOf(file) >= 0) return through(); if (absno.indexOf(file) >= 0) return through(); - var parts = file.split('/node_modules/'); + var parts = file.replace(/\\/g, '/').split('/node_modules/'); for (var i = 0; i < no.length; i++) { if (typeof no[i] === 'function' && no[i](file)) { return through(); diff --git a/test/delay.js b/test/delay.js index 6335ee832..63c1d8785 100644 --- a/test/delay.js +++ b/test/delay.js @@ -1,5 +1,6 @@ var browserify = require('../'); var vm = require('vm'); +var path = require('path'); var test = require('tap').test; var through = require('through2'); @@ -9,8 +10,8 @@ test('delay for pipelines', function (t) { var b = browserify(__dirname + '/delay/main.js'); b.pipeline.get('record').push(through.obj(function (row, enc, next) { if (row.file) { - t.equal(row.file, __dirname + '/delay/main.js'); - row.file = __dirname + '/delay/diverted.js'; + t.equal(row.file, path.join(__dirname, 'delay/main.js')); + row.file = path.join(__dirname, 'delay/diverted.js'); } this.push(row); next(); diff --git a/test/entry.js b/test/entry.js index 34d91e9f6..23a2ee254 100644 --- a/test/entry.js +++ b/test/entry.js @@ -1,5 +1,6 @@ var browserify = require('../'); var vm = require('vm'); +var path = require('path'); var test = require('tap').test; test('entry', function (t) { @@ -7,7 +8,7 @@ test('entry', function (t) { var b = browserify(__dirname + '/entry/main.js'); b.on('dep', function(row) { - if (row.entry) t.equal(row.file, __dirname + '/entry/main.js'); + if (row.entry) t.equal(row.file, path.join(__dirname, 'entry/main.js')); }); b.bundle(function (err, src) { var c = { @@ -27,7 +28,7 @@ test('entry via add', function (t) { var b = browserify(); b.add(__dirname + '/entry/main.js'); b.on('dep', function(row) { - if (row.entry) t.equal(row.file, __dirname + '/entry/main.js'); + if (row.entry) t.equal(row.file, path.join(__dirname, 'entry/main.js')); }); b.bundle(function (err, src) { var c = { diff --git a/test/entry_expose.js b/test/entry_expose.js index 2323c2cb9..381bdc5f5 100644 --- a/test/entry_expose.js +++ b/test/entry_expose.js @@ -1,6 +1,5 @@ var test = require('tap').test; var browserify = require('../'); -var path = require('path'); var vm = require('vm'); test('entry expose', function (t) { diff --git a/test/entry_relative.js b/test/entry_relative.js index f1ae37f2c..178a8ac1b 100644 --- a/test/entry_relative.js +++ b/test/entry_relative.js @@ -1,5 +1,6 @@ var browserify = require('../'); var vm = require('vm'); +var path = require('path'); var test = require('tap').test; test('entry - relative path', function (t) { @@ -9,7 +10,7 @@ test('entry - relative path', function (t) { var b = browserify('entry/main.js'); b.on('dep', function(row) { - if (row.entry) t.equal(row.file, __dirname + '/entry/main.js'); + if (row.entry) t.equal(row.file, path.join(__dirname, 'entry/main.js')); }); b.bundle(function (err, src) { var c = { @@ -29,7 +30,7 @@ test('entry - relative path via add', function (t) { var b = browserify({basedir: __dirname}); b.add('entry/main.js'); b.on('dep', function(row) { - if (row.entry) t.equal(row.file, __dirname + '/entry/main.js'); + if (row.entry) t.equal(row.file, path.join(__dirname, 'entry/main.js')); }); b.bundle(function (err, src) { var c = { diff --git a/test/file_event.js b/test/file_event.js index 285ccafa6..33ac36ce5 100644 --- a/test/file_event.js +++ b/test/file_event.js @@ -8,7 +8,7 @@ test('file event', function (t) { var b = browserify(__dirname + '/entry/main.js'); var files = { - 'main.js': __dirname + '/entry/main.js', + 'main.js': path.join(__dirname, 'entry/main.js'), 'one.js': './one', 'two.js': './two' }; diff --git a/test/global_noparse.js b/test/global_noparse.js index decd772da..a4e5a7051 100644 --- a/test/global_noparse.js +++ b/test/global_noparse.js @@ -1,5 +1,6 @@ var browserify = require('../'); var vm = require('vm'); +var path = require('path'); var test = require('tap').test; test('global noparse module', function (t) { @@ -84,7 +85,7 @@ test('global noparse function', function (t) { var b = browserify({ noParse: function(file) { - return file === __dirname + '/global/filename.js'; + return file === path.join(__dirname, 'global/filename.js'); } }); b.require(__dirname + '/global/filename.js', { expose: 'x' }); diff --git a/test/ignore.js b/test/ignore.js index fe19a2e00..4cb70971f 100644 --- a/test/ignore.js +++ b/test/ignore.js @@ -1,90 +1,91 @@ -var browserify = require('../'); -var test = require('tap').test; -var vm = require('vm'); - -test('ignore', function (t) { - t.plan(1); - - var b = browserify(); - b.add(__dirname + '/ignore/main.js'); - b.ignore( __dirname + '/ignore/skip.js'); - - b.bundle(function (err, src) { - if (err) t.fail(err); - vm.runInNewContext(src, { t: t }); - }); -}); - -test('ignore array', function(t) { - t.plan(2); - - var b = browserify(); - b.add(__dirname + '/ignore/array.js'); - b.ignore([ - __dirname + '/ignore/skip.js', - __dirname + '/ignore/skip2.js' - ]); - - b.bundle(function (err, src) { - if (err) { - t.fail(err); - } - vm.runInNewContext(src, { t: t }); - }); -}); - -test('ignore by package or id', function (t) { - t.plan(3); - - var b = browserify(); - b.add(__dirname + '/ignore/by-id.js'); - b.ignore('events'); - b.ignore('beep'); - b.ignore('bad id'); - - b.bundle(function (err, src) { - if (err) t.fail(err); - vm.runInNewContext(src, { t: t }); - }); -}); - -test('ignore files referenced by relative path', function (t) { - // Change the current working directory relative to this file - var cwd = process.cwd(); - process.chdir(__dirname); - - t.plan(1); - - var b = browserify(); - b.add(__dirname + '/ignore/by-relative.js'); - b.ignore('./ignore/ignored/skip.js'); - - b.bundle(function (err, src) { - if (err) t.fail(err); - vm.runInNewContext(src, { t: t }); - }); - - // Revert CWD - process.chdir(cwd); -}); - -test('do not ignore files with relative paths that do not resolve', function (t) { - // Change the current working directory to the ignore folder - var cwd = process.cwd(); - process.chdir(__dirname + '/ignore'); - - t.plan(2); - - var b = browserify(); - b.add(__dirname + '/ignore/double-skip.js'); - - b.ignore('./skip.js'); - - b.bundle(function (err, src) { - if (err) t.fail(err); - vm.runInNewContext(src, { t: t }); - }); - - // Revert CWD - process.chdir(cwd); -}); +var browserify = require('../'); +var test = require('tap').test; +var vm = require('vm'); +var path = require('path'); + +test('ignore', function (t) { + t.plan(1); + + var b = browserify(); + b.add(__dirname + '/ignore/main.js'); + b.ignore(path.join(__dirname, 'ignore/skip.js')); + + b.bundle(function (err, src) { + if (err) t.fail(err); + vm.runInNewContext(src, { t: t }); + }); +}); + +test('ignore array', function(t) { + t.plan(2); + + var b = browserify(); + b.add(__dirname + '/ignore/array.js'); + b.ignore([ + path.join(__dirname, 'ignore/skip.js'), + path.join(__dirname, 'ignore/skip2.js') + ]); + + b.bundle(function (err, src) { + if (err) { + t.fail(err); + } + vm.runInNewContext(src, { t: t }); + }); +}); + +test('ignore by package or id', function (t) { + t.plan(3); + + var b = browserify(); + b.add(__dirname + '/ignore/by-id.js'); + b.ignore('events'); + b.ignore('beep'); + b.ignore('bad id'); + + b.bundle(function (err, src) { + if (err) t.fail(err); + vm.runInNewContext(src, { t: t }); + }); +}); + +test('ignore files referenced by relative path', function (t) { + // Change the current working directory relative to this file + var cwd = process.cwd(); + process.chdir(__dirname); + + t.plan(1); + + var b = browserify(); + b.add(__dirname + '/ignore/by-relative.js'); + b.ignore('./ignore/ignored/skip.js'); + + b.bundle(function (err, src) { + if (err) t.fail(err); + vm.runInNewContext(src, { t: t }); + }); + + // Revert CWD + process.chdir(cwd); +}); + +test('do not ignore files with relative paths that do not resolve', function (t) { + // Change the current working directory to the ignore folder + var cwd = process.cwd(); + process.chdir(__dirname + '/ignore'); + + t.plan(2); + + var b = browserify(); + b.add(__dirname + '/ignore/double-skip.js'); + + b.ignore('./skip.js'); + + b.bundle(function (err, src) { + if (err) t.fail(err); + vm.runInNewContext(src, { t: t }); + }); + + // Revert CWD + process.chdir(cwd); +}); diff --git a/test/multi_entry.js b/test/multi_entry.js index f910eddc2..e38a7b3b4 100644 --- a/test/multi_entry.js +++ b/test/multi_entry.js @@ -1,12 +1,13 @@ var browserify = require('../'); var vm = require('vm'); +var path = require('path'); var test = require('tap').test; var fs = require('fs'); var testFiles = [ - __dirname + '/multi_entry/a.js', - __dirname + '/multi_entry/b.js', - __dirname + '/multi_entry/c.js' + path.join(__dirname, 'multi_entry/a.js'), + path.join(__dirname, 'multi_entry/b.js'), + path.join(__dirname, 'multi_entry/c.js') ]; test('multi entry', function (t) { @@ -105,7 +106,7 @@ test('entries as streams', function (t) { if (row.entry) { t.similar( row.file, - RegExp(__dirname + '/multi_entry/_stream_[\\d].js'), + RegExp(path.join(__dirname, 'multi_entry/_stream_').replace(/\\/g, '\\\\') + '[\\d].js'), 'should be full entry path' ); } diff --git a/test/multi_entry_cross_require.js b/test/multi_entry_cross_require.js index 0cc1a8829..43f04ea51 100644 --- a/test/multi_entry_cross_require.js +++ b/test/multi_entry_cross_require.js @@ -1,11 +1,12 @@ var browserify = require('../'); var vm = require('vm'); +var path = require('path'); var test = require('tap').test; var testFiles = [ - __dirname + '/multi_entry_cross_require/a.js', - __dirname + '/multi_entry_cross_require/lib/b.js', - __dirname + '/multi_entry_cross_require/c.js' + path.join(__dirname, 'multi_entry_cross_require/a.js'), + path.join(__dirname, 'multi_entry_cross_require/lib/b.js'), + path.join(__dirname, 'multi_entry_cross_require/c.js') ]; test('multi entry cross require', function (t) { diff --git a/test/multi_symlink.js b/test/multi_symlink.js index 913c7a3be..08a5b1dd6 100644 --- a/test/multi_symlink.js +++ b/test/multi_symlink.js @@ -2,7 +2,7 @@ var browserify = require('../'); var vm = require('vm'); var test = require('tap').test; -test('multiple symlink execution', function (t) { +test('multiple symlink execution', { skip: process.platform === 'win32' }, function (t) { t.plan(1); var b = browserify(__dirname + '/multi_symlink/main.js'); b.bundle(function (err, src) { diff --git a/test/noparse.js b/test/noparse.js index 7d0b3b272..ddb024df1 100644 --- a/test/noparse.js +++ b/test/noparse.js @@ -18,8 +18,8 @@ test('noParse array', function (t) { var b = browserify({ entries: [ __dirname + '/noparse/a.js' ], noParse: [ - __dirname + '/noparse/dir1/1.js', - __dirname + '/noparse/node_modules/robot/main.js' + path.join(__dirname, 'noparse/dir1/1.js'), + path.join(__dirname, 'noparse/node_modules/robot/main.js') ] }); b.on('dep', function(dep) { actual.push(dep.file); }); diff --git a/test/preserve-symlinks.js b/test/preserve-symlinks.js index aefb99361..83940ddc4 100644 --- a/test/preserve-symlinks.js +++ b/test/preserve-symlinks.js @@ -2,24 +2,24 @@ var browserify = require('../'); var vm = require('vm'); var test = require('tap').test; -test('optionally preserves symlinks', function (t) { +test('optionally preserves symlinks', { skip: process.platform === 'win32' }, function (t) { t.plan(2); var b = browserify(__dirname + '/preserve_symlinks/a/index.js', {preserveSymlinks: true}); b.bundle(function (err, buf) { - t.ok(!err); + t.ifError(err); t.ok(buf); var src = buf.toString('utf8'); vm.runInNewContext(src, {}); }); }); -test('always resolve entry point symlink', function (t) { +test('always resolve entry point symlink', { skip: process.platform === 'win32' }, function (t) { t.plan(2); var b = browserify(__dirname + '/preserve_symlinks/linked-entry.js', {preserveSymlinks: true}); b.bundle(function (err, buf) { - t.ok(!err); + t.ifError(err); t.ok(buf); var src = buf.toString('utf8'); vm.runInNewContext(src, {}); diff --git a/test/shared_symlink.js b/test/shared_symlink.js index d5287c139..f10d57339 100644 --- a/test/shared_symlink.js +++ b/test/shared_symlink.js @@ -4,7 +4,7 @@ var browserify = require('../'); var vm = require('vm'); var test = require('tap').test; -test('shared symlink', function (t) { +test('shared symlink', { skip: process.platform === 'win32' }, function (t) { t.plan(1); var b = browserify(__dirname + '/shared_symlink/main.js'); b.bundle(function (err, src) { diff --git a/test/symlink_dedupe.js b/test/symlink_dedupe.js index 00d21d15c..dbc7afe63 100644 --- a/test/symlink_dedupe.js +++ b/test/symlink_dedupe.js @@ -2,7 +2,7 @@ var browserify = require('../'); var vm = require('vm'); var test = require('tap').test; -test('hash instances with hashed contexts', function (t) { +test('hash instances with hashed contexts', { skip: process.platform === 'win32' }, function (t) { t.plan(5); var b = browserify(__dirname + '/symlink_dedupe/main.js'); diff --git a/test/tr_symlink.js b/test/tr_symlink.js index ae3210a50..9fcca56de 100644 --- a/test/tr_symlink.js +++ b/test/tr_symlink.js @@ -6,7 +6,7 @@ var vm = require('vm'); var test = require('tap').test; var through = require('through2'); -test('transform symlink', function (t) { +test('transform symlink', { skip: process.platform === 'win32' }, function (t) { t.plan(4); var expected = [ 9, 555, 777 ]; var b = browserify(__dirname + '/tr_symlink/app/main.js', { From c428f0c38ccf34a4e0c49a70eb96f28c2f642a58 Mon Sep 17 00:00:00 2001 From: Su-Shing Chen Date: Mon, 20 Mar 2017 16:33:28 +1300 Subject: [PATCH 06/63] Fix external relative paths on Windows Replace backslashes with forward slashes when adding relative paths for external references. --- index.js | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/index.js b/index.js index 82c9c4a19..54dcf2c6e 100644 --- a/index.js +++ b/index.js @@ -30,7 +30,8 @@ inherits(Browserify, EventEmitter); var fs = require('fs'); var path = require('path'); -var relativePath = require('cached-path-relative') +var cachedPathRelative = require('cached-path-relative'); + var paths = { empty: path.join(__dirname, 'lib/_empty.js') }; @@ -136,14 +137,12 @@ Browserify.prototype.require = function (file, opts) { var expose = opts.expose; if (file === expose && /^[\.]/.test(expose)) { expose = '/' + relativePath(basedir, expose); - expose = expose.replace(/\\/g, '/'); } if (expose === undefined && this._options.exposeAll) { expose = true; } if (expose === true) { expose = '/' + relativePath(basedir, file); - expose = expose.replace(/\\/g, '/'); } if (isStream(file)) { @@ -789,8 +788,7 @@ Browserify.prototype._debug = function (opts) { return through.obj(function (row, enc, next) { if (opts.debug) { row.sourceRoot = 'file://localhost'; - row.sourceFile = relativePath(basedir, row.file) - .replace(/\\/g, '/'); + row.sourceFile = relativePath(basedir, row.file); } this.push(row); next(); @@ -855,3 +853,7 @@ function isExternalModule (file) { /^[\/.]/; return !regexp.test(file); } +function relativePath (from, to) { + // Replace \ with / for OS-independent behavior + return cachedPathRelative(from, to).replace(/\\/g, '/'); +} From e39d6096efce81ce726229db23a1d0aac45f92bf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9e=20Kooi?= Date: Tue, 8 May 2018 11:43:15 +0200 Subject: [PATCH 07/63] Skip failing test on old Node on Windows Not sure why this is failing, and can't test it well, so skipping for now with a TODO comment --- .travis.yml | 1 + appveyor.yml | 1 + test/error_code.js | 5 ++++- test/external_shim.js | 2 +- 4 files changed, 7 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 143cf3d29..0ad727779 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,5 +1,6 @@ language: node_js node_js: + - "10" - "9" - "8" - "6" diff --git a/appveyor.yml b/appveyor.yml index ad7043c0d..d4dac1bd9 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -1,5 +1,6 @@ environment: matrix: + - nodejs_version: "10" - nodejs_version: "9" - nodejs_version: "8" - nodejs_version: "6" diff --git a/test/error_code.js b/test/error_code.js index 2f3734c24..443b89621 100644 --- a/test/error_code.js +++ b/test/error_code.js @@ -2,7 +2,10 @@ var test = require('tap').test; var spawn = require('child_process').spawn; var path = require('path'); -test('error code', function (t) { +// TODO this should be fixable I guess +var knownFailure = process.platform === 'win32' && /^v0\.10\.\d+$/.test(process.version); + +test('error code', { skip: knownFailure }, function (t) { t.plan(2); var cwd = process.cwd(); diff --git a/test/external_shim.js b/test/external_shim.js index 63739c00a..1c251242a 100644 --- a/test/external_shim.js +++ b/test/external_shim.js @@ -3,6 +3,7 @@ var vm = require('vm'); var test = require('tap').test; test('requiring a shimmed module name from an external bundle', function (t) { + t.plan(1); var b1 = browserify(); var b2 = browserify(); @@ -12,7 +13,6 @@ test('requiring a shimmed module name from an external bundle', function (t) { b1.bundle(function (err, src1) { b2.bundle(function (err, src2) { - t.plan(1); var c = { console: console, From 370315469bac31b54c2a17afe2b25dae7208d603 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9e=20Kooi?= Date: Tue, 8 May 2018 12:44:17 +0200 Subject: [PATCH 08/63] Disable invalid json chars test in node 10 --- package.json | 1 + test/error_code.js | 3 ++- test/json.js | 6 +++++- 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 60ef6d8a6..f0423055e 100644 --- a/package.json +++ b/package.json @@ -81,6 +81,7 @@ "has-template-literals": "^1.0.0", "isstream": "^0.1.2", "make-generator-function": "^1.1.0", + "semver": "^5.5.0", "seq": "0.3.5", "tap": "^10.7.2", "temp": "^0.8.1", diff --git a/test/error_code.js b/test/error_code.js index 443b89621..5d0b2b1d7 100644 --- a/test/error_code.js +++ b/test/error_code.js @@ -1,9 +1,10 @@ var test = require('tap').test; var spawn = require('child_process').spawn; var path = require('path'); +var semver = require('semver'); // TODO this should be fixable I guess -var knownFailure = process.platform === 'win32' && /^v0\.10\.\d+$/.test(process.version); +var knownFailure = process.platform === 'win32' && semver.satisfies(process.version, 'v0.10.x'); test('error code', { skip: knownFailure }, function (t) { t.plan(2); diff --git a/test/json.js b/test/json.js index ffa5333f4..e0f2e27ea 100644 --- a/test/json.js +++ b/test/json.js @@ -1,6 +1,7 @@ var browserify = require('../'); var fs = require('fs'); var vm = require('vm'); +var semver = require('semver'); var test = require('tap').test; test('json', function (t) { @@ -18,7 +19,10 @@ test('json', function (t) { }); }); -test('verify evil json', function(t) { +// This works in Node v10 and up thanks to the JSON superset proposal, which +// allows the evil chars in javascript strings. +// https://github.com/tc39/proposal-json-superset +test('verify evil json', { skip: semver.gte(process.version, 'v10.0.0') }, function(t) { t.plan(1); fs.readFile(__dirname + '/json/evil-chars.json', function(err, data) { if (err) t.fail(err); From 8e7cb8737d0c5d89266ac6fc42f8e6086659957b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9e=20Kooi?= Date: Tue, 8 May 2018 13:24:06 +0200 Subject: [PATCH 09/63] Skip flaky test on Windows w old Node --- test/bin_tr_error.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/test/bin_tr_error.js b/test/bin_tr_error.js index 039704cca..a68127545 100644 --- a/test/bin_tr_error.js +++ b/test/bin_tr_error.js @@ -2,8 +2,12 @@ var browserify = require('../'); var spawn = require('child_process').spawn; var test = require('tap').test; var path = require('path') +var semver = require('semver'); -test('function transform', function (t) { +// TODO this should be fixable I guess +var flaky = process.platform === 'win32' && semver.satisfies(process.version, 'v0.10.x'); + +test('function transform', { skip: flaky }, function (t) { t.plan(3); var ps = spawn(process.execPath, [ path.resolve(__dirname, '../bin/cmd.js'), From 36d7c9aa88a82473df80dc82a1dfa5a0ef996baa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9e=20Kooi?= Date: Wed, 9 May 2018 09:55:29 +0200 Subject: [PATCH 10/63] 16.2.1 --- changelog.markdown | 10 ++++++++++ package.json | 2 +- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/changelog.markdown b/changelog.markdown index ccd3da31a..eb0082373 100644 --- a/changelog.markdown +++ b/changelog.markdown @@ -1,3 +1,13 @@ +# 16.2.1 + +Fix relative `--external` paths on Windows. + +https://github.com/browserify/browserify/pull/1704 + +Fix tests to work on Windows, and add Appveyor CI for Windows testing. + +https://github.com/browserify/browserify/pull/1819 + # 16.2.0 update the browser versions of `vm-browserify` and `string_decoder`. diff --git a/package.json b/package.json index f0423055e..22c1bc19e 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "browserify", - "version": "16.2.0", + "version": "16.2.1", "description": "browser-side require() the node way", "main": "index.js", "bin": { From fc30e509953bc75f77d0bc18070598ce71996479 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9e=20Kooi?= Date: Wed, 9 May 2018 09:59:57 +0200 Subject: [PATCH 11/63] 16.2.2 --- changelog.markdown | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/changelog.markdown b/changelog.markdown index eb0082373..85fc3e31c 100644 --- a/changelog.markdown +++ b/changelog.markdown @@ -1,3 +1,7 @@ +# 16.2.2 + +Remove some extraneous files from the published package. + # 16.2.1 Fix relative `--external` paths on Windows. From 38f7e1b6b8b9c646086352bb424f1f922b2085dd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9e=20Kooi?= Date: Wed, 30 May 2018 14:41:05 +0200 Subject: [PATCH 12/63] Upgrade events to v3.0.0. --- package.json | 2 +- test/util.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 22c1bc19e..e8e0a00c5 100644 --- a/package.json +++ b/package.json @@ -38,7 +38,7 @@ "deps-sort": "^2.0.0", "domain-browser": "^1.2.0", "duplexer2": "~0.1.2", - "events": "^2.0.0", + "events": "^3.0.0", "glob": "^7.1.0", "has": "^1.0.0", "htmlescape": "^1.1.0", diff --git a/test/util.js b/test/util.js index 760acf1e3..8efc112ae 100644 --- a/test/util.js +++ b/test/util.js @@ -46,7 +46,7 @@ test('util.inherits without Object.create', function (t) { b.require('events'); b.bundle(function (err, src) { - var c = { Object : { prototype: Object.prototype } }; + var c = { Object : { prototype: Object.prototype, defineProperty: Object.defineProperty } }; vm.runInNewContext(src, c); var EE = c.require('events').EventEmitter; From 420bf8374e25fde7434bba6c83bb32e0cc733b7d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9e=20Kooi?= Date: Wed, 6 Jun 2018 16:08:50 +0200 Subject: [PATCH 13/63] Update path-browserify to v1 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 22c1bc19e..745574bdf 100644 --- a/package.json +++ b/package.json @@ -50,7 +50,7 @@ "module-deps": "^6.0.0", "os-browserify": "~0.3.0", "parents": "^1.0.1", - "path-browserify": "~0.0.0", + "path-browserify": "^1.0.0", "process": "~0.11.0", "punycode": "^1.3.2", "querystring-es3": "~0.2.0", From 32d0a054275cd0f3cf8d138d78d24e2014ed3721 Mon Sep 17 00:00:00 2001 From: Farzon Lotfi Date: Sat, 16 Jun 2018 23:39:04 -0400 Subject: [PATCH 14/63] fix ReadME link. the old git gist link is no longer in use the new link is https://github.com/defunctzombie/package-browser-field-spec --- readme.markdown | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/readme.markdown b/readme.markdown index b3118771f..7d6f87e62 100644 --- a/readme.markdown +++ b/readme.markdown @@ -698,7 +698,7 @@ sophisticated things you can do in the package.json: ## browser field -There is a special "[browser](https://gist.github.com/4339901)" field you can +There is a special "[browser](https://github.com/defunctzombie/package-browser-field-spec)" field you can set in your package.json on a per-module basis to override file resolution for browser-specific versions of files. From b1e61aa6cdfd273835a22ff4fd060d6092dba18d Mon Sep 17 00:00:00 2001 From: Mohamed Akram Date: Mon, 23 Jul 2018 20:20:25 +0400 Subject: [PATCH 15/63] Add inspector builtin --- lib/builtins.js | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/builtins.js b/lib/builtins.js index 503be6eeb..3aaa280e6 100644 --- a/lib/builtins.js +++ b/lib/builtins.js @@ -12,6 +12,7 @@ exports.events = require.resolve('events/'); exports.fs = require.resolve('./_empty.js'); exports.http = require.resolve('stream-http'); exports.https = require.resolve('https-browserify'); +exports.inspector = require.resolve('./_empty.js'); exports.module = require.resolve('./_empty.js'); exports.net = require.resolve('./_empty.js'); exports.os = require.resolve('os-browserify/browser.js'); From cfd3af23f6383bb5899dbb5e39beb7834b042d85 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9e=20Kooi?= Date: Tue, 25 Sep 2018 16:31:43 +0200 Subject: [PATCH 16/63] 16.2.3 --- changelog.markdown | 10 ++++++++++ package.json | 2 +- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/changelog.markdown b/changelog.markdown index 85fc3e31c..ec63d8c91 100644 --- a/changelog.markdown +++ b/changelog.markdown @@ -1,3 +1,13 @@ +# 16.2.3 + +add empty stub for the `inspector` builtin module. + +https://github.com/browserify/browserify/pull/1854 + +change the "browser" field link to the browser-field-spec repo instead of the old gist. + +https://github.com/browserify/browserify/pull/1845 + # 16.2.2 Remove some extraneous files from the published package. diff --git a/package.json b/package.json index 22c1bc19e..c29b5f621 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "browserify", - "version": "16.2.1", + "version": "16.2.3", "description": "browser-side require() the node way", "main": "index.js", "bin": { From 8f80729102cebfaa34ca38bd31b53057ab8e78b8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9e=20Kooi?= Date: Mon, 1 Oct 2018 09:29:55 +0200 Subject: [PATCH 17/63] Update license Our license files includes some other licenses for things that used to be in-tree, but are now in separate modules with their own licenses. --- LICENSE | 66 --------------------------------------------------------- 1 file changed, 66 deletions(-) diff --git a/LICENSE b/LICENSE index eff138cad..ee27ba4b4 100644 --- a/LICENSE +++ b/LICENSE @@ -16,69 +16,3 @@ FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - ---- - -Some pieces from builtins/ taken from node core under this license: - ----- - -Copyright Joyent, Inc. and other Node contributors. - -Permission is hereby granted, free of charge, to any person obtaining a -copy of this software and associated documentation files (the -"Software"), to deal in the Software without restriction, including -without limitation the rights to use, copy, modify, merge, publish, -distribute, sublicense, and/or sell copies of the Software, and to permit -persons to whom the Software is furnished to do so, subject to the -following conditions: - -The above copyright notice and this permission notice shall be included -in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN -NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR -OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE -USE OR OTHER DEALINGS IN THE SOFTWARE. - ----- - -buffer_ieee754.js has this license in it: - ----- - -Copyright (c) 2008-2015, Fair Oaks Labs, Inc. -All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - - * Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - * Neither the name of Fair Oaks Labs, Inc. nor the names of its contributors - may be used to endorse or promote products derived from this software - without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE -LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -POSSIBILITY OF SUCH DAMAGE. - -Modifications to writeIEEE754 to support negative zeroes made by Brian White - ----- From 3192e5bfa38162142ec25004904d5453a83b38af Mon Sep 17 00:00:00 2001 From: Mike Stemle Date: Wed, 31 Oct 2018 08:59:21 -0400 Subject: [PATCH 18/63] I just spent two hours trying to figure out how to use this in such a manner, and pouring over the documentation. I finally found it, and thought I would add a small bit of documentation. --- readme.markdown | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/readme.markdown b/readme.markdown index 7d6f87e62..e4cc10bac 100644 --- a/readme.markdown +++ b/readme.markdown @@ -480,6 +480,14 @@ $ npm install -g derequire $ browserify main.js --standalone Foo | derequire > bundle.js ``` +```html + + +``` + `opts.insertGlobalVars` will be passed to [insert-module-globals](https://www.npmjs.com/package/insert-module-globals) as the `opts.vars` parameter. From f13b7132292931aa14476b2e9a44d76a5d1ae3c4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dominykas=20Blyz=CC=8Ce=CC=87?= Date: Tue, 24 Feb 2015 18:38:41 +0200 Subject: [PATCH 19/63] when a module is exposed, it should still resolve the way it would normally do, i.e. with/without extension and directories should fall back to index, and index from a directory should be accepted with/without extension too --- test/resolve_exposed.js | 70 ++++++++++++++++++++++++++++++++- test/resolve_exposed/y/index.js | 1 + 2 files changed, 70 insertions(+), 1 deletion(-) create mode 100644 test/resolve_exposed/y/index.js diff --git a/test/resolve_exposed.js b/test/resolve_exposed.js index 0d3efc24b..1dbea4211 100644 --- a/test/resolve_exposed.js +++ b/test/resolve_exposed.js @@ -4,7 +4,7 @@ var test = require('tap').test; test('resolve exposed files', function (t) { t.plan(2); - + var b = browserify(__dirname + '/resolve_exposed/main.js', { basedir: __dirname + '/resolve_exposed' }); @@ -18,3 +18,71 @@ test('resolve exposed files', function (t) { } }); }); + +test('resolve exposed files without extension', function (t) { + t.plan(2); + + var b = browserify(__dirname + '/resolve_exposed/main.js', { + basedir: __dirname + '/resolve_exposed' + }); + b.require('./x', {expose: 'xyz'}); + b.bundle(function (err, src) { + t.ifError(err); + var c = {console: {log: log}}; + vm.runInNewContext(src, c); + function log(x) { + t.equal(x, 333); + } + }); +}); + +test('resolve exposed directories', function (t) { + t.plan(2); + + var b = browserify(__dirname + '/resolve_exposed/main.js', { + basedir: __dirname + '/resolve_exposed' + }); + b.require('./y', {expose: 'xyz'}); + b.bundle(function (err, src) { + t.ifError(err); + var c = {console: {log: log}}; + vm.runInNewContext(src, c); + function log(x) { + t.equal(x, 555); + } + }); +}); + +test('resolve exposed index from directories', function (t) { + t.plan(2); + + var b = browserify(__dirname + '/resolve_exposed/main.js', { + basedir: __dirname + '/resolve_exposed' + }); + b.require('./y/index', {expose: 'xyz'}); + b.bundle(function (err, src) { + t.ifError(err); + var c = {console: {log: log}}; + vm.runInNewContext(src, c); + function log(x) { + t.equal(x, 555); + } + }); +}); + +test('resolve exposed index.js from directories', function (t) { + t.plan(2); + + var b = browserify(__dirname + '/resolve_exposed/main.js', { + basedir: __dirname + '/resolve_exposed' + }); + b.require('./y/index.js', {expose: 'xyz'}); + b.bundle(function (err, src) { + t.ifError(err); + var c = {console: {log: log}}; + vm.runInNewContext(src, c); + function log(x) { + t.equal(x, 555); + } + }); +}); diff --git a/test/resolve_exposed/y/index.js b/test/resolve_exposed/y/index.js new file mode 100644 index 000000000..caedade49 --- /dev/null +++ b/test/resolve_exposed/y/index.js @@ -0,0 +1 @@ +module.exports = 5 From 876182d36fbf68bae81304ac86fa67ee8de1685f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9e=20Kooi?= Date: Sat, 29 Jun 2019 11:27:59 +0200 Subject: [PATCH 20/63] Tweak license text so Github detects it correctly --- LICENSE | 27 +++++++++++++++------------ 1 file changed, 15 insertions(+), 12 deletions(-) diff --git a/LICENSE b/LICENSE index ee27ba4b4..59f71e2a1 100644 --- a/LICENSE +++ b/LICENSE @@ -1,18 +1,21 @@ -This software is released under the MIT license: +MIT License -Permission is hereby granted, free of charge, to any person obtaining a copy of -this software and associated documentation files (the "Software"), to deal in -the Software without restriction, including without limitation the rights to -use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of -the Software, and to permit persons to whom the Software is furnished to do so, -subject to the following conditions: +Copyright (c) 2010 James Halliday + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS -FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR -COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER -IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. From d2ade256a022a8841a3085396fb11db5581d3a3f Mon Sep 17 00:00:00 2001 From: Steve Taylor Date: Fri, 5 Jul 2019 23:21:59 +1000 Subject: [PATCH 21/63] Add http2 to builtins --- lib/builtins.js | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/builtins.js b/lib/builtins.js index 3aaa280e6..d7bdbe1ce 100644 --- a/lib/builtins.js +++ b/lib/builtins.js @@ -12,6 +12,7 @@ exports.events = require.resolve('events/'); exports.fs = require.resolve('./_empty.js'); exports.http = require.resolve('stream-http'); exports.https = require.resolve('https-browserify'); +exports.http2 = require.resolve('./_empty.js'); exports.inspector = require.resolve('./_empty.js'); exports.module = require.resolve('./_empty.js'); exports.net = require.resolve('./_empty.js'); From 9824fae234cdaa5321886793e0c84714e1ddd555 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9e=20Kooi?= Date: Fri, 5 Jul 2019 16:53:05 +0200 Subject: [PATCH 22/63] 16.3.0 --- changelog.markdown | 14 ++++++++++++++ package.json | 2 +- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/changelog.markdown b/changelog.markdown index ec63d8c91..23d1decd5 100644 --- a/changelog.markdown +++ b/changelog.markdown @@ -1,3 +1,17 @@ +# 16.3.0 + +add empty stub for the `http2` builtin module. + +https://github.com/browserify/browserify/pull/1913 + +update license text to remove references to code that is no longer included. + +https://github.com/browserify/browserify/pull/1906 + +add more tests for folder resolution. + +https://github.com/browserify/browserify/pull/1139 + # 16.2.3 add empty stub for the `inspector` builtin module. diff --git a/package.json b/package.json index c29b5f621..a86639ea9 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "browserify", - "version": "16.2.3", + "version": "16.3.0", "description": "browser-side require() the node way", "main": "index.js", "bin": { From 4a5ea7e86460c1b7026f1e0875249986b460e8b4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9e=20Kooi?= Date: Sun, 21 Jul 2019 10:25:00 +0200 Subject: [PATCH 23/63] Add funding.yml --- .github/FUNDING.yml | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 .github/FUNDING.yml diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml new file mode 100644 index 000000000..7d862baf6 --- /dev/null +++ b/.github/FUNDING.yml @@ -0,0 +1,12 @@ +# These are supported funding model platforms + +github: # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2] +patreon: # Replace with a single Patreon username +open_collective: # Replace with a single Open Collective username +ko_fi: # Replace with a single Ko-fi username +tidelift: npm/browserify +community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry +liberapay: # Replace with a single Liberapay username +issuehunt: # Replace with a single IssueHunt username +otechie: # Replace with a single Otechie username +custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2'] From 5dc1bf2ae5c3fdb973484b13fed39143ffa28751 Mon Sep 17 00:00:00 2001 From: Feross Aboukhadijeh Date: Tue, 6 Aug 2019 18:25:38 -0700 Subject: [PATCH 24/63] Upgrade stream-http to v3 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This version of stream-http drops support for IE10 and below. This should not require a major version bump since browserify 14.0.0 already upgraded the buffer package and dropped support for IE8-10. Since stream uses buffer internally, stream is already not working in IE8-10. This lets us get the latest and best improvements. --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index a86639ea9..7793600dd 100644 --- a/package.json +++ b/package.json @@ -60,7 +60,7 @@ "shasum": "^1.0.0", "shell-quote": "^1.6.1", "stream-browserify": "^2.0.0", - "stream-http": "^2.0.0", + "stream-http": "^3.0.0", "string_decoder": "^1.1.1", "subarg": "^1.0.0", "syntax-error": "^1.1.1", From f871a85e390f25ca5017e08a3f8f59354cddbc9f Mon Sep 17 00:00:00 2001 From: Feross Aboukhadijeh Date: Wed, 7 Aug 2019 17:13:12 -0700 Subject: [PATCH 25/63] Update changelog.markdown --- changelog.markdown | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/changelog.markdown b/changelog.markdown index 23d1decd5..58e5d5384 100644 --- a/changelog.markdown +++ b/changelog.markdown @@ -1,3 +1,9 @@ +# 16.4.0 + +Upgrade stream-http to v3. This version drops support for IE10 and below. + +https://github.com/browserify/browserify/pull/1916 + # 16.3.0 add empty stub for the `http2` builtin module. From 8980670c03a8a123da1fff22858a7e9210bbae09 Mon Sep 17 00:00:00 2001 From: Feross Aboukhadijeh Date: Wed, 7 Aug 2019 17:14:52 -0700 Subject: [PATCH 26/63] 16.4.0 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 7793600dd..2ae4bf3dc 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "browserify", - "version": "16.3.0", + "version": "16.4.0", "description": "browser-side require() the node way", "main": "index.js", "bin": { From 8213b6430eb0cd0ef1066a66297ffd7fb9637c50 Mon Sep 17 00:00:00 2001 From: Feross Aboukhadijeh Date: Wed, 7 Aug 2019 19:14:48 -0700 Subject: [PATCH 27/63] Support custom names for "browser" field resolution Fix: https://github.com/browserify/browserify/issues/1917 --- index.js | 11 +++++++++-- readme.markdown | 4 +++- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/index.js b/index.js index 54dcf2c6e..858a0cbbf 100644 --- a/index.js +++ b/index.js @@ -83,12 +83,19 @@ function Browserify (files, opts) { self._transforms = []; self._entryOrder = 0; self._ticked = false; - self._bresolve = opts.browserField === false + + var browserField = opts.browserField + self._bresolve = browserField === false ? function (id, opts, cb) { if (!opts.basedir) opts.basedir = path.dirname(opts.filename) resolve(id, opts, cb) } - : bresolve + : typeof browserField === 'string' + ? function (id, opts, cb) { + opts.browser = browserField + bresolve(id, opts, cb) + } + : bresolve ; self._syntaxCache = {}; diff --git a/readme.markdown b/readme.markdown index 7d6f87e62..87ee6d925 100644 --- a/readme.markdown +++ b/readme.markdown @@ -447,7 +447,9 @@ useful for preserving the original paths that a bundle was generated with. `opts.bundleExternal` boolean option to set if external modules should be bundled. Defaults to true. -When `opts.browserField` is false, the package.json browser field will be ignored. +When `opts.browserField` is false, the package.json browser field will be +ignored. When `opts.browserField` is set to a `string`, then a custom field name +can be used instead of the default `"browser"` field. When `opts.insertGlobals` is true, always insert `process`, `global`, `__filename`, and `__dirname` without analyzing the AST for faster builds but From 85489ccff51efca2fd8b4c94cb5bd23ec7ff1070 Mon Sep 17 00:00:00 2001 From: Feross Aboukhadijeh Date: Thu, 8 Aug 2019 22:27:52 -0700 Subject: [PATCH 28/63] Update changelog.markdown --- changelog.markdown | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/changelog.markdown b/changelog.markdown index 58e5d5384..4cc7bd208 100644 --- a/changelog.markdown +++ b/changelog.markdown @@ -1,3 +1,9 @@ +# 16.5.0 + +Support custom name for `"browser"` field resolution in `package.json` using the `browserField` option. + +https://github.com/browserify/browserify/pull/1918 + # 16.4.0 Upgrade stream-http to v3. This version drops support for IE10 and below. From 506533cd13d51ebe9160a36276105f6c7e1ada44 Mon Sep 17 00:00:00 2001 From: Feross Aboukhadijeh Date: Thu, 8 Aug 2019 22:28:47 -0700 Subject: [PATCH 29/63] 16.5.0 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 2ae4bf3dc..d00986e1b 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "browserify", - "version": "16.4.0", + "version": "16.5.0", "description": "browser-side require() the node way", "main": "index.js", "bin": { From 4fc0b6622c1797c02a22abec247b1bfbf276eb84 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9e=20Kooi?= Date: Sun, 25 Aug 2019 16:44:01 +0200 Subject: [PATCH 30/63] Add security.md --- security.md | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 security.md diff --git a/security.md b/security.md new file mode 100644 index 000000000..a14ace6a5 --- /dev/null +++ b/security.md @@ -0,0 +1,10 @@ +# Security Policy + +## Supported Versions +Only the latest major version is supported at any given time. + +## Reporting a Vulnerability + +To report a security vulnerability, please use the +[Tidelift security contact](https://tidelift.com/security). +Tidelift will coordinate the fix and disclosure. From b39f397738cd43a0eb094297e7aedf8f81408c75 Mon Sep 17 00:00:00 2001 From: Anton Gilgur Date: Wed, 27 Nov 2019 01:12:54 -0500 Subject: [PATCH 31/63] fixes swapped changelog PR references in 10.2.0 - noParse path matcher fix is in 1257 and browser-pack update is in 1259 --- changelog.markdown | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/changelog.markdown b/changelog.markdown index 4cc7bd208..f4cc8b554 100644 --- a/changelog.markdown +++ b/changelog.markdown @@ -356,7 +356,7 @@ https://github.com/substack/node-browserify/pull/1244 fixes for the "noParse" path matcher. -https://github.com/substack/node-browserify/pull/1259 +https://github.com/substack/node-browserify/pull/1257 add syntax check cache. this speeds up rebuilds (like when using watchify). @@ -364,7 +364,7 @@ https://github.com/substack/node-browserify/pull/1253 update to browser-pack@^5.0.0 - includes several fixes related to source maps. -https://github.com/substack/node-browserify/pull/1257 +https://github.com/substack/node-browserify/pull/1259 # 10.1.3 From 9e6272a77247fd7af0b0732fac9d9629b8fe20ba Mon Sep 17 00:00:00 2001 From: kumavis Date: Fri, 27 Dec 2019 20:26:29 +0800 Subject: [PATCH 32/63] gitignore - add node_modules --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index d8b83df9c..7a7b33aa1 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ package-lock.json +node_modules From f3629a7dffc4bd68250a9ffa75ab917e0a053664 Mon Sep 17 00:00:00 2001 From: kumavis Date: Sat, 28 Dec 2019 11:19:37 +0800 Subject: [PATCH 33/63] deps - pin deps for node v0.8 support --- package.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index bef396efd..85c4c136a 100644 --- a/package.json +++ b/package.json @@ -28,7 +28,7 @@ "browser-pack": "^6.0.1", "browser-resolve": "^1.11.0", "browserify-zlib": "~0.2.0", - "buffer": "^5.0.2", + "buffer": "5.2.1", "cached-path-relative": "^1.0.0", "concat-stream": "^1.6.0", "console-browserify": "^1.1.0", @@ -84,7 +84,7 @@ "semver": "^5.5.0", "seq": "0.3.5", "tap": "^10.7.2", - "temp": "^0.8.1", + "temp": "0.8.3", "through": "^2.3.4" }, "author": { From 6c1fa0b67db287932a06818ebc73a8613cc23fa9 Mon Sep 17 00:00:00 2001 From: kumavis Date: Sat, 28 Dec 2019 11:44:31 +0800 Subject: [PATCH 34/63] Update package.json Co-Authored-By: Jordan Harband --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 85c4c136a..05c740c00 100644 --- a/package.json +++ b/package.json @@ -84,7 +84,7 @@ "semver": "^5.5.0", "seq": "0.3.5", "tap": "^10.7.2", - "temp": "0.8.3", + "temp": "=0.8.3", "through": "^2.3.4" }, "author": { From 27391a421cb4c96875766707191f17f0cbabb1cf Mon Sep 17 00:00:00 2001 From: kumavis Date: Sat, 28 Dec 2019 11:44:42 +0800 Subject: [PATCH 35/63] Update package.json Co-Authored-By: Jordan Harband --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 05c740c00..c61d005b1 100644 --- a/package.json +++ b/package.json @@ -28,7 +28,7 @@ "browser-pack": "^6.0.1", "browser-resolve": "^1.11.0", "browserify-zlib": "~0.2.0", - "buffer": "5.2.1", + "buffer": "~5.2.1", "cached-path-relative": "^1.0.0", "concat-stream": "^1.6.0", "console-browserify": "^1.1.0", From 00c913fa345dbb7f612bdad6b4acc91c706e98b2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9e=20Kooi?= Date: Wed, 25 Mar 2020 09:35:55 +0100 Subject: [PATCH 36/63] Use non-deprecated mkdirp package. --- bin/cmd.js | 2 +- package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/bin/cmd.js b/bin/cmd.js index 1a63b19ac..ab4213753 100755 --- a/bin/cmd.js +++ b/bin/cmd.js @@ -2,7 +2,7 @@ var fs = require('fs'); var JSONStream = require('JSONStream'); var through = require('through2'); -var mkdirp = require('mkdirp'); +var mkdirp = require('mkdirp-classic'); var path = require('path'); var b = require('./args')(process.argv.slice(2)); diff --git a/package.json b/package.json index c61d005b1..28f8b4da8 100644 --- a/package.json +++ b/package.json @@ -46,7 +46,7 @@ "inherits": "~2.0.1", "insert-module-globals": "^7.0.0", "labeled-stream-splicer": "^2.0.0", - "mkdirp": "^0.5.0", + "mkdirp-classic": "^0.5.2", "module-deps": "^6.0.0", "os-browserify": "~0.3.0", "parents": "^1.0.1", From a245fe65f814c4cc9cad8402276ada5ed78ffce1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9e=20Kooi?= Date: Sun, 25 Aug 2019 16:44:01 +0200 Subject: [PATCH 37/63] Add security.md --- security.md | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 security.md diff --git a/security.md b/security.md new file mode 100644 index 000000000..a14ace6a5 --- /dev/null +++ b/security.md @@ -0,0 +1,10 @@ +# Security Policy + +## Supported Versions +Only the latest major version is supported at any given time. + +## Reporting a Vulnerability + +To report a security vulnerability, please use the +[Tidelift security contact](https://tidelift.com/security). +Tidelift will coordinate the fix and disclosure. From 86c3a00b2f915c496dad9e60177d5be1d036d2bb Mon Sep 17 00:00:00 2001 From: Anton Gilgur Date: Wed, 27 Nov 2019 01:12:54 -0500 Subject: [PATCH 38/63] fixes swapped changelog PR references in 10.2.0 - noParse path matcher fix is in 1257 and browser-pack update is in 1259 --- changelog.markdown | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/changelog.markdown b/changelog.markdown index 4cc7bd208..f4cc8b554 100644 --- a/changelog.markdown +++ b/changelog.markdown @@ -356,7 +356,7 @@ https://github.com/substack/node-browserify/pull/1244 fixes for the "noParse" path matcher. -https://github.com/substack/node-browserify/pull/1259 +https://github.com/substack/node-browserify/pull/1257 add syntax check cache. this speeds up rebuilds (like when using watchify). @@ -364,7 +364,7 @@ https://github.com/substack/node-browserify/pull/1253 update to browser-pack@^5.0.0 - includes several fixes related to source maps. -https://github.com/substack/node-browserify/pull/1257 +https://github.com/substack/node-browserify/pull/1259 # 10.1.3 From 985dad9ba31d5576acae0c4ba291ce9ae2ad2811 Mon Sep 17 00:00:00 2001 From: kumavis Date: Sat, 28 Dec 2019 11:19:37 +0800 Subject: [PATCH 39/63] deps - pin deps for node v0.8 support --- package.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index d00986e1b..16126a244 100644 --- a/package.json +++ b/package.json @@ -28,7 +28,7 @@ "browser-pack": "^6.0.1", "browser-resolve": "^1.11.0", "browserify-zlib": "~0.2.0", - "buffer": "^5.0.2", + "buffer": "5.2.1", "cached-path-relative": "^1.0.0", "concat-stream": "^1.6.0", "console-browserify": "^1.1.0", @@ -84,7 +84,7 @@ "semver": "^5.5.0", "seq": "0.3.5", "tap": "^10.7.2", - "temp": "^0.8.1", + "temp": "0.8.3", "through": "^2.3.4" }, "author": { From 249f54b5846fc5d9926a11bd4ac36b941562e38c Mon Sep 17 00:00:00 2001 From: kumavis Date: Sat, 28 Dec 2019 11:44:31 +0800 Subject: [PATCH 40/63] Update package.json Co-Authored-By: Jordan Harband --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 16126a244..e9b8ce9ca 100644 --- a/package.json +++ b/package.json @@ -84,7 +84,7 @@ "semver": "^5.5.0", "seq": "0.3.5", "tap": "^10.7.2", - "temp": "0.8.3", + "temp": "=0.8.3", "through": "^2.3.4" }, "author": { From 2b5063253f0f4d84b036678fbe95182356631eac Mon Sep 17 00:00:00 2001 From: kumavis Date: Sat, 28 Dec 2019 11:44:42 +0800 Subject: [PATCH 41/63] Update package.json Co-Authored-By: Jordan Harband --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index e9b8ce9ca..a699479f7 100644 --- a/package.json +++ b/package.json @@ -28,7 +28,7 @@ "browser-pack": "^6.0.1", "browser-resolve": "^1.11.0", "browserify-zlib": "~0.2.0", - "buffer": "5.2.1", + "buffer": "~5.2.1", "cached-path-relative": "^1.0.0", "concat-stream": "^1.6.0", "console-browserify": "^1.1.0", From c53f8417ad1d0b7bb90cede45c36dbb050332e0e Mon Sep 17 00:00:00 2001 From: kumavis Date: Fri, 27 Dec 2019 20:26:29 +0800 Subject: [PATCH 42/63] gitignore - add node_modules --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index d8b83df9c..7a7b33aa1 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ package-lock.json +node_modules From dc71ea0b0f133831cc15fe65b9a066fd2446720d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9e=20Kooi?= Date: Wed, 25 Mar 2020 09:35:55 +0100 Subject: [PATCH 43/63] Use non-deprecated mkdirp package. --- bin/cmd.js | 2 +- package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/bin/cmd.js b/bin/cmd.js index 1a63b19ac..ab4213753 100755 --- a/bin/cmd.js +++ b/bin/cmd.js @@ -2,7 +2,7 @@ var fs = require('fs'); var JSONStream = require('JSONStream'); var through = require('through2'); -var mkdirp = require('mkdirp'); +var mkdirp = require('mkdirp-classic'); var path = require('path'); var b = require('./args')(process.argv.slice(2)); diff --git a/package.json b/package.json index a699479f7..588e964c0 100644 --- a/package.json +++ b/package.json @@ -46,7 +46,7 @@ "inherits": "~2.0.1", "insert-module-globals": "^7.0.0", "labeled-stream-splicer": "^2.0.0", - "mkdirp": "^0.5.0", + "mkdirp-classic": "^0.5.2", "module-deps": "^6.0.0", "os-browserify": "~0.3.0", "parents": "^1.0.1", From da0f1e1d306af457305cde8510347cd3a1c528f6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9e=20Kooi?= Date: Mon, 30 Mar 2020 12:22:40 +0200 Subject: [PATCH 44/63] 16.5.1 --- changelog.markdown | 10 ++++++++++ package.json | 2 +- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/changelog.markdown b/changelog.markdown index f4cc8b554..b0aa46b9b 100644 --- a/changelog.markdown +++ b/changelog.markdown @@ -1,3 +1,13 @@ +# 16.5.1 + +Remove deprecated `mkdirp` version in favour of `mkdirp-classic`. + +https://github.com/browserify/browserify/commit/00c913fa345dbb7f612bdad6b4acc91c706e98b2 + +Pin dependencies for Node.js 0.8 support. + +https://github.com/browserify/browserify/pull/1939 + # 16.5.0 Support custom name for `"browser"` field resolution in `package.json` using the `browserField` option. diff --git a/package.json b/package.json index 588e964c0..f107946cb 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "browserify", - "version": "16.5.0", + "version": "16.5.1", "description": "browser-side require() the node way", "main": "index.js", "bin": { From de9cc6cffecd7e1259c14f5dfe5d925775d28cc5 Mon Sep 17 00:00:00 2001 From: Tim Gates Date: Thu, 2 Apr 2020 23:58:36 +1100 Subject: [PATCH 45/63] docs: Fix simple typo, libarary -> library There is a small typo in test/reverse_multi_bundle.js. Should read `library` rather than `libarary`. --- test/reverse_multi_bundle.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/reverse_multi_bundle.js b/test/reverse_multi_bundle.js index 8d9f8325f..1a7537e65 100644 --- a/test/reverse_multi_bundle.js +++ b/test/reverse_multi_bundle.js @@ -12,7 +12,7 @@ var test = require('tap').test; test('reverse multi bundle', function (t) { t.plan(5); - // Main app bundle has the main app code and the shared libarary code + // Main app bundle has the main app code and the shared library code var app = browserify([__dirname + '/reverse_multi_bundle/app.js']) .external(__dirname + '/reverse_multi_bundle/lazy.js') .require(__dirname + '/reverse_multi_bundle/shared.js', { expose: true }) From 51bc462e8ce62318097302909919aee9bddc01d8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9e=20Kooi?= Date: Tue, 12 Jun 2018 12:08:55 +0200 Subject: [PATCH 46/63] Upgrade util to v0.12.0. This release includes `util.promisify` and `util.callbackify` support. --- package.json | 2 +- test/util.js | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 1a93229e3..04cb3c6c7 100644 --- a/package.json +++ b/package.json @@ -68,7 +68,7 @@ "timers-browserify": "^1.0.1", "tty-browserify": "0.0.1", "url": "~0.11.0", - "util": "~0.10.1", + "util": "~0.12.0", "vm-browserify": "^1.0.0", "xtend": "^4.0.0" }, diff --git a/test/util.js b/test/util.js index 8efc112ae..a5cc8cdc7 100644 --- a/test/util.js +++ b/test/util.js @@ -1,6 +1,7 @@ var browserify = require('../'); var test = require('tap').test; var util = require('util'); +var xtend = require('xtend'); var vm = require('vm'); test('util.inspect', function (t) { @@ -46,7 +47,8 @@ test('util.inherits without Object.create', function (t) { b.require('events'); b.bundle(function (err, src) { - var c = { Object : { prototype: Object.prototype, defineProperty: Object.defineProperty } }; + var c = xtend({}, Object); + delete c.create; vm.runInNewContext(src, c); var EE = c.require('events').EventEmitter; From 9aaa22d454729d808ad81795f3268bfb04e43efc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9e=20Kooi?= Date: Tue, 29 Oct 2019 13:25:43 +0100 Subject: [PATCH 47/63] =?UTF-8?q?shasum=20=E2=86=92=20shasum-object?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- index.js | 2 +- package.json | 4 ++-- test/syntax_cache.js | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/index.js b/index.js index 9494152e1..3bf58b0f8 100644 --- a/index.js +++ b/index.js @@ -18,7 +18,7 @@ var isArray = Array.isArray; var defined = require('defined'); var has = require('has'); var sanitize = require('htmlescape').sanitize; -var shasum = require('shasum'); +var shasum = require('shasum-object'); var bresolve = require('browser-resolve'); var resolve = require('resolve'); diff --git a/package.json b/package.json index 1a93229e3..5ef3c88e6 100644 --- a/package.json +++ b/package.json @@ -35,7 +35,7 @@ "constants-browserify": "~1.0.0", "crypto-browserify": "^3.0.0", "defined": "^1.0.0", - "deps-sort": "^2.0.0", + "deps-sort": "^2.0.1", "domain-browser": "^1.2.0", "duplexer2": "~0.1.2", "events": "^3.0.0", @@ -57,7 +57,7 @@ "read-only-stream": "^2.0.0", "readable-stream": "^2.0.2", "resolve": "^1.1.4", - "shasum": "^1.0.0", + "shasum-object": "^1.0.0", "shell-quote": "^1.6.1", "stream-browserify": "^2.0.0", "stream-http": "^3.0.0", diff --git a/test/syntax_cache.js b/test/syntax_cache.js index ff2a5deec..202e5f6d7 100644 --- a/test/syntax_cache.js +++ b/test/syntax_cache.js @@ -1,7 +1,7 @@ var Seq = require('seq'); var browserify = require('../'); var test = require('tap').test; -var shasum = require('shasum'); +var shasum = require('shasum-object'); test('syntax cache - valid', function (t) { t.plan(2); From fc324b5b64fb549ad1fd2bdb7c5b2435b2c12890 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9e=20Kooi?= Date: Mon, 3 Aug 2020 09:39:23 +0200 Subject: [PATCH 48/63] update browser-resolve to v2 --- package.json | 4 ++-- test/shared_symlink.js | 5 +++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/package.json b/package.json index f107946cb..a2d5adf86 100644 --- a/package.json +++ b/package.json @@ -26,7 +26,7 @@ "JSONStream": "^1.0.3", "assert": "^1.4.0", "browser-pack": "^6.0.1", - "browser-resolve": "^1.11.0", + "browser-resolve": "^2.0.0", "browserify-zlib": "~0.2.0", "buffer": "~5.2.1", "cached-path-relative": "^1.0.0", @@ -47,7 +47,7 @@ "insert-module-globals": "^7.0.0", "labeled-stream-splicer": "^2.0.0", "mkdirp-classic": "^0.5.2", - "module-deps": "^6.0.0", + "module-deps": "^6.2.3", "os-browserify": "~0.3.0", "parents": "^1.0.1", "path-browserify": "~0.0.0", diff --git a/test/shared_symlink.js b/test/shared_symlink.js index f10d57339..7b37f2aa4 100644 --- a/test/shared_symlink.js +++ b/test/shared_symlink.js @@ -9,8 +9,9 @@ test('shared symlink', { skip: process.platform === 'win32' }, function (t) { var b = browserify(__dirname + '/shared_symlink/main.js'); b.bundle(function (err, src) { // does the same thing as node: crashes - t.equal(err.message, "Cannot find module 'foo' from '" - + __dirname + "/shared_symlink/shared'" + t.equal(err.message, "Can't walk dependency graph: Cannot find module 'foo' " + + "from '" + __dirname + "/shared_symlink/shared/index.js'\n" + + " required by " + __dirname + "/shared_symlink/shared/index.js" ); }); }); From c94b4d5a097e7f553a238217c685c91ceecea11c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9e=20Kooi?= Date: Mon, 3 Aug 2020 22:15:04 +0200 Subject: [PATCH 49/63] 16.5.2 --- changelog.markdown | 6 ++++++ package.json | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/changelog.markdown b/changelog.markdown index b0aa46b9b..769657e09 100644 --- a/changelog.markdown +++ b/changelog.markdown @@ -1,3 +1,9 @@ +# 16.5.2 + +Upgrade browser-resolve to v2. + +https://github.com/browserify/browserify/pull/1973 + # 16.5.1 Remove deprecated `mkdirp` version in favour of `mkdirp-classic`. diff --git a/package.json b/package.json index a2d5adf86..a427e785f 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "browserify", - "version": "16.5.1", + "version": "16.5.2", "description": "browser-side require() the node way", "main": "index.js", "bin": { From 190491a6a81b221d7cbe16f8818a7272b49864d0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9e=20Kooi?= Date: Fri, 9 Oct 2020 13:27:29 +0200 Subject: [PATCH 50/63] update min insert-module-globals version --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 25f5e41fa..bae9eb58e 100644 --- a/package.json +++ b/package.json @@ -44,7 +44,7 @@ "htmlescape": "^1.1.0", "https-browserify": "^1.0.0", "inherits": "~2.0.1", - "insert-module-globals": "^7.0.0", + "insert-module-globals": "^7.2.1", "labeled-stream-splicer": "^2.0.0", "mkdirp-classic": "^0.5.2", "module-deps": "^6.2.3", From e34ed8cf7de0a20f16a5bb4dd720bef1e4c54403 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9e=20Kooi?= Date: Fri, 9 Oct 2020 13:39:46 +0200 Subject: [PATCH 51/63] skip crypto tests in old node.js --- test/crypto.js | 4 +++- test/crypto_ig.js | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/test/crypto.js b/test/crypto.js index 7edb25594..453ddb368 100644 --- a/test/crypto.js +++ b/test/crypto.js @@ -4,6 +4,7 @@ var path = require('path'); var fs = require('fs'); var vm = require('vm'); var concat = require('concat-stream'); +var semver = require('semver'); var temp = require('temp'); temp.track(); @@ -13,7 +14,8 @@ fs.writeFileSync(tmpdir + '/main.js', 'beep(require("crypto"))\n'); if (!ArrayBuffer.isView) ArrayBuffer.isView = function () { return false; }; -test('*-browserify libs from node_modules/', function (t) { +// `crypto-browserify` no longer works in node.js <4 +test('*-browserify libs from node_modules/', { skip: semver.lt(process.version, 'v4.0.0') }, function (t) { t.plan(2); var bin = __dirname + '/../bin/cmd.js'; diff --git a/test/crypto_ig.js b/test/crypto_ig.js index c60b5bf60..932ee9ef8 100644 --- a/test/crypto_ig.js +++ b/test/crypto_ig.js @@ -4,6 +4,7 @@ var path = require('path'); var fs = require('fs'); var vm = require('vm'); var concat = require('concat-stream'); +var semver = require('semver'); var temp = require('temp'); temp.track(); @@ -13,7 +14,8 @@ fs.writeFileSync(tmpdir + '/main.js', 'beep(require("crypto"))\n'); if (!ArrayBuffer.isView) ArrayBuffer.isView = function () { return false; }; -test('crypto --insertGlobals', function (t) { +// `crypto-browserify` no longer works in node.js <4 +test('crypto --insertGlobals', { skip: semver.lt(process.version, 'v4.0.0') }, function (t) { t.plan(2); var bin = __dirname + '/../bin/cmd.js'; From 26665c02996383f03561957218d99de6962cdd4b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9e=20Kooi?= Date: Thu, 18 Jun 2020 21:09:49 +0200 Subject: [PATCH 52/63] bump readable-stream --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index bae9eb58e..dd3f0ec97 100644 --- a/package.json +++ b/package.json @@ -59,7 +59,7 @@ "resolve": "^1.1.4", "shasum-object": "^1.0.0", "shell-quote": "^1.6.1", - "stream-browserify": "^2.0.0", + "stream-browserify": "^3.0.0", "stream-http": "^3.0.0", "string_decoder": "^1.1.1", "subarg": "^1.0.0", From 7b14fb1c92b31e4f469d71d97e0c370d65f2e058 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9e=20Kooi?= Date: Sat, 10 Oct 2020 11:32:25 +0200 Subject: [PATCH 53/63] 17.0.0 --- changelog.markdown | 7 +++++++ package.json | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/changelog.markdown b/changelog.markdown index 769657e09..72719df79 100644 --- a/changelog.markdown +++ b/changelog.markdown @@ -1,3 +1,10 @@ +# 17.0.0 +* Upgrade events to v3.x. EventEmitter instances now have an `off()` method. `require('events').once` can be used to react to an event being emitted with `async`/`await` syntax. ([#1839](https://github.com/browserify/browserify/pull/1839)) +* Upgrade path-browserify to v1.x. ([#1838](https://github.com/browserify/browserify/pull/1838)) +* Upgrade stream-browserify to v3.x. `require('stream')` now matches the Node.js 10+ API. ([#1970](https://github.com/browserify/browserify/pull/1970)) +* Upgrade util to v0.12. Most notably, `util.promisify` and `util.callbackify` are finally available by default in browserify. ([#1844](https://gihub.com/browserify/browserify/pull/1844)) +* Add JSON syntax checking. Syntax errors in `.json` files will now fail to bundle. ([#1700](https://github.com/browserify/browserify/pull/1700)) + # 16.5.2 Upgrade browser-resolve to v2. diff --git a/package.json b/package.json index dd3f0ec97..72a635079 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "browserify", - "version": "16.5.2", + "version": "17.0.0", "description": "browser-side require() the node way", "main": "index.js", "bin": { From 0ec6e80ec48b67513718a392a6d09bd5569967d4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9e=20Kooi?= Date: Thu, 25 Mar 2021 15:14:37 +0100 Subject: [PATCH 54/63] stop recommending globally installed npm modules --- readme.markdown | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/readme.markdown b/readme.markdown index 87ee6d925..e0c81b342 100644 --- a/readme.markdown +++ b/readme.markdown @@ -60,7 +60,7 @@ html! With [npm](https://www.npmjs.com/) do: ``` -npm install -g browserify +npm install browserify ``` # usage @@ -478,7 +478,7 @@ You can remove these calls with [derequire](https://www.npmjs.com/package/derequire): ``` -$ npm install -g derequire +$ npm install derequire $ browserify main.js --standalone Foo | derequire > bundle.js ``` From a084959abc4ffa954b439c46abf5f74fb8d6f070 Mon Sep 17 00:00:00 2001 From: Tobias Speicher Date: Sun, 27 Mar 2022 18:01:21 +0200 Subject: [PATCH 55/63] refactor: replace deprecated String.prototype.substr() .substr() is deprecated so we replace it with .slice() which works similarily but isn't deprecated Signed-off-by: Tobias Speicher --- bin/args.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/args.js b/bin/args.js index 130ace75b..2f5beec16 100644 --- a/bin/args.js +++ b/bin/args.js @@ -254,7 +254,7 @@ function splitOnColon (f) { if ((/[a-zA-Z]:[\\/]/.test(f)) && (pos == 1)){ return [f]; // Windows path and colon is part of drive name } else { - return [f.substr(0, pos), f.substr(pos + 1)]; + return [f.slice(0, pos), f.slice(pos + 1)]; } } } From 4b1a5dc0db56263b38dc98e155fb1908e810c1a9 Mon Sep 17 00:00:00 2001 From: Jordan Harband Date: Sat, 21 Oct 2023 00:13:09 -0700 Subject: [PATCH 56/63] [Refactor] use `hasown` instead of `has` --- index.js | 4 ++-- package.json | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/index.js b/index.js index 3bf58b0f8..ea42e8683 100644 --- a/index.js +++ b/index.js @@ -16,7 +16,7 @@ var EventEmitter = require('events').EventEmitter; var xtend = require('xtend'); var isArray = Array.isArray; var defined = require('defined'); -var has = require('has'); +var hasOwn = require('hasown'); var sanitize = require('htmlescape').sanitize; var shasum = require('shasum-object'); @@ -554,7 +554,7 @@ Browserify.prototype._createDeps = function (opts) { else mopts.modules = xtend(builtins); Object.keys(builtins).forEach(function (key) { - if (!has(mopts.modules, key)) self._exclude.push(key); + if (!hasOwn(mopts.modules, key)) self._exclude.push(key); }); mopts.globalTransform = []; diff --git a/package.json b/package.json index 72a635079..fcb289e1f 100644 --- a/package.json +++ b/package.json @@ -23,7 +23,6 @@ "javascript" ], "dependencies": { - "JSONStream": "^1.0.3", "assert": "^1.4.0", "browser-pack": "^6.0.1", "browser-resolve": "^2.0.0", @@ -40,11 +39,12 @@ "duplexer2": "~0.1.2", "events": "^3.0.0", "glob": "^7.1.0", - "has": "^1.0.0", + "hasown": "^2.0.0", "htmlescape": "^1.1.0", "https-browserify": "^1.0.0", "inherits": "~2.0.1", "insert-module-globals": "^7.2.1", + "JSONStream": "^1.0.3", "labeled-stream-splicer": "^2.0.0", "mkdirp-classic": "^0.5.2", "module-deps": "^6.2.3", From dac674a6c1bfd49aaa389960c27c30483ce3177d Mon Sep 17 00:00:00 2001 From: goldim Date: Sat, 24 Aug 2024 23:39:08 +0300 Subject: [PATCH 57/63] Pass modified no parse full paths into module-deps --- index.js | 1 + 1 file changed, 1 insertion(+) diff --git a/index.js b/index.js index ea42e8683..729cac5a5 100644 --- a/index.js +++ b/index.js @@ -574,6 +574,7 @@ Browserify.prototype._createDeps = function (opts) { }).map(function (x) { return path.resolve(basedir, x); }); + mopts.noParse = absno; function globalTr (file) { if (opts.detectGlobals === false) return through(); From 27d756487b12c07a676bfc25e10a175c2ba50032 Mon Sep 17 00:00:00 2001 From: ZolotovDY Date: Mon, 26 Aug 2024 19:49:19 +0300 Subject: [PATCH 58/63] Added regression test for noParse option with relative paths --- test/noparse.js | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/test/noparse.js b/test/noparse.js index ddb024df1..31517e0a8 100644 --- a/test/noparse.js +++ b/test/noparse.js @@ -29,3 +29,31 @@ test('noParse array', function (t) { t.deepEqual(actual, expected); }); }); + +test('noParse array with relative paths', function (t) { + process.chdir(__dirname); + + t.plan(2); + + var actual = []; + var expected = [ + 'noparse/a.js', + 'noparse/b.js', + 'noparse/dir1/1.js', + 'noparse/node_modules/robot/main.js' + ].map(function (x) {return path.resolve(x);}).sort(); + + var b = browserify({ + entries: [ __dirname + '/noparse/a.js' ], + noParse: [ + path.join('noparse/dir1/1.js'), + path.join('noparse/node_modules/robot/main.js') + ] + }); + b.on('dep', function(dep) { actual.push(dep.file); }); + b.bundle(function (err, src) { + actual.sort(); + t.ifError(err); + t.deepEqual(actual, expected); + }); +}); From 7791742dcc8c4e76ad126731967515dc311c4f42 Mon Sep 17 00:00:00 2001 From: Dmitry Zolotov Date: Fri, 30 Aug 2024 10:45:16 +0300 Subject: [PATCH 59/63] Update test/noparse.js Co-authored-by: Jordan Harband --- test/noparse.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/noparse.js b/test/noparse.js index 31517e0a8..4e706802e 100644 --- a/test/noparse.js +++ b/test/noparse.js @@ -41,7 +41,7 @@ test('noParse array with relative paths', function (t) { 'noparse/b.js', 'noparse/dir1/1.js', 'noparse/node_modules/robot/main.js' - ].map(function (x) {return path.resolve(x);}).sort(); + ].map(function (x) { return path.resolve(x); }).sort(); var b = browserify({ entries: [ __dirname + '/noparse/a.js' ], From 2557674d6245af4c9b330e67f8c4e7b058aae902 Mon Sep 17 00:00:00 2001 From: Dmitry Zolotov Date: Fri, 30 Aug 2024 10:45:25 +0300 Subject: [PATCH 60/63] Update test/noparse.js Co-authored-by: Jordan Harband --- test/noparse.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/noparse.js b/test/noparse.js index 4e706802e..784c504da 100644 --- a/test/noparse.js +++ b/test/noparse.js @@ -50,7 +50,7 @@ test('noParse array with relative paths', function (t) { path.join('noparse/node_modules/robot/main.js') ] }); - b.on('dep', function(dep) { actual.push(dep.file); }); + b.on('dep', function (dep) { actual.push(dep.file); }); b.bundle(function (err, src) { actual.sort(); t.ifError(err); From 0bea7b74face8f7f8af22659c81bdd179c65d444 Mon Sep 17 00:00:00 2001 From: Dmitry Zolotov Date: Fri, 30 Aug 2024 10:45:36 +0300 Subject: [PATCH 61/63] Update test/noparse.js Co-authored-by: Jordan Harband --- test/noparse.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/noparse.js b/test/noparse.js index 784c504da..37b2b4053 100644 --- a/test/noparse.js +++ b/test/noparse.js @@ -44,7 +44,7 @@ test('noParse array with relative paths', function (t) { ].map(function (x) { return path.resolve(x); }).sort(); var b = browserify({ - entries: [ __dirname + '/noparse/a.js' ], + entries: [__dirname + '/noparse/a.js'], noParse: [ path.join('noparse/dir1/1.js'), path.join('noparse/node_modules/robot/main.js') From d1d3fed4fea333f5d7a3b933e7ff12b045112322 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9e=20Kooi?= Date: Thu, 3 Oct 2024 21:43:21 +0200 Subject: [PATCH 62/63] 17.0.1 --- changelog.markdown | 5 +++++ package.json | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/changelog.markdown b/changelog.markdown index 72719df79..a24017b15 100644 --- a/changelog.markdown +++ b/changelog.markdown @@ -1,3 +1,8 @@ +# 17.0.1 +* Use `hasown` instead of `has`. ([4b1a5dc](https://github.com/browserify/browserify/commit/4b1a5dc0db56263b38dc98e155fb1908e810c1a9)) +* Use `String.prototype.slice` instead of `String.prototype.substr`. ([#2036](https://github.com/browserify/browserify/pull/2036)) +* Support relative paths in the `noParse` option. ([#2080](https://github.com/browserify/browserify/pull/2080)) + # 17.0.0 * Upgrade events to v3.x. EventEmitter instances now have an `off()` method. `require('events').once` can be used to react to an event being emitted with `async`/`await` syntax. ([#1839](https://github.com/browserify/browserify/pull/1839)) * Upgrade path-browserify to v1.x. ([#1838](https://github.com/browserify/browserify/pull/1838)) diff --git a/package.json b/package.json index fcb289e1f..7affe9acc 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "browserify", - "version": "17.0.0", + "version": "17.0.1", "description": "browser-side require() the node way", "main": "index.js", "bin": { From d5d692ca2d1334b7644beef82e7c94cf471ab344 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9e=20Kooi?= Date: Thu, 3 Oct 2024 21:46:40 +0200 Subject: [PATCH 63/63] browserify is no longer part of the tidelift subscription --- .github/FUNDING.yml | 12 ------------ 1 file changed, 12 deletions(-) delete mode 100644 .github/FUNDING.yml diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml deleted file mode 100644 index 7d862baf6..000000000 --- a/.github/FUNDING.yml +++ /dev/null @@ -1,12 +0,0 @@ -# These are supported funding model platforms - -github: # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2] -patreon: # Replace with a single Patreon username -open_collective: # Replace with a single Open Collective username -ko_fi: # Replace with a single Ko-fi username -tidelift: npm/browserify -community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry -liberapay: # Replace with a single Liberapay username -issuehunt: # Replace with a single IssueHunt username -otechie: # Replace with a single Otechie username -custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2']