Releases: amzn/style-dictionary
v4.3.2
v4.3.1
v4.3.0
Minor Changes
- 302b466: Introduce a new entrypoint:
style-dictionary/enums
for most of the library's hard-coded string values. Most of these are built-in hooks names. This provides better type-safety for consumers as well as various maintainability related benefits for this library. See documentation for more info. - 5aad797: Add tailwind preset example, remove unused .editorconfig file
- bd8be17: Add support for native .TS token & config file processing.
- 209085d: Add
tokenMap
properties to Dictionary, which is a JavaScript Map structure of the tokens, which makes it easy to iterate as well as access tokens. Also addconvertTokenData
utility that allows to seemlessly convert between Map, Object or Array of tokens, and deprecate theflattenTokens
utility in favor of that one.
Patch Changes
- 2966cfd: handle DTCG-format tokens in typescript/es6-declarations formatter
- 4a7bca7: add accessControl field to Android Compose template
- f694f67: Fix Prettier imports, see https://prettier.io/docs/en/api#custom-parser-api-removed for more info.
- fd8cdb4: handle DTCG-format tokens in javascript/es6 formatter
- 6a6a409: Move prettier to dependencies since style-dictionary isn't really a prettier plugin and a direct dependency seems more accurate here.
- 8a9cfa0: Fix
outputReferencesTransformed
util, would returntrue
for tokens which original values were not strings. - 7a661bb: Fix font-style and font-weight logic for fonts.css.template.js
v4.2.0
Minor Changes
- 0fcf229: Add a new built-in format javascript/esm that outputs an ES module JS default export.
- d7b5836: Mark javascript/esm as nested, use Prettier on all JavaScript/TypeScript formats, use 3.x.x peerDependency so the user's installation is used when possible.
- 4bf68a3: Apply stripMeta from "json" format to the new "javascript/esm" as well.
- 8f1b4f0: Add new utility in
style-dictionary/utils
->stripMeta
for stripping metadata from tokens.
This utility is used now as an opt-in for the built-in'json'
format by usingoptions.stripMeta
, which if set totrue
will strip Style Dictionary meta props.
You can specifykeep
/strip
(allow/blocklist) for granular control about which properties to keep or strip.
Patch Changes
- 5e3a5af: Update .d.ts/js files type imports to use correct extensions rather than extensionless. This fixes some incompatibilities with latest TypeScript "NodeNext" moduleResolution.
v4.1.4
v4.1.3
Patch Changes
- 9376247: Make
defaultMessage
param in FileHeader type optional. - 43ccb42: (#1305): fix reference sorting in
sortByReference
function for DTCG token format, ensuring token references are declared after their targets - 26728b9: Fix
filterTokens
utility to deal with random metadata properties throughout token groups, without throwing errors.
v4.1.2
v4.1.1
v4.1.0
Minor Changes
-
ccf27b7: Prevent duplicate redundant calls to StyleDictionary class methods by caching platform specific config & tokens results.
Added reusable methods:
getPlatformTokens()
-> grabs thetokens
/allTokens
(new!exportPlatform
does not return this) for a specific platform, after running platform specific preprocessors and transforms. This replaces the oldexportPlatform
method which is now deprecated and will be removed in v5.getPlatformConfig()
-> grabs the processed/transformedPlatformConfig
for a specific platform, replaces the now deprecatedgetPlatform
method which will be removed in v5.
The reasons for deprecating those methods and replacing them with new ones is to reduce method ambiguity and make them more pure.
Add new options object to methods:
getPlatformTokens
getPlatformConfig
exportPlatform
(deprecated, see above)getPlatform
(deprecated, see above)formatPlatform
formatAllPlatforms
buildPlatform
buildAllPlatforms
cleanPlatform
cleanAllPlatforms
with property
cache
, which if set tofalse
, will disable this caching of generating the platform specific config / tokens, e.g.:await sd.exportPlatform('css', { cache: false }); await sd.buildAllPlatforms('css', { cache: false });
Expectation is that this is usually not useful for majority of users, unless for example you're testing multiple runs of StyleDictionary while changing tokens or platform configs in between those runs.
Patch Changes
-
2ec9a44:
size/rem
transform to leave 0 (string or number) values as is, since 0 doesn't need a unit. -
f317430: Added link to logging documentation inside all of the warnings and errors that refer to verbosity.
-
6275983: Respect
formatting
options in scss map-deep/map-flat formats, those that make sense:commentPosition
commentStyle
indentation
Also export a new type interface
FormattingOverrides
, which is a limited version ofFormattingOptions
.
These contain the formatting options that can be overridden by users, whereas the full version is meant for the format helper utilities such ascreatePropertyFormatter
/formattedVariables
.
v4.0.1
Patch Changes
- e6cbf73: Fix type information for Config.parser
- e8aea2f: Fix transitive color transform advanced example, migrate chroma-js to colorjs.io
- 7afcffd: Fix bugs with expand tokens where they would run before instead of after user-configured preprocessors, and would fatally error on broken references. Broken refs should be tolerated at the expand stage, and errors will be thrown after preprocessor lifecycle if the refs are still broken at that point.
- 922b6aa: Update memfs esm-fork dependency to allow named import Volume.
- 61b6984: Fix 'filePath' missing from falsy token values
- 3ae67e3: Upgrade memfs esm fork to publish types and bumping stream to fix unclear licensing issue with transitive dependency.