@webstudio-is/sdk 0.0.0-4f7bf18 → 0.0.0-588fe22

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/lib/index.js CHANGED
@@ -428,6 +428,7 @@ var Styles = z10.map(z10.string(), StyleDecl);
428
428
  import { z as z11 } from "zod";
429
429
  var Templates = z11.enum([
430
430
  "vanilla",
431
+ "docker",
431
432
  "vercel",
432
433
  "netlify-functions",
433
434
  "netlify-edge-functions",
@@ -974,13 +975,13 @@ var lintExpression = ({
974
975
  allowAssignment = false
975
976
  }) => {
976
977
  const diagnostics = [];
977
- const addError = (message) => {
978
+ const addMessage = (message, severity = "error") => {
978
979
  return (node) => {
979
980
  diagnostics.push({
980
981
  // tune error position after wrapping expression with parentheses
981
982
  from: node.start - 1,
982
983
  to: node.end - 1,
983
- severity: "error",
984
+ severity,
984
985
  message
985
986
  });
986
987
  };
@@ -1003,7 +1004,10 @@ var lintExpression = ({
1003
1004
  simple(root, {
1004
1005
  Identifier(node) {
1005
1006
  if (availableVariables.has(node.name) === false) {
1006
- addError(`"${node.name}" is not defined in the scope`)(node);
1007
+ addMessage(
1008
+ `"${node.name}" is not defined in the scope`,
1009
+ "warning"
1010
+ )(node);
1007
1011
  }
1008
1012
  },
1009
1013
  Literal() {
@@ -1030,13 +1034,16 @@ var lintExpression = ({
1030
1034
  },
1031
1035
  AssignmentExpression(node) {
1032
1036
  if (allowAssignment === false) {
1033
- addError("Assignment is supported only inside actions")(node);
1037
+ addMessage("Assignment is supported only inside actions")(node);
1034
1038
  return;
1035
1039
  }
1036
1040
  simple(node.left, {
1037
1041
  Identifier(node2) {
1038
1042
  if (availableVariables.has(node2.name) === false) {
1039
- addError(`"${node2.name}" is not defined in the scope`)(node2);
1043
+ addMessage(
1044
+ `"${node2.name}" is not defined in the scope`,
1045
+ "warning"
1046
+ )(node2);
1040
1047
  }
1041
1048
  }
1042
1049
  });
@@ -1044,18 +1051,18 @@ var lintExpression = ({
1044
1051
  // parser forbids to yield inside module
1045
1052
  YieldExpression() {
1046
1053
  },
1047
- ThisExpression: addError(`"this" keyword is not supported`),
1048
- FunctionExpression: addError("Functions are not supported"),
1049
- UpdateExpression: addError("Increment and decrement are not supported"),
1050
- CallExpression: addError("Functions are not supported"),
1051
- NewExpression: addError("Classes are not supported"),
1052
- SequenceExpression: addError(`Only single expression is supported`),
1053
- ArrowFunctionExpression: addError("Functions are not supported"),
1054
- TaggedTemplateExpression: addError("Tagged template is not supported"),
1055
- ClassExpression: addError("Classes are not supported"),
1056
- MetaProperty: addError("Imports are not supported"),
1057
- AwaitExpression: addError(`"await" keyword is not supported`),
1058
- ImportExpression: addError("Imports are not supported")
1054
+ ThisExpression: addMessage(`"this" keyword is not supported`),
1055
+ FunctionExpression: addMessage("Functions are not supported"),
1056
+ UpdateExpression: addMessage("Increment and decrement are not supported"),
1057
+ CallExpression: addMessage("Functions are not supported"),
1058
+ NewExpression: addMessage("Classes are not supported"),
1059
+ SequenceExpression: addMessage(`Only single expression is supported`),
1060
+ ArrowFunctionExpression: addMessage("Functions are not supported"),
1061
+ TaggedTemplateExpression: addMessage("Tagged template is not supported"),
1062
+ ClassExpression: addMessage("Classes are not supported"),
1063
+ MetaProperty: addMessage("Imports are not supported"),
1064
+ AwaitExpression: addMessage(`"await" keyword is not supported`),
1065
+ ImportExpression: addMessage("Imports are not supported")
1059
1066
  });
1060
1067
  } catch (error) {
1061
1068
  const castedError = error;
@@ -1240,6 +1247,7 @@ var generateExpression = ({
1240
1247
  usedDataSources?.set(dep.id, dep);
1241
1248
  return scope.getName(dep.id, dep.name);
1242
1249
  }
1250
+ return "undefined";
1243
1251
  }
1244
1252
  });
1245
1253
  };
@@ -1736,10 +1744,12 @@ export {
1736
1744
  corePropsMetas,
1737
1745
  createScope,
1738
1746
  decodeDataSourceVariable,
1747
+ decodeDataSourceVariable as decodeDataVariableId,
1739
1748
  defaultStates,
1740
1749
  descendantComponent,
1741
1750
  documentTypes,
1742
1751
  encodeDataSourceVariable,
1752
+ encodeDataSourceVariable as encodeDataVariableId,
1743
1753
  executeExpression,
1744
1754
  findPageByIdOrPath,
1745
1755
  findParentFolderByChildId,
@@ -43,11 +43,16 @@ export declare const parseObjectExpression: (expression: string) => Map<string,
43
43
  */
44
44
  export declare const generateObjectExpression: (map: Map<string, string>) => string;
45
45
  export declare const encodeDataSourceVariable: (id: string) => string;
46
+ export { encodeDataSourceVariable as encodeDataVariableId };
46
47
  export declare const decodeDataSourceVariable: (name: string) => string | undefined;
48
+ export { decodeDataSourceVariable as decodeDataVariableId };
47
49
  export declare const generateExpression: ({ expression, dataSources, usedDataSources, scope, }: {
48
50
  expression: string;
49
51
  dataSources: DataSources;
50
52
  usedDataSources: DataSources;
51
53
  scope: Scope;
52
54
  }) => string;
55
+ /**
56
+ * edge case utility for "statoc" expression without variables
57
+ */
53
58
  export declare const executeExpression: (expression: undefined | string) => any;
@@ -1,21 +1,21 @@
1
1
  import { z } from "zod";
2
- export declare const Templates: z.ZodEnum<["vanilla", "vercel", "netlify-functions", "netlify-edge-functions", "ssg", "ssg-netlify", "ssg-vercel"]>;
2
+ export declare const Templates: z.ZodEnum<["vanilla", "docker", "vercel", "netlify-functions", "netlify-edge-functions", "ssg", "ssg-netlify", "ssg-vercel"]>;
3
3
  export type Templates = z.infer<typeof Templates>;
4
4
  export declare const Deployment: z.ZodUnion<[z.ZodObject<{
5
5
  destination: z.ZodLiteral<"static">;
6
6
  name: z.ZodString;
7
7
  assetsDomain: z.ZodString;
8
- templates: z.ZodArray<z.ZodEnum<["vanilla", "vercel", "netlify-functions", "netlify-edge-functions", "ssg", "ssg-netlify", "ssg-vercel"]>, "many">;
8
+ templates: z.ZodArray<z.ZodEnum<["vanilla", "docker", "vercel", "netlify-functions", "netlify-edge-functions", "ssg", "ssg-netlify", "ssg-vercel"]>, "many">;
9
9
  }, "strip", z.ZodTypeAny, {
10
10
  name: string;
11
11
  destination: "static";
12
12
  assetsDomain: string;
13
- templates: ("vanilla" | "vercel" | "netlify-functions" | "netlify-edge-functions" | "ssg" | "ssg-netlify" | "ssg-vercel")[];
13
+ templates: ("vanilla" | "docker" | "vercel" | "netlify-functions" | "netlify-edge-functions" | "ssg" | "ssg-netlify" | "ssg-vercel")[];
14
14
  }, {
15
15
  name: string;
16
16
  destination: "static";
17
17
  assetsDomain: string;
18
- templates: ("vanilla" | "vercel" | "netlify-functions" | "netlify-edge-functions" | "ssg" | "ssg-netlify" | "ssg-vercel")[];
18
+ templates: ("vanilla" | "docker" | "vercel" | "netlify-functions" | "netlify-edge-functions" | "ssg" | "ssg-netlify" | "ssg-vercel")[];
19
19
  }>, z.ZodObject<{
20
20
  destination: z.ZodOptional<z.ZodLiteral<"saas">>;
21
21
  domains: z.ZodArray<z.ZodString, "many">;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@webstudio-is/sdk",
3
- "version": "0.0.0-4f7bf18",
3
+ "version": "0.0.0-588fe22",
4
4
  "description": "Webstudio project data schema",
5
5
  "author": "Webstudio <github@webstudio.is>",
6
6
  "homepage": "https://webstudio.is",
@@ -39,16 +39,16 @@
39
39
  "reserved-identifiers": "^1.0.0",
40
40
  "type-fest": "^4.32.0",
41
41
  "zod": "^3.22.4",
42
- "@webstudio-is/css-engine": "0.0.0-4f7bf18",
43
- "@webstudio-is/icons": "0.0.0-4f7bf18",
44
- "@webstudio-is/fonts": "0.0.0-4f7bf18"
42
+ "@webstudio-is/css-engine": "0.0.0-588fe22",
43
+ "@webstudio-is/fonts": "0.0.0-588fe22",
44
+ "@webstudio-is/icons": "0.0.0-588fe22"
45
45
  },
46
46
  "devDependencies": {
47
47
  "html-tags": "^4.0.0",
48
48
  "vitest": "^3.0.2",
49
49
  "@webstudio-is/css-data": "0.0.0",
50
- "@webstudio-is/template": "0.0.0-4f7bf18",
51
- "@webstudio-is/tsconfig": "1.0.7"
50
+ "@webstudio-is/tsconfig": "1.0.7",
51
+ "@webstudio-is/template": "0.0.0-588fe22"
52
52
  },
53
53
  "scripts": {
54
54
  "typecheck": "tsc",