#5748·webiny-js

remote-components: buildManifestCode leaves nested object inputs unbuilt

Author: SvenAlHamadCreated Sep 21, 2026Updated Sep 21, 2026

Summary

buildManifestCode in packages/remote-components/src/api/bundler/bundleComponent.ts rewrites the declarative input descriptors in a component's manifest into factory calls with a regex whose params group cannot match nested braces. A nested input — the documented list-of-cards shape — is therefore left as a raw descriptor object, and the component ships with an input the editor cannot render.

The regex

javascript
const inputEntryPattern =
    /\{\s*name\s*:\s*["'`](\w+)["'`]\s*,\s*factory\s*:\s*["'`](create\w+)["'`]\s*,\s*params\s*:\s*(\{[^}]*\})\s*\}/g;

(\{[^}]*\}) stops at the first }, so it matches only descriptors whose params contain no nested object or array of objects.

Example: the list-of-cards shape the generator is told to produce

buildComponentPrompt.ts instructs the model to emit exactly this (its own "Pre-populating List Data" section):

javascript
export const manifest = {
    name: "Custom/CardGrid",
    inputs: [
        { name: "cards", factory: "createObjectInput", params: { list: true, label: "Cards", fields: [
            { name: "title", factory: "createTextInput", params: { label: "Title", defaultValue: "Feature" } },
            { name: "description", factory: "createLongTextInput", params: { label: "Description", defaultValue: "Description text." } }
        ] } }
    ],
    defaults: {
        inputs: {
            cards: [
                { title: "Fast Performance", description: "Lightning-fast load times." }
            ]
        }
    }
};

The outer cards descriptor's params contains a fields array of objects, so inputEntryPattern does not match it. It is passed through unrewritten, and _createComponent receives { name, factory, params } where it expects a built input.

Expected vs actual

  • Expected: createObjectInput({ name: "cards", list: true, label: "Cards", fields: [createTextInput({…}), createLongTextInput({…})] })
  • Actual: the literal descriptor object, with factory as a string and no type.

Impact

Any generated component with an object or list input — which the prompt actively encourages for card grids, testimonials, feature lists, and any repeated content — bundles without error and then misbehaves in the editor, because the input has no type. It fails silently: nothing throws at bundle time, and validateComponentSource only regex-checks that a manifest export exists.

Suggested fix

Rewrite descriptors by walking the parsed manifest object rather than its text: extract the manifest literal, evaluate it as data (it is a plain object literal by contract), then map each { name, factory, params } to its factory call recursively through params.fields. The SDK input factories are pure and have no React dependency, so this works in Node.

A brace-matching parser over the text would also work, but parsing the object is simpler and handles arbitrary nesting depth for free.

Context

Noticed while reimplementing manifest recovery for a throwaway page-composition proof of concept, where walking the parsed object was the approach taken and nested inputs built correctly. Filed separately from the "no server-readable manifest" issue because this one affects users of the components module today, independently of any consumer.