Skip to content

Commit 504f77a

Browse files
yankouskiaclaude
andcommitted
docs: correct bundle-size figures and add security policy
- Update the bundle-size claim from "~1.5 kB" to the accurate "~1 kB" min+gzip across the README, hero artwork, and Docusaurus docs. size-limit reports 827 B (ESM, brotli); the minified UMD gzips to 1120 B, so ~1 kB is the honest figure. - Fix the README API section: it lists twelve exports, not eleven. - Add SECURITY.md — the README already linked to it, but the file was missing. Documents supported versions, private reporting, and scope. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent 5728162 commit 504f77a

11 files changed

Lines changed: 65 additions & 17 deletions

File tree

‎README.md‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
<p align="center">
1010
<strong>Tiny, typed, SSR-safe browser detection.</strong><br />
11-
One call. One canonical answer. <strong>~1.5&nbsp;kB</strong> min+gzip. Zero dependencies.
11+
One call. One canonical answer. <strong>~1&nbsp;kB</strong> min+gzip. Zero dependencies.
1212
</p>
1313

1414
<p align="center">
@@ -55,7 +55,7 @@ No bundler? Drop in the UMD bundle:
5555

5656
## Why you'd use this
5757

58-
- 🪶 **Tiny** — ~1.5 kB min+gzip, zero dependencies, tree-shakeable.
58+
- 🪶 **Tiny** — ~1 kB min+gzip, zero dependencies, tree-shakeable.
5959
- 🧠 **Typed** — `detect()` returns the `Browser` union, never `string`. Exhaustive switches compile.
6060
- 🏗️ **SSR-safe** — every detector takes `{ userAgent }`. Works in Node, Next.js, Remix, Astro, Workers, Deno.
6161
- 🎯 **Honest** — it answers *who*, not *what*. For capability checks use `@supports` / `matchMedia`.
@@ -134,7 +134,7 @@ If a future major bumps `Browser`, the compiler refuses to build. No silent drif
134134

135135
## API
136136

137-
Eleven exports. That's all.
137+
Twelve exports. That's all.
138138

139139
| | |
140140
| --- | --- |
@@ -152,7 +152,7 @@ Eleven exports. That's all.
152152

153153
| Bundle (min+gz) | get-browser | detect-browser | bowser | ua-parser-js |
154154
| --- | :-: | :-: | :-: | :-: |
155-
| | 🏆 **~1.5 kB** | ~2 kB | ~7 kB | ~10 kB |
155+
| | 🏆 **~1 kB** | ~2 kB | ~7 kB | ~10 kB |
156156

