@shikijs/cli 3.2.1 → 3.2.2

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.
package/dist/cli.mjs CHANGED
@@ -1,23 +1,23 @@
1
1
  import fs from 'node:fs/promises';
2
2
  import { parse } from 'node:path';
3
3
  import process from 'node:process';
4
- import minimist from 'minimist';
5
- import { c as codeToANSI } from './shared/cli.yIlX_F3O.mjs';
4
+ import cac from 'cac';
5
+ import { c as codeToANSI } from './shared/cli.Ddl0vE4t.mjs';
6
6
  import '@shikijs/vscode-textmate';
7
7
  import 'ansis';
8
8
  import 'shiki';
9
9
 
10
- async function run(argv = process.argv.slice(2), log = console.log) {
11
- const options = minimist(argv);
12
- const {
13
- theme = "vitesse-dark",
14
- lang = void 0,
15
- _: files = []
16
- } = options;
10
+ const version = "3.2.2";
11
+
12
+ async function run(argv = process.argv, log = console.log) {
13
+ const cli = cac("shiki");
14
+ cli.option("--theme <theme>", "Color theme to use", { default: "vitesse-dark" }).option("--lang <lang>", "Programming language").help().version(version);
15
+ const { options, args } = cli.parse(argv);
16
+ const files = args;
17
17
  const codes = await Promise.all(files.map(async (path) => {
18
18
  const content = await fs.readFile(path, "utf-8");
19
- const ext = lang || parse(path).ext.slice(1);
20
- return await codeToANSI(content, ext, theme);
19
+ const ext = options.lang || parse(path).ext.slice(1);
20
+ return await codeToANSI(content, ext, options.theme);
21
21
  }));
22
22
  for (const code of codes)
23
23
  log(code);
package/dist/index.mjs CHANGED
@@ -1,4 +1,4 @@
1
- export { c as codeToANSI } from './shared/cli.yIlX_F3O.mjs';
1
+ export { c as codeToANSI } from './shared/cli.Ddl0vE4t.mjs';
2
2
  import '@shikijs/vscode-textmate';
3
3
  import 'ansis';
4
4
  import 'shiki';
@@ -55,6 +55,8 @@ async function codeToANSI(code, lang, theme) {
55
55
  text = c.italic(text);
56
56
  if (token.fontStyle & FontStyle.Underline)
57
57
  text = c.underline(text);
58
+ if (token.fontStyle & FontStyle.Strikethrough)
59
+ text = c.strikethrough(text);
58
60
  }
59
61
  output += text;
60
62
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@shikijs/cli",
3
3
  "type": "module",
4
- "version": "3.2.1",
4
+ "version": "3.2.2",
5
5
  "description": "Shiki in the command line",
6
6
  "author": "Anthony Fu <anthonyfu117@hotmail.com>",
7
7
  "license": "MIT",
@@ -38,11 +38,8 @@
38
38
  "dependencies": {
39
39
  "@shikijs/vscode-textmate": "^10.0.2",
40
40
  "ansis": "^3.17.0",
41
- "minimist": "^1.2.8",
42
- "shiki": "3.2.1"
43
- },
44
- "devDependencies": {
45
- "@types/minimist": "^1.2.5"
41
+ "cac": "^6.7.14",
42
+ "shiki": "3.2.2"
46
43
  },
47
44
  "scripts": {
48
45
  "build": "unbuild",