refactor(update SDK exports to use named imports, deprecate default export) ♻️ #11
Conversation
…xport): ♻️
### This change aligns the SDK with modern JavaScript/TypeScript best practices, as default exports can cause confusion, especially when multiple exports exist in the same module.
### Benefits: - Improves clarity and consistency when importing the SDK.
- Reduces the chance of errors when integrating the SDK into other projects, as developers can now use `import { AbacatePay } from 'abacatepay'`.
- Addresses an issue where users had difficulty with the default export, enhancing the integration experience.
- Makes the API more modular and aligned with modern import/export patterns.
### Note: The default export is still present but is marked as `@deprecated` and can be removed in future versions.
Closes AbacatePay#5
|
How does it handles different environments like browser, typescript, EJS and CJS? |
Thanks for the question! This PR aims to improve compatibility across environments by favoring named exports, which are better supported in both ESM and CJS when consumed through bundlers or TypeScript-aware tools.
This update doesn’t break compatibility — it just adds more flexibility and improves developer experience in ESM and TypeScript setups. If the maintainers approve, we can mark the default export as deprecated in docs and fully transition in the next major release. |
|
Love the in depth details, will merge it very soon |
|
Oh, could you run the |
60514af to
bb263d4
Compare
Sure, done! |
This change aligns the SDK with modern JavaScript/TypeScript best practices, as default exports can cause confusion, especially when multiple exports exist in the same module.
Benefits:
import { AbacatePay } from 'abacatepay'.Note: The default export is still present but is marked as
@deprecatedand can be removed in future versions.Closes #5