Skip to content

Commit

Permalink
Merge branch 'browserify:master' into v18-dev
Browse files Browse the repository at this point in the history
  • Loading branch information
legobeat authored Oct 18, 2024
2 parents d1ccd95 + 1a67280 commit 45d41b0
Show file tree
Hide file tree
Showing 6 changed files with 47 additions and 17 deletions.
12 changes: 0 additions & 12 deletions .github/FUNDING.yml

This file was deleted.

5 changes: 5 additions & 0 deletions changelog.markdown
Original file line number Diff line number Diff line change
@@ -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))
Expand Down
5 changes: 3 additions & 2 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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');

Expand Down Expand Up @@ -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 = [];
Expand All @@ -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();
Expand Down
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -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": {
Expand All @@ -23,7 +23,6 @@
"javascript"
],
"dependencies": {
"JSONStream": "^1.0.3",
"assert": "^1.4.0",
"browser-pack": "^6.0.1",
"browser-resolve": "^2.0.0",
Expand All @@ -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",
Expand Down
8 changes: 8 additions & 0 deletions readme.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -482,6 +482,14 @@ $ npm install derequire
$ browserify main.js --standalone Foo | derequire > bundle.js
```

```html
<script src="bundle.js"></script>
<script type="text/javascript">
// Now you can address `Foo` by name in your HTML document
Foo.bar();
</script>
```

`opts.insertGlobalVars` will be passed to
[insert-module-globals](https://www.npmjs.com/package/insert-module-globals)
as the `opts.vars` parameter.
Expand Down
28 changes: 28 additions & 0 deletions test/noparse.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
});
});

0 comments on commit 45d41b0

Please sign in to comment.