@fluixi/compiler 1.0.0-alpha.83 → 1.0.0-alpha.85

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 (241) hide show
  1. package/dist/analyze/expr-shape.cjs +62 -1
  2. package/dist/analyze/expr-shape.d.cts +14 -0
  3. package/dist/analyze/expr-shape.d.ts +2 -2
  4. package/dist/analyze/expr-shape.js +1 -1
  5. package/dist/analyze/expr-shape.mjs +41 -1
  6. package/dist/analyze/intrinsics.cjs +80 -1
  7. package/dist/analyze/intrinsics.d.cts +66 -0
  8. package/dist/analyze/intrinsics.d.ts +7 -7
  9. package/dist/analyze/intrinsics.d.ts.map +1 -1
  10. package/dist/analyze/intrinsics.js +3 -3
  11. package/dist/analyze/intrinsics.mjs +59 -1
  12. package/dist/analyze/paren.cjs +134 -0
  13. package/dist/analyze/paren.d.cts +23 -0
  14. package/dist/analyze/paren.d.ts +24 -0
  15. package/dist/analyze/paren.d.ts.map +1 -0
  16. package/dist/analyze/paren.js +168 -0
  17. package/dist/analyze/paren.mjs +113 -0
  18. package/dist/analyze/props-destructure.cjs +226 -1
  19. package/dist/analyze/props-destructure.d.cts +83 -0
  20. package/dist/analyze/props-destructure.d.ts +3 -3
  21. package/dist/analyze/props-destructure.d.ts.map +1 -1
  22. package/dist/analyze/props-destructure.js +4 -4
  23. package/dist/analyze/props-destructure.mjs +205 -1
  24. package/dist/analyze/reactive-bindings.cjs +190 -1
  25. package/dist/analyze/reactive-bindings.d.cts +42 -0
  26. package/dist/analyze/reactive-bindings.d.ts +1 -1
  27. package/dist/analyze/reactive-bindings.js +2 -2
  28. package/dist/analyze/reactive-bindings.mjs +167 -1
  29. package/dist/analyze/reactive-expr.cjs +38 -1
  30. package/dist/analyze/reactive-expr.d.cts +38 -0
  31. package/dist/analyze/reactive-expr.d.ts +4 -4
  32. package/dist/analyze/reactive-expr.d.ts.map +1 -1
  33. package/dist/analyze/reactive-expr.js +2 -2
  34. package/dist/analyze/reactive-expr.mjs +17 -1
  35. package/dist/analyze/static-graph.cjs +811 -1
  36. package/dist/analyze/static-graph.d.cts +102 -0
  37. package/dist/analyze/static-graph.d.ts +1 -1
  38. package/dist/analyze/static-graph.d.ts.map +1 -1
  39. package/dist/analyze/static-graph.js +11 -11
  40. package/dist/analyze/static-graph.mjs +793 -1
  41. package/dist/babel-TGY76XJ7.mjs +636 -0
  42. package/dist/chunk-4PLHS2FP.mjs +158 -0
  43. package/dist/chunk-6DB5FXS4.mjs +1718 -0
  44. package/dist/chunk-F74GFKSL.mjs +16 -0
  45. package/dist/chunk-G6QC2WRJ.mjs +11 -0
  46. package/dist/chunk-RUDJDZAA.mjs +1078 -0
  47. package/dist/codegen/backend.cjs +18 -1
  48. package/dist/codegen/backend.d.cts +35 -0
  49. package/dist/codegen/backends/imperative.cjs +542 -1
  50. package/dist/codegen/backends/imperative.d.cts +11 -0
  51. package/dist/codegen/backends/imperative.d.ts +1 -1
  52. package/dist/codegen/backends/imperative.d.ts.map +1 -1
  53. package/dist/codegen/backends/imperative.js +24 -20
  54. package/dist/codegen/backends/imperative.mjs +519 -1
  55. package/dist/codegen/contract.cjs +52 -1
  56. package/dist/codegen/contract.d.cts +24 -0
  57. package/dist/codegen/contract.d.ts +2 -2
  58. package/dist/codegen/contract.js +2 -2
  59. package/dist/codegen/contract.mjs +31 -1
  60. package/dist/codegen/partial-template.cjs +176 -1
  61. package/dist/codegen/partial-template.d.cts +61 -0
  62. package/dist/codegen/partial-template.d.ts +4 -4
  63. package/dist/codegen/partial-template.js +0 -0
  64. package/dist/codegen/partial-template.mjs +153 -1
  65. package/dist/codegen/serialize-static.cjs +125 -1
  66. package/dist/codegen/serialize-static.d.cts +38 -0
  67. package/dist/codegen/serialize-static.d.ts +3 -3
  68. package/dist/codegen/serialize-static.js +6 -6
  69. package/dist/codegen/serialize-static.mjs +104 -1
  70. package/dist/frontend/babel/build-ir-lit.cjs +1509 -1
  71. package/dist/frontend/babel/build-ir-lit.d.cts +26 -0
  72. package/dist/frontend/babel/build-ir-lit.d.ts +2 -2
  73. package/dist/frontend/babel/build-ir-lit.mjs +1478 -1
  74. package/dist/frontend/babel/build-ir.cjs +1524 -1
  75. package/dist/frontend/babel/build-ir.d.cts +35 -0
  76. package/dist/frontend/babel/build-ir.d.ts +2 -2
  77. package/dist/frontend/babel/build-ir.js +2 -2
  78. package/dist/frontend/babel/build-ir.mjs +1495 -1
  79. package/dist/frontend/babel/index.cjs +2186 -1
  80. package/dist/frontend/babel/index.d.cts +33 -0
  81. package/dist/frontend/babel/index.d.ts +1 -1
  82. package/dist/frontend/babel/index.js +1 -1
  83. package/dist/frontend/babel/index.mjs +2156 -1
  84. package/dist/frontend/babel/lower-template.cjs +1507 -1
  85. package/dist/frontend/babel/lower-template.d.cts +23 -0
  86. package/dist/frontend/babel/lower-template.d.ts +1 -1
  87. package/dist/frontend/babel/lower-template.js +2 -2
  88. package/dist/frontend/babel/lower-template.mjs +1478 -1
  89. package/dist/frontend/babel/plugin.cjs +2132 -1
  90. package/dist/frontend/babel/plugin.d.cts +95 -0
  91. package/dist/frontend/babel/plugin.d.ts +5 -5
  92. package/dist/frontend/babel/plugin.d.ts.map +1 -1
  93. package/dist/frontend/babel/plugin.js +14 -14
  94. package/dist/frontend/babel/plugin.mjs +2103 -1
  95. package/dist/frontend/babel/server-functions.cjs +110 -1
  96. package/dist/frontend/babel/server-functions.d.cts +10 -0
  97. package/dist/frontend/babel/server-functions.mjs +89 -1
  98. package/dist/frontend/babel/types.cjs +18 -1
  99. package/dist/frontend/babel/types.d.cts +33 -0
  100. package/dist/frontend/types.cjs +18 -1
  101. package/dist/frontend/types.d.cts +25 -0
  102. package/dist/frontend/vocabulary.cjs +98 -0
  103. package/dist/frontend/vocabulary.d.cts +79 -0
  104. package/dist/frontend/vocabulary.d.ts +80 -0
  105. package/dist/frontend/vocabulary.d.ts.map +1 -0
  106. package/dist/frontend/vocabulary.js +124 -0
  107. package/dist/frontend/vocabulary.mjs +77 -0
  108. package/dist/index.cjs +1595 -14
  109. package/dist/index.d.cts +27 -0
  110. package/dist/index.d.ts +1 -1
  111. package/dist/index.js +4 -4
  112. package/dist/index.mjs +1575 -14
  113. package/dist/integrations.cjs +4312 -26
  114. package/dist/integrations.d.cts +215 -0
  115. package/dist/integrations.d.ts +9 -9
  116. package/dist/integrations.d.ts.map +1 -1
  117. package/dist/integrations.js +29 -8
  118. package/dist/integrations.mjs +536 -18
  119. package/dist/ir/nodes.cjs +18 -1
  120. package/dist/ir/nodes.d.cts +168 -0
  121. package/dist/ir/nodes.d.ts +6 -6
  122. package/dist/lower/compile-template.cjs +1356 -1
  123. package/dist/lower/compile-template.d.cts +69 -0
  124. package/dist/lower/compile-template.d.ts +3 -3
  125. package/dist/lower/compile-template.js +1 -1
  126. package/dist/lower/compile-template.mjs +1336 -1
  127. package/dist/lower/jsx.cjs +529 -1
  128. package/dist/lower/jsx.d.cts +25 -0
  129. package/dist/lower/jsx.d.ts +1 -1
  130. package/dist/lower/jsx.d.ts.map +1 -1
  131. package/dist/lower/jsx.js +6 -5
  132. package/dist/lower/jsx.mjs +506 -1
  133. package/dist/lower/template.cjs +1061 -1
  134. package/dist/lower/template.d.cts +53 -0
  135. package/dist/lower/template.d.ts +3 -3
  136. package/dist/lower/template.d.ts.map +1 -1
  137. package/dist/lower/template.js +12 -11
  138. package/dist/lower/template.mjs +1042 -1
  139. package/dist/lower/text.cjs +42 -1
  140. package/dist/lower/text.d.cts +10 -0
  141. package/dist/lower/text.d.ts +2 -2
  142. package/dist/lower/text.d.ts.map +1 -1
  143. package/dist/lower/text.js +2 -2
  144. package/dist/lower/text.mjs +21 -1
  145. package/dist/optimize/analyze-static.cjs +112 -1
  146. package/dist/optimize/analyze-static.d.cts +39 -0
  147. package/dist/optimize/analyze-static.d.ts +2 -2
  148. package/dist/optimize/analyze-static.js +2 -2
  149. package/dist/optimize/analyze-static.mjs +91 -1
  150. package/dist/optimize/collapse-strategies.cjs +90 -1
  151. package/dist/optimize/collapse-strategies.d.cts +30 -0
  152. package/dist/optimize/collapse-strategies.d.ts +3 -3
  153. package/dist/optimize/collapse-strategies.mjs +67 -1
  154. package/dist/options.cjs +33 -1
  155. package/dist/options.d.cts +39 -0
  156. package/dist/options.d.ts +2 -2
  157. package/dist/options.mjs +12 -1
  158. package/dist/resolve/builtins.cjs +73 -1
  159. package/dist/resolve/builtins.d.cts +68 -0
  160. package/dist/resolve/builtins.d.ts +8 -8
  161. package/dist/resolve/builtins.d.ts.map +1 -1
  162. package/dist/resolve/builtins.js +4 -4
  163. package/dist/resolve/builtins.mjs +53 -1
  164. package/dist/resolve/component-globals.cjs +234 -14
  165. package/dist/resolve/component-globals.d.cts +80 -0
  166. package/dist/resolve/component-globals.d.ts +5 -5
  167. package/dist/resolve/component-globals.js +10 -10
  168. package/dist/resolve/component-globals.mjs +211 -14
  169. package/dist/resolve/component-resolver.cjs +80 -1
  170. package/dist/resolve/component-resolver.d.cts +68 -0
  171. package/dist/resolve/component-resolver.d.ts +3 -3
  172. package/dist/resolve/component-resolver.d.ts.map +1 -1
  173. package/dist/resolve/component-resolver.js +3 -3
  174. package/dist/resolve/component-resolver.mjs +59 -1
  175. package/dist/resolve/load-directive.cjs +93 -1
  176. package/dist/resolve/load-directive.d.cts +53 -0
  177. package/dist/resolve/load-directive.d.ts +5 -5
  178. package/dist/resolve/load-directive.js +6 -6
  179. package/dist/resolve/load-directive.mjs +72 -1
  180. package/dist/resolve/resolve-ir.cjs +108 -1
  181. package/dist/resolve/resolve-ir.d.cts +53 -0
  182. package/dist/resolve/resolve-ir.d.ts +6 -6
  183. package/dist/resolve/resolve-ir.d.ts.map +1 -1
  184. package/dist/resolve/resolve-ir.js +1 -1
  185. package/dist/resolve/resolve-ir.mjs +85 -1
  186. package/dist/resolve/write-globals.cjs +319 -14
  187. package/dist/resolve/write-globals.d.cts +30 -0
  188. package/dist/resolve/write-globals.js +2 -2
  189. package/dist/resolve/write-globals.mjs +298 -14
  190. package/dist/server-fns-ZYWQTSZU.mjs +78 -0
  191. package/dist/server-functions-PCERFA7A.mjs +82 -0
  192. package/dist/transform/bindings.cjs +71 -1
  193. package/dist/transform/bindings.d.cts +16 -0
  194. package/dist/transform/bindings.d.ts +1 -1
  195. package/dist/transform/bindings.js +1 -1
  196. package/dist/transform/bindings.mjs +50 -1
  197. package/dist/transform/index.cjs +2732 -8
  198. package/dist/transform/index.d.cts +15 -0
  199. package/dist/transform/index.mjs +3773 -17
  200. package/dist/transform/intrinsics.cjs +216 -3
  201. package/dist/transform/intrinsics.d.cts +21 -0
  202. package/dist/transform/intrinsics.js +1 -1
  203. package/dist/transform/intrinsics.mjs +193 -3
  204. package/dist/transform/props.cjs +441 -3
  205. package/dist/transform/props.d.cts +45 -0
  206. package/dist/transform/props.d.ts +1 -1
  207. package/dist/transform/props.d.ts.map +1 -1
  208. package/dist/transform/props.js +4 -4
  209. package/dist/transform/props.mjs +1482 -12
  210. package/dist/transform/server-fn-id.cjs +35 -1
  211. package/dist/transform/server-fn-id.d.cts +9 -0
  212. package/dist/transform/server-fn-id.d.ts +1 -1
  213. package/dist/transform/server-fn-id.js +2 -2
  214. package/dist/transform/server-fn-id.mjs +14 -1
  215. package/dist/transform/server-fns.cjs +114 -2
  216. package/dist/transform/server-fns.d.cts +12 -0
  217. package/dist/transform/server-fns.js +3 -3
  218. package/dist/transform/server-fns.mjs +1155 -11
  219. package/dist/transform/source-locations.cjs +330 -1
  220. package/dist/transform/source-locations.d.cts +43 -0
  221. package/dist/transform/source-locations.d.ts +1 -1
  222. package/dist/transform/source-locations.js +5 -5
  223. package/dist/transform/source-locations.mjs +307 -1
  224. package/dist/transform/templates.cjs +2701 -7
  225. package/dist/transform/templates.d.cts +69 -0
  226. package/dist/transform/templates.d.ts +2 -2
  227. package/dist/transform/templates.d.ts.map +1 -1
  228. package/dist/transform/templates.js +7 -7
  229. package/dist/transform/templates.mjs +3743 -16
  230. package/dist/transform-RWDTQUF5.mjs +893 -0
  231. package/dist/tsconfig.lib.tsbuildinfo +1 -1
  232. package/package.json +6 -5
  233. package/dist/babel-VXKH6MRQ.mjs +0 -1
  234. package/dist/chunk-3SAEGOMQ.mjs +0 -1
  235. package/dist/chunk-5KMMN5QP.mjs +0 -1
  236. package/dist/chunk-IBRM4W7I.mjs +0 -10
  237. package/dist/chunk-OHHZCYIQ.mjs +0 -1
  238. package/dist/chunk-YKZ54NVE.mjs +0 -1
  239. package/dist/server-fns-6QM243HC.mjs +0 -2
  240. package/dist/server-functions-E3LKCZ4R.mjs +0 -1
  241. package/dist/transform-C4ZXRVGP.mjs +0 -8
