mini-shiki 3.13.0 → 3.15.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 (2) hide show
  1. package/dist/shiki.js +55 -4
  2. package/package.json +5 -5
package/dist/shiki.js CHANGED
@@ -361,10 +361,33 @@ function createColorPalette(namedColorsMap = defaultNamedColorsMap) {
361
361
  }
362
362
  return { value };
363
363
  }
364
+ const defaultAnsiColors = {
365
+ black: "#000000",
366
+ red: "#cd3131",
367
+ green: "#0DBC79",
368
+ yellow: "#E5E510",
369
+ blue: "#2472C8",
370
+ magenta: "#BC3FBC",
371
+ cyan: "#11A8CD",
372
+ white: "#E5E5E5",
373
+ brightBlack: "#666666",
374
+ brightRed: "#F14C4C",
375
+ brightGreen: "#23D18B",
376
+ brightYellow: "#F5F543",
377
+ brightBlue: "#3B8EEA",
378
+ brightMagenta: "#D670D6",
379
+ brightCyan: "#29B8DB",
380
+ brightWhite: "#FFFFFF"
381
+ };
364
382
  function tokenizeAnsiWithTheme(theme, fileContents, options) {
365
383
  const colorReplacements = resolveColorReplacements(theme, options);
366
384
  const lines = splitLines(fileContents);
367
- const colorPalette = createColorPalette(Object.fromEntries(namedColors.map((name) => [name, theme.colors?.[`terminal.ansi${name[0].toUpperCase()}${name.substring(1)}`]])));
385
+ const ansiPalette = Object.fromEntries(namedColors.map((name) => {
386
+ const key = `terminal.ansi${name[0].toUpperCase()}${name.substring(1)}`;
387
+ const themeColor = theme.colors?.[key];
388
+ return [name, themeColor || defaultAnsiColors[name]];
389
+ }));
390
+ const colorPalette = createColorPalette(ansiPalette);
368
391
  const parser = createAnsiSequenceParser();
369
392
  return lines.map((line) => parser.parse(line[0]).map((token) => {
370
393
  let color;
@@ -394,7 +417,7 @@ function tokenizeAnsiWithTheme(theme, fileContents, options) {
394
417
  }));
395
418
  }
396
419
  function dimColor(color) {
397
- const hexMatch = color.match(/#([0-9a-f]{3})([0-9a-f]{3})?([0-9a-f]{2})?/);
420
+ const hexMatch = color.match(/#([0-9a-f]{3})([0-9a-f]{3})?([0-9a-f]{2})?/i);
398
421
  if (hexMatch) if (hexMatch[3]) {
399
422
  const alpha = Math.round(Number.parseInt(hexMatch[3], 16) / 2).toString(16).padStart(2, "0");
400
423
  return `#${hexMatch[1]}${hexMatch[2]}${alpha}`;
@@ -1446,6 +1469,11 @@ const bundledLanguagesInfo = [
1446
1469
  "name": "HTTP",
1447
1470
  "import": () => import("@shikijs/langs/http")
1448
1471
  },
1472
+ {
1473
+ "id": "hurl",
1474
+ "name": "Hurl",
1475
+ "import": () => import("@shikijs/langs/hurl")
1476
+ },
1449
1477
  {
1450
1478
  "id": "hxml",
1451
1479
  "name": "HXML",
@@ -1475,7 +1503,11 @@ const bundledLanguagesInfo = [
1475
1503
  {
1476
1504
  "id": "javascript",
1477
1505
  "name": "JavaScript",
1478
- "aliases": ["js"],
1506
+ "aliases": [
1507
+ "js",
1508
+ "cjs",
1509
+ "mjs"
1510
+ ],
1479
1511
  "import": () => import("@shikijs/langs/javascript")
1480
1512
  },
1481
1513
  {
@@ -1530,6 +1562,11 @@ const bundledLanguagesInfo = [
1530
1562
  "aliases": ["jl"],
1531
1563
  "import": () => import("@shikijs/langs/julia")
1532
1564
  },
1565
+ {
1566
+ "id": "kdl",
1567
+ "name": "KDL",
1568
+ "import": () => import("@shikijs/langs/kdl")
1569
+ },
1533
1570
  {
1534
1571
  "id": "kotlin",
1535
1572
  "name": "Kotlin",
@@ -1706,6 +1743,11 @@ const bundledLanguagesInfo = [
1706
1743
  "name": "PHP",
1707
1744
  "import": () => import("@shikijs/langs/php")
1708
1745
  },
1746
+ {
1747
+ "id": "pkl",
1748
+ "name": "Pkl",
1749
+ "import": () => import("@shikijs/langs/pkl")
1750
+ },
1709
1751
  {
1710
1752
  "id": "plsql",
1711
1753
  "name": "PL/SQL",
@@ -1833,6 +1875,11 @@ const bundledLanguagesInfo = [
1833
1875
  "name": "RISC-V",
1834
1876
  "import": () => import("@shikijs/langs/riscv")
1835
1877
  },
1878
+ {
1879
+ "id": "rosmsg",
1880
+ "name": "ROS Interface",
1881
+ "import": () => import("@shikijs/langs/rosmsg")
1882
+ },
1836
1883
  {
1837
1884
  "id": "rst",
1838
1885
  "name": "reStructuredText",
@@ -2038,7 +2085,11 @@ const bundledLanguagesInfo = [
2038
2085
  {
2039
2086
  "id": "typescript",
2040
2087
  "name": "TypeScript",
2041
- "aliases": ["ts"],
2088
+ "aliases": [
2089
+ "ts",
2090
+ "cts",
2091
+ "mts"
2092
+ ],
2042
2093
  "import": () => import("@shikijs/langs/typescript")
2043
2094
  },
2044
2095
  {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mini-shiki",
3
- "version": "3.13.0",
3
+ "version": "3.15.0",
4
4
  "type": "module",
5
5
  "repository": "git+https://github.com/un-ts/mini-shiki.git",
6
6
  "homepage": "https://github.com/un-ts/mini-shiki#readme",
@@ -21,10 +21,10 @@
21
21
  "static"
22
22
  ],
23
23
  "dependencies": {
24
- "@shikijs/engine-oniguruma": "^3.13.0",
25
- "@shikijs/langs": "^3.13.0",
26
- "@shikijs/themes": "^3.13.0",
27
- "@shikijs/types": "^3.13.0",
24
+ "@shikijs/engine-oniguruma": "^3.15.0",
25
+ "@shikijs/langs": "^3.15.0",
26
+ "@shikijs/themes": "^3.15.0",
27
+ "@shikijs/types": "^3.15.0",
28
28
  "@shikijs/vscode-textmate": "^10.0.2"
29
29
  }
30
30
  }