(instance: ComponentInternalInstance)
| 645 | // for easier console inspection. In prod mode it will be an empty object so |
| 646 | // these properties definitions can be skipped. |
| 647 | export function createDevRenderContext(instance: ComponentInternalInstance) { |
| 648 | const target: Record<string, any> = {} |
| 649 | |
| 650 | // expose internal instance for proxy handlers |
| 651 | Object.defineProperty(target, `_`, { |
| 652 | configurable: true, |
| 653 | enumerable: false, |
| 654 | get: () => instance, |
| 655 | }) |
| 656 | |
| 657 | // expose public properties |
| 658 | Object.keys(publicPropertiesMap).forEach(key => { |
| 659 | Object.defineProperty(target, key, { |
| 660 | configurable: true, |
| 661 | enumerable: false, |
| 662 | get: () => publicPropertiesMap[key](instance), |
| 663 | // intercepted by the proxy so no need for implementation, |
| 664 | // but needed to prevent set errors |
| 665 | set: NOOP, |
| 666 | }) |
| 667 | }) |
| 668 | |
| 669 | return target as ComponentRenderContext |
| 670 | } |
| 671 | |
| 672 | // dev only |
| 673 | export function exposePropsOnRenderContext( |
no test coverage detected