Skip to content

Commit

Permalink
cool
Browse files Browse the repository at this point in the history
  • Loading branch information
sonnyp committed Dec 21, 2024
1 parent 1368c1f commit a1561f4
Show file tree
Hide file tree
Showing 133 changed files with 605 additions and 714 deletions.
File renamed without changes.
16 changes: 8 additions & 8 deletions bundle.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
#!/usr/bin/env node

'use strict'
import fs from "fs"
import path from "path"
import browserify from "browserify"
import commonShake from "common-shakeify"
import packFlat from "browser-pack-flat"
import exorcist from "exorcist"
import { minify } from "uglify-js"

const fs = require('fs')
const path = require('path')
const browserify = require('browserify')
const commonShake = require('common-shakeify')
const packFlat = require('browser-pack-flat')
const exorcist = require('exorcist')
const {minify} = require('uglify-js')
const __dirname = import.meta.dirname;

const dist = path.join(__dirname, 'packages/client/dist')

Expand Down
File renamed without changes.
17 changes: 7 additions & 10 deletions eslint.config.mjs → eslint.config.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// eslint-disable-next-line n/no-extraneous-import
import js from "@eslint/js";
import eslintConfigPrettier from "eslint-config-prettier";
import globals from "globals";
Expand Down Expand Up @@ -81,16 +82,12 @@ export default [
"unicorn/prefer-export-from": "off",
},
},
// {
// files: [
// "packages/client/**/*.js",
// "packages/events/**/*.js",
// "packages/base64/**/*.js",
// ],
// languageOptions: {
// sourceType: "module",
// },
// },
{
files: ["**/*.cjs"],
languageOptions: {
sourceType: "commonjs",
},
},
{
files: ["**/*.spec.js", "**/*.test.js", "**/test.js", "**/test/**.js"],
plugins: { jest: pluginJest },
Expand Down
File renamed without changes.
56 changes: 28 additions & 28 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"private": true,
"type": "commonjs",
"type": "module",
"devDependencies": {
"@babel/core": "^7.26.0",
"@babel/plugin-proposal-object-rest-spread": "^7.16.5",
Expand All @@ -26,6 +26,7 @@
"eslint-plugin-promise": "^7.2.1",
"eslint-plugin-unicorn": "^56.0.1",
"exorcist": "^2.0.0",
"globals": "^15.14.0",
"husky": "^9.1.7",
"jest": "^29.7.0",
"jest-extended": "^4.0.2",
Expand All @@ -38,7 +39,7 @@
"uglify-js": "^3.19.3"
},
"scripts": {
"test": "jest",
"test": "npx jest",
"lint": "eslint --cache .",
"preversion": "make bundle"
},
Expand Down
2 changes: 1 addition & 1 deletion packages/component-core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"bugs": "http://github.com/xmppjs/xmpp.js/issues",
"version": "0.13.2",
"license": "ISC",
"type": "commonjs",
"type": "module",
"keywords": [
"XMPP",
"component",
Expand Down
2 changes: 1 addition & 1 deletion packages/connection-tcp/test/Connection.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Connection as _Connection } from "@xmpp/connection";
import _Connection from "@xmpp/connection";
import Connection from "../index.js";

import net from "net";
Expand Down
2 changes: 1 addition & 1 deletion packages/error/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,4 +34,4 @@ class XMPPError extends Error {
}
}

module.exports = XMPPError;
export default XMPPError;
12 changes: 6 additions & 6 deletions packages/iq/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@ Included in `@xmpp/client` and `@xmpp/component`.
Implements the caller side of iq semantics.

```js
const {client} = require('@xmpp/client') // or component
import { client } from "@xmpp/client"; // or component

const xmpp = client(...)
const {iqCaller} = xmpp
const xmpp = client(...);
const {iqCaller} = xmpp;
```

### request
Expand Down Expand Up @@ -71,10 +71,10 @@ Implements the callee side of iq semantics.
You can think of this as http routing except there are only 2 methods; `get` and `set` and you would pass a namespace and a tag name instead of an url. The return value of the handler will be the child element of the response sent to the caller.

```js
const {client} = require('@xmpp/client') // or component
import { client } from "@xmpp/client"; // or component

const xmpp = client(...)
const {iqCallee} = xmpp
const xmpp = client(...);
const {iqCallee} = xmpp;
```

## get
Expand Down
8 changes: 3 additions & 5 deletions packages/iq/callee.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
"use strict";
import xml from "@xmpp/xml";

/**
* References
* https://xmpp.org/rfcs/rfc6120.html#stanzas-semantics-iq
* https://xmpp.org/rfcs/rfc6120.html#stanzas-error
*/

const xml = require("@xmpp/xml");

const NS_STANZA = "urn:ietf:params:xml:ns:xmpp-stanzas";

function isQuery({ name, type }) {
Expand Down Expand Up @@ -101,7 +99,7 @@ function route(type, ns, name, handler) {
};
}

module.exports = function iqCallee({ middleware, entity }) {
export default function iqCallee({ middleware, entity }) {
middleware.use(iqHandler(entity));

return {
Expand All @@ -112,4 +110,4 @@ module.exports = function iqCallee({ middleware, entity }) {
middleware.use(route("set", ns, name, handler));
},
};
};
}
15 changes: 6 additions & 9 deletions packages/iq/caller.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
"use strict";

const xid = require("@xmpp/id");
const StanzaError = require("@xmpp/middleware/lib/StanzaError");
const { Deferred } = require("@xmpp/events");
const timeoutPromise = require("@xmpp/events").timeout;
const xml = require("@xmpp/xml");
import xid from "@xmpp/id";
import StanzaError from "@xmpp/middleware/lib/StanzaError.js";
import { Deferred, timeout as timeoutPromise } from "@xmpp/events";
import xml from "@xmpp/xml";

function isReply({ name, type }) {
if (name !== "iq") return false;
Expand Down Expand Up @@ -79,8 +76,8 @@ class IQCaller {
}
}

module.exports = function iqCaller(...args) {
export default function iqCaller(...args) {
const iqCaller = new IQCaller(...args);
iqCaller.start();
return iqCaller;
};
}
5 changes: 1 addition & 4 deletions packages/iq/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"bugs": "http://github.com/xmppjs/xmpp.js/issues",
"version": "0.13.2",
"license": "ISC",
"type": "commonjs",
"type": "module",
"keywords": [
"XMPP",
"iq",
Expand All @@ -22,9 +22,6 @@
"@xmpp/middleware": "^0.13.2",
"@xmpp/xml": "^0.13.2"
},
"devDependencies": {
"@xmpp/middleware": "^0.13.1"
},
"publishConfig": {
"access": "public"
}
Expand Down
Loading

0 comments on commit a1561f4

Please sign in to comment.