@astrojs/markdown-remark 7.0.0-beta.6 → 7.0.0-beta.8

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.
@@ -0,0 +1,2 @@
1
+ import type { RegexEngine } from 'shiki';
2
+ export declare function loadShikiEngine(): Promise<RegexEngine>;
@@ -0,0 +1,7 @@
1
+ import { createOnigurumaEngine } from "shiki/engine/oniguruma";
2
+ function loadShikiEngine() {
3
+ return createOnigurumaEngine(import("shiki/wasm"));
4
+ }
5
+ export {
6
+ loadShikiEngine
7
+ };
@@ -0,0 +1,2 @@
1
+ import type { RegexEngine } from 'shiki';
2
+ export declare function loadShikiEngine(): Promise<RegexEngine>;
@@ -0,0 +1,7 @@
1
+ import { createOnigurumaEngine } from "shiki/engine/oniguruma";
2
+ function loadShikiEngine() {
3
+ return createOnigurumaEngine(import("shiki/onig.wasm"));
4
+ }
5
+ export {
6
+ loadShikiEngine
7
+ };
package/dist/shiki.d.ts CHANGED
@@ -41,3 +41,4 @@ export interface ShikiHighlighterHighlightOptions {
41
41
  meta?: string;
42
42
  }
43
43
  export declare function createShikiHighlighter({ langs, theme, themes, langAlias, }?: CreateShikiHighlighterOptions): Promise<ShikiHighlighter>;
44
+ export type { ThemePresets };
package/dist/shiki.js CHANGED
@@ -3,11 +3,13 @@ import {
3
3
  createHighlighter,
4
4
  isSpecialLang
5
5
  } from "shiki";
6
+ import { loadShikiEngine } from "#shiki-engine";
6
7
  let _cssVariablesTheme;
7
8
  const cssVariablesTheme = () => _cssVariablesTheme ?? (_cssVariablesTheme = createCssVariablesTheme({
8
9
  variablePrefix: "--astro-code-"
9
10
  }));
10
11
  const cachedHighlighters = /* @__PURE__ */ new Map();
12
+ let shikiEngine = void 0;
11
13
  async function createShikiHighlighter({
12
14
  langs = [],
13
15
  theme = "github-dark",
@@ -15,10 +17,14 @@ async function createShikiHighlighter({
15
17
  langAlias = {}
16
18
  } = {}) {
17
19
  theme = theme === "css-variables" ? cssVariablesTheme() : theme;
20
+ if (shikiEngine === void 0) {
21
+ shikiEngine = await loadShikiEngine();
22
+ }
18
23
  const highlighterOptions = {
19
24
  langs: ["plaintext", ...langs],
20
25
  langAlias,
21
- themes: Object.values(themes).length ? Object.values(themes) : [theme]
26
+ themes: Object.values(themes).length ? Object.values(themes) : [theme],
27
+ engine: shikiEngine
22
28
  };
23
29
  const key = JSON.stringify(highlighterOptions, Object.keys(highlighterOptions).sort());
24
30
  let highlighter;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@astrojs/markdown-remark",
3
- "version": "7.0.0-beta.6",
3
+ "version": "7.0.0-beta.8",
4
4
  "type": "module",
5
5
  "author": "withastro",
6
6
  "license": "MIT",
@@ -13,12 +13,17 @@
13
13
  "homepage": "https://astro.build",
14
14
  "main": "./dist/index.js",
15
15
  "exports": {
16
- ".": "./dist/index.js"
16
+ ".": "./dist/index.js",
17
+ "./shiki": "./dist/shiki.js"
17
18
  },
18
19
  "imports": {
19
20
  "#import-plugin": {
20
21
  "browser": "./dist/import-plugin-browser.js",
21
22
  "default": "./dist/import-plugin-default.js"
23
+ },
24
+ "#shiki-engine": {
25
+ "workerd": "./dist/shiki-engine-workerd.js",
26
+ "default": "./dist/shiki-engine-default.js"
22
27
  }
23
28
  },
24
29
  "files": [
@@ -52,7 +57,7 @@
52
57
  "@types/js-yaml": "^4.0.9",
53
58
  "@types/mdast": "^4.0.4",
54
59
  "@types/unist": "^3.0.3",
55
- "esbuild": "^0.24.2",
60
+ "esbuild": "^0.27.3",
56
61
  "mdast-util-mdx-expression": "^2.0.1",
57
62
  "astro-scripts": "0.0.14"
58
63
  },