mirror of
https://github.com/lancedikson/bowser
synced 2026-09-22 12:05:23 +00:00
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.
148 lines
4.0 KiB
JSON
148 lines
4.0 KiB
JSON
{
|
|
"name": "bowser",
|
|
"description": "Lightweight browser detector",
|
|
"files": [
|
|
"src",
|
|
"es5.js",
|
|
"bundled.js",
|
|
"bowser.mjs",
|
|
"index.d.ts",
|
|
"index.d.mts"
|
|
],
|
|
"keywords": [
|
|
"browser",
|
|
"useragent",
|
|
"user-agent",
|
|
"parser",
|
|
"ua",
|
|
"detection",
|
|
"ender",
|
|
"sniff"
|
|
],
|
|
"homepage": "https://github.com/bowser-js/bowser",
|
|
"author": "Dustin Diaz <dustin@dustindiaz.com> (http://dustindiaz.com)",
|
|
"contributors": [
|
|
{
|
|
"name": "Denis Demchenko",
|
|
"url": "http://twitter.com/lancedikson"
|
|
},
|
|
{
|
|
"name": "Naor Peled",
|
|
"url": "https://github.com/naorpeled"
|
|
}
|
|
],
|
|
"main": "es5.js",
|
|
"browser": "es5.js",
|
|
"module": "src/bowser.js",
|
|
"types": "index.d.ts",
|
|
"exports": {
|
|
".": {
|
|
"import": {
|
|
"types": "./index.d.mts",
|
|
"default": "./bowser.mjs"
|
|
},
|
|
"require": {
|
|
"types": "./index.d.ts",
|
|
"default": "./es5.js"
|
|
},
|
|
"default": "./es5.js"
|
|
},
|
|
"./es5.js": "./es5.js",
|
|
"./es5": "./es5.js",
|
|
"./bundled.js": "./bundled.js",
|
|
"./bundled": "./bundled.js",
|
|
"./bowser.mjs": {
|
|
"types": "./index.d.mts",
|
|
"default": "./bowser.mjs"
|
|
},
|
|
"./src/bowser.js": "./src/bowser.js",
|
|
"./src/bowser": "./src/bowser.js",
|
|
"./src/constants.js": "./src/constants.js",
|
|
"./src/constants": "./src/constants.js",
|
|
"./src/parser.js": "./src/parser.js",
|
|
"./src/parser": "./src/parser.js",
|
|
"./src/parser-browsers.js": "./src/parser-browsers.js",
|
|
"./src/parser-browsers": "./src/parser-browsers.js",
|
|
"./src/parser-engines.js": "./src/parser-engines.js",
|
|
"./src/parser-engines": "./src/parser-engines.js",
|
|
"./src/parser-os.js": "./src/parser-os.js",
|
|
"./src/parser-os": "./src/parser-os.js",
|
|
"./src/parser-platforms.js": "./src/parser-platforms.js",
|
|
"./src/parser-platforms": "./src/parser-platforms.js",
|
|
"./src/utils.js": "./src/utils.js",
|
|
"./src/utils": "./src/utils.js",
|
|
"./LICENSE": "./LICENSE",
|
|
"./README.md": "./README.md",
|
|
"./index.d.ts": "./index.d.ts",
|
|
"./index.d.mts": "./index.d.mts",
|
|
"./package.json": "./package.json"
|
|
},
|
|
"repository": {
|
|
"type": "git",
|
|
"url": "git+https://github.com/bowser-js/bowser.git"
|
|
},
|
|
"devDependencies": {
|
|
"@arethetypeswrong/cli": "^0.18.5",
|
|
"@babel/cli": "^7.29.7",
|
|
"@babel/core": "^7.29.7",
|
|
"@babel/preset-env": "^7.29.7",
|
|
"@babel/register": "^7.29.7",
|
|
"@eslint/js": "^10.0.1",
|
|
"@rolldown/plugin-babel": "0.2.3",
|
|
"acorn": "^8.18.0",
|
|
"ava": "^3.0.0",
|
|
"babel-plugin-add-module-exports": "^1.0.4",
|
|
"babel-plugin-istanbul": "^8.0.0",
|
|
"core-js": "^3.49.0",
|
|
"coveralls-next": "^6.0.2",
|
|
"docdash": "^2.0.2",
|
|
"eslint": "^10.8.0",
|
|
"eslint-config-airbnb-extended": "^3.1.0",
|
|
"eslint-plugin-ava": "^17.0.1",
|
|
"eslint-plugin-import": "^2.32.0",
|
|
"gh-pages": "^6.3.0",
|
|
"jsdoc": "^4.0.5",
|
|
"nyc": "^18.0.0",
|
|
"publint": "^0.3.22",
|
|
"regenerator-runtime": "^0.14.1",
|
|
"sinon": "^22.0.0",
|
|
"terser": "^5.49.0",
|
|
"testem": "^3.20.2",
|
|
"tsdown": "^0.22.14",
|
|
"typescript": "^5.9.3",
|
|
"yamljs": "^0.3.0"
|
|
},
|
|
"ava": {
|
|
"require": [
|
|
"@babel/register"
|
|
],
|
|
"files": [
|
|
"test/**/*.js",
|
|
"!test/package/**",
|
|
"!test/types/**"
|
|
]
|
|
},
|
|
"bugs": {
|
|
"url": "https://github.com/bowser-js/bowser/issues"
|
|
},
|
|
"directories": {
|
|
"test": "test"
|
|
},
|
|
"scripts": {
|
|
"build": "tsdown",
|
|
"generate-and-deploy-docs": "pnpm generate-docs && gh-pages --dist docs --dest docs",
|
|
"watch": "tsdown --watch",
|
|
"lint:check": "eslint ./src",
|
|
"lint:fix": "eslint --fix ./src",
|
|
"testem": "testem",
|
|
"test": "nyc --reporter=html --reporter=text ava",
|
|
"test:watch": "ava --watch",
|
|
"test:package": "node test/package/smoke.cjs",
|
|
"coverage": "nyc report --reporter=text-lcov | coveralls",
|
|
"generate-docs": "jsdoc -c jsdoc.json",
|
|
"test:types": "node test/types/check.mjs"
|
|
},
|
|
"license": "MIT",
|
|
"packageManager": "pnpm@11.18.0"
|
|
}
|