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

browser support #385

Merged
merged 1 commit into from
Jun 22, 2023
Merged

browser support #385

merged 1 commit into from
Jun 22, 2023

Conversation

samypr100
Copy link

This PR adds browser support as part of #384. As a result, the use of fs was dropped from index.ts and moved over to a dedicated node.ts file.

Other notable changes include:

  • TIFF now needs to always be loaded fully into a buffer for it to work
  • I split index.ts into node.ts and lookup.ts to keep a index lean and importable by both ecosystems
  • Updates the tests to load the TIFF fully into the buffer to test valid tiffs
  • Adjusted package.json so that imports work for both esm and non-esm, including typings on both resolution modes

As part of this I manually tested installing the package on a esm project and a non esm project as well as testing on node and the browser and they both seem to fully work.

I'm targeting 2.0 since it seems like the right branch to introduce small API breaking changes. I'm open to ideas and suggestions, or thoughts going forward.

@netroy
Copy link
Member

netroy commented Jun 18, 2023

Thanks a lot for tackling this, and sorry for the delays. I'll try to review the PR this week.

Copy link
Member

@netroy netroy left a comment

Choose a reason for hiding this comment

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

From a first glance this looks good to me.
I've extracted out unrelated changes into separate commits in the 2.0 branch.
I want to test this a bit more, and maybe add a simple browser based test, and then we can merge this.
Thanks

refactor: split out index into separate files for easier node and browser support
tests: make sure tests pass again
chore: use node: style imports
breaking: removed fs support on types/interface.ts
build: adjusted exports to work with node and node16 resolution modes
style: adjusted prettier quotes to match eslint

Co-authored-by: mcdenhoed <mcdenhoed@users.noreply.github.com>
@sonarcloud
Copy link

sonarcloud bot commented Jun 19, 2023

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 1 Code Smell

No Coverage information No Coverage information
0.0% 0.0% Duplication

@netroy netroy merged commit d9f94e8 into image-size:2.0 Jun 22, 2023
4 checks passed
netroy pushed a commit that referenced this pull request Nov 13, 2023
refactor: split out index into separate files for easier node and browser support
tests: make sure tests pass again
chore: use node: style imports
breaking: removed fs support on types/interface.ts
build: adjusted exports to work with node and node16 resolution modes
style: adjusted prettier quotes to match eslint

Co-authored-by: mcdenhoed <mcdenhoed@users.noreply.github.com>
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.

None yet

2 participants