kss-modern 1.2.0-beta.2 → 1.2.0-beta.4

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.
@@ -6,9 +6,17 @@ import fs from 'fs-extra';
6
6
  import { glob } from 'tinyglobby';
7
7
  import { l as logger, s as sanitizeSpecialCharacters, I as INSERT_VITE_PUG_TAG_RE, P as PUG_SRC_RE, a as PUG_ERROR_OVERLAY_TAG, c as compileMarkup, p as pugErrorFile, b as sectionSanitizeId, d as stripPugErrorOverlay, e as ensureStartingSlash, g as generateId, r as replaceWrapperContent } from '../shared/kss-modern.o1Fp758z.mjs';
8
8
  export { f as createLogger } from '../shared/kss-modern.o1Fp758z.mjs';
9
+ import htmlLang from '@shikijs/langs/html';
10
+ import markdownLang from '@shikijs/langs/markdown';
11
+ import scssLang from '@shikijs/langs/scss';
12
+ import shellscriptLang from '@shikijs/langs/shellscript';
13
+ import typescriptLang from '@shikijs/langs/typescript';
9
14
  import { fromAsyncCodeToHtml } from '@shikijs/markdown-it/async';
15
+ import auroraX from '@shikijs/themes/aurora-x';
16
+ import githubLightDefault from '@shikijs/themes/github-light-default';
10
17
  import MarkdownItAsync from 'markdown-it-async';
11
- import { codeToHtml } from 'shiki';
18
+ import { createHighlighterCore } from 'shiki/core';
19
+ import { createJavaScriptRegexEngine } from 'shiki/engine/javascript';
12
20
  import os from 'node:os';
13
21
  import { Worker } from 'node:worker_threads';
14
22
  import fs$1 from 'node:fs/promises';
@@ -350,6 +358,20 @@ function markdownItComponent(md, options) {
350
358
  }
351
359
 
352
360
  let md;