157157
Pick `ua-parser-js` if you need version numbers or device info. Pick `get-browser` if you just need the single, lowercase, typed answer to *which browser is this?* — see [the full comparison](https://yankouskia.github.io/get-browser/docs/comparison).
158158

‎SECURITY.md‎

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
# Security Policy
2+
3+
## Supported Versions
4+
5+
`get-browser` follows [semantic versioning](https://semver.org/). Security fixes
6+
land on the latest minor of the current major.
7+
8+
| Version | Supported |
9+
| ------- | ------------------ |
10+
| 2.x | :white_check_mark: |
11+
| 1.x | :x: |
12+
13+
## Reporting a Vulnerability
14+
15+
**Please do not open a public issue for security vulnerabilities.**
16+
17+
Report privately through GitHub's
18+
[private vulnerability reporting](https://github.com/yankouskia/get-browser/security/advisories/new)
19+
— this opens a confidential advisory visible only to the maintainers.
20+
21+
If you prefer email, contact the maintainer at **aleksandr.yankovskiy@gmail.com**.
22+
23+
Please include:
24+
25+
- A description of the issue and its impact.
26+
- Steps to reproduce — a failing test or a sample user-agent string is ideal.
27+
- The affected version(s).
28+
29+
## What to Expect
30+
31+
- **Acknowledgement** within 3 business days.
32+
- An initial assessment and severity rating within 7 days.
33+
- **Coordinated disclosure:** a fix is published to npm before the advisory goes
34+
public, and reporters are credited unless they ask otherwise.
35+
36+
## Scope
37+
38+
`get-browser` has **zero runtime dependencies** and performs **no I/O** — it only
39+
inspects user-agent strings the caller already has. The realistic attack surface
40+
is therefore limited to:
41+
42+
- **Regular-expression denial of service (ReDoS)** in the detection patterns.
43+
- Incorrect detection results that could weaken a security-relevant branch in
44+
consuming code.
45+
46+
Reports in these areas are especially welcome. General "this browser is
47+
misdetected" bugs *without* a security impact belong in the normal
48+
[issue tracker](https://github.com/yankouskia/get-browser/issues) instead.

‎resources/hero.svg‎

Lines changed: 1 addition & 1 deletion
Loading

‎website/docs/api/detect.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ import TabItem from '@theme/TabItem';
1616
| --- | --- |
1717
| **Signature** | `(options?: DetectOptions) => Browser` |
1818
| **Returns** | `'android' \| 'chrome' \| 'edge' \| 'firefox' \| 'ie' \| 'opera' \| 'safari' \| 'unknown'` |
19-
| **Bundle cost** | ~1.5 kB (full library, min+gz) |
19+
| **Bundle cost** | ~1 kB (full library, min+gz) |
2020
| **SSR safe** | ✅ Pass `{ userAgent }` to pin |
2121

2222
## Signature

‎website/docs/comparison.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ import SizeChart from '@site/src/components/SizeChart';
1616

1717
| | `get-browser` | [`ua-parser-js`](https://www.npmjs.com/package/ua-parser-js) | [`bowser`](https://www.npmjs.com/package/bowser) | [`detect-browser`](https://www.npmjs.com/package/detect-browser) |
1818
| --- | :-: | :-: | :-: | :-: |
19-
| Bundle (min+gz) | 🏆 **~1.5 kB** | ~10 kB | ~7 kB | ~2 kB |
19+
| Bundle (min+gz) | 🏆 **~1 kB** | ~10 kB | ~7 kB | ~2 kB |
2020
| Tree-shakes to single predicate | ✅ ~400 B | ❌ | ❌ | ❌ |
2121
| Dual ESM + CJS | ✅ | ✅ | ✅ | ⚠️ |
2222
| Strict union return type | ✅ | ❌ | ⚠️ | ⚠️ |

‎website/docs/faq.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ No. If `navigator` isn't available (Node, Workers, Deno), every detector cleanly
4646

4747
## Why not just regex the UA myself?
4848

49-
You can! The library is ~1.5 kB because the regexes aren't trivial — Chrome-on-Edge, Firefox-on-iOS, Safari-vs-CriOS, Opera Mini, and the long tail of mobile detection have edge cases that aren't obvious. We've debugged them so you don't have to.
49+
You can! The library is ~1 kB because the regexes aren't trivial — Chrome-on-Edge, Firefox-on-iOS, Safari-vs-CriOS, Opera Mini, and the long tail of mobile detection have edge cases that aren't obvious. We've debugged them so you don't have to.
5050

5151
## License?
5252

‎website/docs/intro.md‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
id: intro
33
title: Introduction
4-
description: A tiny, SSR-safe TypeScript utility that tells you which browser is on the other end. Zero dependencies, ~1.5 kB.
4+
description: A tiny, SSR-safe TypeScript utility that tells you which browser is on the other end. Zero dependencies, ~1 kB.
55
slug: /intro
66
sidebar_position: 1
77
---
@@ -17,7 +17,7 @@ detect(); // → 'chrome' | 'edge' | 'firefox' | ...
1717
detect() === browsers.SAFARI; // → true on Safari (with the constant type-checked)
1818
```
1919

20-
That's the whole pitch. **~1.5 kB** min+gzip, zero dependencies, dual ESM + CJS, strict TypeScript types, and an SSR-safe API. It pairs `detect()` with a handful of single-purpose predicates (`isChrome`, `isMobile`, …) when all you want is a boolean.
20+
That's the whole pitch. **~1 kB** min+gzip, zero dependencies, dual ESM + CJS, strict TypeScript types, and an SSR-safe API. It pairs `detect()` with a handful of single-purpose predicates (`isChrome`, `isMobile`, …) when all you want is a boolean.
2121

2222
## Should I use this?
2323

@@ -39,7 +39,7 @@ See [feature detection vs UA sniffing](/docs/guides/feature-vs-ua) for the longe
3939

4040
## What you get
4141

42-
- **🪶 Tiny** — ~1.5 kB min+gzip, zero dependencies, fully tree-shakeable (single predicates ship at ~400 bytes).
42+
- **🪶 Tiny** — ~1 kB min+gzip, zero dependencies, fully tree-shakeable (single predicates ship at ~400 bytes).
4343
- **🧠 Typed** — `detect()` returns the `Browser` union, never plain `string`. Exhaustive `switch` statements compile.
4444
- **🏗️ SSR-safe** — every detector takes `{ userAgent, vendor }`. No `window` at import time. Works in Node, Next.js, Remix, Astro, Workers, Deno.
4545
- **📦 Dual ESM + CJS** — `import` and `require` both work, types ship for both. UMD bundle for `<script>` tags.

‎website/docs/migration.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ description: Breaking changes between get-browser 1.x and 2.x, and the steps to
2424
| TypeScript minimum | 4.5 | 5.0 |
2525
| Types in dist | hand-rolled | generated, dual `.d.ts` + `.d.cts` |
2626
| `isMobile` regex | original detectmobilebrowsers.com | modernized; now correctly matches iPad in "Request Mobile Website" mode |
27-
| Bundle (min+gz) | ~3 kB | ~1.5 kB |
27+
| Bundle (min+gz) | ~3 kB | ~1 kB |
2828

2929
## Step 1: bump the dependency
3030

‎website/src/components/Hero/index.tsx‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ export default function Hero() {
2727
<div className={styles.heroLeft}>
2828
<Link to="/docs/migration" className={styles.eyebrow}>
2929
<span className={styles.eyebrowBadge}>v2</span>
30-
<span>Now strict TypeScript, dual ESM + CJS, 1.5 kB</span>
30+
<span>Now strict TypeScript, dual ESM + CJS, 1 kB</span>
3131
<span className={styles.eyebrowArrow}>→</span>
3232
</Link>
3333

@@ -39,7 +39,7 @@ export default function Hero() {
3939

4040
<p className={styles.subtitle}>
4141
<code>get-browser</code> answers <strong>which browser?</strong> with a strict
42-
TypeScript union. <strong>1.5 kB</strong> min+gzip. <strong>Zero</strong> runtime
42+
TypeScript union. <strong>1 kB</strong> min+gzip. <strong>Zero</strong> runtime
4343
dependencies. Works in Node, the browser, edge runtimes, Workers, Deno — same import,
4444
same call.
4545
</p>
@@ -69,7 +69,7 @@ export default function Hero() {
6969

7070
<div className={styles.statRow}>
7171
<div className={styles.stat}>
72-
<strong>~1.5 kB</strong>
72+
<strong>~1 kB</strong>
7373
<span>min+gzip</span>
7474
</div>
7575
<div className={styles.stat}>

‎website/src/pages/index.tsx‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ export default function Home() {
1212
return (
1313
<Layout
1414
title="get-browser — tiny, typed, SSR-safe browser detection"
15-
description="A ~1.5 kB TypeScript utility that returns a strict union for the current user-agent. Works in Node, Next.js, Remix, Workers, Deno, and the browser. Zero runtime dependencies."
15+
description="A ~1 kB TypeScript utility that returns a strict union for the current user-agent. Works in Node, Next.js, Remix, Workers, Deno, and the browser. Zero runtime dependencies."
1616
>
1717
<Hero />
1818

0 commit comments

Comments
 (0)