@builder.io/mitosis 0.0.56 → 0.0.57

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/package.json CHANGED
@@ -25,7 +25,7 @@
25
25
  "engines": {
26
26
  "npm": "99999999.9.9"
27
27
  },
28
- "version": "0.0.56",
28
+ "version": "0.0.57",
29
29
  "homepage": "https://github.com/BuilderIO/mitosis",
30
30
  "main": "./dist/src/index.js",
31
31
  "exports": {
@@ -116,10 +116,6 @@
116
116
  "ts-jest": "^26.4.4",
117
117
  "ts-node": "^9.1.1",
118
118
  "typescript": "^4",
119
- "universalify": "^2.0.0",
120
- "vue-template-compiler": "~2.6"
121
- },
122
- "peerDependencies": {
123
- "vue-template-compiler": "~2.6"
119
+ "universalify": "^2.0.0"
124
120
  }
125
121
  }
@@ -1,2 +0,0 @@
1
- import { StringMap } from '../types/string-map';
2
- export declare function mapToAttributes(map: StringMap): string;
@@ -1,19 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.mapToAttributes = void 0;
4
- var lodash_1 = require("lodash");
5
- // This list is not exhaustive of all HTML boolean attributes, but we can add more in the future if needed.
6
- var booleanHTMLAttributes = new Set(['checked', 'disabled', 'selected']);
7
- function mapToAttributes(map) {
8
- if (!(0, lodash_1.size)(map)) {
9
- return '';
10
- }
11
- return (0, lodash_1.reduce)(map, function (memo, value, key) {
12
- var attributeValue = " ".concat(key, "=\"").concat(value, "\"");
13
- if (booleanHTMLAttributes.has(key) && value) {
14
- attributeValue = " ".concat(value);
15
- }
16
- return memo + attributeValue;
17
- }, '');
18
- }
19
- exports.mapToAttributes = mapToAttributes;
@@ -1,2 +0,0 @@
1
- import { StringMap } from '../types/string-map';
2
- export declare function mapToCss(map: StringMap, spaces?: number, important?: boolean, uewNewLine?: boolean): string;
@@ -1,16 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.mapToCss = void 0;
4
- var lodash_1 = require("lodash");
5
- function mapToCss(map, spaces, important, uewNewLine) {
6
- if (spaces === void 0) { spaces = 2; }
7
- if (important === void 0) { important = false; }
8
- if (uewNewLine === void 0) { uewNewLine = spaces > 1; }
9
- return (0, lodash_1.reduce)(map, function (memo, value, key) {
10
- return (memo +
11
- (value && value.trim()
12
- ? "".concat(uewNewLine ? '\n' : '').concat(' '.repeat(spaces)).concat((0, lodash_1.kebabCase)(key), ": ").concat(value + (important ? ' !important' : ''), ";")
13
- : ''));
14
- }, '');
15
- }
16
- exports.mapToCss = mapToCss;
@@ -1,7 +0,0 @@
1
- export declare type ParseReactiveScriptOptions = {
2
- format: 'html' | 'js';
3
- };
4
- export declare const reactiveScriptRe: RegExp;
5
- export declare function parseReactiveScript(code: string, options: ParseReactiveScriptOptions): {
6
- state: any;
7
- };
@@ -1,75 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.parseReactiveScript = exports.reactiveScriptRe = void 0;
4
- exports.reactiveScriptRe = /<script\s[^>]*reactive[^>]*>([\s\S]*)<\/\s*script>/i;
5
- function parseReactiveScript(code, options) {
6
- var state = {};
7
- // TO-DO: this is unused
8
- // const format = options.format || 'html';
9
- // const useCode = format === 'html' ? code.match(reactiveScriptRe)?.[1] || '' : code;
10
- // const output = transform(useCode, {
11
- // plugins: [
12
- // () => ({
13
- // visitor: {
14
- // ExportDefaultDeclaration(path: babel.NodePath<babel.types.ExportDefaultDeclaration>) {
15
- // if (types.isObjectExpression(path.node.declaration)) {
16
- // const stateProperty = path.node.declaration.properties.find(
17
- // (item) =>
18
- // types.isObjectProperty(item) &&
19
- // types.isIdentifier(item.key) &&
20
- // item.key.name === 'state',
21
- // ) as types.ObjectProperty | null;
22
- // if (stateProperty) {
23
- // const value = stateProperty.value;
24
- // if (types.isObjectExpression(value)) {
25
- // const properties = value.properties;
26
- // const useProperties = properties.map((item) => {
27
- // if (types.isObjectProperty(item)) {
28
- // if (
29
- // types.isFunctionExpression(item.value) ||
30
- // types.isArrowFunctionExpression(item.value)
31
- // ) {
32
- // return createFunctionStringLiteralObjectProperty(item.key, item.value);
33
- // }
34
- // }
35
- // if (types.isObjectMethod(item)) {
36
- // return types.objectProperty(
37
- // item.key,
38
- // types.stringLiteral(
39
- // `${methodLiteralPrefix}${generate({ ...item, returnType: null }).code}`,
40
- // ),
41
- // );
42
- // }
43
- // // Remove typescript types, e.g. from
44
- // // { foo: ('string' as SomeType) }
45
- // if (types.isObjectProperty(item)) {
46
- // let value = item.value;
47
- // if (types.isTSAsExpression(value)) {
48
- // value = value.expression;
49
- // }
50
- // return types.objectProperty(item.key, value);
51
- // }
52
- // return item;
53
- // });
54
- // const newObject = types.objectExpression(useProperties);
55
- // let code;
56
- // let obj;
57
- // try {
58
- // code = generate(newObject).code!;
59
- // obj = json5.parse(code);
60
- // } catch (err) {
61
- // console.error('Could not JSON5 parse object:\n', code);
62
- // throw err;
63
- // }
64
- // state = obj;
65
- // }
66
- // }
67
- // }
68
- // },
69
- // },
70
- // }),
71
- // ],
72
- // });
73
- return { state: state };
74
- }
75
- exports.parseReactiveScript = parseReactiveScript;
File without changes
@@ -1,2 +0,0 @@
1
- "use strict";
2
- // TODO: import via HTML and/or Vue-esque compiler
@@ -1,70 +0,0 @@
1
- import { BuilderElement } from '@builder.io/sdk';
2
- import { ITemplate } from 'liquidjs';
3
- import * as compiler from 'vue-template-compiler';
4
- /**
5
- * Extract a liquid expression from our JS structure - i.e. transform
6
- * "context.shopify.liquid.condition('some | liquid')" to "some | liquid"
7
- */
8
- export declare const getLiquidConditionExpresion: (expression: string) => string;
9
- interface Options {
10
- emailMode?: boolean;
11
- extractCss?: boolean;
12
- minify?: boolean;
13
- includeJson?: boolean;
14
- skipPrettier?: boolean;
15
- wrap?: boolean;
16
- useBuilderSignature?: boolean;
17
- componentOnly?: boolean;
18
- openingTagOnly?: boolean;
19
- static?: boolean;
20
- looseBindings?: boolean;
21
- }
22
- export declare function blockToLiquid(json: BuilderElement, options?: Options): string;
23
- export declare function humanCase(str: string): string;
24
- export declare const parsedLiquidToHtml: (templates: ITemplate[], options: LiquidToBuilderOptions) => Promise<string>;
25
- export declare const htmlNodeToBuilder: (node: compiler.ASTNode, index: number, parentArray: compiler.ASTNode[], options: LiquidToBuilderOptions) => Promise<BuilderElement | BuilderElement[] | null>;
26
- export declare const liquidToAst: (str: string, options?: LiquidToBuilderOptions) => ITemplate[];
27
- export declare const htmlToAst: (html: string) => {
28
- htmlNodes: compiler.ASTNode[];
29
- preprocessed: compiler.ASTNode[];
30
- };
31
- export declare const separateTagsAndText: (text: string) => compiler.ASTText[];
32
- export declare const postProcessHtmlAstNodes: (nodes: compiler.ASTNode[]) => compiler.ASTNode[];
33
- export declare const postProcessBuilderTree: (nodes: BuilderElement[], options: LiquidToBuilderOptions) => Promise<BuilderElement[]>;
34
- export declare const htmlAstToBuilder: (nodes: compiler.ASTNode[], options: LiquidToBuilderOptions) => Promise<BuilderElement[]>;
35
- export declare const processedAstToBuilder: (nodes: compiler.ASTNode[], options: LiquidToBuilderOptions) => Promise<{
36
- blocks: BuilderElement[];
37
- preprocessed: BuilderElement[];
38
- }>;
39
- export interface LiquidToBuilderOptions {
40
- log?: boolean;
41
- themeId?: string;
42
- importSections?: boolean;
43
- importSnippets?: boolean;
44
- translations?: {
45
- [key: string]: string;
46
- };
47
- cachebust?: boolean;
48
- auth?: {
49
- token?: string;
50
- publicKey?: string;
51
- };
52
- }
53
- export declare const htmlDebugString: (els: BuilderElement[]) => string;
54
- export declare const tryFormat: (str: string) => string;
55
- /**
56
- * This function is the first step, before we turn the liquid into an AST.
57
- * It is used to make certain changes to the liquid string that are much
58
- * easier to do before we process it. Examples of this include rewriting
59
- * certain tags to a format we already know how to parse, or fixing common
60
- * liquid template errors that cause problems during import.
61
- *
62
- * Note: there are a lot of regexes in here, and they can be confusing!
63
- * If you are trying to debug something that includes a regex, try using
64
- * a tool like https://regex101.com/ to break down what is going on.
65
- */
66
- export declare const preprocessLiquid: (liquid: string, options?: LiquidToBuilderOptions) => Promise<string>;
67
- export declare const liquidToBuilder: (liquid: string, options?: LiquidToBuilderOptions) => Promise<BuilderElement[]>;
68
- export declare const htmlToBuilder: (html: string) => Promise<BuilderElement[]>;
69
- export declare const bindingsFromAttrs: (node: compiler.ASTElement, bindings: Record<string, any>, properties: Record<string, any>, options: LiquidToBuilderOptions) => Promise<void>;
70
- export {};