Skip to content

Commit

Permalink
ESM Upgrades (#29)
Browse files Browse the repository at this point in the history
  • Loading branch information
zoe-codez authored Nov 16, 2024
1 parent 1f6a3ed commit f9a9182
Show file tree
Hide file tree
Showing 16 changed files with 1,771 additions and 1,309 deletions.
12 changes: 8 additions & 4 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,9 @@ export default [
"plugin:prettier/recommended",
"plugin:@cspell/recommended",
)
.map(config => ({ ...config, files: ["src/**/*.ts"] })),
.map(config => ({ ...config, files: ["src/**/*.mts"] })),
{
files: ["src/**/*.ts"],
files: ["src/**/*.mts"],
languageOptions: {
parser: tsParser,
ecmaVersion: 5,
Expand All @@ -64,8 +64,12 @@ export default [
"@typescript-eslint/no-magic-numbers": "warn",
"unicorn/no-object-as-default-parameter": "off",
"unicorn/no-null": "off",
"sonarjs/no-empty-function": "off",
"sonarjs/no-unused-expressions": "off",
"unicorn/no-empty-file": "off",
"sonarjs/prefer-single-boolean-return": "off",
"@typescript-eslint/no-unused-expressions": "off",
"unicorn/expiring-todo-comments": "off",
"unicorn/no-array-callback-reference": "off",
"sonarjs/prefer-nullish-coalescing": "off",
"sonarjs/hashing": "off",
Expand Down Expand Up @@ -130,7 +134,7 @@ export default [
},
// module definitions
{
files: ["src/**/*.module.ts"],
files: ["src/**/*.module.mts"],
languageOptions: {
parser: tsParser,
ecmaVersion: 5,
Expand All @@ -144,7 +148,7 @@ export default [
},
},
{
files: ["src/**/*.spec.ts"],
files: ["src/**/*.spec.mts"],
languageOptions: {
globals: { ...globals.jest },
parser: tsParser,
Expand Down
48 changes: 24 additions & 24 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"name": "@digital-alchemy/mqtt-extension",
"repository": "https://github.com/Digital-Alchemy-TS/mqtt",
"homepage": "https://docs.digital-alchemy.app/MQTT",
"version": "24.9.1",
"version": "24.11.1",
"scripts": {
"build": "rm -rf dist/; tsc",
"test": "./scripts/test.sh",
Expand All @@ -22,50 +22,50 @@
"node": ">=20"
},
"exports": {
".": "./dist/index.js"
".": "./dist/index.mjs"
},
"license": "MIT",
"dependencies": {
"mqtt": "^5.10.1",
"mqtt-packet": "^9.0.0"
"mqtt": "^5.10.2",
"mqtt-packet": "^9.0.1"
},
"peerDependencies": {
"@digital-alchemy/core": "*"
},
"devDependencies": {
"@cspell/eslint-plugin": "^8.14.4",
"@digital-alchemy/core": "^24.9.3",
"@eslint/compat": "^1.1.1",
"@eslint/eslintrc": "^3.1.0",
"@eslint/js": "^9.11.1",
"@types/jest": "^29.5.13",
"@types/node": "^22.7.0",
"@cspell/eslint-plugin": "^8.16.0",
"@digital-alchemy/core": "^24.11.3",
"@eslint/compat": "^1.2.3",
"@eslint/eslintrc": "^3.2.0",
"@eslint/js": "^9.15.0",
"@types/jest": "^29.5.14",
"@types/node": "^22.9.0",
"@types/node-cron": "^3.0.11",
"@types/ws": "^8.5.12",
"@typescript-eslint/eslint-plugin": "8.7.0",
"@typescript-eslint/parser": "8.7.0",
"@types/ws": "^8.5.13",
"@typescript-eslint/eslint-plugin": "8.14.0",
"@typescript-eslint/parser": "8.14.0",
"dayjs": "^1.11.13",
"dotenv": "^16.4.5",
"eslint": "9.11.1",
"eslint": "9.15.0",
"eslint-config-prettier": "9.1.0",
"eslint-plugin-import": "^2.30.0",
"eslint-plugin-jsonc": "^2.16.0",
"eslint-plugin-no-unsanitized": "^4.1.1",
"eslint-plugin-import": "^2.31.0",
"eslint-plugin-jsonc": "^2.18.1",
"eslint-plugin-no-unsanitized": "^4.1.2",
"eslint-plugin-prettier": "^5.2.1",
"eslint-plugin-security": "^3.0.1",
"eslint-plugin-simple-import-sort": "^12.1.1",
"eslint-plugin-sonarjs": "^2.0.2",
"eslint-plugin-sonarjs": "^2.0.4",
"eslint-plugin-sort-keys-fix": "^1.1.2",
"eslint-plugin-unicorn": "^55.0.0",
"globals": "^15.9.0",
"eslint-plugin-unicorn": "^56.0.0",
"globals": "^15.12.0",
"jest": "^29.7.0",
"jest-environment-node": "^29.7.0",
"node-cron": "^3.0.3",
"prettier": "^3.3.3",
"ts-jest": "^29.2.5",
"tsx": "^4.19.1",
"type-fest": "^4.26.1",
"typescript": "^5.6.2",
"tsx": "^4.19.2",
"type-fest": "^4.27.0",
"typescript": "^5.7.0-beta",
"ws": "^8.18.0"
},
"packageManager": "[email protected]"
Expand Down
3 changes: 0 additions & 3 deletions src/extensions/index.ts

This file was deleted.

File renamed without changes.
2 changes: 2 additions & 0 deletions src/helpers/index.mts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
export * from "./events.mts";
export * from "./types.mts";
2 changes: 0 additions & 2 deletions src/helpers/index.ts

This file was deleted.

File renamed without changes.
3 changes: 3 additions & 0 deletions src/index.mts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export * from "./helpers/index.mts";
export * from "./mqtt.module.mts";
export * from "./services/index.mts";
3 changes: 0 additions & 3 deletions src/index.ts

This file was deleted.

2 changes: 1 addition & 1 deletion src/mqtt.module.ts → src/mqtt.module.mts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { CreateLibrary } from "@digital-alchemy/core";
import { IClientOptions } from "mqtt";

import { MQTT_Bindings, Publish, Subscribe } from "./extensions";
import { MQTT_Bindings, Publish, Subscribe } from "./services/index.mts";

export const LIB_MQTT = CreateLibrary({
configuration: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@ import {
} from "mqtt";
import { QoS } from "mqtt-packet";

import { MQTT_RECONNECT } from "../helpers/events.mts";
import {
MQTT_RECONNECT,
MqttCallback,
MQTTParseFormat,
MQTTSubscribeOptions,
SubscriptionOptions,
} from "..";
} from "../helpers/types.mts";

// Function to translate readable options to MQTT options
function translateOptions(options: SubscriptionOptions): IClientSubscribeOptions {
Expand Down
3 changes: 3 additions & 0 deletions src/services/index.mts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export * from "./bindings.service.mts";
export * from "./publish.service.mts";
export * from "./subscribe.service.mts";
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { TServiceParams } from "@digital-alchemy/core";

import { MQTTSubscribeOptions } from "..";
import { MQTTSubscribeOptions } from "../index.mts";

export function Subscribe({ mqtt }: TServiceParams) {
return function <DATA = unknown>(options: MQTTSubscribeOptions<DATA>): void {
Expand Down
3 changes: 2 additions & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
"skipLibCheck": true,
"noUncheckedIndexedAccess": true,
"sourceMap": true,
"rewriteRelativeImportExtensions": true,
"outDir": "./dist",
"strict": false,
"strictBindCallApply": true,
Expand All @@ -27,7 +28,7 @@
"allowSyntheticDefaultImports": true
},
"include": [
"src/**/*.ts"
"src/**/*.mts"
],
"exclude": [
"node_modules",
Expand Down
Loading

0 comments on commit f9a9182

Please sign in to comment.