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

20 Commits

Author SHA1 Message Date
naorpeled
a78d9d35a2 fix: make dual packaging non-breaking for existing consumers
Keeps the published surface of bowser@2.14.1 intact while adding a real
ESM build, and rewrites CI so it can actually run the new toolchain.

Packaging

- Restore the flat artifact layout. es5.js and bundled.js stay at the
  tarball root next to src/, so unpkg.com/bowser/es5.js and
  require('bowser/bundled') keep working. bowser.mjs is added alongside.
- Build the UMD bundles from dedicated single-default-export entries in
  build/entries/. src/bowser.js gained named exports (parse, getParser)
  to fix #511, but a UMD bundle with named exports makes require('bowser')
  a namespace object instead of the class: typeof flips from 'function' to
  'object' and BROWSER_MAP / ENGINE_MAP / OS_MAP / PLATFORMS_MAP disappear,
  since they are static getters rather than exports.
- globalName back to lowercase 'bowser', matching the shipped es5.js.
  Renaming it to 'Bowser' would break every script-tag consumer.
- Enumerate every legacy subpath in the exports map. Conditional exports
  are honoured from Node 12.16.0 onward, so a "."-only map turns paths
  that resolve today into ERR_PACKAGE_PATH_NOT_EXPORTED. Subpath patterns
  ("./src/*") need Node 12.20.0+ and the trailing-slash folder form was
  removed in Node 17, so explicit per-file keys are the only spelling that
  works across the whole supported range. Extension-less aliases included:
  the README documents require('bowser/bundled').
- main, browser and module keep their existing values. No engines field
  (npm warns EBADENGINE, pnpm fails under engine-strict) and no type
  field (it would reclassify es5.js as ESM).

Build

- Minify the UMD bundles with terser instead of rolldown's built-in oxc
  minifier. oxc prints every string literal as a template literal and
  rejects any compress.target below es2015, so it cannot emit ES5 and was
  silently undoing babel's lowering. terser is what webpack 4 used.
- Wire up the copyright banner, which was declared but never passed to a
  config, and restore bundled.js as the polyfilled build via core-js/stable.
- Add index.d.mts so the import condition has ESM types. Reusing the
  export = declarations for both conditions describes an ES module with
  CommonJS types.

CI

- Replace npm ci with pnpm across all workflows. This is what was failing:
  the lockfile was swapped for pnpm-lock.yaml but the workflows still ran
  npm ci, pinned to Node 12.16.3 and 16. Build now runs on Node 24, which
  tsdown requires.
- Add a pack-smoke job that installs the packed tarball on Node 12.16.3,
  14, 18, 20 and 24 and exercises every documented entry point, plus
  publint and attw on the tarball. This is what makes "non-breaking" a
  tested claim rather than an argument; it catches all of the above.
- Restore test-list-of-ua.js to asserting src against the built es5.js.
  It had been collapsed to comparing Bowser.parse with itself.
2026-08-01 14:40:56 +03:00
Yasumasa Ashida
1944c3d05c chore: Update devDependency eslint to 10.8.0 2026-07-26 08:22:44 +09:00
Yasumasa Ashida
a9d17b8891 chore: Update devDependency tsdown to 0.22.14 2026-07-25 10:59:26 +09:00
Yasumasa Ashida
c48ede52dc chore: Update devDependency tsdown to 0.22.13 2026-07-23 20:12:02 +09:00
Yasumasa Ashida
d3b4ee75d5 chore: Update devDependency tsdown to 0.22.12 2026-07-22 14:10:28 +09:00
Yasumasa Ashida
552c183eb1 chore: Update devDependency tsdown to 0.22.9 2026-07-18 08:10:43 +09:00
Yasumasa Ashida
395e4da9a7 chore: Update devDependency tsdown to 0.22.8 2026-07-17 16:34:41 +09:00
Yasumasa Ashida
381def1620 chore: Update devDependency tsdown to 0.22.7 2026-07-15 06:12:31 +09:00
Yasumasa Ashida
e5829fe94d chore: Update devDependency tsdown to 0.22.5 2026-07-12 06:29:27 +09:00
Yasumasa Ashida
0d5ae62ea5 chore: Update devDependency eslint to 10.7.0 2026-07-11 07:26:53 +09:00
Yasumasa Ashida
8b2b1736cb chore: Update dependencies 2026-07-10 21:00:04 +09:00
Yasumasa Ashida
3b1648b7a1 chore: Roll back the gh-pages version. 2026-06-17 20:17:46 +09:00
Yasumasa Ashida
825b409478 chore: Remove devDependency @babel/eslint-parser 2026-06-17 15:34:37 +09:00
Yasumasa Ashida
8ab044238a chore: Update tsdown to 0.22.3 2026-06-17 12:30:01 +09:00
Yasumasa Ashida
7c6fd2f463 chore: Update sinon to 22.0.0 2026-06-16 17:57:43 +09:00
Yasumasa Ashida
6edf9da595 chore: Update ESLint to 10.5.0 2026-06-16 16:58:53 +09:00
Yasumasa Ashida
4ba3be2e46 chore: Install @rolldown/plugin-babel and update tsdown.config.ts 2026-06-15 10:26:34 +09:00
Yasumasa Ashida
b339e6215c chore: Install core-js 2026-06-15 08:10:44 +09:00
Yasumasa Ashida
479d002bc2 chore: Install tsdown and create a dual package for UMD and ESM 2026-06-15 08:10:44 +09:00
Yasumasa Ashida
6ff01f53db chore: Switch to pnpm, update dependencies, and remove webpack 2026-06-14 21:51:01 +09:00