@sigil-dev/compiler 0.3.0 → 0.4.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/jsr.json +1 -1
- package/package.json +1 -1
- package/src/babel/jsx/element.ts +7 -11
- package/src/babel/jsx/ssr.ts +2 -1
package/jsr.json
CHANGED
package/package.json
CHANGED
package/src/babel/jsx/element.ts
CHANGED
|
@@ -151,19 +151,15 @@ export function processElement(
|
|
|
151
151
|
);
|
|
152
152
|
}
|
|
153
153
|
seenAttrs.add(realAttr);
|
|
154
|
-
if (attrName
|
|
155
|
-
// use
|
|
156
|
-
const
|
|
157
|
-
const args: t.Expression[] = [
|
|
158
|
-
t.identifier(varName),
|
|
159
|
-
t.identifier(directiveName),
|
|
160
|
-
];
|
|
161
|
-
if (t.isJSXExpressionContainer(attr.value)) {
|
|
162
|
-
args.push((attr.value as t.JSXExpressionContainer).expression as t.Expression);
|
|
163
|
-
}
|
|
154
|
+
if (attrName === "use") {
|
|
155
|
+
// use={directive} or use={[directive, params]}
|
|
156
|
+
const expr = (attr.value as t.JSXExpressionContainer).expression as t.Expression;
|
|
164
157
|
statements.push(
|
|
165
158
|
t.expressionStatement(
|
|
166
|
-
t.callExpression(t.identifier("applyDirective"),
|
|
159
|
+
t.callExpression(t.identifier("applyDirective"), [
|
|
160
|
+
t.identifier(varName),
|
|
161
|
+
expr,
|
|
162
|
+
]),
|
|
167
163
|
),
|
|
168
164
|
);
|
|
169
165
|
} else if (/^on[A-Z]/.test(attrName)) {
|
package/src/babel/jsx/ssr.ts
CHANGED
|
@@ -139,7 +139,8 @@ export function processElementSSR(
|
|
|
139
139
|
}
|
|
140
140
|
// drop event handlers
|
|
141
141
|
if (attrName.startsWith("on")) continue;
|
|
142
|
-
// drop
|
|
142
|
+
// drop client-only props
|
|
143
|
+
if (attrName === "use") continue;
|
|
143
144
|
if (attrName.startsWith("bind")) continue;
|
|
144
145
|
|
|
145
146
|
const domAttr = ATTR_MAP_SSR[attrName] ?? attrName;
|