Skip to content

Latest commit

 

History

History
53 lines (46 loc) · 1.18 KB

File metadata and controls

53 lines (46 loc) · 1.18 KB

AOT

AOT compilation example usage.

  • entry.ts: Export built dependencies IDs
    // Exclude `runtime-compiler` when bundling
    export const appId = build(app);
  • build.ts: Build hydration code
    import { 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}
    `;

New design

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));
});