@vobs/compiler 1.3.7 → 1.4.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/package.json CHANGED
@@ -11,7 +11,7 @@
11
11
  "type": "git",
12
12
  "url": "git+https://github.com/vobsjs/vobs.git"
13
13
  },
14
- "version": "1.3.7",
14
+ "version": "1.4.1",
15
15
  "publishConfig": {
16
16
  "access": "public"
17
17
  },
@@ -40,6 +40,6 @@
40
40
  },
41
41
  "dependencies": {
42
42
  "typescript": "^5.9.3",
43
- "@vobs/runtime": "1.3.7"
43
+ "@vobs/runtime": "1.4.1"
44
44
  }
45
45
  }
@@ -343,6 +343,25 @@ export const width = st(50, 'doc.width')
343
343
  expect(result).toContain('() => content')
344
344
  })
345
345
 
346
+ // 回归(Labelune 踩坑备忘):用户态组件透传 children 曾渲染为 "[object HTMLDivElement]"。
347
+ // children 必须编译为 getter 返回节点/节点数组,{children} 表达式走 insertDynamicValue
348
+ // 直传节点,任何一侧都不允许落入文本序列化路径。
349
+ it('用户态组件透传 children 编译为节点 getter 与节点直传(不字符串化)', () => {
350
+ const result = compile(`
351
+ function Section({ children }) {
352
+ return <section>{children}</section>
353
+ }
354
+ const el = <Section><div class="inner">inner</div></Section>
355
+ `)
356
+ // 调用方:children 是 getter,值为构建好的节点(transformElement 求值结果 / 静态提升 clone)
357
+ expect(result).toContain('get children()')
358
+ expect(result).toContain('createComponent(')
359
+ // 被调方:{children} 标识符表达式直传节点(insertDynamicValue),不走 createText(String(...))
360
+ expect(result).toContain('insertDynamicValue')
361
+ expect(result).toContain('() => children')
362
+ expect(result).not.toContain('String(children)')
363
+ })
364
+
346
365
  it('支持 DOM spread 和对象样式', () => {
347
366
  const result = compile(`const props = { className: 'card' }; const el = <div {...props} style={{ backgroundColor: 'red' }} />`)
348
367
  expect(result).toContain('spreadProps')