vitepress 1.1.4 → 1.2.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.
@@ -1,25 +1,29 @@
1
1
  import { createHash } from 'crypto';
2
2
  import { createRequire } from 'module';
3
- import path$q, { win32, posix as posix$1, resolve as resolve$1, parse as parse$b, basename, join, dirname, normalize as normalize$3 } from 'path';
4
- import path$r from 'node:path';
3
+ import path$q, { resolve as resolve$1, parse as parse$b, basename, join, dirname, normalize as normalize$3 } from 'path';
4
+ import path$r, { win32, posix as posix$1 } from 'node:path';
5
5
  import process$2, { stdin, stdout } from 'node:process';
6
- import 'node:fs/promises';
6
+ import { lstat as lstat$4, readdir as readdir$5, readlink, realpath } from 'node:fs/promises';
7
7
  import { fileURLToPath } from 'node:url';
8
- import fs$u from 'node:fs';
9
- import require$$3, { fileURLToPath as fileURLToPath$1, URL as URL$1, pathToFileURL } from 'url';
10
- import * as fs$t from 'fs';
8
+ import * as fs$t from 'node:fs';
9
+ import fs__default$1 from 'node:fs';
10
+ import * as fs$u from 'fs';
11
11
  import fs__default, { realpathSync as realpathSync$1, lstatSync, readdir as readdir$4, readdirSync as readdirSync$1, readlinkSync, unlinkSync, rmdirSync, chmodSync, statSync as statSync$1, renameSync, rmSync } from 'fs';
12
- import { lstat as lstat$4, readdir as readdir$5, readlink, realpath } from 'fs/promises';
13
- import require$$0$6, { EventEmitter } from 'events';
14
- import require$$0$2 from 'stream';
15
- import require$$1, { StringDecoder } from 'string_decoder';
12
+ import { EventEmitter } from 'node:events';
13
+ import Stream$2 from 'node:stream';
14
+ import { StringDecoder } from 'node:string_decoder';
16
15
  import require$$0$3, { inspect } from 'util';
17
16
  import require$$0$5, { tmpdir } from 'os';
17
+ import require$$3, { fileURLToPath as fileURLToPath$1, URL as URL$1, pathToFileURL } from 'url';
18
18
  import require$$5 from 'assert';
19
+ import require$$0$6 from 'events';
19
20
  import { normalizePath, loadConfigFromFile, createLogger, mergeConfig as mergeConfig$1, searchForWorkspaceRoot, build as build$1, transformWithEsbuild, createServer as createServer$1 } from 'vite';
21
+ import require$$0$2 from 'stream';
20
22
  import require$$2$1 from 'readline';
21
23
  import require$$0$7 from 'child_process';
24
+ import require$$1 from 'string_decoder';
22
25
  import zlib from 'zlib';
26
+ import { isBooleanAttr } from '@vue/shared';
23
27
  import f$1 from 'node:readline';
24
28
  import { WriteStream } from 'node:tty';
25
29
  import http from 'http';
