mqtt 5.2.0 → 5.2.1

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.
Files changed (2) hide show
  1. package/README.md +11 -25
  2. package/package.json +11 -3
package/README.md CHANGED
@@ -801,6 +801,8 @@ The callback is called when the packet has been removed.
801
801
  Closes the Store.
802
802
 
803
803
  <a name="browser"></a>
804
+ <a name="webpack"></a>
805
+ <a name="vite"></a>
804
806
 
805
807
  ## Browser
806
808
 
@@ -812,7 +814,15 @@ You can find all mqtt bundles versions in `dist` folder:
812
814
  - `mqtt.min.js` - iife format, minified
813
815
  - `mqtt.esm.js` - esm format minified
814
816
 
815
- In order to import them use one of the following:
817
+ Starting from MQTT.js > 5.2.0 you can import mqtt in your code like this:
818
+
819
+ ```js
820
+ import mqtt from 'mqtt'
821
+ ```
822
+
823
+ This will be automatically handled by your bundler.
824
+
825
+ Otherwise you can choose to use a specific bundle like:
816
826
 
817
827
  ```js
818
828
  import * as mqtt from 'mqtt/dist/mqtt'
@@ -830,30 +840,6 @@ See <http://unpkg.com> for the full documentation on version ranges.
830
840
 
831
841
  **Be sure to only use this bundle with `ws` or `wss` URLs in the browser. Others URL types will likey fail**
832
842
 
833
- <a name="webpack"></a>
834
-
835
- ### Webpack
836
-
837
- If you are using webpack simply import MQTT.js in one of the following ways:
838
-
839
- ```js
840
- import * as mqtt from 'mqtt/dist/mqtt'
841
- import * as mqtt from 'mqtt/dist/mqtt.min'
842
- import mqtt from 'mqtt/dist/mqtt.esm'
843
- ```
844
-
845
- <a name="vite"></a>
846
-
847
- ### Vite
848
-
849
- If you are using vite simply import MQTT.js like this:
850
-
851
- ```js
852
- import * as mqtt from 'mqtt/dist/mqtt'
853
- import * as mqtt from 'mqtt/dist/mqtt.min'
854
- import mqtt from 'mqtt/dist/mqtt.esm'
855
- ```
856
-
857
843
  <a name="qos"></a>
858
844
 
859
845
  ## About QoS
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.2.0",
4
+ "version": "5.2.1",
5
5
  "contributors": [
6
6
  "Adam Rudd <adamvrr@gmail.com>",
7
7
  "Matteo Collina <matteo.collina@gmail.com> (https://github.com/mcollina)",
@@ -21,6 +21,7 @@
21
21
  "url": "git://github.com/mqttjs/MQTT.js.git"
22
22
  },
23
23
  "main": "./build/mqtt.js",
24
+ "module": "./dist/mqtt.esm.js",
24
25
  "bin": {
25
26
  "mqtt_pub": "./build/bin/pub.js",
26
27
  "mqtt_sub": "./build/bin/sub.js",
@@ -35,7 +36,13 @@
35
36
  "src/"
36
37
  ],
37
38
  "exports": {
38
- ".": "./build/mqtt.js",
39
+ ".": {
40
+ "browser": {
41
+ "import": "./dist/mqtt.esm.js",
42
+ "default": "./dist/mqtt.js"
43
+ },
44
+ "default": "./build/mqtt.js"
45
+ },
39
46
  "./package.json": "./package.json",
40
47
  "./*.map": "./build/*.js.map",
41
48
  "./dist/*": "./dist/*.js",
@@ -95,7 +102,7 @@
95
102
  "node": ">=16.0.0"
96
103
  },
97
104
  "browser": {
98
- "./mqtt.js": "./build/mqtt.js",
105
+ "./mqtt.js": "./dist/mqtt.js",
99
106
  "fs": false,
100
107
  "tls": false,
101
108
  "net": false
@@ -110,6 +117,7 @@
110
117
  "help-me": "^4.2.0",
111
118
  "lru-cache": "^10.0.1",
112
119
  "minimist": "^1.2.8",
120
+ "mqtt": "^5.2.0",
113
121
  "mqtt-packet": "^9.0.0",
114
122
  "number-allocator": "^1.0.14",
115
123
  "readable-stream": "^4.4.2",