@builder.io/mitosis 0.5.38 → 0.6.0

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.
@@ -25,13 +25,17 @@ const collectStyles = (json, options = {}) => {
25
25
  const componentIndexes = {};
26
26
  const componentHashes = {};
27
27
  (0, legacy_1.default)(json).forEach(function (item) {
28
- var _a;
28
+ var _a, _b;
29
29
  if ((0, is_mitosis_node_1.isMitosisNode)(item)) {
30
30
  if ((0, helpers_1.nodeHasCss)(item)) {
31
31
  const value = (0, helpers_1.parseCssObject)((_a = item.bindings.css) === null || _a === void 0 ? void 0 : _a.code);
32
32
  delete item.bindings.css;
33
- const componentName = item.properties.$name
34
- ? (0, dash_case_1.dashCase)(item.properties.$name)
33
+ // Clean the name by keeping only alphanumeric characters, underscores, and dashes
34
+ const cleanedName = (_b = item.properties.$name) === null || _b === void 0 ? void 0 : _b.replace(/[^a-zA-Z0-9_-]/g, '');
35
+ // Remove leading numbers or dashes
36
+ const normalizedName = cleanedName === null || cleanedName === void 0 ? void 0 : cleanedName.replace(/^[0-9-]+/, '');
37
+ const componentName = normalizedName
38
+ ? (0, dash_case_1.dashCase)(normalizedName)
35
39
  : /^h\d$/.test(item.name || '') // don't dashcase h1 into h-1
36
40
  ? item.name
37
41
  : (0, dash_case_1.dashCase)(item.name || 'div');
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.5.38",
25
+ "version": "0.6.0",
26
26
  "homepage": "https://github.com/BuilderIO/mitosis",
27
27
  "main": "./dist/src/index.js",
28
28
  "exports": {