@builder.io/mitosis 0.0.45-5 → 0.0.48
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__/builder.test.js +71 -68
- package/dist/src/__tests__/context.test.js +13 -10
- package/dist/src/__tests__/data/basic.raw.jsx +1 -1
- package/dist/src/__tests__/data/blocks/button-with-metadata.raw.jsx +1 -1
- package/dist/src/__tests__/data/blocks/columns.raw.jsx +8 -2
- package/dist/src/__tests__/data/blocks/custom-code.raw.jsx +3 -3
- package/dist/src/__tests__/data/blocks/embed.raw.jsx +3 -3
- package/dist/src/__tests__/data/blocks/form.raw.jsx +5 -5
- package/dist/src/__tests__/data/blocks/image.raw.jsx +4 -4
- package/dist/src/__tests__/data/blocks/stamped-io.raw.jsx +4 -4
- package/dist/src/__tests__/data/context/component-with-context.lite.jsx +2 -2
- package/dist/src/__tests__/data/context/simple.context.lite.js +1 -1
- package/dist/src/__tests__/html.test.js +2 -2
- package/dist/src/__tests__/liquid.test.js +34 -34
- package/dist/src/__tests__/parse-jsx.test.js +1 -1
- package/dist/src/__tests__/qwik.test.js +197 -50
- package/dist/src/__tests__/react-native.test.js +35 -35
- package/dist/src/__tests__/react.test.js +35 -35
- package/dist/src/__tests__/solid.test.js +32 -32
- package/dist/src/__tests__/vue.test.js +35 -34
- package/dist/src/generators/angular.d.ts +4 -7
- package/dist/src/generators/angular.js +77 -81
- package/dist/src/generators/builder.d.ts +4 -4
- package/dist/src/generators/builder.js +57 -57
- package/dist/src/generators/context/react.d.ts +3 -1
- package/dist/src/generators/context/react.js +20 -17
- package/dist/src/generators/html.d.ts +5 -9
- package/dist/src/generators/html.js +205 -199
- package/dist/src/generators/liquid.d.ts +5 -9
- package/dist/src/generators/liquid.js +62 -59
- package/dist/src/generators/mitosis.d.ts +6 -7
- package/dist/src/generators/mitosis.js +61 -63
- package/dist/src/generators/qwik/component.d.ts +20 -0
- package/dist/src/generators/qwik/component.js +117 -0
- package/dist/src/generators/qwik/directives.d.ts +2 -0
- package/dist/src/generators/qwik/directives.js +27 -0
- package/dist/src/generators/qwik/handlers.d.ts +4 -0
- package/dist/src/generators/qwik/handlers.js +80 -0
- package/dist/src/generators/qwik/index.d.ts +2 -0
- package/dist/src/generators/qwik/index.js +9 -0
- package/dist/src/generators/qwik/jsx.d.ts +4 -0
- package/dist/src/generators/qwik/jsx.js +124 -0
- package/dist/src/generators/qwik/src-generator.d.ts +79 -0
- package/dist/src/generators/qwik/src-generator.js +427 -0
- package/dist/src/generators/qwik/styles.d.ts +7 -0
- package/dist/src/generators/qwik/styles.js +94 -0
- package/dist/src/generators/react-native.d.ts +4 -7
- package/dist/src/generators/react-native.js +53 -43
- package/dist/src/generators/react.d.ts +4 -8
- package/dist/src/generators/react.js +122 -114
- package/dist/src/generators/solid.d.ts +4 -8
- package/dist/src/generators/solid.js +55 -54
- package/dist/src/generators/svelte.d.ts +4 -7
- package/dist/src/generators/svelte.js +120 -123
- package/dist/src/generators/swift-ui.d.ts +2 -2
- package/dist/src/generators/swift-ui.js +62 -62
- package/dist/src/generators/template.d.ts +4 -8
- package/dist/src/generators/template.js +48 -45
- package/dist/src/generators/vue.d.ts +9 -9
- package/dist/src/generators/vue.js +170 -169
- package/dist/src/helpers/babel-transform.js +9 -9
- package/dist/src/helpers/camel-case.d.ts +8 -0
- package/dist/src/helpers/camel-case.js +18 -0
- package/dist/src/helpers/collect-styles.js +39 -37
- package/dist/src/helpers/dash-case.js +1 -1
- package/dist/src/helpers/generic-format.test.js +2 -2
- package/dist/src/helpers/get-components-used.js +2 -2
- package/dist/src/helpers/get-components.js +3 -3
- package/dist/src/helpers/get-props.js +1 -1
- package/dist/src/helpers/get-refs.js +2 -2
- package/dist/src/helpers/get-state-object-string.js +52 -39
- package/dist/src/helpers/get-state-used.js +1 -1
- package/dist/src/helpers/get-styles.js +1 -1
- package/dist/src/helpers/getters-to-functions.js +4 -4
- package/dist/src/helpers/handle-missing-state.js +1 -1
- package/dist/src/helpers/has-component.js +2 -2
- package/dist/src/helpers/has-props.js +1 -1
- package/dist/src/helpers/is-children.js +1 -1
- package/dist/src/helpers/json.d.ts +1 -0
- package/dist/src/helpers/json.js +17 -0
- package/dist/src/helpers/map-refs.js +7 -6
- package/dist/src/helpers/map-to-attributes.js +4 -4
- package/dist/src/helpers/map-to-css.js +2 -2
- package/dist/src/helpers/parse-node.js +2 -2
- package/dist/src/helpers/parse-reactive-script.js +4 -4
- package/dist/src/helpers/patterns.d.ts +2 -0
- package/dist/src/helpers/patterns.js +5 -0
- package/dist/src/helpers/process-http-requests.js +1 -1
- package/dist/src/helpers/process-tag-references.js +4 -4
- package/dist/src/helpers/remove-surrounding-block.test.js +1 -1
- package/dist/src/helpers/render-imports.js +7 -7
- package/dist/src/helpers/replace-idenifiers.js +1 -1
- package/dist/src/helpers/strip-meta-properties.js +2 -2
- package/dist/src/helpers/trace-reference-to-module-path.js +1 -1
- package/dist/src/helpers/traverse-nodes.js +2 -2
- package/dist/src/helpers/try-prettier-format.js +1 -1
- package/dist/src/index.d.ts +3 -1
- package/dist/src/index.js +3 -1
- package/dist/src/jsx-types.d.ts +1 -1
- package/dist/src/modules/plugins.d.ts +2 -10
- package/dist/src/parsers/angular.js +13 -13
- package/dist/src/parsers/builder.d.ts +1 -1
- package/dist/src/parsers/builder.js +56 -59
- package/dist/src/parsers/context.js +2 -2
- package/dist/src/parsers/jsx.js +59 -87
- package/dist/src/parsers/liquid.js +193 -195
- package/dist/src/plugins/compile-away-builder-components.d.ts +1 -1
- package/dist/src/plugins/compile-away-builder-components.js +330 -91
- package/dist/src/plugins/compile-away-components.js +3 -3
- package/dist/src/plugins/map-styles.js +3 -3
- package/dist/src/targets.d.ts +24 -0
- package/dist/src/targets.js +30 -0
- package/dist/src/types/config.d.ts +31 -0
- package/dist/src/types/{jsx-lite-component.js → config.js} +0 -0
- package/dist/src/types/generators.d.ts +0 -0
- package/dist/src/types/generators.js +1 -0
- package/dist/src/types/plugins.d.ts +11 -0
- package/dist/src/types/{jsx-lite-context.js → plugins.js} +0 -0
- package/dist/test/qwik/Accordion/high.jsx +1 -0
- package/dist/test/qwik/Accordion/low.jsx +92 -0
- package/dist/test/qwik/Accordion/med.jsx +9 -0
- package/dist/test/qwik/For/high.jsx +1 -0
- package/dist/test/qwik/For/low.jsx +55 -0
- package/dist/test/qwik/For/med.jsx +9 -0
- package/dist/test/qwik/Image/high.js +1 -0
- package/dist/test/qwik/Image/low.js +68 -0
- package/dist/test/qwik/Image/med.js +9 -0
- package/dist/test/qwik/Image.slow/high.js +1 -0
- package/dist/test/qwik/Image.slow/low.js +68 -0
- package/dist/test/qwik/Image.slow/med.js +9 -0
- package/dist/test/qwik/button/high.js +8 -0
- package/dist/test/qwik/button/low.js +34 -0
- package/dist/test/qwik/button/med.js +9 -0
- package/dist/test/qwik/hello_world/stylesheet/high.jsx +1 -0
- package/dist/test/qwik/hello_world/stylesheet/low.jsx +24 -0
- package/dist/test/qwik/hello_world/stylesheet/med.jsx +9 -0
- package/dist/test/qwik/page-with-symbol/high.js +1 -0
- package/dist/test/qwik/page-with-symbol/low.js +49 -0
- package/dist/test/qwik/page-with-symbol/med.js +9 -0
- package/dist/test/qwik/svg/high.js +1 -0
- package/dist/test/qwik/svg/low.js +30 -0
- package/dist/test/qwik/svg/med.js +9 -0
- package/dist/test/qwik/todo/Todo.cjs/high.cjs +31 -0
- package/dist/test/qwik/todo/Todo.cjs/low.cjs +1 -0
- package/dist/test/qwik/todo/Todo.cjs/med.cjs +59 -0
- package/dist/test/qwik/todo/Todo.js/high.js +5 -0
- package/dist/test/qwik/todo/Todo.js/low.js +0 -0
- package/dist/test/qwik/todo/Todo.js/med.js +1 -0
- package/dist/test/qwik/todo/Todo.tsx/high.tsx +30 -0
- package/dist/test/qwik/todo/Todo.tsx/low.tsx +1 -0
- package/dist/test/qwik/todo/Todo.tsx/med.tsx +34 -0
- package/dist/test/qwik/todos/Todo.tsx/high.tsx +12 -0
- package/dist/test/qwik/todos/Todo.tsx/low.tsx +25 -0
- package/dist/test/qwik/todos/Todo.tsx/med.tsx +8 -0
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +2 -2
- package/CHANGELOG.md +0 -4
- package/dist/src/__tests__/data/blocks/tabs.raw.d.ts +0 -11
- package/dist/src/__tests__/data/blocks/tabs.raw.jsx +0 -24
- package/dist/src/__tests__/qoot.test.d.ts +0 -1
- package/dist/src/__tests__/qoot.test.js +0 -115
- package/dist/src/generators/jsx-lite.d.ts +0 -10
- package/dist/src/generators/jsx-lite.js +0 -176
- package/dist/src/generators/qoot.d.ts +0 -21
- package/dist/src/generators/qoot.js +0 -442
- package/dist/src/generators/qwik.d.ts +0 -21
- package/dist/src/generators/qwik.js +0 -458
- package/dist/src/helpers/create-jsx-lite-component.d.ts +0 -2
- package/dist/src/helpers/create-jsx-lite-component.js +0 -16
- package/dist/src/helpers/create-jsx-lite-context.d.ts +0 -4
- package/dist/src/helpers/create-jsx-lite-context.js +0 -18
- package/dist/src/helpers/create-jsx-lite-node.d.ts +0 -2
- package/dist/src/helpers/create-jsx-lite-node.js +0 -16
- package/dist/src/helpers/is-jsx-lite-node.d.ts +0 -2
- package/dist/src/helpers/is-jsx-lite-node.js +0 -7
- package/dist/src/types/jsx-lite-component.d.ts +0 -63
- package/dist/src/types/jsx-lite-context.d.ts +0 -6
- package/dist/src/types/jsx-lite-node.d.ts +0 -13
- package/dist/src/types/jsx-lite-node.js +0 -2
- package/dist/src/types/jsx-lite-styles.d.ts +0 -1
- package/dist/src/types/jsx-lite-styles.js +0 -2
- package/dist/test/qoot/Todo/bundle.js +0 -88
- package/dist/test/qoot/Todo/component.ts +0 -17
- package/dist/test/qoot/Todo/onButtonClick.ts +0 -13
- package/dist/test/qoot/Todo/onInput2Blur.ts +0 -11
- package/dist/test/qoot/Todo/onInput2KeyUp.ts +0 -10
- package/dist/test/qoot/Todo/onInputClick.ts +0 -10
- package/dist/test/qoot/Todo/onLabelDblClick.ts +0 -11
- package/dist/test/qoot/Todo/public.ts +0 -4
- package/dist/test/qoot/Todo/template.tsx +0 -46
- package/dist/test/qoot/Todos/component.ts +0 -9
- package/dist/test/qoot/Todos/onInputClick.ts +0 -14
- package/dist/test/qoot/Todos/public.ts +0 -3
- package/dist/test/qoot/Todos/template.tsx +0 -30
- package/dist/test/qwik/Todo/bundle.js +0 -46
- package/dist/test/qwik/Todo/component.ts +0 -17
- package/dist/test/qwik/Todo/onButtonClick.ts +0 -10
- package/dist/test/qwik/Todo/onInput2Blur.ts +0 -14
- package/dist/test/qwik/Todo/onInput2KeyUp.ts +0 -10
- package/dist/test/qwik/Todo/onInputClick.ts +0 -13
- package/dist/test/qwik/Todo/onLabelDblClick.ts +0 -11
- package/dist/test/qwik/Todo/public.ts +0 -3
- package/dist/test/qwik/Todo/template.tsx +0 -46
- package/dist/test/qwik/Todo.ts +0 -4
- package/dist/test/qwik/Todo_component.ts +0 -17
- package/dist/test/qwik/Todo_onButtonClick.ts +0 -13
- package/dist/test/qwik/Todo_onInput2Blur.ts +0 -14
- package/dist/test/qwik/Todo_onInput2KeyUp.ts +0 -10
- package/dist/test/qwik/Todo_onInputClick.ts +0 -13
- package/dist/test/qwik/Todo_onLabelDblClick.ts +0 -14
- package/dist/test/qwik/Todo_template.tsx +0 -46
- package/dist/test/qwik/Todos/component.ts +0 -9
- package/dist/test/qwik/Todos/onInputClick.ts +0 -14
- package/dist/test/qwik/Todos/public.ts +0 -3
- package/dist/test/qwik/Todos/template.tsx +0 -30
- package/dist/test/qwik/Todos.ts +0 -3
- package/dist/test/qwik/Todos_component.ts +0 -9
- package/dist/test/qwik/Todos_onInputClick.ts +0 -14
- package/dist/test/qwik/Todos_template.tsx +0 -30
|
@@ -21,88 +21,88 @@ var image = require('./data/blocks/image.raw');
|
|
|
21
21
|
var columns = require('./data/blocks/columns.raw');
|
|
22
22
|
describe('Liquid', function () {
|
|
23
23
|
test('Basic', function () {
|
|
24
|
-
var
|
|
25
|
-
var output = liquid_1.componentToLiquid(
|
|
24
|
+
var component = (0, jsx_1.parseJsx)(basic);
|
|
25
|
+
var output = (0, liquid_1.componentToLiquid)()({ component: component });
|
|
26
26
|
expect(output).toMatchSnapshot();
|
|
27
27
|
});
|
|
28
28
|
test('Input block', function () {
|
|
29
|
-
var
|
|
30
|
-
var output = liquid_1.componentToLiquid(
|
|
29
|
+
var component = (0, jsx_1.parseJsx)(inputBlock);
|
|
30
|
+
var output = (0, liquid_1.componentToLiquid)()({ component: component });
|
|
31
31
|
expect(output).toMatchSnapshot();
|
|
32
32
|
});
|
|
33
33
|
test('Submit button block', function () {
|
|
34
|
-
var
|
|
35
|
-
var output = liquid_1.componentToLiquid(
|
|
34
|
+
var component = (0, jsx_1.parseJsx)(submitButtonBlock);
|
|
35
|
+
var output = (0, liquid_1.componentToLiquid)()({ component: component });
|
|
36
36
|
expect(output).toMatchSnapshot();
|
|
37
37
|
});
|
|
38
38
|
test('Select block', function () {
|
|
39
|
-
var
|
|
40
|
-
var output = liquid_1.componentToLiquid(
|
|
39
|
+
var component = (0, jsx_1.parseJsx)(selectBlock);
|
|
40
|
+
var output = (0, liquid_1.componentToLiquid)()({ component: component });
|
|
41
41
|
expect(output).toMatchSnapshot();
|
|
42
42
|
});
|
|
43
43
|
test('Form block', function () {
|
|
44
|
-
var
|
|
45
|
-
var output = liquid_1.componentToLiquid(
|
|
44
|
+
var component = (0, jsx_1.parseJsx)(formBlock);
|
|
45
|
+
var output = (0, liquid_1.componentToLiquid)()({ component: component });
|
|
46
46
|
expect(output).toMatchSnapshot();
|
|
47
47
|
});
|
|
48
48
|
test('Button', function () {
|
|
49
|
-
var
|
|
50
|
-
var output = liquid_1.componentToLiquid(
|
|
49
|
+
var component = (0, jsx_1.parseJsx)(button);
|
|
50
|
+
var output = (0, liquid_1.componentToLiquid)()({ component: component });
|
|
51
51
|
expect(output).toMatchSnapshot();
|
|
52
52
|
});
|
|
53
53
|
test('Textarea', function () {
|
|
54
|
-
var
|
|
55
|
-
var output = liquid_1.componentToLiquid(
|
|
54
|
+
var component = (0, jsx_1.parseJsx)(textarea);
|
|
55
|
+
var output = (0, liquid_1.componentToLiquid)()({ component: component });
|
|
56
56
|
expect(output).toMatchSnapshot();
|
|
57
57
|
});
|
|
58
58
|
test('Img', function () {
|
|
59
|
-
var
|
|
60
|
-
var output = liquid_1.componentToLiquid(
|
|
59
|
+
var component = (0, jsx_1.parseJsx)(img);
|
|
60
|
+
var output = (0, liquid_1.componentToLiquid)()({ component: component });
|
|
61
61
|
expect(output).toMatchSnapshot();
|
|
62
62
|
});
|
|
63
63
|
test('Video', function () {
|
|
64
|
-
var
|
|
65
|
-
var output = liquid_1.componentToLiquid(
|
|
64
|
+
var component = (0, jsx_1.parseJsx)(video);
|
|
65
|
+
var output = (0, liquid_1.componentToLiquid)()({ component: component });
|
|
66
66
|
expect(output).toMatchSnapshot();
|
|
67
67
|
});
|
|
68
68
|
test('Section', function () {
|
|
69
|
-
var
|
|
70
|
-
var output = liquid_1.componentToLiquid(
|
|
69
|
+
var component = (0, jsx_1.parseJsx)(section);
|
|
70
|
+
var output = (0, liquid_1.componentToLiquid)()({ component: component });
|
|
71
71
|
expect(output).toMatchSnapshot();
|
|
72
72
|
});
|
|
73
73
|
test('Text', function () {
|
|
74
|
-
var
|
|
75
|
-
var output = liquid_1.componentToLiquid(
|
|
74
|
+
var component = (0, jsx_1.parseJsx)(text);
|
|
75
|
+
var output = (0, liquid_1.componentToLiquid)()({ component: component });
|
|
76
76
|
expect(output).toMatchSnapshot();
|
|
77
77
|
});
|
|
78
78
|
test('RawText', function () {
|
|
79
|
-
var
|
|
80
|
-
var output = liquid_1.componentToLiquid(
|
|
79
|
+
var component = (0, jsx_1.parseJsx)(rawText);
|
|
80
|
+
var output = (0, liquid_1.componentToLiquid)()({ component: component });
|
|
81
81
|
expect(output).toMatchSnapshot();
|
|
82
82
|
});
|
|
83
83
|
test('Stamped.io', function () {
|
|
84
|
-
var
|
|
85
|
-
var output = liquid_1.componentToLiquid(
|
|
84
|
+
var component = (0, jsx_1.parseJsx)(stamped);
|
|
85
|
+
var output = (0, liquid_1.componentToLiquid)()({ component: component });
|
|
86
86
|
expect(output).toMatchSnapshot();
|
|
87
87
|
});
|
|
88
88
|
test('CustomCode', function () {
|
|
89
|
-
var
|
|
90
|
-
var output = liquid_1.componentToLiquid(
|
|
89
|
+
var component = (0, jsx_1.parseJsx)(customCode);
|
|
90
|
+
var output = (0, liquid_1.componentToLiquid)()({ component: component });
|
|
91
91
|
expect(output).toMatchSnapshot();
|
|
92
92
|
});
|
|
93
93
|
test('Embed', function () {
|
|
94
|
-
var
|
|
95
|
-
var output = liquid_1.componentToLiquid(
|
|
94
|
+
var component = (0, jsx_1.parseJsx)(customCode);
|
|
95
|
+
var output = (0, liquid_1.componentToLiquid)()({ component: component });
|
|
96
96
|
expect(output).toMatchSnapshot();
|
|
97
97
|
});
|
|
98
98
|
test('Image', function () {
|
|
99
|
-
var
|
|
100
|
-
var output = liquid_1.componentToLiquid(
|
|
99
|
+
var component = (0, jsx_1.parseJsx)(image);
|
|
100
|
+
var output = (0, liquid_1.componentToLiquid)()({ component: component });
|
|
101
101
|
expect(output).toMatchSnapshot();
|
|
102
102
|
});
|
|
103
103
|
test('Columns', function () {
|
|
104
|
-
var
|
|
105
|
-
var output = liquid_1.componentToLiquid(
|
|
104
|
+
var component = (0, jsx_1.parseJsx)(columns);
|
|
105
|
+
var output = (0, liquid_1.componentToLiquid)()({ component: component });
|
|
106
106
|
expect(output).toMatchSnapshot();
|
|
107
107
|
});
|
|
108
108
|
});
|
|
@@ -4,7 +4,7 @@ var jsx_1 = require("../parsers/jsx");
|
|
|
4
4
|
var buttonWithMetadata = require('./data/blocks/button-with-metadata.raw');
|
|
5
5
|
describe('Parse JSX', function () {
|
|
6
6
|
test('metadata', function () {
|
|
7
|
-
var json = jsx_1.parseJsx(buttonWithMetadata);
|
|
7
|
+
var json = (0, jsx_1.parseJsx)(buttonWithMetadata);
|
|
8
8
|
expect(json).toMatchSnapshot();
|
|
9
9
|
});
|
|
10
10
|
});
|
|
@@ -37,26 +37,35 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
37
37
|
};
|
|
38
38
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
39
|
var fs_extra_promise_1 = require("fs-extra-promise");
|
|
40
|
-
var
|
|
40
|
+
var __1 = require("..");
|
|
41
|
+
var index_1 = require("../generators/qwik/index");
|
|
42
|
+
var src_generator_1 = require("../generators/qwik/src-generator");
|
|
41
43
|
var jsx_1 = require("../parsers/jsx");
|
|
44
|
+
var compile_away_builder_components_1 = require("../plugins/compile-away-builder-components");
|
|
42
45
|
var todo = require('../../../../examples/todo/src/components/todo.lite');
|
|
43
46
|
var todos = require('../../../../examples/todo/src/components/todos.lite');
|
|
44
47
|
var debugFiles = true;
|
|
45
|
-
var debugOutput = function (
|
|
46
|
-
var
|
|
47
|
-
return __generator(this, function (
|
|
48
|
-
switch (
|
|
48
|
+
var debugOutput = function (fileSet) { return __awaiter(void 0, void 0, void 0, function () {
|
|
49
|
+
var testName, base, _a, _b, _i, key, file;
|
|
50
|
+
return __generator(this, function (_c) {
|
|
51
|
+
switch (_c.label) {
|
|
49
52
|
case 0:
|
|
53
|
+
testName = expect.getState().currentTestName;
|
|
54
|
+
base = 'dist/test/' + testName.split(' ').join('/') + '/';
|
|
50
55
|
if (!debugFiles) return [3 /*break*/, 4];
|
|
51
|
-
|
|
52
|
-
_b
|
|
56
|
+
_a = [];
|
|
57
|
+
for (_b in fileSet)
|
|
58
|
+
_a.push(_b);
|
|
59
|
+
_i = 0;
|
|
60
|
+
_c.label = 1;
|
|
53
61
|
case 1:
|
|
54
62
|
if (!(_i < _a.length)) return [3 /*break*/, 4];
|
|
55
|
-
|
|
56
|
-
|
|
63
|
+
key = _a[_i];
|
|
64
|
+
file = fileSet[key];
|
|
65
|
+
return [4 /*yield*/, (0, fs_extra_promise_1.outputFileAsync)(base + file.path, file.contents)];
|
|
57
66
|
case 2:
|
|
58
|
-
|
|
59
|
-
|
|
67
|
+
_c.sent();
|
|
68
|
+
_c.label = 3;
|
|
60
69
|
case 3:
|
|
61
70
|
_i++;
|
|
62
71
|
return [3 /*break*/, 1];
|
|
@@ -64,52 +73,190 @@ var debugOutput = function (output) { return __awaiter(void 0, void 0, void 0, f
|
|
|
64
73
|
}
|
|
65
74
|
});
|
|
66
75
|
}); };
|
|
67
|
-
describe('
|
|
68
|
-
|
|
69
|
-
|
|
76
|
+
describe('qwik', function () {
|
|
77
|
+
describe('todo', function () {
|
|
78
|
+
test('Todo.tsx', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
79
|
+
var json, fileSet;
|
|
80
|
+
return __generator(this, function (_a) {
|
|
81
|
+
json = (0, jsx_1.parseJsx)(todo);
|
|
82
|
+
fileSet = (0, index_1.createFileSet)({ output: 'ts' });
|
|
83
|
+
(0, index_1.addComponent)(fileSet, json);
|
|
84
|
+
debugOutput(fileSet);
|
|
85
|
+
expect(toObj(fileSet)).toMatchSnapshot();
|
|
86
|
+
return [2 /*return*/];
|
|
87
|
+
});
|
|
88
|
+
}); });
|
|
89
|
+
test('Todo.cjs', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
90
|
+
var json, fileSet;
|
|
91
|
+
return __generator(this, function (_a) {
|
|
92
|
+
json = (0, jsx_1.parseJsx)(todo);
|
|
93
|
+
fileSet = (0, index_1.createFileSet)({ output: 'cjs', jsx: false });
|
|
94
|
+
(0, index_1.addComponent)(fileSet, json);
|
|
95
|
+
debugOutput(fileSet);
|
|
96
|
+
expect(toObj(fileSet)).toMatchSnapshot();
|
|
97
|
+
return [2 /*return*/];
|
|
98
|
+
});
|
|
99
|
+
}); });
|
|
100
|
+
test('Todo.js', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
101
|
+
var json, fileSet;
|
|
102
|
+
return __generator(this, function (_a) {
|
|
103
|
+
json = (0, jsx_1.parseJsx)(todo);
|
|
104
|
+
fileSet = (0, index_1.createFileSet)({
|
|
105
|
+
output: 'mjs',
|
|
106
|
+
minify: true,
|
|
107
|
+
jsx: false,
|
|
108
|
+
});
|
|
109
|
+
(0, index_1.addComponent)(fileSet, json);
|
|
110
|
+
debugOutput(fileSet);
|
|
111
|
+
expect(toObj(fileSet)).toMatchSnapshot();
|
|
112
|
+
return [2 /*return*/];
|
|
113
|
+
});
|
|
114
|
+
}); });
|
|
115
|
+
});
|
|
116
|
+
describe('todos', function () {
|
|
117
|
+
test('Todo.tsx', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
118
|
+
var json, fileSet;
|
|
119
|
+
return __generator(this, function (_a) {
|
|
120
|
+
json = (0, jsx_1.parseJsx)(todos);
|
|
121
|
+
fileSet = (0, index_1.createFileSet)({ output: 'ts' });
|
|
122
|
+
(0, index_1.addComponent)(fileSet, json);
|
|
123
|
+
debugOutput(fileSet);
|
|
124
|
+
expect(toObj(fileSet)).toMatchSnapshot();
|
|
125
|
+
return [2 /*return*/];
|
|
126
|
+
});
|
|
127
|
+
}); });
|
|
128
|
+
});
|
|
129
|
+
describe('hello_world', function () {
|
|
130
|
+
test('stylesheet', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
131
|
+
var component, fileSet;
|
|
132
|
+
return __generator(this, function (_a) {
|
|
133
|
+
component = (0, __1.builderContentToMitosisComponent)(require('./qwik.test.hello_world.json'));
|
|
134
|
+
fileSet = (0, index_1.createFileSet)({ output: 'mjs' });
|
|
135
|
+
(0, index_1.addComponent)(fileSet, component);
|
|
136
|
+
debugOutput(fileSet);
|
|
137
|
+
expect(toObj(fileSet)).toMatchSnapshot();
|
|
138
|
+
return [2 /*return*/];
|
|
139
|
+
});
|
|
140
|
+
}); });
|
|
141
|
+
});
|
|
142
|
+
test('page-with-symbol', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
143
|
+
var component, fileSet;
|
|
70
144
|
return __generator(this, function (_a) {
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
expect(output).toMatchSnapshot();
|
|
78
|
-
debugOutput(output);
|
|
79
|
-
return [2 /*return*/];
|
|
80
|
-
}
|
|
145
|
+
component = (0, __1.builderContentToMitosisComponent)(require('./qwik.test.page-with-symbol.json'));
|
|
146
|
+
fileSet = (0, index_1.createFileSet)({ output: 'mjs', jsx: false });
|
|
147
|
+
(0, index_1.addComponent)(fileSet, component);
|
|
148
|
+
debugOutput(fileSet);
|
|
149
|
+
expect(toObj(fileSet)).toMatchSnapshot();
|
|
150
|
+
return [2 /*return*/];
|
|
81
151
|
});
|
|
82
152
|
}); });
|
|
83
|
-
test('
|
|
84
|
-
var
|
|
153
|
+
test('button', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
154
|
+
var component, fileSet;
|
|
85
155
|
return __generator(this, function (_a) {
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
case 1:
|
|
93
|
-
output = _a.sent();
|
|
94
|
-
expect(output).toMatchSnapshot();
|
|
95
|
-
debugOutput(output);
|
|
96
|
-
return [2 /*return*/];
|
|
97
|
-
}
|
|
156
|
+
component = (0, __1.builderContentToMitosisComponent)(require('./qwik.test.button.json'));
|
|
157
|
+
fileSet = (0, index_1.createFileSet)({ output: 'mjs', jsx: false });
|
|
158
|
+
(0, index_1.addComponent)(fileSet, component);
|
|
159
|
+
debugOutput(fileSet);
|
|
160
|
+
expect(toObj(fileSet)).toMatchSnapshot();
|
|
161
|
+
return [2 /*return*/];
|
|
98
162
|
});
|
|
99
163
|
}); });
|
|
100
|
-
test('
|
|
101
|
-
var
|
|
164
|
+
test('svg', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
165
|
+
var component, fileSet;
|
|
102
166
|
return __generator(this, function (_a) {
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
167
|
+
component = (0, __1.builderContentToMitosisComponent)(require('./qwik.test.svg.json'), {
|
|
168
|
+
includeBuilderExtras: true,
|
|
169
|
+
preserveTextBlocks: true,
|
|
170
|
+
});
|
|
171
|
+
fileSet = (0, index_1.createFileSet)({ output: 'mjs', jsx: false });
|
|
172
|
+
(0, index_1.addComponent)(fileSet, component);
|
|
173
|
+
debugOutput(fileSet);
|
|
174
|
+
expect(toObj(fileSet)).toMatchSnapshot();
|
|
175
|
+
return [2 /*return*/];
|
|
176
|
+
});
|
|
177
|
+
}); });
|
|
178
|
+
test('Image', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
179
|
+
var component, fileSet;
|
|
180
|
+
return __generator(this, function (_a) {
|
|
181
|
+
component = (0, __1.builderContentToMitosisComponent)(require('./qwik.test.image.json'), {
|
|
182
|
+
includeBuilderExtras: true,
|
|
183
|
+
preserveTextBlocks: true,
|
|
184
|
+
});
|
|
185
|
+
fileSet = (0, index_1.createFileSet)({ output: 'mjs', jsx: false });
|
|
186
|
+
(0, index_1.addComponent)(fileSet, component);
|
|
187
|
+
debugOutput(fileSet);
|
|
188
|
+
expect(toObj(fileSet)).toMatchSnapshot();
|
|
189
|
+
return [2 /*return*/];
|
|
190
|
+
});
|
|
191
|
+
}); });
|
|
192
|
+
test('Image.slow', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
193
|
+
var component, fileSet;
|
|
194
|
+
return __generator(this, function (_a) {
|
|
195
|
+
component = (0, __1.builderContentToMitosisComponent)(require('./qwik.test.image.json'), {
|
|
196
|
+
includeBuilderExtras: true,
|
|
197
|
+
preserveTextBlocks: true,
|
|
198
|
+
});
|
|
199
|
+
(0, compile_away_builder_components_1.compileAwayBuilderComponentsFromTree)(component, compile_away_builder_components_1.components);
|
|
200
|
+
fileSet = (0, index_1.createFileSet)({ output: 'mjs', jsx: false });
|
|
201
|
+
(0, index_1.addComponent)(fileSet, component);
|
|
202
|
+
debugOutput(fileSet);
|
|
203
|
+
expect(toObj(fileSet)).toMatchSnapshot();
|
|
204
|
+
return [2 /*return*/];
|
|
205
|
+
});
|
|
206
|
+
}); });
|
|
207
|
+
test('Accordion', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
208
|
+
var component, fileSet;
|
|
209
|
+
return __generator(this, function (_a) {
|
|
210
|
+
component = (0, __1.builderContentToMitosisComponent)(require('./qwik.test.accordion.json'), {
|
|
211
|
+
includeBuilderExtras: true,
|
|
212
|
+
preserveTextBlocks: true,
|
|
213
|
+
});
|
|
214
|
+
(0, compile_away_builder_components_1.compileAwayBuilderComponentsFromTree)(component, compile_away_builder_components_1.components);
|
|
215
|
+
fileSet = (0, index_1.createFileSet)({ output: 'mjs', jsx: true });
|
|
216
|
+
(0, index_1.addComponent)(fileSet, component);
|
|
217
|
+
debugOutput(fileSet);
|
|
218
|
+
expect(toObj(fileSet)).toMatchSnapshot();
|
|
219
|
+
return [2 /*return*/];
|
|
113
220
|
});
|
|
114
221
|
}); });
|
|
222
|
+
test('For', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
223
|
+
var component, fileSet;
|
|
224
|
+
return __generator(this, function (_a) {
|
|
225
|
+
component = (0, __1.builderContentToMitosisComponent)(require('./qwik.test.for-loop.json'), {
|
|
226
|
+
includeBuilderExtras: true,
|
|
227
|
+
preserveTextBlocks: true,
|
|
228
|
+
});
|
|
229
|
+
(0, compile_away_builder_components_1.compileAwayBuilderComponentsFromTree)(component, compile_away_builder_components_1.components);
|
|
230
|
+
fileSet = (0, index_1.createFileSet)({ output: 'mjs', jsx: true });
|
|
231
|
+
(0, index_1.addComponent)(fileSet, component);
|
|
232
|
+
debugOutput(fileSet);
|
|
233
|
+
expect(toObj(fileSet)).toMatchSnapshot();
|
|
234
|
+
return [2 /*return*/];
|
|
235
|
+
});
|
|
236
|
+
}); });
|
|
237
|
+
describe('helper functions', function () {
|
|
238
|
+
describe('isStatement', function () {
|
|
239
|
+
test('is an expression', function () {
|
|
240
|
+
expect((0, src_generator_1.isStatement)('a.b')).toBe(false);
|
|
241
|
+
expect((0, src_generator_1.isStatement)('1?2:"bar"')).toBe(false);
|
|
242
|
+
expect((0, src_generator_1.isStatement)('"var x; return foo + \'\\"\';"')).toBe(false);
|
|
243
|
+
expect((0, src_generator_1.isStatement)('"foo" + `bar\nbaz`')).toBe(false);
|
|
244
|
+
expect((0, src_generator_1.isStatement)('(...)()')).toBe(false);
|
|
245
|
+
});
|
|
246
|
+
test('is a statement', function () {
|
|
247
|
+
expect((0, src_generator_1.isStatement)('var x; return x;')).toBe(true);
|
|
248
|
+
expect((0, src_generator_1.isStatement)('var x')).toBe(true);
|
|
249
|
+
});
|
|
250
|
+
});
|
|
251
|
+
});
|
|
115
252
|
});
|
|
253
|
+
function toObj(fileSet) {
|
|
254
|
+
var obj = {};
|
|
255
|
+
for (var key in fileSet) {
|
|
256
|
+
if (Object.prototype.hasOwnProperty.call(fileSet, key)) {
|
|
257
|
+
var file = fileSet[key];
|
|
258
|
+
obj[file.path] = file.contents;
|
|
259
|
+
}
|
|
260
|
+
}
|
|
261
|
+
return obj;
|
|
262
|
+
}
|
|
@@ -21,90 +21,90 @@ var image = require('./data/blocks/image.raw');
|
|
|
21
21
|
var columns = require('./data/blocks/columns.raw');
|
|
22
22
|
describe('React', function () {
|
|
23
23
|
test('Basic', function () {
|
|
24
|
-
var
|
|
25
|
-
var output = react_native_1.componentToReactNative(
|
|
24
|
+
var component = (0, jsx_1.parseJsx)(basic);
|
|
25
|
+
var output = (0, react_native_1.componentToReactNative)()({ component: component });
|
|
26
26
|
expect(output).toMatchSnapshot();
|
|
27
27
|
});
|
|
28
28
|
test('Input block', function () {
|
|
29
|
-
var
|
|
30
|
-
var output = react_native_1.componentToReactNative(
|
|
29
|
+
var component = (0, jsx_1.parseJsx)(inputBlock);
|
|
30
|
+
var output = (0, react_native_1.componentToReactNative)()({ component: component });
|
|
31
31
|
expect(output).toMatchSnapshot();
|
|
32
32
|
});
|
|
33
33
|
test('Submit button block', function () {
|
|
34
|
-
var
|
|
35
|
-
var output = react_native_1.componentToReactNative(
|
|
34
|
+
var component = (0, jsx_1.parseJsx)(submitButtonBlock);
|
|
35
|
+
var output = (0, react_native_1.componentToReactNative)()({ component: component });
|
|
36
36
|
expect(output).toMatchSnapshot();
|
|
37
37
|
});
|
|
38
38
|
test('Select block', function () {
|
|
39
|
-
var
|
|
40
|
-
var output = react_native_1.componentToReactNative(
|
|
39
|
+
var component = (0, jsx_1.parseJsx)(selectBlock);
|
|
40
|
+
var output = (0, react_native_1.componentToReactNative)()({ component: component });
|
|
41
41
|
expect(output).toMatchSnapshot();
|
|
42
42
|
});
|
|
43
43
|
test('Form block', function () {
|
|
44
|
-
var
|
|
45
|
-
var output = react_native_1.componentToReactNative(
|
|
44
|
+
var component = (0, jsx_1.parseJsx)(formBlock);
|
|
45
|
+
var output = (0, react_native_1.componentToReactNative)()({ component: component });
|
|
46
46
|
expect(output).toMatchSnapshot();
|
|
47
47
|
});
|
|
48
48
|
test('Button', function () {
|
|
49
|
-
var
|
|
50
|
-
var output = react_native_1.componentToReactNative(
|
|
49
|
+
var component = (0, jsx_1.parseJsx)(button);
|
|
50
|
+
var output = (0, react_native_1.componentToReactNative)()({ component: component });
|
|
51
51
|
expect(output).toMatchSnapshot();
|
|
52
52
|
});
|
|
53
53
|
test('Textarea', function () {
|
|
54
|
-
var
|
|
55
|
-
var output = react_native_1.componentToReactNative(
|
|
54
|
+
var component = (0, jsx_1.parseJsx)(textarea);
|
|
55
|
+
var output = (0, react_native_1.componentToReactNative)()({ component: component });
|
|
56
56
|
expect(output).toMatchSnapshot();
|
|
57
57
|
});
|
|
58
58
|
test('Img', function () {
|
|
59
|
-
var
|
|
60
|
-
var output = react_native_1.componentToReactNative(
|
|
59
|
+
var component = (0, jsx_1.parseJsx)(img);
|
|
60
|
+
var output = (0, react_native_1.componentToReactNative)()({ component: component });
|
|
61
61
|
expect(output).toMatchSnapshot();
|
|
62
62
|
});
|
|
63
63
|
test('Video', function () {
|
|
64
|
-
var
|
|
65
|
-
var output = react_native_1.componentToReactNative(
|
|
64
|
+
var component = (0, jsx_1.parseJsx)(video);
|
|
65
|
+
var output = (0, react_native_1.componentToReactNative)()({ component: component });
|
|
66
66
|
expect(output).toMatchSnapshot();
|
|
67
67
|
});
|
|
68
68
|
test('Section', function () {
|
|
69
|
-
var
|
|
70
|
-
var output = react_native_1.componentToReactNative(
|
|
69
|
+
var component = (0, jsx_1.parseJsx)(section);
|
|
70
|
+
var output = (0, react_native_1.componentToReactNative)()({ component: component });
|
|
71
71
|
expect(output).toMatchSnapshot();
|
|
72
72
|
});
|
|
73
73
|
test('Text', function () {
|
|
74
|
-
var
|
|
75
|
-
var output = react_native_1.componentToReactNative(
|
|
74
|
+
var component = (0, jsx_1.parseJsx)(text);
|
|
75
|
+
var output = (0, react_native_1.componentToReactNative)()({ component: component });
|
|
76
76
|
expect(output).toMatchSnapshot();
|
|
77
77
|
});
|
|
78
78
|
test('RawText', function () {
|
|
79
|
-
var
|
|
80
|
-
var output = react_native_1.componentToReactNative(
|
|
79
|
+
var component = (0, jsx_1.parseJsx)(rawText);
|
|
80
|
+
var output = (0, react_native_1.componentToReactNative)()({ component: component });
|
|
81
81
|
expect(output).toMatchSnapshot();
|
|
82
82
|
});
|
|
83
83
|
test('Stamped.io', function () {
|
|
84
|
-
var
|
|
85
|
-
var output = react_native_1.componentToReactNative(
|
|
84
|
+
var component = (0, jsx_1.parseJsx)(stamped);
|
|
85
|
+
var output = (0, react_native_1.componentToReactNative)({
|
|
86
86
|
stateType: 'useState',
|
|
87
|
-
});
|
|
87
|
+
})({ component: component });
|
|
88
88
|
expect(output).toMatchSnapshot();
|
|
89
89
|
});
|
|
90
90
|
test('CustomCode', function () {
|
|
91
|
-
var
|
|
92
|
-
var output = react_native_1.componentToReactNative(
|
|
91
|
+
var component = (0, jsx_1.parseJsx)(customCode);
|
|
92
|
+
var output = (0, react_native_1.componentToReactNative)()({ component: component });
|
|
93
93
|
expect(output).toMatchSnapshot();
|
|
94
94
|
});
|
|
95
95
|
test('Embed', function () {
|
|
96
|
-
var
|
|
97
|
-
var output = react_native_1.componentToReactNative(
|
|
96
|
+
var component = (0, jsx_1.parseJsx)(customCode);
|
|
97
|
+
var output = (0, react_native_1.componentToReactNative)()({ component: component });
|
|
98
98
|
expect(output).toMatchSnapshot();
|
|
99
99
|
});
|
|
100
100
|
test('Image', function () {
|
|
101
|
-
var
|
|
102
|
-
var output = react_native_1.componentToReactNative(
|
|
101
|
+
var component = (0, jsx_1.parseJsx)(image);
|
|
102
|
+
var output = (0, react_native_1.componentToReactNative)()({ component: component });
|
|
103
103
|
expect(output).toMatchSnapshot();
|
|
104
104
|
});
|
|
105
105
|
test('Columns', function () {
|
|
106
|
-
var
|
|
107
|
-
var output = react_native_1.componentToReactNative(
|
|
106
|
+
var component = (0, jsx_1.parseJsx)(columns);
|
|
107
|
+
var output = (0, react_native_1.componentToReactNative)()({ component: component });
|
|
108
108
|
expect(output).toMatchSnapshot();
|
|
109
109
|
});
|
|
110
110
|
});
|