@builder.io/sdk-react 0.5.1 → 0.5.4
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/{acorn_interpreter.js → evaluate/acorn-interpreter.js} +1084 -1000
- 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/package.json +12 -3
- package/dist/functions/acorn_interpreter.d.ts +0 -1
- package/dist/functions/apply-patch-with-mutation.test.d.ts +0 -1
- package/dist/functions/apply-patch-with-mutation.test.js +0 -53
- package/dist/functions/evaluate/acorn.d.ts +0 -0
- package/dist/functions/evaluate/acorn.js +0 -2432
- package/dist/functions/evaluate/evaluate.test.d.ts +0 -1
- package/dist/functions/evaluate/evaluate.test.js +0 -23
- package/dist/functions/evaluate/interpreter.js +0 -3853
- package/dist/functions/evaluate.d.ts +0 -23
- package/dist/functions/evaluate.js +0 -68
- package/dist/functions/evaluate.test.d.ts +0 -1
- package/dist/functions/evaluate.test.js +0 -23
- package/dist/functions/get-builder-search-params/fn.test.d.ts +0 -1
- package/dist/functions/get-builder-search-params/fn.test.js +0 -13
- package/dist/functions/get-content/generate-content-url.test.d.ts +0 -1
- package/dist/functions/get-content/generate-content-url.test.js +0 -111
- package/dist/functions/get-content/processCookies.d.ts +0 -2
- package/dist/functions/get-content/processCookies.js +0 -3
- package/dist/functions/get-processed-block.test.d.ts +0 -1
- package/dist/functions/get-processed-block.test.js +0 -35
- package/dist/functions/on-change.test.d.ts +0 -1
- package/dist/functions/on-change.test.js +0 -30
- package/dist/functions/set.test.d.ts +0 -1
- package/dist/functions/set.test.js +0 -22
- package/dist/helpers/url.test.d.ts +0 -1
- package/dist/helpers/url.test.js +0 -21
- /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();
|
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.4",
|
|
5
5
|
"files": [
|
|
6
6
|
"dist"
|
|
7
7
|
],
|
|
@@ -11,13 +11,22 @@
|
|
|
11
11
|
"./server": "./dist/functions/get-content/index.js"
|
|
12
12
|
},
|
|
13
13
|
"scripts": {
|
|
14
|
-
"
|
|
14
|
+
"clean": "rimraf dist",
|
|
15
|
+
"build": "yarn clean && tsc"
|
|
15
16
|
},
|
|
16
17
|
"peerDependencies": {
|
|
17
18
|
"react": "^18.2.0"
|
|
18
19
|
},
|
|
19
20
|
"devDependencies": {
|
|
21
|
+
"nx": "^16.6.0",
|
|
22
|
+
"nx-cloud": "^16.2.0",
|
|
20
23
|
"react": "^18.2.0",
|
|
21
|
-
"
|
|
24
|
+
"rimraf": "^3.0.2",
|
|
25
|
+
"typescript": "^4.9.4"
|
|
26
|
+
},
|
|
27
|
+
"nx": {
|
|
28
|
+
"implicitDependencies": [
|
|
29
|
+
"@builder.io/sdks"
|
|
30
|
+
]
|
|
22
31
|
}
|
|
23
32
|
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export const j: {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
import { applyPatchWithMinimalMutationChain } from './apply-patch-with-mutation.js';
|
|
2
|
-
describe('applyPatchWithMinimalMutationChain', () => {
|
|
3
|
-
test('Basic shallow update', () => {
|
|
4
|
-
const obj = {
|
|
5
|
-
foo: 'bar'
|
|
6
|
-
};
|
|
7
|
-
const patch = {
|
|
8
|
-
op: 'replace',
|
|
9
|
-
path: '/foo',
|
|
10
|
-
value: '60px'
|
|
11
|
-
};
|
|
12
|
-
const applied = applyPatchWithMinimalMutationChain(obj, patch);
|
|
13
|
-
expect(applied.foo).toBe('60px');
|
|
14
|
-
expect(applied).not.toBe(obj);
|
|
15
|
-
});
|
|
16
|
-
test('Deep object updates', () => {
|
|
17
|
-
const obj = {
|
|
18
|
-
foo: {
|
|
19
|
-
bar: true
|
|
20
|
-
},
|
|
21
|
-
baz: {}
|
|
22
|
-
};
|
|
23
|
-
const patch = {
|
|
24
|
-
op: 'replace',
|
|
25
|
-
path: '/foo/bar',
|
|
26
|
-
value: '60px'
|
|
27
|
-
};
|
|
28
|
-
const applied = applyPatchWithMinimalMutationChain(obj, patch);
|
|
29
|
-
expect(applied.foo.bar).toBe('60px');
|
|
30
|
-
expect(applied).not.toBe(obj);
|
|
31
|
-
expect(applied.foo).not.toBe(obj.foo);
|
|
32
|
-
expect(applied.baz).toBe(obj.baz);
|
|
33
|
-
});
|
|
34
|
-
test('Deep array updates', () => {
|
|
35
|
-
const obj = {
|
|
36
|
-
foo: [{
|
|
37
|
-
bar: true
|
|
38
|
-
}],
|
|
39
|
-
baz: {}
|
|
40
|
-
};
|
|
41
|
-
const patch = {
|
|
42
|
-
op: 'replace',
|
|
43
|
-
path: '/foo/0/bar',
|
|
44
|
-
value: '60px'
|
|
45
|
-
};
|
|
46
|
-
const applied = applyPatchWithMinimalMutationChain(obj, patch);
|
|
47
|
-
expect(applied.foo[0].bar).toBe('60px');
|
|
48
|
-
expect(applied).not.toBe(obj);
|
|
49
|
-
expect(applied.foo).not.toBe(obj.foo);
|
|
50
|
-
expect(applied.foo[0]).not.toBe(obj.foo[0]);
|
|
51
|
-
expect(applied.baz).toBe(obj.baz);
|
|
52
|
-
});
|
|
53
|
-
});
|
|
File without changes
|