@lynovratech/baileys 1.0.10 → 1.0.11

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.
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@lynovratech/baileys",
3
3
  "type": "module",
4
- "version": "1.0.10",
4
+ "version": "1.0.11",
5
5
  "description": "A WebSockets library for interacting with WhatsApp Web - lynovra fork with JID-first and dual ESM/CJS support",
6
6
  "keywords": [
7
7
  "whatsapp",
@@ -58,7 +58,7 @@
58
58
  "test": "node --experimental-vm-modules ./node_modules/.bin/jest --testMatch '**/*.test.ts'",
59
59
  "test:e2e": "node --experimental-vm-modules ./node_modules/.bin/jest --testMatch '**/*.test-e2e.ts'",
60
60
  "update:version": "tsx ./scripts/update-version.ts",
61
- "postinstall": "node scripts/patch-rust-bridge.cjs",
61
+ "postinstall": "node scripts/patch-rust-bridge.cjs || true",
62
62
  "postbuild": "node scripts/fix-rust-bridge-import.cjs"
63
63
  },
64
64
  "dependencies": {
@@ -1,20 +1,24 @@
1
1
  const fs = require('fs');
2
2
  const path = require('path');
3
3
 
4
- const pkgPath = path.resolve(__dirname, '../node_modules/whatsapp-rust-bridge/package.json');
4
+ const possible = [
5
+ path.resolve(__dirname, '../node_modules/whatsapp-rust-bridge/package.json'),
6
+ path.resolve(process.cwd(), 'node_modules/whatsapp-rust-bridge/package.json')
7
+ ];
5
8
 
6
- if(!fs.existsSync(pkgPath)) {
7
- console.log('whatsapp-rust-bridge not found, skipping patch');
9
+ let pkgPath = null;
10
+ for(const p of possible) {
11
+ if(fs.existsSync(p)) { pkgPath = p; break; }
12
+ }
13
+
14
+ if(!pkgPath) {
15
+ console.log('whatsapp-rust-bridge not found, skip');
8
16
  process.exit(0);
9
17
  }
10
18
 
11
19
  const pkg = JSON.parse(fs.readFileSync(pkgPath, 'utf8'));
12
-
13
- if(!pkg.exports['.'].require) {
14
- pkg.exports['.'].require = './dist/index.js';
15
- pkg.main = './dist/index.js';
16
- fs.writeFileSync(pkgPath, JSON.stringify(pkg, null, 2));
17
- console.log('patched whatsapp-rust-bridge for CJS support');
18
- } else {
19
- console.log('whatsapp-rust-bridge already patched');
20
- }
20
+ pkg.exports['.'].require = './dist/index.js';
21
+ pkg.exports['.'].default = './dist/index.js';
22
+ pkg.main = './dist/index.js';
23
+ fs.writeFileSync(pkgPath, JSON.stringify(pkg, null, 2));
24
+ console.log('patched whatsapp-rust-bridge OK');