361
+ let highlighter;
362
+ let loadedLanguages;
363
+ async function highlightCodeToHtml(code, options) {
364
+ if (!highlighter) {
365
+ highlighter = await createHighlighterCore({
366
+ themes: [githubLightDefault, auroraX],
367
+ langs: [htmlLang, scssLang, typescriptLang, shellscriptLang, markdownLang],
368
+ engine: createJavaScriptRegexEngine()
369
+ });
370
+ loadedLanguages = new Set(highlighter.getLoadedLanguages());
371
+ }
372
+ const lang = loadedLanguages.has(options.lang) ? options.lang : "text";
373
+ return highlighter.codeToHtml(code, { ...options, lang });
374
+ }
353
375
  function shiftHeadingLevels(markdownContent, rootHeadingLevel) {
354
376
  const getHasHeadingLevel = (level) => new RegExp(`^#{${level}} `, "m").test(markdownContent);
355
377
  const shiftDown = (shiftAmount) => {
@@ -380,7 +402,7 @@ async function parseMarkdown(data) {
380
402
  });
381
403
  md.use(
382
404
  fromAsyncCodeToHtml(
383
- codeToHtml,
405
+ highlightCodeToHtml,
384
406
  {
385
407
  themes: {
386
408
  light: "github-light-default",
@@ -1241,7 +1263,7 @@ async function generateFullPageFile(data) {
1241
1263
  <meta name="theme-color" media="(prefers-color-scheme: light)" content="${data.theme.light}">
1242
1264
  <meta name="theme-color" media="(prefers-color-scheme: dark)" content="${data.theme.dark}">
1243
1265
  ` : `<meta name="theme-color" content="${data.theme}">`}
1244
- <script type="module" src="/styleguide-assets/fullpage-Bm_FdpPi.js"><\/script>
1266
+ <script type="module" src="/styleguide-assets/fullpage-CzaJFxfS.js"><\/script>
1245
1267
  ${computedStyleTags}
1246
1268
  </head>
1247
1269
  <body${data.page.bodyclass ? ` class="${data.page.bodyclass}"` : ""}>
@@ -2198,7 +2220,7 @@ document.addEventListener("DOMContentLoaded", () => {
2198
2220
  //#endregion
2199
2221
  ;
2200
2222
  <\/script>
2201
- <script type="module" src="/styleguide-assets/preview-w33XyCLZ.js"><\/script>
2223
+ <script type="module" src="/styleguide-assets/preview-ChQyjhUb.js"><\/script>
2202
2224
  <link rel="preload" href="/styleguide-assets/fonts/geist-mono-latin-400-normal.woff2" as="font" type="font/woff2" crossorigin="anonymous">
2203
2225
  <link rel="preload" href="/styleguide-assets/fonts/geist-mono-latin-600-normal.woff2" as="font" type="font/woff2" crossorigin="anonymous">
2204
2226
  <link rel="preload" href="/styleguide-assets/fonts/geist-mono-latin-300-normal.woff2" as="font" type="font/woff2" crossorigin="anonymous">
@@ -1,12 +1,16 @@
1
1
  {
2
- "_animate-BwJZPSbF.js": {
3
- "file": "animate-BwJZPSbF.js",
2
+ "_animate-DRGZltJ3.js": {
3
+ "file": "animate-DRGZltJ3.js",
4
4
  "name": "animate"
5
5
  },
6
- "_code-highlight-ClkzHTGA.js": {
7
- "file": "code-highlight-ClkzHTGA.js",
6
+ "_code-highlight-BygtMiLu.js": {
7
+ "file": "code-highlight-BygtMiLu.js",
8
8
  "name": "code-highlight"
9
9
  },
10
+ "_rolldown-runtime-B1bRi_D7.js": {
11
+ "file": "rolldown-runtime-B1bRi_D7.js",
12
+ "name": "rolldown-runtime"
13
+ },
10
14
  "_shared-hGcWlnRM.js": {
11
15
  "file": "shared-hGcWlnRM.js",
12
16
  "name": "shared"
@@ -20,11 +24,12 @@
20
24
  "name": "utils"
21
25
  },
22
26
  "client/fullpage.ts": {
23
- "file": "fullpage-Bm_FdpPi.js",
27
+ "file": "fullpage-CzaJFxfS.js",
24
28
  "name": "fullpage",
25
29
  "src": "client/fullpage.ts",
26
30
  "isEntry": true,
27
31
  "imports": [
32
+ "_rolldown-runtime-B1bRi_D7.js",
28
33
  "_shared-hGcWlnRM.js"
29
34
  ],
30
35
  "dynamicImports": [
@@ -33,14 +38,14 @@
33
38
  ]
34
39
  },
35
40
  "client/lib/clipboard.ts": {
36
- "file": "clipboard-BqN2XQ0C.js",
41
+ "file": "clipboard-0X6xnPVo.js",
37
42
  "name": "clipboard",
38
43
  "src": "client/lib/clipboard.ts",
39
44
  "isDynamicEntry": true,
40
45
  "imports": [
46
+ "_animate-DRGZltJ3.js",
41
47
  "_signal-ZVBNTRLw.js",
42
- "_utils-DrMb1LbR.js",
43
- "_animate-BwJZPSbF.js"
48
+ "_utils-DrMb1LbR.js"
44
49
  ]
45
50
  },
46
51
  "client/lib/editor-select.ts": {
@@ -50,24 +55,24 @@
50
55
  "isDynamicEntry": true
51
56
  },
52
57
  "client/lib/html-validator.ts": {
53
- "file": "html-validator-B4XHcC9W.js",
58
+ "file": "html-validator-CeH3wXbU.js",
54
59
  "name": "html-validator",
55
60
  "src": "client/lib/html-validator.ts",
56
61
  "isDynamicEntry": true,
57
62
  "imports": [
58
- "_code-highlight-ClkzHTGA.js",
63
+ "_code-highlight-BygtMiLu.js",
59
64
  "_utils-DrMb1LbR.js",
60
65
  "_shared-hGcWlnRM.js"
61
66
  ]
62
67
  },
63
68
  "client/lib/icons.ts": {
64
- "file": "icons-DICmq5xt.js",
69
+ "file": "icons-Do1H6FzJ.js",
65
70
  "name": "icons",
66
71
  "src": "client/lib/icons.ts",
67
72
  "isDynamicEntry": true,
68
73
  "imports": [
69
- "_utils-DrMb1LbR.js",
70
- "_animate-BwJZPSbF.js"
74
+ "_animate-DRGZltJ3.js",
75
+ "_utils-DrMb1LbR.js"
71
76
  ]
72
77
  },
73
78
  "client/preview-inline.ts": {
@@ -77,15 +82,15 @@
77
82
  "isEntry": true
78
83
  },
79
84
  "client/preview.ts": {
80
- "file": "preview-w33XyCLZ.js",
85
+ "file": "preview-ChQyjhUb.js",
81
86
  "name": "preview",
82
87
  "src": "client/preview.ts",
83
88
  "isEntry": true,
84
89
  "imports": [
85
- "_code-highlight-ClkzHTGA.js",
90
+ "_animate-DRGZltJ3.js",
91
+ "_code-highlight-BygtMiLu.js",
86
92
  "_signal-ZVBNTRLw.js",
87
- "_utils-DrMb1LbR.js",
88
- "_animate-BwJZPSbF.js"
93
+ "_utils-DrMb1LbR.js"
89
94
  ],
90
95
  "dynamicImports": [
91
96
  "client/lib/html-validator.ts",
@@ -95,21 +100,21 @@
95
100
  ]
96
101
  },
97
102
  "node_modules/axe-core/axe.js": {
98
- "file": "axe-DInlcoey.js",
103
+ "file": "axe-B09yVm_c.js",
99
104
  "name": "axe",
100
105
  "src": "node_modules/axe-core/axe.js",
101
106
  "isDynamicEntry": true,
102
107
  "imports": [
103
- "client/fullpage.ts"
108
+ "_rolldown-runtime-B1bRi_D7.js"
104
109
  ]
105
110
  },
106
111
  "node_modules/html-validate/dist/esm/browser.js": {
107
- "file": "browser-DRrrjwZN.js",
112
+ "file": "browser-BgMZpraI.js",
108
113
  "name": "browser",
109
114
  "src": "node_modules/html-validate/dist/esm/browser.js",
110
115
  "isDynamicEntry": true,
111
116
  "imports": [
112
- "client/fullpage.ts"
117
+ "_rolldown-runtime-B1bRi_D7.js"
113
118
  ]
114
119
  },
115
120
  "style.css": {