shiki-codegen 4.0.1 → 4.1.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
@@ -2,14 +2,14 @@ import { codegen } from "./index.mjs";
2
2
  import fs from "node:fs/promises";
3
3
  import { dirname, resolve } from "node:path";
4
4
  import { cac } from "cac";
5
-
6
5
  //#region src/cli.ts
6
+ const RE_TYPESCRIPT_EXT = /\.[cm]?ts$/i;
7
7
  const cli = cac("shiki-codegen");
8
8
  cli.command("[path]", "Generate shiki bundle module").option("--themes <themes>", "Themes to include").option("--langs <langs>", "Languages to include").option("--engine <engine>", "Engine to use", { default: "javascript" }).option("--precompiled", "Use precompiled languages", { default: false }).option("--shorthands", "Generate shorthands", { default: true }).option("--format", "Use prettier to format", { default: true }).action(async (path, options) => {
9
9
  const output = resolve(path || "shiki.bundle.ts");
10
10
  const langs = (Array.isArray(options.langs) ? options.langs.join(",") : options.langs || "").split(",").map((lang) => lang.trim()).filter(Boolean);
11
11
  const themes = (Array.isArray(options.themes) ? options.themes.join(",") : options.themes || "").split(",").map((theme) => theme.trim()).filter(Boolean);
12
- const isTypeScript = !!output.match(/\.[cm]?ts$/i);
12
+ const isTypeScript = !!output.match(RE_TYPESCRIPT_EXT);
13
13
  if (!themes.length) throw new Error("No themes specified, use --themes=theme-name to specify themes");
14
14
  if (!langs.length) throw new Error("No langs specified, use --langs=lang-name to specify langs");
15
15
  const { code } = await codegen({
@@ -27,6 +27,5 @@ cli.command("[path]", "Generate shiki bundle module").option("--themes <themes>"
27
27
  });
28
28
  cli.help();
29
29
  cli.parse();
30
-
31
30
  //#endregion
32
- export { };
31
+ export {};
package/dist/index.mjs CHANGED
@@ -1,5 +1,4 @@
1
1
  import { bundledLanguagesInfo, bundledThemesInfo } from "shiki/bundle/full";
2
-
3
2
  //#region src/index.ts
4
3
  async function codegen(options) {
5
4
  const { header = "/* Generate by @shikijs/codegen */", typescript = true, precompiled = false, format: _format = true, shorthands = true } = options;
@@ -90,6 +89,5 @@ async function codegen(options) {
90
89
  }
91
90
  return { code };
92
91
  }
93
-
94
92
  //#endregion
95
- export { codegen };
93
+ export { codegen };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "shiki-codegen",
3
3
  "type": "module",
4
- "version": "4.0.1",
4
+ "version": "4.1.0",
5
5
  "description": "Codegen for fine-grained Shiki bundles.",
6
6
  "author": "Anthony Fu <anthonyfu117@hotmail.com>",
7
7
  "license": "MIT",
@@ -36,8 +36,8 @@
36
36
  },
37
37
  "dependencies": {
38
38
  "cac": "^7.0.0",
39
- "prettier": "^3.8.1",
40
- "shiki": "4.0.1"
39
+ "prettier": "^3.8.3",
40
+ "shiki": "4.1.0"
41
41
  },
42
42
  "scripts": {
43
43
  "build": "tsdown",