@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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sigil-dev/compiler",
3
- "version": "0.2.0",
3
+ "version": "0.4.0",
4
4
  "exports": "./index.ts",
5
5
  "publish": {
6
6
  "exclude": ["src/**/*.test.ts"]
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@sigil-dev/compiler",
3
3
  "module": "index.ts",
4
4
  "type": "module",
5
- "version": "0.3.0",
5
+ "version": "0.4.0",
6
6
  "private": false,
7
7
  "description": "Compiler for the Sigil framework",
8
8
  "peerDependencies": {
@@ -151,19 +151,15 @@ export function processElement(
151
151
  );
152
152
  }
153
153
  seenAttrs.add(realAttr);
154
- if (attrName.startsWith("use:")) {
155
- // use:directive or use:directive={params}
156
- const directiveName = attrName.slice(4);
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"), args),
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)) {
@@ -139,7 +139,8 @@ export function processElementSSR(
139
139
  }
140
140
  // drop event handlers
141
141
  if (attrName.startsWith("on")) continue;
142
- // drop bind:* - no two-way binding on server
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;