@builder.io/mitosis 0.0.56-99 → 0.0.56
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/dist/src/__tests__/data/blocks/content-slot-jsx.raw.jsx +4 -1
- package/dist/src/__tests__/data/blocks/form.raw.jsx +5 -5
- package/dist/src/__tests__/data/blocks/onUpdateWithDeps.raw.d.ts +5 -1
- package/dist/src/__tests__/data/blocks/onUpdateWithDeps.raw.jsx +3 -3
- package/dist/src/__tests__/data/jsx-json.spec.d.ts +2 -0
- package/dist/src/__tests__/data/jsx-json.spec.js +10226 -0
- package/dist/src/__tests__/shared.d.ts +7 -2
- package/dist/src/__tests__/shared.js +66 -9
- package/dist/src/constants/method-literal-prefix.d.ts +0 -1
- package/dist/src/constants/method-literal-prefix.js +0 -3
- package/dist/src/generators/angular.d.ts +2 -2
- package/dist/src/generators/angular.js +5 -3
- package/dist/src/generators/builder.d.ts +4 -11
- package/dist/src/generators/builder.js +3 -2
- package/dist/src/generators/context/svelte.d.ts +3 -0
- package/dist/src/generators/context/svelte.js +3 -0
- package/dist/src/generators/helpers/functions.d.ts +2 -0
- package/dist/src/generators/helpers/functions.js +28 -0
- package/dist/src/generators/html.d.ts +3 -3
- package/dist/src/generators/html.js +9 -7
- package/dist/src/generators/liquid.d.ts +2 -2
- package/dist/src/generators/liquid.js +4 -4
- package/dist/src/generators/lit/generate.d.ts +2 -2
- package/dist/src/generators/lit/generate.js +3 -2
- package/dist/src/generators/marko/generate.d.ts +2 -2
- package/dist/src/generators/marko/generate.js +10 -8
- package/dist/src/generators/mitosis.d.ts +3 -4
- package/dist/src/generators/mitosis.js +3 -2
- package/dist/src/generators/qwik/component-generator.d.ts +2 -2
- package/dist/src/generators/qwik/component-generator.js +49 -55
- package/dist/src/generators/qwik/component.d.ts +0 -1
- package/dist/src/generators/qwik/component.js +22 -19
- package/dist/src/generators/qwik/directives.d.ts +1 -0
- package/dist/src/generators/qwik/directives.js +11 -14
- package/dist/src/generators/qwik/jsx.d.ts +1 -1
- package/dist/src/generators/qwik/jsx.js +9 -5
- package/dist/src/generators/qwik/src-generator.js +9 -3
- package/dist/src/generators/qwik/stable-serialize.d.ts +6 -0
- package/dist/src/generators/qwik/stable-serialize.js +51 -0
- package/dist/src/generators/react/generator.d.ts +6 -0
- package/dist/src/generators/{react.js → react/generator.js} +58 -150
- package/dist/src/generators/react/helpers.d.ts +2 -0
- package/dist/src/generators/react/helpers.js +14 -0
- package/dist/src/generators/react/index.d.ts +2 -0
- package/dist/src/generators/react/index.js +18 -0
- package/dist/src/generators/react/state.d.ts +9 -0
- package/dist/src/generators/react/state.js +107 -0
- package/dist/src/generators/react/types.d.ts +10 -0
- package/dist/src/generators/react/types.js +2 -0
- package/dist/src/generators/react-native.d.ts +2 -2
- package/dist/src/generators/solid/index.d.ts +3 -0
- package/dist/src/generators/{solid.js → solid/index.js} +80 -40
- package/dist/src/generators/solid/state.d.ts +19 -0
- package/dist/src/generators/solid/state.js +144 -0
- package/dist/src/generators/solid/types.d.ts +6 -0
- package/dist/src/generators/solid/types.js +2 -0
- package/dist/src/generators/stencil/generate.d.ts +2 -2
- package/dist/src/generators/stencil/generate.js +5 -2
- package/dist/src/generators/svelte.d.ts +6 -7
- package/dist/src/generators/svelte.js +43 -40
- package/dist/src/generators/swift-ui.d.ts +3 -5
- package/dist/src/generators/swift-ui.js +3 -2
- package/dist/src/generators/template.d.ts +2 -2
- package/dist/src/generators/template.js +3 -2
- package/dist/src/generators/vue.d.ts +5 -3
- package/dist/src/generators/vue.js +256 -113
- package/dist/src/helpers/babel-transform.d.ts +3 -1
- package/dist/src/helpers/babel-transform.js +52 -56
- package/dist/src/helpers/get-bindings.js +3 -5
- package/dist/src/helpers/get-state-object-string.js +24 -21
- package/dist/src/helpers/getters-to-functions.js +1 -11
- package/dist/src/helpers/map-refs.js +25 -25
- package/dist/src/helpers/nodes/for.d.ts +4 -0
- package/dist/src/helpers/nodes/for.js +13 -0
- package/dist/src/helpers/nullable.d.ts +2 -0
- package/dist/src/helpers/nullable.js +7 -0
- package/dist/src/helpers/parse-reactive-script.js +66 -78
- package/dist/src/helpers/patterns.d.ts +2 -0
- package/dist/src/helpers/patterns.js +5 -1
- package/dist/src/helpers/render-imports.js +3 -3
- package/dist/src/helpers/replace-identifiers.d.ts +5 -0
- package/dist/src/helpers/{replace-idenifiers.js → replace-identifiers.js} +2 -1
- package/dist/src/helpers/slots.d.ts +2 -0
- package/dist/src/helpers/slots.js +15 -1
- package/dist/src/helpers/state.d.ts +0 -2
- package/dist/src/helpers/state.js +1 -10
- package/dist/src/helpers/strip-state-and-props-refs.d.ts +1 -1
- package/dist/src/helpers/strip-state-and-props-refs.js +43 -31
- package/dist/src/helpers/styles/helpers.d.ts +3 -2
- package/dist/src/parsers/angular.js +2 -2
- package/dist/src/parsers/builder.d.ts +2 -2
- package/dist/src/parsers/builder.js +61 -43
- package/dist/src/parsers/constants/outdated-prefixes.d.ts +10 -0
- package/dist/src/parsers/constants/outdated-prefixes.js +13 -0
- package/dist/src/parsers/context.js +2 -2
- package/dist/src/parsers/helpers/state.d.ts +3 -0
- package/dist/src/parsers/helpers/state.js +30 -0
- package/dist/src/parsers/jsx/component-types.d.ts +1 -1
- package/dist/src/parsers/jsx/component-types.js +15 -2
- package/dist/src/parsers/jsx/context.js +1 -1
- package/dist/src/parsers/jsx/element-parser.d.ts +6 -0
- package/dist/src/parsers/jsx/element-parser.js +243 -0
- package/dist/src/parsers/jsx/exports.d.ts +3 -0
- package/dist/src/parsers/jsx/exports.js +78 -0
- package/dist/src/parsers/jsx/function-parser.d.ts +7 -0
- package/dist/src/parsers/jsx/function-parser.js +291 -0
- package/dist/src/parsers/jsx/helpers.d.ts +2 -0
- package/dist/src/parsers/jsx/helpers.js +30 -1
- package/dist/src/parsers/jsx/imports.d.ts +7 -0
- package/dist/src/parsers/jsx/imports.js +65 -0
- package/dist/src/parsers/jsx/index.d.ts +1 -1
- package/dist/src/parsers/jsx/index.js +1 -2
- package/dist/src/parsers/jsx/jsx.js +29 -516
- package/dist/src/parsers/jsx/state.d.ts +2 -3
- package/dist/src/parsers/jsx/state.js +15 -22
- package/dist/src/plugins/compile-away-builder-components.js +6 -0
- package/dist/src/symbols/symbol-processor.js +3 -0
- package/dist/src/targets.d.ts +21 -28
- package/dist/src/targets.js +2 -2
- package/dist/src/types/config.d.ts +11 -1
- package/dist/src/types/mitosis-component.d.ts +12 -6
- package/dist/src/types/mitosis-component.js +11 -0
- package/dist/src/types/mitosis-context.d.ts +2 -2
- package/dist/src/types/mitosis-node.d.ts +14 -5
- package/dist/src/types/mitosis-node.js +3 -0
- package/dist/src/types/transpiler.d.ts +6 -1
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/package.json +13 -9
- package/dist/src/__tests__/angular.test.d.ts +0 -1
- package/dist/src/__tests__/angular.test.js +0 -10
- package/dist/src/__tests__/builder.test.d.ts +0 -1
- package/dist/src/__tests__/builder.test.js +0 -235
- package/dist/src/__tests__/context.test.d.ts +0 -1
- package/dist/src/__tests__/context.test.js +0 -35
- package/dist/src/__tests__/hash-code.test.d.ts +0 -1
- package/dist/src/__tests__/hash-code.test.js +0 -11
- package/dist/src/__tests__/html.test.d.ts +0 -1
- package/dist/src/__tests__/html.test.js +0 -7
- package/dist/src/__tests__/liquid.test.d.ts +0 -1
- package/dist/src/__tests__/liquid.test.js +0 -7
- package/dist/src/__tests__/lit.test.d.ts +0 -1
- package/dist/src/__tests__/lit.test.js +0 -7
- package/dist/src/__tests__/marko.test.d.ts +0 -1
- package/dist/src/__tests__/marko.test.js +0 -14
- package/dist/src/__tests__/parse-jsx.test.d.ts +0 -1
- package/dist/src/__tests__/parse-jsx.test.js +0 -37
- package/dist/src/__tests__/qwik/convert-method-to-function.test.d.ts +0 -1
- package/dist/src/__tests__/qwik/convert-method-to-function.test.js +0 -37
- package/dist/src/__tests__/qwik/src-generator.test.d.ts +0 -1
- package/dist/src/__tests__/qwik/src-generator.test.js +0 -65
- package/dist/src/__tests__/qwik.directive.test.d.ts +0 -1
- package/dist/src/__tests__/qwik.directive.test.js +0 -108
- package/dist/src/__tests__/qwik.test.d.ts +0 -1
- package/dist/src/__tests__/qwik.test.js +0 -465
- package/dist/src/__tests__/react-native.test.d.ts +0 -1
- package/dist/src/__tests__/react-native.test.js +0 -7
- package/dist/src/__tests__/react.test.d.ts +0 -1
- package/dist/src/__tests__/react.test.js +0 -20
- package/dist/src/__tests__/solid.test.d.ts +0 -1
- package/dist/src/__tests__/solid.test.js +0 -10
- package/dist/src/__tests__/stencil.test.d.ts +0 -1
- package/dist/src/__tests__/stencil.test.js +0 -7
- package/dist/src/__tests__/styles.test.d.ts +0 -1
- package/dist/src/__tests__/styles.test.js +0 -23
- package/dist/src/__tests__/svelte.test.d.ts +0 -1
- package/dist/src/__tests__/svelte.test.js +0 -7
- package/dist/src/__tests__/vue.test.d.ts +0 -1
- package/dist/src/__tests__/vue.test.js +0 -7
- package/dist/src/__tests__/webcomponent.test.d.ts +0 -1
- package/dist/src/__tests__/webcomponent.test.js +0 -15
- package/dist/src/constants/function-literal-prefix.d.ts +0 -1
- package/dist/src/constants/function-literal-prefix.js +0 -4
- package/dist/src/generators/react.d.ts +0 -14
- package/dist/src/generators/solid.d.ts +0 -5
- package/dist/src/helpers/babel-transform.test.d.ts +0 -1
- package/dist/src/helpers/babel-transform.test.js +0 -7
- package/dist/src/helpers/generic-format.test.d.ts +0 -1
- package/dist/src/helpers/generic-format.test.js +0 -8
- package/dist/src/helpers/remove-surrounding-block.test.d.ts +0 -1
- package/dist/src/helpers/remove-surrounding-block.test.js +0 -9
- package/dist/src/helpers/render-imports.test.d.ts +0 -1
- package/dist/src/helpers/render-imports.test.js +0 -33
- package/dist/src/helpers/replace-idenifiers.d.ts +0 -1
- package/dist/src/helpers/styles/collect-css.test.d.ts +0 -1
- package/dist/src/helpers/styles/collect-css.test.js +0 -18
- package/dist/test/qwik/Accordion/high.jsx +0 -0
- package/dist/test/qwik/Accordion/low.jsx +0 -240
- package/dist/test/qwik/Accordion/med.jsx +0 -4
- package/dist/test/qwik/For/high.jsx +0 -0
- package/dist/test/qwik/For/low.jsx +0 -52
- package/dist/test/qwik/For/med.jsx +0 -4
- package/dist/test/qwik/Image/high.js +0 -9
- package/dist/test/qwik/Image/low.js +0 -0
- package/dist/test/qwik/Image/med.js +0 -155
- package/dist/test/qwik/Image.slow/high.js +0 -9
- package/dist/test/qwik/Image.slow/low.js +0 -0
- package/dist/test/qwik/Image.slow/med.js +0 -155
- package/dist/test/qwik/bindings/high.cjs +0 -0
- package/dist/test/qwik/bindings/low.cjs +0 -45
- package/dist/test/qwik/bindings/med.cjs +0 -3
- package/dist/test/qwik/button/high.js +0 -3
- package/dist/test/qwik/button/low.js +0 -25
- package/dist/test/qwik/button/med.js +0 -31
- package/dist/test/qwik/component/bindings/high.jsx +0 -0
- package/dist/test/qwik/component/bindings/low.jsx +0 -104
- package/dist/test/qwik/component/bindings/med.jsx +0 -7
- package/dist/test/qwik/component/component/inputs/high.cjsx +0 -9
- package/dist/test/qwik/component/component/inputs/low.cjsx +0 -0
- package/dist/test/qwik/component/component/inputs/med.cjsx +0 -68
- package/dist/test/qwik/for-loop.bindings/high.cjs +0 -0
- package/dist/test/qwik/for-loop.bindings/low.cjs +0 -56
- package/dist/test/qwik/for-loop.bindings/med.cjs +0 -5
- package/dist/test/qwik/hello_world/stylesheet/high.jsx +0 -0
- package/dist/test/qwik/hello_world/stylesheet/low.jsx +0 -26
- package/dist/test/qwik/hello_world/stylesheet/med.jsx +0 -4
- package/dist/test/qwik/mount/high.cjs +0 -0
- package/dist/test/qwik/mount/low.cjs +0 -47
- package/dist/test/qwik/mount/med.cjs +0 -3
- package/dist/test/qwik/page-with-symbol/high.js +0 -0
- package/dist/test/qwik/page-with-symbol/low.js +0 -33
- package/dist/test/qwik/page-with-symbol/med.js +0 -4
- package/dist/test/qwik/show-hide/high.jsx +0 -9
- package/dist/test/qwik/show-hide/low.jsx +0 -0
- package/dist/test/qwik/show-hide/med.jsx +0 -181
- package/dist/test/qwik/svg/high.js +0 -0
- package/dist/test/qwik/svg/low.js +0 -30
- package/dist/test/qwik/svg/med.js +0 -4
- package/dist/test/qwik/todo/Todo.cjs/high.cjs +0 -19
- package/dist/test/qwik/todo/Todo.cjs/low.cjs +0 -0
- package/dist/test/qwik/todo/Todo.cjs/med.cjs +0 -51
- package/dist/test/qwik/todo/Todo.js/high.js +0 -19
- package/dist/test/qwik/todo/Todo.js/low.js +0 -0
- package/dist/test/qwik/todo/Todo.js/med.js +0 -47
- package/dist/test/qwik/todo/Todo.tsx/high.tsx +0 -19
- package/dist/test/qwik/todo/Todo.tsx/low.tsx +0 -0
- package/dist/test/qwik/todo/Todo.tsx/med.tsx +0 -43
- package/dist/test/qwik/todos/Todo.tsx/high.tsx +0 -7
- package/dist/test/qwik/todos/Todo.tsx/low.tsx +0 -32
- package/dist/test/qwik/todos/Todo.tsx/med.tsx +0 -4
- package/dist/tsconfig.tsbuildinfo +0 -1
|
@@ -1,16 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
4
|
-
var lodash_1 = require("lodash");
|
|
3
|
+
exports.checkHasState = void 0;
|
|
5
4
|
var checkHasState = function (component) {
|
|
6
5
|
return Boolean(Object.keys(component.state).length);
|
|
7
6
|
};
|
|
8
7
|
exports.checkHasState = checkHasState;
|
|
9
|
-
var mapJsonToStateValue = function (value) { return ({
|
|
10
|
-
code: value,
|
|
11
|
-
type: 'property',
|
|
12
|
-
}); };
|
|
13
|
-
var mapJsonObjectToStateValue = function (value) {
|
|
14
|
-
return (0, lodash_1.mapValues)(value, mapJsonToStateValue);
|
|
15
|
-
};
|
|
16
|
-
exports.mapJsonObjectToStateValue = mapJsonObjectToStateValue;
|
|
@@ -16,4 +16,4 @@ export declare type StripStateAndPropsRefsOptions = {
|
|
|
16
16
|
*
|
|
17
17
|
* @todo proper ref replacement with babel
|
|
18
18
|
*/
|
|
19
|
-
export declare const stripStateAndPropsRefs: (code?: string,
|
|
19
|
+
export declare const stripStateAndPropsRefs: (code?: string, _options?: StripStateAndPropsRefsOptions) => string;
|
|
@@ -1,6 +1,27 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __assign = (this && this.__assign) || function () {
|
|
3
|
+
__assign = Object.assign || function(t) {
|
|
4
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
+
s = arguments[i];
|
|
6
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
+
t[p] = s[p];
|
|
8
|
+
}
|
|
9
|
+
return t;
|
|
10
|
+
};
|
|
11
|
+
return __assign.apply(this, arguments);
|
|
12
|
+
};
|
|
2
13
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
14
|
exports.stripStateAndPropsRefs = void 0;
|
|
15
|
+
var DEFAULT_OPTIONS = {
|
|
16
|
+
replaceWith: '',
|
|
17
|
+
contextVars: [],
|
|
18
|
+
outputVars: [],
|
|
19
|
+
stateVars: [],
|
|
20
|
+
context: 'this.',
|
|
21
|
+
domRefs: [],
|
|
22
|
+
includeProps: true,
|
|
23
|
+
includeState: true,
|
|
24
|
+
};
|
|
4
25
|
/**
|
|
5
26
|
* Remove state. and props. from expressions, e.g.
|
|
6
27
|
* state.foo -> foo
|
|
@@ -9,48 +30,39 @@ exports.stripStateAndPropsRefs = void 0;
|
|
|
9
30
|
*
|
|
10
31
|
* @todo proper ref replacement with babel
|
|
11
32
|
*/
|
|
12
|
-
var stripStateAndPropsRefs = function (code,
|
|
13
|
-
if (
|
|
33
|
+
var stripStateAndPropsRefs = function (code, _options) {
|
|
34
|
+
if (_options === void 0) { _options = {}; }
|
|
14
35
|
var newCode = code || '';
|
|
15
|
-
var
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
// determine expression edge cases onMessage( to this.onMessage.emit(
|
|
31
|
-
var regexp = '(^|\\s|;|\\()(props\\.?)' + _var + '\\(';
|
|
32
|
-
var replacer = '$1' + context + _var + '.emit(';
|
|
33
|
-
newCode = newCode.replace(new RegExp(regexp, 'g'), replacer);
|
|
34
|
-
});
|
|
35
|
-
}
|
|
36
|
-
if (options.includeProps !== false) {
|
|
37
|
-
if (typeof replacer === 'string') {
|
|
38
|
-
newCode = newCode.replace(/props\./g, replacer);
|
|
36
|
+
var _a = __assign(__assign({}, DEFAULT_OPTIONS), _options), replaceWith = _a.replaceWith, contextVars = _a.contextVars, outputVars = _a.outputVars, context = _a.context, domRefs = _a.domRefs, includeProps = _a.includeProps, includeState = _a.includeState, stateVars = _a.stateVars;
|
|
37
|
+
contextVars.forEach(function (_var) {
|
|
38
|
+
newCode = newCode.replace(
|
|
39
|
+
// determine expression edge cases - https://regex101.com/r/iNcTSM/1
|
|
40
|
+
new RegExp('(^|\\n|\\r| |;|\\(|\\[|!)' + _var + '(\\?\\.|\\.|\\(| |;|\\)|$)', 'g'), '$1' + context + _var + '$2');
|
|
41
|
+
});
|
|
42
|
+
outputVars.forEach(function (_var) {
|
|
43
|
+
// determine expression edge cases onMessage( to this.onMessage.emit(
|
|
44
|
+
var regexp = '(^|\\s|;|\\()(props\\.?)' + _var + '\\(';
|
|
45
|
+
var replacer = '$1' + context + _var + '.emit(';
|
|
46
|
+
newCode = newCode.replace(new RegExp(regexp, 'g'), replacer);
|
|
47
|
+
});
|
|
48
|
+
if (includeProps !== false) {
|
|
49
|
+
if (typeof replaceWith === 'string') {
|
|
50
|
+
newCode = newCode.replace(/props\./g, replaceWith);
|
|
39
51
|
}
|
|
40
52
|
else {
|
|
41
|
-
newCode = newCode.replace(/props\.([\$a-z0-9_]+)/gi, function (memo, name) { return
|
|
53
|
+
newCode = newCode.replace(/props\.([\$a-z0-9_]+)/gi, function (memo, name) { return replaceWith(name); });
|
|
42
54
|
}
|
|
43
55
|
// TODO: webcomponent edge-case
|
|
44
56
|
if (/el\.this\.props/.test(newCode)) {
|
|
45
57
|
newCode = newCode.replace(/el\.this\.props/g, 'el.props');
|
|
46
58
|
}
|
|
47
59
|
}
|
|
48
|
-
if (
|
|
49
|
-
if (typeof
|
|
50
|
-
newCode = newCode.replace(/state\./g,
|
|
60
|
+
if (includeState !== false) {
|
|
61
|
+
if (typeof replaceWith === 'string') {
|
|
62
|
+
newCode = newCode.replace(/state\./g, replaceWith);
|
|
51
63
|
}
|
|
52
64
|
else {
|
|
53
|
-
newCode = newCode.replace(/state\.([\$a-z0-9_]+)/gi, function (memo, name) { return
|
|
65
|
+
newCode = newCode.replace(/state\.([\$a-z0-9_]+)/gi, function (memo, name) { return replaceWith(name); });
|
|
54
66
|
}
|
|
55
67
|
}
|
|
56
68
|
var matchPropertyAccessorsArguments = '\\?\\.|,|\\.|\\(| |;|\\)|\\]|$'; // foo?.stuff | foo) | foo | foo] etc.
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
/// <reference types="lodash" />
|
|
1
2
|
import * as CSS from 'csstype';
|
|
2
3
|
import { MitosisNode } from '../../types/mitosis-node';
|
|
3
4
|
import { MitosisComponent } from '../../types/mitosis-component';
|
|
@@ -19,8 +20,8 @@ export declare const hasStyle: (component: MitosisComponent) => boolean;
|
|
|
19
20
|
export declare type StyleMap = {
|
|
20
21
|
[className: string]: CSS.Properties | StyleMap;
|
|
21
22
|
};
|
|
22
|
-
export declare const getNestedSelectors: (map: StyleMap) => import("lodash").Dictionary<
|
|
23
|
-
export declare const getStylesOnly: (map: StyleMap) => import("lodash").Dictionary<
|
|
23
|
+
export declare const getNestedSelectors: (map: StyleMap) => import("lodash").Dictionary<CSS.Properties<0 | (string & {}), string & {}> | StyleMap>;
|
|
24
|
+
export declare const getStylesOnly: (map: StyleMap) => import("lodash").Dictionary<CSS.Properties<0 | (string & {}), string & {}> | StyleMap>;
|
|
24
25
|
/**
|
|
25
26
|
* { 'my-class': { display: 'block', '&.foo': { display: 'none' } }}
|
|
26
27
|
*/
|
|
@@ -63,8 +63,8 @@ var angularTemplateNodeToMitosisNode = function (node, options) {
|
|
|
63
63
|
bindings: {
|
|
64
64
|
each: { code: transformBinding(expression, options) },
|
|
65
65
|
},
|
|
66
|
-
|
|
67
|
-
|
|
66
|
+
scope: {
|
|
67
|
+
forName: itemName,
|
|
68
68
|
},
|
|
69
69
|
children: [angularTemplateNodeToMitosisNode((0, lodash_1.omit)(node, 'templateAttrs'), options)],
|
|
70
70
|
});
|
|
@@ -40,7 +40,7 @@ export declare const builderContentToMitosisComponent: (builderContent: BuilderC
|
|
|
40
40
|
useMetadata?: JSONObject | undefined;
|
|
41
41
|
};
|
|
42
42
|
inputs: import("..").MitosisComponentInput[];
|
|
43
|
-
state: import("
|
|
43
|
+
state: import("..").MitosisState;
|
|
44
44
|
context: {
|
|
45
45
|
get: import("..").ContextGet;
|
|
46
46
|
set: import("..").ContextSet;
|
|
@@ -74,7 +74,7 @@ export declare const builderContentToMitosisComponent: (builderContent: BuilderC
|
|
|
74
74
|
useMetadata?: JSONObject | undefined;
|
|
75
75
|
};
|
|
76
76
|
inputs: import("..").MitosisComponentInput[];
|
|
77
|
-
state: import("
|
|
77
|
+
state: import("..").MitosisState;
|
|
78
78
|
context: {
|
|
79
79
|
get: import("..").ContextGet;
|
|
80
80
|
set: import("..").ContextSet;
|
|
@@ -51,7 +51,7 @@ var create_mitosis_node_1 = require("../helpers/create-mitosis-node");
|
|
|
51
51
|
var jsx_1 = require("./jsx");
|
|
52
52
|
var parsers_1 = require("../helpers/parsers");
|
|
53
53
|
var __1 = require("..");
|
|
54
|
-
var state_1 = require("
|
|
54
|
+
var state_1 = require("./helpers/state");
|
|
55
55
|
// Omit some superflous styles that can come from Builder's web importer
|
|
56
56
|
var styleOmitList = [
|
|
57
57
|
'backgroundRepeatX',
|
|
@@ -299,8 +299,8 @@ var componentMappers = __assign(__assign({ Symbol: function (block, options) {
|
|
|
299
299
|
bindings: {
|
|
300
300
|
each: { code: "state.".concat(block.component.options.repeat.collection) },
|
|
301
301
|
},
|
|
302
|
-
|
|
303
|
-
|
|
302
|
+
scope: {
|
|
303
|
+
forName: block.component.options.repeat.itemName,
|
|
304
304
|
},
|
|
305
305
|
children: (block.children || []).map(function (child) { return (0, exports.builderElementToMitosisNode)(child, options); }),
|
|
306
306
|
});
|
|
@@ -380,27 +380,29 @@ var builderElementToMitosisNode = function (block, options, _internalOptions) {
|
|
|
380
380
|
// Special builder properties
|
|
381
381
|
// TODO: support hide and repeat
|
|
382
382
|
var blockBindings = getBlockBindings(block, options);
|
|
383
|
-
var
|
|
384
|
-
if (
|
|
383
|
+
var code = undefined;
|
|
384
|
+
if (blockBindings.show) {
|
|
385
|
+
code = wrapBindingIfNeeded(blockBindings.show, options);
|
|
386
|
+
}
|
|
387
|
+
else if (blockBindings.hide) {
|
|
388
|
+
code = "!(".concat(wrapBindingIfNeeded(blockBindings.hide, options), ")");
|
|
389
|
+
}
|
|
390
|
+
if (code) {
|
|
385
391
|
var isFragment = ((_c = block.component) === null || _c === void 0 ? void 0 : _c.name) === 'Fragment';
|
|
386
392
|
// TODO: handle having other things, like a repeat too
|
|
387
393
|
if (isFragment) {
|
|
388
394
|
return (0, create_mitosis_node_1.createMitosisNode)({
|
|
389
395
|
name: 'Show',
|
|
390
|
-
bindings: {
|
|
391
|
-
when: { code: wrapBindingIfNeeded(showBinding, options) },
|
|
392
|
-
},
|
|
396
|
+
bindings: { when: { code: code } },
|
|
393
397
|
children: ((_d = block.children) === null || _d === void 0 ? void 0 : _d.map(function (child) { return (0, exports.builderElementToMitosisNode)(child, options); })) || [],
|
|
394
398
|
});
|
|
395
399
|
}
|
|
396
400
|
else {
|
|
397
401
|
return (0, create_mitosis_node_1.createMitosisNode)({
|
|
398
402
|
name: 'Show',
|
|
399
|
-
bindings: {
|
|
400
|
-
when: { code: wrapBindingIfNeeded(showBinding, options) },
|
|
401
|
-
},
|
|
403
|
+
bindings: { when: { code: code } },
|
|
402
404
|
children: [
|
|
403
|
-
(0, exports.builderElementToMitosisNode)(__assign(__assign({}, block), { code: __assign(__assign({}, block.code), { bindings: (0, lodash_1.omit)(blockBindings, 'show') }), bindings: (0, lodash_1.omit)(blockBindings, 'show') }), options),
|
|
405
|
+
(0, exports.builderElementToMitosisNode)(__assign(__assign({}, block), { code: __assign(__assign({}, block.code), { bindings: (0, lodash_1.omit)(blockBindings, 'show', 'hide') }), bindings: (0, lodash_1.omit)(blockBindings, 'show', 'hide') }), options),
|
|
404
406
|
],
|
|
405
407
|
});
|
|
406
408
|
}
|
|
@@ -417,8 +419,8 @@ var builderElementToMitosisNode = function (block, options, _internalOptions) {
|
|
|
417
419
|
code: wrapBindingIfNeeded((_g = block.repeat) === null || _g === void 0 ? void 0 : _g.collection, options),
|
|
418
420
|
},
|
|
419
421
|
},
|
|
420
|
-
|
|
421
|
-
|
|
422
|
+
scope: {
|
|
423
|
+
forName: ((_h = block.repeat) === null || _h === void 0 ? void 0 : _h.itemName) || 'item',
|
|
422
424
|
},
|
|
423
425
|
children: ((_j = block.children) === null || _j === void 0 ? void 0 : _j.map(function (child) { return (0, exports.builderElementToMitosisNode)(child, options); })) || [],
|
|
424
426
|
});
|
|
@@ -434,8 +436,8 @@ var builderElementToMitosisNode = function (block, options, _internalOptions) {
|
|
|
434
436
|
code: wrapBindingIfNeeded((_m = block.repeat) === null || _m === void 0 ? void 0 : _m.collection, options),
|
|
435
437
|
},
|
|
436
438
|
},
|
|
437
|
-
|
|
438
|
-
|
|
439
|
+
scope: {
|
|
440
|
+
forName: ((_o = block.repeat) === null || _o === void 0 ? void 0 : _o.itemName) || 'item',
|
|
439
441
|
},
|
|
440
442
|
children: [(0, exports.builderElementToMitosisNode)((0, lodash_1.omit)(useBlock, 'repeat'), options)],
|
|
441
443
|
});
|
|
@@ -465,9 +467,9 @@ var builderElementToMitosisNode = function (block, options, _internalOptions) {
|
|
|
465
467
|
}
|
|
466
468
|
}
|
|
467
469
|
}
|
|
468
|
-
var properties = __assign(__assign({}, block.properties), (options.includeBuilderExtras && (_a = {},
|
|
470
|
+
var properties = __assign(__assign(__assign({}, block.properties), (options.includeBuilderExtras && (_a = {},
|
|
469
471
|
_a['builder-id'] = block.id,
|
|
470
|
-
_a)));
|
|
472
|
+
_a))), (options.includeBuilderExtras && getBuilderPropsForSymbol(block)));
|
|
471
473
|
if (block.layerName) {
|
|
472
474
|
properties.$name = block.layerName;
|
|
473
475
|
}
|
|
@@ -502,11 +504,7 @@ var builderElementToMitosisNode = function (block, options, _internalOptions) {
|
|
|
502
504
|
name: ((_r = (_q = block.component) === null || _q === void 0 ? void 0 : _q.name) === null || _r === void 0 ? void 0 : _r.replace(/[^a-z0-9]/gi, '')) ||
|
|
503
505
|
block.tagName ||
|
|
504
506
|
(block.linkUrl ? 'a' : 'div'),
|
|
505
|
-
properties: __assign(__assign({}, (block.component
|
|
506
|
-
? {
|
|
507
|
-
$tagName: block.tagName,
|
|
508
|
-
}
|
|
509
|
-
: null)), properties),
|
|
507
|
+
properties: __assign(__assign(__assign({}, (block.component && { $tagName: block.tagName })), (block.class && { class: block.class })), properties),
|
|
510
508
|
bindings: __assign(__assign(__assign(__assign({}, bindings), actionBindings), (styleString && {
|
|
511
509
|
style: { code: styleString },
|
|
512
510
|
})), (css &&
|
|
@@ -530,6 +528,17 @@ var builderElementToMitosisNode = function (block, options, _internalOptions) {
|
|
|
530
528
|
return node;
|
|
531
529
|
};
|
|
532
530
|
exports.builderElementToMitosisNode = builderElementToMitosisNode;
|
|
531
|
+
var getBuilderPropsForSymbol = function (block) {
|
|
532
|
+
var _a, _b;
|
|
533
|
+
if (((_a = block.children) === null || _a === void 0 ? void 0 : _a.length) === 1) {
|
|
534
|
+
var child = block.children[0];
|
|
535
|
+
var builderContentId = (_b = child.properties) === null || _b === void 0 ? void 0 : _b['builder-content-id'];
|
|
536
|
+
if (builderContentId) {
|
|
537
|
+
return { 'builder-content-id': builderContentId };
|
|
538
|
+
}
|
|
539
|
+
}
|
|
540
|
+
return undefined;
|
|
541
|
+
};
|
|
533
542
|
var getHooks = function (content) {
|
|
534
543
|
var _a, _b;
|
|
535
544
|
var code = convertExportDefaultToReturn(((_a = content.data) === null || _a === void 0 ? void 0 : _a.tsCode) || ((_b = content.data) === null || _b === void 0 ? void 0 : _b.jsCode) || '');
|
|
@@ -589,19 +598,30 @@ function extractStateHook(code) {
|
|
|
589
598
|
}
|
|
590
599
|
exports.extractStateHook = extractStateHook;
|
|
591
600
|
function convertExportDefaultToReturn(code) {
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
var
|
|
597
|
-
|
|
598
|
-
if (types.
|
|
599
|
-
types.
|
|
600
|
-
|
|
601
|
+
try {
|
|
602
|
+
var types = babel.types;
|
|
603
|
+
var body = (0, parsers_1.parseCode)(code);
|
|
604
|
+
var newBody = body.slice();
|
|
605
|
+
for (var i = 0; i < body.length; i++) {
|
|
606
|
+
var statement = body[i];
|
|
607
|
+
if (types.isExportDefaultDeclaration(statement)) {
|
|
608
|
+
if (types.isCallExpression(statement.declaration) ||
|
|
609
|
+
types.isExpression(statement.declaration)) {
|
|
610
|
+
newBody[i] = types.returnStatement(statement.declaration);
|
|
611
|
+
}
|
|
601
612
|
}
|
|
602
613
|
}
|
|
614
|
+
return (0, generator_1.default)(types.program(newBody)).code || '';
|
|
615
|
+
}
|
|
616
|
+
catch (e) {
|
|
617
|
+
var error = e;
|
|
618
|
+
if (error.code === 'BABEL_PARSE_ERROR') {
|
|
619
|
+
return code;
|
|
620
|
+
}
|
|
621
|
+
else {
|
|
622
|
+
throw e;
|
|
623
|
+
}
|
|
603
624
|
}
|
|
604
|
-
return (0, generator_1.default)(types.program(newBody)).code || '';
|
|
605
625
|
}
|
|
606
626
|
exports.convertExportDefaultToReturn = convertExportDefaultToReturn;
|
|
607
627
|
// TODO: maybe this should be part of the builder -> Mitosis part
|
|
@@ -650,7 +670,7 @@ var isBuilderElement = function (el) {
|
|
|
650
670
|
};
|
|
651
671
|
exports.isBuilderElement = isBuilderElement;
|
|
652
672
|
var builderContentPartToMitosisComponent = function (builderContent, options) {
|
|
653
|
-
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
673
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
654
674
|
if (options === void 0) { options = {}; }
|
|
655
675
|
builderContent = (0, fast_clone_1.fastClone)(builderContent);
|
|
656
676
|
(0, traverse_1.default)(builderContent).forEach(function (elem) {
|
|
@@ -679,24 +699,22 @@ var builderContentPartToMitosisComponent = function (builderContent, options) {
|
|
|
679
699
|
}
|
|
680
700
|
}
|
|
681
701
|
});
|
|
682
|
-
var
|
|
702
|
+
var _k = extractStateHook(((_a = builderContent === null || builderContent === void 0 ? void 0 : builderContent.data) === null || _a === void 0 ? void 0 : _a.tsCode) || ((_b = builderContent === null || builderContent === void 0 ? void 0 : builderContent.data) === null || _b === void 0 ? void 0 : _b.jsCode) || ''), state = _k.state, code = _k.code;
|
|
683
703
|
var customCode = convertExportDefaultToReturn(code);
|
|
684
704
|
var parsed = getHooks(builderContent);
|
|
685
705
|
var componentJson = (0, create_mitosis_component_1.createMitosisComponent)({
|
|
686
|
-
meta: {
|
|
687
|
-
useMetadata: {
|
|
706
|
+
meta: __assign({ useMetadata: {
|
|
688
707
|
httpRequests: (_c = builderContent.data) === null || _c === void 0 ? void 0 : _c.httpRequests,
|
|
689
|
-
},
|
|
690
|
-
|
|
691
|
-
inputs: (_e = (_d = builderContent.data) === null || _d === void 0 ? void 0 : _d.inputs) === null || _e === void 0 ? void 0 : _e.map(function (input) { return ({
|
|
708
|
+
} }, (((_d = builderContent.data) === null || _d === void 0 ? void 0 : _d.cssCode) && { cssCode: builderContent.data.cssCode })),
|
|
709
|
+
inputs: (_f = (_e = builderContent.data) === null || _e === void 0 ? void 0 : _e.inputs) === null || _f === void 0 ? void 0 : _f.map(function (input) { return ({
|
|
692
710
|
name: input.name,
|
|
693
711
|
defaultValue: input.defaultValue,
|
|
694
712
|
}); }),
|
|
695
|
-
state: (parsed === null || parsed === void 0 ? void 0 : parsed.state) || __assign(__assign({}, state), (0, state_1.mapJsonObjectToStateValue)((
|
|
696
|
-
hooks: __assign({}, ((((
|
|
713
|
+
state: (parsed === null || parsed === void 0 ? void 0 : parsed.state) || __assign(__assign({}, state), (0, state_1.mapJsonObjectToStateValue)((_g = builderContent.data) === null || _g === void 0 ? void 0 : _g.state)),
|
|
714
|
+
hooks: __assign({}, ((((_h = parsed === null || parsed === void 0 ? void 0 : parsed.hooks.onMount) === null || _h === void 0 ? void 0 : _h.code) || (customCode && { code: customCode })) && {
|
|
697
715
|
onMount: (parsed === null || parsed === void 0 ? void 0 : parsed.hooks.onMount) || { code: customCode },
|
|
698
716
|
})),
|
|
699
|
-
children: (((
|
|
717
|
+
children: (((_j = builderContent.data) === null || _j === void 0 ? void 0 : _j.blocks) || [])
|
|
700
718
|
.filter(function (item) {
|
|
701
719
|
var _a, _b;
|
|
702
720
|
if ((_b = (_a = item.properties) === null || _a === void 0 ? void 0 : _a.src) === null || _b === void 0 ? void 0 : _b.includes('/api/v1/pixel')) {
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* DO NOT USE THIS PREFIX. It's only used for legacy purposes, within a very small subset of logic in the JSX & Builder parsers.
|
|
3
|
+
* It will be eliminated in the future, and generators should not need to rely on these prefixes for any reason.
|
|
4
|
+
*/
|
|
5
|
+
export declare const __DO_NOT_USE_FUNCTION_LITERAL_PREFIX = "@builder.io/mitosis/function:";
|
|
6
|
+
/**
|
|
7
|
+
* DO NOT USE THIS PREFIX. It's only used for legacy purposes, within a very small subset of logic in the JSX & Builder parsers.
|
|
8
|
+
* It will be eliminated in the future, and generators should not need to rely on these prefixes for any reason.
|
|
9
|
+
*/
|
|
10
|
+
export declare const __DO_NOT_USE_METHOD_LITERAL_PREFIX = "@builder.io/mitosis/method:";
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.__DO_NOT_USE_METHOD_LITERAL_PREFIX = exports.__DO_NOT_USE_FUNCTION_LITERAL_PREFIX = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* DO NOT USE THIS PREFIX. It's only used for legacy purposes, within a very small subset of logic in the JSX & Builder parsers.
|
|
6
|
+
* It will be eliminated in the future, and generators should not need to rely on these prefixes for any reason.
|
|
7
|
+
*/
|
|
8
|
+
exports.__DO_NOT_USE_FUNCTION_LITERAL_PREFIX = "@builder.io/mitosis/function:";
|
|
9
|
+
/**
|
|
10
|
+
* DO NOT USE THIS PREFIX. It's only used for legacy purposes, within a very small subset of logic in the JSX & Builder parsers.
|
|
11
|
+
* It will be eliminated in the future, and generators should not need to rely on these prefixes for any reason.
|
|
12
|
+
*/
|
|
13
|
+
exports.__DO_NOT_USE_METHOD_LITERAL_PREFIX = "@builder.io/mitosis/method:";
|
|
@@ -26,7 +26,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
26
26
|
exports.parseContext = void 0;
|
|
27
27
|
var babel = __importStar(require("@babel/core"));
|
|
28
28
|
var create_mitosis_context_1 = require("../helpers/create-mitosis-context");
|
|
29
|
-
var
|
|
29
|
+
var state_1 = require("./jsx/state");
|
|
30
30
|
var types = babel.types;
|
|
31
31
|
var tsPreset = require('@babel/preset-typescript');
|
|
32
32
|
function parseContext(code, options) {
|
|
@@ -51,7 +51,7 @@ function parseContext(code, options) {
|
|
|
51
51
|
if (types.isObjectExpression(firstArg)) {
|
|
52
52
|
// TODO: support non object values by parsing any node type
|
|
53
53
|
// like the logic within each property value of parseStateObject
|
|
54
|
-
context.value = (0,
|
|
54
|
+
context.value = (0, state_1.parseStateObjectToMitosisState)(firstArg);
|
|
55
55
|
found = true;
|
|
56
56
|
}
|
|
57
57
|
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.mapJsonObjectToStateValue = void 0;
|
|
4
|
+
var lodash_1 = require("lodash");
|
|
5
|
+
var patterns_1 = require("../../helpers/patterns");
|
|
6
|
+
var outdated_prefixes_1 = require("../constants/outdated-prefixes");
|
|
7
|
+
/**
|
|
8
|
+
* Sets StateTypeValue based on the string prefixes we've set previously.
|
|
9
|
+
*
|
|
10
|
+
* This is a temporary workaround until we eliminate the prefixes and make this StateValueType the
|
|
11
|
+
* source of truth.
|
|
12
|
+
*/
|
|
13
|
+
var mapJsonToStateValue = function (value) {
|
|
14
|
+
if (typeof value === 'string') {
|
|
15
|
+
if (value.startsWith(outdated_prefixes_1.__DO_NOT_USE_FUNCTION_LITERAL_PREFIX)) {
|
|
16
|
+
return { type: 'function', code: value.replace(outdated_prefixes_1.__DO_NOT_USE_FUNCTION_LITERAL_PREFIX, '') };
|
|
17
|
+
}
|
|
18
|
+
else if (value.startsWith(outdated_prefixes_1.__DO_NOT_USE_METHOD_LITERAL_PREFIX)) {
|
|
19
|
+
var strippedValue = value.replace(outdated_prefixes_1.__DO_NOT_USE_METHOD_LITERAL_PREFIX, '');
|
|
20
|
+
var isGet = Boolean(strippedValue.match(patterns_1.GETTER));
|
|
21
|
+
var type = isGet ? 'getter' : 'method';
|
|
22
|
+
return { type: type, code: strippedValue };
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
return { type: 'property', code: value };
|
|
26
|
+
};
|
|
27
|
+
var mapJsonObjectToStateValue = function (value) {
|
|
28
|
+
return (0, lodash_1.mapValues)(value, mapJsonToStateValue);
|
|
29
|
+
};
|
|
30
|
+
exports.mapJsonObjectToStateValue = mapJsonObjectToStateValue;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as babel from '@babel/core';
|
|
2
2
|
import { Context } from './types';
|
|
3
3
|
export declare const getPropsTypeRef: (node: babel.types.FunctionDeclaration, context: Context) => string | undefined;
|
|
4
|
-
export declare const isTypeImport: (node: babel.Node) => boolean;
|
|
5
4
|
export declare const isTypeOrInterface: (node: babel.Node) => boolean;
|
|
6
5
|
export declare const collectTypes: (node: babel.Node, context: Context) => void;
|
|
6
|
+
export declare function handleTypeImports(path: babel.NodePath<babel.types.Program>, context: Context): void;
|
|
@@ -35,7 +35,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
35
35
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
36
36
|
};
|
|
37
37
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
38
|
-
exports.
|
|
38
|
+
exports.handleTypeImports = exports.collectTypes = exports.isTypeOrInterface = exports.getPropsTypeRef = void 0;
|
|
39
39
|
var babel = __importStar(require("@babel/core"));
|
|
40
40
|
var generator_1 = __importDefault(require("@babel/generator"));
|
|
41
41
|
var types = babel.types;
|
|
@@ -71,7 +71,6 @@ var isTypeImport = function (node) {
|
|
|
71
71
|
// Babel adds an implicit JSX type import that we don't want
|
|
72
72
|
((_a = node.specifiers[0]) === null || _a === void 0 ? void 0 : _a.local.name) !== 'JSX';
|
|
73
73
|
};
|
|
74
|
-
exports.isTypeImport = isTypeImport;
|
|
75
74
|
var isTypeOrInterface = function (node) {
|
|
76
75
|
return types.isTSTypeAliasDeclaration(node) ||
|
|
77
76
|
types.isTSInterfaceDeclaration(node) ||
|
|
@@ -86,3 +85,17 @@ var collectTypes = function (node, context) {
|
|
|
86
85
|
context.builder.component.types = types.filter(Boolean);
|
|
87
86
|
};
|
|
88
87
|
exports.collectTypes = collectTypes;
|
|
88
|
+
function handleTypeImports(path, context) {
|
|
89
|
+
for (var _i = 0, _a = path.node.body; _i < _a.length; _i++) {
|
|
90
|
+
var statement = _a[_i];
|
|
91
|
+
if (isTypeImport(statement)) {
|
|
92
|
+
var importDeclaration = statement;
|
|
93
|
+
// Remove .lite from path if exists, as that will be stripped
|
|
94
|
+
if (importDeclaration.source.value.endsWith('.lite')) {
|
|
95
|
+
importDeclaration.source.value = importDeclaration.source.value.replace(/\.lite$/, '');
|
|
96
|
+
}
|
|
97
|
+
(0, exports.collectTypes)(statement, context);
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
exports.handleTypeImports = handleTypeImports;
|
|
@@ -52,7 +52,7 @@ function extractContextComponents(json) {
|
|
|
52
52
|
json.context.set[refPath] = {
|
|
53
53
|
name: name_1,
|
|
54
54
|
value: value
|
|
55
|
-
? (0, state_1.
|
|
55
|
+
? (0, state_1.parseStateObjectToMitosisState)(expressionToNode(value))
|
|
56
56
|
: undefined,
|
|
57
57
|
};
|
|
58
58
|
this.update((0, create_mitosis_node_1.createMitosisNode)({
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import * as babel from '@babel/core';
|
|
2
|
+
import { MitosisNode } from '../../types/mitosis-node';
|
|
3
|
+
/**
|
|
4
|
+
* Parses a JSX element into a MitosisNode.
|
|
5
|
+
*/
|
|
6
|
+
export declare const jsxElementToJson: (node: babel.types.JSXElement | babel.types.JSXExpressionContainer | babel.types.JSXFragment | babel.types.JSXSpreadChild | babel.types.JSXText) => MitosisNode | null;
|