()
| 18 | * uses (for example when bundling a Fastify app into a Docker image). |
| 19 | */ |
| 20 | export function getJavaScriptFile(): string { |
| 21 | try { |
| 22 | // The main entry resolves to `<pkg>/dist/index.js`, so the standalone build |
| 23 | // sits next to it under `browser/`. |
| 24 | const entry = require.resolve('@scalar/api-reference') |
| 25 | return fs.readFileSync(path.join(path.dirname(entry), 'browser/standalone.js'), 'utf-8') |
| 26 | } catch (cause) { |
| 27 | throw new Error( |
| 28 | '[@scalar/fastify-api-reference] Could not read the standalone build of `@scalar/api-reference`. Build `@scalar/api-reference` first (e.g. `pnpm build:packages`).', |
| 29 | { cause }, |
| 30 | ) |
| 31 | } |
| 32 | } |
no outgoing calls
no test coverage detected