Something went wrong. Try again.
[READ-ONLY] Mirror of https://github.com/lukebennett88/luke-ui. ui.lukebennett.dev
Something went wrong. Try again.
TypeScript
12345678910111213141516171819202122232425262728/** * Generates src/generated/playground-scope.generated.ts — the module map the * playground preview uses to resolve imports in user code at runtime. * * Reads the docs specifier list from `docs-playground-specifiers.ts`, so new * `@luke-ui/react` subpaths and the shared third-party allowlist stay aligned, * and renders it with `@luke-ui/playground-core/generate`. Runs via the `generate:playground` script (wired into `docs#generate` * in turbo.json), so dev and build always regenerate it. */import { mkdirSync, writeFileSync } from 'node:fs';import { dirname, resolve } from 'node:path';import { fileURLToPath } from 'node:url';import { renderPlaygroundScopeModule } from '@luke-ui/playground-core/generate';import { docsPlaygroundRuntimeSpecifierList } from '../src/lib/docs-playground-specifiers.ts';
const scriptDir = dirname(fileURLToPath(import.meta.url));const outputPath = resolve(scriptDir, '../src/generated/playground-scope.generated.ts');
const specifiers = docsPlaygroundRuntimeSpecifierList();const output = renderPlaygroundScopeModule(specifiers);
mkdirSync(dirname(outputPath), { recursive: true });writeFileSync(outputPath, output);// oxlint-disable-next-line no-consoleconsole.log( `generate-playground-scope: wrote ${specifiers.length} modules to src/generated/playground-scope.generated.ts`,);