11import { createRequire } from "node:module" ;
2- import { dirname , extname , relative , resolve } from "node:path" ;
2+ import * as path from "node:path" ;
33import { fileURLToPath } from "node:url" ;
44import type { Config } from "@docusaurus/types" ;
55import type { Root } from "mdast" ;
66import { themes } from "prism-react-renderer" ;
77import type { Transformer } from "unified" ;
88import { visit } from "unist-util-visit" ;
99
10+ // oxlint-disable-next-line unicorn/prefer-import-meta-properties
11+ const __dirname = path . dirname ( fileURLToPath ( import . meta. url ) ) ;
1012const require = createRequire ( import . meta. url ) ;
1113
1214const docsRelative = "packages/app-web-docs/src/docs/" ;
@@ -42,16 +44,14 @@ function remarkPluginFixLinksToRepositoryArtifacts(): Transformer<Root> {
4244 return ;
4345 }
4446
45- const repoRoot = resolve (
46- dirname ( fileURLToPath ( import . meta. url ) ) ,
47- "../.." ,
48- ) ;
49- const artifact = resolve ( file . dirname ! , url ) ;
50- const artifactRelative = relative ( repoRoot , artifact ) . replaceAll (
51- "\\" ,
52- "/" ,
53- ) ;
54- const fileRelative = relative ( repoRoot , file . path ) . replaceAll ( "\\" , "/" ) ;
47+ const repoRoot = path . resolve ( __dirname , "../.." ) ;
48+ const artifact = path . resolve ( file . dirname ! , url ) ;
49+ const artifactRelative = path
50+ . relative ( repoRoot , artifact )
51+ . replaceAll ( "\\" , "/" ) ;
52+ const fileRelative = path
53+ . relative ( repoRoot , file . path )
54+ . replaceAll ( "\\" , "/" ) ;
5555
5656 // We host all files under docs. Will resolve as a relative link, but
5757 // relative links pointing to a folder passing between user and
@@ -73,7 +73,7 @@ function remarkPluginFixLinksToRepositoryArtifacts(): Transformer<Root> {
7373}
7474
7575function isFolder ( url : string ) {
76- return ! extname ( url ) ;
76+ return ! path . extname ( url ) ;
7777}
7878
7979function passingBetweenUserAndContributing (
0 commit comments