mirror of
https://github.com/lancedikson/bowser
synced 2024-10-27 20:34:22 +00:00
Merge branch 'release/2.0.0-alpha.2'
This commit is contained in:
commit
2ae6ce1820
@ -1 +0,0 @@
|
||||
src/bowser.js
|
4
.gitignore
vendored
4
.gitignore
vendored
@ -1,8 +1,6 @@
|
||||
node_modules/
|
||||
.idea/
|
||||
/bowser.js
|
||||
/bowser.min.js
|
||||
/lib/
|
||||
.nyc_output
|
||||
coverage
|
||||
dist
|
||||
compiled.js
|
||||
|
@ -1,5 +1,5 @@
|
||||
make
|
||||
src/useragents.js
|
||||
Makefile
|
||||
test
|
||||
.nyc_output
|
||||
coverage
|
||||
**/.*
|
||||
node_modules
|
||||
|
@ -1,5 +1,11 @@
|
||||
# Bowser Changelog
|
||||
|
||||
### 2.0.0-alpha.2 (July 17, 2018)
|
||||
- [CHANGE] Make `src/bowser` main file instead of the bundled one
|
||||
- [CHANGE] Move the bundled file to the root of the package to make it possible to `require('bowser/compiled')` (#231)
|
||||
- [REMOVE] Remove `typings.d.ts` before stable release (#232)
|
||||
- [FIX] Improve Nexus devices detection (#233)
|
||||
|
||||
### 2.0.0-alpha.1 (July 9, 2018)
|
||||
- [ADD] `Bowser.getParser()`
|
||||
- [ADD] `Bowser.parse`
|
||||
|
19
README.md
19
README.md
@ -22,7 +22,7 @@ The upcoming 2.0 version has drastically changed API. All available methods can
|
||||
|
||||
First of all, require the library:
|
||||
|
||||
```
|
||||
```javascript
|
||||
const bowser = require('bowser');
|
||||
```
|
||||
|
||||
@ -30,7 +30,7 @@ const bowser = require('bowser');
|
||||
|
||||
Often we need to pick users' browser properties such as the name, the version, the rendering engine and so on. Here is an example how to make it with Bowser:
|
||||
|
||||
```
|
||||
```javascript
|
||||
const browser = bowser.getParser(window.navigator.userAgent);
|
||||
|
||||
console.log(`The current browser name is "${browser.getBrowserName()}"`);
|
||||
@ -39,7 +39,7 @@ console.log(`The current browser name is "${browser.getBrowserName()}"`);
|
||||
|
||||
or
|
||||
|
||||
```
|
||||
```javascript
|
||||
const impression = new Impression();
|
||||
|
||||
const browser = bowser.getParser(window.navigator.userAgent);
|
||||
@ -50,7 +50,7 @@ impression.brVer = browserInfo.version;
|
||||
|
||||
or
|
||||
|
||||
```
|
||||
```javascript
|
||||
const browser = bowser.getParser(window.navigator.userAgent);
|
||||
impression.userTechData = browser.parse();
|
||||
console.log(impression.userTechData);
|
||||
@ -81,7 +81,7 @@ console.log(impression.userTechData);
|
||||
You could want to filter some particular browsers to provide any special support for them or make any workarounds.
|
||||
It could look like this:
|
||||
|
||||
```
|
||||
```javascript
|
||||
const browser = bowser.getParsers(window.navigator.userAgent);
|
||||
const isValidBrowser = browser.satisfies({
|
||||
// declare browsers per OS
|
||||
@ -111,10 +111,11 @@ Thus, you can define OS or platform specific rules and they will have more prior
|
||||
More of API and possibilities you will find in the `docs` folder.
|
||||
|
||||
# Advanced Usage
|
||||
By default, `require('bowser')` requires the pre-compiled file, which can
|
||||
include useless for you polyfills. In case you don't need that, you can choose
|
||||
using source file requiring bowser like that: `require('bowser/src/bowser`);
|
||||
Then you get ES2015 file, which is not precompiled and can be easier to debug.
|
||||
By default, `require('bowser')` requires the *ES6 version of files*, which
|
||||
**don't** include any polyfills. In case if you don't use your own `babel-polyfill`
|
||||
you may need to have pre-built bundle with all needed polyfills.
|
||||
It's possible requiring bowser like that: `require('bowser/compiled');`
|
||||
As result you get a ES5 file with `babel-polyfill` bundled in it.
|
||||
|
||||
# Contributing
|
||||
If you'd like to contribute a change to bowser, modify the files in `src/`, then run the following (you'll need node + npm installed):
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "bowser",
|
||||
"version": "2.0.0-alpha.1",
|
||||
"version": "2.0.0-alpha.2",
|
||||
"description": "Lightweight browser detector",
|
||||
"keywords": [
|
||||
"browser",
|
||||
@ -20,8 +20,7 @@
|
||||
"url": "http://twitter.com/lancedikson"
|
||||
}
|
||||
],
|
||||
"main": "./dist/bowser.compiled.js",
|
||||
"typings": "./typings.d.ts",
|
||||
"main": "src/bowser.js",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/lancedikson/bowser.git"
|
||||
|
@ -14,7 +14,7 @@ const TYPES_LABELS = {
|
||||
export default [
|
||||
/* Nexus Tablet */
|
||||
{
|
||||
test: [/nexus\s*[0-9]+/i],
|
||||
test: [/nexus\s*(?:7|8|9|10).*/i],
|
||||
describe() {
|
||||
return {
|
||||
type: TYPES_LABELS.tablet,
|
||||
@ -87,7 +87,7 @@ export default [
|
||||
|
||||
/* Nexus Mobile */
|
||||
{
|
||||
test: [/nexus\s*[0-6]\s*/i, /galaxy nexus/i],
|
||||
test: [/nexus\s*[0-6].*/i, /galaxy nexus/i],
|
||||
describe() {
|
||||
return {
|
||||
type: TYPES_LABELS.mobile,
|
||||
|
@ -254,7 +254,21 @@
|
||||
type: "tablet"
|
||||
engine:
|
||||
name: "Blink"
|
||||
Amazon Silk:
|
||||
-
|
||||
ua: "Mozilla/5.0 (Linux; Android 7.0; Nexus 6P Build/NRD90T) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/63.0.3239.111 Mobile Safari/537.36"
|
||||
spec:
|
||||
browser:
|
||||
name: "Chrome"
|
||||
version: "63.0.3239.111"
|
||||
os:
|
||||
name: "Android"
|
||||
version: "7.0"
|
||||
platform:
|
||||
type: "mobile"
|
||||
vendor: "Nexus"
|
||||
engine:
|
||||
name: "Blink"
|
||||
Amazon Silk:
|
||||
-
|
||||
ua: "Mozilla/5.0 (Linux; U; Android 4.0.3; en-us; KFTT Build/IML74K) AppleWebKit/535.19 (KHTML, like Gecko) Silk/3.4 Mobile Safari/535.19 Silk-Accelerated=true"
|
||||
spec:
|
||||
@ -607,7 +621,7 @@
|
||||
name: "Android"
|
||||
version: "5.1.1"
|
||||
platform:
|
||||
type: "tablet"
|
||||
type: "mobile"
|
||||
vendor: "Nexus"
|
||||
engine:
|
||||
name: "Blink"
|
||||
|
1
typings.d.ts
vendored
1
typings.d.ts
vendored
@ -1 +0,0 @@
|
||||
// to be defined in stable version
|
@ -9,10 +9,10 @@ module.exports = {
|
||||
// and webpack starts bundling
|
||||
output: {
|
||||
// options related to how webpack emits results
|
||||
path: path.resolve(__dirname, 'dist'), // string
|
||||
path: path.resolve(__dirname, './'), // string
|
||||
// the target directory for all output files
|
||||
// must be an absolute path (use the Node.js path module)
|
||||
filename: 'bowser.compiled.js', // string
|
||||
filename: 'compiled.js', // string
|
||||
// the filename template for entry chunks
|
||||
library: 'bowser',
|
||||
libraryTarget: 'umd', // universal module definition
|
||||
|
Loading…
Reference in New Issue
Block a user