@@ -2684,7 +2688,7 @@ function findUpSync(name, {
2684
2688
  const filePath = path$r.isAbsolute(name) ? name : path$r.join(directory, name);
2685
2689
 
2686
2690
  try {
2687
- const stats = fs$u.statSync(filePath, {throwIfNoEntry: false});
2691
+ const stats = fs__default$1.statSync(filePath, {throwIfNoEntry: false});
2688
2692
  if ((type === 'file' && stats?.isFile()) || (type === 'directory' && stats?.isDirectory())) {
2689
2693
  return filePath;
2690
2694
  }
@@ -6193,7 +6197,7 @@ const proc = typeof process === 'object' && process
6193
6197
  const isStream = (s) => !!s &&
6194
6198
  typeof s === 'object' &&
6195
6199
  (s instanceof Minipass ||
6196
- s instanceof require$$0$2 ||
6200
+ s instanceof Stream$2 ||
6197
6201
  isReadable(s) ||
6198
6202
  isWritable(s));
6199
6203
  /**
@@ -6204,7 +6208,7 @@ const isReadable = (s) => !!s &&
6204
6208
  s instanceof EventEmitter &&
6205
6209
  typeof s.pipe === 'function' &&
6206
6210
  // node core Writable streams have a pipe() method, but it throws
6207
- s.pipe !== require$$0$2.Writable.prototype.pipe;
6211
+ s.pipe !== Stream$2.Writable.prototype.pipe;
6208
6212
  /**
6209
6213
  * Return true if the argument is a valid {@link Minipass.Writable}
6210
6214
  */
@@ -7210,8 +7214,8 @@ const defaultFS = {
7210
7214
  },
7211
7215
  };
7212
7216
  // if they just gave us require('fs') then use our default
7213
- const fsFromOption = (fsOption) => !fsOption || fsOption === defaultFS || fsOption === fs$t
7214
- ? defaultFS
7217
+ const fsFromOption = (fsOption) => !fsOption || fsOption === defaultFS || fsOption === fs$t ?
7218
+ defaultFS
7215
7219
  : {
7216
7220
  ...defaultFS,
7217
7221
  ...fsOption,
@@ -7252,20 +7256,13 @@ const ENOREADLINK = 0b0001_0000_0000;
7252
7256
  const ENOREALPATH = 0b0010_0000_0000;
7253
7257
  const ENOCHILD = ENOTDIR | ENOENT | ENOREALPATH;
7254
7258
  const TYPEMASK = 0b0011_1111_1111;
7255
- const entToType = (s) => s.isFile()
7256
- ? IFREG
7257
- : s.isDirectory()
7258
- ? IFDIR
7259
- : s.isSymbolicLink()
7260
- ? IFLNK
7261
- : s.isCharacterDevice()
7262
- ? IFCHR
7263
- : s.isBlockDevice()
7264
- ? IFBLK
7265
- : s.isSocket()
7266
- ? IFSOCK
7267
- : s.isFIFO()
7268
- ? IFIFO
7259
+ const entToType = (s) => s.isFile() ? IFREG
7260
+ : s.isDirectory() ? IFDIR
7261
+ : s.isSymbolicLink() ? IFLNK
7262
+ : s.isCharacterDevice() ? IFCHR
7263
+ : s.isBlockDevice() ? IFBLK
7264
+ : s.isSocket() ? IFSOCK
7265
+ : s.isFIFO() ? IFIFO
7269
7266
  : UNKNOWN;
7270
7267
  // normalize unicode path names
7271
7268
  const normalizeCache = new Map();
@@ -7367,6 +7364,11 @@ class PathBase {
7367
7364
  * @internal
7368
7365
  */
7369
7366
  nocase;
7367
+ /**
7368
+ * boolean indicating that this path is the current working directory
7369
+ * of the PathScurry collection that contains it.
7370
+ */
7371
+ isCWD = false;
7370
7372
  // potential default fs override
7371
7373
  #fs;
7372
7374
  // Stats fields
@@ -7454,14 +7456,20 @@ class PathBase {
7454
7456
  #realpath;
7455
7457
  /**
7456
7458
  * This property is for compatibility with the Dirent class as of
7457
- * Node v20, where Dirent['path'] refers to the path of the directory
7458
- * that was passed to readdir. So, somewhat counterintuitively, this
7459
- * property refers to the *parent* path, not the path object itself.
7460
- * For root entries, it's the path to the entry itself.
7459
+ * Node v20, where Dirent['parentPath'] refers to the path of the
7460
+ * directory that was passed to readdir. For root entries, it's the path
7461
+ * to the entry itself.
7461
7462
  */
7462
- get path() {
7463
+ get parentPath() {
7463
7464
  return (this.parent || this).fullpath();
7464
7465
  }
7466
+ /**
7467
+ * Deprecated alias for Dirent['parentPath'] Somewhat counterintuitively,
7468
+ * this property refers to the *parent* path, not the path object itself.
7469
+ */
7470
+ get path() {
7471
+ return this.parentPath;
7472
+ }
7465
7473
  /**
7466
7474
  * Do not create new Path objects directly. They should always be accessed
7467
7475
  * via the PathScurry class or other methods on the Path class.
@@ -7515,8 +7523,8 @@ class PathBase {
7515
7523
  const rootPath = this.getRootString(path);
7516
7524
  const dir = path.substring(rootPath.length);
7517
7525
  const dirParts = dir.split(this.splitSep);
7518
- const result = rootPath
7519
- ? this.getRoot(rootPath).#resolveParts(dirParts)
7526
+ const result = rootPath ?
7527
+ this.getRoot(rootPath).#resolveParts(dirParts)
7520
7528
  : this.#resolveParts(dirParts);
7521
7529
  return result;
7522
7530
  }
@@ -7567,9 +7575,7 @@ class PathBase {
7567
7575
  }
7568
7576
  // find the child
7569
7577
  const children = this.children();
7570
- const name = this.nocase
7571
- ? normalizeNocase(pathPart)
7572
- : normalize$2(pathPart);
7578
+ const name = this.nocase ? normalizeNocase(pathPart) : normalize$2(pathPart);
7573
7579
  for (const p of children) {
7574
7580
  if (p.#matchName === name) {
7575
7581
  return p;
@@ -7579,9 +7585,7 @@ class PathBase {
7579
7585
  // actually exist. If we know the parent isn't a dir, then
7580
7586
  // in fact it CAN'T exist.
7581
7587
  const s = this.parent ? this.sep : '';
7582
- const fullpath = this.#fullpath
7583
- ? this.#fullpath + s + pathPart
7584
- : undefined;
7588
+ const fullpath = this.#fullpath ? this.#fullpath + s + pathPart : undefined;
7585
7589
  const pchild = this.newChild(pathPart, UNKNOWN, {
7586
7590
  ...opts,
7587
7591
  parent: this,
@@ -7600,6 +7604,8 @@ class PathBase {
7600
7604
  * the cwd, then this ends up being equivalent to the fullpath()
7601
7605
  */
7602
7606
  relative() {
7607
+ if (this.isCWD)
7608
+ return '';
7603
7609
  if (this.#relative !== undefined) {
7604
7610
  return this.#relative;
7605
7611
  }
@@ -7620,6 +7626,8 @@ class PathBase {
7620
7626
  relativePosix() {
7621
7627
  if (this.sep === '/')
7622
7628
  return this.relative();
7629
+ if (this.isCWD)
7630
+ return '';
7623
7631
  if (this.#relativePosix !== undefined)
7624
7632
  return this.#relativePosix;
7625
7633
  const name = this.name;
@@ -7685,23 +7693,15 @@ class PathBase {
7685
7693
  return this[`is${type}`]();
7686
7694
  }
7687
7695
  getType() {
7688
- return this.isUnknown()
7689
- ? 'Unknown'
7690
- : this.isDirectory()
7691
- ? 'Directory'
7692
- : this.isFile()
7693
- ? 'File'
7694
- : this.isSymbolicLink()
7695
- ? 'SymbolicLink'
7696
- : this.isFIFO()
7697
- ? 'FIFO'
7698
- : this.isCharacterDevice()
7699
- ? 'CharacterDevice'
7700
- : this.isBlockDevice()
7701
- ? 'BlockDevice'
7702
- : /* c8 ignore start */ this.isSocket()
7703
- ? 'Socket'
7704
- : 'Unknown';
7696
+ return (this.isUnknown() ? 'Unknown'
7697
+ : this.isDirectory() ? 'Directory'
7698
+ : this.isFile() ? 'File'
7699
+ : this.isSymbolicLink() ? 'SymbolicLink'
7700
+ : this.isFIFO() ? 'FIFO'
7701
+ : this.isCharacterDevice() ? 'CharacterDevice'
7702
+ : this.isBlockDevice() ? 'BlockDevice'
7703
+ : /* c8 ignore start */ this.isSocket() ? 'Socket'
7704
+ : 'Unknown');
7705
7705
  /* c8 ignore stop */
7706
7706
  }
7707
7707
  /**
@@ -7835,8 +7835,8 @@ class PathBase {
7835
7835
  * directly.
7836
7836
  */
7837
7837
  isNamed(n) {
7838
- return !this.nocase
7839
- ? this.#matchName === normalize$2(n)
7838
+ return !this.nocase ?
7839
+ this.#matchName === normalize$2(n)
7840
7840
  : this.#matchName === normalizeNocase(n);
7841
7841
  }
7842
7842
  /**
@@ -7892,7 +7892,7 @@ class PathBase {
7892
7892
  /* c8 ignore stop */
7893
7893
  try {
7894
7894
  const read = this.#fs.readlinkSync(this.fullpath());
7895
- const linkTarget = (this.parent.realpathSync())?.resolve(read);
7895
+ const linkTarget = this.parent.realpathSync()?.resolve(read);
7896
7896
  if (linkTarget) {
7897
7897
  return (this.#linkTarget = linkTarget);
7898
7898
  }
@@ -8013,9 +8013,7 @@ class PathBase {
8013
8013
  #readdirMaybePromoteChild(e, c) {
8014
8014
  for (let p = c.provisional; p < c.length; p++) {
8015
8015
  const pchild = c[p];
8016
- const name = this.nocase
8017
- ? normalizeNocase(e.name)
8018
- : normalize$2(e.name);
8016
+ const name = this.nocase ? normalizeNocase(e.name) : normalize$2(e.name);
8019
8017
  if (name !== pchild.#matchName) {
8020
8018
  continue;
8021
8019
  }
@@ -8314,6 +8312,8 @@ class PathBase {
8314
8312
  [setAsCwd](oldCwd) {
8315
8313
  if (oldCwd === this)
8316
8314
  return;
8315
+ oldCwd.isCWD = false;
8316
+ this.isCWD = true;
8317
8317
  const changed = new Set([]);
8318
8318
  let rp = [];
8319
8319
  let p = this;
@@ -8487,7 +8487,7 @@ class PathScurryBase {
8487
8487
  constructor(cwd = process.cwd(), pathImpl, sep, { nocase, childrenCacheSize = 16 * 1024, fs = defaultFS, } = {}) {
8488
8488
  this.#fs = fsFromOption(fs);
8489
8489
  if (cwd instanceof URL || cwd.startsWith('file://')) {
8490
- cwd = fileURLToPath$1(cwd);
8490
+ cwd = fileURLToPath(cwd);
8491
8491
  }
8492
8492
  // resolve and split root, and then add to the store.
8493
8493
  // this is the only time we call path.resolve()
@@ -9165,10 +9165,8 @@ process.platform === 'win32' ? PathWin32 : PathPosix;
9165
9165
  * {@link PathScurryWin32} on Windows systems, {@link PathScurryDarwin} on
9166
9166
  * Darwin (macOS) systems, {@link PathScurryPosix} on all others.
9167
9167
  */
9168
- const PathScurry = process.platform === 'win32'
9169
- ? PathScurryWin32
9170
- : process.platform === 'darwin'
9171
- ? PathScurryDarwin
9168
+ const PathScurry = process.platform === 'win32' ? PathScurryWin32
9169
+ : process.platform === 'darwin' ? PathScurryDarwin
9172
9170
  : PathScurryPosix;
9173
9171
 
9174
9172
  // this is just a very light wrapper around 2 arrays with an offset index
@@ -10227,7 +10225,7 @@ class Glob {
10227
10225
  this.cwd = '';
10228
10226
  }
10229
10227
  else if (opts.cwd instanceof URL || opts.cwd.startsWith('file://')) {
10230
- opts.cwd = fileURLToPath$1(opts.cwd);
10228
+ opts.cwd = fileURLToPath(opts.cwd);
10231
10229
  }
10232
10230
  this.cwd = opts.cwd || '';
10233
10231
  this.root = opts.root;
@@ -10483,12 +10481,12 @@ const optArgT = (opt) => {
10483
10481
  if (!glob) {
10484
10482
  return options;
10485
10483
  }
10486
- const globOpt = glob === true
10487
- ? opt.signal
10488
- ? { signal: opt.signal }
10484
+ const globOpt = glob === true ?
10485
+ opt.signal ?
10486
+ { signal: opt.signal }
10489
10487
  : {}
10490
- : opt.signal
10491
- ? {
10488
+ : opt.signal ?
10489
+ {
10492
10490
  signal: opt.signal,
10493
10491
  ...glob,
10494
10492
  }
@@ -10513,10 +10511,8 @@ const pathArg = (path, opt = {}) => {
10513
10511
  const type = typeof path;
10514
10512
  if (type !== 'string') {
10515
10513
  const ctor = path && type === 'object' && path.constructor;
10516
- const received = ctor && ctor.name
10517
- ? `an instance of ${ctor.name}`
10518
- : type === 'object'
10519
- ? inspect(path)
10514
+ const received = ctor && ctor.name ? `an instance of ${ctor.name}`
10515
+ : type === 'object' ? inspect(path)
10520
10516
  : `type ${type} ${path}`;
10521
10517
  const msg = 'The "path" argument must be of type string. ' + `Received ${received}`;
10522
10518
  throw Object.assign(new TypeError(msg), {
@@ -10563,7 +10559,7 @@ const readdirSync = (path) => readdirSync$1(path, { withFileTypes: true });
10563
10559
  const chmod$2 = (path, mode) => new Promise((res, rej) => fs__default.chmod(path, mode, (er, ...d) => (er ? rej(er) : res(...d))));
10564
10560
  const mkdir = (path, options) => new Promise((res, rej) => fs__default.mkdir(path, options, (er, made) => (er ? rej(er) : res(made))));
10565
10561
  const readdir$3 = (path) => new Promise((res, rej) => fs__default.readdir(path, { withFileTypes: true }, (er, data) => er ? rej(er) : res(data)));
10566
- const rename$1 = (oldPath, newPath) => new Promise((res, rej) => fs__default.rename(oldPath, newPath, (er, ...d) => (er ? rej(er) : res(...d))));
10562
+ const rename$1 = (oldPath, newPath) => new Promise((res, rej) => fs__default.rename(oldPath, newPath, (er, ...d) => er ? rej(er) : res(...d)));
10567
10563
  const rm$1 = (path, options) => new Promise((res, rej) => fs__default.rm(path, options, (er, ...d) => (er ? rej(er) : res(...d))));
10568
10564
  const rmdir$3 = (path) => new Promise((res, rej) => fs__default.rmdir(path, (er, ...d) => (er ? rej(er) : res(...d))));
10569
10565
  const stat$2 = (path) => new Promise((res, rej) => fs__default.stat(path, (er, data) => (er ? rej(er) : res(data))));
@@ -11271,11 +11267,11 @@ const [major = 0, minor = 0] = versArr.map(v => parseInt(v, 10));
11271
11267
  const hasNative = major > 14 || (major === 14 && minor >= 14);
11272
11268
  // we do NOT use native by default on Windows, because Node's native
11273
11269
  // rm implementation is less advanced. Change this code if that changes.
11274
- const useNative = !hasNative || platform === 'win32'
11275
- ? () => false
11270
+ const useNative = !hasNative || platform === 'win32' ?
11271
+ () => false
11276
11272
  : opt => !opt?.signal && !opt?.filter;
11277
- const useNativeSync = !hasNative || platform === 'win32'
11278
- ? () => false
11273
+ const useNativeSync = !hasNative || platform === 'win32' ?
11274
+ () => false
11279
11275
  : opt => !opt?.signal && !opt?.filter;
11280
11276
 
11281
11277
  const wrap = (fn) => async (path, opt) => {
@@ -11316,7 +11312,9 @@ const moveRemoveSync = wrapSync(rimrafMoveRemoveSync);
11316
11312
  const moveRemove = Object.assign(wrap(rimrafMoveRemove), {
11317
11313
  sync: moveRemoveSync,
11318
11314
  });
11319
- const rimrafSync = wrapSync((path, opt) => useNativeSync(opt) ? rimrafNativeSync(path, opt) : rimrafManualSync(path, opt));
11315
+ const rimrafSync = wrapSync((path, opt) => useNativeSync(opt) ?
11316
+ rimrafNativeSync(path, opt)
11317
+ : rimrafManualSync(path, opt));
11320
11318
  const rimraf_ = wrap((path, opt) => useNative(opt) ? rimrafNative(path, opt) : rimrafManual(path, opt));
11321
11319
  const rimraf = Object.assign(rimraf_, {
11322
11320
  rimraf: rimraf_,
@@ -12390,17 +12388,21 @@ if (typeof process === 'undefined' || process.type === 'renderer' || process.bro
12390
12388
  var srcExports = src$1.exports;
12391
12389
  var _debug = /*@__PURE__*/getDefaultExportFromCjs(srcExports);
12392
12390
 
12393
- var picocolors = {exports: {}};
12391
+ function commonjsRequire(path) {
12392
+ throw new Error('Could not dynamically require "' + path + '". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.');
12393
+ }
12394
12394
 
12395
- let tty = require$$0$4;
12395
+ var picocolors = {exports: {}};
12396
12396
 
12397
+ let argv = process.argv || [],
12398
+ env = process.env;
12397
12399
  let isColorSupported =
12398
- !("NO_COLOR" in process.env || process.argv.includes("--no-color")) &&
12399
- ("FORCE_COLOR" in process.env ||
12400
- process.argv.includes("--color") ||
12400
+ !("NO_COLOR" in env || argv.includes("--no-color")) &&
12401
+ ("FORCE_COLOR" in env ||
12402
+ argv.includes("--color") ||
12401
12403
  process.platform === "win32" ||
12402
- (tty.isatty(1) && process.env.TERM !== "dumb") ||
12403
- "CI" in process.env);
12404
+ (commonjsRequire != null && require$$0$4.isatty(1) && env.TERM !== "dumb") ||
12405
+ "CI" in env);
12404
12406
 
12405
12407
  let formatter =
12406
12408
  (open, close, replace = open) =>
@@ -12413,40 +12415,47 @@ let formatter =
12413
12415
  };
12414
12416
 
12415
12417
  let replaceClose = (string, close, replace, index) => {
12416
- let start = string.substring(0, index) + replace;
12417
- let end = string.substring(index + close.length);
12418
- let nextIndex = end.indexOf(close);
12419
- return ~nextIndex ? start + replaceClose(end, close, replace, nextIndex) : start + end
12420
- };
12421
-
12422
- let createColors = (enabled = isColorSupported) => ({
12423
- isColorSupported: enabled,
12424
- reset: enabled ? s => `\x1b[0m${s}\x1b[0m` : String,
12425
- bold: enabled ? formatter("\x1b[1m", "\x1b[22m", "\x1b[22m\x1b[1m") : String,
12426
- dim: enabled ? formatter("\x1b[2m", "\x1b[22m", "\x1b[22m\x1b[2m") : String,
12427
- italic: enabled ? formatter("\x1b[3m", "\x1b[23m") : String,
12428
- underline: enabled ? formatter("\x1b[4m", "\x1b[24m") : String,
12429
- inverse: enabled ? formatter("\x1b[7m", "\x1b[27m") : String,
12430
- hidden: enabled ? formatter("\x1b[8m", "\x1b[28m") : String,
12431
- strikethrough: enabled ? formatter("\x1b[9m", "\x1b[29m") : String,
12432
- black: enabled ? formatter("\x1b[30m", "\x1b[39m") : String,
12433
- red: enabled ? formatter("\x1b[31m", "\x1b[39m") : String,
12434
- green: enabled ? formatter("\x1b[32m", "\x1b[39m") : String,
12435
- yellow: enabled ? formatter("\x1b[33m", "\x1b[39m") : String,
12436
- blue: enabled ? formatter("\x1b[34m", "\x1b[39m") : String,
12437
- magenta: enabled ? formatter("\x1b[35m", "\x1b[39m") : String,
12438
- cyan: enabled ? formatter("\x1b[36m", "\x1b[39m") : String,
12439
- white: enabled ? formatter("\x1b[37m", "\x1b[39m") : String,
12440
- gray: enabled ? formatter("\x1b[90m", "\x1b[39m") : String,
12441
- bgBlack: enabled ? formatter("\x1b[40m", "\x1b[49m") : String,
12442
- bgRed: enabled ? formatter("\x1b[41m", "\x1b[49m") : String,
12443
- bgGreen: enabled ? formatter("\x1b[42m", "\x1b[49m") : String,
12444
- bgYellow: enabled ? formatter("\x1b[43m", "\x1b[49m") : String,
12445
- bgBlue: enabled ? formatter("\x1b[44m", "\x1b[49m") : String,
12446
- bgMagenta: enabled ? formatter("\x1b[45m", "\x1b[49m") : String,
12447
- bgCyan: enabled ? formatter("\x1b[46m", "\x1b[49m") : String,
12448
- bgWhite: enabled ? formatter("\x1b[47m", "\x1b[49m") : String,
12449
- });
12418
+ let result = "";
12419
+ let cursor = 0;
12420
+ do {
12421
+ result += string.substring(cursor, index) + replace;
12422
+ cursor = index + close.length;
12423
+ index = string.indexOf(close, cursor);
12424
+ } while (~index)
12425
+ return result + string.substring(cursor)
12426
+ };
12427
+
12428
+ let createColors = (enabled = isColorSupported) => {
12429
+ let init = enabled ? formatter : () => String;
12430
+ return {
12431
+ isColorSupported: enabled,
12432
+ reset: init("\x1b[0m", "\x1b[0m"),
12433
+ bold: init("\x1b[1m", "\x1b[22m", "\x1b[22m\x1b[1m"),
12434
+ dim: init("\x1b[2m", "\x1b[22m", "\x1b[22m\x1b[2m"),
12435
+ italic: init("\x1b[3m", "\x1b[23m"),
12436
+ underline: init("\x1b[4m", "\x1b[24m"),
12437
+ inverse: init("\x1b[7m", "\x1b[27m"),
12438
+ hidden: init("\x1b[8m", "\x1b[28m"),
12439
+ strikethrough: init("\x1b[9m", "\x1b[29m"),
12440
+ black: init("\x1b[30m", "\x1b[39m"),
12441
+ red: init("\x1b[31m", "\x1b[39m"),
12442
+ green: init("\x1b[32m", "\x1b[39m"),
12443
+ yellow: init("\x1b[33m", "\x1b[39m"),
12444
+ blue: init("\x1b[34m", "\x1b[39m"),
12445
+ magenta: init("\x1b[35m", "\x1b[39m"),
12446
+ cyan: init("\x1b[36m", "\x1b[39m"),
12447
+ white: init("\x1b[37m", "\x1b[39m"),
12448
+ gray: init("\x1b[90m", "\x1b[39m"),
12449
+ bgBlack: init("\x1b[40m", "\x1b[49m"),
12450
+ bgRed: init("\x1b[41m", "\x1b[49m"),
12451
+ bgGreen: init("\x1b[42m", "\x1b[49m"),
12452
+ bgYellow: init("\x1b[43m", "\x1b[49m"),
12453
+ bgBlue: init("\x1b[44m", "\x1b[49m"),
12454
+ bgMagenta: init("\x1b[45m", "\x1b[49m"),
12455
+ bgCyan: init("\x1b[46m", "\x1b[49m"),
12456
+ bgWhite: init("\x1b[47m", "\x1b[49m"),
12457
+ }
12458
+ };
12450
12459
 
12451
12460
  picocolors.exports = createColors();
12452
12461
  picocolors.exports.createColors = createColors;
@@ -19701,8 +19710,7 @@ const dynamicRoutesPlugin = async (config) => {
19701
19710
  server = _server;
19702
19711
  },
19703
19712
  resolveId(id) {
19704
- if (!id.endsWith(".md"))
19705
- return;
19713
+ if (!id.endsWith(".md")) return;
19706
19714
  const normalizedId = id.startsWith(config.srcDir) ? id : normalizePath(path$q.resolve(config.srcDir, id.replace(/^\//, "")));
19707
19715
  const matched = config.dynamicRoutes.routes.find(
19708
19716
  (r) => r.fullPath === normalizedId
@@ -19770,9 +19778,12 @@ async function resolveDynamicRoutes(srcDir, routes, logger) {
19770
19778
  "silent"
19771
19779
  );
19772
19780
  routeModuleCache.set(pathsFile, mod);
19773
- } catch (e) {
19774
- logger.warn(`${c$1.yellow(`Failed to load ${pathsFile}:`)}
19775
- ${e.stack}`);
19781
+ } catch (err) {
19782
+ logger.warn(
19783
+ `${c$1.yellow(`Failed to load ${pathsFile}:`)}
19784
+ ${err.message}
19785
+ ${err.stack}`
19786
+ );
19776
19787
  continue;
19777
19788
  }
19778
19789
  }
@@ -19819,7 +19830,7 @@ const HASH_OR_QUERY_RE = /[?#].*$/;
19819
19830
  const INDEX_OR_EXT_RE = /(?:(^|\/)index)?\.(?:md|html)$/;
19820
19831
  const inBrowser = typeof document !== "undefined";
19821
19832
  const notFoundPageData = {
19822
- relativePath: "",
19833
+ relativePath: "404.md",
19823
19834
  filePath: "",
19824
19835
  title: "404",
19825
19836
  description: "Not Found",
@@ -19851,10 +19862,13 @@ function normalize$1(path) {
19851
19862
  function isExternal(path) {
19852
19863
  return EXTERNAL_URL_RE.test(path);
19853
19864
  }
19854
- function resolveSiteDataByRoute(siteData, relativePath) {
19855
- const localeIndex = Object.keys(siteData.locales).find(
19865
+ function getLocaleForPath(siteData, relativePath) {
19866
+ return Object.keys(siteData?.locales || {}).find(
19856
19867
  (key) => key !== "root" && !isExternal(key) && isActive(relativePath, `/${key}/`, true)
19857
19868
  ) || "root";
19869
+ }
19870
+ function resolveSiteDataByRoute(siteData, relativePath) {
19871
+ const localeIndex = getLocaleForPath(siteData, relativePath);
19858
19872
  return Object.assign({}, siteData, {
19859
19873
  localeIndex,
19860
19874
  lang: siteData.locales[localeIndex]?.lang ?? siteData.lang,
@@ -19895,11 +19909,9 @@ function createTitleTemplate(siteTitle, template) {
19895
19909
  }
19896
19910
  function hasTag(head, tag) {
19897
19911
  const [tagType, tagAttrs] = tag;
19898
- if (tagType !== "meta")
19899
- return false;
19912
+ if (tagType !== "meta") return false;
19900
19913
  const keyAttr = Object.entries(tagAttrs)[0];
19901
- if (keyAttr == null)
19902
- return false;
19914
+ if (keyAttr == null) return false;
19903
19915
  return head.some(
19904
19916
  ([type, attrs]) => type === tagType && attrs[keyAttr[0]] === keyAttr[1]
19905
19917
  );
@@ -21674,10 +21686,6 @@ var merge = new Type$7('tag:yaml.org,2002:merge', {
21674
21686
  resolve: resolveYamlMerge
21675
21687
  });
21676
21688
 
21677
- function commonjsRequire(path) {
21678
- throw new Error('Could not dynamically require "' + path + '". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.');
21679
- }
21680
-
21681
21689
  /*eslint-disable no-bitwise*/
21682
21690
 
21683
21691
  var NodeBuffer;
@@ -26687,7 +26695,7 @@ function replaceUnsafeChar$1 (ch) {
26687
26695
  return HTML_REPLACEMENTS$1[ch]
26688
26696
  }
26689
26697
 
26690
- function escapeHtml$1 (str) {
26698
+ function escapeHtml$2 (str) {
26691
26699
  if (HTML_ESCAPE_TEST_RE$1.test(str)) {
26692
26700
  return str.replace(HTML_ESCAPE_REPLACE_RE$1, replaceUnsafeChar$1)
26693
26701
  }
@@ -26845,7 +26853,7 @@ var utils$3 = /*#__PURE__*/Object.freeze({
26845
26853
  __proto__: null,
26846
26854
  arrayReplaceAt: arrayReplaceAt,
26847
26855
  assign: assign$1,
26848
- escapeHtml: escapeHtml$1,
26856
+ escapeHtml: escapeHtml$2,
26849
26857
  escapeRE: escapeRE$1,
26850
26858
  fromCodePoint: fromCodePoint,
26851
26859
  has: has,
@@ -27078,7 +27086,7 @@ default_rules.code_inline = function (tokens, idx, options, env, slf) {
27078
27086
  const token = tokens[idx];
27079
27087
 
27080
27088
  return '<code' + slf.renderAttrs(token) + '>' +
27081
- escapeHtml$1(token.content) +
27089
+ escapeHtml$2(token.content) +
27082
27090
  '</code>'
27083
27091
  };
27084
27092
 
@@ -27086,7 +27094,7 @@ default_rules.code_block = function (tokens, idx, options, env, slf) {
27086
27094
  const token = tokens[idx];
27087
27095
 
27088
27096
  return '<pre' + slf.renderAttrs(token) + '><code>' +
27089
- escapeHtml$1(tokens[idx].content) +
27097
+ escapeHtml$2(tokens[idx].content) +
27090
27098
  '</code></pre>\n'
27091
27099
  };
27092
27100
 
@@ -27104,9 +27112,9 @@ default_rules.fence = function (tokens, idx, options, env, slf) {
27104
27112
 
27105
27113
  let highlighted;
27106
27114
  if (options.highlight) {
27107
- highlighted = options.highlight(token.content, langName, langAttrs) || escapeHtml$1(token.content);
27115
+ highlighted = options.highlight(token.content, langName, langAttrs) || escapeHtml$2(token.content);
27108
27116
  } else {
27109
- highlighted = escapeHtml$1(token.content);
27117
+ highlighted = escapeHtml$2(token.content);
27110
27118
  }
27111
27119
 
27112
27120
  if (highlighted.indexOf('<pre') === 0) {
@@ -27160,7 +27168,7 @@ default_rules.softbreak = function (tokens, idx, options /*, env */) {
27160
27168
  };
27161
27169
 
27162
27170
  default_rules.text = function (tokens, idx /*, options, env */) {
27163
- return escapeHtml$1(tokens[idx].content)
27171
+ return escapeHtml$2(tokens[idx].content)
27164
27172
  };
27165
27173
 
27166
27174
  default_rules.html_block = function (tokens, idx /*, options, env */) {
@@ -27220,7 +27228,7 @@ Renderer.prototype.renderAttrs = function renderAttrs (token) {
27220
27228
  result = '';
27221
27229
 
27222
27230
  for (i = 0, l = token.attrs.length; i < l; i++) {
27223
- result += ' ' + escapeHtml$1(token.attrs[i][0]) + '="' + escapeHtml$1(token.attrs[i][1]) + '"';
27231
+ result += ' ' + escapeHtml$2(token.attrs[i][0]) + '="' + escapeHtml$2(token.attrs[i][1]) + '"';
27224
27232
  }
27225
27233
 
27226
27234
  return result
@@ -28407,7 +28415,7 @@ function smartquotes (state) {
28407
28415
  // For example, `\:)` shouldn't be replaced with an emoji.
28408
28416
  //
28409
28417
 
28410
- function text_join (state) {
28418
+ function text_join$1 (state) {
28411
28419
  let curr, last;
28412
28420
  const blockTokens = state.tokens;
28413
28421
  const l = blockTokens.length;
@@ -28460,7 +28468,7 @@ const _rules$2 = [
28460
28468
  ['smartquotes', smartquotes],
28461
28469
  // `text_join` finds `text_special` tokens (for escape sequences)
28462
28470
  // and joins them with the rest of the text
28463
- ['text_join', text_join]
28471
+ ['text_join', text_join$1]
28464
28472
  ];
28465
28473
 
28466
28474
  /**
@@ -36923,10 +36931,7 @@ function preWrapperPlugin(md, options) {
36923
36931
  const active = / active( |$)/.test(token.info) ? " active" : "";
36924
36932
  token.info = token.info.replace(/ active$/, "").replace(/ active /, " ");
36925
36933
  const lang = extractLang(token.info);
36926
- const rawCode = fence(...args);
36927
- return `<div class="language-${lang}${getAdaptiveThemeMarker(
36928
- options
36929
- )}${active}"><button title="Copy Code" class="copy"></button><span class="lang">${lang}</span>${rawCode}</div>`;
36934
+ return `<div class="language-${lang}${getAdaptiveThemeMarker(options)}${active}"><button title="${options.codeCopyButtonTitle}" class="copy"></button><span class="lang">${lang}</span>` + fence(...args) + "</div>";
36930
36935
  };
36931
36936
  }
36932
36937
  function getAdaptiveThemeMarker(options) {
@@ -36989,8 +36994,7 @@ function createContainer(klass, defaultTitle, md) {
36989
36994
  `;
36990
36995
  return `<div class="${klass} custom-block"${attrs}><p class="custom-block-title">${title}</p>
36991
36996
  `;
36992
- } else
36993
- return klass === "details" ? `</details>
36997
+ } else return klass === "details" ? `</details>
36994
36998
  ` : `</div>
36995
36999
  `;
36996
37000
  }
@@ -37006,7 +37010,7 @@ function createCodeGroup(options) {
37006
37010
  if (tokens[idx].nesting === 1) {
37007
37011
  const name = nanoid$1(5);
37008
37012
  let tabs = "";
37009
- let checked = 'checked="checked"';
37013
+ let checked = "checked";
37010
37014
  for (let i = idx + 1; !(tokens[i].nesting === -1 && tokens[i].type === "container_code-group_close"); ++i) {
37011
37015
  const isHtml = tokens[i].type === "html_block";
37012
37016
  if (tokens[i].type === "fence" && tokens[i].tag === "code" || isHtml) {
@@ -37017,8 +37021,7 @@ function createCodeGroup(options) {
37017
37021
  if (title) {
37018
37022
  const id = nanoid$1(7);
37019
37023
  tabs += `<input type="radio" name="group-${name}" id="tab-${id}" ${checked}><label for="tab-${id}">${title}</label>`;
37020
- if (checked && !isHtml)
37021
- tokens[i].info += " active";
37024
+ if (checked && !isHtml) tokens[i].info += " active";
37022
37025
  checked = "";
37023
37026
  }
37024
37027
  }
@@ -37055,15 +37058,12 @@ const gitHubAlertsPlugin = (md, options) => {
37055
37058
  let endIndex = i + 1;
37056
37059
  while (endIndex < tokens.length && (tokens[endIndex].type !== "blockquote_close" || tokens[endIndex].level !== open.level))
37057
37060
  endIndex++;
37058
- if (endIndex === tokens.length)
37059
- continue;
37061
+ if (endIndex === tokens.length) continue;
37060
37062
  const close = tokens[endIndex];
37061
37063
  const firstContent = tokens.slice(startIndex, endIndex + 1).find((token) => token.type === "inline");
37062
- if (!firstContent)
37063
- continue;
37064
+ if (!firstContent) continue;
37064
37065
  const match = firstContent.content.match(markerRE);
37065
- if (!match)
37066
- continue;
37066
+ if (!match) continue;
37067
37067
  const type = match[1].toLowerCase();
37068
37068
  const title = match[2].trim() || titleMark[type] || capitalize(type);
37069
37069
  firstContent.content = firstContent.content.slice(match[0].length).trimStart();
@@ -37165,8 +37165,7 @@ The language '${lang}' is not loaded, falling back to '${defaultLang || "txt"}'
37165
37165
  const lineOptions = attrsToLines(attrs);
37166
37166
  const mustaches = /* @__PURE__ */ new Map();
37167
37167
  const removeMustache = (s) => {
37168
- if (vPre)
37169
- return s;
37168
+ if (vPre) return s;
37170
37169
  return s.replace(mustacheRE, (match) => {
37171
37170
  let marker = mustaches.get(match);
37172
37171
  if (!marker) {
@@ -37191,8 +37190,7 @@ The language '${lang}' is not loaded, falling back to '${defaultLang || "txt"}'
37191
37190
  {
37192
37191
  name: "vitepress:v-pre",
37193
37192
  pre(node) {
37194
- if (vPre)
37195
- node.properties["v-pre"] = "";
37193
+ if (vPre) node.properties["v-pre"] = "";
37196
37194
  }
37197
37195
  },
37198
37196
  {
@@ -37253,8 +37251,7 @@ const imagePlugin = (md, { lazyLoading } = {}) => {
37253
37251
  const token = tokens[idx];
37254
37252
  let url = token.attrGet("src");
37255
37253
  if (url && !EXTERNAL_URL_RE.test(url)) {
37256
- if (!/^\.?\//.test(url))
37257
- url = "./" + url;
37254
+ if (!/^\.?\//.test(url)) url = "./" + url;
37258
37255
  token.attrSet("src", decodeURIComponent(url));
37259
37256
  }
37260
37257
  if (lazyLoading) {
@@ -37357,13 +37354,36 @@ const linkPlugin = (md, externalAttrs, base) => {
37357
37354
  };
37358
37355
 
37359
37356
  function restoreEntities(md) {
37360
- md.core.ruler.disable("text_join");
37361
- md.renderer.rules.text_special = (tokens, idx) => {
37362
- if (tokens[idx].info === "entity") {
37363
- return tokens[idx].markup;
37364
- }
37365
- return md.utils.escapeHtml(tokens[idx].content);
37366
- };
37357
+ md.core.ruler.at("text_join", text_join);
37358
+ md.renderer.rules.text = (tokens, idx) => escapeHtml$1(tokens[idx].content);
37359
+ }
37360
+ function text_join(state) {
37361
+ let curr, last;
37362
+ const blockTokens = state.tokens;
37363
+ const l = blockTokens.length;
37364
+ for (let j = 0; j < l; ++j) {
37365
+ if (blockTokens[j].type !== "inline") continue;
37366
+ const tokens = blockTokens[j].children || [];
37367
+ const max = tokens.length;
37368
+ for (curr = 0; curr < max; ++curr)
37369
+ if (tokens[curr].type === "text_special") tokens[curr].type = "text";
37370
+ for (curr = last = 0; curr < max; ++curr)
37371
+ if (tokens[curr].type === "text" && curr + 1 < max && tokens[curr + 1].type === "text") {
37372
+ tokens[curr + 1].content = getContent(tokens[curr]) + getContent(tokens[curr + 1]);
37373
+ tokens[curr + 1].info = "";
37374
+ tokens[curr + 1].markup = "";
37375
+ } else {
37376
+ if (curr !== last) tokens[last] = tokens[curr];
37377
+ ++last;
37378
+ }
37379
+ if (curr !== last) tokens.length = last;
37380
+ }
37381
+ }
37382
+ function getContent(token) {
37383
+ return token.info === "entity" ? token.markup : token.info === "escape" && token.content === "&" ? "&amp;" : token.content;
37384
+ }
37385
+ function escapeHtml$1(str) {
37386
+ return str.replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;");
37367
37387
  }
37368
37388
 
37369
37389
  const rawPathRegexp = /^(.+?(?:(?:\.([a-z0-9]+))?))(?:(#[\w-]+))?(?: ?(?:{(\d+(?:[,-]\d+)*)? ?(\S+)?}))? ?(?:\[(.+)\])?$/;
@@ -37383,8 +37403,7 @@ function dedent(text) {
37383
37403
  const lines = text.split("\n");
37384
37404
  const minIndentLength = lines.reduce((acc, line) => {
37385
37405
  for (let i = 0; i < line.length; i++) {
37386
- if (line[i] !== " " && line[i] !== " ")
37387
- return Math.min(i, acc);
37406
+ if (line[i] !== " " && line[i] !== " ") return Math.min(i, acc);
37388
37407
  }
37389
37408
  return acc;
37390
37409
  }, Infinity);
@@ -37441,8 +37460,7 @@ const snippetPlugin = (md, srcDir) => {
37441
37460
  }
37442
37461
  for (let i = 0; i < 3; ++i) {
37443
37462
  const ch = state.src.charCodeAt(pos + i);
37444
- if (ch !== CH || pos + i >= max)
37445
- return false;
37463
+ if (ch !== CH || pos + i >= max) return false;
37446
37464
  }
37447
37465
  if (silent) {
37448
37466
  return true;
@@ -37466,8 +37484,7 @@ const snippetPlugin = (md, srcDir) => {
37466
37484
  const [tokens, idx, , { includes }] = args;
37467
37485
  const token = tokens[idx];
37468
37486
  const [src, regionName] = token.src ?? [];
37469
- if (!src)
37470
- return fence(...args);
37487
+ if (!src) return fence(...args);
37471
37488
  if (includes) {
37472
37489
  includes.push(src);
37473
37490
  }
@@ -37495,6 +37512,7 @@ const snippetPlugin = (md, srcDir) => {
37495
37512
 
37496
37513
  const createMarkdownRenderer = async (srcDir, options = {}, base = "/", logger = console) => {
37497
37514
  const theme = options.theme ?? { light: "github-light", dark: "github-dark" };
37515
+ const codeCopyButtonTitle = options.codeCopyButtonTitle || "Copy Code";
37498
37516
  const hasSingleTheme = typeof theme === "string" || "name" in theme;
37499
37517
  const md = MarkdownIt({
37500
37518
  html: true,
@@ -37507,7 +37525,7 @@ const createMarkdownRenderer = async (srcDir, options = {}, base = "/", logger =
37507
37525
  if (options.preConfig) {
37508
37526
  options.preConfig(md);
37509
37527
  }
37510
- md.use(componentPlugin, { ...options.component }).use(highlightLinePlugin).use(preWrapperPlugin, { hasSingleTheme }).use(snippetPlugin, srcDir).use(containerPlugin, { hasSingleTheme }, options.container).use(imagePlugin, options.image).use(
37528
+ md.use(componentPlugin, { ...options.component }).use(highlightLinePlugin).use(preWrapperPlugin, { codeCopyButtonTitle, hasSingleTheme }).use(snippetPlugin, srcDir).use(containerPlugin, { hasSingleTheme }, options.container).use(imagePlugin, options.image).use(
37511
37529
  linkPlugin,
37512
37530
  { target: "_blank", rel: "noreferrer", ...options.externalLinks },
37513
37531
  base
@@ -38203,12 +38221,10 @@ crossSpawn.exports._enoent = enoent;
38203
38221
  const cache$2 = /* @__PURE__ */ new Map();
38204
38222
  function getGitTimestamp(file) {
38205
38223
  const cached = cache$2.get(file);
38206
- if (cached)
38207
- return cached;
38224
+ if (cached) return cached;
38208
38225
  return new Promise((resolve, reject) => {
38209
38226
  const cwd = dirname(file);
38210
- if (!fs$a.existsSync(cwd))
38211
- return resolve(0);
38227
+ if (!fs$a.existsSync(cwd)) return resolve(0);
38212
38228
  const fileName = basename(file);
38213
38229
  const child = spawn_1("git", ["log", "-1", '--pretty="%ai"', fileName], {
38214
38230
  cwd
@@ -38228,8 +38244,7 @@ function processIncludes(srcDir, src, file, includes) {
38228
38244
  const includesRE = /<!--\s*@include:\s*(.*?)\s*-->/g;
38229
38245
  const rangeRE = /\{(\d*),(\d*)\}$/;
38230
38246
  return src.replace(includesRE, (m, m1) => {
38231
- if (!m1.length)
38232
- return m;
38247
+ if (!m1.length) return m;
38233
38248
  const range = m1.match(rangeRE);
38234
38249
  range && (m1 = m1.slice(0, -range[0].length));
38235
38250
  const atPresent = m1[0] === "@";
@@ -38297,12 +38312,14 @@ async function createMarkdownToVueRenderFn(srcDir, options = {}, pages, isBuild
38297
38312
  );
38298
38313
  let includes = [];
38299
38314
  src = processIncludes(srcDir, src, fileOrig, includes);
38315
+ const localeIndex = getLocaleForPath(siteConfig?.site, relativePath);
38300
38316
  const env = {
38301
38317
  path: file,
38302
38318
  relativePath,
38303
38319
  cleanUrls,
38304
38320
  includes,
38305
- realPath: fileOrig
38321
+ realPath: fileOrig,
38322
+ localeIndex
38306
38323
  };
38307
38324
  const html = md.render(src, env);
38308
38325
  const {
@@ -38343,11 +38360,9 @@ async function createMarkdownToVueRenderFn(srcDir, options = {}, pages, isBuild
38343
38360
  const dir = path$q.dirname(file);
38344
38361
  for (let url of links) {
38345
38362
  const { pathname } = new URL(url, "http://a.com");
38346
- if (!treatAsHtml(pathname))
38347
- continue;
38363
+ if (!treatAsHtml(pathname)) continue;
38348
38364
  url = url.replace(/[?#].*$/, "").replace(/\.(html|md)$/, "");
38349
- if (url.endsWith("/"))
38350
- url += `index`;
38365
+ if (url.endsWith("/")) url += `index`;
38351
38366
  let resolved = decodeURIComponent(
38352
38367
  slash(
38353
38368
  url.startsWith("/") ? url.slice(1) : path$q.relative(srcDir, path$q.resolve(dir, url))
@@ -38472,8 +38487,7 @@ function serializeFunctions(value, key) {
38472
38487
  return value.map((v) => serializeFunctions(v));
38473
38488
  } else if (typeof value === "object" && value !== null) {
38474
38489
  return Object.keys(value).reduce((acc, key2) => {
38475
- if (key2[0] === "_")
38476
- return acc;
38490
+ if (key2[0] === "_") return acc;
38477
38491
  acc[key2] = serializeFunctions(value[key2], key2);
38478
38492
  return acc;
38479
38493
  }, {});
@@ -41956,15 +41970,13 @@ async function localSearchPlugin(siteConfig) {
41956
41970
  );
41957
41971
  const options = siteConfig.site.themeConfig.search.options || {};
41958
41972
  async function render(file) {
41959
- if (!fs$a.existsSync(file))
41960
- return "";
41973
+ if (!fs$a.existsSync(file)) return "";
41961
41974
  const { srcDir, cleanUrls = false } = siteConfig;
41962
41975
  const relativePath = slash(path$q.relative(srcDir, file));
41963
41976
  const env = { path: file, relativePath, cleanUrls };
41964
41977
  const md_raw = await fs$a.promises.readFile(file, "utf-8");
41965
41978
  const md_src = processIncludes(srcDir, md_raw, file, []);
41966
- if (options._render)
41967
- return await options._render(md_src, env, md);
41979
+ if (options._render) return await options._render(md_src, env, md);
41968
41980
  else {
41969
41981
  const html = md.render(md_src, env);
41970
41982
  return env.frontmatter?.search === false ? "" : html;
@@ -41983,11 +41995,6 @@ async function localSearchPlugin(siteConfig) {
41983
41995
  }
41984
41996
  return index;
41985
41997
  }
41986
- function getLocaleForPath(file) {
41987
- const relativePath = slash(path$q.relative(siteConfig.srcDir, file));
41988
- const siteData = resolveSiteDataByRoute(siteConfig.site, relativePath);
41989
- return siteData?.localeIndex ?? "root";
41990
- }
41991
41998
  let server;
41992
41999
  function onIndexUpdated() {
41993
42000
  if (server) {
@@ -41995,8 +42002,7 @@ async function localSearchPlugin(siteConfig) {
41995
42002
  const mod = server.moduleGraph.getModuleById(
41996
42003
  LOCAL_SEARCH_INDEX_REQUEST_PATH
41997
42004
  );
41998
- if (!mod)
41999
- return;
42005
+ if (!mod) return;
42000
42006
  server.ws.send({
42001
42007
  type: "update",
42002
42008
  updates: [
@@ -42021,7 +42027,7 @@ async function localSearchPlugin(siteConfig) {
42021
42027
  async function indexFile(page) {
42022
42028
  const file = path$q.join(siteConfig.srcDir, page);
42023
42029
  const fileId = getDocId(file);
42024
- const locale = getLocaleForPath(file);
42030
+ const locale = getLocaleForPath(siteConfig.site, page);
42025
42031
  const index = getIndexByLocale(locale);
42026
42032
  const html = await render(file);
42027
42033
  const sections = (
@@ -42030,8 +42036,7 @@ async function localSearchPlugin(siteConfig) {
42030
42036
  splitPageIntoSections(html)
42031
42037
  );
42032
42038
  for await (const section of sections) {
42033
- if (!section || !(section.text || section.titles))
42034
- break;
42039
+ if (!section || !(section.text || section.titles)) break;
42035
42040
  const { anchor, text, titles } = section;
42036
42041
  const id = anchor ? [fileId, anchor].join("#") : fileId;
42037
42042
  index.add({
@@ -42116,8 +42121,7 @@ function* splitPageIntoSections(html) {
42116
42121
  const title = clearHtmlTags(headingResult?.[1] ?? "").trim();
42117
42122
  const anchor = headingResult?.[2] ?? "";
42118
42123
  const content = result[i + 2];
42119
- if (!title || !content)
42120
- continue;
42124
+ if (!title || !content) continue;
42121
42125
  let titles = parentTitles.slice(0, level);
42122
42126
  titles[level] = title;
42123
42127
  titles = titles.filter(Boolean);
@@ -42200,8 +42204,7 @@ const staticDataPlugin = {
42200
42204
  const result = `export const data = JSON.parse(${JSON.stringify(
42201
42205
  JSON.stringify(data)
42202
42206
  )})`;
42203
- if (_resolve)
42204
- _resolve(result);
42207
+ if (_resolve) _resolve(result);
42205
42208
  return result;
42206
42209
  }
42207
42210
  },
@@ -42302,8 +42305,7 @@ async function createVitePressPlugin(siteConfig, ssr = false, pageToHashMap, cli
42302
42305
  );
42303
42306
  const processClientJS = (code, id) => {
42304
42307
  return scriptClientRE.test(code) ? code.replace(scriptClientRE, (_, content) => {
42305
- if (ssr && clientJSMap)
42306
- clientJSMap[id] = content;
42308
+ if (ssr && clientJSMap) clientJSMap[id] = content;
42307
42309
  return `
42308
42310
  `.repeat(_.split("\n").length - 1);
42309
42311
  }) : code;
@@ -46468,11 +46470,9 @@ function requireDist () {
46468
46470
  var distExports = requireDist();
46469
46471
 
46470
46472
  async function generateSitemap(siteConfig) {
46471
- if (!siteConfig.sitemap?.hostname)
46472
- return;
46473
+ if (!siteConfig.sitemap?.hostname) return;
46473
46474
  const getLastmod = async (url) => {
46474
- if (!siteConfig.lastUpdated)
46475
- return void 0;
46475
+ if (!siteConfig.lastUpdated) return void 0;
46476
46476
  let file = url.replace(/(^|\/)$/, "$1index");
46477
46477
  file = file.replace(/(\.html)?$/, ".md");
46478
46478
  file = siteConfig.rewrites.inv[file] || file;
@@ -46494,10 +46494,8 @@ async function generateSitemap(siteConfig) {
46494
46494
  const lang = locales[locale]?.lang || defaultLang;
46495
46495
  let url = page.replace(/(^|\/)index\.md$/, "$1");
46496
46496
  url = url.replace(/\.md$/, siteConfig.cleanUrls ? "" : ".html");
46497
- if (filteredLocales.includes(locale))
46498
- page = page.slice(locale.length + 1);
46499
- if (!groupedPages[page])
46500
- groupedPages[page] = [];
46497
+ if (filteredLocales.includes(locale)) page = page.slice(locale.length + 1);
46498
+ if (!groupedPages[page]) groupedPages[page] = [];
46501
46499
  groupedPages[page].push({ url, lang });
46502
46500
  });
46503
46501
  const _items = await Promise.all(
@@ -46522,26 +46520,6 @@ async function generateSitemap(siteConfig) {
46522
46520
  });
46523
46521
  }
46524
46522
 
46525
- /**
46526
- * @vue/shared v3.4.25
46527
- * (c) 2018-present Yuxi (Evan) You and Vue contributors
46528
- * @license MIT
46529
- **/
46530
- /*! #__NO_SIDE_EFFECTS__ */
46531
- // @__NO_SIDE_EFFECTS__
46532
- function makeMap(str, expectsLowerCase) {
46533
- const set = new Set(str.split(","));
46534
- return expectsLowerCase ? (val) => set.has(val.toLowerCase()) : (val) => set.has(val);
46535
- }
46536
-
46537
- !!(process.env.NODE_ENV !== "production") ? Object.freeze({}) : {};
46538
- !!(process.env.NODE_ENV !== "production") ? Object.freeze([]) : [];
46539
-
46540
- const specialBooleanAttrs = `itemscope,allowfullscreen,formnovalidate,ismap,nomodule,novalidate,readonly`;
46541
- const isBooleanAttr = /* @__PURE__ */ makeMap(
46542
- specialBooleanAttrs + `,async,autofocus,autoplay,controls,default,defer,disabled,hidden,inert,loop,open,required,reversed,scoped,seamless,checked,muted,multiple,selected`
46543
- );
46544
-
46545
46523
  /*!
46546
46524
  * escape-html
46547
46525
  * Copyright(c) 2012-2013 TJ Holowaychuk
@@ -46621,7 +46599,7 @@ function escapeHtml(string) {
46621
46599
 
46622
46600
  var escape$1 = /*@__PURE__*/getDefaultExportFromCjs(escapeHtml_1);
46623
46601
 
46624
- var version = "1.1.4";
46602
+ var version = "1.2.0";
46625
46603
 
46626
46604
  async function renderPage(render, config, page, result, appChunk, cssChunk, assets, pageToHashMap, metadataScript, additionalHeadTags) {
46627
46605
  const routePath = `/${page.replace(/\.md$/, "")}`;
@@ -46727,7 +46705,7 @@ async function renderPage(render, config, page, result, appChunk, cssChunk, asse
46727
46705
  ${await renderHead(head)}
46728
46706
  </head>
46729
46707
  <body>${teleports?.body || ""}
46730
- <div id="app">${content}</div>
46708
+ <div id="app">${page === "404.md" ? "" : content}</div>
46731
46709
  ${metadataScript.inHead ? "" : metadataScript.html}
46732
46710
  ${inlinedScript}
46733
46711
  </body>
@@ -46787,8 +46765,7 @@ async function renderHead(head) {
46787
46765
  }
46788
46766
  function renderAttrs(attrs) {
46789
46767
  return Object.keys(attrs).map((key) => {
46790
- if (isBooleanAttr(key))
46791
- return ` ${key}`;
46768
+ if (isBooleanAttr(key)) return ` ${key}`;
46792
46769
  return ` ${key}="${escape$1(attrs[key])}"`;
46793
46770
  }).join("");
46794
46771
  }
@@ -46892,8 +46869,7 @@ async function build(root, buildOptions = {}) {
46892
46869
  );
46893
46870
  } finally {
46894
46871
  unlinkVue();
46895
- if (!process.env.DEBUG)
46896
- await rimraf(siteConfig.tempDir);
46872
+ if (!process.env.DEBUG) await rimraf(siteConfig.tempDir);
46897
46873
  }
46898
46874
  await generateSitemap(siteConfig);
46899
46875
  await siteConfig.buildEnd?.(siteConfig);
@@ -50096,8 +50072,8 @@ function viaLocal(dir, isEtag, uri, extns) {
50096
50072
  let abs, stats, name, headers;
50097
50073
  for (; i < arr.length; i++) {
50098
50074
  abs = normalize$3(join(dir, name=arr[i]));
50099
- if (abs.startsWith(dir) && fs$t.existsSync(abs)) {
50100
- stats = fs$t.statSync(abs);
50075
+ if (abs.startsWith(dir) && fs$u.existsSync(abs)) {
50076
+ stats = fs$u.statSync(abs);
50101
50077
  if (stats.isDirectory()) continue;
50102
50078
  headers = toHeaders(name, stats, isEtag);
50103
50079
  headers['Cache-Control'] = isEtag ? 'no-cache' : 'no-store';
@@ -50145,7 +50121,7 @@ function send(req, res, file, stats, headers) {
50145
50121
  }
50146
50122
 
50147
50123
  res.writeHead(code, headers);
50148
- fs$t.createReadStream(file, opts).pipe(res);
50124
+ fs$u.createReadStream(file, opts).pipe(res);
50149
50125
  }
50150
50126
 
50151
50127
  const ENCODING = {
@@ -50266,8 +50242,7 @@ async function serve(options = {}) {
50266
50242
  const notFound = fs$a.readFileSync(path$q.resolve(config.outDir, "./404.html"));
50267
50243
  const onNoMatch = (req, res) => {
50268
50244
  res.statusCode = 404;
50269
- if (notAnAsset(req.path))
50270
- res.write(notFound.toString());
50245
+ if (notAnAsset(req.path)) res.write(notFound.toString());
50271
50246
  res.end();
50272
50247
  };
50273
50248
  const compress = compression({ brotli: true });