mirror of
https://github.com/lancedikson/bowser
synced 2026-10-17 16:43:26 +00:00
- Exclude the 10 core-js 3.0 modules with no counterpart in the @babel/polyfill set every released bundled.js shipped (concat/splice species fixes, Array#flat, Object.fromEntries, the __defineGetter__ family, NodeList#forEach): 156.1 -> 153.2 kB (49.3 -> 48.4 kB gzip). babel rejects unknown exclude names, so a core-js rename fails the build. - terser `passes: 5`, where output stops shrinking: es5.js 7.52 -> 7.49 kB gzip. - New test: bundled.js must not install polyfills no release ever shipped (fails on the previous master build, passes on 2.14.1 and this one). - README no longer claims named imports shrink the bundle; AGENTS.md describes the tsdown build and four-artifact acceptance tests; CONTRIBUTING points at the existing lint:check script.
28 lines
1.2 KiB
JavaScript
28 lines
1.2 KiB
JavaScript
/**
|
|
* UMD entry point for `bundled.js` — same as `es5.js`, but with the polyfills
|
|
* needed by the browser targets baked in.
|
|
*
|
|
* This is the core-js@3 equivalent of the deprecated `@babel/polyfill` that
|
|
* this bundle used to be built from, which was: all of ECMAScript, the
|
|
* `timers`, `immediate` and DOM-collection iterator web polyfills, and
|
|
* `regenerator-runtime`. `@babel/preset-env`'s `useBuiltIns: 'entry'` rewrites
|
|
* the `core-js/*` imports below into the modules the configured targets need.
|
|
*
|
|
* `core-js/es` rather than `core-js/stable`: `stable` is `es` plus every web
|
|
* polyfill, and the extra ones — `URL`, `URLSearchParams`, `queueMicrotask` —
|
|
* were never in any released `bundled.js`, yet cost ~20 kB (~7 kB gzipped).
|
|
* The few `es` modules `@babel/polyfill` did not have are excluded in
|
|
* `tsdown.config.ts` (`NOT_IN_BABEL_POLYFILL`).
|
|
* `test/acceptance/test-es5-runtime.js` pins the `@babel/polyfill` surface.
|
|
*
|
|
* See `./es5.js` for why this only re-exports the default.
|
|
*/
|
|
import 'core-js/es';
|
|
import 'core-js/web/dom-collections';
|
|
import 'core-js/web/immediate';
|
|
import 'core-js/web/timers';
|
|
import 'regenerator-runtime/runtime';
|
|
import Bowser from '../../src/bowser.js';
|
|
|
|
export default Bowser;
|