@digdir/designsystemet 1.1.10 → 1.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (33) hide show
  1. package/dist/bin/config.js +12 -12
  2. package/dist/bin/designsystemet.js +55 -57
  3. package/dist/src/config.js +6 -6
  4. package/dist/src/index.js +18 -18
  5. package/dist/src/migrations/beta-to-v1.js +5 -5
  6. package/dist/src/migrations/codemods/css/plugins.js +3 -3
  7. package/dist/src/migrations/codemods/css/run.js +2 -2
  8. package/dist/src/migrations/color-rename-next49.js +5 -5
  9. package/dist/src/migrations/index.js +5 -5
  10. package/dist/src/scripts/createJsonSchema.js +1 -1
  11. package/dist/src/scripts/update-design-tokens.js +2 -2
  12. package/dist/src/scripts/update-preview-tokens.js +22 -22
  13. package/dist/src/scripts/update-template.js +11 -11
  14. package/dist/src/tokens/build.js +29 -29
  15. package/dist/src/tokens/create/generators/$designsystemet.js +5 -5
  16. package/dist/src/tokens/create/write.d.ts.map +1 -1
  17. package/dist/src/tokens/create/write.js +14 -16
  18. package/dist/src/tokens/format.js +18 -18
  19. package/dist/src/tokens/index.js +18 -18
  20. package/dist/src/tokens/process/configs/color.js +2 -2
  21. package/dist/src/tokens/process/configs/semantic.js +2 -2
  22. package/dist/src/tokens/process/configs/typography.js +2 -2
  23. package/dist/src/tokens/process/configs.js +4 -4
  24. package/dist/src/tokens/process/formats/css/color.js +2 -2
  25. package/dist/src/tokens/process/formats/css/semantic.js +2 -2
  26. package/dist/src/tokens/process/formats/css/typography.js +2 -2
  27. package/dist/src/tokens/process/formats/css.js +2 -2
  28. package/dist/src/tokens/process/output/declarations.js +9 -9
  29. package/dist/src/tokens/process/output/theme.js +8 -8
  30. package/dist/src/tokens/process/platform.js +10 -10
  31. package/dist/src/tokens/process/utils/getMultidimensionalThemes.js +4 -4
  32. package/dist/src/utils.js +10 -10
  33. package/package.json +5 -5
@@ -1,10 +1,10 @@
1
1
  // bin/config.ts
2
2
  import path2 from "path";
3
- import chalk3 from "chalk";
3
+ import pc3 from "picocolors";
4
4
  import * as R8 from "ramda";
5
5
 
6
6
  // src/config.ts
7
- import chalk from "chalk";
7
+ import pc from "picocolors";
8
8
  import * as R7 from "ramda";
9
9
  import { z } from "zod";
10
10
  import { fromError } from "zod-validation-error";
@@ -334,12 +334,12 @@ function makeFriendlyError(err) {
334
334
  const optionName = mapPathToOptionName(issue.path);
335
335
  const errorCode = `(error code: ${issue.code})`;
336
336
  const optionMessage = optionName ? ` or CLI option --${optionName}` : "";
337
- return ` - Error in JSON value ${chalk.red(issuePath)}${optionMessage}:
338
- ${issue.message} ${chalk.dim(errorCode)}`;
337
+ return ` - Error in JSON value ${pc.red(issuePath)}${optionMessage}:
338
+ ${issue.message} ${pc.dim(errorCode)}`;
339
339
  }).join("\n")
340
340
  });
341
341
  } catch (_err2) {
342
- console.error(chalk.red(err instanceof Error ? err.message : "Unknown error occurred while parsing config file"));
342
+ console.error(pc.red(err instanceof Error ? err.message : "Unknown error occurred while parsing config file"));
343
343
  console.error(err instanceof Error ? err.stack : "No stack trace available");
344
344
  }
345
345
  }
