InboxSDK / InboxSDK

The InboxSDK lets you build apps for Gmail.
Other
733 stars 50 forks source link

chore: stop inlining most libraries in the npm published version #1170

Closed wegry closed 2 months ago

wegry commented 5 months ago

We now depend on the importing project's dependencies. Common dependencies like lodash being shared makes the package much lighter. It also highlights some older libraries we should probably remove.

This is a potentially breaking change for @inboxsdk/core consumers. Among other things:

Closes #981.

Macil commented 5 months ago

I assume this is intended as a stepping stone toward not bundling the InboxSDK at all.

It seems like this would switch us to publishing using ESM instead of CommonJS. Could this break users who were doing import InboxSDK from '@inboxsdk/core'; (instead of import * as InboxSDK from '...';)? Does that work currently? If it did, we would need to decide whether to document that as a breaking change or to add a default export to make that still work.

wegry commented 5 months ago

I assume this is intended as a stepping stone toward not bundling the InboxSDK at all.

@Macil that's my intention. Ultimately, I think, we'd want a named exports for what are currently "namespaces" in the InboxSDK global.

It seems like this would switch us to publishing using ESM instead of CommonJS. Could this break users who were doing import InboxSDK from '@inboxsdk/core'; (instead of import * as InboxSDK from '...';)?

This actually would break in the reverse in 994571d2ec679e1242fa09dae6b4edbd584dbbaa. import InboxSDK from '@inboxsdk/core' (default import) would work. import * from '@inboxsdk/core (wildcard import) would stop working. I'd prefer to ultimately only support the wildcard form of import. That'd be another breaking change if we didn't include it with this though. edit: cb0084c only supports the wildcard form of import.

Does that work currently? If it did, we would need to decide whether to document that as a breaking change or to add a default export to make that still work.

Yeah, this is a breaking change. My understanding is that CJS being consumed by a bundler with support for it will work with either a default or wildcard import. Switching to ESM from UMD also removes the InboxSDK global provided by webpack's entry.library.name.

wegry commented 4 months ago

This PR may sit until Streak moves off of MV2 SDK support.