Skip to content

Commit

Permalink
upgrade dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
sonnyp committed Mar 23, 2020
1 parent 63cbb44 commit 8af3705
Show file tree
Hide file tree
Showing 113 changed files with 1,001 additions and 772 deletions.
2 changes: 2 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,5 @@ node_modules/
**/dist/*.js
bundle.js
package.json
.yarn/
server/prosody-modules/
4 changes: 0 additions & 4 deletions .prettierrc.yaml

This file was deleted.

4 changes: 1 addition & 3 deletions lerna.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,7 @@
"version": "0.11.1",
"npmClient": "yarn",
"useWorkspaces": true,
"packages": [
"packages/*"
],
"packages": ["packages/*"],
"command": {
"publish": {
"ignoreChanges": [
Expand Down
28 changes: 14 additions & 14 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@
"private": true,
"devDependencies": {
"@ava/babel": "^1.0.1",
"@babel/core": "^7.8.4",
"@babel/plugin-proposal-object-rest-spread": "^7.8.3",
"@babel/plugin-transform-react-jsx": "^7.8.3",
"@babel/plugin-transform-runtime": "^7.8.3",
"@babel/preset-env": "^7.8.4",
"@babel/runtime": "^7.8.4",
"ava": "^3.3.0",
"@babel/core": "^7.9.0",
"@babel/plugin-proposal-object-rest-spread": "^7.9.0",
"@babel/plugin-transform-react-jsx": "^7.9.1",
"@babel/plugin-transform-runtime": "^7.9.0",
"@babel/preset-env": "^7.9.0",
"@babel/runtime": "^7.9.2",
"ava": "^3.5.1",
"babel-plugin-jsx-pragmatic": "^1.0.2",
"babel-plugin-transform-async-to-promises": "^0.8.15",
"babelify": "^10.0.0",
Expand All @@ -18,19 +18,19 @@
"bundlesize": "^0.18.0",
"common-shakeify": "^0.6.2",
"eslint": "^6.8.0",
"eslint-config-prettier": "^6.10.0",
"eslint-config-xo": "^0.29.0",
"eslint-config-prettier": "^6.10.1",
"eslint-config-xo": "^0.29.1",
"eslint-plugin-node": "^11.0.0",
"eslint-plugin-prettier": "^3.1.2",
"eslint-plugin-promise": "^4.2.1",
"eslint-plugin-unicorn": "^16.1.1",
"eslint-plugin-unicorn": "^17.2.0",
"exorcist": "^1.0.1",
"jsdom": "^16.1.0",
"jsdom": "^16.2.1",
"lerna": "^3.20.2",
"node-fetch": "^2.6.0",
"prettier": "^1.19.1",
"sinon": "^8.1.1",
"uglify-js": "^3.7.7"
"prettier": "^2.0.1",
"sinon": "^9.0.1",
"uglify-js": "^3.8.0"
},
"scripts": {
"bootstrap": "lerna bootstrap",
Expand Down
2 changes: 1 addition & 1 deletion packages/client-core/lib/Client.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ class Client extends Connection {
}

_findTransport(service) {
return this.transports.find(Transport => {
return this.transports.find((Transport) => {
try {
return Transport.prototype.socketParameters(service) !== undefined
// eslint-disable-next-line no-unused-vars
Expand Down
2 changes: 1 addition & 1 deletion packages/client-core/test/Client.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
const test = require('ava')
const Client = require('../lib/Client')

test('_findTransport', t => {
test('_findTransport', (t) => {
class Transport {
socketParameters(uri) {
if (uri === 'a') {
Expand Down
16 changes: 8 additions & 8 deletions packages/client/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,22 +47,22 @@ const xmpp = client({

debug(xmpp, true)

xmpp.on('error', err => {
xmpp.on('error', (err) => {
console.error(err)
})

xmpp.on('offline', () => {
console.log('offline')
})

xmpp.on('stanza', async stanza => {
xmpp.on('stanza', async (stanza) => {
if (stanza.is('message')) {
await xmpp.send(xml('presence', {type: 'unavailable'}))
await xmpp.stop()
}
})

xmpp.on('online', async address => {
xmpp.on('online', async (address) => {
// Makes itself available
await xmpp.send(xml('presence'))

Expand Down Expand Up @@ -137,7 +137,7 @@ You can listen for status change using the `status` event.
Emitted when the status changes.

```js
xmpp.on('status', status => {
xmpp.on('status', (status) => {
console.debug(status)
})
```
Expand All @@ -149,7 +149,7 @@ Emitted when an error occurs. For connection errors, `xmpp` will reconnect on it
- `<Error>`

```js
xmpp.on('error', error => {
xmpp.on('error', (error) => {
console.error(error)
})
```
Expand All @@ -162,7 +162,7 @@ Emitted when a stanza is received and parsed.

```js
// Simple echo bot example
xmpp.on('stanza', stanza => {
xmpp.on('stanza', (stanza) => {
console.log(stanza.toString())
if (!stanza.is('message')) return

Expand All @@ -179,7 +179,7 @@ Emitted when connected, authenticated and ready to receive/send stanzas.
- [`<Jid>`](/packages/jid)

```js
xmpp.on('online', address => {
xmpp.on('online', (address) => {
console.log('online as', address.toString())
})
```
Expand All @@ -200,7 +200,7 @@ Starts the connection. Attempts to reconnect will automatically happen if it can

```js
xmpp.start().catch(console.error)
xmpp.on('online', address => {
xmpp.on('online', (address) => {
console.log('online', address.toString())
})
```
Expand Down
5 changes: 4 additions & 1 deletion packages/client/browser.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,10 @@ function client(options = {}) {
middleware,
})
const resourceBinding = _resourceBinding({iqCaller, streamFeatures}, resource)
const sessionEstablishment = _sessionEstablishment({iqCaller, streamFeatures})
const sessionEstablishment = _sessionEstablishment({
iqCaller,
streamFeatures,
})
// SASL mechanisms - order matters and define priority
const mechanisms = Object.entries({plain, anonymous}).map(([k, v]) => ({
[k]: v(sasl),
Expand Down
43 changes: 4 additions & 39 deletions packages/client/example.js
Original file line number Diff line number Diff line change
@@ -1,48 +1,13 @@
/* eslint-disable node/no-extraneous-require */

