@sola-air-ui/compiler 1.3.0 → 1.3.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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/index.js +8 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sola-air-ui/compiler",
3
- "version": "1.3.0",
3
+ "version": "1.3.1",
4
4
  "description": "Compiler for Sola single-file components (.sola) \u2014 transforms template + script + style to ES modules",
5
5
  "type": "module",
6
6
  "main": "./src/index.js",
package/src/index.js CHANGED
@@ -976,6 +976,14 @@ export function compile(source, options = {}) {
976
976
  edits.push({ start: call.end, end: call.end, replacement: ')' });
977
977
  }
978
978
 
979
+ // $effect(fn) as a bare statement: the form the docs show. It compiles to
980
+ // createEffect(fn); the declaration form (const stop = $effect(fn)) is below.
981
+ if (node.type === 'ExpressionStatement' && node.expression.type === 'CallExpression' &&
982
+ node.expression.callee.type === 'Identifier' && node.expression.callee.name === '$effect') {
983
+ const callee = node.expression.callee;
984
+ edits.push({ start: callee.start, end: callee.end, replacement: 'createEffect' });
985
+ }
986
+
979
987
  // $state()/$derived()/$effect()/$intent()/$data() macro declarations.
980
988
  // Bracket edits (head + tail) leave the argument expression in place so
981
989
  // the reactive rewrite pass below can still auto-call signals inside it.