1
0
mirror of https://github.com/lancedikson/bowser synced 2026-09-23 04:24:54 +00:00
Commit Graph

321 Commits

Author SHA1 Message Date
naorpeled
5d77bd5049 fix: getBrandVersion throws on ES5 browsers; make test:types runnable
Both from Qodo review on #632.

`Parser.getBrandVersion()` called `Array.prototype.find` directly. That is
ES6, and `es5.js` ships no polyfills, so a documented public API threw
`TypeError: this._hints.brands.find is not a function` on exactly the
browsers that bundle exists to serve. `bundled.js` was unaffected because
core-js polyfills it. Every other lookup in parser.js already goes through
`Utils.find`, which guards on `Array.prototype.find` and falls back to a
loop; this one call site had missed it. `hasBrand()` next to it uses
`Array.prototype.some`, which is ES5, and is fine.

The ES5 runtime guard added alongside it did not catch this because nothing
exercised the Client Hints path. It now does, for both bundles.

That test builds its hints object from a script evaluated *inside* the vm
context rather than assigning one onto it. A first attempt assigned a
host-realm object and passed against the live bug: an array created in the
host realm keeps the host's `Array.prototype`, so its `find` survives the
sandbox's delete. A real browser hands the parser a same-realm array.

`pnpm test:types` passed no tarball, and check.mjs exited 1 when the argument
was absent, so the advertised command could never run — CI only passed
because it packs and invokes the file directly. The argument is now optional:
without one the package is assembled from the `files` allowlist in the
working tree. `npm pack` cannot be used for this, as package.json carries no
`version` until release time and npm refuses to pack without one. Missing
build output is reported as such rather than as a type error.

