@builder.io/mitosis 0.0.56-2 → 0.0.56-22
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 +2 -13
- package/dist/src/__tests__/builder.test.js +3 -3
- package/dist/src/__tests__/data/basic-child-component.raw.d.ts +1 -0
- package/dist/src/__tests__/data/basic-child-component.raw.jsx +21 -0
- package/dist/src/__tests__/data/basic-context.raw.d.ts +1 -0
- package/dist/src/__tests__/data/basic-context.raw.jsx +29 -0
- package/dist/src/__tests__/data/basic-custom-mitosis-package.raw.d.ts +1 -0
- package/dist/src/__tests__/data/basic-custom-mitosis-package.raw.jsx +10 -0
- package/dist/src/__tests__/data/basic-for-show.raw.d.ts +1 -0
- package/dist/src/__tests__/data/basic-for-show.raw.jsx +20 -0
- package/dist/src/__tests__/data/basic-for.raw.d.ts +1 -0
- package/dist/src/__tests__/data/basic-for.raw.jsx +23 -0
- package/dist/src/__tests__/data/basic-forwardRef-metadata.raw.d.ts +5 -0
- package/dist/src/__tests__/data/basic-forwardRef-metadata.raw.jsx +17 -0
- package/dist/src/__tests__/data/basic-forwardRef.raw.d.ts +5 -0
- package/dist/src/__tests__/data/basic-forwardRef.raw.jsx +14 -0
- package/dist/src/__tests__/data/basic-onChange.raw.d.ts +1 -0
- package/dist/src/__tests__/data/basic-onChange.raw.jsx +17 -0
- package/dist/src/__tests__/data/basic-onMount-update.raw.d.ts +5 -0
- package/dist/src/__tests__/data/basic-onMount-update.raw.jsx +17 -0
- package/dist/src/__tests__/data/basic-onUpdate-return.raw.d.ts +1 -0
- package/dist/src/__tests__/data/basic-onUpdate-return.raw.jsx +24 -0
- package/dist/src/__tests__/data/basic-outputs-meta.raw.d.ts +1 -0
- package/dist/src/__tests__/data/basic-outputs-meta.raw.jsx +17 -0
- package/dist/src/__tests__/data/basic-outputs.raw.d.ts +1 -0
- package/dist/src/__tests__/data/basic-outputs.raw.jsx +14 -0
- package/dist/src/__tests__/data/basic-preserve-export-or-local-statement.raw.d.ts +6 -0
- package/dist/src/__tests__/data/basic-preserve-export-or-local-statement.raw.jsx +14 -0
- package/dist/src/__tests__/data/basic-props-destructure.raw.d.ts +6 -0
- package/dist/src/__tests__/data/basic-props-destructure.raw.jsx +14 -0
- package/dist/src/__tests__/data/basic-props.raw.d.ts +6 -0
- package/dist/src/__tests__/data/basic-props.raw.jsx +13 -0
- package/dist/src/__tests__/data/basic-ref-assignment.raw.d.ts +4 -0
- package/dist/src/__tests__/data/basic-ref-assignment.raw.jsx +15 -0
- package/dist/src/__tests__/data/basic-ref-usePrevious.raw.d.ts +5 -0
- package/dist/src/__tests__/data/basic-ref-usePrevious.raw.jsx +35 -0
- package/dist/src/__tests__/data/basic-ref.raw.d.ts +4 -0
- package/dist/src/__tests__/data/basic-ref.raw.jsx +36 -0
- package/dist/src/__tests__/data/basic.raw.d.ts +6 -1
- package/dist/src/__tests__/data/basic.raw.jsx +13 -4
- package/dist/src/__tests__/data/blocks/button-with-metadata.raw.d.ts +1 -1
- package/dist/src/__tests__/data/blocks/button.raw.d.ts +1 -1
- package/dist/src/__tests__/data/blocks/classname-jsx.raw.d.ts +7 -0
- package/dist/src/__tests__/data/blocks/classname-jsx.raw.jsx +15 -0
- package/dist/src/__tests__/data/blocks/columns.raw.d.ts +1 -1
- package/dist/src/__tests__/data/blocks/columns.raw.jsx +1 -1
- package/dist/src/__tests__/data/blocks/content-slot-html.raw.d.ts +7 -0
- package/dist/src/__tests__/data/blocks/content-slot-html.raw.jsx +15 -0
- package/dist/src/__tests__/data/blocks/content-slot-jsx.raw.d.ts +6 -0
- package/dist/src/__tests__/data/blocks/content-slot-jsx.raw.jsx +12 -0
- package/dist/src/__tests__/data/blocks/custom-code.raw.d.ts +1 -1
- package/dist/src/__tests__/data/blocks/custom-code.raw.jsx +3 -7
- package/dist/src/__tests__/data/blocks/embed.raw.d.ts +1 -1
- package/dist/src/__tests__/data/blocks/embed.raw.jsx +3 -7
- package/dist/src/__tests__/data/blocks/form.raw.d.ts +1 -1
- package/dist/src/__tests__/data/blocks/form.raw.jsx +3 -3
- package/dist/src/__tests__/data/blocks/image.raw.d.ts +1 -1
- package/dist/src/__tests__/data/blocks/image.raw.jsx +8 -9
- package/dist/src/__tests__/data/blocks/img-state.raw.d.ts +1 -0
- package/dist/src/__tests__/data/blocks/img-state.raw.jsx +17 -0
- package/dist/src/__tests__/data/blocks/img.raw.d.ts +1 -1
- package/dist/src/__tests__/data/blocks/input.raw.d.ts +1 -1
- package/dist/src/__tests__/data/blocks/input.raw.jsx +1 -3
- package/dist/src/__tests__/data/blocks/multiple-onUpdate.raw.d.ts +1 -1
- package/dist/src/__tests__/data/blocks/multiple-onUpdateWithDeps.raw.d.ts +1 -1
- package/dist/src/__tests__/data/blocks/multiple-onUpdateWithDeps.raw.jsx +7 -1
- package/dist/src/__tests__/data/blocks/onInit-onMount.raw.d.ts +1 -0
- package/dist/src/__tests__/data/blocks/onInit-onMount.raw.jsx +13 -0
- package/dist/src/__tests__/data/blocks/onInit.raw.d.ts +8 -0
- package/dist/src/__tests__/data/blocks/onInit.raw.jsx +20 -0
- package/dist/src/__tests__/data/blocks/onMount.raw.d.ts +1 -1
- package/dist/src/__tests__/data/blocks/onUpdate.raw.d.ts +1 -1
- package/dist/src/__tests__/data/blocks/onUpdateWithDeps.raw.d.ts +1 -1
- package/dist/src/__tests__/data/blocks/onUpdateWithDeps.raw.jsx +1 -1
- package/dist/src/__tests__/data/blocks/raw-text.raw.d.ts +1 -1
- package/dist/src/__tests__/data/blocks/rootShow.raw.d.ts +1 -1
- package/dist/src/__tests__/data/blocks/section-state.raw.d.ts +6 -0
- package/dist/src/__tests__/data/blocks/section-state.raw.jsx +17 -0
- package/dist/src/__tests__/data/blocks/section.raw.d.ts +1 -1
- package/dist/src/__tests__/data/blocks/select.raw.d.ts +1 -1
- package/dist/src/__tests__/data/blocks/select.raw.jsx +1 -3
- package/dist/src/__tests__/data/blocks/self-referencing-component-with-children.raw.d.ts +1 -1
- package/dist/src/__tests__/data/blocks/self-referencing-component.raw.d.ts +1 -1
- package/dist/src/__tests__/data/blocks/shadow-dom.raw.d.ts +1 -1
- package/dist/src/__tests__/data/blocks/shadow-dom.raw.jsx +2 -4
- package/dist/src/__tests__/data/blocks/slot-html.raw.d.ts +5 -0
- package/dist/src/__tests__/data/blocks/slot-html.raw.jsx +15 -0
- package/dist/src/__tests__/data/blocks/slot-jsx.raw.d.ts +5 -0
- package/dist/src/__tests__/data/blocks/slot-jsx.raw.jsx +12 -0
- package/dist/src/__tests__/data/blocks/stamped-io.raw.d.ts +1 -1
- package/dist/src/__tests__/data/blocks/stamped-io.raw.jsx +2 -4
- package/dist/src/__tests__/data/blocks/submit-button.raw.d.ts +1 -1
- package/dist/src/__tests__/data/blocks/text.raw.d.ts +1 -1
- package/dist/src/__tests__/data/blocks/text.raw.jsx +3 -1
- package/dist/src/__tests__/data/blocks/textarea.raw.d.ts +1 -1
- package/dist/src/__tests__/data/blocks/video.raw.d.ts +1 -1
- package/dist/src/__tests__/data/blocks/video.raw.jsx +1 -1
- package/dist/src/__tests__/data/context/component-with-context.lite.d.ts +3 -1
- package/dist/src/__tests__/data/context/component-with-context.lite.jsx +7 -2
- package/dist/src/__tests__/data/styles/class-and-className.raw.d.ts +1 -0
- package/dist/src/__tests__/data/styles/class-and-className.raw.jsx +10 -0
- package/dist/src/__tests__/data/styles/class.raw.d.ts +1 -0
- package/dist/src/__tests__/data/styles/class.raw.jsx +10 -0
- package/dist/src/__tests__/data/styles/className.raw.d.ts +1 -0
- package/dist/src/__tests__/data/styles/className.raw.jsx +10 -0
- package/dist/src/__tests__/data/styles/classState.raw.d.ts +1 -0
- package/dist/src/__tests__/data/styles/classState.raw.jsx +12 -0
- package/dist/src/__tests__/data/types/component-props-interface.raw.d.ts +6 -0
- package/dist/src/__tests__/data/types/component-props-interface.raw.jsx +6 -0
- package/dist/src/__tests__/data/types/component-props-type.raw.d.ts +6 -0
- package/dist/src/__tests__/data/types/component-props-type.raw.jsx +6 -0
- package/dist/src/__tests__/data/types/preserve-typing.raw.d.ts +8 -0
- package/dist/src/__tests__/data/types/preserve-typing.raw.jsx +6 -0
- package/dist/src/__tests__/html.test.js +2 -13
- package/dist/src/__tests__/liquid.test.js +2 -103
- package/dist/src/__tests__/parse-jsx.test.js +22 -0
- package/dist/src/__tests__/qwik/convertMethodToFunction.test.d.ts +1 -0
- package/dist/src/__tests__/qwik/convertMethodToFunction.test.js +34 -0
- package/dist/src/__tests__/qwik/src-generator.test.d.ts +1 -0
- package/dist/src/__tests__/qwik/src-generator.test.js +65 -0
- package/dist/src/__tests__/qwik.directive.test.js +1 -0
- package/dist/src/__tests__/qwik.test.js +54 -23
- package/dist/src/__tests__/react-native.test.js +3 -136
- package/dist/src/__tests__/react.test.js +5 -135
- package/dist/src/__tests__/shared.d.ts +3 -0
- package/dist/src/__tests__/shared.js +232 -0
- package/dist/src/__tests__/solid.test.js +2 -97
- package/dist/src/__tests__/stencil.test.js +3 -98
- package/dist/src/__tests__/styles.test.d.ts +1 -0
- package/dist/src/__tests__/styles.test.js +23 -0
- package/dist/src/__tests__/svelte.test.js +2 -31
- package/dist/src/__tests__/vue.test.js +2 -134
- package/dist/src/__tests__/webcomponent.test.js +8 -5
- package/dist/src/constants/hooks.d.ts +6 -0
- package/dist/src/constants/hooks.js +9 -0
- package/dist/src/flow.d.ts +6 -0
- package/dist/src/flow.js +6 -2
- package/dist/src/generators/angular.d.ts +8 -2
- package/dist/src/generators/angular.js +202 -44
- package/dist/src/generators/builder.d.ts +2 -2
- package/dist/src/generators/builder.js +19 -26
- package/dist/src/generators/context/{react copy.d.ts → qwik.d.ts} +2 -2
- package/dist/src/generators/context/{react copy.js → qwik.js} +4 -5
- package/dist/src/generators/context/svelte.d.ts +1 -1
- package/dist/src/generators/helpers/context.js +1 -2
- package/dist/src/generators/html.d.ts +1 -1
- package/dist/src/generators/html.js +365 -108
- package/dist/src/generators/liquid.d.ts +1 -1
- package/dist/src/generators/liquid.js +18 -25
- package/dist/src/generators/mitosis.d.ts +1 -1
- package/dist/src/generators/mitosis.js +37 -35
- package/dist/src/generators/qwik/component-generator.d.ts +4 -0
- package/dist/src/generators/qwik/component-generator.js +276 -0
- package/dist/src/generators/qwik/component.js +21 -25
- package/dist/src/generators/qwik/convertMethodToFunction.d.ts +1 -0
- package/dist/src/generators/qwik/convertMethodToFunction.js +161 -0
- package/dist/src/generators/qwik/directives.js +27 -22
- package/dist/src/generators/qwik/handlers.js +3 -19
- package/dist/src/generators/qwik/index.d.ts +3 -1
- package/dist/src/generators/qwik/index.js +3 -1
- package/dist/src/generators/qwik/jsx.js +33 -13
- package/dist/src/generators/qwik/src-generator.d.ts +21 -8
- package/dist/src/generators/qwik/src-generator.js +163 -42
- package/dist/src/generators/qwik/styles.js +3 -3
- package/dist/src/generators/react-native.d.ts +2 -2
- package/dist/src/generators/react-native.js +8 -10
- package/dist/src/generators/react.d.ts +4 -2
- package/dist/src/generators/react.js +152 -80
- package/dist/src/generators/solid.d.ts +1 -1
- package/dist/src/generators/solid.js +41 -35
- package/dist/src/generators/stencil/collect-class-string.js +5 -8
- package/dist/src/generators/stencil/generate.d.ts +1 -1
- package/dist/src/generators/stencil/generate.js +16 -21
- package/dist/src/generators/svelte.d.ts +2 -2
- package/dist/src/generators/svelte.js +97 -43
- package/dist/src/generators/swift-ui.d.ts +1 -1
- package/dist/src/generators/swift-ui.js +17 -19
- package/dist/src/generators/template.d.ts +1 -1
- package/dist/src/generators/template.js +11 -18
- package/dist/src/generators/vue.d.ts +12 -8
- package/dist/src/generators/vue.js +111 -63
- package/dist/src/helpers/babel-transform.js +3 -8
- package/dist/src/helpers/create-mitosis-component.d.ts +1 -1
- package/dist/src/helpers/create-mitosis-component.js +1 -1
- package/dist/src/helpers/create-mitosis-node.js +1 -1
- package/dist/src/helpers/fast-clone.js +1 -3
- package/dist/src/helpers/filter-empty-text-nodes.js +1 -2
- package/dist/src/helpers/get-bindings.d.ts +2 -0
- package/dist/src/helpers/get-bindings.js +18 -0
- package/dist/src/helpers/get-prop-functions.d.ts +5 -0
- package/dist/src/helpers/get-prop-functions.js +29 -0
- package/dist/src/helpers/get-props-ref.d.ts +2 -0
- package/dist/src/helpers/get-props-ref.js +32 -0
- package/dist/src/helpers/get-refs.js +3 -2
- package/dist/src/helpers/get-state-object-string.d.ts +4 -3
- package/dist/src/helpers/get-state-object-string.js +23 -20
- package/dist/src/helpers/get-styles.js +4 -3
- package/dist/src/helpers/getters-to-functions.d.ts +1 -1
- package/dist/src/helpers/getters-to-functions.js +1 -1
- package/dist/src/helpers/has-bindings-text.d.ts +2 -0
- package/dist/src/helpers/has-bindings-text.js +21 -0
- package/dist/src/helpers/has-stateful-dom.d.ts +2 -0
- package/dist/src/helpers/has-stateful-dom.js +21 -0
- package/dist/src/helpers/is-children.js +2 -1
- package/dist/src/helpers/is-component.js +1 -3
- package/dist/src/helpers/is-html-attribute.d.ts +4 -0
- package/dist/src/helpers/is-html-attribute.js +380 -0
- package/dist/src/helpers/map-refs.js +17 -3
- package/dist/src/helpers/parsers.js +1 -2
- package/dist/src/helpers/render-imports.d.ts +18 -2
- package/dist/src/helpers/render-imports.js +100 -54
- package/dist/src/helpers/render-imports.test.d.ts +1 -0
- package/dist/src/helpers/render-imports.test.js +19 -0
- package/dist/src/helpers/replace-idenifiers.js +5 -7
- package/dist/src/helpers/strip-state-and-props-refs.d.ts +4 -1
- package/dist/src/helpers/strip-state-and-props-refs.js +24 -6
- package/dist/src/helpers/styles/collect-css.d.ts +6 -0
- package/dist/src/helpers/styles/collect-css.js +87 -0
- package/dist/src/helpers/styles/collect-css.test.d.ts +1 -0
- package/dist/src/helpers/styles/collect-css.test.js +18 -0
- package/dist/src/helpers/styles/collect-styled-components.d.ts +2 -0
- package/dist/src/helpers/styles/collect-styled-components.js +61 -0
- package/dist/src/helpers/{collect-styles.d.ts → styles/helpers.d.ts} +5 -10
- package/dist/src/helpers/styles/helpers.js +61 -0
- package/dist/src/helpers/typescript.d.ts +2 -0
- package/dist/src/{jsx-types.js → helpers/typescript.js} +0 -0
- package/dist/src/index.d.ts +7 -4
- package/dist/src/index.js +24 -8
- package/dist/src/modules/plugins.d.ts +1 -1
- package/dist/src/parsers/angular.js +22 -34
- package/dist/src/parsers/builder.d.ts +25 -23
- package/dist/src/parsers/builder.js +59 -67
- package/dist/src/parsers/jsx.d.ts +2 -1
- package/dist/src/parsers/jsx.js +300 -93
- package/dist/src/parsers/liquid.js +51 -149
- package/dist/src/plugins/compile-away-builder-components.js +158 -115
- package/dist/src/symbols/symbol-processor.js +10 -7
- package/dist/src/targets.d.ts +7 -5
- package/dist/src/targets.js +7 -1
- package/dist/src/types/config.d.ts +42 -13
- package/dist/src/types/mitosis-component.d.ts +31 -10
- package/dist/src/types/mitosis-node.d.ts +15 -9
- package/dist/src/types/transpiler.d.ts +14 -0
- package/dist/src/types/transpiler.js +2 -0
- package/dist/test/qwik/Accordion/low.jsx +9 -3
- package/dist/test/qwik/Accordion/med.jsx +2 -8
- package/dist/test/qwik/For/low.jsx +29 -25
- package/dist/test/qwik/For/med.jsx +2 -8
- package/dist/test/qwik/Image/high.js +1 -1
- package/dist/test/qwik/Image/med.js +15 -13
- package/dist/test/qwik/Image.slow/high.js +1 -1
- package/dist/test/qwik/Image.slow/med.js +15 -13
- package/dist/test/qwik/bindings/low.cjs +12 -3
- package/dist/test/qwik/bindings/med.cjs +1 -10
- package/dist/test/qwik/button/high.js +1 -1
- package/dist/test/qwik/button/low.js +9 -3
- package/dist/test/qwik/button/med.js +2 -8
- package/dist/test/qwik/component/bindings/low.jsx +48 -5
- package/dist/test/qwik/component/bindings/med.jsx +3 -49
- package/dist/test/qwik/component/component/inputs/high.cjsx +1 -1
- package/dist/test/qwik/component/component/inputs/med.cjsx +8 -9
- package/dist/test/qwik/for-loop.bindings/high.cjs +0 -0
- package/dist/test/qwik/for-loop.bindings/low.cjs +46 -0
- package/dist/test/qwik/for-loop.bindings/med.cjs +5 -0
- package/dist/test/qwik/hello_world/stylesheet/low.jsx +9 -3
- package/dist/test/qwik/hello_world/stylesheet/med.jsx +2 -8
- package/dist/test/qwik/mount/high.cjs +0 -0
- package/dist/test/qwik/mount/low.cjs +45 -0
- package/dist/test/qwik/mount/med.cjs +3 -0
- package/dist/test/qwik/page-with-symbol/low.js +9 -3
- package/dist/test/qwik/page-with-symbol/med.js +2 -8
- package/dist/test/qwik/show-hide/high.jsx +1 -1
- package/dist/test/qwik/show-hide/med.jsx +15 -13
- package/dist/test/qwik/svg/low.js +9 -3
- package/dist/test/qwik/svg/med.js +2 -8
- package/dist/test/qwik/todo/Todo.cjs/high.cjs +6 -10
- package/dist/test/qwik/todo/Todo.cjs/med.cjs +9 -9
- package/dist/test/qwik/todo/Todo.js/high.js +7 -10
- package/dist/test/qwik/todo/Todo.js/med.js +9 -9
- package/dist/test/qwik/todo/Todo.tsx/high.tsx +7 -10
- package/dist/test/qwik/todo/Todo.tsx/med.tsx +9 -9
- package/dist/test/qwik/todos/Todo.tsx/high.tsx +1 -1
- package/dist/test/qwik/todos/Todo.tsx/low.tsx +15 -12
- package/dist/test/qwik/todos/Todo.tsx/med.tsx +1 -6
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +11 -6
- package/README.md +0 -239
- package/dist/src/__tests__/data/blocks/onUpdate.raw copy.d.ts +0 -1
- package/dist/src/__tests__/data/blocks/onUpdate.raw copy.jsx +0 -10
- package/dist/src/__tests__/data/blocks/slot.raw.d.ts +0 -5
- package/dist/src/__tests__/data/blocks/slot.raw.jsx +0 -6
- package/dist/src/__tests__/data/blocks/styles.raw.d.ts +0 -1
- package/dist/src/__tests__/data/blocks/styles.raw.jsx +0 -10
- package/dist/src/helpers/babel-transform copy.d.ts +0 -8
- package/dist/src/helpers/babel-transform copy.js +0 -138
- package/dist/src/helpers/collect-styles.js +0 -178
- package/dist/src/jsx-types.d.ts +0 -1171
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
function MyBasicComponent() {
|
|
4
|
+
return (<div className="test" class="test2" css={{
|
|
5
|
+
padding: '10px',
|
|
6
|
+
}}>
|
|
7
|
+
Hello! I can run in React, Vue, Solid, or Liquid!
|
|
8
|
+
</div>);
|
|
9
|
+
}
|
|
10
|
+
exports.default = MyBasicComponent;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default function MyBasicComponent(): import("@builder.io/mitosis/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
function MyBasicComponent() {
|
|
4
|
+
return (<div class="test" css={{
|
|
5
|
+
padding: '10px',
|
|
6
|
+
}}>
|
|
7
|
+
Hello! I can run in React, Vue, Solid, or Liquid!
|
|
8
|
+
</div>);
|
|
9
|
+
}
|
|
10
|
+
exports.default = MyBasicComponent;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default function MyBasicComponent(): import("@builder.io/mitosis/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
function MyBasicComponent() {
|
|
4
|
+
return (<div className="test" css={{
|
|
5
|
+
padding: '10px',
|
|
6
|
+
}}>
|
|
7
|
+
Hello! I can run in React, Vue, Solid, or Liquid!
|
|
8
|
+
</div>);
|
|
9
|
+
}
|
|
10
|
+
exports.default = MyBasicComponent;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default function MyBasicComponent(): import("@builder.io/mitosis/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
var mitosis_1 = require("@builder.io/mitosis");
|
|
4
|
+
function MyBasicComponent() {
|
|
5
|
+
var _a = (0, mitosis_1.useState)('testClassName'), classState = _a[0], setClassState = _a[1];
|
|
6
|
+
return (<div class={classState} css={{
|
|
7
|
+
padding: '10px',
|
|
8
|
+
}}>
|
|
9
|
+
Hello! I can run in React, Vue, Solid, or Liquid!
|
|
10
|
+
</div>);
|
|
11
|
+
}
|
|
12
|
+
exports.default = MyBasicComponent;
|
|
@@ -1,18 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
var html_1 = require("../generators/html");
|
|
4
|
-
var
|
|
5
|
-
var stamped = require('./data/blocks/stamped-io.raw');
|
|
6
|
-
var shadowDom = require('./data/blocks/shadow-dom.raw');
|
|
4
|
+
var shared_1 = require("./shared");
|
|
7
5
|
describe('Html', function () {
|
|
8
|
-
|
|
9
|
-
var component = (0, jsx_1.parseJsx)(stamped);
|
|
10
|
-
var html = (0, html_1.componentToHtml)()({ component: component });
|
|
11
|
-
expect(html).toMatchSnapshot();
|
|
12
|
-
});
|
|
13
|
-
test('Shadow DOM', function () {
|
|
14
|
-
var component = (0, jsx_1.parseJsx)(shadowDom);
|
|
15
|
-
var html = (0, html_1.componentToHtml)()({ component: component });
|
|
16
|
-
expect(html).toMatchSnapshot();
|
|
17
|
-
});
|
|
6
|
+
(0, shared_1.runTestsForTarget)('html', (0, html_1.componentToHtml)());
|
|
18
7
|
});
|
|
@@ -1,108 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
var liquid_1 = require("../generators/liquid");
|
|
4
|
-
var
|
|
5
|
-
var basic = require('./data/basic.raw');
|
|
6
|
-
var submitButtonBlock = require('./data/blocks/submit-button.raw');
|
|
7
|
-
var inputBlock = require('./data/blocks/input.raw');
|
|
8
|
-
var selectBlock = require('./data/blocks/select.raw');
|
|
9
|
-
var formBlock = require('./data/blocks/form.raw');
|
|
10
|
-
var button = require('./data/blocks/button.raw');
|
|
11
|
-
var textarea = require('./data/blocks/textarea.raw');
|
|
12
|
-
var img = require('./data/blocks/img.raw');
|
|
13
|
-
var video = require('./data/blocks/video.raw');
|
|
14
|
-
var section = require('./data/blocks/section.raw');
|
|
15
|
-
var text = require('./data/blocks/text.raw');
|
|
16
|
-
var rawText = require('./data/blocks/raw-text.raw');
|
|
17
|
-
var customCode = require('./data/blocks/custom-code.raw');
|
|
18
|
-
var stamped = require('./data/blocks/stamped-io.raw');
|
|
19
|
-
var embed = require('./data/blocks/embed.raw');
|
|
20
|
-
var image = require('./data/blocks/image.raw');
|
|
21
|
-
var columns = require('./data/blocks/columns.raw');
|
|
4
|
+
var shared_1 = require("./shared");
|
|
22
5
|
describe('Liquid', function () {
|
|
23
|
-
|
|
24
|
-
var component = (0, jsx_1.parseJsx)(basic);
|
|
25
|
-
var output = (0, liquid_1.componentToLiquid)()({ component: component });
|
|
26
|
-
expect(output).toMatchSnapshot();
|
|
27
|
-
});
|
|
28
|
-
test('Input block', function () {
|
|
29
|
-
var component = (0, jsx_1.parseJsx)(inputBlock);
|
|
30
|
-
var output = (0, liquid_1.componentToLiquid)()({ component: component });
|
|
31
|
-
expect(output).toMatchSnapshot();
|
|
32
|
-
});
|
|
33
|
-
test('Submit button block', function () {
|
|
34
|
-
var component = (0, jsx_1.parseJsx)(submitButtonBlock);
|
|
35
|
-
var output = (0, liquid_1.componentToLiquid)()({ component: component });
|
|
36
|
-
expect(output).toMatchSnapshot();
|
|
37
|
-
});
|
|
38
|
-
test('Select block', function () {
|
|
39
|
-
var component = (0, jsx_1.parseJsx)(selectBlock);
|
|
40
|
-
var output = (0, liquid_1.componentToLiquid)()({ component: component });
|
|
41
|
-
expect(output).toMatchSnapshot();
|
|
42
|
-
});
|
|
43
|
-
test('Form block', function () {
|
|
44
|
-
var component = (0, jsx_1.parseJsx)(formBlock);
|
|
45
|
-
var output = (0, liquid_1.componentToLiquid)()({ component: component });
|
|
46
|
-
expect(output).toMatchSnapshot();
|
|
47
|
-
});
|
|
48
|
-
test('Button', function () {
|
|
49
|
-
var component = (0, jsx_1.parseJsx)(button);
|
|
50
|
-
var output = (0, liquid_1.componentToLiquid)()({ component: component });
|
|
51
|
-
expect(output).toMatchSnapshot();
|
|
52
|
-
});
|
|
53
|
-
test('Textarea', function () {
|
|
54
|
-
var component = (0, jsx_1.parseJsx)(textarea);
|
|
55
|
-
var output = (0, liquid_1.componentToLiquid)()({ component: component });
|
|
56
|
-
expect(output).toMatchSnapshot();
|
|
57
|
-
});
|
|
58
|
-
test('Img', function () {
|
|
59
|
-
var component = (0, jsx_1.parseJsx)(img);
|
|
60
|
-
var output = (0, liquid_1.componentToLiquid)()({ component: component });
|
|
61
|
-
expect(output).toMatchSnapshot();
|
|
62
|
-
});
|
|
63
|
-
test('Video', function () {
|
|
64
|
-
var component = (0, jsx_1.parseJsx)(video);
|
|
65
|
-
var output = (0, liquid_1.componentToLiquid)()({ component: component });
|
|
66
|
-
expect(output).toMatchSnapshot();
|
|
67
|
-
});
|
|
68
|
-
test('Section', function () {
|
|
69
|
-
var component = (0, jsx_1.parseJsx)(section);
|
|
70
|
-
var output = (0, liquid_1.componentToLiquid)()({ component: component });
|
|
71
|
-
expect(output).toMatchSnapshot();
|
|
72
|
-
});
|
|
73
|
-
test('Text', function () {
|
|
74
|
-
var component = (0, jsx_1.parseJsx)(text);
|
|
75
|
-
var output = (0, liquid_1.componentToLiquid)()({ component: component });
|
|
76
|
-
expect(output).toMatchSnapshot();
|
|
77
|
-
});
|
|
78
|
-
test('RawText', function () {
|
|
79
|
-
var component = (0, jsx_1.parseJsx)(rawText);
|
|
80
|
-
var output = (0, liquid_1.componentToLiquid)()({ component: component });
|
|
81
|
-
expect(output).toMatchSnapshot();
|
|
82
|
-
});
|
|
83
|
-
test('Stamped.io', function () {
|
|
84
|
-
var component = (0, jsx_1.parseJsx)(stamped);
|
|
85
|
-
var output = (0, liquid_1.componentToLiquid)()({ component: component });
|
|
86
|
-
expect(output).toMatchSnapshot();
|
|
87
|
-
});
|
|
88
|
-
test('CustomCode', function () {
|
|
89
|
-
var component = (0, jsx_1.parseJsx)(customCode);
|
|
90
|
-
var output = (0, liquid_1.componentToLiquid)()({ component: component });
|
|
91
|
-
expect(output).toMatchSnapshot();
|
|
92
|
-
});
|
|
93
|
-
test('Embed', function () {
|
|
94
|
-
var component = (0, jsx_1.parseJsx)(customCode);
|
|
95
|
-
var output = (0, liquid_1.componentToLiquid)()({ component: component });
|
|
96
|
-
expect(output).toMatchSnapshot();
|
|
97
|
-
});
|
|
98
|
-
test('Image', function () {
|
|
99
|
-
var component = (0, jsx_1.parseJsx)(image);
|
|
100
|
-
var output = (0, liquid_1.componentToLiquid)()({ component: component });
|
|
101
|
-
expect(output).toMatchSnapshot();
|
|
102
|
-
});
|
|
103
|
-
test('Columns', function () {
|
|
104
|
-
var component = (0, jsx_1.parseJsx)(columns);
|
|
105
|
-
var output = (0, liquid_1.componentToLiquid)()({ component: component });
|
|
106
|
-
expect(output).toMatchSnapshot();
|
|
107
|
-
});
|
|
6
|
+
(0, shared_1.runTestsForTarget)('liquid', (0, liquid_1.componentToLiquid)());
|
|
108
7
|
});
|
|
@@ -3,6 +3,11 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
var jsx_1 = require("../parsers/jsx");
|
|
4
4
|
var buttonWithMetadata = require('./data/blocks/button-with-metadata.raw');
|
|
5
5
|
var image = require('./data/blocks/image.raw');
|
|
6
|
+
var basicOnUpdateReturn = require('./data/basic-onUpdate-return.raw');
|
|
7
|
+
var basicMitosis = require('./data/basic-custom-mitosis-package.raw');
|
|
8
|
+
var basicRef = require('./data/basic-ref.raw');
|
|
9
|
+
var basicPropsRaw = require('./data/basic-props.raw');
|
|
10
|
+
var basicPropsDestructureRaw = require('./data/basic-props-destructure.raw');
|
|
6
11
|
describe('Parse JSX', function () {
|
|
7
12
|
test('metadata', function () {
|
|
8
13
|
var json = (0, jsx_1.parseJsx)(buttonWithMetadata);
|
|
@@ -12,4 +17,21 @@ describe('Parse JSX', function () {
|
|
|
12
17
|
var json = (0, jsx_1.parseJsx)(image);
|
|
13
18
|
expect(json).toMatchSnapshot();
|
|
14
19
|
});
|
|
20
|
+
test('onUpdate return', function () {
|
|
21
|
+
var json = (0, jsx_1.parseJsx)(basicOnUpdateReturn);
|
|
22
|
+
expect(json).toMatchSnapshot();
|
|
23
|
+
});
|
|
24
|
+
test('useRef', function () {
|
|
25
|
+
var json = (0, jsx_1.parseJsx)(basicRef);
|
|
26
|
+
expect(json).toMatchSnapshot();
|
|
27
|
+
});
|
|
28
|
+
test('custom mitosis package', function () {
|
|
29
|
+
var json = (0, jsx_1.parseJsx)(basicMitosis, {
|
|
30
|
+
compileAwayPackages: ['@dummy/custom-mitosis'],
|
|
31
|
+
});
|
|
32
|
+
expect(json).toMatchSnapshot();
|
|
33
|
+
});
|
|
34
|
+
test('custom mitosis package', function () {
|
|
35
|
+
expect((0, jsx_1.parseJsx)(basicPropsRaw)).toEqual((0, jsx_1.parseJsx)(basicPropsDestructureRaw));
|
|
36
|
+
});
|
|
15
37
|
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
var convertMethodToFunction_1 = require("../../generators/qwik/convertMethodToFunction");
|
|
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, convertMethodToFunction_1.convertMethodToFunction)('this.methodA(123)', methodMap, lexicalArgs)).toEqual('methodA(props,state,123)');
|
|
14
|
+
});
|
|
15
|
+
test('getter', function () {
|
|
16
|
+
expect((0, convertMethodToFunction_1.convertMethodToFunction)('this.getterB', methodMap, lexicalArgs)).toEqual('getterB(props,state)');
|
|
17
|
+
});
|
|
18
|
+
test('handle comments', function () {
|
|
19
|
+
expect((0, convertMethodToFunction_1.convertMethodToFunction)('//\nreturn this.getterB;', methodMap, lexicalArgs)).toEqual('//\nreturn getterB(props,state);');
|
|
20
|
+
});
|
|
21
|
+
test('braces', function () {
|
|
22
|
+
var code = 'getFontCss({}: {}) { this.getCssFromFont(font) }';
|
|
23
|
+
expect((0, convertMethodToFunction_1.convertMethodToFunction)(code, methodMap, lexicalArgs)).toEqual('getFontCss({}: {}) { getCssFromFont(props,state,font) }');
|
|
24
|
+
});
|
|
25
|
+
});
|
|
26
|
+
describe('string', function () {
|
|
27
|
+
test('should not rewrite string', function () {
|
|
28
|
+
expect((0, convertMethodToFunction_1.convertMethodToFunction)('"this.getterB"', methodMap, lexicalArgs)).toEqual('"this.getterB"');
|
|
29
|
+
});
|
|
30
|
+
test('should rewrite template string', function () {
|
|
31
|
+
expect((0, convertMethodToFunction_1.convertMethodToFunction)('`${this.getterB}this.getterB`', methodMap, lexicalArgs)).toEqual('`${getterB(props,state)}this.getterB`');
|
|
32
|
+
});
|
|
33
|
+
});
|
|
34
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
var src_generator_1 = require("../../generators/qwik/src-generator");
|
|
4
|
+
describe('src-generator', function () {
|
|
5
|
+
describe('isStatement', function () {
|
|
6
|
+
test('is an expression', function () {
|
|
7
|
+
expect((0, src_generator_1.isStatement)('a.b')).toBe(false);
|
|
8
|
+
expect((0, src_generator_1.isStatement)('1?2:"bar"')).toBe(false);
|
|
9
|
+
expect((0, src_generator_1.isStatement)('"var x; return foo + \'\\"\';"')).toBe(false);
|
|
10
|
+
expect((0, src_generator_1.isStatement)('"foo" + `bar\nbaz`')).toBe(false);
|
|
11
|
+
expect((0, src_generator_1.isStatement)('(...)()')).toBe(false);
|
|
12
|
+
});
|
|
13
|
+
test('regression', function () {
|
|
14
|
+
expect((0, src_generator_1.isStatement)('props.attributes?.class || props.attributes?.className')).toBe(false);
|
|
15
|
+
});
|
|
16
|
+
test('is a statement', function () {
|
|
17
|
+
expect((0, src_generator_1.isStatement)('var x; return x;')).toBe(true);
|
|
18
|
+
expect((0, src_generator_1.isStatement)('var x')).toBe(true);
|
|
19
|
+
});
|
|
20
|
+
});
|
|
21
|
+
describe('import', function () {
|
|
22
|
+
var options;
|
|
23
|
+
var src;
|
|
24
|
+
describe('module', function () {
|
|
25
|
+
beforeEach(function () {
|
|
26
|
+
options = {
|
|
27
|
+
isJSX: true,
|
|
28
|
+
isPretty: false,
|
|
29
|
+
isTypeScript: false,
|
|
30
|
+
isModule: true,
|
|
31
|
+
isBuilder: false,
|
|
32
|
+
};
|
|
33
|
+
src = new src_generator_1.SrcBuilder(new src_generator_1.File('test', options, '', ''), options);
|
|
34
|
+
});
|
|
35
|
+
test('import to string', function () {
|
|
36
|
+
src.import('module', [new src_generator_1.Symbol('importName', 'asLocalName')]);
|
|
37
|
+
expect(src.toString()).toEqual('import{importName as asLocalName}from"module";');
|
|
38
|
+
});
|
|
39
|
+
test('import from default', function () {
|
|
40
|
+
src.import('module', [new src_generator_1.Symbol('default', 'asLocalName')]);
|
|
41
|
+
expect(src.toString()).toEqual('import asLocalName from"module";');
|
|
42
|
+
});
|
|
43
|
+
});
|
|
44
|
+
describe('require', function () {
|
|
45
|
+
beforeEach(function () {
|
|
46
|
+
options = {
|
|
47
|
+
isJSX: true,
|
|
48
|
+
isPretty: false,
|
|
49
|
+
isTypeScript: false,
|
|
50
|
+
isModule: false,
|
|
51
|
+
isBuilder: false,
|
|
52
|
+
};
|
|
53
|
+
src = new src_generator_1.SrcBuilder(new src_generator_1.File('test', options, '', ''), options);
|
|
54
|
+
});
|
|
55
|
+
test('import to string', function () {
|
|
56
|
+
src.import('module', [new src_generator_1.Symbol('importName', 'asLocalName')]);
|
|
57
|
+
expect(src.toString()).toEqual('const asLocalName=require("module").importName;');
|
|
58
|
+
});
|
|
59
|
+
test('import from default', function () {
|
|
60
|
+
src.import('module', [new src_generator_1.Symbol('default', 'asLocalName')]);
|
|
61
|
+
expect(src.toString()).toEqual('const asLocalName=require("module");');
|
|
62
|
+
});
|
|
63
|
+
});
|
|
64
|
+
});
|
|
65
|
+
});
|
|
@@ -38,12 +38,13 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
38
38
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
39
|
var fs_extra_promise_1 = require("fs-extra-promise");
|
|
40
40
|
var qwik_1 = require("../generators/qwik");
|
|
41
|
+
var component_generator_1 = require("../generators/qwik/component-generator");
|
|
41
42
|
var index_1 = require("../generators/qwik/index");
|
|
42
|
-
var src_generator_1 = require("../generators/qwik/src-generator");
|
|
43
43
|
var builder_1 = require("../parsers/builder");
|
|
44
44
|
var jsx_1 = require("../parsers/jsx");
|
|
45
45
|
var compile_away_builder_components_1 = require("../plugins/compile-away-builder-components");
|
|
46
46
|
var symbol_processor_1 = require("../symbols/symbol-processor");
|
|
47
|
+
var shared_1 = require("./shared");
|
|
47
48
|
var todo = require('../../../../examples/todo/src/components/todo.lite');
|
|
48
49
|
var todos = require('../../../../examples/todo/src/components/todos.lite');
|
|
49
50
|
var debugFiles = true;
|
|
@@ -76,6 +77,7 @@ var debugOutput = function (fileSet) { return __awaiter(void 0, void 0, void 0,
|
|
|
76
77
|
});
|
|
77
78
|
}); };
|
|
78
79
|
describe('qwik', function () {
|
|
80
|
+
(0, shared_1.runTestsForTarget)('qwik', (0, component_generator_1.componentToQwik)());
|
|
79
81
|
describe('todo', function () {
|
|
80
82
|
test('Todo.tsx', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
81
83
|
var json, fileSet;
|
|
@@ -309,8 +311,7 @@ describe('qwik', function () {
|
|
|
309
311
|
fileSet = (0, index_1.createFileSet)({ output: 'mjs', jsx: true });
|
|
310
312
|
hierarchy.depthFirstSymbols.forEach(function (builderComponent) {
|
|
311
313
|
var mitosisComponent = (0, symbol_processor_1.convertBuilderElementToMitosisComponent)(builderComponent);
|
|
312
|
-
mitosisComponent &&
|
|
313
|
-
(0, index_1.addComponent)(fileSet, mitosisComponent, { isRoot: false });
|
|
314
|
+
mitosisComponent && (0, index_1.addComponent)(fileSet, mitosisComponent, { isRoot: false });
|
|
314
315
|
});
|
|
315
316
|
component = (0, builder_1.builderContentToMitosisComponent)(content, {
|
|
316
317
|
includeBuilderExtras: true,
|
|
@@ -372,13 +373,49 @@ describe('qwik', function () {
|
|
|
372
373
|
});
|
|
373
374
|
}); });
|
|
374
375
|
test('bindings', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
375
|
-
var content,
|
|
376
|
+
var content, fileSet, component;
|
|
376
377
|
return __generator(this, function (_a) {
|
|
377
378
|
switch (_a.label) {
|
|
378
379
|
case 0:
|
|
379
380
|
content = require('./qwik.test.bindings.json');
|
|
380
|
-
|
|
381
|
-
|
|
381
|
+
fileSet = (0, index_1.createFileSet)({ output: 'cjs', jsx: false });
|
|
382
|
+
component = (0, builder_1.builderContentToMitosisComponent)(content, {
|
|
383
|
+
includeBuilderExtras: true,
|
|
384
|
+
preserveTextBlocks: true,
|
|
385
|
+
});
|
|
386
|
+
(0, compile_away_builder_components_1.compileAwayBuilderComponentsFromTree)(component, compile_away_builder_components_1.components);
|
|
387
|
+
(0, index_1.addComponent)(fileSet, component);
|
|
388
|
+
return [4 /*yield*/, debugOutput(fileSet)];
|
|
389
|
+
case 1:
|
|
390
|
+
_a.sent();
|
|
391
|
+
expect(toObj(fileSet)).toMatchSnapshot();
|
|
392
|
+
return [2 /*return*/];
|
|
393
|
+
}
|
|
394
|
+
});
|
|
395
|
+
}); });
|
|
396
|
+
test('for-loop.bindings', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
397
|
+
var component, fileSet;
|
|
398
|
+
return __generator(this, function (_a) {
|
|
399
|
+
switch (_a.label) {
|
|
400
|
+
case 0:
|
|
401
|
+
component = require('./qwik.test.for-loop.binding.json');
|
|
402
|
+
fileSet = (0, index_1.createFileSet)({ output: 'cjs', jsx: false });
|
|
403
|
+
(0, compile_away_builder_components_1.compileAwayBuilderComponentsFromTree)(component, compile_away_builder_components_1.components);
|
|
404
|
+
(0, index_1.addComponent)(fileSet, component);
|
|
405
|
+
return [4 /*yield*/, debugOutput(fileSet)];
|
|
406
|
+
case 1:
|
|
407
|
+
_a.sent();
|
|
408
|
+
expect(toObj(fileSet)).toMatchSnapshot();
|
|
409
|
+
return [2 /*return*/];
|
|
410
|
+
}
|
|
411
|
+
});
|
|
412
|
+
}); });
|
|
413
|
+
test('mount', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
414
|
+
var content, fileSet, component;
|
|
415
|
+
return __generator(this, function (_a) {
|
|
416
|
+
switch (_a.label) {
|
|
417
|
+
case 0:
|
|
418
|
+
content = require('./qwik.test.mount.json');
|
|
382
419
|
fileSet = (0, index_1.createFileSet)({ output: 'cjs', jsx: false });
|
|
383
420
|
component = (0, builder_1.builderContentToMitosisComponent)(content, {
|
|
384
421
|
includeBuilderExtras: true,
|
|
@@ -395,30 +432,24 @@ describe('qwik', function () {
|
|
|
395
432
|
});
|
|
396
433
|
}); });
|
|
397
434
|
describe('src-generator', function () {
|
|
398
|
-
|
|
399
|
-
|
|
435
|
+
var file;
|
|
436
|
+
beforeEach(function () {
|
|
437
|
+
return (file = new qwik_1.File('test.js', {
|
|
400
438
|
isPretty: true,
|
|
401
439
|
isTypeScript: false,
|
|
402
440
|
isJSX: true,
|
|
403
441
|
isModule: true,
|
|
404
|
-
|
|
442
|
+
isBuilder: true,
|
|
443
|
+
}, '', ''));
|
|
444
|
+
});
|
|
445
|
+
test('should format code', function () {
|
|
405
446
|
file.src.emit('const x=1');
|
|
406
447
|
expect(file.toString()).toEqual('const x = 1;\n');
|
|
407
448
|
});
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
expect((0, src_generator_1.isStatement)('a.b')).toBe(false);
|
|
413
|
-
expect((0, src_generator_1.isStatement)('1?2:"bar"')).toBe(false);
|
|
414
|
-
expect((0, src_generator_1.isStatement)('"var x; return foo + \'\\"\';"')).toBe(false);
|
|
415
|
-
expect((0, src_generator_1.isStatement)('"foo" + `bar\nbaz`')).toBe(false);
|
|
416
|
-
expect((0, src_generator_1.isStatement)('(...)()')).toBe(false);
|
|
417
|
-
});
|
|
418
|
-
test('is a statement', function () {
|
|
419
|
-
expect((0, src_generator_1.isStatement)('var x; return x;')).toBe(true);
|
|
420
|
-
expect((0, src_generator_1.isStatement)('var x')).toBe(true);
|
|
421
|
-
});
|
|
449
|
+
test('should deal with empty bindings', function () {
|
|
450
|
+
file.src.jsxBegin('Image', {}, { image: '' });
|
|
451
|
+
file.src.jsxEnd('Image');
|
|
452
|
+
expect(file.toString()).toEqual('<Image></Image>;\n');
|
|
422
453
|
});
|
|
423
454
|
});
|
|
424
455
|
});
|