@builder.io/sdk-svelte 0.5.2 → 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 (31) hide show
  1. package/README.md +4 -0
  2. package/package/--package.json +21 -7
  3. package/package/CHANGELOG.md +5 -0
  4. package/package/README.md +4 -0
  5. package/package/blocks/image/image.svelte.d.ts +1 -0
  6. package/package/blocks/text/text.svelte +2 -1
  7. package/package/components/content-variants/content-variants.svelte +12 -6
  8. package/package/constants/sdk-version.d.ts +1 -1
  9. package/package/constants/sdk-version.js +1 -1
  10. package/package/functions/evaluate/acorn-interpreter.js +3111 -0
  11. package/package/functions/evaluate/evaluate.js +1 -1
  12. package/package/functions/evaluate/non-node-runtime/index.d.ts +6 -0
  13. package/package/functions/evaluate/non-node-runtime/index.js +22 -0
  14. package/package/functions/evaluate/{non-node-runtime.d.ts → non-node-runtime/non-node-runtime.d.ts} +1 -1
  15. package/package/functions/evaluate/{non-node-runtime.js → non-node-runtime/non-node-runtime.js} +3 -3
  16. package/package/functions/evaluate/types.d.ts +1 -0
  17. package/package.json +18 -4
  18. package/src/blocks/text/text.svelte +2 -1
  19. package/src/components/content-variants/content-variants.svelte +12 -6
  20. package/src/constants/sdk-version.ts +1 -1
  21. package/src/functions/evaluate/acorn-interpreter.ts +2891 -0
  22. package/src/functions/evaluate/evaluate.ts +1 -1
  23. package/src/functions/evaluate/non-node-runtime/index.ts +23 -0
  24. package/src/functions/evaluate/{non-node-runtime.ts → non-node-runtime/non-node-runtime.ts} +4 -4
  25. package/src/functions/evaluate/types.ts +2 -1
  26. package/package/functions/evaluate/acorn.d.ts +0 -0
  27. package/package/functions/evaluate/acorn.js +0 -2433
  28. package/package/functions/evaluate/interpreter.js +0 -3853
  29. package/src/functions/evaluate/acorn.ts +0 -2501
  30. package/src/functions/evaluate/interpreter.ts +0 -3887
  31. /package/package/functions/evaluate/{interpreter.d.ts → acorn-interpreter.d.ts} +0 -0
package/README.md CHANGED
@@ -21,3 +21,7 @@ Take a look at [our example repo](/examples/svelte/sveltekit) for how to use thi
21
21
  ## Fetch
22
22
 
