mqtt 5.5.1 → 5.5.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "mqtt",
3
3
  "description": "A library for the MQTT protocol",
4
- "version": "5.5.1",
4
+ "version": "5.5.2",
5
5
  "contributors": [
6
6
  "Adam Rudd <adamvrr@gmail.com>",
7
7
  "Matteo Collina <matteo.collina@gmail.com> (https://github.com/mcollina)",
@@ -1,4 +1,5 @@
1
1
  import { Duplex, Transform } from 'readable-stream'
2
+ import { Buffer } from 'buffer'
2
3
  import { IClientOptions } from './client'
3
4
 
4
5
  /**
@@ -1,4 +1,4 @@
1
- import isBrowser, { isWebWorker } from './is-browser'
1
+ import isBrowser, { isWebWorker, isReactNativeBrowser } from './is-browser'
2
2
  import { clearTimeout as clearT, setTimeout as setT } from 'worker-timers'
3
3
  import type { TimerVariant } from './shared'
4
4
 
@@ -30,7 +30,9 @@ const getTimer = (variant: TimerVariant): Timer => {
30
30
  }
31
31
  case 'auto':
32
32
  default: {
33
- return isBrowser && !isWebWorker ? workerTimer : nativeTimer
33
+ return isBrowser && !isWebWorker && !isReactNativeBrowser
34
+ ? workerTimer
35
+ : nativeTimer
34
36
  }
35
37
  }
36
38
  }
@@ -17,4 +17,6 @@ const isBrowser =
17
17
 
18
18
  export const isWebWorker = isWebWorkerEnv()
19
19
 
20
+ export const isReactNativeBrowser = isReactNativeEnv()
21
+
20
22
  export default isBrowser
package/src/lib/shared.ts CHANGED
@@ -76,8 +76,9 @@ export function applyMixin(
76
76
  }
77
77
  }
78
78
  }
79
- export const nextTick = process
80
- ? process.nextTick
81
- : (callback: () => void) => {
82
- setTimeout(callback, 0)
83
- }
79
+ export const nextTick =
80
+ typeof process?.nextTick === 'function'
81
+ ? process.nextTick
82
+ : (callback: () => void) => {
83
+ setTimeout(callback, 0)
84
+ }