@elmethis/core 1.0.0-alpha.155 → 1.0.0-alpha.156

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.
@@ -1,5 +1,5 @@
1
1
  import { defineComponent, ref, onMounted, onServerPrefetch, createElementBlock, openBlock, normalizeClass, createElementVNode } from "vue";
2
- import { createHighlighter } from "shiki";
2
+ import { getHighlighterSingleton } from "./shikiInstance.mjs";
3
3
  const _hoisted_1 = ["innerHTML"];
4
4
  const _sfc_main = /* @__PURE__ */ defineComponent({
5
5
  __name: "ElmShikiHighlighter",
@@ -13,10 +13,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
13
13
  const html = ref(`<pre>${props.code}</pre>`);
14
14
  const render = async () => {
15
15
  if (!isRendered.value) {
16
- const highlighter = await createHighlighter({
17
- langs: [props.language],
18
- themes: ["vitesse-light", "vitesse-dark"]
19
- });
16
+ const highlighter = await getHighlighterSingleton();
20
17
  html.value = highlighter.codeToHtml(props.code, {
21
18
  lang: props.language,
22
19
  themes: {
@@ -0,0 +1,2 @@
1
+ import { Highlighter } from 'shiki';
2
+ export declare function getHighlighterSingleton(): Promise<Highlighter>;
@@ -0,0 +1,75 @@
1
+ import { createHighlighter } from "shiki";
2
+ let highlighterPromise = null;
3
+ function getHighlighterSingleton() {
4
+ if (!highlighterPromise) {
5
+ highlighterPromise = createHighlighter({
6
+ langs: [
7
+ "abap",
8
+ "bash",
9
+ "c",
10
+ "clojure",
11
+ "coffeescript",
12
+ "c++",
13
+ "c#",
14
+ "css",
15
+ "dart",
16
+ "diff",
17
+ "docker",
18
+ "elixir",
19
+ "elm",
20
+ "erlang",
21
+ "f#",
22
+ "gherkin",
23
+ "glsl",
24
+ "go",
25
+ "graphql",
26
+ "groovy",
27
+ "haskell",
28
+ "html",
29
+ "java",
30
+ "javascript",
31
+ "json",
32
+ "julia",
33
+ "kotlin",
34
+ "latex",
35
+ "less",
36
+ "lisp",
37
+ "lua",
38
+ "makefile",
39
+ "markdown",
40
+ "matlab",
41
+ "mermaid",
42
+ "nix",
43
+ "objective-c",
44
+ "ocaml",
45
+ "pascal",
46
+ "perl",
47
+ "php",
48
+ "plaintext",
49
+ "powershell",
50
+ "prolog",
51
+ "protobuf",
52
+ "python",
53
+ "r",
54
+ "ruby",
55
+ "rust",
56
+ "sass",
57
+ "scala",
58
+ "scheme",
59
+ "scss",
60
+ "shell",
61
+ "sql",
62
+ "swift",
63
+ "typescript",
64
+ "wasm",
65
+ "xml",
66
+ "yaml"
67
+ ],
68
+ themes: ["vitesse-light", "vitesse-dark"]
69
+ });
70
+ }
71
+ return highlighterPromise;
72
+ }
73
+ export {
74
+ getHighlighterSingleton
75
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@elmethis/core",
3
- "version": "1.0.0-alpha.155",
3
+ "version": "1.0.0-alpha.156",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },