vuepress-plugin-md-power 1.0.0-rc.108 → 1.0.0-rc.110

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.
Files changed (2) hide show
  1. package/lib/node/index.js +13 -12
  2. package/package.json +4 -3
package/lib/node/index.js CHANGED
@@ -1226,8 +1226,8 @@ function resolveTreeNodeInfo(tokens, current, idx) {
1226
1226
  }
1227
1227
  if (!hasInline)
1228
1228
  return void 0;
1229
- const children = inline.children?.filter((token) => token.type === "text" && token.content || token.tag === "strong") || [];
1230
- const filename = children.filter((token) => token.type === "text").map((token) => token.content).join(" ").split(/\s+/)[0] ?? "";
1229
+ const children = inline.children.filter((token) => token.type === "text" && token.content || token.tag === "strong");
1230
+ const filename = children.filter((token) => token.type === "text").map((token) => token.content).join(" ").split(/\s+/)[0];
1231
1231
  const focus = children[0]?.tag === "strong";
1232
1232
  const type2 = hasChildren || filename.endsWith("/") ? "folder" : "file";
1233
1233
  const info = {
@@ -1241,8 +1241,6 @@ function resolveTreeNodeInfo(tokens, current, idx) {
1241
1241
  }
1242
1242
  function updateInlineToken(inline, info, icon) {
1243
1243
  const children = inline.children;
1244
- if (!children || children.length === 0)
1245
- return;
1246
1244
  const tokens = [];
1247
1245
  const wrapperOpen = new Token("span_open", "span", 1);
1248
1246
  const wrapperClose = new Token("span_close", "span", -1);
@@ -1300,8 +1298,10 @@ function updateInlineToken(inline, info, icon) {
1300
1298
  }
1301
1299
 
1302
1300
  // src/node/container/langRepl.ts
1301
+ import { promises as fs2 } from "node:fs";
1302
+ import { resolveModule } from "local-pkg";
1303
1303
  import container3 from "markdown-it-container";
1304
- import { fs as fs2, getDirname, path as path2 } from "vuepress/utils";
1304
+ import { path as path2 } from "vuepress/utils";
1305
1305
  var RE_INFO = /^(#editable)?(.*)$/;
1306
1306
  function createReplContainer(md, lang) {
1307
1307
  const type2 = `${lang}-repl`;
@@ -1309,7 +1309,7 @@ function createReplContainer(md, lang) {
1309
1309
  const render = (tokens, index) => {
1310
1310
  const token = tokens[index];
1311
1311
  const info = token.info.trim().slice(type2.length).trim() || "";
1312
- const [, editable, title] = info.match(RE_INFO) ?? [];
1312
+ const [, editable, title] = info.match(RE_INFO);
1313
1313
  if (token.nesting === 1)
1314
1314
  return `<CodeRepl ${editable ? "editable" : ""} title="${title || `${lang} playground`}">`;
1315
1315
  else
@@ -1334,8 +1334,8 @@ async function langReplPlugin(app, md, {
1334
1334
  }
1335
1335
  theme ??= { light: "github-light", dark: "github-dark" };
1336
1336
  const data = { grammars: {} };
1337
- const themesPath = getDirname(import.meta.resolve("tm-themes"));
1338
- const grammarsPath = getDirname(import.meta.resolve("tm-grammars"));
1337
+ const themesPath = path2.dirname(resolveModule("tm-themes"));
1338
+ const grammarsPath = path2.dirname(resolveModule("tm-grammars"));
1339
1339
  const readTheme = (theme2) => read(path2.join(themesPath, "themes", `${theme2}.json`));
1340
1340
  const readGrammar = (grammar) => read(path2.join(grammarsPath, "grammars", `${grammar}.json`));
1341
1341
  if (typeof theme === "string") {
@@ -1563,7 +1563,7 @@ function npmToPlugins(md, options = {}) {
1563
1563
  if (tokens[idx].nesting === 1) {
1564
1564
  const token = tokens[idx + 1];
1565
1565
  const info = token.info.trim();
1566
- if (token.type === "fence" && (info.startsWith("sh") || info.startsWith("bash") || info.startsWith("shell"))) {
1566
+ if (token.type === "fence") {
1567
1567
  const content = token.content;
1568
1568
  token.hidden = true;
1569
1569
  token.type = "text";
@@ -2271,9 +2271,9 @@ function inlineSyntaxPlugin(md, options) {
2271
2271
 
2272
2272
  // src/node/prepareConfigFile.ts
2273
2273
  import { ensureEndingSlash } from "@vuepress/helper";
2274
- import { getDirname as getDirname2, path as path4 } from "vuepress/utils";
2274
+ import { getDirname, path as path4 } from "vuepress/utils";
2275
2275
  var { url: filepath } = import.meta;
2276
- var __dirname = getDirname2(filepath);
2276
+ var __dirname = getDirname(filepath);
2277
2277
  var CLIENT_FOLDER = ensureEndingSlash(
2278
2278
  path4.resolve(__dirname, "../client")
2279
2279
  );
@@ -2344,7 +2344,7 @@ function markdownPowerPlugin(options = {}) {
2344
2344
  },
2345
2345
  extendsBundlerOptions(bundlerOptions, app) {
2346
2346
  if (options.repl) {
2347
- addViteOptimizeDepsInclude(bundlerOptions, app, ["shiki/core", "shiki/wasm"]);
2347
+ addViteOptimizeDepsInclude(bundlerOptions, app, ["shiki/core", "shiki/wasm", "shiki/engine/oniguruma"]);
2348
2348
  }
2349
2349
  },
2350
2350
  extendsMarkdown: async (md, app) => {
@@ -2359,3 +2359,4 @@ export {
2359
2359
  markdownPowerPlugin,
2360
2360
  resolveImageSize
2361
2361
  };
2362
+ /* istanbul ignore if -- @preserve */
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "vuepress-plugin-md-power",
3
3
  "type": "module",
4
- "version": "1.0.0-rc.108",
4
+ "version": "1.0.0-rc.110",
5
5
  "description": "The Plugin for VuePress 2 - markdown power",
6
6
  "author": "pengzhanbo <volodymyr@foxmail.com>",
7
7
  "license": "MIT",
@@ -32,7 +32,7 @@
32
32
  ],
33
33
  "peerDependencies": {
34
34
  "markdown-it": "^14.0.0",
35
- "vuepress": "2.0.0-rc.17"
35
+ "vuepress": "2.0.0-rc.18"
36
36
  },
37
37
  "peerDependenciesMeta": {
38
38
  "markdown-it": {
@@ -47,9 +47,10 @@
47
47
  "@mdit/plugin-sup": "^0.13.1",
48
48
  "@mdit/plugin-tab": "^0.13.2",
49
49
  "@mdit/plugin-tasklist": "^0.13.1",
50
- "@vuepress/helper": "2.0.0-rc.52",
50
+ "@vuepress/helper": "2.0.0-rc.55",
51
51
  "@vueuse/core": "^11.1.0",
52
52
  "image-size": "^1.1.1",
53
+ "local-pkg": "^0.5.0",
53
54
  "markdown-it-container": "^4.0.0",
54
55
  "nanoid": "^5.0.7",
55
56
  "shiki": "^1.22.0",