Pre-flight checklist
Problem or use case
view evaluates directive expressions at runtime. That is exactly right for the zero-build CDN story, but it leaves performance on the table for build-using apps and keeps an expression parser/evaluator on the hot path — which is also where the documented bq-for/object-expression edge cases live (#136). Svelte compiles templates to optimized JS, and Vue offers a compile step; bQuery has no opt-in equivalent, so larger views pay runtime-evaluation cost they could avoid.
Proposed solution
Offer an optional, build-tool-agnostic compile step that pre-parses bq-* expressions and emits optimized update functions, while the runtime evaluator remains the default for zero-build usage. This must be strictly opt-in to preserve the "zero mandatory build step" goal and must not introduce a bundled build tool of bQuery's own (a non-goal) — it should be a small transform usable from any bundler plus a CLI invocation. Compiled and runtime paths must be behaviorally identical so authoring is unchanged.
Possible API or UX shape
// Optional, e.g. as a Vite/esbuild/rollup-agnostic transform:
import { compileViews } from "@bquery/bquery/view/compiler";
// build step: precompiles bq-* expressions in templates to update fns
// runtime is unchanged for zero-build users — same directives, same behavior
Alternatives considered
Staying runtime-only forever — acceptable but cedes a measurable performance axis to Svelte/Vue for apps that already build. Making compilation mandatory — violates the zero-build goal and the no-bundled-build-tool non-goal; opt-in is the only design consistent with bQuery's identity.
Relevant area
view
Additional context
Lower priority than #136/#137 for stability, but it both improves performance parity and reduces the runtime parser surface where the known edge cases live. Area could also be classified as "build or tooling"; filed under view since the behavior it optimizes is the view layer.
Pre-flight checklist
Problem or use case
viewevaluates directive expressions at runtime. That is exactly right for the zero-build CDN story, but it leaves performance on the table for build-using apps and keeps an expression parser/evaluator on the hot path — which is also where the documentedbq-for/object-expression edge cases live (#136). Svelte compiles templates to optimized JS, and Vue offers a compile step; bQuery has no opt-in equivalent, so larger views pay runtime-evaluation cost they could avoid.Proposed solution
Offer an optional, build-tool-agnostic compile step that pre-parses
bq-*expressions and emits optimized update functions, while the runtime evaluator remains the default for zero-build usage. This must be strictly opt-in to preserve the "zero mandatory build step" goal and must not introduce a bundled build tool of bQuery's own (a non-goal) — it should be a small transform usable from any bundler plus a CLI invocation. Compiled and runtime paths must be behaviorally identical so authoring is unchanged.Possible API or UX shape
Alternatives considered
Staying runtime-only forever — acceptable but cedes a measurable performance axis to Svelte/Vue for apps that already build. Making compilation mandatory — violates the zero-build goal and the no-bundled-build-tool non-goal; opt-in is the only design consistent with bQuery's identity.
Relevant area
viewAdditional context
Lower priority than #136/#137 for stability, but it both improves performance parity and reduces the runtime parser surface where the known edge cases live. Area could also be classified as "build or tooling"; filed under
viewsince the behavior it optimizes is the view layer.