diff --git a/.gitignore b/.gitignore index 5ae2bc8..30da7c6 100644 --- a/.gitignore +++ b/.gitignore @@ -5,3 +5,4 @@ package-lock.json */.DS_Store .DS_Store .env +lib \ No newline at end of file diff --git a/WAClient/Utils.ts b/WAClient/Utils.ts index fedccfd..c18c3a3 100644 --- a/WAClient/Utils.ts +++ b/WAClient/Utils.ts @@ -1,5 +1,5 @@ import { MessageType, HKDFInfoKeys, MessageOptions, MessageStubTypes } from './Constants' -import * as sharp from 'sharp' +import sharp from 'sharp' import * as fs from 'fs' import fetch from 'node-fetch' import { WAMessage, WAMessageContent } from '../WAConnection/Constants' diff --git a/WAConnection/Base.ts b/WAConnection/Base.ts index 46b6d8a..9b9b2d8 100644 --- a/WAConnection/Base.ts +++ b/WAConnection/Base.ts @@ -1,6 +1,6 @@ import * as QR from 'qrcode-terminal' import * as fs from 'fs' -import * as WS from 'ws' +import WS from 'ws' import * as Utils from './Utils' import Encoder from '../Binary/Encoder' import Decoder from '../Binary/Decoder' diff --git a/WAConnection/Connect.ts b/WAConnection/Connect.ts index 899c1b7..c1155ad 100644 --- a/WAConnection/Connect.ts +++ b/WAConnection/Connect.ts @@ -1,4 +1,4 @@ -import * as WS from 'ws' +import WS from 'ws' import * as Utils from './Utils' import { AuthenticationCredentialsBase64, UserMetaData, WAMessage, WAChat, WAContact, MessageLogLevel } from './Constants' import WAConnectionValidator from './Validation' diff --git a/WAConnection/Utils.ts b/WAConnection/Utils.ts index 6ece841..6f93ba6 100644 --- a/WAConnection/Utils.ts +++ b/WAConnection/Utils.ts @@ -1,5 +1,5 @@ import * as Crypto from 'crypto' -import * as HKDF from 'futoin-hkdf' +import HKDF from 'futoin-hkdf' /** decrypt AES 256 CBC; where the IV is prefixed to the buffer */ diff --git a/package.json b/package.json index 5bbd400..5acb832 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "name": "@adiwajshing/baileys", "version": "2.0.0", "description": "WhatsApp Web API", - "main": "WAClient/WAClient.ts", + "main": "lib/WAClient/WAClient.js", "homepage": "https://github.com/adiwajshing/Baileys", "type": "module", "keywords": [ diff --git a/tsconfig.json b/tsconfig.json index fb9b1e6..f89701f 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,16 +1,17 @@ { "compilerOptions": { "target": "es5", - "module": "es2015", + "module": "commonjs", + "moduleResolution": "node", "allowJs": true, "checkJs": false, - "outDir": "build/", + "outDir": "lib/", "strict": false, "noImplicitThis": true, "esModuleInterop": true, "forceConsistentCasingInFileNames": true, "resolveJsonModule": true }, - "include": ["*.ts"], + "include": ["*/*.ts"], "exclude": ["node_modules", "*/Tests.ts"] }