project: Move to ESM Modules

This commit is contained in:
Rajeh Taher
2025-07-17 13:54:17 +03:00
parent 19124426b2
commit 787aed88b8
69 changed files with 5143 additions and 4757 deletions
+3 -2
View File
@@ -1,2 +1,3 @@
yarn pbjs -t static-module -w commonjs -o ./WAProto/index.js ./WAProto/WAProto.proto;
yarn pbts -o ./WAProto/index.d.ts ./WAProto/index.js;
yarn pbjs -t static-module -w es6 --no-bundle -o ./WAProto/index.js ./WAProto/WAProto.proto;
yarn pbts -o ./WAProto/index.d.ts ./WAProto/index.js;
node ./fix-imports.js
+23
View File
@@ -0,0 +1,23 @@
import { readFileSync, writeFileSync } from 'fs';
import { argv, exit } from 'process';
const filePath = './index.js';
try {
// Read the file
let content = readFileSync(filePath, 'utf8');
// Fix the import statement
content = content.replace(
/import \* as (\$protobuf) from/g,
'import $1 from'
);
// Write back
writeFileSync(filePath, content, 'utf8');
console.log(`✅ Fixed imports in ${filePath}`);
} catch (error) {
console.error(`❌ Error fixing imports: ${error.message}`);
exit(1);
}
+4136 -4138
View File
File diff suppressed because it is too large Load Diff