Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
6 changes: 3 additions & 3 deletions e2e/fixtures/plugin-typedoc/multi/rspress.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ export default defineConfig({
plugins: [
pluginTypeDoc({
entryPoints: [
'./src/index.ts',
'./src/middleware.ts',
'./src/raw-link.ts',
path.join(__dirname, './src/index.ts'),
path.join(__dirname, './src/middleware.ts'),
path.join(__dirname, './src/raw-link.ts'),
],
}),
],
Expand Down
2 changes: 1 addition & 1 deletion e2e/fixtures/plugin-typedoc/single/rspress.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export default defineConfig({
root: path.join(__dirname, 'doc'),
plugins: [
pluginTypeDoc({
entryPoints: ['./src/index.ts'],
entryPoints: [path.join(__dirname, './src/index.ts')],
}),
],
});
11 changes: 10 additions & 1 deletion packages/plugin-typedoc/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import path from 'node:path';
import { cwd } from 'node:process';
import type { RspressPlugin } from '@rspress/core';
import { Application } from 'typedoc';
import { load as loadPluginMarkdown } from 'typedoc-plugin-markdown';
Expand All @@ -19,7 +20,15 @@ export interface PluginTypeDocOptions {
}

export function pluginTypeDoc(options: PluginTypeDocOptions): RspressPlugin {
const { entryPoints = [], outDir = API_DIR } = options;
const { entryPoints: userEntryPoints = [], outDir = API_DIR } = options;

// windows posix path fix https://github.com/web-infra-dev/rspress/pull/2790#issuecomment-3590946652
const entryPoints = userEntryPoints.map(entryPath => {
return path.isAbsolute(entryPath)
? path.posix.relative(entryPath, cwd())
: entryPath;
});

return {
name: '@rspress/plugin-typedoc',
async config(config) {
Expand Down
Loading