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 ESM-CJS compatibility (#36) #37

Merged
merged 4 commits into from
Jun 30, 2023
Merged

Conversation

zetlen
Copy link
Contributor

@zetlen zetlen commented Jun 27, 2023

Resolves #36.

  • Updates docx version to 8.1.0, which uses package.json exports correctly and supports direct ESM import
  • Updates unist-util-visit to current release
  • Uses the modern package.json exports field to conditionally export for module formats
  • Removes reliance on unstable import assertions (not strictly necessary to resolve import issues #36 but falls in the category of ESM compatibility)

Copy link
Owner

@inokawa inokawa left a comment

Choose a reason for hiding this comment

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

Thank you for your PR @zetlen !

For unknown reason, docx 8.1.0 seems to generate no result in src/index.spec.ts and obsolete its snapshots. Could you fix it?

@zetlen
Copy link
Contributor Author

zetlen commented Jun 29, 2023

Added a fix for an unexpected regression.

It looks like version 8.1.0 of docx has a regression where it'll return a Uint8Array instead of a Buffer if it can't tell it's running in Node. The intended behavior is documented here. I'll open the bug in docx when I can. I don't have the time to make a minimal repro for that, unfortunately.

@zetlen
Copy link
Contributor Author

zetlen commented Jun 29, 2023

Whoops, forgot to actually update the snapshots! Stand by

Copy link
Owner

@inokawa inokawa left a comment

Choose a reason for hiding this comment

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

LGTM
Thanks!

@inokawa inokawa merged commit 8b9de57 into inokawa:main Jun 30, 2023
@zetlen zetlen deleted the fix-esm-unist branch June 30, 2023 17:46
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.

import issues
2 participants