@builder.io/mitosis 0.0.77 → 0.0.78

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.
Files changed (76) hide show
  1. package/dist/src/parsers/builder/builder.d.ts +34 -0
  2. package/dist/src/parsers/{builder.js → builder/builder.js} +16 -12
  3. package/dist/src/parsers/{helpers/state.d.ts → builder/helpers.d.ts} +2 -2
  4. package/dist/src/parsers/builder/helpers.js +26 -0
  5. package/dist/src/parsers/builder/index.d.ts +1 -0
  6. package/dist/src/parsers/builder/index.js +17 -0
  7. package/dist/src/parsers/jsx/function-parser.js +54 -73
  8. package/dist/src/parsers/jsx/helpers.d.ts +1 -0
  9. package/dist/src/parsers/jsx/helpers.js +10 -2
  10. package/dist/src/parsers/jsx/{metadata.d.ts → hooks.d.ts} +1 -1
  11. package/dist/src/parsers/jsx/{metadata.js → hooks.js} +3 -3
  12. package/dist/src/parsers/jsx/index.d.ts +1 -2
  13. package/dist/src/parsers/jsx/index.js +3 -5
  14. package/dist/src/parsers/jsx/jsx.js +4 -2
  15. package/dist/src/parsers/jsx/state.d.ts +2 -4
  16. package/dist/src/parsers/jsx/state.js +50 -27
  17. package/dist/test/src/__tests__/qwik.test.ts/033[2m/>//033[22mqwik/033[2m/>//033[22mAccordion/high.jsx +0 -0
  18. package/dist/test/src/__tests__/qwik.test.ts/033[2m/>//033[22mqwik/033[2m/>//033[22mAccordion/low.jsx +240 -0
  19. package/dist/test/src/__tests__/qwik.test.ts/033[2m/>//033[22mqwik/033[2m/>//033[22mAccordion/med.jsx +4 -0
  20. package/dist/test/src/__tests__/qwik.test.ts/033[2m/>//033[22mqwik/033[2m/>//033[22mFor/high.jsx +0 -0
  21. package/dist/test/src/__tests__/qwik.test.ts/033[2m/>//033[22mqwik/033[2m/>//033[22mFor/low.jsx +54 -0
  22. package/dist/test/src/__tests__/qwik.test.ts/033[2m/>//033[22mqwik/033[2m/>//033[22mFor/med.jsx +4 -0
  23. package/dist/test/src/__tests__/qwik.test.ts/033[2m/>//033[22mqwik/033[2m/>//033[22mImage/high.js +9 -0
  24. package/dist/test/src/__tests__/qwik.test.ts/033[2m/>//033[22mqwik/033[2m/>//033[22mImage/low.js +0 -0
  25. package/dist/test/src/__tests__/qwik.test.ts/033[2m/>//033[22mqwik/033[2m/>//033[22mImage/med.js +151 -0
  26. package/dist/test/src/__tests__/qwik.test.ts/033[2m/>//033[22mqwik/033[2m/>//033[22mImage.slow/high.js +9 -0
  27. package/dist/test/src/__tests__/qwik.test.ts/033[2m/>//033[22mqwik/033[2m/>//033[22mImage.slow/low.js +0 -0
  28. package/dist/test/src/__tests__/qwik.test.ts/033[2m/>//033[22mqwik/033[2m/>//033[22mImage.slow/med.js +151 -0
  29. package/dist/test/src/__tests__/qwik.test.ts/033[2m/>//033[22mqwik/033[2m/>//033[22mbindings/high.cjs +0 -0
  30. package/dist/test/src/__tests__/qwik.test.ts/033[2m/>//033[22mqwik/033[2m/>//033[22mbindings/low.cjs +45 -0
  31. package/dist/test/src/__tests__/qwik.test.ts/033[2m/>//033[22mqwik/033[2m/>//033[22mbindings/med.cjs +3 -0
  32. package/dist/test/src/__tests__/qwik.test.ts/033[2m/>//033[22mqwik/033[2m/>//033[22mbutton/high.js +3 -0
  33. package/dist/test/src/__tests__/qwik.test.ts/033[2m/>//033[22mqwik/033[2m/>//033[22mbutton/low.js +25 -0
  34. package/dist/test/src/__tests__/qwik.test.ts/033[2m/>//033[22mqwik/033[2m/>//033[22mbutton/med.js +31 -0
  35. package/dist/test/src/__tests__/qwik.test.ts/033[2m/>//033[22mqwik/033[2m/>//033[22mcomponent/033[2m/>//033[22mbindings/high.jsx +0 -0
  36. package/dist/test/src/__tests__/qwik.test.ts/033[2m/>//033[22mqwik/033[2m/>//033[22mcomponent/033[2m/>//033[22mbindings/low.jsx +108 -0
  37. package/dist/test/src/__tests__/qwik.test.ts/033[2m/>//033[22mqwik/033[2m/>//033[22mcomponent/033[2m/>//033[22mbindings/med.jsx +7 -0
  38. package/dist/test/src/__tests__/qwik.test.ts/033[2m/>//033[22mqwik/033[2m/>//033[22mcomponent/033[2m/>//033[22mcomponent/inputs/high.cjsx +9 -0
  39. package/dist/test/src/__tests__/qwik.test.ts/033[2m/>//033[22mqwik/033[2m/>//033[22mcomponent/033[2m/>//033[22mcomponent/inputs/low.cjsx +0 -0
  40. package/dist/test/src/__tests__/qwik.test.ts/033[2m/>//033[22mqwik/033[2m/>//033[22mcomponent/033[2m/>//033[22mcomponent/inputs/med.cjsx +68 -0
  41. package/dist/test/src/__tests__/qwik.test.ts/033[2m/>//033[22mqwik/033[2m/>//033[22mfor-loop.bindings/high.cjs +0 -0
  42. package/dist/test/src/__tests__/qwik.test.ts/033[2m/>//033[22mqwik/033[2m/>//033[22mfor-loop.bindings/low.cjs +58 -0
  43. package/dist/test/src/__tests__/qwik.test.ts/033[2m/>//033[22mqwik/033[2m/>//033[22mfor-loop.bindings/med.cjs +5 -0
  44. package/dist/test/src/__tests__/qwik.test.ts/033[2m/>//033[22mqwik/033[2m/>//033[22mhello_world/033[2m/>//033[22mstylesheet/high.jsx +0 -0
  45. package/dist/test/src/__tests__/qwik.test.ts/033[2m/>//033[22mqwik/033[2m/>//033[22mhello_world/033[2m/>//033[22mstylesheet/low.jsx +26 -0
  46. package/dist/test/src/__tests__/qwik.test.ts/033[2m/>//033[22mqwik/033[2m/>//033[22mhello_world/033[2m/>//033[22mstylesheet/med.jsx +4 -0
  47. package/dist/test/src/__tests__/qwik.test.ts/033[2m/>//033[22mqwik/033[2m/>//033[22mmount/high.cjs +0 -0
  48. package/dist/test/src/__tests__/qwik.test.ts/033[2m/>//033[22mqwik/033[2m/>//033[22mmount/low.cjs +47 -0
  49. package/dist/test/src/__tests__/qwik.test.ts/033[2m/>//033[22mqwik/033[2m/>//033[22mmount/med.cjs +3 -0
  50. package/dist/test/src/__tests__/qwik.test.ts/033[2m/>//033[22mqwik/033[2m/>//033[22mpage-with-symbol/high.js +0 -0
  51. package/dist/test/src/__tests__/qwik.test.ts/033[2m/>//033[22mqwik/033[2m/>//033[22mpage-with-symbol/low.js +33 -0
  52. package/dist/test/src/__tests__/qwik.test.ts/033[2m/>//033[22mqwik/033[2m/>//033[22mpage-with-symbol/med.js +4 -0
  53. package/dist/test/src/__tests__/qwik.test.ts/033[2m/>//033[22mqwik/033[2m/>//033[22mshow-hide/high.jsx +9 -0
  54. package/dist/test/src/__tests__/qwik.test.ts/033[2m/>//033[22mqwik/033[2m/>//033[22mshow-hide/low.jsx +0 -0
  55. package/dist/test/src/__tests__/qwik.test.ts/033[2m/>//033[22mqwik/033[2m/>//033[22mshow-hide/med.jsx +170 -0
  56. package/dist/test/src/__tests__/qwik.test.ts/033[2m/>//033[22mqwik/033[2m/>//033[22msvg/high.js +0 -0
  57. package/dist/test/src/__tests__/qwik.test.ts/033[2m/>//033[22mqwik/033[2m/>//033[22msvg/low.js +30 -0
  58. package/dist/test/src/__tests__/qwik.test.ts/033[2m/>//033[22mqwik/033[2m/>//033[22msvg/med.js +4 -0
  59. package/dist/test/src/__tests__/qwik.test.ts/033[2m/>//033[22mqwik/033[2m/>//033[22mtodo/033[2m/>//033[22mTodo.cjs/high.cjs +19 -0
  60. package/dist/test/src/__tests__/qwik.test.ts/033[2m/>//033[22mqwik/033[2m/>//033[22mtodo/033[2m/>//033[22mTodo.cjs/low.cjs +0 -0
  61. package/dist/test/src/__tests__/qwik.test.ts/033[2m/>//033[22mqwik/033[2m/>//033[22mtodo/033[2m/>//033[22mTodo.cjs/med.cjs +51 -0
  62. package/dist/test/src/__tests__/qwik.test.ts/033[2m/>//033[22mqwik/033[2m/>//033[22mtodo/033[2m/>//033[22mTodo.js/high.js +19 -0
  63. package/dist/test/src/__tests__/qwik.test.ts/033[2m/>//033[22mqwik/033[2m/>//033[22mtodo/033[2m/>//033[22mTodo.js/low.js +0 -0
  64. package/dist/test/src/__tests__/qwik.test.ts/033[2m/>//033[22mqwik/033[2m/>//033[22mtodo/033[2m/>//033[22mTodo.js/med.js +47 -0
  65. package/dist/test/src/__tests__/qwik.test.ts/033[2m/>//033[22mqwik/033[2m/>//033[22mtodo/033[2m/>//033[22mTodo.tsx/high.tsx +19 -0
  66. package/dist/test/src/__tests__/qwik.test.ts/033[2m/>//033[22mqwik/033[2m/>//033[22mtodo/033[2m/>//033[22mTodo.tsx/low.tsx +0 -0
  67. package/dist/test/src/__tests__/qwik.test.ts/033[2m/>//033[22mqwik/033[2m/>//033[22mtodo/033[2m/>//033[22mTodo.tsx/med.tsx +43 -0
  68. package/dist/test/src/__tests__/qwik.test.ts/033[2m/>//033[22mqwik/033[2m/>//033[22mtodos/033[2m/>//033[22mTodo.tsx/high.tsx +7 -0
  69. package/dist/test/src/__tests__/qwik.test.ts/033[2m/>//033[22mqwik/033[2m/>//033[22mtodos/033[2m/>//033[22mTodo.tsx/low.tsx +34 -0
  70. package/dist/test/src/__tests__/qwik.test.ts/033[2m/>//033[22mqwik/033[2m/>//033[22mtodos/033[2m/>//033[22mTodo.tsx/med.tsx +4 -0
  71. package/dist/tsconfig.build.tsbuildinfo +1 -1
  72. package/package.json +1 -1
  73. package/dist/src/parsers/builder.d.ts +0 -104
  74. package/dist/src/parsers/constants/outdated-prefixes.d.ts +0 -10
  75. package/dist/src/parsers/constants/outdated-prefixes.js +0 -13
  76. package/dist/src/parsers/helpers/state.js +0 -30
package/package.json CHANGED
@@ -25,7 +25,7 @@
25
25
  "engines": {
26
26
  "npm": "99999999.9.9"
27
27
  },
28
- "version": "0.0.77",
28
+ "version": "0.0.78",
29
29
  "homepage": "https://github.com/BuilderIO/mitosis",
30
30
  "main": "./dist/src/index.js",
31
31
  "exports": {
@@ -1,104 +0,0 @@
1
- import { BuilderContent, BuilderElement } from '@builder.io/sdk';
2
- import { MitosisNode } from '../types/mitosis-node';
3
- import { JSONObject } from '../types/json';
4
- declare type InternalOptions = {
5
- skipMapper?: boolean;
6
- };
7
- export declare const symbolBlocksAsChildren = false;
8
- export declare type BuilderToMitosisOptions = {
9
- context?: {
10
- [key: string]: any;
11
- };
12
- includeBuilderExtras?: boolean;
13
- preserveTextBlocks?: boolean;
14
- };
15
- export declare type InternalBuilderToMitosisOptions = BuilderToMitosisOptions & {
16
- context: {
17
- [key: string]: any;
18
- };
19
- };
20
- export declare const builderElementToMitosisNode: (block: BuilderElement, options: BuilderToMitosisOptions, _internalOptions?: InternalOptions) => MitosisNode;
21
- /**
22
- * Take Builder custom jsCode and extract the contents of the useState hook
23
- * and return it as a JS object along with the inputted code with the hook
24
- * code extracted
25
- */
26
- export declare function extractStateHook(code: string): {
27
- code: string;
28
- state: any;
29
- };
30
- export declare function convertExportDefaultToReturn(code: string): string;
31
- export declare const createBuilderElement: (options?: Partial<BuilderElement>) => BuilderElement;
32
- export declare const isBuilderElement: (el: unknown) => el is BuilderElement;
33
- export declare const builderContentToMitosisComponent: (builderContent: BuilderContent, options?: BuilderToMitosisOptions) => {
34
- subComponents: {
35
- name: string;
36
- '@type': "@builder.io/mitosis/component";
37
- imports: import("..").MitosisImport[];
38
- exports?: import("..").MitosisExports | undefined;
39
- meta: JSONObject & {
40
- useMetadata?: JSONObject | undefined;
41
- };
42
- inputs: import("..").MitosisComponentInput[];
43
- state: import("..").MitosisState;
44
- context: {
45
- get: import("../helpers/typescript").Dictionary<import("..").ContextGetInfo>;
46
- set: import("../helpers/typescript").Dictionary<import("..").ContextSetInfo>;
47
- };
48
- refs: {
49
- [useRef: string]: {
50
- typeParameter?: string | undefined;
51
- argument: string;
52
- };
53
- };
54
- hooks: {
55
- init?: import("..").extendedHook | undefined;
56
- onInit?: import("..").extendedHook | undefined;
57
- onMount?: import("..").extendedHook | undefined;
58
- onUnMount?: import("..").extendedHook | undefined;
59
- preComponent?: import("..").extendedHook | undefined;
60
- postComponent?: import("..").extendedHook | undefined;
61
- onUpdate?: import("..").extendedHook[] | undefined;
62
- };
63
- children: MitosisNode[];
64
- subComponents: import("..").MitosisComponent[];
65
- types?: string[] | undefined;
66
- propsTypeRef?: string | undefined;
67
- defaultProps?: JSONObject | undefined;
68
- style?: string | undefined;
69
- }[];
70
- '@type': "@builder.io/mitosis/component";
71
- name: string;
72
- imports: import("..").MitosisImport[];
73
- exports?: import("..").MitosisExports | undefined;
74
- meta: JSONObject & {
75
- useMetadata?: JSONObject | undefined;
76
- };
77
- inputs: import("..").MitosisComponentInput[];
78
- state: import("..").MitosisState;
79
- context: {
80
- get: import("../helpers/typescript").Dictionary<import("..").ContextGetInfo>;
81
- set: import("../helpers/typescript").Dictionary<import("..").ContextSetInfo>;
82
- };
83
- refs: {
84
- [useRef: string]: {
85
- typeParameter?: string | undefined;
86
- argument: string;
87
- };
88
- };
89
- hooks: {
90
- init?: import("..").extendedHook | undefined;
91
- onInit?: import("..").extendedHook | undefined;
92
- onMount?: import("..").extendedHook | undefined;
93
- onUnMount?: import("..").extendedHook | undefined;
94
- preComponent?: import("..").extendedHook | undefined;
95
- postComponent?: import("..").extendedHook | undefined;
96
- onUpdate?: import("..").extendedHook[] | undefined;
97
- };
98
- children: MitosisNode[];
99
- types?: string[] | undefined;
100
- propsTypeRef?: string | undefined;
101
- defaultProps?: JSONObject | undefined;
102
- style?: string | undefined;
103
- };
104
- export {};
@@ -1,10 +0,0 @@
1
- /**
2
- * DO NOT USE THIS PREFIX. It's only used for legacy purposes, within a very small subset of logic in the JSX & Builder parsers.
3
- * It will be eliminated in the future, and generators should not need to rely on these prefixes for any reason.
4
- */
5
- export declare const __DO_NOT_USE_FUNCTION_LITERAL_PREFIX = "@builder.io/mitosis/function:";
6
- /**
7
- * DO NOT USE THIS PREFIX. It's only used for legacy purposes, within a very small subset of logic in the JSX & Builder parsers.
8
- * It will be eliminated in the future, and generators should not need to rely on these prefixes for any reason.
9
- */
10
- export declare const __DO_NOT_USE_METHOD_LITERAL_PREFIX = "@builder.io/mitosis/method:";
@@ -1,13 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.__DO_NOT_USE_METHOD_LITERAL_PREFIX = exports.__DO_NOT_USE_FUNCTION_LITERAL_PREFIX = void 0;
4
- /**
5
- * DO NOT USE THIS PREFIX. It's only used for legacy purposes, within a very small subset of logic in the JSX & Builder parsers.
6
- * It will be eliminated in the future, and generators should not need to rely on these prefixes for any reason.
7
- */
8
- exports.__DO_NOT_USE_FUNCTION_LITERAL_PREFIX = "@builder.io/mitosis/function:";
9
- /**
10
- * DO NOT USE THIS PREFIX. It's only used for legacy purposes, within a very small subset of logic in the JSX & Builder parsers.
11
- * It will be eliminated in the future, and generators should not need to rely on these prefixes for any reason.
12
- */
13
- exports.__DO_NOT_USE_METHOD_LITERAL_PREFIX = "@builder.io/mitosis/method:";
@@ -1,30 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.mapJsonObjectToStateValue = void 0;
4
- var lodash_1 = require("lodash");
5
- var patterns_1 = require("../../helpers/patterns");
6
- var outdated_prefixes_1 = require("../constants/outdated-prefixes");
7
- /**
8
- * Sets StateTypeValue based on the string prefixes we've set previously.
9
- *
10
- * This is a temporary workaround until we eliminate the prefixes and make this StateValueType the
11
- * source of truth.
12
- */
13
- var mapJsonToStateValue = function (value) {
14
- if (typeof value === 'string') {
15
- if (value.startsWith(outdated_prefixes_1.__DO_NOT_USE_FUNCTION_LITERAL_PREFIX)) {
16
- return { type: 'function', code: value.replace(outdated_prefixes_1.__DO_NOT_USE_FUNCTION_LITERAL_PREFIX, '') };
17
- }
18
- else if (value.startsWith(outdated_prefixes_1.__DO_NOT_USE_METHOD_LITERAL_PREFIX)) {
19
- var strippedValue = value.replace(outdated_prefixes_1.__DO_NOT_USE_METHOD_LITERAL_PREFIX, '');
20
- var isGet = Boolean(strippedValue.match(patterns_1.GETTER));
21
- var type = isGet ? 'getter' : 'method';
22
- return { type: type, code: strippedValue };
23
- }
24
- }
25
- return { type: 'property', code: value };
26
- };
27
- var mapJsonObjectToStateValue = function (value) {
28
- return (0, lodash_1.mapValues)(value, mapJsonToStateValue);
29
- };
30
- exports.mapJsonObjectToStateValue = mapJsonObjectToStateValue;