Thanks to visit codestin.com
Credit goes to github.com

Skip to content

perf(schema-org): remove ohash and defu dependencies#605

Merged
harlan-zw merged 6 commits into
unjs:mainfrom
harlan-zw:claude/remove-dependencies-ohash-defu-011CV2NgcuTaAsednM3hYyxh
Nov 13, 2025
Merged

perf(schema-org): remove ohash and defu dependencies#605
harlan-zw merged 6 commits into
unjs:mainfrom
harlan-zw:claude/remove-dependencies-ohash-defu-011CV2NgcuTaAsednM3hYyxh

Conversation

@harlan-zw

Copy link
Copy Markdown
Collaborator

πŸ”— Linked issue

❓ Type of change

  • πŸ“– Documentation (updates to the documentation or readme)
  • 🐞 Bug fix (a non-breaking change that fixes an issue)
  • πŸ‘Œ Enhancement (improving an existing functionality)
  • ✨ New feature (a non-breaking change that adds functionality)
  • 🧹 Chore (updates to the build process or auxiliary tools and libraries)
  • ⚠️ Breaking change (fix or feature that would cause existing functionality to change)

πŸ“š Description

Replaced ohash with existing custom hashCode implementation

  • Replaced createDefu with custom merge logic in util.ts
  • Replaced defu with custom mergeObjects utility in plugin.ts
  • Removed both dependencies from package.json (~3.5KB size reduction)

- Replaced ohash with existing custom hashCode implementation
- Replaced createDefu with custom merge logic in util.ts
- Replaced defu with custom mergeObjects utility in plugin.ts
- Removed both dependencies from package.json (~3.5KB size reduction)
- Removed variadic arguments from merge (only called with 2 args)
- Removed redundant Array.isArray check in recursive call
- Extracted isNestedObject check for better readability
- Simplified conditional logic and formatting
The merge function was being called with arguments in the wrong order,
causing old values to overwrite new values instead of the reverse.
This caused deduplication and merge logic to fail in tests.

Fixed by swapping the order to merge(old, new) so new values properly
override old values during node deduplication.
Removed unused TypeScript error suppression comments that were
causing build failures. The code is valid TypeScript and doesn't
need these directives.
Fixed TypeScript error TS18046: 'item' is of type 'unknown' by adding
explicit type annotation to the arrow function parameter in uniqueBy call.
@harlan-zw harlan-zw merged commit 0d50831 into unjs:main Nov 13, 2025
1 of 2 checks passed
@harlan-zw harlan-zw mentioned this pull request Apr 4, 2026
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