Verified by reverting the parser fix: the es5.js Client Hints test fails with
the original TypeError while the bundled.js one still passes, which is the
correct split. Parse output is unchanged — all four artifacts still agree
across the 270-UA corpus, and Client Hints still resolve on modern runtimes.
2026-08-30 22:38:01 +03:00
Naor Peled
1d7923497f fix: resolve open GitHub security findings (#630) 2026-08-30 21:05:22 +03:00
Naor Peled
a88622557d Dual packaging, without breaking existing consumers (#628)
Co-authored-by: Yasumasa Ashida <ys.ashida@gmail.com>
2026-08-30 00:10:11 +03:00
Jelle Raaijmakers
a37b8be8a7 feat: add Ladybird browser support (#627) 2026-07-31 12:10:10 +03:00
Swapnil Sahu
92b5639733 feat: add support for HeyTap Browser and Vivo Browser identification (#621) 2026-04-10 23:18:44 +07:00
Naor Peled
2c253c3ad2 fix: prevent Motorola Edge devices from being misidentified as Microsoft Edge (#612) 2026-03-14 16:17:53 +02:00
naorpeled
cf397a4b50 feat: add Vivaldi client hints support 2026-02-13 23:09:48 +02:00
Naor Peled
587196f211 feat: add copyright comment to bundle (#605) 2026-02-13 22:57:03 +02:00
Stas Tolpekin
8ddb4f5a0d feat: add the ability to use an array of versions in Parser.satisfies() (#466) 2026-02-13 22:15:55 +02:00
Copilot
a2d6ce81b1 feat: add Smart TV platform detection (#582) 2026-02-07 18:44:55 +02:00
Copilot
227f5ecd4b feat: add Brave browser support via clientHints (#597) 2026-02-07 18:29:20 +02:00
Copilot
fdcc87319b docs: document user agent client hints addition 2026-02-07 17:57:02 +02:00
Jam Hsu
c09ff24ae1 feat: Add Line sipder detection (#600)
Co-authored-by: Jam <jam.hsu@lativ.com.tw>
2026-02-06 23:08:55 +02:00
Jonathan Kingston
aaa67db25e feat: add clientHints support + DuckDuckGo detection (#595) 2026-02-01 23:50:33 +02:00
Jam Hsu
74463f6b23 feat: Add Slack bot detection (#596)
Co-authored-by: Jam <jam.hsu@lativ.com.tw>
2026-01-31 18:54:09 +02:00
Copilot
0f51d8bce8 Replace lancedikson with bowser-js in GitHub URLs (#592)
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: naorpeled <6171622+naorpeled@users.noreply.github.com>
2025-11-30 18:58:23 +02:00
Naor Peled
1df8838756 revert: rollback addition of named exports (#591) 2025-11-29 02:01:44 +02:00
Naor Peled
514510d847 feat: add support for latest MacOS (#580)
Co-authored-by: Seiji Kohara <9543980+seijikohara@users.noreply.github.com>
2025-11-22 23:50:54 +02:00
Naor Peled
4a6dacca08 feat: add Sogou browser support (#579)
Co-authored-by: 猫猫 <49067249+NotEvenANeko@users.noreply.github.com>
2025-11-22 23:31:31 +02:00
Copilot
be90a00e37 feat: add LibreWolf browser detection (#578)
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: naorpeled <6171622+naorpeled@users.noreply.github.com>
2025-11-22 19:01:03 +02:00
Naor Peled
f7d2c0693c feat: add support for AI crawl bots (#577) 2025-11-22 18:05:08 +02:00
Lucio Martinez
771dfb2dfe feat: add more bot platforms (#542)
Co-authored-by: naorpeled <me@naor.dev>
2025-11-22 16:44:08 +02:00
Copilot
bd5cb7186c feat: add named exports for tree shaking support with modern bundlers (#566)
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: naorpeled <6171622+naorpeled@users.noreply.github.com>
Co-authored-by: naorpeled <me@naor.dev>
2025-11-22 15:15:13 +02:00
Copilot
2b5ee5de8c feat: add Support for HarmonyOS User-Agent Detection (#567)
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: naorpeled <6171622+naorpeled@users.noreply.github.com>
2025-11-22 14:27:00 +02:00
Naor Peled
94ab87ec0e feat(constants): add bot as a platform (#540) (#541)
Co-authored-by: Lucio Martinez <martinezlucio.com@gmail.com>
2023-11-27 16:21:18 +02:00
Amelie
07462efb6a feat: update types of parser methods (#449) 2023-11-17 21:01:45 +02:00
idmadj
f8fcea59e7 docs: fix getBrowserTypeByAlias docs (#467) 2023-11-17 20:55:43 +02:00
daniol
4481f5aab3 feat: add Nokia Vendor (#448) 2023-11-17 20:54:44 +02:00
Mehmet Akif Yücel
bb8f94efcd feat: add Pale Moon browser support (#495) 2023-11-17 20:47:16 +02:00
Connor Bär
b86bce16af fix(parser): resolve issues with array detection (#516)
- this change resolves issues with Next.js middlewares
2023-11-13 11:10:39 +02:00
Denis Demchenko
c504b110bb Merge pull request #427 from YongliangDing/declaration-update
Update @returns of Parser.prototype.parse
2020-09-12 10:35:50 +03:00
Denis Demchenko
24dab5f699 Merge pull request #437 from willamesoares/include-alias-check
feat: add support for using alias in 'is' method
2020-09-12 10:25:35 +03:00
Will Soares
a9c4677c86 feat: add support for using alias in 'is' method 2020-08-23 16:55:29 -03:00
Will Soares
d5fe5657d1 feat(browser): add detection for Miui Browser 2020-08-23 13:58:07 -03:00
dingyongliang
1bde6c6c7e Update @returns of Parser.prototype.parse 2020-07-14 15:04:07 +08:00
Denis Demchenko
725de76e14 Revert "chore(tests): fix tests for Firefox iOS"
This reverts commit 9edfabf9
2020-07-09 21:23:10 +03:00
Denis Demchenko
9edfabf98a chore(tests): fix tests for Firefox iOS
relevant to #401
2020-06-02 00:32:35 +03:00
Denis Demchenko
3813d92a55 feat(browser): add detection of Opera Touch
fixes #414
2020-06-02 00:16:43 +03:00
acailly
cb242c0242 handle Firefox on iPad on iOS 13 2020-04-28 11:37:01 +02:00
Denis Demchenko
24d1ce5e2c Revert "Merge pull request #382 from DarkPurple141/types-update"
This reverts commit 406e39d2fe, reversing
changes made to d238da4906.
2019-12-26 23:26:36 +02:00
Denis Demchenko
406e39d2fe Merge pull request #382 from DarkPurple141/types-update
fix: update types to include constants in types.d.ts
2019-12-26 15:56:37 +02:00
Denis Demchenko
d238da4906 Merge pull request #383 from oliverfoster/issue/359
fixes #359 IE11 Added Array.prototype.find and Object.assign polyfills
2019-12-26 15:55:29 +02:00
Denis Demchenko
366a9c47e9 Merge pull request #381 from Tindtily/feature/add-wechat-ua
add windowswechat ua
2019-12-26 15:50:21 +02:00
Denis Demchenko
de5b4e02fe Merge pull request #379 from neckro/production
Correctly detect Firefox on iPad
2019-12-26 15:48:46 +02:00
Alex Hinds
8fbbc33d87 Amended re-export to also import 2019-12-20 08:50:05 +11:00
Oliver foster
5a6af193d2 Extended test cases and fixed bug 2019-12-19 12:00:46 +00:00
Oliver foster
f27c7e0580 Edited typo 2019-12-19 11:49:50 +00:00
Oliver foster
3cdfd7de02 Expanded test coverage for utils.js 2019-12-19 11:22:40 +00:00
Oliver foster
a54868776d Fixed linting issues 2019-12-19 10:51:30 +00:00
Oliver foster
e55055534f Fix travis errors 2019-12-19 10:45:33 +00:00