vitepress 1.2.1 → 1.2.2
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/client/app/utils.js +1 -1
- package/dist/client/index.d.ts +5 -1
- package/dist/client/index.js +1 -1
- package/dist/client/shared.js +10 -0
- package/dist/node/cli.js +1 -1
- package/dist/node/index.js +2 -2
- package/dist/node/{serve-DGS-XFVh.js → serve-BwR5EPUJ.js} +22 -101
- package/package.json +1 -3
package/dist/client/app/utils.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { siteDataRef } from './data';
|
|
2
2
|
import { inBrowser, EXTERNAL_URL_RE, sanitizeFileName } from '../shared';
|
|
3
3
|
import { h, onMounted, onUnmounted, shallowRef } from 'vue';
|
|
4
|
-
export { inBrowser } from '../shared';
|
|
4
|
+
export { inBrowser, escapeHtml as _escapeHtml } from '../shared';
|
|
5
5
|
/**
|
|
6
6
|
* Join two paths by resolving the slash collision.
|
|
7
7
|
*/
|
package/dist/client/index.d.ts
CHANGED
|
@@ -4,6 +4,10 @@ import { PageData, Awaitable, SiteData } from '../../types/shared.js';
|
|
|
4
4
|
export { HeadConfig, Header, PageData, SiteData } from '../../types/shared.js';
|
|
5
5
|
|
|
6
6
|
declare const inBrowser: boolean;
|
|
7
|
+
/**
|
|
8
|
+
* @internal
|
|
9
|
+
*/
|
|
10
|
+
declare function escapeHtml(str: string): string;
|
|
7
11
|
|
|
8
12
|
interface Route {
|
|
9
13
|
path: string;
|
|
@@ -122,4 +126,4 @@ declare const Content: vue.DefineComponent<{
|
|
|
122
126
|
as: string | Record<string, any>;
|
|
123
127
|
}, {}>;
|
|
124
128
|
|
|
125
|
-
export { Content, type EnhanceAppContext, type Route, type Router, type Theme, type VitePressData, dataSymbol, defineClientComponent, getScrollOffset, inBrowser, onContentUpdated, useData, useRoute, useRouter, withBase };
|
|
129
|
+
export { Content, type EnhanceAppContext, type Route, type Router, type Theme, type VitePressData, escapeHtml as _escapeHtml, dataSymbol, defineClientComponent, getScrollOffset, inBrowser, onContentUpdated, useData, useRoute, useRouter, withBase };
|
package/dist/client/index.js
CHANGED
|
@@ -4,6 +4,6 @@
|
|
|
4
4
|
export { useData, dataSymbol } from './app/data';
|
|
5
5
|
export { useRoute, useRouter } from './app/router';
|
|
6
6
|
// utilities
|
|
7
|
-
export { inBrowser, onContentUpdated, defineClientComponent, withBase, getScrollOffset } from './app/utils';
|
|
7
|
+
export { inBrowser, onContentUpdated, defineClientComponent, withBase, getScrollOffset, _escapeHtml } from './app/utils';
|
|
8
8
|
// components
|
|
9
9
|
export { Content } from './app/components/Content';
|
package/dist/client/shared.js
CHANGED
|
@@ -140,3 +140,13 @@ export function treatAsHtml(filename) {
|
|
|
140
140
|
export function escapeRegExp(str) {
|
|
141
141
|
return str.replace(/[|\\{}()[\]^$+*?.]/g, '\\$&').replace(/-/g, '\\x2d');
|
|
142
142
|
}
|
|
143
|
+
/**
|
|
144
|
+
* @internal
|
|
145
|
+
*/
|
|
146
|
+
export function escapeHtml(str) {
|
|
147
|
+
return str
|
|
148
|
+
.replace(/</g, '<')
|
|
149
|
+
.replace(/>/g, '>')
|
|
150
|
+
.replace(/"/g, '"')
|
|
151
|
+
.replace(/&(?![\w#]+;)/g, '&');
|
|
152
|
+
}
|
package/dist/node/cli.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as getDefaultExportFromCjs, q as c, t as clearCache, n as init, b as build, o as serve, v as version, p as createServer } from './serve-
|
|
1
|
+
import { a as getDefaultExportFromCjs, q as c, t as clearCache, n as init, b as build, o as serve, v as version, p as createServer } from './serve-BwR5EPUJ.js';
|
|
2
2
|
import { createLogger } from 'vite';
|
|
3
3
|
import 'path';
|
|
4
4
|
import 'shiki';
|
package/dist/node/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { normalizePath } from 'vite';
|
|
2
2
|
export { loadEnv } from 'vite';
|
|
3
|
-
import { g as glob, c as createMarkdownRenderer, f as fs, m as matter, a as getDefaultExportFromCjs } from './serve-
|
|
4
|
-
export { S as ScaffoldThemeType, b as build, p as createServer, e as defineConfig, h as defineConfigWithTheme, d as defineLoader, n as init, j as mergeConfig, r as resolveConfig, l as resolvePages, k as resolveSiteData, i as resolveUserConfig, s as scaffold, o as serve } from './serve-
|
|
3
|
+
import { g as glob, c as createMarkdownRenderer, f as fs, m as matter, a as getDefaultExportFromCjs } from './serve-BwR5EPUJ.js';
|
|
4
|
+
export { S as ScaffoldThemeType, b as build, p as createServer, e as defineConfig, h as defineConfigWithTheme, d as defineLoader, n as init, j as mergeConfig, r as resolveConfig, l as resolvePages, k as resolveSiteData, i as resolveUserConfig, s as scaffold, o as serve } from './serve-BwR5EPUJ.js';
|
|
5
5
|
import path from 'path';
|
|
6
6
|
import 'crypto';
|
|
7
7
|
import 'module';
|
|
@@ -3743,7 +3743,7 @@ class AST {
|
|
|
3743
3743
|
* that exact character. In this mode, `\` is _not_ escaped, because it is
|
|
3744
3744
|
* not interpreted as a magic character, but instead as a path separator.
|
|
3745
3745
|
*/
|
|
3746
|
-
const escape$
|
|
3746
|
+
const escape$3 = (s, { windowsPathsNoEscape = false, } = {}) => {
|
|
3747
3747
|
// don't need to escape +@! because we escape the parens
|
|
3748
3748
|
// that make those magic, and escaping ! as [!] isn't valid,
|
|
3749
3749
|
// because [!]] is a valid glob class meaning not ']'.
|
|
@@ -4740,7 +4740,7 @@ class Minimatch {
|
|
|
4740
4740
|
/* c8 ignore stop */
|
|
4741
4741
|
minimatch.AST = AST;
|
|
4742
4742
|
minimatch.Minimatch = Minimatch;
|
|
4743
|
-
minimatch.escape = escape$
|
|
4743
|
+
minimatch.escape = escape$3;
|
|
4744
4744
|
minimatch.unescape = unescape;
|
|
4745
4745
|
|
|
4746
4746
|
/**
|
|
@@ -10454,7 +10454,7 @@ const glob$1 = Object.assign(glob_, {
|
|
|
10454
10454
|
iterateSync,
|
|
10455
10455
|
Glob,
|
|
10456
10456
|
hasMagic,
|
|
10457
|
-
escape: escape$
|
|
10457
|
+
escape: escape$3,
|
|
10458
10458
|
unescape,
|
|
10459
10459
|
});
|
|
10460
10460
|
glob$1.glob = glob$1;
|
|
@@ -19941,6 +19941,9 @@ function treatAsHtml(filename) {
|
|
|
19941
19941
|
function escapeRegExp$1(str) {
|
|
19942
19942
|
return str.replace(/[|\\{}()[\]^$+*?.]/g, "\\$&").replace(/-/g, "\\x2d");
|
|
19943
19943
|
}
|
|
19944
|
+
function escapeHtml$1(str) {
|
|
19945
|
+
return str.replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/&(?![\w#]+;)/g, "&");
|
|
19946
|
+
}
|
|
19944
19947
|
|
|
19945
19948
|
const debug$2 = _debug("vitepress:config");
|
|
19946
19949
|
const resolve = (root, file) => normalizePath(path$q.resolve(root, `.vitepress`, file));
|
|
@@ -26695,7 +26698,7 @@ function replaceUnsafeChar$1 (ch) {
|
|
|
26695
26698
|
return HTML_REPLACEMENTS$1[ch]
|
|
26696
26699
|
}
|
|
26697
26700
|
|
|
26698
|
-
function escapeHtml
|
|
26701
|
+
function escapeHtml (str) {
|
|
26699
26702
|
if (HTML_ESCAPE_TEST_RE$1.test(str)) {
|
|
26700
26703
|
return str.replace(HTML_ESCAPE_REPLACE_RE$1, replaceUnsafeChar$1)
|
|
26701
26704
|
}
|
|
@@ -26853,7 +26856,7 @@ var utils$3 = /*#__PURE__*/Object.freeze({
|
|
|
26853
26856
|
__proto__: null,
|
|
26854
26857
|
arrayReplaceAt: arrayReplaceAt,
|
|
26855
26858
|
assign: assign$1,
|
|
26856
|
-
escapeHtml: escapeHtml
|
|
26859
|
+
escapeHtml: escapeHtml,
|
|
26857
26860
|
escapeRE: escapeRE$1,
|
|
26858
26861
|
fromCodePoint: fromCodePoint,
|
|
26859
26862
|
has: has,
|
|
@@ -27086,7 +27089,7 @@ default_rules.code_inline = function (tokens, idx, options, env, slf) {
|
|
|
27086
27089
|
const token = tokens[idx];
|
|
27087
27090
|
|
|
27088
27091
|
return '<code' + slf.renderAttrs(token) + '>' +
|
|
27089
|
-
escapeHtml
|
|
27092
|
+
escapeHtml(token.content) +
|
|
27090
27093
|
'</code>'
|
|
27091
27094
|
};
|
|
27092
27095
|
|
|
@@ -27094,7 +27097,7 @@ default_rules.code_block = function (tokens, idx, options, env, slf) {
|
|
|
27094
27097
|
const token = tokens[idx];
|
|
27095
27098
|
|
|
27096
27099
|
return '<pre' + slf.renderAttrs(token) + '><code>' +
|
|
27097
|
-
escapeHtml
|
|
27100
|
+
escapeHtml(tokens[idx].content) +
|
|
27098
27101
|
'</code></pre>\n'
|
|
27099
27102
|
};
|
|
27100
27103
|
|
|
@@ -27112,9 +27115,9 @@ default_rules.fence = function (tokens, idx, options, env, slf) {
|
|
|
27112
27115
|
|
|
27113
27116
|
let highlighted;
|
|
27114
27117
|
if (options.highlight) {
|
|
27115
|
-
highlighted = options.highlight(token.content, langName, langAttrs) || escapeHtml
|
|
27118
|
+
highlighted = options.highlight(token.content, langName, langAttrs) || escapeHtml(token.content);
|
|
27116
27119
|
} else {
|
|
27117
|
-
highlighted = escapeHtml
|
|
27120
|
+
highlighted = escapeHtml(token.content);
|
|
27118
27121
|
}
|
|
27119
27122
|
|
|
27120
27123
|
if (highlighted.indexOf('<pre') === 0) {
|
|
@@ -27168,7 +27171,7 @@ default_rules.softbreak = function (tokens, idx, options /*, env */) {
|
|
|
27168
27171
|
};
|
|
27169
27172
|
|
|
27170
27173
|
default_rules.text = function (tokens, idx /*, options, env */) {
|
|
27171
|
-
return escapeHtml
|
|
27174
|
+
return escapeHtml(tokens[idx].content)
|
|
27172
27175
|
};
|
|
27173
27176
|
|
|
27174
27177
|
default_rules.html_block = function (tokens, idx /*, options, env */) {
|
|
@@ -27228,7 +27231,7 @@ Renderer.prototype.renderAttrs = function renderAttrs (token) {
|
|
|
27228
27231
|
result = '';
|
|
27229
27232
|
|
|
27230
27233
|
for (i = 0, l = token.attrs.length; i < l; i++) {
|
|
27231
|
-
result += ' ' + escapeHtml
|
|
27234
|
+
result += ' ' + escapeHtml(token.attrs[i][0]) + '="' + escapeHtml(token.attrs[i][1]) + '"';
|
|
27232
27235
|
}
|
|
27233
27236
|
|
|
27234
27237
|
return result
|
|
@@ -30636,7 +30639,7 @@ for (let i = 0; i < 256; i++) { ESCAPED.push(0); }
|
|
|
30636
30639
|
'\\!"#$%&\'()*+,./:;<=>?@[]^_`{|}~-'
|
|
30637
30640
|
.split('').forEach(function (ch) { ESCAPED[ch.charCodeAt(0)] = 1; });
|
|
30638
30641
|
|
|
30639
|
-
function escape$
|
|
30642
|
+
function escape$2 (state, silent) {
|
|
30640
30643
|
let pos = state.pos;
|
|
30641
30644
|
const max = state.posMax;
|
|
30642
30645
|
|
|
@@ -31635,7 +31638,7 @@ const _rules = [
|
|
|
31635
31638
|
['text', text$1],
|
|
31636
31639
|
['linkify', linkify],
|
|
31637
31640
|
['newline', newline],
|
|
31638
|
-
['escape', escape$
|
|
31641
|
+
['escape', escape$2],
|
|
31639
31642
|
['backticks', backtick],
|
|
31640
31643
|
['strikethrough', r_strikethrough.tokenize],
|
|
31641
31644
|
['emphasis', r_emphasis.tokenize],
|
|
@@ -37381,9 +37384,6 @@ function text_join(state) {
|
|
|
37381
37384
|
function getContent(token) {
|
|
37382
37385
|
return token.info === "entity" ? token.markup : token.info === "escape" && token.content === "&" ? "&" : token.content;
|
|
37383
37386
|
}
|
|
37384
|
-
function escapeHtml$1(str) {
|
|
37385
|
-
return str.replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """);
|
|
37386
|
-
}
|
|
37387
37387
|
|
|
37388
37388
|
const rawPathRegexp = /^(.+?(?:(?:\.([a-z0-9]+))?))(?:(#[\w-]+))?(?: ?(?:{(\d+(?:[,-]\d+)*)? ?(\S+)?}))? ?(?:\[(.+)\])?$/;
|
|
37389
37389
|
function rawPathToToken(rawPath) {
|
|
@@ -38033,7 +38033,7 @@ var readShebang_1 = readShebang$1;
|
|
|
38033
38033
|
|
|
38034
38034
|
const path = path$q;
|
|
38035
38035
|
const resolveCommand = resolveCommand_1;
|
|
38036
|
-
const escape$
|
|
38036
|
+
const escape$1 = _escape;
|
|
38037
38037
|
const readShebang = readShebang_1;
|
|
38038
38038
|
|
|
38039
38039
|
const isWin$2 = process.platform === 'win32';
|
|
@@ -38080,8 +38080,8 @@ function parseNonShell(parsed) {
|
|
|
38080
38080
|
parsed.command = path.normalize(parsed.command);
|
|
38081
38081
|
|
|
38082
38082
|
// Escape command & arguments
|
|
38083
|
-
parsed.command = escape$
|
|
38084
|
-
parsed.args = parsed.args.map((arg) => escape$
|
|
38083
|
+
parsed.command = escape$1.command(parsed.command);
|
|
38084
|
+
parsed.args = parsed.args.map((arg) => escape$1.argument(arg, needsDoubleEscapeMetaChars));
|
|
38085
38085
|
|
|
38086
38086
|
const shellCommand = [parsed.command].concat(parsed.args).join(' ');
|
|
38087
38087
|
|
|
@@ -46519,86 +46519,7 @@ async function generateSitemap(siteConfig) {
|
|
|
46519
46519
|
});
|
|
46520
46520
|
}
|
|
46521
46521
|
|
|
46522
|
-
|
|
46523
|
-
* escape-html
|
|
46524
|
-
* Copyright(c) 2012-2013 TJ Holowaychuk
|
|
46525
|
-
* Copyright(c) 2015 Andreas Lubbe
|
|
46526
|
-
* Copyright(c) 2015 Tiancheng "Timothy" Gu
|
|
46527
|
-
* MIT Licensed
|
|
46528
|
-
*/
|
|
46529
|
-
|
|
46530
|
-
/**
|
|
46531
|
-
* Module variables.
|
|
46532
|
-
* @private
|
|
46533
|
-
*/
|
|
46534
|
-
|
|
46535
|
-
var matchHtmlRegExp = /["'&<>]/;
|
|
46536
|
-
|
|
46537
|
-
/**
|
|
46538
|
-
* Module exports.
|
|
46539
|
-
* @public
|
|
46540
|
-
*/
|
|
46541
|
-
|
|
46542
|
-
var escapeHtml_1 = escapeHtml;
|
|
46543
|
-
|
|
46544
|
-
/**
|
|
46545
|
-
* Escape special characters in the given string of html.
|
|
46546
|
-
*
|
|
46547
|
-
* @param {string} string The string to escape for inserting into HTML
|
|
46548
|
-
* @return {string}
|
|
46549
|
-
* @public
|
|
46550
|
-
*/
|
|
46551
|
-
|
|
46552
|
-
function escapeHtml(string) {
|
|
46553
|
-
var str = '' + string;
|
|
46554
|
-
var match = matchHtmlRegExp.exec(str);
|
|
46555
|
-
|
|
46556
|
-
if (!match) {
|
|
46557
|
-
return str;
|
|
46558
|
-
}
|
|
46559
|
-
|
|
46560
|
-
var escape;
|
|
46561
|
-
var html = '';
|
|
46562
|
-
var index = 0;
|
|
46563
|
-
var lastIndex = 0;
|
|
46564
|
-
|
|
46565
|
-
for (index = match.index; index < str.length; index++) {
|
|
46566
|
-
switch (str.charCodeAt(index)) {
|
|
46567
|
-
case 34: // "
|
|
46568
|
-
escape = '"';
|
|
46569
|
-
break;
|
|
46570
|
-
case 38: // &
|
|
46571
|
-
escape = '&';
|
|
46572
|
-
break;
|
|
46573
|
-
case 39: // '
|
|
46574
|
-
escape = ''';
|
|
46575
|
-
break;
|
|
46576
|
-
case 60: // <
|
|
46577
|
-
escape = '<';
|
|
46578
|
-
break;
|
|
46579
|
-
case 62: // >
|
|
46580
|
-
escape = '>';
|
|
46581
|
-
break;
|
|
46582
|
-
default:
|
|
46583
|
-
continue;
|
|
46584
|
-
}
|
|
46585
|
-
|
|
46586
|
-
if (lastIndex !== index) {
|
|
46587
|
-
html += str.substring(lastIndex, index);
|
|
46588
|
-
}
|
|
46589
|
-
|
|
46590
|
-
lastIndex = index + 1;
|
|
46591
|
-
html += escape;
|
|
46592
|
-
}
|
|
46593
|
-
|
|
46594
|
-
return lastIndex !== index
|
|
46595
|
-
? html + str.substring(lastIndex, index)
|
|
46596
|
-
: html;
|
|
46597
|
-
}
|
|
46598
|
-
|
|
46599
|
-
var escape$1 = /*@__PURE__*/getDefaultExportFromCjs(escapeHtml_1);
|
|
46600
|
-
|
|
46601
|
-
var version = "1.2.1";
|
|
46522
|
+
var version = "1.2.2";
|
|
46602
46523
|
|
|
46603
46524
|
async function renderPage(render, config, page, result, appChunk, cssChunk, assets, pageToHashMap, metadataScript, additionalHeadTags) {
|
|
46604
46525
|
const routePath = `/${page.replace(/\.md$/, "")}`;
|
|
@@ -46695,7 +46616,7 @@ async function renderPage(render, config, page, result, appChunk, cssChunk, asse
|
|
|
46695
46616
|
<head>
|
|
46696
46617
|
<meta charset="utf-8">
|
|
46697
46618
|
${isMetaViewportOverridden(head) ? "" : '<meta name="viewport" content="width=device-width,initial-scale=1">'}
|
|
46698
|
-
<title>${
|
|
46619
|
+
<title>${escapeHtml$1(title)}</title>
|
|
46699
46620
|
${isDescriptionOverridden(head) ? "" : `<meta name="description" content="${description}">`}
|
|
46700
46621
|
<meta name="generator" content="VitePress v${version}">
|
|
46701
46622
|
${stylesheetLink}
|
|
@@ -46765,7 +46686,7 @@ async function renderHead(head) {
|
|
|
46765
46686
|
function renderAttrs(attrs) {
|
|
46766
46687
|
return Object.keys(attrs).map((key) => {
|
|
46767
46688
|
if (isBooleanAttr(key)) return ` ${key}`;
|
|
46768
|
-
return ` ${key}="${
|
|
46689
|
+
return ` ${key}="${escapeHtml$1(attrs[key])}"`;
|
|
46769
46690
|
}).join("");
|
|
46770
46691
|
}
|
|
46771
46692
|
function filterOutHeadDescription(head = []) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vitepress",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.2",
|
|
4
4
|
"description": "Vite & Vue powered static site generator",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"vite",
|
|
@@ -95,7 +95,6 @@
|
|
|
95
95
|
"@rollup/plugin-replace": "^5.0.5",
|
|
96
96
|
"@types/cross-spawn": "^6.0.6",
|
|
97
97
|
"@types/debug": "^4.1.12",
|
|
98
|
-
"@types/escape-html": "^1.0.4",
|
|
99
98
|
"@types/fs-extra": "^11.0.4",
|
|
100
99
|
"@types/lodash.template": "^4.5.3",
|
|
101
100
|
"@types/mark.js": "^8.11.12",
|
|
@@ -112,7 +111,6 @@
|
|
|
112
111
|
"cross-spawn": "^7.0.3",
|
|
113
112
|
"debug": "^4.3.4",
|
|
114
113
|
"esbuild": "^0.21.3",
|
|
115
|
-
"escape-html": "^1.0.3",
|
|
116
114
|
"execa": "^9.1.0",
|
|
117
115
|
"fast-glob": "^3.3.2",
|
|
118
116
|
"fs-extra": "^11.2.0",
|