@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.
Files changed (84) hide show
  1. package/README.md +4 -0
  2. package/dist/blocks/BaseText.d.ts +1 -0
  3. package/dist/blocks/button/button.d.ts +1 -0
  4. package/dist/blocks/button/button.js +2 -2
  5. package/dist/blocks/columns/columns.d.ts +1 -0
  6. package/dist/blocks/columns/columns.js +2 -2
  7. package/dist/blocks/custom-code/custom-code.d.ts +1 -0
  8. package/dist/blocks/embed/embed.d.ts +1 -0
  9. package/dist/blocks/form/form.d.ts +1 -0
  10. package/dist/blocks/fragment/fragment.d.ts +1 -0
  11. package/dist/blocks/image/image.d.ts +1 -0
  12. package/dist/blocks/img/img.d.ts +1 -0
  13. package/dist/blocks/img/img.js +1 -1
  14. package/dist/blocks/input/input.d.ts +1 -0
  15. package/dist/blocks/input/input.js +1 -1
  16. package/dist/blocks/raw-text/raw-text.d.ts +1 -0
  17. package/dist/blocks/section/section.d.ts +1 -0
  18. package/dist/blocks/section/section.js +1 -1
  19. package/dist/blocks/select/select.d.ts +1 -0
  20. package/dist/blocks/select/select.js +1 -1
  21. package/dist/blocks/submit-button/submit-button.d.ts +1 -0
  22. package/dist/blocks/submit-button/submit-button.js +1 -1
  23. package/dist/blocks/symbol/symbol.d.ts +1 -0
  24. package/dist/blocks/symbol/symbol.js +1 -1
  25. package/dist/blocks/text/text.d.ts +1 -0
  26. package/dist/blocks/text/text.js +1 -1
  27. package/dist/blocks/textarea/textarea.d.ts +1 -0
  28. package/dist/blocks/textarea/textarea.js +1 -1
  29. package/dist/blocks/video/video.d.ts +1 -0
  30. package/dist/components/block/block.d.ts +1 -0
  31. package/dist/components/block/components/block-styles.d.ts +1 -0
  32. package/dist/components/block/components/block-wrapper.d.ts +1 -0
  33. package/dist/components/block/components/component-ref/component-ref.d.ts +1 -0
  34. package/dist/components/block/components/interactive-element.d.ts +1 -0
  35. package/dist/components/block/components/repeated-block.d.ts +1 -0
  36. package/dist/components/blocks/blocks-wrapper.d.ts +1 -0
  37. package/dist/components/blocks/blocks-wrapper.js +1 -1
  38. package/dist/components/blocks/blocks.d.ts +1 -0
  39. package/dist/components/content/components/enable-editor.d.ts +1 -0
  40. package/dist/components/content/components/enable-editor.js +1 -1
  41. package/dist/components/content/components/styles.d.ts +1 -0
  42. package/dist/components/content/content.d.ts +1 -0
  43. package/dist/components/content/content.js +3 -1
  44. package/dist/components/content-variants/content-variants.d.ts +1 -0
  45. package/dist/components/content-variants/content-variants.js +12 -6
  46. package/dist/components/inlined-script.d.ts +1 -0
  47. package/dist/components/inlined-styles.d.ts +1 -0
  48. package/dist/constants/sdk-version.d.ts +1 -1
  49. package/dist/constants/sdk-version.js +1 -1
  50. package/dist/functions/{acorn_interpreter.js → evaluate/acorn-interpreter.js} +1084 -1000
  51. package/dist/functions/evaluate/evaluate.js +1 -1
  52. package/dist/functions/evaluate/non-node-runtime/index.d.ts +1 -0
  53. package/dist/functions/evaluate/non-node-runtime/index.js +2 -0
  54. package/dist/functions/evaluate/{non-node-runtime.d.ts → non-node-runtime/non-node-runtime.d.ts} +1 -1
  55. package/dist/functions/evaluate/{non-node-runtime.js → non-node-runtime/non-node-runtime.js} +3 -3
  56. package/dist/functions/evaluate/types.d.ts +1 -0
  57. package/package.json +12 -3
  58. package/dist/functions/acorn_interpreter.d.ts +0 -1
  59. package/dist/functions/apply-patch-with-mutation.test.d.ts +0 -1
  60. package/dist/functions/apply-patch-with-mutation.test.js +0 -53
  61. package/dist/functions/evaluate/acorn.d.ts +0 -0
  62. package/dist/functions/evaluate/acorn.js +0 -2432
  63. package/dist/functions/evaluate/evaluate.test.d.ts +0 -1
  64. package/dist/functions/evaluate/evaluate.test.js +0 -23
  65. package/dist/functions/evaluate/interpreter.js +0 -3853
  66. package/dist/functions/evaluate.d.ts +0 -23
  67. package/dist/functions/evaluate.js +0 -68
  68. package/dist/functions/evaluate.test.d.ts +0 -1
  69. package/dist/functions/evaluate.test.js +0 -23
  70. package/dist/functions/get-builder-search-params/fn.test.d.ts +0 -1
  71. package/dist/functions/get-builder-search-params/fn.test.js +0 -13
  72. package/dist/functions/get-content/generate-content-url.test.d.ts +0 -1
  73. package/dist/functions/get-content/generate-content-url.test.js +0 -111
  74. package/dist/functions/get-content/processCookies.d.ts +0 -2
  75. package/dist/functions/get-content/processCookies.js +0 -3
  76. package/dist/functions/get-processed-block.test.d.ts +0 -1
  77. package/dist/functions/get-processed-block.test.js +0 -35
  78. package/dist/functions/on-change.test.d.ts +0 -1
  79. package/dist/functions/on-change.test.js +0 -30
  80. package/dist/functions/set.test.d.ts +0 -1
  81. package/dist/functions/set.test.js +0 -22
  82. package/dist/helpers/url.test.d.ts +0 -1
  83. package/dist/helpers/url.test.js +0 -21
  84. /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';
@@ -0,0 +1,2 @@
1
+ // TEMPORARY FIX UNTIL we fix dynamic imports
2
+ export { runInNonNode } from './non-node-runtime.js';
@@ -1,2 +1,2 @@
1
- import type { ExecutorArgs } from './types';
1
+ import type { ExecutorArgs } from '../types';
2
2
  export declare const runInNonNode: ({ builder, context, event, rootState, localState, rootSetState, useCode }: ExecutorArgs) => any;
@@ -1,6 +1,6 @@
1
- import { logger } from '../../helpers/logger';
2
- import { set } from '../set';
3
- import Interpreter from './interpreter.js';
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();
@@ -8,3 +8,4 @@ export type ExecutorArgs = Pick<BuilderContextInterface, 'localState' | 'context
8
8
  };
9
9
  event: Event | undefined;
10
10
  };
11
+ export type Executor = (args: ExecutorArgs) => any;
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.1",
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
- "build": "tsc"
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
- "typescript": "^5.1.6"
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