Uh oh!
There was an error while loading. Please reload this page.
- Add ESM Module version cross build CJS - #19
Conversation
Smeagolworms4
commented
Jan 20, 2025
- Add ESM Module version cross build commonjs.
- Update to fetch 3 (compatibility commonjs)
Smeagolworms4
commented
Jan 20, 2025
All test work. |
adohertyTS
commented
Apr 4, 2025
@Smeagolworms4 can you explain to me a little more what is the purpose of this pull request? What is the problem you are trying to solve? |
The current version of telesign doesn't work with an esmodule environment. Ans, version 3 of fetch is necessarily esmodule. The pull request I'm sending you allows you to generate a commonjs + esmodule version. And all the tests are up to date. There's even an action that runs them. |
Smeagolworms4
commented
Apr 16, 2025
also it adds typescript typing (even if it is a basic version) |
77bdcf1 to
4727149CompareSmeagolworms4
commented
Apr 16, 2025
In package.json: Add ESM and CJS version of module (it's retrocompatible) : "main": "dist/cjs/TeleSign.js","module": "dist/esm/TeleSign.js",// ESM"types": "dist/types/TeleSign.d.ts",// Typing Typescript"exports": {".": {"require": "./dist/cjs/TeleSign.js",// CJS"import": "./dist/esm/TeleSign.js"// ESM}},Depencency fetch 2 and 3 : "peerDependencies": {"node-fetch": "^2.6.0 || ^3.0.0"}This code use fetch on global or window if already loaded. asyncfunctionfetchWithTimeout(url,options){/** @type {any} */letfetch=(typeofwindow!=='undefined' ? window : global).fetch||null;if(!fetch){fetch=awaitimport('node-fetch').then(m=>m.default??m);}returnawaitPromise.race([fetch(url,options),newPromise((_,reject)=>setTimeout(()=>reject({code: 408,message: 'Timeout'}),options.timeout))]);} |
adohertyTS
commented
Apr 21, 2025
@Smeagolworms4 thanks for the clarification. I'll pass this along to the relevant product team to review. |
Smeagolworms4
commented
May 9, 2025
Fix last rebase main version |
Smeagolworms4
commented
Jun 18, 2025
Any news? As long as it's not merged, it's going to accumulate conflicts. The current version doesn't support esm and fetch 3. And this version has basic ts typing. |