@builder.io/sdk-react 0.5.2 → 0.5.5
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/README.md +4 -0
- package/dist/blocks/BaseText.d.ts +1 -0
- package/dist/blocks/button/button.d.ts +1 -0
- package/dist/blocks/button/button.js +2 -2
- package/dist/blocks/columns/columns.d.ts +1 -0
- package/dist/blocks/columns/columns.js +2 -2
- package/dist/blocks/custom-code/custom-code.d.ts +1 -0
- package/dist/blocks/embed/embed.d.ts +1 -0
- package/dist/blocks/form/form.d.ts +1 -0
- package/dist/blocks/fragment/fragment.d.ts +1 -0
- package/dist/blocks/image/image.d.ts +1 -0
- package/dist/blocks/img/img.d.ts +1 -0
- package/dist/blocks/img/img.js +1 -1
- package/dist/blocks/input/input.d.ts +1 -0
- package/dist/blocks/input/input.js +1 -1
- package/dist/blocks/raw-text/raw-text.d.ts +1 -0
- package/dist/blocks/section/section.d.ts +1 -0
- package/dist/blocks/section/section.js +1 -1
- package/dist/blocks/select/select.d.ts +1 -0
- package/dist/blocks/select/select.js +1 -1
- package/dist/blocks/submit-button/submit-button.d.ts +1 -0
- package/dist/blocks/submit-button/submit-button.js +1 -1
- package/dist/blocks/symbol/symbol.d.ts +1 -0
- package/dist/blocks/symbol/symbol.js +1 -1
- package/dist/blocks/text/text.d.ts +1 -0
- package/dist/blocks/text/text.js +1 -1
- package/dist/blocks/textarea/textarea.d.ts +1 -0
- package/dist/blocks/textarea/textarea.js +1 -1
- package/dist/blocks/video/video.d.ts +1 -0
- package/dist/components/block/block.d.ts +1 -0
- package/dist/components/block/components/block-styles.d.ts +1 -0
- package/dist/components/block/components/block-wrapper.d.ts +1 -0
- package/dist/components/block/components/component-ref/component-ref.d.ts +1 -0
- package/dist/components/block/components/interactive-element.d.ts +1 -0
- package/dist/components/block/components/repeated-block.d.ts +1 -0
- package/dist/components/blocks/blocks-wrapper.d.ts +1 -0
- package/dist/components/blocks/blocks-wrapper.js +1 -1
- package/dist/components/blocks/blocks.d.ts +1 -0
- package/dist/components/content/components/enable-editor.d.ts +1 -0
- package/dist/components/content/components/enable-editor.js +1 -1
- package/dist/components/content/components/styles.d.ts +1 -0
- package/dist/components/content/content.d.ts +1 -0
- package/dist/components/content/content.js +3 -1
- package/dist/components/content-variants/content-variants.d.ts +1 -0
- package/dist/components/content-variants/content-variants.js +12 -6
- package/dist/components/inlined-script.d.ts +1 -0
- package/dist/components/inlined-styles.d.ts +1 -0
- package/dist/constants/sdk-version.d.ts +1 -1
- package/dist/constants/sdk-version.js +1 -1
- package/dist/functions/evaluate/acorn-interpreter.js +3111 -0
- package/dist/functions/evaluate/evaluate.js +1 -1
- package/dist/functions/evaluate/non-node-runtime/index.d.ts +1 -0
- package/dist/functions/evaluate/non-node-runtime/index.js +2 -0
- package/dist/functions/evaluate/{non-node-runtime.d.ts → non-node-runtime/non-node-runtime.d.ts} +1 -1
- package/dist/functions/evaluate/{non-node-runtime.js → non-node-runtime/non-node-runtime.js} +3 -3
- package/dist/functions/evaluate/types.d.ts +1 -0
- package/dist/helpers/preview-lru-cache/get.d.ts +2 -1
- package/dist/helpers/preview-lru-cache/get.js +2 -6
- package/dist/helpers/preview-lru-cache/helpers.d.ts +0 -1
- package/dist/helpers/preview-lru-cache/helpers.js +0 -9
- package/dist/helpers/preview-lru-cache/init.js +1 -10
- package/dist/helpers/preview-lru-cache/set.js +0 -4
- package/dist/helpers/preview-lru-cache/types.d.ts +0 -12
- package/dist/helpers/preview-lru-cache/types.js +0 -6
- package/package.json +9 -2
- package/dist/functions/evaluate/acorn.d.ts +0 -0
- package/dist/functions/evaluate/acorn.js +0 -2432
- package/dist/functions/evaluate/interpreter.js +0 -3853
- /package/dist/functions/evaluate/{interpreter.d.ts → acorn-interpreter.d.ts} +0 -0
|
@@ -2,7 +2,7 @@ import { logger } from '../../helpers/logger.js';
|
|
|
2
2
|
import { isBrowser } from '../is-browser.js';
|
|
3
3
|
import { isEditing } from '../is-editing.js';
|
|
4
4
|
import { isNonNodeServer } from '../is-non-node-server.js';
|
|
5
|
-
import { runInNonNode } from './non-node-runtime.js';
|
|
5
|
+
import { runInNonNode } from './non-node-runtime/index.js';
|
|
6
6
|
export function evaluate({ code, context, localState, rootState, rootSetState, event, isExpression = true }) {
|
|
7
7
|
if (code === '') {
|
|
8
8
|
logger.warn('Skipping evaluation of empty code block.');
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { runInNonNode } from './non-node-runtime.js';
|
package/dist/functions/evaluate/{non-node-runtime.d.ts → non-node-runtime/non-node-runtime.d.ts}
RENAMED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import type { ExecutorArgs } from '
|
|
1
|
+
import type { ExecutorArgs } from '../types';
|
|
2
2
|
export declare const runInNonNode: ({ builder, context, event, rootState, localState, rootSetState, useCode }: ExecutorArgs) => any;
|
package/dist/functions/evaluate/{non-node-runtime.js → non-node-runtime/non-node-runtime.js}
RENAMED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { logger } from '
|
|
2
|
-
import { set } from '
|
|
3
|
-
import Interpreter from '
|
|
1
|
+
import { logger } from '../../../helpers/logger';
|
|
2
|
+
import { set } from '../../set';
|
|
3
|
+
import Interpreter from '../acorn-interpreter.js';
|
|
4
4
|
const processCode = (code) => {
|
|
5
5
|
return code.split('\n').map(line => {
|
|
6
6
|
const trimmed = line.trim();
|
|
@@ -1 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
import type { BuilderContent } from '../../types/builder-content';
|
|
2
|
+
export declare function getPreviewContent(_searchParams: URLSearchParams): BuilderContent | undefined;
|
|
@@ -1,7 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
export function getPreviewContent(searchParams) {
|
|
4
|
-
init();
|
|
5
|
-
const id = getIdFromSearchParams(searchParams);
|
|
6
|
-
return typeof id === 'string' ? globalThis._BUILDER_PREVIEW_LRU_CACHE.get(id) : undefined;
|
|
1
|
+
export function getPreviewContent(_searchParams) {
|
|
2
|
+
return undefined;
|
|
7
3
|
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const getIdFromSearchParams: (searchParams: URLSearchParams) => string;
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { logger } from '../logger';
|
|
2
|
-
export const getIdFromSearchParams = (searchParams) => {
|
|
3
|
-
const previewedModel = searchParams.get('preview');
|
|
4
|
-
const previewedId = searchParams.get('overrides.' + previewedModel);
|
|
5
|
-
if (!previewedId) {
|
|
6
|
-
logger.warn('No previewed ID found in search params.');
|
|
7
|
-
}
|
|
8
|
-
return previewedId;
|
|
9
|
-
};
|
|
@@ -3,13 +3,4 @@
|
|
|
3
3
|
*
|
|
4
4
|
* Note: This logic is only used by the NextJS SDK.
|
|
5
5
|
*/
|
|
6
|
-
|
|
7
|
-
export function init() {
|
|
8
|
-
if (!globalThis._BUILDER_PREVIEW_LRU_CACHE) {
|
|
9
|
-
globalThis._BUILDER_PREVIEW_LRU_CACHE = new LRUCache({
|
|
10
|
-
max: 500,
|
|
11
|
-
// how long to live in ms
|
|
12
|
-
ttl: 1000 * 60 * 5
|
|
13
|
-
});
|
|
14
|
-
}
|
|
15
|
-
}
|
|
6
|
+
export function init() { }
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* This is an LRU cache to hold preview content on the server-side.
|
|
3
|
-
*
|
|
4
|
-
* Note: This logic is only used by the NextJS SDK.
|
|
5
|
-
*/
|
|
6
|
-
import type { LRUCache } from 'lru-cache';
|
|
7
|
-
import type { BuilderContent } from '../../types/builder-content';
|
|
8
|
-
type BuilderLRUCache = LRUCache<string, BuilderContent>;
|
|
9
|
-
export type GlobalWCache = typeof globalThis & {
|
|
10
|
-
_BUILDER_PREVIEW_LRU_CACHE: BuilderLRUCache;
|
|
11
|
-
};
|
|
12
|
-
export {};
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@builder.io/sdk-react",
|
|
3
3
|
"description": "Builder.io SDK for React",
|
|
4
|
-
"version": "0.5.
|
|
4
|
+
"version": "0.5.5",
|
|
5
5
|
"files": [
|
|
6
6
|
"dist"
|
|
7
7
|
],
|
|
@@ -18,8 +18,15 @@
|
|
|
18
18
|
"react": "^18.2.0"
|
|
19
19
|
},
|
|
20
20
|
"devDependencies": {
|
|
21
|
+
"nx": "^16.6.0",
|
|
22
|
+
"nx-cloud": "^16.2.0",
|
|
21
23
|
"react": "^18.2.0",
|
|
22
24
|
"rimraf": "^3.0.2",
|
|
23
|
-
"typescript": "^
|
|
25
|
+
"typescript": "^4.9.4"
|
|
26
|
+
},
|
|
27
|
+
"nx": {
|
|
28
|
+
"implicitDependencies": [
|
|
29
|
+
"@builder.io/sdks"
|
|
30
|
+
]
|
|
24
31
|
}
|
|
25
32
|
}
|
|
File without changes
|