@firsthandjs/compiler 0.10.0 → 0.10.1
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/{chunk-JEIWCE46.js → chunk-SRIXSLZ7.js} +18 -2
- package/dist/index.js +1 -1
- package/dist/jsx.d.ts.map +1 -1
- package/dist/marks.d.ts +24 -0
- package/dist/marks.d.ts.map +1 -1
- package/dist/runs.d.ts.map +1 -1
- package/dist/vite.js +1 -1
- package/package.json +1 -1
|
@@ -101,6 +101,16 @@ function generated(arrow) {
|
|
|
101
101
|
arrow[GENERATED] = true;
|
|
102
102
|
return arrow;
|
|
103
103
|
}
|
|
104
|
+
var THROUGH_RUN = /* @__PURE__ */ Symbol("firsthand.throughRun");
|
|
105
|
+
function throughRun(child) {
|
|
106
|
+
if (!t.isCallExpression(child)) {
|
|
107
|
+
return;
|
|
108
|
+
}
|
|
109
|
+
const [argument] = child.arguments;
|
|
110
|
+
if (t.isArrowFunctionExpression(argument)) {
|
|
111
|
+
argument[THROUGH_RUN] = true;
|
|
112
|
+
}
|
|
113
|
+
}
|
|
104
114
|
var LIST_CALL = /* @__PURE__ */ Symbol("firsthand.list");
|
|
105
115
|
function isKeyedList(node) {
|
|
106
116
|
return t.isCallExpression(node) && LIST_CALL in node;
|
|
@@ -1048,7 +1058,7 @@ function isComponentCall(path) {
|
|
|
1048
1058
|
}
|
|
1049
1059
|
function enclosingRun(path, state) {
|
|
1050
1060
|
let fn = path.getFunctionParent();
|
|
1051
|
-
while (fn !== null && GENERATED in fn.node) {
|
|
1061
|
+
while (fn !== null && (GENERATED in fn.node || THROUGH_RUN in fn.node)) {
|
|
1052
1062
|
fn = fn.getFunctionParent();
|
|
1053
1063
|
}
|
|
1054
1064
|
if (fn === null) {
|
|
@@ -1585,7 +1595,13 @@ function keptPrologue(kept, state) {
|
|
|
1585
1595
|
// packages/compiler/src/jsx.ts
|
|
1586
1596
|
function compileNode(path, state) {
|
|
1587
1597
|
if (path.isJSXFragment()) {
|
|
1588
|
-
|
|
1598
|
+
const children = compileChildren(path.node.children, state);
|
|
1599
|
+
if (enclosingRun(path, state) !== null) {
|
|
1600
|
+
for (const child of children) {
|
|
1601
|
+
throughRun(child);
|
|
1602
|
+
}
|
|
1603
|
+
}
|
|
1604
|
+
return t14.arrayExpression(children);
|
|
1589
1605
|
}
|
|
1590
1606
|
const node = path.node;
|
|
1591
1607
|
if (isComponentTag(node)) {
|
package/dist/index.js
CHANGED
package/dist/jsx.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"jsx.d.ts","sourceRoot":"","sources":["../src/jsx.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAEhD,OAAO,KAAK,CAAC,MAAM,cAAc,CAAC;AAqBlC,OAAO,EAA4B,KAAK,KAAK,EAAE,MAAM,YAAY,CAAC;AAIlE,wBAAgB,WAAW,CACzB,IAAI,EAAE,QAAQ,CAAC,CAAC,CAAC,UAAU,GAAG,CAAC,CAAC,WAAW,CAAC,EAC5C,KAAK,EAAE,KAAK,GACX,CAAC,CAAC,UAAU,
|
|
1
|
+
{"version":3,"file":"jsx.d.ts","sourceRoot":"","sources":["../src/jsx.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAEhD,OAAO,KAAK,CAAC,MAAM,cAAc,CAAC;AAqBlC,OAAO,EAA4B,KAAK,KAAK,EAAE,MAAM,YAAY,CAAC;AAIlE,wBAAgB,WAAW,CACzB,IAAI,EAAE,QAAQ,CAAC,CAAC,CAAC,UAAU,GAAG,CAAC,CAAC,WAAW,CAAC,EAC5C,KAAK,EAAE,KAAK,GACX,CAAC,CAAC,UAAU,CAmBd;AA6ND;;;;;;;;;GASG;AACH,wBAAgB,eAAe,CAC7B,QAAQ,EAAE,CAAC,CAAC,UAAU,CAAC,UAAU,CAAC,EAClC,KAAK,EAAE,KAAK,EACZ,IAAI,CAAC,EAAE,IAAI,GACV,CAAC,CAAC,UAAU,EAAE,CAuBhB;AAED;;;;;;GAMG;AACH,KAAK,IAAI,GAAG;IACV,iEAAiE;IACjE,OAAO,CAAC,KAAK,EAAE,CAAC,CAAC,UAAU,GAAG,OAAO,CAAC;IACtC,uEAAuE;IACvE,IAAI,CAAC,KAAK,EAAE,CAAC,CAAC,UAAU,GAAG,CAAC,CAAC,UAAU,CAAC;IACxC,gEAAgE;IAChE,KAAK,CAAC,KAAK,EAAE,CAAC,CAAC,UAAU,GAAG,CAAC,CAAC,UAAU,CAAC;CAC1C,CAAC"}
|
package/dist/marks.d.ts
CHANGED
|
@@ -24,6 +24,30 @@ export declare const CHILD_THUNK: unique symbol;
|
|
|
24
24
|
*/
|
|
25
25
|
export declare const GENERATED: unique symbol;
|
|
26
26
|
export declare function generated(arrow: t.ArrowFunctionExpression): t.ArrowFunctionExpression;
|
|
27
|
+
/**
|
|
28
|
+
* Marks a child thunk that is written again on every run (#47).
|
|
29
|
+
*
|
|
30
|
+
* A thunk is the compiler's own wrapper, so it is never a scope the author
|
|
31
|
+
* wrote — but it is not always a place a run reaches either. In a kept
|
|
32
|
+
* template the part around it is made on the first run and never again, and
|
|
33
|
+
* what is inside it belongs to that part. In a fragment a run returns, the
|
|
34
|
+
* array and every part in it are built afresh each time, so the thunk *is*
|
|
35
|
+
* reached on every run and the markup in it belongs to the run rather than to
|
|
36
|
+
* the wrapper.
|
|
37
|
+
*
|
|
38
|
+
* Only the second kind carries this mark, and only `enclosingRun` reads it.
|
|
39
|
+
*/
|
|
40
|
+
export declare const THROUGH_RUN: unique symbol;
|
|
41
|
+
/**
|
|
42
|
+
* Marks the thunk inside a compiled child, if it has one.
|
|
43
|
+
*
|
|
44
|
+
* Takes the child a `compileChildren` produced — `part(() => …)`, `part(list)`
|
|
45
|
+
* or a plain string — and finds the thunk to mark, because a keyed list has no
|
|
46
|
+
* thunk to see through and a static child has nothing in it to keep. An arrow
|
|
47
|
+
* in that position is always the thunk: `compileChildren` puts nothing else
|
|
48
|
+
* there.
|
|
49
|
+
*/
|
|
50
|
+
export declare function throughRun(child: t.Expression): void;
|
|
27
51
|
/** Marks a call the map rewrite produced, so it is not wrapped in a thunk. */
|
|
28
52
|
export declare const LIST_CALL: unique symbol;
|
|
29
53
|
/** Whether an expression is the keyed-list call `rewriteKeyedMaps` produced. */
|
package/dist/marks.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"marks.d.ts","sourceRoot":"","sources":["../src/marks.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,CAAC,MAAM,cAAc,CAAC;AAElC;;;;;;GAMG;AACH,eAAO,MAAM,WAAW,eAAiC,CAAC;AAE1D;;;;;;GAMG;AACH,eAAO,MAAM,SAAS,eAAgC,CAAC;AAEvD,wBAAgB,SAAS,CAAC,KAAK,EAAE,CAAC,CAAC,uBAAuB,GAAG,CAAC,CAAC,uBAAuB,CAGrF;AAED,8EAA8E;AAC9E,eAAO,MAAM,SAAS,eAA2B,CAAC;AAElD,gFAAgF;AAChF,wBAAgB,WAAW,CAAC,IAAI,EAAE,CAAC,CAAC,IAAI,GAAG,OAAO,CAEjD"}
|
|
1
|
+
{"version":3,"file":"marks.d.ts","sourceRoot":"","sources":["../src/marks.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,CAAC,MAAM,cAAc,CAAC;AAElC;;;;;;GAMG;AACH,eAAO,MAAM,WAAW,eAAiC,CAAC;AAE1D;;;;;;GAMG;AACH,eAAO,MAAM,SAAS,eAAgC,CAAC;AAEvD,wBAAgB,SAAS,CAAC,KAAK,EAAE,CAAC,CAAC,uBAAuB,GAAG,CAAC,CAAC,uBAAuB,CAGrF;AAED;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,WAAW,eAAiC,CAAC;AAE1D;;;;;;;;GAQG;AACH,wBAAgB,UAAU,CAAC,KAAK,EAAE,CAAC,CAAC,UAAU,GAAG,IAAI,CAQpD;AAED,8EAA8E;AAC9E,eAAO,MAAM,SAAS,eAA2B,CAAC;AAElD,gFAAgF;AAChF,wBAAgB,WAAW,CAAC,IAAI,EAAE,CAAC,CAAC,IAAI,GAAG,OAAO,CAEjD"}
|
package/dist/runs.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"runs.d.ts","sourceRoot":"","sources":["../src/runs.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAEhD,OAAO,KAAK,CAAC,MAAM,cAAc,CAAC;AAMlC,OAAO,EAAW,KAAK,KAAK,EAAE,KAAK,UAAU,EAAE,KAAK,KAAK,EAAE,MAAM,YAAY,CAAC;AAE9E;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,YAAY,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAC,CAAC,OAAO,CAAC,EAAE,KAAK,EAAE,KAAK,GAAG,IAAI,CAiB7E;AA6BD;;;;;;;GAOG;AACH,wBAAgB,WAAW,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC,CAAC,UAAU,CAAC,EAAE,KAAK,EAAE,KAAK,GAAG,OAAO,CAuB/E;AAED;;;;;;GAMG;AACH,wBAAgB,WAAW,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAC,CAAC,OAAO,CAAC,EAAE,KAAK,EAAE,KAAK,GAAG,IAAI,CAM5E;AAwGD,uEAAuE;AACvE,wBAAgB,YAAY,CAAC,IAAI,EAAE,QAAQ,EAAE,KAAK,EAAE,KAAK,GAAG,UAAU,GAAG,IAAI,
|
|
1
|
+
{"version":3,"file":"runs.d.ts","sourceRoot":"","sources":["../src/runs.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,QAAQ,EAAE,MA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