@builder.io/mitosis 0.0.50-6 → 0.0.50
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__/angular.test.js +6 -0
- package/dist/src/__tests__/builder.test.js +5 -1
- package/dist/src/__tests__/data/blocks/multiple-onUpdate.raw.d.ts +1 -0
- package/dist/src/__tests__/data/blocks/multiple-onUpdate.raw.jsx +13 -0
- package/dist/src/__tests__/data/blocks/multiple-onUpdateWithDeps.raw.d.ts +1 -0
- package/dist/src/__tests__/data/blocks/multiple-onUpdateWithDeps.raw.jsx +19 -0
- package/dist/src/__tests__/data/blocks/onUpdateWithDeps.raw.jsx +6 -3
- package/dist/src/__tests__/data/blocks/self-referencing-component-with-children.raw.d.ts +1 -0
- package/dist/src/__tests__/data/blocks/self-referencing-component-with-children.raw.jsx +15 -0
- package/dist/src/__tests__/data/blocks/self-referencing-component.raw.d.ts +1 -0
- package/dist/src/__tests__/data/blocks/self-referencing-component.raw.jsx +12 -0
- package/dist/src/__tests__/data/blocks/shadow-dom.raw.d.ts +6 -0
- package/dist/src/__tests__/data/blocks/shadow-dom.raw.jsx +54 -0
- package/dist/src/__tests__/data/blocks/slot.raw.d.ts +5 -0
- package/dist/src/__tests__/data/blocks/slot.raw.jsx +6 -0
- package/dist/src/__tests__/data/blocks/stamped-io.raw.jsx +8 -0
- package/dist/src/__tests__/data/blocks/styles.raw.d.ts +1 -0
- package/dist/src/__tests__/data/blocks/styles.raw.jsx +10 -0
- package/dist/src/__tests__/data/context/simple.context.lite.d.ts +8 -1
- package/dist/src/__tests__/html.test.js +6 -0
- package/dist/src/__tests__/qwik.directive.test.d.ts +1 -0
- package/dist/src/__tests__/qwik.directive.test.js +107 -0
- package/dist/src/__tests__/qwik.test.js +256 -128
- package/dist/src/__tests__/react-native.test.js +12 -0
- package/dist/src/__tests__/react.test.js +12 -0
- package/dist/src/__tests__/svelte.test.js +24 -0
- package/dist/src/__tests__/vue.test.js +12 -0
- package/dist/src/__tests__/webcomponent.test.d.ts +1 -0
- package/dist/src/__tests__/webcomponent.test.js +12 -0
- package/dist/src/constants/html_tags.d.ts +1 -0
- package/dist/src/constants/html_tags.js +119 -0
- package/dist/src/generators/angular.js +7 -4
- package/dist/src/generators/context/react copy.d.ts +8 -0
- package/dist/src/generators/context/react copy.js +28 -0
- package/dist/src/generators/context/solid.d.ts +8 -0
- package/dist/src/generators/context/solid.js +28 -0
- package/dist/src/generators/context/svelte.d.ts +8 -0
- package/dist/src/generators/context/svelte.js +28 -0
- package/dist/src/generators/helpers/context.d.ts +2 -0
- package/dist/src/generators/helpers/context.js +8 -0
- package/dist/src/generators/html.js +20 -14
- package/dist/src/generators/mitosis.js +4 -3
- package/dist/src/generators/qwik/component.js +26 -5
- package/dist/src/generators/qwik/directives.d.ts +14 -5
- package/dist/src/generators/qwik/directives.js +32 -25
- package/dist/src/generators/qwik/handlers.js +3 -4
- package/dist/src/generators/qwik/jsx.js +17 -5
- package/dist/src/generators/qwik/src-generator.d.ts +0 -9
- package/dist/src/generators/qwik/src-generator.js +93 -101
- package/dist/src/generators/qwik/styles.js +8 -11
- package/dist/src/generators/react.js +9 -8
- package/dist/src/generators/solid.js +82 -8
- package/dist/src/generators/stencil/generate.js +5 -3
- package/dist/src/generators/stencil/index.js +5 -1
- package/dist/src/generators/svelte.d.ts +9 -1
- package/dist/src/generators/svelte.js +175 -76
- package/dist/src/generators/vue.d.ts +1 -1
- package/dist/src/generators/vue.js +86 -10
- package/dist/src/helpers/babel-transform copy.d.ts +8 -0
- package/dist/src/helpers/babel-transform copy.js +138 -0
- package/dist/src/helpers/babel-transform.d.ts +4 -7
- package/dist/src/helpers/babel-transform.js +18 -2
- package/dist/src/helpers/babel-transform.test.d.ts +1 -0
- package/dist/src/helpers/babel-transform.test.js +7 -0
- package/dist/src/helpers/create-mitosis-component.js +1 -1
- package/dist/src/helpers/get-state-object-string.js +2 -1
- package/dist/src/helpers/map-refs.js +22 -9
- package/dist/src/helpers/parsers.d.ts +8 -0
- package/dist/src/helpers/parsers.js +66 -0
- package/dist/src/helpers/render-imports.d.ts +2 -4
- package/dist/src/helpers/render-imports.js +32 -14
- package/dist/src/index.d.ts +10 -5
- package/dist/src/index.js +11 -5
- package/dist/src/parsers/builder.d.ts +16 -50
- package/dist/src/parsers/builder.js +22 -40
- package/dist/src/parsers/context.js +5 -1
- package/dist/src/parsers/jsx.d.ts +7 -0
- package/dist/src/parsers/jsx.js +27 -5
- package/dist/src/parsers/liquid.js +5 -1
- package/dist/src/plugins/compile-away-builder-components.js +5 -1
- package/dist/src/symbols/symbol-processor.js +3 -3
- package/dist/src/targets.d.ts +1 -1
- package/dist/src/types/mitosis-component.d.ts +8 -3
- package/dist/test/qwik/Accordion/high.jsx +0 -1
- package/dist/test/qwik/Accordion/low.jsx +171 -65
- package/dist/test/qwik/Accordion/med.jsx +9 -10
- package/dist/test/qwik/For/high.jsx +0 -1
- package/dist/test/qwik/For/low.jsx +25 -58
- package/dist/test/qwik/For/med.jsx +9 -10
- package/dist/test/qwik/Image/high.js +9 -1
- package/dist/test/qwik/Image/low.js +0 -42
- package/dist/test/qwik/Image/med.js +149 -12
- package/dist/test/qwik/Image.slow/high.js +9 -1
- package/dist/test/qwik/Image.slow/low.js +0 -42
- package/dist/test/qwik/Image.slow/med.js +149 -12
- package/dist/{src/types/generators.d.ts → test/qwik/bindings/high.cjs} +0 -0
- package/dist/test/qwik/bindings/low.cjs +33 -0
- package/dist/test/qwik/bindings/med.cjs +12 -0
- package/dist/test/qwik/button/high.js +1 -13
- package/dist/test/qwik/button/low.js +8 -40
- package/dist/test/qwik/button/med.js +36 -11
- package/dist/test/qwik/component/bindings/high.jsx +0 -1
- package/dist/test/qwik/component/bindings/low.jsx +26 -71
- package/dist/test/qwik/component/bindings/med.jsx +48 -39
- package/dist/test/qwik/component/component/inputs/high.cjsx +9 -0
- package/dist/test/qwik/component/component/inputs/low.cjsx +0 -0
- package/dist/test/qwik/component/component/inputs/med.cjsx +65 -0
- package/dist/test/qwik/hello_world/stylesheet/high.jsx +0 -1
- package/dist/test/qwik/hello_world/stylesheet/low.jsx +6 -27
- package/dist/test/qwik/hello_world/stylesheet/med.jsx +9 -10
- package/dist/test/qwik/page-with-symbol/high.js +0 -1
- package/dist/test/qwik/page-with-symbol/low.js +15 -52
- package/dist/test/qwik/page-with-symbol/med.js +9 -10
- package/dist/test/qwik/show-hide/high.jsx +9 -0
- package/dist/test/qwik/show-hide/low.jsx +0 -0
- package/dist/test/qwik/show-hide/med.jsx +174 -0
- package/dist/test/qwik/svg/high.js +0 -1
- package/dist/test/qwik/svg/low.js +9 -35
- package/dist/test/qwik/svg/med.js +9 -10
- package/dist/test/qwik/todo/Todo.cjs/high.cjs +4 -39
- package/dist/test/qwik/todo/Todo.cjs/low.cjs +0 -1
- package/dist/test/qwik/todo/Todo.cjs/med.cjs +38 -61
- package/dist/test/qwik/todo/Todo.js/high.js +22 -5
- package/dist/test/qwik/todo/Todo.js/med.js +45 -1
- package/dist/test/qwik/todo/Todo.tsx/high.tsx +4 -39
- package/dist/test/qwik/todo/Todo.tsx/low.tsx +0 -1
- package/dist/test/qwik/todo/Todo.tsx/med.tsx +31 -34
- package/dist/test/qwik/todos/Todo.tsx/high.tsx +0 -12
- package/dist/test/qwik/todos/Todo.tsx/low.tsx +18 -25
- package/dist/test/qwik/todos/Todo.tsx/med.tsx +8 -10
- package/dist/tsconfig.build.tsbuildinfo +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +22 -22
- package/dist/src/__tests__/data/blocks/onMount-onUnMount.d.ts +0 -1
- package/dist/src/__tests__/data/blocks/onMount-onUnMount.jsx +0 -13
- package/dist/src/__tests__/data/blocks/onMount.d.ts +0 -1
- package/dist/src/__tests__/data/blocks/onMount.jsx +0 -13
- package/dist/src/types/generators.js +0 -1
|
@@ -37,6 +37,7 @@ 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 qwik_1 = require("../generators/qwik");
|
|
40
41
|
var index_1 = require("../generators/qwik/index");
|
|
41
42
|
var src_generator_1 = require("../generators/qwik/src-generator");
|
|
42
43
|
var builder_1 = require("../parsers/builder");
|
|
@@ -79,38 +80,52 @@ describe('qwik', function () {
|
|
|
79
80
|
test('Todo.tsx', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
80
81
|
var json, fileSet;
|
|
81
82
|
return __generator(this, function (_a) {
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
83
|
+
switch (_a.label) {
|
|
84
|
+
case 0:
|
|
85
|
+
json = (0, jsx_1.parseJsx)(todo);
|
|
86
|
+
fileSet = (0, index_1.createFileSet)({ output: 'ts' });
|
|
87
|
+
(0, index_1.addComponent)(fileSet, json);
|
|
88
|
+
return [4 /*yield*/, debugOutput(fileSet)];
|
|
89
|
+
case 1:
|
|
90
|
+
_a.sent();
|
|
91
|
+
expect(toObj(fileSet)).toMatchSnapshot();
|
|
92
|
+
return [2 /*return*/];
|
|
93
|
+
}
|
|
88
94
|
});
|
|
89
95
|
}); });
|
|
90
96
|
test('Todo.cjs', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
91
97
|
var json, fileSet;
|
|
92
98
|
return __generator(this, function (_a) {
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
+
switch (_a.label) {
|
|
100
|
+
case 0:
|
|
101
|
+
json = (0, jsx_1.parseJsx)(todo);
|
|
102
|
+
fileSet = (0, index_1.createFileSet)({ output: 'cjs', jsx: false });
|
|
103
|
+
(0, index_1.addComponent)(fileSet, json);
|
|
104
|
+
return [4 /*yield*/, debugOutput(fileSet)];
|
|
105
|
+
case 1:
|
|
106
|
+
_a.sent();
|
|
107
|
+
expect(toObj(fileSet)).toMatchSnapshot();
|
|
108
|
+
return [2 /*return*/];
|
|
109
|
+
}
|
|
99
110
|
});
|
|
100
111
|
}); });
|
|
101
112
|
test('Todo.js', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
102
113
|
var json, fileSet;
|
|
103
114
|
return __generator(this, function (_a) {
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
115
|
+
switch (_a.label) {
|
|
116
|
+
case 0:
|
|
117
|
+
json = (0, jsx_1.parseJsx)(todo);
|
|
118
|
+
fileSet = (0, index_1.createFileSet)({
|
|
119
|
+
output: 'mjs',
|
|
120
|
+
jsx: false,
|
|
121
|
+
});
|
|
122
|
+
(0, index_1.addComponent)(fileSet, json);
|
|
123
|
+
return [4 /*yield*/, debugOutput(fileSet)];
|
|
124
|
+
case 1:
|
|
125
|
+
_a.sent();
|
|
126
|
+
expect(toObj(fileSet)).toMatchSnapshot();
|
|
127
|
+
return [2 /*return*/];
|
|
128
|
+
}
|
|
114
129
|
});
|
|
115
130
|
}); });
|
|
116
131
|
});
|
|
@@ -118,12 +133,17 @@ describe('qwik', function () {
|
|
|
118
133
|
test('Todo.tsx', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
119
134
|
var json, fileSet;
|
|
120
135
|
return __generator(this, function (_a) {
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
136
|
+
switch (_a.label) {
|
|
137
|
+
case 0:
|
|
138
|
+
json = (0, jsx_1.parseJsx)(todos);
|
|
139
|
+
fileSet = (0, index_1.createFileSet)({ output: 'ts' });
|
|
140
|
+
(0, index_1.addComponent)(fileSet, json);
|
|
141
|
+
return [4 /*yield*/, debugOutput(fileSet)];
|
|
142
|
+
case 1:
|
|
143
|
+
_a.sent();
|
|
144
|
+
expect(toObj(fileSet)).toMatchSnapshot();
|
|
145
|
+
return [2 /*return*/];
|
|
146
|
+
}
|
|
127
147
|
});
|
|
128
148
|
}); });
|
|
129
149
|
});
|
|
@@ -131,152 +151,260 @@ describe('qwik', function () {
|
|
|
131
151
|
test('stylesheet', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
132
152
|
var component, fileSet;
|
|
133
153
|
return __generator(this, function (_a) {
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
154
|
+
switch (_a.label) {
|
|
155
|
+
case 0:
|
|
156
|
+
component = (0, builder_1.builderContentToMitosisComponent)(require('./qwik.test.hello_world.json'));
|
|
157
|
+
fileSet = (0, index_1.createFileSet)({ output: 'mjs' });
|
|
158
|
+
(0, index_1.addComponent)(fileSet, component);
|
|
159
|
+
return [4 /*yield*/, debugOutput(fileSet)];
|
|
160
|
+
case 1:
|
|
161
|
+
_a.sent();
|
|
162
|
+
expect(toObj(fileSet)).toMatchSnapshot();
|
|
163
|
+
return [2 /*return*/];
|
|
164
|
+
}
|
|
140
165
|
});
|
|
141
166
|
}); });
|
|
142
167
|
});
|
|
143
168
|
test('page-with-symbol', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
144
169
|
var component, fileSet;
|
|
145
170
|
return __generator(this, function (_a) {
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
171
|
+
switch (_a.label) {
|
|
172
|
+
case 0:
|
|
173
|
+
component = (0, builder_1.builderContentToMitosisComponent)(require('./qwik.test.page-with-symbol.json'));
|
|
174
|
+
fileSet = (0, index_1.createFileSet)({ output: 'mjs', jsx: false });
|
|
175
|
+
(0, index_1.addComponent)(fileSet, component);
|
|
176
|
+
return [4 /*yield*/, debugOutput(fileSet)];
|
|
177
|
+
case 1:
|
|
178
|
+
_a.sent();
|
|
179
|
+
expect(toObj(fileSet)).toMatchSnapshot();
|
|
180
|
+
return [2 /*return*/];
|
|
181
|
+
}
|
|
152
182
|
});
|
|
153
183
|
}); });
|
|
154
184
|
test('button', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
155
185
|
var component, fileSet;
|
|
156
186
|
return __generator(this, function (_a) {
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
187
|
+
switch (_a.label) {
|
|
188
|
+
case 0:
|
|
189
|
+
component = (0, builder_1.builderContentToMitosisComponent)(require('./qwik.test.button.json'));
|
|
190
|
+
fileSet = (0, index_1.createFileSet)({ output: 'mjs', jsx: false });
|
|
191
|
+
(0, index_1.addComponent)(fileSet, component);
|
|
192
|
+
return [4 /*yield*/, debugOutput(fileSet)];
|
|
193
|
+
case 1:
|
|
194
|
+
_a.sent();
|
|
195
|
+
expect(toObj(fileSet)).toMatchSnapshot();
|
|
196
|
+
return [2 /*return*/];
|
|
197
|
+
}
|
|
163
198
|
});
|
|
164
199
|
}); });
|
|
165
200
|
test('svg', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
166
201
|
var component, fileSet;
|
|
167
202
|
return __generator(this, function (_a) {
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
203
|
+
switch (_a.label) {
|
|
204
|
+
case 0:
|
|
205
|
+
component = (0, builder_1.builderContentToMitosisComponent)(require('./qwik.test.svg.json'), {
|
|
206
|
+
includeBuilderExtras: true,
|
|
207
|
+
preserveTextBlocks: true,
|
|
208
|
+
});
|
|
209
|
+
fileSet = (0, index_1.createFileSet)({ output: 'mjs', jsx: false });
|
|
210
|
+
(0, index_1.addComponent)(fileSet, component);
|
|
211
|
+
return [4 /*yield*/, debugOutput(fileSet)];
|
|
212
|
+
case 1:
|
|
213
|
+
_a.sent();
|
|
214
|
+
expect(toObj(fileSet)).toMatchSnapshot();
|
|
215
|
+
return [2 /*return*/];
|
|
216
|
+
}
|
|
177
217
|
});
|
|
178
218
|
}); });
|
|
179
219
|
test('Image', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
180
220
|
var component, fileSet;
|
|
181
221
|
return __generator(this, function (_a) {
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
222
|
+
switch (_a.label) {
|
|
223
|
+
case 0:
|
|
224
|
+
component = (0, builder_1.builderContentToMitosisComponent)(require('./qwik.test.image.json'), {
|
|
225
|
+
includeBuilderExtras: true,
|
|
226
|
+
preserveTextBlocks: true,
|
|
227
|
+
});
|
|
228
|
+
fileSet = (0, index_1.createFileSet)({ output: 'mjs', jsx: false });
|
|
229
|
+
(0, index_1.addComponent)(fileSet, component);
|
|
230
|
+
return [4 /*yield*/, debugOutput(fileSet)];
|
|
231
|
+
case 1:
|
|
232
|
+
_a.sent();
|
|
233
|
+
expect(toObj(fileSet)).toMatchSnapshot();
|
|
234
|
+
return [2 /*return*/];
|
|
235
|
+
}
|
|
191
236
|
});
|
|
192
237
|
}); });
|
|
193
238
|
test('Image.slow', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
194
239
|
var component, fileSet;
|
|
195
240
|
return __generator(this, function (_a) {
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
241
|
+
switch (_a.label) {
|
|
242
|
+
case 0:
|
|
243
|
+
component = (0, builder_1.builderContentToMitosisComponent)(require('./qwik.test.image.json'), {
|
|
244
|
+
includeBuilderExtras: true,
|
|
245
|
+
preserveTextBlocks: true,
|
|
246
|
+
});
|
|
247
|
+
fileSet = (0, index_1.createFileSet)({ output: 'mjs', jsx: false });
|
|
248
|
+
(0, index_1.addComponent)(fileSet, component);
|
|
249
|
+
return [4 /*yield*/, debugOutput(fileSet)];
|
|
250
|
+
case 1:
|
|
251
|
+
_a.sent();
|
|
252
|
+
expect(toObj(fileSet)).toMatchSnapshot();
|
|
253
|
+
return [2 /*return*/];
|
|
254
|
+
}
|
|
205
255
|
});
|
|
206
256
|
}); });
|
|
207
257
|
test('Accordion', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
208
258
|
var component, fileSet;
|
|
209
259
|
return __generator(this, function (_a) {
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
260
|
+
switch (_a.label) {
|
|
261
|
+
case 0:
|
|
262
|
+
component = (0, builder_1.builderContentToMitosisComponent)(require('./qwik.test.accordion.json'), {
|
|
263
|
+
includeBuilderExtras: true,
|
|
264
|
+
preserveTextBlocks: true,
|
|
265
|
+
});
|
|
266
|
+
(0, compile_away_builder_components_1.compileAwayBuilderComponentsFromTree)(component, compile_away_builder_components_1.components);
|
|
267
|
+
fileSet = (0, index_1.createFileSet)({ output: 'mjs', jsx: true });
|
|
268
|
+
(0, index_1.addComponent)(fileSet, component);
|
|
269
|
+
return [4 /*yield*/, debugOutput(fileSet)];
|
|
270
|
+
case 1:
|
|
271
|
+
_a.sent();
|
|
272
|
+
expect(toObj(fileSet)).toMatchSnapshot();
|
|
273
|
+
return [2 /*return*/];
|
|
274
|
+
}
|
|
220
275
|
});
|
|
221
276
|
}); });
|
|
222
277
|
test('For', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
223
278
|
var component, fileSet;
|
|
224
279
|
return __generator(this, function (_a) {
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
280
|
+
switch (_a.label) {
|
|
281
|
+
case 0:
|
|
282
|
+
component = (0, builder_1.builderContentToMitosisComponent)(require('./qwik.test.for-loop.json'), {
|
|
283
|
+
includeBuilderExtras: true,
|
|
284
|
+
preserveTextBlocks: true,
|
|
285
|
+
});
|
|
286
|
+
(0, compile_away_builder_components_1.compileAwayBuilderComponentsFromTree)(component, compile_away_builder_components_1.components);
|
|
287
|
+
fileSet = (0, index_1.createFileSet)({ output: 'mjs', jsx: true });
|
|
288
|
+
(0, index_1.addComponent)(fileSet, component);
|
|
289
|
+
return [4 /*yield*/, debugOutput(fileSet)];
|
|
290
|
+
case 1:
|
|
291
|
+
_a.sent();
|
|
292
|
+
expect(toObj(fileSet)).toMatchSnapshot();
|
|
293
|
+
return [2 /*return*/];
|
|
294
|
+
}
|
|
235
295
|
});
|
|
236
296
|
}); });
|
|
237
297
|
describe('component', function () {
|
|
238
298
|
test('bindings', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
239
299
|
var content, state, hierarchy, fileSet, component;
|
|
240
300
|
return __generator(this, function (_a) {
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
301
|
+
switch (_a.label) {
|
|
302
|
+
case 0:
|
|
303
|
+
content = require('./qwik.test.component-binding.json');
|
|
304
|
+
state = {};
|
|
305
|
+
hierarchy = (0, symbol_processor_1.convertBuilderContentToSymbolHierarchy)(content, {
|
|
306
|
+
collectComponentState: state,
|
|
307
|
+
});
|
|
308
|
+
expect(state).toMatchSnapshot();
|
|
309
|
+
fileSet = (0, index_1.createFileSet)({ output: 'mjs', jsx: true });
|
|
310
|
+
hierarchy.depthFirstSymbols.forEach(function (builderComponent) {
|
|
311
|
+
var mitosisComponent = (0, symbol_processor_1.convertBuilderElementToMitosisComponent)(builderComponent);
|
|
312
|
+
mitosisComponent &&
|
|
313
|
+
(0, index_1.addComponent)(fileSet, mitosisComponent, { isRoot: false });
|
|
314
|
+
});
|
|
315
|
+
component = (0, builder_1.builderContentToMitosisComponent)(content, {
|
|
316
|
+
includeBuilderExtras: true,
|
|
317
|
+
preserveTextBlocks: true,
|
|
318
|
+
});
|
|
319
|
+
(0, compile_away_builder_components_1.compileAwayBuilderComponentsFromTree)(component, compile_away_builder_components_1.components);
|
|
320
|
+
(0, index_1.addComponent)(fileSet, component);
|
|
321
|
+
return [4 /*yield*/, debugOutput(fileSet)];
|
|
322
|
+
case 1:
|
|
323
|
+
_a.sent();
|
|
324
|
+
expect(toObj(fileSet)).toMatchSnapshot();
|
|
325
|
+
return [2 /*return*/];
|
|
326
|
+
}
|
|
327
|
+
});
|
|
328
|
+
}); });
|
|
329
|
+
test('component inputs', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
330
|
+
var content, state, fileSet, component;
|
|
331
|
+
return __generator(this, function (_a) {
|
|
332
|
+
switch (_a.label) {
|
|
333
|
+
case 0:
|
|
334
|
+
content = require('./qwik.test.component-inputs.json');
|
|
335
|
+
state = {};
|
|
336
|
+
expect(state).toMatchSnapshot();
|
|
337
|
+
fileSet = (0, index_1.createFileSet)({ output: 'cjs', jsx: true });
|
|
338
|
+
component = (0, builder_1.builderContentToMitosisComponent)(content, {
|
|
339
|
+
includeBuilderExtras: true,
|
|
340
|
+
preserveTextBlocks: true,
|
|
341
|
+
});
|
|
342
|
+
(0, index_1.addComponent)(fileSet, component);
|
|
343
|
+
return [4 /*yield*/, debugOutput(fileSet)];
|
|
344
|
+
case 1:
|
|
345
|
+
_a.sent();
|
|
346
|
+
expect(toObj(fileSet)).toMatchSnapshot();
|
|
347
|
+
return [2 /*return*/];
|
|
348
|
+
}
|
|
262
349
|
});
|
|
263
350
|
}); });
|
|
264
351
|
});
|
|
265
|
-
test('
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
352
|
+
test('show-hide', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
353
|
+
var content, state, fileSet, component;
|
|
354
|
+
return __generator(this, function (_a) {
|
|
355
|
+
switch (_a.label) {
|
|
356
|
+
case 0:
|
|
357
|
+
content = require('./qwik.test.show-hide.json');
|
|
358
|
+
state = {};
|
|
359
|
+
expect(state).toMatchSnapshot();
|
|
360
|
+
fileSet = (0, index_1.createFileSet)({ output: 'mjs', jsx: true });
|
|
361
|
+
component = (0, builder_1.builderContentToMitosisComponent)(content, {
|
|
362
|
+
includeBuilderExtras: true,
|
|
363
|
+
preserveTextBlocks: true,
|
|
364
|
+
});
|
|
365
|
+
(0, index_1.addComponent)(fileSet, component);
|
|
366
|
+
return [4 /*yield*/, debugOutput(fileSet)];
|
|
367
|
+
case 1:
|
|
368
|
+
_a.sent();
|
|
369
|
+
expect(toObj(fileSet)).toMatchSnapshot();
|
|
370
|
+
return [2 /*return*/];
|
|
371
|
+
}
|
|
372
|
+
});
|
|
373
|
+
}); });
|
|
374
|
+
test('bindings', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
375
|
+
var content, state, fileSet, component;
|
|
376
|
+
return __generator(this, function (_a) {
|
|
377
|
+
switch (_a.label) {
|
|
378
|
+
case 0:
|
|
379
|
+
content = require('./qwik.test.bindings.json');
|
|
380
|
+
state = {};
|
|
381
|
+
expect(state).toMatchSnapshot();
|
|
382
|
+
fileSet = (0, index_1.createFileSet)({ output: 'cjs', jsx: false });
|
|
383
|
+
component = (0, builder_1.builderContentToMitosisComponent)(content, {
|
|
384
|
+
includeBuilderExtras: true,
|
|
385
|
+
preserveTextBlocks: true,
|
|
386
|
+
});
|
|
387
|
+
(0, compile_away_builder_components_1.compileAwayBuilderComponentsFromTree)(component, compile_away_builder_components_1.components);
|
|
388
|
+
(0, index_1.addComponent)(fileSet, component);
|
|
389
|
+
return [4 /*yield*/, debugOutput(fileSet)];
|
|
390
|
+
case 1:
|
|
391
|
+
_a.sent();
|
|
392
|
+
expect(toObj(fileSet)).toMatchSnapshot();
|
|
393
|
+
return [2 /*return*/];
|
|
394
|
+
}
|
|
395
|
+
});
|
|
396
|
+
}); });
|
|
397
|
+
describe('src-generator', function () {
|
|
398
|
+
test('should format code', function () {
|
|
399
|
+
var file = new qwik_1.File('test.js', {
|
|
400
|
+
isPretty: true,
|
|
401
|
+
isTypeScript: false,
|
|
402
|
+
isJSX: true,
|
|
403
|
+
isModule: true,
|
|
404
|
+
}, '', '');
|
|
405
|
+
file.src.emit('const x=1');
|
|
406
|
+
expect(file.toString()).toEqual('const x = 1;\n');
|
|
275
407
|
});
|
|
276
|
-
(0, compile_away_builder_components_1.compileAwayBuilderComponentsFromTree)(component, compile_away_builder_components_1.components);
|
|
277
|
-
(0, index_1.addComponent)(fileSet, component);
|
|
278
|
-
debugOutput(fileSet);
|
|
279
|
-
expect(toObj(fileSet)).toMatchSnapshot();
|
|
280
408
|
});
|
|
281
409
|
describe('helper functions', function () {
|
|
282
410
|
describe('isStatement', function () {
|
|
@@ -21,6 +21,8 @@ var image = require('./data/blocks/image.raw');
|
|
|
21
21
|
var columns = require('./data/blocks/columns.raw');
|
|
22
22
|
var onUpdate = require('./data/blocks/onUpdate.raw');
|
|
23
23
|
var onUpdateWithDeps = require('./data/blocks/onUpdateWithDeps.raw');
|
|
24
|
+
var multipleOnUpdate = require('./data/blocks/multiple-onUpdate.raw');
|
|
25
|
+
var multipleOnUpdateWithDeps = require('./data/blocks/multiple-onUpdateWithDeps.raw');
|
|
24
26
|
var onMount = require('./data/blocks/onMount.raw');
|
|
25
27
|
describe('React', function () {
|
|
26
28
|
test('Basic', function () {
|
|
@@ -120,6 +122,16 @@ describe('React', function () {
|
|
|
120
122
|
var output = (0, react_native_1.componentToReactNative)()({ component: component });
|
|
121
123
|
expect(output).toMatchSnapshot();
|
|
122
124
|
});
|
|
125
|
+
test('multipleOnUpdate', function () {
|
|
126
|
+
var component = (0, jsx_1.parseJsx)(multipleOnUpdate);
|
|
127
|
+
var output = (0, react_native_1.componentToReactNative)()({ component: component });
|
|
128
|
+
expect(output).toMatchSnapshot();
|
|
129
|
+
});
|
|
130
|
+
test('multipleOnnUpdateWithDeps', function () {
|
|
131
|
+
var component = (0, jsx_1.parseJsx)(multipleOnUpdateWithDeps);
|
|
132
|
+
var output = (0, react_native_1.componentToReactNative)()({ component: component });
|
|
133
|
+
expect(output).toMatchSnapshot();
|
|
134
|
+
});
|
|
123
135
|
test('onMount & onUnMount', function () {
|
|
124
136
|
var component = (0, jsx_1.parseJsx)(onMount);
|
|
125
137
|
var output = (0, react_native_1.componentToReactNative)()({ component: component });
|
|
@@ -21,6 +21,8 @@ var image = require('./data/blocks/image.raw');
|
|
|
21
21
|
var columns = require('./data/blocks/columns.raw');
|
|
22
22
|
var onUpdate = require('./data/blocks/onUpdate.raw');
|
|
23
23
|
var onUpdateWithDeps = require('./data/blocks/onUpdateWithDeps.raw');
|
|
24
|
+
var multipleOnUpdate = require('./data/blocks/multiple-onUpdate.raw');
|
|
25
|
+
var multipleOnUpdateWithDeps = require('./data/blocks/multiple-onUpdateWithDeps.raw');
|
|
24
26
|
var onMount = require('./data/blocks/onMount.raw');
|
|
25
27
|
describe('React', function () {
|
|
26
28
|
test('Basic', function () {
|
|
@@ -121,6 +123,16 @@ describe('React', function () {
|
|
|
121
123
|
var output = (0, react_1.componentToReact)()({ component: component });
|
|
122
124
|
expect(output).toMatchSnapshot();
|
|
123
125
|
});
|
|
126
|
+
test('multipleOnUpdate', function () {
|
|
127
|
+
var component = (0, jsx_1.parseJsx)(multipleOnUpdate);
|
|
128
|
+
var output = (0, react_1.componentToReact)()({ component: component });
|
|
129
|
+
expect(output).toMatchSnapshot();
|
|
130
|
+
});
|
|
131
|
+
test('multipleOnnUpdateWithDeps', function () {
|
|
132
|
+
var component = (0, jsx_1.parseJsx)(multipleOnUpdateWithDeps);
|
|
133
|
+
var output = (0, react_1.componentToReact)()({ component: component });
|
|
134
|
+
expect(output).toMatchSnapshot();
|
|
135
|
+
});
|
|
124
136
|
test('onMount & onUnMount', function () {
|
|
125
137
|
var component = (0, jsx_1.parseJsx)(onMount);
|
|
126
138
|
var output = (0, react_1.componentToReact)()({ component: component });
|
|
@@ -3,10 +3,34 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
var svelte_1 = require("../generators/svelte");
|
|
4
4
|
var jsx_1 = require("../parsers/jsx");
|
|
5
5
|
var onUpdate = require('./data/blocks/onUpdate.raw');
|
|
6
|
+
var multipleOUpdate = require('./data/blocks/multiple-onUpdate.raw');
|
|
7
|
+
var selfReferencingComponent = require('./data/blocks/self-referencing-component.raw');
|
|
8
|
+
var selfReferencingComponentWithChildren = require('./data/blocks/self-referencing-component-with-children.raw');
|
|
9
|
+
var builderRenderBlock = require('./data/blocks/builder-render-block.raw');
|
|
6
10
|
describe('Svelte', function () {
|
|
7
11
|
test('onUpdate', function () {
|
|
8
12
|
var component = (0, jsx_1.parseJsx)(onUpdate);
|
|
9
13
|
var output = (0, svelte_1.componentToSvelte)()({ component: component });
|
|
10
14
|
expect(output).toMatchSnapshot();
|
|
11
15
|
});
|
|
16
|
+
test('multipleOnUpdate', function () {
|
|
17
|
+
var component = (0, jsx_1.parseJsx)(multipleOUpdate);
|
|
18
|
+
var output = (0, svelte_1.componentToSvelte)()({ component: component });
|
|
19
|
+
expect(output).toMatchSnapshot();
|
|
20
|
+
});
|
|
21
|
+
test('selfReferencingComponent', function () {
|
|
22
|
+
var component = (0, jsx_1.parseJsx)(selfReferencingComponent);
|
|
23
|
+
var output = (0, svelte_1.componentToSvelte)()({ component: component });
|
|
24
|
+
expect(output).toMatchSnapshot();
|
|
25
|
+
});
|
|
26
|
+
test('selfReferencingComponentWithChildren', function () {
|
|
27
|
+
var component = (0, jsx_1.parseJsx)(selfReferencingComponentWithChildren);
|
|
28
|
+
var output = (0, svelte_1.componentToSvelte)()({ component: component });
|
|
29
|
+
expect(output).toMatchSnapshot();
|
|
30
|
+
});
|
|
31
|
+
test('BuilderRenderBlock', function () {
|
|
32
|
+
var component = (0, jsx_1.parseJsx)(builderRenderBlock);
|
|
33
|
+
var output = (0, svelte_1.componentToSvelte)()({ component: component });
|
|
34
|
+
expect(output).toMatchSnapshot();
|
|
35
|
+
});
|
|
12
36
|
});
|
|
@@ -22,6 +22,8 @@ var columns = require('./data/blocks/columns.raw');
|
|
|
22
22
|
var onUpdate = require('./data/blocks/onUpdate.raw');
|
|
23
23
|
var onUpdateWithDeps = require('./data/blocks/onUpdateWithDeps.raw');
|
|
24
24
|
var onMount = require('./data/blocks/onMount.raw');
|
|
25
|
+
var multipleOnUpdate = require('./data/blocks/multiple-onUpdate.raw');
|
|
26
|
+
var multipleOnUpdateWithDeps = require('./data/blocks/multiple-onUpdateWithDeps.raw');
|
|
25
27
|
var path = 'test-path';
|
|
26
28
|
describe('Vue', function () {
|
|
27
29
|
test('Basic', function () {
|
|
@@ -119,6 +121,16 @@ describe('Vue', function () {
|
|
|
119
121
|
var output = (0, vue_1.componentToVue)()({ component: component, path: path });
|
|
120
122
|
expect(output).toMatchSnapshot();
|
|
121
123
|
});
|
|
124
|
+
test('multipleOnUpdate', function () {
|
|
125
|
+
var component = (0, jsx_1.parseJsx)(multipleOnUpdate);
|
|
126
|
+
var output = (0, vue_1.componentToVue)()({ component: component, path: path });
|
|
127
|
+
expect(output).toMatchSnapshot();
|
|
128
|
+
});
|
|
129
|
+
test('multipleOnUpdateWithDeps', function () {
|
|
130
|
+
var component = (0, jsx_1.parseJsx)(multipleOnUpdateWithDeps);
|
|
131
|
+
var output = (0, vue_1.componentToVue)()({ component: component, path: path });
|
|
132
|
+
expect(output).toMatchSnapshot();
|
|
133
|
+
});
|
|
122
134
|
test('onMount & onUnMount', function () {
|
|
123
135
|
var component = (0, jsx_1.parseJsx)(onMount);
|
|
124
136
|
var output = (0, vue_1.componentToVue)()({ component: component, path: path });
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
var html_1 = require("../generators/html");
|
|
4
|
+
var jsx_1 = require("../parsers/jsx");
|
|
5
|
+
var stamped = require('./data/blocks/stamped-io.raw');
|
|
6
|
+
describe('webcomponent', function () {
|
|
7
|
+
test('Stamped', function () {
|
|
8
|
+
var component = (0, jsx_1.parseJsx)(stamped);
|
|
9
|
+
var html = (0, html_1.componentToCustomElement)()({ component: component });
|
|
10
|
+
expect(html).toMatchSnapshot();
|
|
11
|
+
});
|
|
12
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const VALID_HTML_TAGS: string[];
|