@barefootjs/hono 0.31.1 → 0.31.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/adapter/hono-adapter.d.ts +67 -2
- package/dist/adapter/hono-adapter.d.ts.map +1 -1
- package/dist/adapter/index.js +46 -187398
- package/dist/app.js +0 -71
- package/dist/async.js +0 -71
- package/dist/client-shim.js +0 -71
- package/dist/dev-worker.js +0 -71
- package/dist/dialog-context.js +0 -71
- package/dist/index.js +46 -187398
- package/dist/jsx/jsx-dev-runtime/index.d.ts +3 -1
- package/dist/jsx/jsx-dev-runtime/index.d.ts.map +1 -1
- package/dist/jsx/jsx-dev-runtime/index.js +14 -69
- package/dist/jsx/jsx-runtime/index.d.ts +4 -1
- package/dist/jsx/jsx-runtime/index.d.ts.map +1 -1
- package/dist/jsx/jsx-runtime/index.js +24 -69
- package/dist/jsx/resolve-dangerously-set-inner-html.d.ts +2 -0
- package/dist/jsx/resolve-dangerously-set-inner-html.d.ts.map +1 -0
- package/dist/portal-ssr.js +0 -71
- package/dist/portals.js +0 -71
- package/dist/preload.js +0 -71
- package/dist/render.js +0 -71
- package/dist/request-env.js +0 -71
- package/dist/scripts.js +0 -71
- package/dist/utils.js +0 -71
- package/dist/vite.js +394 -143
- package/package.json +2 -2
- package/src/__tests__/aliased-destructured-prop.test.ts +8 -7
- package/src/__tests__/consumer-typecheck.test.ts +358 -51
- package/src/__tests__/corpus-typecheck.test.ts +130 -0
- package/src/__tests__/dangerously-set-inner-html.test.ts +70 -0
- package/src/__tests__/nested-ternary-bare-branch.test.ts +70 -0
- package/src/adapter/hono-adapter.ts +123 -166
- package/src/jsx/jsx-dev-runtime/index.ts +13 -1
- package/src/jsx/jsx-runtime/index.ts +24 -1
- package/src/jsx/resolve-dangerously-set-inner-html.ts +34 -0
|
@@ -100,9 +100,18 @@ export declare class HonoAdapter extends JsxAdapter implements IRNodeEmitter<Hon
|
|
|
100
100
|
* `hasScriptAssets()` before emitting preload-registration codegen.
|
|
101
101
|
*/
|
|
102
102
|
private hasPreloadAssets;
|
|
103
|
-
private generateModuleLevelContextBindings;
|
|
104
103
|
private generateImports;
|
|
105
|
-
|
|
104
|
+
/**
|
|
105
|
+
* Per-component synthesized types only. The source module's own type
|
|
106
|
+
* declarations are NOT emitted here — `generateModuleScopeDeclarations`
|
|
107
|
+
* carries them once, file-wide, in the module-constants section (#2570).
|
|
108
|
+
* The per-component reachability scan that used to live here (#1453) is
|
|
109
|
+
* gone with them: pruning per component both duplicated shared types
|
|
110
|
+
* across components' sections (TS2300 — the compiler dedups sections by
|
|
111
|
+
* whole string) and dropped exported types no component referenced
|
|
112
|
+
* (TS2305 for any consumer's `import type`).
|
|
113
|
+
*/
|
|
114
|
+
generateTypes(ir: ComponentIR): string | null;
|
|
106
115
|
private getPropsTypeName;
|
|
107
116
|
private generateComponent;
|
|
108
117
|
/**
|
|
@@ -128,6 +137,36 @@ export declare class HonoAdapter extends JsxAdapter implements IRNodeEmitter<Hon
|
|
|
128
137
|
private renderText;
|
|
129
138
|
renderExpression(expr: IRExpression): string;
|
|
130
139
|
renderConditional(cond: IRConditional, ctx?: HonoRenderCtx): string;
|
|
140
|
+
/**
|
|
141
|
+
* The bare ternary text for `cond` — everything `renderConditional` would
|
|
142
|
+
* wrap in `{…}`, minus that wrapping. `renderConditional` is the ONLY
|
|
143
|
+
* place that should add the enclosing braces for a JSX-child position.
|
|
144
|
+
*
|
|
145
|
+
* The two branches below need genuinely different embedding rules, not
|
|
146
|
+
* just a brace/no-brace toggle:
|
|
147
|
+
*
|
|
148
|
+
* - Non-reactive (`cond.slotId` is null): the whole thing collapses to a
|
|
149
|
+
* FLAT `cond ? whenTrue : whenFalse` — one JS expression, wrapped in
|
|
150
|
+
* `{…}` exactly once by whichever caller owns that position (either
|
|
151
|
+
* `renderConditional` for a JSX-child position, or an ENCLOSING
|
|
152
|
+
* ternary's own bare-branch splice when this conditional is itself
|
|
153
|
+
* nested — see `renderBareBranch`). So whenTrue/whenFalse must stay
|
|
154
|
+
* bare all the way down: a nested conditional branch renders through
|
|
155
|
+
* `renderConditionalBody` again (bare), never through the generic
|
|
156
|
+
* `renderNode`/`emitConditional` dispatch, which would re-brace it and
|
|
157
|
+
* break the .tsx parse where only a plain expression is legal (#2470).
|
|
158
|
+
*
|
|
159
|
+
* - Reactive (`cond.slotId` set): each branch is spliced through
|
|
160
|
+
* `wrapWithCondMarker`, which expects a self-contained renderable
|
|
161
|
+
* chunk — an HTML-element string it can tag with `bf-c`, or otherwise
|
|
162
|
+
* text/JSX content it splices directly as JSX CHILDREN inside a
|
|
163
|
+
* `<>…</>` fragment. A nested conditional branch here must keep going
|
|
164
|
+
* through the ordinary `renderNode`/`emitConditional` dispatch (via
|
|
165
|
+
* `renderNodeRawCtx`, unchanged) so it comes back as a complete,
|
|
166
|
+
* already-`{…}`-wrapped JSX expression container — valid as fragment
|
|
167
|
+
* children, which bare ternary text would not be.
|
|
168
|
+
*/
|
|
169
|
+
private renderConditionalBody;
|
|
131
170
|
/**
|
|
132
171
|
* Like the base `renderNodeRaw`, but threads a render ctx through to
|
|
133
172
|
* `renderNode` so a conditional branch can mark its element as a loop item
|
|
@@ -135,6 +174,20 @@ export declare class HonoAdapter extends JsxAdapter implements IRNodeEmitter<Hon
|
|
|
135
174
|
* element, so it short-circuits exactly as the base helper does.
|
|
136
175
|
*/
|
|
137
176
|
private renderNodeRawCtx;
|
|
177
|
+
/**
|
|
178
|
+
* A branch of a NON-reactive conditional's flat ternary (#2470) — the
|
|
179
|
+
* value must be a bare JS expression, since it's spliced directly into
|
|
180
|
+
* `cond ? whenTrue : whenFalse`. Mirrors `renderNodeRawCtx`'s existing
|
|
181
|
+
* `null`/`undefined` special case, extended to a nested conditional: that
|
|
182
|
+
* branch renders through `renderConditionalBody` itself (bare), instead
|
|
183
|
+
* of falling through to `renderNode`/`emitConditional`, which would wrap
|
|
184
|
+
* it in its own `{…}` and break the .tsx parse in this brace-free
|
|
185
|
+
* position. The `@client`-directive combination is excluded — its
|
|
186
|
+
* rendering is a pair of independent marker expressions, not a single JS
|
|
187
|
+
* expression, so it can't be spliced bare into a ternary branch either
|
|
188
|
+
* way; that shape falls through to the pre-existing (unrelated) behavior.
|
|
189
|
+
*/
|
|
190
|
+
private renderBareBranch;
|
|
138
191
|
private wrapWithCondMarker;
|
|
139
192
|
renderLoop(loop: IRLoop): string;
|
|
140
193
|
private renderChildrenInLoop;
|
|
@@ -180,6 +233,18 @@ export declare class HonoAdapter extends JsxAdapter implements IRNodeEmitter<Hon
|
|
|
180
233
|
private renderAttributes;
|
|
181
234
|
private renderComponentProps;
|
|
182
235
|
private attrValueToJsExpr;
|
|
236
|
+
/**
|
|
237
|
+
* Hono runs JS at SSR time, so a structured template can be
|
|
238
|
+
* re-materialised as the equivalent runtime JS — a `${MAP[KEY]}` lookup
|
|
239
|
+
* becomes an indexed access against the resolved cases, runtime-identical
|
|
240
|
+
* to the client emit path. Delegates to the single renderer shared with
|
|
241
|
+
* that path and with the IR-time component-prop collapse, which also adds
|
|
242
|
+
* the `preserveTypes` index annotation for this .tsx output (#2565).
|
|
243
|
+
*
|
|
244
|
+
* The parts' RAW keys/conditions are used (not their `templateX`
|
|
245
|
+
* projections) because this output runs inside the destructured-prop
|
|
246
|
+
* scope of the emitted component.
|
|
247
|
+
*/
|
|
183
248
|
private renderTemplateLiteralParts;
|
|
184
249
|
}
|
|
185
250
|
export declare const honoAdapter: HonoAdapter;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hono-adapter.d.ts","sourceRoot":"","sources":["../../src/adapter/hono-adapter.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EACL,KAAK,WAAW,EAChB,KAAK,MAAM,EACX,KAAK,SAAS,EACd,KAAK,MAAM,EACX,KAAK,YAAY,EACjB,KAAK,aAAa,EAClB,KAAK,MAAM,EACX,KAAK,WAAW,EAChB,KAAK,UAAU,EACf,KAAK,aAAa,EAClB,KAAK,UAAU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