@shikijs/cli 3.2.1 → 3.3.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.
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
|
|
5
|
-
import { c as codeToANSI } from './shared/cli.
|
|
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
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
10
|
+
const version = "3.3.0";
|
|
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
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@shikijs/cli",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "3.
|
|
4
|
+
"version": "3.3.0",
|
|
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
|
-
"
|
|
42
|
-
"shiki": "3.
|
|
43
|
-
},
|
|
44
|
-
"devDependencies": {
|
|
45
|
-
"@types/minimist": "^1.2.5"
|
|
41
|
+
"cac": "^6.7.14",
|
|
42
|
+
"shiki": "3.3.0"
|
|
46
43
|
},
|
|
47
44
|
"scripts": {
|
|
48
45
|
"build": "unbuild",
|