Skip to content

Commit 7f5ff0d

Browse files
committed
Drops object-hash in favour for the platform
1 parent c76b4fd commit 7f5ff0d

5 files changed

Lines changed: 11 additions & 10 deletions

File tree

bun.lock

Lines changed: 0 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/gitbook/package.json

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,6 @@
6060
"next": "^16.2.6",
6161
"next-themes": "^0.4.6",
6262
"nuqs": "^2.2.3",
63-
"object-hash": "^3.0.0",
6463
"object-identity": "^0.1.2",
6564
"openapi-types": "^12.1.3",
6665
"p-map": "^7.0.3",
@@ -102,7 +101,6 @@
102101
"@types/jsonwebtoken": "^9.0.6",
103102
"@types/mdast": "^4.0.4",
104103
"@types/node": "^20",
105-
"@types/object-hash": "^3.0.6",
106104
"@types/parse-cache-control": "^1.0.4",
107105
"@types/react": "19.2.14",
108106
"@types/react-dom": "19.2.3",

packages/gitbook/src/lib/utils.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
1+
import { createHash } from 'node:crypto';
12
import * as api from '@gitbook/api';
23
import { CustomizationPageActionType } from '@gitbook/api';
4+
import { identify } from 'object-identity';
35

46
/**
57
* Return the default customization settings for a site.
@@ -126,3 +128,10 @@ export function findSectionInGroup<T extends { id: string; object: string; child
126128
flattenSectionsFromGroup(group.children).find((section) => section.id === sectionId) ?? null
127129
);
128130
}
131+
132+
/**
133+
* Creates a stable hash of any value.
134+
*/
135+
export function hash(value: any): string {
136+
return createHash('sha256').update(identify(value)).digest('base64url');
137+
}

packages/gitbook/src/lib/visitors.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { type JwtPayload, jwtDecode } from 'jwt-decode';
22
import { type NextRequest, NextResponse } from 'next/server';
3-
import hash from 'object-hash';
3+
import { hash } from './utils';
44

55
const VISITOR_AUTH_PARAM = 'jwt_token';
66
const VISITOR_PARAM_PREFIX = 'visitor.';

packages/react-math/package.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,7 @@
1212
"sideEffects": false,
1313
"dependencies": {
1414
"katex": "^0.16.25",
15-
"mathjax": "^3.2.2",
16-
"object-hash": "^3.0.0"
15+
"mathjax": "^3.2.2"
1716
},
1817
"peerDependencies": {
1918
"react": "*"

0 commit comments

Comments
 (0)