@webstudio-is/sdk 0.143.1 → 0.144.1-710b1d2.0

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
@@ -126,10 +126,7 @@ var Pages = z2.object({
126
126
  compiler: CompilerSettings.optional(),
127
127
  redirects: z2.array(PageRedirect).optional(),
128
128
  homePage: HomePage,
129
- pages: z2.array(Page).refine(
130
- (array) => new Set(array.map((page) => page.path)).size === array.length,
131
- "All paths must be unique"
132
- ),
129
+ pages: z2.array(Page),
133
130
  folders: z2.array(Folder).refine((folders) => folders.length > 0, "Folders can't be empty")
134
131
  });
135
132
 
@@ -378,7 +375,8 @@ var StyleDeclRaw = z10.object({
378
375
  state: z10.optional(z10.string()),
379
376
  // @todo can't figure out how to make property to be enum
380
377
  property: z10.string(),
381
- value: StyleValue
378
+ value: StyleValue,
379
+ listed: z10.boolean().optional()
382
380
  });
383
381
  var StyleDecl = StyleDeclRaw;
384
382
  var getStyleDeclKey = (styleDecl) => {
@@ -600,6 +598,12 @@ var lintExpression = ({
600
598
  };
601
599
  };
602
600
  if (expression.trim().length === 0) {
601
+ diagnostics.push({
602
+ from: 0,
603
+ to: 0,
604
+ severity: "error",
605
+ message: "Expression cannot be empty"
606
+ });
603
607
  return diagnostics;
604
608
  }
605
609
  try {
@@ -730,7 +734,13 @@ var transpileExpression = ({
730
734
  executable = false,
731
735
  replaceVariable
732
736
  }) => {
733
- const root = parseExpressionAt(expression, 0, { ecmaVersion: "latest" });
737
+ let root;
738
+ try {
739
+ root = parseExpressionAt(expression, 0, { ecmaVersion: "latest" });
740
+ } catch (error) {
741
+ const message = error.message;
742
+ throw Error(`${message} in ${JSON.stringify(expression)}`);
743
+ }
734
744
  const replacements = [];
735
745
  const replaceIdentifier = (node, assignee) => {
736
746
  const newName = replaceVariable?.(node.name, assignee);
@@ -289,7 +289,7 @@ export declare const Pages: z.ZodObject<{
289
289
  rootInstanceId: string;
290
290
  systemDataSourceId?: string | undefined;
291
291
  }>;
292
- pages: z.ZodEffects<z.ZodArray<z.ZodObject<{
292
+ pages: z.ZodArray<z.ZodObject<{
293
293
  path: z.ZodEffects<z.ZodEffects<z.ZodEffects<z.ZodEffects<z.ZodEffects<z.ZodEffects<z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>, string, string>, string, string>, string, string>, string, string>, string, string>, string, string>;
294
294
  id: z.ZodString;
295
295
  name: z.ZodEffects<z.ZodString, string, string>;
@@ -384,49 +384,7 @@ export declare const Pages: z.ZodObject<{
384
384
  title: string;
385
385
  rootInstanceId: string;
386
386
  systemDataSourceId?: string | undefined;
387
- }>, "many">, {
388
- path: string;
389
- id: string;
390
- name: string;
391
- meta: {
392
- description?: string | undefined;
393
- title?: string | undefined;
394
- excludePageFromSearch?: string | undefined;
395
- language?: string | undefined;
396
- socialImageAssetId?: string | undefined;
397
- socialImageUrl?: string | undefined;
398
- status?: string | undefined;
399
- redirect?: string | undefined;
400
- custom?: {
401
- property: string;
402
- content: string;
403
- }[] | undefined;
404
- };
405
- title: string;
406
- rootInstanceId: string;
407
- systemDataSourceId?: string | undefined;
408
- }[], {
409
- path: string;
410
- id: string;
411
- name: string;
412
- meta: {
413
- description?: string | undefined;
414
- title?: string | undefined;
415
- excludePageFromSearch?: string | undefined;
416
- language?: string | undefined;
417
- socialImageAssetId?: string | undefined;
418
- socialImageUrl?: string | undefined;
419
- status?: string | undefined;
420
- redirect?: string | undefined;
421
- custom?: {
422
- property: string;
423
- content: string;
424
- }[] | undefined;
425
- };
426
- title: string;
427
- rootInstanceId: string;
428
- systemDataSourceId?: string | undefined;
429
- }[]>;
387
+ }>, "many">;
430
388
  folders: z.ZodEffects<z.ZodArray<z.ZodObject<{
431
389
  id: z.ZodString;
432
390
  name: z.ZodEffects<z.ZodString, string, string>;
@@ -7257,6 +7257,7 @@ declare const StyleDeclRaw: z.ZodObject<{
7257
7257
  type: "guaranteedInvalid";
7258
7258
  })[];
7259
7259
  }>]>;
7260
+ listed: z.ZodOptional<z.ZodBoolean>;
7260
7261
  }, "strip", z.ZodTypeAny, {
7261
7262
  value: {
7262
7263
  value: number;
@@ -7691,6 +7692,7 @@ declare const StyleDeclRaw: z.ZodObject<{
7691
7692
  styleSourceId: string;
7692
7693
  breakpointId: string;
7693
7694
  state?: string | undefined;
7695
+ listed?: boolean | undefined;
7694
7696
  }, {
7695
7697
  value: {
7696
7698
  value: number;
@@ -9637,6 +9639,7 @@ declare const StyleDeclRaw: z.ZodObject<{
9637
9639
  styleSourceId: string;
9638
9640
  breakpointId: string;
9639
9641
  state?: string | undefined;
9642
+ listed?: boolean | undefined;
9640
9643
  }>;
9641
9644
  export type StyleDecl = Simplify<Omit<z.infer<typeof StyleDeclRaw>, "property"> & {
9642
9645
  property: StyleProperty;
@@ -10074,6 +10077,7 @@ export declare const StyleDecl: z.ZodType<{
10074
10077
  styleSourceId: string;
10075
10078
  breakpointId: string;
10076
10079
  state?: string | undefined;
10080
+ listed?: boolean | undefined;
10077
10081
  property: StyleProperty;
10078
10082
  }, z.ZodTypeDef, {
10079
10083
  value: {
@@ -10508,6 +10512,7 @@ export declare const StyleDecl: z.ZodType<{
10508
10512
  styleSourceId: string;
10509
10513
  breakpointId: string;
10510
10514
  state?: string | undefined;
10515
+ listed?: boolean | undefined;
10511
10516
  property: StyleProperty;
10512
10517
  }>;
10513
10518
  export type StyleDeclKey = string;
@@ -10945,6 +10950,7 @@ export declare const Styles: z.ZodMap<z.ZodString, z.ZodType<{
10945
10950
  styleSourceId: string;
10946
10951
  breakpointId: string;
10947
10952
  state?: string | undefined;
10953
+ listed?: boolean | undefined;
10948
10954
  property: StyleProperty;
10949
10955
  }, z.ZodTypeDef, {
10950
10956
  value: {
@@ -11379,6 +11385,7 @@ export declare const Styles: z.ZodMap<z.ZodString, z.ZodType<{
11379
11385
  styleSourceId: string;
11380
11386
  breakpointId: string;
11381
11387
  state?: string | undefined;
11388
+ listed?: boolean | undefined;
11382
11389
  property: StyleProperty;
11383
11390
  }>>;
11384
11391
  export type Styles = Map<string, StyleDecl>;
@@ -1183,6 +1183,7 @@ export declare const WebstudioFragment: z.ZodObject<{
1183
1183
  styleSourceId: string;
1184
1184
  breakpointId: string;
1185
1185
  state?: string | undefined;
1186
+ listed?: boolean | undefined;
1186
1187
  property: import("@webstudio-is/css-engine").StyleProperty;
1187
1188
  }, z.ZodTypeDef, {
1188
1189
  value: {
@@ -1617,6 +1618,7 @@ export declare const WebstudioFragment: z.ZodObject<{
1617
1618
  styleSourceId: string;
1618
1619
  breakpointId: string;
1619
1620
  state?: string | undefined;
1621
+ listed?: boolean | undefined;
1620
1622
  property: import("@webstudio-is/css-engine").StyleProperty;
1621
1623
  }>, "many">;
1622
1624
  }, "strip", z.ZodTypeAny, {
@@ -2270,6 +2272,7 @@ export declare const WebstudioFragment: z.ZodObject<{
2270
2272
  styleSourceId: string;
2271
2273
  breakpointId: string;
2272
2274
  state?: string | undefined;
2275
+ listed?: boolean | undefined;
2273
2276
  property: import("@webstudio-is/css-engine").StyleProperty;
2274
2277
  }[];
2275
2278
  }, {
@@ -2923,6 +2926,7 @@ export declare const WebstudioFragment: z.ZodObject<{
2923
2926
  styleSourceId: string;
2924
2927
  breakpointId: string;
2925
2928
  state?: string | undefined;
2929
+ listed?: boolean | undefined;
2926
2930
  property: import("@webstudio-is/css-engine").StyleProperty;
2927
2931
  }[];
2928
2932
  }>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@webstudio-is/sdk",
3
- "version": "0.143.1",
3
+ "version": "0.144.1-710b1d2.0",
4
4
  "description": "Webstudio project data schema",
5
5
  "author": "Webstudio <github@webstudio.is>",
6
6
  "homepage": "https://webstudio.is",
@@ -20,14 +20,16 @@
20
20
  "dependencies": {
21
21
  "acorn": "^8.11.3",
22
22
  "acorn-walk": "^8.3.2",
23
+ "type-fest": "^4.3.1",
23
24
  "zod": "^3.22.4",
24
- "@webstudio-is/css-engine": "0.143.1",
25
- "@webstudio-is/fonts": "0.143.1"
25
+ "@webstudio-is/css-engine": "0.144.1-710b1d2.0",
26
+ "@webstudio-is/fonts": "0.144.1-710b1d2.0"
26
27
  },
27
28
  "devDependencies": {
28
29
  "@jest/globals": "^29.7.0",
29
- "@webstudio-is/jest-config": "1.0.7",
30
- "@webstudio-is/tsconfig": "1.0.7"
30
+ "strip-indent": "^4.0.0",
31
+ "@webstudio-is/jest-config": "1.0.8-710b1d2.0",
32
+ "@webstudio-is/tsconfig": "1.0.8-710b1d2.0"
31
33
  },
32
34
  "scripts": {
33
35
  "typecheck": "tsc",