@builder.io/sdk-solid 0.5.3 → 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/CHANGELOG.md +9 -0
- package/package.json +1 -1
- package/src/functions/evaluate/acorn-interpreter.js +2876 -0
- package/src/functions/evaluate/evaluate.js +1 -15
- package/src/functions/evaluate/non-node-runtime/index.js +18 -0
- package/src/functions/evaluate/{non-node-runtime.js → non-node-runtime/non-node-runtime.js} +3 -3
- package/src/helpers/preview-lru-cache/get.js +2 -6
- package/src/helpers/preview-lru-cache/helpers.js +0 -10
- package/src/helpers/preview-lru-cache/init.js +1 -9
- package/src/helpers/preview-lru-cache/set.js +0 -4
- package/src/functions/evaluate/acorn.js +0 -1595
- package/src/functions/evaluate/interpreter.js +0 -2801
|
@@ -2,21 +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
|
-
|
|
6
|
-
if (isNonNodeServer()) {
|
|
7
|
-
import("./non-node-runtime.js").then(m => {
|
|
8
|
-
runInNonNode = m.runInNonNode;
|
|
9
|
-
}).catch(err => {
|
|
10
|
-
const ERROR_MESSAGE = `Error importing JS interpreter for non-Node.js runtimes. Make sure \`js-interpreter\` is installed.
|
|
11
|
-
Read more here: https://github.com/BuilderIO/builder/tree/main/packages/sdks/README.md#non-nodejs-runtimes-edge-serverless
|
|
12
|
-
`;
|
|
13
|
-
logger.error(ERROR_MESSAGE, err);
|
|
14
|
-
runInNonNode = (..._args) => {
|
|
15
|
-
logger.error(ERROR_MESSAGE);
|
|
16
|
-
return void 0;
|
|
17
|
-
};
|
|
18
|
-
});
|
|
19
|
-
}
|
|
5
|
+
import { runInNonNode } from "./non-node-runtime/index.js";
|
|
20
6
|
function evaluate({
|
|
21
7
|
code,
|
|
22
8
|
context,
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { logger } from "../../../helpers/logger.js";
|
|
2
|
+
import { isNonNodeServer } from "../../is-non-node-server.js";
|
|
3
|
+
let runInNonNode;
|
|
4
|
+
if (isNonNodeServer()) {
|
|
5
|
+
import("./non-node-runtime.js").then(m => {
|
|
6
|
+
runInNonNode = m.runInNonNode;
|
|
7
|
+
}).catch(err => {
|
|
8
|
+
const ERROR_MESSAGE = `Error importing JS interpreter for non-Node.js runtimes. Make sure \`js-interpreter\` is installed.
|
|
9
|
+
Read more here: https://github.com/BuilderIO/builder/tree/main/packages/sdks/README.md#non-nodejs-runtimes-edge-serverless
|
|
10
|
+
`;
|
|
11
|
+
logger.error(ERROR_MESSAGE, err);
|
|
12
|
+
runInNonNode = (..._args) => {
|
|
13
|
+
logger.error(ERROR_MESSAGE);
|
|
14
|
+
return void 0;
|
|
15
|
+
};
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
export { runInNonNode }
|
|
@@ -15,9 +15,9 @@ var __spreadValues = (a, b) => {
|
|
|
15
15
|
}
|
|
16
16
|
return a;
|
|
17
17
|
};
|
|
18
|
-
import { logger } from "
|
|
19
|
-
import { set } from "
|
|
20
|
-
import Interpreter from "
|
|
18
|
+
import { logger } from "../../../helpers/logger";
|
|
19
|
+
import { set } from "../../set";
|
|
20
|
+
import Interpreter from "../acorn-interpreter.js";
|
|
21
21
|
const processCode = code => {
|
|
22
22
|
return code.split("\n").map(line => {
|
|
23
23
|
const trimmed = line.trim();
|
|
@@ -1,8 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
function getPreviewContent(searchParams) {
|
|
4
|
-
init();
|
|
5
|
-
const id = getIdFromSearchParams(searchParams);
|
|
6
|
-
return typeof id === "string" ? globalThis._BUILDER_PREVIEW_LRU_CACHE.get(id) : void 0;
|
|
1
|
+
function getPreviewContent(_searchParams) {
|
|
2
|
+
return void 0;
|
|
7
3
|
}
|
|
8
4
|
export { getPreviewContent }
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { logger } from "../logger";
|
|
2
|
-
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
|
-
};
|
|
10
|
-
export { getIdFromSearchParams }
|
|
@@ -18,15 +18,11 @@ var __async = (__this, __arguments, generator) => {
|
|
|
18
18
|
step((generator = generator.apply(__this, __arguments)).next());
|
|
19
19
|
});
|
|
20
20
|
};
|
|
21
|
-
"use server";
|
|
22
|
-
import { init } from "./init";
|
|
23
21
|
function postPreviewContent(_0) {
|
|
24
22
|
return __async(this, arguments, function* ({
|
|
25
23
|
key,
|
|
26
24
|
value
|
|
27
25
|
}) {
|
|
28
|
-
init();
|
|
29
|
-
globalThis._BUILDER_PREVIEW_LRU_CACHE.set(key, value);
|
|
30
26
|
return {
|
|
31
27
|
[key]: value
|
|
32
28
|
};
|