@builder.io/mitosis 0.0.56-41 → 0.0.56-42
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.
|
@@ -39,6 +39,18 @@ var function_literal_prefix_1 = require("../../constants/function-literal-prefix
|
|
|
39
39
|
var method_literal_prefix_1 = require("../../constants/method-literal-prefix");
|
|
40
40
|
var patterns_1 = require("../../helpers/patterns");
|
|
41
41
|
var get_refs_1 = require("../../helpers/get-refs");
|
|
42
|
+
var is_upper_case_1 = require("../../helpers/is-upper-case");
|
|
43
|
+
var lodash_1 = require("lodash");
|
|
44
|
+
/**
|
|
45
|
+
* Convert a component name to a tagName
|
|
46
|
+
*
|
|
47
|
+
* So things like
|
|
48
|
+
* 'FooBar' -> <foo-bar>
|
|
49
|
+
* 'h1' -> <h1>
|
|
50
|
+
*/
|
|
51
|
+
var toTagName = function (str) {
|
|
52
|
+
return (0, is_upper_case_1.isUpperCase)(str[0]) ? (0, lodash_1.kebabCase)(str) : str;
|
|
53
|
+
};
|
|
42
54
|
// Having issues with this, so off for now
|
|
43
55
|
var USE_MARKO_PRETTIER = false;
|
|
44
56
|
function getStateTypeOfValue(value) {
|
|
@@ -102,7 +114,7 @@ var blockToMarko = function (json, options) {
|
|
|
102
114
|
.join('\n'), "</if>\n ").concat(!json.meta.else ? '' : "<else>".concat(blockToMarko(json.meta.else, options), "</else>"));
|
|
103
115
|
}
|
|
104
116
|
var str = '';
|
|
105
|
-
str += "<".concat((
|
|
117
|
+
str += "<".concat(toTagName(json.name), " ");
|
|
106
118
|
var classString = (0, collect_class_string_1.collectClassString)(json);
|
|
107
119
|
if (classString) {
|
|
108
120
|
str += " class=".concat(classString, " ");
|
|
@@ -137,7 +149,7 @@ var blockToMarko = function (json, options) {
|
|
|
137
149
|
if (json.children) {
|
|
138
150
|
str += json.children.map(function (item) { return blockToMarko(item, options); }).join('\n');
|
|
139
151
|
}
|
|
140
|
-
str += "</".concat((
|
|
152
|
+
str += "</".concat(toTagName(json.name), ">");
|
|
141
153
|
return str;
|
|
142
154
|
};
|
|
143
155
|
function processBinding(json, code, type) {
|
|
@@ -15,13 +15,16 @@ var convertMethodToFunction_1 = require("./convertMethodToFunction");
|
|
|
15
15
|
var jsx_1 = require("./jsx");
|
|
16
16
|
var src_generator_1 = require("./src-generator");
|
|
17
17
|
var babel_transform_1 = require("../../helpers/babel-transform");
|
|
18
|
+
var fast_clone_1 = require("../../helpers/fast-clone");
|
|
18
19
|
Error.stackTraceLimit = 9999;
|
|
19
20
|
// TODO(misko): styles are not processed.
|
|
20
21
|
var DEBUG = false;
|
|
21
22
|
var componentToQwik = function (userOptions) {
|
|
22
23
|
if (userOptions === void 0) { userOptions = {}; }
|
|
23
24
|
return function (_a) {
|
|
24
|
-
var
|
|
25
|
+
var _component = _a.component, path = _a.path;
|
|
26
|
+
// Make a copy we can safely mutate, similar to babel's toolchain
|
|
27
|
+
var component = (0, fast_clone_1.fastClone)(_component);
|
|
25
28
|
var file = new src_generator_1.File(component.name + '.js', {
|
|
26
29
|
isPretty: true,
|
|
27
30
|
isJSX: true,
|