@barefootjs/mojolicious 0.1.0

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.
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=boolean-result.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"boolean-result.test.d.ts","sourceRoot":"","sources":["../../../src/adapter/__tests__/boolean-result.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,42 @@
1
+ /**
2
+ * Structural classifier for JS expressions whose result is a boolean
3
+ * value (or unambiguously stringifies to "true"/"false" in JS).
4
+ *
5
+ * Used by the Mojo adapter's `emitExpression` to decide whether to
6
+ * route a reactive attribute binding through the `bf->bool_str` Perl
7
+ * runtime helper (#1466 follow-up). Perl has no native boolean type;
8
+ * `($count > 0)` evaluates to `''` / `1`, not `"false"` / `"true"`,
9
+ * so the literal stringification diverges from Hono / Go. Wrapping
10
+ * the value with `bool_str` realigns the serialised attribute with
11
+ * JS `String(boolean)` semantics.
12
+ *
13
+ * The classifier walks a `ParsedExpr` produced by
14
+ * `@barefootjs/jsx::parseExpression` — same AST the filter / loop
15
+ * lowerings already use — so detection is structural rather than
16
+ * regex-text-matching. Wrapped expression text is left to the
17
+ * caller's existing `convertExpressionToPerl` pipeline; this module
18
+ * only decides whether to wrap.
19
+ *
20
+ * Detected shapes:
21
+ * - `binary` with a comparison operator (`<`, `>`, `<=`, `>=`,
22
+ * `==`, `===`, `!=`, `!==`)
23
+ * - `unary` with logical `!`
24
+ * - `literal` with `literalType: 'boolean'`
25
+ * - `logical` (`&&` / `||` / `??`) when both sides are themselves
26
+ * boolean-result (catches `x > 0 && y < 10`; intentionally does
27
+ * NOT catch `x() || 'fallback'` whose right side stringifies as
28
+ * a regular value)
29
+ * - `conditional` (`?:`) when both branches are themselves
30
+ * boolean-result
31
+ *
32
+ * Anything else returns `false` — including bare identifiers
33
+ * (`accepted`) and call expressions (`accepted()`) whose return type
34
+ * the adapter has no way to infer from source text alone. Those
35
+ * carry their own (Perl-coerced) value through unchanged, which
36
+ * stays correct for non-boolean shapes and is handled by
37
+ * `normalizeHTML`'s `aria-*="0"` rule for the specific Mojo-Perl
38
+ * `aria-*={booleanFn()}` divergence.
39
+ */
40
+ export declare function isBooleanResultExpr(expr: string): boolean;
41
+ export declare function isAriaBooleanAttr(name: string): boolean;
42
+ //# sourceMappingURL=boolean-result.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"boolean-result.d.ts","sourceRoot":"","sources":["../../src/adapter/boolean-result.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsCG;AAwCH,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAIzD;AAyCD,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAEvD"}
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Mojolicious EP Template Adapter Exports
3
+ */
4
+ export { MojoAdapter, mojoAdapter } from './mojo-adapter';
5
+ export type { MojoAdapterOptions } from './mojo-adapter';
6
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/adapter/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAA;AACzD,YAAY,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAA"}