@builder.io/mitosis 0.0.0-dev-20260605060721
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/constants/hooks.d.ts +16 -0
- package/dist/src/constants/hooks.js +19 -0
- package/dist/src/constants/html_tags.d.ts +2 -0
- package/dist/src/constants/html_tags.js +198 -0
- package/dist/src/constants/media-sizes.d.ts +22 -0
- package/dist/src/constants/media-sizes.js +34 -0
- package/dist/src/constants/method-literal-prefix.d.ts +1 -0
- package/dist/src/constants/method-literal-prefix.js +2 -0
- package/dist/src/flow.d.ts +26 -0
- package/dist/src/flow.js +27 -0
- package/dist/src/generators/alpine/generate.d.ts +11 -0
- package/dist/src/generators/alpine/generate.js +201 -0
- package/dist/src/generators/alpine/index.d.ts +2 -0
- package/dist/src/generators/alpine/index.js +18 -0
- package/dist/src/generators/alpine/render-mount-hook.d.ts +2 -0
- package/dist/src/generators/alpine/render-mount-hook.js +17 -0
- package/dist/src/generators/alpine/render-update-hooks.d.ts +5 -0
- package/dist/src/generators/alpine/render-update-hooks.js +44 -0
- package/dist/src/generators/alpine/types.d.ts +12 -0
- package/dist/src/generators/alpine/types.js +2 -0
- package/dist/src/generators/angular/classic/blocks.d.ts +10 -0
- package/dist/src/generators/angular/classic/blocks.js +409 -0
- package/dist/src/generators/angular/classic/component.d.ts +3 -0
- package/dist/src/generators/angular/classic/component.js +356 -0
- package/dist/src/generators/angular/classic/plugins/get-class-properties-plugin.d.ts +2 -0
- package/dist/src/generators/angular/classic/plugins/get-class-properties-plugin.js +138 -0
- package/dist/src/generators/angular/classic/plugins/get-code-processor-plugins.d.ts +8 -0
- package/dist/src/generators/angular/classic/plugins/get-code-processor-plugins.js +60 -0
- package/dist/src/generators/angular/component.d.ts +3 -0
- package/dist/src/generators/angular/component.js +27 -0
- package/dist/src/generators/angular/helpers/format.d.ts +1 -0
- package/dist/src/generators/angular/helpers/format.js +24 -0
- package/dist/src/generators/angular/helpers/get-inputs.d.ts +7 -0
- package/dist/src/generators/angular/helpers/get-inputs.js +18 -0
- package/dist/src/generators/angular/helpers/get-outputs.d.ts +7 -0
- package/dist/src/generators/angular/helpers/get-outputs.js +23 -0
- package/dist/src/generators/angular/helpers/get-refs.d.ts +8 -0
- package/dist/src/generators/angular/helpers/get-refs.js +40 -0
- package/dist/src/generators/angular/helpers/get-styles.d.ts +6 -0
- package/dist/src/generators/angular/helpers/get-styles.js +17 -0
- package/dist/src/generators/angular/helpers/hooks.d.ts +25 -0
- package/dist/src/generators/angular/helpers/hooks.js +59 -0
- package/dist/src/generators/angular/helpers/index.d.ts +33 -0
- package/dist/src/generators/angular/helpers/index.js +221 -0
- package/dist/src/generators/angular/helpers/parse-selector.d.ts +5 -0
- package/dist/src/generators/angular/helpers/parse-selector.js +19 -0
- package/dist/src/generators/angular/index.d.ts +2 -0
- package/dist/src/generators/angular/index.js +18 -0
- package/dist/src/generators/angular/signals/blocks.d.ts +10 -0
- package/dist/src/generators/angular/signals/blocks.js +379 -0
- package/dist/src/generators/angular/signals/component.d.ts +3 -0
- package/dist/src/generators/angular/signals/component.js +377 -0
- package/dist/src/generators/angular/signals/helpers/get-computed.d.ts +6 -0
- package/dist/src/generators/angular/signals/helpers/get-computed.js +79 -0
- package/dist/src/generators/angular/signals/helpers/get-dynamic-template-refs.d.ts +2 -0
- package/dist/src/generators/angular/signals/helpers/get-dynamic-template-refs.js +25 -0
- package/dist/src/generators/angular/signals/helpers/get-inputs.d.ts +7 -0
- package/dist/src/generators/angular/signals/helpers/get-inputs.js +15 -0
- package/dist/src/generators/angular/signals/helpers/index.d.ts +16 -0
- package/dist/src/generators/angular/signals/helpers/index.js +30 -0
- package/dist/src/generators/angular/signals/plugins/get-code-processor-plugins.d.ts +4 -0
- package/dist/src/generators/angular/signals/plugins/get-code-processor-plugins.js +547 -0
- package/dist/src/generators/angular/types.d.ts +72 -0
- package/dist/src/generators/angular/types.js +12 -0
- package/dist/src/generators/builder/generator.d.ts +12 -0
- package/dist/src/generators/builder/generator.js +876 -0
- package/dist/src/generators/builder/index.d.ts +2 -0
- package/dist/src/generators/builder/index.js +18 -0
- package/dist/src/generators/builder/types.d.ts +6 -0
- package/dist/src/generators/builder/types.js +2 -0
- package/dist/src/generators/context/angular.d.ts +9 -0
- package/dist/src/generators/context/angular.js +40 -0
- package/dist/src/generators/context/helpers/context-with-symbol-key.d.ts +5 -0
- package/dist/src/generators/context/helpers/context-with-symbol-key.js +33 -0
- package/dist/src/generators/context/qwik.d.ts +8 -0
- package/dist/src/generators/context/qwik.js +29 -0
- package/dist/src/generators/context/react.d.ts +10 -0
- package/dist/src/generators/context/react.js +30 -0
- package/dist/src/generators/context/rsc.d.ts +12 -0
- package/dist/src/generators/context/rsc.js +32 -0
- package/dist/src/generators/context/solid.d.ts +8 -0
- package/dist/src/generators/context/solid.js +30 -0
- package/dist/src/generators/context/svelte.d.ts +11 -0
- package/dist/src/generators/context/svelte.js +44 -0
- package/dist/src/generators/context/vue.d.ts +3 -0
- package/dist/src/generators/context/vue.js +5 -0
- package/dist/src/generators/helpers/context.d.ts +8 -0
- package/dist/src/generators/helpers/context.js +15 -0
- package/dist/src/generators/helpers/functions.d.ts +2 -0
- package/dist/src/generators/helpers/functions.js +31 -0
- package/dist/src/generators/helpers/minify.d.ts +1 -0
- package/dist/src/generators/helpers/minify.js +20 -0
- package/dist/src/generators/helpers/on-mount.d.ts +5 -0
- package/dist/src/generators/helpers/on-mount.js +25 -0
- package/dist/src/generators/helpers/rsc.d.ts +2 -0
- package/dist/src/generators/helpers/rsc.js +38 -0
- package/dist/src/generators/html/generator.d.ts +4 -0
- package/dist/src/generators/html/generator.js +1232 -0
- package/dist/src/generators/html/index.d.ts +2 -0
- package/dist/src/generators/html/index.js +18 -0
- package/dist/src/generators/html/types.d.ts +6 -0
- package/dist/src/generators/html/types.js +2 -0
- package/dist/src/generators/liquid/generator.d.ts +9 -0
- package/dist/src/generators/liquid/generator.js +161 -0
- package/dist/src/generators/liquid/index.d.ts +2 -0
- package/dist/src/generators/liquid/index.js +18 -0
- package/dist/src/generators/liquid/types.d.ts +5 -0
- package/dist/src/generators/liquid/types.js +2 -0
- package/dist/src/generators/lit/collect-class-string.d.ts +2 -0
- package/dist/src/generators/lit/collect-class-string.js +41 -0
- package/dist/src/generators/lit/generate.d.ts +3 -0
- package/dist/src/generators/lit/generate.js +271 -0
- package/dist/src/generators/lit/index.d.ts +2 -0
- package/dist/src/generators/lit/index.js +18 -0
- package/dist/src/generators/lit/types.d.ts +8 -0
- package/dist/src/generators/lit/types.js +2 -0
- package/dist/src/generators/marko/generate.d.ts +20 -0
- package/dist/src/generators/marko/generate.js +316 -0
- package/dist/src/generators/marko/index.d.ts +2 -0
- package/dist/src/generators/marko/index.js +18 -0
- package/dist/src/generators/marko/types.d.ts +4 -0
- package/dist/src/generators/marko/types.js +2 -0
- package/dist/src/generators/mitosis/generator.d.ts +7 -0
- package/dist/src/generators/mitosis/generator.js +367 -0
- package/dist/src/generators/mitosis/index.d.ts +2 -0
- package/dist/src/generators/mitosis/index.js +18 -0
- package/dist/src/generators/mitosis/types.d.ts +8 -0
- package/dist/src/generators/mitosis/types.js +2 -0
- package/dist/src/generators/qwik/component-generator.d.ts +3 -0
- package/dist/src/generators/qwik/component-generator.js +337 -0
- package/dist/src/generators/qwik/component.d.ts +21 -0
- package/dist/src/generators/qwik/component.js +170 -0
- package/dist/src/generators/qwik/directives.d.ts +24 -0
- package/dist/src/generators/qwik/directives.js +152 -0
- package/dist/src/generators/qwik/helpers/add-prevent-default.d.ts +7 -0
- package/dist/src/generators/qwik/helpers/add-prevent-default.js +33 -0
- package/dist/src/generators/qwik/helpers/convert-method-to-function.d.ts +2 -0
- package/dist/src/generators/qwik/helpers/convert-method-to-function.js +161 -0
- package/dist/src/generators/qwik/helpers/handlers.d.ts +3 -0
- package/dist/src/generators/qwik/helpers/handlers.js +60 -0
- package/dist/src/generators/qwik/helpers/stable-inject.d.ts +5 -0
- package/dist/src/generators/qwik/helpers/stable-inject.js +49 -0
- package/dist/src/generators/qwik/helpers/stable-serialize.d.ts +6 -0
- package/dist/src/generators/qwik/helpers/stable-serialize.js +50 -0
- package/dist/src/generators/qwik/helpers/state.d.ts +32 -0
- package/dist/src/generators/qwik/helpers/state.js +111 -0
- package/dist/src/generators/qwik/helpers/styles.d.ts +7 -0
- package/dist/src/generators/qwik/helpers/styles.js +70 -0
- package/dist/src/generators/qwik/index.d.ts +5 -0
- package/dist/src/generators/qwik/index.js +26 -0
- package/dist/src/generators/qwik/jsx.d.ts +17 -0
- package/dist/src/generators/qwik/jsx.js +223 -0
- package/dist/src/generators/qwik/src-generator.d.ts +83 -0
- package/dist/src/generators/qwik/src-generator.js +575 -0
- package/dist/src/generators/qwik/types.d.ts +14 -0
- package/dist/src/generators/qwik/types.js +2 -0
- package/dist/src/generators/react/blocks.d.ts +4 -0
- package/dist/src/generators/react/blocks.js +332 -0
- package/dist/src/generators/react/generator.d.ts +5 -0
- package/dist/src/generators/react/generator.js +399 -0
- package/dist/src/generators/react/helpers/default-props.d.ts +2 -0
- package/dist/src/generators/react/helpers/default-props.js +21 -0
- package/dist/src/generators/react/helpers/hooks.d.ts +20 -0
- package/dist/src/generators/react/helpers/hooks.js +67 -0
- package/dist/src/generators/react/helpers/index.d.ts +11 -0
- package/dist/src/generators/react/helpers/index.js +97 -0
- package/dist/src/generators/react/helpers/state.d.ts +17 -0
- package/dist/src/generators/react/helpers/state.js +198 -0
- package/dist/src/generators/react/index.d.ts +3 -0
- package/dist/src/generators/react/index.js +21 -0
- package/dist/src/generators/react/types.d.ts +22 -0
- package/dist/src/generators/react/types.js +2 -0
- package/dist/src/generators/react-native/extract-css-var-default-value.d.ts +1 -0
- package/dist/src/generators/react-native/extract-css-var-default-value.js +15 -0
- package/dist/src/generators/react-native/helpers.d.ts +3 -0
- package/dist/src/generators/react-native/helpers.js +133 -0
- package/dist/src/generators/react-native/index.d.ts +8 -0
- package/dist/src/generators/react-native/index.js +286 -0
- package/dist/src/generators/react-native/sanitize-react-native-block-styles.d.ts +4 -0
- package/dist/src/generators/react-native/sanitize-react-native-block-styles.js +57 -0
- package/dist/src/generators/react-native/types.d.ts +9 -0
- package/dist/src/generators/react-native/types.js +2 -0
- package/dist/src/generators/rsc/generator.d.ts +3 -0
- package/dist/src/generators/rsc/generator.js +77 -0
- package/dist/src/generators/rsc/index.d.ts +2 -0
- package/dist/src/generators/rsc/index.js +18 -0
- package/dist/src/generators/rsc/types.d.ts +5 -0
- package/dist/src/generators/rsc/types.js +2 -0
- package/dist/src/generators/solid/blocks.d.ts +4 -0
- package/dist/src/generators/solid/blocks.js +138 -0
- package/dist/src/generators/solid/helpers/styles.d.ts +3 -0
- package/dist/src/generators/solid/helpers/styles.js +47 -0
- package/dist/src/generators/solid/index.d.ts +4 -0
- package/dist/src/generators/solid/index.js +264 -0
- package/dist/src/generators/solid/state/helpers.d.ts +13 -0
- package/dist/src/generators/solid/state/helpers.js +88 -0
- package/dist/src/generators/solid/state/index.d.ts +1 -0
- package/dist/src/generators/solid/state/index.js +5 -0
- package/dist/src/generators/solid/state/signals.d.ts +7 -0
- package/dist/src/generators/solid/state/signals.js +53 -0
- package/dist/src/generators/solid/state/state.d.ts +14 -0
- package/dist/src/generators/solid/state/state.js +55 -0
- package/dist/src/generators/solid/state/store.d.ts +7 -0
- package/dist/src/generators/solid/state/store.js +76 -0
- package/dist/src/generators/solid/types.d.ts +10 -0
- package/dist/src/generators/solid/types.js +2 -0
- package/dist/src/generators/stencil/blocks.d.ts +9 -0
- package/dist/src/generators/stencil/blocks.js +122 -0
- package/dist/src/generators/stencil/component.d.ts +3 -0
- package/dist/src/generators/stencil/component.js +199 -0
- package/dist/src/generators/stencil/helpers/collect-class-string.d.ts +2 -0
- package/dist/src/generators/stencil/helpers/collect-class-string.js +43 -0
- package/dist/src/generators/stencil/helpers/index.d.ts +37 -0
- package/dist/src/generators/stencil/helpers/index.js +129 -0
- package/dist/src/generators/stencil/index.d.ts +2 -0
- package/dist/src/generators/stencil/index.js +18 -0
- package/dist/src/generators/stencil/plugins/get-code-processor-plugins.d.ts +4 -0
- package/dist/src/generators/stencil/plugins/get-code-processor-plugins.js +25 -0
- package/dist/src/generators/stencil/types.d.ts +37 -0
- package/dist/src/generators/stencil/types.js +2 -0
- package/dist/src/generators/svelte/blocks.d.ts +10 -0
- package/dist/src/generators/svelte/blocks.js +280 -0
- package/dist/src/generators/svelte/helpers.d.ts +6 -0
- package/dist/src/generators/svelte/helpers.js +14 -0
- package/dist/src/generators/svelte/index.d.ts +2 -0
- package/dist/src/generators/svelte/index.js +20 -0
- package/dist/src/generators/svelte/svelte.d.ts +3 -0
- package/dist/src/generators/svelte/svelte.js +412 -0
- package/dist/src/generators/svelte/types.d.ts +5 -0
- package/dist/src/generators/svelte/types.js +2 -0
- package/dist/src/generators/swift/blocks.d.ts +8 -0
- package/dist/src/generators/swift/blocks.js +304 -0
- package/dist/src/generators/swift/generator.d.ts +3 -0
- package/dist/src/generators/swift/generator.js +287 -0
- package/dist/src/generators/swift/helpers.d.ts +42 -0
- package/dist/src/generators/swift/helpers.js +412 -0
- package/dist/src/generators/swift/index.d.ts +2 -0
- package/dist/src/generators/swift/index.js +18 -0
- package/dist/src/generators/swift/types.d.ts +29 -0
- package/dist/src/generators/swift/types.js +2 -0
- package/dist/src/generators/taro/generator.d.ts +8 -0
- package/dist/src/generators/taro/generator.js +168 -0
- package/dist/src/generators/taro/index.d.ts +2 -0
- package/dist/src/generators/taro/index.js +18 -0
- package/dist/src/generators/taro/types.d.ts +3 -0
- package/dist/src/generators/taro/types.js +2 -0
- package/dist/src/generators/template/generator.d.ts +3 -0
- package/dist/src/generators/template/generator.js +131 -0
- package/dist/src/generators/template/index.d.ts +2 -0
- package/dist/src/generators/template/index.js +18 -0
- package/dist/src/generators/template/types.d.ts +4 -0
- package/dist/src/generators/template/types.js +2 -0
- package/dist/src/generators/vue/blocks.d.ts +8 -0
- package/dist/src/generators/vue/blocks.js +217 -0
- package/dist/src/generators/vue/compositionApi.d.ts +3 -0
- package/dist/src/generators/vue/compositionApi.js +128 -0
- package/dist/src/generators/vue/helpers.d.ts +25 -0
- package/dist/src/generators/vue/helpers.js +179 -0
- package/dist/src/generators/vue/index.d.ts +2 -0
- package/dist/src/generators/vue/index.js +18 -0
- package/dist/src/generators/vue/optionsApi.d.ts +3 -0
- package/dist/src/generators/vue/optionsApi.js +210 -0
- package/dist/src/generators/vue/types.d.ts +33 -0
- package/dist/src/generators/vue/types.js +2 -0
- package/dist/src/generators/vue/vue.d.ts +3 -0
- package/dist/src/generators/vue/vue.js +272 -0
- package/dist/src/helpers/apply-meta-tagname.d.ts +2 -0
- package/dist/src/helpers/apply-meta-tagname.js +20 -0
- package/dist/src/helpers/babel-transform.d.ts +7 -0
- package/dist/src/helpers/babel-transform.js +130 -0
- package/dist/src/helpers/bindings.d.ts +6 -0
- package/dist/src/helpers/bindings.js +9 -0
- package/dist/src/helpers/camel-case.d.ts +8 -0
- package/dist/src/helpers/camel-case.js +17 -0
- package/dist/src/helpers/capitalize.d.ts +1 -0
- package/dist/src/helpers/capitalize.js +10 -0
- package/dist/src/helpers/class-components.d.ts +13 -0
- package/dist/src/helpers/class-components.js +51 -0
- package/dist/src/helpers/component-file-extensions.d.ts +50 -0
- package/dist/src/helpers/component-file-extensions.js +141 -0
- package/dist/src/helpers/create-mitosis-component.d.ts +7 -0
- package/dist/src/helpers/create-mitosis-component.js +27 -0
- package/dist/src/helpers/create-mitosis-context.d.ts +4 -0
- package/dist/src/helpers/create-mitosis-context.js +11 -0
- package/dist/src/helpers/create-mitosis-node.d.ts +2 -0
- package/dist/src/helpers/create-mitosis-node.js +14 -0
- package/dist/src/helpers/dash-case.d.ts +1 -0
- package/dist/src/helpers/dash-case.js +6 -0
- package/dist/src/helpers/dedent.d.ts +1 -0
- package/dist/src/helpers/dedent.js +83 -0
- package/dist/src/helpers/event-handlers.d.ts +3 -0
- package/dist/src/helpers/event-handlers.js +115 -0
- package/dist/src/helpers/fast-clone.d.ts +1 -0
- package/dist/src/helpers/fast-clone.js +5 -0
- package/dist/src/helpers/filter-empty-text-nodes.d.ts +3 -0
- package/dist/src/helpers/filter-empty-text-nodes.js +9 -0
- package/dist/src/helpers/generic-format.d.ts +6 -0
- package/dist/src/helpers/generic-format.js +35 -0
- package/dist/src/helpers/get-bindings.d.ts +2 -0
- package/dist/src/helpers/get-bindings.js +16 -0
- package/dist/src/helpers/get-child-components.d.ts +2 -0
- package/dist/src/helpers/get-child-components.js +26 -0
- package/dist/src/helpers/get-components-used.d.ts +2 -0
- package/dist/src/helpers/get-components-used.js +18 -0
- package/dist/src/helpers/get-components.d.ts +2 -0
- package/dist/src/helpers/get-components.js +21 -0
- package/dist/src/helpers/get-custom-imports.d.ts +15 -0
- package/dist/src/helpers/get-custom-imports.js +38 -0
- package/dist/src/helpers/get-function-string.d.ts +1 -0
- package/dist/src/helpers/get-function-string.js +5 -0
- package/dist/src/helpers/get-prop-functions.d.ts +5 -0
- package/dist/src/helpers/get-prop-functions.js +28 -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-props.d.ts +5 -0
- package/dist/src/helpers/get-props.js +41 -0
- package/dist/src/helpers/get-refs.d.ts +2 -0
- package/dist/src/helpers/get-refs.js +21 -0
- package/dist/src/helpers/get-state-object-string.d.ts +20 -0
- package/dist/src/helpers/get-state-object-string.js +86 -0
- package/dist/src/helpers/get-state-used.d.ts +5 -0
- package/dist/src/helpers/get-state-used.js +28 -0
- package/dist/src/helpers/get-styles.d.ts +4 -0
- package/dist/src/helpers/get-styles.js +34 -0
- package/dist/src/helpers/get-tag-name.d.ts +2 -0
- package/dist/src/helpers/get-tag-name.js +7 -0
- package/dist/src/helpers/get-typed-function.d.ts +4 -0
- package/dist/src/helpers/get-typed-function.js +20 -0
- package/dist/src/helpers/getters-to-functions.d.ts +5 -0
- package/dist/src/helpers/getters-to-functions.js +36 -0
- package/dist/src/helpers/handle-missing-state.d.ts +2 -0
- package/dist/src/helpers/handle-missing-state.js +13 -0
- 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-component.d.ts +2 -0
- package/dist/src/helpers/has-component.js +21 -0
- package/dist/src/helpers/has-props.d.ts +2 -0
- package/dist/src/helpers/has-props.js +19 -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/has.d.ts +9 -0
- package/dist/src/helpers/has.js +27 -0
- package/dist/src/helpers/html-escape.d.ts +1 -0
- package/dist/src/helpers/html-escape.js +7 -0
- package/dist/src/helpers/indent.d.ts +1 -0
- package/dist/src/helpers/indent.js +7 -0
- package/dist/src/helpers/is-children.d.ts +6 -0
- package/dist/src/helpers/is-children.js +14 -0
- package/dist/src/helpers/is-component.d.ts +5 -0
- package/dist/src/helpers/is-component.js +8 -0
- package/dist/src/helpers/is-hook-empty.d.ts +2 -0
- package/dist/src/helpers/is-hook-empty.js +14 -0
- package/dist/src/helpers/is-html-attribute.d.ts +4 -0
- package/dist/src/helpers/is-html-attribute.js +371 -0
- package/dist/src/helpers/is-mitosis-node.d.ts +2 -0
- package/dist/src/helpers/is-mitosis-node.js +7 -0
- package/dist/src/helpers/is-root-text-node.d.ts +4 -0
- package/dist/src/helpers/is-root-text-node.js +12 -0
- package/dist/src/helpers/is-upper-case.d.ts +1 -0
- package/dist/src/helpers/is-upper-case.js +5 -0
- package/dist/src/helpers/is-valid-attribute-name.d.ts +1 -0
- package/dist/src/helpers/is-valid-attribute-name.js +7 -0
- package/dist/src/helpers/json.d.ts +3 -0
- package/dist/src/helpers/json.js +17 -0
- package/dist/src/helpers/map-refs.d.ts +9 -0
- package/dist/src/helpers/map-refs.js +91 -0
- package/dist/src/helpers/merge-options.d.ts +19 -0
- package/dist/src/helpers/merge-options.js +35 -0
- package/dist/src/helpers/mitosis-imports.d.ts +5 -0
- package/dist/src/helpers/mitosis-imports.js +48 -0
- package/dist/src/helpers/nodes/for.d.ts +4 -0
- package/dist/src/helpers/nodes/for.js +12 -0
- package/dist/src/helpers/nullable.d.ts +2 -0
- package/dist/src/helpers/nullable.js +5 -0
- package/dist/src/helpers/on-event.d.ts +14 -0
- package/dist/src/helpers/on-event.js +52 -0
- package/dist/src/helpers/output.d.ts +5 -0
- package/dist/src/helpers/output.js +10 -0
- package/dist/src/helpers/parse-node.d.ts +2 -0
- package/dist/src/helpers/parse-node.js +20 -0
- package/dist/src/helpers/parsers.d.ts +9 -0
- package/dist/src/helpers/parsers.js +66 -0
- package/dist/src/helpers/patterns.d.ts +8 -0
- package/dist/src/helpers/patterns.js +17 -0
- package/dist/src/helpers/plugins/process-code/index.d.ts +12 -0
- package/dist/src/helpers/plugins/process-code/index.js +169 -0
- package/dist/src/helpers/plugins/process-code/types.d.ts +7 -0
- package/dist/src/helpers/plugins/process-code/types.js +2 -0
- package/dist/src/helpers/plugins/process-signals.d.ts +22 -0
- package/dist/src/helpers/plugins/process-signals.js +179 -0
- package/dist/src/helpers/plugins/process-target-blocks.d.ts +6 -0
- package/dist/src/helpers/plugins/process-target-blocks.js +59 -0
- package/dist/src/helpers/process-http-requests.d.ts +2 -0
- package/dist/src/helpers/process-http-requests.js +25 -0
- package/dist/src/helpers/remove-surrounding-block.d.ts +6 -0
- package/dist/src/helpers/remove-surrounding-block.js +25 -0
- package/dist/src/helpers/render-imports.d.ts +42 -0
- package/dist/src/helpers/render-imports.js +169 -0
- package/dist/src/helpers/replace-identifiers.d.ts +27 -0
- package/dist/src/helpers/replace-identifiers.js +187 -0
- package/dist/src/helpers/replace-new-lines-in-strings.d.ts +1 -0
- package/dist/src/helpers/replace-new-lines-in-strings.js +26 -0
- package/dist/src/helpers/set.d.ts +7 -0
- package/dist/src/helpers/set.js +24 -0
- package/dist/src/helpers/signals/index.d.ts +1 -0
- package/dist/src/helpers/signals/index.js +17 -0
- package/dist/src/helpers/signals/signals.d.ts +22 -0
- package/dist/src/helpers/signals/signals.js +109 -0
- package/dist/src/helpers/slots.d.ts +5 -0
- package/dist/src/helpers/slots.js +26 -0
- package/dist/src/helpers/state.d.ts +2 -0
- package/dist/src/helpers/state.js +5 -0
- package/dist/src/helpers/strip-meta-properties.d.ts +2 -0
- package/dist/src/helpers/strip-meta-properties.js +26 -0
- package/dist/src/helpers/strip-state-and-props-refs.d.ts +38 -0
- package/dist/src/helpers/strip-state-and-props-refs.js +86 -0
- package/dist/src/helpers/styles/collect-css.d.ts +7 -0
- package/dist/src/helpers/styles/collect-css.js +113 -0
- package/dist/src/helpers/styles/collect-styled-components.d.ts +2 -0
- package/dist/src/helpers/styles/collect-styled-components.js +64 -0
- package/dist/src/helpers/styles/helpers.d.ts +31 -0
- package/dist/src/helpers/styles/helpers.js +90 -0
- package/dist/src/helpers/trace-reference-to-module-path.d.ts +2 -0
- package/dist/src/helpers/trace-reference-to-module-path.js +13 -0
- package/dist/src/helpers/transform-state-setters.d.ts +14 -0
- package/dist/src/helpers/transform-state-setters.js +24 -0
- package/dist/src/helpers/transform-to-jsx.d.ts +4 -0
- package/dist/src/helpers/transform-to-jsx.js +13 -0
- package/dist/src/helpers/traverse-nodes.d.ts +4 -0
- package/dist/src/helpers/traverse-nodes.js +16 -0
- package/dist/src/helpers/try-prettier-format.d.ts +1 -0
- package/dist/src/helpers/try-prettier-format.js +24 -0
- package/dist/src/helpers/typescript-project.d.ts +7 -0
- package/dist/src/helpers/typescript-project.js +63 -0
- package/dist/src/helpers/typescript.d.ts +9 -0
- package/dist/src/helpers/typescript.js +5 -0
- package/dist/src/helpers/web-components/attribute-passing.d.ts +6 -0
- package/dist/src/helpers/web-components/attribute-passing.js +47 -0
- package/dist/src/index.d.ts +96 -0
- package/dist/src/index.js +74 -0
- package/dist/src/modules/plugins.d.ts +25 -0
- package/dist/src/modules/plugins.js +51 -0
- package/dist/src/parsers/angular.d.ts +5 -0
- package/dist/src/parsers/angular.js +154 -0
- package/dist/src/parsers/builder/builder.d.ts +55 -0
- package/dist/src/parsers/builder/builder.js +1198 -0
- package/dist/src/parsers/builder/helpers.d.ts +3 -0
- package/dist/src/parsers/builder/helpers.js +26 -0
- package/dist/src/parsers/builder/index.d.ts +1 -0
- package/dist/src/parsers/builder/index.js +17 -0
- package/dist/src/parsers/context.d.ts +6 -0
- package/dist/src/parsers/context.js +82 -0
- package/dist/src/parsers/jsx/ast.d.ts +5 -0
- package/dist/src/parsers/jsx/ast.js +74 -0
- package/dist/src/parsers/jsx/component-types.d.ts +8 -0
- package/dist/src/parsers/jsx/component-types.js +82 -0
- package/dist/src/parsers/jsx/context.d.ts +6 -0
- package/dist/src/parsers/jsx/context.js +68 -0
- package/dist/src/parsers/jsx/element-parser.d.ts +9 -0
- package/dist/src/parsers/jsx/element-parser.js +418 -0
- package/dist/src/parsers/jsx/exports.d.ts +5 -0
- package/dist/src/parsers/jsx/exports.js +76 -0
- package/dist/src/parsers/jsx/function-parser.d.ts +9 -0
- package/dist/src/parsers/jsx/function-parser.js +360 -0
- package/dist/src/parsers/jsx/helpers.d.ts +17 -0
- package/dist/src/parsers/jsx/helpers.js +85 -0
- package/dist/src/parsers/jsx/hooks/helpers.d.ts +5 -0
- package/dist/src/parsers/jsx/hooks/helpers.js +54 -0
- package/dist/src/parsers/jsx/hooks/index.d.ts +16 -0
- package/dist/src/parsers/jsx/hooks/index.js +96 -0
- package/dist/src/parsers/jsx/hooks/use-metadata.d.ts +9 -0
- package/dist/src/parsers/jsx/hooks/use-metadata.js +184 -0
- package/dist/src/parsers/jsx/hooks/use-target.d.ts +13 -0
- package/dist/src/parsers/jsx/hooks/use-target.js +135 -0
- package/dist/src/parsers/jsx/imports.d.ts +7 -0
- package/dist/src/parsers/jsx/imports.js +23 -0
- package/dist/src/parsers/jsx/index.d.ts +2 -0
- package/dist/src/parsers/jsx/index.js +5 -0
- package/dist/src/parsers/jsx/jsx.d.ts +10 -0
- package/dist/src/parsers/jsx/jsx.js +227 -0
- package/dist/src/parsers/jsx/props-types.d.ts +5 -0
- package/dist/src/parsers/jsx/props-types.js +22 -0
- package/dist/src/parsers/jsx/props.d.ts +2 -0
- package/dist/src/parsers/jsx/props.js +64 -0
- package/dist/src/parsers/jsx/signals.d.ts +9 -0
- package/dist/src/parsers/jsx/signals.js +99 -0
- package/dist/src/parsers/jsx/state.d.ts +17 -0
- package/dist/src/parsers/jsx/state.js +274 -0
- package/dist/src/parsers/jsx/types.d.ts +29 -0
- package/dist/src/parsers/jsx/types.js +2 -0
- package/dist/src/parsers/svelte/css/index.d.ts +3 -0
- package/dist/src/parsers/svelte/css/index.js +8 -0
- package/dist/src/parsers/svelte/helpers/bindings.d.ts +3 -0
- package/dist/src/parsers/svelte/helpers/bindings.js +75 -0
- package/dist/src/parsers/svelte/helpers/children.d.ts +5 -0
- package/dist/src/parsers/svelte/helpers/children.js +22 -0
- package/dist/src/parsers/svelte/helpers/expressions.d.ts +3 -0
- package/dist/src/parsers/svelte/helpers/expressions.js +20 -0
- package/dist/src/parsers/svelte/helpers/hooks.d.ts +2 -0
- package/dist/src/parsers/svelte/helpers/hooks.js +15 -0
- package/dist/src/parsers/svelte/helpers/mitosis-node.d.ts +2 -0
- package/dist/src/parsers/svelte/helpers/mitosis-node.js +16 -0
- package/dist/src/parsers/svelte/helpers/post-process.d.ts +15 -0
- package/dist/src/parsers/svelte/helpers/post-process.js +174 -0
- package/dist/src/parsers/svelte/helpers/string.d.ts +3 -0
- package/dist/src/parsers/svelte/helpers/string.js +26 -0
- package/dist/src/parsers/svelte/html/actions.d.ts +3 -0
- package/dist/src/parsers/svelte/html/actions.js +46 -0
- package/dist/src/parsers/svelte/html/each.d.ts +4 -0
- package/dist/src/parsers/svelte/html/each.js +20 -0
- package/dist/src/parsers/svelte/html/element.d.ts +3 -0
- package/dist/src/parsers/svelte/html/element.js +224 -0
- package/dist/src/parsers/svelte/html/fragment.d.ts +3 -0
- package/dist/src/parsers/svelte/html/fragment.js +16 -0
- package/dist/src/parsers/svelte/html/if-else.d.ts +3 -0
- package/dist/src/parsers/svelte/html/if-else.js +31 -0
- package/dist/src/parsers/svelte/html/index.d.ts +5 -0
- package/dist/src/parsers/svelte/html/index.js +80 -0
- package/dist/src/parsers/svelte/html/mustache-tag.d.ts +3 -0
- package/dist/src/parsers/svelte/html/mustache-tag.js +24 -0
- package/dist/src/parsers/svelte/html/slot.d.ts +3 -0
- package/dist/src/parsers/svelte/html/slot.js +20 -0
- package/dist/src/parsers/svelte/html/text.d.ts +66 -0
- package/dist/src/parsers/svelte/html/text.js +14 -0
- package/dist/src/parsers/svelte/index.d.ts +2 -0
- package/dist/src/parsers/svelte/index.js +59 -0
- package/dist/src/parsers/svelte/instance/context.d.ts +5 -0
- package/dist/src/parsers/svelte/instance/context.js +59 -0
- package/dist/src/parsers/svelte/instance/expressions.d.ts +3 -0
- package/dist/src/parsers/svelte/instance/expressions.js +11 -0
- package/dist/src/parsers/svelte/instance/functions.d.ts +3 -0
- package/dist/src/parsers/svelte/instance/functions.js +66 -0
- package/dist/src/parsers/svelte/instance/hooks.d.ts +5 -0
- package/dist/src/parsers/svelte/instance/hooks.js +32 -0
- package/dist/src/parsers/svelte/instance/imports.d.ts +3 -0
- package/dist/src/parsers/svelte/instance/imports.js +32 -0
- package/dist/src/parsers/svelte/instance/index.d.ts +3 -0
- package/dist/src/parsers/svelte/instance/index.js +123 -0
- package/dist/src/parsers/svelte/instance/properties.d.ts +3 -0
- package/dist/src/parsers/svelte/instance/properties.js +22 -0
- package/dist/src/parsers/svelte/instance/reactive.d.ts +3 -0
- package/dist/src/parsers/svelte/instance/reactive.js +33 -0
- package/dist/src/parsers/svelte/instance/references.d.ts +4 -0
- package/dist/src/parsers/svelte/instance/references.js +68 -0
- package/dist/src/parsers/svelte/instance/statements.d.ts +3 -0
- package/dist/src/parsers/svelte/instance/statements.js +10 -0
- package/dist/src/parsers/svelte/module/index.d.ts +3 -0
- package/dist/src/parsers/svelte/module/index.js +34 -0
- package/dist/src/parsers/svelte/types/index.d.ts +4 -0
- package/dist/src/parsers/svelte/types/index.js +2 -0
- package/dist/src/parsers/svelte/typescript/index.d.ts +7 -0
- package/dist/src/parsers/svelte/typescript/index.js +121 -0
- package/dist/src/plugins/compile-away-builder-components.d.ts +15 -0
- package/dist/src/plugins/compile-away-builder-components.js +609 -0
- package/dist/src/plugins/compile-away-components.d.ts +33 -0
- package/dist/src/plugins/compile-away-components.js +50 -0
- package/dist/src/plugins/map-styles.d.ts +12 -0
- package/dist/src/plugins/map-styles.js +16 -0
- package/dist/src/symbols/symbol-processor.d.ts +20 -0
- package/dist/src/symbols/symbol-processor.js +202 -0
- package/dist/src/targets.d.ts +25 -0
- package/dist/src/targets.js +46 -0
- package/dist/src/types/config.d.ts +103 -0
- package/dist/src/types/config.js +2 -0
- package/dist/src/types/json.d.ts +13 -0
- package/dist/src/types/json.js +2 -0
- package/dist/src/types/metadata.d.ts +55 -0
- package/dist/src/types/metadata.js +2 -0
- package/dist/src/types/mitosis-component.d.ts +162 -0
- package/dist/src/types/mitosis-component.js +2 -0
- package/dist/src/types/mitosis-context.d.ts +6 -0
- package/dist/src/types/mitosis-context.js +2 -0
- package/dist/src/types/mitosis-node.d.ts +117 -0
- package/dist/src/types/mitosis-node.js +12 -0
- package/dist/src/types/mitosis-styles.d.ts +1 -0
- package/dist/src/types/mitosis-styles.js +2 -0
- package/dist/src/types/plugins.d.ts +19 -0
- package/dist/src/types/plugins.js +2 -0
- package/dist/src/types/transpiler.d.ts +48 -0
- package/dist/src/types/transpiler.js +2 -0
- package/jsx-runtime.d.ts +2143 -0
- package/package.json +106 -0
|
@@ -0,0 +1,272 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.componentToVue = void 0;
|
|
7
|
+
const apply_meta_tagname_1 = require("../../helpers/apply-meta-tagname");
|
|
8
|
+
const babel_transform_1 = require("../../helpers/babel-transform");
|
|
9
|
+
const bindings_1 = require("../../helpers/bindings");
|
|
10
|
+
const dedent_1 = require("../../helpers/dedent");
|
|
11
|
+
const fast_clone_1 = require("../../helpers/fast-clone");
|
|
12
|
+
const get_props_1 = require("../../helpers/get-props");
|
|
13
|
+
const is_mitosis_node_1 = require("../../helpers/is-mitosis-node");
|
|
14
|
+
const map_refs_1 = require("../../helpers/map-refs");
|
|
15
|
+
const merge_options_1 = require("../../helpers/merge-options");
|
|
16
|
+
const on_event_1 = require("../../helpers/on-event");
|
|
17
|
+
const process_code_1 = require("../../helpers/plugins/process-code");
|
|
18
|
+
const process_http_requests_1 = require("../../helpers/process-http-requests");
|
|
19
|
+
const render_imports_1 = require("../../helpers/render-imports");
|
|
20
|
+
const replace_identifiers_1 = require("../../helpers/replace-identifiers");
|
|
21
|
+
const slots_1 = require("../../helpers/slots");
|
|
22
|
+
const strip_meta_properties_1 = require("../../helpers/strip-meta-properties");
|
|
23
|
+
const collect_css_1 = require("../../helpers/styles/collect-css");
|
|
24
|
+
const function_1 = require("fp-ts/lib/function");
|
|
25
|
+
const lodash_1 = require("lodash");
|
|
26
|
+
const legacy_1 = __importDefault(require("neotraverse/legacy"));
|
|
27
|
+
const standalone_1 = require("prettier/standalone");
|
|
28
|
+
const plugins_1 = require("../../modules/plugins");
|
|
29
|
+
const functions_1 = require("../helpers/functions");
|
|
30
|
+
const blocks_1 = require("./blocks");
|
|
31
|
+
const compositionApi_1 = require("./compositionApi");
|
|
32
|
+
const helpers_1 = require("./helpers");
|
|
33
|
+
const optionsApi_1 = require("./optionsApi");
|
|
34
|
+
// Transform <foo.bar key="value" /> to <component :is="foo.bar" key="value" />
|
|
35
|
+
function processDynamicComponents(json, _options) {
|
|
36
|
+
(0, legacy_1.default)(json).forEach((node) => {
|
|
37
|
+
if ((0, is_mitosis_node_1.isMitosisNode)(node)) {
|
|
38
|
+
if (node.name.includes('.')) {
|
|
39
|
+
node.bindings.is = (0, bindings_1.createSingleBinding)({ code: node.name });
|
|
40
|
+
node.name = 'component';
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
function processForKeys(json, _options) {
|
|
46
|
+
(0, legacy_1.default)(json).forEach((node) => {
|
|
47
|
+
if ((0, is_mitosis_node_1.isMitosisNode)(node)) {
|
|
48
|
+
if (node.name === 'For') {
|
|
49
|
+
const firstChild = node.children[0];
|
|
50
|
+
if (firstChild && firstChild.bindings.key) {
|
|
51
|
+
node.bindings.key = firstChild.bindings.key;
|
|
52
|
+
delete firstChild.bindings.key;
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* This plugin handle `onUpdate` code that watches dependencies.
|
|
60
|
+
* We need to apply this workaround to be able to watch specific dependencies in Vue 2: https://stackoverflow.com/a/45853349
|
|
61
|
+
*
|
|
62
|
+
* We add a `computed` property for the dependencies, and a matching `watch` function for the `onUpdate` code
|
|
63
|
+
*/
|
|
64
|
+
const onUpdatePlugin = (options) => ({
|
|
65
|
+
json: {
|
|
66
|
+
post: (component) => {
|
|
67
|
+
if (component.hooks.onUpdate) {
|
|
68
|
+
component.hooks.onUpdate
|
|
69
|
+
.filter((hook) => { var _a; return (_a = hook.deps) === null || _a === void 0 ? void 0 : _a.length; })
|
|
70
|
+
.forEach((hook, index) => {
|
|
71
|
+
var _a;
|
|
72
|
+
const code = `get ${(0, helpers_1.getOnUpdateHookName)(index)} () {
|
|
73
|
+
return {
|
|
74
|
+
${(_a = hook.deps) === null || _a === void 0 ? void 0 : _a.slice(1, -1).split(',').map((dep, k) => {
|
|
75
|
+
const val = dep.trim();
|
|
76
|
+
return `${k}: ${val}`;
|
|
77
|
+
}).join(',')}
|
|
78
|
+
}
|
|
79
|
+
}`;
|
|
80
|
+
component.state[(0, helpers_1.getOnUpdateHookName)(index)] = {
|
|
81
|
+
code,
|
|
82
|
+
type: 'getter',
|
|
83
|
+
};
|
|
84
|
+
});
|
|
85
|
+
}
|
|
86
|
+
},
|
|
87
|
+
},
|
|
88
|
+
});
|
|
89
|
+
const BASE_OPTIONS = {
|
|
90
|
+
api: 'options',
|
|
91
|
+
defineComponent: true,
|
|
92
|
+
casing: 'pascal',
|
|
93
|
+
};
|
|
94
|
+
const componentToVue = (userOptions) => ({ component: _component, path }) => {
|
|
95
|
+
var _a, _b, _c, _d, _e, _f;
|
|
96
|
+
// Make a copy we can safely mutate, similar to babel's toolchain can be used
|
|
97
|
+
let component = (0, fast_clone_1.fastClone)(_component);
|
|
98
|
+
const options = (0, merge_options_1.initializeOptions)({
|
|
99
|
+
target: 'vue',
|
|
100
|
+
component,
|
|
101
|
+
defaults: BASE_OPTIONS,
|
|
102
|
+
userOptions: userOptions,
|
|
103
|
+
});
|
|
104
|
+
if (options.api === 'composition') {
|
|
105
|
+
options.asyncComponentImports = false;
|
|
106
|
+
}
|
|
107
|
+
options.plugins.unshift((0, on_event_1.processOnEventHooksPlugin)(), ...(options.api === 'options' ? [onUpdatePlugin] : []), ...(options.api === 'composition' ? [functions_1.FUNCTION_HACK_PLUGIN] : []), (0, process_code_1.CODE_PROCESSOR_PLUGIN)((codeType) => {
|
|
108
|
+
if (options.api === 'composition') {
|
|
109
|
+
switch (codeType) {
|
|
110
|
+
case 'hooks':
|
|
111
|
+
return (code) => (0, helpers_1.processBinding)({ code, options, json: component });
|
|
112
|
+
case 'state':
|
|
113
|
+
return (code) => (0, helpers_1.processBinding)({ code, options, json: component });
|
|
114
|
+
case 'bindings':
|
|
115
|
+
return (0, function_1.flow)(
|
|
116
|
+
// Strip types from any JS code that ends up in the template, because Vue does not support TS code in templates.
|
|
117
|
+
babel_transform_1.convertTypeScriptToJS, (code) => (0, helpers_1.processBinding)({ code, options, json: component, codeType }));
|
|
118
|
+
case 'context-set':
|
|
119
|
+
return (code) => (0, helpers_1.processBinding)({ code, options, json: component, preserveGetter: true });
|
|
120
|
+
case 'hooks-deps':
|
|
121
|
+
return (0, replace_identifiers_1.replaceStateIdentifier)(null);
|
|
122
|
+
case 'properties':
|
|
123
|
+
case 'dynamic-jsx-elements':
|
|
124
|
+
case 'hooks-deps-array':
|
|
125
|
+
case 'types':
|
|
126
|
+
return (c) => c;
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
else {
|
|
130
|
+
switch (codeType) {
|
|
131
|
+
case 'hooks':
|
|
132
|
+
return (code) => (0, helpers_1.processBinding)({ code, options, json: component });
|
|
133
|
+
case 'bindings':
|
|
134
|
+
return (0, function_1.flow)(
|
|
135
|
+
// Strip types from any JS code that ends up in the template, because Vue does not support TS code in templates.
|
|
136
|
+
babel_transform_1.convertTypeScriptToJS, (code) => (0, helpers_1.processBinding)({ code, options, json: component, codeType }));
|
|
137
|
+
case 'properties':
|
|
138
|
+
case 'dynamic-jsx-elements':
|
|
139
|
+
case 'hooks-deps':
|
|
140
|
+
case 'hooks-deps-array':
|
|
141
|
+
case 'types':
|
|
142
|
+
return (c) => c;
|
|
143
|
+
case 'state':
|
|
144
|
+
return (c) => (0, helpers_1.processBinding)({ code: c, options, json: component });
|
|
145
|
+
case 'context-set':
|
|
146
|
+
return (code) => (0, helpers_1.processBinding)({
|
|
147
|
+
code,
|
|
148
|
+
options,
|
|
149
|
+
json: component,
|
|
150
|
+
thisPrefix: '_this',
|
|
151
|
+
preserveGetter: true,
|
|
152
|
+
});
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
}));
|
|
156
|
+
(0, process_http_requests_1.processHttpRequests)(component);
|
|
157
|
+
processDynamicComponents(component, options);
|
|
158
|
+
processForKeys(component, options);
|
|
159
|
+
component = (0, plugins_1.runPreJsonPlugins)({ json: component, plugins: options.plugins });
|
|
160
|
+
if (options.api === 'options') {
|
|
161
|
+
(0, map_refs_1.mapRefs)(component, (refName) => `this.$refs.${refName}`);
|
|
162
|
+
}
|
|
163
|
+
// need to run this before we process the component's code
|
|
164
|
+
const props = Array.from((0, get_props_1.getProps)(component));
|
|
165
|
+
const elementProps = props.filter((prop) => !(0, slots_1.isSlotProperty)(prop));
|
|
166
|
+
const slotsProps = props.filter((prop) => (0, slots_1.isSlotProperty)(prop));
|
|
167
|
+
component = (0, plugins_1.runPostJsonPlugins)({ json: component, plugins: options.plugins });
|
|
168
|
+
const css = (0, collect_css_1.collectCss)(component, {
|
|
169
|
+
prefix: (_b = (_a = options.cssNamespace) === null || _a === void 0 ? void 0 : _a.call(options)) !== null && _b !== void 0 ? _b : undefined,
|
|
170
|
+
});
|
|
171
|
+
// Apply the meta tagName to the component BEFORE we strip the meta properties
|
|
172
|
+
(0, apply_meta_tagname_1.applyMetaTagName)(component);
|
|
173
|
+
(0, strip_meta_properties_1.stripMetaProperties)(component);
|
|
174
|
+
const templateStrBody = component.children
|
|
175
|
+
.map((item) => (0, blocks_1.blockToVue)(item, options, { isRootNode: true }))
|
|
176
|
+
.join('\n');
|
|
177
|
+
const template = options.casing === 'kebab'
|
|
178
|
+
? (0, helpers_1.renameMitosisComponentsToKebabCase)(templateStrBody)
|
|
179
|
+
: templateStrBody;
|
|
180
|
+
const onUpdateWithDeps = ((_c = component.hooks.onUpdate) === null || _c === void 0 ? void 0 : _c.filter((hook) => { var _a; return (_a = hook.deps) === null || _a === void 0 ? void 0 : _a.length; })) || [];
|
|
181
|
+
const onUpdateWithoutDeps = ((_d = component.hooks.onUpdate) === null || _d === void 0 ? void 0 : _d.filter((hook) => { var _a; return !((_a = hook.deps) === null || _a === void 0 ? void 0 : _a.length); })) || [];
|
|
182
|
+
const getterKeys = Object.keys((0, lodash_1.pickBy)(component.state, (i) => (i === null || i === void 0 ? void 0 : i.type) === 'getter'));
|
|
183
|
+
// import from vue
|
|
184
|
+
let vueImports = [];
|
|
185
|
+
if (options.asyncComponentImports) {
|
|
186
|
+
vueImports.push('defineAsyncComponent');
|
|
187
|
+
}
|
|
188
|
+
if (options.api === 'options' && options.defineComponent) {
|
|
189
|
+
vueImports.push('defineComponent');
|
|
190
|
+
}
|
|
191
|
+
if (options.api === 'composition') {
|
|
192
|
+
onUpdateWithDeps.length && vueImports.push('watch');
|
|
193
|
+
component.hooks.onMount.length && vueImports.push('onMounted');
|
|
194
|
+
((_e = component.hooks.onUnMount) === null || _e === void 0 ? void 0 : _e.code) && vueImports.push('onUnmounted');
|
|
195
|
+
onUpdateWithoutDeps.length && vueImports.push('onUpdated');
|
|
196
|
+
(0, lodash_1.size)(getterKeys) && vueImports.push('computed');
|
|
197
|
+
(0, lodash_1.size)(component.context.set) && vueImports.push('provide');
|
|
198
|
+
(0, lodash_1.size)(component.context.get) && vueImports.push('inject');
|
|
199
|
+
(0, lodash_1.size)(Object.keys(component.state).filter((key) => { var _a; return ((_a = component.state[key]) === null || _a === void 0 ? void 0 : _a.type) === 'property'; })) + (0, lodash_1.size)(component.refs) && vueImports.push('ref');
|
|
200
|
+
(0, lodash_1.size)(slotsProps) && vueImports.push('useSlots');
|
|
201
|
+
}
|
|
202
|
+
const tsLangAttribute = options.typescript ? `lang='ts'` : '';
|
|
203
|
+
let str = (0, dedent_1.dedent) `
|
|
204
|
+
${template.trim().length > 0
|
|
205
|
+
? `<template>
|
|
206
|
+
${template}
|
|
207
|
+
</template>`
|
|
208
|
+
: ''}
|
|
209
|
+
|
|
210
|
+
|
|
211
|
+
<script ${options.api === 'composition' ? 'setup' : ''} ${tsLangAttribute}>
|
|
212
|
+
${vueImports.length ? `import { ${(0, lodash_1.uniq)(vueImports).sort().join(', ')} } from "vue"` : ''}
|
|
213
|
+
|
|
214
|
+
${(0, render_imports_1.renderPreComponent)({
|
|
215
|
+
explicitImportFileExtension: options.explicitImportFileExtension,
|
|
216
|
+
component,
|
|
217
|
+
target: 'vue',
|
|
218
|
+
asyncComponentImports: options.asyncComponentImports,
|
|
219
|
+
})}
|
|
220
|
+
|
|
221
|
+
${(options.typescript && ((_f = component.types) === null || _f === void 0 ? void 0 : _f.join('\n'))) || ''}
|
|
222
|
+
|
|
223
|
+
${options.api === 'composition'
|
|
224
|
+
? (0, compositionApi_1.generateCompositionApiScript)(component, options, template, elementProps, onUpdateWithDeps, onUpdateWithoutDeps)
|
|
225
|
+
: (0, optionsApi_1.generateOptionsApiScript)(component, options, path, template, elementProps, onUpdateWithDeps, onUpdateWithoutDeps)}
|
|
226
|
+
</script>
|
|
227
|
+
|
|
228
|
+
${!css.trim().length
|
|
229
|
+
? ''
|
|
230
|
+
: `<style scoped>
|
|
231
|
+
${css}
|
|
232
|
+
</style>`}
|
|
233
|
+
`;
|
|
234
|
+
str = (0, plugins_1.runPreCodePlugins)({
|
|
235
|
+
json: component,
|
|
236
|
+
code: str,
|
|
237
|
+
plugins: options.plugins,
|
|
238
|
+
options: { json: component },
|
|
239
|
+
});
|
|
240
|
+
if (true || options.prettier !== false) {
|
|
241
|
+
try {
|
|
242
|
+
str = (0, standalone_1.format)(str, {
|
|
243
|
+
parser: 'vue',
|
|
244
|
+
plugins: [
|
|
245
|
+
// To support running in browsers
|
|
246
|
+
require('prettier/parser-typescript'),
|
|
247
|
+
require('prettier/parser-html'),
|
|
248
|
+
require('prettier/parser-postcss'),
|
|
249
|
+
require('prettier/parser-babel'),
|
|
250
|
+
],
|
|
251
|
+
});
|
|
252
|
+
}
|
|
253
|
+
catch (err) {
|
|
254
|
+
console.warn('Could not prettify', { string: str }, err);
|
|
255
|
+
}
|
|
256
|
+
}
|
|
257
|
+
str = (0, plugins_1.runPostCodePlugins)({ json: component, code: str, plugins: options.plugins });
|
|
258
|
+
for (const pattern of removePatterns) {
|
|
259
|
+
str = str.replace(pattern, '').trim();
|
|
260
|
+
}
|
|
261
|
+
str = str.replace(/<script(.*)>\n?<\/script>/g, '').trim();
|
|
262
|
+
return str;
|
|
263
|
+
};
|
|
264
|
+
exports.componentToVue = componentToVue;
|
|
265
|
+
// Remove unused artifacts like empty script or style tags
|
|
266
|
+
const removePatterns = [
|
|
267
|
+
`<script>
|
|
268
|
+
export default {};
|
|
269
|
+
</script>`,
|
|
270
|
+
`<style>
|
|
271
|
+
</style>`,
|
|
272
|
+
];
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.applyMetaTagName = void 0;
|
|
7
|
+
const legacy_1 = __importDefault(require("neotraverse/legacy"));
|
|
8
|
+
const is_mitosis_node_1 = require("./is-mitosis-node");
|
|
9
|
+
const applyMetaTagName = (json) => {
|
|
10
|
+
(0, legacy_1.default)(json).forEach((item) => {
|
|
11
|
+
if ((0, is_mitosis_node_1.isMitosisNode)(item)) {
|
|
12
|
+
if (item.properties.$tagName) {
|
|
13
|
+
item.name = item.properties.$tagName;
|
|
14
|
+
delete item.properties.$tagName;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
});
|
|
18
|
+
return json;
|
|
19
|
+
};
|
|
20
|
+
exports.applyMetaTagName = applyMetaTagName;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import * as babel from '@babel/core';
|
|
2
|
+
import type { Visitor } from '@babel/traverse';
|
|
3
|
+
export declare const babelTransformCode: <VisitorContextType = any>(code: string, visitor?: babel.Visitor<VisitorContextType> | undefined, stripTypes?: boolean) => string;
|
|
4
|
+
type ExpressionType = 'expression' | 'unknown' | 'block' | 'functionBody';
|
|
5
|
+
export declare const babelTransformExpression: <VisitorContextType = any>(code: string, visitor: babel.Visitor<VisitorContextType>, initialType?: ExpressionType, stripTypes?: boolean) => string;
|
|
6
|
+
export declare const convertTypeScriptToJS: (code: string) => string;
|
|
7
|
+
export {};
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
26
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
|
+
};
|
|
28
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
+
exports.convertTypeScriptToJS = exports.babelTransformExpression = exports.babelTransformCode = void 0;
|
|
30
|
+
const babel = __importStar(require("@babel/core"));
|
|
31
|
+
const plugin_syntax_decorators_1 = __importDefault(require("@babel/plugin-syntax-decorators"));
|
|
32
|
+
const plugin_syntax_typescript_1 = __importDefault(require("@babel/plugin-syntax-typescript"));
|
|
33
|
+
const preset_typescript_1 = __importDefault(require("@babel/preset-typescript"));
|
|
34
|
+
const function_1 = require("fp-ts/lib/function");
|
|
35
|
+
const patterns_1 = require("./patterns");
|
|
36
|
+
const handleErrorOrExpression = ({ code, useCode, result, visitor, stripTypes, }) => {
|
|
37
|
+
try {
|
|
38
|
+
// If it can't, e.g. this is an expression or code fragment, modify the code below and try again
|
|
39
|
+
// Detect method fragments. These get passed sometimes and otherwise
|
|
40
|
+
// generate compile errors. They are of the form `foo() { ... }`
|
|
41
|
+
const isMethod = Boolean(!code.trim().startsWith('function') && code.trim().match(/^[a-z0-9_]+\s*\([^\)]*\)\s*[\{:]/i));
|
|
42
|
+
const isGetter = (0, patterns_1.checkIsGetter)(code);
|
|
43
|
+
const isMethodOrGetter = isMethod || isGetter;
|
|
44
|
+
if (isMethodOrGetter) {
|
|
45
|
+
useCode = `function ${useCode}`;
|
|
46
|
+
}
|
|
47
|
+
result = (0, function_1.pipe)(
|
|
48
|
+
// Parse the code as an expression (instead of the default, a block) by giving it a fake variable assignment
|
|
49
|
+
// e.g. if the code parsed is { ... } babel will treat that as a block by deafult, unless processed as an expression
|
|
50
|
+
// that is an object
|
|
51
|
+
`let _ = ${useCode}`, (code) => (0, exports.babelTransformCode)(code, visitor, stripTypes), trimSemicolons,
|
|
52
|
+
// Remove our fake variable assignment
|
|
53
|
+
(str) => str.replace(/let _ =\s/, ''));
|
|
54
|
+
if (isMethodOrGetter) {
|
|
55
|
+
return result.replace('function', '');
|
|
56
|
+
}
|
|
57
|
+
return result;
|
|
58
|
+
}
|
|
59
|
+
catch (err) {
|
|
60
|
+
console.error('Error parsing code:\n', { code, result, useCode });
|
|
61
|
+
throw err;
|
|
62
|
+
}
|
|
63
|
+
};
|
|
64
|
+
const babelTransform = ({ code, visitor, stripTypes, }) => {
|
|
65
|
+
return babel.transform(code, {
|
|
66
|
+
sourceFileName: 'file.tsx',
|
|
67
|
+
configFile: false,
|
|
68
|
+
babelrc: false,
|
|
69
|
+
parserOpts: { allowReturnOutsideFunction: true },
|
|
70
|
+
...(stripTypes ? { presets: [[preset_typescript_1.default, { isTSX: true, allExtensions: true }]] } : {}),
|
|
71
|
+
plugins: [
|
|
72
|
+
[plugin_syntax_typescript_1.default, { isTSX: true }],
|
|
73
|
+
[plugin_syntax_decorators_1.default, { legacy: true }],
|
|
74
|
+
...(visitor ? [() => ({ visitor })] : []),
|
|
75
|
+
],
|
|
76
|
+
});
|
|
77
|
+
};
|
|
78
|
+
const babelTransformCode = (code, visitor, stripTypes = false) => { var _a; return ((_a = babelTransform({ code, visitor, stripTypes })) === null || _a === void 0 ? void 0 : _a.code) || ''; };
|
|
79
|
+
exports.babelTransformCode = babelTransformCode;
|
|
80
|
+
// Babel adds trailing semicolons, but for expressions we need those gone
|
|
81
|
+
// TODO: maybe detect if the original code ended with one, and keep it if so, for the case
|
|
82
|
+
// of appending several fragements
|
|
83
|
+
const trimSemicolons = (code) => code.replace(/;$/, '');
|
|
84
|
+
const trimExpression = (type) => (code) => {
|
|
85
|
+
switch (type) {
|
|
86
|
+
case 'functionBody':
|
|
87
|
+
return code.replace(/^function\s*\(\)\s*\{/, '').replace(/\};?$/, '');
|
|
88
|
+
default:
|
|
89
|
+
return trimSemicolons(code);
|
|
90
|
+
}
|
|
91
|
+
};
|
|
92
|
+
const getType = (code, initialType) => {
|
|
93
|
+
// match for object literal like { foo: ... }
|
|
94
|
+
if (initialType === 'unknown' && code.trim().match(/^\s*{\s*[a-z0-9]+:/i)) {
|
|
95
|
+
return 'expression';
|
|
96
|
+
}
|
|
97
|
+
// For Builder content
|
|
98
|
+
if (initialType === 'unknown' &&
|
|
99
|
+
(code.includes('return _virtual_index') || code.trim().startsWith('return ')) &&
|
|
100
|
+
!code.trim().startsWith('function')) {
|
|
101
|
+
return 'functionBody';
|
|
102
|
+
}
|
|
103
|
+
return initialType;
|
|
104
|
+
};
|
|
105
|
+
const babelTransformExpression = (code, visitor, initialType = 'unknown', stripTypes = false) => {
|
|
106
|
+
if (!code) {
|
|
107
|
+
return '';
|
|
108
|
+
}
|
|
109
|
+
const isGetter = code.trim().startsWith('get ');
|
|
110
|
+
return (0, function_1.pipe)(code, isGetter ? patterns_1.replaceGetterWithFunction : function_1.identity, (code) => {
|
|
111
|
+
const type = getType(code, initialType);
|
|
112
|
+
const useCode = type === 'functionBody' ? `function(){${code}}` : code;
|
|
113
|
+
return { type, useCode };
|
|
114
|
+
}, ({ type, useCode }) => {
|
|
115
|
+
if (type !== 'expression') {
|
|
116
|
+
try {
|
|
117
|
+
return (0, function_1.pipe)((0, exports.babelTransformCode)(useCode, visitor, stripTypes), trimExpression(type));
|
|
118
|
+
}
|
|
119
|
+
catch (error) {
|
|
120
|
+
return handleErrorOrExpression({ code, useCode, result: null, visitor, stripTypes });
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
else {
|
|
124
|
+
return handleErrorOrExpression({ code, useCode, result: null, visitor, stripTypes });
|
|
125
|
+
}
|
|
126
|
+
}, isGetter ? patterns_1.replaceFunctionWithGetter : function_1.identity);
|
|
127
|
+
};
|
|
128
|
+
exports.babelTransformExpression = babelTransformExpression;
|
|
129
|
+
const convertTypeScriptToJS = (code) => (0, exports.babelTransformExpression)(code, {}, 'unknown', true);
|
|
130
|
+
exports.convertTypeScriptToJS = convertTypeScriptToJS;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { Binding } from '../types/mitosis-node';
|
|
2
|
+
type SingleBinding = Omit<Binding & {
|
|
3
|
+
type: 'single';
|
|
4
|
+
}, 'type'>;
|
|
5
|
+
export declare const createSingleBinding: (args: Omit<SingleBinding, 'bindingType'> & Partial<Pick<SingleBinding, 'bindingType'>>) => Binding;
|
|
6
|
+
export {};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createSingleBinding = void 0;
|
|
4
|
+
const createSingleBinding = (args) => ({
|
|
5
|
+
...args,
|
|
6
|
+
bindingType: args.bindingType || 'expression',
|
|
7
|
+
type: 'single',
|
|
8
|
+
});
|
|
9
|
+
exports.createSingleBinding = createSingleBinding;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.camelCase = void 0;
|
|
4
|
+
const capitalize_1 = require("./capitalize");
|
|
5
|
+
/**
|
|
6
|
+
* This is a function similar to loadash `camelCase`, but it does not mess with capitalization.
|
|
7
|
+
*
|
|
8
|
+
* loadash: `camelCase('A-BC')` => "ABc"
|
|
9
|
+
* this fn: `camelCase('A-BC')` => "ABC"
|
|
10
|
+
*
|
|
11
|
+
*/
|
|
12
|
+
function camelCase(text = '') {
|
|
13
|
+
const parts = text.split('-');
|
|
14
|
+
const first = parts.shift();
|
|
15
|
+
return first + parts.map(capitalize_1.capitalize).join('');
|
|
16
|
+
}
|
|
17
|
+
exports.camelCase = camelCase;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const capitalize: (str: string) => string;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { Target } from '../types/config';
|
|
2
|
+
import { MitosisComponent } from '../types/mitosis-component';
|
|
3
|
+
export type ProcessBindingOptions = {
|
|
4
|
+
events: string[];
|
|
5
|
+
props: string[];
|
|
6
|
+
target: Target;
|
|
7
|
+
replaceWith?: string;
|
|
8
|
+
skipAppendEmit?: boolean;
|
|
9
|
+
};
|
|
10
|
+
/**
|
|
11
|
+
* We use this for generators like stencil and angular
|
|
12
|
+
*/
|
|
13
|
+
export declare const processClassComponentBinding: (json: MitosisComponent, code: string, processBindingOptions: ProcessBindingOptions) => string;
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.processClassComponentBinding = void 0;
|
|
4
|
+
const strip_state_and_props_refs_1 = require("../helpers/strip-state-and-props-refs");
|
|
5
|
+
const event_handlers_1 = require("./event-handlers");
|
|
6
|
+
/**
|
|
7
|
+
* We need to "emit" events those can be on multiple places, so we do it as post step
|
|
8
|
+
*/
|
|
9
|
+
const appendEmits = (str, { name }, { events, props, target, skipAppendEmit }) => {
|
|
10
|
+
let code = str;
|
|
11
|
+
if (events.length) {
|
|
12
|
+
for (const event of events) {
|
|
13
|
+
const eventWithoutOn = (0, event_handlers_1.getEventNameWithoutOn)(event);
|
|
14
|
+
if (props.includes(eventWithoutOn)) {
|
|
15
|
+
console.error(`
|
|
16
|
+
Component ${name} has an event ${event} that conflicts with prop ${eventWithoutOn} for target ${target}.
|
|
17
|
+
Please rename the prop or the event.
|
|
18
|
+
`);
|
|
19
|
+
}
|
|
20
|
+
if (!skipAppendEmit) {
|
|
21
|
+
code = code.replaceAll(`props.${event}(`, `props.${eventWithoutOn}.emit(`);
|
|
22
|
+
}
|
|
23
|
+
code = code.replaceAll(`props.${event}`, `props.${eventWithoutOn}`);
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
return code;
|
|
27
|
+
};
|
|
28
|
+
/**
|
|
29
|
+
* We use this for generators like stencil and angular
|
|
30
|
+
*/
|
|
31
|
+
const processClassComponentBinding = (json, code, processBindingOptions) => {
|
|
32
|
+
const { replaceWith = 'this.' } = processBindingOptions;
|
|
33
|
+
let resolvedCode = (0, strip_state_and_props_refs_1.stripStateAndPropsRefs)(appendEmits(code, json, processBindingOptions), {
|
|
34
|
+
replaceWith,
|
|
35
|
+
});
|
|
36
|
+
if (json.exports) {
|
|
37
|
+
// We need to use local exports with `this.` in stencil and angular
|
|
38
|
+
Object.entries(json.exports)
|
|
39
|
+
.filter(([, value]) => value.usedInLocal)
|
|
40
|
+
.forEach(([key]) => {
|
|
41
|
+
resolvedCode = resolvedCode.replaceAll(key, `${replaceWith}${key}`);
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
if (json.context.get) {
|
|
45
|
+
for (const key of Object.keys(json.context.get)) {
|
|
46
|
+
resolvedCode = resolvedCode.replaceAll(key, `${replaceWith}${key}`);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
return resolvedCode;
|
|
50
|
+
};
|
|
51
|
+
exports.processClassComponentBinding = processClassComponentBinding;
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { MitosisConfig, Target } from '../types/config';
|
|
2
|
+
export declare const COMPONENT_IMPORT_EXTENSIONS: string[];
|
|
3
|
+
export declare const checkIsSvelteComponentFilePath: (filePath: string) => boolean;
|
|
4
|
+
export declare const checkIsLiteComponentFilePath: (filePath: string) => boolean;
|
|
5
|
+
export declare const checkIsMitosisComponentFilePath: (filePath: string) => boolean;
|
|
6
|
+
/**
|
|
7
|
+
* Matches `.svelte`, `.lite.tsx`, `.lite.jsx` files (with optional `.jsx`/`.tsx` extension)
|
|
8
|
+
*/
|
|
9
|
+
export declare const INPUT_EXTENSION_REGEX: RegExp;
|
|
10
|
+
export declare const renameComponentFile: ({ path, target, options, }: {
|
|
11
|
+
path: string;
|
|
12
|
+
target: Target;
|
|
13
|
+
options: MitosisConfig;
|
|
14
|
+
}) => string;
|
|
15
|
+
export declare const renameComponentImport: ({ importPath, target, explicitImportFileExtension, }: {
|
|
16
|
+
importPath: string;
|
|
17
|
+
target: Target;
|
|
18
|
+
explicitImportFileExtension: boolean;
|
|
19
|
+
}) => string;
|
|
20
|
+
export declare const renameImport: ({ importPath, target, explicitImportFileExtension, }: {
|
|
21
|
+
importPath: string;
|
|
22
|
+
target: Target;
|
|
23
|
+
explicitImportFileExtension: boolean;
|
|
24
|
+
}) => string;
|
|
25
|
+
type Args = {
|
|
26
|
+
target: Target;
|
|
27
|
+
} & ({
|
|
28
|
+
/**
|
|
29
|
+
* Whether we are rendering an import statement or a filename.
|
|
30
|
+
*/
|
|
31
|
+
type: 'import';
|
|
32
|
+
explicitImportFileExtension: boolean;
|
|
33
|
+
} | {
|
|
34
|
+
/**
|
|
35
|
+
* Whether we are rendering an import statement or a filename.
|
|
36
|
+
*/
|
|
37
|
+
type: 'filename';
|
|
38
|
+
isTypescript: boolean;
|
|
39
|
+
});
|
|
40
|
+
/**
|
|
41
|
+
* Provides the correct file extension for a given component. This is used:
|
|
42
|
+
* - in `core` to render import statements within other components.
|
|
43
|
+
* - in `cli` to render filenames for generated components, and import statements within plain `.js`/`.ts` files.
|
|
44
|
+
*/
|
|
45
|
+
export declare const getComponentFileExtensionForTarget: (args: Args) => string;
|
|
46
|
+
export declare const getFileExtensionForTarget: ({ target, explicitImportFileExtension, }: {
|
|
47
|
+
target: Target;
|
|
48
|
+
explicitImportFileExtension: boolean;
|
|
49
|
+
}) => string;
|
|
50
|
+
export {};
|