@knapsack/design-token-utils 4.65.8--canary.4318.2950f41.1 → 4.65.9--canary.4329.af7563d.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -15,7 +15,7 @@ export interface KsFigmaVarAlias {
15
15
  }
16
16
  export type KsFigmaVarValue = boolean | string | number | KsFigmaColorRbg | KsFigmaVarAlias;
17
17
  export type KsFigmaVariableType = 'BOOLEAN' | 'COLOR' | 'FLOAT' | 'STRING';
18
- export declare function isKsFigmaVarValueAlias(value: KsFigmaVarValue): value is KsFigmaVarAlias;
18
+ export declare function isKsFigmaVarValueAlias(value: unknown): value is KsFigmaVarAlias;
19
19
  export declare function isKsFigmaVarValueRgb(value: KsFigmaVarValue): value is KsFigmaColorRbg;
20
20
  export type KsFigmaVar = {
21
21
  id: string;
@@ -1 +1 @@
1
- {"version":3,"file":"ks-figma-vars.format.d.ts","sourceRoot":"","sources":["../../../src/formats/ks-figma-vars/ks-figma-vars.format.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAGxC,MAAM,MAAM,eAAe,GAAG;IAC5B,YAAY;IACZ,CAAC,EAAE,MAAM,CAAC;IACV,YAAY;IACZ,CAAC,EAAE,MAAM,CAAC;IACV,YAAY;IACZ,CAAC,EAAE,MAAM,CAAC;IACV,YAAY;IACZ,CAAC,CAAC,EAAE,MAAM,CAAC;CACZ,CAAC;AAEF,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,gBAAgB,CAAC;IACvB,EAAE,EAAE,MAAM,CAAC;CACZ;AACD,MAAM,MAAM,eAAe,GACvB,OAAO,GACP,MAAM,GACN,MAAM,GACN,eAAe,GACf,eAAe,CAAC;AACpB,MAAM,MAAM,mBAAmB,GAAG,SAAS,GAAG,OAAO,GAAG,OAAO,GAAG,QAAQ,CAAC;AAE3E,wBAAgB,sBAAsB,CACpC,KAAK,EAAE,eAAe,GACrB,KAAK,IAAI,eAAe,CAE1B;AAED,wBAAgB,oBAAoB,CAClC,KAAK,EAAE,e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AC;AAEF,MAAM,MAAM,iBAAiB,GAAG;IAC9B,eAAe,EAAE,MAAM,CAAC,MAAM,EAAE,iBAAiB,CAAC,CAAC;IACnD,aAAa,EAAE,MAAM,CAAC,MAAM,EAAE,UAAU,CAAC,CAAC;CAC3C,CAAC;AAEF,eAAO,MAAM,oBAAoB,EAAE,SAAS,CAAC,iBAAiB,CA0F7D,CAAC"}
@@ -51,6 +51,36 @@ export const validateFigmaVarsSrc = (src) => {
51
51
  ],
52
52
  };
53
53
  }
54
+ // Verify all vars that are referenced actually exist
55
+ // @TODO: zod all this
56
+ if (isObject(src) && 'variablesById' in src && isObject(src.variablesById)) {
57
+ // const allVarIds = Object.keys(src.variablesById);
58
+ const { variablesById } = src;
59
+ Object.values(variablesById).forEach((varData) => {
60
+ if (!isObject(varData) || !('valuesByMode' in varData))
61
+ return;
62
+ const { valuesByMode } = varData;
63
+ if (!isObject(valuesByMode))
64
+ return;
65
+ const refErrors = [];
66
+ Object.entries(valuesByMode).forEach(([modeId, modeVal]) => {
67
+ if (isKsFigmaVarValueAlias(modeVal)) {
68
+ const found = variablesById[modeVal.id];
69
+ if (!found) {
70
+ const msg = `Var "${varData.name}" has a reference, "${modeVal.id}", for mode "${modeId}" that cannot be found`;
71
+ refErrors.push({
72
+ id: `${varData.name}.${modeId}`,
73
+ msgs: [msg],
74
+ });
75
+ }
76
+ }
77
+ });
78
+ validateResults = {
79
+ ...validateResults,
80
+ errors: [...validateResults.errors, ...refErrors],
81
+ };
82
+ });
83
+ }
54
84
  return {
55
85
  errorMsg: formatValidationResults(validateResults.errors),
56
86
  errors: validateResults.errors,
@@ -1 +1 @@
1
- {"version":3,"file":"ks-figma-vars.format.js","sourceRoot":"","sources":["../../../src/formats/ks-figma-vars/ks-figma-vars.format.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAE3C,OAAO,EAAE,uBAAuB,EAAE,MAAM,oBAAoB,CAAC;AAyB7D,MAAM,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
  "description": "",
4
- "version": "4.65.8--canary.4318.2950f41.1",
4
+ "version": "4.65.9--canary.4329.af7563d.0",
5
5
  "type": "module",
6
6
  "exports": {
7
7
  ".": {
@@ -26,19 +26,19 @@
26
26
  "test": "time npm run ava"
27
27
  },
28
28
  "dependencies": {
29
- "@knapsack/color-utils": "4.65.8--canary.4318.2950f41.1",
30
- "@knapsack/file-utils": "4.65.8--canary.4318.2950f41.1",
31
- "@knapsack/types": "4.65.8--canary.4318.2950f41.1",
32
- "@knapsack/utils": "4.65.8--canary.4318.2950f41.1",
29
+ "@knapsack/color-utils": "4.65.9--canary.4329.af7563d.0",
30
+ "@knapsack/file-utils": "4.65.9--canary.4329.af7563d.0",
31
+ "@knapsack/types": "4.65.9--canary.4329.af7563d.0",
32
+ "@knapsack/utils": "4.65.9--canary.4329.af7563d.0",
33
33
  "flat": "^5.0.2",
34
34
  "immer": "^10.0.4",
35
35
  "lodash": "^4.17.21",
36
36
  "superstruct": "^0.16.7"
37
37
  },
38
38
  "devDependencies": {
39
- "@knapsack/eslint-config-starter": "4.65.8--canary.4318.2950f41.1",
40
- "@knapsack/test-ava": "4.65.8--canary.4318.2950f41.1",
41
- "@knapsack/typescript-config-starter": "4.65.8--canary.4318.2950f41.1",
39
+ "@knapsack/eslint-config-starter": "4.65.9--canary.4329.af7563d.0",
40
+ "@knapsack/test-ava": "4.65.9--canary.4329.af7563d.0",
41
+ "@knapsack/typescript-config-starter": "4.65.9--canary.4329.af7563d.0",
42
42
  "@microsoft/api-extractor": "^7.43.8",
43
43
  "@types/flat": "^5.0.5",
44
44
  "@types/fs-extra": "^11.0.4",
@@ -63,5 +63,5 @@
63
63
  "directory": "libs/design-token-utils",
64
64
  "type": "git"
65
65
  },
66
- "gitHead": "2950f4143e9f0288bd956a4edd78f3a3bf267854"
66
+ "gitHead": "af7563d754f88766001c1bfccb711bcc9058b301"
67
67
  }