@builder.io/mitosis 0.7.3 → 0.7.4

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.
@@ -52,6 +52,13 @@ exports.DEFAULT_FORMAT = 'legacy';
52
52
  const isValidAttributeName = (str) => {
53
53
  return Boolean(str && /^[$a-z0-9\-_:]+$/i.test(str));
54
54
  };
55
+ const isInvalidJsxAttributeName = (str) => {
56
+ let attr = str.trim();
57
+ if (attr.startsWith(':') || str.startsWith('@')) {
58
+ return true;
59
+ }
60
+ return false;
61
+ };
55
62
  const blockToMitosis = (json, toMitosisOptions = {}, component, insideJsx) => {
56
63
  var _a, _b, _c, _d, _e, _f, _g, _h;
57
64
  const options = {
@@ -154,6 +161,10 @@ const blockToMitosis = (json, toMitosisOptions = {}, component, insideJsx) => {
154
161
  let str = '';
155
162
  str += `<${json.name} `;
156
163
  for (const key in json.properties) {
164
+ if (isInvalidJsxAttributeName(key)) {
165
+ console.warn('Skipping invalid attribute name:', key);
166
+ continue;
167
+ }
157
168
  const value = (json.properties[key] || '').replace(/"/g, '&quot;').replace(/\n/g, '\\n');
158
169
  if (!isValidAttributeName(key)) {
159
170
  console.warn('Skipping invalid attribute name:', key);
@@ -163,6 +174,10 @@ const blockToMitosis = (json, toMitosisOptions = {}, component, insideJsx) => {
163
174
  }
164
175
  }
165
176
  for (const key in json.bindings) {
177
+ if (isInvalidJsxAttributeName(key)) {
178
+ console.warn('Skipping invalid attribute name:', key);
179
+ continue;
180
+ }
166
181
  const value = (_e = json.bindings[key]) === null || _e === void 0 ? void 0 : _e.code;
167
182
  if (!value || ((_f = json.slots) === null || _f === void 0 ? void 0 : _f[key])) {
168
183
  continue;
package/package.json CHANGED
@@ -22,7 +22,7 @@
22
22
  "name": "Builder.io",
23
23
  "url": "https://www.builder.io"
24
24
  },
25
- "version": "0.7.3",
25
+ "version": "0.7.4",
26
26
  "homepage": "https://github.com/BuilderIO/mitosis",
27
27
  "main": "./dist/src/index.js",
28
28
  "exports": {