└── dist └── src ├── constants ├── method-literal-prefix.d.ts ├── method-literal-prefix.js ├── html_tags.d.ts ├── hooks.js ├── hooks.d.ts ├── media-sizes.d.ts └── media-sizes.js ├── generators ├── lit │ ├── index.d.ts │ ├── collect-class-string.d.ts │ ├── generate.d.ts │ └── index.js ├── marko │ ├── index.d.ts │ ├── index.js │ └── generate.d.ts ├── alpine │ ├── index.d.ts │ ├── render-mount-hook.d.ts │ ├── render-update-hooks.d.ts │ ├── render-mount-hook.js │ ├── index.js │ └── generate.d.ts ├── stencil │ ├── index.d.ts │ ├── collect-class-string.d.ts │ ├── generate.d.ts │ └── index.js ├── solid │ ├── state │ │ ├── index.d.ts │ │ ├── index.js │ │ ├── signals.d.ts │ │ ├── store.d.ts │ │ ├── state.d.ts │ │ └── helpers.d.ts │ ├── types.js │ ├── index.d.ts │ ├── helpers │ │ └── styles.d.ts │ ├── types.d.ts │ └── blocks.d.ts ├── svelte │ ├── index.d.ts │ ├── types.js │ ├── types.d.ts │ ├── svelte.d.ts │ ├── helpers.d.ts │ ├── index.js │ ├── blocks.d.ts │ └── helpers.js ├── vue │ ├── index.d.ts │ ├── types.js │ ├── vue.d.ts │ ├── blocks.d.ts │ ├── compositionApi.d.ts │ ├── optionsApi.d.ts │ ├── types.d.ts │ ├── index.js │ └── helpers.d.ts ├── react │ ├── types.js │ ├── index.d.ts │ ├── blocks.d.ts │ ├── generator.d.ts │ ├── state.d.ts │ ├── helpers.d.ts │ ├── types.d.ts │ └── index.js ├── minify.d.ts ├── helpers │ ├── functions.d.ts │ ├── rsc.d.ts │ ├── on-mount.d.ts │ ├── context.d.ts │ ├── on-mount.js │ ├── context.js │ ├── functions.js │ └── rsc.js ├── angular │ ├── helpers.d.ts │ ├── types.js │ ├── index.d.ts │ ├── types.d.ts │ └── helpers.js ├── react-native │ ├── sanitize-react-native-block-styles.d.ts │ └── index.d.ts ├── qwik │ ├── helpers │ │ ├── convert-method-to-function.d.ts │ │ ├── handlers.d.ts │ │ ├── stable-serialize.d.ts │ │ ├── stable-inject.d.ts │ │ ├── add-prevent-default.d.ts │ │ ├── styles.d.ts │ │ ├── state.d.ts │ │ ├── add-prevent-default.js │ │ ├── stable-serialize.js │ │ └── stable-inject.js │ ├── index.d.ts │ ├── component-generator.d.ts │ ├── directives.d.ts │ ├── component.d.ts │ ├── index.js │ └── jsx.d.ts ├── context │ ├── vue.d.ts │ ├── vue.js │ ├── qwik.d.ts │ ├── solid.d.ts │ ├── helpers │ │ ├── context-with-symbol-key.d.ts │ │ └── context-with-symbol-key.js │ ├── angular.d.ts │ ├── react.d.ts │ ├── rsc.d.ts │ ├── svelte.d.ts │ ├── qwik.js │ ├── solid.js │ ├── rsc.js │ ├── react.js │ ├── angular.js │ └── svelte.js ├── swift-ui.d.ts ├── rsc.d.ts ├── template.d.ts ├── html.d.ts ├── liquid.d.ts ├── taro.d.ts ├── mitosis.d.ts ├── builder.d.ts └── minify.js ├── helpers ├── signals │ ├── index.d.ts │ ├── index.js │ └── signals.d.ts ├── capitalize.d.ts ├── dash-case.d.ts ├── fast-clone.d.ts ├── indent.d.ts ├── is-upper-case.d.ts ├── html-escape.d.ts ├── event-handlers.d.ts ├── is-valid-attribute-name.d.ts ├── dedent.d.ts ├── replace-new-lines-in-strings.d.ts ├── try-prettier-format.d.ts ├── plugins │ ├── process-code │ │ ├── types.js │ │ ├── types.d.ts │ │ └── index.d.ts │ ├── process-target-blocks.d.ts │ └── process-signals.d.ts ├── json.d.ts ├── handle-missing-state.d.ts ├── process-http-requests.d.ts ├── bindings.d.ts ├── get-bindings.d.ts ├── get-refs.d.ts ├── has-props.d.ts ├── is-mitosis-node.d.ts ├── nullable.d.ts ├── state.d.ts ├── get-components.d.ts ├── has-stateful-dom.d.ts ├── has-bindings-text.d.ts ├── create-mitosis-node.d.ts ├── get-components-used.d.ts ├── has-component.d.ts ├── parse-node.d.ts ├── strip-meta-properties.d.ts ├── get-props-ref.d.ts ├── styles │ ├── collect-styled-components.d.ts │ ├── collect-css.d.ts │ └── helpers.d.ts ├── is-html-attribute.d.ts ├── trace-reference-to-module-path.d.ts ├── output.d.ts ├── nodes │ ├── for.d.ts │ └── for.js ├── create-mitosis-context.d.ts ├── get-props.d.ts ├── is-component.d.ts ├── map-refs.d.ts ├── get-state-used.d.ts ├── filter-empty-text-nodes.d.ts ├── get-prop-functions.d.ts ├── fast-clone.js ├── remove-surrounding-block.d.ts ├── is-upper-case.js ├── generic-format.d.ts ├── typescript.js ├── getters-to-functions.d.ts ├── dash-case.js ├── is-children.d.ts ├── nullable.js ├── state.js ├── camel-case.d.ts ├── is-root-text-node.d.ts ├── mitosis-imports.d.ts ├── event-handlers.js ├── get-styles.d.ts ├── html-escape.js ├── is-mitosis-node.js ├── indent.js ├── capitalize.js ├── is-valid-attribute-name.js ├── slots.d.ts ├── traverse-nodes.d.ts ├── is-component.js ├── create-mitosis-component.d.ts ├── has.d.ts ├── typescript-project.d.ts ├── typescript.d.ts ├── parsers.d.ts ├── filter-empty-text-nodes.js ├── is-root-text-node.js ├── patterns.d.ts ├── get-custom-imports.d.ts ├── transform-state-setters.d.ts ├── output.js ├── handle-missing-state.js ├── get-bindings.js ├── json.js ├── trace-reference-to-module-path.js ├── babel-transform.d.ts ├── parse-node.js ├── camel-case.js ├── on-event.d.ts ├── traverse-nodes.js ├── is-children.js ├── bindings.js ├── has-props.js ├── get-components-used.js ├── create-mitosis-context.js ├── create-mitosis-node.js ├── has-component.js ├── has-stateful-dom.js ├── remove-surrounding-block.js ├── get-refs.js ├── merge-options.d.ts ├── get-components.js ├── try-prettier-format.js ├── has.js ├── get-state-object-string.d.ts ├── has-bindings-text.js ├── replace-new-lines-in-strings.js ├── strip-meta-properties.js ├── replace-identifiers.d.ts ├── process-http-requests.js ├── get-prop-functions.js ├── get-styles.js ├── get-state-used.js ├── patterns.js ├── generic-format.js ├── get-props-ref.js ├── slots.js ├── transform-state-setters.js └── strip-state-and-props-refs.d.ts ├── parsers ├── builder │ ├── index.d.ts │ ├── helpers.d.ts │ ├── index.js │ ├── helpers.js │ └── builder.d.ts ├── jsx │ ├── types.js │ ├── index.d.ts │ ├── props.d.ts │ ├── props-types.d.ts │ ├── ast.d.ts │ ├── index.js │ ├── context.d.ts │ ├── exports.d.ts │ ├── signals.d.ts │ ├── hooks │ │ ├── helpers.d.ts │ │ ├── use-target.d.ts │ │ └── index.d.ts │ ├── imports.d.ts │ ├── function-parser.d.ts │ ├── element-parser.d.ts │ ├── types.d.ts │ ├── jsx.d.ts │ ├── helpers.d.ts │ ├── state.d.ts │ ├── component-types.d.ts │ └── props-types.js ├── svelte │ ├── types │ │ ├── index.js │ │ └── index.d.ts │ ├── helpers │ │ ├── mitosis-node.d.ts │ │ ├── hooks.d.ts │ │ ├── expressions.d.ts │ │ ├── bindings.d.ts │ │ ├── string.d.ts │ │ ├── children.d.ts │ │ ├── mitosis-node.js │ │ ├── hooks.js │ │ ├── post-process.d.ts │ │ ├── expressions.js │ │ ├── string.js │ │ └── children.js │ ├── index.d.ts │ ├── css │ │ ├── index.d.ts │ │ └── index.js │ ├── module │ │ └── index.d.ts │ ├── instance │ │ ├── imports.d.ts │ │ ├── index.d.ts │ │ ├── reactive.d.ts │ │ ├── statements.d.ts │ │ ├── functions.d.ts │ │ ├── properties.d.ts │ │ ├── expressions.d.ts │ │ ├── references.d.ts │ │ ├── hooks.d.ts │ │ ├── context.d.ts │ │ ├── statements.js │ │ ├── expressions.js │ │ ├── hooks.js │ │ ├── properties.js │ │ └── reactive.js │ ├── html │ │ ├── slot.d.ts │ │ ├── element.d.ts │ │ ├── fragment.d.ts │ │ ├── if-else.d.ts │ │ ├── actions.d.ts │ │ ├── mustache-tag.d.ts │ │ ├── each.d.ts │ │ ├── index.d.ts │ │ ├── fragment.js │ │ ├── text.js │ │ ├── slot.js │ │ ├── mustache-tag.js │ │ ├── each.js │ │ ├── text.d.ts │ │ └── if-else.js │ └── typescript │ │ └── index.d.ts ├── context.d.ts └── angular.d.ts ├── types ├── json.js ├── config.js ├── metadata.js ├── plugins.js ├── transpiler.js ├── mitosis-context.js ├── mitosis-styles.js ├── mitosis-component.js ├── mitosis-styles.d.ts ├── mitosis-context.d.ts ├── mitosis-node.js ├── plugins.d.ts ├── json.d.ts ├── metadata.d.ts └── transpiler.d.ts ├── plugins ├── map-styles.d.ts ├── map-styles.js ├── compile-away-builder-components.d.ts └── compile-away-components.d.ts ├── flow.js ├── flow.d.ts ├── modules └── plugins.d.ts └── symbols └── symbol-processor.d.ts /dist/src/constants/method-literal-prefix.d.ts: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /dist/src/constants/method-literal-prefix.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | -------------------------------------------------------------------------------- /dist/src/generators/lit/index.d.ts: -------------------------------------------------------------------------------- 1 | export * from './generate'; 2 | -------------------------------------------------------------------------------- /dist/src/generators/marko/index.d.ts: -------------------------------------------------------------------------------- 1 | export * from './generate'; 2 | -------------------------------------------------------------------------------- /dist/src/helpers/signals/index.d.ts: -------------------------------------------------------------------------------- 1 | export * from './signals'; 2 | -------------------------------------------------------------------------------- /dist/src/parsers/builder/index.d.ts: -------------------------------------------------------------------------------- 1 | export * from './builder'; 2 | -------------------------------------------------------------------------------- /dist/src/generators/alpine/index.d.ts: -------------------------------------------------------------------------------- 1 | export * from './generate'; 2 | -------------------------------------------------------------------------------- /dist/src/generators/stencil/index.d.ts: -------------------------------------------------------------------------------- 1 | export * from './generate'; 2 | -------------------------------------------------------------------------------- /dist/src/generators/solid/state/index.d.ts: -------------------------------------------------------------------------------- 1 | export { getState } from './state'; 2 | -------------------------------------------------------------------------------- /dist/src/generators/svelte/index.d.ts: -------------------------------------------------------------------------------- 1 | export { componentToSvelte } from './svelte'; 2 | -------------------------------------------------------------------------------- /dist/src/generators/vue/index.d.ts: -------------------------------------------------------------------------------- 1 | export * from './types'; 2 | export * from './vue'; 3 | -------------------------------------------------------------------------------- /dist/src/helpers/capitalize.d.ts: -------------------------------------------------------------------------------- 1 | export declare const capitalize: (str: string) => string; 2 | -------------------------------------------------------------------------------- /dist/src/helpers/dash-case.d.ts: -------------------------------------------------------------------------------- 1 | export declare const dashCase: (string: string) => string; 2 | -------------------------------------------------------------------------------- /dist/src/helpers/fast-clone.d.ts: -------------------------------------------------------------------------------- 1 | export declare const fastClone: (obj: T) => T; 2 | -------------------------------------------------------------------------------- /dist/src/helpers/indent.d.ts: -------------------------------------------------------------------------------- 1 | export declare function indent(str: string, spaces?: number): string; 2 | -------------------------------------------------------------------------------- /dist/src/helpers/is-upper-case.d.ts: -------------------------------------------------------------------------------- 1 | export declare const isUpperCase: (str: string) => boolean; 2 | -------------------------------------------------------------------------------- /dist/src/helpers/html-escape.d.ts: -------------------------------------------------------------------------------- 1 | export declare function htmlAttributeEscape(value: string): string; 2 | -------------------------------------------------------------------------------- /dist/src/types/json.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | -------------------------------------------------------------------------------- /dist/src/types/config.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | -------------------------------------------------------------------------------- /dist/src/types/metadata.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | -------------------------------------------------------------------------------- /dist/src/types/plugins.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | -------------------------------------------------------------------------------- /dist/src/types/transpiler.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | -------------------------------------------------------------------------------- /dist/src/generators/vue/types.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | -------------------------------------------------------------------------------- /dist/src/helpers/event-handlers.d.ts: -------------------------------------------------------------------------------- 1 | export declare const checkIsBindingEventHandler: (code: string) => boolean; 2 | -------------------------------------------------------------------------------- /dist/src/helpers/is-valid-attribute-name.d.ts: -------------------------------------------------------------------------------- 1 | export declare const isValidAttributeName: (str: string) => boolean; 2 | -------------------------------------------------------------------------------- /dist/src/parsers/jsx/types.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | -------------------------------------------------------------------------------- /dist/src/types/mitosis-context.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | -------------------------------------------------------------------------------- /dist/src/types/mitosis-styles.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | -------------------------------------------------------------------------------- /dist/src/generators/react/types.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | -------------------------------------------------------------------------------- /dist/src/generators/solid/types.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | -------------------------------------------------------------------------------- /dist/src/generators/svelte/types.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | -------------------------------------------------------------------------------- /dist/src/helpers/dedent.d.ts: -------------------------------------------------------------------------------- 1 | export declare function dedent(strings: TemplateStringsArray, ...values: any[]): string; 2 | -------------------------------------------------------------------------------- /dist/src/parsers/jsx/index.d.ts: -------------------------------------------------------------------------------- 1 | export { parseJsx } from './jsx'; 2 | export { ParseMitosisOptions } from './types'; 3 | -------------------------------------------------------------------------------- /dist/src/parsers/svelte/types/index.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | -------------------------------------------------------------------------------- /dist/src/types/mitosis-component.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | -------------------------------------------------------------------------------- /dist/src/helpers/replace-new-lines-in-strings.d.ts: -------------------------------------------------------------------------------- 1 | export declare function stripNewlinesInStrings(string: string): string; 2 | -------------------------------------------------------------------------------- /dist/src/helpers/try-prettier-format.d.ts: -------------------------------------------------------------------------------- 1 | export declare const tryPrettierFormat: (str: string, parser: string) => string; 2 | -------------------------------------------------------------------------------- /dist/src/helpers/plugins/process-code/types.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | -------------------------------------------------------------------------------- /dist/src/generators/minify.d.ts: -------------------------------------------------------------------------------- 1 | export declare function minify(messageParts: TemplateStringsArray, ...expressions: readonly any[]): string; 2 | -------------------------------------------------------------------------------- /dist/src/generators/react/index.d.ts: -------------------------------------------------------------------------------- 1 | export { blockToReact } from './blocks'; 2 | export * from './generator'; 3 | export * from './types'; 4 | -------------------------------------------------------------------------------- /dist/src/helpers/json.d.ts: -------------------------------------------------------------------------------- 1 | type ParsedJson = any; 2 | export declare const tryParseJson: (jsonStr: string) => ParsedJson; 3 | export {}; 4 | -------------------------------------------------------------------------------- /dist/src/constants/html_tags.d.ts: -------------------------------------------------------------------------------- 1 | export declare const VALID_HTML_TAGS: string[]; 2 | export declare const SELF_CLOSING_HTML_TAGS: Set; 3 | -------------------------------------------------------------------------------- /dist/src/generators/helpers/functions.d.ts: -------------------------------------------------------------------------------- 1 | import { Plugin } from '../../modules/plugins'; 2 | export declare const FUNCTION_HACK_PLUGIN: Plugin; 3 | -------------------------------------------------------------------------------- /dist/src/helpers/handle-missing-state.d.ts: -------------------------------------------------------------------------------- 1 | import { MitosisComponent } from '..'; 2 | export declare function handleMissingState(json: MitosisComponent): void; 3 | -------------------------------------------------------------------------------- /dist/src/helpers/process-http-requests.d.ts: -------------------------------------------------------------------------------- 1 | import { MitosisComponent } from '..'; 2 | export declare function processHttpRequests(json: MitosisComponent): void; 3 | -------------------------------------------------------------------------------- /dist/src/helpers/bindings.d.ts: -------------------------------------------------------------------------------- 1 | import { Binding } from '../types/mitosis-node'; 2 | export declare const createSingleBinding: (args: Omit) => Binding; 3 | -------------------------------------------------------------------------------- /dist/src/helpers/get-bindings.d.ts: -------------------------------------------------------------------------------- 1 | import { MitosisNode } from '../types/mitosis-node'; 2 | export declare function getBindingsCode(children: MitosisNode[]): string[]; 3 | -------------------------------------------------------------------------------- /dist/src/helpers/get-refs.d.ts: -------------------------------------------------------------------------------- 1 | import { MitosisComponent } from '../types/mitosis-component'; 2 | export declare const getRefs: (json: MitosisComponent) => Set; 3 | -------------------------------------------------------------------------------- /dist/src/helpers/has-props.d.ts: -------------------------------------------------------------------------------- 1 | import { MitosisComponent } from '../types/mitosis-component'; 2 | export declare const hasProps: (json: MitosisComponent) => boolean; 3 | -------------------------------------------------------------------------------- /dist/src/helpers/is-mitosis-node.d.ts: -------------------------------------------------------------------------------- 1 | import { MitosisNode } from '../types/mitosis-node'; 2 | export declare const isMitosisNode: (thing: unknown) => thing is MitosisNode; 3 | -------------------------------------------------------------------------------- /dist/src/helpers/nullable.d.ts: -------------------------------------------------------------------------------- 1 | export type Nullable = X | null | undefined; 2 | export declare const checkIsDefined: (value: Nullable) => value is NonNullable; 3 | -------------------------------------------------------------------------------- /dist/src/helpers/state.d.ts: -------------------------------------------------------------------------------- 1 | import { MitosisComponent } from '../types/mitosis-component'; 2 | export declare const checkHasState: (component: MitosisComponent) => boolean; 3 | -------------------------------------------------------------------------------- /dist/src/parsers/svelte/helpers/mitosis-node.d.ts: -------------------------------------------------------------------------------- 1 | import { MitosisNode } from '../../../types/mitosis-node'; 2 | export declare function createMitosisNode(): MitosisNode; 3 | -------------------------------------------------------------------------------- /dist/src/helpers/get-components.d.ts: -------------------------------------------------------------------------------- 1 | import { MitosisComponent } from '../types/mitosis-component'; 2 | export declare function getComponents(json: MitosisComponent): Set; 3 | -------------------------------------------------------------------------------- /dist/src/helpers/has-stateful-dom.d.ts: -------------------------------------------------------------------------------- 1 | import { MitosisComponent } from '../types/mitosis-component'; 2 | export declare const hasStatefulDom: (json: MitosisComponent) => boolean; 3 | -------------------------------------------------------------------------------- /dist/src/helpers/has-bindings-text.d.ts: -------------------------------------------------------------------------------- 1 | import { MitosisComponent } from '../types/mitosis-component'; 2 | export declare const hasBindingsText: (json: MitosisComponent) => boolean; 3 | -------------------------------------------------------------------------------- /dist/src/parsers/jsx/props.d.ts: -------------------------------------------------------------------------------- 1 | import * as babel from '@babel/core'; 2 | export declare function undoPropsDestructure(path: babel.NodePath): void; 3 | -------------------------------------------------------------------------------- /dist/src/helpers/create-mitosis-node.d.ts: -------------------------------------------------------------------------------- 1 | import { MitosisNode } from '../types/mitosis-node'; 2 | export declare const createMitosisNode: (options: Partial) => MitosisNode; 3 | -------------------------------------------------------------------------------- /dist/src/helpers/get-components-used.d.ts: -------------------------------------------------------------------------------- 1 | import { MitosisComponent } from '../types/mitosis-component'; 2 | export declare function getComponentsUsed(json: MitosisComponent): Set; 3 | -------------------------------------------------------------------------------- /dist/src/helpers/has-component.d.ts: -------------------------------------------------------------------------------- 1 | import { MitosisComponent } from '../types/mitosis-component'; 2 | export declare const hasComponent: (name: string, json: MitosisComponent) => boolean; 3 | -------------------------------------------------------------------------------- /dist/src/helpers/parse-node.d.ts: -------------------------------------------------------------------------------- 1 | export declare const parseNode: (str: string) => import("..").MitosisNode; 2 | export declare const parseNodes: (str: string) => import("..").MitosisNode[]; 3 | -------------------------------------------------------------------------------- /dist/src/parsers/svelte/helpers/hooks.d.ts: -------------------------------------------------------------------------------- 1 | import type { SveltosisComponent } from '../types'; 2 | export declare function addToOnInitHook(json: SveltosisComponent, code: string): void; 3 | -------------------------------------------------------------------------------- /dist/src/parsers/svelte/types/index.d.ts: -------------------------------------------------------------------------------- 1 | import { MitosisComponent } from '../../../types/mitosis-component'; 2 | export type SveltosisComponent = MitosisComponent & { 3 | props: any; 4 | }; 5 | -------------------------------------------------------------------------------- /dist/src/generators/helpers/rsc.d.ts: -------------------------------------------------------------------------------- 1 | import type { MitosisComponent } from '../../types/mitosis-component'; 2 | export declare const checkIfIsClientComponent: (json: MitosisComponent) => boolean; 3 | -------------------------------------------------------------------------------- /dist/src/helpers/strip-meta-properties.d.ts: -------------------------------------------------------------------------------- 1 | import { MitosisComponent } from '../types/mitosis-component'; 2 | export declare const stripMetaProperties: (json: MitosisComponent) => MitosisComponent; 3 | -------------------------------------------------------------------------------- /dist/src/parsers/jsx/props-types.d.ts: -------------------------------------------------------------------------------- 1 | import { Project } from 'ts-morph'; 2 | export declare const findOptionalProps: (args: { 3 | project: Project; 4 | filePath: string; 5 | }) => string[]; 6 | -------------------------------------------------------------------------------- /dist/src/generators/angular/helpers.d.ts: -------------------------------------------------------------------------------- 1 | export declare const HELPER_FUNCTIONS: { 2 | [key: string]: string; 3 | }; 4 | export declare const getAppropriateTemplateFunctionKeys: (code: string) => string[]; 5 | -------------------------------------------------------------------------------- /dist/src/helpers/get-props-ref.d.ts: -------------------------------------------------------------------------------- 1 | import { MitosisComponent } from '../types/mitosis-component'; 2 | export declare function getPropsRef(json: MitosisComponent, shouldRemove?: boolean): [string, boolean]; 3 | -------------------------------------------------------------------------------- /dist/src/helpers/styles/collect-styled-components.d.ts: -------------------------------------------------------------------------------- 1 | import { MitosisComponent } from '../../types/mitosis-component'; 2 | export declare const collectStyledComponents: (json: MitosisComponent) => string; 3 | -------------------------------------------------------------------------------- /dist/src/parsers/svelte/index.d.ts: -------------------------------------------------------------------------------- 1 | import type { MitosisComponent } from '../../types/mitosis-component'; 2 | export declare const parseSvelte: (string_: string, path?: string) => Promise; 3 | -------------------------------------------------------------------------------- /dist/src/generators/svelte/types.d.ts: -------------------------------------------------------------------------------- 1 | import { BaseTranspilerOptions } from '../../types/transpiler'; 2 | export type ToSvelteOptions = BaseTranspilerOptions & { 3 | stateType?: 'proxies' | 'variables'; 4 | }; 5 | -------------------------------------------------------------------------------- /dist/src/helpers/is-html-attribute.d.ts: -------------------------------------------------------------------------------- 1 | export declare const htmlElementAttributes: { 2 | [key: string]: string[]; 3 | }; 4 | export declare const isHtmlAttribute: (attr: string, tagName: string) => boolean; 5 | -------------------------------------------------------------------------------- /dist/src/types/mitosis-styles.d.ts: -------------------------------------------------------------------------------- 1 | export type MitosisStyles = Omit, 'length' | 'getPropertyPriority' | 'getPropertyValue' | 'item' | 'removeProperty' | 'setProperty' | 'parentRule'>; 2 | -------------------------------------------------------------------------------- /dist/src/generators/react-native/sanitize-react-native-block-styles.d.ts: -------------------------------------------------------------------------------- 1 | type Styles = Record; 2 | export declare const sanitizeReactNativeBlockStyles: (styles: Styles) => Styles; 3 | export {}; 4 | -------------------------------------------------------------------------------- /dist/src/generators/vue/vue.d.ts: -------------------------------------------------------------------------------- 1 | import { TranspilerGenerator } from '../../types/transpiler'; 2 | import { ToVueOptions } from './types'; 3 | export declare const componentToVue: TranspilerGenerator>; 4 | -------------------------------------------------------------------------------- /dist/src/helpers/trace-reference-to-module-path.d.ts: -------------------------------------------------------------------------------- 1 | import { MitosisImport } from '../types/mitosis-component'; 2 | export declare function traceReferenceToModulePath(imports: MitosisImport[], name: string): string | null; 3 | -------------------------------------------------------------------------------- /dist/src/generators/alpine/render-mount-hook.d.ts: -------------------------------------------------------------------------------- 1 | import { MitosisComponent } from '../../types/mitosis-component'; 2 | export declare const renderMountHook: import("lodash").CurriedFunction2; 3 | -------------------------------------------------------------------------------- /dist/src/generators/qwik/helpers/convert-method-to-function.d.ts: -------------------------------------------------------------------------------- 1 | import type { MethodMap } from './state'; 2 | export declare function convertMethodToFunction(code: string, properties: MethodMap, lexicalArgs: string[]): string; 3 | -------------------------------------------------------------------------------- /dist/src/generators/svelte/svelte.d.ts: -------------------------------------------------------------------------------- 1 | import { TranspilerGenerator } from '../../types/transpiler'; 2 | import { ToSvelteOptions } from './types'; 3 | export declare const componentToSvelte: TranspilerGenerator; 4 | -------------------------------------------------------------------------------- /dist/src/helpers/output.d.ts: -------------------------------------------------------------------------------- 1 | import { MitosisConfig, Target } from '..'; 2 | export declare const checkShouldOutputTypeScript: ({ target, options, }: { 3 | target: Target; 4 | options: MitosisConfig; 5 | }) => boolean; 6 | -------------------------------------------------------------------------------- /dist/src/generators/solid/index.d.ts: -------------------------------------------------------------------------------- 1 | import { TranspilerGenerator } from '../../types/transpiler'; 2 | import { ToSolidOptions } from './types'; 3 | export declare const componentToSolid: TranspilerGenerator>; 4 | -------------------------------------------------------------------------------- /dist/src/helpers/nodes/for.d.ts: -------------------------------------------------------------------------------- 1 | import { ForNode } from '../../types/mitosis-node'; 2 | export declare const getForArguments: (node: ForNode, { excludeCollectionName }?: { 3 | excludeCollectionName: boolean; 4 | }) => string[]; 5 | -------------------------------------------------------------------------------- /dist/src/parsers/svelte/css/index.d.ts: -------------------------------------------------------------------------------- 1 | import { Ast } from 'svelte/types/compiler/interfaces'; 2 | import type { SveltosisComponent } from '../types'; 3 | export declare const parseCss: (ast: Ast, json: SveltosisComponent) => void; 4 | -------------------------------------------------------------------------------- /dist/src/helpers/create-mitosis-context.d.ts: -------------------------------------------------------------------------------- 1 | import { MitosisContext } from '../types/mitosis-context'; 2 | export declare function createMitosisContext(options: Partial & { 3 | name: string; 4 | }): MitosisContext; 5 | -------------------------------------------------------------------------------- /dist/src/helpers/get-props.d.ts: -------------------------------------------------------------------------------- 1 | import { MitosisComponent } from '../types/mitosis-component'; 2 | /** 3 | * Get props used in the components by reference 4 | */ 5 | export declare const getProps: (json: MitosisComponent) => Set; 6 | -------------------------------------------------------------------------------- /dist/src/generators/lit/collect-class-string.d.ts: -------------------------------------------------------------------------------- 1 | import { MitosisNode } from '../../types/mitosis-node'; 2 | export declare function collectClassString(json: MitosisNode, bindingOpenChar?: string, bindingCloseChar?: string): string | null; 3 | -------------------------------------------------------------------------------- /dist/src/generators/stencil/collect-class-string.d.ts: -------------------------------------------------------------------------------- 1 | import { MitosisNode } from '../../types/mitosis-node'; 2 | export declare function collectClassString(json: MitosisNode, bindingOpenChar?: string, bindingCloseChar?: string): string | null; 3 | -------------------------------------------------------------------------------- /dist/src/helpers/is-component.d.ts: -------------------------------------------------------------------------------- 1 | import { MitosisNode } from '../types/mitosis-node'; 2 | /** 3 | * This node is a component, vs a plain html tag ( vs
) 4 | */ 5 | export declare const isComponent: (json: MitosisNode) => boolean; 6 | -------------------------------------------------------------------------------- /dist/src/helpers/map-refs.d.ts: -------------------------------------------------------------------------------- 1 | import { MitosisComponent } from '../types/mitosis-component'; 2 | export type RefMapper = (refName: string) => string; 3 | export declare const mapRefs: (component: MitosisComponent, mapper: RefMapper) => void; 4 | -------------------------------------------------------------------------------- /dist/src/parsers/svelte/module/index.d.ts: -------------------------------------------------------------------------------- 1 | import type { Ast } from 'svelte/types/compiler/interfaces'; 2 | import type { SveltosisComponent } from '../types'; 3 | export declare function parseModule(ast: Ast, json: SveltosisComponent): void; 4 | -------------------------------------------------------------------------------- /dist/src/generators/context/vue.d.ts: -------------------------------------------------------------------------------- 1 | export declare const contextToVue: (options: Pick) => ({ context }: { 2 | context: import("../../types/mitosis-context").MitosisContext; 3 | }) => string; 4 | -------------------------------------------------------------------------------- /dist/src/helpers/get-state-used.d.ts: -------------------------------------------------------------------------------- 1 | import { MitosisComponent } from '../types/mitosis-component'; 2 | /** 3 | * Get state used in the components by reference 4 | */ 5 | export declare const getStateUsed: (json: MitosisComponent) => Set; 6 | -------------------------------------------------------------------------------- /dist/src/parsers/svelte/instance/imports.d.ts: -------------------------------------------------------------------------------- 1 | import type { ImportDeclaration } from 'estree'; 2 | import type { SveltosisComponent } from '../types'; 3 | export declare function parseImports(json: SveltosisComponent, node: ImportDeclaration): void; 4 | -------------------------------------------------------------------------------- /dist/src/parsers/svelte/instance/index.d.ts: -------------------------------------------------------------------------------- 1 | import type { Ast } from 'svelte/types/compiler/interfaces'; 2 | import type { SveltosisComponent } from '../types'; 3 | export declare function parseInstance(ast: Ast, json: SveltosisComponent): void; 4 | -------------------------------------------------------------------------------- /dist/src/parsers/svelte/instance/reactive.d.ts: -------------------------------------------------------------------------------- 1 | import type { LabeledStatement } from 'estree'; 2 | import type { SveltosisComponent } from '../types'; 3 | export declare function parseReactive(json: SveltosisComponent, node: LabeledStatement): void; 4 | -------------------------------------------------------------------------------- /dist/src/generators/swift-ui.d.ts: -------------------------------------------------------------------------------- 1 | import { BaseTranspilerOptions, TranspilerGenerator } from '../types/transpiler'; 2 | export type ToSwiftOptions = BaseTranspilerOptions; 3 | export declare const componentToSwift: TranspilerGenerator; 4 | -------------------------------------------------------------------------------- /dist/src/helpers/filter-empty-text-nodes.d.ts: -------------------------------------------------------------------------------- 1 | import { MitosisNode } from '../types/mitosis-node'; 2 | export declare const isEmptyTextNode: (node: MitosisNode) => boolean; 3 | export declare const filterEmptyTextNodes: (node: MitosisNode) => boolean; 4 | -------------------------------------------------------------------------------- /dist/src/helpers/get-prop-functions.d.ts: -------------------------------------------------------------------------------- 1 | import { MitosisComponent } from '../types/mitosis-component'; 2 | /** 3 | * Get props used in the components by reference 4 | */ 5 | export declare const getPropFunctions: (json: MitosisComponent) => string[]; 6 | -------------------------------------------------------------------------------- /dist/src/parsers/svelte/helpers/expressions.d.ts: -------------------------------------------------------------------------------- 1 | import { ObjectExpression } from 'estree'; 2 | import type { SveltosisComponent } from '../types'; 3 | export declare function parseObjectExpression(json: SveltosisComponent, node: ObjectExpression): {}; 4 | -------------------------------------------------------------------------------- /dist/src/parsers/svelte/instance/statements.d.ts: -------------------------------------------------------------------------------- 1 | import type { Statement } from 'estree'; 2 | import type { SveltosisComponent } from '../types'; 3 | export declare function parseStatementAtProgramLevel(json: SveltosisComponent, node: Statement): void; 4 | -------------------------------------------------------------------------------- /dist/src/generators/solid/helpers/styles.d.ts: -------------------------------------------------------------------------------- 1 | import { MitosisNode } from '../../../types/mitosis-node'; 2 | import { ToSolidOptions } from '../types'; 3 | export declare const collectClassString: (json: MitosisNode, options: ToSolidOptions) => string | null; 4 | -------------------------------------------------------------------------------- /dist/src/helpers/fast-clone.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | exports.fastClone = void 0; 4 | var fastClone = function (obj) { return JSON.parse(JSON.stringify(obj)); }; 5 | exports.fastClone = fastClone; 6 | -------------------------------------------------------------------------------- /dist/src/helpers/remove-surrounding-block.d.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Remove the surrounding block for a function, for instance 3 | * 4 | * `{ const foo = "bar" }` -> `const foo = "bar"` 5 | */ 6 | export declare function removeSurroundingBlock(code: string): string; 7 | -------------------------------------------------------------------------------- /dist/src/parsers/svelte/instance/functions.d.ts: -------------------------------------------------------------------------------- 1 | import type { FunctionDeclaration } from 'estree'; 2 | import type { SveltosisComponent } from '../types'; 3 | export declare function parseFunctions(json: SveltosisComponent, node: FunctionDeclaration): void; 4 | -------------------------------------------------------------------------------- /dist/src/helpers/is-upper-case.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | exports.isUpperCase = void 0; 4 | var isUpperCase = function (str) { return str.toUpperCase() === str; }; 5 | exports.isUpperCase = isUpperCase; 6 | -------------------------------------------------------------------------------- /dist/src/parsers/jsx/ast.d.ts: -------------------------------------------------------------------------------- 1 | import * as babel from '@babel/core'; 2 | import { JSONOrNode } from '../../types/json'; 3 | declare const types: typeof babel.types; 4 | export declare const jsonToAst: (json: JSONOrNode) => babel.types.Expression; 5 | export {}; 6 | -------------------------------------------------------------------------------- /dist/src/parsers/svelte/helpers/bindings.d.ts: -------------------------------------------------------------------------------- 1 | import type { MitosisNode } from '../../../types/mitosis-node'; 2 | import type { SveltosisComponent } from '../types'; 3 | export declare function processBindings(json: SveltosisComponent, node: MitosisNode): void; 4 | -------------------------------------------------------------------------------- /dist/src/types/mitosis-context.d.ts: -------------------------------------------------------------------------------- 1 | import { ContextOptions, MitosisState } from './mitosis-component'; 2 | export type MitosisContext = ContextOptions & { 3 | '@type': '@builder.io/mitosis/context'; 4 | name: string; 5 | value: MitosisState; 6 | }; 7 | -------------------------------------------------------------------------------- /dist/src/generators/rsc.d.ts: -------------------------------------------------------------------------------- 1 | import { TranspilerGenerator } from '../types/transpiler'; 2 | import { ToReactOptions } from './react'; 3 | export type ToRscOptions = ToReactOptions; 4 | export declare const componentToRsc: TranspilerGenerator>; 5 | -------------------------------------------------------------------------------- /dist/src/parsers/builder/helpers.d.ts: -------------------------------------------------------------------------------- 1 | import { JSONObject } from '../../types/json'; 2 | import { MitosisComponent } from '../../types/mitosis-component'; 3 | export declare const mapBuilderContentStateToMitosisState: (value: JSONObject) => MitosisComponent['state']; 4 | -------------------------------------------------------------------------------- /dist/src/parsers/svelte/instance/properties.d.ts: -------------------------------------------------------------------------------- 1 | import type { ExportNamedDeclaration } from 'estree'; 2 | import type { SveltosisComponent } from '../types'; 3 | export declare function parseProperties(json: SveltosisComponent, node: ExportNamedDeclaration): void; 4 | -------------------------------------------------------------------------------- /dist/src/types/mitosis-node.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | exports.checkIsForNode = void 0; 4 | var checkIsForNode = function (node) { return node.name === 'For'; }; 5 | exports.checkIsForNode = checkIsForNode; 6 | -------------------------------------------------------------------------------- /dist/src/helpers/generic-format.d.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Generic formatter for languages prettier doesn't support, like Swift 3 | * 4 | * Not super sophisticated, but much better than nothing 5 | */ 6 | export declare const format: (str: string, indentSpaces?: number) => string; 7 | -------------------------------------------------------------------------------- /dist/src/helpers/typescript.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | exports.objectHasKey = void 0; 4 | var objectHasKey = function (object, key) { 5 | return key in object; 6 | }; 7 | exports.objectHasKey = objectHasKey; 8 | -------------------------------------------------------------------------------- /dist/src/parsers/context.d.ts: -------------------------------------------------------------------------------- 1 | import { MitosisContext } from '../types/mitosis-context'; 2 | type ParseContextOptions = { 3 | name: string; 4 | }; 5 | export declare function parseContext(code: string, options: ParseContextOptions): MitosisContext | null; 6 | export {}; 7 | -------------------------------------------------------------------------------- /dist/src/generators/qwik/helpers/handlers.d.ts: -------------------------------------------------------------------------------- 1 | import { MitosisNode } from '../../../types/mitosis-node'; 2 | import { File } from '../src-generator'; 3 | export declare function renderHandlers(file: File, componentName: string, children: MitosisNode[]): Map; 4 | -------------------------------------------------------------------------------- /dist/src/generators/qwik/index.d.ts: -------------------------------------------------------------------------------- 1 | export { addCommonStyles, addComponent, createFileSet } from './component'; 2 | export type { FileSet, QwikOptions } from './component'; 3 | export { componentToQwik } from './component-generator'; 4 | export { File } from './src-generator'; 5 | -------------------------------------------------------------------------------- /dist/src/generators/template.d.ts: -------------------------------------------------------------------------------- 1 | import { BaseTranspilerOptions, TranspilerGenerator } from '../types/transpiler'; 2 | export interface ToTemplateOptions extends BaseTranspilerOptions { 3 | } 4 | export declare const componentToTemplate: TranspilerGenerator; 5 | -------------------------------------------------------------------------------- /dist/src/parsers/angular.d.ts: -------------------------------------------------------------------------------- 1 | import { MitosisComponent } from '../types/mitosis-component'; 2 | interface AngularToMitosisOptions { 3 | } 4 | export declare function angularToMitosisComponent(code: string, options?: AngularToMitosisOptions): MitosisComponent; 5 | export {}; 6 | -------------------------------------------------------------------------------- /dist/src/generators/qwik/helpers/stable-serialize.d.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Same as JSON.stringify, but sorts keys ensuring that the output is stable across runs. 3 | * @param obj 4 | * @returns JSON serialized string 5 | */ 6 | export declare function stableJSONserialize(obj: any): string; 7 | -------------------------------------------------------------------------------- /dist/src/parsers/svelte/html/slot.d.ts: -------------------------------------------------------------------------------- 1 | import type { TemplateNode } from 'svelte/types/compiler/interfaces'; 2 | import type { SveltosisComponent } from '../types'; 3 | export declare function parseSlot(json: SveltosisComponent, node: TemplateNode): import("../../..").MitosisNode; 4 | -------------------------------------------------------------------------------- /dist/src/generators/qwik/component-generator.d.ts: -------------------------------------------------------------------------------- 1 | import { BaseTranspilerOptions, TranspilerGenerator } from '../../types/transpiler'; 2 | export interface ToQwikOptions extends BaseTranspilerOptions { 3 | } 4 | export declare const componentToQwik: TranspilerGenerator; 5 | -------------------------------------------------------------------------------- /dist/src/generators/stencil/generate.d.ts: -------------------------------------------------------------------------------- 1 | import { BaseTranspilerOptions, TranspilerGenerator } from '../../types/transpiler'; 2 | export interface ToStencilOptions extends BaseTranspilerOptions { 3 | } 4 | export declare const componentToStencil: TranspilerGenerator; 5 | -------------------------------------------------------------------------------- /dist/src/helpers/getters-to-functions.d.ts: -------------------------------------------------------------------------------- 1 | import { MitosisComponent } from '../types/mitosis-component'; 2 | /** 3 | * Map getters like `useStore({ get foo() { ... }})` from `state.foo` to `foo()` 4 | */ 5 | export declare const gettersToFunctions: (json: MitosisComponent) => void; 6 | -------------------------------------------------------------------------------- /dist/src/parsers/svelte/helpers/string.d.ts: -------------------------------------------------------------------------------- 1 | export declare function uniqueName(existingItems: string[], reference: string): string; 2 | export declare function insertAt(string_: string, sub: string, pos: number): string; 3 | export declare function stripQuotes(string_: string): string; 4 | -------------------------------------------------------------------------------- /dist/src/parsers/svelte/html/element.d.ts: -------------------------------------------------------------------------------- 1 | import type { TemplateNode } from 'svelte/types/compiler/interfaces'; 2 | import type { SveltosisComponent } from '../types'; 3 | export declare function parseElement(json: SveltosisComponent, node: TemplateNode): import("../../..").MitosisNode; 4 | -------------------------------------------------------------------------------- /dist/src/parsers/svelte/html/fragment.d.ts: -------------------------------------------------------------------------------- 1 | import type { TemplateNode } from 'svelte/types/compiler/interfaces'; 2 | import type { SveltosisComponent } from '../types'; 3 | export declare function parseFragment(json: SveltosisComponent, node: TemplateNode): import("../../..").MitosisNode; 4 | -------------------------------------------------------------------------------- /dist/src/parsers/svelte/html/if-else.d.ts: -------------------------------------------------------------------------------- 1 | import type { TemplateNode } from 'svelte/types/compiler/interfaces'; 2 | import type { SveltosisComponent } from '../types'; 3 | export declare function parseIfElse(json: SveltosisComponent, node: TemplateNode): import("../../..").MitosisNode; 4 | -------------------------------------------------------------------------------- /dist/src/generators/helpers/on-mount.d.ts: -------------------------------------------------------------------------------- 1 | import { MitosisComponent } from '../../types/mitosis-component'; 2 | /** 3 | * Helper for frameworks where all `onMount()`s must share a single scope. 4 | */ 5 | export declare const stringifySingleScopeOnMount: (json: MitosisComponent) => string; 6 | -------------------------------------------------------------------------------- /dist/src/helpers/dash-case.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | exports.dashCase = void 0; 4 | var lodash_1 = require("lodash"); 5 | var dashCase = function (string) { return (0, lodash_1.kebabCase)(string); }; 6 | exports.dashCase = dashCase; 7 | -------------------------------------------------------------------------------- /dist/src/helpers/plugins/process-target-blocks.d.ts: -------------------------------------------------------------------------------- 1 | import { Targets } from '../../targets'; 2 | import { Plugin } from '../../types/plugins'; 3 | /** 4 | * Processes `useTarget()` blocks for a given target. 5 | */ 6 | export declare const processTargetBlocks: (target: Targets) => Plugin; 7 | -------------------------------------------------------------------------------- /dist/src/helpers/styles/collect-css.d.ts: -------------------------------------------------------------------------------- 1 | import { MitosisComponent } from '../../types/mitosis-component'; 2 | type CollectStyleOptions = { 3 | prefix?: string; 4 | }; 5 | export declare const collectCss: (json: MitosisComponent, options?: CollectStyleOptions) => string; 6 | export {}; 7 | -------------------------------------------------------------------------------- /dist/src/parsers/jsx/index.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | exports.parseJsx = void 0; 4 | var jsx_1 = require("./jsx"); 5 | Object.defineProperty(exports, "parseJsx", { enumerable: true, get: function () { return jsx_1.parseJsx; } }); 6 | -------------------------------------------------------------------------------- /dist/src/parsers/svelte/instance/expressions.d.ts: -------------------------------------------------------------------------------- 1 | import { BaseNode, ExpressionStatement } from 'estree'; 2 | import type { SveltosisComponent } from '../types'; 3 | export declare function parseMemberExpression(json: SveltosisComponent, node: ExpressionStatement, parent?: BaseNode): void; 4 | -------------------------------------------------------------------------------- /dist/src/helpers/is-children.d.ts: -------------------------------------------------------------------------------- 1 | import { MitosisNode } from '../types/mitosis-node'; 2 | export declare const getTextValue: (node: MitosisNode) => string; 3 | export default function isChildren({ node, extraMatches, }: { 4 | node: MitosisNode; 5 | extraMatches?: string[]; 6 | }): boolean; 7 | -------------------------------------------------------------------------------- /dist/src/helpers/nullable.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | exports.checkIsDefined = void 0; 4 | var checkIsDefined = function (value) { 5 | return value !== null && value !== undefined; 6 | }; 7 | exports.checkIsDefined = checkIsDefined; 8 | -------------------------------------------------------------------------------- /dist/src/parsers/jsx/context.d.ts: -------------------------------------------------------------------------------- 1 | import { MitosisComponent } from '../../types/mitosis-component'; 2 | /** 3 | * Convert to hooks formats by mutating the 4 | * MitosisComponent tree 5 | */ 6 | export declare function extractContextComponents(json: MitosisComponent): void; 7 | -------------------------------------------------------------------------------- /dist/src/generators/lit/generate.d.ts: -------------------------------------------------------------------------------- 1 | import { BaseTranspilerOptions, TranspilerGenerator } from '../../types/transpiler'; 2 | export interface ToLitOptions extends BaseTranspilerOptions { 3 | useShadowDom?: boolean; 4 | } 5 | export declare const componentToLit: TranspilerGenerator; 6 | -------------------------------------------------------------------------------- /dist/src/helpers/state.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | exports.checkHasState = void 0; 4 | var checkHasState = function (component) { 5 | return Boolean(Object.keys(component.state).length); 6 | }; 7 | exports.checkHasState = checkHasState; 8 | -------------------------------------------------------------------------------- /dist/src/parsers/jsx/exports.d.ts: -------------------------------------------------------------------------------- 1 | import * as babel from '@babel/core'; 2 | import { MitosisExports } from '../../types/mitosis-component'; 3 | declare const types: typeof babel.types; 4 | export declare const generateExports: (path: babel.NodePath) => MitosisExports; 5 | export {}; 6 | -------------------------------------------------------------------------------- /dist/src/parsers/jsx/signals.d.ts: -------------------------------------------------------------------------------- 1 | import { Project } from 'ts-morph'; 2 | export declare const findSignals: ({ filePath, project }: { 3 | project: Project; 4 | filePath: string; 5 | }) => { 6 | props: Set; 7 | state: Set; 8 | context: Set; 9 | }; 10 | -------------------------------------------------------------------------------- /dist/src/parsers/svelte/html/actions.d.ts: -------------------------------------------------------------------------------- 1 | import type { Element } from 'svelte/types/compiler/interfaces'; 2 | import type { SveltosisComponent } from '../types'; 3 | export declare function parseAction(json: SveltosisComponent, nodeReference: string, attribute: Element['attributes'][number]): void; 4 | -------------------------------------------------------------------------------- /dist/src/generators/solid/state/index.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | exports.getState = void 0; 4 | var state_1 = require("./state"); 5 | Object.defineProperty(exports, "getState", { enumerable: true, get: function () { return state_1.getState; } }); 6 | -------------------------------------------------------------------------------- /dist/src/generators/context/vue.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | exports.contextToVue = void 0; 4 | var context_with_symbol_key_1 = require("./helpers/context-with-symbol-key"); 5 | exports.contextToVue = context_with_symbol_key_1.getContextWithSymbolKey; 6 | -------------------------------------------------------------------------------- /dist/src/helpers/camel-case.d.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This is a function similar to loadash `camelCase`, but it does not mess with capitalization. 3 | * 4 | * loadash: `camelCase('A-BC')` => "ABc" 5 | * this fn: `camelCase('A-BC')` => "ABC" 6 | * 7 | */ 8 | export declare function camelCase(text?: string): string; 9 | -------------------------------------------------------------------------------- /dist/src/generators/solid/types.d.ts: -------------------------------------------------------------------------------- 1 | import { BaseTranspilerOptions } from '../../types/transpiler'; 2 | export type SolidState = 'mutable' | 'signals' | 'store'; 3 | export interface ToSolidOptions extends BaseTranspilerOptions { 4 | state: SolidState; 5 | stylesType?: 'styled-components' | 'style-tag'; 6 | } 7 | -------------------------------------------------------------------------------- /dist/src/helpers/is-root-text-node.d.ts: -------------------------------------------------------------------------------- 1 | import { MitosisComponent } from '../types/mitosis-component'; 2 | import { MitosisNode } from '../types/mitosis-node'; 3 | export declare function isRootTextNode(json: MitosisComponent | MitosisNode): boolean; 4 | export declare function isTextNode(node: MitosisNode): boolean; 5 | -------------------------------------------------------------------------------- /dist/src/helpers/mitosis-imports.d.ts: -------------------------------------------------------------------------------- 1 | import * as babel from '@babel/core'; 2 | import { MitosisImport } from '../types/mitosis-component'; 3 | declare const types: typeof babel.types; 4 | export declare const mapImportDeclarationToMitosisImport: (node: babel.types.ImportDeclaration) => MitosisImport; 5 | export {}; 6 | -------------------------------------------------------------------------------- /dist/src/parsers/svelte/html/mustache-tag.d.ts: -------------------------------------------------------------------------------- 1 | import type { TemplateNode } from 'svelte/types/compiler/interfaces'; 2 | export declare function parseMustacheTag(node: TemplateNode): import("../../..").MitosisNode; 3 | export declare function parseRawMustacheTag(node: TemplateNode): import("../../..").MitosisNode; 4 | -------------------------------------------------------------------------------- /dist/src/generators/context/qwik.d.ts: -------------------------------------------------------------------------------- 1 | import { MitosisContext } from '../../types/mitosis-context'; 2 | type ContextToQwikOptions = { 3 | format?: boolean; 4 | }; 5 | export declare const contextToQwik: (options?: ContextToQwikOptions) => ({ context }: { 6 | context: MitosisContext; 7 | }) => string; 8 | export {}; 9 | -------------------------------------------------------------------------------- /dist/src/generators/svelte/helpers.d.ts: -------------------------------------------------------------------------------- 1 | import { MitosisComponent } from '../../types/mitosis-component'; 2 | import { ToSvelteOptions } from './types'; 3 | export declare const stripStateAndProps: ({ options, json }: { 4 | options: ToSvelteOptions; 5 | json: MitosisComponent; 6 | }) => (code: string) => string; 7 | -------------------------------------------------------------------------------- /dist/src/helpers/event-handlers.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | exports.checkIsBindingEventHandler = void 0; 4 | var checkIsBindingEventHandler = function (code) { return code.startsWith('on'); }; 5 | exports.checkIsBindingEventHandler = checkIsBindingEventHandler; 6 | -------------------------------------------------------------------------------- /dist/src/helpers/get-styles.d.ts: -------------------------------------------------------------------------------- 1 | import { MitosisNode } from '../types/mitosis-node'; 2 | import { MitosisStyles } from '../types/mitosis-styles'; 3 | export declare const getStyles: (json: MitosisNode) => MitosisStyles | null; 4 | export declare const setStyles: (json: MitosisNode, styles: MitosisStyles | null) => void; 5 | -------------------------------------------------------------------------------- /dist/src/generators/context/solid.d.ts: -------------------------------------------------------------------------------- 1 | import { MitosisContext } from '../../types/mitosis-context'; 2 | type ContextToSolidOptions = { 3 | format?: boolean; 4 | }; 5 | export declare const contextToSolid: (options?: ContextToSolidOptions) => ({ context }: { 6 | context: MitosisContext; 7 | }) => string; 8 | export {}; 9 | -------------------------------------------------------------------------------- /dist/src/helpers/html-escape.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | exports.htmlAttributeEscape = void 0; 4 | function htmlAttributeEscape(value) { 5 | return value.replace(/"/g, '"').replace(/\n/g, '\\n'); 6 | } 7 | exports.htmlAttributeEscape = htmlAttributeEscape; 8 | -------------------------------------------------------------------------------- /dist/src/helpers/is-mitosis-node.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | exports.isMitosisNode = void 0; 4 | var isMitosisNode = function (thing) { 5 | return Boolean(thing && thing['@type'] === '@builder.io/mitosis/node'); 6 | }; 7 | exports.isMitosisNode = isMitosisNode; 8 | -------------------------------------------------------------------------------- /dist/src/parsers/svelte/html/each.d.ts: -------------------------------------------------------------------------------- 1 | import type { TemplateNode } from 'svelte/types/compiler/interfaces'; 2 | import { MitosisNode } from '../../../types/mitosis-node'; 3 | import type { SveltosisComponent } from '../types'; 4 | export declare function parseEach(json: SveltosisComponent, node: TemplateNode): MitosisNode; 5 | -------------------------------------------------------------------------------- /dist/src/generators/svelte/index.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | exports.componentToSvelte = void 0; 4 | var svelte_1 = require("./svelte"); 5 | Object.defineProperty(exports, "componentToSvelte", { enumerable: true, get: function () { return svelte_1.componentToSvelte; } }); 6 | -------------------------------------------------------------------------------- /dist/src/helpers/indent.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | exports.indent = void 0; 4 | function indent(str, spaces) { 5 | if (spaces === void 0) { spaces = 4; } 6 | return str.replace(/\n([^\n])/g, "\n".concat(' '.repeat(spaces), "$1")); 7 | } 8 | exports.indent = indent; 9 | -------------------------------------------------------------------------------- /dist/src/parsers/svelte/css/index.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | exports.parseCss = void 0; 4 | var parseCss = function (ast, json) { 5 | var _a; 6 | json.style = (_a = ast.css) === null || _a === void 0 ? void 0 : _a.content.styles; 7 | }; 8 | exports.parseCss = parseCss; 9 | -------------------------------------------------------------------------------- /dist/src/generators/qwik/helpers/stable-inject.d.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Similar to our `stableJSONSerialize` function, except that it does not stringify the values: it injects them as-is. 3 | * This is needed for our `MitosisState` values which are JS expressions stored as strings. 4 | */ 5 | export declare function stableInject(obj: any): string; 6 | -------------------------------------------------------------------------------- /dist/src/helpers/capitalize.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | exports.capitalize = void 0; 4 | var capitalize = function (str) { 5 | if (!str) { 6 | return str; 7 | } 8 | return str[0].toUpperCase() + str.slice(1); 9 | }; 10 | exports.capitalize = capitalize; 11 | -------------------------------------------------------------------------------- /dist/src/helpers/is-valid-attribute-name.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | exports.isValidAttributeName = void 0; 4 | var isValidAttributeName = function (str) { 5 | return Boolean(str && /^[a-z0-9\-_:]+$/i.test(str)); 6 | }; 7 | exports.isValidAttributeName = isValidAttributeName; 8 | -------------------------------------------------------------------------------- /dist/src/generators/react/blocks.d.ts: -------------------------------------------------------------------------------- 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, parentSlots?: any[]) => string; 5 | -------------------------------------------------------------------------------- /dist/src/generators/vue/blocks.d.ts: -------------------------------------------------------------------------------- 1 | import { MitosisNode } from '../../types/mitosis-node'; 2 | import { ToVueOptions } from './types'; 3 | type BlockRenderer = (json: MitosisNode, options: ToVueOptions, scope?: Scope) => string; 4 | interface Scope { 5 | isRootNode?: boolean; 6 | } 7 | export declare const blockToVue: BlockRenderer; 8 | export {}; 9 | -------------------------------------------------------------------------------- /dist/src/helpers/slots.d.ts: -------------------------------------------------------------------------------- 1 | export type SlotMapper = (slotName: string) => string; 2 | export declare const isSlotProperty: (key: string, slotPrefix?: string) => boolean; 3 | export declare const stripSlotPrefix: (key: string, slotPrefix?: string) => string; 4 | export declare function replaceSlotsInString(code: string, mapper: SlotMapper): string; 5 | -------------------------------------------------------------------------------- /dist/src/generators/solid/state/signals.d.ts: -------------------------------------------------------------------------------- 1 | import { MitosisComponent, MitosisState } from '../../../types/mitosis-component'; 2 | import { ToSolidOptions } from '../types'; 3 | export declare const getSignalsCode: ({ json, options, state, }: { 4 | json: MitosisComponent; 5 | options: ToSolidOptions; 6 | state: MitosisState; 7 | }) => string; 8 | -------------------------------------------------------------------------------- /dist/src/helpers/traverse-nodes.d.ts: -------------------------------------------------------------------------------- 1 | import { TraverseContext } from 'traverse'; 2 | import { MitosisComponent } from '../types/mitosis-component'; 3 | import { MitosisNode } from '../types/mitosis-node'; 4 | export declare function traverseNodes(component: MitosisComponent | MitosisNode, cb: (node: MitosisNode, context: TraverseContext) => void): void; 5 | -------------------------------------------------------------------------------- /dist/src/generators/solid/state/store.d.ts: -------------------------------------------------------------------------------- 1 | import { MitosisComponent, MitosisState } from '../../../types/mitosis-component'; 2 | import { ToSolidOptions } from '../types'; 3 | export declare const getStoreCode: ({ json: component, options, state, }: { 4 | json: MitosisComponent; 5 | options: ToSolidOptions; 6 | state: MitosisState; 7 | }) => string; 8 | -------------------------------------------------------------------------------- /dist/src/helpers/is-component.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | exports.isComponent = void 0; 4 | /** 5 | * This node is a component, vs a plain html tag ( vs
) 6 | */ 7 | var isComponent = function (json) { return json.name.toLowerCase() !== json.name; }; 8 | exports.isComponent = isComponent; 9 | -------------------------------------------------------------------------------- /dist/src/parsers/jsx/hooks/helpers.d.ts: -------------------------------------------------------------------------------- 1 | import * as babel from '@babel/core'; 2 | declare const types: typeof babel.types; 3 | export declare const getHook: (node: babel.Node) => babel.types.CallExpression | null; 4 | export declare const processHookCode: (firstArg: babel.types.ArrowFunctionExpression | babel.types.FunctionExpression) => string; 5 | export {}; 6 | -------------------------------------------------------------------------------- /dist/src/generators/context/helpers/context-with-symbol-key.d.ts: -------------------------------------------------------------------------------- 1 | import { MitosisContext } from '../../../types/mitosis-context'; 2 | import { BaseTranspilerOptions } from '../../../types/transpiler'; 3 | export declare const getContextWithSymbolKey: (options: Pick) => ({ context }: { 4 | context: MitosisContext; 5 | }) => string; 6 | -------------------------------------------------------------------------------- /dist/src/generators/context/angular.d.ts: -------------------------------------------------------------------------------- 1 | import { MitosisContext } from '../../types/mitosis-context'; 2 | type ContextToAngularOptions = { 3 | format?: boolean; 4 | typescript?: boolean; 5 | }; 6 | export declare const contextToAngular: (options?: ContextToAngularOptions) => ({ context }: { 7 | context: MitosisContext; 8 | }) => string; 9 | export {}; 10 | -------------------------------------------------------------------------------- /dist/src/generators/qwik/helpers/add-prevent-default.d.ts: -------------------------------------------------------------------------------- 1 | import { MitosisComponent } from '../../../types/mitosis-component'; 2 | /** 3 | * Find event handlers that explicitly call .preventDefault() and 4 | * add preventdefault:event 5 | * https://qwik.builder.io/tutorial/events/preventdefault 6 | */ 7 | export declare function addPreventDefault(json: MitosisComponent): void; 8 | -------------------------------------------------------------------------------- /dist/src/generators/vue/compositionApi.d.ts: -------------------------------------------------------------------------------- 1 | import { BaseHook, MitosisComponent } from '../../types/mitosis-component'; 2 | import { ToVueOptions } from './types'; 3 | export declare function generateCompositionApiScript(component: MitosisComponent, options: ToVueOptions, template: string, props: Array, onUpdateWithDeps: BaseHook[], onUpdateWithoutDeps: BaseHook[]): string; 4 | -------------------------------------------------------------------------------- /dist/src/generators/react/generator.d.ts: -------------------------------------------------------------------------------- 1 | import { TranspilerGenerator } from '../../types/transpiler'; 2 | import { ToReactOptions } from './types'; 3 | export declare const contextPropDrillingKey = "_context"; 4 | export declare const componentToPreact: TranspilerGenerator>; 5 | export declare const componentToReact: TranspilerGenerator>; 6 | -------------------------------------------------------------------------------- /dist/src/parsers/svelte/instance/references.d.ts: -------------------------------------------------------------------------------- 1 | import type { Expression, Pattern, VariableDeclaration } from 'estree'; 2 | import type { SveltosisComponent } from '../types'; 3 | export declare function getParsedValue(json: SveltosisComponent, element: Expression | Pattern): {}; 4 | export declare function parseReferences(json: SveltosisComponent, node: VariableDeclaration): void; 5 | -------------------------------------------------------------------------------- /dist/src/generators/angular/types.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | exports.DEFAULT_ANGULAR_OPTIONS = exports.BUILT_IN_COMPONENTS = void 0; 4 | exports.BUILT_IN_COMPONENTS = new Set(['Show', 'For', 'Fragment', 'Slot']); 5 | exports.DEFAULT_ANGULAR_OPTIONS = { 6 | preserveImports: false, 7 | preserveFileExtensions: false, 8 | }; 9 | -------------------------------------------------------------------------------- /dist/src/generators/context/react.d.ts: -------------------------------------------------------------------------------- 1 | import { MitosisContext } from '../../types/mitosis-context'; 2 | type ContextToReactOptions = { 3 | format?: boolean; 4 | preact?: boolean; 5 | typescript?: boolean; 6 | }; 7 | export declare const contextToReact: (options?: ContextToReactOptions) => ({ context }: { 8 | context: MitosisContext; 9 | }) => string; 10 | export {}; 11 | -------------------------------------------------------------------------------- /dist/src/generators/solid/blocks.d.ts: -------------------------------------------------------------------------------- 1 | import { MitosisComponent } from '../../types/mitosis-component'; 2 | import { MitosisNode } from '../../types/mitosis-node'; 3 | import { ToSolidOptions } from './types'; 4 | export declare const blockToSolid: ({ json, options, component, }: { 5 | json: MitosisNode; 6 | options: ToSolidOptions; 7 | component: MitosisComponent; 8 | }) => string; 9 | -------------------------------------------------------------------------------- /dist/src/generators/vue/optionsApi.d.ts: -------------------------------------------------------------------------------- 1 | import { BaseHook, MitosisComponent } from '../../types/mitosis-component'; 2 | import { ToVueOptions } from './types'; 3 | export declare function generateOptionsApiScript(component: MitosisComponent, options: ToVueOptions, path: string | undefined, template: string, props: string[], onUpdateWithDeps: BaseHook[], onUpdateWithoutDeps: BaseHook[]): string; 4 | -------------------------------------------------------------------------------- /dist/src/generators/html.d.ts: -------------------------------------------------------------------------------- 1 | import { BaseTranspilerOptions, TranspilerGenerator } from '../types/transpiler'; 2 | export interface ToHtmlOptions extends BaseTranspilerOptions { 3 | format?: 'class' | 'script'; 4 | prefix?: string; 5 | } 6 | export declare const componentToHtml: TranspilerGenerator; 7 | export declare const componentToCustomElement: TranspilerGenerator; 8 | -------------------------------------------------------------------------------- /dist/src/helpers/create-mitosis-component.d.ts: -------------------------------------------------------------------------------- 1 | import { MitosisComponent } from '../types/mitosis-component'; 2 | import { Overwrite, Prettify } from './typescript'; 3 | type PartialMitosisComponent = Prettify, { 4 | hooks: Partial; 5 | }>>; 6 | export declare const createMitosisComponent: (options?: PartialMitosisComponent) => MitosisComponent; 7 | export {}; 8 | -------------------------------------------------------------------------------- /dist/src/parsers/svelte/helpers/children.d.ts: -------------------------------------------------------------------------------- 1 | import type { TemplateNode } from 'svelte/types/compiler/interfaces'; 2 | import type { MitosisNode } from '../../../types/mitosis-node'; 3 | import type { SveltosisComponent } from '../types'; 4 | export declare function filterChildren(children: TemplateNode[]): TemplateNode[]; 5 | export declare function parseChildren(json: SveltosisComponent, node: TemplateNode): MitosisNode[]; 6 | -------------------------------------------------------------------------------- /dist/src/helpers/has.d.ts: -------------------------------------------------------------------------------- 1 | import { MitosisComponent } from '../types/mitosis-component'; 2 | import { MitosisNode } from '../types/mitosis-node'; 3 | /** 4 | * Test if the component has something 5 | * 6 | * e.g. 7 | * const hasSpread = has(component, node => some(node.bindings, { type: 'spread' })); 8 | */ 9 | export declare function has(json: MitosisComponent, test: (node: MitosisNode) => boolean): boolean; 10 | -------------------------------------------------------------------------------- /dist/src/parsers/jsx/imports.d.ts: -------------------------------------------------------------------------------- 1 | import * as babel from '@babel/core'; 2 | import { Context, ParseMitosisOptions } from './types'; 3 | declare const types: typeof babel.types; 4 | export declare const handleImportDeclaration: ({ options, path, context, }: { 5 | options: Partial; 6 | path: babel.NodePath; 7 | context: Context; 8 | }) => void; 9 | export {}; 10 | -------------------------------------------------------------------------------- /dist/src/parsers/svelte/html/index.d.ts: -------------------------------------------------------------------------------- 1 | import type { MitosisNode } from '../../../types/mitosis-node'; 2 | import type { Ast, TemplateNode } from 'svelte/types/compiler/interfaces'; 3 | import type { SveltosisComponent } from '../types'; 4 | export declare function parseHtml(ast: Ast, json: SveltosisComponent): void; 5 | export declare function parseHtmlNode(json: SveltosisComponent, node: TemplateNode): MitosisNode | undefined; 6 | -------------------------------------------------------------------------------- /dist/src/helpers/typescript-project.d.ts: -------------------------------------------------------------------------------- 1 | import { Project, SourceFile, Symbol } from 'ts-morph'; 2 | export declare const removeMitosisImport: (code: string) => string; 3 | export declare const getPropsSymbol: (ast: SourceFile) => Symbol | undefined; 4 | export declare const getContextSymbols: (ast: SourceFile) => Set; 5 | export declare const createTypescriptProject: (tsConfigFilePath: string) => { 6 | project: Project; 7 | }; 8 | -------------------------------------------------------------------------------- /dist/src/generators/angular/index.d.ts: -------------------------------------------------------------------------------- 1 | import { MitosisNode } from '../../types/mitosis-node'; 2 | import { TranspilerGenerator } from '../../types/transpiler'; 3 | import { AngularBlockOptions, ToAngularOptions } from './types'; 4 | export declare const blockToAngular: (json: MitosisNode, options?: ToAngularOptions, blockOptions?: AngularBlockOptions) => string; 5 | export declare const componentToAngular: TranspilerGenerator; 6 | -------------------------------------------------------------------------------- /dist/src/generators/qwik/helpers/styles.d.ts: -------------------------------------------------------------------------------- 1 | import { MitosisNode } from '../../..'; 2 | import { SrcBuilder } from '../src-generator'; 3 | export type CssStyles = { 4 | CLASS_NAME: string; 5 | } & Record; 6 | export declare function collectStyles(children: MitosisNode[], styleMap: Map): Map; 7 | export declare function renderStyles(styles: Map): (this: SrcBuilder) => void; 8 | -------------------------------------------------------------------------------- /dist/src/generators/vue/types.d.ts: -------------------------------------------------------------------------------- 1 | import { BaseTranspilerOptions } from '../../types/transpiler'; 2 | export type Api = 'options' | 'composition'; 3 | export interface ToVueOptions extends BaseTranspilerOptions { 4 | cssNamespace?: () => string; 5 | namePrefix?: (path: string) => string; 6 | asyncComponentImports?: boolean; 7 | defineComponent?: boolean; 8 | api: Api; 9 | convertClassStringToObject?: boolean; 10 | } 11 | -------------------------------------------------------------------------------- /dist/src/helpers/typescript.d.ts: -------------------------------------------------------------------------------- 1 | export type Overwrite = keyof U extends keyof T ? Pick> & U : never; 2 | export type Prettify = { 3 | [K in keyof T]: T[K]; 4 | } & {}; 5 | export type OmitObj = T extends U ? Omit : never; 6 | export type Dictionary = { 7 | [key: string]: T; 8 | }; 9 | export declare const objectHasKey: (object: T, key: PropertyKey) => key is keyof T; 10 | -------------------------------------------------------------------------------- /dist/src/parsers/jsx/function-parser.d.ts: -------------------------------------------------------------------------------- 1 | import * as babel from '@babel/core'; 2 | import { JSONOrNode } from '../../types/json'; 3 | import { Context } from './types'; 4 | declare const types: typeof babel.types; 5 | /** 6 | * Parses function declarations within the Mitosis copmonent's body to JSON 7 | */ 8 | export declare const componentFunctionToJson: (node: babel.types.FunctionDeclaration, context: Context) => JSONOrNode; 9 | export {}; 10 | -------------------------------------------------------------------------------- /dist/src/parsers/svelte/instance/hooks.d.ts: -------------------------------------------------------------------------------- 1 | import type { ExpressionStatement } from 'estree'; 2 | import type { SveltosisComponent } from '../types'; 3 | export declare function parseOnMount(json: SveltosisComponent, node: ExpressionStatement): void; 4 | export declare function parseOnDestroy(json: SveltosisComponent, node: ExpressionStatement): void; 5 | export declare function parseAfterUpdate(json: SveltosisComponent, node: ExpressionStatement): void; 6 | -------------------------------------------------------------------------------- /dist/src/generators/alpine/render-update-hooks.d.ts: -------------------------------------------------------------------------------- 1 | import { MitosisComponent } from '../../types/mitosis-component'; 2 | export declare function hasRootUpdateHook(json: MitosisComponent): boolean; 3 | export declare const renderUpdateHooks: import("lodash").CurriedFunction2; 4 | export declare const hasWatchHooks: (json: MitosisComponent) => boolean; 5 | export declare const renderWatchHooks: (json: MitosisComponent) => string; 6 | -------------------------------------------------------------------------------- /dist/src/generators/context/rsc.d.ts: -------------------------------------------------------------------------------- 1 | import { MitosisContext } from '../../types/mitosis-context'; 2 | type ContextToRscOptions = { 3 | format?: boolean; 4 | }; 5 | /** 6 | * React Server Components currently do not support context, so we use 7 | * plain objects and prop drilling instead. 8 | */ 9 | export declare const contextToRsc: (options?: ContextToRscOptions) => ({ context }: { 10 | context: MitosisContext; 11 | }) => string; 12 | export {}; 13 | -------------------------------------------------------------------------------- /dist/src/parsers/jsx/element-parser.d.ts: -------------------------------------------------------------------------------- 1 | import * as babel from '@babel/core'; 2 | import { MitosisNode } from '../../types/mitosis-node'; 3 | declare const types: typeof babel.types; 4 | /** 5 | * Parses a JSX element into a MitosisNode. 6 | */ 7 | export declare const jsxElementToJson: (node: babel.types.JSXElement | babel.types.JSXText | babel.types.JSXFragment | babel.types.JSXExpressionContainer | babel.types.JSXSpreadChild) => MitosisNode | null; 8 | export {}; 9 | -------------------------------------------------------------------------------- /dist/src/generators/context/svelte.d.ts: -------------------------------------------------------------------------------- 1 | import { MitosisContext } from '../../types/mitosis-context'; 2 | import { BaseTranspilerOptions } from '../../types/transpiler'; 3 | interface ContextToSvelteOptions extends Pick { 4 | } 5 | /** 6 | * TO-DO: support types 7 | */ 8 | export declare const contextToSvelte: (options: ContextToSvelteOptions) => ({ context }: { 9 | context: MitosisContext; 10 | }) => string; 11 | export {}; 12 | -------------------------------------------------------------------------------- /dist/src/generators/solid/state/state.d.ts: -------------------------------------------------------------------------------- 1 | import { MitosisComponent } from '../../../types/mitosis-component'; 2 | import { ToSolidOptions } from '../types'; 3 | type State = { 4 | str: string; 5 | import: { 6 | store?: string[]; 7 | solidjs?: string[]; 8 | }; 9 | }; 10 | export declare const getState: ({ json, options, }: { 11 | json: MitosisComponent; 12 | options: ToSolidOptions; 13 | }) => State | undefined; 14 | export {}; 15 | -------------------------------------------------------------------------------- /dist/src/generators/svelte/blocks.d.ts: -------------------------------------------------------------------------------- 1 | import { MitosisComponent } from '../../types/mitosis-component'; 2 | import { BaseNode, MitosisNode } from '../../types/mitosis-node'; 3 | import { ToSvelteOptions } from './types'; 4 | type BlockToSvelte = (props: { 5 | json: T; 6 | options: ToSvelteOptions; 7 | parentComponent: MitosisComponent; 8 | }) => string; 9 | export declare const blockToSvelte: BlockToSvelte; 10 | export {}; 11 | -------------------------------------------------------------------------------- /dist/src/helpers/parsers.d.ts: -------------------------------------------------------------------------------- 1 | import * as babel from '@babel/core'; 2 | export declare function parseCode(code: string): babel.types.Statement[]; 3 | export declare const isCodeBodyExpression: (body: babel.types.Statement[]) => boolean; 4 | /** 5 | * Returns `true` if the `code` is a valid expression. (vs a statement) 6 | */ 7 | export declare function isExpression(code: string): boolean; 8 | export declare const isCodeBodyIdentifier: (body: babel.types.Statement[]) => boolean; 9 | -------------------------------------------------------------------------------- /dist/src/types/plugins.d.ts: -------------------------------------------------------------------------------- 1 | import { MitosisComponent } from './mitosis-component'; 2 | export type Plugin = (options?: any) => { 3 | json?: { 4 | pre?: (json: MitosisComponent) => MitosisComponent | void; 5 | post?: (json: MitosisComponent) => MitosisComponent | void; 6 | }; 7 | code?: { 8 | pre?: (code: string, json: MitosisComponent) => string; 9 | post?: (code: string, json: MitosisComponent) => string; 10 | }; 11 | }; 12 | -------------------------------------------------------------------------------- /dist/src/parsers/svelte/instance/context.d.ts: -------------------------------------------------------------------------------- 1 | import type { ExpressionStatement, VariableDeclaration } from 'estree'; 2 | import type { SveltosisComponent } from '../types'; 3 | export declare function parseGetContext(json: SveltosisComponent, node: VariableDeclaration): void; 4 | export declare function parseHasContext(json: SveltosisComponent, node: VariableDeclaration): void; 5 | export declare function parseSetContext(json: SveltosisComponent, node: ExpressionStatement): void; 6 | -------------------------------------------------------------------------------- /dist/src/parsers/jsx/types.d.ts: -------------------------------------------------------------------------------- 1 | import { Project } from 'ts-morph'; 2 | import { MitosisComponent } from '../../types/mitosis-component'; 3 | export type ParseMitosisOptions = { 4 | jsonHookNames?: string[]; 5 | compileAwayPackages?: string[]; 6 | typescript: boolean; 7 | tsProject?: { 8 | project: Project; 9 | }; 10 | filePath?: string; 11 | }; 12 | export type Context = { 13 | builder: { 14 | component: MitosisComponent; 15 | }; 16 | }; 17 | -------------------------------------------------------------------------------- /dist/src/parsers/svelte/helpers/mitosis-node.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | exports.createMitosisNode = void 0; 4 | function createMitosisNode() { 5 | return { 6 | '@type': '@builder.io/mitosis/node', 7 | name: '', 8 | meta: {}, 9 | scope: {}, 10 | children: [], 11 | bindings: {}, 12 | properties: {}, 13 | }; 14 | } 15 | exports.createMitosisNode = createMitosisNode; 16 | -------------------------------------------------------------------------------- /dist/src/parsers/svelte/instance/statements.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | exports.parseStatementAtProgramLevel = void 0; 4 | var astring_1 = require("astring"); 5 | var hooks_1 = require("../helpers/hooks"); 6 | function parseStatementAtProgramLevel(json, node) { 7 | var statement = (0, astring_1.generate)(node); 8 | (0, hooks_1.addToOnInitHook)(json, statement); 9 | } 10 | exports.parseStatementAtProgramLevel = parseStatementAtProgramLevel; 11 | -------------------------------------------------------------------------------- /dist/src/plugins/map-styles.d.ts: -------------------------------------------------------------------------------- 1 | import { TraverseContext } from 'traverse'; 2 | import { MitosisComponent } from '../types/mitosis-component'; 3 | import { MitosisStyles } from '../types/mitosis-styles'; 4 | type MapStylesOptions = { 5 | map: (styles: MitosisStyles, context: TraverseContext) => MitosisStyles; 6 | }; 7 | export declare const mapStyles: (pluginOptions: MapStylesOptions) => (options: any) => { 8 | json: { 9 | pre: (json: MitosisComponent) => void; 10 | }; 11 | }; 12 | export {}; 13 | -------------------------------------------------------------------------------- /dist/src/helpers/plugins/process-code/types.d.ts: -------------------------------------------------------------------------------- 1 | import { MitosisComponent } from '../../../types/mitosis-component'; 2 | import { MitosisNode } from '../../../types/mitosis-node'; 3 | export type CodeType = 'hooks' | 'hooks-deps' | 'bindings' | 'properties' | 'state' | 'types' | 'context-set' | 'dynamic-jsx-elements'; 4 | declare function codeProcessor(codeType: CodeType, json: MitosisComponent, node?: MitosisNode): (code: string, hookType: string) => string | (() => void); 5 | export type CodeProcessor = typeof codeProcessor; 6 | export {}; 7 | -------------------------------------------------------------------------------- /dist/src/parsers/svelte/helpers/hooks.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | exports.addToOnInitHook = void 0; 4 | function addToOnInitHook(json, code) { 5 | var _a; 6 | if ((_a = json.hooks.onInit) === null || _a === void 0 ? void 0 : _a.code.length) { 7 | json.hooks.onInit.code += "\n ".concat(code); 8 | } 9 | else { 10 | json.hooks.onInit = { 11 | code: code, 12 | }; 13 | } 14 | } 15 | exports.addToOnInitHook = addToOnInitHook; 16 | -------------------------------------------------------------------------------- /dist/src/parsers/svelte/typescript/index.d.ts: -------------------------------------------------------------------------------- 1 | import type { SveltosisComponent } from '../types'; 2 | export declare function isTypeScriptComponent(string_: string): boolean; 3 | /** Create a tag matching regexp. */ 4 | export declare function createTagRegex(tagName: string, flags?: string): RegExp; 5 | /** Transform an attribute string into a key-value object */ 6 | export declare function parseAttributes(attributesString: string): Record; 7 | export declare function collectTypes(string_: string, json: SveltosisComponent): void; 8 | -------------------------------------------------------------------------------- /dist/src/helpers/filter-empty-text-nodes.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | exports.filterEmptyTextNodes = exports.isEmptyTextNode = void 0; 4 | var isEmptyTextNode = function (node) { 5 | return typeof node.properties._text === 'string' && node.properties._text.trim().length === 0; 6 | }; 7 | exports.isEmptyTextNode = isEmptyTextNode; 8 | var filterEmptyTextNodes = function (node) { return !(0, exports.isEmptyTextNode)(node); }; 9 | exports.filterEmptyTextNodes = filterEmptyTextNodes; 10 | -------------------------------------------------------------------------------- /dist/src/helpers/is-root-text-node.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | exports.isTextNode = exports.isRootTextNode = void 0; 4 | function isRootTextNode(json) { 5 | var firstChild = json.children[0]; 6 | return Boolean(json.children.length === 1 && firstChild && isTextNode(firstChild)); 7 | } 8 | exports.isRootTextNode = isRootTextNode; 9 | function isTextNode(node) { 10 | return Boolean(node.properties._text || node.bindings._text); 11 | } 12 | exports.isTextNode = isTextNode; 13 | -------------------------------------------------------------------------------- /dist/src/helpers/patterns.d.ts: -------------------------------------------------------------------------------- 1 | export declare const GETTER: RegExp; 2 | export declare const SETTER: RegExp; 3 | export declare const checkIsGetter: (code: string) => RegExpMatchArray | null; 4 | export declare const stripGetter: (str: string) => string; 5 | export declare const replaceGetterWithFunction: (str: string) => string; 6 | export declare const replaceFunctionWithGetter: (str: string) => string; 7 | export declare const extractGetterCodeBlock: (getter: string) => string; 8 | export declare const prefixWithFunction: (str: string) => string; 9 | -------------------------------------------------------------------------------- /dist/src/helpers/get-custom-imports.d.ts: -------------------------------------------------------------------------------- 1 | import { MitosisComponent } from '../types/mitosis-component'; 2 | /** 3 | * Return custom imports of basic values (aka things 4 | * that are not ClassCase like components and types) 5 | * 6 | * For for code like: 7 | * import { foo, bar } from './constants' 8 | * 9 | * Will return: 10 | * ['foo', 'bar' ] 11 | * 12 | * This also filters for strings that appears to be actually used 13 | * by the template 14 | */ 15 | export declare function getCustomImports(json: MitosisComponent): string[]; 16 | -------------------------------------------------------------------------------- /dist/src/parsers/jsx/jsx.d.ts: -------------------------------------------------------------------------------- 1 | import { MitosisComponent } from '../../types/mitosis-component'; 2 | import { ParseMitosisOptions } from './types'; 3 | /** 4 | * This function takes the raw string from a Mitosis component, and converts it into a JSON that can be processed by 5 | * each generator function. 6 | * 7 | * @param jsx string representation of the Mitosis component 8 | * @returns A JSON representation of the Mitosis component 9 | */ 10 | export declare function parseJsx(jsx: string, _options?: Partial): MitosisComponent; 11 | -------------------------------------------------------------------------------- /dist/src/parsers/svelte/instance/expressions.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | exports.parseMemberExpression = void 0; 4 | var astring_1 = require("astring"); 5 | var hooks_1 = require("../helpers/hooks"); 6 | function parseMemberExpression(json, node, parent) { 7 | if ((parent === null || parent === void 0 ? void 0 : parent.type) === 'Program') { 8 | (0, hooks_1.addToOnInitHook)(json, (0, astring_1.generate)(node)); 9 | } 10 | } 11 | exports.parseMemberExpression = parseMemberExpression; 12 | -------------------------------------------------------------------------------- /dist/src/generators/helpers/context.d.ts: -------------------------------------------------------------------------------- 1 | import { ContextGetInfo, ContextSetInfo, MitosisComponent, ReactivityType } from '../../types/mitosis-component'; 2 | export declare const hasContext: (component: MitosisComponent) => boolean; 3 | export declare const hasSetContext: (component: MitosisComponent) => boolean; 4 | export declare const hasGetContext: (component: MitosisComponent) => boolean; 5 | export declare const getContextType: ({ component, context, }: { 6 | component: MitosisComponent; 7 | context: ContextGetInfo | ContextSetInfo; 8 | }) => ReactivityType; 9 | -------------------------------------------------------------------------------- /dist/src/helpers/transform-state-setters.d.ts: -------------------------------------------------------------------------------- 1 | import { types } from '@babel/core'; 2 | type StateSetterTransformer = ({ path, propertyName, }: { 3 | path: babel.NodePath; 4 | propertyName: string; 5 | }) => types.CallExpression; 6 | /** 7 | * Finds instances of state being set in `value`, and transforms them using the 8 | * provided `transformer`. 9 | */ 10 | export declare const transformStateSetters: ({ value, transformer, }: { 11 | value: string; 12 | transformer: StateSetterTransformer; 13 | }) => string; 14 | export {}; 15 | -------------------------------------------------------------------------------- /dist/src/parsers/jsx/helpers.d.ts: -------------------------------------------------------------------------------- 1 | import * as babel from '@babel/core'; 2 | declare const types: typeof babel.types; 3 | export declare const uncapitalize: (str: string) => string; 4 | export declare const parseCode: (node: babel.types.Node) => string; 5 | export declare const parseCodeJson: (node: babel.types.Node) => any; 6 | export declare const isImportOrDefaultExport: (node: babel.Node) => boolean; 7 | export declare const HTML_ATTR_FROM_JSX: { 8 | htmlFor: string; 9 | }; 10 | export declare const transformAttributeName: (name: string) => string; 11 | export {}; 12 | -------------------------------------------------------------------------------- /dist/src/types/json.d.ts: -------------------------------------------------------------------------------- 1 | export type JSONPrimitive = string | null | number | boolean | undefined; 2 | export type JSONObject = { 3 | [key: string]: _JSON | undefined; 4 | }; 5 | /** 6 | * We use an underscore to avoid collisions with the global `JSON` primitive type. 7 | */ 8 | export type _JSON = JSONPrimitive | JSONObject | _JSON[]; 9 | export type JSONPrimitiveOrNode = JSONPrimitive | babel.Node; 10 | export type JSONOrNodeObject = { 11 | [key: string]: JSONOrNode; 12 | }; 13 | export type JSONOrNode = JSONPrimitiveOrNode | JSONOrNodeObject | JSONOrNode[]; 14 | -------------------------------------------------------------------------------- /dist/src/constants/hooks.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | exports.HOOKS = void 0; 4 | exports.HOOKS = { 5 | STORE: 'useStore', 6 | STATE: 'useState', 7 | CONTEXT: 'useContext', 8 | REF: 'useRef', 9 | DEFAULT_PROPS: 'useDefaultProps', 10 | STYLE: 'useStyle', 11 | TARGET: 'useTarget', 12 | METADATA: 'useMetadata', 13 | MOUNT: 'onMount', 14 | EVENT: 'onEvent', 15 | UNMOUNT: 'onUnMount', 16 | UPDATE: 'onUpdate', 17 | INIT: 'onInit', 18 | SET_CONTEXT: 'setContext', 19 | }; 20 | -------------------------------------------------------------------------------- /dist/src/generators/liquid.d.ts: -------------------------------------------------------------------------------- 1 | import { BaseTranspilerOptions, TranspilerGenerator } from '../types/transpiler'; 2 | export interface ToLiquidOptions extends BaseTranspilerOptions { 3 | reactive?: boolean; 4 | } 5 | /** 6 | * Test if the binding expression would be likely to generate 7 | * valid or invalid liquid. If we generate invalid liquid tags 8 | * Shopify will reject our PUT to update the template 9 | */ 10 | export declare const isValidLiquidBinding: (str?: string) => boolean; 11 | export declare const componentToLiquid: TranspilerGenerator; 12 | -------------------------------------------------------------------------------- /dist/src/generators/react/state.d.ts: -------------------------------------------------------------------------------- 1 | import { MitosisComponent } from '../../types/mitosis-component'; 2 | import { ToReactOptions } from './types'; 3 | export declare const processHookCode: ({ str, options }: { 4 | str: string; 5 | options: ToReactOptions; 6 | }) => string; 7 | export declare const getUseStateCode: (json: MitosisComponent, options: ToReactOptions) => string; 8 | export declare const updateStateSetters: (json: MitosisComponent, options: ToReactOptions) => void; 9 | export declare const updateStateSettersInCode: (value: string, options: ToReactOptions) => string; 10 | -------------------------------------------------------------------------------- /dist/src/generators/taro.d.ts: -------------------------------------------------------------------------------- 1 | import { ClassStyleMap } from '../helpers/styles/helpers'; 2 | import { MitosisComponent } from '../types/mitosis-component'; 3 | import { TranspilerGenerator } from '../types/transpiler'; 4 | import { ToReactOptions } from './react'; 5 | export declare const DEFAULT_Component_SET: Set; 6 | export type ToTaroOptions = ToReactOptions; 7 | export declare const collectTaroStyles: (json: MitosisComponent) => ClassStyleMap; 8 | export declare const TagMap: Record; 9 | export declare const componentToTaro: TranspilerGenerator>; 10 | -------------------------------------------------------------------------------- /dist/src/constants/hooks.d.ts: -------------------------------------------------------------------------------- 1 | export declare const HOOKS: { 2 | readonly STORE: "useStore"; 3 | readonly STATE: "useState"; 4 | readonly CONTEXT: "useContext"; 5 | readonly REF: "useRef"; 6 | readonly DEFAULT_PROPS: "useDefaultProps"; 7 | readonly STYLE: "useStyle"; 8 | readonly TARGET: "useTarget"; 9 | readonly METADATA: "useMetadata"; 10 | readonly MOUNT: "onMount"; 11 | readonly EVENT: "onEvent"; 12 | readonly UNMOUNT: "onUnMount"; 13 | readonly UPDATE: "onUpdate"; 14 | readonly INIT: "onInit"; 15 | readonly SET_CONTEXT: "setContext"; 16 | }; 17 | -------------------------------------------------------------------------------- /dist/src/generators/angular/types.d.ts: -------------------------------------------------------------------------------- 1 | import { BaseTranspilerOptions } from '../../types/transpiler'; 2 | export declare const BUILT_IN_COMPONENTS: Set; 3 | export interface ToAngularOptions extends BaseTranspilerOptions { 4 | standalone?: boolean; 5 | preserveImports?: boolean; 6 | preserveFileExtensions?: boolean; 7 | importMapper?: Function; 8 | bootstrapMapper?: Function; 9 | } 10 | export declare const DEFAULT_ANGULAR_OPTIONS: ToAngularOptions; 11 | export interface AngularBlockOptions { 12 | childComponents?: string[]; 13 | nativeAttributes: string[]; 14 | } 15 | -------------------------------------------------------------------------------- /dist/src/helpers/output.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | exports.checkShouldOutputTypeScript = void 0; 4 | var nullable_1 = require("./nullable"); 5 | var checkShouldOutputTypeScript = function (_a) { 6 | var _b; 7 | var target = _a.target, options = _a.options; 8 | var targetTsConfig = (_b = options.options[target]) === null || _b === void 0 ? void 0 : _b.typescript; 9 | return (0, nullable_1.checkIsDefined)(targetTsConfig) ? targetTsConfig : false; 10 | }; 11 | exports.checkShouldOutputTypeScript = checkShouldOutputTypeScript; 12 | -------------------------------------------------------------------------------- /dist/src/helpers/handle-missing-state.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | exports.handleMissingState = void 0; 4 | var get_state_used_1 = require("./get-state-used"); 5 | function handleMissingState(json) { 6 | var stateUsed = (0, get_state_used_1.getStateUsed)(json); 7 | Array.from(stateUsed).forEach(function (property) { 8 | if (!(property in json.state)) { 9 | json.state[property] = { code: 'null', type: 'property', propertyType: 'normal' }; 10 | } 11 | }); 12 | } 13 | exports.handleMissingState = handleMissingState; 14 | -------------------------------------------------------------------------------- /dist/src/parsers/jsx/state.d.ts: -------------------------------------------------------------------------------- 1 | import * as babel from '@babel/core'; 2 | import { MitosisComponent, MitosisState } from '../../types/mitosis-component'; 3 | declare const types: typeof babel.types; 4 | /** 5 | * Convert state identifiers from React hooks format to the state.* format Mitosis needs 6 | * e.g. 7 | * text -> state.text 8 | * setText(...) -> state.text = ... 9 | */ 10 | export declare function mapStateIdentifiers(json: MitosisComponent): void; 11 | export declare const parseStateObjectToMitosisState: (object: babel.types.ObjectExpression, isState?: boolean) => MitosisState; 12 | export {}; 13 | -------------------------------------------------------------------------------- /dist/src/helpers/get-bindings.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | exports.getBindingsCode = void 0; 4 | function getBindingsCode(children) { 5 | var bindings = []; 6 | children.forEach(function (child) { 7 | Object.values(child.bindings || []).forEach(function (binding) { 8 | bindings.push(binding.code); 9 | }); 10 | if (child.children) { 11 | bindings.push.apply(bindings, getBindingsCode(child.children)); 12 | } 13 | }); 14 | return bindings; 15 | } 16 | exports.getBindingsCode = getBindingsCode; 17 | -------------------------------------------------------------------------------- /dist/src/helpers/nodes/for.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | exports.getForArguments = void 0; 4 | var nullable_1 = require("../nullable"); 5 | var getForArguments = function (node, _a) { 6 | var _b = _a === void 0 ? { excludeCollectionName: false } : _a, excludeCollectionName = _b.excludeCollectionName; 7 | return [ 8 | node.scope.forName || 'item', 9 | node.scope.indexName, 10 | excludeCollectionName ? undefined : node.scope.collectionName, 11 | ].filter(nullable_1.checkIsDefined); 12 | }; 13 | exports.getForArguments = getForArguments; 14 | -------------------------------------------------------------------------------- /dist/src/constants/media-sizes.d.ts: -------------------------------------------------------------------------------- 1 | export type Size = 'large' | 'medium' | 'small'; 2 | export declare const sizeNames: Size[]; 3 | export declare const sizes: { 4 | small: { 5 | min: number; 6 | default: number; 7 | max: number; 8 | }; 9 | medium: { 10 | min: number; 11 | default: number; 12 | max: number; 13 | }; 14 | large: { 15 | min: number; 16 | default: number; 17 | max: number; 18 | }; 19 | getWidthForSize(size: Size): number; 20 | getSizeForWidth(width: number): Size; 21 | }; 22 | export declare const mediaQueryRegex: RegExp; 23 | -------------------------------------------------------------------------------- /dist/src/helpers/json.js: -------------------------------------------------------------------------------- 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.tryParseJson = void 0; 7 | var json5_1 = __importDefault(require("json5")); 8 | var tryParseJson = function (jsonStr) { 9 | try { 10 | return json5_1.default.parse(jsonStr); 11 | } 12 | catch (err) { 13 | console.error('Could not JSON5 parse object:\n', jsonStr); 14 | throw err; 15 | } 16 | }; 17 | exports.tryParseJson = tryParseJson; 18 | -------------------------------------------------------------------------------- /dist/src/helpers/trace-reference-to-module-path.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | exports.traceReferenceToModulePath = void 0; 4 | function traceReferenceToModulePath(imports, name) { 5 | var response = null; 6 | for (var _i = 0, imports_1 = imports; _i < imports_1.length; _i++) { 7 | var importInfo = imports_1[_i]; 8 | if (name in importInfo.imports) { 9 | return "".concat(importInfo.path, ":").concat(importInfo.imports[name]); 10 | } 11 | } 12 | return response; 13 | } 14 | exports.traceReferenceToModulePath = traceReferenceToModulePath; 15 | -------------------------------------------------------------------------------- /dist/src/generators/react-native/index.d.ts: -------------------------------------------------------------------------------- 1 | import { ClassStyleMap } from '../../helpers/styles/helpers'; 2 | import { MitosisComponent } from '../../types/mitosis-component'; 3 | import { BaseTranspilerOptions, TranspilerGenerator } from '../../types/transpiler'; 4 | export interface ToReactNativeOptions extends BaseTranspilerOptions { 5 | stylesType: 'emotion' | 'react-native'; 6 | stateType: 'useState' | 'mobx' | 'valtio' | 'solid' | 'builder'; 7 | } 8 | export declare const collectReactNativeStyles: (json: MitosisComponent) => ClassStyleMap; 9 | export declare const componentToReactNative: TranspilerGenerator>; 10 | -------------------------------------------------------------------------------- /dist/src/helpers/babel-transform.d.ts: -------------------------------------------------------------------------------- 1 | import * as babel from '@babel/core'; 2 | import type { Visitor } from '@babel/traverse'; 3 | export declare const babelTransformCode: (code: string, visitor?: babel.Visitor | undefined, stripTypes?: boolean) => string; 4 | type ExpressionType = 'expression' | 'unknown' | 'block' | 'functionBody'; 5 | export declare const babelTransformExpression: (code: string, visitor: babel.Visitor, initialType?: ExpressionType, stripTypes?: boolean) => string; 6 | export declare const convertTypeScriptToJS: (code: string) => string; 7 | export {}; 8 | -------------------------------------------------------------------------------- /dist/src/helpers/parse-node.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | exports.parseNodes = exports.parseNode = void 0; 4 | var jsx_1 = require("../parsers/jsx"); 5 | var parseNode = function (str) { 6 | return (0, jsx_1.parseJsx)("\n export default function MyComponent() {\n return (".concat(str, ")\n }\n ")).children[0]; 7 | }; 8 | exports.parseNode = parseNode; 9 | var parseNodes = function (str) { 10 | return (0, jsx_1.parseJsx)("\n export default function MyComponent() {\n return (<>".concat(str, ")\n }\n ")).children[0].children; 11 | }; 12 | exports.parseNodes = parseNodes; 13 | -------------------------------------------------------------------------------- /dist/src/generators/mitosis.d.ts: -------------------------------------------------------------------------------- 1 | import { MitosisComponent } from '../types/mitosis-component'; 2 | import { MitosisNode } from '../types/mitosis-node'; 3 | import { BaseTranspilerOptions, TranspilerGenerator } from '../types/transpiler'; 4 | export interface ToMitosisOptions extends BaseTranspilerOptions { 5 | format: 'react' | 'legacy'; 6 | } 7 | export declare const DEFAULT_FORMAT: ToMitosisOptions['format']; 8 | export declare const blockToMitosis: (json: MitosisNode, toMitosisOptions: Partial | undefined, component: MitosisComponent) => string; 9 | export declare const componentToMitosis: TranspilerGenerator>; 10 | -------------------------------------------------------------------------------- /dist/src/helpers/camel-case.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | exports.camelCase = void 0; 4 | var 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 | if (text === void 0) { text = ''; } 14 | var parts = text.split('-'); 15 | var first = parts.shift(); 16 | return first + parts.map(capitalize_1.capitalize).join(''); 17 | } 18 | exports.camelCase = camelCase; 19 | -------------------------------------------------------------------------------- /dist/src/helpers/on-event.d.ts: -------------------------------------------------------------------------------- 1 | import { MitosisComponent, MitosisNode, OnEventHook, Plugin } from '..'; 2 | export declare const getOnEventHandlerName: (hook: OnEventHook) => string; 3 | export declare const getOnEventHooksForNode: ({ node, component, }: { 4 | node: MitosisNode; 5 | component: MitosisComponent; 6 | }) => OnEventHook[]; 7 | /** 8 | * Adds event handlers from `onEvent` hooks to the appropriate node's bindings. 9 | * Only works with frameworks that support custom events in their templates. 10 | */ 11 | export declare const processOnEventHooksPlugin: (args?: { 12 | setBindings?: boolean; 13 | includeRootEvents?: boolean; 14 | }) => Plugin; 15 | -------------------------------------------------------------------------------- /dist/src/generators/solid/state/helpers.d.ts: -------------------------------------------------------------------------------- 1 | import { MitosisComponent } from '../../../types/mitosis-component'; 2 | import { ToSolidOptions } from '../types'; 3 | export declare const getStateSetterName: (stateName: string) => string; 4 | export declare const getStateTypeForValue: ({ value, component, options, }: { 5 | value: string; 6 | component: MitosisComponent; 7 | options: ToSolidOptions; 8 | }) => import("../types").SolidState; 9 | export declare const updateStateCode: ({ options, component, updateSetters, }: { 10 | options: ToSolidOptions; 11 | component: MitosisComponent; 12 | updateSetters?: boolean | undefined; 13 | }) => (value: string) => string; 14 | -------------------------------------------------------------------------------- /dist/src/generators/builder.d.ts: -------------------------------------------------------------------------------- 1 | import { BuilderContent, BuilderElement } from '@builder.io/sdk'; 2 | import { MitosisNode } from '../types/mitosis-node'; 3 | import { BaseTranspilerOptions, TranspilerArgs } from '../types/transpiler'; 4 | export interface ToBuilderOptions extends BaseTranspilerOptions { 5 | includeIds?: boolean; 6 | } 7 | type InternalOptions = { 8 | skipMapper?: boolean; 9 | }; 10 | export declare const blockToBuilder: (json: MitosisNode, options?: ToBuilderOptions, _internalOptions?: InternalOptions) => BuilderElement; 11 | export declare const componentToBuilder: (options?: ToBuilderOptions) => ({ component }: TranspilerArgs) => BuilderContent; 12 | export {}; 13 | -------------------------------------------------------------------------------- /dist/src/helpers/traverse-nodes.js: -------------------------------------------------------------------------------- 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.traverseNodes = void 0; 7 | var traverse_1 = __importDefault(require("traverse")); 8 | var is_mitosis_node_1 = require("./is-mitosis-node"); 9 | function traverseNodes(component, cb) { 10 | (0, traverse_1.default)(component).forEach(function (item) { 11 | if ((0, is_mitosis_node_1.isMitosisNode)(item)) { 12 | cb(item, this); 13 | } 14 | }); 15 | } 16 | exports.traverseNodes = traverseNodes; 17 | -------------------------------------------------------------------------------- /dist/src/generators/react/helpers.d.ts: -------------------------------------------------------------------------------- 1 | import { MitosisComponent } from '../../types/mitosis-component'; 2 | import { MitosisNode } from '../../types/mitosis-node'; 3 | import { ToReactOptions } from './types'; 4 | export declare const processBinding: (str: string, options: ToReactOptions) => string; 5 | export declare const openFrag: (options: ToReactOptions) => string; 6 | export declare const closeFrag: (options: ToReactOptions) => string; 7 | export declare function getFragment(type: 'open' | 'close', options: ToReactOptions): string; 8 | export declare const wrapInFragment: (json: MitosisComponent | MitosisNode) => boolean; 9 | export declare function processTagReferences(json: MitosisComponent, options: ToReactOptions): void; 10 | -------------------------------------------------------------------------------- /dist/src/helpers/is-children.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | exports.getTextValue = void 0; 4 | var getTextValue = function (node) { 5 | var _a; 6 | var textValue = ((_a = node.bindings._text) === null || _a === void 0 ? void 0 : _a.code) || node.properties.__text || ''; 7 | return textValue.replace(/\s+/g, ''); 8 | }; 9 | exports.getTextValue = getTextValue; 10 | function isChildren(_a) { 11 | var node = _a.node, _b = _a.extraMatches, extraMatches = _b === void 0 ? [] : _b; 12 | var textValue = (0, exports.getTextValue)(node); 13 | return ['props.children', 'children'].concat(extraMatches).includes(textValue); 14 | } 15 | exports.default = isChildren; 16 | -------------------------------------------------------------------------------- /dist/src/parsers/svelte/helpers/post-process.d.ts: -------------------------------------------------------------------------------- 1 | import type { StateValue } from '../../../types/mitosis-component'; 2 | import type { SveltosisComponent } from '../types'; 3 | type SveltosisStateValue = StateValue & { 4 | arguments?: string[]; 5 | type: string; 6 | }; 7 | export declare function preventNameCollissions(json: SveltosisComponent, item: SveltosisStateValue): { 8 | code: string; 9 | typeParameter?: string | undefined; 10 | type: "function" | "getter" | "method" | "property"; 11 | propertyType?: import("../../../types/mitosis-component").ReactivityType | undefined; 12 | arguments?: string[] | undefined; 13 | }; 14 | export declare function postProcess(json: SveltosisComponent): void; 15 | export {}; 16 | -------------------------------------------------------------------------------- /dist/src/helpers/bindings.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | var __assign = (this && this.__assign) || function () { 3 | __assign = Object.assign || function(t) { 4 | for (var s, i = 1, n = arguments.length; i < n; i++) { 5 | s = arguments[i]; 6 | for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) 7 | t[p] = s[p]; 8 | } 9 | return t; 10 | }; 11 | return __assign.apply(this, arguments); 12 | }; 13 | Object.defineProperty(exports, "__esModule", { value: true }); 14 | exports.createSingleBinding = void 0; 15 | var createSingleBinding = function (args) { return (__assign(__assign({}, args), { type: 'single' })); }; 16 | exports.createSingleBinding = createSingleBinding; 17 | -------------------------------------------------------------------------------- /dist/src/parsers/jsx/component-types.d.ts: -------------------------------------------------------------------------------- 1 | import * as babel from '@babel/core'; 2 | import { Context } from './types'; 3 | declare const types: typeof babel.types; 4 | export declare const getPropsTypeRef: (node: babel.types.FunctionDeclaration, context: Context) => string | undefined; 5 | export declare const isTypeOrInterface: (node: babel.Node) => boolean; 6 | import { NodePath as BabelTraverseNodePath } from '@babel/traverse'; 7 | export declare const collectTypes: (path: BabelTraverseNodePath | BabelTraverseNodePath | BabelTraverseNodePath | BabelTraverseNodePath, context: Context) => void; 8 | export {}; 9 | -------------------------------------------------------------------------------- /dist/src/plugins/map-styles.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | exports.mapStyles = void 0; 4 | var get_styles_1 = require("../helpers/get-styles"); 5 | var traverse_nodes_1 = require("../helpers/traverse-nodes"); 6 | var mapStyles = function (pluginOptions) { return function (options) { return ({ 7 | json: { 8 | pre: function (json) { 9 | (0, traverse_nodes_1.traverseNodes)(json, function (node, context) { 10 | var styles = (0, get_styles_1.getStyles)(node); 11 | (0, get_styles_1.setStyles)(node, pluginOptions.map(styles || {}, context)); 12 | }); 13 | }, 14 | }, 15 | }); }; }; 16 | exports.mapStyles = mapStyles; 17 | -------------------------------------------------------------------------------- /dist/src/helpers/has-props.js: -------------------------------------------------------------------------------- 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.hasProps = void 0; 7 | var traverse_1 = __importDefault(require("traverse")); 8 | var hasProps = function (json) { 9 | var has = false; 10 | (0, traverse_1.default)(json).forEach(function (item) { 11 | // TODO: use proper reference tracking 12 | if (typeof item === 'string' && item.match(/(^|\W)props\s*\./)) { 13 | has = true; 14 | this.stop(); 15 | } 16 | }); 17 | return has; 18 | }; 19 | exports.hasProps = hasProps; 20 | -------------------------------------------------------------------------------- /dist/src/generators/react/types.d.ts: -------------------------------------------------------------------------------- 1 | import { BaseTranspilerOptions } from '../../types/transpiler'; 2 | export interface ToReactOptions extends BaseTranspilerOptions { 3 | stylesType: 'emotion' | 'styled-components' | 'styled-jsx' | 'react-native' | 'style-tag'; 4 | stateType: 'useState' | 'mobx' | 'valtio' | 'solid' | 'builder' | 'variables'; 5 | format?: 'lite' | 'safe'; 6 | type: 'dom' | 'native' | 'taro'; 7 | preact?: boolean; 8 | rsc?: boolean; 9 | forwardRef?: string; 10 | experimental?: any; 11 | /** 12 | * For RSC, normal React context is currently not supported, so provide a prop drilling 13 | * option 14 | */ 15 | contextType?: 'context' | 'prop-drill'; 16 | addUseClientDirectiveIfNeeded?: boolean; 17 | } 18 | -------------------------------------------------------------------------------- /dist/src/parsers/svelte/html/fragment.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | exports.parseFragment = void 0; 4 | var children_1 = require("../helpers/children"); 5 | var mitosis_node_1 = require("../helpers/mitosis-node"); 6 | function parseFragment(json, node) { 7 | var mitosisNode = (0, mitosis_node_1.createMitosisNode)(); 8 | mitosisNode.name = 'Fragment'; 9 | mitosisNode.children = (0, children_1.parseChildren)(json, node); 10 | // if there is only one child, don't even bother to render the fragment as it is not necessary 11 | if (mitosisNode.children.length === 1) { 12 | mitosisNode = mitosisNode.children[0]; 13 | } 14 | return mitosisNode; 15 | } 16 | exports.parseFragment = parseFragment; 17 | -------------------------------------------------------------------------------- /dist/src/helpers/get-components-used.js: -------------------------------------------------------------------------------- 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.getComponentsUsed = void 0; 7 | var traverse_1 = __importDefault(require("traverse")); 8 | var is_mitosis_node_1 = require("./is-mitosis-node"); 9 | function getComponentsUsed(json) { 10 | var components = new Set(); 11 | (0, traverse_1.default)(json).forEach(function (item) { 12 | if ((0, is_mitosis_node_1.isMitosisNode)(item)) { 13 | components.add(item.name); 14 | } 15 | }); 16 | return components; 17 | } 18 | exports.getComponentsUsed = getComponentsUsed; 19 | -------------------------------------------------------------------------------- /dist/src/helpers/create-mitosis-context.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | var __assign = (this && this.__assign) || function () { 3 | __assign = Object.assign || function(t) { 4 | for (var s, i = 1, n = arguments.length; i < n; i++) { 5 | s = arguments[i]; 6 | for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) 7 | t[p] = s[p]; 8 | } 9 | return t; 10 | }; 11 | return __assign.apply(this, arguments); 12 | }; 13 | Object.defineProperty(exports, "__esModule", { value: true }); 14 | exports.createMitosisContext = void 0; 15 | function createMitosisContext(options) { 16 | return __assign({ '@type': '@builder.io/mitosis/context', value: {} }, options); 17 | } 18 | exports.createMitosisContext = createMitosisContext; 19 | -------------------------------------------------------------------------------- /dist/src/flow.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | exports.Fragment = exports.Show = exports.Slot = exports.For = void 0; 4 | /** 5 | * Flow control based on Solid 6 | * 7 | * https://github.com/ryansolid/solid/blob/master/packages/solid/src/rendering/flow.ts 8 | * https://github.com/ryansolid/solid/blob/master/documentation/rendering.md 9 | * 10 | * These elements all compile away so they return `null` 11 | */ 12 | function For(props) { 13 | return null; 14 | } 15 | exports.For = For; 16 | function Slot(props) { 17 | return null; 18 | } 19 | exports.Slot = Slot; 20 | function Show(props) { 21 | return null; 22 | } 23 | exports.Show = Show; 24 | function Fragment(props) { 25 | return null; 26 | } 27 | exports.Fragment = Fragment; 28 | -------------------------------------------------------------------------------- /dist/src/generators/qwik/directives.d.ts: -------------------------------------------------------------------------------- 1 | import { MitosisNode } from '../../types/mitosis-node'; 2 | export declare const DIRECTIVES: Record void) => void)>; 3 | interface ImageProps { 4 | altText?: string; 5 | image?: string; 6 | href?: string; 7 | height?: number; 8 | width?: number; 9 | builderBlock?: any; 10 | attributes?: any; 11 | sizes?: string; 12 | srcsetSizes?: string; 13 | srcset?: string; 14 | backgroundSize?: string; 15 | backgroundPosition?: string; 16 | fitContent?: boolean; 17 | aspectRatio?: number; 18 | lazy?: boolean; 19 | class?: string; 20 | children?: any[]; 21 | noWebp?: boolean; 22 | } 23 | export declare function Image(props: ImageProps): any; 24 | export {}; 25 | -------------------------------------------------------------------------------- /dist/src/parsers/jsx/hooks/use-target.d.ts: -------------------------------------------------------------------------------- 1 | import * as babel from '@babel/core'; 2 | import { MitosisComponent, TargetBlockDefinition } from '../../../types/mitosis-component'; 3 | declare const types: typeof babel.types; 4 | export declare const getTargetId: (component: MitosisComponent) => string; 5 | export declare const getMagicString: (targetId: string) => string; 6 | export declare const USE_TARGET_MAGIC_STRING = "USE_TARGET_BLOCK_"; 7 | export declare const USE_TARGET_MAGIC_REGEX: RegExp; 8 | export declare const getIdFromMatch: (match: string) => string | undefined; 9 | /** 10 | * This function finds `useTarget()` and converts it our JSON representation 11 | */ 12 | export declare const getUseTargetStatements: (path: babel.NodePath) => TargetBlockDefinition | undefined; 13 | export {}; 14 | -------------------------------------------------------------------------------- /dist/src/helpers/create-mitosis-node.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | var __assign = (this && this.__assign) || function () { 3 | __assign = Object.assign || function(t) { 4 | for (var s, i = 1, n = arguments.length; i < n; i++) { 5 | s = arguments[i]; 6 | for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) 7 | t[p] = s[p]; 8 | } 9 | return t; 10 | }; 11 | return __assign.apply(this, arguments); 12 | }; 13 | Object.defineProperty(exports, "__esModule", { value: true }); 14 | exports.createMitosisNode = void 0; 15 | var createMitosisNode = function (options) { return (__assign({ '@type': '@builder.io/mitosis/node', name: 'div', meta: {}, scope: {}, properties: {}, bindings: {}, children: [] }, options)); }; 16 | exports.createMitosisNode = createMitosisNode; 17 | -------------------------------------------------------------------------------- /dist/src/helpers/has-component.js: -------------------------------------------------------------------------------- 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.hasComponent = void 0; 7 | var traverse_1 = __importDefault(require("traverse")); 8 | var is_mitosis_node_1 = require("./is-mitosis-node"); 9 | var hasComponent = function (name, json) { 10 | var has = false; 11 | (0, traverse_1.default)(json).forEach(function (item) { 12 | if ((0, is_mitosis_node_1.isMitosisNode)(item)) { 13 | if (item.name === name) { 14 | has = true; 15 | this.stop(); 16 | } 17 | } 18 | }); 19 | return has; 20 | }; 21 | exports.hasComponent = hasComponent; 22 | -------------------------------------------------------------------------------- /dist/src/helpers/plugins/process-signals.d.ts: -------------------------------------------------------------------------------- 1 | import { Node, types } from '@babel/core'; 2 | import { Target } from '../../types/config'; 3 | import { Plugin } from '../../types/plugins'; 4 | export declare const replaceSignalSetters: ({ code, nodeMaps, }: { 5 | code: string; 6 | nodeMaps: { 7 | from: types.Node; 8 | setTo: types.Expression; 9 | }[]; 10 | }) => string; 11 | /** 12 | * Processes `Signal` type imports, transforming them to the target's equivalent and adding the import to the component. 13 | */ 14 | export declare const getSignalTypePlugin: ({ target }: { 15 | target: Target; 16 | }) => Plugin; 17 | /** 18 | * Processes `mySignal.value` accessors for props, context, and state. 19 | */ 20 | export declare const getSignalAccessPlugin: ({ target }: { 21 | target: Target; 22 | }) => Plugin; 23 | -------------------------------------------------------------------------------- /dist/src/generators/alpine/render-mount-hook.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | exports.renderMountHook = void 0; 4 | var lodash_1 = require("lodash"); 5 | var on_mount_1 = require("../helpers/on-mount"); 6 | var render_update_hooks_1 = require("./render-update-hooks"); 7 | function shouldRenderMountHook(json) { 8 | return json.hooks.onMount.length > 0 || (0, render_update_hooks_1.hasWatchHooks)(json); 9 | } 10 | exports.renderMountHook = (0, lodash_1.curry)(function (json, objectString) { 11 | return shouldRenderMountHook(json) 12 | ? objectString.replace(/(?:,)?(\s*)(}\s*)$/, ", init() {\n ".concat((0, render_update_hooks_1.renderWatchHooks)(json), "\n ").concat((0, on_mount_1.stringifySingleScopeOnMount)(json), "\n }$1$2")) 13 | : objectString; 14 | }); 15 | -------------------------------------------------------------------------------- /dist/src/generators/qwik/component.d.ts: -------------------------------------------------------------------------------- 1 | import { MitosisComponent } from '../../types/mitosis-component'; 2 | import { File, SrcBuilder } from './src-generator'; 3 | export type QwikOptions = { 4 | qwikLib?: string; 5 | qrlPrefix?: string; 6 | output?: 'ts' | 'cjs' | 'mjs'; 7 | jsx?: boolean; 8 | minify?: boolean; 9 | }; 10 | export interface FileSet { 11 | high: File; 12 | med: File; 13 | low: File; 14 | } 15 | export declare function createFileSet(options?: QwikOptions): FileSet; 16 | export declare function addComponent(fileSet: FileSet, component: MitosisComponent, opts?: { 17 | isRoot?: boolean; 18 | shareStyles?: boolean; 19 | }): void; 20 | export declare function renderUseLexicalScope(file: File): (this: SrcBuilder) => SrcBuilder; 21 | export declare function addCommonStyles(fileSet: FileSet): void; 22 | -------------------------------------------------------------------------------- /dist/src/helpers/plugins/process-code/index.d.ts: -------------------------------------------------------------------------------- 1 | import { MitosisComponent } from '../../../types/mitosis-component'; 2 | import { Plugin } from '../../../types/plugins'; 3 | import { CodeProcessor } from './types'; 4 | export declare const createCodeProcessorPlugin: (codeProcessor: CodeProcessor, { processProperties }?: { 5 | processProperties?: boolean | undefined; 6 | }) => (json: MitosisComponent) => void; 7 | /** 8 | * Given a `codeProcessor` function, processes all code expressions within a Mitosis component. 9 | */ 10 | export declare const CODE_PROCESSOR_PLUGIN: (codeProcessor: (codeType: import("./types").CodeType, json: MitosisComponent, node?: import("../../..").MitosisNode | undefined) => (code: string, hookType: string) => string | (() => void), a_1?: { 11 | processProperties?: boolean | undefined; 12 | } | undefined) => Plugin; 13 | -------------------------------------------------------------------------------- /dist/src/generators/helpers/on-mount.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | exports.stringifySingleScopeOnMount = void 0; 4 | /** 5 | * Helper for frameworks where all `onMount()`s must share a single scope. 6 | */ 7 | var stringifySingleScopeOnMount = function (json) { 8 | var hooks = json.hooks.onMount; 9 | if (hooks.length === 0) 10 | return ''; 11 | if (hooks.length === 1) { 12 | return hooks[0].code; 13 | } 14 | return hooks 15 | .map(function (hook, i) { 16 | var hookFnName = "onMountHook_".concat(i); 17 | return "\n const ".concat(hookFnName, " = () => {\n ").concat(hook.code, "\n }\n ").concat(hookFnName, "();"); 18 | }) 19 | .join(''); 20 | }; 21 | exports.stringifySingleScopeOnMount = stringifySingleScopeOnMount; 22 | -------------------------------------------------------------------------------- /dist/src/generators/minify.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | exports.minify = void 0; 4 | function minify(messageParts) { 5 | var expressions = []; 6 | for (var _i = 1; _i < arguments.length; _i++) { 7 | expressions[_i - 1] = arguments[_i]; 8 | } 9 | var text = ''; 10 | for (var i = 0; i < messageParts.length; i++) { 11 | var part = messageParts[i]; 12 | text += part; 13 | if (i < expressions.length) { 14 | text += expressions[i]; 15 | } 16 | } 17 | return text 18 | .replace('\n', ' ') 19 | .replace(/^\s+/, '') 20 | .replace(/\s+$/, '') 21 | .replace(/\s+/g, ' ') 22 | .replace(/\s?([,;\:\-\{\}\(\)\<\>])\s?/g, function (_, match) { return match; }); 23 | } 24 | exports.minify = minify; 25 | -------------------------------------------------------------------------------- /dist/src/helpers/has-stateful-dom.js: -------------------------------------------------------------------------------- 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.hasStatefulDom = void 0; 7 | var traverse_1 = __importDefault(require("traverse")); 8 | var is_mitosis_node_1 = require("./is-mitosis-node"); 9 | var hasStatefulDom = function (json) { 10 | var has = false; 11 | (0, traverse_1.default)(json).forEach(function (item) { 12 | if ((0, is_mitosis_node_1.isMitosisNode)(item)) { 13 | if (/input|textarea|select/.test(item.name)) { 14 | has = true; 15 | this.stop(); 16 | } 17 | } 18 | }); 19 | return has; 20 | }; 21 | exports.hasStatefulDom = hasStatefulDom; 22 | -------------------------------------------------------------------------------- /dist/src/parsers/svelte/html/text.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | var __assign = (this && this.__assign) || function () { 3 | __assign = Object.assign || function(t) { 4 | for (var s, i = 1, n = arguments.length; i < n; i++) { 5 | s = arguments[i]; 6 | for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) 7 | t[p] = s[p]; 8 | } 9 | return t; 10 | }; 11 | return __assign.apply(this, arguments); 12 | }; 13 | Object.defineProperty(exports, "__esModule", { value: true }); 14 | exports.parseText = void 0; 15 | var mitosis_node_1 = require("../helpers/mitosis-node"); 16 | function parseText(node) { 17 | return __assign(__assign({}, (0, mitosis_node_1.createMitosisNode)()), { name: 'div', properties: { 18 | _text: node.data, 19 | } }); 20 | } 21 | exports.parseText = parseText; 22 | -------------------------------------------------------------------------------- /dist/src/parsers/jsx/hooks/index.d.ts: -------------------------------------------------------------------------------- 1 | import * as babel from '@babel/core'; 2 | import { MitosisComponent } from '../../../types/mitosis-component'; 3 | import { ParseMitosisOptions } from '../types'; 4 | declare const types: typeof babel.types; 5 | export declare function parseDefaultPropsHook(component: MitosisComponent, expression: babel.types.CallExpression): void; 6 | export declare function generateUseStyleCode(expression: babel.types.CallExpression): string; 7 | /** 8 | * Transform useMetadata({...}) onto the component JSON as 9 | * meta: { metadataHook: { ... }} 10 | * 11 | * This function collects metadata and removes the statement from 12 | * the returned nodes array 13 | */ 14 | export declare const collectModuleScopeHooks: (component: MitosisComponent, options: ParseMitosisOptions) => (nodes: babel.types.Statement[]) => babel.types.Statement[]; 15 | export {}; 16 | -------------------------------------------------------------------------------- /dist/src/plugins/compile-away-builder-components.d.ts: -------------------------------------------------------------------------------- 1 | import { type Plugin } from '..'; 2 | import { TraverseContext } from 'traverse'; 3 | import { MitosisComponent } from '../types/mitosis-component'; 4 | import { MitosisNode } from '../types/mitosis-node'; 5 | type CompileAwayComponentsMap = { 6 | [key: string]: (node: MitosisNode, context: TraverseContext, components: CompileAwayComponentsMap) => MitosisNode | void; 7 | }; 8 | export declare const components: CompileAwayComponentsMap; 9 | type CompileAwayBuilderComponentsOptions = { 10 | only?: string[]; 11 | omit?: string[]; 12 | }; 13 | export declare const compileAwayBuilderComponentsFromTree: (tree: MitosisNode | MitosisComponent, components: CompileAwayComponentsMap) => void; 14 | export declare const compileAwayBuilderComponents: (pluginOptions?: CompileAwayBuilderComponentsOptions) => Plugin; 15 | export {}; 16 | -------------------------------------------------------------------------------- /dist/src/helpers/remove-surrounding-block.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | exports.removeSurroundingBlock = void 0; 4 | /** 5 | * Remove the surrounding block for a function, for instance 6 | * 7 | * `{ const foo = "bar" }` -> `const foo = "bar"` 8 | */ 9 | function removeSurroundingBlock(code) { 10 | var str = code; 11 | // Object literal like { foo: ... } should not be unwrapped 12 | if (str.match(/^\s*{\s*[a-z0-9]+:/i)) { 13 | return str; 14 | } 15 | // Empty object literal 16 | if (str.replace(/\s+/g, '') === '{}') { 17 | return str; 18 | } 19 | var bracesRegex = /^\s*\{([\s\S]+)\}\s*$/; 20 | if (bracesRegex.test(str)) { 21 | return str.replace(bracesRegex, '$1'); 22 | } 23 | return str; 24 | } 25 | exports.removeSurroundingBlock = removeSurroundingBlock; 26 | -------------------------------------------------------------------------------- /dist/src/helpers/get-refs.js: -------------------------------------------------------------------------------- 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.getRefs = void 0; 7 | var traverse_1 = __importDefault(require("traverse")); 8 | var is_mitosis_node_1 = require("./is-mitosis-node"); 9 | var getRefs = function (json) { 10 | var refs = new Set(); 11 | (0, traverse_1.default)(json).forEach(function (item) { 12 | var _a; 13 | if ((0, is_mitosis_node_1.isMitosisNode)(item)) { 14 | if (typeof ((_a = item.bindings.ref) === null || _a === void 0 ? void 0 : _a.code) === 'string') { 15 | refs.add(item.bindings.ref.code); 16 | } 17 | } 18 | }); 19 | return refs; 20 | }; 21 | exports.getRefs = getRefs; 22 | -------------------------------------------------------------------------------- /dist/src/generators/lit/index.js: -------------------------------------------------------------------------------- 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 __exportStar = (this && this.__exportStar) || function(m, exports) { 14 | for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); 15 | }; 16 | Object.defineProperty(exports, "__esModule", { value: true }); 17 | __exportStar(require("./generate"), exports); 18 | -------------------------------------------------------------------------------- /dist/src/generators/marko/index.js: -------------------------------------------------------------------------------- 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 __exportStar = (this && this.__exportStar) || function(m, exports) { 14 | for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); 15 | }; 16 | Object.defineProperty(exports, "__esModule", { value: true }); 17 | __exportStar(require("./generate"), exports); 18 | -------------------------------------------------------------------------------- /dist/src/helpers/merge-options.d.ts: -------------------------------------------------------------------------------- 1 | import { BaseTranspilerOptions, MitosisComponent, Target } from '..'; 2 | /** 3 | * Merges options while combining the `plugins` array, and adds any default plugins. 4 | */ 5 | export declare const mergeOptions: (a: T, b?: Partial, c?: Partial | undefined, d?: Partial | undefined) => T & { 6 | plugins: NonNullable; 7 | }; 8 | /** 9 | * Merges options while combining the `plugins` array, and adds any default plugins. 10 | */ 11 | export declare const initializeOptions: ({ target, component, defaults, userOptions, extra, }: { 12 | target: Target; 13 | component: MitosisComponent; 14 | defaults: T; 15 | userOptions?: Partial | undefined; 16 | extra?: Partial | undefined; 17 | }) => T & { 18 | plugins: NonNullable; 19 | }; 20 | -------------------------------------------------------------------------------- /dist/src/helpers/signals/index.js: -------------------------------------------------------------------------------- 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 __exportStar = (this && this.__exportStar) || function(m, exports) { 14 | for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); 15 | }; 16 | Object.defineProperty(exports, "__esModule", { value: true }); 17 | __exportStar(require("./signals"), exports); 18 | -------------------------------------------------------------------------------- /dist/src/parsers/builder/index.js: -------------------------------------------------------------------------------- 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 __exportStar = (this && this.__exportStar) || function(m, exports) { 14 | for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); 15 | }; 16 | Object.defineProperty(exports, "__esModule", { value: true }); 17 | __exportStar(require("./builder"), exports); 18 | -------------------------------------------------------------------------------- /dist/src/generators/alpine/index.js: -------------------------------------------------------------------------------- 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 __exportStar = (this && this.__exportStar) || function(m, exports) { 14 | for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); 15 | }; 16 | Object.defineProperty(exports, "__esModule", { value: true }); 17 | __exportStar(require("./generate"), exports); 18 | -------------------------------------------------------------------------------- /dist/src/generators/stencil/index.js: -------------------------------------------------------------------------------- 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 __exportStar = (this && this.__exportStar) || function(m, exports) { 14 | for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); 15 | }; 16 | Object.defineProperty(exports, "__esModule", { value: true }); 17 | __exportStar(require("./generate"), exports); 18 | -------------------------------------------------------------------------------- /dist/src/helpers/get-components.js: -------------------------------------------------------------------------------- 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.getComponents = void 0; 7 | var traverse_1 = __importDefault(require("traverse")); 8 | var is_mitosis_node_1 = require("./is-mitosis-node"); 9 | var is_upper_case_1 = require("./is-upper-case"); 10 | function getComponents(json) { 11 | var components = new Set(); 12 | (0, traverse_1.default)(json).forEach(function (item) { 13 | if ((0, is_mitosis_node_1.isMitosisNode)(item)) { 14 | if ((0, is_upper_case_1.isUpperCase)(item.name[0])) { 15 | components.add(item.name); 16 | } 17 | } 18 | }); 19 | return components; 20 | } 21 | exports.getComponents = getComponents; 22 | -------------------------------------------------------------------------------- /dist/src/parsers/svelte/helpers/expressions.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | exports.parseObjectExpression = void 0; 4 | var astring_1 = require("astring"); 5 | var references_1 = require("../instance/references"); 6 | function parseObjectExpression(json, node) { 7 | var _a; 8 | var properties = node.properties.map(function (n) { 9 | var node_ = n; 10 | return { 11 | key: (0, astring_1.generate)(node_.key), 12 | value: (0, references_1.getParsedValue)(json, node_.value), 13 | }; 14 | }); 15 | var c = {}; 16 | for (var _i = 0, properties_1 = properties; _i < properties_1.length; _i++) { 17 | var item = properties_1[_i]; 18 | Object.assign(c, (_a = {}, _a[item.key] = item.value, _a)); 19 | } 20 | return c; 21 | } 22 | exports.parseObjectExpression = parseObjectExpression; 23 | -------------------------------------------------------------------------------- /dist/src/generators/marko/generate.d.ts: -------------------------------------------------------------------------------- 1 | import { BaseTranspilerOptions, TranspilerGenerator } from '../../types/transpiler'; 2 | export interface ToMarkoOptions extends BaseTranspilerOptions { 3 | } 4 | export declare const componentToMarko: TranspilerGenerator; 5 | /** 6 | * Convert marko expressions to valid html 7 | * 8 | *
doSomething())> ->
9 | */ 10 | export declare function preprocessHtml(htmlString: string): string; 11 | /** 12 | * Convert HTML back to marko expressions 13 | * 14 | *
->
doSomething())> 15 | */ 16 | export declare function postprocessHtml(htmlString: string): string; 17 | /** 18 | * Format Marko HTML using the built-in HTML parser for prettier, 19 | * given issues with Marko's plugin 20 | */ 21 | export declare function markoFormatHtml(htmlString: string): string; 22 | -------------------------------------------------------------------------------- /dist/src/flow.d.ts: -------------------------------------------------------------------------------- 1 | import { JSX } from '../jsx-runtime'; 2 | /** 3 | * Flow control based on Solid 4 | * 5 | * https://github.com/ryansolid/solid/blob/master/packages/solid/src/rendering/flow.ts 6 | * https://github.com/ryansolid/solid/blob/master/documentation/rendering.md 7 | * 8 | * These elements all compile away so they return `null` 9 | */ 10 | export declare function For(props: { 11 | each?: readonly T[]; 12 | children: (item: T, index: number) => U; 13 | }): any; 14 | export declare function Slot(props: { 15 | name?: JSX.Element; 16 | } | { 17 | [key: string]: any; 18 | }): any; 19 | export declare function Show(props: { 20 | when: T | undefined | null | false; 21 | else?: JSX.Element; 22 | children?: JSX.Element | null; 23 | }): any; 24 | export declare function Fragment(props: { 25 | children: JSX.Element | JSX.Element[]; 26 | }): any; 27 | -------------------------------------------------------------------------------- /dist/src/generators/vue/index.js: -------------------------------------------------------------------------------- 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 __exportStar = (this && this.__exportStar) || function(m, exports) { 14 | for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); 15 | }; 16 | Object.defineProperty(exports, "__esModule", { value: true }); 17 | __exportStar(require("./types"), exports); 18 | __exportStar(require("./vue"), exports); 19 | -------------------------------------------------------------------------------- /dist/src/helpers/try-prettier-format.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | exports.tryPrettierFormat = void 0; 4 | var standalone_1 = require("prettier/standalone"); 5 | var tryPrettierFormat = function (str, parser) { 6 | try { 7 | return (0, standalone_1.format)(str, { 8 | parser: parser, 9 | plugins: [ 10 | // To support running in browsers 11 | require('prettier/parser-typescript'), 12 | require('prettier/parser-postcss'), 13 | require('prettier/parser-html'), 14 | require('prettier/parser-babel'), 15 | ], 16 | htmlWhitespaceSensitivity: 'ignore', 17 | }); 18 | } 19 | catch (err) { 20 | console.warn('Could not prettify', { string: str }, err); 21 | } 22 | return str; 23 | }; 24 | exports.tryPrettierFormat = tryPrettierFormat; 25 | -------------------------------------------------------------------------------- /dist/src/modules/plugins.d.ts: -------------------------------------------------------------------------------- 1 | import { MitosisComponent } from '../types/mitosis-component'; 2 | import { Plugin } from '../types/plugins'; 3 | export type { Plugin }; 4 | export declare const runPreJsonPlugins: ({ json, plugins, options, }: { 5 | json: MitosisComponent; 6 | plugins: Plugin[]; 7 | options?: any; 8 | }) => MitosisComponent; 9 | export declare const runPostJsonPlugins: ({ json, plugins, options, }: { 10 | json: MitosisComponent; 11 | plugins: Plugin[]; 12 | options?: any; 13 | }) => MitosisComponent; 14 | export declare const runPreCodePlugins: ({ code, plugins, options, json, }: { 15 | json: MitosisComponent; 16 | code: string; 17 | plugins: Plugin[]; 18 | options?: any; 19 | }) => string; 20 | export declare const runPostCodePlugins: ({ code, plugins, options, json, }: { 21 | json: MitosisComponent; 22 | code: string; 23 | plugins: Plugin[]; 24 | options?: any; 25 | }) => string; 26 | -------------------------------------------------------------------------------- /dist/src/generators/alpine/generate.d.ts: -------------------------------------------------------------------------------- 1 | import { MitosisNode } from '../../types/mitosis-node'; 2 | import { BaseTranspilerOptions, TranspilerGenerator } from '../../types/transpiler'; 3 | export interface ToAlpineOptions extends BaseTranspilerOptions { 4 | /** 5 | * use @on and : instead of `x-on` and `x-bind` 6 | */ 7 | useShorthandSyntax?: boolean; 8 | /** 9 | * If true, the javascript won't be extracted into a separate script block. 10 | */ 11 | inlineState?: boolean; 12 | } 13 | export declare const checkIsComponentNode: (node: MitosisNode) => boolean; 14 | /** 15 | * Test if the binding expression would be likely to generate 16 | * valid or invalid liquid. If we generate invalid liquid tags 17 | * Shopify will reject our PUT to update the template 18 | */ 19 | export declare const isValidAlpineBinding: (str?: string) => boolean; 20 | export declare const componentToAlpine: TranspilerGenerator; 21 | -------------------------------------------------------------------------------- /dist/src/helpers/has.js: -------------------------------------------------------------------------------- 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.has = void 0; 7 | var traverse_1 = __importDefault(require("traverse")); 8 | var is_mitosis_node_1 = require("./is-mitosis-node"); 9 | /** 10 | * Test if the component has something 11 | * 12 | * e.g. 13 | * const hasSpread = has(component, node => some(node.bindings, { type: 'spread' })); 14 | */ 15 | function has(json, test) { 16 | var found = false; 17 | (0, traverse_1.default)(json).forEach(function (thing) { 18 | if ((0, is_mitosis_node_1.isMitosisNode)(thing)) { 19 | if (test(thing)) { 20 | found = true; 21 | this.stop(); 22 | } 23 | } 24 | }); 25 | return found; 26 | } 27 | exports.has = has; 28 | -------------------------------------------------------------------------------- /dist/src/parsers/svelte/helpers/string.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | exports.stripQuotes = exports.insertAt = exports.uniqueName = void 0; 4 | // helper functions for strings 5 | var lodash_1 = require("lodash"); 6 | function uniqueName(existingItems, reference) { 7 | var index = 0; 8 | var match = false; 9 | while (false === match) { 10 | if (!existingItems.includes(reference)) { 11 | match = true; 12 | break; 13 | } 14 | index++; 15 | } 16 | return (0, lodash_1.camelCase)("".concat(reference).concat(index)); 17 | } 18 | exports.uniqueName = uniqueName; 19 | function insertAt(string_, sub, pos) { 20 | return "".concat(string_.slice(0, pos)).concat(sub).concat(string_.slice(pos)); 21 | } 22 | exports.insertAt = insertAt; 23 | function stripQuotes(string_) { 24 | return string_.replace(/["']+/g, ''); 25 | } 26 | exports.stripQuotes = stripQuotes; 27 | -------------------------------------------------------------------------------- /dist/src/helpers/get-state-object-string.d.ts: -------------------------------------------------------------------------------- 1 | import { MitosisComponent } from '../types/mitosis-component'; 2 | import { MitosisContext } from '../types/mitosis-context'; 3 | type ValueMapper = (code: string, type: 'data' | 'function' | 'getter', typeParameter: string | undefined, key: string | undefined) => string; 4 | interface GetStateObjectStringOptions { 5 | data?: boolean; 6 | functions?: boolean; 7 | getters?: boolean; 8 | valueMapper?: ValueMapper; 9 | format?: 'object' | 'class' | 'variables'; 10 | keyPrefix?: string; 11 | } 12 | export declare const getMemberObjectString: (object: MitosisComponent['state'], userOptions?: GetStateObjectStringOptions) => string; 13 | export declare const stringifyContextValue: (object: MitosisContext['value'], userOptions?: GetStateObjectStringOptions) => string; 14 | export declare const getStateObjectStringFromComponent: (component: MitosisComponent, options?: GetStateObjectStringOptions) => string; 15 | export {}; 16 | -------------------------------------------------------------------------------- /dist/src/helpers/has-bindings-text.js: -------------------------------------------------------------------------------- 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.hasBindingsText = void 0; 7 | var traverse_1 = __importDefault(require("traverse")); 8 | var is_children_1 = __importDefault(require("./is-children")); 9 | var is_mitosis_node_1 = require("./is-mitosis-node"); 10 | var hasBindingsText = function (json) { 11 | var has = false; 12 | (0, traverse_1.default)(json).forEach(function (node) { 13 | var _a; 14 | if ((0, is_mitosis_node_1.isMitosisNode)(node) && !(0, is_children_1.default)({ node: node }) && ((_a = node.bindings._text) === null || _a === void 0 ? void 0 : _a.code)) { 15 | has = true; 16 | this.stop(); 17 | } 18 | }); 19 | return has; 20 | }; 21 | exports.hasBindingsText = hasBindingsText; 22 | -------------------------------------------------------------------------------- /dist/src/helpers/replace-new-lines-in-strings.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | exports.stripNewlinesInStrings = void 0; 4 | function stripNewlinesInStrings(string) { 5 | var inString = null; 6 | return string 7 | .split('') 8 | .map(function (char, index) { 9 | if (inString) { 10 | if (char === '\n') { 11 | return ' '; 12 | } 13 | } 14 | // Prior char is escape char and the char before that is not escaping it 15 | var isEscaped = string[index - 1] === '\\' && string[index - 2] !== '\\'; 16 | if (!inString && (char === '"' || char === "'") && !isEscaped) { 17 | inString = char; 18 | } 19 | else if (inString && char === inString && !isEscaped) { 20 | inString = null; 21 | } 22 | return char; 23 | }) 24 | .join(''); 25 | } 26 | exports.stripNewlinesInStrings = stripNewlinesInStrings; 27 | -------------------------------------------------------------------------------- /dist/src/generators/angular/helpers.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | exports.getAppropriateTemplateFunctionKeys = exports.HELPER_FUNCTIONS = void 0; 4 | exports.HELPER_FUNCTIONS = { 5 | useObjectWrapper: "useObjectWrapper(...args: any[]) {\n let obj = {}\n args.forEach((arg) => {\n obj = { ...obj, ...arg };\n });\n return obj;\n }", 6 | useObjectDotValues: "useObjectDotValues(obj: any): any[] {\n return Object.values(obj);\n }", 7 | useTypeOf: "useTypeOf(obj: any): string {\n return typeof obj;\n }", 8 | useJsonStringify: "useJsonStringify(obj: any): string {\n return JSON.stringify(obj);\n }", 9 | }; 10 | var getAppropriateTemplateFunctionKeys = function (code) { 11 | return Object.keys(exports.HELPER_FUNCTIONS).filter(function (key) { return code.includes(key); }); 12 | }; 13 | exports.getAppropriateTemplateFunctionKeys = getAppropriateTemplateFunctionKeys; 14 | -------------------------------------------------------------------------------- /dist/src/parsers/svelte/html/slot.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | exports.parseSlot = void 0; 4 | var lodash_1 = require("lodash"); 5 | var children_1 = require("../helpers/children"); 6 | var mitosis_node_1 = require("../helpers/mitosis-node"); 7 | function parseSlot(json, node) { 8 | var _a, _b; 9 | var mitosisNode = (0, mitosis_node_1.createMitosisNode)(); 10 | mitosisNode.name = 'Slot'; 11 | if (node.attributes.length > 0 && 12 | node.attributes[0].value.length > 0 && 13 | ((_a = node.attributes[0].value[0].data) === null || _a === void 0 ? void 0 : _a.trim().length)) { 14 | var slotName = (0, lodash_1.upperFirst)((0, lodash_1.camelCase)((_b = node.attributes[0].value[0]) === null || _b === void 0 ? void 0 : _b.data)); 15 | mitosisNode.properties.name = slotName; 16 | } 17 | mitosisNode.children = (0, children_1.parseChildren)(json, node); 18 | return mitosisNode; 19 | } 20 | exports.parseSlot = parseSlot; 21 | -------------------------------------------------------------------------------- /dist/src/helpers/signals/signals.d.ts: -------------------------------------------------------------------------------- 1 | import { Target } from '../../types/config'; 2 | export declare const getSignalMitosisImportForTarget: (target: Target) => import("../..").MitosisImport | undefined; 3 | export declare const getSignalImportName: (code: string) => string | undefined; 4 | /** 5 | * Finds all `Signal` types and replaces them with the correct type for the given target. 6 | * e.g. `Signal` becomes `Writable` for Svelte. 7 | */ 8 | export declare const mapSignalType: ({ code, target, signalImportName, }: { 9 | code: string; 10 | target: Target; 11 | signalImportName?: string | undefined; 12 | }) => string; 13 | /** 14 | * Processes the `Signal` type usage in a plain TS file: 15 | * - Finds the `Signal` import name 16 | * - Maps the `Signal` type to the target's equivalent 17 | * - Adds the equivalent of the `Signal` import to the file 18 | */ 19 | export declare const mapSignalTypeInTSFile: ({ code, target }: { 20 | code: string; 21 | target: Target; 22 | }) => string; 23 | -------------------------------------------------------------------------------- /dist/src/generators/svelte/helpers.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | exports.stripStateAndProps = void 0; 4 | var slots_1 = require("../../helpers/slots"); 5 | var strip_state_and_props_refs_1 = require("../../helpers/strip-state-and-props-refs"); 6 | var stripStateAndProps = function (_a) { 7 | var options = _a.options, json = _a.json; 8 | return function (code) { 9 | return (0, strip_state_and_props_refs_1.stripStateAndPropsRefs)(code, { 10 | includeState: options.stateType === 'variables', 11 | replaceWith: function (name) { 12 | return name === 'children' 13 | ? '$$slots.default' 14 | : (0, slots_1.isSlotProperty)(name) 15 | ? (0, slots_1.replaceSlotsInString)(name, function (x) { return "$$slots.".concat(x); }) 16 | : name; 17 | }, 18 | }); 19 | }; 20 | }; 21 | exports.stripStateAndProps = stripStateAndProps; 22 | -------------------------------------------------------------------------------- /dist/src/types/metadata.d.ts: -------------------------------------------------------------------------------- 1 | import { Target } from '..'; 2 | import { SolidState } from '../generators/solid/types'; 3 | import { Dictionary } from '../helpers/typescript'; 4 | type Targets = typeof import('../targets').targets; 5 | type TargetOptions = { 6 | [K in Target]?: Partial[0]>>; 7 | }; 8 | export type ComponentMetadata = { 9 | [index: string]: any; 10 | httpRequests?: Record; 11 | options?: TargetOptions; 12 | angular?: { 13 | nativeAttributes: string[]; 14 | }; 15 | qwik?: { 16 | component?: { 17 | isLight?: boolean; 18 | }; 19 | setUseStoreFirst?: boolean; 20 | hasDeepStore?: boolean; 21 | mutable?: string[]; 22 | imports?: Dictionary; 23 | replace?: Record; 24 | }; 25 | solid?: { 26 | state?: Dictionary; 27 | }; 28 | rsc?: { 29 | componentType?: 'client' | 'server'; 30 | }; 31 | }; 32 | export {}; 33 | -------------------------------------------------------------------------------- /dist/src/generators/qwik/index.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | exports.File = exports.componentToQwik = exports.createFileSet = exports.addComponent = exports.addCommonStyles = void 0; 4 | var component_1 = require("./component"); 5 | Object.defineProperty(exports, "addCommonStyles", { enumerable: true, get: function () { return component_1.addCommonStyles; } }); 6 | Object.defineProperty(exports, "addComponent", { enumerable: true, get: function () { return component_1.addComponent; } }); 7 | Object.defineProperty(exports, "createFileSet", { enumerable: true, get: function () { return component_1.createFileSet; } }); 8 | var component_generator_1 = require("./component-generator"); 9 | Object.defineProperty(exports, "componentToQwik", { enumerable: true, get: function () { return component_generator_1.componentToQwik; } }); 10 | var src_generator_1 = require("./src-generator"); 11 | Object.defineProperty(exports, "File", { enumerable: true, get: function () { return src_generator_1.File; } }); 12 | -------------------------------------------------------------------------------- /dist/src/types/transpiler.d.ts: -------------------------------------------------------------------------------- 1 | import { MitosisComponent } from './mitosis-component'; 2 | import { Plugin } from './plugins'; 3 | export interface TranspilerArgs { 4 | path?: string; 5 | component: MitosisComponent; 6 | } 7 | export type Transpiler = (args: TranspilerArgs) => R; 8 | /** 9 | * This type guarantees that all code generators receive the same base options 10 | */ 11 | export type TranspilerGenerator = (args?: X) => Transpiler; 12 | export interface BaseTranspilerOptions { 13 | experimental?: { 14 | [key: string]: any; 15 | }; 16 | /** 17 | * Runs `prettier` on generated components 18 | */ 19 | prettier?: boolean; 20 | /** 21 | * Mitosis Plugins to run during codegen. 22 | */ 23 | plugins?: Plugin[]; 24 | /** 25 | * Enable `typescript` output 26 | */ 27 | typescript?: boolean; 28 | /** 29 | * Preserves explicit filename extensions in import statements. 30 | */ 31 | explicitImportFileExtension?: boolean; 32 | } 33 | -------------------------------------------------------------------------------- /dist/src/parsers/jsx/props-types.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | exports.findOptionalProps = void 0; 4 | var ts_morph_1 = require("ts-morph"); 5 | var typescript_project_1 = require("../../helpers/typescript-project"); 6 | var findOptionalProps = function (args) { 7 | var ast = args.project.getSourceFileOrThrow(args.filePath); 8 | if (ast === undefined) { 9 | throw new Error('Could not find AST. Please provide either `code` or `filePath` configs.'); 10 | } 11 | var propsSymbol = (0, typescript_project_1.getPropsSymbol)(ast); 12 | if (!propsSymbol) 13 | return []; 14 | return propsSymbol 15 | .getDeclarations()[0] 16 | .getType() 17 | .getProperties() 18 | .map(function (p) { return p.getDeclarations()[0]; }) 19 | .filter(function (k) { 20 | return ts_morph_1.PropertySignature.isPropertySignature(k) && k.hasQuestionToken(); 21 | }) 22 | .map(function (k) { return k.getName(); }); 23 | }; 24 | exports.findOptionalProps = findOptionalProps; 25 | -------------------------------------------------------------------------------- /dist/src/parsers/svelte/helpers/children.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | exports.parseChildren = exports.filterChildren = void 0; 4 | var html_1 = require("../html"); 5 | function filterChildren(children) { 6 | var _a; 7 | return ((_a = children === null || children === void 0 ? void 0 : children.filter(function (n) { var _a; return n.type !== 'Comment' && (n.type !== 'Text' || ((_a = n.data) === null || _a === void 0 ? void 0 : _a.trim().length)); })) !== null && _a !== void 0 ? _a : []); 8 | } 9 | exports.filterChildren = filterChildren; 10 | function parseChildren(json, node) { 11 | var children = []; 12 | if (node.children) { 13 | for (var _i = 0, _a = filterChildren(node.children); _i < _a.length; _i++) { 14 | var child = _a[_i]; 15 | var mitosisNode = (0, html_1.parseHtmlNode)(json, child); 16 | if (mitosisNode) { 17 | children.push(mitosisNode); 18 | } 19 | } 20 | } 21 | return children; 22 | } 23 | exports.parseChildren = parseChildren; 24 | -------------------------------------------------------------------------------- /dist/src/symbols/symbol-processor.d.ts: -------------------------------------------------------------------------------- 1 | import { BuilderContent, BuilderElement } from '@builder.io/sdk'; 2 | import { MitosisComponent } from '../types/mitosis-component'; 3 | export type SymbolHierarchy = { 4 | depthFirstSymbols: BuilderElement[]; 5 | } & { 6 | [id: string]: string[]; 7 | }; 8 | /** 9 | * Ensure every symbol in a BuilderContent tree has a unique ID. 10 | * Mutates the data tree directly. 11 | */ 12 | export declare function ensureAllSymbolsHaveIds(content: BuilderContent): void; 13 | export declare function convertBuilderContentToSymbolHierarchy(content: BuilderContent, { collectComponentStyles, collectComponentState, }?: { 14 | collectComponentStyles?: string[]; 15 | collectComponentState?: Record; 16 | }): SymbolHierarchy; 17 | export declare function convertBuilderElementToMitosisComponent(element: BuilderElement): MitosisComponent | null; 18 | export declare function getJsxSymbolComponentName(id: string): string; 19 | export declare function hashCodeAsString(obj: any): string; 20 | export declare function hashCode(obj: any, hash?: number): number; 21 | -------------------------------------------------------------------------------- /dist/src/parsers/svelte/html/mustache-tag.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | exports.parseRawMustacheTag = exports.parseMustacheTag = void 0; 4 | var astring_1 = require("astring"); 5 | var bindings_1 = require("../../../helpers/bindings"); 6 | var mitosis_node_1 = require("../helpers/mitosis-node"); 7 | function parseMustacheTag(node) { 8 | var mitosisNode = (0, mitosis_node_1.createMitosisNode)(); 9 | mitosisNode.name = 'div'; 10 | mitosisNode.bindings['_text'] = (0, bindings_1.createSingleBinding)({ 11 | code: (0, astring_1.generate)(node.expression), 12 | }); 13 | return mitosisNode; 14 | } 15 | exports.parseMustacheTag = parseMustacheTag; 16 | function parseRawMustacheTag(node) { 17 | var mitosisNode = (0, mitosis_node_1.createMitosisNode)(); 18 | mitosisNode.name = 'div'; 19 | mitosisNode.bindings.innerHTML = (0, bindings_1.createSingleBinding)({ 20 | code: (0, astring_1.generate)(node.expression), 21 | }); 22 | return mitosisNode; 23 | } 24 | exports.parseRawMustacheTag = parseRawMustacheTag; 25 | -------------------------------------------------------------------------------- /dist/src/helpers/strip-meta-properties.js: -------------------------------------------------------------------------------- 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.stripMetaProperties = void 0; 7 | var traverse_1 = __importDefault(require("traverse")); 8 | var is_mitosis_node_1 = require("./is-mitosis-node"); 9 | var stripMetaProperties = function (json) { 10 | (0, traverse_1.default)(json).forEach(function (item) { 11 | if ((0, is_mitosis_node_1.isMitosisNode)(item)) { 12 | for (var property in item.properties) { 13 | if (property.startsWith('$')) { 14 | delete item.properties[property]; 15 | } 16 | } 17 | for (var property in item.bindings) { 18 | if (property.startsWith('$')) { 19 | delete item.bindings[property]; 20 | } 21 | } 22 | } 23 | }); 24 | return json; 25 | }; 26 | exports.stripMetaProperties = stripMetaProperties; 27 | -------------------------------------------------------------------------------- /dist/src/plugins/compile-away-components.d.ts: -------------------------------------------------------------------------------- 1 | import { TraverseContext } from 'traverse'; 2 | import { MitosisComponent } from '../types/mitosis-component'; 3 | import { MitosisNode } from '../types/mitosis-node'; 4 | export declare const getRenderOptions: (node: MitosisNode) => { 5 | [x: string]: string; 6 | }; 7 | type CompileAwayComponentsOptions = { 8 | components: { 9 | [key: string]: (node: MitosisNode, context: TraverseContext) => MitosisNode | void; 10 | }; 11 | }; 12 | /** 13 | * @example 14 | * componentToReact(mitosisJson, { 15 | * plugins: [ 16 | * compileAwayComponents({ 17 | * Image: (node) => { 18 | * return jsx(` 19 | *
20 | * 21 | *
22 | * `); 23 | * } 24 | * }) 25 | * ] 26 | * }) 27 | */ 28 | export declare const compileAwayComponents: (pluginOptions: CompileAwayComponentsOptions) => (options?: any) => { 29 | json: { 30 | pre: (json: MitosisComponent) => void; 31 | }; 32 | }; 33 | export {}; 34 | -------------------------------------------------------------------------------- /dist/src/constants/media-sizes.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | exports.mediaQueryRegex = exports.sizes = exports.sizeNames = void 0; 4 | exports.sizeNames = ['small', 'medium', 'large']; 5 | exports.sizes = { 6 | small: { 7 | min: 320, 8 | default: 321, 9 | max: 640, 10 | }, 11 | medium: { 12 | min: 641, 13 | default: 642, 14 | max: 991, 15 | }, 16 | large: { 17 | min: 990, 18 | default: 991, 19 | max: 1200, 20 | }, 21 | getWidthForSize: function (size) { 22 | return this[size].default; 23 | }, 24 | getSizeForWidth: function (width) { 25 | for (var _i = 0, sizeNames_1 = exports.sizeNames; _i < sizeNames_1.length; _i++) { 26 | var size = sizeNames_1[_i]; 27 | var value = this[size]; 28 | if (width <= value.max) { 29 | return size; 30 | } 31 | } 32 | return 'large'; 33 | }, 34 | }; 35 | exports.mediaQueryRegex = /@\s*?media\s*?\(\s*?max-width\s*?:\s*?(\d+)(px)\s*?\)\s*?/; 36 | -------------------------------------------------------------------------------- /dist/src/helpers/replace-identifiers.d.ts: -------------------------------------------------------------------------------- 1 | import { types } from '@babel/core'; 2 | export type ReplaceTo = string | ((accessedProperty: string, matchedIdentifier: string) => string) | null; 3 | type ReplaceArgs = { 4 | code: string; 5 | from: string | string[]; 6 | to: ReplaceTo; 7 | }; 8 | /** 9 | * @deprecated Use `replaceNodes` instead. 10 | */ 11 | export declare const replaceIdentifiers: ({ code, from, to }: ReplaceArgs) => string; 12 | export declare const replaceStateIdentifier: (to: ReplaceArgs['to']) => (code: string) => string; 13 | export declare const replacePropsIdentifier: (to: ReplaceArgs['to']) => (code: string) => string; 14 | /** 15 | * Replaces all instances of a Babel AST Node with a new Node within a code string. 16 | * Uses `generate()` to convert the Node to a string and compare them. 17 | */ 18 | export declare const replaceNodes: ({ code, nodeMaps, }: { 19 | code: string; 20 | nodeMaps: { 21 | from: types.Node; 22 | condition?: ((path: babel.NodePath) => boolean) | undefined; 23 | to: types.Node; 24 | }[]; 25 | }) => string; 26 | export {}; 27 | -------------------------------------------------------------------------------- /dist/src/generators/react/index.js: -------------------------------------------------------------------------------- 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 __exportStar = (this && this.__exportStar) || function(m, exports) { 14 | for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); 15 | }; 16 | Object.defineProperty(exports, "__esModule", { value: true }); 17 | exports.blockToReact = void 0; 18 | var blocks_1 = require("./blocks"); 19 | Object.defineProperty(exports, "blockToReact", { enumerable: true, get: function () { return blocks_1.blockToReact; } }); 20 | __exportStar(require("./generator"), exports); 21 | __exportStar(require("./types"), exports); 22 | -------------------------------------------------------------------------------- /dist/src/generators/context/qwik.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | exports.contextToQwik = void 0; 4 | var standalone_1 = require("prettier/standalone"); 5 | var contextToQwik = function (options) { 6 | if (options === void 0) { options = {}; } 7 | return function (_a) { 8 | var context = _a.context; 9 | var str = "\n import { createContextId } from '@builder.io/qwik';\n\n export default createContextId(\"".concat(context.name, "\")\n "); 10 | if (options.format !== false) { 11 | try { 12 | str = (0, standalone_1.format)(str, { 13 | parser: 'typescript', 14 | plugins: [ 15 | require('prettier/parser-typescript'), // To support running in browsers 16 | ], 17 | }); 18 | } 19 | catch (err) { 20 | console.error('Format error for file:', str); 21 | throw err; 22 | } 23 | } 24 | return str; 25 | }; 26 | }; 27 | exports.contextToQwik = contextToQwik; 28 | -------------------------------------------------------------------------------- /dist/src/generators/helpers/context.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | exports.getContextType = exports.hasGetContext = exports.hasSetContext = exports.hasContext = void 0; 4 | var hasContext = function (component) { 5 | return (0, exports.hasSetContext)(component) || (0, exports.hasGetContext)(component); 6 | }; 7 | exports.hasContext = hasContext; 8 | var hasSetContext = function (component) { 9 | return Object.keys(component.context.set).length > 0; 10 | }; 11 | exports.hasSetContext = hasSetContext; 12 | var hasGetContext = function (component) { 13 | return Object.keys(component.context.get).length > 0; 14 | }; 15 | exports.hasGetContext = hasGetContext; 16 | var getContextType = function (_a) { 17 | var _b, _c; 18 | var component = _a.component, context = _a.context; 19 | // TO-DO: remove useMetadata check if no longer needed. 20 | return ((_c = (_b = component.meta.useMetadata) === null || _b === void 0 ? void 0 : _b.contextTypes) === null || _c === void 0 ? void 0 : _c[context.name]) || context.type || 'normal'; 21 | }; 22 | exports.getContextType = getContextType; 23 | -------------------------------------------------------------------------------- /dist/src/helpers/process-http-requests.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | exports.processHttpRequests = void 0; 4 | function processHttpRequests(json) { 5 | var _a, _b; 6 | var httpRequests = (_b = (_a = json === null || json === void 0 ? void 0 : json.meta) === null || _a === void 0 ? void 0 : _a.useMetadata) === null || _b === void 0 ? void 0 : _b.httpRequests; 7 | if (httpRequests) { 8 | for (var key in httpRequests) { 9 | if (!json.state[key]) { 10 | json.state[key] = { code: 'null', type: 'property', propertyType: 'normal' }; 11 | } 12 | var value = httpRequests[key]; 13 | // TODO: unravel our proxy. aka parse out methods, header, etc 14 | // and remove our proxy from being used anymore 15 | json.hooks.onMount.push({ 16 | code: "\n fetch(\"".concat(value, "\").then(res => res.json()).then(result => {\n state.").concat(key, " = result;\n })\n "), 17 | }); 18 | } 19 | } 20 | } 21 | exports.processHttpRequests = processHttpRequests; 22 | -------------------------------------------------------------------------------- /dist/src/generators/qwik/jsx.d.ts: -------------------------------------------------------------------------------- 1 | import { MitosisNode } from '../../types/mitosis-node'; 2 | import { CssStyles } from './helpers/styles'; 3 | import { File } from './src-generator'; 4 | /** 5 | * Convert a Mitosis nodes to a JSX nodes. 6 | * 7 | * @param file File into which the output will be written to. 8 | * @param directives Store for directives which we came across so that they can be imported. 9 | * @param handlers A set of handlers which we came across so that they can be rendered 10 | * @param children A list of children to convert to JSX 11 | * @param styles Store for styles which we came across so that they can be rendered. 12 | * @param key Key to be used for the node if needed 13 | * @param parentSymbolBindings A set of bindings from parent to be written into the child. 14 | * @param root True if this is the root JSX, and may need a Fragment wrapper. 15 | * @returns 16 | */ 17 | export declare function renderJSXNodes(file: File, directives: Map, handlers: Map, children: MitosisNode[], styles: Map, key: string | null | undefined, parentSymbolBindings: Record, root?: boolean): any; 18 | -------------------------------------------------------------------------------- /dist/src/parsers/svelte/html/each.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | var __assign = (this && this.__assign) || function () { 3 | __assign = Object.assign || function(t) { 4 | for (var s, i = 1, n = arguments.length; i < n; i++) { 5 | s = arguments[i]; 6 | for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) 7 | t[p] = s[p]; 8 | } 9 | return t; 10 | }; 11 | return __assign.apply(this, arguments); 12 | }; 13 | Object.defineProperty(exports, "__esModule", { value: true }); 14 | exports.parseEach = void 0; 15 | var children_1 = require("../helpers/children"); 16 | var mitosis_node_1 = require("../helpers/mitosis-node"); 17 | var bindings_1 = require("../../../helpers/bindings"); 18 | function parseEach(json, node) { 19 | return __assign(__assign({}, (0, mitosis_node_1.createMitosisNode)()), { name: 'For', scope: { forName: node.context.name }, bindings: { 20 | each: (0, bindings_1.createSingleBinding)({ 21 | code: node.expression.name, 22 | }), 23 | }, children: (0, children_1.parseChildren)(json, node) }); 24 | } 25 | exports.parseEach = parseEach; 26 | -------------------------------------------------------------------------------- /dist/src/helpers/get-prop-functions.js: -------------------------------------------------------------------------------- 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.getPropFunctions = void 0; 7 | var traverse_1 = __importDefault(require("traverse")); 8 | var propsRegex = /props\s*\.\s*([a-zA-Z0-9_\4]+)\(/; 9 | var allPropsMatchesRegex = new RegExp(propsRegex, 'g'); 10 | /** 11 | * Get props used in the components by reference 12 | */ 13 | var getPropFunctions = function (json) { 14 | var props = []; 15 | (0, traverse_1.default)(json).forEach(function (item) { 16 | if (typeof item === 'string') { 17 | // TODO: proper babel ref matching 18 | var matches = item.match(allPropsMatchesRegex); 19 | if (matches) { 20 | for (var _i = 0, matches_1 = matches; _i < matches_1.length; _i++) { 21 | var match = matches_1[_i]; 22 | props.push(match.match(propsRegex)[1]); 23 | } 24 | } 25 | } 26 | }); 27 | return props; 28 | }; 29 | exports.getPropFunctions = getPropFunctions; 30 | -------------------------------------------------------------------------------- /dist/src/parsers/svelte/html/text.d.ts: -------------------------------------------------------------------------------- 1 | import type { TemplateNode } from 'svelte/types/compiler/interfaces'; 2 | export declare function parseText(node: TemplateNode): { 3 | name: string; 4 | properties: { 5 | _text: any; 6 | }; 7 | '@type': "@builder.io/mitosis/node"; 8 | meta: import("../../../types/json").JSONObject; 9 | scope: {}; 10 | bindings: { 11 | [key: string]: import("../../..").Binding | undefined; 12 | }; 13 | children: import("../../..").MitosisNode[]; 14 | slots?: { 15 | [key: string]: import("../../..").MitosisNode[]; 16 | } | undefined; 17 | } | { 18 | name: string; 19 | properties: { 20 | _text: any; 21 | }; 22 | '@type': "@builder.io/mitosis/node"; 23 | meta: import("../../../types/json").JSONObject; 24 | scope: { 25 | forName: string | undefined; 26 | indexName: string | undefined; 27 | collectionName: string | undefined; 28 | }; 29 | bindings: { 30 | [key: string]: import("../../..").Binding | undefined; 31 | }; 32 | children: import("../../..").MitosisNode[]; 33 | slots?: { 34 | [key: string]: import("../../..").MitosisNode[]; 35 | } | undefined; 36 | }; 37 | -------------------------------------------------------------------------------- /dist/src/helpers/get-styles.js: -------------------------------------------------------------------------------- 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.setStyles = exports.getStyles = void 0; 7 | var json5_1 = __importDefault(require("json5")); 8 | var lodash_1 = require("lodash"); 9 | var bindings_1 = require("./bindings"); 10 | var getStyles = function (json) { 11 | var _a; 12 | if (!json.bindings.css) { 13 | return null; 14 | } 15 | var css; 16 | try { 17 | css = json5_1.default.parse((_a = json.bindings.css) === null || _a === void 0 ? void 0 : _a.code); 18 | } 19 | catch (err) { 20 | console.warn('Could not json 5 parse css', err, json.bindings.css.code); 21 | return null; 22 | } 23 | return css; 24 | }; 25 | exports.getStyles = getStyles; 26 | var setStyles = function (json, styles) { 27 | if (!(0, lodash_1.size)(styles)) { 28 | delete json.bindings.css; 29 | } 30 | else { 31 | json.bindings.css = (0, bindings_1.createSingleBinding)({ code: json5_1.default.stringify(styles) }); 32 | } 33 | }; 34 | exports.setStyles = setStyles; 35 | -------------------------------------------------------------------------------- /dist/src/helpers/get-state-used.js: -------------------------------------------------------------------------------- 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.getStateUsed = void 0; 7 | var traverse_1 = __importDefault(require("traverse")); 8 | var stateAccessRegex = /state\s*\.\s*([a-zA-Z0-9_\$]+)/; 9 | var allStateMatchesRegex = new RegExp(stateAccessRegex, 'g'); 10 | /** 11 | * Get state used in the components by reference 12 | */ 13 | var getStateUsed = function (json) { 14 | var stateProperties = new Set(); 15 | (0, traverse_1.default)(json).forEach(function (item) { 16 | if (typeof item === 'string') { 17 | // TODO: proper babel ref matching 18 | var matches = item.match(allStateMatchesRegex); 19 | if (matches) { 20 | for (var _i = 0, matches_1 = matches; _i < matches_1.length; _i++) { 21 | var match = matches_1[_i]; 22 | stateProperties.add(match.match(stateAccessRegex)[1]); 23 | } 24 | } 25 | } 26 | }); 27 | return stateProperties; 28 | }; 29 | exports.getStateUsed = getStateUsed; 30 | -------------------------------------------------------------------------------- /dist/src/generators/context/solid.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | exports.contextToSolid = void 0; 4 | var get_state_object_string_1 = require("../../helpers/get-state-object-string"); 5 | var standalone_1 = require("prettier/standalone"); 6 | var contextToSolid = function (options) { 7 | if (options === void 0) { options = {}; } 8 | return function (_a) { 9 | var context = _a.context; 10 | var str = "\n import { createContext } from 'solid-js';\n\n export default createContext(".concat((0, get_state_object_string_1.stringifyContextValue)(context.value), ")\n "); 11 | if (options.format !== false) { 12 | try { 13 | str = (0, standalone_1.format)(str, { 14 | parser: 'typescript', 15 | plugins: [ 16 | require('prettier/parser-typescript'), // To support running in browsers 17 | ], 18 | }); 19 | } 20 | catch (err) { 21 | console.error('Format error for file:', str); 22 | throw err; 23 | } 24 | } 25 | return str; 26 | }; 27 | }; 28 | exports.contextToSolid = contextToSolid; 29 | -------------------------------------------------------------------------------- /dist/src/generators/qwik/helpers/state.d.ts: -------------------------------------------------------------------------------- 1 | import { ComponentMetadata } from '../../../types/metadata'; 2 | import { MitosisComponent } from '../../../types/mitosis-component'; 3 | import { File } from '../src-generator'; 4 | /** 5 | * Stores getters and initialization map. 6 | */ 7 | export type StateInit = [ 8 | StateValues, 9 | /** 10 | * Set of state initializers. 11 | */ 12 | ...string[] 13 | ]; 14 | export type PropertyName = string; 15 | export type StateValue = string; 16 | /** 17 | * Map of getters that need to be rewritten to function invocations. 18 | */ 19 | export type StateValues = Record; 20 | /** 21 | * @param file 22 | * @param stateInit 23 | */ 24 | export declare function emitUseStore({ file, stateInit, isDeep, }: { 25 | file: File; 26 | stateInit: StateInit; 27 | isDeep?: boolean; 28 | }): void; 29 | export declare function emitStateMethodsAndRewriteBindings(file: File, component: MitosisComponent, metadata?: ComponentMetadata): StateInit; 30 | export declare function getLexicalScopeVars(component: MitosisComponent): string[]; 31 | export type MethodMap = Record; 32 | export declare function getStateMethodsAndGetters(state: MitosisComponent['state']): MethodMap; 33 | -------------------------------------------------------------------------------- /dist/src/generators/context/helpers/context-with-symbol-key.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | exports.getContextWithSymbolKey = void 0; 4 | var standalone_1 = require("prettier/standalone"); 5 | var get_state_object_string_1 = require("../../../helpers/get-state-object-string"); 6 | var getContextWithSymbolKey = function (options) { 7 | return function (_a) { 8 | var context = _a.context; 9 | var str = "\n const key = Symbol(); \n\n export default {\n ".concat(context.name, ": ").concat((0, get_state_object_string_1.stringifyContextValue)(context.value), ", \n key \n }\n "); 10 | if (options.prettier !== false) { 11 | try { 12 | str = (0, standalone_1.format)(str, { 13 | parser: 'typescript', 14 | plugins: [ 15 | require('prettier/parser-typescript'), // To support running in browsers 16 | ], 17 | }); 18 | } 19 | catch (err) { 20 | console.error('Format error for file:', str); 21 | throw err; 22 | } 23 | } 24 | return str; 25 | }; 26 | }; 27 | exports.getContextWithSymbolKey = getContextWithSymbolKey; 28 | -------------------------------------------------------------------------------- /dist/src/generators/helpers/functions.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | exports.FUNCTION_HACK_PLUGIN = void 0; 4 | var patterns_1 = require("../../helpers/patterns"); 5 | var FUNCTION_HACK_PLUGIN = function () { return ({ 6 | json: { 7 | pre: function (json) { 8 | var _a, _b; 9 | for (var key in json.state) { 10 | var value = (_a = json.state[key]) === null || _a === void 0 ? void 0 : _a.code; 11 | var type = (_b = json.state[key]) === null || _b === void 0 ? void 0 : _b.type; 12 | if (typeof value === 'string' && type === 'method') { 13 | var newValue = (0, patterns_1.prefixWithFunction)(value); 14 | json.state[key] = { 15 | code: newValue, 16 | type: 'method', 17 | }; 18 | } 19 | else if (typeof value === 'string' && type === 'function') { 20 | json.state[key] = { 21 | code: value, 22 | type: 'method', 23 | }; 24 | } 25 | } 26 | }, 27 | }, 28 | }); }; 29 | exports.FUNCTION_HACK_PLUGIN = FUNCTION_HACK_PLUGIN; 30 | -------------------------------------------------------------------------------- /dist/src/helpers/patterns.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | exports.prefixWithFunction = exports.extractGetterCodeBlock = exports.replaceFunctionWithGetter = exports.replaceGetterWithFunction = exports.stripGetter = exports.checkIsGetter = exports.SETTER = exports.GETTER = void 0; 4 | exports.GETTER = /^\s*get /; 5 | exports.SETTER = /^\s*set /; 6 | var checkIsGetter = function (code) { return code.match(exports.GETTER); }; 7 | exports.checkIsGetter = checkIsGetter; 8 | var stripGetter = function (str) { return str.replace(exports.GETTER, ''); }; 9 | exports.stripGetter = stripGetter; 10 | var replaceGetterWithFunction = function (str) { return str.replace(/^(get )?/, 'function '); }; 11 | exports.replaceGetterWithFunction = replaceGetterWithFunction; 12 | var replaceFunctionWithGetter = function (str) { return str.replace(/^(function )?/, 'get '); }; 13 | exports.replaceFunctionWithGetter = replaceFunctionWithGetter; 14 | var extractGetterCodeBlock = function (getter) { 15 | return getter.replace(/[\S\s]*\(\) \{([\S\s]*)\}[\S\s]*/, '$1').trim(); 16 | }; 17 | exports.extractGetterCodeBlock = extractGetterCodeBlock; 18 | var prefixWithFunction = function (str) { return "function ".concat(str); }; 19 | exports.prefixWithFunction = prefixWithFunction; 20 | -------------------------------------------------------------------------------- /dist/src/helpers/generic-format.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | exports.format = void 0; 4 | var preSpaceRegex = /^\s*/g; 5 | var DEFAULT_INDENT_SPACES = 2; 6 | /** 7 | * Generic formatter for languages prettier doesn't support, like Swift 8 | * 9 | * Not super sophisticated, but much better than nothing 10 | */ 11 | var format = function (str, indentSpaces) { 12 | if (indentSpaces === void 0) { indentSpaces = DEFAULT_INDENT_SPACES; } 13 | var currentIndent = 0; 14 | var lines = str.split('\n'); 15 | lines.forEach(function (item, index) { 16 | item = item.trimEnd(); 17 | if (!item) { 18 | lines[index] = ''; 19 | return; 20 | } 21 | lines[index] = item.replace(preSpaceRegex, ' '.repeat(currentIndent * indentSpaces)); 22 | var nextLine = lines[index + 1]; 23 | if (!nextLine) { 24 | return; 25 | } 26 | if (nextLine.match(/^\s*[})][,;]?\s*$/)) { 27 | currentIndent--; 28 | } 29 | else if (item.match(/([({]| in)$/)) { 30 | currentIndent++; 31 | } 32 | currentIndent = Math.max(currentIndent, 0); 33 | }); 34 | return lines.join('\n').replace(/\n{3,}/g, '\n\n'); 35 | }; 36 | exports.format = format; 37 | -------------------------------------------------------------------------------- /dist/src/parsers/svelte/instance/hooks.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | exports.parseAfterUpdate = exports.parseOnDestroy = exports.parseOnMount = void 0; 4 | var astring_1 = require("astring"); 5 | function parseHookBody(node, stripCurlyBraces) { 6 | var _a; 7 | if (stripCurlyBraces === void 0) { stripCurlyBraces = true; } 8 | var arguments_ = (_a = node.expression) === null || _a === void 0 ? void 0 : _a.arguments; 9 | var code = (0, astring_1.generate)(arguments_[0].body); 10 | if (stripCurlyBraces && (code === null || code === void 0 ? void 0 : code.trim().length) && code[0] === '{' && code[code.length - 1] === '}') 11 | code = code.slice(1, -1); 12 | return code; 13 | } 14 | function parseOnMount(json, node) { 15 | json.hooks.onMount.push({ 16 | code: parseHookBody(node), 17 | }); 18 | } 19 | exports.parseOnMount = parseOnMount; 20 | function parseOnDestroy(json, node) { 21 | json.hooks.onUnMount = { 22 | code: parseHookBody(node), 23 | }; 24 | } 25 | exports.parseOnDestroy = parseOnDestroy; 26 | function parseAfterUpdate(json, node) { 27 | json.hooks.onUpdate = [ 28 | { 29 | code: parseHookBody(node), 30 | }, 31 | ]; 32 | } 33 | exports.parseAfterUpdate = parseAfterUpdate; 34 | -------------------------------------------------------------------------------- /dist/src/generators/context/rsc.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | exports.contextToRsc = void 0; 4 | var get_state_object_string_1 = require("../../helpers/get-state-object-string"); 5 | var standalone_1 = require("prettier/standalone"); 6 | /** 7 | * React Server Components currently do not support context, so we use 8 | * plain objects and prop drilling instead. 9 | */ 10 | var contextToRsc = function (options) { 11 | if (options === void 0) { options = {}; } 12 | return function (_a) { 13 | var context = _a.context; 14 | var str = "\n export default ".concat((0, get_state_object_string_1.stringifyContextValue)(context.value), "\n "); 15 | if (options.format !== false) { 16 | try { 17 | str = (0, standalone_1.format)(str, { 18 | parser: 'typescript', 19 | plugins: [ 20 | require('prettier/parser-typescript'), // To support running in browsers 21 | ], 22 | }); 23 | } 24 | catch (err) { 25 | console.error('Format error for file:', str); 26 | throw err; 27 | } 28 | } 29 | return str; 30 | }; 31 | }; 32 | exports.contextToRsc = contextToRsc; 33 | -------------------------------------------------------------------------------- /dist/src/helpers/get-props-ref.js: -------------------------------------------------------------------------------- 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.getPropsRef = void 0; 7 | var traverse_1 = __importDefault(require("traverse")); 8 | var is_mitosis_node_1 = require("./is-mitosis-node"); 9 | function getPropsRef(json, shouldRemove) { 10 | var has = false; 11 | var prop = ''; 12 | (0, traverse_1.default)(json).forEach(function (item) { 13 | if ((0, is_mitosis_node_1.isMitosisNode)(item)) { 14 | var binding = item.bindings.ref; 15 | var regexp = /(.+)?props\.(.+)( |\)|;|\()?$/; 16 | if (binding && regexp.test(binding.code)) { 17 | var match = regexp.exec(binding.code); 18 | var _prop = match === null || match === void 0 ? void 0 : match[2]; 19 | if (_prop) { 20 | prop = _prop; 21 | } 22 | if (shouldRemove) { 23 | delete item.bindings.ref; 24 | } 25 | has = true; 26 | this.stop(); 27 | } 28 | } 29 | }); 30 | return [prop, has]; 31 | } 32 | exports.getPropsRef = getPropsRef; 33 | -------------------------------------------------------------------------------- /dist/src/helpers/slots.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | exports.replaceSlotsInString = exports.stripSlotPrefix = exports.isSlotProperty = void 0; 4 | var core_1 = require("@babel/core"); 5 | var babel_transform_1 = require("./babel-transform"); 6 | var SLOT_PREFIX = 'slot'; 7 | var isSlotProperty = function (key, slotPrefix) { 8 | if (slotPrefix === void 0) { slotPrefix = SLOT_PREFIX; } 9 | return key.startsWith(slotPrefix); 10 | }; 11 | exports.isSlotProperty = isSlotProperty; 12 | var stripSlotPrefix = function (key, slotPrefix) { 13 | if (slotPrefix === void 0) { slotPrefix = SLOT_PREFIX; } 14 | return (0, exports.isSlotProperty)(key, slotPrefix) ? key.substring(slotPrefix.length) : key; 15 | }; 16 | exports.stripSlotPrefix = stripSlotPrefix; 17 | function replaceSlotsInString(code, mapper) { 18 | return (0, babel_transform_1.babelTransformExpression)(code, { 19 | Identifier: function (path) { 20 | var name = path.node.name; 21 | var isSlot = (0, exports.isSlotProperty)(name); 22 | if (isSlot) { 23 | path.replaceWith(core_1.types.identifier(mapper((0, exports.stripSlotPrefix)(name).toLowerCase()))); 24 | } 25 | }, 26 | }); 27 | } 28 | exports.replaceSlotsInString = replaceSlotsInString; 29 | -------------------------------------------------------------------------------- /dist/src/helpers/transform-state-setters.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | exports.transformStateSetters = void 0; 4 | var core_1 = require("@babel/core"); 5 | var babel_transform_1 = require("./babel-transform"); 6 | /** 7 | * Finds instances of state being set in `value`, and transforms them using the 8 | * provided `transformer`. 9 | */ 10 | var transformStateSetters = function (_a) { 11 | var value = _a.value, transformer = _a.transformer; 12 | return (0, babel_transform_1.babelTransformExpression)(value, { 13 | AssignmentExpression: function (path) { 14 | var node = path.node; 15 | if (core_1.types.isMemberExpression(node.left) && 16 | core_1.types.isIdentifier(node.left.object) && 17 | // TODO: utillity to properly trace this reference to the beginning 18 | node.left.object.name === 'state') { 19 | // TODO: ultimately support other property access like strings 20 | var propertyName = node.left.property.name; 21 | var newExpression = transformer({ path: path, propertyName: propertyName }); 22 | path.replaceWith(newExpression); 23 | } 24 | }, 25 | }); 26 | }; 27 | exports.transformStateSetters = transformStateSetters; 28 | -------------------------------------------------------------------------------- /dist/src/helpers/styles/helpers.d.ts: -------------------------------------------------------------------------------- 1 | import * as CSS from 'csstype'; 2 | import { MitosisComponent } from '../../types/mitosis-component'; 3 | import { MitosisNode } from '../../types/mitosis-node'; 4 | export declare const nodeHasCss: (node: MitosisNode) => boolean; 5 | export declare const nodeHasStyle: (node: MitosisNode) => boolean; 6 | export declare const hasCss: (component: MitosisComponent) => boolean; 7 | export declare const hasStyle: (component: MitosisComponent) => boolean; 8 | /** 9 | * e.g.: 10 | * { 11 | * display: 'none', 12 | * '@media (max-width: 500px)': { 13 | * '& .sub-class': { 14 | * display: 'block' 15 | * } 16 | * } 17 | * } 18 | */ 19 | export type StyleMap = { 20 | [className: string]: CSS.Properties | StyleMap; 21 | }; 22 | export declare const getNestedSelectors: (map: StyleMap) => import("lodash").Dictionary | StyleMap>; 23 | export declare const getStylesOnly: (map: StyleMap) => import("lodash").Dictionary | StyleMap>; 24 | /** 25 | * { 'my-class': { display: 'block', '&.foo': { display: 'none' } }} 26 | */ 27 | export type ClassStyleMap = { 28 | [key: string]: StyleMap; 29 | }; 30 | export declare const parseCssObject: (css: string) => any; 31 | export declare const styleMapToCss: (map: StyleMap) => string; 32 | -------------------------------------------------------------------------------- /dist/src/generators/context/react.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | exports.contextToReact = void 0; 4 | var get_state_object_string_1 = require("../../helpers/get-state-object-string"); 5 | var standalone_1 = require("prettier/standalone"); 6 | var contextToReact = function (options) { 7 | if (options === void 0) { options = { typescript: false, preact: false }; } 8 | return function (_a) { 9 | var context = _a.context; 10 | var str = "\n import { createContext } from '".concat(options.preact ? 'preact' : 'react', "';\n\n export default createContext").concat(options.typescript ? '' : '', "(").concat((0, get_state_object_string_1.stringifyContextValue)(context.value), ")\n "); 11 | if (options.format !== false) { 12 | try { 13 | str = (0, standalone_1.format)(str, { 14 | parser: 'typescript', 15 | plugins: [ 16 | require('prettier/parser-typescript'), // To support running in browsers 17 | ], 18 | }); 19 | } 20 | catch (err) { 21 | console.error('Format error for file:', str); 22 | throw err; 23 | } 24 | } 25 | return str; 26 | }; 27 | }; 28 | exports.contextToReact = contextToReact; 29 | -------------------------------------------------------------------------------- /dist/src/parsers/builder/helpers.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | exports.mapBuilderContentStateToMitosisState = void 0; 4 | var lodash_1 = require("lodash"); 5 | var patterns_1 = require("../../helpers/patterns"); 6 | var __DO_NOT_USE_FUNCTION_LITERAL_PREFIX = "@builder.io/mitosis/function:"; 7 | var __DO_NOT_USE_METHOD_LITERAL_PREFIX = "@builder.io/mitosis/method:"; 8 | /** 9 | * Maps the Builder State format to the Mitosis State format. 10 | */ 11 | var mapJsonToStateValue = function (value) { 12 | if (typeof value === 'string') { 13 | if (value.startsWith(__DO_NOT_USE_FUNCTION_LITERAL_PREFIX)) { 14 | return { type: 'function', code: value.replace(__DO_NOT_USE_FUNCTION_LITERAL_PREFIX, '') }; 15 | } 16 | else if (value.startsWith(__DO_NOT_USE_METHOD_LITERAL_PREFIX)) { 17 | var strippedValue = value.replace(__DO_NOT_USE_METHOD_LITERAL_PREFIX, ''); 18 | var isGet = Boolean(strippedValue.match(patterns_1.GETTER)); 19 | var type = isGet ? 'getter' : 'method'; 20 | return { type: type, code: strippedValue }; 21 | } 22 | } 23 | return { type: 'property', code: JSON.stringify(value), propertyType: 'normal' }; 24 | }; 25 | var mapBuilderContentStateToMitosisState = function (value) { return (0, lodash_1.mapValues)(value, mapJsonToStateValue); }; 26 | exports.mapBuilderContentStateToMitosisState = mapBuilderContentStateToMitosisState; 27 | -------------------------------------------------------------------------------- /dist/src/parsers/builder/builder.d.ts: -------------------------------------------------------------------------------- 1 | import { MitosisComponent, MitosisState } from '../../types/mitosis-component'; 2 | import { BuilderContent, BuilderElement } from '@builder.io/sdk'; 3 | import { MitosisNode } from '../../types/mitosis-node'; 4 | type InternalOptions = { 5 | skipMapper?: boolean; 6 | }; 7 | export declare const symbolBlocksAsChildren = false; 8 | type BuilderToMitosisOptions = { 9 | context?: { 10 | [key: string]: any; 11 | }; 12 | includeBuilderExtras?: boolean; 13 | preserveTextBlocks?: boolean; 14 | includeSpecialBindings?: boolean; 15 | }; 16 | export declare const builderElementToMitosisNode: (block: BuilderElement, options: BuilderToMitosisOptions, _internalOptions?: InternalOptions) => MitosisNode; 17 | /** 18 | * Take Builder custom jsCode and extract the contents of the useState hook 19 | * and return it as a JS object along with the inputted code with the hook 20 | * code extracted 21 | */ 22 | export declare function extractStateHook(code: string): { 23 | code: string; 24 | state: MitosisState; 25 | }; 26 | export declare function convertExportDefaultToReturn(code: string): string; 27 | export declare const createBuilderElement: (options?: Partial) => BuilderElement; 28 | export declare const isBuilderElement: (el: unknown) => el is BuilderElement; 29 | export declare const builderContentToMitosisComponent: (builderContent: BuilderContent, options?: BuilderToMitosisOptions) => MitosisComponent; 30 | export {}; 31 | -------------------------------------------------------------------------------- /dist/src/generators/context/angular.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | exports.contextToAngular = void 0; 4 | var get_state_object_string_1 = require("../../helpers/get-state-object-string"); 5 | var standalone_1 = require("prettier/standalone"); 6 | var contextToAngular = function (options) { 7 | if (options === void 0) { options = { typescript: false }; } 8 | return function (_a) { 9 | var context = _a.context; 10 | var str = "\nimport { Injectable } from '@angular/core';\n\n@Injectable({\n providedIn: 'root'\n})\nexport default class ".concat(context.name, "Context {\n ").concat((0, get_state_object_string_1.stringifyContextValue)(context.value) 11 | .replace(/^\{/, '') 12 | .replace(/\}$/, '') 13 | .replaceAll(',', ';\n') 14 | .replaceAll(':', ': any = '), "\n constructor() { }\n}\n "); 15 | if (options.format !== false) { 16 | try { 17 | str = (0, standalone_1.format)(str, { 18 | parser: 'typescript', 19 | plugins: [ 20 | require('prettier/parser-typescript'), // To support running in browsers 21 | ], 22 | }); 23 | } 24 | catch (err) { 25 | console.error('Format error for file:', str); 26 | throw err; 27 | } 28 | } 29 | return str; 30 | }; 31 | }; 32 | exports.contextToAngular = contextToAngular; 33 | -------------------------------------------------------------------------------- /dist/src/helpers/strip-state-and-props-refs.d.ts: -------------------------------------------------------------------------------- 1 | export type StripStateAndPropsRefsOptions = { 2 | replaceWith?: string | ((name: string) => string); 3 | includeProps?: boolean; 4 | includeState?: boolean; 5 | }; 6 | /** 7 | * Do not use this anywhere. We are migrating to AST transforms and should avoid Regex String.replace() as they are 8 | * very brittle. 9 | * 10 | * If you need to re-use this, re-create it as an AST tranform first. 11 | */ 12 | export declare const DO_NOT_USE_CONTEXT_VARS_TRANSFORMS: ({ code, contextVars, context, }: { 13 | code: string; 14 | contextVars?: string[] | undefined; 15 | context: string; 16 | }) => string; 17 | export type DO_NOT_USE_ARGS = { 18 | outputVars?: string[]; 19 | domRefs?: string[]; 20 | stateVars?: string[]; 21 | contextVars?: string[]; 22 | context?: string; 23 | }; 24 | /** 25 | * Do not use these anywhere. We are migrating to AST transforms and should avoid Regex String.replace() as they are 26 | * very brittle. 27 | * 28 | * If you need to re-use a part of this, re-create it as an AST tranform first. 29 | */ 30 | export declare const DO_NOT_USE_VARS_TRANSFORMS: (newCode: string, { context, domRefs, outputVars, stateVars, contextVars }: DO_NOT_USE_ARGS) => string; 31 | /** 32 | * Remove state. and props. from expressions, e.g. 33 | * state.foo -> foo 34 | * 35 | * This is for support for frameworks like Vue, Svelte, liquid, etc 36 | * 37 | */ 38 | export declare const stripStateAndPropsRefs: (code?: string, _options?: StripStateAndPropsRefsOptions) => string; 39 | -------------------------------------------------------------------------------- /dist/src/generators/context/svelte.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | exports.contextToSvelte = void 0; 4 | var get_state_object_string_1 = require("../../helpers/get-state-object-string"); 5 | var standalone_1 = require("prettier/standalone"); 6 | /** 7 | * TO-DO: support types 8 | */ 9 | var contextToSvelte = function (options) { 10 | return function (_a) { 11 | var context = _a.context; 12 | var isReactive = context.type === 'reactive'; 13 | var str = "\nconst key = Symbol(); \n".concat(isReactive ? 'import {writable} from "svelte/store";' : '', "\n\nexport default {\n ").concat(context.name, ": ").concat([ 14 | isReactive && 'writable(', 15 | (0, get_state_object_string_1.stringifyContextValue)(context.value), 16 | isReactive && ')', 17 | ] 18 | .filter(Boolean) 19 | .join(''), ", \n key \n}\n"); 20 | if (options.prettier !== false) { 21 | try { 22 | str = (0, standalone_1.format)(str, { 23 | parser: 'typescript', 24 | plugins: [ 25 | require('prettier/parser-typescript'), // To support running in browsers 26 | ], 27 | }); 28 | } 29 | catch (err) { 30 | console.error('Format error for file:', str); 31 | throw err; 32 | } 33 | } 34 | return str; 35 | }; 36 | }; 37 | exports.contextToSvelte = contextToSvelte; 38 | -------------------------------------------------------------------------------- /dist/src/parsers/svelte/instance/properties.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | var __assign = (this && this.__assign) || function () { 3 | __assign = Object.assign || function(t) { 4 | for (var s, i = 1, n = arguments.length; i < n; i++) { 5 | s = arguments[i]; 6 | for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) 7 | t[p] = s[p]; 8 | } 9 | return t; 10 | }; 11 | return __assign.apply(this, arguments); 12 | }; 13 | Object.defineProperty(exports, "__esModule", { value: true }); 14 | exports.parseProperties = void 0; 15 | function parseProperties(json, node) { 16 | var _a; 17 | var _b, _c; 18 | var declarations = (_b = node.declaration) === null || _b === void 0 ? void 0 : _b.declarations; 19 | if (declarations === null || declarations === void 0 ? void 0 : declarations.length) { 20 | var declaration = declarations[0]; 21 | var property = declaration.id.name; 22 | var value = (_c = declaration.init) === null || _c === void 0 ? void 0 : _c.value; 23 | var propertyObject = (_a = {}, 24 | _a[property] = { 25 | default: value, 26 | }, 27 | _a); 28 | json.props = __assign(__assign({}, json.props), propertyObject); 29 | json.defaultProps = Object.fromEntries(Object.keys(json.props) 30 | .filter(function (key) { return json.props[key].default; }) 31 | .map(function (key) { return [key, json.props[key].default]; })); 32 | } 33 | } 34 | exports.parseProperties = parseProperties; 35 | -------------------------------------------------------------------------------- /dist/src/generators/qwik/helpers/add-prevent-default.js: -------------------------------------------------------------------------------- 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.addPreventDefault = void 0; 7 | var traverse_1 = __importDefault(require("traverse")); 8 | var is_mitosis_node_1 = require("../../../helpers/is-mitosis-node"); 9 | /** 10 | * Find event handlers that explicitly call .preventDefault() and 11 | * add preventdefault:event 12 | * https://qwik.builder.io/tutorial/events/preventdefault 13 | */ 14 | function addPreventDefault(json) { 15 | (0, traverse_1.default)(json).forEach(function (node) { 16 | var _a; 17 | if ((0, is_mitosis_node_1.isMitosisNode)(node)) { 18 | if (node.bindings) { 19 | for (var _i = 0, _b = Object.keys(node.bindings); _i < _b.length; _i++) { 20 | var key = _b[_i]; 21 | if (key.startsWith('on')) { 22 | if ((_a = node.bindings[key]) === null || _a === void 0 ? void 0 : _a.code.includes('.preventDefault()')) { 23 | var event_1 = key.slice(2).toLowerCase(); 24 | node.properties['preventdefault:' + event_1] = ''; 25 | node.bindings[key].code = node.bindings[key].code.replace(/.*?\.preventDefault\(\);?/, '').trim(); 26 | } 27 | } 28 | } 29 | } 30 | } 31 | }); 32 | } 33 | exports.addPreventDefault = addPreventDefault; 34 | -------------------------------------------------------------------------------- /dist/src/parsers/svelte/instance/reactive.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | exports.parseReactive = void 0; 4 | var astring_1 = require("astring"); 5 | function parseReactive(json, node) { 6 | var body = node.body; 7 | var expression = body === null || body === void 0 ? void 0 : body.expression; 8 | if (!expression) { 9 | var wrap = node.body.type !== 'BlockStatement'; 10 | var name_1 = "reactive".concat(Object.values(json.state).filter(function (index) { return (index === null || index === void 0 ? void 0 : index.type) === 'getter'; }).length); 11 | json.state[name_1] = { 12 | code: "get ".concat(name_1, "() ").concat(wrap ? '{' : '').concat((0, astring_1.generate)(node.body)).concat(wrap ? '}' : ''), 13 | type: 'getter', 14 | }; 15 | } 16 | else if (expression.type === 'AssignmentExpression') { 17 | var name_2 = expression.left.name; 18 | json.state[name_2] = { 19 | code: "get ".concat(name_2, "() {\n return ").concat((0, astring_1.generate)(expression.right), "}"), 20 | type: 'getter', 21 | }; 22 | } 23 | else if (expression.type === 'CallExpression') { 24 | if (node.body.type === 'ExpressionStatement') { 25 | json.hooks.onUpdate = json.hooks.onUpdate || []; 26 | json.hooks.onUpdate.push({ 27 | code: (0, astring_1.generate)(node.body), 28 | deps: "[".concat(expression.arguments.map(function (arg) { return (0, astring_1.generate)(arg); }), "]"), 29 | }); 30 | } 31 | } 32 | } 33 | exports.parseReactive = parseReactive; 34 | -------------------------------------------------------------------------------- /dist/src/generators/vue/helpers.d.ts: -------------------------------------------------------------------------------- 1 | import { Nullable } from '../../helpers/nullable'; 2 | import { ContextGetInfo, ContextSetInfo, MitosisComponent } from '../../types/mitosis-component'; 3 | import { MitosisNode } from '../../types/mitosis-node'; 4 | import { ToVueOptions } from './types'; 5 | export declare const addPropertiesToJson: (properties: MitosisNode['properties']) => (json: MitosisNode) => MitosisNode; 6 | export declare const addBindingsToJson: (bindings: MitosisNode['bindings']) => (json: MitosisNode) => MitosisNode; 7 | export declare const getOnUpdateHookName: (index: number) => string; 8 | export declare const invertBooleanExpression: (expression: string) => string; 9 | export declare function encodeQuotes(string: string): string; 10 | export declare const mapMitosisComponentToKebabCase: (componentName: string) => string; 11 | export declare const renameMitosisComponentsToKebabCase: (str: string) => string; 12 | export declare function getContextNames(json: MitosisComponent): string[]; 13 | type ProcessBinding = { 14 | code: string; 15 | options: ToVueOptions; 16 | json: MitosisComponent; 17 | preserveGetter?: boolean; 18 | thisPrefix?: 'this' | '_this'; 19 | codeType?: 'state' | 'hooks' | 'bindings' | 'hooks-deps' | 'properties'; 20 | }; 21 | export declare const processBinding: ({ code, options, json, preserveGetter, thisPrefix, codeType, }: ProcessBinding) => string; 22 | export declare const getContextValue: ({ name, ref, value }: ContextSetInfo) => Nullable; 23 | export declare const checkIfContextHasStrName: (context: ContextGetInfo | ContextSetInfo) => boolean; 24 | export declare const getContextKey: (context: ContextGetInfo | ContextSetInfo) => string; 25 | export {}; 26 | -------------------------------------------------------------------------------- /dist/src/generators/qwik/helpers/stable-serialize.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | exports.stableJSONserialize = void 0; 4 | /** 5 | * Same as JSON.stringify, but sorts keys ensuring that the output is stable across runs. 6 | * @param obj 7 | * @returns JSON serialized string 8 | */ 9 | function stableJSONserialize(obj) { 10 | var output = []; 11 | _serialize(output, obj); 12 | return output.join(''); 13 | } 14 | exports.stableJSONserialize = stableJSONserialize; 15 | function _serialize(output, obj) { 16 | if (obj == null) { 17 | output.push('null'); 18 | } 19 | else if (typeof obj === 'object') { 20 | if (Array.isArray(obj)) { 21 | output.push('['); 22 | var sep = ''; 23 | for (var i = 0; i < obj.length; i++) { 24 | output.push(sep); 25 | _serialize(output, obj[i]); 26 | sep = ','; 27 | } 28 | output.push(']'); 29 | } 30 | else { 31 | var keys = Object.keys(obj).sort(); 32 | output.push('{'); 33 | var sep = ''; 34 | for (var _i = 0, keys_1 = keys; _i < keys_1.length; _i++) { 35 | var key = keys_1[_i]; 36 | var value = obj[key]; 37 | if (value !== undefined) { 38 | output.push(sep); 39 | output.push(JSON.stringify(key)); 40 | output.push(':'); 41 | _serialize(output, value); 42 | sep = ','; 43 | } 44 | } 45 | output.push('}'); 46 | } 47 | } 48 | else { 49 | output.push(JSON.stringify(obj)); 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /dist/src/generators/qwik/helpers/stable-inject.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | exports.stableInject = void 0; 4 | /** 5 | * Similar to our `stableJSONSerialize` function, except that it does not stringify the values: it injects them as-is. 6 | * This is needed for our `MitosisState` values which are JS expressions stored as strings. 7 | */ 8 | function stableInject(obj) { 9 | var output = []; 10 | _serialize(output, obj); 11 | return output.join(''); 12 | } 13 | exports.stableInject = stableInject; 14 | function _serialize(output, obj) { 15 | if (obj == null) { 16 | output.push('null'); 17 | } 18 | else if (typeof obj === 'object') { 19 | if (Array.isArray(obj)) { 20 | output.push('['); 21 | var sep = ''; 22 | for (var i = 0; i < obj.length; i++) { 23 | output.push(sep); 24 | _serialize(output, obj[i]); 25 | sep = ','; 26 | } 27 | output.push(']'); 28 | } 29 | else { 30 | var keys = Object.keys(obj).sort(); 31 | output.push('{'); 32 | var sep = ''; 33 | for (var _i = 0, keys_1 = keys; _i < keys_1.length; _i++) { 34 | var key = keys_1[_i]; 35 | var value = obj[key]; 36 | if (value !== undefined) { 37 | output.push(sep); 38 | output.push(JSON.stringify(key)); 39 | output.push(':'); 40 | _serialize(output, value); 41 | sep = ','; 42 | } 43 | } 44 | output.push('}'); 45 | } 46 | } 47 | else { 48 | output.push(obj); 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /dist/src/parsers/svelte/html/if-else.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | var __assign = (this && this.__assign) || function () { 3 | __assign = Object.assign || function(t) { 4 | for (var s, i = 1, n = arguments.length; i < n; i++) { 5 | s = arguments[i]; 6 | for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) 7 | t[p] = s[p]; 8 | } 9 | return t; 10 | }; 11 | return __assign.apply(this, arguments); 12 | }; 13 | Object.defineProperty(exports, "__esModule", { value: true }); 14 | exports.parseIfElse = void 0; 15 | var astring_1 = require("astring"); 16 | var _1 = require("."); 17 | var children_1 = require("../helpers/children"); 18 | var mitosis_node_1 = require("../helpers/mitosis-node"); 19 | var bindings_1 = require("../../../helpers/bindings"); 20 | function parseIfElse(json, node) { 21 | var _a, _b, _c; 22 | var mitosisNode = (0, mitosis_node_1.createMitosisNode)(); 23 | mitosisNode.name = 'Show'; 24 | mitosisNode.bindings = { 25 | when: (0, bindings_1.createSingleBinding)({ 26 | code: (0, astring_1.generate)(node.expression), 27 | }), 28 | }; 29 | mitosisNode.children = (0, children_1.parseChildren)(json, node); 30 | if (node.else) { 31 | mitosisNode.meta.else = 32 | ((_a = node.else.children) === null || _a === void 0 ? void 0 : _a.length) === 1 33 | ? (0, _1.parseHtmlNode)(json, node.else.children[0]) 34 | : __assign(__assign({}, (0, mitosis_node_1.createMitosisNode)()), { name: 'div', children: (_c = (_b = node.else.children) === null || _b === void 0 ? void 0 : _b.map(function (n) { return (0, _1.parseHtmlNode)(json, n); })) !== null && _c !== void 0 ? _c : [] }); 35 | } 36 | return mitosisNode; 37 | } 38 | exports.parseIfElse = parseIfElse; 39 | -------------------------------------------------------------------------------- /dist/src/generators/helpers/rsc.js: -------------------------------------------------------------------------------- 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.checkIfIsClientComponent = void 0; 7 | var is_mitosis_node_1 = require("../../helpers/is-mitosis-node"); 8 | var traverse_1 = __importDefault(require("traverse")); 9 | var checkIsNodeAMitosisComponent = function (node) { 10 | return node.name[0] === node.name[0].toUpperCase(); 11 | }; 12 | var checkIfIsClientComponent = function (json) { 13 | var _a, _b; 14 | if (json.hooks.onMount.length) 15 | return true; 16 | if ((_a = json.hooks.onUnMount) === null || _a === void 0 ? void 0 : _a.code) 17 | return true; 18 | if ((_b = json.hooks.onUpdate) === null || _b === void 0 ? void 0 : _b.length) 19 | return true; 20 | if (Object.keys(json.refs).length) 21 | return true; 22 | if (Object.keys(json.context.set).length) 23 | return true; 24 | if (Object.keys(json.context.get).length) 25 | return true; 26 | if (Object.values(json.state).filter(function (s) { return (s === null || s === void 0 ? void 0 : s.type) === 'property'; }).length) 27 | return true; 28 | var foundEventListener = false; 29 | (0, traverse_1.default)(json).forEach(function (node) { 30 | if ((0, is_mitosis_node_1.isMitosisNode)(node) && !checkIsNodeAMitosisComponent(node)) { 31 | if (Object.keys(node.bindings).filter(function (item) { return item.startsWith('on'); }).length) { 32 | foundEventListener = true; 33 | this.stop(); 34 | } 35 | } 36 | }); 37 | return foundEventListener; 38 | }; 39 | exports.checkIfIsClientComponent = checkIfIsClientComponent; 40 | --------------------------------------------------------------------------------