@@ -347,7 +347,7 @@ function validateConfig(schema, unvalidatedConfig, configPath) {
347
347
  try {
348
348
  return schema.parse(unvalidatedConfig);
349
349
  } catch (err) {
350
- console.error(chalk.redBright(`Invalid config file at ${chalk.red(configPath)}`));
350
+ console.error(pc.redBright(`Invalid config file at ${pc.red(configPath)}`));
351
351
  const validationError = makeFriendlyError(err);
352
352
  console.error(validationError?.toString());
353
353
  process.exit(1);
@@ -360,7 +360,7 @@ function parseConfig(configFile, configPath) {
360
360
  try {
361
361
  return JSON.parse(configFile);
362
362
  } catch (err) {
363
- console.error(chalk.redBright(`Failed parsing config file at ${chalk.red(configPath)}`));
363
+ console.error(pc.redBright(`Failed parsing config file at ${pc.red(configPath)}`));
364
364
  const validationError = makeFriendlyError(err);
365
365
  console.error(validationError?.toString());
366
366
  process.exit(1);
@@ -413,10 +413,10 @@ var configFileCreateSchema = _configFileCreateSchema.extend(commonConfig.shape);
413
413
 
414
414
  // src/utils.ts
415
415
  import fs from "fs/promises";
416
- import chalk2 from "chalk";
416
+ import pc2 from "picocolors";
417
417
  var readFile = async (path3, dry, allowFileNotFound) => {
418
418
  if (dry) {
419
- console.log(`${chalk2.blue("readFile")} ${path3}`);
419
+ console.log(`${pc2.blue("readFile")} ${path3}`);
420
420
  return Promise.resolve("");
421
421
  }
422
422
  try {
@@ -450,11 +450,11 @@ async function readConfigFile(configPath, allowFileNotFound = true) {
450
450
  if (allowFileNotFound) {
451
451
  return "";
452
452
  }
453
- console.error(chalk3.redBright(`Could not read config file at ${chalk3.blue(resolvedPath)}`));
453
+ console.error(pc3.redBright(`Could not read config file at ${pc3.blue(resolvedPath)}`));
454
454
  throw err;
455
455
  }
456
456
  if (configFile) {
457
- console.log(`Found config file: ${chalk3.green(resolvedPath)}`);
457
+ console.log(`Found config file: ${pc3.green(resolvedPath)}`);
458
458
  }
459
459
  return configFile;
460
460
  }
@@ -465,7 +465,7 @@ async function parseCreateConfig(configFile, options) {
465
465
  (x) => /* @__PURE__ */ new Set([...R8.keys(x.colors.main), ...R8.keys(x.colors.support)])
466
466
  );
467
467
  if (!R8.all(R8.equals(R8.__, themeColors[0]), themeColors)) {
468
- console.error(chalk3.redBright(`In config, all themes must have the same custom color names, but we found:`));
468
+ console.error(pc3.redBright(`In config, all themes must have the same custom color names, but we found:`));
469
469
  const themeNames = R8.keys(configParsed.themes ?? {});
470
470
  themeColors.forEach((colors, index) => {
471
471
  const colorNames = Array.from(colors);
@@ -2,7 +2,7 @@
2
2
 
3
3
  // bin/designsystemet.ts
4
4
  import { Argument, createCommand, program } from "@commander-js/extra-typings";
5
- import chalk11 from "chalk";
5
+ import pc11 from "picocolors";
6
6
  import * as R24 from "ramda";
7
7
 
8
8
  // src/colors/colorMetadata.ts
@@ -358,11 +358,11 @@ var generateColorContrast = (color, type) => {
358
358
  };
359
359
 
360
360
  // src/migrations/codemods/css/plugins.ts
361
- import chalk from "chalk";
362
361
  import hash from "object-hash";
362
+ import pc from "picocolors";
363
363
  import * as R3 from "ramda";
364
- var printDelete = (text) => console.log(`${chalk.red("Deleted:")} ${text}`.replace(/"|'/g, ""));
365
- var deleteMsg = (decl, from) => `${chalk.yellow(from)} @ ${chalk.gray(`${JSON.stringify(decl.source?.input.file)}:${decl.source?.start?.line}:${decl.source?.start?.column}`)}`;
364
+ var printDelete = (text) => console.log(`${pc.red("Deleted:")} ${text}`.replace(/"|'/g, ""));
365
+ var deleteMsg = (decl, from) => `${pc.yellow(from)} @ ${pc.gray(`${JSON.stringify(decl.source?.input.file)}:${decl.source?.start?.line}:${decl.source?.start?.column}`)}`;
366
366
  var cssClassRename = (dictionary) => ({
367
367
  postcssPlugin: `Renames CSS classes ${hash(dictionary)}`,
368
368
  Rule(rule) {
@@ -407,10 +407,10 @@ import postcss from "postcss";
407
407
 
408
408
  // src/utils.ts
409
409
  import fs from "fs/promises";
410
- import chalk2 from "chalk";
410
+ import pc2 from "picocolors";
411
411
  var mkdir = async (dir, dry) => {
412
412
  if (dry) {
413
- console.log(`${chalk2.blue("mkdir")} ${dir}`);
413
+ console.log(`${pc2.blue("mkdir")} ${dir}`);
414
414
  return Promise.resolve();
415
415
  }
416
416
  const exists = await fs.access(dir, fs.constants.F_OK).then(() => true).catch(() => false);
@@ -421,27 +421,27 @@ var mkdir = async (dir, dry) => {
421
421
  };
422
422
  var writeFile = async (path5, data, dry) => {
423
423
  if (dry) {
424
- console.log(`${chalk2.blue("writeFile")} ${path5}`);
424
+ console.log(`${pc2.blue("writeFile")} ${path5}`);
425
425
  return Promise.resolve();
426
426
  }
427
427
  return fs.writeFile(path5, data, { encoding: "utf-8" }).catch((error) => {
428
- console.error(chalk2.red(`Error writing file: ${path5}`));
429
- console.error(chalk2.red(error));
428
+ console.error(pc2.red(`Error writing file: ${path5}`));
429
+ console.error(pc2.red(error));
430
430
  throw error;
431
431
  });
432
432
  };
433
433
  var cleanDir = async (dir, dry) => {
434
434
  if (dry) {
435
- console.log(`${chalk2.blue("cleanDir")} ${dir}`);
435
+ console.log(`${pc2.blue("cleanDir")} ${dir}`);
436
436
  return Promise.resolve();
437
437
  }
438
438
  console.log(`
439
- \u{1F525} Cleaning dir ${chalk2.red(`${dir.trim()}`)} `);
439
+ \u{1F525} Cleaning dir ${pc2.red(`${dir.trim()}`)} `);
440
440
  return fs.rm(dir, { recursive: true, force: true });
441
441
  };
442
442
  var readFile = async (path5, dry, allowFileNotFound) => {
443
443
  if (dry) {
444
- console.log(`${chalk2.blue("readFile")} ${path5}`);
444
+ console.log(`${pc2.blue("readFile")} ${path5}`);
445
445
  return Promise.resolve("");
446
446
  }
447
447
  try {
@@ -861,16 +861,16 @@ var migrations_default = {
861
861
 
862
862
  // src/tokens/build.ts
863
863
  import path from "path";
864
- import chalk7 from "chalk";
864
+ import pc7 from "picocolors";
865
865
  import * as R16 from "ramda";
866
866
 
867
867
  // src/tokens/process/output/declarations.ts
868
- import chalk5 from "chalk";
868
+ import pc5 from "picocolors";
869
869
 
870
870
  // package.json
871
871
  var package_default = {
872
872
  name: "@digdir/designsystemet",
873
- version: "1.1.10",
873
+ version: "1.2.0",
874
874
  description: "CLI for Designsystemet",
875
875
  author: "Designsystemet team",
876
876
  engines: {
@@ -934,7 +934,6 @@ var package_default = {
934
934
  "@commander-js/extra-typings": "^14.0.0",
935
935
  "@tokens-studio/sd-transforms": "1.3.0",
936
936
  "apca-w3": "^0.1.9",
937
- chalk: "^5.4.1",
938
937
  "change-case": "^5.4.4",
939
938
  "chroma-js": "^3.1.2",
940
939
  "colorjs.io": "^0.6.0-alpha.1",
@@ -942,10 +941,11 @@ var package_default = {
942
941
  "fast-glob": "^3.3.3",
943
942
  hsluv: "^1.0.1",
944
943
  "object-hash": "^3.0.0",
944
+ picocolors: "^1.1.1",
945
945
  postcss: "^8.5.6",
946
946
  ramda: "^0.31.3",
947
947
  "style-dictionary": "^5.0.1",
948
- zod: "^4.0.15",
948
+ zod: "^4.0.17",
949
949
  "zod-validation-error": "^4.0.1"
950
950
  },
951
951
  devDependencies: {
@@ -953,10 +953,10 @@ var package_default = {
953
953
  "@types/apca-w3": "^0.1.3",
954
954
  "@types/chroma-js": "^3.1.1",
955
955
  "@types/fs-extra": "^11.0.4",
956
- "@types/node": "^22.17.0",
956
+ "@types/node": "^22.17.1",
957
957
  "@types/object-hash": "^3.0.6",
958
958
  "@types/ramda": "^0.31.0",
959
- "fs-extra": "^11.3.0",
959
+ "fs-extra": "^11.3.1",
960
960
  tslib: "^2.8.1",
961
961
  tsup: "^8.5.0",
962
962
  tsx: "^4.20.3",
@@ -965,7 +965,7 @@ var package_default = {
965
965
  };
966
966
 
967
967
  // src/tokens/process/platform.ts
968
- import chalk4 from "chalk";
968
+ import pc4 from "picocolors";
969
969
  import * as R14 from "ramda";
970
970
  import StyleDictionary2 from "style-dictionary";
971
971
 
@@ -1669,8 +1669,8 @@ var TypographyValues;
1669
1669
  })(TypographyValues || (TypographyValues = {}));
1670
1670
 
1671
1671
  // src/tokens/process/utils/getMultidimensionalThemes.ts
1672
- import chalk3 from "chalk";
1673
1672
  import { kebabCase } from "change-case";
1673
+ import pc3 from "picocolors";
1674
1674
  import * as R12 from "ramda";
1675
1675
  var getMultidimensionalThemes = (processed$themes, dimensions) => {
1676
1676
  const verboseLogging = buildOptions?.verbose;
@@ -1680,8 +1680,8 @@ var getMultidimensionalThemes = (processed$themes, dimensions) => {
1680
1680
  const keys3 = R12.keys(grouped$themes);
1681
1681
  const nonDependentKeys = keys3.filter((x) => ![...ALL_DEPENDENT_ON, ...dimensions].includes(x));
1682
1682
  if (verboseLogging) {
1683
- console.log(chalk3.cyan(`\u{1F50E} Finding theme permutations for ${dimensions}`));
1684
- console.log(chalk3.cyan(` (ignoring permutations for ${nonDependentKeys})`));
1683
+ console.log(pc3.cyan(`\u{1F50E} Finding theme permutations for ${dimensions}`));
1684
+ console.log(pc3.cyan(` (ignoring permutations for ${nonDependentKeys})`));
1685
1685
  }
1686
1686
  return permutations.filter((val) => {
1687
1687
  const filters = nonDependentKeys.map((x) => val.permutation[x] === grouped$themes[x][0].name);
@@ -1908,18 +1908,18 @@ async function processPlatform(options) {
1908
1908
  const UNSAFE_DEFAULT_COLOR = process.env.UNSAFE_DEFAULT_COLOR ?? "";
1909
1909
  if (UNSAFE_DEFAULT_COLOR) {
1910
1910
  console.warn(
1911
- chalk4.yellow(
1911
+ pc4.yellow(
1912
1912
  `
1913
- \u26A0\uFE0F UNSAFE_DEFAULT_COLOR is set to ${chalk4.blue(UNSAFE_DEFAULT_COLOR)}. This will override the default color.`
1913
+ \u26A0\uFE0F UNSAFE_DEFAULT_COLOR is set to ${pc4.blue(UNSAFE_DEFAULT_COLOR)}. This will override the default color.`
1914
1914
  )
1915
1915
  );
1916
1916
  }
1917
1917
  const UNSAFE_COLOR_GROUPS = Array.from(process.env.UNSAFE_COLOR_GROUPS?.split(",") ?? []);
1918
1918
  if (UNSAFE_COLOR_GROUPS.length > 0) {
1919
1919
  console.warn(
1920
- chalk4.yellow(
1920
+ pc4.yellow(
1921
1921
  `
1922
- \u26A0\uFE0F UNSAFE_COLOR_GROUPS is set to ${chalk4.blue(`[${UNSAFE_COLOR_GROUPS.join(", ")}]`)}. This will override the default color groups.`
1922
+ \u26A0\uFE0F UNSAFE_COLOR_GROUPS is set to ${pc4.blue(`[${UNSAFE_COLOR_GROUPS.join(", ")}]`)}. This will override the default color groups.`
1923
1923
  )
1924
1924
  );
1925
1925
  }
@@ -1934,7 +1934,7 @@ async function processPlatform(options) {
1934
1934
  }
1935
1935
  if (buildOptions.defaultColor) {
1936
1936
  console.log(`
1937
- \u{1F3A8} Using ${chalk4.blue(buildOptions.defaultColor)} as default color`);
1937
+ \u{1F3A8} Using ${pc4.blue(buildOptions.defaultColor)} as default color`);
1938
1938
  }
1939
1939
  const buildAndSdConfigs = R14.map((buildConfig) => {
1940
1940
  const sdConfigs = getConfigsForThemeDimensions(
@@ -1978,7 +1978,7 @@ async function processPlatform(options) {
1978
1978
  }
1979
1979
  if (sdConfigs.length > 0) {
1980
1980
  console.log(`
1981
- \u{1F371} Building ${chalk4.green(buildConfig.name ?? buildName)}`);
1981
+ \u{1F371} Building ${pc4.green(buildConfig.name ?? buildName)}`);
1982
1982
  const results = await Promise.all(
1983
1983
  sdConfigs.map(async (sdConfig) => {
1984
1984
  const { config, permutation } = sdConfig;
@@ -2030,7 +2030,7 @@ ${typeDeclaration}`,
2030
2030
  };
2031
2031
  function createColorTypeDeclaration(colors2) {
2032
2032
  console.log(`
2033
- \u{1F371} Building ${chalk5.green("type declarations")}`);
2033
+ \u{1F371} Building ${pc5.green("type declarations")}`);
2034
2034
  const typeDeclaration = `
2035
2035
  /* ${defaultFileHeader} */
2036
2036
  import type {} from '@digdir/designsystemet/types';
@@ -2109,7 +2109,7 @@ ${dynamicColors}`;
2109
2109
  };
2110
2110
 
2111
2111
  // src/tokens/process/output/theme.ts
2112
- import chalk6 from "chalk";
2112
+ import pc6 from "picocolors";
2113
2113
  import * as R15 from "ramda";
2114
2114
  var defaultFileHeader2 = `build: v${package_default.version}`;
2115
2115
  var createThemeCSSFiles = ({
@@ -2146,10 +2146,10 @@ var createThemeCSSFiles = ({
2146
2146
  });
2147
2147
  if (sortIndex === -1) {
2148
2148
  console.error(
2149
- chalk6.yellow("WARNING: CSS section does not have a defined sort order:", filePath.replace(".css", ""))
2149
+ pc6.yellow(`WARNING: CSS section does not have a defined sort order: ${filePath.replace(".css", "")}`)
2150
2150
  );
2151
2151
  console.log(
2152
- chalk6.dim(
2152
+ pc6.dim(
2153
2153
  `
2154
2154
  The section will currently be added to the end of the entry file, but the exact
2155
2155
  order may change due to nondeterminism.`.trim()
@@ -2205,7 +2205,7 @@ var buildTokens = async (options) => {
2205
2205
  } catch (_error) {
2206
2206
  }
2207
2207
  console.log(`
2208
- \u{1F3D7}\uFE0F Start building tokens in ${chalk7.green(tokensDir)}`);
2208
+ \u{1F3D7}\uFE0F Start building tokens in ${pc7.green(tokensDir)}`);
2209
2209
  const processedBuilds = await processPlatform({
2210
2210
  ...options,
2211
2211
  outDir,
@@ -2228,7 +2228,7 @@ design-tokens: v${$designsystemet.version}` : ""
2228
2228
  files = files.concat(tailwindFiles.filter(Boolean));
2229
2229
  }
2230
2230
  console.log(`
2231
- \u{1F4BE} Writing build to ${chalk7.green(outDir)}`);
2231
+ \u{1F4BE} Writing build to ${pc7.green(outDir)}`);
2232
2232
  await write(files, outDir, options.dry);
2233
2233
  console.log(`
2234
2234
  \u2705 Finished building tokens!`);
@@ -2237,7 +2237,7 @@ design-tokens: v${$designsystemet.version}` : ""
2237
2237
 
2238
2238
  // src/tokens/create/write.ts
2239
2239
  import path2 from "path";
2240
- import chalk8 from "chalk";
2240
+ import pc8 from "picocolors";
2241
2241
  import * as R17 from "ramda";
2242
2242
 
2243
2243
  // src/tokens/create/generators/$designsystemet.ts
@@ -2474,7 +2474,7 @@ var writeTokens = async (options) => {
2474
2474
  );
2475
2475
  const themes = concatThemeNames(themeObjects);
2476
2476
  console.log(`
2477
- Themes: ${chalk8.blue(themes.join(", "))}`);
2477
+ Themes: ${pc8.blue(themes.join(", "))}`);
2478
2478
  const $themes = await generate$Themes(["dark", "light"], themes, colors2);
2479
2479
  const $metadata = generate$Metadata(["dark", "light"], themes, colors2);
2480
2480
  const $designsystemet = generate$Designsystemet();
@@ -2487,9 +2487,7 @@ Themes: ${chalk8.blue(themes.join(", "))}`);
2487
2487
  const filePath = path2.join(targetDir, `${set4}.json`);
2488
2488
  await writeFile(filePath, stringify(tokens), dry);
2489
2489
  }
2490
- console.log(
2491
- `Finished creating Designsystem design tokens in ${chalk8.green(outDir)} for theme ${chalk8.blue(themeName)}`
2492
- );
2490
+ console.log(`Finished creating Designsystem design tokens in ${pc8.green(outDir)} for theme ${pc8.blue(themeName)}`);
2493
2491
  };
2494
2492
 
2495
2493
  // src/tokens/create/defaults.ts
@@ -4251,11 +4249,11 @@ var createTokens = async (opts) => {
4251
4249
 
4252
4250
  // bin/config.ts
4253
4251
  import path4 from "path";
4254
- import chalk10 from "chalk";
4252
+ import pc10 from "picocolors";
4255
4253
  import * as R23 from "ramda";
4256
4254
 
4257
4255
  // src/config.ts
4258
- import chalk9 from "chalk";
4256
+ import pc9 from "picocolors";
4259
4257
  import * as R22 from "ramda";
4260
4258
  import { z } from "zod";
4261
4259
  import { fromError } from "zod-validation-error";
@@ -4275,12 +4273,12 @@ function makeFriendlyError(err) {
4275
4273
  const optionName = mapPathToOptionName(issue.path);
4276
4274
  const errorCode = `(error code: ${issue.code})`;
4277
4275
  const optionMessage = optionName ? ` or CLI option --${optionName}` : "";
4278
- return ` - Error in JSON value ${chalk9.red(issuePath)}${optionMessage}:
4279
- ${issue.message} ${chalk9.dim(errorCode)}`;
4276
+ return ` - Error in JSON value ${pc9.red(issuePath)}${optionMessage}:
4277
+ ${issue.message} ${pc9.dim(errorCode)}`;
4280
4278
  }).join("\n")
4281
4279
  });
4282
4280
  } catch (_err2) {
4283
- console.error(chalk9.red(err instanceof Error ? err.message : "Unknown error occurred while parsing config file"));
4281
+ console.error(pc9.red(err instanceof Error ? err.message : "Unknown error occurred while parsing config file"));
4284
4282
  console.error(err instanceof Error ? err.stack : "No stack trace available");
4285
4283
  }
4286
4284
  }
@@ -4288,7 +4286,7 @@ function validateConfig(schema, unvalidatedConfig, configPath) {
4288
4286
  try {
4289
4287
  return schema.parse(unvalidatedConfig);
4290
4288
  } catch (err) {
4291
- console.error(chalk9.redBright(`Invalid config file at ${chalk9.red(configPath)}`));
4289
+ console.error(pc9.redBright(`Invalid config file at ${pc9.red(configPath)}`));
4292
4290
  const validationError = makeFriendlyError(err);
4293
4291
  console.error(validationError?.toString());
4294
4292
  process.exit(1);
@@ -4301,7 +4299,7 @@ function parseConfig(configFile, configPath) {
4301
4299
  try {
4302
4300
  return JSON.parse(configFile);
4303
4301
  } catch (err) {
4304
- console.error(chalk9.redBright(`Failed parsing config file at ${chalk9.red(configPath)}`));
4302
+ console.error(pc9.redBright(`Failed parsing config file at ${pc9.red(configPath)}`));
4305
4303
  const validationError = makeFriendlyError(err);
4306
4304
  console.error(validationError?.toString());
4307
4305
  process.exit(1);
@@ -4373,11 +4371,11 @@ async function readConfigFile(configPath, allowFileNotFound = true) {
4373
4371
  if (allowFileNotFound) {
4374
4372
  return "";
4375
4373
  }
4376
- console.error(chalk10.redBright(`Could not read config file at ${chalk10.blue(resolvedPath)}`));
4374
+ console.error(pc10.redBright(`Could not read config file at ${pc10.blue(resolvedPath)}`));
4377
4375
  throw err;
4378
4376
  }
4379
4377
  if (configFile) {
4380
- console.log(`Found config file: ${chalk10.green(resolvedPath)}`);
4378
+ console.log(`Found config file: ${pc10.green(resolvedPath)}`);
4381
4379
  }
4382
4380
  return configFile;
4383
4381
  }
@@ -4388,7 +4386,7 @@ async function parseCreateConfig(configFile, options) {
4388
4386
  (x) => /* @__PURE__ */ new Set([...R23.keys(x.colors.main), ...R23.keys(x.colors.support)])
4389
4387
  );
4390
4388
  if (!R23.all(R23.equals(R23.__, themeColors[0]), themeColors)) {
4391
- console.error(chalk10.redBright(`In config, all themes must have the same custom color names, but we found:`));
4389
+ console.error(pc10.redBright(`In config, all themes must have the same custom color names, but we found:`));
4392
4390
  const themeNames = R23.keys(configParsed.themes ?? {});
4393
4391
  themeColors.forEach((colors2, index) => {
4394
4392
  const colorNames = Array.from(colors2);
@@ -4442,11 +4440,11 @@ var DEFAULT_THEME_NAME = "theme";
4442
4440
  var DEFAULT_CONFIG_FILE = "designsystemet.config.json";
4443
4441
  function makeTokenCommands() {
4444
4442
  const tokenCmd = createCommand("tokens");
4445
- tokenCmd.command("build").description("Build Designsystemet tokens").option("-t, --tokens <string>", `Path to ${chalk11.blue("design-tokens")}`, DEFAULT_TOKENS_CREATE_DIR).option(
4443
+ tokenCmd.command("build").description("Build Designsystemet tokens").option("-t, --tokens <string>", `Path to ${pc11.blue("design-tokens")}`, DEFAULT_TOKENS_CREATE_DIR).option(
4446
4444
  "-o, --out-dir <string>",
4447
- `Output directory for built ${chalk11.blue("design-tokens")}`,
4445
+ `Output directory for built ${pc11.blue("design-tokens")}`,
4448
4446
  DEFAULT_TOKENS_BUILD_DIR
4449
- ).option(`--${cliOptions.clean} [boolean]`, "Clean output directory before building tokens", parseBoolean, false).option("--dry [boolean]", `Dry run for built ${chalk11.blue("design-tokens")}`, parseBoolean, false).option("--verbose", "Enable verbose output", false).option("--config <string>", `Path to config file (default: "${DEFAULT_CONFIG_FILE}")`).option("--experimental-tailwind", "Generate Tailwind CSS classes for tokens", false).action(async (opts) => {
4447
+ ).option(`--${cliOptions.clean} [boolean]`, "Clean output directory before building tokens", parseBoolean, false).option("--dry [boolean]", `Dry run for built ${pc11.blue("design-tokens")}`, parseBoolean, false).option("--verbose", "Enable verbose output", false).option("--config <string>", `Path to config file (default: "${DEFAULT_CONFIG_FILE}")`).option("--experimental-tailwind", "Generate Tailwind CSS classes for tokens", false).action(async (opts) => {
4450
4448
  const { verbose, clean, dry, experimentalTailwind } = opts;
4451
4449
  const tokensDir = typeof opts.tokens === "string" ? opts.tokens : DEFAULT_TOKENS_CREATE_DIR;
4452
4450
  const outDir = typeof opts.outDir === "string" ? opts.outDir : "./dist/tokens";
@@ -4463,9 +4461,9 @@ function makeTokenCommands() {
4463
4461
  });
4464
4462
  tokenCmd.command("create").description("Create Designsystemet tokens").option(`-m, --${cliOptions.theme.colors.main} <name:hex...>`, `Main colors`, parseColorValues).option(`-s, --${cliOptions.theme.colors.support} <name:hex...>`, `Support colors`, parseColorValues).option(`-n, --${cliOptions.theme.colors.neutral} <hex>`, `Neutral hex color`, convertToHex).option(
4465
4463
  `-o, --${cliOptions.outDir} <string>`,
4466
- `Output directory for created ${chalk11.blue("design-tokens")}`,
4464
+ `Output directory for created ${pc11.blue("design-tokens")}`,
4467
4465
  DEFAULT_TOKENS_CREATE_DIR
4468
- ).option(`--${cliOptions.clean} [boolean]`, "Clean output directory before creating tokens", parseBoolean, false).option("--dry [boolean]", `Dry run for created ${chalk11.blue("design-tokens")}`, parseBoolean, false).option(`-f, --${cliOptions.theme.typography.fontFamily} <string>`, `Font family (experimental)`, DEFAULT_FONT).option(
4466
+ ).option(`--${cliOptions.clean} [boolean]`, "Clean output directory before creating tokens", parseBoolean, false).option("--dry [boolean]", `Dry run for created ${pc11.blue("design-tokens")}`, parseBoolean, false).option(`-f, --${cliOptions.theme.typography.fontFamily} <string>`, `Font family (experimental)`, DEFAULT_FONT).option(
4469
4467
  `-b, --${cliOptions.theme.borderRadius} <number>`,
4470
4468
  `Unitless base border-radius in px`,
4471
4469
  (radiusAsString) => Number(radiusAsString),
@@ -4506,8 +4504,8 @@ program.command("migrate").description("run a Designsystemet migration").addArgu
4506
4504
  console.error("Migration not found!");
4507
4505
  throw "Aborting";
4508
4506
  }
4509
- console.log(`Applying migration ${chalk11.blue(migrationKey)} with glob: ${chalk11.green(glob2)}`);
4510
- migration?.(glob2).then(() => console.log(`Migration ${chalk11.blue(migrationKey)} finished`)).catch((error) => console.log(error));
4507
+ console.log(`Applying migration ${pc11.blue(migrationKey)} with glob: ${pc11.green(glob2)}`);
4508
+ migration?.(glob2).then(() => console.log(`Migration ${pc11.blue(migrationKey)} finished`)).catch((error) => console.log(error));
4511
4509
  } else {
4512
4510
  console.log("Migrate: please specify a migration name or --list");
4513
4511
  }
@@ -1,5 +1,5 @@
1
1
  // src/config.ts
2
- import chalk from "chalk";
2
+ import pc from "picocolors";
3
3
  import * as R7 from "ramda";
4
4
  import { z } from "zod";
5
5
  import { fromError } from "zod-validation-error";
@@ -329,12 +329,12 @@ function makeFriendlyError(err) {
329
329
  const optionName = mapPathToOptionName(issue.path);
330
330
  const errorCode = `(error code: ${issue.code})`;
331
331
  const optionMessage = optionName ? ` or CLI option --${optionName}` : "";
332
- return ` - Error in JSON value ${chalk.red(issuePath)}${optionMessage}:
333
- ${issue.message} ${chalk.dim(errorCode)}`;
332
+ return ` - Error in JSON value ${pc.red(issuePath)}${optionMessage}:
333
+ ${issue.message} ${pc.dim(errorCode)}`;
334
334
  }).join("\n")
335
335
  });
336
336
  } catch (_err2) {
337
- console.error(chalk.red(err instanceof Error ? err.message : "Unknown error occurred while parsing config file"));
337
+ console.error(pc.red(err instanceof Error ? err.message : "Unknown error occurred while parsing config file"));
338
338
  console.error(err instanceof Error ? err.stack : "No stack trace available");
339
339
  }
340
340
  }
@@ -342,7 +342,7 @@ function validateConfig(schema, unvalidatedConfig, configPath) {
342
342
  try {
343
343
  return schema.parse(unvalidatedConfig);
344
344
  } catch (err) {
345
- console.error(chalk.redBright(`Invalid config file at ${chalk.red(configPath)}`));
345
+ console.error(pc.redBright(`Invalid config file at ${pc.red(configPath)}`));
346
346
  const validationError = makeFriendlyError(err);
347
347
  console.error(validationError?.toString());
348
348
  process.exit(1);
@@ -355,7 +355,7 @@ function parseConfig(configFile, configPath) {
355
355
  try {
356
356
  return JSON.parse(configFile);
357
357
  } catch (err) {
358
- console.error(chalk.redBright(`Failed parsing config file at ${chalk.red(configPath)}`));
358
+ console.error(pc.redBright(`Failed parsing config file at ${pc.red(configPath)}`));
359
359
  const validationError = makeFriendlyError(err);
360
360
  console.error(validationError?.toString());
361
361
  process.exit(1);
package/dist/src/index.js CHANGED
@@ -2566,13 +2566,13 @@ function generateTypographyGroup(themes) {
2566
2566
  }
2567
2567
 
2568
2568
  // src/tokens/process/output/theme.ts
2569
- import chalk from "chalk";
2569
+ import pc from "picocolors";
2570
2570
  import * as R7 from "ramda";
2571
2571
 
2572
2572
  // package.json
2573
2573
  var package_default = {
2574
2574
  name: "@digdir/designsystemet",
2575
- version: "1.1.10",
2575
+ version: "1.2.0",
2576
2576
  description: "CLI for Designsystemet",
2577
2577
  author: "Designsystemet team",
2578
2578
  engines: {
@@ -2636,7 +2636,6 @@ var package_default = {
2636
2636
  "@commander-js/extra-typings": "^14.0.0",
2637
2637
  "@tokens-studio/sd-transforms": "1.3.0",
2638
2638
  "apca-w3": "^0.1.9",
2639
- chalk: "^5.4.1",
2640
2639
  "change-case": "^5.4.4",
2641
2640
  "chroma-js": "^3.1.2",
2642
2641
  "colorjs.io": "^0.6.0-alpha.1",
@@ -2644,10 +2643,11 @@ var package_default = {
2644
2643
  "fast-glob": "^3.3.3",
2645
2644
  hsluv: "^1.0.1",
2646
2645
  "object-hash": "^3.0.0",
2646
+ picocolors: "^1.1.1",
2647
2647
  postcss: "^8.5.6",
2648
2648
  ramda: "^0.31.3",
2649
2649
  "style-dictionary": "^5.0.1",
2650
- zod: "^4.0.15",
2650
+ zod: "^4.0.17",
2651
2651
  "zod-validation-error": "^4.0.1"
2652
2652
  },
2653
2653
  devDependencies: {
@@ -2655,10 +2655,10 @@ var package_default = {
2655
2655
  "@types/apca-w3": "^0.1.3",
2656
2656
  "@types/chroma-js": "^3.1.1",
2657
2657
  "@types/fs-extra": "^11.0.4",
2658
- "@types/node": "^22.17.0",
2658
+ "@types/node": "^22.17.1",
2659
2659
  "@types/object-hash": "^3.0.6",
2660
2660
  "@types/ramda": "^0.31.0",
2661
- "fs-extra": "^11.3.0",
2661
+ "fs-extra": "^11.3.1",
2662
2662
  tslib: "^2.8.1",
2663
2663
  tsup: "^8.5.0",
2664
2664
  tsx: "^4.20.3",
@@ -2702,10 +2702,10 @@ var createThemeCSSFiles = ({
2702
2702
  });
2703
2703
  if (sortIndex === -1) {
2704
2704
  console.error(
2705
- chalk.yellow("WARNING: CSS section does not have a defined sort order:", filePath.replace(".css", ""))
2705
+ pc.yellow(`WARNING: CSS section does not have a defined sort order: ${filePath.replace(".css", "")}`)
2706
2706
  );
2707
2707
  console.log(
2708
- chalk.dim(
2708
+ pc.dim(
2709
2709
  `
2710
2710
  The section will currently be added to the end of the entry file, but the exact
2711
2711
  order may change due to nondeterminism.`.trim()
@@ -2738,7 +2738,7 @@ ${fileHeader}
2738
2738
  };
2739
2739
 
2740
2740
  // src/tokens/process/platform.ts
2741
- import chalk3 from "chalk";
2741
+ import pc3 from "picocolors";
2742
2742
  import * as R17 from "ramda";
2743
2743
  import StyleDictionary2 from "style-dictionary";
2744
2744
 
@@ -3279,8 +3279,8 @@ var typographyVariables = ({ theme, typography: typography2 }) => {
3279
3279
  };
3280
3280
 
3281
3281
  // src/tokens/process/utils/getMultidimensionalThemes.ts
3282
- import chalk2 from "chalk";
3283
3282
  import { kebabCase } from "change-case";
3283
+ import pc2 from "picocolors";
3284
3284
  import * as R15 from "ramda";
3285
3285
  var getMultidimensionalThemes = (processed$themes, dimensions) => {
3286
3286
  const verboseLogging = buildOptions?.verbose;
@@ -3290,8 +3290,8 @@ var getMultidimensionalThemes = (processed$themes, dimensions) => {
3290
3290
  const keys2 = R15.keys(grouped$themes);
3291
3291
  const nonDependentKeys = keys2.filter((x) => ![...ALL_DEPENDENT_ON, ...dimensions].includes(x));
3292
3292
  if (verboseLogging) {
3293
- console.log(chalk2.cyan(`\u{1F50E} Finding theme permutations for ${dimensions}`));
3294
- console.log(chalk2.cyan(` (ignoring permutations for ${nonDependentKeys})`));
3293
+ console.log(pc2.cyan(`\u{1F50E} Finding theme permutations for ${dimensions}`));
3294
+ console.log(pc2.cyan(` (ignoring permutations for ${nonDependentKeys})`));
3295
3295
  }
3296
3296
  return permutations.filter((val) => {
3297
3297
  const filters = nonDependentKeys.map((x) => val.permutation[x] === grouped$themes[x][0].name);
@@ -3518,18 +3518,18 @@ async function processPlatform(options) {
3518
3518
  const UNSAFE_DEFAULT_COLOR = process.env.UNSAFE_DEFAULT_COLOR ?? "";
3519
3519
  if (UNSAFE_DEFAULT_COLOR) {
3520
3520
  console.warn(
3521
- chalk3.yellow(
3521
+ pc3.yellow(
3522
3522
  `
3523
- \u26A0\uFE0F UNSAFE_DEFAULT_COLOR is set to ${chalk3.blue(UNSAFE_DEFAULT_COLOR)}. This will override the default color.`
3523
+ \u26A0\uFE0F UNSAFE_DEFAULT_COLOR is set to ${pc3.blue(UNSAFE_DEFAULT_COLOR)}. This will override the default color.`
3524
3524
  )
3525
3525
  );
3526
3526
  }
3527
3527
  const UNSAFE_COLOR_GROUPS = Array.from(process.env.UNSAFE_COLOR_GROUPS?.split(",") ?? []);
3528
3528
  if (UNSAFE_COLOR_GROUPS.length > 0) {
3529
3529
  console.warn(
3530
- chalk3.yellow(
3530
+ pc3.yellow(
3531
3531
  `
3532
- \u26A0\uFE0F UNSAFE_COLOR_GROUPS is set to ${chalk3.blue(`[${UNSAFE_COLOR_GROUPS.join(", ")}]`)}. This will override the default color groups.`
3532
+ \u26A0\uFE0F UNSAFE_COLOR_GROUPS is set to ${pc3.blue(`[${UNSAFE_COLOR_GROUPS.join(", ")}]`)}. This will override the default color groups.`
3533
3533
  )
3534
3534
  );
3535
3535
  }
@@ -3544,7 +3544,7 @@ async function processPlatform(options) {
3544
3544
  }
3545
3545
  if (buildOptions.defaultColor) {
3546
3546
  console.log(`
3547
- \u{1F3A8} Using ${chalk3.blue(buildOptions.defaultColor)} as default color`);
3547
+ \u{1F3A8} Using ${pc3.blue(buildOptions.defaultColor)} as default color`);
3548
3548
  }
3549
3549
  const buildAndSdConfigs = R17.map((buildConfig) => {
3550
3550
  const sdConfigs = getConfigsForThemeDimensions(
@@ -3588,7 +3588,7 @@ async function processPlatform(options) {
3588
3588
  }
3589
3589
  if (sdConfigs.length > 0) {
3590
3590
  console.log(`
3591
- \u{1F371} Building ${chalk3.green(buildConfig.name ?? buildName)}`);
3591
+ \u{1F371} Building ${pc3.green(buildConfig.name ?? buildName)}`);
3592
3592
  const results = await Promise.all(
3593
3593
  sdConfigs.map(async (sdConfig) => {
3594
3594
  const { config, permutation } = sdConfig;
@@ -1,9 +1,9 @@
1
1
  // src/migrations/codemods/css/plugins.ts
2
- import chalk from "chalk";
3
2
  import hash from "object-hash";
3
+ import pc from "picocolors";
4
4
  import * as R from "ramda";
5
- var printDelete = (text) => console.log(`${chalk.red("Deleted:")} ${text}`.replace(/"|'/g, ""));
6
- var deleteMsg = (decl, from) => `${chalk.yellow(from)} @ ${chalk.gray(`${JSON.stringify(decl.source?.input.file)}:${decl.source?.start?.line}:${decl.source?.start?.column}`)}`;
5
+ var printDelete = (text) => console.log(`${pc.red("Deleted:")} ${text}`.replace(/"|'/g, ""));
6
+ var deleteMsg = (decl, from) => `${pc.yellow(from)} @ ${pc.gray(`${JSON.stringify(decl.source?.input.file)}:${decl.source?.start?.line}:${decl.source?.start?.column}`)}`;
7
7
  var cssClassRename = (dictionary) => ({
8
8
  postcssPlugin: `Renames CSS classes ${hash(dictionary)}`,
9
9
  Rule(rule) {
@@ -48,10 +48,10 @@ import postcss from "postcss";
48
48
 
49
49
  // src/utils.ts
50
50
  import fs from "fs/promises";
51
- import chalk2 from "chalk";
51
+ import pc2 from "picocolors";
52
52
  var readFile = async (path, dry, allowFileNotFound) => {
53
53
  if (dry) {
54
- console.log(`${chalk2.blue("readFile")} ${path}`);
54
+ console.log(`${pc2.blue("readFile")} ${path}`);
55
55
  return Promise.resolve("");
56
56
  }
57
57
  try {