Download scripts/compose_app.mjs from VoiceOfML/Search: direct link, hf CLI and curl.
- Browser
- Download file 890 Bytes
-
https://huggingface.co/spaces/VoiceOfML/Search/resolve/main/scripts/compose_app.mjs
- Command line
-
hf download hf://spaces/VoiceOfML/Search/scripts/compose_app.mjs
-
curl -L -o compose_app.mjs https://huggingface.co/spaces/VoiceOfML/Search/resolve/main/scripts/compose_app.mjs
890 Bytes
| import { readFileSync } from "node:fs"; | |
| import { resolve } from "node:path"; | |
| import { pathToFileURL } from "node:url"; | |
| // One ordered dependency list owns the production app and its shell scripts. | |
| // Keep classic-script globals for the host; each dependency owns its own scope. | |
| export const APP_DEPENDENCIES = Object.freeze([ | |
| "reader-resources.js", "reader-contract.js", "reader-navigation.js", | |
| "search-session.js", "download-controller.js" | |
| ]); | |
| export function stripBundledScripts(html) { | |
| return html.replace(/<script\s+src="(?:\/?(?:search\/)?static\/)([^"/]+)"\s*>\s*<\/script>\s*/g, | |
| (tag, filename) => APP_DEPENDENCIES.includes(filename) ? "" : tag); | |
| } | |
| if (process.argv[1] && import.meta.url === pathToFileURL(resolve(process.argv[1])).href) { | |
| process.stdout.write([...APP_DEPENDENCIES, "app.js"] | |
| .map(file => readFileSync("static/" + file, "utf8")).join("\n;\n")); | |
| } | |