1
0
mirror of https://github.com/lancedikson/bowser synced 2026-09-22 20:14:20 +00:00
Commit Graph

190 Commits

Author SHA1 Message Date
naorpeled
4f59e5d25e test: guard ES5 runtime APIs and type-check consumers in CI
Follow-up to the ES5 syntax fix, closing the gaps that investigation left.

An ES5-only runtime sandbox. The acorn check catches syntax, but syntax is
only half the contract: preset-env lowers syntax and never polyfills library
calls, so one `Array.prototype.includes` in the parser source compiles
cleanly, passes every test on modern Node, and throws on the browsers es5.js
exists for. The new test runs both legacy bundles in a vm context with the
post-ES5.1 globals, statics and prototype methods deleted, and asserts
bundled.js additionally installs the polyfills its README entry promises.
Includes a test that the sandbox really strips, so it cannot quietly pass
against a modern global.

A consumer type-check across every module resolution mode, run in CI against
the packed tarball. attw already checks that types *resolve* per condition;
it compiles nothing, so it cannot catch a declaration that resolves correctly
and then misdescribes the runtime. Negative cases are asserted too — the maps
must stay non-importable as named exports, which is the line index.d.mts
draws deliberately and only a failing compile can hold.

Also documents two findings that were investigated and deliberately left
alone: the bundled.js size increase is the core-js 2 -> 3 upgrade rather than
waste, and `useBuiltIns: 'usage'` would shrink it by breaking the documented
"all needed polyfills" contract; and the src/*.js ESM-in-CJS wart (publint
warnings, Yarn PnP, Node < 20.19) is longstanding and identical on 2.14.1,
with the nested-package.json fix blocked on @babel/register.

Verified by breaking each guard in turn: an ES6 API call injected into es5.js
fails the sandbox test, and an index.d.mts with its `parse` export removed
fails all three ESM resolution modes while the CJS modes correctly still pass.
2026-08-30 21:59:08 +03:00
naorpeled
2a2ba39ddb fix: restore ES5 output for bundled.js, and assert it
`bundled.js` stopped being ES5 when the webpack build was replaced by tsdown
in #628. It parses at ecmaVersion 2015 but not 5:

    var t=(t,e)=>()=>(e||(t((e={exports:{}}).exports,e),t=null),e.exports)

That is rolldown's `__commonJS` interop helper. `@rolldown/plugin-babel` only
transforms input modules, and rolldown appends the helper afterwards; terser
with `ecma: 5` avoids introducing newer syntax but does not transpile, so the
arrow functions reached the published file. `es5.js` has no CommonJS
dependencies and never gets the helper, which is why only `bundled.js` broke.

The effect is total rather than partial: in an ES5 engine the whole script is
a SyntaxError, so `bundled.js` — the bundle that exists specifically to serve
those engines, polyfills included — does not load at all there.

Lower the emitted chunk with a babel renderChunk pass that runs after bundling
and before terser, so rolldown's own helpers are covered too. Costs 2.8 kB
(+1.6%) on bundled.js; es5.js is unchanged at 34 kB.

The existing guard was a grep for backticks, which this syntax slips straight
past. Replace it with an acorn parse at ecmaVersion 5 over both legacy
bundles, plus a tokeniser check for real template literals (backticks inside
core-js string literals are fine, and 2.14.1 shipped three of them).

Verified by reverting the build fix: `bundled.js parses as ES5` fails, and
passes again once restored. Also confirmed bundled.js loads and parses the
live navigator.userAgent in a real browser.
2026-08-30 21:59:08 +03:00
Naor Peled
28174aca5e fix: keep every published file reachable, and test all four build artifacts (#631) 2026-08-30 21:40:10 +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
Naor Peled
eb3f153def fix: attempt to resolve build issues (#604) 2026-02-09 00:03:04 +02:00
naorpeled
2bb8caee93 fix: remove prepublish hook 2026-02-07 19:48:42 +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
naorpeled
eef8480944 docs(package.json): add naorpeled as contributor 2025-11-23 00:08:32 +02:00
Naor Peled
327e6f5e51 ci: add release drafter (#545) 2024-04-20 14:35:56 +03:00
Naor Peled
efb8e612a5 ci: move to Github Actions (#530) 2023-11-13 11:11:28 +02:00
Denis Demchenko
1d64ecab12 chore: bump version, write changelog and docs 2020-09-12 11:22:31 +03:00
Denis Demchenko
cc546cfb44 chore(docs): regen docs 2020-07-09 22:11:59 +03:00
Denis Demchenko
77f394c8e7 chore(package): bump version, write changelog 2020-07-09 22:08:32 +03:00
Denis Demchenko
7adb0017dd Merge pull request #397 from lancedikson/greenkeeper/sinon-9.0.0
Update sinon to the latest version 🚀
2020-07-09 21:51:01 +03:00
Denis Demchenko
a7bc7110e2 Merge pull request #417 from lancedikson/greenkeeper/compression-webpack-plugin-4.0.0
Update compression-webpack-plugin to the latest version 🚀
2020-07-09 21:50:45 +03:00
greenkeeper[bot]
98f32dfbf5 chore(package): update gh-pages to version 3.0.0 2020-05-29 20:31:26 +00:00
greenkeeper[bot]
538ee8fe0e chore(package): update compression-webpack-plugin to version 4.0.0 2020-05-12 13:33:47 +00:00
greenkeeper[bot]
c83b241238 chore(package): update sinon to version 9.0.0 2020-02-19 11:44:43 +00:00
Denis Demchenko
6add52d49c chore(package): bump version, write changelog 2020-01-28 22:26:13 +02:00
Denis Demchenko
433955ac68 Merge branch 'master' into greenkeeper/monorepo.babel7-20200114033043 2020-01-28 21:53:59 +02:00
Denis Demchenko
9af50fd1c7 Merge pull request #393 from lancedikson/greenkeeper/ava-3.0.0
Update ava to the latest version 🚀
2020-01-28 21:52:16 +02:00
greenkeeper[bot]
be8860b731 chore(package): update ava to version 3.0.0 2020-01-19 15:21:06 +00:00
greenkeeper[bot]
db8e9d4417 chore(package): update eslint-plugin-ava to version 10.0.0 2020-01-19 15:14:38 +00:00
greenkeeper[bot]
2132446318 chore(package): update @babel/register to version 7.8.3 2020-01-15 17:07:01 +00:00
greenkeeper[bot]
50f5a73386 chore(package): update @babel/preset-env to version 7.8.2 2020-01-15 17:06:57 +00:00
greenkeeper[bot]
e575388f48 chore(package): update @babel/polyfill to version 7.8.3 2020-01-15 17:06:54 +00:00
greenkeeper[bot]
b0b505fbe2 chore(package): update @babel/core to version 7.8.0 2020-01-15 17:06:49 +00:00
greenkeeper[bot]
48866a119e chore(package): update @babel/cli to version 7.8.3 2020-01-15 17:06:46 +00:00
Denis Demchenko
01f5f2281e chore(package): bump version, write changelog 2019-12-26 23:28:09 +02:00
Denis Demchenko
ca7357338f chore(package): bump version 2019-12-26 16:45:29 +02:00
Denis Demchenko
15442b789b Merge branch 'master' into greenkeeper/nyc-15.0.0 2019-12-26 16:18:07 +02:00
Denis Demchenko
a62e610f36 Merge pull request #385 from lancedikson/greenkeeper/babel-plugin-istanbul-6.0.0
Update babel-plugin-istanbul to the latest version 🚀
2019-12-26 16:16:41 +02:00
greenkeeper[bot]
0353113434 chore(package): update nyc to version 15.0.0 2019-12-23 01:13:44 +00:00
greenkeeper[bot]
460858d826 chore(package): update babel-plugin-istanbul to version 6.0.0 2019-12-23 00:59:55 +00:00
greenkeeper[bot]
8122ad99a0 chore(package): update sinon to version 8.0.0 2019-12-22 16:29:15 +00:00
Denis Demchenko
715ea30809 chore(package): bump version, update deps 2019-10-02 21:44:30 +03:00
Denis Demchenko
935d30f144 Merge pull request #346 from lancedikson/greenkeeper/eslint-plugin-ava-8.0.0
Update eslint-plugin-ava to the latest version 🚀
2019-10-02 21:30:41 +03:00
greenkeeper[bot]
1caea71a81 chore(package): update testem to version 3.0.0 2019-09-30 17:44:54 +00:00
Denis Demchenko
94a58a2d80 2.6.1 2019-09-10 19:04:13 +03:00
Denis Demchenko
4f12f6bafd chore(package): expose pkg.browser
related to #355
2019-09-10 19:02:13 +03:00
Denis Demchenko
b8ef17a7ba chore(package): write changelog, bump version 2019-09-06 14:35:23 +03:00
Mark Stacey
4356c0a503 Add 'module' field to manifest
The 'module' field is used by bundlers such as rollup and webpack to
determine the entrypoint for a package. Conventionally 'module' is used
for the ES6 entrypoint, and 'main' is used for the CommonJS entrypoint.

Adding a 'module' field allows importing bowser as an ES6 module
directly, rather than using a package-relative path to the ES6
entrypoint (e.g. `bowser/src/bowser`)

Closes #353
2019-09-05 18:28:47 -03:00
Denis Demchenko
a450ae2510 chore(package): bump version 2019-09-02 18:52:35 +03:00
greenkeeper[bot]
b548f9fed2 chore(package): update eslint-plugin-ava to version 8.0.0 2019-08-18 12:58:29 +00:00
Denis Demchenko
ee8989bc20 chore(package): bump version to 2.5.3 2019-08-04 23:50:01 +03:00
greenkeeper[bot]
4f6e7fa14b chore(package): update webpack to version 4.39.1 2019-08-02 12:48:38 +00:00
Alex Hinds
c6c4234f87 Update package.json to to point to "types" 2019-07-30 11:18:59 +10:00
Denis Demchenko
8ec03334a6 chore(package): bump package version 2019-07-17 16:48:23 +03:00
Denis Demchenko
9ba7a45c3f chore(package): bump package version 2019-07-17 13:49:27 +03:00