Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix splitbrain between .js being ESM & CJS inconsistently #189

Merged
merged 7 commits into from
Jan 13, 2025

Conversation

t3chguy
Copy link
Member

@t3chguy t3chguy commented Jan 8, 2025

Fixes #188

no actual changes to the js/cjs/mjs files barring some ts annotations

Switches the package type to ESM as that is what wasm-pack is outputting
Convinces the wasm bindgen test to use an ESM runner
Uses explicit extensions on the CJS entrypoints

@richvdh
Copy link
Member

richvdh commented Jan 8, 2025

would it be better to stop using .js altogether, and just call everything .mjs / .cjs, to avoid this sort of confusion?

@t3chguy
Copy link
Member Author

t3chguy commented Jan 8, 2025

That would also be possible but I somehow hate the idea of having to rename the output files of wasm-pack s/js/mjs - "type": "module" is also a good thing going forward. I can imagine also imagine issues going forward if the tests/entrypoints were ts-ified and needing mts/cts and the issues typescript has around those

Edit: ended up being explicit on the checked in files, still added "type": "module" for wasm-pack generated files and for ts downstream to be happier

@t3chguy t3chguy force-pushed the t3chguy/fix-cjs-esm branch from 42eae8c to 5d2f778 Compare January 8, 2025 12:52
@t3chguy t3chguy marked this pull request as ready for review January 8, 2025 13:13
@t3chguy t3chguy requested a review from a team as a code owner January 8, 2025 13:13
@t3chguy t3chguy requested a review from andybalaam January 8, 2025 13:13
@andybalaam andybalaam requested review from richvdh and removed request for andybalaam January 8, 2025 14:20
@andybalaam
Copy link
Member

@richvdh I assigned this to you since you seem to understand it more than me. Feel free to assign another one to me :-)

Copy link
Member

@richvdh richvdh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no actual changes to the js/cjs/mjs files

This doesn't seem quite right? Could you give the description of the PR an update, please, to give an overview of the approach? (Looks like we're now standardising on .js meaning ESM, and .cjs meaning CommonJS?)

Also, please can you add an entry to the changelog?

node.cjs Show resolved Hide resolved
@t3chguy
Copy link
Member Author

t3chguy commented Jan 9, 2025

This doesn't seem quite right? Could you give the description of the PR an update, please, to give an overview of the approach? (Looks like we're now standardising on .js meaning ESM, and .cjs meaning CommonJS?)

Have updated the description

Also, please can you add an entry to the changelog?

Could you please point me to any guidance on doing so? Not seeing anything in the contributing doc

@t3chguy t3chguy requested a review from richvdh January 9, 2025 13:01
@richvdh
Copy link
Member

richvdh commented Jan 9, 2025

Also, please can you add an entry to the changelog?
Could you please point me to any guidance on doing so? Not seeing anything in the contributing doc

https://github.com/matrix-org/matrix-rust-sdk/blob/main/CONTRIBUTING.md#writing-changelog-entries is the most relevant guide.

TL;DR though: if you could just add an entry under the "UNRELEASED" heading, following the same style as previous entries, that would be be great.

CHANGELOG.md Outdated Show resolved Hide resolved
@t3chguy t3chguy requested a review from richvdh January 13, 2025 12:31
Copy link
Member

@richvdh richvdh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Thank you.

@richvdh richvdh merged commit e4153ec into matrix-org:main Jan 13, 2025
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

SyntaxError: Unexpected token 'export' when importing as ESM
3 participants