1
0
mirror of https://github.com/lancedikson/bowser synced 2026-09-22 20:14:20 +00:00
Files
lancedikson_bowser/package.json

148 lines
4.0 KiB
JSON
Raw Normal View History

2011-04-27 15:17:11 -07:00
{
2014-01-27 14:01:27 -08:00
"name": "bowser",
"description": "Lightweight browser detector",
"files": [
"src",
"es5.js",
"bundled.js",
"bowser.mjs",
"index.d.ts",
"index.d.mts"
],
2014-01-27 14:01:27 -08:00
"keywords": [
"browser",
"useragent",
"user-agent",
"parser",
"ua",
"detection",
"ender",
"sniff"
2014-01-27 14:01:27 -08:00
],
"homepage": "https://github.com/bowser-js/bowser",
2014-01-27 14:01:27 -08:00
"author": "Dustin Diaz <dustin@dustindiaz.com> (http://dustindiaz.com)",
2018-06-27 23:04:25 +03:00
"contributors": [
{
"name": "Denis Demchenko",
"url": "http://twitter.com/lancedikson"
},
{
"name": "Naor Peled",
"url": "https://github.com/naorpeled"
2018-06-27 23:04:25 +03:00
}
],
"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"
},
2014-01-27 14:01:27 -08:00
"repository": {
"type": "git",
"url": "git+https://github.com/bowser-js/bowser.git"
2014-01-27 14:01:27 -08:00
},
"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",
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:45:38 +03:00
"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"
2017-04-09 17:13:00 +03:00
},
"ava": {
"require": [
2019-01-19 12:07:15 +02:00
"@babel/register"
],
"files": [
"test/**/*.js",
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:57:22 +03:00
"!test/package/**",
"!test/types/**"
2019-01-19 12:07:15 +02:00
]
2015-05-03 13:14:06 +02:00
},
"bugs": {
"url": "https://github.com/bowser-js/bowser/issues"
2015-05-03 13:14:06 +02:00
},
"directories": {
"test": "test"
},
"scripts": {
"build": "tsdown",
"generate-and-deploy-docs": "pnpm generate-docs && gh-pages --dist docs --dest docs",
"watch": "tsdown --watch",
2023-11-13 11:11:28 +02:00
"lint:check": "eslint ./src",
"lint:fix": "eslint --fix ./src",
2017-08-20 18:37:01 +03:00
"testem": "testem",
"test": "nyc --reporter=html --reporter=text ava",
"test:watch": "ava --watch",
"test:package": "node test/package/smoke.cjs",
2018-07-05 22:44:43 +03:00
"coverage": "nyc report --reporter=text-lcov | coveralls",
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:57:22 +03:00
"generate-docs": "jsdoc -c jsdoc.json",
"test:types": "node test/types/check.mjs"
2015-05-03 13:14:06 +02:00
},
"license": "MIT",
"packageManager": "pnpm@11.18.0"
2011-04-27 15:17:11 -07:00
}