chore: remove unused dependencies and bundle react-icons#2796
chore: remove unused dependencies and bundle react-icons#2796nperez0111 wants to merge 3 commits into
Conversation
@blocknote/core: - Remove unused @tiptap/extension-horizontal-rule (custom divider block) - Remove unused @tiptap/extension-paragraph (custom paragraph block) - Remove lib0; replace lib0/random uuidv4 with crypto.randomUUID() - Update YjsThreadStore test mock accordingly @blocknote/react: - Remove unused lodash.merge and @types/lodash.merge - Remove unused @floating-ui/utils (transitive dep only) - Move @types/use-sync-external-store to optionalDependencies - Bundle react-icons into dist output (tree-shaken) instead of externalizing it, so consumers no longer need to install it - Define local IconType to avoid leaking react-icons in .d.ts output
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: ⛔ Files ignored due to path filters (1)
📒 Files selected for processing (4)
💤 Files with no reviewable changes (1)
🚧 Files skipped from review as they are similar to previous changes (3)
📝 WalkthroughWalkthroughThis PR replaces lib0's uuidv4 with crypto.randomUUID() across core code and tests, introduces a local IconType and re-exports it, updates components to use the new type, changes Vite bundling to include react-icons, and adjusts multiple package.json dependency entries. ChangesWeb Crypto UUID Migration
React Icon Type & Bundling
Manifest and Dependency Tidying
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related PRs
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@packages/core/src/comments/threadstore/yjs/YjsThreadStore.test.ts`:
- Around line 7-12: The test file sets a module-level spy via vi.spyOn(crypto,
"randomUUID") but never restores it, leaving the mocked implementation active;
change the spy creation to capture the spy object (e.g., const randomUUIDSpy =
vi.spyOn(crypto, "randomUUID").mockImplementation(...)) and restore it in a test
teardown (call randomUUIDSpy.mockRestore() inside an afterAll or afterEach hook
and import the hook from the test framework), while keeping the existing
mockUuidCounter and originalRandomUUID references intact so the mock still
returns sequential IDs.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: e53fb7ec-82f8-4e91-9233-5b67a05d021a
⛔ Files ignored due to path filters (1)
pnpm-lock.yamlis excluded by!**/pnpm-lock.yaml
📒 Files selected for processing (13)
packages/core/package.jsonpackages/core/src/comments/threadstore/yjs/YjsThreadStore.test.tspackages/core/src/comments/threadstore/yjs/YjsThreadStore.tspackages/core/src/extensions/Placeholder/Placeholder.tspackages/core/src/extensions/tiptap-extensions/UniqueID/UniqueID.tspackages/react/package.jsonpackages/react/src/components/FormattingToolbar/DefaultButtons/BasicTextStyleButton.tsxpackages/react/src/components/FormattingToolbar/DefaultButtons/TextAlignButton.tsxpackages/react/src/components/FormattingToolbar/DefaultSelects/BlockTypeSelect.tsxpackages/react/src/components/SuggestionMenu/getDefaultReactSlashMenuItems.tsxpackages/react/src/icons.tspackages/react/src/index.tspackages/react/vite.config.ts
💤 Files with no reviewable changes (1)
- packages/core/package.json
- code-block: move @blocknote/core and @shikijs/types to devDeps (type-only imports) - mantine: bundle react-icons into build output - shadcn: remove unused autoprefixer - xl-ai: remove unused @blocknote/mantine, @tiptap/core, react-dom; bundle react-icons - server-util: remove unused @tiptap/core; move yjs/y-prosemirror/y-protocols to devDeps - xl-email-exporter: remove unused @blocknote/react, buffer, react, react-dom; move react-email to devDeps - xl-multi-column: remove unused prosemirror-tables, prosemirror-transform; bundle react-icons - xl-odt-exporter: remove unused buffer - xl-pdf-exporter: remove unused @blocknote/react, buffer, docx - Fix IconType to use function signature matching react-icons' original type
@blocknote/ariakit
@blocknote/code-block
@blocknote/core
@blocknote/mantine
@blocknote/react
@blocknote/server-util
@blocknote/shadcn
@blocknote/xl-ai
@blocknote/xl-docx-exporter
@blocknote/xl-email-exporter
@blocknote/xl-multi-column
@blocknote/xl-odt-exporter
@blocknote/xl-pdf-exporter
commit: |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@packages/server-util/package.json`:
- Around line 66-68: The package manifest currently lists "yjs" only in
devDependencies while ServerBlockNoteEditor.ts imports types from "yjs" and
exposes Y.Doc/Y.XmlFragment in public APIs (see yXmlFragmentToBlocks,
blocksToYXmlFragment, yDocToBlocks, blocksToYDoc); move "yjs" from
devDependencies into dependencies in package.json so consuming projects can
resolve those public TypeScript types at runtime/compile time.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 387b2a76-533f-4a8d-9b91-e3063044892d
⛔ Files ignored due to path filters (1)
pnpm-lock.yamlis excluded by!**/pnpm-lock.yaml
📒 Files selected for processing (13)
packages/code-block/package.jsonpackages/mantine/package.jsonpackages/mantine/vite.config.tspackages/react/src/icons.tspackages/server-util/package.jsonpackages/shadcn/package.jsonpackages/xl-ai/package.jsonpackages/xl-ai/vite.config.tspackages/xl-email-exporter/package.jsonpackages/xl-multi-column/package.jsonpackages/xl-multi-column/vite.config.tspackages/xl-odt-exporter/package.jsonpackages/xl-pdf-exporter/package.json
💤 Files with no reviewable changes (2)
- packages/xl-odt-exporter/package.json
- packages/shadcn/package.json
✅ Files skipped from review due to trivial changes (1)
- packages/xl-pdf-exporter/package.json
🚧 Files skipped from review as they are similar to previous changes (1)
- packages/react/src/icons.ts
| "@blocknote/core": "0.51.3", | ||
| "@shikijs/types": "^4", |
There was a problem hiding this comment.
This should be a optional meta dep no?
| "@shikijs/themes": "^4" | ||
| }, | ||
| "devDependencies": { | ||
| "@blocknote/core": "0.51.3", |
There was a problem hiding this comment.
This is a peer dep no?
| @@ -1,4 +1,4 @@ | |||
| import { uuidv4 } from "lib0/random"; | |||
|
|
|||
There was a problem hiding this comment.
run the lint this line should not be here
nperez0111
left a comment
There was a problem hiding this comment.
see other comments
- Remove leading blank line in YjsThreadStore.ts (nperez0111) - Restore crypto.randomUUID spy in afterAll in test (coderabbitai) - Move @blocknote/core out of devDeps in code-block (already peerDep) - Move @shikijs/types to optionalDependencies in code-block (nperez0111) - Move yjs back to dependencies in server-util (public API types)
29061a5 to
1def215
Compare
Summary
Remove unused/unnecessary dependencies across 11 packages in the monorepo, and bundle
react-iconsinto build output for packages that use it so consumers no longer need to install it separately.Changes
@blocknote/core@tiptap/extension-horizontal-rule(unused — divider block is custom implementation)@tiptap/extension-paragraph(unused — paragraph block is custom implementation)lib0— replaceduuidv4()with nativecrypto.randomUUID()in 3 files@blocknote/reactlodash.merge+@types/lodash.merge(zero source imports — dead weight)@floating-ui/utils(never directly imported, only transitive)@types/use-sync-external-storetooptionalDependenciesreact-iconsinto build output (moved to devDeps, excluded from Vite externals)IconTypetype to avoid exposingreact-iconsin.d.tsoutput@blocknote/code-block@blocknote/coreto devDeps (type-only import, already a peerDep)@shikijs/typesto devDeps (type-only import)@blocknote/mantinereact-iconsinto build output (moved to devDeps, excluded from Vite externals)@blocknote/shadcnautoprefixer(unused)@blocknote/xl-ai@blocknote/mantine,@tiptap/core,react-dom,reactfrom depsreact-iconsinto build output@blocknote/server-util@tiptap/core(unused)y-prosemirror,y-protocols,yjsto devDeps (type-only or unused in src)@blocknote/xl-email-exporter@blocknote/react,bufferfrom deps (unused)react,react-domto devDeps (already peerDeps)react-emailto devDeps (CLI tool, not runtime)@blocknote/xl-multi-columnprosemirror-tables,prosemirror-transform(unused)react-iconsinto build output@blocknote/xl-odt-exporterbuffer(unused)@blocknote/xl-pdf-exporter@blocknote/react,buffer,docx(all unused)Impact
Reduces the number of transitive dependencies consumers need to install. The
react-iconsbundling means consumers of@blocknote/react,@blocknote/mantine,@blocknote/xl-ai, and@blocknote/xl-multi-columnno longer needreact-iconsin their ownnode_modules.Testing
pnpm run build— 18 projects, 0 errors)@blocknote/coretests pass (27 files, 445 tests)Summary by CodeRabbit
Chores
Refactor
Tests