AOT compilation example usage.
entry.ts: Export built dependencies IDs// Exclude `runtime-compiler` when bundling export const appId = build(app);
build.ts: Build hydration codeimport { statements } from 'runtime-compiler'; import 'runtime-compiler/config/loader/build'; import './entry.ts'; // Replace `runtime-compiler/config` with `runtime-compiler/config/mode/hydrate` when bundling. const hydratedCode = ` import { $ } from 'runtime-compiler'; export * from './entry.ts'; ${statements} `; // Or with no bundler magic const hydratedCode = ` import 'runtime-compiler/config/loader/hydrate'; import { $ } from 'runtime-compiler'; export * from './entry.ts'; ${statements} `;
Ok so hear me out... for the 5th time I think I need to rewrite the API but anyways:
const root = router.init();
router.handle(
router.get(root, '/', ...),
send.text(() => 'Hi')
);
router.use(layer);
const api = router.branch(root, '/api');
// ...// Middleware design
layer((c) => {
const res = preprocess(c);
// Implement onEnd somehow to be fast
onEnd(() => postprocess(res));
});