Skip to content

Conversation

@Friss
Copy link
Contributor

@Friss Friss commented Jan 21, 2026

  • Replace package.json require with SDK_VERSION build-time constant
  • Add separate prefetch entry point for smaller bundle imports
  • Enable code splitting in tsup for tree-shaking
  • Add ./prefetch subpath export in package.json
  • Export as es2020
  • Remove uuid dep
  • Full bundle: ~14.8KB, Prefetch-only: ~3.2KB (78% smaller)

Friss added 3 commits January 21, 2026 14:57
- Replace package.json require with __SDK_VERSION__ build-time constant
- Add separate prefetch entry point for smaller bundle imports
- Enable code splitting in tsup for tree-shaking
- Add ./prefetch subpath export in package.json
- Full bundle: ~14.8KB, Prefetch-only: ~3.2KB (78% smaller)
return crypto.randomUUID();
}

return Math.random().toString(36).substring(2, 15) + Math.random().toString(36).substring(2, 15);
Copy link
Contributor

Choose a reason for hiding this comment

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

i think this isn't a uuid.

maybe

function uuid() {
  if (typeof crypto !== "undefined" && crypto.randomUUID) {
    return crypto.randomUUID();
  }

  // Fallback: not cryptographically secure, but at least a valid UUIDv4 format
  return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, (c) => {
    const r = (Math.random() * 16) | 0;
    const v = c === "x" ? r : (r & 0x3) | 0x8;
    return v.toString(16);
  });
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants