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

Update dependency style-dictionary to v4.0.0-prerelease.25 #485

Closed
wants to merge 1 commit into from

Conversation

renovate[bot]
Copy link
Contributor

@renovate renovate bot commented Apr 11, 2024

Mend Renovate

This PR contains the following updates:

Package Change Age Adoption Passing Confidence
style-dictionary 4.0.0-prerelease.15 -> 4.0.0-prerelease.25 age adoption passing confidence

Release Notes

amzn/style-dictionary (style-dictionary)

v4.0.0-prerelease.25

Compare Source

Major Changes
  • 0b81a08: BREAKING: no longer wraps tokens of type asset in double quotes. Rather, we added a transform asset/url that will wrap such tokens inside url("") statements, this transform is applied to transformGroups scss, css and less.
Minor Changes
  • 2da5130: Added outputReferencesTransformed utility function to pass into outputReferences option, which will not output references for values that have been transitively transformed.
Patch Changes
  • 47face0: Token merging behavior changed so that upon token collisions, metadata props aren't accidentally merged together.

v4.0.0-prerelease.24

Compare Source

Major Changes
  • 5e167de: BREAKING: moved formatHelpers away from the StyleDictionary class and export them in 'style-dictionary/utils' entrypoint instead.

    Before

    import StyleDictionary from 'style-dictionary';
    
    const { fileHeader, formattedVariables } = StyleDictionary.formatHelpers;

    After

    import { fileHeader, formattedVariables } from 'style-dictionary/utils';
  • 90095a6: BREAKING: Allow specifying a function for outputReferences, conditionally outputting a ref or not per token. Also exposes outputReferencesFilter utility function which will determine whether a token should be outputting refs based on whether those referenced tokens were filtered out or not.

    If you are maintaining a custom format that allows outputReferences option, you'll need to take into account that it can be a function, and pass the correct options to it.

    Before:

    StyleDictionary.registerFormat({
      name: 'custom/es6',
      formatter: async (dictionary) => {
        const { allTokens, options, file } = dictionary;
        const { usesDtcg } = options;
    
        const compileTokenValue = (token) => {
          let value = usesDtcg ? token.$value : token.value;
          const originalValue = usesDtcg ? token.original.$value : token.original.value;
    
          // Look here 👇
          const shouldOutputRefs = outputReferences && usesReferences(originalValue);
    
          if (shouldOutputRefs) {
            // ... your code for putting back the reference in the output
            value = ...
          }
          return value;
        }
        return `${allTokens.reduce((acc, token) => `${acc}export const ${token.name} = ${compileTokenValue(token)};\n`, '')}`;
      },
    });

    After

    StyleDictionary.registerFormat({
      name: 'custom/es6',
      formatter: async (dictionary) => {
        const { allTokens, options, file } = dictionary;
        const { usesDtcg } = options;
    
        const compileTokenValue = (token) => {
          let value = usesDtcg ? token.$value : token.value;
          const originalValue = usesDtcg ? token.original.$value : token.original.value;
    
          // Look here 👇
          const shouldOutputRef =
            usesReferences(original) &&
            (typeof options.outputReferences === 'function'
              ? outputReferences(token, { dictionary, usesDtcg })
              : options.outputReferences);
    
          if (shouldOutputRefs) {
            // ... your code for putting back the reference in the output
            value = ...
          }
          return value;
        }
        return `${allTokens.reduce((acc, token) => `${acc}export const ${token.name} = ${compileTokenValue(token)};\n`, '')}`;
      },
    });

v4.0.0-prerelease.23

Compare Source

Patch Changes
  • f8c40f7: fix(types): add missing type keyword for type export from index.d.ts

v4.0.0-prerelease.22

Compare Source

Patch Changes
  • daa78e1: Added missing type exports

v4.0.0-prerelease.21

Compare Source

Minor Changes
  • 8b6fff3: Fixes some noisy warnings still being outputted even when verbosity is set to default.

    We also added log.warning "disabled" option for turning off warnings altogether, meaning you only get success logs and fatal errors.
    This option can be used from the CLI as well using the --no-warn flag.

Patch Changes
  • 77ae35f: Fix scenario of passing absolute paths in Node env, do not remove leading slash in absolute paths.

v4.0.0-prerelease.20

Compare Source

