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

chore: bump @gmod dependencies and generic-filehandle #849

Merged
merged 2 commits into from
Apr 17, 2023
Merged

Conversation

manzt
Copy link
Member

@manzt manzt commented Mar 16, 2023

Closes #807

Change List

  • bump @gmod/* packages
  • bump generic-filehandle
  • add optimizeDeps.esbuildOptions.inject to inject Buffer polyfill globally for all dependencies.

Checklist

  • Ensure the PR works with all demos on the online editor
  • Unit tests added or updated
  • Examples added or updated
  • Documentation updated (e.g., added API functions)
  • Screenshots for visual changes (e.g., new encoding support or UI change on Editor)

@manzt
Copy link
Member Author

manzt commented Mar 16, 2023

seem to be issue with bigwig files ..

@manzt
Copy link
Member Author

manzt commented Mar 16, 2023

Ok I updated the vite.config.js to inject the Buffer into the dependencies.. This isn't ideal. Really, upstream we should have @gmod/* have explicit imports for Buffer in the library code:

import { Buffer } from 'buffer';

instead of just relying on a global. This is easier for bundlers to resolve, and something that I implemented a while ago in generic-filehandle.

GMOD/generic-filehandle#102

@manzt manzt requested a review from sehilyi March 16, 2023 01:14
@manzt
Copy link
Member Author

manzt commented Mar 22, 2023

@sehilyi it seems adding those import { Buffer } from "buffer" is welcomed from the @GMOD folks. I won't be able to make this PR for a bit FYI

@sehilyi
Copy link
Member

sehilyi commented Mar 22, 2023

Thanks for letting me know. I might not be able to find time this week but probably possible next week.

@@ -86,7 +86,7 @@ function BigWigDataFetcher(HGC: import('@higlass/types').HGC, dataConfig: BigWig
this.dataPromises.push(this.loadBBI(dataConfig));
}

loadBBI(dataConfig: { url: string }) {
async loadBBI(dataConfig: { url: string }) {
Copy link
Member

Choose a reason for hiding this comment

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

I assume this change was needed by some recent changes in BBI?

Copy link
Member Author

Choose a reason for hiding this comment

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

Not exactly. This function returns either a promise or null, and we push the results to dataPromises. Previously the return type was Promise<void> | null. The async makes it always return a Promise.

        async loadBBI(dataConfig: { url: string }) {
            if (dataConfig.url) {
                this.bwFile = new BigWig({
                    filehandle: new RemoteFile(dataConfig.url)
                });
                return this.bwFile.getHeader().then((h: BigWigHeader) => {
                    this.bwFileHeader = h;
                });
            } else {
                console.error('Please enter a "url" field to the data config');
                return null;
            }
        }

Copy link
Member

Choose a reason for hiding this comment

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

I see – Good to know that.

Copy link
Member

@sehilyi sehilyi left a comment

Choose a reason for hiding this comment

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

Thanks for this change -- tested locally with demo examples and works well

@sehilyi
Copy link
Member

sehilyi commented Apr 17, 2023

@manzt Now there is a conflict in yarn.lock. Should we regenerate the lock file?

@manzt
Copy link
Member Author

manzt commented Apr 17, 2023

yah we can just copy the lock file over from master or relock.

git checkout master -- yarn.lock

@manzt
Copy link
Member Author

manzt commented Apr 17, 2023

ok, I rebased the changes @sehilyi

@sehilyi
Copy link
Member

sehilyi commented Apr 17, 2023

Thanks! I will go ahead and merge this.

@sehilyi sehilyi merged commit 1c62919 into master Apr 17, 2023
@sehilyi sehilyi deleted the manzt/gmod branch April 17, 2023 15:13
sehilyi pushed a commit that referenced this pull request Apr 19, 2023
* chore: bump @GMOD dependencies and generic-filehandle

* fix: broken bbi
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