23
23
  This Package uses fetch. See [these docs](https://github.com/BuilderIO/this-package-uses-fetch/blob/main/README.md) for more information.
24
+
25
+ ## Non-Node.js Runtimes (Edge, Serverless)
26
+
27
+ If planning to deploy your app to a non-Node.js runtime (like Edge or Serverless functions), make sure to read the [Non-Node.js Runtimes](../../README.md#non-nodejs-runtimes-edge-serverless) section of the main README.
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@builder.io/sdk-svelte",
3
3
  "description": "Builder.io SDK for Svelte",
4
- "version": "0.5.2",
4
+ "version": "0.5.4",
5
5
  "type": "module",
6
6
  "files": [
7
7
  "package",
@@ -98,11 +98,11 @@
98
98
  "./context/types": "./context/types.js",
99
99
  "./functions/apply-patch-with-mutation": "./functions/apply-patch-with-mutation.js",
100
100
  "./functions/camel-to-kebab-case": "./functions/camel-to-kebab-case.js",
101
- "./functions/evaluate/acorn": "./functions/evaluate/acorn.js",
101
+ "./functions/evaluate/acorn-interpreter": "./functions/evaluate/acorn-interpreter.js",
102
102
  "./functions/evaluate/evaluate": "./functions/evaluate/evaluate.js",
103
103
  "./functions/evaluate": "./functions/evaluate/index.js",
104
- "./functions/evaluate/interpreter": "./functions/evaluate/interpreter.js",
105
- "./functions/evaluate/non-node-runtime": "./functions/evaluate/non-node-runtime.js",
104
+ "./functions/evaluate/non-node-runtime": "./functions/evaluate/non-node-runtime/index.js",
105
+ "./functions/evaluate/non-node-runtime/non-node-runtime": "./functions/evaluate/non-node-runtime/non-node-runtime.js",
106
106
  "./functions/evaluate/types": "./functions/evaluate/types.js",
107
107
  "./functions/event-handler-name": "./functions/event-handler-name.js",
108
108
  "./functions/extract-text-styles": "./functions/extract-text-styles.js",
@@ -175,11 +175,25 @@
175
175
  "@sveltejs/adapter-auto": "1.0.0-next.71",
176
176
  "@sveltejs/kit": "^1.16.2",
177
177
  "@sveltejs/package": "1.0.0-next.1",
178
+ "nx": "^16.6.0",
179
+ "nx-cloud": "^16.2.0",
178
180
  "svelte": "^3.59.1",
179
- "svelte-check": "^3.3.2",
180
- "svelte-preprocess": "^4.10.6",
181
+ "svelte-check": "^3.4.6",
182
+ "svelte-preprocess": "^5.0.4",
181
183
  "tslib": "^2.3.1",
182
184
  "typescript": "^5.1.6",
183
- "vite": "^3.0.4"
185
+ "vite": "^4.4.8"
186
+ },
187
+ "nx": {
188
+ "implicitDependencies": [
189
+ "@builder.io/sdks"
190
+ ],
191
+ "targets": {
192
+ "build": {
193
+ "outputs": [
194
+ "{projectRoot}/package"
195
+ ]
196
+ }
197
+ }
184
198
  }
185
199
  }
@@ -1,3 +1,8 @@
1
+ ### 0.5.4
2
+
3
+ - Fix build issues caused by extraneous `acorn` import.
4
+ - Put Edge runtime evaluator behind dynamic import.
5
+
1
6
  ### 0.5.2
2
7
 
3
8
  - No Changes.
package/package/README.md CHANGED
@@ -21,3 +21,7 @@ Take a look at [our example repo](/examples/svelte/sveltekit) for how to use thi
21
21
  ## Fetch
22
22
 
23
23
  This Package uses fetch. See [these docs](https://github.com/BuilderIO/this-package-uses-fetch/blob/main/README.md) for more information.
24
+
25
+ ## Non-Node.js Runtimes (Edge, Serverless)
26
+
27
+ If planning to deploy your app to a non-Node.js runtime (like Edge or Serverless functions), make sure to read the [Non-Node.js Runtimes](../../README.md#non-nodejs-runtimes-edge-serverless) section of the main README.
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  import { SvelteComponentTyped } from "svelte";
2
3
  export interface ImageProps {
3
4
  className?: string;
@@ -17,5 +17,6 @@ function mitosis_styling(node, vars) {
17
17
  use:mitosis_styling={{
18
18
  outline: "none",
19
19
  }}
20
- class="builder-text">{@html text?.toString() || ""}</span
20
+ class="builder-text"
21
+ {...{}}>{@html text?.toString() || ""}</span
21
22
  >
@@ -31,6 +31,17 @@ $: hideVariantsStyleString = () => {
31
31
  .map((value) => `.variant-${value.testVariationId} { display: none; } `)
32
32
  .join("");
33
33
  };
34
+ $: defaultContent = () => {
35
+ return shouldRenderVariants
36
+ ? {
37
+ ...content,
38
+ testVariationId: content?.id,
39
+ }
40
+ : handleABTestingSync({
41
+ item: content,
42
+ canTrack: getDefaultCanTrack(canTrack),
43
+ });
44
+ };
34
45
  let shouldRenderVariants = checkShouldRunVariants({
35
46
  canTrack: getDefaultCanTrack(canTrack),
36
47
  content: content,
@@ -76,12 +87,7 @@ onMount(() => {
76
87
 
77
88
  <ContentComponent
78
89
  {...{}}
79
- content={shouldRenderVariants
80
- ? content
81
- : handleABTestingSync({
82
- item: content,
83
- canTrack: getDefaultCanTrack(canTrack),
84
- })}
90
+ content={defaultContent()}
85
91
  classNameProp={`variant-${content?.id}`}
86
92
  showContent={true}
87
93
  {model}
@@ -1 +1 @@
1
- export declare const SDK_VERSION = "0.5.2";
1
+ export declare const SDK_VERSION = "UNKNOWN_VERSION";
@@ -1 +1 @@
1
- export const SDK_VERSION = "0.5.2";
1
+ export const SDK_VERSION = 'UNKNOWN_VERSION';