Minor Changes
  • aff6646: Allow passing a custom FileSystem Volume to your Style-Dictionary instances, to ensure input/output files are read/written from/to that specific volume.
    Useful in case you want multiple Style-Dictionary instances that are isolated from one another in terms of inputs/outputs.

    import { Volume } from 'memfs';
    // You will need a bundler for memfs in browser...
    // Or use as a prebundled fork:
    import memfs from '@​bundled-es-modules/memfs';
    const { Volume } = memfs;
    
    const vol = new Volume();
    
    const sd = new StyleDictionary(
      {
        tokens: {
          colors: {
            red: {
              value: '#FF0000',
              type: 'color',
            },
          },
        },
        platforms: {
          css: {
            transformGroup: 'css',
            files: [
              {
                destination: 'variables.css',
                format: 'css/variables',
              },
            ],
          },
        },
      },
      { volume: vol },
    );
    
    await sd.buildAllPlatforms();
    
    vol.readFileSync('/variables.css');
    /**
     * :root {
     *   --colors-red: #FF0000;
     * }
     */

    This also works when using extend:

    const extendedSd = await sd.extend(cfg, { volume: vol });

v4.0.0-prerelease.19

Compare Source

Major Changes
  • 79bb201: BREAKING: Logging has been redesigned a fair bit and is more configurable now.

    Before:

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

    After:

    {
      "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.

  • bcb5ef3: Remove reliance on CTI token structure across transforms, actions and formats.

    Breaking changes:

    • Token type will now be determined by "type" (or "$type") property on the token, rather than by checking its CTI attributes. This change has been reflected in all of the format templates as well as transform "matcher" functions that were previously checking attributes.category as the token type indicator.
    • Types are mostly aligned with DTCG spec types, although a few additional ones have been added for compatibility reasons:
      • asset -> string type tokens where the value is a filepath to an asset
      • icon -> content type string tokens where the content resembles an icon, e.g. for icon fonts like Microsoft codicons
      • html -> HTML entity strings for unicode characters
      • content -> regular string content e.g. text content which sometimes needs to be wrapped in quotes
    • Built-in name transforms are now reliant only on the token path, and are renamed from name/cti/casing to just name/casing. name/ti/camel and name/ti/constant have been removed. For example name/cti/kebab transform is now name/kebab.
    • Transform content/icon has been renamed to html/icon since it targets HTML entity strings, not just any icon content.
    • font/objC/literal, font/swift/literal and font/flutter/literal have been removed in favor of font/objC/literal, font/swift/literal and font/flutter/literal, as they do he exact same transformations.
    • typescript/module-declarations format to be updated with current DesignToken type interface.

    Before:

    {
      "color": {
        "red": {
          "value": "#FF0000"
        }
      }
    }

    After:

    {
      "color": {
        // <-- this no longer needs to be "color" in order for the tokens inside this group to be considered of type "color"
        "red": {
          "value": "#FF0000",
          "type": "color"
        }
      }
    }
Patch Changes
  • 8e297d6: Fix outputReferences for DTCG spec tokens, by using token.original.$value instead of token.original.value.

v4.0.0-prerelease.18

Compare Source

Patch Changes
  • 738686b: Allow transformGroup to be combined with transforms, where standalone transforms will be added after the group's transforms.

v4.0.0-prerelease.17

Compare Source

Patch Changes
  • 63681a6: Fix a couple of type imports issues in .d.ts files

v4.0.0-prerelease.16

Compare Source

Patch Changes
  • 72f020d: Pass outputReferencesFallback option to the relevant utilities, so the option actually works.
  • d008c67: Fix a couple of spots where DTCG option wasn't properly taken into account, more tests added.

Configuration

📅 Schedule: Branch creation - "before 5am every weekday" in timezone Europe/London, Automerge - At any time (no schedule defined).

🚦 Automerge: Disabled by config. Please merge this manually once you are satisfied.

Rebasing: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

🔕 Ignore: Close this PR and you won't be reminded about this update again.


  • If you want to rebase/retry this PR, check this box

This PR has been generated by Mend Renovate. View repository job log here.

@renovate renovate bot force-pushed the renovate/style-dictionary-4.x branch 26 times, most recently from f9e0c42 to 2c7ab5b Compare April 14, 2024 21:44
@renovate renovate bot force-pushed the renovate/style-dictionary-4.x branch from 2c7ab5b to 3d0d482 Compare April 15, 2024 14:04
@renovate renovate bot changed the title Update dependency style-dictionary to v4.0.0-prerelease.24 Update dependency style-dictionary to v4.0.0-prerelease.25 Apr 15, 2024
@QuietNatu QuietNatu closed this Apr 16, 2024
Copy link
Contributor Author

renovate bot commented Apr 16, 2024

Renovate Ignore Notification

Because you closed this PR without merging, Renovate will ignore this update (4.0.0-prerelease.25). You will get a PR once a newer version is released. To ignore this dependency forever, add it to the ignoreDeps array of your Renovate config.

If you accidentally closed this PR, or if you changed your mind: rename this PR to get a fresh replacement PR.

@renovate renovate bot deleted the renovate/style-dictionary-4.x branch April 16, 2024 21:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant