Something went wrong. Try again.
[READ-ONLY] Mirror of https://github.com/MaxwellCohen/DPU. dpu-gamma.vercel.app
Something went wrong. Try again.
123456789101112131415161718192021222324252627282930313233/** * The MaxwellCohen/react CSB tarball omits react-server jsx-runtime and * compiler-runtime CJS builds that Waku/Vite need. Copy vendored shims into * the installed react package after every install. */import { copyFileSync, existsSync, mkdirSync, readdirSync } from 'node:fs';import { createRequire } from 'node:module';import { dirname, join } from 'node:path';import { fileURLToPath } from 'node:url';
const require = createRequire(import.meta.url);const here = dirname(fileURLToPath(import.meta.url));const shimDir = join(here, 'react-fork-shims', 'cjs');
const reactRoot = dirname(require.resolve('react/package.json'));const targetDir = join(reactRoot, 'cjs');
mkdirSync(targetDir, { recursive: true });
const files = readdirSync(shimDir).filter((name) => name.endsWith('.js'));let copied = 0;
for (const name of files) { const dest = join(targetDir, name); if (existsSync(dest)) continue; copyFileSync(join(shimDir, name), dest); copied += 1;}
if (copied > 0) { console.log(`[patch-react-fork] added ${copied} missing file(s) under ${targetDir}`);}