Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions .changeset/nice-rocks-crash.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
---
"@gitbook/emoji-codepoints": patch
"@gitbook/react-contentkit": patch
"@gitbook/openapi-parser": patch
"@gitbook/browser-types": patch
"@gitbook/react-openapi": patch
"@gitbook/cache-tags": patch
"@gitbook/react-math": patch
"gitbook": patch
"@gitbook/colors": patch
"@gitbook/embed": patch
"@gitbook/fonts": patch
"@gitbook/icons": patch
"@gitbook/expr": patch
---

Mark as sideEffects, fix all package bundles
4 changes: 2 additions & 2 deletions .github/workflows/publish.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ jobs:
fetch-depth: 0
- name: Setup Bun
uses: ./.github/composite/setup-bun
- name: Setup npmrc
run: echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}" > .npmrc
- name: Install dependencies
run: bun install --frozen-lockfile
env:
Expand All @@ -36,8 +38,6 @@ jobs:
# Using a PAT instead of GITHUB_TOKEN because we need to run workflows when releases are created
# https://github.com/orgs/community/discussions/26875#discussioncomment-3253761
GITHUB_TOKEN: ${{ secrets.GH_PERSONAL_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
NPM_CONFIG_TOKEN: ${{ secrets.NPM_TOKEN }}
CLOUDFLARE_ACCOUNT_ID: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }}

354 changes: 186 additions & 168 deletions bun.lock

Large diffs are not rendered by default.

