fix: remove nodeLinker=hoisted, replace transitive imports with existing deps
This commit is contained in:
3 files changed
+16
-10
No files matched your search
@@ -1,5 +1,3 @@
|
||||
import { hashKey } from "@tanstack/query-core";
|
||||
|
||||
export function objectKeys<O extends object>(obj: O): (keyof O)[] {
|
||||
return Object.keys(obj) as (keyof O)[];
|
||||
}
|
||||
@@ -11,5 +9,18 @@ type Entries<T> = {
|
||||
export const objectEntries = <T extends object>(obj: T) => Object.entries(obj) as Entries<T>;
|
||||
|
||||
export const hashObjectBase64 = (obj: object) => {
|
||||
return Buffer.from(hashKey([obj])).toString("base64");
|
||||
const json = JSON.stringify([obj], (_, val) =>
|
||||
typeof val === "object" && val !== null && !Array.isArray(val)
|
||||
? Object.keys(val)
|
||||
.sort()
|
||||
.reduce(
|
||||
(acc, key) => {
|
||||
acc[key] = (val as Record<string, unknown>)[key];
|
||||
return acc;
|
||||
},
|
||||
{} as Record<string, unknown>,
|
||||
)
|
||||
: val,
|
||||
);
|
||||
return Buffer.from(json).toString("base64");
|
||||
};
|
||||
Reference in new issue
Block a user