From 0f0c5f8d672ae19273eaa00537fa164593090e56 Mon Sep 17 00:00:00 2001 From: jorenbroekema Date: Tue, 19 Dec 2023 16:07:22 +0100 Subject: [PATCH] chore: fix types across, upgrade to latest SD types branch --- package-lock.json | 211 ++---------------- package.json | 2 +- .../transformColorModifiers.ts | 2 +- src/mapDescriptionToComment.ts | 2 +- src/parsers/add-font-styles.ts | 6 +- src/parsers/expand-composites.ts | 8 +- src/registerTransforms.ts | 5 +- test/integration/custom-group.test.ts | 3 +- test/integration/expand-composition.test.ts | 4 +- .../math-in-complex-values.test.ts | 5 +- .../object-value-references.test.ts | 4 +- test/integration/output-references.test.ts | 4 +- test/integration/sd-transforms.test.ts | 4 +- test/integration/utils.ts | 6 +- test/suites/transform-suite.spec.ts | 2 +- 15 files changed, 45 insertions(+), 223 deletions(-) diff --git a/package-lock.json b/package-lock.json index 04eb4cc..723b55e 100644 --- a/package-lock.json +++ b/package-lock.json @@ -16,7 +16,7 @@ "expr-eval": "^2.0.2", "is-mergeable-object": "^1.1.1", "postcss-calc-ast-parser": "^0.1.4", - "style-dictionary": "4.0.0-prerelease.4" + "style-dictionary": "github:amzn/style-dictionary#types" }, "devDependencies": { "@changesets/cli": "^2.26.0", @@ -2891,15 +2891,6 @@ "node": ">=6" } }, - "node_modules/camel-case": { - "version": "4.1.2", - "resolved": "https://registry.npmjs.org/camel-case/-/camel-case-4.1.2.tgz", - "integrity": "sha512-gxGWBrTT1JuMx6R+o5PTXMmUnhnVzLQ9SNutD4YqKtI6ap897t3tKECYla6gCWEkplXnlNybEkZg9GEGxKFCgw==", - "dependencies": { - "pascal-case": "^3.1.2", - "tslib": "^2.0.3" - } - }, "node_modules/camelcase": { "version": "6.3.0", "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-6.3.0.tgz", @@ -2938,16 +2929,6 @@ "node": ">=6" } }, - "node_modules/capital-case": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/capital-case/-/capital-case-1.0.4.tgz", - "integrity": "sha512-ds37W8CytHgwnhGGTi88pcPyR15qoNkOpYwmMMfnWqqWgESapLqvDx6huFjQ5vqWSn2Z06173XNA7LtMOeUh1A==", - "dependencies": { - "no-case": "^3.0.4", - "tslib": "^2.0.3", - "upper-case-first": "^2.0.2" - } - }, "node_modules/chalk": { "version": "2.4.2", "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", @@ -3048,23 +3029,9 @@ } }, "node_modules/change-case": { - "version": "4.1.2", - "resolved": "https://registry.npmjs.org/change-case/-/change-case-4.1.2.tgz", - "integrity": "sha512-bSxY2ws9OtviILG1EiY5K7NNxkqg/JnRnFxLtKQ96JaviiIxi7djMrSd0ECT9AC+lttClmYwKw53BWpOMblo7A==", - "dependencies": { - "camel-case": "^4.1.2", - "capital-case": "^1.0.4", - "constant-case": "^3.0.4", - "dot-case": "^3.0.4", - "header-case": "^2.0.4", - "no-case": "^3.0.4", - "param-case": "^3.0.4", - "pascal-case": "^3.1.2", - "path-case": "^3.0.4", - "sentence-case": "^3.0.4", - "snake-case": "^3.0.4", - "tslib": "^2.0.3" - } + "version": "5.3.0", + "resolved": "https://registry.npmjs.org/change-case/-/change-case-5.3.0.tgz", + "integrity": "sha512-Eykca0fGS/xYlx2fG5NqnGSnsWauhSGiSXYhB1kO6E909GUfo8S54u4UZNS7lMJmgZumZ2SUpWaoLgAcfQRICg==" }, "node_modules/chardet": { "version": "0.7.0", @@ -3372,16 +3339,6 @@ "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", "integrity": "sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==" }, - "node_modules/constant-case": { - "version": "3.0.4", - "resolved": "https://registry.npmjs.org/constant-case/-/constant-case-3.0.4.tgz", - "integrity": "sha512-I2hSBi7Vvs7BEuJDr5dDHfzb/Ruj3FyvFyh7KLilAjNQw3Be+xgqUBA2W6scVEcL0hL1dwPRtIqEPVUCKkSsyQ==", - "dependencies": { - "no-case": "^3.0.4", - "tslib": "^2.0.3", - "upper-case": "^2.0.2" - } - }, "node_modules/content-disposition": { "version": "0.5.4", "resolved": "https://registry.npmjs.org/content-disposition/-/content-disposition-0.5.4.tgz", @@ -3725,15 +3682,6 @@ "node": ">=6.0.0" } }, - "node_modules/dot-case": { - "version": "3.0.4", - "resolved": "https://registry.npmjs.org/dot-case/-/dot-case-3.0.4.tgz", - "integrity": "sha512-Kv5nKlh6yRrdrGvxeJ2e5y2eRUpkUosIW4A2AS38zwSz27zu7ufDwQPi5Jhs3XAlGNetl3bmnGhQsMtkKJnj3w==", - "dependencies": { - "no-case": "^3.0.4", - "tslib": "^2.0.3" - } - }, "node_modules/eastasianwidth": { "version": "0.2.0", "resolved": "https://registry.npmjs.org/eastasianwidth/-/eastasianwidth-0.2.0.tgz", @@ -5149,15 +5097,6 @@ "he": "bin/he" } }, - "node_modules/header-case": { - "version": "2.0.4", - "resolved": "https://registry.npmjs.org/header-case/-/header-case-2.0.4.tgz", - "integrity": "sha512-H/vuk5TEEVZwrR0lp2zed9OCo1uAILMlx0JEMgC26rzyJJ3N1v6XkwHHXJQdR2doSjcGPM6OKPYoJgf0plJ11Q==", - "dependencies": { - "capital-case": "^1.0.4", - "tslib": "^2.0.3" - } - }, "node_modules/hosted-git-info": { "version": "2.8.9", "resolved": "https://registry.npmjs.org/hosted-git-info/-/hosted-git-info-2.8.9.tgz", @@ -5665,14 +5604,6 @@ "node": ">=0.10.0" } }, - "node_modules/is-plain-object": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/is-plain-object/-/is-plain-object-5.0.0.tgz", - "integrity": "sha512-VRSzKkbMm5jMDoKLbltAkFQ5Qr7VDiTFGXxYFXXowVj387GeGNOCsOH6Msy00SGZ3Fp84b1Naa1psqgcCIEP5Q==", - "engines": { - "node": ">=0.10.0" - } - }, "node_modules/is-reference": { "version": "1.2.1", "resolved": "https://registry.npmjs.org/is-reference/-/is-reference-1.2.1.tgz", @@ -6039,11 +5970,6 @@ "node": ">=6" } }, - "node_modules/jsonc-parser": { - "version": "3.2.0", - "resolved": "https://registry.npmjs.org/jsonc-parser/-/jsonc-parser-3.2.0.tgz", - "integrity": "sha512-gfFQZrcTc8CnKXp6Y4/CBT3fTc0OVuDofpre4aEeEpSBPV5X5v4+Vmx+8snU7RLPrNHPKSgLxGo9YuQzz20o+w==" - }, "node_modules/jsonfile": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-4.0.0.tgz", @@ -6478,7 +6404,8 @@ "node_modules/lodash": { "version": "4.17.21", "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz", - "integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==" + "integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==", + "dev": true }, "node_modules/lodash-es": { "version": "4.17.21", @@ -6725,14 +6652,6 @@ "node": ">=8" } }, - "node_modules/lower-case": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/lower-case/-/lower-case-2.0.2.tgz", - "integrity": "sha512-7fm3l3NAF9WfN6W3JOmf5drwpVqX78JtoGJ3A6W0a6ZnldM41w2fV5D490psKFTpMds8TJse/eHLFFsNHHjHgg==", - "dependencies": { - "tslib": "^2.0.3" - } - }, "node_modules/lru-cache": { "version": "6.0.0", "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz", @@ -7351,15 +7270,6 @@ "integrity": "sha512-1nh45deeb5olNY7eX82BkPO7SSxR5SSYJiPTrTdFUVYwAl8CKMA5N9PjTYkHiRjisVcxcQ1HXdLhx2qxxJzLNQ==", "dev": true }, - "node_modules/no-case": { - "version": "3.0.4", - "resolved": "https://registry.npmjs.org/no-case/-/no-case-3.0.4.tgz", - "integrity": "sha512-fgAN3jGAh+RoxUGZHTSOLJIqUc2wmoBwGR4tbpNAKmmovFoWq0OdRkb0VkldReO2a2iBT/OEulG9XSUc10r3zg==", - "dependencies": { - "lower-case": "^2.0.2", - "tslib": "^2.0.3" - } - }, "node_modules/node-fetch": { "version": "2.6.7", "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.7.tgz", @@ -7771,15 +7681,6 @@ "node": ">=6" } }, - "node_modules/param-case": { - "version": "3.0.4", - "resolved": "https://registry.npmjs.org/param-case/-/param-case-3.0.4.tgz", - "integrity": "sha512-RXlj7zCYokReqWpOPH9oYivUzLYZ5vAPIfEmCTNViosC78F8F0H9y7T7gG2M39ymgutxF5gcFEsyZQSph9Bp3A==", - "dependencies": { - "dot-case": "^3.0.4", - "tslib": "^2.0.3" - } - }, "node_modules/parent-module": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/parent-module/-/parent-module-1.0.1.tgz", @@ -7837,15 +7738,6 @@ "node": ">= 0.8" } }, - "node_modules/pascal-case": { - "version": "3.1.2", - "resolved": "https://registry.npmjs.org/pascal-case/-/pascal-case-3.1.2.tgz", - "integrity": "sha512-uWlGT3YSnK9x3BQJaOdcZwrnV6hPpd8jFH1/ucpiLRPh/2zCVJKS19E4GvYHvaCcACn3foXZ0cLB9Wrx1KGe5g==", - "dependencies": { - "no-case": "^3.0.4", - "tslib": "^2.0.3" - } - }, "node_modules/patch-package": { "version": "8.0.0", "resolved": "https://registry.npmjs.org/patch-package/-/patch-package-8.0.0.tgz", @@ -8053,15 +7945,6 @@ "resolved": "https://registry.npmjs.org/path-browserify/-/path-browserify-1.0.1.tgz", "integrity": "sha512-b7uo2UCUOYZcnF/3ID0lulOJi/bafxa1xPe7ZPsammBSpjSWQkjNxlt635YGS2MiR9GjvuXCtz2emr3jbsz98g==" }, - "node_modules/path-case": { - "version": "3.0.4", - "resolved": "https://registry.npmjs.org/path-case/-/path-case-3.0.4.tgz", - "integrity": "sha512-qO4qCFjXqVTrcbPt/hQfhTQ+VhFsqNKOPtytgNKkKxSoEp3XPUQ8ObFuePylOIok5gjn69ry8XiULxCwot3Wfg==", - "dependencies": { - "dot-case": "^3.0.4", - "tslib": "^2.0.3" - } - }, "node_modules/path-exists": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-4.0.0.tgz", @@ -9125,16 +9008,6 @@ "semver": "bin/semver" } }, - "node_modules/sentence-case": { - "version": "3.0.4", - "resolved": "https://registry.npmjs.org/sentence-case/-/sentence-case-3.0.4.tgz", - "integrity": "sha512-8LS0JInaQMCRoQ7YUytAo/xUu5W2XnQxV2HI/6uM6U7CITS1RqPElr30V6uIqyMKM9lJGRVFy5/4CuzcixNYSg==", - "dependencies": { - "no-case": "^3.0.4", - "tslib": "^2.0.3", - "upper-case-first": "^2.0.2" - } - }, "node_modules/serialize-javascript": { "version": "6.0.0", "resolved": "https://registry.npmjs.org/serialize-javascript/-/serialize-javascript-6.0.0.tgz", @@ -9390,15 +9263,6 @@ "node": ">=8" } }, - "node_modules/snake-case": { - "version": "3.0.4", - "resolved": "https://registry.npmjs.org/snake-case/-/snake-case-3.0.4.tgz", - "integrity": "sha512-LAOh4z89bGQvl9pFfNF8V146i7o7/CqFPbqzYgP+yYzDIDeS9HaNFtXABamRW+AQzEVODcvE79ljJ+8a9YSdMg==", - "dependencies": { - "dot-case": "^3.0.4", - "tslib": "^2.0.3" - } - }, "node_modules/sort-object-keys": { "version": "1.1.3", "resolved": "https://registry.npmjs.org/sort-object-keys/-/sort-object-keys-1.1.3.tgz", @@ -9799,25 +9663,21 @@ }, "node_modules/style-dictionary": { "version": "4.0.0-prerelease.4", - "resolved": "https://registry.npmjs.org/style-dictionary/-/style-dictionary-4.0.0-prerelease.4.tgz", - "integrity": "sha512-1qS+BWreFMbj2s5Q4NTAThpQSXm1BymmNxBBklAg/pVazkhxeA62UemOBFbgzqvMlye5IPQaJxCLDQsoJ+i2DQ==", + "resolved": "git+ssh://git@github.com/amzn/style-dictionary.git#38d0e08d738e6d6f1e14c1b0bc80ceee0ec2a3b6", "hasInstallScript": true, + "license": "Apache-2.0", "dependencies": { "@bundled-es-modules/deepmerge": "^4.3.1", "@bundled-es-modules/glob": "^10.3.5", "@bundled-es-modules/memfs": "^4.2.3", "@bundled-es-modules/path-browserify": "^1.0.2", "chalk": "^5.3.0", - "change-case": "^4.1.2", + "change-case": "^5.3.0", "commander": "^8.3.0", - "fs-extra": "^10.0.0", - "is-plain-object": "^5.0.0", + "is-plain-obj": "^4.1.0", "json5": "^2.2.2", - "jsonc-parser": "^3.0.0", - "lodash": "^4.17.15", "lodash-es": "^4.17.21", - "tinycolor2": "^1.6.0", - "url": "^0.11.1" + "tinycolor2": "^1.6.0" }, "bin": { "style-dictionary": "bin/style-dictionary.js" @@ -9845,36 +9705,15 @@ "node": ">= 12" } }, - "node_modules/style-dictionary/node_modules/fs-extra": { - "version": "10.1.0", - "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-10.1.0.tgz", - "integrity": "sha512-oRXApq54ETRj4eMiFzGnHWGy+zo5raudjuxN0b8H7s/RU2oW0Wvsx9O0ACRN/kRq9E8Vu/ReskGB5o3ji+FzHQ==", - "dependencies": { - "graceful-fs": "^4.2.0", - "jsonfile": "^6.0.1", - "universalify": "^2.0.0" - }, + "node_modules/style-dictionary/node_modules/is-plain-obj": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/is-plain-obj/-/is-plain-obj-4.1.0.tgz", + "integrity": "sha512-+Pgi+vMuUNkJyExiMBt5IlFoMyKnr5zhJ4Uspz58WOhBF5QoIZkFyNHIbBAtHwzVAgk5RtndVNsDRN61/mmDqg==", "engines": { "node": ">=12" - } - }, - "node_modules/style-dictionary/node_modules/jsonfile": { - "version": "6.1.0", - "resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-6.1.0.tgz", - "integrity": "sha512-5dgndWOriYSm5cnYaJNhalLNDKOqFwyDB/rr1E9ZsGciGvKPs8R2xYGCacuf3z6K1YKDz182fd+fY3cn3pMqXQ==", - "dependencies": { - "universalify": "^2.0.0" }, - "optionalDependencies": { - "graceful-fs": "^4.1.6" - } - }, - "node_modules/style-dictionary/node_modules/universalify": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/universalify/-/universalify-2.0.0.tgz", - "integrity": "sha512-hAZsKq7Yy11Zu1DE0OzWjw7nnLZmJZYTDZZyEFHZdUhV8FkH5MCfoU1XMaxXovpyW5nq5scPqq0ZDP9Zyl04oQ==", - "engines": { - "node": ">= 10.0.0" + "funding": { + "url": "https://github.com/sponsors/sindresorhus" } }, "node_modules/supports-color": { @@ -10540,22 +10379,6 @@ "node": ">= 0.8" } }, - "node_modules/upper-case": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/upper-case/-/upper-case-2.0.2.tgz", - "integrity": "sha512-KgdgDGJt2TpuwBUIjgG6lzw2GWFRCW9Qkfkiv0DxqHHLYJHmtmdUIKcZd8rHgFSjopVTlw6ggzCm1b8MFQwikg==", - "dependencies": { - "tslib": "^2.0.3" - } - }, - "node_modules/upper-case-first": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/upper-case-first/-/upper-case-first-2.0.2.tgz", - "integrity": "sha512-514ppYHBaKwfJRK/pNC6c/OxfGa0obSnAl106u97Ed0I625Nin96KAjttZF6ZL3e1XLtphxnqrOi9iWgm+u+bg==", - "dependencies": { - "tslib": "^2.0.3" - } - }, "node_modules/uri-js": { "version": "4.4.1", "resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.4.1.tgz", diff --git a/package.json b/package.json index 73d53b5..24d7311 100644 --- a/package.json +++ b/package.json @@ -46,7 +46,7 @@ "expr-eval": "^2.0.2", "is-mergeable-object": "^1.1.1", "postcss-calc-ast-parser": "^0.1.4", - "style-dictionary": "4.0.0-prerelease.4" + "style-dictionary": "github:amzn/style-dictionary#types" }, "devDependencies": { "@changesets/cli": "^2.26.0", diff --git a/src/color-modifiers/transformColorModifiers.ts b/src/color-modifiers/transformColorModifiers.ts index ebb596b..8e3e666 100644 --- a/src/color-modifiers/transformColorModifiers.ts +++ b/src/color-modifiers/transformColorModifiers.ts @@ -1,4 +1,4 @@ -import { DesignToken } from 'style-dictionary'; +import type { DesignToken } from 'style-dictionary/types'; import { modifyColor } from './modifyColor.js'; import { ColorModifier } from '@tokens-studio/types'; import { ColorModifierOptions } from '../TransformOptions.js'; diff --git a/src/mapDescriptionToComment.ts b/src/mapDescriptionToComment.ts index 0e6e7bc..2ca3b55 100644 --- a/src/mapDescriptionToComment.ts +++ b/src/mapDescriptionToComment.ts @@ -1,4 +1,4 @@ -import { DesignToken } from 'style-dictionary'; +import type { DesignToken } from 'style-dictionary/types'; /** * Helper: Maps the token description to a style dictionary comment attribute - this will be picked up by some Style Dictionary diff --git a/src/parsers/add-font-styles.ts b/src/parsers/add-font-styles.ts index f5f59c8..9c54846 100644 --- a/src/parsers/add-font-styles.ts +++ b/src/parsers/add-font-styles.ts @@ -1,5 +1,5 @@ import { DeepKeyTokenMap, TokenTypographyValue } from '@tokens-studio/types'; -import { usesReference, resolveReferences } from 'style-dictionary/utils'; +import { usesReferences, resolveReferences } from 'style-dictionary/utils'; import { fontWeightReg, fontStyles } from '../transformFontWeights.js'; import { TransformOptions } from '../TransformOptions.js'; @@ -19,8 +19,8 @@ function recurse( continue; } let fontWeight = value.fontWeight; - if (usesReference(fontWeight)) { - fontWeight = resolveReferences(fontWeight, copy) ?? fontWeight; + if (usesReferences(fontWeight)) { + fontWeight = `${resolveReferences(fontWeight, copy) ?? fontWeight}`; } // cast because fontStyle is a prop we will add ourselves const tokenValue = value as TokenTypographyValue & { fontStyle: string }; diff --git a/src/parsers/expand-composites.ts b/src/parsers/expand-composites.ts index 40c2022..e9e1386 100644 --- a/src/parsers/expand-composites.ts +++ b/src/parsers/expand-composites.ts @@ -1,6 +1,6 @@ import type { DeepKeyTokenMap, SingleToken, TokenBoxshadowValue } from '@tokens-studio/types'; -import type { DesignTokens } from 'style-dictionary'; -import { usesReference, resolveReferences } from 'style-dictionary/utils'; +import type { DesignTokens } from 'style-dictionary/types'; +import { usesReferences, resolveReferences } from 'style-dictionary/utils'; import { ExpandFilter, TransformOptions, @@ -110,7 +110,7 @@ function recurse( ); if (expand) { // if token uses a reference, attempt to resolve it - if (typeof token.value === 'string' && usesReference(token.value)) { + if (typeof token.value === 'string' && usesReferences(token.value)) { token.value = resolveReferences(token.value, copy as DesignTokens) ?? token.value; // If every key of the result (object) is a number, the ref value is a multi-value, which means TokenBoxshadowValue[] if ( @@ -120,7 +120,7 @@ function recurse( token.value = (Object.values(token.value) as TokenBoxshadowValue[]).map(part => flattenValues(part), ); - } else if (!usesReference(token.value)) { + } else if (!usesReferences(token.value)) { token.value = flattenValues(token.value); } } diff --git a/src/registerTransforms.ts b/src/registerTransforms.ts index 52c5766..8378386 100644 --- a/src/registerTransforms.ts +++ b/src/registerTransforms.ts @@ -1,4 +1,5 @@ -import StyleDictionary, { DesignTokens } from 'style-dictionary'; +import type StyleDictionary from 'style-dictionary'; +import type { DesignTokens } from 'style-dictionary/types'; import { transformDimension } from './transformDimension.js'; import { transformHEXRGBaForCSS } from './css/transformHEXRGBa.js'; import { transformShadowForCSS } from './css/transformShadow.js'; @@ -36,7 +37,7 @@ export const transforms = [ * import style-dictionary as it depends on nodejs env */ export async function registerTransforms( - sd: StyleDictionary.Core, + sd: typeof StyleDictionary, transformOpts?: TransformOptions, ) { // Allow completely disabling the registering of this parser diff --git a/test/integration/custom-group.test.ts b/test/integration/custom-group.test.ts index aecfb2f..e22de03 100644 --- a/test/integration/custom-group.test.ts +++ b/test/integration/custom-group.test.ts @@ -25,7 +25,7 @@ const cfg = { }, }, }; -let dict: StyleDictionary.Core | undefined; +let dict: StyleDictionary | undefined; async function before() { cleanup(dict); @@ -35,7 +35,6 @@ async function before() { // remove 'px' appending transform to unitless values transforms: transforms.filter(transform => transform !== 'ts/size/px'), }); - // @ts-expect-error v4 does not have types aligned yet dict = new StyleDictionary(cfg); await dict?.buildAllPlatforms(); } diff --git a/test/integration/expand-composition.test.ts b/test/integration/expand-composition.test.ts index 837ffa9..0e750a7 100644 --- a/test/integration/expand-composition.test.ts +++ b/test/integration/expand-composition.test.ts @@ -1,5 +1,5 @@ +import type StyleDictionary from 'style-dictionary'; import { expect } from '@esm-bundle/chai'; -import StyleDictionary from 'style-dictionary'; import { promises } from 'fs'; import path from 'path'; import { cleanup, init } from './utils.js'; @@ -25,7 +25,7 @@ const cfg = { }, }; let transformOpts = {}; -let dict: StyleDictionary.Core | undefined; +let dict: StyleDictionary | undefined; async function before() { await cleanup(dict); diff --git a/test/integration/math-in-complex-values.test.ts b/test/integration/math-in-complex-values.test.ts index ca98516..0d4dd63 100644 --- a/test/integration/math-in-complex-values.test.ts +++ b/test/integration/math-in-complex-values.test.ts @@ -1,5 +1,5 @@ +import type StyleDictionary from 'style-dictionary'; import { expect } from '@esm-bundle/chai'; -import StyleDictionary from 'style-dictionary'; import { promises } from 'fs'; import path from 'path'; import { cleanup, init } from './utils.js'; @@ -24,8 +24,7 @@ const cfg = { }, }, }; - -let dict: StyleDictionary.Core | undefined; +let dict: StyleDictionary | undefined; describe('sd-transforms advanced tests', () => { beforeEach(async () => { diff --git a/test/integration/object-value-references.test.ts b/test/integration/object-value-references.test.ts index a8ddd5b..7a459a5 100644 --- a/test/integration/object-value-references.test.ts +++ b/test/integration/object-value-references.test.ts @@ -1,5 +1,5 @@ +import type StyleDictionary from 'style-dictionary'; import { expect } from '@esm-bundle/chai'; -import StyleDictionary from 'style-dictionary'; import { promises } from 'fs'; import path from 'path'; import { cleanup, init } from './utils.js'; @@ -25,7 +25,7 @@ const cfg = { }, }; -let dict: StyleDictionary.Core | undefined; +let dict: StyleDictionary | undefined; describe('typography references', () => { beforeEach(async () => { diff --git a/test/integration/output-references.test.ts b/test/integration/output-references.test.ts index 2e24e24..665a357 100644 --- a/test/integration/output-references.test.ts +++ b/test/integration/output-references.test.ts @@ -1,5 +1,5 @@ +import type StyleDictionary from 'style-dictionary'; import { expect } from '@esm-bundle/chai'; -import StyleDictionary from 'style-dictionary'; import { promises } from 'fs'; import path from 'path'; import { cleanup, init } from './utils.js'; @@ -28,7 +28,7 @@ const cfg = { }, }; -let dict: StyleDictionary.Core | undefined; +let dict: StyleDictionary | undefined; describe('outputReferences integration', () => { beforeEach(async () => { diff --git a/test/integration/sd-transforms.test.ts b/test/integration/sd-transforms.test.ts index b12646d..d324a9c 100644 --- a/test/integration/sd-transforms.test.ts +++ b/test/integration/sd-transforms.test.ts @@ -1,5 +1,5 @@ +import type StyleDictionary from 'style-dictionary'; import { expect } from '@esm-bundle/chai'; -import StyleDictionary from 'style-dictionary'; import { promises } from 'fs'; import path from 'path'; import { cleanup, init } from './utils.js'; @@ -25,7 +25,7 @@ const cfg = { }, }; -let dict: StyleDictionary.Core | undefined; +let dict: StyleDictionary | undefined; describe('sd-transforms smoke tests', () => { beforeEach(async () => { diff --git a/test/integration/utils.ts b/test/integration/utils.ts index e717298..d00f837 100644 --- a/test/integration/utils.ts +++ b/test/integration/utils.ts @@ -1,15 +1,15 @@ -import StyleDictionary, { Config } from 'style-dictionary'; +import type { Config } from 'style-dictionary/types'; +import StyleDictionary from 'style-dictionary'; import { registerTransforms } from '../../src/registerTransforms.js'; export async function init(cfg: Config, transformOpts = {}) { registerTransforms(StyleDictionary, transformOpts); - // @ts-expect-error v4 does not have types aligned yet const dict = new StyleDictionary(cfg); await dict.buildAllPlatforms(); return dict; } -export async function cleanup(dict?: StyleDictionary.Core) { +export async function cleanup(dict?: StyleDictionary) { // @ts-expect-error polluting dictionary it on purpose if (dict && !dict.cleaned) { await dict.cleanAllPlatforms(); diff --git a/test/suites/transform-suite.spec.ts b/test/suites/transform-suite.spec.ts index c75e5ae..27dbad4 100644 --- a/test/suites/transform-suite.spec.ts +++ b/test/suites/transform-suite.spec.ts @@ -1,5 +1,5 @@ import { expect } from '@esm-bundle/chai'; -import { DesignToken } from 'style-dictionary'; +import { DesignToken } from 'style-dictionary/types'; export function runTransformSuite(transformer: (value: unknown) => unknown, token?: DesignToken) { describe('Test Suite: Transforms', () => {