13 changes: 10 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
"packageManager": "bun@1.2.15",
"overrides": {
"@codemirror/state": "6.4.1",
"react": "^19.0.0",
"react-dom": "^19.0.0",
"react": "catalog:",
"react-dom": "catalog:",
"esbuild": "0.24.2"
},
"private": true,
Expand All @@ -36,8 +36,15 @@
"packages": ["packages/*"],
"catalog": {
"@gitbook/api": "0.143.2",
"assert-never": "^1.4.0",
"bidc": "^0.0.2",
"tsdown": "^0.15.6"
"bun-types": "^1.1.20",
"classnames": "^2.5.1",
"react": "^19.0.0",
"react-dom": "^19.0.0",
"tsdown": "^0.15.6",
"typescript": "^5.5.3",
"usehooks-ts": "^3.1.0"
}
},
"patchedDependencies": {
Expand Down
9 changes: 6 additions & 3 deletions packages/browser-types/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,20 @@
"default": "./dist/index.js"
}
},
"sideEffects": false,
"version": "0.1.1",
"dependencies": {
"@gitbook/api": "catalog:",
"@gitbook/icons": "workspace:"
},
"devDependencies": {
"typescript": "^5.5.3"
"tsdown": "catalog:",
"typescript": "catalog:"
},
"scripts": {
"build": "tsc",
"typecheck": "tsc --noEmit"
"build": "tsdown",
"typecheck": "tsc --noEmit",
"dev": "bun run build -- --watch ./src"
},
"files": ["dist", "README.md", "CHANGELOG.md"],
"publishConfig": {
Expand Down
13 changes: 7 additions & 6 deletions packages/cache-tags/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,24 +4,25 @@
"exports": {
".": {
"types": "./dist/index.d.ts",
"development": "./src/index.ts",
"default": "./dist/index.js"
}
},
"sideEffects": false,
"version": "0.3.2",
"dependencies": {
"@gitbook/api": "catalog:",
"assert-never": "^1.2.1"
"assert-never": "catalog:"
},
"devDependencies": {
"typescript": "^5.5.3"
"tsdown": "catalog:",
"typescript": "catalog:"
},
"scripts": {
"build": "tsc",
"build": "tsdown",
"typecheck": "tsc --noEmit",
"dev": "tsc -w"
"dev": "bun run build -- --watch ./src"
},
"files": ["dist", "src", "README.md", "CHANGELOG.md"],
"files": ["dist", "README.md", "CHANGELOG.md"],
"publishConfig": {
"access": "public",
"registry": "https://registry.npmjs.org/"
Expand Down
11 changes: 6 additions & 5 deletions packages/colors/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,21 @@
"exports": {
".": {
"types": "./dist/index.d.ts",
"development": "./src/index.ts",
"default": "./dist/index.js"
}
},
"sideEffects": false,
"version": "0.4.1",
"devDependencies": {
"typescript": "^5.5.3"
"tsdown": "catalog:",
"typescript": "catalog:"
},
"scripts": {
"build": "tsc",
"build": "tsdown",
"typecheck": "tsc --noEmit",
"dev": "tsc -w"
"dev": "bun run build -- --watch ./src"
},
"files": ["dist", "src", "README.md", "CHANGELOG.md"],
"files": ["dist", "README.md", "CHANGELOG.md"],
"publishConfig": {
"access": "public",
"registry": "https://registry.npmjs.org/"
Expand Down
7 changes: 4 additions & 3 deletions packages/embed/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,19 +12,20 @@
"default": "./dist/react/index.js"
}
},
"sideEffects": false,
"version": "0.1.3",
"dependencies": {
"@gitbook/api": "catalog:",
"@gitbook/icons": "workspace:",
"bidc": "catalog:"
},
"peerDependencies": {
"react": "^18.0.0"
"react": "*"
},
"devDependencies": {
"tsdown": "catalog:",
"typescript": "^5.5.3",
"react": "^19.0.0"
"typescript": "catalog:",
"react": "catalog:"
},
"scripts": {
"build": "bun run build-lib && bun run build-standalone",
Expand Down
14 changes: 8 additions & 6 deletions packages/embed/src/react/GitBookFrame.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
import React from 'react';
'use client';

import { useEffect, useMemo, useRef, useState } from 'react';
import type {
GetFrameURLOptions,
GitBookEmbeddableConfiguration,
Expand All @@ -17,19 +19,19 @@ export type GitBookFrameProps = {
export function GitBookFrame(props: GitBookFrameProps) {
const { className, visitor, buttons, welcomeMessage, suggestions, tools } = props;

const frameRef = React.useRef<HTMLIFrameElement>(null);
const frameRef = useRef<HTMLIFrameElement>(null);
const gitbook = useGitBook();
const [gitbookFrame, setGitbookFrame] = React.useState<GitBookFrameClient | null>(null);
const [gitbookFrame, setGitbookFrame] = useState<GitBookFrameClient | null>(null);

const frameURL = React.useMemo(() => gitbook.getFrameURL({ visitor }), [gitbook, visitor]);
const frameURL = useMemo(() => gitbook.getFrameURL({ visitor }), [gitbook, visitor]);

React.useEffect(() => {
useEffect(() => {
if (frameRef.current) {
setGitbookFrame(gitbook.createFrame(frameRef.current));
}
}, [gitbook]);

React.useEffect(() => {
useEffect(() => {
gitbookFrame?.configure({
buttons,
welcomeMessage,
Expand Down
10 changes: 7 additions & 3 deletions packages/embed/tsdown.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,12 @@ import { defineConfig } from 'tsdown';

export default defineConfig([
{
entry: ['src/index.ts', 'src/react/index.ts'],
dts: true,
format: ['esm'],
entry: 'src/index.ts',
outDir: 'dist',
},
{
entry: 'src/react/index.ts',
outDir: 'dist/react',
unbundle: true,
},
]);
8 changes: 2 additions & 6 deletions packages/emoji-codepoints/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,12 @@
"version": "0.2.1",
"private": true,
"exports": "./dist/index.ts",
"dependencies": {},
"sideEffects": false,
"devDependencies": {
"emoji-assets": "^8.0.0"
"emoji-assets": "^9.0.0"
},
"scripts": {
"generate": "bun ./build.ts",
"clean": "rm -rf ./dist"
},
"publishConfig": {
"access": "public",
"registry": "https://registry.npmjs.org/"
}
}
12 changes: 5 additions & 7 deletions packages/expr/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,26 +6,24 @@
"exports": {
".": {
"types": "./dist/index.d.ts",
"import": "./dist/index.js",
"default": "./dist/index.js"
}
},
"sideEffects": false,
"dependencies": {
"eval-estree-expression": "github:jonschlinkert/eval-estree-expression#9cf28d2",
"acorn": "^8.14.0",
"acorn-loose": "8.4.0",
"acorn-walk": "^8.3.4",
"assert-never": "catalog:",
"escodegen": "^2.1.0",
"assert-never": "^1.2.1"
"eval-estree-expression": "github:jonschlinkert/eval-estree-expression#9cf28d2"
},
"devDependencies": {
"bun-types": "^1.1.20",
"tsdown": "catalog:",
"@types/escodegen": "^0.0.10",
"@types/estree": "^1.0.6",
"@babel/types": "^7.26.0",
"@types/json-schema": "^7.0.15",
"@types/escodegen": "^0.0.10"
"bun-types": "catalog:",
"tsdown": "catalog:"
},
"scripts": {
"build": "tsdown",
Expand Down
13 changes: 7 additions & 6 deletions packages/fonts/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,27 +4,28 @@
"exports": {
".": {
"types": "./dist/index.d.ts",
"development": "./src/index.ts",
"default": "./dist/index.js"
}
},
"sideEffects": false,
"version": "0.1.1",
"dependencies": {
"@gitbook/api": "catalog:"
},
"devDependencies": {
"google-font-metadata": "^6.0.3",
"typescript": "^5.5.3"
"google-font-metadata": "^6.0.7",
"tsdown": "catalog:",
"typescript": "catalog:"
},
"scripts": {
"generate": "bun ./bin/generate.js",
"build": "tsc --project tsconfig.build.json",
"build": "tsdown",
"typecheck": "tsc --noEmit",
"dev": "tsc -w",
"dev": "bun run build -- --watch ./src",
"clean": "rm -rf ./dist && rm -rf ./src/data",
"unit": "bun test"
},
"files": ["dist", "src", "bin", "README.md", "CHANGELOG.md"],
"files": ["dist", "bin", "README.md", "CHANGELOG.md"],
"engines": {
"node": ">=20.0.0"
},
Expand Down
18 changes: 9 additions & 9 deletions packages/fonts/src/__snapshots__/getDefaultFont.test.ts.snap
Original file line number Diff line number Diff line change
@@ -1,57 +1,57 @@
// Bun Snapshot v1, https://goo.gl/fbAQLP
// Bun Snapshot v1, https://bun.sh/docs/test/snapshots

exports[`getDefaultFont should return correct object for Latin text 1`] = `
{
"font": "Inter",
"url": "https://fonts.gstatic.com/s/inter/v18/UcCO3FwrK3iLTeHuS_nVMrMxCp50SjIw2boKoduKmMEVuLyfAZ9hjp-Ek-_0ew.woff",
"url": "https://fonts.gstatic.com/s/inter/v20/UcCO3FwrK3iLTeHuS_nVMrMxCp50SjIw2boKoduKmMEVuLyfAZ9hjp-Ek-_0ew.woff",
}
`;

exports[`getDefaultFont should return correct object for Cyrillic text 1`] = `
{
"font": "Inter",
"url": "https://fonts.gstatic.com/s/inter/v18/UcCO3FwrK3iLTeHuS_nVMrMxCp50SjIw2boKoduKmMEVuLyfAZthjp-Ek-_0ewmM.woff",
"url": "https://fonts.gstatic.com/s/inter/v20/UcCO3FwrK3iLTeHuS_nVMrMxCp50SjIw2boKoduKmMEVuLyfAZthjp-Ek-_0ewmM.woff",
}
`;

exports[`getDefaultFont should return correct object for Greek text 1`] = `
{
"font": "Inter",
"url": "https://fonts.gstatic.com/s/inter/v18/UcCO3FwrK3iLTeHuS_nVMrMxCp50SjIw2boKoduKmMEVuLyfAZxhjp-Ek-_0ewmM.woff",
"url": "https://fonts.gstatic.com/s/inter/v20/UcCO3FwrK3iLTeHuS_nVMrMxCp50SjIw2boKoduKmMEVuLyfAZxhjp-Ek-_0ewmM.woff",
}
`;

exports[`getDefaultFont should handle mixed script text 1`] = `
{
"font": "Inter",
"url": "https://fonts.gstatic.com/s/inter/v18/UcCO3FwrK3iLTeHuS_nVMrMxCp50SjIw2boKoduKmMEVuLyfAZthjp-Ek-_0ewmM.woff",
"url": "https://fonts.gstatic.com/s/inter/v20/UcCO3FwrK3iLTeHuS_nVMrMxCp50SjIw2boKoduKmMEVuLyfAZthjp-Ek-_0ewmM.woff",
}
`;

exports[`getDefaultFont should handle different font weights: regular 1`] = `
{
"font": "Inter",
"url": "https://fonts.gstatic.com/s/inter/v18/UcCO3FwrK3iLTeHuS_nVMrMxCp50SjIw2boKoduKmMEVuLyfAZ9hjp-Ek-_0ew.woff",
"url": "https://fonts.gstatic.com/s/inter/v20/UcCO3FwrK3iLTeHuS_nVMrMxCp50SjIw2boKoduKmMEVuLyfAZ9hjp-Ek-_0ew.woff",
}
`;

exports[`getDefaultFont should handle different font weights: bold 1`] = `
{
"font": "Inter",
"url": "https://fonts.gstatic.com/s/inter/v18/UcCO3FwrK3iLTeHuS_nVMrMxCp50SjIw2boKoduKmMEVuFuYAZ9hjp-Ek-_0ew.woff",
"url": "https://fonts.gstatic.com/s/inter/v20/UcCO3FwrK3iLTeHuS_nVMrMxCp50SjIw2boKoduKmMEVuFuYAZ9hjp-Ek-_0ew.woff",
}
`;

exports[`getDefaultFont should handle different fonts: inter 1`] = `
{
"font": "Inter",
"url": "https://fonts.gstatic.com/s/inter/v18/UcCO3FwrK3iLTeHuS_nVMrMxCp50SjIw2boKoduKmMEVuLyfAZ9hjp-Ek-_0ew.woff",
"url": "https://fonts.gstatic.com/s/inter/v20/UcCO3FwrK3iLTeHuS_nVMrMxCp50SjIw2boKoduKmMEVuLyfAZ9hjp-Ek-_0ew.woff",
}
`;

exports[`getDefaultFont should handle different fonts: roboto 1`] = `
{
"font": "Roboto",
"url": "https://fonts.gstatic.com/s/roboto/v32/KFOmCnqEu92Fr1Mu4mxMKTU1Kg.woff",
"url": "https://fonts.gstatic.com/s/roboto/v49/KFOMCnqEu92Fr1ME7kSn66aGLdTylUAMQXC89YmC2DPNWubEbVmUiAz0klQm_20.woff",
}
`;
4 changes: 0 additions & 4 deletions packages/fonts/tsconfig.build.json

This file was deleted.

Loading