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
2 changes: 1 addition & 1 deletion packages/tester/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"preview": "rspress preview"
},
"dependencies": {
"rspress": "^2.0.0-beta.21",
"@rspress/core": "^2.0.0-beta.31",
"@callstack/rspress-theme": "workspace:*"
},
"devDependencies": {
Expand Down
2 changes: 1 addition & 1 deletion packages/tester/rspress.config.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import * as path from 'node:path';
import { pluginCallstackTheme } from '@callstack/rspress-theme/plugin';
import { defineConfig } from 'rspress/config';
import { defineConfig } from '@rspress/core';

export default defineConfig({
root: path.join(__dirname, 'docs'),
Expand Down
4 changes: 2 additions & 2 deletions packages/tester/theme/index.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Announcement, VersionBadge } from '@callstack/rspress-theme';
import { Layout as RspressLayout } from 'rspress/theme';
import { Layout as RspressLayout } from '@rspress/core/theme';

const Layout = () => {
return (
Expand All @@ -18,4 +18,4 @@ const Layout = () => {

export { Layout };

export * from 'rspress/theme';
export * from '@rspress/core/theme';
4 changes: 2 additions & 2 deletions packages/theme/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ To use the `rspress-theme` package, you need to add the plugin to the Rspress co
In your `rspress.config.ts` file, import `pluginCallstackTheme` from `@callstack/rspress-theme/plugin` and add it to the plugins array:

```ts
import { defineConfig } from 'rspress/core';
import { defineConfig } from '@rspress/core';
import { pluginCallstackTheme } from '@callstack/rspress-theme/plugin';

export default defineConfig({
Expand Down Expand Up @@ -87,7 +87,7 @@ import { Announcement } from '@callstack/rspress-theme';

```ts
import path from 'node:path';
import { defineConfig } from 'rspress/core';
import { defineConfig } from '@rspress/core';
import { pluginCallstackTheme } from '@callstack/rspress-theme/plugin';

export default defineConfig({
Expand Down
6 changes: 3 additions & 3 deletions packages/theme/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,8 @@
"typecheck": "tsc --noEmit"
},
"peerDependencies": {
"react": "^19.0.0",
"rspress": "^2.0.0-beta.21"
"@rspress/core": "^2.0.0-beta.31",
"react": "^19.0.0"
},
"devDependencies": {
"@microsoft/api-extractor": "^7.52.8",
Expand All @@ -55,10 +55,10 @@
"@rsbuild/plugin-sass": "^1.3.3",
"@rsbuild/plugin-svgr": "^1.2.1",
"@rslib/core": "^0.10.5",
"@rspress/core": "^2.0.0-beta.31",
"@types/node": "^22",
"@types/react": "^19",
"react": "^19",
"rspress": "^2.0.0-beta.21",
"typescript": "^5.8.3"
}
}
9 changes: 5 additions & 4 deletions packages/theme/src/plugin/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import fs from 'node:fs';
import { createRequire } from 'node:module';
import path from 'node:path';
import { fileURLToPath } from 'node:url';
import type { RspressPlugin, UserConfig } from 'rspress/core';
import type { RspressPlugin, UserConfig } from '@rspress/core';

type BuilderConfig = NonNullable<UserConfig['builderConfig']>;
type AliasEntry = string | (false | string)[] | false | undefined;
Expand All @@ -15,7 +15,6 @@ interface PluginCallstackThemeOptions {
};
}

const { resolve } = createRequire(import.meta.url);
const dirname = path.dirname(fileURLToPath(import.meta.url));

function excludeFalse<T>(value: T): value is Exclude<T, false> {
Expand All @@ -37,8 +36,10 @@ function getThemeAliases(
existingThemeAlias: AliasEntry
): Record<string, string | string[]> {
const ckThemeExportsPath = path.join(dirname, 'theme');

const { resolve } = createRequire(import.meta.url);
const rspressThemeDefaultPath = resolve('@rspress/theme-default', {
paths: [resolve('rspress')],
paths: [resolve('@rspress/core')],
});

const aliases: Record<string, string | string[]> = {};
Expand All @@ -63,7 +64,7 @@ function getThemeAliases(
// Add alias for @default-theme to avoid circular dependency
aliases['@default-theme'] = rspressThemeDefaultPath;
// Alias rspress/theme to our theme to keep the theme override pattern from Rspress docs
aliases['rspress/theme'] = ckThemeExportsPath;
aliases['@rspress/core/theme'] = ckThemeExportsPath;

return aliases;
}
Expand Down
2 changes: 1 addition & 1 deletion packages/theme/src/theme/components/announcement/index.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { NoSSR } from '@rspress/core/runtime';
import { useState } from 'react';
import { NoSSR } from 'rspress/runtime';
import IconClose from '../../assets/close.svg?react';
import styles from './index.module.scss';

Expand Down
2 changes: 1 addition & 1 deletion packages/theme/src/theme/components/home-feature/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import {
isExternalUrl,
normalizeHrefInRuntime,
withBase,
} from 'rspress/runtime';
} from '@rspress/core/runtime';
import type { Feature, FrontMatterMeta } from '../../types';
import { renderHtmlOrText } from '../../utils';
import styles from './index.module.scss';
Expand Down
2 changes: 1 addition & 1 deletion packages/theme/src/theme/components/home-footer/index.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { usePageData } from '@rspress/core/runtime';
import { Link, SocialLinks } from '@theme';
import { usePageData } from 'rspress/runtime';
import CKLogoDark from '../../assets/ck-logo-dark.svg?react';
import CKLogoLight from '../../assets/ck-logo-light.svg?react';
import styles from './index.module.scss';
Expand Down
2 changes: 1 addition & 1 deletion packages/theme/src/theme/components/home-hero/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import {
normalizeHrefInRuntime,
normalizeImagePath,
withBase,
} from 'rspress/runtime';
} from '@rspress/core/runtime';
import type { FrontMatterMeta, Hero } from '../../types';
import { renderHtmlOrText } from '../../utils';
import { Button } from '../button';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { ThemeContext, flushSync, useSite } from '@rspress/core/runtime';
import { type MouseEvent, useContext } from 'react';
import { DataContext, ThemeContext, flushSync } from 'rspress/runtime';
import IconMoon from '../../assets/moon.svg?react';
import IconSun from '../../assets/sun.svg?react';
import './index.module.scss';
Expand All @@ -26,12 +26,12 @@ const removeClipViewTransition = () => {
};

export function SwitchAppearance({ onClick }: { onClick?: () => void }) {
const { data: pageData } = useContext(DataContext);
const { site: siteData } = useSite();
const { theme, setTheme = () => {} } = useContext(ThemeContext);

const handleClick = (event: MouseEvent) => {
const supported = supportAppearanceTransition();
const enabled = pageData.siteData?.themeConfig?.enableAppearanceAnimation;
const enabled = siteData.themeConfig?.enableAppearanceAnimation;

const nextTheme = theme === 'dark' ? 'light' : 'dark';
const isDark = nextTheme === 'dark';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { usePageData } from '@rspress/core/runtime';
import { Badge } from '@theme';
import { usePageData } from 'rspress/runtime';
import styles from './index.module.scss';

interface VersionBadgeProps {
Expand Down
Loading