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

feat: replace slugid with Buffer-less polyfill #1112

Merged
merged 2 commits into from
Aug 30, 2022
Merged

Conversation

manzt
Copy link
Member

@manzt manzt commented Aug 29, 2022

Description

What was changed in this pull request?

Aliases slugid import with a local ./app/bufferless-slugid.js which does not rely on Buffer global.

Why is it necessary?

Reliance on Buffer complicates the Vite build and adds additional bloat to higlass which isn't necessary.

Fixes #___

Checklist

  • Set proper GitHub labels (e.g. v1.6+, ignore if you don't know)
  • Unit tests added or updated
  • Documentation added or updated
  • Example(s) added or updated
  • Update schema.json if there are changes to the viewconf JSON structure format
  • Screenshot for visual changes (e.g. new tracks or UI changes)
  • Updated CHANGELOG.md

@manzt manzt requested a review from pkerpedjiev August 29, 2022 16:17
@manzt manzt force-pushed the manzt/slugid branch 2 times, most recently from 4be3b86 to 89f35e7 Compare August 29, 2022 16:26
@@ -101,14 +101,6 @@ export default defineConfig({
return assetInfo.name;
}
},
plugins: [
Copy link
Member

Choose a reason for hiding this comment

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

Less config makes me happy!


/**
*
* Returns a randomly generated uuid v4 compliant slug which conforms to a set
Copy link
Member

Choose a reason for hiding this comment

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

Did you code this yourself?

Any intention to send this to the slugid folks to see if they'll include it in their repo and get rid of the Buffer requirement?

Copy link
Member Author

Choose a reason for hiding this comment

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

I did code this myself, yes. I just adapted some of their code, mostly.

I'd probably be able to make a PR, but right now the uuid library I chose @lukeed/uuid is fast but not cryptographically secure. A PR would probably entail refactoring internals with uuid as suggested taskcluster/slugid#12.

Copy link
Member

@pkerpedjiev pkerpedjiev left a comment

Choose a reason for hiding this comment

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

A+

@manzt manzt merged commit c2dc872 into manzt/vite Aug 30, 2022
@manzt manzt deleted the manzt/slugid branch August 30, 2022 12:56
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.

2 participants