@@ -1,3 +1,441 @@
1
- "use strict";var $=Object.create;var h=Object.defineProperty;var L=Object.getOwnPropertyDescriptor;var T=Object.getOwnPropertyNames;var F=Object.getPrototypeOf,V=Object.prototype.hasOwnProperty;var J=(e,n)=>{for(var t in n)h(e,t,{get:n[t],enumerable:!0})},D=(e,n,t,s)=>{if(n&&typeof n=="object"||typeof n=="function")for(let r of T(n))!V.call(e,r)&&r!==t&&h(e,r,{get:()=>n[r],enumerable:!(s=L(n,r))||s.enumerable});return e};var U=(e,n,t)=>(t=e!=null?$(F(e)):{},D(n||!e||!e.__esModule?h(t,"default",{value:e,enumerable:!0}):t,e)),W=e=>D(h({},"__esModule",{value:!0}),e);var Q={};J(Q,{collectPropsEdits:()=>M,transformProps:()=>K});module.exports=W(Q);var A=require("@babel/parser"),C=U(require("magic-string"),1);function l(e,n){if(e)switch(e.type){case"Identifier":n.add(e.name);return;case"ObjectPattern":for(let t of e.properties)t.type==="RestElement"?l(t.argument,n):l(t.value,n);return;case"ArrayPattern":for(let t of e.elements)l(t,n);return;case"AssignmentPattern":l(e.left,n);return;case"RestElement":l(e.argument,n);return}}function P(e){switch(e.type){case"StringLiteral":case"NumericLiteral":case"BooleanLiteral":case"NullLiteral":case"BigIntLiteral":case"RegExpLiteral":case"Identifier":return!0;case"Literal":return!0;case"TemplateLiteral":return e.expressions.every(P);case"UnaryExpression":return P(e.argument);case"MemberExpression":return!1;default:return!1}}function b(e,n){if(!(!e||typeof e!="object")){n(e);for(let t of Object.keys(e)){if(t==="loc"||t==="range"||t==="leadingComments"||t==="trailingComments")continue;let s=e[t];if(Array.isArray(s))for(let r of s)r&&typeof r=="object"&&b(r,n);else s&&typeof s=="object"&&typeof s.type=="string"&&b(s,n)}}}function Z(e){let n=new Set;return b(e,t=>{if(t.type==="AssignmentExpression")l(t.left,n);else if(t.type==="UpdateExpression"){let s=t.argument;s?.type==="Identifier"&&n.add(s.name)}}),n}function _(e,n){let t=new Set,s=r=>{let u=new Set;l(r,u);for(let c of u)n.has(c)&&t.add(c)};return b(e,r=>{switch(r.type){case"VariableDeclarator":s(r.id);return;case"FunctionDeclaration":case"FunctionExpression":case"ArrowFunctionExpression":s(r.id);for(let u of r.params??[])s(u);return;case"CatchClause":s(r.param);return;case"ClassDeclaration":case"ClassExpression":s(r.id);return}}),t}function E(e,n,t){for(let s of e.properties??[]){if(s.type==="RestElement"){let d=s.argument;if(d?.type!=="Identifier"||n.length>0){let f=new Set;l(d,f);for(let w of f)t.bails.push({name:w,reason:"rest"});continue}t.rest={name:d.name,keys:[]};continue}if(s.computed){let d=new Set;l(s.value,d);for(let f of d)t.bails.push({name:f,reason:"computed"});continue}let r=s.key,u=r.type==="Identifier"?r.name:r.value,c=s.value,a;c.type==="AssignmentPattern"&&(a=c.right,c=c.left);let i=[...n,u];if(c.type==="Identifier"){if(a&&!P(a)){t.bails.push({name:c.name,reason:"unsafe-default"});continue}t.reads.push({name:c.name,path:i,...a?{fallback:a}:{}});continue}if(c.type==="ObjectPattern"){if(a){let d=new Set;l(c,d);for(let f of d)t.bails.push({name:f,reason:"unsafe-default"});continue}E(c,i,t);continue}let N=new Set;l(c,N);for(let d of N)t.bails.push({name:d,reason:"computed"})}}function v(e,n){let t={reads:[],bails:[]};if(e?.type!=="ObjectPattern"||(E(e,[],t),t.rest&&(n?.type!=="BlockStatement"?(t.bails.push({name:t.rest.name,reason:"rest"}),delete t.rest):t.rest.keys=(e.properties??[]).filter(a=>a.type!=="RestElement"&&!a.computed).map(a=>{let i=a.key;return i.type==="Identifier"?i.name:i.value})),t.reads.length===0&&!t.rest))return t;let s=new Set(t.reads.map(a=>a.name));t.rest&&s.add(t.rest.name);let r=Z(n),u=_(n,s),c=[];for(let a of t.reads)r.has(a.name)?t.bails.push({name:a.name,reason:"reassigned"}):u.has(a.name)?t.bails.push({name:a.name,reason:"shadowed"}):c.push(a);return t.reads=c,t.rest&&r.has(t.rest.name)?(t.bails.push({name:t.rest.name,reason:"reassigned"}),delete t.rest):t.rest&&u.has(t.rest.name)&&(t.bails.push({name:t.rest.name,reason:"shadowed"}),delete t.rest),t}function R(e){switch(e){case"rest":return"this rest element cannot be served by splitProps, and copying the props into a plain object would lose the getters";case"computed":return"the property is not known until it runs";case"reassigned":return"the binding is assigned to, and props are read-only";case"shadowed":return"an inner scope binds the same name";case"unsafe-default":return"the default would have to run again on every read"}}function g(e,n){if(e)switch(e.type){case"Identifier":n.add(e.name);return;case"ObjectPattern":for(let t of e.properties)t.type==="RestElement"?g(t.argument,n):g(t.value,n);return;case"ArrayPattern":for(let t of e.elements)g(t,n);return;case"AssignmentPattern":g(e.left,n);return;case"RestElement":g(e.argument,n);return}}function j(e,n){switch(e.type){case"ImportDeclaration":for(let t of e.specifiers)g(t.local,n);return;case"VariableDeclaration":for(let t of e.declarations)g(t.id,n);return;case"FunctionDeclaration":case"ClassDeclaration":g(e.id,n);return;case"ExportNamedDeclaration":case"ExportDefaultDeclaration":e.declaration&&j(e.declaration,n);return}}function O(e){let n=new Set;for(let t of e.body)j(t,n);return n}function y(e,n,t=null){if(!(!e||typeof e!="object"||typeof e.type!="string")&&!e.type.startsWith("TS")&&n(e,t)!==!1)for(let s of Object.keys(e)){if(s==="loc"||s==="leadingComments"||s==="trailingComments")continue;let r=e[s];if(Array.isArray(r))for(let u of r)y(u,n,e);else r&&typeof r=="object"&&y(r,n,e)}}function I(e){return!!e&&e[0]>="A"&&e[0]<="Z"}function q(e){let n=[];return y(e,t=>{if(t.type==="FunctionDeclaration"&&I(t.id?.name)){n.push(t);return}if(t.type==="VariableDeclarator"&&I(t.id?.name)){let s=t.init;s&&(s.type==="ArrowFunctionExpression"||s.type==="FunctionExpression")&&n.push(s)}}),n}function z(e){let n=new Set;return y(e,t=>{t.type==="Identifier"&&n.add(t.name)}),n}function G(e,n){if(!n)return!0;switch(n.type){case"MemberExpression":case"OptionalMemberExpression":return!(n.property===e&&!n.computed);case"ObjectProperty":case"ObjectMethod":case"ClassProperty":case"ClassMethod":return!(n.key===e&&!n.computed);case"LabeledStatement":case"BreakStatement":case"ContinueStatement":return n.label!==e;case"ImportSpecifier":case"ExportSpecifier":return!1;default:return!0}}function M(e,n,t={}){let s=[],r=[],u=new Set;for(let c of q(e)){let a=c.params?.[0];if(a?.type!=="ObjectPattern")continue;let i=v(a,c.body);for(let o of i.bails)r.push({name:o.name,reason:o.reason,message:R(o.reason),start:a.start});if(i.bails.length>0||i.reads.length===0&&!i.rest)continue;let N=z(c),d=t.parameterName??"props";for(;N.has(d);)d=`_${d}`;let f=new Map;for(let o of i.reads){let p=`${d}.${o.path.join(".")}`,m=o.fallback;f.set(o.name,m?`(${p} === undefined ? ${n.slice(m.start,m.end)} : ${p})`:p)}let w=a.typeAnnotation;if(s.push({start:a.start,end:w?.start??a.end,code:d}),i.rest){let o=i.rest.keys.map(m=>JSON.stringify(m)).join(", "),p=c.body;s.push({start:p.start+1,end:p.start+1,code:`
2
- const [, ${i.rest.name}] = splitProps(${d}, [${o}]);`}),u.add("splitProps")}let k=[];y(c.body,(o,p)=>{if(o.type!=="Identifier")return;let m=f.get(o.name);if(!m)return;let x=p?.type==="ObjectProperty"&&p.shorthand&&p.value===o;if(!x&&!G(o,p))return;let S=i.reads.find(B=>B.name===o.name).path;k.push({node:o,parent:x?p:null,text:m,property:S[S.length-1]})});for(let o of k)o.parent?s.push({start:o.parent.start,end:o.parent.end,code:`${o.node.name}: ${o.text}`}):s.push({start:o.node.start,end:o.node.end,code:o.text}),H(o.node,d,o.property)}return{edits:s,diagnostics:r,used:u}}function H(e,n,t){e.type="MemberExpression",e.computed=!1,e.optional=!1,e.object={type:"Identifier",name:n,start:e.start,end:e.start},e.property={type:"Identifier",name:t,start:e.end,end:e.end},delete e.name}function K(e,n="module.tsx",t={}){let s=(0,A.parse)(e,{sourceType:"module",plugins:["typescript","jsx"],errorRecovery:!0}),{edits:r,diagnostics:u,used:c}=M(s.program,e,t),a=new C.default(e);for(let i of r)i.start===i.end?a.appendLeft(i.start,i.code):a.overwrite(i.start,i.end,i.code);return c.has("splitProps")&&!O(s.program).has("splitProps")&&a.prepend(`import { splitProps } from ${JSON.stringify(t.runtimeModule??"@fluixi/dom")};
3
- `),{code:a.toString(),map:a.generateMap({source:n,includeContent:!0,hires:!0}),diagnostics:u,rewritten:r.filter(i=>i.code!==(t.parameterName??"props")).length}}
1
+ "use strict";
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __export = (target, all) => {
9
+ for (var name in all)
10
+ __defProp(target, name, { get: all[name], enumerable: true });
11
+ };
12
+ var __copyProps = (to, from, except, desc) => {
13
+ if (from && typeof from === "object" || typeof from === "function") {
14
+ for (let key of __getOwnPropNames(from))
15
+ if (!__hasOwnProp.call(to, key) && key !== except)
16
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
+ }
18
+ return to;
19
+ };
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ // If the importer is in node compatibility mode or this is not an ESM
22
+ // file that has been converted to a CommonJS file using a Babel-
23
+ // compatible transform (i.e. "__esModule" has not been set), then set
24
+ // "default" to the CommonJS "module.exports" for node compatibility.
25
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
+ mod
27
+ ));
28
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
+
30
+ // src/transform/props.ts
31
+ var props_exports = {};
32
+ __export(props_exports, {
33
+ collectPropsEdits: () => collectPropsEdits,
34
+ transformProps: () => transformProps
35
+ });
36
+ module.exports = __toCommonJS(props_exports);
37
+ var import_parser = require("@babel/parser");
38
+ var import_magic_string = __toESM(require("magic-string"), 1);
39
+
40
+ // src/analyze/props-destructure.ts
41
+ function patternNames(node, out) {
42
+ if (!node) return;
43
+ switch (node.type) {
44
+ case "Identifier":
45
+ out.add(node.name);
46
+ return;
47
+ case "ObjectPattern":
48
+ for (const p of node.properties) {
49
+ if (p.type === "RestElement") patternNames(p.argument, out);
50
+ else patternNames(p.value, out);
51
+ }
52
+ return;
53
+ case "ArrayPattern":
54
+ for (const e of node.elements) patternNames(e, out);
55
+ return;
56
+ case "AssignmentPattern":
57
+ patternNames(node.left, out);
58
+ return;
59
+ case "RestElement":
60
+ patternNames(node.argument, out);
61
+ return;
62
+ }
63
+ }
64
+ function isSafeDefault(node) {
65
+ switch (node.type) {
66
+ case "StringLiteral":
67
+ case "NumericLiteral":
68
+ case "BooleanLiteral":
69
+ case "NullLiteral":
70
+ case "BigIntLiteral":
71
+ case "RegExpLiteral":
72
+ case "Identifier":
73
+ return true;
74
+ // ESTree spells every literal as `Literal`; both shapes reach this analysis.
75
+ case "Literal":
76
+ return true;
77
+ case "TemplateLiteral":
78
+ return node.expressions.every(isSafeDefault);
79
+ case "UnaryExpression":
80
+ return isSafeDefault(node.argument);
81
+ case "MemberExpression":
82
+ return false;
83
+ default:
84
+ return false;
85
+ }
86
+ }
87
+ function walk(root, visit) {
88
+ if (!root || typeof root !== "object") return;
89
+ visit(root);
90
+ for (const key of Object.keys(root)) {
91
+ if (key === "loc" || key === "range" || key === "leadingComments" || key === "trailingComments") continue;
92
+ const value = root[key];
93
+ if (Array.isArray(value)) {
94
+ for (const item of value) if (item && typeof item === "object") walk(item, visit);
95
+ } else if (value && typeof value === "object" && typeof value.type === "string") {
96
+ walk(value, visit);
97
+ }
98
+ }
99
+ }
100
+ function reassignedNames(body) {
101
+ const written = /* @__PURE__ */ new Set();
102
+ walk(body, (node) => {
103
+ if (node.type === "AssignmentExpression") patternNames(node.left, written);
104
+ else if (node.type === "UpdateExpression") {
105
+ const arg = node.argument;
106
+ if (arg?.type === "Identifier") written.add(arg.name);
107
+ }
108
+ });
109
+ return written;
110
+ }
111
+ function shadowedNames(body, candidates) {
112
+ const shadowed = /* @__PURE__ */ new Set();
113
+ const note = (node) => {
114
+ const names = /* @__PURE__ */ new Set();
115
+ patternNames(node, names);
116
+ for (const n of names) if (candidates.has(n)) shadowed.add(n);
117
+ };
118
+ walk(body, (node) => {
119
+ switch (node.type) {
120
+ case "VariableDeclarator":
121
+ note(node.id);
122
+ return;
123
+ case "FunctionDeclaration":
124
+ case "FunctionExpression":
125
+ case "ArrowFunctionExpression":
126
+ note(node.id);
127
+ for (const p of node.params ?? []) note(p);
128
+ return;
129
+ case "CatchClause":
130
+ note(node.param);
131
+ return;
132
+ case "ClassDeclaration":
133
+ case "ClassExpression":
134
+ note(node.id);
135
+ return;
136
+ }
137
+ });
138
+ return shadowed;
139
+ }
140
+ function collect(pattern, path, plan) {
141
+ for (const property of pattern.properties ?? []) {
142
+ if (property.type === "RestElement") {
143
+ const argument = property.argument;
144
+ if (argument?.type !== "Identifier" || path.length > 0) {
145
+ const names2 = /* @__PURE__ */ new Set();
146
+ patternNames(argument, names2);
147
+ for (const name of names2) plan.bails.push({ name, reason: "rest" });
148
+ continue;
149
+ }
150
+ plan.rest = { name: argument.name, keys: [] };
151
+ continue;
152
+ }
153
+ if (property.computed) {
154
+ const names2 = /* @__PURE__ */ new Set();
155
+ patternNames(property.value, names2);
156
+ for (const name of names2) plan.bails.push({ name, reason: "computed" });
157
+ continue;
158
+ }
159
+ const key = property.key;
160
+ const propertyName = key.type === "Identifier" ? key.name : key.value;
161
+ let value = property.value;
162
+ let fallback;
163
+ if (value.type === "AssignmentPattern") {
164
+ fallback = value.right;
165
+ value = value.left;
166
+ }
167
+ const here = [...path, propertyName];
168
+ if (value.type === "Identifier") {
169
+ if (fallback && !isSafeDefault(fallback)) {
170
+ plan.bails.push({ name: value.name, reason: "unsafe-default" });
171
+ continue;
172
+ }
173
+ plan.reads.push({ name: value.name, path: here, ...fallback ? { fallback } : {} });
174
+ continue;
175
+ }
176
+ if (value.type === "ObjectPattern") {
177
+ if (fallback) {
178
+ const names2 = /* @__PURE__ */ new Set();
179
+ patternNames(value, names2);
180
+ for (const name of names2) plan.bails.push({ name, reason: "unsafe-default" });
181
+ continue;
182
+ }
183
+ collect(value, here, plan);
184
+ continue;
185
+ }
186
+ const names = /* @__PURE__ */ new Set();
187
+ patternNames(value, names);
188
+ for (const name of names) plan.bails.push({ name, reason: "computed" });
189
+ }
190
+ }
191
+ function planPropsDestructure(pattern, body) {
192
+ const plan = { reads: [], bails: [] };
193
+ if (pattern?.type !== "ObjectPattern") return plan;
194
+ collect(pattern, [], plan);
195
+ if (plan.rest) {
196
+ if (body?.type !== "BlockStatement") {
197
+ plan.bails.push({ name: plan.rest.name, reason: "rest" });
198
+ delete plan.rest;
199
+ } else {
200
+ plan.rest.keys = (pattern.properties ?? []).filter((p) => p.type !== "RestElement" && !p.computed).map((p) => {
201
+ const key = p.key;
202
+ return key.type === "Identifier" ? key.name : key.value;
203
+ });
204
+ }
205
+ }
206
+ if (plan.reads.length === 0 && !plan.rest) return plan;
207
+ const candidates = new Set(plan.reads.map((r) => r.name));
208
+ if (plan.rest) candidates.add(plan.rest.name);
209
+ const written = reassignedNames(body);
210
+ const shadowed = shadowedNames(body, candidates);
211
+ const kept = [];
212
+ for (const read of plan.reads) {
213
+ if (written.has(read.name)) plan.bails.push({ name: read.name, reason: "reassigned" });
214
+ else if (shadowed.has(read.name)) plan.bails.push({ name: read.name, reason: "shadowed" });
215
+ else kept.push(read);
216
+ }
217
+ plan.reads = kept;
218
+ if (plan.rest && written.has(plan.rest.name)) {
219
+ plan.bails.push({ name: plan.rest.name, reason: "reassigned" });
220
+ delete plan.rest;
221
+ } else if (plan.rest && shadowed.has(plan.rest.name)) {
222
+ plan.bails.push({ name: plan.rest.name, reason: "shadowed" });
223
+ delete plan.rest;
224
+ }
225
+ return plan;
226
+ }
227
+ function explainBail(reason) {
228
+ switch (reason) {
229
+ case "rest":
230
+ return "this rest element cannot be served by splitProps, and copying the props into a plain object would lose the getters";
231
+ case "computed":
232
+ return "the property is not known until it runs";
233
+ case "reassigned":
234
+ return "the binding is assigned to, and props are read-only";
235
+ case "shadowed":
236
+ return "an inner scope binds the same name";
237
+ case "unsafe-default":
238
+ return "the default would have to run again on every read";
239
+ }
240
+ }
241
+
242
+ // src/transform/bindings.ts
243
+ function patternNames2(node, out) {
244
+ if (!node) return;
245
+ switch (node.type) {
246
+ case "Identifier":
247
+ out.add(node.name);
248
+ return;
249
+ case "ObjectPattern":
250
+ for (const p of node.properties) {
251
+ if (p.type === "RestElement") patternNames2(p.argument, out);
252
+ else patternNames2(p.value, out);
253
+ }
254
+ return;
255
+ case "ArrayPattern":
256
+ for (const e of node.elements) patternNames2(e, out);
257
+ return;
258
+ case "AssignmentPattern":
259
+ patternNames2(node.left, out);
260
+ return;
261
+ case "RestElement":
262
+ patternNames2(node.argument, out);
263
+ return;
264
+ }
265
+ }
266
+ function declared(node, out) {
267
+ switch (node.type) {
268
+ case "ImportDeclaration":
269
+ for (const s of node.specifiers) patternNames2(s.local, out);
270
+ return;
271
+ case "VariableDeclaration":
272
+ for (const d of node.declarations) patternNames2(d.id, out);
273
+ return;
274
+ case "FunctionDeclaration":
275
+ case "ClassDeclaration":
276
+ patternNames2(node.id, out);
277
+ return;
278
+ case "ExportNamedDeclaration":
279
+ case "ExportDefaultDeclaration":
280
+ if (node.declaration) declared(node.declaration, out);
281
+ return;
282
+ }
283
+ }
284
+ function moduleBindings(program) {
285
+ const names = /* @__PURE__ */ new Set();
286
+ for (const statement of program.body) declared(statement, names);
287
+ return names;
288
+ }
289
+
290
+ // src/transform/props.ts
291
+ function walk2(root, visit, parent = null) {
292
+ if (!root || typeof root !== "object" || typeof root.type !== "string") return;
293
+ if (root.type.startsWith("TS")) return;
294
+ if (visit(root, parent) === false) return;
295
+ for (const key of Object.keys(root)) {
296
+ if (key === "loc" || key === "leadingComments" || key === "trailingComments") continue;
297
+ const value = root[key];
298
+ if (Array.isArray(value)) {
299
+ for (const item of value) walk2(item, visit, root);
300
+ } else if (value && typeof value === "object") {
301
+ walk2(value, visit, root);
302
+ }
303
+ }
304
+ }
305
+ function isComponentName(name) {
306
+ return !!name && name[0] >= "A" && name[0] <= "Z";
307
+ }
308
+ function componentFunctions(program) {
309
+ const found = [];
310
+ walk2(program, (node) => {
311
+ if (node.type === "FunctionDeclaration" && isComponentName(node.id?.name)) {
312
+ found.push(node);
313
+ return;
314
+ }
315
+ if (node.type === "VariableDeclarator" && isComponentName(node.id?.name)) {
316
+ const init = node.init;
317
+ if (init && (init.type === "ArrowFunctionExpression" || init.type === "FunctionExpression")) found.push(init);
318
+ }
319
+ });
320
+ return found;
321
+ }
322
+ function usedNames(fn) {
323
+ const names = /* @__PURE__ */ new Set();
324
+ walk2(fn, (node) => {
325
+ if (node.type === "Identifier") names.add(node.name);
326
+ });
327
+ return names;
328
+ }
329
+ function isReferencePosition(node, parent) {
330
+ if (!parent) return true;
331
+ switch (parent.type) {
332
+ case "MemberExpression":
333
+ case "OptionalMemberExpression":
334
+ return !(parent.property === node && !parent.computed);
335
+ case "ObjectProperty":
336
+ case "ObjectMethod":
337
+ case "ClassProperty":
338
+ case "ClassMethod":
339
+ return !(parent.key === node && !parent.computed);
340
+ case "LabeledStatement":
341
+ case "BreakStatement":
342
+ case "ContinueStatement":
343
+ return parent.label !== node;
344
+ case "ImportSpecifier":
345
+ case "ExportSpecifier":
346
+ return false;
347
+ default:
348
+ return true;
349
+ }
350
+ }
351
+ function collectPropsEdits(program, code, options = {}) {
352
+ const edits = [];
353
+ const diagnostics = [];
354
+ const used = /* @__PURE__ */ new Set();
355
+ for (const fn of componentFunctions(program)) {
356
+ const pattern = fn.params?.[0];
357
+ if (pattern?.type !== "ObjectPattern") continue;
358
+ const plan = planPropsDestructure(pattern, fn.body);
359
+ for (const b of plan.bails) {
360
+ diagnostics.push({ name: b.name, reason: b.reason, message: explainBail(b.reason), start: pattern.start });
361
+ }
362
+ if (plan.bails.length > 0) continue;
363
+ if (plan.reads.length === 0 && !plan.rest) continue;
364
+ const taken = usedNames(fn);
365
+ let parameter = options.parameterName ?? "props";
366
+ while (taken.has(parameter)) parameter = `_${parameter}`;
367
+ const replacement = /* @__PURE__ */ new Map();
368
+ for (const read of plan.reads) {
369
+ const access = `${parameter}.${read.path.join(".")}`;
370
+ const fallback = read.fallback;
371
+ replacement.set(
372
+ read.name,
373
+ fallback ? `(${access} === undefined ? ${code.slice(fallback.start, fallback.end)} : ${access})` : access
374
+ );
375
+ }
376
+ const annotation = pattern.typeAnnotation;
377
+ edits.push({ start: pattern.start, end: annotation?.start ?? pattern.end, code: parameter });
378
+ if (plan.rest) {
379
+ const keys = plan.rest.keys.map((k) => JSON.stringify(k)).join(", ");
380
+ const body = fn.body;
381
+ edits.push({
382
+ start: body.start + 1,
383
+ end: body.start + 1,
384
+ code: `
385
+ const [, ${plan.rest.name}] = splitProps(${parameter}, [${keys}]);`
386
+ });
387
+ used.add("splitProps");
388
+ }
389
+ const matches = [];
390
+ walk2(fn.body, (node, parent) => {
391
+ if (node.type !== "Identifier") return void 0;
392
+ const text = replacement.get(node.name);
393
+ if (!text) return void 0;
394
+ const shorthand = parent?.type === "ObjectProperty" && parent.shorthand && parent.value === node;
395
+ if (!shorthand && !isReferencePosition(node, parent)) return void 0;
396
+ const path = plan.reads.find((r) => r.name === node.name).path;
397
+ matches.push({ node, parent: shorthand ? parent : null, text, property: path[path.length - 1] });
398
+ return void 0;
399
+ });
400
+ for (const match of matches) {
401
+ if (match.parent) {
402
+ edits.push({ start: match.parent.start, end: match.parent.end, code: `${match.node.name}: ${match.text}` });
403
+ } else {
404
+ edits.push({ start: match.node.start, end: match.node.end, code: match.text });
405
+ }
406
+ asMemberRead(match.node, parameter, match.property);
407
+ }
408
+ }
409
+ return { edits, diagnostics, used };
410
+ }
411
+ function asMemberRead(node, parameter, property) {
412
+ node.type = "MemberExpression";
413
+ node.computed = false;
414
+ node.optional = false;
415
+ node.object = { type: "Identifier", name: parameter, start: node.start, end: node.start };
416
+ node.property = { type: "Identifier", name: property, start: node.end, end: node.end };
417
+ delete node["name"];
418
+ }
419
+ function transformProps(code, filename = "module.tsx", options = {}) {
420
+ const ast = (0, import_parser.parse)(code, {
421
+ sourceType: "module",
422
+ plugins: ["typescript", "jsx"],
423
+ errorRecovery: true
424
+ });
425
+ const { edits, diagnostics, used } = collectPropsEdits(ast.program, code, options);
426
+ const source = new import_magic_string.default(code);
427
+ for (const e of edits) {
428
+ if (e.start === e.end) source.appendLeft(e.start, e.code);
429
+ else source.overwrite(e.start, e.end, e.code);
430
+ }
431
+ if (used.has("splitProps") && !moduleBindings(ast.program).has("splitProps")) {
432
+ source.prepend(`import { splitProps } from ${JSON.stringify(options.runtimeModule ?? "@fluixi/dom")};
433
+ `);
434
+ }
435
+ return {
436
+ code: source.toString(),
437
+ map: source.generateMap({ source: filename, includeContent: true, hires: true }),
438
+ diagnostics,
439
+ rewritten: edits.filter((e) => e.code !== (options.parameterName ?? "props")).length
440
+ };
441
+ }
@@ -0,0 +1,45 @@
1
+ import MagicString from 'magic-string';
2
+ import { type DestructureBail } from '../analyze/props-destructure.cjs';
3
+ export interface PropsDiagnostic {
4
+ /** The binding we couldn't rewrite. */
5
+ name: string;
6
+ reason: DestructureBail;
7
+ /** Sentence for the message. */
8
+ message: string;
9
+ /** Character offset of the pattern it came from. */
10
+ start: number;
11
+ }
12
+ export interface PropsTransformOptions {
13
+ /** Name to give the props parameter. @default 'props' */
14
+ parameterName?: string;
15
+ /** Module `splitProps` is imported from when a rest needs it. @default '@fluixi/dom' */
16
+ runtimeModule?: string;
17
+ }
18
+ export interface PropsTransformResult {
19
+ code: string;
20
+ map: ReturnType<MagicString['generateMap']>;
21
+ diagnostics: PropsDiagnostic[];
22
+ /** How many bindings were rewritten. Zero means the source came back untouched. */
23
+ rewritten: number;
24
+ }
25
+ /** One span to replace. Same shape the template transform uses for its own edits. */
26
+ export interface PropsEdit {
27
+ start: number;
28
+ end: number;
29
+ code: string;
30
+ }
31
+ export interface PropsEditsResult {
32
+ edits: PropsEdit[];
33
+ diagnostics: PropsDiagnostic[];
34
+ /** Runtime symbols the emitted code needs: `splitProps`, when a pattern had a rest. */
35
+ used: Set<string>;
36
+ }
37
+ /**
38
+ * Work out the edits without applying them, so a caller that already has the source in a
39
+ * MagicString can fold them into its own. That's how the template transform picks this
40
+ * up: one string, one map, and holes get the rewrite because it slices them with the
41
+ * edits applied.
42
+ */
43
+ export declare function collectPropsEdits(program: unknown, code: string, options?: PropsTransformOptions): PropsEditsResult;
44
+ /** Run the rewrite on its own. The template transform folds the edits in instead. */
45
+ export declare function transformProps(code: string, filename?: string, options?: PropsTransformOptions): PropsTransformResult;
@@ -31,7 +31,7 @@ export interface PropsEdit {
31
31
  export interface PropsEditsResult {
32
32
  edits: PropsEdit[];
33
33
  diagnostics: PropsDiagnostic[];
34
- /** Runtime symbols the emitted code needs `splitProps`, when a pattern had a rest. */
34
+ /** Runtime symbols the emitted code needs: `splitProps`, when a pattern had a rest. */
35
35
  used: Set<string>;
36
36
  }
37
37
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"props.d.ts","sourceRoot":"","sources":["../../src/transform/props.ts"],"names":[],"mappings":"AAaA,OAAO,WAAW,MAAM,cAAc,CAAC;AACvC,OAAO,EAAqC,KAAK,eAAe,EAAE,MAAM,iCAAiC,CAAC;AAU1G,MAAM,WAAW,eAAe;IAC9B,uCAAuC;IACvC,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,eAAe,CAAC;IACxB,gCAAgC;IAChC,OAAO,EAAE,MAAM,CAAC;IAChB,oDAAoD;IACpD,KAAK,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,qBAAqB;IACpC,yDAAyD;IACzD,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,wFAAwF;IACxF,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AAED,MAAM,WAAW,oBAAoB;IACnC,IAAI,EAAE,MAAM,CAAC;IACb,GAAG,EAAE,UAAU,CAAC,WAAW,CAAC,aAAa,CAAC,CAAC,CAAC;IAC5C,WAAW,EAAE,eAAe,EAAE,CAAC;IAC/B,mFAAmF;IACnF,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,qFAAqF;AACrF,MAAM,WAAW,SAAS;IACxB,KAAK,EAAE,MAAM,CAAC;IACd,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,MAAM,CAAC;CACd;AAED,MAAM,WAAW,gBAAgB;IAC/B,KAAK,EAAE,SAAS,EAAE,CAAC;IACnB,WAAW,EAAE,eAAe,EAAE,CAAC;IAC/B,wFAAwF;IACxF,IAAI,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;CACnB;AA+ED;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAC/B,OAAO,EAAE,OAAO,EAChB,IAAI,EAAE,MAAM,EACZ,OAAO,GAAE,qBAA0B,GAClC,gBAAgB,CAuFlB;AAgBD,qFAAqF;AACrF,wBAAgB,cAAc,CAC5B,IAAI,EAAE,MAAM,EACZ,QAAQ,SAAe,EACvB,OAAO,GAAE,qBAA0B,GAClC,oBAAoB,CA0BtB"}
1
+ {"version":3,"file":"props.d.ts","sourceRoot":"","sources":["../../src/transform/props.ts"],"names":[],"mappings":"AAaA,OAAO,WAAW,MAAM,cAAc,CAAC;AACvC,OAAO,EAAqC,KAAK,eAAe,EAAE,MAAM,iCAAiC,CAAC;AAU1G,MAAM,WAAW,eAAe;IAC9B,uCAAuC;IACvC,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,eAAe,CAAC;IACxB,gCAAgC;IAChC,OAAO,EAAE,MAAM,CAAC;IAChB,oDAAoD;IACpD,KAAK,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,qBAAqB;IACpC,yDAAyD;IACzD,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,wFAAwF;IACxF,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AAED,MAAM,WAAW,oBAAoB;IACnC,IAAI,EAAE,MAAM,CAAC;IACb,GAAG,EAAE,UAAU,CAAC,WAAW,CAAC,aAAa,CAAC,CAAC,CAAC;IAC5C,WAAW,EAAE,eAAe,EAAE,CAAC;IAC/B,mFAAmF;IACnF,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,qFAAqF;AACrF,MAAM,WAAW,SAAS;IACxB,KAAK,EAAE,MAAM,CAAC;IACd,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,MAAM,CAAC;CACd;AAED,MAAM,WAAW,gBAAgB;IAC/B,KAAK,EAAE,SAAS,EAAE,CAAC;IACnB,WAAW,EAAE,eAAe,EAAE,CAAC;IAC/B,uFAAuF;IACvF,IAAI,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;CACnB;AA+ED;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAC/B,OAAO,EAAE,OAAO,EAChB,IAAI,EAAE,MAAM,EACZ,OAAO,GAAE,qBAA0B,GAClC,gBAAgB,CAuFlB;AAgBD,qFAAqF;AACrF,wBAAgB,cAAc,CAC5B,IAAI,EAAE,MAAM,EACZ,QAAQ,SAAe,EACvB,OAAO,GAAE,qBAA0B,GAClC,oBAAoB,CA0BtB"}
@@ -3,7 +3,7 @@
3
3
  *
