@builder.io/mitosis 0.0.56-57 → 0.0.56-58
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__/qwik/convert-method-to-function.test.d.ts +1 -0
- package/dist/src/__tests__/qwik/convert-method-to-function.test.js +37 -0
- package/dist/src/__tests__/react.test.js +3 -0
- package/dist/src/helpers/styles/helpers.d.ts +3 -2
- package/dist/src/targets.js +1 -1
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +2 -2
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
var convert_method_to_function_1 = require("../../generators/qwik/convert-method-to-function");
|
|
4
|
+
describe('convertMethodToFunction', function () {
|
|
5
|
+
var methodMap = {
|
|
6
|
+
methodA: 'method',
|
|
7
|
+
getterB: 'getter',
|
|
8
|
+
getCssFromFont: 'method',
|
|
9
|
+
};
|
|
10
|
+
var lexicalArgs = ['props', 'state'];
|
|
11
|
+
describe('rewrite', function () {
|
|
12
|
+
test('method', function () {
|
|
13
|
+
expect((0, convert_method_to_function_1.convertMethodToFunction)('this.methodA(123)', methodMap, lexicalArgs)).toEqual('methodA(props,state,123)');
|
|
14
|
+
});
|
|
15
|
+
test('getter', function () {
|
|
16
|
+
expect((0, convert_method_to_function_1.convertMethodToFunction)('this.getterB', methodMap, lexicalArgs)).toEqual('getterB(props,state)');
|
|
17
|
+
});
|
|
18
|
+
test('method binding', function () {
|
|
19
|
+
expect((0, convert_method_to_function_1.convertMethodToFunction)('this.methodA', methodMap, lexicalArgs)).toEqual('methodA.bind(null,props,state)');
|
|
20
|
+
});
|
|
21
|
+
test('handle comments', function () {
|
|
22
|
+
expect((0, convert_method_to_function_1.convertMethodToFunction)('//\nreturn this.getterB;', methodMap, lexicalArgs)).toEqual('//\nreturn getterB(props,state);');
|
|
23
|
+
});
|
|
24
|
+
test('braces', function () {
|
|
25
|
+
var code = 'getFontCss({}: {}) { this.getCssFromFont(font) }';
|
|
26
|
+
expect((0, convert_method_to_function_1.convertMethodToFunction)(code, methodMap, lexicalArgs)).toEqual('getFontCss({}: {}) { getCssFromFont(props,state,font) }');
|
|
27
|
+
});
|
|
28
|
+
});
|
|
29
|
+
describe('string', function () {
|
|
30
|
+
test('should not rewrite string', function () {
|
|
31
|
+
expect((0, convert_method_to_function_1.convertMethodToFunction)('"this.getterB"', methodMap, lexicalArgs)).toEqual('"this.getterB"');
|
|
32
|
+
});
|
|
33
|
+
test('should rewrite template string', function () {
|
|
34
|
+
expect((0, convert_method_to_function_1.convertMethodToFunction)('`${this.getterB}this.getterB`', methodMap, lexicalArgs)).toEqual('`${getterB(props,state)}this.getterB`');
|
|
35
|
+
});
|
|
36
|
+
});
|
|
37
|
+
});
|
|
@@ -3,6 +3,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
var __1 = require("..");
|
|
4
4
|
var react_1 = require("../generators/react");
|
|
5
5
|
var shared_1 = require("./shared");
|
|
6
|
+
describe('Preact', function () {
|
|
7
|
+
(0, shared_1.runTestsForTarget)('react', (0, react_1.componentToReact)({ preact: true }));
|
|
8
|
+
});
|
|
6
9
|
var stamped = require('./data/blocks/stamped-io.raw');
|
|
7
10
|
describe('React', function () {
|
|
8
11
|
(0, shared_1.runTestsForTarget)('react', (0, react_1.componentToReact)());
|
|
@@ -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
|
*/
|
package/dist/src/targets.js
CHANGED