@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,575 @@
|
|
|
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.iteratorProperty = exports.lastProperty = exports.isStatement = exports.iif = exports.arrowFnValue = exports.arrowFnBlock = exports.invoke = exports.quote = exports.Imports = exports.Symbol = exports.SrcBuilder = exports.File = void 0;
|
|
7
|
+
const parser_typescript_1 = __importDefault(require("prettier/parser-typescript"));
|
|
8
|
+
const standalone_1 = require("prettier/standalone");
|
|
9
|
+
const event_handlers_1 = require("../../helpers/event-handlers");
|
|
10
|
+
const html_tags_1 = require("../../constants/html_tags");
|
|
11
|
+
const builder_1 = require("../../parsers/builder");
|
|
12
|
+
const stable_serialize_1 = require("./helpers/stable-serialize");
|
|
13
|
+
class File {
|
|
14
|
+
get module() {
|
|
15
|
+
return this.filename.substr(0, this.filename.lastIndexOf('.'));
|
|
16
|
+
}
|
|
17
|
+
get path() {
|
|
18
|
+
return this.filename;
|
|
19
|
+
}
|
|
20
|
+
get contents() {
|
|
21
|
+
return this.toString();
|
|
22
|
+
}
|
|
23
|
+
constructor(filename, options, qwikModule, qrlPrefix) {
|
|
24
|
+
this.imports = new Imports();
|
|
25
|
+
this.exports = new Map();
|
|
26
|
+
this.filename = filename;
|
|
27
|
+
this.options = options;
|
|
28
|
+
this.src = new SrcBuilder(this, this.options);
|
|
29
|
+
this.qwikModule = qwikModule;
|
|
30
|
+
this.qrlPrefix = qrlPrefix;
|
|
31
|
+
}
|
|
32
|
+
import(module, symbol, as) {
|
|
33
|
+
return this.imports.get(module, symbol, as);
|
|
34
|
+
}
|
|
35
|
+
toQrlChunk() {
|
|
36
|
+
return quote(this.qrlPrefix + this.module + '.js');
|
|
37
|
+
}
|
|
38
|
+
exportConst(name, value, locallyVisible = false) {
|
|
39
|
+
if (this.exports.has(name))
|
|
40
|
+
return;
|
|
41
|
+
this.exports.set(name, this.src.isModule ? name : 'exports.' + name);
|
|
42
|
+
this.src.const(name, value, true, locallyVisible);
|
|
43
|
+
}
|
|
44
|
+
exportDefault(symbolName) {
|
|
45
|
+
if (this.options.isPretty) {
|
|
46
|
+
this.src.emit('\n\n');
|
|
47
|
+
}
|
|
48
|
+
if (this.options.isModule) {
|
|
49
|
+
this.src.emit('export default ', symbolName, ';');
|
|
50
|
+
}
|
|
51
|
+
else {
|
|
52
|
+
this.src.emit('module.exports=', symbolName, ';');
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
toString() {
|
|
56
|
+
const srcImports = new SrcBuilder(this, this.options);
|
|
57
|
+
const imports = this.imports.imports;
|
|
58
|
+
const modules = Array.from(imports.keys()).sort();
|
|
59
|
+
modules.forEach((module) => {
|
|
60
|
+
if (module == '<SELF>')
|
|
61
|
+
return;
|
|
62
|
+
const symbolMap = imports.get(module);
|
|
63
|
+
const symbols = Array.from(symbolMap.values());
|
|
64
|
+
symbols.sort(symbolSort);
|
|
65
|
+
if (removeExt(module) !== removeExt(this.qrlPrefix + this.filename)) {
|
|
66
|
+
srcImports.import(module, symbols);
|
|
67
|
+
}
|
|
68
|
+
});
|
|
69
|
+
let source = srcImports.toString() + this.src.toString();
|
|
70
|
+
if (this.options.isPretty) {
|
|
71
|
+
try {
|
|
72
|
+
source = (0, standalone_1.format)(source, {
|
|
73
|
+
parser: 'typescript',
|
|
74
|
+
plugins: [
|
|
75
|
+
'prettier/parser-postcss',
|
|
76
|
+
parser_typescript_1.default,
|
|
77
|
+
'prettier-plugin-organize-imports',
|
|
78
|
+
],
|
|
79
|
+
htmlWhitespaceSensitivity: 'ignore',
|
|
80
|
+
});
|
|
81
|
+
}
|
|
82
|
+
catch (e) {
|
|
83
|
+
throw new Error(e +
|
|
84
|
+
'\n' +
|
|
85
|
+
'========================================================================\n' +
|
|
86
|
+
source +
|
|
87
|
+
'\n\n========================================================================');
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
return source;
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
exports.File = File;
|
|
94
|
+
function symbolSort(a, b) {
|
|
95
|
+
return a.importName < b.importName ? -1 : a.importName === b.importName ? 0 : 1;
|
|
96
|
+
}
|
|
97
|
+
function removeExt(filename) {
|
|
98
|
+
const indx = filename.lastIndexOf('.');
|
|
99
|
+
return indx == -1 ? filename : filename.substr(0, indx);
|
|
100
|
+
}
|
|
101
|
+
class SrcBuilder {
|
|
102
|
+
constructor(file, options) {
|
|
103
|
+
this.buf = [];
|
|
104
|
+
this.jsxDepth = 0;
|
|
105
|
+
/**
|
|
106
|
+
* Used to signal that we are generating code for Builder.
|
|
107
|
+
*
|
|
108
|
+
* In builder the `<For/>` iteration places the value on the state.
|
|
109
|
+
*/
|
|
110
|
+
this.isBuilder = false;
|
|
111
|
+
this.file = file;
|
|
112
|
+
this.isTypeScript = options.isTypeScript;
|
|
113
|
+
this.isModule = options.isModule;
|
|
114
|
+
this.isJSX = options.isJSX;
|
|
115
|
+
this.isBuilder = options.isBuilder;
|
|
116
|
+
}
|
|
117
|
+
import(module, symbols) {
|
|
118
|
+
if (this.isModule) {
|
|
119
|
+
this.emit('import');
|
|
120
|
+
if (symbols.length === 1 && symbols[0].importName === 'default') {
|
|
121
|
+
this.emit(' ', symbols[0].localName, ' ');
|
|
122
|
+
}
|
|
123
|
+
else {
|
|
124
|
+
this.emit('{');
|
|
125
|
+
symbols.forEach((symbol) => {
|
|
126
|
+
if (symbol.importName === symbol.localName) {
|
|
127
|
+
this.emit(symbol.importName);
|
|
128
|
+
}
|
|
129
|
+
else {
|
|
130
|
+
this.emit(symbol.importName, ' as ', symbol.localName);
|
|
131
|
+
}
|
|
132
|
+
this.emit(',');
|
|
133
|
+
});
|
|
134
|
+
this.emit('}');
|
|
135
|
+
}
|
|
136
|
+
this.emit('from', quote(module), ';');
|
|
137
|
+
}
|
|
138
|
+
else {
|
|
139
|
+
symbols.forEach((symbol) => {
|
|
140
|
+
this.const(symbol.localName, function () {
|
|
141
|
+
this.emit(invoke('require', [quote(module)]));
|
|
142
|
+
if (symbol.importName !== 'default') {
|
|
143
|
+
this.emit('.', symbol.importName);
|
|
144
|
+
}
|
|
145
|
+
});
|
|
146
|
+
});
|
|
147
|
+
}
|
|
148
|
+
if (this.file.options.isPretty) {
|
|
149
|
+
this.emit('\n\n');
|
|
150
|
+
}
|
|
151
|
+
return this;
|
|
152
|
+
}
|
|
153
|
+
emit(...values) {
|
|
154
|
+
for (let i = 0; i < values.length; i++) {
|
|
155
|
+
const value = values[i];
|
|
156
|
+
if (typeof value == 'function') {
|
|
157
|
+
value.call(this);
|
|
158
|
+
}
|
|
159
|
+
else if (value === null) {
|
|
160
|
+
this.push('null');
|
|
161
|
+
}
|
|
162
|
+
else if (value === undefined) {
|
|
163
|
+
this.push('undefined');
|
|
164
|
+
}
|
|
165
|
+
else if (typeof value == 'string') {
|
|
166
|
+
this.push(value);
|
|
167
|
+
}
|
|
168
|
+
else if (typeof value == 'number') {
|
|
169
|
+
this.push(String(value));
|
|
170
|
+
}
|
|
171
|
+
else if (typeof value == 'boolean') {
|
|
172
|
+
this.push(String(value));
|
|
173
|
+
}
|
|
174
|
+
else if (Array.isArray(value)) {
|
|
175
|
+
this.emitList(value);
|
|
176
|
+
}
|
|
177
|
+
else if (typeof value == 'object') {
|
|
178
|
+
this.emit('{');
|
|
179
|
+
let separator = false;
|
|
180
|
+
for (const key in value) {
|
|
181
|
+
if (Object.prototype.hasOwnProperty.call(value, key)) {
|
|
182
|
+
if (separator) {
|
|
183
|
+
this.emit(',');
|
|
184
|
+
}
|
|
185
|
+
this.emit(possiblyQuotePropertyName(key)).emit(':', value[key]);
|
|
186
|
+
separator = true;
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
this.emit('}');
|
|
190
|
+
}
|
|
191
|
+
else {
|
|
192
|
+
throw new Error('Unexpected value: ' + value);
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
return this;
|
|
196
|
+
}
|
|
197
|
+
push(value) {
|
|
198
|
+
if (value.startsWith(')') ||
|
|
199
|
+
value.startsWith(':') ||
|
|
200
|
+
value.startsWith(']') ||
|
|
201
|
+
value.startsWith('}') ||
|
|
202
|
+
value.startsWith(',') ||
|
|
203
|
+
value.startsWith('?')) {
|
|
204
|
+
// clear last ',' or ';';
|
|
205
|
+
let index = this.buf.length - 1;
|
|
206
|
+
let ch = this.buf[index];
|
|
207
|
+
if (ch.endsWith(',') || ch.endsWith(';')) {
|
|
208
|
+
ch = ch.substring(0, ch.length - 1);
|
|
209
|
+
this.buf[index] = ch;
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
this.buf.push(value);
|
|
213
|
+
}
|
|
214
|
+
emitList(values, sep = ',') {
|
|
215
|
+
let separator = false;
|
|
216
|
+
for (const value of values) {
|
|
217
|
+
if (separator) {
|
|
218
|
+
this.emit(sep);
|
|
219
|
+
}
|
|
220
|
+
this.emit(value);
|
|
221
|
+
separator = true;
|
|
222
|
+
}
|
|
223
|
+
return this;
|
|
224
|
+
}
|
|
225
|
+
const(name, value, export_ = false, locallyVisible = false) {
|
|
226
|
+
if (export_) {
|
|
227
|
+
this.emit(this.isModule
|
|
228
|
+
? 'export const '
|
|
229
|
+
: (locallyVisible ? 'const ' + name + '=' : '') + 'exports.');
|
|
230
|
+
}
|
|
231
|
+
else {
|
|
232
|
+
this.emit('const ');
|
|
233
|
+
}
|
|
234
|
+
this.emit(name);
|
|
235
|
+
if (value !== undefined) {
|
|
236
|
+
this.emit('=', value);
|
|
237
|
+
}
|
|
238
|
+
this.emit(';');
|
|
239
|
+
return this;
|
|
240
|
+
}
|
|
241
|
+
type(def) {
|
|
242
|
+
if (this.isTypeScript) {
|
|
243
|
+
this.emit(':', def);
|
|
244
|
+
}
|
|
245
|
+
return this;
|
|
246
|
+
}
|
|
247
|
+
typeParameters(typeParameters) {
|
|
248
|
+
if (this.isTypeScript && typeParameters && typeParameters.length) {
|
|
249
|
+
this.emit('<', typeParameters, '>');
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
jsxExpression(expression) {
|
|
253
|
+
const previousJsxDepth = this.jsxDepth;
|
|
254
|
+
try {
|
|
255
|
+
if (previousJsxDepth) {
|
|
256
|
+
this.jsxDepth = 0;
|
|
257
|
+
this.isJSX && this.emit('{');
|
|
258
|
+
}
|
|
259
|
+
expression.apply(this);
|
|
260
|
+
}
|
|
261
|
+
finally {
|
|
262
|
+
if (previousJsxDepth) {
|
|
263
|
+
this.isJSX && this.emit('}');
|
|
264
|
+
}
|
|
265
|
+
this.jsxDepth = previousJsxDepth;
|
|
266
|
+
}
|
|
267
|
+
}
|
|
268
|
+
jsxBegin(symbol, props, bindings) {
|
|
269
|
+
this.jsxDepth++;
|
|
270
|
+
const self = this;
|
|
271
|
+
if (symbol == 'div' && ('href' in props || 'href' in bindings)) {
|
|
272
|
+
// HACK: if we contain href then we are `a` not `div`
|
|
273
|
+
symbol = 'a';
|
|
274
|
+
}
|
|
275
|
+
if (this.isJSX) {
|
|
276
|
+
this.emit('<' + symbol);
|
|
277
|
+
}
|
|
278
|
+
else {
|
|
279
|
+
this.emit('h(', literalTagName(symbol), ',{');
|
|
280
|
+
}
|
|
281
|
+
for (const key in props) {
|
|
282
|
+
if (Object.prototype.hasOwnProperty.call(props, key) &&
|
|
283
|
+
!ignoreKey(key) &&
|
|
284
|
+
!Object.prototype.hasOwnProperty.call(bindings, key)) {
|
|
285
|
+
emitJsxProp(key, quote(props[key]));
|
|
286
|
+
}
|
|
287
|
+
}
|
|
288
|
+
for (const rawKey in bindings) {
|
|
289
|
+
if (bindings[rawKey].type === 'spread') {
|
|
290
|
+
if (this.isJSX) {
|
|
291
|
+
this.emit('{...', bindings[rawKey].code, '}');
|
|
292
|
+
}
|
|
293
|
+
else {
|
|
294
|
+
this.emit('...', bindings[rawKey].code);
|
|
295
|
+
}
|
|
296
|
+
}
|
|
297
|
+
else if (Object.prototype.hasOwnProperty.call(bindings, rawKey) && !ignoreKey(rawKey)) {
|
|
298
|
+
let binding = bindings[rawKey];
|
|
299
|
+
binding =
|
|
300
|
+
binding && typeof binding == 'object' && 'code' in binding ? binding.code : binding;
|
|
301
|
+
if (rawKey === 'class' && props.class) {
|
|
302
|
+
// special case for classes as they can have both static and dynamic binding
|
|
303
|
+
binding = quote(props.class + ' ') + '+' + binding;
|
|
304
|
+
}
|
|
305
|
+
let key = lastProperty(rawKey);
|
|
306
|
+
if (isEvent(key)) {
|
|
307
|
+
key = key + '$';
|
|
308
|
+
binding = `${this.file.import(this.file.qwikModule, '$').localName}((event)=>${binding})`;
|
|
309
|
+
}
|
|
310
|
+
else if (!binding && rawKey in props) {
|
|
311
|
+
binding = quote(props[rawKey]);
|
|
312
|
+
}
|
|
313
|
+
else if (binding != null && binding === props[key]) {
|
|
314
|
+
// HACK: workaround for the fact that sometimes the `bindings` have string literals
|
|
315
|
+
// We assume that when the binding content equals prop content.
|
|
316
|
+
binding = quote(binding);
|
|
317
|
+
}
|
|
318
|
+
else if (typeof binding == 'string' && isStatement(binding)) {
|
|
319
|
+
binding = iif(binding);
|
|
320
|
+
}
|
|
321
|
+
if (key === 'hide' || key === 'show') {
|
|
322
|
+
let [truthy, falsy] = key == 'hide' ? ['"none"', '"inherit"'] : ['"inherit"', '"none"'];
|
|
323
|
+
emitJsxProp('style', function () {
|
|
324
|
+
this.emit('{display:', binding, '?', truthy, ':', falsy, '}');
|
|
325
|
+
});
|
|
326
|
+
}
|
|
327
|
+
else {
|
|
328
|
+
emitJsxProp(key, binding);
|
|
329
|
+
}
|
|
330
|
+
}
|
|
331
|
+
}
|
|
332
|
+
if (this.isJSX) {
|
|
333
|
+
if (!this.isSelfClosingTag(symbol)) {
|
|
334
|
+
this.emit('>');
|
|
335
|
+
}
|
|
336
|
+
}
|
|
337
|
+
else {
|
|
338
|
+
this.emit('},');
|
|
339
|
+
}
|
|
340
|
+
function emitJsxProp(key, value) {
|
|
341
|
+
if (value) {
|
|
342
|
+
if (key === 'innerHTML')
|
|
343
|
+
key = 'dangerouslySetInnerHTML';
|
|
344
|
+
if (key === 'dataSet')
|
|
345
|
+
return; // ignore
|
|
346
|
+
if (self.isJSX) {
|
|
347
|
+
if (key.includes(':') && value === '""') {
|
|
348
|
+
self.emit(' ', key);
|
|
349
|
+
return;
|
|
350
|
+
}
|
|
351
|
+
self.emit(' ', key, '=');
|
|
352
|
+
if (typeof value == 'string' && value.startsWith('"') && value.endsWith('"')) {
|
|
353
|
+
self.emit(value);
|
|
354
|
+
}
|
|
355
|
+
else {
|
|
356
|
+
self.emit('{', value, '}');
|
|
357
|
+
}
|
|
358
|
+
}
|
|
359
|
+
else {
|
|
360
|
+
self.emit(possiblyQuotePropertyName(key), ':', value, ',');
|
|
361
|
+
}
|
|
362
|
+
}
|
|
363
|
+
}
|
|
364
|
+
}
|
|
365
|
+
isSelfClosingTag(symbol) {
|
|
366
|
+
return html_tags_1.SELF_CLOSING_HTML_TAGS.has(String(symbol));
|
|
367
|
+
}
|
|
368
|
+
jsxEnd(symbol) {
|
|
369
|
+
if (this.isJSX) {
|
|
370
|
+
if (this.isSelfClosingTag(symbol)) {
|
|
371
|
+
this.emit(' />');
|
|
372
|
+
}
|
|
373
|
+
else {
|
|
374
|
+
this.emit('</', symbol, '>');
|
|
375
|
+
}
|
|
376
|
+
}
|
|
377
|
+
else {
|
|
378
|
+
this.emit('),');
|
|
379
|
+
}
|
|
380
|
+
this.jsxDepth--;
|
|
381
|
+
}
|
|
382
|
+
jsxBeginFragment(symbol) {
|
|
383
|
+
this.jsxDepth++;
|
|
384
|
+
if (this.isJSX) {
|
|
385
|
+
this.emit('<>');
|
|
386
|
+
}
|
|
387
|
+
else {
|
|
388
|
+
this.emit('h(', symbol.localName, ',null,');
|
|
389
|
+
}
|
|
390
|
+
}
|
|
391
|
+
jsxEndFragment() {
|
|
392
|
+
this.jsxDepth--;
|
|
393
|
+
if (this.isJSX) {
|
|
394
|
+
this.emit('</>');
|
|
395
|
+
}
|
|
396
|
+
else {
|
|
397
|
+
this.emit(')');
|
|
398
|
+
}
|
|
399
|
+
}
|
|
400
|
+
jsxTextBinding(exp) {
|
|
401
|
+
if (this.isJSX) {
|
|
402
|
+
this.emit('{', exp, '}');
|
|
403
|
+
}
|
|
404
|
+
else {
|
|
405
|
+
this.emit(exp);
|
|
406
|
+
}
|
|
407
|
+
}
|
|
408
|
+
toString() {
|
|
409
|
+
return this.buf.join('');
|
|
410
|
+
}
|
|
411
|
+
}
|
|
412
|
+
exports.SrcBuilder = SrcBuilder;
|
|
413
|
+
function isEvent(name) {
|
|
414
|
+
return (0, event_handlers_1.checkIsEvent)(name) && isUppercase(name.charAt(2)) && !name.endsWith('$');
|
|
415
|
+
}
|
|
416
|
+
function isUppercase(ch) {
|
|
417
|
+
return ch == ch.toUpperCase();
|
|
418
|
+
}
|
|
419
|
+
class Symbol {
|
|
420
|
+
constructor(importName, localName) {
|
|
421
|
+
this.importName = importName;
|
|
422
|
+
this.localName = localName;
|
|
423
|
+
}
|
|
424
|
+
}
|
|
425
|
+
exports.Symbol = Symbol;
|
|
426
|
+
class Imports {
|
|
427
|
+
constructor() {
|
|
428
|
+
this.imports = new Map();
|
|
429
|
+
}
|
|
430
|
+
get(moduleName, symbolName, asVar) {
|
|
431
|
+
let importSymbols = this.imports.get(moduleName);
|
|
432
|
+
if (!importSymbols) {
|
|
433
|
+
importSymbols = new Map();
|
|
434
|
+
this.imports.set(moduleName, importSymbols);
|
|
435
|
+
}
|
|
436
|
+
let symbol = importSymbols.get(symbolName);
|
|
437
|
+
if (!symbol) {
|
|
438
|
+
symbol = new Symbol(symbolName, asVar || symbolName);
|
|
439
|
+
importSymbols.set(symbolName, symbol);
|
|
440
|
+
}
|
|
441
|
+
return symbol;
|
|
442
|
+
}
|
|
443
|
+
hasImport(localName) {
|
|
444
|
+
for (const symbolMap of Array.from(this.imports.values())) {
|
|
445
|
+
for (const symbol of Array.from(symbolMap.values())) {
|
|
446
|
+
if (symbol.localName === localName) {
|
|
447
|
+
return true;
|
|
448
|
+
}
|
|
449
|
+
}
|
|
450
|
+
}
|
|
451
|
+
return false;
|
|
452
|
+
}
|
|
453
|
+
}
|
|
454
|
+
exports.Imports = Imports;
|
|
455
|
+
function ignoreKey(key) {
|
|
456
|
+
return (key.startsWith('$') ||
|
|
457
|
+
key.startsWith('_') ||
|
|
458
|
+
key == 'code' ||
|
|
459
|
+
key == '' ||
|
|
460
|
+
key.indexOf('.') !== -1);
|
|
461
|
+
}
|
|
462
|
+
function possiblyQuotePropertyName(key) {
|
|
463
|
+
return /^\w[\w\d]*$/.test(key) ? key : quote(key);
|
|
464
|
+
}
|
|
465
|
+
function quote(text) {
|
|
466
|
+
const string = (0, stable_serialize_1.stableJSONserialize)(text);
|
|
467
|
+
// So \u2028 is a line separator character and prettier treats it as such
|
|
468
|
+
// https://www.fileformat.info/info/unicode/char/2028/index.htm
|
|
469
|
+
// That means it can't be inside of a string, so we replace it with `\\u2028`.
|
|
470
|
+
// (see double `\\` vs `\`)
|
|
471
|
+
const parts = string.split('\u2028');
|
|
472
|
+
return parts.join('\\u2028');
|
|
473
|
+
}
|
|
474
|
+
exports.quote = quote;
|
|
475
|
+
function invoke(symbol, args, typeParameters) {
|
|
476
|
+
return function () {
|
|
477
|
+
this.emit(typeof symbol == 'string' ? symbol : symbol.localName);
|
|
478
|
+
this.typeParameters(typeParameters);
|
|
479
|
+
this.emit('(', args, ')');
|
|
480
|
+
};
|
|
481
|
+
}
|
|
482
|
+
exports.invoke = invoke;
|
|
483
|
+
function arrowFnBlock(args, statements, argTypes) {
|
|
484
|
+
return function () {
|
|
485
|
+
this.emit('(');
|
|
486
|
+
for (let i = 0; i < args.length; i++) {
|
|
487
|
+
const arg = args[i];
|
|
488
|
+
const type = argTypes && argTypes[i];
|
|
489
|
+
this.emit(arg);
|
|
490
|
+
if (type && this.file.options.isTypeScript) {
|
|
491
|
+
this.emit(':', type);
|
|
492
|
+
}
|
|
493
|
+
this.emit(',');
|
|
494
|
+
}
|
|
495
|
+
this.emit(')=>{').emitList(statements, ';').emit('}');
|
|
496
|
+
};
|
|
497
|
+
}
|
|
498
|
+
exports.arrowFnBlock = arrowFnBlock;
|
|
499
|
+
function arrowFnValue(args, expression) {
|
|
500
|
+
return function () {
|
|
501
|
+
this.emit('(', args, ')=>', expression);
|
|
502
|
+
};
|
|
503
|
+
}
|
|
504
|
+
exports.arrowFnValue = arrowFnValue;
|
|
505
|
+
const _virtual_index = '_virtual_index;';
|
|
506
|
+
const return_virtual_index = 'return _virtual_index;';
|
|
507
|
+
function iif(code) {
|
|
508
|
+
if (!code)
|
|
509
|
+
return;
|
|
510
|
+
code = code.trim();
|
|
511
|
+
if (code.endsWith(_virtual_index) && !code.endsWith(return_virtual_index)) {
|
|
512
|
+
code = code.substr(0, code.length - _virtual_index.length) + return_virtual_index;
|
|
513
|
+
}
|
|
514
|
+
if (code.indexOf('export') !== -1) {
|
|
515
|
+
code = (0, builder_1.convertExportDefaultToReturn)(code);
|
|
516
|
+
}
|
|
517
|
+
return function () {
|
|
518
|
+
code && this.emit('(()=>{', code, '})()');
|
|
519
|
+
};
|
|
520
|
+
}
|
|
521
|
+
exports.iif = iif;
|
|
522
|
+
const LOWER_CASE = 'a'.charCodeAt(0) - 1;
|
|
523
|
+
function literalTagName(symbol) {
|
|
524
|
+
if (typeof symbol == 'string' &&
|
|
525
|
+
symbol.charCodeAt(0) > LOWER_CASE &&
|
|
526
|
+
symbol.indexOf('.') === -1) {
|
|
527
|
+
return quote(symbol);
|
|
528
|
+
}
|
|
529
|
+
return symbol;
|
|
530
|
+
}
|
|
531
|
+
/**
|
|
532
|
+
* Returns `true` if the code is a statement (rather than expression).
|
|
533
|
+
*
|
|
534
|
+
* Code is an expression if it is a list of identifiers all connected with a valid separator
|
|
535
|
+
* identifier: [a-z_$](a-z0-9_$)*
|
|
536
|
+
* separator: [()[]{}.-+/*,]
|
|
537
|
+
*
|
|
538
|
+
* it is not 100% but a good enough approximation
|
|
539
|
+
*/
|
|
540
|
+
function isStatement(code) {
|
|
541
|
+
// remove trailing `!` as it is used to mark a non-null assertion in TS
|
|
542
|
+
// it messes up the logic afterwards
|
|
543
|
+
if (code.endsWith('!')) {
|
|
544
|
+
code = code.substr(0, code.length - 1);
|
|
545
|
+
}
|
|
546
|
+
code = code.trim();
|
|
547
|
+
if ((code.startsWith('(') && code.endsWith(')')) ||
|
|
548
|
+
(code.startsWith('{') && code.endsWith('}'))) {
|
|
549
|
+
// Code starting with `(` is most likely an IFF and hence is an expression.
|
|
550
|
+
return false;
|
|
551
|
+
}
|
|
552
|
+
const codeNoStrings = code.replace(STRING_LITERAL, 'STRING_LITERAL');
|
|
553
|
+
const identifiers = codeNoStrings.split(EXPRESSION_SEPARATORS);
|
|
554
|
+
const filteredIdentifiers = identifiers.filter((i) => {
|
|
555
|
+
i = i.trim();
|
|
556
|
+
return i && !i.match(EXPRESSION_IDENTIFIER);
|
|
557
|
+
});
|
|
558
|
+
return filteredIdentifiers.length !== 0;
|
|
559
|
+
}
|
|
560
|
+
exports.isStatement = isStatement;
|
|
561
|
+
// https://regexr.com/6cppf
|
|
562
|
+
const STRING_LITERAL = /(["'`])((\\{2})*|((\n|.)*?[^\\](\\{2})*))\1/g;
|
|
563
|
+
// https://regexr.com/6cpk4
|
|
564
|
+
const EXPRESSION_SEPARATORS = /[()\[\]{}.\?:\-+/*,|&]+/;
|
|
565
|
+
// https://regexr.com/6cpka
|
|
566
|
+
const EXPRESSION_IDENTIFIER = /^\s*[a-zA-Z0-9_$]+\s*$/;
|
|
567
|
+
function lastProperty(expr) {
|
|
568
|
+
const parts = expr.split('.');
|
|
569
|
+
return parts[parts.length - 1];
|
|
570
|
+
}
|
|
571
|
+
exports.lastProperty = lastProperty;
|
|
572
|
+
function iteratorProperty(expr) {
|
|
573
|
+
return lastProperty(expr) + 'Item';
|
|
574
|
+
}
|
|
575
|
+
exports.iteratorProperty = iteratorProperty;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { Dictionary } from '../../helpers/typescript';
|
|
2
|
+
import { BaseTranspilerOptions } from '../../types/transpiler';
|
|
3
|
+
export interface ToQwikOptions extends BaseTranspilerOptions {
|
|
4
|
+
}
|
|
5
|
+
export type QwikMetadata = {
|
|
6
|
+
component?: {
|
|
7
|
+
isLight?: boolean;
|
|
8
|
+
};
|
|
9
|
+
setUseStoreFirst?: boolean;
|
|
10
|
+
hasDeepStore?: boolean;
|
|
11
|
+
mutable?: string[];
|
|
12
|
+
imports?: Dictionary<string>;
|
|
13
|
+
replace?: Record<string, string>;
|
|
14
|
+
};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { MitosisComponent } from '../../types/mitosis-component';
|
|
2
|
+
import { MitosisNode } from '../../types/mitosis-node';
|
|
3
|
+
import { ToReactOptions } from './types';
|
|
4
|
+
export declare const blockToReact: (json: MitosisNode, options: ToReactOptions, component: MitosisComponent, insideJsx: boolean, parentSlots?: any[]) => string;
|