Skip to content

Releases: DamonOehlman/detect-browser

4.3.0

10 Apr 09:32
Compare
Choose a tag to compare

Added detection support for the Miui browser (#98)

4.2.1

08 Apr 08:27
Compare
Choose a tag to compare

Address issue with VSCode reporting errors when it looks into the node_modules tree at detect-browser (see #95). Resolution is to remove the tsconfig.json file from the npm tarball. Also removed tslint.json at the same time as it offers no value being in the package.

4.2.0

25 Mar 03:02
Compare
Choose a tag to compare

Added additional regex for matching the new UA string for ios-webview for iOS 12.1.4 and greater (#96) - thanks to @e-compton on this one.

4.1.0

06 Feb 11:07
Compare
Choose a tag to compare
  • Added support for Opera-Mini, Silk and Chrome OS (#92)

thanks to @sreya3 on this one.

4.0.3

08 Jan 10:16
Compare
Choose a tag to compare

FIX: Remove Array#find usage in the code. Additionally the source tsconfig.json file (not release related, but pertinent) has been set to only expect es5 constructs in the code which should prevent any future attempts to use all the newer things we like to use.

Big thanks to @limonte for picking up these IE11 related issues.

4.0.2

08 Jan 09:28
Compare
Choose a tag to compare

FIX: Remove Array#fill usage. While I expected this would be transpiled out by TypeScript, this is not the case. TypeScript expects that you might have injected a polyfill to take care of this, which is completely reasonable.

4.0.1

07 Jan 22:24
Compare
Choose a tag to compare

FIX: Address babel static analysis issue

TL; DR; If you were having "critical dependency" (see issue #84) warning when using [email protected] it's now fixed (see PR #85). You should upgrade to 4.0.1 to resolve the issue.


Due to the use of the TypeScript umd transpilation target, the generated index.js file included code that implied dynamic require behaviour (something that is inherent in the UMD header pattern apparently). The TypeScript compiler has now been switched to generating a standard commonjs output file.

Given that a UMD compilation target was selected for the 4.x only very recently to satisfy a potential use case of detect-browser within a requirejs context, I feel this is an acceptable (and necessary) change.

I will look to create a transpiled file that can be used in a requirejs context as part of completing #83 sometime in the future.

4.0.0

05 Jan 08:32
24b8c6f
Compare
Choose a tag to compare

Summary

A TypeScript rewrite.

Breaking Changes

The only potential breaking change is that the bot boolean flag has been removed for all "non-bot" detection results, i.e. when we have detected a browser or the node environment.

In the majority of cases this should not affect usage as detecting for bots will still succeed due to the "falsiness" evaluation of the undefined value. The only corner case is if you are doing an equality comparison against false at any point.

For instance, the following would no longer work:

const { detect } = require('detect-browser');
const result = detect();

if (result && result.bot == false) {
  console.log('browser or node detected');
}

A simple change to the following, however, would resolve the issue:

const { detect } = require('detect-browser');
const result = detect();

if (result && !result.bot) {
  console.log('browser or node detected');
}

Extra Goodness

As this is a full TypeScript rewrite, the type definitions are now included in the package by default. So with an upgrade to detect-browser@4 you should probably also remove the @types/detect-browser package if you are working in a TypeScript environment.

Thanks

A big thanks goes to @sargant for being the catalyst for a source conversion to TypeScript with a couple of solid PRs, and also to @carusology for an excellent review and challenging some of the early design decisions that I had made with the initial conversion. What we have ended up with I think is a solid result.

3.0.0

04 Jul 03:24
Compare
Choose a tag to compare

(copied from the text of #65)

So this is a reasonably simple change, but one that should have a pretty big impact for people who have been hit with the code path which is returning a false positive on node detection (see #54).

It changes two things:

We do browser detection if at all possible (i.e. navigator is defined). This then falls back to detecting the node environment if that isn't available.

  • Removes the require('os') import for os detection and simply uses process.platform instead. The information won't be as detailed and it's possible that a user of this module may still want to opt to do their own check using the os module. Given that the majority use case is web browser detection though I think that makes sense. Should stop browserify bringing in any shims for the os module also (which is a good thing).

  • Because of point 2 though, I believe we should do a major version bump to 3.0.0 to ensure that no-one that is using detect-browser in an isomorphic way is caught out unexpectedly.

2.5.0

24 May 11:16
Compare
Choose a tag to compare
  • Implemented iOS WebView detection (#67) - thanks @enijar