Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(typescript): migrating to typescript #1248

Closed
wants to merge 155 commits into from
Closed
Show file tree
Hide file tree
Changes from 154 commits
Commits
Show all changes
155 commits
Select commit Hold shift + click to select a range
4140de9
chore: formatting-only changes for JS/MD files and pkg json
jorenbroekema Sep 1, 2023
c5a9592
Merge pull request #1013 from amzn/formatting
jorenbroekema Sep 15, 2023
d043139
chore: formatting createPropertyFormatter test/code
jorenbroekema Sep 29, 2023
7d2310c
chore: add verify & release workflows (#1018)
jorenbroekema Oct 2, 2023
dcbe2fb
BREAKING: make style-dictionary ESM-only and browser-compatible (#1014)
jorenbroekema Oct 22, 2023
a45ac2f
chore: bump husky, change precommit hook, eslint scripts
jorenbroekema Oct 23, 2023
4d82091
Merge pull request #1028 from amzn/fix-husky-eslint
jorenbroekema Oct 23, 2023
e43b147
chore: customize commit message changesets workflow
jorenbroekema Oct 23, 2023
016ac6b
chore: release (prerelease)
github-actions[bot] Oct 23, 2023
dab4161
Merge pull request #1029 from amzn/changeset-release/v4
jorenbroekema Oct 23, 2023
24d41c3
fix: allow outputReferences to work on non-string values
jorenbroekema Oct 24, 2023
c1dd5ec
feat: commentStyle and commentPosition improvements for createPropert…
jorenbroekema Oct 24, 2023
ddafafe
Merge pull request #1030 from amzn/v3-fixes-port
jorenbroekema Oct 24, 2023
6fb81ad
fix: allow falsy token values for outputReferences, e.g. 0
jorenbroekema Oct 26, 2023
6495951
chore: fix grammar issue in docs
jorenbroekema Oct 26, 2023
39c0c97
Merge pull request #1035 from amzn/port-ref-falsy
jorenbroekema Oct 26, 2023
6c0ac72
chore: release (prerelease)
github-actions[bot] Oct 26, 2023
0d3531c
Merge pull request #1031 from amzn/changeset-release/v4
jorenbroekema Oct 26, 2023
1e19133
chore: fix unit tests
jorenbroekema Nov 9, 2023
984a71e
fix: logging to respect log level option, fix integration tests
jorenbroekema Nov 21, 2023
fd8c3b5
fix: add commentPosition to FormatHelpers.LineFormatting type interface
jorenbroekema Nov 23, 2023
a4542f4
chore: add changesets
jorenbroekema Nov 23, 2023
3a380a6
chore: remove es6 helpers and use actual ES6
jorenbroekema Nov 23, 2023
cedf8a0
feat: add preprocessors
jorenbroekema Nov 2, 2023
82e4975
Merge pull request #1043 from amzn/preprocessors
jorenbroekema Nov 28, 2023
e2493fb
Merge pull request #1048 from amzn/es6-remove
jorenbroekema Nov 28, 2023
269c077
Merge pull request #1045 from amzn/fix-tests
jorenbroekema Nov 28, 2023
2b62332
chore: release (prerelease)
github-actions[bot] Nov 28, 2023
efbfeee
Merge pull request #1050 from amzn/changeset-release/v4
jorenbroekema Nov 28, 2023
3591f50
chore: fix inject-version script
jorenbroekema Nov 28, 2023
122c8f6
feat: refactor reference utils and expose as standalone functions
jorenbroekema Dec 4, 2023
8d2f6d8
fix: make sure fs-node.js is published to npm
jorenbroekema Dec 5, 2023
30e319c
Merge pull request #1057 from amzn/files-fix
jorenbroekema Dec 5, 2023
c1f4ffd
chore: release (prerelease)
github-actions[bot] Dec 5, 2023
73443b0
Merge pull request #1058 from amzn/changeset-release/v4
jorenbroekema Dec 5, 2023
2ceb1fa
fix: bin path in pkg json
jorenbroekema Dec 5, 2023
044123c
fix: main type export default
jorenbroekema Dec 5, 2023
613023e
Merge pull request #1059 from amzn/fix-main-type
jorenbroekema Dec 5, 2023
90d2cfc
Merge branch 'v4' into utils
jorenbroekema Dec 5, 2023
00956de
Merge pull request #1056 from amzn/utils
jorenbroekema Dec 5, 2023
1a6d0b5
chore: release (prerelease)
github-actions[bot] Dec 5, 2023
5b9bcbf
Merge pull request #1060 from amzn/changeset-release/v4
jorenbroekema Dec 5, 2023
f47f308
Update docs (#1051)
jorenbroekema Dec 14, 2023
6cc7f31
feat: make ref utils consistent API, apply strict typing (breaking)
jorenbroekema Dec 23, 2023
e859036
chore: upgrade glob to latest, set posix:true, verify & fix Windows (…
jorenbroekema Dec 23, 2023
cc56249
chore: release (prerelease) (#1072)
github-actions[bot] Dec 23, 2023
77e4d44
chore: fix glob usage in script (#1074)
jorenbroekema Dec 23, 2023
78daa4a
chore: fix npm script name
jorenbroekema Dec 23, 2023
1dd828c
fix: glob dependency (#1075)
jorenbroekema Dec 23, 2023
5443c37
chore: release (prerelease) (#1076)
github-actions[bot] Dec 23, 2023
0410295
feat: improve and test ref utils error handling (#1077)
jorenbroekema Jan 8, 2024
0f5b1da
chore: release (prerelease) (#1078)
github-actions[bot] Jan 8, 2024
59f3eb0
feat: expose flattenTokens utility (#1079)
jorenbroekema Jan 11, 2024
39547fb
fix: resolved filepath, async parser await (#1083)
jorenbroekema Jan 15, 2024
5fdba20
chore: release (prerelease) (#1080)
github-actions[bot] Jan 15, 2024
3138313
feat: allow deferring transitive transforms from the transformer (#1069)
jorenbroekema Jan 22, 2024
294fd0e
feat: support w3c special properties (#1081)
jorenbroekema Jan 23, 2024
7a1e446
chore: release (prerelease) (#1086)
github-actions[bot] Jan 23, 2024
0c1a36f
feat: expose typeW3CDelegate util function (#1087)
jorenbroekema Jan 25, 2024
0e0dd46
chore: release (prerelease) (#1089)
github-actions[bot] Jan 25, 2024
cd48aac
fix: only run postinstall scripts in non- prod-mode (#1091)
jorenbroekema Jan 26, 2024
6857825
chore: release (prerelease) (#1092)
github-actions[bot] Jan 26, 2024
c2cbd1b
fix: publish missing script file to npm (#1093)
jorenbroekema Jan 26, 2024
290cf44
chore: release (prerelease) (#1094)
github-actions[bot] Jan 26, 2024
24584b4
fix: dev scripts only run in sd cwd (#1095)
jorenbroekema Jan 26, 2024
b3f5d86
chore: release (prerelease) (#1096)
github-actions[bot] Jan 26, 2024
cd9f484
fix: escape double quotes for ts outputStringLiterals (#1097)
andnorda Feb 8, 2024
606af51
W3C Syntax refactor to allow value & type token names/groups (#1100)
jorenbroekema Feb 9, 2024
5194116
chore: release (prerelease) (#1101)
github-actions[bot] Feb 9, 2024
502dbd1
feat: support async for all hooks (#1106)
jorenbroekema Feb 23, 2024
d5d7a8e
chore: release (prerelease) (#1108)
github-actions[bot] Feb 23, 2024
d008c67
fix: dtcg option not passed in some places (#1116)
jorenbroekema Mar 11, 2024
72f020d
fix: outputReferenceFallbacks for css/variables formatter (#1113)
tkgroot Mar 11, 2024
f3c0df2
chore: release (prerelease) (#1117)
github-actions[bot] Mar 11, 2024
63681a6
fix: missing type imports (#1118)
jorenbroekema Mar 11, 2024
e4f4300
chore: typo
jorenbroekema Mar 11, 2024
ced28c7
chore: release (prerelease) (#1119)
github-actions[bot] Mar 11, 2024
4c0ac0c
chore: fix small type problem
jorenbroekema Mar 11, 2024
738686b
feat: allow transforms to be added on top of transformGroup (#1120)
jorenbroekema Mar 12, 2024
aa49a5f
chore: release (prerelease) (#1121)
github-actions[bot] Mar 12, 2024
7d0423d
chore: fix ref docs mistakes, add DTCG option (#1122)
jorenbroekema Mar 14, 2024
bcb5ef3
feat: remove reliance on CTI, add token type (#1123)
jorenbroekema Mar 19, 2024
79bb201
feat: redesign logging (#1125)
jorenbroekema Mar 19, 2024
8e297d6
fix: outputReferences for DTCG spec tokens (#1127)
jorenbroekema Mar 19, 2024
220bc88
chore: release (prerelease) (#1126)
github-actions[bot] Mar 19, 2024
aff6646
feat: allow passing Filesystem volumes to SD instance / extend method…
jorenbroekema Mar 25, 2024
236c027
chore: update docs volumes (#1130)
jorenbroekema Mar 25, 2024
5f2f8c5
chore: release (prerelease) (#1129)
github-actions[bot] Mar 25, 2024
77ae35f
fix: absolute paths in Node env (#1134)
jorenbroekema Mar 26, 2024
8b6fff3
feat: add warnings disabled option, fix logging issues (#1136)
jorenbroekema Mar 26, 2024
be346a8
chore: release (prerelease) (#1131)
github-actions[bot] Mar 26, 2024
daa78e1
fix(types): added missing type exports
lukasoppermann Mar 26, 2024
3537e8d
chore: release (prerelease) (#1138)
github-actions[bot] Mar 26, 2024
f8c40f7
fix(types): add missing type keyword for type export from index.d.ts …
lukasoppermann Mar 27, 2024
de2c394
chore: release (prerelease) (#1140)
github-actions[bot] Mar 27, 2024
ee08a7e
Revamp docs (#1141)
jorenbroekema Apr 3, 2024
90095a6
feat: allow outputReferences function, publish filter util for it (#1…
jorenbroekema Apr 4, 2024
5e167de
feat: move formatHelpers to utils entrypoint (breaking) (#1147)
jorenbroekema Apr 4, 2024
27d0622
chore: release (prerelease) (#1146)
github-actions[bot] Apr 5, 2024
0b47321
chore: add migration docs (#1148)
jorenbroekema Apr 9, 2024
6254532
Some small docs fixes, and removing docsify (#1149)
jorenbroekema Apr 9, 2024
47face0
fix: change merging behavior for tokens to override (#1151)
jorenbroekema Apr 11, 2024
0b81a08
fix: asset url handling in CSS format (#1153)
jorenbroekema Apr 11, 2024
2da5130
feat: add outputReferencesTransformed utility function (#1154)
jorenbroekema Apr 12, 2024
50a69dc
chore: release (prerelease) (#1152)
github-actions[bot] Apr 12, 2024
061c67e
fix: outputReferencesTransformed util handling object-value tokens, u…
jorenbroekema Apr 15, 2024
51efc17
chore: fix some docs links (#1159)
jorenbroekema Apr 15, 2024
6cfce97
fix: logging to be in sequence per platform (#1161)
jorenbroekema Apr 16, 2024
3485467
fix: get rid of lodash, refactor templates to ES6 (#1160)
jorenbroekema Apr 16, 2024
76d5ab4
chore: release (prerelease) (#1157)
github-actions[bot] Apr 16, 2024
2f80da2
Format options improvements (#1165)
jorenbroekema Apr 19, 2024
7b82150
feat: turn off generated timestamp by default in file headers (#1174)
jorenbroekema May 1, 2024
e83886c
Expand composites (#1169)
jorenbroekema May 1, 2024
f2ed88b
Align Hooks APIs (#1185)
jorenbroekema May 6, 2024
f6e7177
chore: release (prerelease) (#1167)
github-actions[bot] May 9, 2024
c815a20
chore: fix docs typo (#1189)
jorenbroekema May 9, 2024
a5bafac
fix: color filter now skips invalid colors (#995) (#1188)
Rykus0 May 9, 2024
17582c9
chore: docs mentions extend twice, duplicate (#1192)
jorenbroekema May 9, 2024
4225d78
feat: add object-value CSS shorthand transforms (#1194)
jorenbroekema May 14, 2024
a140902
chore: release (prerelease) (#1190)
github-actions[bot] May 14, 2024
96439c7
chore: improve sd-playground, eject feature (#1196)
jorenbroekema May 15, 2024
1a749ee
Examples (#1204)
jorenbroekema May 16, 2024
0972b26
feat: pass options to fileheaders and filters, add unfilteredAllToken…
jorenbroekema May 17, 2024
4ec34fd
fix: pass options to transforms filters, live demo main page (#1208)
jorenbroekema May 17, 2024
646b8f8
chore: allow preselecting playground file (#1209)
jorenbroekema May 17, 2024
cb94554
fix: typeDtcgDelegate at any position, size/rem apply to unitless va…
jorenbroekema May 17, 2024
9d61dcd
chore: release (prerelease) (#1207)
github-actions[bot] May 17, 2024
7418c97
feat: add convert to DTCG spec utilities, file converter docs site (#…
jorenbroekema May 23, 2024
aeca085
chore: release (prerelease) (#1213)
github-actions[bot] May 23, 2024
5763a77
chore: version inject for sd-playground on build (#1216)
jorenbroekema May 25, 2024
4867290
docs(DTCG): Update DTCG docs with latest link and fix full name (#1215)
kaelig May 25, 2024
c708325
chore: move `@zip.js/zip.js` from `devDependencies` to `dependencies …
daanvosdewael May 27, 2024
b1eeb4d
chore: add mermaid integration to docs, create architecture (#1221)
jorenbroekema May 27, 2024
a2ecdf0
chore: release (prerelease) (#1220)
github-actions[bot] May 29, 2024
9ed8594
feat: add formatPlatform/formatAllPlatforms methods (#1222)
jorenbroekema May 30, 2024
2335f13
fix: allow register hooks override existing (#1223)
jorenbroekema May 30, 2024
3f09277
feat: pass dictionary options to preprocessors (#1224)
jorenbroekema May 30, 2024
6e226aa
feat: pass ref path in getReferences util output (#1226)
jorenbroekema May 30, 2024
af5cc94
chore: add missing changeset for SD format platform methods (#1227)
jorenbroekema May 30, 2024
04c3377
chore: release (prerelease) (#1225)
github-actions[bot] May 30, 2024
261a2cb
timingFunction and fontFamily props, optional border props (#1229)
jorenbroekema Jun 4, 2024
6560456
chore: release (prerelease) (#1230)
github-actions[bot] Jun 4, 2024
ba03ee9
fix: expand on platform level to adjust path prop (#1231)
jorenbroekema Jun 4, 2024
344cf66
chore: release (prerelease) (#1232)
github-actions[bot] Jun 4, 2024
c06661d
fix: fix CLI, update basic example, fix android templates DTCG (#1235)
jorenbroekema Jun 6, 2024
1b8bdff
chore: release (prerelease) (#1236)
github-actions[bot] Jun 11, 2024
39f0220
feat: allow not throwing on broken refs (#1240)
jorenbroekema Jun 15, 2024
fdb308a
chore: release (prerelease) (#1242)
github-actions[bot] Jun 16, 2024
8450a45
feat: recursively expand nested composite tokens (#1244)
Imable Jun 17, 2024
17985e5
chore: release (prerelease) (#1245)
github-actions[bot] Jun 17, 2024
c73ec7b
chore(typescript): upgrading to typescript
dbanksdesign Jun 18, 2024
d82a3fc
chore: fixing tests
dbanksdesign Jun 19, 2024
a099636
chore: updating scripts
dbanksdesign Jun 19, 2024
d64b8fe
chore: fix fs
dbanksdesign Jun 19, 2024
4b50ddc
chore: fixes
dbanksdesign Jun 19, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
3 changes: 0 additions & 3 deletions .babelrc

This file was deleted.

8 changes: 8 additions & 0 deletions .changeset/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Changesets

Hello and welcome! This folder has been automatically generated by `@changesets/cli`, a build tool that works
with multi-package repos, or single-package repos to help you version and publish your code. You can
find the full documentation for it [in our repository](https://github.com/changesets/changesets)

We have a quick list of common questions to get you started engaging with this project in
[our documentation](https://github.com/changesets/changesets/blob/main/docs/common-questions.md)
20 changes: 20 additions & 0 deletions .changeset/angry-balloons-yell.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
---
'style-dictionary': major
---

BREAKING:
- `usesReference` util function is now `usesReferences` to be consistent plural form like the other reference util functions.
- `getReferences` first and second parameters have been swapped to be consistent with `resolveReferences`, so value first, then the full token object (instead of the entire dictionary instance).
- `getReferences` accepts a third options parameter which can be used to set reference Regex options as well as an unfilteredTokens object which can be used as a fallback when references are made to tokens that have been filtered out. There will be warnings logged for this.
- `format.formatter` removed old function signature of `(dictionary, platform, file)` in favor of `({ dictionary, platform, options, file })`.
- Types changes:

- Style Dictionary is entirely strictly typed now, and there will be `.d.ts` files published next to every file, this means that if you import from one of Style Dictionary's entrypoints, you automatically get the types implicitly with it. This is a big win for people using TypeScript, as the majority of the codebase now has much better types, with much fewer `any`s.
- There is no more hand-written Style Dictionary module `index.d.ts` anymore that exposes all type interfaces on itself. This means that you can no longer grab types that aren't members of the Style Dictionary class directly from the default export of the main entrypoint. External types such as `Parser`, `Transform`, `DesignTokens`, etc. can be imported from the newly added types entrypoint:

```ts
import type { DesignTokens, Transform, Parser } from 'style-dictionary/types';
```

Please raise an issue if you find anything missing or suddenly broken.
- `Matcher`, `Transformer`, `Formatter`, etc. are still available, although no longer directly but rather as properties on their parents, so `Filter['matcher']`, `Transform['transformer']`, `Format['formatter']`
12 changes: 12 additions & 0 deletions .changeset/big-worms-collect-2.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
---
'style-dictionary': minor
---

FileSystem that is used by Style Dictionary can now be customized:

```js
import { setFs } from 'style-dictionary/fs';
setFs(myFileSystemShim);
```

By default, it uses an in-memory filesystem shim `@bundled-es-modules/memfs` in browser context, `node:fs` built-in module in Node context.
10 changes: 10 additions & 0 deletions .changeset/big-worms-collect.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
---
'style-dictionary': major
---

- The project has been fully converted to [ESM format](https://nodejs.org/api/esm.html), which is also the format that the browser uses.
For users, this means you'll have to either use Style Dictionary in ESM JavaScript code, or dynamically import it into your CommonJS code.
- `StyleDictionary.extend()` method is now asynchronous, which means it returns `Promise<StyleDictionary.Core>` instead of `StyleDictionary.Core`.
- `allProperties` / `properties` was deprecated in v3, and is now removed from `StyleDictionary.Core`, use `allTokens` and `tokens` instead.
- Templates and the method `registerTemplate` were deprecated in v3, now removed. Use Formats instead.
- The package now uses [package entrypoints](https://nodejs.org/api/packages.html), which means that what is importable from the package is locked down to just the specified entrypoints: `style-dictionary` & `style-dictionary/fs`. If more is needed, please raise an issue explaining which file you were importing and why you need it to be public API.
11 changes: 11 additions & 0 deletions .changeset/bright-timers-shout.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
---
'style-dictionary': patch
---

Allow overriding CSS formatting with commentStyle and commentPosition props.
For commentStyle, options are 'short' or 'long'.
For commentPosition, options are 'above' or 'inline'.

We also ensure that the right defaults are picked for CSS, SASS/SCSS, Stylus and Less.

This also contains a fix for ensuring that multi-line comments are automatically put "above" rather than "inline".
5 changes: 5 additions & 0 deletions .changeset/chilled-oranges-drive.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'style-dictionary': minor
---

Fix some inconsistencies in some of the templates, usually with regards to spaces/newlines
23 changes: 23 additions & 0 deletions .changeset/chilly-numbers-work.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
---
'style-dictionary': minor
---

Allow not throwing fatal errors on broken token references/aliases, but `console.error` instead.

You can also configure this on global/platform `log` property:

```json
{
"log": {
"errors": {
"brokenReferences": "console"
}
}
}
```

This setting defaults to `"error"` when not configured.

`resolveReferences` and `getReferences` `warnImmediately` option is set to `true` which causes an error to be thrown/warned immediately by default, which can be configured to `false` if you know those utils are running in the transform/format hooks respectively, where the errors are collected and grouped, then thrown as 1 error/warning instead of multiple.

Some minor grammatical improvements to some of the error logs were also done.
27 changes: 27 additions & 0 deletions .changeset/chilly-worms-vanish.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
---
'style-dictionary': patch
---

All formats using `createPropertyFormatter` or `formattedVariables` helpers now respect the `file.options.formatting` option passed by users to customize formatting.

Example:

```js
{
platforms: {
css: {
transformGroup: 'css',
buildPath,
files: [
{
destination: 'variables.css',
format: 'css/variables',
options: {
formatting: { indentation: ' ' },
},
},
]
}
}
}
```
11 changes: 11 additions & 0 deletions .changeset/config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"$schema": "https://unpkg.com/@changesets/[email protected]/schema.json",
"changelog": "@changesets/cli/changelog",
"commit": false,
"fixed": [],
"linked": [],
"access": "public",
"baseBranch": "v4",
"updateInternalDependencies": "patch",
"ignore": []
}
5 changes: 5 additions & 0 deletions .changeset/cuddly-cheetahs-drum.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'style-dictionary': minor
---

Rename `typeW3CDelegate` utility function to `typeDtcgDelegate`, as using "W3C" is highly discouraged when the standard isn't a W3C standard yet.
5 changes: 5 additions & 0 deletions .changeset/curvy-geckos-exist.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'style-dictionary': patch
---

Conditionally only run dev scripts when CWD is style-dictionary, so our consumers don't run it by accident
5 changes: 5 additions & 0 deletions .changeset/eight-items-cheat.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'style-dictionary': patch
---

Patch StyleDictionary main type file to export default instead of "export =" which does not work in ESM.
5 changes: 5 additions & 0 deletions .changeset/eleven-llamas-raise.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'style-dictionary': patch
---

Fix typeDtcgDelegate util $type property position to be allowed anywhere in the object, not just at the top.
5 changes: 5 additions & 0 deletions .changeset/famous-falcons-join.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'style-dictionary': patch
---

Fix outputReferences for DTCG spec tokens, by using token.original.$value instead of token.original.value.
15 changes: 15 additions & 0 deletions .changeset/famous-suns-rule.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
---
'style-dictionary': minor
---

Added the following transforms for CSS, and added them to the `scss`, `css` and `less` transformGroups:

- `fontFamily/css` -> wraps font names with spaces in `'` quotes
- `cubicBezier/css` -> array value, put inside `cubic-bezier()` CSS function
- `strokeStyle/css/shorthand` -> object value, transform to CSS shorthand
- `border/css/shorthand` -> object value, transform to CSS shorthand
- `typography/css/shorthand` -> object value, transform to CSS shorthand
- `transition/css/shorthand` -> object value, transform to CSS shorthand
- `shadow/css/shorthand` -> object value (or array of objects), transform to CSS shorthand

The main intention here is to ensure that Style Dictionary is compliant with [DTCG draft specification](https://design-tokens.github.io/community-group/format/) out of the box with regards to exporting to CSS, where object-value tokens are not supported without transforming them to shorthands (or expanding them, which is a different feature that was added in `4.0.0-prerelease.27`).
6 changes: 6 additions & 0 deletions .changeset/fifty-dragons-heal.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
'style-dictionary': minor
---

Preprocessors are a new feature added to style-dictionary, which allows you to do any type of processing of the token dictionary **after** parsing, **before** resolving and transforming.
See [preprocessor docs](https://github.com/amzn/style-dictionary/tree/v4/docs/preprocessors.md) for more information.
5 changes: 5 additions & 0 deletions .changeset/fifty-hats-study.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'style-dictionary': patch
---

Expose flattenTokens utility.
36 changes: 36 additions & 0 deletions .changeset/five-crews-hear.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
---
'style-dictionary': major
---

BREAKING: File headers, when registered, are put inside the `hooks.fileHeaders` property now, as opposed to `fileHeader`.
Note the change from singular to plural form here.

Before:

```js
export default {
fileHeader: {
foo: (defaultMessages = []) => [
'Ola, planet!',
...defaultMessages,
'Hello, World!'
],
},
}
```

After:

```js
export default {
hooks: {
fileHeaders: {
foo: (defaultMessages = []) => [
'Ola, planet!',
...defaultMessages,
'Hello, World!'
],
},
},
}
```
5 changes: 5 additions & 0 deletions .changeset/five-kangaroos-destroy.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'style-dictionary': minor
---

Re-add and update example basic, fix copySync command in CLI, fix android templates to use $type for DTCG tokens.
5 changes: 5 additions & 0 deletions .changeset/four-fireants-try.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'style-dictionary': patch
---

Pass outputReferenceFallbacks option to the relevant utilities, so the option actually works.
5 changes: 5 additions & 0 deletions .changeset/fuzzy-gorillas-prove.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'style-dictionary': minor
---

'size/rem' transform to not transform tokens that already have a unit, such as `"4px"`, this should not be transformed to `"4rem"`.
5 changes: 5 additions & 0 deletions .changeset/gold-countries-own.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'style-dictionary': patch
---

Fix parsers async support, use resolved filePath instead of raw.
5 changes: 5 additions & 0 deletions .changeset/gorgeous-lamps-chew.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'style-dictionary': minor
---

options.log to be respected in all error logging, including platform specific logs.
5 changes: 5 additions & 0 deletions .changeset/great-trainers-shop.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'style-dictionary': patch
---

Allow transitive transforms to return undefined, by doing this the transformer can mark itself as "deferred" for that specific token. This is useful when references in properties other than "value" need to be resolved first.
5 changes: 5 additions & 0 deletions .changeset/green-wolves-heal.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'style-dictionary': patch
---

Escape double quotes for ts outputStringLiterals
5 changes: 5 additions & 0 deletions .changeset/grumpy-peaches-flow.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'style-dictionary': patch
---

Fix small issue in type DTCG delegate utility type tracking.
43 changes: 43 additions & 0 deletions .changeset/happy-glasses-teach.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
---
'style-dictionary': major
---

BREAKING: Logging has been redesigned a fair bit and is more configurable now.

Before:

```json
{
"log": "error" // 'error' | 'warn' -> 'warn' is the default value
}
```

After:

```json
{
"log": {
"warnings": "error", // 'error' | 'warn' -> 'warn' is the default value
"verbosity": "verbose" // 'default' | 'verbose' | 'silent' -> 'default' is the default value
}
}
```

Log is now and object and the old "log" option is now "warnings".

This configures whether the following five warnings will be thrown as errors instead of being logged as warnings:

- Token value collisions (in the source)
- Token name collisions (when exporting)
- Missing "undo" function for Actions
- File not created because no tokens found, or all of them filtered out
- Broken references in file when using outputReferences, but referring to a token that's been filtered out

Verbosity configures whether the following warnings/errors should display in a verbose manner:

- Token collisions of both types (value & name)
- Broken references due to outputReferences & filters
- Token reference errors

And it also configures whether success/neutral logs should be logged at all.
Using "silent" (or --silent in the CLI) means no logs are shown apart from fatal errors.
18 changes: 18 additions & 0 deletions .changeset/happy-numbers-grab.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
---
'style-dictionary': minor
---

Expose a new utility called resolveReferences which takes a value containing references, the dictionary object, and resolves the value's references for you.

```js
import StyleDictionary from 'style-dictionary';
import { resolveReferences } from 'style-dictionary/utils';

const sd = new StyleDictionary({ tokens: {
foo: { value: 'foo' },
bar: { value: '{foo}' },
qux: { value: '{bar}' },
}});

console.log(resolveReferences(sd.tokens.qux.value, sd.tokens)); // 'foo'
```
5 changes: 5 additions & 0 deletions .changeset/happy-vans-end.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'style-dictionary': patch
---

Fix a couple of spots where DTCG option wasn't properly taken into account, more tests added.
5 changes: 5 additions & 0 deletions .changeset/hip-candles-flow.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'style-dictionary': patch
---

Fix logging to be ordered by platform when building or cleaning platforms. This now happens in parallel, resulting in the logs being ordered randomly which was a small regression to the logging experience.
5 changes: 5 additions & 0 deletions .changeset/honest-toes-wink.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'style-dictionary': patch
---

Allow falsy token values for outputReferences, e.g. `0`.
5 changes: 5 additions & 0 deletions .changeset/kind-rats-invite.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'style-dictionary': minor
---

Improve and test the error handling of standalone usage of reference utilities.
Loading