@shikijs/core 3.18.0 → 3.19.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/index.mjs +23 -14
- package/package.json +9 -2
package/dist/index.mjs
CHANGED
|
@@ -1306,7 +1306,7 @@ function codeToHast(internal, code, options, transformerContext = {
|
|
|
1306
1306
|
fg,
|
|
1307
1307
|
bg,
|
|
1308
1308
|
themeName,
|
|
1309
|
-
rootStyle
|
|
1309
|
+
rootStyle: options.rootStyle === false ? false : options.rootStyle ?? rootStyle
|
|
1310
1310
|
},
|
|
1311
1311
|
contextSource,
|
|
1312
1312
|
grammarState
|
|
@@ -1323,21 +1323,25 @@ function tokensToHast(tokens, options, transformerContext, grammarState = getLas
|
|
|
1323
1323
|
structure = "classic",
|
|
1324
1324
|
tabindex = "0"
|
|
1325
1325
|
} = options;
|
|
1326
|
+
const properties = {
|
|
1327
|
+
class: `shiki ${options.themeName || ""}`
|
|
1328
|
+
};
|
|
1329
|
+
if (options.rootStyle !== false) {
|
|
1330
|
+
if (options.rootStyle != null)
|
|
1331
|
+
properties.style = options.rootStyle;
|
|
1332
|
+
else
|
|
1333
|
+
properties.style = `background-color:${options.bg};color:${options.fg}`;
|
|
1334
|
+
}
|
|
1335
|
+
if (tabindex !== false && tabindex != null)
|
|
1336
|
+
properties.tabindex = tabindex.toString();
|
|
1337
|
+
for (const [key, value] of Object.entries(options.meta || {})) {
|
|
1338
|
+
if (!key.startsWith("_"))
|
|
1339
|
+
properties[key] = value;
|
|
1340
|
+
}
|
|
1326
1341
|
let preNode = {
|
|
1327
1342
|
type: "element",
|
|
1328
1343
|
tagName: "pre",
|
|
1329
|
-
properties
|
|
1330
|
-
class: `shiki ${options.themeName || ""}`,
|
|
1331
|
-
style: options.rootStyle || `background-color:${options.bg};color:${options.fg}`,
|
|
1332
|
-
...tabindex !== false && tabindex != null ? {
|
|
1333
|
-
tabindex: tabindex.toString()
|
|
1334
|
-
} : {},
|
|
1335
|
-
...Object.fromEntries(
|
|
1336
|
-
Array.from(
|
|
1337
|
-
Object.entries(options.meta || {})
|
|
1338
|
-
).filter(([key]) => !key.startsWith("_"))
|
|
1339
|
-
)
|
|
1340
|
-
},
|
|
1344
|
+
properties,
|
|
1341
1345
|
children: []
|
|
1342
1346
|
};
|
|
1343
1347
|
let codeNode = {
|
|
@@ -1824,7 +1828,12 @@ class Registry extends Registry$1 {
|
|
|
1824
1828
|
const langsGraphArray = Array.from(this._langGraph.entries());
|
|
1825
1829
|
const missingLangs = langsGraphArray.filter(([_, lang]) => !lang);
|
|
1826
1830
|
if (missingLangs.length) {
|
|
1827
|
-
const dependents = langsGraphArray.filter(([_, lang]) =>
|
|
1831
|
+
const dependents = langsGraphArray.filter(([_, lang]) => {
|
|
1832
|
+
if (!lang)
|
|
1833
|
+
return false;
|
|
1834
|
+
const embedded = lang.embeddedLanguages || lang.embeddedLangs;
|
|
1835
|
+
return embedded?.some((l) => missingLangs.map(([name]) => name).includes(l));
|
|
1836
|
+
}).filter((lang) => !missingLangs.includes(lang));
|
|
1828
1837
|
throw new ShikiError(`Missing languages ${missingLangs.map(([name]) => `\`${name}\``).join(", ")}, required by ${dependents.map(([name]) => `\`${name}\``).join(", ")}`);
|
|
1829
1838
|
}
|
|
1830
1839
|
for (const [_, lang] of langsGraphArray)
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@shikijs/core",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "3.
|
|
4
|
+
"version": "3.19.0",
|
|
5
5
|
"description": "Core of Shiki",
|
|
6
6
|
"author": "Pine Wu <octref@gmail.com>; Anthony Fu <anthonyfu117@hotmail.com>",
|
|
7
7
|
"license": "MIT",
|
|
@@ -32,6 +32,13 @@
|
|
|
32
32
|
"main": "./dist/index.mjs",
|
|
33
33
|
"module": "./dist/index.mjs",
|
|
34
34
|
"types": "./dist/index.d.mts",
|
|
35
|
+
"typesVersions": {
|
|
36
|
+
"*": {
|
|
37
|
+
"types": [
|
|
38
|
+
"./dist/types.d.mts"
|
|
39
|
+
]
|
|
40
|
+
}
|
|
41
|
+
},
|
|
35
42
|
"files": [
|
|
36
43
|
"dist"
|
|
37
44
|
],
|
|
@@ -39,7 +46,7 @@
|
|
|
39
46
|
"@shikijs/vscode-textmate": "^10.0.2",
|
|
40
47
|
"@types/hast": "^3.0.4",
|
|
41
48
|
"hast-util-to-html": "^9.0.5",
|
|
42
|
-
"@shikijs/types": "3.
|
|
49
|
+
"@shikijs/types": "3.19.0"
|
|
43
50
|
},
|
|
44
51
|
"scripts": {
|
|
45
52
|
"build": "unbuild",
|