@bikariya/shiki 0.0.4 → 0.0.5

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/README.md ADDED
@@ -0,0 +1,36 @@
1
+ # @bikariya/shiki
2
+
3
+ Shiki 集成,基于 [Pinia](https://pinia.vuejs.org)。
4
+
5
+ ## 安装
6
+
7
+ ```bash
8
+ pnpm i -D @bikariya/shiki
9
+ ```
10
+
11
+ ## 使用方式
12
+
13
+ 1. 在 `nuxt.config.ts` 中添加模块:
14
+
15
+ ```ts
16
+ export default defineNuxtConfig({
17
+ modules: [
18
+ "@bikariya/shiki",
19
+ ],
20
+ });
21
+ ```
22
+
23
+ 2. 在 `app` 目录下创建 `shiki.config.ts`:
24
+
25
+ ```ts
26
+ import { defineConfig } from "#shiki/config";
27
+
28
+ export default defineConfig({
29
+ themes: {
30
+ light: () => import("shiki/themes/min-light.mjs"),
31
+ dark: () => import("shiki/themes/min-dark.mjs"),
32
+ },
33
+ });
34
+ ```
35
+
36
+ 3. 参照[集成示例](/playground/app/components/simple-shiki.vue)。
package/dist/module.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@bikariya/shiki",
3
3
  "configKey": "shiki",
4
- "version": "0.0.4",
4
+ "version": "0.0.5",
5
5
  "builder": {
6
6
  "@nuxt/module-builder": "1.0.2",
7
7
  "unbuild": "3.6.1"
package/dist/module.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { defineNuxtModule, createResolver, addImportsDir } from '@nuxt/kit';
1
+ import { defineNuxtModule, createResolver, addImportsSources } from '@nuxt/kit';
2
2
 
3
3
  const name = "@bikariya/shiki";
4
4
  const packageJson = {
@@ -14,7 +14,12 @@ const module$1 = defineNuxtModule({
14
14
  },
15
15
  setup(options, nuxt) {
16
16
  const resolver = createResolver(import.meta.url);
17
- addImportsDir(resolver.resolve("runtime/stores"));
17
+ addImportsSources({
18
+ from: resolver.resolve("runtime/store"),
19
+ imports: [
20
+ "useShikiStore"
21
+ ]
22
+ });
18
23
  nuxt.options.alias["#shiki/config"] = resolver.resolve("runtime/config");
19
24
  }
20
25
  });
@@ -31,8 +31,13 @@ export const useShikiStore = defineStore("shiki", () => {
31
31
  void /(?i: )/;
32
32
  engine = createJavaScriptRegexEngine();
33
33
  } catch {
34
- const { createOnigurumaEngine } = await import("shiki/engine-oniguruma.mjs");
35
- engine = await createOnigurumaEngine(import("https://esm.sh/shiki/wasm"));
34
+ const [{ createOnigurumaEngine }, wasm] = await Promise.all([
35
+ // @ts-expect-error TS2307
36
+ import("https://esm.sh/shiki/engine-oniguruma.mjs"),
37
+ // @ts-expect-error TS2307
38
+ import("https://esm.sh/shiki/wasm")
39
+ ]);
40
+ engine = await createOnigurumaEngine(wasm);
36
41
  }
37
42
  Object.assign(options, {
38
43
  ...config,
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@bikariya/shiki",
3
3
  "type": "module",
4
- "version": "0.0.4",
4
+ "version": "0.0.5",
5
5
  "description": "Bikariya shiki for Nuxt",
6
6
  "author": "KazariEX",
7
7
  "license": "MIT",
File without changes