@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.
- package/dist/adapter/__tests__/boolean-result.test.d.ts +2 -0
- package/dist/adapter/__tests__/boolean-result.test.d.ts.map +1 -0
- package/dist/adapter/boolean-result.d.ts +42 -0
- package/dist/adapter/boolean-result.d.ts.map +1 -0
- package/dist/adapter/index.d.ts +6 -0
- package/dist/adapter/index.d.ts.map +1 -0
- package/dist/adapter/index.js +1143 -0
- package/dist/adapter/mojo-adapter.d.ts +219 -0
- package/dist/adapter/mojo-adapter.d.ts.map +1 -0
- package/dist/build.d.ts +28 -0
- package/dist/build.d.ts.map +1 -0
- package/dist/build.js +1163 -0
- package/dist/index.d.ts +8 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +1143 -0
- package/dist/test-render.d.ts +38 -0
- package/dist/test-render.d.ts.map +1 -0
- package/lib/BarefootJS.pm +745 -0
- package/lib/Mojolicious/Plugin/BarefootJS/DevReload.pm +150 -0
- package/lib/Mojolicious/Plugin/BarefootJS.pm +104 -0
- package/package.json +65 -0
- package/src/__tests__/mojo-adapter.test.ts +940 -0
- package/src/__tests__/mojo-streaming.test.ts +136 -0
- package/src/__tests__/scaffold.test.ts +224 -0
- package/src/__tests__/template-base-name.test.ts +26 -0
- package/src/adapter/__tests__/boolean-result.test.ts +106 -0
- package/src/adapter/boolean-result.ts +126 -0
- package/src/adapter/index.ts +6 -0
- package/src/adapter/mojo-adapter.ts +1931 -0
- package/src/build.ts +37 -0
- package/src/index.ts +8 -0
- package/src/test-render.ts +704 -0
|
@@ -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 @@
|
|
|
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"}
|