@webmate-studio/builder 0.2.25 → 0.2.26
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/build-service.js +7 -3
- package/package.json +1 -1
package/build-service.js
CHANGED
|
@@ -101,9 +101,13 @@ function injectSvelteOptions(filename, content, componentMetadata) {
|
|
|
101
101
|
}
|
|
102
102
|
|
|
103
103
|
// Generate <svelte:options> block
|
|
104
|
-
// IMPORTANT: props must be
|
|
105
|
-
|
|
106
|
-
const
|
|
104
|
+
// IMPORTANT: props must be a JavaScript object literal, not JSON string
|
|
105
|
+
// Convert to JS syntax: { title: { type: "Number" } } instead of {"title":{"type":"Number"}}
|
|
106
|
+
const propsEntries = Object.entries(props).map(([name, config]) => {
|
|
107
|
+
return `${name}: { type: "${config.type}" }`;
|
|
108
|
+
}).join(', ');
|
|
109
|
+
const propsLiteral = `{ ${propsEntries} }`;
|
|
110
|
+
const svelteOptions = `<svelte:options customElement={{ tag: "${tagName}", shadow: "none", props: ${propsLiteral} }} />\n\n`;
|
|
107
111
|
|
|
108
112
|
// Check if <svelte:options> already exists
|
|
109
113
|
if (content.includes('<svelte:options')) {
|