'use strict'

const {client, xml} = require('@xmpp/client')
const {client, xml, jid} = require('@xmpp/client')
const debug = require('@xmpp/debug')

const xmpp = client({
service: 'ws://localhost:5280/xmpp-websocket',
domain: 'localhost',
resource: 'example',
service: 'xmpp://jabberfr.org:5222',
resource: 'myResource',
username: 'username',
password: 'password',
})

debug(xmpp, true)

xmpp.on('error', err => {
console.error(err)
})

xmpp.on('offline', () => {
console.log('offline')
})

xmpp.on('stanza', async stanza => {
if (stanza.is('message')) {
await xmpp.send(xml('presence', {type: 'unavailable'}))
await xmpp.stop()
}
})

xmpp.on('online', async address => {
console.log('online as', address.toString())

// Makes itself available
await xmpp.send(xml('presence'))

// Sends a chat message to itself
const message = xml(
'message',
{type: 'chat', to: address},
xml('body', {}, 'hello world')
)
await xmpp.send(message)
})

xmpp.start().catch(console.error)
xmpp.start()
5 changes: 4 additions & 1 deletion packages/client/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,10 @@ function client(options = {}) {
middleware,
})
const resourceBinding = _resourceBinding({iqCaller, streamFeatures}, resource)
const sessionEstablishment = _sessionEstablishment({iqCaller, streamFeatures})
const sessionEstablishment = _sessionEstablishment({
iqCaller,
streamFeatures,
})
// SASL mechanisms - order matters and define priority
const mechanisms = Object.entries({
scramsha1,
Expand Down
5 changes: 4 additions & 1 deletion packages/client/react-native.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,10 @@ function client(options = {}) {
middleware,
})
const resourceBinding = _resourceBinding({iqCaller, streamFeatures}, resource)
const sessionEstablishment = _sessionEstablishment({iqCaller, streamFeatures})
const sessionEstablishment = _sessionEstablishment({
iqCaller,
streamFeatures,
})
// SASL mechanisms - order matters and define priority
const mechanisms = Object.entries({plain, anonymous}).map(([k, v]) => ({
[k]: v(sasl),
Expand Down
2 changes: 1 addition & 1 deletion packages/client/test/getDomain.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
const test = require('ava')
const getDomain = require('../lib/getDomain')

test('getDomain', t => {
test('getDomain', (t) => {
t.is(getDomain('ws://foo:123/foobar'), 'foo')
t.is(getDomain('ws://123.156.123.5:123/foobar'), '123.156.123.5')
t.is(getDomain('xmpp://foo:123/foobar'), 'foo')
Expand Down
2 changes: 1 addition & 1 deletion packages/component-core/test/send.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
const test = require('ava')
const {Component, xml} = require('..')

test('from attribute', t => {
test('from attribute', (t) => {
const entity = new Component()
entity.jid = 'test.foobar'
entity.write = () => Promise.resolve()
Expand Down
16 changes: 8 additions & 8 deletions packages/component/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,21 +26,21 @@ const xmpp = component({

debug(xmpp, true)

xmpp.on('error', err => {
xmpp.on('error', (err) => {
console.error(err)
})

xmpp.on('offline', () => {
console.log('offline')
})

xmpp.on('stanza', async stanza => {
xmpp.on('stanza', async (stanza) => {
if (stanza.is('message')) {
await xmpp.stop()
}
})

xmpp.on('online', async address => {
xmpp.on('online', async (address) => {
console.log('online as', address.toString())

// Sends a chat message to itself
Expand Down Expand Up @@ -107,7 +107,7 @@ You can listen for status change using the `status` event.
Emitted when the status changes.

```js
xmpp.on('status', status => {
xmpp.on('status', (status) => {
console.debug(status)
})
```
Expand All @@ -119,7 +119,7 @@ Emitted when an error occurs. For connection errors, `xmpp` will reconnect on it
- `<Error>`

```js
xmpp.on('error', error => {
xmpp.on('error', (error) => {
console.error(error)
})
```
Expand All @@ -132,7 +132,7 @@ Emitted when a stanza is received and parsed.

```js
// Simple echo bot example
xmpp.on('stanza', stanza => {
xmpp.on('stanza', (stanza) => {
console.log(stanza.toString())
if (!stanza.is('message')) return

Expand All @@ -149,7 +149,7 @@ Emitted when connected, authenticated and ready to receive/send stanzas.
- [`<Jid>`](/packages/jid)

```js
xmpp.on('online', address => {
xmpp.on('online', (address) => {
console.log('online as', address.toString())
})
```
Expand All @@ -170,7 +170,7 @@ Starts the connection. Attempts to reconnect will automatically happen if it can

```js
xmpp.start().catch(console.error)
xmpp.on('online', address => {
xmpp.on('online', (address) => {
console.log('online', address.toString())
})
```
Expand Down
6 changes: 3 additions & 3 deletions packages/component/example.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,21 +13,21 @@ const xmpp = component({

debug(xmpp, true)

xmpp.on('error', err => {
xmpp.on('error', (err) => {
console.error(err)
})

xmpp.on('offline', () => {
console.log('offline')
})

xmpp.on('stanza', async stanza => {
xmpp.on('stanza', async (stanza) => {
if (stanza.is('message')) {
await xmpp.stop()
}
})

xmpp.on('online', async address => {
xmpp.on('online', async (address) => {
console.log('online as', address.toString())

// Sends a chat message to itself
Expand Down
4 changes: 2 additions & 2 deletions packages/component/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@ function component(options) {
const iqCaller = _iqCaller({entity, middleware})
const iqCallee = _iqCallee({entity, middleware})

entity.on('open', async el => {
entity.on('open', async (el) => {
try {
const {id} = el.attrs
if (typeof password === 'function') {
await password(creds => entity.authenticate(id, creds))
await password((creds) => entity.authenticate(id, creds))
} else {
await entity.authenticate(id, password)
}
Expand Down
Loading

0 comments on commit 8af3705

Please sign in to comment.