MCPcopy
hub / github.com/BuilderIO/mitosis / addProviderComponents

Function addProviderComponents

packages/core/src/generators/solid/index.ts:75–93  ·  view source on GitHub ↗
(json: MitosisComponent, options: ToSolidOptions)

Source from the content-addressed store, hash-verified

73 .join('\n');
74
75function addProviderComponents(json: MitosisComponent, options: ToSolidOptions) {
76 for (const key in json.context.set) {
77 const { name, value, ref } = json.context.set[key];
78
79 const bindingValue = value
80 ? createSingleBinding({ code: stringifyContextValue(value) })
81 : ref
82 ? createSingleBinding({ code: ref })
83 : undefined;
84
85 json.children = [
86 createMitosisNode({
87 name: `${name}.Provider`,
88 children: json.children,
89 ...(bindingValue && { bindings: { value: bindingValue } }),
90 }),
91 ];
92 }
93}
94
95const DEFAULT_OPTIONS: ToSolidOptions = {
96 state: 'signals',

Callers 1

componentToSolidFunction · 0.85

Calls 3

createSingleBindingFunction · 0.90
stringifyContextValueFunction · 0.90
createMitosisNodeFunction · 0.90

Tested by

no test coverage detected