Upgrade to bun 1.3 (#3731)

This commit is contained in:
Greg Bergé
2025-10-16 10:22:52 +02:00
committed by GitHub
parent a48b886dfd
commit 8eae6e970b
32 changed files with 357 additions and 659 deletions
+274 -626
View File
File diff suppressed because it is too large Load Diff
+9 -2
View File
@@ -7,9 +7,11 @@
"turbo": "^2.5.8",
"vercel": "^39.4.2"
},
"packageManager": "bun@1.2.15",
"packageManager": "bun@1.3.0",
"overrides": {
"@codemirror/state": "6.4.1",
"@types/react": "catalog:",
"@types/react-dom": "catalog:",
"react": "catalog:",
"react-dom": "catalog:",
"esbuild": "0.24.2"
@@ -35,7 +37,12 @@
"workspaces": {
"packages": ["packages/*"],
"catalog": {
"@tsconfig/strictest": "^2.0.6",
"@tsconfig/node20": "^20.1.6",
"@gitbook/api": "0.143.2",
"@scalar/api-client-react": "^1.3.46",
"@types/react": "^19.0.0",
"@types/react-dom": "^19.0.0",
"assert-never": "^1.4.0",
"bidc": "^0.0.2",
"bun-types": "^1.1.20",
@@ -44,7 +51,7 @@
"react-dom": "^19.0.0",
"tsdown": "^0.15.6",
"typescript": "^5.5.3",
"usehooks-ts": "^3.1.0"
"usehooks-ts": "^3.1.1"
}
},
"patchedDependencies": {
+1
View File
@@ -15,6 +15,7 @@
"@gitbook/icons": "workspace:"
},
"devDependencies": {
"bun-types": "catalog:",
"tsdown": "catalog:",
"typescript": "catalog:"
},
+1
View File
@@ -14,6 +14,7 @@
"assert-never": "catalog:"
},
"devDependencies": {
"bun-types": "catalog:",
"tsdown": "catalog:",
"typescript": "catalog:"
},
+1
View File
@@ -10,6 +10,7 @@
"sideEffects": false,
"version": "0.4.2",
"devDependencies": {
"bun-types": "catalog:",
"tsdown": "catalog:",
"typescript": "catalog:"
},
+1
View File
@@ -23,6 +23,7 @@
"react": "*"
},
"devDependencies": {
"@types/react": "catalog:",
"tsdown": "catalog:",
"typescript": "catalog:",
"react": "catalog:"
+4 -1
View File
@@ -19,11 +19,14 @@
"eval-estree-expression": "github:jonschlinkert/eval-estree-expression#9cf28d2"
},
"devDependencies": {
"@tsconfig/strictest": "catalog:",
"@tsconfig/node20": "catalog:",
"@types/escodegen": "^0.0.10",
"@types/estree": "^1.0.6",
"@types/json-schema": "^7.0.15",
"bun-types": "catalog:",
"tsdown": "catalog:"
"tsdown": "catalog:",
"typescript": "catalog:"
},
"scripts": {
"build": "tsdown",
+1
View File
@@ -13,6 +13,7 @@
"@gitbook/api": "catalog:"
},
"devDependencies": {
"bun-types": "catalog:",
"google-font-metadata": "^6.0.7",
"tsdown": "catalog:",
"typescript": "catalog:"
+12 -7
View File
@@ -3,12 +3,14 @@
"version": "0.19.2",
"private": true,
"dependencies": {
"@cloudflare/workers-types": "^4.20251011.0",
"@gitbook/api": "catalog:",
"@gitbook/browser-types": "workspace:*",
"@gitbook/cache-tags": "workspace:*",
"@gitbook/colors": "workspace:*",
"@gitbook/emoji-codepoints": "workspace:*",
"@gitbook/expr": "workspace:*",
"@gitbook/embed": "workspace:*",
"@gitbook/fonts": "workspace:*",
"@gitbook/icons": "workspace:*",
"@gitbook/openapi-parser": "workspace:*",
@@ -16,7 +18,8 @@
"@gitbook/react-math": "workspace:*",
"@gitbook/react-openapi": "workspace:*",
"@modelcontextprotocol/sdk": "^1.17.5",
"@opennextjs/cloudflare": "^1.9.2",
"@opennextjs/aws": "^3.8.5",
"@opennextjs/cloudflare": "^1.11.0",
"@radix-ui/react-checkbox": "^1.0.4",
"@radix-ui/react-dropdown-menu": "^2.1.12",
"@radix-ui/react-hover-card": "^1.1.15",
@@ -33,12 +36,10 @@
"classnames": "catalog:",
"direction": "^2.0.1",
"event-iterator": "^2.0.0",
"framer-motion": "^10.16.14",
"image-size": "^2.0.2",
"js-cookie": "^3.0.5",
"jsontoxml": "^1.0.1",
"jwt-decode": "^4.0.0",
"mathjax": "^3.2.2",
"mcp-handler": "^1.0.2",
"mdast-util-from-markdown": "^2.0.2",
"mdast-util-frontmatter": "^2.0.1",
@@ -47,7 +48,7 @@
"memoizee": "^0.4.17",
"micromark-extension-frontmatter": "^2.0.0",
"micromark-extension-gfm": "^3.0.0",
"motion": "^12.23.12",
"motion": "^12.23.24",
"next": "15.4.0",
"next-themes": "^0.4.6",
"nuqs": "^2.2.3",
@@ -56,6 +57,8 @@
"openapi-types": "^12.1.3",
"p-map": "^7.0.3",
"quick-lru": "^7.0.1",
"react": "catalog:",
"react-dom": "catalog:",
"react-hotkeys-hook": "^4.4.1",
"rehype-sanitize": "^6.0.0",
"rehype-stringify": "^10.0.1",
@@ -79,6 +82,7 @@
"devDependencies": {
"@argos-ci/playwright": "^5.0.9",
"@playwright/test": "^1.54.2",
"@scalar/api-client-react": "catalog:",
"@tailwindcss/postcss": "^4.1.11",
"@types/js-cookie": "^3.0.6",
"@types/jsontoxml": "^1.0.5",
@@ -87,8 +91,8 @@
"@types/node": "^20",
"@types/object-hash": "^3.0.6",
"@types/parse-cache-control": "^1.0.4",
"@types/react": "18.3.13",
"@types/react-dom": "18.3.1",
"@types/react": "catalog:",
"@types/react-dom": "catalog:",
"@types/rison": "^0.0.9",
"bun-types": "catalog:",
"deepmerge": "^4.3.1",
@@ -99,7 +103,8 @@
"tailwindcss": "^4.1.11",
"ts-essentials": "^10.0.1",
"typescript": "catalog:",
"vercel": "^39.3.0"
"vercel": "^39.3.0",
"wrangler": "^4.43.0"
},
"scripts": {
"generate": "./scripts/generate.sh",
@@ -11,7 +11,7 @@ import { AIChatFollowupSuggestions } from './AiChatFollowupSuggestions';
export function AIChatMessages(props: {
chat: AIChatState;
chatController: AIChatController;
lastUserMessageRef?: React.RefObject<HTMLDivElement>;
lastUserMessageRef?: React.RefObject<HTMLDivElement | null>;
}) {
const { chat, chatController, lastUserMessageRef } = props;
@@ -35,6 +35,7 @@ export function HideToolbarButton(props: HideToolbarButtonProps) {
}
setOpen(false);
};
// @ts-expect-error wrong type for ref
useOnClickOutside(ref, handleClickOutsideArcMenu);
// Close arc menu on scroll
@@ -6,7 +6,7 @@ import {
useReducedMotion,
useSpring,
} from 'motion/react';
import React from 'react';
import React, { isValidElement } from 'react';
import { AnimatedLogo } from './AnimatedLogo';
import { useToolbarControls } from './ToolbarControlsContext';
@@ -291,6 +291,10 @@ function ToolbarButtonWrapper(props: {
x: springX,
};
if (!isValidElement<{ motionValues: typeof motionValues }>(child)) {
return null;
}
return React.cloneElement(child, {
motionValues,
});
@@ -136,7 +136,7 @@ const calculateSpacing = (
export function useMagnificationEffect(props: {
childrenCount: number;
containerRef: React.RefObject<HTMLElement>;
containerRef: React.RefObject<HTMLElement | null>;
config?: MagnificationConfig;
}) {
const { childrenCount, containerRef, config } = props;
@@ -37,6 +37,7 @@ export function PageCoverImage({ imgs, y }: { imgs: Images; y: number }) {
const containerRef = useRef<HTMLDivElement>(null);
const container = useResizeObserver({
// @ts-expect-error wrong types
ref: containerRef,
});
@@ -1,7 +1,7 @@
'use client';
import { Icon, type IconName } from '@gitbook/icons';
import { motion } from 'framer-motion';
import { motion } from 'motion/react';
import React from 'react';
import { type ClassValue, tcls } from '@/lib/tailwind';
@@ -63,7 +63,7 @@ const TOC_ITEM_OFFSET = 100;
* Scrolls the table of contents container to the page item when it's initially active.
*/
export function useScrollToActiveTOCItem(props: {
anchorRef: React.RefObject<HTMLAnchorElement>;
anchorRef: React.RefObject<HTMLAnchorElement | null>;
isActive: boolean;
}) {
const { isActive, anchorRef } = props;
@@ -1,7 +1,7 @@
'use client';
import { Icon } from '@gitbook/icons';
import { motion } from 'framer-motion';
import { motion } from 'motion/react';
import React, { useRef } from 'react';
import { tcls } from '@/lib/tailwind';
@@ -196,9 +196,9 @@ function Descendants(props: {
const { isVisible, children } = props;
return (
<motion.div
className="overflow-hidden"
animate={isVisible ? show : hide}
initial={isVisible ? show : hide}
style={{ overflow: 'hidden' }}
>
{children}
</motion.div>
@@ -7,7 +7,7 @@ const HAS_INTERSECTION_OBSERVER = typeof IntersectionObserver !== 'undefined';
* Return true if the element has been in the viewport once.
*/
export function useHasBeenInViewport(
containerRef: React.RefObject<HTMLElement>,
containerRef: React.RefObject<HTMLElement | null>,
options?: Pick<IntersectionObserverInit, 'root' | 'rootMargin' | 'threshold'>
) {
const [visible, setVisible] = useState(false);
@@ -7,7 +7,7 @@ const HAS_INTERSECTION_OBSERVER = typeof IntersectionObserver !== 'undefined';
* Watch an element to know when it is in the viewport.
*/
export function useInViewportListener(
containerRef: React.RefObject<HTMLElement>,
containerRef: React.RefObject<HTMLElement | null>,
listener: (isIntersecting: boolean, disconnect: () => void) => void,
options?: Pick<IntersectionObserverInit, 'root' | 'rootMargin' | 'threshold'>
) {
@@ -17,7 +17,7 @@ import { type RefObject, useEffect, useLayoutEffect, useRef } from 'react';
*/
export function useScrollListener(
listener: (event: Event) => void,
elementRef: RefObject<HTMLElement | Window> | null
elementRef: RefObject<HTMLElement | Window | null> | null
) {
const listenerRef = useRef(listener);
useLayoutEffect(() => {
@@ -1,6 +1,6 @@
'use client';
import { stagger, useAnimate } from 'framer-motion';
import { stagger, useAnimate } from 'motion/react';
import React, { useLayoutEffect } from 'react';
const show = {
+2 -2
View File
@@ -1,4 +1,4 @@
import React from 'react';
import React, { isValidElement } from 'react';
import type { TranslationKey, TranslationLanguage } from './translations';
@@ -70,7 +70,7 @@ function reactToString(el: React.ReactNode): string {
return el.map(reactToString).join('');
}
if (typeof el === 'object' && 'props' in el) {
if (isValidElement<{ children: string[] }>(el)) {
return el.props.children.map(reactToString).join('');
}
+2
View File
@@ -24,6 +24,8 @@
"@gitbook/fontawesome-pro": "1.0.15"
},
"devDependencies": {
"bun-types": "catalog:",
"@types/react": "catalog:",
"react": "catalog:",
"tsdown": "catalog:",
"typescript": "catalog:"
+2 -2
View File
@@ -16,8 +16,8 @@
"@scalar/openapi-types": "^0.3.7"
},
"devDependencies": {
"@tsconfig/strictest": "^2.0.6",
"@tsconfig/node20": "^20.1.6",
"@tsconfig/strictest": "catalog:",
"@tsconfig/node20": "catalog:",
"@types/swagger2openapi": "^7.0.4",
"bun-types": "catalog:",
"tsdown": "catalog:",
+2
View File
@@ -19,6 +19,8 @@
"react": "*"
},
"devDependencies": {
"@types/react": "catalog:",
"react": "catalog:",
"tsdown": "catalog:",
"typescript": "catalog:"
},
@@ -159,6 +159,7 @@ export function ElementWebframe(props: ContentKitClientElementProps<ContentKitWe
return sendMessage({ state });
}, [element.data, renderer.state, sendMessage]);
// @ts-expect-error type definition is wrong for useResizeObserver
const { width: observedWidth = 0 } = useResizeObserver({ ref: iframeRef });
const liveWidth = observedWidth || iframeRef.current?.clientWidth || 0;
+5
View File
@@ -12,6 +12,7 @@
"sideEffects": false,
"dependencies": {
"katex": "^0.16.25",
"mathjax": "^3.2.2",
"object-hash": "^3.0.0"
},
"peerDependencies": {
@@ -19,6 +20,10 @@
},
"devDependencies": {
"@types/katex": "^0.16.7",
"@types/react": "catalog:",
"bun-types": "catalog:",
"react": "catalog:",
"tsdown": "catalog:",
"typescript": "catalog:"
},
"scripts": {
+10 -1
View File
@@ -12,7 +12,7 @@
"dependencies": {
"@gitbook/expr": "workspace:*",
"@gitbook/openapi-parser": "workspace:*",
"@scalar/api-client-react": "^1.3.16",
"@scalar/api-client-react": "catalog:",
"@scalar/oas-utils": "^0.2.130",
"@scalar/types": "^0.1.9",
"classnames": "catalog:",
@@ -20,18 +20,27 @@
"json-xml-parse": "^1.3.0",
"react-aria-components": "^1.13.0",
"react-aria": "^3.44.0",
"react-stately": "^3.42.0",
"usehooks-ts": "catalog:",
"zustand": "^5.0.3",
"js-yaml": "^4.1.0"
},
"devDependencies": {
"@types/js-yaml": "^4.0.9",
"@types/react": "catalog:",
"@types/react-dom": "catalog:",
"bun-types": "catalog:",
"react": "catalog:",
"react-dom": "catalog:",
"tsdown": "catalog:",
"typescript": "catalog:"
},
"overrides": {
"@types/react": "catalog:",
"@types/react-dom": "catalog:",
"react": "catalog:",
"react-dom": "catalog:"
},
"peerDependencies": {
"react": "*",
"react-dom": "*"
@@ -85,13 +85,19 @@ function ScalarModal(props: {
return (
<ApiClientModalProvider
configuration={{ url: specUrl, ...prefillConfig }}
initialRequest={{ method, path }}
initialRequest={
method !== 'connect' ? { method: toScalarHttpMethod(method), path } : undefined
}
>
<ScalarModalController method={method} path={path} controllerRef={controllerRef} />
</ApiClientModalProvider>
);
}
function toScalarHttpMethod<T extends OpenAPIV3_1.HttpMethods>(method: T): Uppercase<T> {
return method.toUpperCase() as Uppercase<T>;
}
type ScalarModalControllerRef = {
openClient: (() => void) | undefined;
};
@@ -106,10 +112,10 @@ function ScalarModalController(props: {
const openScalarClient = client?.open;
const { onOpenClient: trackClientOpening } = useOpenAPIOperationContext();
const openClient = useMemo(() => {
if (openScalarClient) {
if (openScalarClient && method !== 'connect') {
return () => {
openScalarClient({
method,
method: toScalarHttpMethod(method),
path,
_source: 'gitbook',
});
+2 -2
View File
@@ -1,4 +1,4 @@
import React from 'react';
import React, { isValidElement } from 'react';
import type { Translation, TranslationKey } from './translations';
@@ -72,7 +72,7 @@ function reactToString(el: React.ReactNode): string {
return el.map(reactToString).join('');
}
if (typeof el === 'object' && 'props' in el) {
if (isValidElement<{ children: string[] }>(el)) {
return el.props.children.map(reactToString).join('');
}
-1
View File
@@ -4,6 +4,5 @@ export default defineConfig([
{
entry: 'src/index.ts',
unbundle: true,
external: ['@react-stately/disclosure', '@react-stately/util'],
},
]);
+1 -1
View File
@@ -51,7 +51,7 @@
"dev": {
"persistent": true,
"cache": false,
"dependsOn": ["generate"]
"dependsOn": ["generate", "^build"]
},
// Script run when the package is deployed
"release": {