diff --git a/.gitignore b/.gitignore index d8b83df9c..7a7b33aa1 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ package-lock.json +node_modules diff --git a/LICENSE b/LICENSE index eff138cad..59f71e2a1 100644 --- a/LICENSE +++ b/LICENSE @@ -1,84 +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. - ---- - -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 - ----- +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. 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)]; } } } 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/changelog.markdown b/changelog.markdown index ec63d8c91..a24017b15 100644 --- a/changelog.markdown +++ b/changelog.markdown @@ -1,3 +1,57 @@ +# 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)) +* 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. + +https://github.com/browserify/browserify/pull/1973 + +# 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. + +https://github.com/browserify/browserify/pull/1918 + +# 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. + +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. @@ -330,7 +384,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). @@ -338,7 +392,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 diff --git a/index.js b/index.js index 54dcf2c6e..729cac5a5 100644 --- a/index.js +++ b/index.js @@ -16,9 +16,9 @@ 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'); +var shasum = require('shasum-object'); var bresolve = require('browser-resolve'); var resolve = require('resolve'); @@ -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 = {}; @@ -547,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 = []; @@ -567,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(); @@ -655,7 +663,16 @@ 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 (err) { + err.message = 'While parsing ' + (row.file || row.id) + ': ' + err.message + this.emit('error', err); + return; + } } this.push(row); next(); 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'); diff --git a/package.json b/package.json index c29b5f621..7affe9acc 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "browserify", - "version": "16.2.3", + "version": "17.0.1", "description": "browser-side require() the node way", "main": "index.js", "bin": { @@ -23,44 +23,44 @@ "javascript" ], "dependencies": { - "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.0.2", + "buffer": "~5.2.1", "cached-path-relative": "^1.0.0", "concat-stream": "^1.6.0", "console-browserify": "^1.1.0", "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": "^2.0.0", + "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.0.0", + "insert-module-globals": "^7.2.1", + "JSONStream": "^1.0.3", "labeled-stream-splicer": "^2.0.0", - "mkdirp": "^0.5.0", - "module-deps": "^6.0.0", + "mkdirp-classic": "^0.5.2", + "module-deps": "^6.2.3", "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", "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": "^2.0.0", + "stream-browserify": "^3.0.0", + "stream-http": "^3.0.0", "string_decoder": "^1.1.1", "subarg": "^1.0.0", "syntax-error": "^1.1.1", @@ -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" }, @@ -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": { diff --git a/readme.markdown b/readme.markdown index 7d6f87e62..864e02b59 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 @@ -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 @@ -476,10 +478,18 @@ 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 ``` +```html + + +``` + `opts.insertGlobalVars` will be passed to [insert-module-globals](https://www.npmjs.com/package/insert-module-globals) as the `opts.vars` parameter. 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. 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'; diff --git a/test/json.js b/test/json.js index e0f2e27ea..0ec722028 100644 --- a/test/json.js +++ b/test/json.js @@ -46,3 +46,12 @@ 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) { + 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 diff --git a/test/noparse.js b/test/noparse.js index ddb024df1..37b2b4053 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); + }); +}); 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 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 }) 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" ); }); }); 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); diff --git a/test/util.js b/test/util.js index 760acf1e3..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 } }; + var c = xtend({}, Object); + delete c.create; vm.runInNewContext(src, c); var EE = c.require('events').EventEmitter;