@webstudio-is/sdk 0.0.0-2738e1e → 0.0.0-4f7bf18

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,9 +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",
432
431
  "vercel",
433
- "netlify",
434
432
  "netlify-functions",
435
433
  "netlify-edge-functions",
436
434
  "ssg",
@@ -968,10 +966,7 @@ var parseComponentName = (componentName) => {
968
966
  };
969
967
 
970
968
  // src/expression.ts
971
- import {
972
- parse,
973
- parseExpressionAt
974
- } from "acorn";
969
+ import { parseExpressionAt } from "acorn";
975
970
  import { simple } from "acorn-walk";
976
971
  var lintExpression = ({
977
972
  expression,
@@ -979,13 +974,13 @@ var lintExpression = ({
979
974
  allowAssignment = false
980
975
  }) => {
981
976
  const diagnostics = [];
982
- const addMessage = (message, severity = "error") => {
977
+ const addError = (message) => {
983
978
  return (node) => {
984
979
  diagnostics.push({
985
980
  // tune error position after wrapping expression with parentheses
986
981
  from: node.start - 1,
987
982
  to: node.end - 1,
988
- severity,
983
+ severity: "error",
989
984
  message
990
985
  });
991
986
  };
@@ -1000,7 +995,7 @@ var lintExpression = ({
1000
995
  return diagnostics;
1001
996
  }
1002
997
  try {
1003
- const root = parse(`(${expression})`, {
998
+ const root = parseExpressionAt(`(${expression})`, 0, {
1004
999
  ecmaVersion: "latest",
1005
1000
  // support parsing import to forbid explicitly
1006
1001
  sourceType: "module"
@@ -1008,10 +1003,7 @@ var lintExpression = ({
1008
1003
  simple(root, {
1009
1004
  Identifier(node) {
1010
1005
  if (availableVariables.has(node.name) === false) {
1011
- addMessage(
1012
- `"${node.name}" is not defined in the scope`,
1013
- "warning"
1014
- )(node);
1006
+ addError(`"${node.name}" is not defined in the scope`)(node);
1015
1007
  }
1016
1008
  },
1017
1009
  Literal() {
@@ -1038,16 +1030,13 @@ var lintExpression = ({
1038
1030
  },
1039
1031
  AssignmentExpression(node) {
1040
1032
  if (allowAssignment === false) {
1041
- addMessage("Assignment is supported only inside actions")(node);
1033
+ addError("Assignment is supported only inside actions")(node);
1042
1034
  return;
1043
1035
  }
1044
1036
  simple(node.left, {
1045
1037
  Identifier(node2) {
1046
1038
  if (availableVariables.has(node2.name) === false) {
1047
- addMessage(
1048
- `"${node2.name}" is not defined in the scope`,
1049
- "warning"
1050
- )(node2);
1039
+ addError(`"${node2.name}" is not defined in the scope`)(node2);
1051
1040
  }
1052
1041
  }
1053
1042
  });
@@ -1055,18 +1044,18 @@ var lintExpression = ({
1055
1044
  // parser forbids to yield inside module
1056
1045
  YieldExpression() {
1057
1046
  },
1058
- ThisExpression: addMessage(`"this" keyword is not supported`),
1059
- FunctionExpression: addMessage("Functions are not supported"),
1060
- UpdateExpression: addMessage("Increment and decrement are not supported"),
1061
- CallExpression: addMessage("Functions are not supported"),
1062
- NewExpression: addMessage("Classes are not supported"),
1063
- SequenceExpression: addMessage(`Only single expression is supported`),
1064
- ArrowFunctionExpression: addMessage("Functions are not supported"),
1065
- TaggedTemplateExpression: addMessage("Tagged template is not supported"),
1066
- ClassExpression: addMessage("Classes are not supported"),
1067
- MetaProperty: addMessage("Imports are not supported"),
1068
- AwaitExpression: addMessage(`"await" keyword is not supported`),
1069
- ImportExpression: addMessage("Imports are not supported")
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")
1070
1059
  });
1071
1060
  } catch (error) {
1072
1061
  const castedError = error;
@@ -1251,7 +1240,6 @@ var generateExpression = ({
1251
1240
  usedDataSources?.set(dep.id, dep);
1252
1241
  return scope.getName(dep.id, dep.name);
1253
1242
  }
1254
- return "undefined";
1255
1243
  }
1256
1244
  });
1257
1245
  };
@@ -1748,12 +1736,10 @@ export {
1748
1736
  corePropsMetas,
1749
1737
  createScope,
1750
1738
  decodeDataSourceVariable,
1751
- decodeDataSourceVariable as decodeDataVariableId,
1752
1739
  defaultStates,
1753
1740
  descendantComponent,
1754
1741
  documentTypes,
1755
1742
  encodeDataSourceVariable,
1756
- encodeDataSourceVariable as encodeDataVariableId,
1757
1743
  executeExpression,
1758
1744
  findPageByIdOrPath,
1759
1745
  findParentFolderByChildId,
@@ -43,16 +43,11 @@ 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 };
47
46
  export declare const decodeDataSourceVariable: (name: string) => string | undefined;
48
- export { decodeDataSourceVariable as decodeDataVariableId };
49
47
  export declare const generateExpression: ({ expression, dataSources, usedDataSources, scope, }: {
50
48
  expression: string;
51
49
  dataSources: DataSources;
52
50
  usedDataSources: DataSources;
53
51
  scope: Scope;
54
52
  }) => string;
55
- /**
56
- * edge case utility for "statoc" expression without variables
57
- */
58
53
  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", "docker", "vercel", "netlify", "netlify-functions", "netlify-edge-functions", "ssg", "ssg-netlify", "ssg-vercel"]>;
2
+ export declare const Templates: z.ZodEnum<["vanilla", "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", "docker", "vercel", "netlify", "netlify-functions", "netlify-edge-functions", "ssg", "ssg-netlify", "ssg-vercel"]>, "many">;
8
+ templates: z.ZodArray<z.ZodEnum<["vanilla", "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" | "docker" | "vercel" | "netlify" | "netlify-functions" | "netlify-edge-functions" | "ssg" | "ssg-netlify" | "ssg-vercel")[];
13
+ templates: ("vanilla" | "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" | "docker" | "vercel" | "netlify" | "netlify-functions" | "netlify-edge-functions" | "ssg" | "ssg-netlify" | "ssg-vercel")[];
18
+ templates: ("vanilla" | "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-2738e1e",
3
+ "version": "0.0.0-4f7bf18",
4
4
  "description": "Webstudio project data schema",
5
5
  "author": "Webstudio <github@webstudio.is>",
6
6
  "homepage": "https://webstudio.is",
@@ -39,15 +39,15 @@
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-2738e1e",
43
- "@webstudio-is/fonts": "0.0.0-2738e1e",
44
- "@webstudio-is/icons": "0.0.0-2738e1e"
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"
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-2738e1e",
50
+ "@webstudio-is/template": "0.0.0-4f7bf18",
51
51
  "@webstudio-is/tsconfig": "1.0.7"
52
52
  },
53
53
  "scripts": {