Spaces:
Running on CPU Upgrade
Running on CPU Upgrade
Download web_docs/scripts/dompurify-resolve-hook.mjs from CommunityOne/open-navigator: direct link, hf CLI and curl.
- Browser
- Download file 540 Bytes
-
https://huggingface.co/spaces/CommunityOne/open-navigator/resolve/main/web_docs/scripts/dompurify-resolve-hook.mjs
- Command line
-
hf download hf://spaces/CommunityOne/open-navigator/web_docs/scripts/dompurify-resolve-hook.mjs
-
curl -L -o dompurify-resolve-hook.mjs https://huggingface.co/spaces/CommunityOne/open-navigator/resolve/main/web_docs/scripts/dompurify-resolve-hook.mjs
540 Bytes
| import { dirname, join } from 'node:path'; | |
| import { pathToFileURL } from 'node:url'; | |
| import { fileURLToPath } from 'node:url'; | |
| const shim = pathToFileURL( | |
| join(dirname(fileURLToPath(import.meta.url)), 'mermaid-dom-purify.mjs'), | |
| ).href; | |
| export async function resolve(specifier, context, nextResolve) { | |
| if (specifier === 'dompurify') { | |
| const parent = context.parentURL ?? ''; | |
| if (!parent.includes('mermaid-dom-purify.mjs')) { | |
| return { url: shim, shortCircuit: true }; | |
| } | |
| } | |
| return nextResolve(specifier, context); | |
| } | |