Skip to content

Commit 5da00da

Browse files
committed
fix(plugin): Fix compatibility issues with Docusaurus v3
1 parent 727be0d commit 5da00da

File tree

2 files changed

+13
-10
lines changed

2 files changed

+13
-10
lines changed

package.json

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,19 +6,21 @@
66
"types": "dist/index.d.ts",
77
"exports": {
88
".": {
9+
"types": "./dist/index.d.ts",
910
"import": "./dist/index.mjs",
10-
"types": "./dist/index.d.ts"
11+
"require": "./dist/index.mjs"
1112
},
1213
"./remark": {
14+
"types": "./dist/remark/index.d.ts",
1315
"import": "./dist/remark/index.mjs",
14-
"types": "./dist/remark/index.d.ts"
16+
"require": "./dist/remark/index.mjs"
1517
}
1618
},
1719
"files": [
1820
"dist"
1921
],
2022
"scripts": {
21-
"build": "tsup src/index.ts src/remark/index.ts --format esm --dts",
23+
"build": "tsup src/index.ts src/remark/index.ts --format esm --dts && cp -r src/theme dist/",
2224
"dev": "tsup src/index.ts --watch",
2325
"prepare": "npm run build",
2426
"clean": "rm -rf dist",

src/index.ts

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
import type { LoadContext, Plugin } from "@docusaurus/types";
1+
import type { LoadContext, Plugin, Props } from "@docusaurus/types";
2+
import path from "path";
23
import { join } from "path";
34
import { ensureDirSync, writeJsonSync, copySync } from "fs-extra";
45
import { getSharedData, loadResistanceDataForSource } from "./data";
@@ -40,7 +41,11 @@ export default function docusaurusPluginResistogram(
4041
return {
4142
name: "docusaurus-plugin-resistogram",
4243

43-
async contentLoaded({ actions }) {
44+
getThemePath() {
45+
return path.resolve(__dirname, "./theme");
46+
},
47+
48+
async contentLoaded({ actions }: { actions: any }) {
4449
const { abx, org, sources, hierarchicalSources, allAbxIds, allOrgIds, orgClasses, orgIdToRank, abxSyn2Id, orgSyn2Id } = await getSharedData(dataPath, files);
4550

4651
// 1. Process and write resistance data for each source, using the new hierarchical loader
@@ -114,14 +119,10 @@ export default function docusaurusPluginResistogram(
114119
actions.setGlobalData(globalData);
115120
},
116121

117-
async postBuild({ outDir }) {
122+
async postBuild({ outDir }: Props) {
118123
const destDir = join(outDir, "assets", "json");
119124
ensureDirSync(destDir);
120125
copySync(pluginDataDir, destDir);
121126
},
122-
123-
getThemePath() {
124-
return "./theme";
125-
},
126127
};
127128
}

0 commit comments

Comments
 (0)