@builder.io/mitosis 0.7.5 → 0.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/src/generators/alpine/index.d.ts +1 -0
- package/dist/src/generators/alpine/index.js +1 -0
- package/dist/src/generators/angular/index.d.ts +1 -0
- package/dist/src/generators/angular/index.js +4 -0
- package/dist/src/generators/builder/index.d.ts +1 -0
- package/dist/src/generators/builder/index.js +1 -0
- package/dist/src/generators/html/index.d.ts +1 -0
- package/dist/src/generators/html/index.js +1 -0
- package/dist/src/generators/liquid/index.d.ts +1 -0
- package/dist/src/generators/liquid/index.js +1 -0
- package/dist/src/generators/lit/index.d.ts +1 -0
- package/dist/src/generators/lit/index.js +1 -0
- package/dist/src/generators/marko/index.d.ts +1 -0
- package/dist/src/generators/marko/index.js +1 -0
- package/dist/src/generators/mitosis/index.d.ts +1 -0
- package/dist/src/generators/mitosis/index.js +1 -0
- package/dist/src/generators/qwik/index.d.ts +1 -0
- package/dist/src/generators/qwik/index.js +15 -0
- package/dist/src/generators/react-native/index.d.ts +1 -0
- package/dist/src/generators/react-native/index.js +15 -0
- package/dist/src/generators/rsc/index.d.ts +1 -0
- package/dist/src/generators/rsc/index.js +1 -0
- package/dist/src/generators/solid/index.d.ts +1 -0
- package/dist/src/generators/solid/index.js +4 -0
- package/dist/src/generators/stencil/index.d.ts +1 -0
- package/dist/src/generators/stencil/index.js +1 -0
- package/dist/src/generators/svelte/index.d.ts +1 -0
- package/dist/src/generators/svelte/index.js +15 -0
- package/dist/src/generators/swift/index.d.ts +1 -0
- package/dist/src/generators/swift/index.js +1 -0
- package/dist/src/generators/taro/index.d.ts +1 -0
- package/dist/src/generators/taro/index.js +1 -0
- package/dist/src/generators/template/index.d.ts +1 -0
- package/dist/src/generators/template/index.js +1 -0
- package/dist/src/parsers/builder/builder.d.ts +6 -0
- package/dist/src/parsers/builder/builder.js +25 -3
- package/dist/src/targets.d.ts +17 -17
- package/package.json +1 -1
|
@@ -22,6 +22,9 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
22
22
|
__setModuleDefault(result, mod);
|
|
23
23
|
return result;
|
|
24
24
|
};
|
|
25
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
26
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
27
|
+
};
|
|
25
28
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
26
29
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
30
|
};
|
|
@@ -703,3 +706,4 @@ const tryFormat = (str, parser) => {
|
|
|
703
706
|
}
|
|
704
707
|
return str;
|
|
705
708
|
};
|
|
709
|
+
__exportStar(require("./types"), exports);
|
|
@@ -1,4 +1,18 @@
|
|
|
1
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
|
+
};
|
|
2
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
17
|
exports.File = exports.componentToQwik = exports.createFileSet = exports.addComponent = exports.addCommonStyles = void 0;
|
|
4
18
|
var component_1 = require("./component");
|
|
@@ -9,3 +23,4 @@ var component_generator_1 = require("./component-generator");
|
|
|
9
23
|
Object.defineProperty(exports, "componentToQwik", { enumerable: true, get: function () { return component_generator_1.componentToQwik; } });
|
|
10
24
|
var src_generator_1 = require("./src-generator");
|
|
11
25
|
Object.defineProperty(exports, "File", { enumerable: true, get: function () { return src_generator_1.File; } });
|
|
26
|
+
__exportStar(require("./types"), exports);
|
|
@@ -5,3 +5,4 @@ import { TranspilerGenerator } from '../../types/transpiler';
|
|
|
5
5
|
import { ToReactOptions } from '../react';
|
|
6
6
|
export declare const collectReactNativeStyles: (json: MitosisComponent, options: ToReactOptions) => ClassStyleMap;
|
|
7
7
|
export declare const componentToReactNative: TranspilerGenerator<Partial<ToReactNativeOptions>>;
|
|
8
|
+
export * from './types';
|
|
@@ -1,4 +1,18 @@
|
|
|
1
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
|
+
};
|
|
2
16
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
17
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
18
|
};
|
|
@@ -269,3 +283,4 @@ const componentToReactNative = (_options = {}) => ({ component, path }) => {
|
|
|
269
283
|
return (0, react_1.componentToReact)({ ...options, type: 'native' })({ component: json, path });
|
|
270
284
|
};
|
|
271
285
|
exports.componentToReactNative = componentToReactNative;
|
|
286
|
+
__exportStar(require("./types"), exports);
|
|
@@ -22,6 +22,9 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
22
22
|
__setModuleDefault(result, mod);
|
|
23
23
|
return result;
|
|
24
24
|
};
|
|
25
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
26
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
27
|
+
};
|
|
25
28
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
26
29
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
30
|
};
|
|
@@ -257,3 +260,4 @@ const componentToSolid = (passedOptions) => ({ component }) => {
|
|
|
257
260
|
return str;
|
|
258
261
|
};
|
|
259
262
|
exports.componentToSolid = componentToSolid;
|
|
263
|
+
__exportStar(require("./types"), exports);
|
|
@@ -1,5 +1,20 @@
|
|
|
1
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
|
+
};
|
|
2
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
17
|
exports.componentToSvelte = void 0;
|
|
4
18
|
var svelte_1 = require("./svelte");
|
|
5
19
|
Object.defineProperty(exports, "componentToSvelte", { enumerable: true, get: function () { return svelte_1.componentToSvelte; } });
|
|
20
|
+
__exportStar(require("./types"), exports);
|
|
@@ -13,6 +13,12 @@ type BuilderToMitosisOptions = {
|
|
|
13
13
|
preserveTextBlocks?: boolean;
|
|
14
14
|
includeSpecialBindings?: boolean;
|
|
15
15
|
includeMeta?: boolean;
|
|
16
|
+
/**
|
|
17
|
+
* When `true`, invalid bindings will be escaped as strings with special comments.
|
|
18
|
+
* This can then be used to have LLMs such as Claude attempt to repair the broken code.
|
|
19
|
+
* Defaults to `false`.
|
|
20
|
+
*/
|
|
21
|
+
escapeInvalidCode?: boolean;
|
|
16
22
|
};
|
|
17
23
|
export declare const builderElementToMitosisNode: (block: BuilderElement, options: BuilderToMitosisOptions, _internalOptions?: InternalOptions) => MitosisNode;
|
|
18
24
|
export declare const getMetaFromBlock: (block: BuilderElement, options: BuilderToMitosisOptions) => {};
|
|
@@ -127,9 +127,20 @@ const getStyleStringFromBlock = (block, options) => {
|
|
|
127
127
|
if (!key.includes('.')) {
|
|
128
128
|
continue;
|
|
129
129
|
}
|
|
130
|
+
let code = ((_b = (_a = block.code) === null || _a === void 0 ? void 0 : _a.bindings) === null || _b === void 0 ? void 0 : _b[key]) || block.bindings[key];
|
|
131
|
+
const verifyCode = verifyIsValid(code);
|
|
132
|
+
if (!verifyCode.valid) {
|
|
133
|
+
if (options.escapeInvalidCode) {
|
|
134
|
+
code = '`' + code + ' [INVALID CODE]`';
|
|
135
|
+
}
|
|
136
|
+
else {
|
|
137
|
+
console.warn(`Dropping binding "${key}" due to invalid code: ${code}`);
|
|
138
|
+
continue;
|
|
139
|
+
}
|
|
140
|
+
}
|
|
130
141
|
if (key.includes('style')) {
|
|
131
142
|
const styleProperty = key.split('.')[1];
|
|
132
|
-
styleBindings[styleProperty] = convertExportDefaultToReturn(
|
|
143
|
+
styleBindings[styleProperty] = convertExportDefaultToReturn(code);
|
|
133
144
|
/**
|
|
134
145
|
* responsiveStyles that are bound need to be merged into media queries.
|
|
135
146
|
* Example:
|
|
@@ -152,7 +163,7 @@ const getStyleStringFromBlock = (block, options) => {
|
|
|
152
163
|
const objKey = `"${mediaKey}"`;
|
|
153
164
|
responsiveStyles[objKey] = {
|
|
154
165
|
...responsiveStyles[objKey],
|
|
155
|
-
[prop]:
|
|
166
|
+
[prop]: code,
|
|
156
167
|
};
|
|
157
168
|
}
|
|
158
169
|
}
|
|
@@ -672,8 +683,19 @@ const builderElementToMitosisNode = (block, options, _internalOptions = {}) => {
|
|
|
672
683
|
}
|
|
673
684
|
const useKey = key.replace(/^(component\.)?options\./, '');
|
|
674
685
|
if (!useKey.includes('.')) {
|
|
686
|
+
let code = blockBindings[key].code || blockBindings[key];
|
|
687
|
+
const verifyCode = verifyIsValid(code);
|
|
688
|
+
if (!verifyCode.valid) {
|
|
689
|
+
if (options.escapeInvalidCode) {
|
|
690
|
+
code = '`' + code + ' [INVALID CODE]`';
|
|
691
|
+
}
|
|
692
|
+
else {
|
|
693
|
+
console.warn(`Dropping binding "${key}" due to invalid code: ${code}`);
|
|
694
|
+
continue;
|
|
695
|
+
}
|
|
696
|
+
}
|
|
675
697
|
bindings[useKey] = (0, bindings_1.createSingleBinding)({
|
|
676
|
-
code
|
|
698
|
+
code,
|
|
677
699
|
});
|
|
678
700
|
}
|
|
679
701
|
else if (useKey.includes('style') && useKey.includes('.')) {
|
package/dist/src/targets.d.ts
CHANGED
|
@@ -1,24 +1,24 @@
|
|
|
1
|
-
export declare const builder: (options?: import("./generators/builder
|
|
1
|
+
export declare const builder: (options?: import("./generators/builder").ToBuilderOptions) => ({ component }: import(".").TranspilerArgs) => import("@builder.io/sdk").BuilderContent;
|
|
2
2
|
export declare const targets: {
|
|
3
|
-
readonly alpine: import(".").TranspilerGenerator<import("./generators/alpine
|
|
4
|
-
readonly angular: import(".").TranspilerGenerator<import("./generators/angular
|
|
5
|
-
readonly customElement: import(".").TranspilerGenerator<import("./generators/html
|
|
6
|
-
readonly html: import(".").TranspilerGenerator<import("./generators/html
|
|
7
|
-
readonly mitosis: import(".").TranspilerGenerator<Partial<import("./generators/mitosis
|
|
8
|
-
readonly liquid: import(".").TranspilerGenerator<import("./generators/liquid
|
|
3
|
+
readonly alpine: import(".").TranspilerGenerator<import("./generators/alpine").ToAlpineOptions>;
|
|
4
|
+
readonly angular: import(".").TranspilerGenerator<import("./generators/angular").ToAngularOptions>;
|
|
5
|
+
readonly customElement: import(".").TranspilerGenerator<import("./generators/html").ToHtmlOptions>;
|
|
6
|
+
readonly html: import(".").TranspilerGenerator<import("./generators/html").ToHtmlOptions>;
|
|
7
|
+
readonly mitosis: import(".").TranspilerGenerator<Partial<import("./generators/mitosis").ToMitosisOptions>>;
|
|
8
|
+
readonly liquid: import(".").TranspilerGenerator<import("./generators/liquid").ToLiquidOptions>;
|
|
9
9
|
readonly react: import(".").TranspilerGenerator<Partial<import("./generators/react").ToReactOptions>>;
|
|
10
|
-
readonly reactNative: import(".").TranspilerGenerator<Partial<import("./generators/react-native
|
|
11
|
-
readonly solid: import(".").TranspilerGenerator<Partial<import("./generators/solid
|
|
12
|
-
readonly svelte: import(".").TranspilerGenerator<import("./generators/svelte
|
|
13
|
-
readonly swift: import(".").TranspilerGenerator<import("./generators/swift
|
|
14
|
-
readonly template: import(".").TranspilerGenerator<import("./generators/template
|
|
15
|
-
readonly webcomponent: import(".").TranspilerGenerator<import("./generators/html
|
|
10
|
+
readonly reactNative: import(".").TranspilerGenerator<Partial<import("./generators/react-native").ToReactNativeOptions>>;
|
|
11
|
+
readonly solid: import(".").TranspilerGenerator<Partial<import("./generators/solid").ToSolidOptions>>;
|
|
12
|
+
readonly svelte: import(".").TranspilerGenerator<import("./generators/svelte").ToSvelteOptions>;
|
|
13
|
+
readonly swift: import(".").TranspilerGenerator<import("./generators/swift").ToSwiftOptions>;
|
|
14
|
+
readonly template: import(".").TranspilerGenerator<import("./generators/template").ToTemplateOptions>;
|
|
15
|
+
readonly webcomponent: import(".").TranspilerGenerator<import("./generators/html").ToHtmlOptions>;
|
|
16
16
|
readonly vue: import(".").TranspilerGenerator<Partial<import("./generators/vue").ToVueOptions>>;
|
|
17
|
-
readonly stencil: import(".").TranspilerGenerator<import("./generators/stencil
|
|
18
|
-
readonly qwik: import(".").TranspilerGenerator<import("./generators/qwik
|
|
19
|
-
readonly marko: import(".").TranspilerGenerator<import("./generators/marko
|
|
17
|
+
readonly stencil: import(".").TranspilerGenerator<import("./generators/stencil").ToStencilOptions>;
|
|
18
|
+
readonly qwik: import(".").TranspilerGenerator<import("./generators/qwik").ToQwikOptions>;
|
|
19
|
+
readonly marko: import(".").TranspilerGenerator<import("./generators/marko").ToMarkoOptions>;
|
|
20
20
|
readonly preact: import(".").TranspilerGenerator<Partial<import("./generators/react").ToReactOptions>>;
|
|
21
|
-
readonly lit: import(".").TranspilerGenerator<import("./generators/lit
|
|
21
|
+
readonly lit: import(".").TranspilerGenerator<import("./generators/lit").ToLitOptions>;
|
|
22
22
|
readonly rsc: import(".").TranspilerGenerator<Partial<import("./generators/react").ToReactOptions>>;
|
|
23
23
|
readonly taro: import(".").TranspilerGenerator<Partial<import("./generators/react").ToReactOptions>>;
|
|
24
24
|
};
|