4
4
  * `function Card({ title, size = 'md' })` becomes `function Card(props)` with `title`
5
5
  * rewritten to `props.title` wherever it's used, so the reads stay live. What can't be
6
- * rewritten is left alone and reported see analyze/props-destructure for the rules.
6
+ * rewritten is left alone and reported: see analyze/props-destructure for the rules.
7
7
  *
8
8
  * Source in, source out, spans spliced with magic-string, so the author's formatting
9
9
  * survives and the map comes out of the splice. It runs before templates are compiled,
@@ -133,7 +133,7 @@ export function collectPropsEdits(program, code, options = {}) {
133
133
  edits.push({ start: pattern.start, end: annotation?.start ?? pattern.end, code: parameter });
134
134
  // `...rest` becomes the splitProps call the author would have written. splitProps
135
135
  // carries the getters over instead of reading them, which is the whole reason a
136
- // plain rest can't be rewritten so this hands the job to the runtime helper that
136
+ // plain rest can't be rewritten: so this hands the job to the runtime helper that
137
137
  // does it properly rather than refusing the pattern.
138
138
  if (plan.rest) {
139
139
  const keys = plan.rest.keys.map((k) => JSON.stringify(k)).join(', ');
@@ -170,7 +170,7 @@ export function collectPropsEdits(program, code, options = {}) {
170
170
  edits.push({ start: match.node.start, end: match.node.end, code: match.text });
171
171
  }
172
172
  // Say it in the AST too, not only in the text. Whether a hole is wired reactively
173
- // is decided from the expression's shape, and a bare identifier is not reactive
173
+ // is decided from the expression's shape, and a bare identifier is not reactive ,
174
174
  // so leaving the node as an Identifier emits `props.text` read once, which is the
175
175
  // bug this whole pass exists to remove. A member read is reactive, which is what
176
176
  // the emitted code now is.
@@ -207,7 +207,7 @@ export function transformProps(code, filename = 'module.tsx', options = {}) {
207
207
  else
208
208
  source.overwrite(e.start, e.end, e.code);
209
209
  }
210
- // Standalone, there's no prologue to join, so the import goes in here unless the
210
+ // Standalone, there's no prologue to join, so the import goes in here, unless the
211
211
  // module already has the name bound.
212
212
  if (used.has('splitProps') && !moduleBindings(ast.program).has('splitProps')) {
213
213
  source.prepend(`import { splitProps } from ${JSON.stringify(options.runtimeModule ?? '@fluixi/dom')};\n`);