Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
ije committed Jun 28, 2024
0 parents commit 36815da
Show file tree
Hide file tree
Showing 7 changed files with 1,174 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
.DS_Store
node_modules/
dist/
30 changes: 30 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# esm-compat

Check the ES module compatibility of a browser.

## Installation

```
npm i esm-compat
```

## Usage

```js
import { getBuildTargetFromUA } from 'esm-compat';

const ua = "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/116.0.0.0 Safari/537.36"
const target = getBuildTargetFromUA(ua)
console.log(target) // => es2022
```

## API

```ts
export const targets: Set<string>;
export const getBuildTargetFromUA: (ua: string | null) => string;
```

## License

MIT
26 changes: 26 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{
"name": "esm-compat",
"description": "Checks the ES6 compatibility from a `User-Agent` string",
"version": "0.0.5",
"type": "module",
"module": "dist/compat.js",
"types": "types/compat.d.ts",
"scripts": {
"prepublishOnly": "pnpm run build",
"build": "pnpm esbuild src/compat.ts --outdir=dist --format=esm --platform=browser",
"test": "pnpm run build && node test.mjs"
},
"files": [
"dist/compat.js",
"types/compat.d.ts"
],
"devDependencies": {
"@types/ua-parser-js": "0.7.39",
"esbuild": "0.21.5"
},
"dependencies": {
"ua-parser-js": "^1.0.38"
},
"repository": "https://github.com/esm-dev/esm-compat",
"license": "MIT"
}
271 changes: 271 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 36815da

Please sign in to comment.