@slidev/cli 0.48.0-beta.9 → 0.48.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/{build-VD6UTPEW.mjs → build-KHRRQKZT.mjs} +6 -42
- package/dist/chunk-AQQIBD5X.mjs +187 -0
- package/dist/chunk-EAVFHD5X.mjs +2216 -0
- package/dist/{chunk-O6TYYGU6.mjs → chunk-LOUKLO2C.mjs} +1 -1
- package/dist/{chunk-ZUTJP24H.mjs → chunk-RNSSCHDN.mjs} +20 -20
- package/dist/cli.mjs +70 -19
- package/dist/{export-SM2ZATWB.mjs → export-P7ZNLPWH.mjs} +40 -12
- package/dist/index.d.mts +5 -84
- package/dist/index.mjs +4 -5
- package/dist/{unocss-XALM635U.mjs → unocss-AGKZGMYO.mjs} +2 -3
- package/package.json +17 -16
- package/template.md +2 -2
- package/dist/chunk-72Z3DJCK.mjs +0 -4320
- package/dist/chunk-7HOZGSL4.mjs +0 -5552
- package/dist/chunk-BXO7ZPPU.mjs +0 -30
package/dist/chunk-72Z3DJCK.mjs
DELETED
|
@@ -1,4320 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
loadSetups
|
|
3
|
-
} from "./chunk-O6TYYGU6.mjs";
|
|
4
|
-
import {
|
|
5
|
-
resolveImportPath,
|
|
6
|
-
toAtFS
|
|
7
|
-
} from "./chunk-7HOZGSL4.mjs";
|
|
8
|
-
import {
|
|
9
|
-
__commonJS,
|
|
10
|
-
__toESM
|
|
11
|
-
} from "./chunk-BXO7ZPPU.mjs";
|
|
12
|
-
|
|
13
|
-
// ../../node_modules/.pnpm/semver@7.6.0/node_modules/semver/internal/constants.js
|
|
14
|
-
var require_constants = __commonJS({
|
|
15
|
-
"../../node_modules/.pnpm/semver@7.6.0/node_modules/semver/internal/constants.js"(exports, module) {
|
|
16
|
-
"use strict";
|
|
17
|
-
var SEMVER_SPEC_VERSION = "2.0.0";
|
|
18
|
-
var MAX_LENGTH = 256;
|
|
19
|
-
var MAX_SAFE_INTEGER = Number.MAX_SAFE_INTEGER || /* istanbul ignore next */
|
|
20
|
-
9007199254740991;
|
|
21
|
-
var MAX_SAFE_COMPONENT_LENGTH = 16;
|
|
22
|
-
var MAX_SAFE_BUILD_LENGTH = MAX_LENGTH - 6;
|
|
23
|
-
var RELEASE_TYPES = [
|
|
24
|
-
"major",
|
|
25
|
-
"premajor",
|
|
26
|
-
"minor",
|
|
27
|
-
"preminor",
|
|
28
|
-
"patch",
|
|
29
|
-
"prepatch",
|
|
30
|
-
"prerelease"
|
|
31
|
-
];
|
|
32
|
-
module.exports = {
|
|
33
|
-
MAX_LENGTH,
|
|
34
|
-
MAX_SAFE_COMPONENT_LENGTH,
|
|
35
|
-
MAX_SAFE_BUILD_LENGTH,
|
|
36
|
-
MAX_SAFE_INTEGER,
|
|
37
|
-
RELEASE_TYPES,
|
|
38
|
-
SEMVER_SPEC_VERSION,
|
|
39
|
-
FLAG_INCLUDE_PRERELEASE: 1,
|
|
40
|
-
FLAG_LOOSE: 2
|
|
41
|
-
};
|
|
42
|
-
}
|
|
43
|
-
});
|
|
44
|
-
|
|
45
|
-
// ../../node_modules/.pnpm/semver@7.6.0/node_modules/semver/internal/debug.js
|
|
46
|
-
var require_debug = __commonJS({
|
|
47
|
-
"../../node_modules/.pnpm/semver@7.6.0/node_modules/semver/internal/debug.js"(exports, module) {
|
|
48
|
-
"use strict";
|
|
49
|
-
var debug = typeof process === "object" && process.env && process.env.NODE_DEBUG && /\bsemver\b/i.test(process.env.NODE_DEBUG) ? (...args) => console.error("SEMVER", ...args) : () => {
|
|
50
|
-
};
|
|
51
|
-
module.exports = debug;
|
|
52
|
-
}
|
|
53
|
-
});
|
|
54
|
-
|
|
55
|
-
// ../../node_modules/.pnpm/semver@7.6.0/node_modules/semver/internal/re.js
|
|
56
|
-
var require_re = __commonJS({
|
|
57
|
-
"../../node_modules/.pnpm/semver@7.6.0/node_modules/semver/internal/re.js"(exports, module) {
|
|
58
|
-
"use strict";
|
|
59
|
-
var {
|
|
60
|
-
MAX_SAFE_COMPONENT_LENGTH,
|
|
61
|
-
MAX_SAFE_BUILD_LENGTH,
|
|
62
|
-
MAX_LENGTH
|
|
63
|
-
} = require_constants();
|
|
64
|
-
var debug = require_debug();
|
|
65
|
-
exports = module.exports = {};
|
|
66
|
-
var re = exports.re = [];
|
|
67
|
-
var safeRe = exports.safeRe = [];
|
|
68
|
-
var src = exports.src = [];
|
|
69
|
-
var t = exports.t = {};
|
|
70
|
-
var R = 0;
|
|
71
|
-
var LETTERDASHNUMBER = "[a-zA-Z0-9-]";
|
|
72
|
-
var safeRegexReplacements = [
|
|
73
|
-
["\\s", 1],
|
|
74
|
-
["\\d", MAX_LENGTH],
|
|
75
|
-
[LETTERDASHNUMBER, MAX_SAFE_BUILD_LENGTH]
|
|
76
|
-
];
|
|
77
|
-
var makeSafeRegex = (value) => {
|
|
78
|
-
for (const [token, max] of safeRegexReplacements) {
|
|
79
|
-
value = value.split(`${token}*`).join(`${token}{0,${max}}`).split(`${token}+`).join(`${token}{1,${max}}`);
|
|
80
|
-
}
|
|
81
|
-
return value;
|
|
82
|
-
};
|
|
83
|
-
var createToken = (name, value, isGlobal) => {
|
|
84
|
-
const safe = makeSafeRegex(value);
|
|
85
|
-
const index = R++;
|
|
86
|
-
debug(name, index, value);
|
|
87
|
-
t[name] = index;
|
|
88
|
-
src[index] = value;
|
|
89
|
-
re[index] = new RegExp(value, isGlobal ? "g" : void 0);
|
|
90
|
-
safeRe[index] = new RegExp(safe, isGlobal ? "g" : void 0);
|
|
91
|
-
};
|
|
92
|
-
createToken("NUMERICIDENTIFIER", "0|[1-9]\\d*");
|
|
93
|
-
createToken("NUMERICIDENTIFIERLOOSE", "\\d+");
|
|
94
|
-
createToken("NONNUMERICIDENTIFIER", `\\d*[a-zA-Z-]${LETTERDASHNUMBER}*`);
|
|
95
|
-
createToken("MAINVERSION", `(${src[t.NUMERICIDENTIFIER]})\\.(${src[t.NUMERICIDENTIFIER]})\\.(${src[t.NUMERICIDENTIFIER]})`);
|
|
96
|
-
createToken("MAINVERSIONLOOSE", `(${src[t.NUMERICIDENTIFIERLOOSE]})\\.(${src[t.NUMERICIDENTIFIERLOOSE]})\\.(${src[t.NUMERICIDENTIFIERLOOSE]})`);
|
|
97
|
-
createToken("PRERELEASEIDENTIFIER", `(?:${src[t.NUMERICIDENTIFIER]}|${src[t.NONNUMERICIDENTIFIER]})`);
|
|
98
|
-
createToken("PRERELEASEIDENTIFIERLOOSE", `(?:${src[t.NUMERICIDENTIFIERLOOSE]}|${src[t.NONNUMERICIDENTIFIER]})`);
|
|
99
|
-
createToken("PRERELEASE", `(?:-(${src[t.PRERELEASEIDENTIFIER]}(?:\\.${src[t.PRERELEASEIDENTIFIER]})*))`);
|
|
100
|
-
createToken("PRERELEASELOOSE", `(?:-?(${src[t.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${src[t.PRERELEASEIDENTIFIERLOOSE]})*))`);
|
|
101
|
-
createToken("BUILDIDENTIFIER", `${LETTERDASHNUMBER}+`);
|
|
102
|
-
createToken("BUILD", `(?:\\+(${src[t.BUILDIDENTIFIER]}(?:\\.${src[t.BUILDIDENTIFIER]})*))`);
|
|
103
|
-
createToken("FULLPLAIN", `v?${src[t.MAINVERSION]}${src[t.PRERELEASE]}?${src[t.BUILD]}?`);
|
|
104
|
-
createToken("FULL", `^${src[t.FULLPLAIN]}$`);
|
|
105
|
-
createToken("LOOSEPLAIN", `[v=\\s]*${src[t.MAINVERSIONLOOSE]}${src[t.PRERELEASELOOSE]}?${src[t.BUILD]}?`);
|
|
106
|
-
createToken("LOOSE", `^${src[t.LOOSEPLAIN]}$`);
|
|
107
|
-
createToken("GTLT", "((?:<|>)?=?)");
|
|
108
|
-
createToken("XRANGEIDENTIFIERLOOSE", `${src[t.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`);
|
|
109
|
-
createToken("XRANGEIDENTIFIER", `${src[t.NUMERICIDENTIFIER]}|x|X|\\*`);
|
|
110
|
-
createToken("XRANGEPLAIN", `[v=\\s]*(${src[t.XRANGEIDENTIFIER]})(?:\\.(${src[t.XRANGEIDENTIFIER]})(?:\\.(${src[t.XRANGEIDENTIFIER]})(?:${src[t.PRERELEASE]})?${src[t.BUILD]}?)?)?`);
|
|
111
|
-
createToken("XRANGEPLAINLOOSE", `[v=\\s]*(${src[t.XRANGEIDENTIFIERLOOSE]})(?:\\.(${src[t.XRANGEIDENTIFIERLOOSE]})(?:\\.(${src[t.XRANGEIDENTIFIERLOOSE]})(?:${src[t.PRERELEASELOOSE]})?${src[t.BUILD]}?)?)?`);
|
|
112
|
-
createToken("XRANGE", `^${src[t.GTLT]}\\s*${src[t.XRANGEPLAIN]}$`);
|
|
113
|
-
createToken("XRANGELOOSE", `^${src[t.GTLT]}\\s*${src[t.XRANGEPLAINLOOSE]}$`);
|
|
114
|
-
createToken("COERCEPLAIN", `${"(^|[^\\d])(\\d{1,"}${MAX_SAFE_COMPONENT_LENGTH}})(?:\\.(\\d{1,${MAX_SAFE_COMPONENT_LENGTH}}))?(?:\\.(\\d{1,${MAX_SAFE_COMPONENT_LENGTH}}))?`);
|
|
115
|
-
createToken("COERCE", `${src[t.COERCEPLAIN]}(?:$|[^\\d])`);
|
|
116
|
-
createToken("COERCEFULL", src[t.COERCEPLAIN] + `(?:${src[t.PRERELEASE]})?(?:${src[t.BUILD]})?(?:$|[^\\d])`);
|
|
117
|
-
createToken("COERCERTL", src[t.COERCE], true);
|
|
118
|
-
createToken("COERCERTLFULL", src[t.COERCEFULL], true);
|
|
119
|
-
createToken("LONETILDE", "(?:~>?)");
|
|
120
|
-
createToken("TILDETRIM", `(\\s*)${src[t.LONETILDE]}\\s+`, true);
|
|
121
|
-
exports.tildeTrimReplace = "$1~";
|
|
122
|
-
createToken("TILDE", `^${src[t.LONETILDE]}${src[t.XRANGEPLAIN]}$`);
|
|
123
|
-
createToken("TILDELOOSE", `^${src[t.LONETILDE]}${src[t.XRANGEPLAINLOOSE]}$`);
|
|
124
|
-
createToken("LONECARET", "(?:\\^)");
|
|
125
|
-
createToken("CARETTRIM", `(\\s*)${src[t.LONECARET]}\\s+`, true);
|
|
126
|
-
exports.caretTrimReplace = "$1^";
|
|
127
|
-
createToken("CARET", `^${src[t.LONECARET]}${src[t.XRANGEPLAIN]}$`);
|
|
128
|
-
createToken("CARETLOOSE", `^${src[t.LONECARET]}${src[t.XRANGEPLAINLOOSE]}$`);
|
|
129
|
-
createToken("COMPARATORLOOSE", `^${src[t.GTLT]}\\s*(${src[t.LOOSEPLAIN]})$|^$`);
|
|
130
|
-
createToken("COMPARATOR", `^${src[t.GTLT]}\\s*(${src[t.FULLPLAIN]})$|^$`);
|
|
131
|
-
createToken("COMPARATORTRIM", `(\\s*)${src[t.GTLT]}\\s*(${src[t.LOOSEPLAIN]}|${src[t.XRANGEPLAIN]})`, true);
|
|
132
|
-
exports.comparatorTrimReplace = "$1$2$3";
|
|
133
|
-
createToken("HYPHENRANGE", `^\\s*(${src[t.XRANGEPLAIN]})\\s+-\\s+(${src[t.XRANGEPLAIN]})\\s*$`);
|
|
134
|
-
createToken("HYPHENRANGELOOSE", `^\\s*(${src[t.XRANGEPLAINLOOSE]})\\s+-\\s+(${src[t.XRANGEPLAINLOOSE]})\\s*$`);
|
|
135
|
-
createToken("STAR", "(<|>)?=?\\s*\\*");
|
|
136
|
-
createToken("GTE0", "^\\s*>=\\s*0\\.0\\.0\\s*$");
|
|
137
|
-
createToken("GTE0PRE", "^\\s*>=\\s*0\\.0\\.0-0\\s*$");
|
|
138
|
-
}
|
|
139
|
-
});
|
|
140
|
-
|
|
141
|
-
// ../../node_modules/.pnpm/semver@7.6.0/node_modules/semver/internal/parse-options.js
|
|
142
|
-
var require_parse_options = __commonJS({
|
|
143
|
-
"../../node_modules/.pnpm/semver@7.6.0/node_modules/semver/internal/parse-options.js"(exports, module) {
|
|
144
|
-
"use strict";
|
|
145
|
-
var looseOption = Object.freeze({ loose: true });
|
|
146
|
-
var emptyOpts = Object.freeze({});
|
|
147
|
-
var parseOptions = (options) => {
|
|
148
|
-
if (!options) {
|
|
149
|
-
return emptyOpts;
|
|
150
|
-
}
|
|
151
|
-
if (typeof options !== "object") {
|
|
152
|
-
return looseOption;
|
|
153
|
-
}
|
|
154
|
-
return options;
|
|
155
|
-
};
|
|
156
|
-
module.exports = parseOptions;
|
|
157
|
-
}
|
|
158
|
-
});
|
|
159
|
-
|
|
160
|
-
// ../../node_modules/.pnpm/semver@7.6.0/node_modules/semver/internal/identifiers.js
|
|
161
|
-
var require_identifiers = __commonJS({
|
|
162
|
-
"../../node_modules/.pnpm/semver@7.6.0/node_modules/semver/internal/identifiers.js"(exports, module) {
|
|
163
|
-
"use strict";
|
|
164
|
-
var numeric = /^[0-9]+$/;
|
|
165
|
-
var compareIdentifiers = (a, b) => {
|
|
166
|
-
const anum = numeric.test(a);
|
|
167
|
-
const bnum = numeric.test(b);
|
|
168
|
-
if (anum && bnum) {
|
|
169
|
-
a = +a;
|
|
170
|
-
b = +b;
|
|
171
|
-
}
|
|
172
|
-
return a === b ? 0 : anum && !bnum ? -1 : bnum && !anum ? 1 : a < b ? -1 : 1;
|
|
173
|
-
};
|
|
174
|
-
var rcompareIdentifiers = (a, b) => compareIdentifiers(b, a);
|
|
175
|
-
module.exports = {
|
|
176
|
-
compareIdentifiers,
|
|
177
|
-
rcompareIdentifiers
|
|
178
|
-
};
|
|
179
|
-
}
|
|
180
|
-
});
|
|
181
|
-
|
|
182
|
-
// ../../node_modules/.pnpm/semver@7.6.0/node_modules/semver/classes/semver.js
|
|
183
|
-
var require_semver = __commonJS({
|
|
184
|
-
"../../node_modules/.pnpm/semver@7.6.0/node_modules/semver/classes/semver.js"(exports, module) {
|
|
185
|
-
"use strict";
|
|
186
|
-
var debug = require_debug();
|
|
187
|
-
var { MAX_LENGTH, MAX_SAFE_INTEGER } = require_constants();
|
|
188
|
-
var { safeRe: re, t } = require_re();
|
|
189
|
-
var parseOptions = require_parse_options();
|
|
190
|
-
var { compareIdentifiers } = require_identifiers();
|
|
191
|
-
var SemVer = class _SemVer {
|
|
192
|
-
constructor(version2, options) {
|
|
193
|
-
options = parseOptions(options);
|
|
194
|
-
if (version2 instanceof _SemVer) {
|
|
195
|
-
if (version2.loose === !!options.loose && version2.includePrerelease === !!options.includePrerelease) {
|
|
196
|
-
return version2;
|
|
197
|
-
} else {
|
|
198
|
-
version2 = version2.version;
|
|
199
|
-
}
|
|
200
|
-
} else if (typeof version2 !== "string") {
|
|
201
|
-
throw new TypeError(`Invalid version. Must be a string. Got type "${typeof version2}".`);
|
|
202
|
-
}
|
|
203
|
-
if (version2.length > MAX_LENGTH) {
|
|
204
|
-
throw new TypeError(
|
|
205
|
-
`version is longer than ${MAX_LENGTH} characters`
|
|
206
|
-
);
|
|
207
|
-
}
|
|
208
|
-
debug("SemVer", version2, options);
|
|
209
|
-
this.options = options;
|
|
210
|
-
this.loose = !!options.loose;
|
|
211
|
-
this.includePrerelease = !!options.includePrerelease;
|
|
212
|
-
const m = version2.trim().match(options.loose ? re[t.LOOSE] : re[t.FULL]);
|
|
213
|
-
if (!m) {
|
|
214
|
-
throw new TypeError(`Invalid Version: ${version2}`);
|
|
215
|
-
}
|
|
216
|
-
this.raw = version2;
|
|
217
|
-
this.major = +m[1];
|
|
218
|
-
this.minor = +m[2];
|
|
219
|
-
this.patch = +m[3];
|
|
220
|
-
if (this.major > MAX_SAFE_INTEGER || this.major < 0) {
|
|
221
|
-
throw new TypeError("Invalid major version");
|
|
222
|
-
}
|
|
223
|
-
if (this.minor > MAX_SAFE_INTEGER || this.minor < 0) {
|
|
224
|
-
throw new TypeError("Invalid minor version");
|
|
225
|
-
}
|
|
226
|
-
if (this.patch > MAX_SAFE_INTEGER || this.patch < 0) {
|
|
227
|
-
throw new TypeError("Invalid patch version");
|
|
228
|
-
}
|
|
229
|
-
if (!m[4]) {
|
|
230
|
-
this.prerelease = [];
|
|
231
|
-
} else {
|
|
232
|
-
this.prerelease = m[4].split(".").map((id) => {
|
|
233
|
-
if (/^[0-9]+$/.test(id)) {
|
|
234
|
-
const num = +id;
|
|
235
|
-
if (num >= 0 && num < MAX_SAFE_INTEGER) {
|
|
236
|
-
return num;
|
|
237
|
-
}
|
|
238
|
-
}
|
|
239
|
-
return id;
|
|
240
|
-
});
|
|
241
|
-
}
|
|
242
|
-
this.build = m[5] ? m[5].split(".") : [];
|
|
243
|
-
this.format();
|
|
244
|
-
}
|
|
245
|
-
format() {
|
|
246
|
-
this.version = `${this.major}.${this.minor}.${this.patch}`;
|
|
247
|
-
if (this.prerelease.length) {
|
|
248
|
-
this.version += `-${this.prerelease.join(".")}`;
|
|
249
|
-
}
|
|
250
|
-
return this.version;
|
|
251
|
-
}
|
|
252
|
-
toString() {
|
|
253
|
-
return this.version;
|
|
254
|
-
}
|
|
255
|
-
compare(other) {
|
|
256
|
-
debug("SemVer.compare", this.version, this.options, other);
|
|
257
|
-
if (!(other instanceof _SemVer)) {
|
|
258
|
-
if (typeof other === "string" && other === this.version) {
|
|
259
|
-
return 0;
|
|
260
|
-
}
|
|
261
|
-
other = new _SemVer(other, this.options);
|
|
262
|
-
}
|
|
263
|
-
if (other.version === this.version) {
|
|
264
|
-
return 0;
|
|
265
|
-
}
|
|
266
|
-
return this.compareMain(other) || this.comparePre(other);
|
|
267
|
-
}
|
|
268
|
-
compareMain(other) {
|
|
269
|
-
if (!(other instanceof _SemVer)) {
|
|
270
|
-
other = new _SemVer(other, this.options);
|
|
271
|
-
}
|
|
272
|
-
return compareIdentifiers(this.major, other.major) || compareIdentifiers(this.minor, other.minor) || compareIdentifiers(this.patch, other.patch);
|
|
273
|
-
}
|
|
274
|
-
comparePre(other) {
|
|
275
|
-
if (!(other instanceof _SemVer)) {
|
|
276
|
-
other = new _SemVer(other, this.options);
|
|
277
|
-
}
|
|
278
|
-
if (this.prerelease.length && !other.prerelease.length) {
|
|
279
|
-
return -1;
|
|
280
|
-
} else if (!this.prerelease.length && other.prerelease.length) {
|
|
281
|
-
return 1;
|
|
282
|
-
} else if (!this.prerelease.length && !other.prerelease.length) {
|
|
283
|
-
return 0;
|
|
284
|
-
}
|
|
285
|
-
let i = 0;
|
|
286
|
-
do {
|
|
287
|
-
const a = this.prerelease[i];
|
|
288
|
-
const b = other.prerelease[i];
|
|
289
|
-
debug("prerelease compare", i, a, b);
|
|
290
|
-
if (a === void 0 && b === void 0) {
|
|
291
|
-
return 0;
|
|
292
|
-
} else if (b === void 0) {
|
|
293
|
-
return 1;
|
|
294
|
-
} else if (a === void 0) {
|
|
295
|
-
return -1;
|
|
296
|
-
} else if (a === b) {
|
|
297
|
-
continue;
|
|
298
|
-
} else {
|
|
299
|
-
return compareIdentifiers(a, b);
|
|
300
|
-
}
|
|
301
|
-
} while (++i);
|
|
302
|
-
}
|
|
303
|
-
compareBuild(other) {
|
|
304
|
-
if (!(other instanceof _SemVer)) {
|
|
305
|
-
other = new _SemVer(other, this.options);
|
|
306
|
-
}
|
|
307
|
-
let i = 0;
|
|
308
|
-
do {
|
|
309
|
-
const a = this.build[i];
|
|
310
|
-
const b = other.build[i];
|
|
311
|
-
debug("prerelease compare", i, a, b);
|
|
312
|
-
if (a === void 0 && b === void 0) {
|
|
313
|
-
return 0;
|
|
314
|
-
} else if (b === void 0) {
|
|
315
|
-
return 1;
|
|
316
|
-
} else if (a === void 0) {
|
|
317
|
-
return -1;
|
|
318
|
-
} else if (a === b) {
|
|
319
|
-
continue;
|
|
320
|
-
} else {
|
|
321
|
-
return compareIdentifiers(a, b);
|
|
322
|
-
}
|
|
323
|
-
} while (++i);
|
|
324
|
-
}
|
|
325
|
-
// preminor will bump the version up to the next minor release, and immediately
|
|
326
|
-
// down to pre-release. premajor and prepatch work the same way.
|
|
327
|
-
inc(release, identifier, identifierBase) {
|
|
328
|
-
switch (release) {
|
|
329
|
-
case "premajor":
|
|
330
|
-
this.prerelease.length = 0;
|
|
331
|
-
this.patch = 0;
|
|
332
|
-
this.minor = 0;
|
|
333
|
-
this.major++;
|
|
334
|
-
this.inc("pre", identifier, identifierBase);
|
|
335
|
-
break;
|
|
336
|
-
case "preminor":
|
|
337
|
-
this.prerelease.length = 0;
|
|
338
|
-
this.patch = 0;
|
|
339
|
-
this.minor++;
|
|
340
|
-
this.inc("pre", identifier, identifierBase);
|
|
341
|
-
break;
|
|
342
|
-
case "prepatch":
|
|
343
|
-
this.prerelease.length = 0;
|
|
344
|
-
this.inc("patch", identifier, identifierBase);
|
|
345
|
-
this.inc("pre", identifier, identifierBase);
|
|
346
|
-
break;
|
|
347
|
-
case "prerelease":
|
|
348
|
-
if (this.prerelease.length === 0) {
|
|
349
|
-
this.inc("patch", identifier, identifierBase);
|
|
350
|
-
}
|
|
351
|
-
this.inc("pre", identifier, identifierBase);
|
|
352
|
-
break;
|
|
353
|
-
case "major":
|
|
354
|
-
if (this.minor !== 0 || this.patch !== 0 || this.prerelease.length === 0) {
|
|
355
|
-
this.major++;
|
|
356
|
-
}
|
|
357
|
-
this.minor = 0;
|
|
358
|
-
this.patch = 0;
|
|
359
|
-
this.prerelease = [];
|
|
360
|
-
break;
|
|
361
|
-
case "minor":
|
|
362
|
-
if (this.patch !== 0 || this.prerelease.length === 0) {
|
|
363
|
-
this.minor++;
|
|
364
|
-
}
|
|
365
|
-
this.patch = 0;
|
|
366
|
-
this.prerelease = [];
|
|
367
|
-
break;
|
|
368
|
-
case "patch":
|
|
369
|
-
if (this.prerelease.length === 0) {
|
|
370
|
-
this.patch++;
|
|
371
|
-
}
|
|
372
|
-
this.prerelease = [];
|
|
373
|
-
break;
|
|
374
|
-
case "pre": {
|
|
375
|
-
const base = Number(identifierBase) ? 1 : 0;
|
|
376
|
-
if (!identifier && identifierBase === false) {
|
|
377
|
-
throw new Error("invalid increment argument: identifier is empty");
|
|
378
|
-
}
|
|
379
|
-
if (this.prerelease.length === 0) {
|
|
380
|
-
this.prerelease = [base];
|
|
381
|
-
} else {
|
|
382
|
-
let i = this.prerelease.length;
|
|
383
|
-
while (--i >= 0) {
|
|
384
|
-
if (typeof this.prerelease[i] === "number") {
|
|
385
|
-
this.prerelease[i]++;
|
|
386
|
-
i = -2;
|
|
387
|
-
}
|
|
388
|
-
}
|
|
389
|
-
if (i === -1) {
|
|
390
|
-
if (identifier === this.prerelease.join(".") && identifierBase === false) {
|
|
391
|
-
throw new Error("invalid increment argument: identifier already exists");
|
|
392
|
-
}
|
|
393
|
-
this.prerelease.push(base);
|
|
394
|
-
}
|
|
395
|
-
}
|
|
396
|
-
if (identifier) {
|
|
397
|
-
let prerelease = [identifier, base];
|
|
398
|
-
if (identifierBase === false) {
|
|
399
|
-
prerelease = [identifier];
|
|
400
|
-
}
|
|
401
|
-
if (compareIdentifiers(this.prerelease[0], identifier) === 0) {
|
|
402
|
-
if (isNaN(this.prerelease[1])) {
|
|
403
|
-
this.prerelease = prerelease;
|
|
404
|
-
}
|
|
405
|
-
} else {
|
|
406
|
-
this.prerelease = prerelease;
|
|
407
|
-
}
|
|
408
|
-
}
|
|
409
|
-
break;
|
|
410
|
-
}
|
|
411
|
-
default:
|
|
412
|
-
throw new Error(`invalid increment argument: ${release}`);
|
|
413
|
-
}
|
|
414
|
-
this.raw = this.format();
|
|
415
|
-
if (this.build.length) {
|
|
416
|
-
this.raw += `+${this.build.join(".")}`;
|
|
417
|
-
}
|
|
418
|
-
return this;
|
|
419
|
-
}
|
|
420
|
-
};
|
|
421
|
-
module.exports = SemVer;
|
|
422
|
-
}
|
|
423
|
-
});
|
|
424
|
-
|
|
425
|
-
// ../../node_modules/.pnpm/semver@7.6.0/node_modules/semver/functions/parse.js
|
|
426
|
-
var require_parse = __commonJS({
|
|
427
|
-
"../../node_modules/.pnpm/semver@7.6.0/node_modules/semver/functions/parse.js"(exports, module) {
|
|
428
|
-
"use strict";
|
|
429
|
-
var SemVer = require_semver();
|
|
430
|
-
var parse = (version2, options, throwErrors = false) => {
|
|
431
|
-
if (version2 instanceof SemVer) {
|
|
432
|
-
return version2;
|
|
433
|
-
}
|
|
434
|
-
try {
|
|
435
|
-
return new SemVer(version2, options);
|
|
436
|
-
} catch (er) {
|
|
437
|
-
if (!throwErrors) {
|
|
438
|
-
return null;
|
|
439
|
-
}
|
|
440
|
-
throw er;
|
|
441
|
-
}
|
|
442
|
-
};
|
|
443
|
-
module.exports = parse;
|
|
444
|
-
}
|
|
445
|
-
});
|
|
446
|
-
|
|
447
|
-
// ../../node_modules/.pnpm/semver@7.6.0/node_modules/semver/functions/valid.js
|
|
448
|
-
var require_valid = __commonJS({
|
|
449
|
-
"../../node_modules/.pnpm/semver@7.6.0/node_modules/semver/functions/valid.js"(exports, module) {
|
|
450
|
-
"use strict";
|
|
451
|
-
var parse = require_parse();
|
|
452
|
-
var valid = (version2, options) => {
|
|
453
|
-
const v = parse(version2, options);
|
|
454
|
-
return v ? v.version : null;
|
|
455
|
-
};
|
|
456
|
-
module.exports = valid;
|
|
457
|
-
}
|
|
458
|
-
});
|
|
459
|
-
|
|
460
|
-
// ../../node_modules/.pnpm/semver@7.6.0/node_modules/semver/functions/clean.js
|
|
461
|
-
var require_clean = __commonJS({
|
|
462
|
-
"../../node_modules/.pnpm/semver@7.6.0/node_modules/semver/functions/clean.js"(exports, module) {
|
|
463
|
-
"use strict";
|
|
464
|
-
var parse = require_parse();
|
|
465
|
-
var clean = (version2, options) => {
|
|
466
|
-
const s = parse(version2.trim().replace(/^[=v]+/, ""), options);
|
|
467
|
-
return s ? s.version : null;
|
|
468
|
-
};
|
|
469
|
-
module.exports = clean;
|
|
470
|
-
}
|
|
471
|
-
});
|
|
472
|
-
|
|
473
|
-
// ../../node_modules/.pnpm/semver@7.6.0/node_modules/semver/functions/inc.js
|
|
474
|
-
var require_inc = __commonJS({
|
|
475
|
-
"../../node_modules/.pnpm/semver@7.6.0/node_modules/semver/functions/inc.js"(exports, module) {
|
|
476
|
-
"use strict";
|
|
477
|
-
var SemVer = require_semver();
|
|
478
|
-
var inc = (version2, release, options, identifier, identifierBase) => {
|
|
479
|
-
if (typeof options === "string") {
|
|
480
|
-
identifierBase = identifier;
|
|
481
|
-
identifier = options;
|
|
482
|
-
options = void 0;
|
|
483
|
-
}
|
|
484
|
-
try {
|
|
485
|
-
return new SemVer(
|
|
486
|
-
version2 instanceof SemVer ? version2.version : version2,
|
|
487
|
-
options
|
|
488
|
-
).inc(release, identifier, identifierBase).version;
|
|
489
|
-
} catch (er) {
|
|
490
|
-
return null;
|
|
491
|
-
}
|
|
492
|
-
};
|
|
493
|
-
module.exports = inc;
|
|
494
|
-
}
|
|
495
|
-
});
|
|
496
|
-
|
|
497
|
-
// ../../node_modules/.pnpm/semver@7.6.0/node_modules/semver/functions/diff.js
|
|
498
|
-
var require_diff = __commonJS({
|
|
499
|
-
"../../node_modules/.pnpm/semver@7.6.0/node_modules/semver/functions/diff.js"(exports, module) {
|
|
500
|
-
"use strict";
|
|
501
|
-
var parse = require_parse();
|
|
502
|
-
var diff = (version1, version2) => {
|
|
503
|
-
const v1 = parse(version1, null, true);
|
|
504
|
-
const v2 = parse(version2, null, true);
|
|
505
|
-
const comparison = v1.compare(v2);
|
|
506
|
-
if (comparison === 0) {
|
|
507
|
-
return null;
|
|
508
|
-
}
|
|
509
|
-
const v1Higher = comparison > 0;
|
|
510
|
-
const highVersion = v1Higher ? v1 : v2;
|
|
511
|
-
const lowVersion = v1Higher ? v2 : v1;
|
|
512
|
-
const highHasPre = !!highVersion.prerelease.length;
|
|
513
|
-
const lowHasPre = !!lowVersion.prerelease.length;
|
|
514
|
-
if (lowHasPre && !highHasPre) {
|
|
515
|
-
if (!lowVersion.patch && !lowVersion.minor) {
|
|
516
|
-
return "major";
|
|
517
|
-
}
|
|
518
|
-
if (highVersion.patch) {
|
|
519
|
-
return "patch";
|
|
520
|
-
}
|
|
521
|
-
if (highVersion.minor) {
|
|
522
|
-
return "minor";
|
|
523
|
-
}
|
|
524
|
-
return "major";
|
|
525
|
-
}
|
|
526
|
-
const prefix = highHasPre ? "pre" : "";
|
|
527
|
-
if (v1.major !== v2.major) {
|
|
528
|
-
return prefix + "major";
|
|
529
|
-
}
|
|
530
|
-
if (v1.minor !== v2.minor) {
|
|
531
|
-
return prefix + "minor";
|
|
532
|
-
}
|
|
533
|
-
if (v1.patch !== v2.patch) {
|
|
534
|
-
return prefix + "patch";
|
|
535
|
-
}
|
|
536
|
-
return "prerelease";
|
|
537
|
-
};
|
|
538
|
-
module.exports = diff;
|
|
539
|
-
}
|
|
540
|
-
});
|
|
541
|
-
|
|
542
|
-
// ../../node_modules/.pnpm/semver@7.6.0/node_modules/semver/functions/major.js
|
|
543
|
-
var require_major = __commonJS({
|
|
544
|
-
"../../node_modules/.pnpm/semver@7.6.0/node_modules/semver/functions/major.js"(exports, module) {
|
|
545
|
-
"use strict";
|
|
546
|
-
var SemVer = require_semver();
|
|
547
|
-
var major = (a, loose) => new SemVer(a, loose).major;
|
|
548
|
-
module.exports = major;
|
|
549
|
-
}
|
|
550
|
-
});
|
|
551
|
-
|
|
552
|
-
// ../../node_modules/.pnpm/semver@7.6.0/node_modules/semver/functions/minor.js
|
|
553
|
-
var require_minor = __commonJS({
|
|
554
|
-
"../../node_modules/.pnpm/semver@7.6.0/node_modules/semver/functions/minor.js"(exports, module) {
|
|
555
|
-
"use strict";
|
|
556
|
-
var SemVer = require_semver();
|
|
557
|
-
var minor = (a, loose) => new SemVer(a, loose).minor;
|
|
558
|
-
module.exports = minor;
|
|
559
|
-
}
|
|
560
|
-
});
|
|
561
|
-
|
|
562
|
-
// ../../node_modules/.pnpm/semver@7.6.0/node_modules/semver/functions/patch.js
|
|
563
|
-
var require_patch = __commonJS({
|
|
564
|
-
"../../node_modules/.pnpm/semver@7.6.0/node_modules/semver/functions/patch.js"(exports, module) {
|
|
565
|
-
"use strict";
|
|
566
|
-
var SemVer = require_semver();
|
|
567
|
-
var patch = (a, loose) => new SemVer(a, loose).patch;
|
|
568
|
-
module.exports = patch;
|
|
569
|
-
}
|
|
570
|
-
});
|
|
571
|
-
|
|
572
|
-
// ../../node_modules/.pnpm/semver@7.6.0/node_modules/semver/functions/prerelease.js
|
|
573
|
-
var require_prerelease = __commonJS({
|
|
574
|
-
"../../node_modules/.pnpm/semver@7.6.0/node_modules/semver/functions/prerelease.js"(exports, module) {
|
|
575
|
-
"use strict";
|
|
576
|
-
var parse = require_parse();
|
|
577
|
-
var prerelease = (version2, options) => {
|
|
578
|
-
const parsed = parse(version2, options);
|
|
579
|
-
return parsed && parsed.prerelease.length ? parsed.prerelease : null;
|
|
580
|
-
};
|
|
581
|
-
module.exports = prerelease;
|
|
582
|
-
}
|
|
583
|
-
});
|
|
584
|
-
|
|
585
|
-
// ../../node_modules/.pnpm/semver@7.6.0/node_modules/semver/functions/compare.js
|
|
586
|
-
var require_compare = __commonJS({
|
|
587
|
-
"../../node_modules/.pnpm/semver@7.6.0/node_modules/semver/functions/compare.js"(exports, module) {
|
|
588
|
-
"use strict";
|
|
589
|
-
var SemVer = require_semver();
|
|
590
|
-
var compare = (a, b, loose) => new SemVer(a, loose).compare(new SemVer(b, loose));
|
|
591
|
-
module.exports = compare;
|
|
592
|
-
}
|
|
593
|
-
});
|
|
594
|
-
|
|
595
|
-
// ../../node_modules/.pnpm/semver@7.6.0/node_modules/semver/functions/rcompare.js
|
|
596
|
-
var require_rcompare = __commonJS({
|
|
597
|
-
"../../node_modules/.pnpm/semver@7.6.0/node_modules/semver/functions/rcompare.js"(exports, module) {
|
|
598
|
-
"use strict";
|
|
599
|
-
var compare = require_compare();
|
|
600
|
-
var rcompare = (a, b, loose) => compare(b, a, loose);
|
|
601
|
-
module.exports = rcompare;
|
|
602
|
-
}
|
|
603
|
-
});
|
|
604
|
-
|
|
605
|
-
// ../../node_modules/.pnpm/semver@7.6.0/node_modules/semver/functions/compare-loose.js
|
|
606
|
-
var require_compare_loose = __commonJS({
|
|
607
|
-
"../../node_modules/.pnpm/semver@7.6.0/node_modules/semver/functions/compare-loose.js"(exports, module) {
|
|
608
|
-
"use strict";
|
|
609
|
-
var compare = require_compare();
|
|
610
|
-
var compareLoose = (a, b) => compare(a, b, true);
|
|
611
|
-
module.exports = compareLoose;
|
|
612
|
-
}
|
|
613
|
-
});
|
|
614
|
-
|
|
615
|
-
// ../../node_modules/.pnpm/semver@7.6.0/node_modules/semver/functions/compare-build.js
|
|
616
|
-
var require_compare_build = __commonJS({
|
|
617
|
-
"../../node_modules/.pnpm/semver@7.6.0/node_modules/semver/functions/compare-build.js"(exports, module) {
|
|
618
|
-
"use strict";
|
|
619
|
-
var SemVer = require_semver();
|
|
620
|
-
var compareBuild = (a, b, loose) => {
|
|
621
|
-
const versionA = new SemVer(a, loose);
|
|
622
|
-
const versionB = new SemVer(b, loose);
|
|
623
|
-
return versionA.compare(versionB) || versionA.compareBuild(versionB);
|
|
624
|
-
};
|
|
625
|
-
module.exports = compareBuild;
|
|
626
|
-
}
|
|
627
|
-
});
|
|
628
|
-
|
|
629
|
-
// ../../node_modules/.pnpm/semver@7.6.0/node_modules/semver/functions/sort.js
|
|
630
|
-
var require_sort = __commonJS({
|
|
631
|
-
"../../node_modules/.pnpm/semver@7.6.0/node_modules/semver/functions/sort.js"(exports, module) {
|
|
632
|
-
"use strict";
|
|
633
|
-
var compareBuild = require_compare_build();
|
|
634
|
-
var sort = (list, loose) => list.sort((a, b) => compareBuild(a, b, loose));
|
|
635
|
-
module.exports = sort;
|
|
636
|
-
}
|
|
637
|
-
});
|
|
638
|
-
|
|
639
|
-
// ../../node_modules/.pnpm/semver@7.6.0/node_modules/semver/functions/rsort.js
|
|
640
|
-
var require_rsort = __commonJS({
|
|
641
|
-
"../../node_modules/.pnpm/semver@7.6.0/node_modules/semver/functions/rsort.js"(exports, module) {
|
|
642
|
-
"use strict";
|
|
643
|
-
var compareBuild = require_compare_build();
|
|
644
|
-
var rsort = (list, loose) => list.sort((a, b) => compareBuild(b, a, loose));
|
|
645
|
-
module.exports = rsort;
|
|
646
|
-
}
|
|
647
|
-
});
|
|
648
|
-
|
|
649
|
-
// ../../node_modules/.pnpm/semver@7.6.0/node_modules/semver/functions/gt.js
|
|
650
|
-
var require_gt = __commonJS({
|
|
651
|
-
"../../node_modules/.pnpm/semver@7.6.0/node_modules/semver/functions/gt.js"(exports, module) {
|
|
652
|
-
"use strict";
|
|
653
|
-
var compare = require_compare();
|
|
654
|
-
var gt = (a, b, loose) => compare(a, b, loose) > 0;
|
|
655
|
-
module.exports = gt;
|
|
656
|
-
}
|
|
657
|
-
});
|
|
658
|
-
|
|
659
|
-
// ../../node_modules/.pnpm/semver@7.6.0/node_modules/semver/functions/lt.js
|
|
660
|
-
var require_lt = __commonJS({
|
|
661
|
-
"../../node_modules/.pnpm/semver@7.6.0/node_modules/semver/functions/lt.js"(exports, module) {
|
|
662
|
-
"use strict";
|
|
663
|
-
var compare = require_compare();
|
|
664
|
-
var lt = (a, b, loose) => compare(a, b, loose) < 0;
|
|
665
|
-
module.exports = lt;
|
|
666
|
-
}
|
|
667
|
-
});
|
|
668
|
-
|
|
669
|
-
// ../../node_modules/.pnpm/semver@7.6.0/node_modules/semver/functions/eq.js
|
|
670
|
-
var require_eq = __commonJS({
|
|
671
|
-
"../../node_modules/.pnpm/semver@7.6.0/node_modules/semver/functions/eq.js"(exports, module) {
|
|
672
|
-
"use strict";
|
|
673
|
-
var compare = require_compare();
|
|
674
|
-
var eq = (a, b, loose) => compare(a, b, loose) === 0;
|
|
675
|
-
module.exports = eq;
|
|
676
|
-
}
|
|
677
|
-
});
|
|
678
|
-
|
|
679
|
-
// ../../node_modules/.pnpm/semver@7.6.0/node_modules/semver/functions/neq.js
|
|
680
|
-
var require_neq = __commonJS({
|
|
681
|
-
"../../node_modules/.pnpm/semver@7.6.0/node_modules/semver/functions/neq.js"(exports, module) {
|
|
682
|
-
"use strict";
|
|
683
|
-
var compare = require_compare();
|
|
684
|
-
var neq = (a, b, loose) => compare(a, b, loose) !== 0;
|
|
685
|
-
module.exports = neq;
|
|
686
|
-
}
|
|
687
|
-
});
|
|
688
|
-
|
|
689
|
-
// ../../node_modules/.pnpm/semver@7.6.0/node_modules/semver/functions/gte.js
|
|
690
|
-
var require_gte = __commonJS({
|
|
691
|
-
"../../node_modules/.pnpm/semver@7.6.0/node_modules/semver/functions/gte.js"(exports, module) {
|
|
692
|
-
"use strict";
|
|
693
|
-
var compare = require_compare();
|
|
694
|
-
var gte = (a, b, loose) => compare(a, b, loose) >= 0;
|
|
695
|
-
module.exports = gte;
|
|
696
|
-
}
|
|
697
|
-
});
|
|
698
|
-
|
|
699
|
-
// ../../node_modules/.pnpm/semver@7.6.0/node_modules/semver/functions/lte.js
|
|
700
|
-
var require_lte = __commonJS({
|
|
701
|
-
"../../node_modules/.pnpm/semver@7.6.0/node_modules/semver/functions/lte.js"(exports, module) {
|
|
702
|
-
"use strict";
|
|
703
|
-
var compare = require_compare();
|
|
704
|
-
var lte = (a, b, loose) => compare(a, b, loose) <= 0;
|
|
705
|
-
module.exports = lte;
|
|
706
|
-
}
|
|
707
|
-
});
|
|
708
|
-
|
|
709
|
-
// ../../node_modules/.pnpm/semver@7.6.0/node_modules/semver/functions/cmp.js
|
|
710
|
-
var require_cmp = __commonJS({
|
|
711
|
-
"../../node_modules/.pnpm/semver@7.6.0/node_modules/semver/functions/cmp.js"(exports, module) {
|
|
712
|
-
"use strict";
|
|
713
|
-
var eq = require_eq();
|
|
714
|
-
var neq = require_neq();
|
|
715
|
-
var gt = require_gt();
|
|
716
|
-
var gte = require_gte();
|
|
717
|
-
var lt = require_lt();
|
|
718
|
-
var lte = require_lte();
|
|
719
|
-
var cmp = (a, op, b, loose) => {
|
|
720
|
-
switch (op) {
|
|
721
|
-
case "===":
|
|
722
|
-
if (typeof a === "object") {
|
|
723
|
-
a = a.version;
|
|
724
|
-
}
|
|
725
|
-
if (typeof b === "object") {
|
|
726
|
-
b = b.version;
|
|
727
|
-
}
|
|
728
|
-
return a === b;
|
|
729
|
-
case "!==":
|
|
730
|
-
if (typeof a === "object") {
|
|
731
|
-
a = a.version;
|
|
732
|
-
}
|
|
733
|
-
if (typeof b === "object") {
|
|
734
|
-
b = b.version;
|
|
735
|
-
}
|
|
736
|
-
return a !== b;
|
|
737
|
-
case "":
|
|
738
|
-
case "=":
|
|
739
|
-
case "==":
|
|
740
|
-
return eq(a, b, loose);
|
|
741
|
-
case "!=":
|
|
742
|
-
return neq(a, b, loose);
|
|
743
|
-
case ">":
|
|
744
|
-
return gt(a, b, loose);
|
|
745
|
-
case ">=":
|
|
746
|
-
return gte(a, b, loose);
|
|
747
|
-
case "<":
|
|
748
|
-
return lt(a, b, loose);
|
|
749
|
-
case "<=":
|
|
750
|
-
return lte(a, b, loose);
|
|
751
|
-
default:
|
|
752
|
-
throw new TypeError(`Invalid operator: ${op}`);
|
|
753
|
-
}
|
|
754
|
-
};
|
|
755
|
-
module.exports = cmp;
|
|
756
|
-
}
|
|
757
|
-
});
|
|
758
|
-
|
|
759
|
-
// ../../node_modules/.pnpm/semver@7.6.0/node_modules/semver/functions/coerce.js
|
|
760
|
-
var require_coerce = __commonJS({
|
|
761
|
-
"../../node_modules/.pnpm/semver@7.6.0/node_modules/semver/functions/coerce.js"(exports, module) {
|
|
762
|
-
"use strict";
|
|
763
|
-
var SemVer = require_semver();
|
|
764
|
-
var parse = require_parse();
|
|
765
|
-
var { safeRe: re, t } = require_re();
|
|
766
|
-
var coerce = (version2, options) => {
|
|
767
|
-
if (version2 instanceof SemVer) {
|
|
768
|
-
return version2;
|
|
769
|
-
}
|
|
770
|
-
if (typeof version2 === "number") {
|
|
771
|
-
version2 = String(version2);
|
|
772
|
-
}
|
|
773
|
-
if (typeof version2 !== "string") {
|
|
774
|
-
return null;
|
|
775
|
-
}
|
|
776
|
-
options = options || {};
|
|
777
|
-
let match = null;
|
|
778
|
-
if (!options.rtl) {
|
|
779
|
-
match = version2.match(options.includePrerelease ? re[t.COERCEFULL] : re[t.COERCE]);
|
|
780
|
-
} else {
|
|
781
|
-
const coerceRtlRegex = options.includePrerelease ? re[t.COERCERTLFULL] : re[t.COERCERTL];
|
|
782
|
-
let next;
|
|
783
|
-
while ((next = coerceRtlRegex.exec(version2)) && (!match || match.index + match[0].length !== version2.length)) {
|
|
784
|
-
if (!match || next.index + next[0].length !== match.index + match[0].length) {
|
|
785
|
-
match = next;
|
|
786
|
-
}
|
|
787
|
-
coerceRtlRegex.lastIndex = next.index + next[1].length + next[2].length;
|
|
788
|
-
}
|
|
789
|
-
coerceRtlRegex.lastIndex = -1;
|
|
790
|
-
}
|
|
791
|
-
if (match === null) {
|
|
792
|
-
return null;
|
|
793
|
-
}
|
|
794
|
-
const major = match[2];
|
|
795
|
-
const minor = match[3] || "0";
|
|
796
|
-
const patch = match[4] || "0";
|
|
797
|
-
const prerelease = options.includePrerelease && match[5] ? `-${match[5]}` : "";
|
|
798
|
-
const build = options.includePrerelease && match[6] ? `+${match[6]}` : "";
|
|
799
|
-
return parse(`${major}.${minor}.${patch}${prerelease}${build}`, options);
|
|
800
|
-
};
|
|
801
|
-
module.exports = coerce;
|
|
802
|
-
}
|
|
803
|
-
});
|
|
804
|
-
|
|
805
|
-
// ../../node_modules/.pnpm/yallist@4.0.0/node_modules/yallist/iterator.js
|
|
806
|
-
var require_iterator = __commonJS({
|
|
807
|
-
"../../node_modules/.pnpm/yallist@4.0.0/node_modules/yallist/iterator.js"(exports, module) {
|
|
808
|
-
"use strict";
|
|
809
|
-
module.exports = function(Yallist) {
|
|
810
|
-
Yallist.prototype[Symbol.iterator] = function* () {
|
|
811
|
-
for (let walker = this.head; walker; walker = walker.next) {
|
|
812
|
-
yield walker.value;
|
|
813
|
-
}
|
|
814
|
-
};
|
|
815
|
-
};
|
|
816
|
-
}
|
|
817
|
-
});
|
|
818
|
-
|
|
819
|
-
// ../../node_modules/.pnpm/yallist@4.0.0/node_modules/yallist/yallist.js
|
|
820
|
-
var require_yallist = __commonJS({
|
|
821
|
-
"../../node_modules/.pnpm/yallist@4.0.0/node_modules/yallist/yallist.js"(exports, module) {
|
|
822
|
-
"use strict";
|
|
823
|
-
module.exports = Yallist;
|
|
824
|
-
Yallist.Node = Node;
|
|
825
|
-
Yallist.create = Yallist;
|
|
826
|
-
function Yallist(list) {
|
|
827
|
-
var self = this;
|
|
828
|
-
if (!(self instanceof Yallist)) {
|
|
829
|
-
self = new Yallist();
|
|
830
|
-
}
|
|
831
|
-
self.tail = null;
|
|
832
|
-
self.head = null;
|
|
833
|
-
self.length = 0;
|
|
834
|
-
if (list && typeof list.forEach === "function") {
|
|
835
|
-
list.forEach(function(item) {
|
|
836
|
-
self.push(item);
|
|
837
|
-
});
|
|
838
|
-
} else if (arguments.length > 0) {
|
|
839
|
-
for (var i = 0, l = arguments.length; i < l; i++) {
|
|
840
|
-
self.push(arguments[i]);
|
|
841
|
-
}
|
|
842
|
-
}
|
|
843
|
-
return self;
|
|
844
|
-
}
|
|
845
|
-
Yallist.prototype.removeNode = function(node) {
|
|
846
|
-
if (node.list !== this) {
|
|
847
|
-
throw new Error("removing node which does not belong to this list");
|
|
848
|
-
}
|
|
849
|
-
var next = node.next;
|
|
850
|
-
var prev = node.prev;
|
|
851
|
-
if (next) {
|
|
852
|
-
next.prev = prev;
|
|
853
|
-
}
|
|
854
|
-
if (prev) {
|
|
855
|
-
prev.next = next;
|
|
856
|
-
}
|
|
857
|
-
if (node === this.head) {
|
|
858
|
-
this.head = next;
|
|
859
|
-
}
|
|
860
|
-
if (node === this.tail) {
|
|
861
|
-
this.tail = prev;
|
|
862
|
-
}
|
|
863
|
-
node.list.length--;
|
|
864
|
-
node.next = null;
|
|
865
|
-
node.prev = null;
|
|
866
|
-
node.list = null;
|
|
867
|
-
return next;
|
|
868
|
-
};
|
|
869
|
-
Yallist.prototype.unshiftNode = function(node) {
|
|
870
|
-
if (node === this.head) {
|
|
871
|
-
return;
|
|
872
|
-
}
|
|
873
|
-
if (node.list) {
|
|
874
|
-
node.list.removeNode(node);
|
|
875
|
-
}
|
|
876
|
-
var head = this.head;
|
|
877
|
-
node.list = this;
|
|
878
|
-
node.next = head;
|
|
879
|
-
if (head) {
|
|
880
|
-
head.prev = node;
|
|
881
|
-
}
|
|
882
|
-
this.head = node;
|
|
883
|
-
if (!this.tail) {
|
|
884
|
-
this.tail = node;
|
|
885
|
-
}
|
|
886
|
-
this.length++;
|
|
887
|
-
};
|
|
888
|
-
Yallist.prototype.pushNode = function(node) {
|
|
889
|
-
if (node === this.tail) {
|
|
890
|
-
return;
|
|
891
|
-
}
|
|
892
|
-
if (node.list) {
|
|
893
|
-
node.list.removeNode(node);
|
|
894
|
-
}
|
|
895
|
-
var tail = this.tail;
|
|
896
|
-
node.list = this;
|
|
897
|
-
node.prev = tail;
|
|
898
|
-
if (tail) {
|
|
899
|
-
tail.next = node;
|
|
900
|
-
}
|
|
901
|
-
this.tail = node;
|
|
902
|
-
if (!this.head) {
|
|
903
|
-
this.head = node;
|
|
904
|
-
}
|
|
905
|
-
this.length++;
|
|
906
|
-
};
|
|
907
|
-
Yallist.prototype.push = function() {
|
|
908
|
-
for (var i = 0, l = arguments.length; i < l; i++) {
|
|
909
|
-
push(this, arguments[i]);
|
|
910
|
-
}
|
|
911
|
-
return this.length;
|
|
912
|
-
};
|
|
913
|
-
Yallist.prototype.unshift = function() {
|
|
914
|
-
for (var i = 0, l = arguments.length; i < l; i++) {
|
|
915
|
-
unshift(this, arguments[i]);
|
|
916
|
-
}
|
|
917
|
-
return this.length;
|
|
918
|
-
};
|
|
919
|
-
Yallist.prototype.pop = function() {
|
|
920
|
-
if (!this.tail) {
|
|
921
|
-
return void 0;
|
|
922
|
-
}
|
|
923
|
-
var res = this.tail.value;
|
|
924
|
-
this.tail = this.tail.prev;
|
|
925
|
-
if (this.tail) {
|
|
926
|
-
this.tail.next = null;
|
|
927
|
-
} else {
|
|
928
|
-
this.head = null;
|
|
929
|
-
}
|
|
930
|
-
this.length--;
|
|
931
|
-
return res;
|
|
932
|
-
};
|
|
933
|
-
Yallist.prototype.shift = function() {
|
|
934
|
-
if (!this.head) {
|
|
935
|
-
return void 0;
|
|
936
|
-
}
|
|
937
|
-
var res = this.head.value;
|
|
938
|
-
this.head = this.head.next;
|
|
939
|
-
if (this.head) {
|
|
940
|
-
this.head.prev = null;
|
|
941
|
-
} else {
|
|
942
|
-
this.tail = null;
|
|
943
|
-
}
|
|
944
|
-
this.length--;
|
|
945
|
-
return res;
|
|
946
|
-
};
|
|
947
|
-
Yallist.prototype.forEach = function(fn, thisp) {
|
|
948
|
-
thisp = thisp || this;
|
|
949
|
-
for (var walker = this.head, i = 0; walker !== null; i++) {
|
|
950
|
-
fn.call(thisp, walker.value, i, this);
|
|
951
|
-
walker = walker.next;
|
|
952
|
-
}
|
|
953
|
-
};
|
|
954
|
-
Yallist.prototype.forEachReverse = function(fn, thisp) {
|
|
955
|
-
thisp = thisp || this;
|
|
956
|
-
for (var walker = this.tail, i = this.length - 1; walker !== null; i--) {
|
|
957
|
-
fn.call(thisp, walker.value, i, this);
|
|
958
|
-
walker = walker.prev;
|
|
959
|
-
}
|
|
960
|
-
};
|
|
961
|
-
Yallist.prototype.get = function(n) {
|
|
962
|
-
for (var i = 0, walker = this.head; walker !== null && i < n; i++) {
|
|
963
|
-
walker = walker.next;
|
|
964
|
-
}
|
|
965
|
-
if (i === n && walker !== null) {
|
|
966
|
-
return walker.value;
|
|
967
|
-
}
|
|
968
|
-
};
|
|
969
|
-
Yallist.prototype.getReverse = function(n) {
|
|
970
|
-
for (var i = 0, walker = this.tail; walker !== null && i < n; i++) {
|
|
971
|
-
walker = walker.prev;
|
|
972
|
-
}
|
|
973
|
-
if (i === n && walker !== null) {
|
|
974
|
-
return walker.value;
|
|
975
|
-
}
|
|
976
|
-
};
|
|
977
|
-
Yallist.prototype.map = function(fn, thisp) {
|
|
978
|
-
thisp = thisp || this;
|
|
979
|
-
var res = new Yallist();
|
|
980
|
-
for (var walker = this.head; walker !== null; ) {
|
|
981
|
-
res.push(fn.call(thisp, walker.value, this));
|
|
982
|
-
walker = walker.next;
|
|
983
|
-
}
|
|
984
|
-
return res;
|
|
985
|
-
};
|
|
986
|
-
Yallist.prototype.mapReverse = function(fn, thisp) {
|
|
987
|
-
thisp = thisp || this;
|
|
988
|
-
var res = new Yallist();
|
|
989
|
-
for (var walker = this.tail; walker !== null; ) {
|
|
990
|
-
res.push(fn.call(thisp, walker.value, this));
|
|
991
|
-
walker = walker.prev;
|
|
992
|
-
}
|
|
993
|
-
return res;
|
|
994
|
-
};
|
|
995
|
-
Yallist.prototype.reduce = function(fn, initial) {
|
|
996
|
-
var acc;
|
|
997
|
-
var walker = this.head;
|
|
998
|
-
if (arguments.length > 1) {
|
|
999
|
-
acc = initial;
|
|
1000
|
-
} else if (this.head) {
|
|
1001
|
-
walker = this.head.next;
|
|
1002
|
-
acc = this.head.value;
|
|
1003
|
-
} else {
|
|
1004
|
-
throw new TypeError("Reduce of empty list with no initial value");
|
|
1005
|
-
}
|
|
1006
|
-
for (var i = 0; walker !== null; i++) {
|
|
1007
|
-
acc = fn(acc, walker.value, i);
|
|
1008
|
-
walker = walker.next;
|
|
1009
|
-
}
|
|
1010
|
-
return acc;
|
|
1011
|
-
};
|
|
1012
|
-
Yallist.prototype.reduceReverse = function(fn, initial) {
|
|
1013
|
-
var acc;
|
|
1014
|
-
var walker = this.tail;
|
|
1015
|
-
if (arguments.length > 1) {
|
|
1016
|
-
acc = initial;
|
|
1017
|
-
} else if (this.tail) {
|
|
1018
|
-
walker = this.tail.prev;
|
|
1019
|
-
acc = this.tail.value;
|
|
1020
|
-
} else {
|
|
1021
|
-
throw new TypeError("Reduce of empty list with no initial value");
|
|
1022
|
-
}
|
|
1023
|
-
for (var i = this.length - 1; walker !== null; i--) {
|
|
1024
|
-
acc = fn(acc, walker.value, i);
|
|
1025
|
-
walker = walker.prev;
|
|
1026
|
-
}
|
|
1027
|
-
return acc;
|
|
1028
|
-
};
|
|
1029
|
-
Yallist.prototype.toArray = function() {
|
|
1030
|
-
var arr = new Array(this.length);
|
|
1031
|
-
for (var i = 0, walker = this.head; walker !== null; i++) {
|
|
1032
|
-
arr[i] = walker.value;
|
|
1033
|
-
walker = walker.next;
|
|
1034
|
-
}
|
|
1035
|
-
return arr;
|
|
1036
|
-
};
|
|
1037
|
-
Yallist.prototype.toArrayReverse = function() {
|
|
1038
|
-
var arr = new Array(this.length);
|
|
1039
|
-
for (var i = 0, walker = this.tail; walker !== null; i++) {
|
|
1040
|
-
arr[i] = walker.value;
|
|
1041
|
-
walker = walker.prev;
|
|
1042
|
-
}
|
|
1043
|
-
return arr;
|
|
1044
|
-
};
|
|
1045
|
-
Yallist.prototype.slice = function(from, to) {
|
|
1046
|
-
to = to || this.length;
|
|
1047
|
-
if (to < 0) {
|
|
1048
|
-
to += this.length;
|
|
1049
|
-
}
|
|
1050
|
-
from = from || 0;
|
|
1051
|
-
if (from < 0) {
|
|
1052
|
-
from += this.length;
|
|
1053
|
-
}
|
|
1054
|
-
var ret = new Yallist();
|
|
1055
|
-
if (to < from || to < 0) {
|
|
1056
|
-
return ret;
|
|
1057
|
-
}
|
|
1058
|
-
if (from < 0) {
|
|
1059
|
-
from = 0;
|
|
1060
|
-
}
|
|
1061
|
-
if (to > this.length) {
|
|
1062
|
-
to = this.length;
|
|
1063
|
-
}
|
|
1064
|
-
for (var i = 0, walker = this.head; walker !== null && i < from; i++) {
|
|
1065
|
-
walker = walker.next;
|
|
1066
|
-
}
|
|
1067
|
-
for (; walker !== null && i < to; i++, walker = walker.next) {
|
|
1068
|
-
ret.push(walker.value);
|
|
1069
|
-
}
|
|
1070
|
-
return ret;
|
|
1071
|
-
};
|
|
1072
|
-
Yallist.prototype.sliceReverse = function(from, to) {
|
|
1073
|
-
to = to || this.length;
|
|
1074
|
-
if (to < 0) {
|
|
1075
|
-
to += this.length;
|
|
1076
|
-
}
|
|
1077
|
-
from = from || 0;
|
|
1078
|
-
if (from < 0) {
|
|
1079
|
-
from += this.length;
|
|
1080
|
-
}
|
|
1081
|
-
var ret = new Yallist();
|
|
1082
|
-
if (to < from || to < 0) {
|
|
1083
|
-
return ret;
|
|
1084
|
-
}
|
|
1085
|
-
if (from < 0) {
|
|
1086
|
-
from = 0;
|
|
1087
|
-
}
|
|
1088
|
-
if (to > this.length) {
|
|
1089
|
-
to = this.length;
|
|
1090
|
-
}
|
|
1091
|
-
for (var i = this.length, walker = this.tail; walker !== null && i > to; i--) {
|
|
1092
|
-
walker = walker.prev;
|
|
1093
|
-
}
|
|
1094
|
-
for (; walker !== null && i > from; i--, walker = walker.prev) {
|
|
1095
|
-
ret.push(walker.value);
|
|
1096
|
-
}
|
|
1097
|
-
return ret;
|
|
1098
|
-
};
|
|
1099
|
-
Yallist.prototype.splice = function(start, deleteCount, ...nodes) {
|
|
1100
|
-
if (start > this.length) {
|
|
1101
|
-
start = this.length - 1;
|
|
1102
|
-
}
|
|
1103
|
-
if (start < 0) {
|
|
1104
|
-
start = this.length + start;
|
|
1105
|
-
}
|
|
1106
|
-
for (var i = 0, walker = this.head; walker !== null && i < start; i++) {
|
|
1107
|
-
walker = walker.next;
|
|
1108
|
-
}
|
|
1109
|
-
var ret = [];
|
|
1110
|
-
for (var i = 0; walker && i < deleteCount; i++) {
|
|
1111
|
-
ret.push(walker.value);
|
|
1112
|
-
walker = this.removeNode(walker);
|
|
1113
|
-
}
|
|
1114
|
-
if (walker === null) {
|
|
1115
|
-
walker = this.tail;
|
|
1116
|
-
}
|
|
1117
|
-
if (walker !== this.head && walker !== this.tail) {
|
|
1118
|
-
walker = walker.prev;
|
|
1119
|
-
}
|
|
1120
|
-
for (var i = 0; i < nodes.length; i++) {
|
|
1121
|
-
walker = insert(this, walker, nodes[i]);
|
|
1122
|
-
}
|
|
1123
|
-
return ret;
|
|
1124
|
-
};
|
|
1125
|
-
Yallist.prototype.reverse = function() {
|
|
1126
|
-
var head = this.head;
|
|
1127
|
-
var tail = this.tail;
|
|
1128
|
-
for (var walker = head; walker !== null; walker = walker.prev) {
|
|
1129
|
-
var p = walker.prev;
|
|
1130
|
-
walker.prev = walker.next;
|
|
1131
|
-
walker.next = p;
|
|
1132
|
-
}
|
|
1133
|
-
this.head = tail;
|
|
1134
|
-
this.tail = head;
|
|
1135
|
-
return this;
|
|
1136
|
-
};
|
|
1137
|
-
function insert(self, node, value) {
|
|
1138
|
-
var inserted = node === self.head ? new Node(value, null, node, self) : new Node(value, node, node.next, self);
|
|
1139
|
-
if (inserted.next === null) {
|
|
1140
|
-
self.tail = inserted;
|
|
1141
|
-
}
|
|
1142
|
-
if (inserted.prev === null) {
|
|
1143
|
-
self.head = inserted;
|
|
1144
|
-
}
|
|
1145
|
-
self.length++;
|
|
1146
|
-
return inserted;
|
|
1147
|
-
}
|
|
1148
|
-
function push(self, item) {
|
|
1149
|
-
self.tail = new Node(item, self.tail, null, self);
|
|
1150
|
-
if (!self.head) {
|
|
1151
|
-
self.head = self.tail;
|
|
1152
|
-
}
|
|
1153
|
-
self.length++;
|
|
1154
|
-
}
|
|
1155
|
-
function unshift(self, item) {
|
|
1156
|
-
self.head = new Node(item, null, self.head, self);
|
|
1157
|
-
if (!self.tail) {
|
|
1158
|
-
self.tail = self.head;
|
|
1159
|
-
}
|
|
1160
|
-
self.length++;
|
|
1161
|
-
}
|
|
1162
|
-
function Node(value, prev, next, list) {
|
|
1163
|
-
if (!(this instanceof Node)) {
|
|
1164
|
-
return new Node(value, prev, next, list);
|
|
1165
|
-
}
|
|
1166
|
-
this.list = list;
|
|
1167
|
-
this.value = value;
|
|
1168
|
-
if (prev) {
|
|
1169
|
-
prev.next = this;
|
|
1170
|
-
this.prev = prev;
|
|
1171
|
-
} else {
|
|
1172
|
-
this.prev = null;
|
|
1173
|
-
}
|
|
1174
|
-
if (next) {
|
|
1175
|
-
next.prev = this;
|
|
1176
|
-
this.next = next;
|
|
1177
|
-
} else {
|
|
1178
|
-
this.next = null;
|
|
1179
|
-
}
|
|
1180
|
-
}
|
|
1181
|
-
try {
|
|
1182
|
-
require_iterator()(Yallist);
|
|
1183
|
-
} catch (er) {
|
|
1184
|
-
}
|
|
1185
|
-
}
|
|
1186
|
-
});
|
|
1187
|
-
|
|
1188
|
-
// ../../node_modules/.pnpm/lru-cache@6.0.0/node_modules/lru-cache/index.js
|
|
1189
|
-
var require_lru_cache = __commonJS({
|
|
1190
|
-
"../../node_modules/.pnpm/lru-cache@6.0.0/node_modules/lru-cache/index.js"(exports, module) {
|
|
1191
|
-
"use strict";
|
|
1192
|
-
var Yallist = require_yallist();
|
|
1193
|
-
var MAX = Symbol("max");
|
|
1194
|
-
var LENGTH = Symbol("length");
|
|
1195
|
-
var LENGTH_CALCULATOR = Symbol("lengthCalculator");
|
|
1196
|
-
var ALLOW_STALE = Symbol("allowStale");
|
|
1197
|
-
var MAX_AGE = Symbol("maxAge");
|
|
1198
|
-
var DISPOSE = Symbol("dispose");
|
|
1199
|
-
var NO_DISPOSE_ON_SET = Symbol("noDisposeOnSet");
|
|
1200
|
-
var LRU_LIST = Symbol("lruList");
|
|
1201
|
-
var CACHE = Symbol("cache");
|
|
1202
|
-
var UPDATE_AGE_ON_GET = Symbol("updateAgeOnGet");
|
|
1203
|
-
var naiveLength = () => 1;
|
|
1204
|
-
var LRUCache = class {
|
|
1205
|
-
constructor(options) {
|
|
1206
|
-
if (typeof options === "number")
|
|
1207
|
-
options = { max: options };
|
|
1208
|
-
if (!options)
|
|
1209
|
-
options = {};
|
|
1210
|
-
if (options.max && (typeof options.max !== "number" || options.max < 0))
|
|
1211
|
-
throw new TypeError("max must be a non-negative number");
|
|
1212
|
-
const max = this[MAX] = options.max || Infinity;
|
|
1213
|
-
const lc = options.length || naiveLength;
|
|
1214
|
-
this[LENGTH_CALCULATOR] = typeof lc !== "function" ? naiveLength : lc;
|
|
1215
|
-
this[ALLOW_STALE] = options.stale || false;
|
|
1216
|
-
if (options.maxAge && typeof options.maxAge !== "number")
|
|
1217
|
-
throw new TypeError("maxAge must be a number");
|
|
1218
|
-
this[MAX_AGE] = options.maxAge || 0;
|
|
1219
|
-
this[DISPOSE] = options.dispose;
|
|
1220
|
-
this[NO_DISPOSE_ON_SET] = options.noDisposeOnSet || false;
|
|
1221
|
-
this[UPDATE_AGE_ON_GET] = options.updateAgeOnGet || false;
|
|
1222
|
-
this.reset();
|
|
1223
|
-
}
|
|
1224
|
-
// resize the cache when the max changes.
|
|
1225
|
-
set max(mL) {
|
|
1226
|
-
if (typeof mL !== "number" || mL < 0)
|
|
1227
|
-
throw new TypeError("max must be a non-negative number");
|
|
1228
|
-
this[MAX] = mL || Infinity;
|
|
1229
|
-
trim(this);
|
|
1230
|
-
}
|
|
1231
|
-
get max() {
|
|
1232
|
-
return this[MAX];
|
|
1233
|
-
}
|
|
1234
|
-
set allowStale(allowStale) {
|
|
1235
|
-
this[ALLOW_STALE] = !!allowStale;
|
|
1236
|
-
}
|
|
1237
|
-
get allowStale() {
|
|
1238
|
-
return this[ALLOW_STALE];
|
|
1239
|
-
}
|
|
1240
|
-
set maxAge(mA) {
|
|
1241
|
-
if (typeof mA !== "number")
|
|
1242
|
-
throw new TypeError("maxAge must be a non-negative number");
|
|
1243
|
-
this[MAX_AGE] = mA;
|
|
1244
|
-
trim(this);
|
|
1245
|
-
}
|
|
1246
|
-
get maxAge() {
|
|
1247
|
-
return this[MAX_AGE];
|
|
1248
|
-
}
|
|
1249
|
-
// resize the cache when the lengthCalculator changes.
|
|
1250
|
-
set lengthCalculator(lC) {
|
|
1251
|
-
if (typeof lC !== "function")
|
|
1252
|
-
lC = naiveLength;
|
|
1253
|
-
if (lC !== this[LENGTH_CALCULATOR]) {
|
|
1254
|
-
this[LENGTH_CALCULATOR] = lC;
|
|
1255
|
-
this[LENGTH] = 0;
|
|
1256
|
-
this[LRU_LIST].forEach((hit) => {
|
|
1257
|
-
hit.length = this[LENGTH_CALCULATOR](hit.value, hit.key);
|
|
1258
|
-
this[LENGTH] += hit.length;
|
|
1259
|
-
});
|
|
1260
|
-
}
|
|
1261
|
-
trim(this);
|
|
1262
|
-
}
|
|
1263
|
-
get lengthCalculator() {
|
|
1264
|
-
return this[LENGTH_CALCULATOR];
|
|
1265
|
-
}
|
|
1266
|
-
get length() {
|
|
1267
|
-
return this[LENGTH];
|
|
1268
|
-
}
|
|
1269
|
-
get itemCount() {
|
|
1270
|
-
return this[LRU_LIST].length;
|
|
1271
|
-
}
|
|
1272
|
-
rforEach(fn, thisp) {
|
|
1273
|
-
thisp = thisp || this;
|
|
1274
|
-
for (let walker = this[LRU_LIST].tail; walker !== null; ) {
|
|
1275
|
-
const prev = walker.prev;
|
|
1276
|
-
forEachStep(this, fn, walker, thisp);
|
|
1277
|
-
walker = prev;
|
|
1278
|
-
}
|
|
1279
|
-
}
|
|
1280
|
-
forEach(fn, thisp) {
|
|
1281
|
-
thisp = thisp || this;
|
|
1282
|
-
for (let walker = this[LRU_LIST].head; walker !== null; ) {
|
|
1283
|
-
const next = walker.next;
|
|
1284
|
-
forEachStep(this, fn, walker, thisp);
|
|
1285
|
-
walker = next;
|
|
1286
|
-
}
|
|
1287
|
-
}
|
|
1288
|
-
keys() {
|
|
1289
|
-
return this[LRU_LIST].toArray().map((k) => k.key);
|
|
1290
|
-
}
|
|
1291
|
-
values() {
|
|
1292
|
-
return this[LRU_LIST].toArray().map((k) => k.value);
|
|
1293
|
-
}
|
|
1294
|
-
reset() {
|
|
1295
|
-
if (this[DISPOSE] && this[LRU_LIST] && this[LRU_LIST].length) {
|
|
1296
|
-
this[LRU_LIST].forEach((hit) => this[DISPOSE](hit.key, hit.value));
|
|
1297
|
-
}
|
|
1298
|
-
this[CACHE] = /* @__PURE__ */ new Map();
|
|
1299
|
-
this[LRU_LIST] = new Yallist();
|
|
1300
|
-
this[LENGTH] = 0;
|
|
1301
|
-
}
|
|
1302
|
-
dump() {
|
|
1303
|
-
return this[LRU_LIST].map((hit) => isStale(this, hit) ? false : {
|
|
1304
|
-
k: hit.key,
|
|
1305
|
-
v: hit.value,
|
|
1306
|
-
e: hit.now + (hit.maxAge || 0)
|
|
1307
|
-
}).toArray().filter((h) => h);
|
|
1308
|
-
}
|
|
1309
|
-
dumpLru() {
|
|
1310
|
-
return this[LRU_LIST];
|
|
1311
|
-
}
|
|
1312
|
-
set(key, value, maxAge) {
|
|
1313
|
-
maxAge = maxAge || this[MAX_AGE];
|
|
1314
|
-
if (maxAge && typeof maxAge !== "number")
|
|
1315
|
-
throw new TypeError("maxAge must be a number");
|
|
1316
|
-
const now = maxAge ? Date.now() : 0;
|
|
1317
|
-
const len = this[LENGTH_CALCULATOR](value, key);
|
|
1318
|
-
if (this[CACHE].has(key)) {
|
|
1319
|
-
if (len > this[MAX]) {
|
|
1320
|
-
del(this, this[CACHE].get(key));
|
|
1321
|
-
return false;
|
|
1322
|
-
}
|
|
1323
|
-
const node = this[CACHE].get(key);
|
|
1324
|
-
const item = node.value;
|
|
1325
|
-
if (this[DISPOSE]) {
|
|
1326
|
-
if (!this[NO_DISPOSE_ON_SET])
|
|
1327
|
-
this[DISPOSE](key, item.value);
|
|
1328
|
-
}
|
|
1329
|
-
item.now = now;
|
|
1330
|
-
item.maxAge = maxAge;
|
|
1331
|
-
item.value = value;
|
|
1332
|
-
this[LENGTH] += len - item.length;
|
|
1333
|
-
item.length = len;
|
|
1334
|
-
this.get(key);
|
|
1335
|
-
trim(this);
|
|
1336
|
-
return true;
|
|
1337
|
-
}
|
|
1338
|
-
const hit = new Entry(key, value, len, now, maxAge);
|
|
1339
|
-
if (hit.length > this[MAX]) {
|
|
1340
|
-
if (this[DISPOSE])
|
|
1341
|
-
this[DISPOSE](key, value);
|
|
1342
|
-
return false;
|
|
1343
|
-
}
|
|
1344
|
-
this[LENGTH] += hit.length;
|
|
1345
|
-
this[LRU_LIST].unshift(hit);
|
|
1346
|
-
this[CACHE].set(key, this[LRU_LIST].head);
|
|
1347
|
-
trim(this);
|
|
1348
|
-
return true;
|
|
1349
|
-
}
|
|
1350
|
-
has(key) {
|
|
1351
|
-
if (!this[CACHE].has(key))
|
|
1352
|
-
return false;
|
|
1353
|
-
const hit = this[CACHE].get(key).value;
|
|
1354
|
-
return !isStale(this, hit);
|
|
1355
|
-
}
|
|
1356
|
-
get(key) {
|
|
1357
|
-
return get(this, key, true);
|
|
1358
|
-
}
|
|
1359
|
-
peek(key) {
|
|
1360
|
-
return get(this, key, false);
|
|
1361
|
-
}
|
|
1362
|
-
pop() {
|
|
1363
|
-
const node = this[LRU_LIST].tail;
|
|
1364
|
-
if (!node)
|
|
1365
|
-
return null;
|
|
1366
|
-
del(this, node);
|
|
1367
|
-
return node.value;
|
|
1368
|
-
}
|
|
1369
|
-
del(key) {
|
|
1370
|
-
del(this, this[CACHE].get(key));
|
|
1371
|
-
}
|
|
1372
|
-
load(arr) {
|
|
1373
|
-
this.reset();
|
|
1374
|
-
const now = Date.now();
|
|
1375
|
-
for (let l = arr.length - 1; l >= 0; l--) {
|
|
1376
|
-
const hit = arr[l];
|
|
1377
|
-
const expiresAt = hit.e || 0;
|
|
1378
|
-
if (expiresAt === 0)
|
|
1379
|
-
this.set(hit.k, hit.v);
|
|
1380
|
-
else {
|
|
1381
|
-
const maxAge = expiresAt - now;
|
|
1382
|
-
if (maxAge > 0) {
|
|
1383
|
-
this.set(hit.k, hit.v, maxAge);
|
|
1384
|
-
}
|
|
1385
|
-
}
|
|
1386
|
-
}
|
|
1387
|
-
}
|
|
1388
|
-
prune() {
|
|
1389
|
-
this[CACHE].forEach((value, key) => get(this, key, false));
|
|
1390
|
-
}
|
|
1391
|
-
};
|
|
1392
|
-
var get = (self, key, doUse) => {
|
|
1393
|
-
const node = self[CACHE].get(key);
|
|
1394
|
-
if (node) {
|
|
1395
|
-
const hit = node.value;
|
|
1396
|
-
if (isStale(self, hit)) {
|
|
1397
|
-
del(self, node);
|
|
1398
|
-
if (!self[ALLOW_STALE])
|
|
1399
|
-
return void 0;
|
|
1400
|
-
} else {
|
|
1401
|
-
if (doUse) {
|
|
1402
|
-
if (self[UPDATE_AGE_ON_GET])
|
|
1403
|
-
node.value.now = Date.now();
|
|
1404
|
-
self[LRU_LIST].unshiftNode(node);
|
|
1405
|
-
}
|
|
1406
|
-
}
|
|
1407
|
-
return hit.value;
|
|
1408
|
-
}
|
|
1409
|
-
};
|
|
1410
|
-
var isStale = (self, hit) => {
|
|
1411
|
-
if (!hit || !hit.maxAge && !self[MAX_AGE])
|
|
1412
|
-
return false;
|
|
1413
|
-
const diff = Date.now() - hit.now;
|
|
1414
|
-
return hit.maxAge ? diff > hit.maxAge : self[MAX_AGE] && diff > self[MAX_AGE];
|
|
1415
|
-
};
|
|
1416
|
-
var trim = (self) => {
|
|
1417
|
-
if (self[LENGTH] > self[MAX]) {
|
|
1418
|
-
for (let walker = self[LRU_LIST].tail; self[LENGTH] > self[MAX] && walker !== null; ) {
|
|
1419
|
-
const prev = walker.prev;
|
|
1420
|
-
del(self, walker);
|
|
1421
|
-
walker = prev;
|
|
1422
|
-
}
|
|
1423
|
-
}
|
|
1424
|
-
};
|
|
1425
|
-
var del = (self, node) => {
|
|
1426
|
-
if (node) {
|
|
1427
|
-
const hit = node.value;
|
|
1428
|
-
if (self[DISPOSE])
|
|
1429
|
-
self[DISPOSE](hit.key, hit.value);
|
|
1430
|
-
self[LENGTH] -= hit.length;
|
|
1431
|
-
self[CACHE].delete(hit.key);
|
|
1432
|
-
self[LRU_LIST].removeNode(node);
|
|
1433
|
-
}
|
|
1434
|
-
};
|
|
1435
|
-
var Entry = class {
|
|
1436
|
-
constructor(key, value, length, now, maxAge) {
|
|
1437
|
-
this.key = key;
|
|
1438
|
-
this.value = value;
|
|
1439
|
-
this.length = length;
|
|
1440
|
-
this.now = now;
|
|
1441
|
-
this.maxAge = maxAge || 0;
|
|
1442
|
-
}
|
|
1443
|
-
};
|
|
1444
|
-
var forEachStep = (self, fn, node, thisp) => {
|
|
1445
|
-
let hit = node.value;
|
|
1446
|
-
if (isStale(self, hit)) {
|
|
1447
|
-
del(self, node);
|
|
1448
|
-
if (!self[ALLOW_STALE])
|
|
1449
|
-
hit = void 0;
|
|
1450
|
-
}
|
|
1451
|
-
if (hit)
|
|
1452
|
-
fn.call(thisp, hit.value, hit.key, self);
|
|
1453
|
-
};
|
|
1454
|
-
module.exports = LRUCache;
|
|
1455
|
-
}
|
|
1456
|
-
});
|
|
1457
|
-
|
|
1458
|
-
// ../../node_modules/.pnpm/semver@7.6.0/node_modules/semver/classes/range.js
|
|
1459
|
-
var require_range = __commonJS({
|
|
1460
|
-
"../../node_modules/.pnpm/semver@7.6.0/node_modules/semver/classes/range.js"(exports, module) {
|
|
1461
|
-
"use strict";
|
|
1462
|
-
var Range = class _Range {
|
|
1463
|
-
constructor(range2, options) {
|
|
1464
|
-
options = parseOptions(options);
|
|
1465
|
-
if (range2 instanceof _Range) {
|
|
1466
|
-
if (range2.loose === !!options.loose && range2.includePrerelease === !!options.includePrerelease) {
|
|
1467
|
-
return range2;
|
|
1468
|
-
} else {
|
|
1469
|
-
return new _Range(range2.raw, options);
|
|
1470
|
-
}
|
|
1471
|
-
}
|
|
1472
|
-
if (range2 instanceof Comparator) {
|
|
1473
|
-
this.raw = range2.value;
|
|
1474
|
-
this.set = [[range2]];
|
|
1475
|
-
this.format();
|
|
1476
|
-
return this;
|
|
1477
|
-
}
|
|
1478
|
-
this.options = options;
|
|
1479
|
-
this.loose = !!options.loose;
|
|
1480
|
-
this.includePrerelease = !!options.includePrerelease;
|
|
1481
|
-
this.raw = range2.trim().split(/\s+/).join(" ");
|
|
1482
|
-
this.set = this.raw.split("||").map((r) => this.parseRange(r.trim())).filter((c) => c.length);
|
|
1483
|
-
if (!this.set.length) {
|
|
1484
|
-
throw new TypeError(`Invalid SemVer Range: ${this.raw}`);
|
|
1485
|
-
}
|
|
1486
|
-
if (this.set.length > 1) {
|
|
1487
|
-
const first = this.set[0];
|
|
1488
|
-
this.set = this.set.filter((c) => !isNullSet(c[0]));
|
|
1489
|
-
if (this.set.length === 0) {
|
|
1490
|
-
this.set = [first];
|
|
1491
|
-
} else if (this.set.length > 1) {
|
|
1492
|
-
for (const c of this.set) {
|
|
1493
|
-
if (c.length === 1 && isAny(c[0])) {
|
|
1494
|
-
this.set = [c];
|
|
1495
|
-
break;
|
|
1496
|
-
}
|
|
1497
|
-
}
|
|
1498
|
-
}
|
|
1499
|
-
}
|
|
1500
|
-
this.format();
|
|
1501
|
-
}
|
|
1502
|
-
format() {
|
|
1503
|
-
this.range = this.set.map((comps) => comps.join(" ").trim()).join("||").trim();
|
|
1504
|
-
return this.range;
|
|
1505
|
-
}
|
|
1506
|
-
toString() {
|
|
1507
|
-
return this.range;
|
|
1508
|
-
}
|
|
1509
|
-
parseRange(range2) {
|
|
1510
|
-
const memoOpts = (this.options.includePrerelease && FLAG_INCLUDE_PRERELEASE) | (this.options.loose && FLAG_LOOSE);
|
|
1511
|
-
const memoKey = memoOpts + ":" + range2;
|
|
1512
|
-
const cached = cache.get(memoKey);
|
|
1513
|
-
if (cached) {
|
|
1514
|
-
return cached;
|
|
1515
|
-
}
|
|
1516
|
-
const loose = this.options.loose;
|
|
1517
|
-
const hr = loose ? re[t.HYPHENRANGELOOSE] : re[t.HYPHENRANGE];
|
|
1518
|
-
range2 = range2.replace(hr, hyphenReplace(this.options.includePrerelease));
|
|
1519
|
-
debug("hyphen replace", range2);
|
|
1520
|
-
range2 = range2.replace(re[t.COMPARATORTRIM], comparatorTrimReplace);
|
|
1521
|
-
debug("comparator trim", range2);
|
|
1522
|
-
range2 = range2.replace(re[t.TILDETRIM], tildeTrimReplace);
|
|
1523
|
-
debug("tilde trim", range2);
|
|
1524
|
-
range2 = range2.replace(re[t.CARETTRIM], caretTrimReplace);
|
|
1525
|
-
debug("caret trim", range2);
|
|
1526
|
-
let rangeList = range2.split(" ").map((comp) => parseComparator(comp, this.options)).join(" ").split(/\s+/).map((comp) => replaceGTE0(comp, this.options));
|
|
1527
|
-
if (loose) {
|
|
1528
|
-
rangeList = rangeList.filter((comp) => {
|
|
1529
|
-
debug("loose invalid filter", comp, this.options);
|
|
1530
|
-
return !!comp.match(re[t.COMPARATORLOOSE]);
|
|
1531
|
-
});
|
|
1532
|
-
}
|
|
1533
|
-
debug("range list", rangeList);
|
|
1534
|
-
const rangeMap = /* @__PURE__ */ new Map();
|
|
1535
|
-
const comparators = rangeList.map((comp) => new Comparator(comp, this.options));
|
|
1536
|
-
for (const comp of comparators) {
|
|
1537
|
-
if (isNullSet(comp)) {
|
|
1538
|
-
return [comp];
|
|
1539
|
-
}
|
|
1540
|
-
rangeMap.set(comp.value, comp);
|
|
1541
|
-
}
|
|
1542
|
-
if (rangeMap.size > 1 && rangeMap.has("")) {
|
|
1543
|
-
rangeMap.delete("");
|
|
1544
|
-
}
|
|
1545
|
-
const result = [...rangeMap.values()];
|
|
1546
|
-
cache.set(memoKey, result);
|
|
1547
|
-
return result;
|
|
1548
|
-
}
|
|
1549
|
-
intersects(range2, options) {
|
|
1550
|
-
if (!(range2 instanceof _Range)) {
|
|
1551
|
-
throw new TypeError("a Range is required");
|
|
1552
|
-
}
|
|
1553
|
-
return this.set.some((thisComparators) => {
|
|
1554
|
-
return isSatisfiable(thisComparators, options) && range2.set.some((rangeComparators) => {
|
|
1555
|
-
return isSatisfiable(rangeComparators, options) && thisComparators.every((thisComparator) => {
|
|
1556
|
-
return rangeComparators.every((rangeComparator) => {
|
|
1557
|
-
return thisComparator.intersects(rangeComparator, options);
|
|
1558
|
-
});
|
|
1559
|
-
});
|
|
1560
|
-
});
|
|
1561
|
-
});
|
|
1562
|
-
}
|
|
1563
|
-
// if ANY of the sets match ALL of its comparators, then pass
|
|
1564
|
-
test(version2) {
|
|
1565
|
-
if (!version2) {
|
|
1566
|
-
return false;
|
|
1567
|
-
}
|
|
1568
|
-
if (typeof version2 === "string") {
|
|
1569
|
-
try {
|
|
1570
|
-
version2 = new SemVer(version2, this.options);
|
|
1571
|
-
} catch (er) {
|
|
1572
|
-
return false;
|
|
1573
|
-
}
|
|
1574
|
-
}
|
|
1575
|
-
for (let i = 0; i < this.set.length; i++) {
|
|
1576
|
-
if (testSet(this.set[i], version2, this.options)) {
|
|
1577
|
-
return true;
|
|
1578
|
-
}
|
|
1579
|
-
}
|
|
1580
|
-
return false;
|
|
1581
|
-
}
|
|
1582
|
-
};
|
|
1583
|
-
module.exports = Range;
|
|
1584
|
-
var LRU = require_lru_cache();
|
|
1585
|
-
var cache = new LRU({ max: 1e3 });
|
|
1586
|
-
var parseOptions = require_parse_options();
|
|
1587
|
-
var Comparator = require_comparator();
|
|
1588
|
-
var debug = require_debug();
|
|
1589
|
-
var SemVer = require_semver();
|
|
1590
|
-
var {
|
|
1591
|
-
safeRe: re,
|
|
1592
|
-
t,
|
|
1593
|
-
comparatorTrimReplace,
|
|
1594
|
-
tildeTrimReplace,
|
|
1595
|
-
caretTrimReplace
|
|
1596
|
-
} = require_re();
|
|
1597
|
-
var { FLAG_INCLUDE_PRERELEASE, FLAG_LOOSE } = require_constants();
|
|
1598
|
-
var isNullSet = (c) => c.value === "<0.0.0-0";
|
|
1599
|
-
var isAny = (c) => c.value === "";
|
|
1600
|
-
var isSatisfiable = (comparators, options) => {
|
|
1601
|
-
let result = true;
|
|
1602
|
-
const remainingComparators = comparators.slice();
|
|
1603
|
-
let testComparator = remainingComparators.pop();
|
|
1604
|
-
while (result && remainingComparators.length) {
|
|
1605
|
-
result = remainingComparators.every((otherComparator) => {
|
|
1606
|
-
return testComparator.intersects(otherComparator, options);
|
|
1607
|
-
});
|
|
1608
|
-
testComparator = remainingComparators.pop();
|
|
1609
|
-
}
|
|
1610
|
-
return result;
|
|
1611
|
-
};
|
|
1612
|
-
var parseComparator = (comp, options) => {
|
|
1613
|
-
debug("comp", comp, options);
|
|
1614
|
-
comp = replaceCarets(comp, options);
|
|
1615
|
-
debug("caret", comp);
|
|
1616
|
-
comp = replaceTildes(comp, options);
|
|
1617
|
-
debug("tildes", comp);
|
|
1618
|
-
comp = replaceXRanges(comp, options);
|
|
1619
|
-
debug("xrange", comp);
|
|
1620
|
-
comp = replaceStars(comp, options);
|
|
1621
|
-
debug("stars", comp);
|
|
1622
|
-
return comp;
|
|
1623
|
-
};
|
|
1624
|
-
var isX = (id) => !id || id.toLowerCase() === "x" || id === "*";
|
|
1625
|
-
var replaceTildes = (comp, options) => {
|
|
1626
|
-
return comp.trim().split(/\s+/).map((c) => replaceTilde(c, options)).join(" ");
|
|
1627
|
-
};
|
|
1628
|
-
var replaceTilde = (comp, options) => {
|
|
1629
|
-
const r = options.loose ? re[t.TILDELOOSE] : re[t.TILDE];
|
|
1630
|
-
return comp.replace(r, (_, M, m, p, pr) => {
|
|
1631
|
-
debug("tilde", comp, _, M, m, p, pr);
|
|
1632
|
-
let ret;
|
|
1633
|
-
if (isX(M)) {
|
|
1634
|
-
ret = "";
|
|
1635
|
-
} else if (isX(m)) {
|
|
1636
|
-
ret = `>=${M}.0.0 <${+M + 1}.0.0-0`;
|
|
1637
|
-
} else if (isX(p)) {
|
|
1638
|
-
ret = `>=${M}.${m}.0 <${M}.${+m + 1}.0-0`;
|
|
1639
|
-
} else if (pr) {
|
|
1640
|
-
debug("replaceTilde pr", pr);
|
|
1641
|
-
ret = `>=${M}.${m}.${p}-${pr} <${M}.${+m + 1}.0-0`;
|
|
1642
|
-
} else {
|
|
1643
|
-
ret = `>=${M}.${m}.${p} <${M}.${+m + 1}.0-0`;
|
|
1644
|
-
}
|
|
1645
|
-
debug("tilde return", ret);
|
|
1646
|
-
return ret;
|
|
1647
|
-
});
|
|
1648
|
-
};
|
|
1649
|
-
var replaceCarets = (comp, options) => {
|
|
1650
|
-
return comp.trim().split(/\s+/).map((c) => replaceCaret(c, options)).join(" ");
|
|
1651
|
-
};
|
|
1652
|
-
var replaceCaret = (comp, options) => {
|
|
1653
|
-
debug("caret", comp, options);
|
|
1654
|
-
const r = options.loose ? re[t.CARETLOOSE] : re[t.CARET];
|
|
1655
|
-
const z = options.includePrerelease ? "-0" : "";
|
|
1656
|
-
return comp.replace(r, (_, M, m, p, pr) => {
|
|
1657
|
-
debug("caret", comp, _, M, m, p, pr);
|
|
1658
|
-
let ret;
|
|
1659
|
-
if (isX(M)) {
|
|
1660
|
-
ret = "";
|
|
1661
|
-
} else if (isX(m)) {
|
|
1662
|
-
ret = `>=${M}.0.0${z} <${+M + 1}.0.0-0`;
|
|
1663
|
-
} else if (isX(p)) {
|
|
1664
|
-
if (M === "0") {
|
|
1665
|
-
ret = `>=${M}.${m}.0${z} <${M}.${+m + 1}.0-0`;
|
|
1666
|
-
} else {
|
|
1667
|
-
ret = `>=${M}.${m}.0${z} <${+M + 1}.0.0-0`;
|
|
1668
|
-
}
|
|
1669
|
-
} else if (pr) {
|
|
1670
|
-
debug("replaceCaret pr", pr);
|
|
1671
|
-
if (M === "0") {
|
|
1672
|
-
if (m === "0") {
|
|
1673
|
-
ret = `>=${M}.${m}.${p}-${pr} <${M}.${m}.${+p + 1}-0`;
|
|
1674
|
-
} else {
|
|
1675
|
-
ret = `>=${M}.${m}.${p}-${pr} <${M}.${+m + 1}.0-0`;
|
|
1676
|
-
}
|
|
1677
|
-
} else {
|
|
1678
|
-
ret = `>=${M}.${m}.${p}-${pr} <${+M + 1}.0.0-0`;
|
|
1679
|
-
}
|
|
1680
|
-
} else {
|
|
1681
|
-
debug("no pr");
|
|
1682
|
-
if (M === "0") {
|
|
1683
|
-
if (m === "0") {
|
|
1684
|
-
ret = `>=${M}.${m}.${p}${z} <${M}.${m}.${+p + 1}-0`;
|
|
1685
|
-
} else {
|
|
1686
|
-
ret = `>=${M}.${m}.${p}${z} <${M}.${+m + 1}.0-0`;
|
|
1687
|
-
}
|
|
1688
|
-
} else {
|
|
1689
|
-
ret = `>=${M}.${m}.${p} <${+M + 1}.0.0-0`;
|
|
1690
|
-
}
|
|
1691
|
-
}
|
|
1692
|
-
debug("caret return", ret);
|
|
1693
|
-
return ret;
|
|
1694
|
-
});
|
|
1695
|
-
};
|
|
1696
|
-
var replaceXRanges = (comp, options) => {
|
|
1697
|
-
debug("replaceXRanges", comp, options);
|
|
1698
|
-
return comp.split(/\s+/).map((c) => replaceXRange(c, options)).join(" ");
|
|
1699
|
-
};
|
|
1700
|
-
var replaceXRange = (comp, options) => {
|
|
1701
|
-
comp = comp.trim();
|
|
1702
|
-
const r = options.loose ? re[t.XRANGELOOSE] : re[t.XRANGE];
|
|
1703
|
-
return comp.replace(r, (ret, gtlt, M, m, p, pr) => {
|
|
1704
|
-
debug("xRange", comp, ret, gtlt, M, m, p, pr);
|
|
1705
|
-
const xM = isX(M);
|
|
1706
|
-
const xm = xM || isX(m);
|
|
1707
|
-
const xp = xm || isX(p);
|
|
1708
|
-
const anyX = xp;
|
|
1709
|
-
if (gtlt === "=" && anyX) {
|
|
1710
|
-
gtlt = "";
|
|
1711
|
-
}
|
|
1712
|
-
pr = options.includePrerelease ? "-0" : "";
|
|
1713
|
-
if (xM) {
|
|
1714
|
-
if (gtlt === ">" || gtlt === "<") {
|
|
1715
|
-
ret = "<0.0.0-0";
|
|
1716
|
-
} else {
|
|
1717
|
-
ret = "*";
|
|
1718
|
-
}
|
|
1719
|
-
} else if (gtlt && anyX) {
|
|
1720
|
-
if (xm) {
|
|
1721
|
-
m = 0;
|
|
1722
|
-
}
|
|
1723
|
-
p = 0;
|
|
1724
|
-
if (gtlt === ">") {
|
|
1725
|
-
gtlt = ">=";
|
|
1726
|
-
if (xm) {
|
|
1727
|
-
M = +M + 1;
|
|
1728
|
-
m = 0;
|
|
1729
|
-
p = 0;
|
|
1730
|
-
} else {
|
|
1731
|
-
m = +m + 1;
|
|
1732
|
-
p = 0;
|
|
1733
|
-
}
|
|
1734
|
-
} else if (gtlt === "<=") {
|
|
1735
|
-
gtlt = "<";
|
|
1736
|
-
if (xm) {
|
|
1737
|
-
M = +M + 1;
|
|
1738
|
-
} else {
|
|
1739
|
-
m = +m + 1;
|
|
1740
|
-
}
|
|
1741
|
-
}
|
|
1742
|
-
if (gtlt === "<") {
|
|
1743
|
-
pr = "-0";
|
|
1744
|
-
}
|
|
1745
|
-
ret = `${gtlt + M}.${m}.${p}${pr}`;
|
|
1746
|
-
} else if (xm) {
|
|
1747
|
-
ret = `>=${M}.0.0${pr} <${+M + 1}.0.0-0`;
|
|
1748
|
-
} else if (xp) {
|
|
1749
|
-
ret = `>=${M}.${m}.0${pr} <${M}.${+m + 1}.0-0`;
|
|
1750
|
-
}
|
|
1751
|
-
debug("xRange return", ret);
|
|
1752
|
-
return ret;
|
|
1753
|
-
});
|
|
1754
|
-
};
|
|
1755
|
-
var replaceStars = (comp, options) => {
|
|
1756
|
-
debug("replaceStars", comp, options);
|
|
1757
|
-
return comp.trim().replace(re[t.STAR], "");
|
|
1758
|
-
};
|
|
1759
|
-
var replaceGTE0 = (comp, options) => {
|
|
1760
|
-
debug("replaceGTE0", comp, options);
|
|
1761
|
-
return comp.trim().replace(re[options.includePrerelease ? t.GTE0PRE : t.GTE0], "");
|
|
1762
|
-
};
|
|
1763
|
-
var hyphenReplace = (incPr) => ($0, from, fM, fm, fp, fpr, fb, to, tM, tm, tp, tpr, tb) => {
|
|
1764
|
-
if (isX(fM)) {
|
|
1765
|
-
from = "";
|
|
1766
|
-
} else if (isX(fm)) {
|
|
1767
|
-
from = `>=${fM}.0.0${incPr ? "-0" : ""}`;
|
|
1768
|
-
} else if (isX(fp)) {
|
|
1769
|
-
from = `>=${fM}.${fm}.0${incPr ? "-0" : ""}`;
|
|
1770
|
-
} else if (fpr) {
|
|
1771
|
-
from = `>=${from}`;
|
|
1772
|
-
} else {
|
|
1773
|
-
from = `>=${from}${incPr ? "-0" : ""}`;
|
|
1774
|
-
}
|
|
1775
|
-
if (isX(tM)) {
|
|
1776
|
-
to = "";
|
|
1777
|
-
} else if (isX(tm)) {
|
|
1778
|
-
to = `<${+tM + 1}.0.0-0`;
|
|
1779
|
-
} else if (isX(tp)) {
|
|
1780
|
-
to = `<${tM}.${+tm + 1}.0-0`;
|
|
1781
|
-
} else if (tpr) {
|
|
1782
|
-
to = `<=${tM}.${tm}.${tp}-${tpr}`;
|
|
1783
|
-
} else if (incPr) {
|
|
1784
|
-
to = `<${tM}.${tm}.${+tp + 1}-0`;
|
|
1785
|
-
} else {
|
|
1786
|
-
to = `<=${to}`;
|
|
1787
|
-
}
|
|
1788
|
-
return `${from} ${to}`.trim();
|
|
1789
|
-
};
|
|
1790
|
-
var testSet = (set, version2, options) => {
|
|
1791
|
-
for (let i = 0; i < set.length; i++) {
|
|
1792
|
-
if (!set[i].test(version2)) {
|
|
1793
|
-
return false;
|
|
1794
|
-
}
|
|
1795
|
-
}
|
|
1796
|
-
if (version2.prerelease.length && !options.includePrerelease) {
|
|
1797
|
-
for (let i = 0; i < set.length; i++) {
|
|
1798
|
-
debug(set[i].semver);
|
|
1799
|
-
if (set[i].semver === Comparator.ANY) {
|
|
1800
|
-
continue;
|
|
1801
|
-
}
|
|
1802
|
-
if (set[i].semver.prerelease.length > 0) {
|
|
1803
|
-
const allowed = set[i].semver;
|
|
1804
|
-
if (allowed.major === version2.major && allowed.minor === version2.minor && allowed.patch === version2.patch) {
|
|
1805
|
-
return true;
|
|
1806
|
-
}
|
|
1807
|
-
}
|
|
1808
|
-
}
|
|
1809
|
-
return false;
|
|
1810
|
-
}
|
|
1811
|
-
return true;
|
|
1812
|
-
};
|
|
1813
|
-
}
|
|
1814
|
-
});
|
|
1815
|
-
|
|
1816
|
-
// ../../node_modules/.pnpm/semver@7.6.0/node_modules/semver/classes/comparator.js
|
|
1817
|
-
var require_comparator = __commonJS({
|
|
1818
|
-
"../../node_modules/.pnpm/semver@7.6.0/node_modules/semver/classes/comparator.js"(exports, module) {
|
|
1819
|
-
"use strict";
|
|
1820
|
-
var ANY = Symbol("SemVer ANY");
|
|
1821
|
-
var Comparator = class _Comparator {
|
|
1822
|
-
static get ANY() {
|
|
1823
|
-
return ANY;
|
|
1824
|
-
}
|
|
1825
|
-
constructor(comp, options) {
|
|
1826
|
-
options = parseOptions(options);
|
|
1827
|
-
if (comp instanceof _Comparator) {
|
|
1828
|
-
if (comp.loose === !!options.loose) {
|
|
1829
|
-
return comp;
|
|
1830
|
-
} else {
|
|
1831
|
-
comp = comp.value;
|
|
1832
|
-
}
|
|
1833
|
-
}
|
|
1834
|
-
comp = comp.trim().split(/\s+/).join(" ");
|
|
1835
|
-
debug("comparator", comp, options);
|
|
1836
|
-
this.options = options;
|
|
1837
|
-
this.loose = !!options.loose;
|
|
1838
|
-
this.parse(comp);
|
|
1839
|
-
if (this.semver === ANY) {
|
|
1840
|
-
this.value = "";
|
|
1841
|
-
} else {
|
|
1842
|
-
this.value = this.operator + this.semver.version;
|
|
1843
|
-
}
|
|
1844
|
-
debug("comp", this);
|
|
1845
|
-
}
|
|
1846
|
-
parse(comp) {
|
|
1847
|
-
const r = this.options.loose ? re[t.COMPARATORLOOSE] : re[t.COMPARATOR];
|
|
1848
|
-
const m = comp.match(r);
|
|
1849
|
-
if (!m) {
|
|
1850
|
-
throw new TypeError(`Invalid comparator: ${comp}`);
|
|
1851
|
-
}
|
|
1852
|
-
this.operator = m[1] !== void 0 ? m[1] : "";
|
|
1853
|
-
if (this.operator === "=") {
|
|
1854
|
-
this.operator = "";
|
|
1855
|
-
}
|
|
1856
|
-
if (!m[2]) {
|
|
1857
|
-
this.semver = ANY;
|
|
1858
|
-
} else {
|
|
1859
|
-
this.semver = new SemVer(m[2], this.options.loose);
|
|
1860
|
-
}
|
|
1861
|
-
}
|
|
1862
|
-
toString() {
|
|
1863
|
-
return this.value;
|
|
1864
|
-
}
|
|
1865
|
-
test(version2) {
|
|
1866
|
-
debug("Comparator.test", version2, this.options.loose);
|
|
1867
|
-
if (this.semver === ANY || version2 === ANY) {
|
|
1868
|
-
return true;
|
|
1869
|
-
}
|
|
1870
|
-
if (typeof version2 === "string") {
|
|
1871
|
-
try {
|
|
1872
|
-
version2 = new SemVer(version2, this.options);
|
|
1873
|
-
} catch (er) {
|
|
1874
|
-
return false;
|
|
1875
|
-
}
|
|
1876
|
-
}
|
|
1877
|
-
return cmp(version2, this.operator, this.semver, this.options);
|
|
1878
|
-
}
|
|
1879
|
-
intersects(comp, options) {
|
|
1880
|
-
if (!(comp instanceof _Comparator)) {
|
|
1881
|
-
throw new TypeError("a Comparator is required");
|
|
1882
|
-
}
|
|
1883
|
-
if (this.operator === "") {
|
|
1884
|
-
if (this.value === "") {
|
|
1885
|
-
return true;
|
|
1886
|
-
}
|
|
1887
|
-
return new Range(comp.value, options).test(this.value);
|
|
1888
|
-
} else if (comp.operator === "") {
|
|
1889
|
-
if (comp.value === "") {
|
|
1890
|
-
return true;
|
|
1891
|
-
}
|
|
1892
|
-
return new Range(this.value, options).test(comp.semver);
|
|
1893
|
-
}
|
|
1894
|
-
options = parseOptions(options);
|
|
1895
|
-
if (options.includePrerelease && (this.value === "<0.0.0-0" || comp.value === "<0.0.0-0")) {
|
|
1896
|
-
return false;
|
|
1897
|
-
}
|
|
1898
|
-
if (!options.includePrerelease && (this.value.startsWith("<0.0.0") || comp.value.startsWith("<0.0.0"))) {
|
|
1899
|
-
return false;
|
|
1900
|
-
}
|
|
1901
|
-
if (this.operator.startsWith(">") && comp.operator.startsWith(">")) {
|
|
1902
|
-
return true;
|
|
1903
|
-
}
|
|
1904
|
-
if (this.operator.startsWith("<") && comp.operator.startsWith("<")) {
|
|
1905
|
-
return true;
|
|
1906
|
-
}
|
|
1907
|
-
if (this.semver.version === comp.semver.version && this.operator.includes("=") && comp.operator.includes("=")) {
|
|
1908
|
-
return true;
|
|
1909
|
-
}
|
|
1910
|
-
if (cmp(this.semver, "<", comp.semver, options) && this.operator.startsWith(">") && comp.operator.startsWith("<")) {
|
|
1911
|
-
return true;
|
|
1912
|
-
}
|
|
1913
|
-
if (cmp(this.semver, ">", comp.semver, options) && this.operator.startsWith("<") && comp.operator.startsWith(">")) {
|
|
1914
|
-
return true;
|
|
1915
|
-
}
|
|
1916
|
-
return false;
|
|
1917
|
-
}
|
|
1918
|
-
};
|
|
1919
|
-
module.exports = Comparator;
|
|
1920
|
-
var parseOptions = require_parse_options();
|
|
1921
|
-
var { safeRe: re, t } = require_re();
|
|
1922
|
-
var cmp = require_cmp();
|
|
1923
|
-
var debug = require_debug();
|
|
1924
|
-
var SemVer = require_semver();
|
|
1925
|
-
var Range = require_range();
|
|
1926
|
-
}
|
|
1927
|
-
});
|
|
1928
|
-
|
|
1929
|
-
// ../../node_modules/.pnpm/semver@7.6.0/node_modules/semver/functions/satisfies.js
|
|
1930
|
-
var require_satisfies = __commonJS({
|
|
1931
|
-
"../../node_modules/.pnpm/semver@7.6.0/node_modules/semver/functions/satisfies.js"(exports, module) {
|
|
1932
|
-
"use strict";
|
|
1933
|
-
var Range = require_range();
|
|
1934
|
-
var satisfies2 = (version2, range2, options) => {
|
|
1935
|
-
try {
|
|
1936
|
-
range2 = new Range(range2, options);
|
|
1937
|
-
} catch (er) {
|
|
1938
|
-
return false;
|
|
1939
|
-
}
|
|
1940
|
-
return range2.test(version2);
|
|
1941
|
-
};
|
|
1942
|
-
module.exports = satisfies2;
|
|
1943
|
-
}
|
|
1944
|
-
});
|
|
1945
|
-
|
|
1946
|
-
// ../../node_modules/.pnpm/semver@7.6.0/node_modules/semver/ranges/to-comparators.js
|
|
1947
|
-
var require_to_comparators = __commonJS({
|
|
1948
|
-
"../../node_modules/.pnpm/semver@7.6.0/node_modules/semver/ranges/to-comparators.js"(exports, module) {
|
|
1949
|
-
"use strict";
|
|
1950
|
-
var Range = require_range();
|
|
1951
|
-
var toComparators = (range2, options) => new Range(range2, options).set.map((comp) => comp.map((c) => c.value).join(" ").trim().split(" "));
|
|
1952
|
-
module.exports = toComparators;
|
|
1953
|
-
}
|
|
1954
|
-
});
|
|
1955
|
-
|
|
1956
|
-
// ../../node_modules/.pnpm/semver@7.6.0/node_modules/semver/ranges/max-satisfying.js
|
|
1957
|
-
var require_max_satisfying = __commonJS({
|
|
1958
|
-
"../../node_modules/.pnpm/semver@7.6.0/node_modules/semver/ranges/max-satisfying.js"(exports, module) {
|
|
1959
|
-
"use strict";
|
|
1960
|
-
var SemVer = require_semver();
|
|
1961
|
-
var Range = require_range();
|
|
1962
|
-
var maxSatisfying = (versions, range2, options) => {
|
|
1963
|
-
let max = null;
|
|
1964
|
-
let maxSV = null;
|
|
1965
|
-
let rangeObj = null;
|
|
1966
|
-
try {
|
|
1967
|
-
rangeObj = new Range(range2, options);
|
|
1968
|
-
} catch (er) {
|
|
1969
|
-
return null;
|
|
1970
|
-
}
|
|
1971
|
-
versions.forEach((v) => {
|
|
1972
|
-
if (rangeObj.test(v)) {
|
|
1973
|
-
if (!max || maxSV.compare(v) === -1) {
|
|
1974
|
-
max = v;
|
|
1975
|
-
maxSV = new SemVer(max, options);
|
|
1976
|
-
}
|
|
1977
|
-
}
|
|
1978
|
-
});
|
|
1979
|
-
return max;
|
|
1980
|
-
};
|
|
1981
|
-
module.exports = maxSatisfying;
|
|
1982
|
-
}
|
|
1983
|
-
});
|
|
1984
|
-
|
|
1985
|
-
// ../../node_modules/.pnpm/semver@7.6.0/node_modules/semver/ranges/min-satisfying.js
|
|
1986
|
-
var require_min_satisfying = __commonJS({
|
|
1987
|
-
"../../node_modules/.pnpm/semver@7.6.0/node_modules/semver/ranges/min-satisfying.js"(exports, module) {
|
|
1988
|
-
"use strict";
|
|
1989
|
-
var SemVer = require_semver();
|
|
1990
|
-
var Range = require_range();
|
|
1991
|
-
var minSatisfying = (versions, range2, options) => {
|
|
1992
|
-
let min = null;
|
|
1993
|
-
let minSV = null;
|
|
1994
|
-
let rangeObj = null;
|
|
1995
|
-
try {
|
|
1996
|
-
rangeObj = new Range(range2, options);
|
|
1997
|
-
} catch (er) {
|
|
1998
|
-
return null;
|
|
1999
|
-
}
|
|
2000
|
-
versions.forEach((v) => {
|
|
2001
|
-
if (rangeObj.test(v)) {
|
|
2002
|
-
if (!min || minSV.compare(v) === 1) {
|
|
2003
|
-
min = v;
|
|
2004
|
-
minSV = new SemVer(min, options);
|
|
2005
|
-
}
|
|
2006
|
-
}
|
|
2007
|
-
});
|
|
2008
|
-
return min;
|
|
2009
|
-
};
|
|
2010
|
-
module.exports = minSatisfying;
|
|
2011
|
-
}
|
|
2012
|
-
});
|
|
2013
|
-
|
|
2014
|
-
// ../../node_modules/.pnpm/semver@7.6.0/node_modules/semver/ranges/min-version.js
|
|
2015
|
-
var require_min_version = __commonJS({
|
|
2016
|
-
"../../node_modules/.pnpm/semver@7.6.0/node_modules/semver/ranges/min-version.js"(exports, module) {
|
|
2017
|
-
"use strict";
|
|
2018
|
-
var SemVer = require_semver();
|
|
2019
|
-
var Range = require_range();
|
|
2020
|
-
var gt = require_gt();
|
|
2021
|
-
var minVersion = (range2, loose) => {
|
|
2022
|
-
range2 = new Range(range2, loose);
|
|
2023
|
-
let minver = new SemVer("0.0.0");
|
|
2024
|
-
if (range2.test(minver)) {
|
|
2025
|
-
return minver;
|
|
2026
|
-
}
|
|
2027
|
-
minver = new SemVer("0.0.0-0");
|
|
2028
|
-
if (range2.test(minver)) {
|
|
2029
|
-
return minver;
|
|
2030
|
-
}
|
|
2031
|
-
minver = null;
|
|
2032
|
-
for (let i = 0; i < range2.set.length; ++i) {
|
|
2033
|
-
const comparators = range2.set[i];
|
|
2034
|
-
let setMin = null;
|
|
2035
|
-
comparators.forEach((comparator) => {
|
|
2036
|
-
const compver = new SemVer(comparator.semver.version);
|
|
2037
|
-
switch (comparator.operator) {
|
|
2038
|
-
case ">":
|
|
2039
|
-
if (compver.prerelease.length === 0) {
|
|
2040
|
-
compver.patch++;
|
|
2041
|
-
} else {
|
|
2042
|
-
compver.prerelease.push(0);
|
|
2043
|
-
}
|
|
2044
|
-
compver.raw = compver.format();
|
|
2045
|
-
case "":
|
|
2046
|
-
case ">=":
|
|
2047
|
-
if (!setMin || gt(compver, setMin)) {
|
|
2048
|
-
setMin = compver;
|
|
2049
|
-
}
|
|
2050
|
-
break;
|
|
2051
|
-
case "<":
|
|
2052
|
-
case "<=":
|
|
2053
|
-
break;
|
|
2054
|
-
default:
|
|
2055
|
-
throw new Error(`Unexpected operation: ${comparator.operator}`);
|
|
2056
|
-
}
|
|
2057
|
-
});
|
|
2058
|
-
if (setMin && (!minver || gt(minver, setMin))) {
|
|
2059
|
-
minver = setMin;
|
|
2060
|
-
}
|
|
2061
|
-
}
|
|
2062
|
-
if (minver && range2.test(minver)) {
|
|
2063
|
-
return minver;
|
|
2064
|
-
}
|
|
2065
|
-
return null;
|
|
2066
|
-
};
|
|
2067
|
-
module.exports = minVersion;
|
|
2068
|
-
}
|
|
2069
|
-
});
|
|
2070
|
-
|
|
2071
|
-
// ../../node_modules/.pnpm/semver@7.6.0/node_modules/semver/ranges/valid.js
|
|
2072
|
-
var require_valid2 = __commonJS({
|
|
2073
|
-
"../../node_modules/.pnpm/semver@7.6.0/node_modules/semver/ranges/valid.js"(exports, module) {
|
|
2074
|
-
"use strict";
|
|
2075
|
-
var Range = require_range();
|
|
2076
|
-
var validRange = (range2, options) => {
|
|
2077
|
-
try {
|
|
2078
|
-
return new Range(range2, options).range || "*";
|
|
2079
|
-
} catch (er) {
|
|
2080
|
-
return null;
|
|
2081
|
-
}
|
|
2082
|
-
};
|
|
2083
|
-
module.exports = validRange;
|
|
2084
|
-
}
|
|
2085
|
-
});
|
|
2086
|
-
|
|
2087
|
-
// ../../node_modules/.pnpm/semver@7.6.0/node_modules/semver/ranges/outside.js
|
|
2088
|
-
var require_outside = __commonJS({
|
|
2089
|
-
"../../node_modules/.pnpm/semver@7.6.0/node_modules/semver/ranges/outside.js"(exports, module) {
|
|
2090
|
-
"use strict";
|
|
2091
|
-
var SemVer = require_semver();
|
|
2092
|
-
var Comparator = require_comparator();
|
|
2093
|
-
var { ANY } = Comparator;
|
|
2094
|
-
var Range = require_range();
|
|
2095
|
-
var satisfies2 = require_satisfies();
|
|
2096
|
-
var gt = require_gt();
|
|
2097
|
-
var lt = require_lt();
|
|
2098
|
-
var lte = require_lte();
|
|
2099
|
-
var gte = require_gte();
|
|
2100
|
-
var outside = (version2, range2, hilo, options) => {
|
|
2101
|
-
version2 = new SemVer(version2, options);
|
|
2102
|
-
range2 = new Range(range2, options);
|
|
2103
|
-
let gtfn, ltefn, ltfn, comp, ecomp;
|
|
2104
|
-
switch (hilo) {
|
|
2105
|
-
case ">":
|
|
2106
|
-
gtfn = gt;
|
|
2107
|
-
ltefn = lte;
|
|
2108
|
-
ltfn = lt;
|
|
2109
|
-
comp = ">";
|
|
2110
|
-
ecomp = ">=";
|
|
2111
|
-
break;
|
|
2112
|
-
case "<":
|
|
2113
|
-
gtfn = lt;
|
|
2114
|
-
ltefn = gte;
|
|
2115
|
-
ltfn = gt;
|
|
2116
|
-
comp = "<";
|
|
2117
|
-
ecomp = "<=";
|
|
2118
|
-
break;
|
|
2119
|
-
default:
|
|
2120
|
-
throw new TypeError('Must provide a hilo val of "<" or ">"');
|
|
2121
|
-
}
|
|
2122
|
-
if (satisfies2(version2, range2, options)) {
|
|
2123
|
-
return false;
|
|
2124
|
-
}
|
|
2125
|
-
for (let i = 0; i < range2.set.length; ++i) {
|
|
2126
|
-
const comparators = range2.set[i];
|
|
2127
|
-
let high = null;
|
|
2128
|
-
let low = null;
|
|
2129
|
-
comparators.forEach((comparator) => {
|
|
2130
|
-
if (comparator.semver === ANY) {
|
|
2131
|
-
comparator = new Comparator(">=0.0.0");
|
|
2132
|
-
}
|
|
2133
|
-
high = high || comparator;
|
|
2134
|
-
low = low || comparator;
|
|
2135
|
-
if (gtfn(comparator.semver, high.semver, options)) {
|
|
2136
|
-
high = comparator;
|
|
2137
|
-
} else if (ltfn(comparator.semver, low.semver, options)) {
|
|
2138
|
-
low = comparator;
|
|
2139
|
-
}
|
|
2140
|
-
});
|
|
2141
|
-
if (high.operator === comp || high.operator === ecomp) {
|
|
2142
|
-
return false;
|
|
2143
|
-
}
|
|
2144
|
-
if ((!low.operator || low.operator === comp) && ltefn(version2, low.semver)) {
|
|
2145
|
-
return false;
|
|
2146
|
-
} else if (low.operator === ecomp && ltfn(version2, low.semver)) {
|
|
2147
|
-
return false;
|
|
2148
|
-
}
|
|
2149
|
-
}
|
|
2150
|
-
return true;
|
|
2151
|
-
};
|
|
2152
|
-
module.exports = outside;
|
|
2153
|
-
}
|
|
2154
|
-
});
|
|
2155
|
-
|
|
2156
|
-
// ../../node_modules/.pnpm/semver@7.6.0/node_modules/semver/ranges/gtr.js
|
|
2157
|
-
var require_gtr = __commonJS({
|
|
2158
|
-
"../../node_modules/.pnpm/semver@7.6.0/node_modules/semver/ranges/gtr.js"(exports, module) {
|
|
2159
|
-
"use strict";
|
|
2160
|
-
var outside = require_outside();
|
|
2161
|
-
var gtr = (version2, range2, options) => outside(version2, range2, ">", options);
|
|
2162
|
-
module.exports = gtr;
|
|
2163
|
-
}
|
|
2164
|
-
});
|
|
2165
|
-
|
|
2166
|
-
// ../../node_modules/.pnpm/semver@7.6.0/node_modules/semver/ranges/ltr.js
|
|
2167
|
-
var require_ltr = __commonJS({
|
|
2168
|
-
"../../node_modules/.pnpm/semver@7.6.0/node_modules/semver/ranges/ltr.js"(exports, module) {
|
|
2169
|
-
"use strict";
|
|
2170
|
-
var outside = require_outside();
|
|
2171
|
-
var ltr = (version2, range2, options) => outside(version2, range2, "<", options);
|
|
2172
|
-
module.exports = ltr;
|
|
2173
|
-
}
|
|
2174
|
-
});
|
|
2175
|
-
|
|
2176
|
-
// ../../node_modules/.pnpm/semver@7.6.0/node_modules/semver/ranges/intersects.js
|
|
2177
|
-
var require_intersects = __commonJS({
|
|
2178
|
-
"../../node_modules/.pnpm/semver@7.6.0/node_modules/semver/ranges/intersects.js"(exports, module) {
|
|
2179
|
-
"use strict";
|
|
2180
|
-
var Range = require_range();
|
|
2181
|
-
var intersects = (r1, r2, options) => {
|
|
2182
|
-
r1 = new Range(r1, options);
|
|
2183
|
-
r2 = new Range(r2, options);
|
|
2184
|
-
return r1.intersects(r2, options);
|
|
2185
|
-
};
|
|
2186
|
-
module.exports = intersects;
|
|
2187
|
-
}
|
|
2188
|
-
});
|
|
2189
|
-
|
|
2190
|
-
// ../../node_modules/.pnpm/semver@7.6.0/node_modules/semver/ranges/simplify.js
|
|
2191
|
-
var require_simplify = __commonJS({
|
|
2192
|
-
"../../node_modules/.pnpm/semver@7.6.0/node_modules/semver/ranges/simplify.js"(exports, module) {
|
|
2193
|
-
"use strict";
|
|
2194
|
-
var satisfies2 = require_satisfies();
|
|
2195
|
-
var compare = require_compare();
|
|
2196
|
-
module.exports = (versions, range2, options) => {
|
|
2197
|
-
const set = [];
|
|
2198
|
-
let first = null;
|
|
2199
|
-
let prev = null;
|
|
2200
|
-
const v = versions.sort((a, b) => compare(a, b, options));
|
|
2201
|
-
for (const version2 of v) {
|
|
2202
|
-
const included = satisfies2(version2, range2, options);
|
|
2203
|
-
if (included) {
|
|
2204
|
-
prev = version2;
|
|
2205
|
-
if (!first) {
|
|
2206
|
-
first = version2;
|
|
2207
|
-
}
|
|
2208
|
-
} else {
|
|
2209
|
-
if (prev) {
|
|
2210
|
-
set.push([first, prev]);
|
|
2211
|
-
}
|
|
2212
|
-
prev = null;
|
|
2213
|
-
first = null;
|
|
2214
|
-
}
|
|
2215
|
-
}
|
|
2216
|
-
if (first) {
|
|
2217
|
-
set.push([first, null]);
|
|
2218
|
-
}
|
|
2219
|
-
const ranges = [];
|
|
2220
|
-
for (const [min, max] of set) {
|
|
2221
|
-
if (min === max) {
|
|
2222
|
-
ranges.push(min);
|
|
2223
|
-
} else if (!max && min === v[0]) {
|
|
2224
|
-
ranges.push("*");
|
|
2225
|
-
} else if (!max) {
|
|
2226
|
-
ranges.push(`>=${min}`);
|
|
2227
|
-
} else if (min === v[0]) {
|
|
2228
|
-
ranges.push(`<=${max}`);
|
|
2229
|
-
} else {
|
|
2230
|
-
ranges.push(`${min} - ${max}`);
|
|
2231
|
-
}
|
|
2232
|
-
}
|
|
2233
|
-
const simplified = ranges.join(" || ");
|
|
2234
|
-
const original = typeof range2.raw === "string" ? range2.raw : String(range2);
|
|
2235
|
-
return simplified.length < original.length ? simplified : range2;
|
|
2236
|
-
};
|
|
2237
|
-
}
|
|
2238
|
-
});
|
|
2239
|
-
|
|
2240
|
-
// ../../node_modules/.pnpm/semver@7.6.0/node_modules/semver/ranges/subset.js
|
|
2241
|
-
var require_subset = __commonJS({
|
|
2242
|
-
"../../node_modules/.pnpm/semver@7.6.0/node_modules/semver/ranges/subset.js"(exports, module) {
|
|
2243
|
-
"use strict";
|
|
2244
|
-
var Range = require_range();
|
|
2245
|
-
var Comparator = require_comparator();
|
|
2246
|
-
var { ANY } = Comparator;
|
|
2247
|
-
var satisfies2 = require_satisfies();
|
|
2248
|
-
var compare = require_compare();
|
|
2249
|
-
var subset = (sub, dom, options = {}) => {
|
|
2250
|
-
if (sub === dom) {
|
|
2251
|
-
return true;
|
|
2252
|
-
}
|
|
2253
|
-
sub = new Range(sub, options);
|
|
2254
|
-
dom = new Range(dom, options);
|
|
2255
|
-
let sawNonNull = false;
|
|
2256
|
-
OUTER:
|
|
2257
|
-
for (const simpleSub of sub.set) {
|
|
2258
|
-
for (const simpleDom of dom.set) {
|
|
2259
|
-
const isSub = simpleSubset(simpleSub, simpleDom, options);
|
|
2260
|
-
sawNonNull = sawNonNull || isSub !== null;
|
|
2261
|
-
if (isSub) {
|
|
2262
|
-
continue OUTER;
|
|
2263
|
-
}
|
|
2264
|
-
}
|
|
2265
|
-
if (sawNonNull) {
|
|
2266
|
-
return false;
|
|
2267
|
-
}
|
|
2268
|
-
}
|
|
2269
|
-
return true;
|
|
2270
|
-
};
|
|
2271
|
-
var minimumVersionWithPreRelease = [new Comparator(">=0.0.0-0")];
|
|
2272
|
-
var minimumVersion = [new Comparator(">=0.0.0")];
|
|
2273
|
-
var simpleSubset = (sub, dom, options) => {
|
|
2274
|
-
if (sub === dom) {
|
|
2275
|
-
return true;
|
|
2276
|
-
}
|
|
2277
|
-
if (sub.length === 1 && sub[0].semver === ANY) {
|
|
2278
|
-
if (dom.length === 1 && dom[0].semver === ANY) {
|
|
2279
|
-
return true;
|
|
2280
|
-
} else if (options.includePrerelease) {
|
|
2281
|
-
sub = minimumVersionWithPreRelease;
|
|
2282
|
-
} else {
|
|
2283
|
-
sub = minimumVersion;
|
|
2284
|
-
}
|
|
2285
|
-
}
|
|
2286
|
-
if (dom.length === 1 && dom[0].semver === ANY) {
|
|
2287
|
-
if (options.includePrerelease) {
|
|
2288
|
-
return true;
|
|
2289
|
-
} else {
|
|
2290
|
-
dom = minimumVersion;
|
|
2291
|
-
}
|
|
2292
|
-
}
|
|
2293
|
-
const eqSet = /* @__PURE__ */ new Set();
|
|
2294
|
-
let gt, lt;
|
|
2295
|
-
for (const c of sub) {
|
|
2296
|
-
if (c.operator === ">" || c.operator === ">=") {
|
|
2297
|
-
gt = higherGT(gt, c, options);
|
|
2298
|
-
} else if (c.operator === "<" || c.operator === "<=") {
|
|
2299
|
-
lt = lowerLT(lt, c, options);
|
|
2300
|
-
} else {
|
|
2301
|
-
eqSet.add(c.semver);
|
|
2302
|
-
}
|
|
2303
|
-
}
|
|
2304
|
-
if (eqSet.size > 1) {
|
|
2305
|
-
return null;
|
|
2306
|
-
}
|
|
2307
|
-
let gtltComp;
|
|
2308
|
-
if (gt && lt) {
|
|
2309
|
-
gtltComp = compare(gt.semver, lt.semver, options);
|
|
2310
|
-
if (gtltComp > 0) {
|
|
2311
|
-
return null;
|
|
2312
|
-
} else if (gtltComp === 0 && (gt.operator !== ">=" || lt.operator !== "<=")) {
|
|
2313
|
-
return null;
|
|
2314
|
-
}
|
|
2315
|
-
}
|
|
2316
|
-
for (const eq of eqSet) {
|
|
2317
|
-
if (gt && !satisfies2(eq, String(gt), options)) {
|
|
2318
|
-
return null;
|
|
2319
|
-
}
|
|
2320
|
-
if (lt && !satisfies2(eq, String(lt), options)) {
|
|
2321
|
-
return null;
|
|
2322
|
-
}
|
|
2323
|
-
for (const c of dom) {
|
|
2324
|
-
if (!satisfies2(eq, String(c), options)) {
|
|
2325
|
-
return false;
|
|
2326
|
-
}
|
|
2327
|
-
}
|
|
2328
|
-
return true;
|
|
2329
|
-
}
|
|
2330
|
-
let higher, lower;
|
|
2331
|
-
let hasDomLT, hasDomGT;
|
|
2332
|
-
let needDomLTPre = lt && !options.includePrerelease && lt.semver.prerelease.length ? lt.semver : false;
|
|
2333
|
-
let needDomGTPre = gt && !options.includePrerelease && gt.semver.prerelease.length ? gt.semver : false;
|
|
2334
|
-
if (needDomLTPre && needDomLTPre.prerelease.length === 1 && lt.operator === "<" && needDomLTPre.prerelease[0] === 0) {
|
|
2335
|
-
needDomLTPre = false;
|
|
2336
|
-
}
|
|
2337
|
-
for (const c of dom) {
|
|
2338
|
-
hasDomGT = hasDomGT || c.operator === ">" || c.operator === ">=";
|
|
2339
|
-
hasDomLT = hasDomLT || c.operator === "<" || c.operator === "<=";
|
|
2340
|
-
if (gt) {
|
|
2341
|
-
if (needDomGTPre) {
|
|
2342
|
-
if (c.semver.prerelease && c.semver.prerelease.length && c.semver.major === needDomGTPre.major && c.semver.minor === needDomGTPre.minor && c.semver.patch === needDomGTPre.patch) {
|
|
2343
|
-
needDomGTPre = false;
|
|
2344
|
-
}
|
|
2345
|
-
}
|
|
2346
|
-
if (c.operator === ">" || c.operator === ">=") {
|
|
2347
|
-
higher = higherGT(gt, c, options);
|
|
2348
|
-
if (higher === c && higher !== gt) {
|
|
2349
|
-
return false;
|
|
2350
|
-
}
|
|
2351
|
-
} else if (gt.operator === ">=" && !satisfies2(gt.semver, String(c), options)) {
|
|
2352
|
-
return false;
|
|
2353
|
-
}
|
|
2354
|
-
}
|
|
2355
|
-
if (lt) {
|
|
2356
|
-
if (needDomLTPre) {
|
|
2357
|
-
if (c.semver.prerelease && c.semver.prerelease.length && c.semver.major === needDomLTPre.major && c.semver.minor === needDomLTPre.minor && c.semver.patch === needDomLTPre.patch) {
|
|
2358
|
-
needDomLTPre = false;
|
|
2359
|
-
}
|
|
2360
|
-
}
|
|
2361
|
-
if (c.operator === "<" || c.operator === "<=") {
|
|
2362
|
-
lower = lowerLT(lt, c, options);
|
|
2363
|
-
if (lower === c && lower !== lt) {
|
|
2364
|
-
return false;
|
|
2365
|
-
}
|
|
2366
|
-
} else if (lt.operator === "<=" && !satisfies2(lt.semver, String(c), options)) {
|
|
2367
|
-
return false;
|
|
2368
|
-
}
|
|
2369
|
-
}
|
|
2370
|
-
if (!c.operator && (lt || gt) && gtltComp !== 0) {
|
|
2371
|
-
return false;
|
|
2372
|
-
}
|
|
2373
|
-
}
|
|
2374
|
-
if (gt && hasDomLT && !lt && gtltComp !== 0) {
|
|
2375
|
-
return false;
|
|
2376
|
-
}
|
|
2377
|
-
if (lt && hasDomGT && !gt && gtltComp !== 0) {
|
|
2378
|
-
return false;
|
|
2379
|
-
}
|
|
2380
|
-
if (needDomGTPre || needDomLTPre) {
|
|
2381
|
-
return false;
|
|
2382
|
-
}
|
|
2383
|
-
return true;
|
|
2384
|
-
};
|
|
2385
|
-
var higherGT = (a, b, options) => {
|
|
2386
|
-
if (!a) {
|
|
2387
|
-
return b;
|
|
2388
|
-
}
|
|
2389
|
-
const comp = compare(a.semver, b.semver, options);
|
|
2390
|
-
return comp > 0 ? a : comp < 0 ? b : b.operator === ">" && a.operator === ">=" ? b : a;
|
|
2391
|
-
};
|
|
2392
|
-
var lowerLT = (a, b, options) => {
|
|
2393
|
-
if (!a) {
|
|
2394
|
-
return b;
|
|
2395
|
-
}
|
|
2396
|
-
const comp = compare(a.semver, b.semver, options);
|
|
2397
|
-
return comp < 0 ? a : comp > 0 ? b : b.operator === "<" && a.operator === "<=" ? b : a;
|
|
2398
|
-
};
|
|
2399
|
-
module.exports = subset;
|
|
2400
|
-
}
|
|
2401
|
-
});
|
|
2402
|
-
|
|
2403
|
-
// ../../node_modules/.pnpm/semver@7.6.0/node_modules/semver/index.js
|
|
2404
|
-
var require_semver2 = __commonJS({
|
|
2405
|
-
"../../node_modules/.pnpm/semver@7.6.0/node_modules/semver/index.js"(exports, module) {
|
|
2406
|
-
"use strict";
|
|
2407
|
-
var internalRe = require_re();
|
|
2408
|
-
var constants = require_constants();
|
|
2409
|
-
var SemVer = require_semver();
|
|
2410
|
-
var identifiers = require_identifiers();
|
|
2411
|
-
var parse = require_parse();
|
|
2412
|
-
var valid = require_valid();
|
|
2413
|
-
var clean = require_clean();
|
|
2414
|
-
var inc = require_inc();
|
|
2415
|
-
var diff = require_diff();
|
|
2416
|
-
var major = require_major();
|
|
2417
|
-
var minor = require_minor();
|
|
2418
|
-
var patch = require_patch();
|
|
2419
|
-
var prerelease = require_prerelease();
|
|
2420
|
-
var compare = require_compare();
|
|
2421
|
-
var rcompare = require_rcompare();
|
|
2422
|
-
var compareLoose = require_compare_loose();
|
|
2423
|
-
var compareBuild = require_compare_build();
|
|
2424
|
-
var sort = require_sort();
|
|
2425
|
-
var rsort = require_rsort();
|
|
2426
|
-
var gt = require_gt();
|
|
2427
|
-
var lt = require_lt();
|
|
2428
|
-
var eq = require_eq();
|
|
2429
|
-
var neq = require_neq();
|
|
2430
|
-
var gte = require_gte();
|
|
2431
|
-
var lte = require_lte();
|
|
2432
|
-
var cmp = require_cmp();
|
|
2433
|
-
var coerce = require_coerce();
|
|
2434
|
-
var Comparator = require_comparator();
|
|
2435
|
-
var Range = require_range();
|
|
2436
|
-
var satisfies2 = require_satisfies();
|
|
2437
|
-
var toComparators = require_to_comparators();
|
|
2438
|
-
var maxSatisfying = require_max_satisfying();
|
|
2439
|
-
var minSatisfying = require_min_satisfying();
|
|
2440
|
-
var minVersion = require_min_version();
|
|
2441
|
-
var validRange = require_valid2();
|
|
2442
|
-
var outside = require_outside();
|
|
2443
|
-
var gtr = require_gtr();
|
|
2444
|
-
var ltr = require_ltr();
|
|
2445
|
-
var intersects = require_intersects();
|
|
2446
|
-
var simplifyRange = require_simplify();
|
|
2447
|
-
var subset = require_subset();
|
|
2448
|
-
module.exports = {
|
|
2449
|
-
parse,
|
|
2450
|
-
valid,
|
|
2451
|
-
clean,
|
|
2452
|
-
inc,
|
|
2453
|
-
diff,
|
|
2454
|
-
major,
|
|
2455
|
-
minor,
|
|
2456
|
-
patch,
|
|
2457
|
-
prerelease,
|
|
2458
|
-
compare,
|
|
2459
|
-
rcompare,
|
|
2460
|
-
compareLoose,
|
|
2461
|
-
compareBuild,
|
|
2462
|
-
sort,
|
|
2463
|
-
rsort,
|
|
2464
|
-
gt,
|
|
2465
|
-
lt,
|
|
2466
|
-
eq,
|
|
2467
|
-
neq,
|
|
2468
|
-
gte,
|
|
2469
|
-
lte,
|
|
2470
|
-
cmp,
|
|
2471
|
-
coerce,
|
|
2472
|
-
Comparator,
|
|
2473
|
-
Range,
|
|
2474
|
-
satisfies: satisfies2,
|
|
2475
|
-
toComparators,
|
|
2476
|
-
maxSatisfying,
|
|
2477
|
-
minSatisfying,
|
|
2478
|
-
minVersion,
|
|
2479
|
-
validRange,
|
|
2480
|
-
outside,
|
|
2481
|
-
gtr,
|
|
2482
|
-
ltr,
|
|
2483
|
-
intersects,
|
|
2484
|
-
simplifyRange,
|
|
2485
|
-
subset,
|
|
2486
|
-
SemVer,
|
|
2487
|
-
re: internalRe.re,
|
|
2488
|
-
src: internalRe.src,
|
|
2489
|
-
tokens: internalRe.t,
|
|
2490
|
-
SEMVER_SPEC_VERSION: constants.SEMVER_SPEC_VERSION,
|
|
2491
|
-
RELEASE_TYPES: constants.RELEASE_TYPES,
|
|
2492
|
-
compareIdentifiers: identifiers.compareIdentifiers,
|
|
2493
|
-
rcompareIdentifiers: identifiers.rcompareIdentifiers
|
|
2494
|
-
};
|
|
2495
|
-
}
|
|
2496
|
-
});
|
|
2497
|
-
|
|
2498
|
-
// package.json
|
|
2499
|
-
var version = "0.48.0-beta.9";
|
|
2500
|
-
|
|
2501
|
-
// node/common.ts
|
|
2502
|
-
import { existsSync, promises as fs } from "node:fs";
|
|
2503
|
-
import { join } from "node:path";
|
|
2504
|
-
import { loadConfigFromFile, mergeConfig, resolveConfig } from "vite";
|
|
2505
|
-
|
|
2506
|
-
// node/utils.ts
|
|
2507
|
-
var import_semver = __toESM(require_semver2());
|
|
2508
|
-
function stringifyMarkdownTokens(tokens) {
|
|
2509
|
-
return tokens.map((token) => token.children?.filter((t) => ["text", "code_inline"].includes(t.type) && !t.content.match(/^\s*$/)).map((t) => t.content.trim()).join(" ")).filter(Boolean).join(" ");
|
|
2510
|
-
}
|
|
2511
|
-
function generateGoogleFontsUrl(options) {
|
|
2512
|
-
const weights = options.weights.flatMap((i) => options.italic ? [`0,${i}`, `1,${i}`] : [`${i}`]).sort().join(";");
|
|
2513
|
-
const fonts = options.webfonts.map((i) => `family=${i.replace(/^(['"])(.*)\1$/, "$1").replace(/\s+/g, "+")}:${options.italic ? "ital," : ""}wght@${weights}`).join("&");
|
|
2514
|
-
return `https://fonts.googleapis.com/css2?${fonts}&display=swap`;
|
|
2515
|
-
}
|
|
2516
|
-
function checkEngine(name, engines = {}) {
|
|
2517
|
-
if (engines.slidev && !(0, import_semver.satisfies)(version, engines.slidev, { includePrerelease: true }))
|
|
2518
|
-
throw new Error(`[slidev] addon "${name}" requires Slidev version range "${engines.slidev}" but found "${version}"`);
|
|
2519
|
-
}
|
|
2520
|
-
|
|
2521
|
-
// node/common.ts
|
|
2522
|
-
async function getIndexHtml({ clientRoot, roots, data }) {
|
|
2523
|
-
let main = await fs.readFile(join(clientRoot, "index.html"), "utf-8");
|
|
2524
|
-
let head = "";
|
|
2525
|
-
let body = "";
|
|
2526
|
-
head += `<link rel="icon" href="${data.config.favicon}">`;
|
|
2527
|
-
for (const root of roots) {
|
|
2528
|
-
const path2 = join(root, "index.html");
|
|
2529
|
-
if (!existsSync(path2))
|
|
2530
|
-
continue;
|
|
2531
|
-
const index = await fs.readFile(path2, "utf-8");
|
|
2532
|
-
head += `
|
|
2533
|
-
${(index.match(/<head>([\s\S]*?)<\/head>/im)?.[1] || "").trim()}`;
|
|
2534
|
-
body += `
|
|
2535
|
-
${(index.match(/<body>([\s\S]*?)<\/body>/im)?.[1] || "").trim()}`;
|
|
2536
|
-
}
|
|
2537
|
-
if (data.features.tweet)
|
|
2538
|
-
body += '\n<script async src="https://platform.twitter.com/widgets.js"></script>';
|
|
2539
|
-
if (data.config.fonts.webfonts.length && data.config.fonts.provider !== "none")
|
|
2540
|
-
head += `
|
|
2541
|
-
<link rel="stylesheet" href="${generateGoogleFontsUrl(data.config.fonts)}" type="text/css">`;
|
|
2542
|
-
main = main.replace("__ENTRY__", toAtFS(join(clientRoot, "main.ts"))).replace("<!-- head -->", head).replace("<!-- body -->", body);
|
|
2543
|
-
return main;
|
|
2544
|
-
}
|
|
2545
|
-
async function mergeViteConfigs({ roots, entry }, viteConfig, config, command) {
|
|
2546
|
-
const configEnv = {
|
|
2547
|
-
mode: "development",
|
|
2548
|
-
command
|
|
2549
|
-
};
|
|
2550
|
-
const files = roots.map((i) => join(i, "vite.config.ts"));
|
|
2551
|
-
for await (const file of files) {
|
|
2552
|
-
if (!existsSync(file))
|
|
2553
|
-
continue;
|
|
2554
|
-
const viteConfig2 = await loadConfigFromFile(configEnv, file);
|
|
2555
|
-
if (!viteConfig2?.config)
|
|
2556
|
-
continue;
|
|
2557
|
-
config = mergeConfig(config, viteConfig2.config);
|
|
2558
|
-
}
|
|
2559
|
-
config = mergeConfig(config, viteConfig);
|
|
2560
|
-
const localConfig = await resolveConfig({}, command, entry);
|
|
2561
|
-
config = mergeConfig(config, { slidev: localConfig.slidev || {} });
|
|
2562
|
-
return config;
|
|
2563
|
-
}
|
|
2564
|
-
|
|
2565
|
-
// node/plugins/preset.ts
|
|
2566
|
-
import { join as join7 } from "node:path";
|
|
2567
|
-
import { existsSync as existsSync3 } from "node:fs";
|
|
2568
|
-
import process3 from "node:process";
|
|
2569
|
-
import { fileURLToPath } from "node:url";
|
|
2570
|
-
import Vue from "@vitejs/plugin-vue";
|
|
2571
|
-
import VueJsx from "@vitejs/plugin-vue-jsx";
|
|
2572
|
-
import Icons from "unplugin-icons/vite";
|
|
2573
|
-
import IconsResolver from "unplugin-icons/resolver";
|
|
2574
|
-
import Components from "unplugin-vue-components/vite";
|
|
2575
|
-
import ServerRef from "vite-plugin-vue-server-ref";
|
|
2576
|
-
import { notNullish as notNullish2 } from "@antfu/utils";
|
|
2577
|
-
|
|
2578
|
-
// node/drawings.ts
|
|
2579
|
-
import { basename, dirname, join as join2, resolve } from "node:path";
|
|
2580
|
-
import fs2 from "fs-extra";
|
|
2581
|
-
import fg from "fast-glob";
|
|
2582
|
-
function resolveDrawingsDir(options) {
|
|
2583
|
-
return options.data.config.drawings.persist ? resolve(
|
|
2584
|
-
dirname(options.entry),
|
|
2585
|
-
options.data.config.drawings.persist
|
|
2586
|
-
) : void 0;
|
|
2587
|
-
}
|
|
2588
|
-
async function loadDrawings(options) {
|
|
2589
|
-
const dir = resolveDrawingsDir(options);
|
|
2590
|
-
if (!dir || !fs2.existsSync(dir))
|
|
2591
|
-
return {};
|
|
2592
|
-
const files = await fg("*.svg", {
|
|
2593
|
-
onlyFiles: true,
|
|
2594
|
-
cwd: dir,
|
|
2595
|
-
absolute: true,
|
|
2596
|
-
suppressErrors: true
|
|
2597
|
-
});
|
|
2598
|
-
const obj = {};
|
|
2599
|
-
await Promise.all(files.map(async (path2) => {
|
|
2600
|
-
const num = +basename(path2, ".svg");
|
|
2601
|
-
if (Number.isNaN(num))
|
|
2602
|
-
return;
|
|
2603
|
-
const content = await fs2.readFile(path2, "utf8");
|
|
2604
|
-
const lines = content.split(/\n/g);
|
|
2605
|
-
obj[num.toString()] = lines.slice(1, -1).join("\n");
|
|
2606
|
-
}));
|
|
2607
|
-
return obj;
|
|
2608
|
-
}
|
|
2609
|
-
async function writeDrawings(options, drawing) {
|
|
2610
|
-
const dir = resolveDrawingsDir(options);
|
|
2611
|
-
if (!dir)
|
|
2612
|
-
return;
|
|
2613
|
-
const width = options.data.config.canvasWidth;
|
|
2614
|
-
const height = Math.round(width / options.data.config.aspectRatio);
|
|
2615
|
-
const SVG_HEAD = `<svg width="${width}" height="${height}" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">`;
|
|
2616
|
-
await fs2.ensureDir(dir);
|
|
2617
|
-
return Promise.all(
|
|
2618
|
-
Object.entries(drawing).map(async ([key, value]) => {
|
|
2619
|
-
if (!value)
|
|
2620
|
-
return;
|
|
2621
|
-
const svg = `${SVG_HEAD}
|
|
2622
|
-
${value}
|
|
2623
|
-
</svg>`;
|
|
2624
|
-
await fs2.writeFile(join2(dir, `${key}.svg`), svg, "utf-8");
|
|
2625
|
-
})
|
|
2626
|
-
);
|
|
2627
|
-
}
|
|
2628
|
-
|
|
2629
|
-
// node/plugins/extendConfig.ts
|
|
2630
|
-
import { join as join3 } from "node:path";
|
|
2631
|
-
import { mergeConfig as mergeConfig2 } from "vite";
|
|
2632
|
-
import isInstalledGlobally from "is-installed-globally";
|
|
2633
|
-
import { uniq } from "@antfu/utils";
|
|
2634
|
-
var EXCLUDE = [
|
|
2635
|
-
"@slidev/shared",
|
|
2636
|
-
"@slidev/types",
|
|
2637
|
-
"@slidev/client",
|
|
2638
|
-
"@slidev/client/constants",
|
|
2639
|
-
"@slidev/client/logic/dark",
|
|
2640
|
-
"@vueuse/core",
|
|
2641
|
-
"@vueuse/shared",
|
|
2642
|
-
"@unocss/reset",
|
|
2643
|
-
"unocss",
|
|
2644
|
-
"mermaid",
|
|
2645
|
-
"vue-demi",
|
|
2646
|
-
"vue"
|
|
2647
|
-
];
|
|
2648
|
-
function createConfigPlugin(options) {
|
|
2649
|
-
return {
|
|
2650
|
-
name: "slidev:config",
|
|
2651
|
-
async config(config) {
|
|
2652
|
-
const injection = {
|
|
2653
|
-
define: getDefine(options),
|
|
2654
|
-
resolve: {
|
|
2655
|
-
alias: {
|
|
2656
|
-
"@slidev/client/": `${toAtFS(options.clientRoot)}/`,
|
|
2657
|
-
"vue": await resolveImportPath("vue/dist/vue.esm-browser.js", true)
|
|
2658
|
-
},
|
|
2659
|
-
dedupe: ["vue"]
|
|
2660
|
-
},
|
|
2661
|
-
optimizeDeps: {
|
|
2662
|
-
exclude: EXCLUDE
|
|
2663
|
-
},
|
|
2664
|
-
css: options.data.config.css === "unocss" ? {
|
|
2665
|
-
postcss: {
|
|
2666
|
-
plugins: [
|
|
2667
|
-
await import("postcss-nested").then((r) => (r.default || r)())
|
|
2668
|
-
]
|
|
2669
|
-
}
|
|
2670
|
-
} : {},
|
|
2671
|
-
server: {
|
|
2672
|
-
fs: {
|
|
2673
|
-
strict: true,
|
|
2674
|
-
allow: uniq([
|
|
2675
|
-
options.userWorkspaceRoot,
|
|
2676
|
-
options.cliRoot,
|
|
2677
|
-
options.clientRoot,
|
|
2678
|
-
...options.roots
|
|
2679
|
-
])
|
|
2680
|
-
}
|
|
2681
|
-
},
|
|
2682
|
-
publicDir: join3(options.userRoot, "public")
|
|
2683
|
-
};
|
|
2684
|
-
if (isInstalledGlobally) {
|
|
2685
|
-
injection.cacheDir = join3(options.cliRoot, "node_modules/.vite");
|
|
2686
|
-
injection.root = options.cliRoot;
|
|
2687
|
-
}
|
|
2688
|
-
return mergeConfig2(injection, config);
|
|
2689
|
-
},
|
|
2690
|
-
configureServer(server) {
|
|
2691
|
-
return () => {
|
|
2692
|
-
server.middlewares.use(async (req, res, next) => {
|
|
2693
|
-
if (req.url.endsWith(".html")) {
|
|
2694
|
-
res.setHeader("Content-Type", "text/html");
|
|
2695
|
-
res.statusCode = 200;
|
|
2696
|
-
res.end(await getIndexHtml(options));
|
|
2697
|
-
return;
|
|
2698
|
-
}
|
|
2699
|
-
next();
|
|
2700
|
-
});
|
|
2701
|
-
};
|
|
2702
|
-
}
|
|
2703
|
-
};
|
|
2704
|
-
}
|
|
2705
|
-
function getDefine(options) {
|
|
2706
|
-
return {
|
|
2707
|
-
__DEV__: options.mode === "dev" ? "true" : "false",
|
|
2708
|
-
__SLIDEV_CLIENT_ROOT__: JSON.stringify(toAtFS(options.clientRoot)),
|
|
2709
|
-
__SLIDEV_HASH_ROUTE__: JSON.stringify(options.data.config.routerMode === "hash"),
|
|
2710
|
-
__SLIDEV_FEATURE_DRAWINGS__: JSON.stringify(options.data.config.drawings.enabled === true || options.data.config.drawings.enabled === options.mode),
|
|
2711
|
-
__SLIDEV_FEATURE_EDITOR__: JSON.stringify(options.mode === "dev" && options.data.config.editor !== false),
|
|
2712
|
-
__SLIDEV_FEATURE_DRAWINGS_PERSIST__: JSON.stringify(!!options.data.config.drawings.persist === true),
|
|
2713
|
-
__SLIDEV_FEATURE_RECORD__: JSON.stringify(options.data.config.record === true || options.data.config.record === options.mode),
|
|
2714
|
-
__SLIDEV_FEATURE_PRESENTER__: JSON.stringify(options.data.config.presenter === true || options.data.config.presenter === options.mode),
|
|
2715
|
-
__SLIDEV_HAS_SERVER__: options.mode !== "build" ? "true" : "false"
|
|
2716
|
-
};
|
|
2717
|
-
}
|
|
2718
|
-
|
|
2719
|
-
// node/plugins/loaders.ts
|
|
2720
|
-
import { basename as basename2, join as join4 } from "node:path";
|
|
2721
|
-
import { isString, isTruthy, notNullish, objectMap, range } from "@antfu/utils";
|
|
2722
|
-
import fg2 from "fast-glob";
|
|
2723
|
-
import fs3 from "fs-extra";
|
|
2724
|
-
import Markdown from "markdown-it";
|
|
2725
|
-
import { bold, gray, red, yellow } from "kolorist";
|
|
2726
|
-
import mila from "markdown-it-link-attributes";
|
|
2727
|
-
import * as parser from "@slidev/parser/fs";
|
|
2728
|
-
import equal from "fast-deep-equal";
|
|
2729
|
-
var regexId = /^\/\@slidev\/slide\/(\d+)\.(md|json)(?:\?import)?$/;
|
|
2730
|
-
var regexIdQuery = /(\d+?)\.(md|json|frontmatter)$/;
|
|
2731
|
-
var templateInjectionMarker = "/* @slidev-injection */";
|
|
2732
|
-
var templateImportContextUtils = `import {
|
|
2733
|
-
useSlideContext,
|
|
2734
|
-
provideFrontmatter as _provideFrontmatter,
|
|
2735
|
-
frontmatterToProps as _frontmatterToProps,
|
|
2736
|
-
} from "@slidev/client/context.ts"`.replace(/\n\s*/g, " ");
|
|
2737
|
-
var templateInitContext = `const { $slidev, $nav, $clicksContext, $clicks, $page, $renderContext, $frontmatter } = useSlideContext()`;
|
|
2738
|
-
function getBodyJson(req) {
|
|
2739
|
-
return new Promise((resolve3, reject) => {
|
|
2740
|
-
let body = "";
|
|
2741
|
-
req.on("data", (chunk) => body += chunk);
|
|
2742
|
-
req.on("error", reject);
|
|
2743
|
-
req.on("end", () => {
|
|
2744
|
-
try {
|
|
2745
|
-
resolve3(JSON.parse(body) || {});
|
|
2746
|
-
} catch (e) {
|
|
2747
|
-
reject(e);
|
|
2748
|
-
}
|
|
2749
|
-
});
|
|
2750
|
-
});
|
|
2751
|
-
}
|
|
2752
|
-
var md = Markdown({ html: true });
|
|
2753
|
-
md.use(mila, {
|
|
2754
|
-
attrs: {
|
|
2755
|
-
target: "_blank",
|
|
2756
|
-
rel: "noopener"
|
|
2757
|
-
}
|
|
2758
|
-
});
|
|
2759
|
-
function renderNoteHTML(data) {
|
|
2760
|
-
return {
|
|
2761
|
-
...data,
|
|
2762
|
-
noteHTML: md.render(data?.note || "")
|
|
2763
|
-
};
|
|
2764
|
-
}
|
|
2765
|
-
function createSlidesLoader({ data, clientRoot, roots, remote, mode }, pluginOptions, serverOptions) {
|
|
2766
|
-
const slidePrefix = "/@slidev/slides/";
|
|
2767
|
-
const hmrPages = /* @__PURE__ */ new Set();
|
|
2768
|
-
let server;
|
|
2769
|
-
let _layouts_cache_time = 0;
|
|
2770
|
-
let _layouts_cache = {};
|
|
2771
|
-
return [
|
|
2772
|
-
{
|
|
2773
|
-
name: "slidev:loader",
|
|
2774
|
-
configureServer(_server) {
|
|
2775
|
-
server = _server;
|
|
2776
|
-
updateServerWatcher();
|
|
2777
|
-
server.middlewares.use(async (req, res, next) => {
|
|
2778
|
-
const match = req.url?.match(regexId);
|
|
2779
|
-
if (!match)
|
|
2780
|
-
return next();
|
|
2781
|
-
const [, no, type] = match;
|
|
2782
|
-
const idx = Number.parseInt(no);
|
|
2783
|
-
if (type === "json" && req.method === "GET") {
|
|
2784
|
-
res.write(JSON.stringify(renderNoteHTML(data.slides[idx])));
|
|
2785
|
-
return res.end();
|
|
2786
|
-
}
|
|
2787
|
-
if (type === "json" && req.method === "POST") {
|
|
2788
|
-
const body = await getBodyJson(req);
|
|
2789
|
-
const slide = data.slides[idx];
|
|
2790
|
-
if (body.content && body.content !== slide.source.content)
|
|
2791
|
-
hmrPages.add(idx);
|
|
2792
|
-
Object.assign(slide.source, body);
|
|
2793
|
-
parser.prettifySlide(slide.source);
|
|
2794
|
-
await parser.save(data.markdownFiles[slide.source.filepath]);
|
|
2795
|
-
res.statusCode = 200;
|
|
2796
|
-
res.write(JSON.stringify(renderNoteHTML(slide)));
|
|
2797
|
-
return res.end();
|
|
2798
|
-
}
|
|
2799
|
-
next();
|
|
2800
|
-
});
|
|
2801
|
-
},
|
|
2802
|
-
async handleHotUpdate(ctx) {
|
|
2803
|
-
if (!data.watchFiles.includes(ctx.file))
|
|
2804
|
-
return;
|
|
2805
|
-
await ctx.read();
|
|
2806
|
-
const newData = await serverOptions.loadData?.();
|
|
2807
|
-
if (!newData)
|
|
2808
|
-
return [];
|
|
2809
|
-
const moduleIds = /* @__PURE__ */ new Set();
|
|
2810
|
-
if (data.slides.length !== newData.slides.length) {
|
|
2811
|
-
moduleIds.add("/@slidev/routes");
|
|
2812
|
-
range(newData.slides.length).map((i) => hmrPages.add(i));
|
|
2813
|
-
}
|
|
2814
|
-
if (!equal(data.headmatter.defaults, newData.headmatter.defaults)) {
|
|
2815
|
-
moduleIds.add("/@slidev/routes");
|
|
2816
|
-
range(data.slides.length).map((i) => hmrPages.add(i));
|
|
2817
|
-
}
|
|
2818
|
-
if (!equal(data.config, newData.config))
|
|
2819
|
-
moduleIds.add("/@slidev/configs");
|
|
2820
|
-
if (!equal(data.features, newData.features)) {
|
|
2821
|
-
setTimeout(() => {
|
|
2822
|
-
ctx.server.ws.send({ type: "full-reload" });
|
|
2823
|
-
}, 1);
|
|
2824
|
-
}
|
|
2825
|
-
const length = Math.max(data.slides.length, newData.slides.length);
|
|
2826
|
-
for (let i = 0; i < length; i++) {
|
|
2827
|
-
const a = data.slides[i];
|
|
2828
|
-
const b = newData.slides[i];
|
|
2829
|
-
if (a?.content.trim() === b?.content.trim() && a?.title?.trim() === b?.title?.trim() && equal(a.frontmatter, b.frontmatter) && Object.entries(a.snippetsUsed ?? {}).every(([file, oldContent]) => {
|
|
2830
|
-
try {
|
|
2831
|
-
const newContent = fs3.readFileSync(file, "utf-8");
|
|
2832
|
-
return oldContent === newContent;
|
|
2833
|
-
} catch {
|
|
2834
|
-
return false;
|
|
2835
|
-
}
|
|
2836
|
-
})) {
|
|
2837
|
-
if (a?.note !== b?.note) {
|
|
2838
|
-
ctx.server.ws.send({
|
|
2839
|
-
type: "custom",
|
|
2840
|
-
event: "slidev-update-note",
|
|
2841
|
-
data: {
|
|
2842
|
-
id: i,
|
|
2843
|
-
note: b.note || "",
|
|
2844
|
-
noteHTML: md.render(b.note || "")
|
|
2845
|
-
}
|
|
2846
|
-
});
|
|
2847
|
-
}
|
|
2848
|
-
continue;
|
|
2849
|
-
}
|
|
2850
|
-
ctx.server.ws.send({
|
|
2851
|
-
type: "custom",
|
|
2852
|
-
event: "slidev-update",
|
|
2853
|
-
data: {
|
|
2854
|
-
id: i,
|
|
2855
|
-
data: renderNoteHTML(newData.slides[i])
|
|
2856
|
-
}
|
|
2857
|
-
});
|
|
2858
|
-
hmrPages.add(i);
|
|
2859
|
-
}
|
|
2860
|
-
Object.assign(data, newData);
|
|
2861
|
-
if (hmrPages.size > 0)
|
|
2862
|
-
moduleIds.add("/@slidev/titles.md");
|
|
2863
|
-
const vueModules = Array.from(hmrPages).flatMap((i) => [
|
|
2864
|
-
ctx.server.moduleGraph.getModuleById(`${slidePrefix}${i + 1}.frontmatter`),
|
|
2865
|
-
ctx.server.moduleGraph.getModuleById(`${slidePrefix}${i + 1}.md`)
|
|
2866
|
-
]);
|
|
2867
|
-
hmrPages.clear();
|
|
2868
|
-
const moduleEntries = [
|
|
2869
|
-
...vueModules,
|
|
2870
|
-
...Array.from(moduleIds).map((id) => ctx.server.moduleGraph.getModuleById(id))
|
|
2871
|
-
].filter(notNullish).filter((i) => !i.id?.startsWith("/@id/@vite-icons"));
|
|
2872
|
-
updateServerWatcher();
|
|
2873
|
-
return moduleEntries;
|
|
2874
|
-
},
|
|
2875
|
-
resolveId(id) {
|
|
2876
|
-
if (id.startsWith(slidePrefix) || id.startsWith("/@slidev/"))
|
|
2877
|
-
return id;
|
|
2878
|
-
return null;
|
|
2879
|
-
},
|
|
2880
|
-
load(id) {
|
|
2881
|
-
if (id === "/@slidev/routes")
|
|
2882
|
-
return generateRoutes();
|
|
2883
|
-
if (id === "/@slidev/layouts")
|
|
2884
|
-
return generateLayouts();
|
|
2885
|
-
if (id === "/@slidev/styles")
|
|
2886
|
-
return generateUserStyles();
|
|
2887
|
-
if (id === "/@slidev/monaco-types")
|
|
2888
|
-
return generateMonacoTypes();
|
|
2889
|
-
if (id === "/@slidev/configs")
|
|
2890
|
-
return generateConfigs();
|
|
2891
|
-
if (id === "/@slidev/global-components/top")
|
|
2892
|
-
return generateGlobalComponents("top");
|
|
2893
|
-
if (id === "/@slidev/global-components/bottom")
|
|
2894
|
-
return generateGlobalComponents("bottom");
|
|
2895
|
-
if (id === "/@slidev/custom-nav-controls")
|
|
2896
|
-
return generateCustomNavControls();
|
|
2897
|
-
if (id === "/@slidev/titles.md") {
|
|
2898
|
-
return {
|
|
2899
|
-
code: data.slides.map(({ title }, i) => `<template ${i === 0 ? "v-if" : "v-else-if"}="+no === ${i + 1}">
|
|
2900
|
-
|
|
2901
|
-
${title}
|
|
2902
|
-
|
|
2903
|
-
</template>`).join(""),
|
|
2904
|
-
map: { mappings: "" }
|
|
2905
|
-
};
|
|
2906
|
-
}
|
|
2907
|
-
if (id.startsWith(slidePrefix)) {
|
|
2908
|
-
const remaning = id.slice(slidePrefix.length);
|
|
2909
|
-
const match = remaning.match(regexIdQuery);
|
|
2910
|
-
if (match) {
|
|
2911
|
-
const [, no, type] = match;
|
|
2912
|
-
const pageNo = Number.parseInt(no) - 1;
|
|
2913
|
-
const slide = data.slides[pageNo];
|
|
2914
|
-
if (!slide)
|
|
2915
|
-
return;
|
|
2916
|
-
if (type === "md") {
|
|
2917
|
-
return {
|
|
2918
|
-
code: slide?.content,
|
|
2919
|
-
map: { mappings: "" }
|
|
2920
|
-
};
|
|
2921
|
-
} else if (type === "frontmatter") {
|
|
2922
|
-
const slideBase = {
|
|
2923
|
-
...renderNoteHTML(slide),
|
|
2924
|
-
frontmatter: void 0,
|
|
2925
|
-
source: void 0,
|
|
2926
|
-
// remove raw content in build, optimize the bundle size
|
|
2927
|
-
...mode === "build" ? { raw: "", content: "", note: "" } : {}
|
|
2928
|
-
};
|
|
2929
|
-
const fontmatter = getFrontmatter(pageNo);
|
|
2930
|
-
return {
|
|
2931
|
-
code: [
|
|
2932
|
-
"// @unocss-include",
|
|
2933
|
-
'import { reactive, computed } from "vue"',
|
|
2934
|
-
`export const frontmatter = reactive(${JSON.stringify(fontmatter)})`,
|
|
2935
|
-
`export const meta = reactive({
|
|
2936
|
-
layout: computed(() => frontmatter.layout),
|
|
2937
|
-
transition: computed(() => frontmatter.transition),
|
|
2938
|
-
class: computed(() => frontmatter.class),
|
|
2939
|
-
clicks: computed(() => frontmatter.clicks),
|
|
2940
|
-
name: computed(() => frontmatter.name),
|
|
2941
|
-
preload: computed(() => frontmatter.preload),
|
|
2942
|
-
slide: {
|
|
2943
|
-
...(${JSON.stringify(slideBase)}),
|
|
2944
|
-
frontmatter,
|
|
2945
|
-
filepath: ${JSON.stringify(slide.source.filepath)},
|
|
2946
|
-
start: ${JSON.stringify(slide.source.start)},
|
|
2947
|
-
id: ${pageNo},
|
|
2948
|
-
no: ${no},
|
|
2949
|
-
},
|
|
2950
|
-
__clicksContext: null,
|
|
2951
|
-
__preloaded: false,
|
|
2952
|
-
})`,
|
|
2953
|
-
"export default frontmatter",
|
|
2954
|
-
// handle HMR, update frontmatter with update
|
|
2955
|
-
"if (import.meta.hot) {",
|
|
2956
|
-
" import.meta.hot.accept(({ frontmatter: update }) => {",
|
|
2957
|
-
" if(!update) return",
|
|
2958
|
-
" Object.keys(frontmatter).forEach(key => {",
|
|
2959
|
-
" if (!(key in update)) delete frontmatter[key]",
|
|
2960
|
-
" })",
|
|
2961
|
-
" Object.assign(frontmatter, update)",
|
|
2962
|
-
" })",
|
|
2963
|
-
"}"
|
|
2964
|
-
].join("\n"),
|
|
2965
|
-
map: { mappings: "" }
|
|
2966
|
-
};
|
|
2967
|
-
}
|
|
2968
|
-
}
|
|
2969
|
-
return {
|
|
2970
|
-
code: "",
|
|
2971
|
-
map: { mappings: "" }
|
|
2972
|
-
};
|
|
2973
|
-
}
|
|
2974
|
-
}
|
|
2975
|
-
},
|
|
2976
|
-
{
|
|
2977
|
-
name: "slidev:layout-transform:pre",
|
|
2978
|
-
enforce: "pre",
|
|
2979
|
-
async transform(code, id) {
|
|
2980
|
-
if (!id.startsWith(slidePrefix))
|
|
2981
|
-
return;
|
|
2982
|
-
const remaning = id.slice(slidePrefix.length);
|
|
2983
|
-
const match = remaning.match(regexIdQuery);
|
|
2984
|
-
if (!match)
|
|
2985
|
-
return;
|
|
2986
|
-
const [, no, type] = match;
|
|
2987
|
-
if (type !== "md")
|
|
2988
|
-
return;
|
|
2989
|
-
const pageNo = Number.parseInt(no) - 1;
|
|
2990
|
-
return transformMarkdown(code, pageNo);
|
|
2991
|
-
}
|
|
2992
|
-
},
|
|
2993
|
-
{
|
|
2994
|
-
name: "slidev:context-transform:pre",
|
|
2995
|
-
enforce: "pre",
|
|
2996
|
-
async transform(code, id) {
|
|
2997
|
-
if (!id.endsWith(".vue") || id.includes("/@slidev/client/") || id.includes("/packages/client/"))
|
|
2998
|
-
return;
|
|
2999
|
-
return transformVue(code);
|
|
3000
|
-
}
|
|
3001
|
-
},
|
|
3002
|
-
{
|
|
3003
|
-
name: "slidev:title-transform:pre",
|
|
3004
|
-
enforce: "pre",
|
|
3005
|
-
transform(code, id) {
|
|
3006
|
-
if (id !== "/@slidev/titles.md")
|
|
3007
|
-
return;
|
|
3008
|
-
return transformTitles(code);
|
|
3009
|
-
}
|
|
3010
|
-
},
|
|
3011
|
-
{
|
|
3012
|
-
name: "slidev:slide-transform:post",
|
|
3013
|
-
enforce: "post",
|
|
3014
|
-
transform(code, id) {
|
|
3015
|
-
if (!id.match(/\/@slidev\/slides\/\d+\.md($|\?)/))
|
|
3016
|
-
return;
|
|
3017
|
-
const replaced = code.replace("if (_rerender_only)", "if (false)");
|
|
3018
|
-
if (replaced !== code)
|
|
3019
|
-
return replaced;
|
|
3020
|
-
}
|
|
3021
|
-
},
|
|
3022
|
-
{
|
|
3023
|
-
name: "slidev:index-html-transform",
|
|
3024
|
-
transformIndexHtml() {
|
|
3025
|
-
const { info, author, keywords } = data.headmatter;
|
|
3026
|
-
return [
|
|
3027
|
-
{
|
|
3028
|
-
tag: "title",
|
|
3029
|
-
children: getTitle()
|
|
3030
|
-
},
|
|
3031
|
-
info && {
|
|
3032
|
-
tag: "meta",
|
|
3033
|
-
attrs: {
|
|
3034
|
-
name: "description",
|
|
3035
|
-
content: info
|
|
3036
|
-
}
|
|
3037
|
-
},
|
|
3038
|
-
author && {
|
|
3039
|
-
tag: "meta",
|
|
3040
|
-
attrs: {
|
|
3041
|
-
name: "author",
|
|
3042
|
-
content: author
|
|
3043
|
-
}
|
|
3044
|
-
},
|
|
3045
|
-
keywords && {
|
|
3046
|
-
tag: "meta",
|
|
3047
|
-
attrs: {
|
|
3048
|
-
name: "keywords",
|
|
3049
|
-
content: Array.isArray(keywords) ? keywords.join(", ") : keywords
|
|
3050
|
-
}
|
|
3051
|
-
}
|
|
3052
|
-
].filter(isTruthy);
|
|
3053
|
-
}
|
|
3054
|
-
}
|
|
3055
|
-
];
|
|
3056
|
-
function updateServerWatcher() {
|
|
3057
|
-
if (!server)
|
|
3058
|
-
return;
|
|
3059
|
-
server.watcher.add(data.watchFiles);
|
|
3060
|
-
}
|
|
3061
|
-
function getFrontmatter(pageNo) {
|
|
3062
|
-
return {
|
|
3063
|
-
...data.headmatter?.defaults || {},
|
|
3064
|
-
...data.slides[pageNo]?.frontmatter || {}
|
|
3065
|
-
};
|
|
3066
|
-
}
|
|
3067
|
-
async function transformMarkdown(code, pageNo) {
|
|
3068
|
-
const layouts = await getLayouts();
|
|
3069
|
-
const frontmatter = getFrontmatter(pageNo);
|
|
3070
|
-
let layoutName = frontmatter?.layout || (pageNo === 0 ? "cover" : "default");
|
|
3071
|
-
if (!layouts[layoutName]) {
|
|
3072
|
-
console.error(red(`
|
|
3073
|
-
Unknown layout "${bold(layoutName)}".${yellow(" Available layouts are:")}`) + Object.keys(layouts).map((i, idx) => (idx % 3 === 0 ? "\n " : "") + gray(i.padEnd(15, " "))).join(" "));
|
|
3074
|
-
console.error();
|
|
3075
|
-
layoutName = "default";
|
|
3076
|
-
}
|
|
3077
|
-
delete frontmatter.title;
|
|
3078
|
-
const imports = [
|
|
3079
|
-
`import InjectedLayout from "${toAtFS(layouts[layoutName])}"`,
|
|
3080
|
-
`import frontmatter from "${toAtFS(`${slidePrefix + (pageNo + 1)}.frontmatter`)}"`,
|
|
3081
|
-
templateImportContextUtils,
|
|
3082
|
-
"_provideFrontmatter(frontmatter)",
|
|
3083
|
-
templateInitContext,
|
|
3084
|
-
templateInjectionMarker
|
|
3085
|
-
];
|
|
3086
|
-
code = code.replace(/(<script setup.*>)/g, `$1
|
|
3087
|
-
${imports.join("\n")}
|
|
3088
|
-
`);
|
|
3089
|
-
const injectA = code.indexOf("<template>") + "<template>".length;
|
|
3090
|
-
const injectB = code.lastIndexOf("</template>");
|
|
3091
|
-
let body = code.slice(injectA, injectB).trim();
|
|
3092
|
-
if (body.startsWith("<div>") && body.endsWith("</div>"))
|
|
3093
|
-
body = body.slice(5, -6);
|
|
3094
|
-
code = `${code.slice(0, injectA)}
|
|
3095
|
-
<InjectedLayout v-bind="_frontmatterToProps(frontmatter,${pageNo})">
|
|
3096
|
-
${body}
|
|
3097
|
-
</InjectedLayout>
|
|
3098
|
-
${code.slice(injectB)}`;
|
|
3099
|
-
return code;
|
|
3100
|
-
}
|
|
3101
|
-
function transformVue(code) {
|
|
3102
|
-
if (code.includes(templateInjectionMarker) || code.includes("useSlideContext()"))
|
|
3103
|
-
return code;
|
|
3104
|
-
const imports = [
|
|
3105
|
-
templateImportContextUtils,
|
|
3106
|
-
templateInitContext,
|
|
3107
|
-
templateInjectionMarker
|
|
3108
|
-
];
|
|
3109
|
-
const matchScript = code.match(/<script((?!setup).)*(setup)?.*>/);
|
|
3110
|
-
if (matchScript && matchScript[2]) {
|
|
3111
|
-
return code.replace(/(<script.*>)/g, `$1
|
|
3112
|
-
${imports.join("\n")}
|
|
3113
|
-
`);
|
|
3114
|
-
} else if (matchScript && !matchScript[2]) {
|
|
3115
|
-
const matchExport = code.match(/export\s+default\s+{/);
|
|
3116
|
-
if (matchExport) {
|
|
3117
|
-
const exportIndex = (matchExport.index || 0) + matchExport[0].length;
|
|
3118
|
-
let component = code.slice(exportIndex);
|
|
3119
|
-
component = component.slice(0, component.indexOf("</script>"));
|
|
3120
|
-
const scriptIndex = (matchScript.index || 0) + matchScript[0].length;
|
|
3121
|
-
const provideImport = '\nimport { injectionSlidevContext } from "@slidev/client/constants.ts"\n';
|
|
3122
|
-
code = `${code.slice(0, scriptIndex)}${provideImport}${code.slice(scriptIndex)}`;
|
|
3123
|
-
let injectIndex = exportIndex + provideImport.length;
|
|
3124
|
-
let injectObject = "$slidev: { from: injectionSlidevContext },";
|
|
3125
|
-
const matchInject = component.match(/.*inject\s*:\s*([\[{])/);
|
|
3126
|
-
if (matchInject) {
|
|
3127
|
-
injectIndex += (matchInject.index || 0) + matchInject[0].length;
|
|
3128
|
-
if (matchInject[1] === "[") {
|
|
3129
|
-
let injects = component.slice((matchInject.index || 0) + matchInject[0].length);
|
|
3130
|
-
const injectEndIndex = injects.indexOf("]");
|
|
3131
|
-
injects = injects.slice(0, injectEndIndex);
|
|
3132
|
-
injectObject += injects.split(",").map((inject) => `${inject}: {from: ${inject}}`).join(",");
|
|
3133
|
-
return `${code.slice(0, injectIndex - 1)}{
|
|
3134
|
-
${injectObject}
|
|
3135
|
-
}${code.slice(injectIndex + injectEndIndex + 1)}`;
|
|
3136
|
-
} else {
|
|
3137
|
-
return `${code.slice(0, injectIndex)}
|
|
3138
|
-
${injectObject}
|
|
3139
|
-
${code.slice(injectIndex)}`;
|
|
3140
|
-
}
|
|
3141
|
-
}
|
|
3142
|
-
return `${code.slice(0, injectIndex)}
|
|
3143
|
-
inject: { ${injectObject} },
|
|
3144
|
-
${code.slice(injectIndex)}`;
|
|
3145
|
-
}
|
|
3146
|
-
}
|
|
3147
|
-
return `<script setup>
|
|
3148
|
-
${imports.join("\n")}
|
|
3149
|
-
</script>
|
|
3150
|
-
${code}`;
|
|
3151
|
-
}
|
|
3152
|
-
function transformTitles(code) {
|
|
3153
|
-
return code.replace(/<template>\s*<div>\s*<p>/, "<template>").replace(/<\/p>\s*<\/div>\s*<\/template>/, "</template>").replace(/<script\ssetup>/, `<script setup lang="ts">
|
|
3154
|
-
defineProps<{ no: number | string }>()`);
|
|
3155
|
-
}
|
|
3156
|
-
async function getLayouts() {
|
|
3157
|
-
const now = Date.now();
|
|
3158
|
-
if (now - _layouts_cache_time < 2e3)
|
|
3159
|
-
return _layouts_cache;
|
|
3160
|
-
const layouts = {};
|
|
3161
|
-
for (const root of [...roots, clientRoot]) {
|
|
3162
|
-
const layoutPaths = await fg2("layouts/**/*.{vue,ts}", {
|
|
3163
|
-
cwd: root,
|
|
3164
|
-
absolute: true,
|
|
3165
|
-
suppressErrors: true
|
|
3166
|
-
});
|
|
3167
|
-
for (const layoutPath of layoutPaths) {
|
|
3168
|
-
const layout = basename2(layoutPath).replace(/\.\w+$/, "");
|
|
3169
|
-
if (layouts[layout])
|
|
3170
|
-
continue;
|
|
3171
|
-
layouts[layout] = layoutPath;
|
|
3172
|
-
}
|
|
3173
|
-
}
|
|
3174
|
-
_layouts_cache_time = now;
|
|
3175
|
-
_layouts_cache = layouts;
|
|
3176
|
-
return layouts;
|
|
3177
|
-
}
|
|
3178
|
-
async function resolveUrl(id) {
|
|
3179
|
-
return toAtFS(await resolveImportPath(id, true));
|
|
3180
|
-
}
|
|
3181
|
-
function resolveUrlOfClient(name) {
|
|
3182
|
-
return toAtFS(join4(clientRoot, name));
|
|
3183
|
-
}
|
|
3184
|
-
async function generateUserStyles() {
|
|
3185
|
-
const imports = [
|
|
3186
|
-
`import "${resolveUrlOfClient("styles/vars.css")}"`,
|
|
3187
|
-
`import "${resolveUrlOfClient("styles/index.css")}"`,
|
|
3188
|
-
`import "${resolveUrlOfClient("styles/code.css")}"`,
|
|
3189
|
-
`import "${resolveUrlOfClient("styles/katex.css")}"`,
|
|
3190
|
-
`import "${resolveUrlOfClient("styles/transitions.css")}"`
|
|
3191
|
-
];
|
|
3192
|
-
for (const root of roots) {
|
|
3193
|
-
const styles = [
|
|
3194
|
-
join4(root, "styles", "index.ts"),
|
|
3195
|
-
join4(root, "styles", "index.js"),
|
|
3196
|
-
join4(root, "styles", "index.css"),
|
|
3197
|
-
join4(root, "styles.css"),
|
|
3198
|
-
join4(root, "style.css")
|
|
3199
|
-
];
|
|
3200
|
-
for (const style of styles) {
|
|
3201
|
-
if (fs3.existsSync(style)) {
|
|
3202
|
-
imports.push(`import "${toAtFS(style)}"`);
|
|
3203
|
-
continue;
|
|
3204
|
-
}
|
|
3205
|
-
}
|
|
3206
|
-
}
|
|
3207
|
-
if (data.features.katex)
|
|
3208
|
-
imports.push(`import "${await resolveUrl("katex/dist/katex.min.css")}"`);
|
|
3209
|
-
if (data.config.highlighter === "shiki") {
|
|
3210
|
-
imports.push(
|
|
3211
|
-
`import "${await resolveUrl("@shikijs/vitepress-twoslash/style.css")}"`,
|
|
3212
|
-
`import "${resolveUrlOfClient("styles/shiki-twoslash.css")}"`
|
|
3213
|
-
);
|
|
3214
|
-
}
|
|
3215
|
-
if (data.config.css === "unocss") {
|
|
3216
|
-
imports.unshift(
|
|
3217
|
-
`import "${await resolveUrl("@unocss/reset/tailwind.css")}"`,
|
|
3218
|
-
'import "uno:preflights.css"',
|
|
3219
|
-
'import "uno:typography.css"',
|
|
3220
|
-
'import "uno:shortcuts.css"'
|
|
3221
|
-
);
|
|
3222
|
-
imports.push('import "uno.css"');
|
|
3223
|
-
}
|
|
3224
|
-
return imports.join("\n");
|
|
3225
|
-
}
|
|
3226
|
-
async function generateMonacoTypes() {
|
|
3227
|
-
return `void 0; ${parser.scanMonacoModules(data.slides.map((s) => s.source.raw).join()).map((i) => `import('/@slidev-monaco-types/${i}')`).join("\n")}`;
|
|
3228
|
-
}
|
|
3229
|
-
async function generateLayouts() {
|
|
3230
|
-
const imports = [];
|
|
3231
|
-
const layouts = objectMap(
|
|
3232
|
-
await getLayouts(),
|
|
3233
|
-
(k, v) => {
|
|
3234
|
-
imports.push(`import __layout_${k} from "${toAtFS(v)}"`);
|
|
3235
|
-
return [k, `__layout_${k}`];
|
|
3236
|
-
}
|
|
3237
|
-
);
|
|
3238
|
-
return [
|
|
3239
|
-
imports.join("\n"),
|
|
3240
|
-
`export default {
|
|
3241
|
-
${Object.entries(layouts).map(([k, v]) => `"${k}": ${v}`).join(",\n")}
|
|
3242
|
-
}`
|
|
3243
|
-
].join("\n\n");
|
|
3244
|
-
}
|
|
3245
|
-
async function generateRoutes() {
|
|
3246
|
-
const imports = [];
|
|
3247
|
-
const redirects = [];
|
|
3248
|
-
const layouts = await getLayouts();
|
|
3249
|
-
imports.push(`import __layout__end from '${layouts.end}'`);
|
|
3250
|
-
let no = 1;
|
|
3251
|
-
const routes = data.slides.map((i, idx) => {
|
|
3252
|
-
imports.push(`import n${no} from '${slidePrefix}${idx + 1}.md'`);
|
|
3253
|
-
imports.push(`import { meta as f${no} } from '${slidePrefix}${idx + 1}.frontmatter'`);
|
|
3254
|
-
const route = `{ path: '${no}', name: 'page-${no}', component: n${no}, meta: f${no} }`;
|
|
3255
|
-
if (i.frontmatter?.routeAlias)
|
|
3256
|
-
redirects.push(`{ path: '${i.frontmatter?.routeAlias}', redirect: { path: '${no}' } }`);
|
|
3257
|
-
no += 1;
|
|
3258
|
-
return route;
|
|
3259
|
-
});
|
|
3260
|
-
const routesStr = `export default [
|
|
3261
|
-
${routes.join(",\n")}
|
|
3262
|
-
]`;
|
|
3263
|
-
const redirectsStr = `export const redirects = [
|
|
3264
|
-
${redirects.join(",\n")}
|
|
3265
|
-
]`;
|
|
3266
|
-
return [...imports, routesStr, redirectsStr].join("\n");
|
|
3267
|
-
}
|
|
3268
|
-
function getTitle() {
|
|
3269
|
-
if (isString(data.config.title)) {
|
|
3270
|
-
const tokens = md.parseInline(data.config.title, {});
|
|
3271
|
-
return stringifyMarkdownTokens(tokens);
|
|
3272
|
-
}
|
|
3273
|
-
return data.config.title;
|
|
3274
|
-
}
|
|
3275
|
-
function generateConfigs() {
|
|
3276
|
-
const config = {
|
|
3277
|
-
...data.config,
|
|
3278
|
-
remote,
|
|
3279
|
-
title: getTitle()
|
|
3280
|
-
};
|
|
3281
|
-
if (isString(config.info))
|
|
3282
|
-
config.info = md.render(config.info);
|
|
3283
|
-
return `export default ${JSON.stringify(config)}`;
|
|
3284
|
-
}
|
|
3285
|
-
async function generateGlobalComponents(layer) {
|
|
3286
|
-
const components = roots.flatMap((root) => {
|
|
3287
|
-
if (layer === "top") {
|
|
3288
|
-
return [
|
|
3289
|
-
join4(root, "global.vue"),
|
|
3290
|
-
join4(root, "global-top.vue"),
|
|
3291
|
-
join4(root, "GlobalTop.vue")
|
|
3292
|
-
];
|
|
3293
|
-
} else {
|
|
3294
|
-
return [
|
|
3295
|
-
join4(root, "global-bottom.vue"),
|
|
3296
|
-
join4(root, "GlobalBottom.vue")
|
|
3297
|
-
];
|
|
3298
|
-
}
|
|
3299
|
-
}).filter((i) => fs3.existsSync(i));
|
|
3300
|
-
const imports = components.map((i, idx) => `import __n${idx} from '${toAtFS(i)}'`).join("\n");
|
|
3301
|
-
const render = components.map((i, idx) => `h(__n${idx})`).join(",");
|
|
3302
|
-
return `
|
|
3303
|
-
${imports}
|
|
3304
|
-
import { h } from 'vue'
|
|
3305
|
-
export default {
|
|
3306
|
-
render() {
|
|
3307
|
-
return [${render}]
|
|
3308
|
-
}
|
|
3309
|
-
}
|
|
3310
|
-
`;
|
|
3311
|
-
}
|
|
3312
|
-
async function generateCustomNavControls() {
|
|
3313
|
-
const components = roots.flatMap((root) => {
|
|
3314
|
-
return [
|
|
3315
|
-
join4(root, "custom-nav-controls.vue"),
|
|
3316
|
-
join4(root, "CustomNavControls.vue")
|
|
3317
|
-
];
|
|
3318
|
-
}).filter((i) => fs3.existsSync(i));
|
|
3319
|
-
const imports = components.map((i, idx) => `import __n${idx} from '${toAtFS(i)}'`).join("\n");
|
|
3320
|
-
const render = components.map((i, idx) => `h(__n${idx})`).join(",");
|
|
3321
|
-
return `
|
|
3322
|
-
${imports}
|
|
3323
|
-
import { h } from 'vue'
|
|
3324
|
-
export default {
|
|
3325
|
-
render() {
|
|
3326
|
-
return [${render}]
|
|
3327
|
-
}
|
|
3328
|
-
}
|
|
3329
|
-
`;
|
|
3330
|
-
}
|
|
3331
|
-
}
|
|
3332
|
-
|
|
3333
|
-
// node/plugins/monacoTransform.ts
|
|
3334
|
-
import { dirname as dirname2, join as join5 } from "node:path";
|
|
3335
|
-
import fs4 from "node:fs/promises";
|
|
3336
|
-
import process2 from "node:process";
|
|
3337
|
-
import { slash } from "@antfu/utils";
|
|
3338
|
-
import { findDepPkgJsonPath } from "vitefu";
|
|
3339
|
-
async function getPackageData(pkg) {
|
|
3340
|
-
const pkgJsonPath = await findDepPkgJsonPath(pkg, process2.cwd());
|
|
3341
|
-
if (!pkgJsonPath)
|
|
3342
|
-
return;
|
|
3343
|
-
const pkgJson = JSON.parse(await fs4.readFile(pkgJsonPath, "utf-8"));
|
|
3344
|
-
const typePath = pkgJson.types || pkgJson.typings;
|
|
3345
|
-
if (!typePath)
|
|
3346
|
-
return;
|
|
3347
|
-
return [dirname2(pkgJsonPath), pkgJson, typePath];
|
|
3348
|
-
}
|
|
3349
|
-
function createMonacoTypesLoader() {
|
|
3350
|
-
return {
|
|
3351
|
-
name: "slidev:monaco-types-loader",
|
|
3352
|
-
resolveId(id) {
|
|
3353
|
-
if (id.startsWith("/@slidev-monaco-types/"))
|
|
3354
|
-
return id;
|
|
3355
|
-
return null;
|
|
3356
|
-
},
|
|
3357
|
-
async load(id) {
|
|
3358
|
-
const match = id.match(/^\/\@slidev-monaco-types\/(.*)$/);
|
|
3359
|
-
if (match) {
|
|
3360
|
-
const pkg = match[1];
|
|
3361
|
-
const packageData = await getPackageData(pkg) || await getPackageData(`@types/${pkg}`);
|
|
3362
|
-
if (!packageData)
|
|
3363
|
-
return;
|
|
3364
|
-
const [pkgDir, pkgJson, typePath] = packageData;
|
|
3365
|
-
return [
|
|
3366
|
-
"import * as monaco from 'monaco-editor'",
|
|
3367
|
-
`import Type from "${slash(join5(pkgDir, typePath))}?raw"`,
|
|
3368
|
-
...Object.keys(pkgJson.dependencies || {}).map((i) => `import "/@slidev-monaco-types/${i}"`),
|
|
3369
|
-
`monaco.languages.typescript.typescriptDefaults.addExtraLib(\`declare module "${pkg}" { \${Type} }\`)`
|
|
3370
|
-
].join("\n");
|
|
3371
|
-
}
|
|
3372
|
-
}
|
|
3373
|
-
};
|
|
3374
|
-
}
|
|
3375
|
-
|
|
3376
|
-
// node/plugins/setupClient.ts
|
|
3377
|
-
import { existsSync as existsSync2 } from "node:fs";
|
|
3378
|
-
import { join as join6, resolve as resolve2 } from "node:path";
|
|
3379
|
-
import { slash as slash2, uniq as uniq2 } from "@antfu/utils";
|
|
3380
|
-
function createClientSetupPlugin({ themeRoots, addonRoots, userRoot, clientRoot }) {
|
|
3381
|
-
const setupEntry = slash2(resolve2(clientRoot, "setup"));
|
|
3382
|
-
return {
|
|
3383
|
-
name: "slidev:setup",
|
|
3384
|
-
enforce: "pre",
|
|
3385
|
-
async transform(code, id) {
|
|
3386
|
-
if (id.startsWith(setupEntry)) {
|
|
3387
|
-
let getInjections2 = function(isAwait = false, isChained = false) {
|
|
3388
|
-
return injections.join("\n").replace(/:AWAIT:/g, isAwait ? "await " : "").replace(/(,\s*)?:LAST:/g, isChained ? "$1injection_return" : "");
|
|
3389
|
-
};
|
|
3390
|
-
var getInjections = getInjections2;
|
|
3391
|
-
const name = id.slice(setupEntry.length + 1).replace(/\?.*$/, "");
|
|
3392
|
-
const imports = [];
|
|
3393
|
-
const injections = [];
|
|
3394
|
-
const setups = uniq2([
|
|
3395
|
-
...themeRoots,
|
|
3396
|
-
...addonRoots,
|
|
3397
|
-
userRoot
|
|
3398
|
-
]).map((i) => join6(i, "setup", name));
|
|
3399
|
-
setups.forEach((path2, idx) => {
|
|
3400
|
-
if (!existsSync2(path2))
|
|
3401
|
-
return;
|
|
3402
|
-
imports.push(`import __n${idx} from '${toAtFS(path2)}'`);
|
|
3403
|
-
let fn = `:AWAIT:__n${idx}`;
|
|
3404
|
-
if (/\binjection_return\b/g.test(code))
|
|
3405
|
-
fn = `injection_return = ${fn}`;
|
|
3406
|
-
if (/\binjection_arg\b/g.test(code)) {
|
|
3407
|
-
fn += "(";
|
|
3408
|
-
const matches = Array.from(code.matchAll(/\binjection_arg(_\d+)?\b/g));
|
|
3409
|
-
const dedupedMatches = Array.from(new Set(matches.map((m) => m[0])));
|
|
3410
|
-
fn += dedupedMatches.join(", ");
|
|
3411
|
-
fn += ", :LAST:)";
|
|
3412
|
-
} else {
|
|
3413
|
-
fn += "(:LAST:)";
|
|
3414
|
-
}
|
|
3415
|
-
injections.push(
|
|
3416
|
-
`// ${path2}`,
|
|
3417
|
-
fn
|
|
3418
|
-
);
|
|
3419
|
-
});
|
|
3420
|
-
code = code.replace("/* __imports__ */", imports.join("\n"));
|
|
3421
|
-
code = code.replace("/* __injections__ */", getInjections2());
|
|
3422
|
-
code = code.replace("/* __async_injections__ */", getInjections2(true));
|
|
3423
|
-
code = code.replace("/* __chained_injections__ */", getInjections2(false, true));
|
|
3424
|
-
code = code.replace("/* __chained_async_injections__ */", getInjections2(true, true));
|
|
3425
|
-
return code;
|
|
3426
|
-
}
|
|
3427
|
-
return null;
|
|
3428
|
-
}
|
|
3429
|
-
};
|
|
3430
|
-
}
|
|
3431
|
-
|
|
3432
|
-
// node/plugins/markdown.ts
|
|
3433
|
-
import fs6 from "node:fs/promises";
|
|
3434
|
-
import Markdown2 from "unplugin-vue-markdown/vite";
|
|
3435
|
-
import * as base64 from "js-base64";
|
|
3436
|
-
import { slash as slash3 } from "@antfu/utils";
|
|
3437
|
-
import mila2 from "markdown-it-link-attributes";
|
|
3438
|
-
import mif from "markdown-it-footnote";
|
|
3439
|
-
|
|
3440
|
-
// ../../node_modules/.pnpm/@hedgedoc+markdown-it-plugins@2.1.4_patch_hash=tuyuxytl56b2vxulpkzt2wf4o4_markdown-it@14.0.0/node_modules/@hedgedoc/markdown-it-plugins/dist/esm/image-size/specialCharacters.js
|
|
3441
|
-
var SpecialCharacters;
|
|
3442
|
-
(function(SpecialCharacters2) {
|
|
3443
|
-
SpecialCharacters2[SpecialCharacters2["EXCLAMATION_MARK"] = 33] = "EXCLAMATION_MARK";
|
|
3444
|
-
SpecialCharacters2[SpecialCharacters2["OPENING_BRACKET"] = 91] = "OPENING_BRACKET";
|
|
3445
|
-
SpecialCharacters2[SpecialCharacters2["OPENING_PARENTHESIS"] = 40] = "OPENING_PARENTHESIS";
|
|
3446
|
-
SpecialCharacters2[SpecialCharacters2["WHITESPACE"] = 32] = "WHITESPACE";
|
|
3447
|
-
SpecialCharacters2[SpecialCharacters2["NEW_LINE"] = 10] = "NEW_LINE";
|
|
3448
|
-
SpecialCharacters2[SpecialCharacters2["EQUALS"] = 61] = "EQUALS";
|
|
3449
|
-
SpecialCharacters2[SpecialCharacters2["LOWER_CASE_X"] = 120] = "LOWER_CASE_X";
|
|
3450
|
-
SpecialCharacters2[SpecialCharacters2["NUMBER_ZERO"] = 48] = "NUMBER_ZERO";
|
|
3451
|
-
SpecialCharacters2[SpecialCharacters2["NUMBER_NINE"] = 57] = "NUMBER_NINE";
|
|
3452
|
-
SpecialCharacters2[SpecialCharacters2["PERCENTAGE"] = 37] = "PERCENTAGE";
|
|
3453
|
-
SpecialCharacters2[SpecialCharacters2["CLOSING_PARENTHESIS"] = 41] = "CLOSING_PARENTHESIS";
|
|
3454
|
-
})(SpecialCharacters || (SpecialCharacters = {}));
|
|
3455
|
-
|
|
3456
|
-
// ../../node_modules/.pnpm/@hedgedoc+markdown-it-plugins@2.1.4_patch_hash=tuyuxytl56b2vxulpkzt2wf4o4_markdown-it@14.0.0/node_modules/@hedgedoc/markdown-it-plugins/dist/esm/task-lists/index.js
|
|
3457
|
-
import Token from "markdown-it/lib/token.mjs";
|
|
3458
|
-
var checkboxRegex = /^ *\[([\sx])] /i;
|
|
3459
|
-
function taskLists(md2, options = { enabled: false, label: false, lineNumber: false }) {
|
|
3460
|
-
md2.core.ruler.after("inline", "task-lists", (state) => processToken(state, options));
|
|
3461
|
-
md2.renderer.rules.taskListItemCheckbox = (tokens) => {
|
|
3462
|
-
const token = tokens[0];
|
|
3463
|
-
const checkedAttribute = token.attrGet("checked") ? 'checked="" ' : "";
|
|
3464
|
-
const disabledAttribute = token.attrGet("disabled") ? 'disabled="" ' : "";
|
|
3465
|
-
const line = token.attrGet("line");
|
|
3466
|
-
const idAttribute = `id="${token.attrGet("id")}" `;
|
|
3467
|
-
const dataLineAttribute = line && options.lineNumber ? `data-line="${line}" ` : "";
|
|
3468
|
-
return `<input class="task-list-item-checkbox" type="checkbox" ${checkedAttribute}${disabledAttribute}${dataLineAttribute}${idAttribute}/>`;
|
|
3469
|
-
};
|
|
3470
|
-
md2.renderer.rules.taskListItemLabel_close = () => {
|
|
3471
|
-
return "</label>";
|
|
3472
|
-
};
|
|
3473
|
-
md2.renderer.rules.taskListItemLabel_open = (tokens) => {
|
|
3474
|
-
const token = tokens[0];
|
|
3475
|
-
const id = token.attrGet("id");
|
|
3476
|
-
return `<label for="${id}">`;
|
|
3477
|
-
};
|
|
3478
|
-
}
|
|
3479
|
-
function processToken(state, options) {
|
|
3480
|
-
const allTokens = state.tokens;
|
|
3481
|
-
for (let i = 2; i < allTokens.length; i++) {
|
|
3482
|
-
if (!isTodoItem(allTokens, i)) {
|
|
3483
|
-
continue;
|
|
3484
|
-
}
|
|
3485
|
-
todoify(allTokens[i], options);
|
|
3486
|
-
allTokens[i - 2].attrJoin("class", `task-list-item ${options.enabled ? " enabled" : ""}`);
|
|
3487
|
-
const parentToken = findParentToken(allTokens, i - 2);
|
|
3488
|
-
if (parentToken) {
|
|
3489
|
-
const classes = parentToken.attrGet("class") ?? "";
|
|
3490
|
-
if (!classes.match(/(^| )contains-task-list/)) {
|
|
3491
|
-
parentToken.attrJoin("class", "contains-task-list");
|
|
3492
|
-
}
|
|
3493
|
-
}
|
|
3494
|
-
}
|
|
3495
|
-
return false;
|
|
3496
|
-
}
|
|
3497
|
-
function findParentToken(tokens, index) {
|
|
3498
|
-
const targetLevel = tokens[index].level - 1;
|
|
3499
|
-
for (let currentTokenIndex = index - 1; currentTokenIndex >= 0; currentTokenIndex--) {
|
|
3500
|
-
if (tokens[currentTokenIndex].level === targetLevel) {
|
|
3501
|
-
return tokens[currentTokenIndex];
|
|
3502
|
-
}
|
|
3503
|
-
}
|
|
3504
|
-
return void 0;
|
|
3505
|
-
}
|
|
3506
|
-
function isTodoItem(tokens, index) {
|
|
3507
|
-
return isInline(tokens[index]) && isParagraph(tokens[index - 1]) && isListItem(tokens[index - 2]) && startsWithTodoMarkdown(tokens[index]);
|
|
3508
|
-
}
|
|
3509
|
-
function todoify(token, options) {
|
|
3510
|
-
if (token.children == null) {
|
|
3511
|
-
return;
|
|
3512
|
-
}
|
|
3513
|
-
const id = generateIdForToken(token);
|
|
3514
|
-
token.children.splice(0, 0, createCheckboxToken(token, options.enabled, id));
|
|
3515
|
-
token.children[1].content = token.children[1].content.replace(checkboxRegex, "");
|
|
3516
|
-
if (options.label) {
|
|
3517
|
-
token.children.splice(1, 0, createLabelBeginToken(id));
|
|
3518
|
-
token.children.push(createLabelEndToken());
|
|
3519
|
-
}
|
|
3520
|
-
}
|
|
3521
|
-
function generateIdForToken(token) {
|
|
3522
|
-
if (token.map) {
|
|
3523
|
-
return `task-item-${token.map[0]}`;
|
|
3524
|
-
} else {
|
|
3525
|
-
return `task-item-${Math.ceil(Math.random() * (1e4 * 1e3) - 1e3)}`;
|
|
3526
|
-
}
|
|
3527
|
-
}
|
|
3528
|
-
function createCheckboxToken(token, enabled, id) {
|
|
3529
|
-
const checkbox = new Token("taskListItemCheckbox", "", 0);
|
|
3530
|
-
if (!enabled) {
|
|
3531
|
-
checkbox.attrSet("disabled", "true");
|
|
3532
|
-
}
|
|
3533
|
-
if (token.map) {
|
|
3534
|
-
checkbox.attrSet("line", token.map[0].toString());
|
|
3535
|
-
}
|
|
3536
|
-
checkbox.attrSet("id", id);
|
|
3537
|
-
const checkboxRegexResult = checkboxRegex.exec(token.content);
|
|
3538
|
-
const isChecked = checkboxRegexResult?.[1].toLowerCase() === "x";
|
|
3539
|
-
if (isChecked) {
|
|
3540
|
-
checkbox.attrSet("checked", "true");
|
|
3541
|
-
}
|
|
3542
|
-
return checkbox;
|
|
3543
|
-
}
|
|
3544
|
-
function createLabelBeginToken(id) {
|
|
3545
|
-
const labelBeginToken = new Token("taskListItemLabel_open", "", 1);
|
|
3546
|
-
labelBeginToken.attrSet("id", id);
|
|
3547
|
-
return labelBeginToken;
|
|
3548
|
-
}
|
|
3549
|
-
function createLabelEndToken() {
|
|
3550
|
-
return new Token("taskListItemLabel_close", "", -1);
|
|
3551
|
-
}
|
|
3552
|
-
function isInline(token) {
|
|
3553
|
-
return token.type === "inline";
|
|
3554
|
-
}
|
|
3555
|
-
function isParagraph(token) {
|
|
3556
|
-
return token.type === "paragraph_open";
|
|
3557
|
-
}
|
|
3558
|
-
function isListItem(token) {
|
|
3559
|
-
return token.type === "list_item_open";
|
|
3560
|
-
}
|
|
3561
|
-
function startsWithTodoMarkdown(token) {
|
|
3562
|
-
return checkboxRegex.test(token.content);
|
|
3563
|
-
}
|
|
3564
|
-
|
|
3565
|
-
// ../../node_modules/.pnpm/@hedgedoc+markdown-it-plugins@2.1.4_patch_hash=tuyuxytl56b2vxulpkzt2wf4o4_markdown-it@14.0.0/node_modules/@hedgedoc/markdown-it-plugins/dist/esm/toc/plugin.js
|
|
3566
|
-
import { Optional } from "@mrdrogdrog/optional";
|
|
3567
|
-
|
|
3568
|
-
// node/plugins/markdown.ts
|
|
3569
|
-
import { encode as encode2 } from "plantuml-encoder";
|
|
3570
|
-
import Mdc from "markdown-it-mdc";
|
|
3571
|
-
|
|
3572
|
-
// node/plugins/markdown-it-katex.ts
|
|
3573
|
-
import katex from "katex";
|
|
3574
|
-
function isValidDelim(state, pos) {
|
|
3575
|
-
const max = state.posMax;
|
|
3576
|
-
let can_open = true;
|
|
3577
|
-
let can_close = true;
|
|
3578
|
-
const prevChar = pos > 0 ? state.src.charCodeAt(pos - 1) : -1;
|
|
3579
|
-
const nextChar = pos + 1 <= max ? state.src.charCodeAt(pos + 1) : -1;
|
|
3580
|
-
if (prevChar === 32 || prevChar === 9 || /* \t */
|
|
3581
|
-
nextChar >= 48 && nextChar <= 57)
|
|
3582
|
-
can_close = false;
|
|
3583
|
-
if (nextChar === 32 || nextChar === 9)
|
|
3584
|
-
can_open = false;
|
|
3585
|
-
return {
|
|
3586
|
-
can_open,
|
|
3587
|
-
can_close
|
|
3588
|
-
};
|
|
3589
|
-
}
|
|
3590
|
-
function math_inline(state, silent) {
|
|
3591
|
-
let match, token, res, pos;
|
|
3592
|
-
if (state.src[state.pos] !== "$")
|
|
3593
|
-
return false;
|
|
3594
|
-
res = isValidDelim(state, state.pos);
|
|
3595
|
-
if (!res.can_open) {
|
|
3596
|
-
if (!silent)
|
|
3597
|
-
state.pending += "$";
|
|
3598
|
-
state.pos += 1;
|
|
3599
|
-
return true;
|
|
3600
|
-
}
|
|
3601
|
-
const start = state.pos + 1;
|
|
3602
|
-
match = start;
|
|
3603
|
-
while ((match = state.src.indexOf("$", match)) !== -1) {
|
|
3604
|
-
pos = match - 1;
|
|
3605
|
-
while (state.src[pos] === "\\")
|
|
3606
|
-
pos -= 1;
|
|
3607
|
-
if ((match - pos) % 2 === 1)
|
|
3608
|
-
break;
|
|
3609
|
-
match += 1;
|
|
3610
|
-
}
|
|
3611
|
-
if (match === -1) {
|
|
3612
|
-
if (!silent)
|
|
3613
|
-
state.pending += "$";
|
|
3614
|
-
state.pos = start;
|
|
3615
|
-
return true;
|
|
3616
|
-
}
|
|
3617
|
-
if (match - start === 0) {
|
|
3618
|
-
if (!silent)
|
|
3619
|
-
state.pending += "$$";
|
|
3620
|
-
state.pos = start + 1;
|
|
3621
|
-
return true;
|
|
3622
|
-
}
|
|
3623
|
-
res = isValidDelim(state, match);
|
|
3624
|
-
if (!res.can_close) {
|
|
3625
|
-
if (!silent)
|
|
3626
|
-
state.pending += "$";
|
|
3627
|
-
state.pos = start;
|
|
3628
|
-
return true;
|
|
3629
|
-
}
|
|
3630
|
-
if (!silent) {
|
|
3631
|
-
token = state.push("math_inline", "math", 0);
|
|
3632
|
-
token.markup = "$";
|
|
3633
|
-
token.content = state.src.slice(start, match);
|
|
3634
|
-
}
|
|
3635
|
-
state.pos = match + 1;
|
|
3636
|
-
return true;
|
|
3637
|
-
}
|
|
3638
|
-
function math_block(state, start, end, silent) {
|
|
3639
|
-
let firstLine;
|
|
3640
|
-
let lastLine;
|
|
3641
|
-
let next;
|
|
3642
|
-
let lastPos;
|
|
3643
|
-
let found = false;
|
|
3644
|
-
let pos = state.bMarks[start] + state.tShift[start];
|
|
3645
|
-
let max = state.eMarks[start];
|
|
3646
|
-
if (pos + 2 > max)
|
|
3647
|
-
return false;
|
|
3648
|
-
if (state.src.slice(pos, pos + 2) !== "$$")
|
|
3649
|
-
return false;
|
|
3650
|
-
pos += 2;
|
|
3651
|
-
firstLine = state.src.slice(pos, max);
|
|
3652
|
-
if (silent)
|
|
3653
|
-
return true;
|
|
3654
|
-
if (firstLine.trim().slice(-2) === "$$") {
|
|
3655
|
-
firstLine = firstLine.trim().slice(0, -2);
|
|
3656
|
-
found = true;
|
|
3657
|
-
}
|
|
3658
|
-
for (next = start; !found; ) {
|
|
3659
|
-
next++;
|
|
3660
|
-
if (next >= end)
|
|
3661
|
-
break;
|
|
3662
|
-
pos = state.bMarks[next] + state.tShift[next];
|
|
3663
|
-
max = state.eMarks[next];
|
|
3664
|
-
if (pos < max && state.tShift[next] < state.blkIndent) {
|
|
3665
|
-
break;
|
|
3666
|
-
}
|
|
3667
|
-
if (state.src.slice(pos, max).trim().slice(-2) === "$$") {
|
|
3668
|
-
lastPos = state.src.slice(0, max).lastIndexOf("$$");
|
|
3669
|
-
lastLine = state.src.slice(pos, lastPos);
|
|
3670
|
-
found = true;
|
|
3671
|
-
}
|
|
3672
|
-
}
|
|
3673
|
-
state.line = next + 1;
|
|
3674
|
-
const token = state.push("math_block", "math", 0);
|
|
3675
|
-
token.block = true;
|
|
3676
|
-
token.content = (firstLine && firstLine.trim() ? `${firstLine}
|
|
3677
|
-
` : "") + state.getLines(start + 1, next, state.tShift[start], true) + (lastLine && lastLine.trim() ? lastLine : "");
|
|
3678
|
-
token.map = [start, state.line];
|
|
3679
|
-
token.markup = "$$";
|
|
3680
|
-
return true;
|
|
3681
|
-
}
|
|
3682
|
-
function math_plugin(md2, options) {
|
|
3683
|
-
options = options || {};
|
|
3684
|
-
const katexInline = function(latex) {
|
|
3685
|
-
options.displayMode = false;
|
|
3686
|
-
try {
|
|
3687
|
-
return katex.renderToString(latex, options);
|
|
3688
|
-
} catch (error) {
|
|
3689
|
-
if (options.throwOnError)
|
|
3690
|
-
console.warn(error);
|
|
3691
|
-
return latex;
|
|
3692
|
-
}
|
|
3693
|
-
};
|
|
3694
|
-
const inlineRenderer = function(tokens, idx) {
|
|
3695
|
-
return katexInline(tokens[idx].content);
|
|
3696
|
-
};
|
|
3697
|
-
const katexBlock = function(latex) {
|
|
3698
|
-
options.displayMode = true;
|
|
3699
|
-
try {
|
|
3700
|
-
return `<p>${katex.renderToString(latex, options)}</p>`;
|
|
3701
|
-
} catch (error) {
|
|
3702
|
-
if (options.throwOnError)
|
|
3703
|
-
console.warn(error);
|
|
3704
|
-
return latex;
|
|
3705
|
-
}
|
|
3706
|
-
};
|
|
3707
|
-
const blockRenderer = function(tokens, idx) {
|
|
3708
|
-
return `${katexBlock(tokens[idx].content)}
|
|
3709
|
-
`;
|
|
3710
|
-
};
|
|
3711
|
-
md2.inline.ruler.after("escape", "math_inline", math_inline);
|
|
3712
|
-
md2.block.ruler.after("blockquote", "math_block", math_block, {
|
|
3713
|
-
alt: ["paragraph", "reference", "blockquote", "list"]
|
|
3714
|
-
});
|
|
3715
|
-
md2.renderer.rules.math_inline = inlineRenderer;
|
|
3716
|
-
md2.renderer.rules.math_block = blockRenderer;
|
|
3717
|
-
}
|
|
3718
|
-
|
|
3719
|
-
// node/plugins/markdown-it-prism.ts
|
|
3720
|
-
import { createRequire } from "node:module";
|
|
3721
|
-
import Prism from "prismjs";
|
|
3722
|
-
import loadLanguages from "prismjs/components/index.js";
|
|
3723
|
-
import * as htmlparser2 from "htmlparser2";
|
|
3724
|
-
var require2 = createRequire(import.meta.url);
|
|
3725
|
-
var Tag = class {
|
|
3726
|
-
tagname;
|
|
3727
|
-
attributes;
|
|
3728
|
-
constructor(tagname, attributes) {
|
|
3729
|
-
this.tagname = tagname;
|
|
3730
|
-
this.attributes = attributes;
|
|
3731
|
-
}
|
|
3732
|
-
asOpen() {
|
|
3733
|
-
return `<${this.tagname} ${Object.entries(this.attributes).map(([key, value]) => `${key}="${value}"`).join(" ")}>`;
|
|
3734
|
-
}
|
|
3735
|
-
asClosed() {
|
|
3736
|
-
return `</${this.tagname}>`;
|
|
3737
|
-
}
|
|
3738
|
-
};
|
|
3739
|
-
var DEFAULTS = {
|
|
3740
|
-
plugins: [],
|
|
3741
|
-
init: () => {
|
|
3742
|
-
},
|
|
3743
|
-
defaultLanguageForUnknown: void 0,
|
|
3744
|
-
defaultLanguageForUnspecified: void 0,
|
|
3745
|
-
defaultLanguage: void 0
|
|
3746
|
-
};
|
|
3747
|
-
function loadPrismLang(lang) {
|
|
3748
|
-
if (!lang)
|
|
3749
|
-
return void 0;
|
|
3750
|
-
let langObject = Prism.languages[lang];
|
|
3751
|
-
if (langObject === void 0) {
|
|
3752
|
-
loadLanguages([lang]);
|
|
3753
|
-
langObject = Prism.languages[lang];
|
|
3754
|
-
}
|
|
3755
|
-
return langObject;
|
|
3756
|
-
}
|
|
3757
|
-
function loadPrismPlugin(name) {
|
|
3758
|
-
try {
|
|
3759
|
-
require2(`prismjs/plugins/${name}/prism-${name}`);
|
|
3760
|
-
} catch (e) {
|
|
3761
|
-
throw new Error(`Cannot load Prism plugin "${name}". Please check the spelling.`);
|
|
3762
|
-
}
|
|
3763
|
-
}
|
|
3764
|
-
function selectLanguage(options, lang) {
|
|
3765
|
-
let langToUse = lang;
|
|
3766
|
-
if (langToUse === "" && options.defaultLanguageForUnspecified !== void 0)
|
|
3767
|
-
langToUse = options.defaultLanguageForUnspecified;
|
|
3768
|
-
let prismLang = loadPrismLang(langToUse);
|
|
3769
|
-
if (prismLang === void 0 && options.defaultLanguageForUnknown !== void 0) {
|
|
3770
|
-
langToUse = options.defaultLanguageForUnknown;
|
|
3771
|
-
prismLang = loadPrismLang(langToUse);
|
|
3772
|
-
}
|
|
3773
|
-
return [langToUse, prismLang];
|
|
3774
|
-
}
|
|
3775
|
-
function highlight(markdownit, options, text, lang) {
|
|
3776
|
-
const [langToUse, prismLang] = selectLanguage(options, lang);
|
|
3777
|
-
let code = text.trimEnd();
|
|
3778
|
-
code = prismLang ? highlightPrism(code, prismLang, langToUse) : markdownit.utils.escapeHtml(code);
|
|
3779
|
-
code = code.split(/\r?\n/g).map((line) => `<span class="line">${line}</span>`).join("\n");
|
|
3780
|
-
const classAttribute = langToUse ? ` class="slidev-code ${markdownit.options.langPrefix}${markdownit.utils.escapeHtml(langToUse)}"` : "";
|
|
3781
|
-
return escapeVueInCode(`<pre${classAttribute}><code>${code}</code></pre>`);
|
|
3782
|
-
}
|
|
3783
|
-
function highlightPrism(code, prismLang, langToUse) {
|
|
3784
|
-
const openTags = [];
|
|
3785
|
-
const parser2 = new htmlparser2.Parser({
|
|
3786
|
-
onopentag(tagname, attributes) {
|
|
3787
|
-
openTags.push(new Tag(tagname, attributes));
|
|
3788
|
-
},
|
|
3789
|
-
onclosetag() {
|
|
3790
|
-
openTags.pop();
|
|
3791
|
-
}
|
|
3792
|
-
});
|
|
3793
|
-
code = Prism.highlight(code, prismLang, langToUse);
|
|
3794
|
-
code = code.split(/\r?\n/g).map((line) => {
|
|
3795
|
-
const prefix = openTags.map((tag) => tag.asOpen()).join("");
|
|
3796
|
-
parser2.write(line);
|
|
3797
|
-
const postfix = openTags.reverse().map((tag) => tag.asClosed()).join("");
|
|
3798
|
-
return prefix + line + postfix;
|
|
3799
|
-
}).join("\n");
|
|
3800
|
-
parser2.end();
|
|
3801
|
-
return code;
|
|
3802
|
-
}
|
|
3803
|
-
function checkLanguageOption(options, optionName) {
|
|
3804
|
-
const language = options[optionName];
|
|
3805
|
-
if (language !== void 0 && loadPrismLang(language) === void 0)
|
|
3806
|
-
throw new Error(`Bad option ${optionName}: There is no Prism language '${language}'.`);
|
|
3807
|
-
}
|
|
3808
|
-
function markdownItPrism(markdownit, useroptions) {
|
|
3809
|
-
const options = Object.assign({}, DEFAULTS, useroptions);
|
|
3810
|
-
checkLanguageOption(options, "defaultLanguage");
|
|
3811
|
-
checkLanguageOption(options, "defaultLanguageForUnknown");
|
|
3812
|
-
checkLanguageOption(options, "defaultLanguageForUnspecified");
|
|
3813
|
-
options.defaultLanguageForUnknown = options.defaultLanguageForUnknown || options.defaultLanguage;
|
|
3814
|
-
options.defaultLanguageForUnspecified = options.defaultLanguageForUnspecified || options.defaultLanguage;
|
|
3815
|
-
options.plugins.forEach(loadPrismPlugin);
|
|
3816
|
-
options.init(Prism);
|
|
3817
|
-
markdownit.options.highlight = (text, lang) => highlight(markdownit, options, text, lang);
|
|
3818
|
-
}
|
|
3819
|
-
|
|
3820
|
-
// node/plugins/transformSnippet.ts
|
|
3821
|
-
import path from "node:path";
|
|
3822
|
-
import fs5 from "fs-extra";
|
|
3823
|
-
function dedent(text) {
|
|
3824
|
-
const lines = text.split("\n");
|
|
3825
|
-
const minIndentLength = lines.reduce((acc, line) => {
|
|
3826
|
-
for (let i = 0; i < line.length; i++) {
|
|
3827
|
-
if (line[i] !== " " && line[i] !== " ")
|
|
3828
|
-
return Math.min(i, acc);
|
|
3829
|
-
}
|
|
3830
|
-
return acc;
|
|
3831
|
-
}, Number.POSITIVE_INFINITY);
|
|
3832
|
-
if (minIndentLength < Number.POSITIVE_INFINITY)
|
|
3833
|
-
return lines.map((x) => x.slice(minIndentLength)).join("\n");
|
|
3834
|
-
return text;
|
|
3835
|
-
}
|
|
3836
|
-
function testLine(line, regexp, regionName, end = false) {
|
|
3837
|
-
const [full, tag, name] = regexp.exec(line.trim()) || [];
|
|
3838
|
-
return full && tag && name === regionName && tag.match(end ? /^[Ee]nd ?[rR]egion$/ : /^[rR]egion$/);
|
|
3839
|
-
}
|
|
3840
|
-
function findRegion(lines, regionName) {
|
|
3841
|
-
const regionRegexps = [
|
|
3842
|
-
/^\/\/ ?#?((?:end)?region) ([\w*-]+)$/,
|
|
3843
|
-
// javascript, typescript, java
|
|
3844
|
-
/^\/\* ?#((?:end)?region) ([\w*-]+) ?\*\/$/,
|
|
3845
|
-
// css, less, scss
|
|
3846
|
-
/^#pragma ((?:end)?region) ([\w*-]+)$/,
|
|
3847
|
-
// C, C++
|
|
3848
|
-
/^<!-- #?((?:end)?region) ([\w*-]+) -->$/,
|
|
3849
|
-
// HTML, markdown
|
|
3850
|
-
/^#((?:End )Region) ([\w*-]+)$/,
|
|
3851
|
-
// Visual Basic
|
|
3852
|
-
/^::#((?:end)region) ([\w*-]+)$/,
|
|
3853
|
-
// Bat
|
|
3854
|
-
/^# ?((?:end)?region) ([\w*-]+)$/
|
|
3855
|
-
// C#, PHP, Powershell, Python, perl & misc
|
|
3856
|
-
];
|
|
3857
|
-
let regexp = null;
|
|
3858
|
-
let start = -1;
|
|
3859
|
-
for (const [lineId, line] of lines.entries()) {
|
|
3860
|
-
if (regexp === null) {
|
|
3861
|
-
for (const reg of regionRegexps) {
|
|
3862
|
-
if (testLine(line, reg, regionName)) {
|
|
3863
|
-
start = lineId + 1;
|
|
3864
|
-
regexp = reg;
|
|
3865
|
-
break;
|
|
3866
|
-
}
|
|
3867
|
-
}
|
|
3868
|
-
} else if (testLine(line, regexp, regionName, true)) {
|
|
3869
|
-
return { start, end: lineId, regexp };
|
|
3870
|
-
}
|
|
3871
|
-
}
|
|
3872
|
-
return null;
|
|
3873
|
-
}
|
|
3874
|
-
function transformSnippet(md2, options, id) {
|
|
3875
|
-
const slideId = id.match(/(\d+)\.md$/)?.[1];
|
|
3876
|
-
if (!slideId)
|
|
3877
|
-
return md2;
|
|
3878
|
-
const data = options.data;
|
|
3879
|
-
const slideInfo = data.slides[+slideId - 1];
|
|
3880
|
-
const dir = path.dirname(slideInfo.source?.filepath ?? options.entry ?? options.userRoot);
|
|
3881
|
-
return md2.replace(
|
|
3882
|
-
/^<<< *(.+?)(#[\w-]+)? *(?: (\S+?))? *(\{.*)?$/mg,
|
|
3883
|
-
(full, filepath = "", regionName = "", lang = "", meta = "") => {
|
|
3884
|
-
const firstLine = `\`\`\`${lang || path.extname(filepath).slice(1)} ${meta}`;
|
|
3885
|
-
const src = /^\@[\/]/.test(filepath) ? path.resolve(options.userRoot, filepath.slice(2)) : path.resolve(dir, filepath);
|
|
3886
|
-
data.watchFiles.push(src);
|
|
3887
|
-
const isAFile = fs5.statSync(src).isFile();
|
|
3888
|
-
if (!fs5.existsSync(src) || !isAFile) {
|
|
3889
|
-
throw new Error(isAFile ? `Code snippet path not found: ${src}` : `Invalid code snippet option`);
|
|
3890
|
-
}
|
|
3891
|
-
let content = fs5.readFileSync(src, "utf8");
|
|
3892
|
-
slideInfo.snippetsUsed ??= {};
|
|
3893
|
-
slideInfo.snippetsUsed[src] = content;
|
|
3894
|
-
if (regionName) {
|
|
3895
|
-
const lines = content.split(/\r?\n/);
|
|
3896
|
-
const region = findRegion(lines, regionName.slice(1));
|
|
3897
|
-
if (region) {
|
|
3898
|
-
content = dedent(
|
|
3899
|
-
lines.slice(region.start, region.end).filter((line) => !region.regexp.test(line.trim())).join("\n")
|
|
3900
|
-
);
|
|
3901
|
-
}
|
|
3902
|
-
}
|
|
3903
|
-
return `${firstLine}
|
|
3904
|
-
${content}
|
|
3905
|
-
\`\`\``;
|
|
3906
|
-
}
|
|
3907
|
-
);
|
|
3908
|
-
}
|
|
3909
|
-
|
|
3910
|
-
// node/plugins/markdown.ts
|
|
3911
|
-
async function createMarkdownPlugin(options, { markdown: mdOptions }) {
|
|
3912
|
-
const { data: { config }, roots, mode, entry, clientRoot } = options;
|
|
3913
|
-
const setups = [];
|
|
3914
|
-
const entryPath = slash3(entry);
|
|
3915
|
-
if (config.highlighter === "shiki") {
|
|
3916
|
-
const MarkdownItShiki = await import("@shikijs/markdown-it").then((r) => r.default);
|
|
3917
|
-
const { transformerTwoslash } = await import("@shikijs/vitepress-twoslash");
|
|
3918
|
-
const options2 = await loadShikiSetups(clientRoot, roots);
|
|
3919
|
-
const plugin = await MarkdownItShiki({
|
|
3920
|
-
...options2,
|
|
3921
|
-
transformers: [
|
|
3922
|
-
...options2.transformers || [],
|
|
3923
|
-
transformerTwoslash({
|
|
3924
|
-
explicitTrigger: true,
|
|
3925
|
-
twoslashOptions: {
|
|
3926
|
-
handbookOptions: {
|
|
3927
|
-
noErrorValidation: true
|
|
3928
|
-
}
|
|
3929
|
-
}
|
|
3930
|
-
}),
|
|
3931
|
-
{
|
|
3932
|
-
pre(pre) {
|
|
3933
|
-
this.addClassToHast(pre, "slidev-code");
|
|
3934
|
-
delete pre.properties.tabindex;
|
|
3935
|
-
},
|
|
3936
|
-
postprocess(code) {
|
|
3937
|
-
return escapeVueInCode(code);
|
|
3938
|
-
}
|
|
3939
|
-
}
|
|
3940
|
-
]
|
|
3941
|
-
});
|
|
3942
|
-
setups.push((md2) => md2.use(plugin));
|
|
3943
|
-
} else {
|
|
3944
|
-
setups.push((md2) => md2.use(markdownItPrism));
|
|
3945
|
-
}
|
|
3946
|
-
if (config.mdc)
|
|
3947
|
-
setups.push((md2) => md2.use(Mdc));
|
|
3948
|
-
const KatexOptions = await loadSetups(options.clientRoot, roots, "katex.ts", {}, { strict: false }, false);
|
|
3949
|
-
return Markdown2({
|
|
3950
|
-
include: [/\.md$/],
|
|
3951
|
-
wrapperClasses: "",
|
|
3952
|
-
headEnabled: false,
|
|
3953
|
-
frontmatter: false,
|
|
3954
|
-
escapeCodeTagInterpolation: false,
|
|
3955
|
-
markdownItOptions: {
|
|
3956
|
-
quotes: `""''`,
|
|
3957
|
-
html: true,
|
|
3958
|
-
xhtmlOut: true,
|
|
3959
|
-
linkify: true,
|
|
3960
|
-
...mdOptions?.markdownItOptions
|
|
3961
|
-
},
|
|
3962
|
-
...mdOptions,
|
|
3963
|
-
markdownItSetup(md2) {
|
|
3964
|
-
md2.use(mila2, {
|
|
3965
|
-
attrs: {
|
|
3966
|
-
target: "_blank",
|
|
3967
|
-
rel: "noopener"
|
|
3968
|
-
}
|
|
3969
|
-
});
|
|
3970
|
-
md2.use(mif);
|
|
3971
|
-
md2.use(taskLists, { enabled: true, lineNumber: true, label: true });
|
|
3972
|
-
md2.use(math_plugin, KatexOptions);
|
|
3973
|
-
setups.forEach((i) => i(md2));
|
|
3974
|
-
mdOptions?.markdownItSetup?.(md2);
|
|
3975
|
-
},
|
|
3976
|
-
transforms: {
|
|
3977
|
-
before(code, id) {
|
|
3978
|
-
if (id === entryPath)
|
|
3979
|
-
return "";
|
|
3980
|
-
const monaco = config.monaco === true || config.monaco === mode ? transformMarkdownMonaco : truncateMancoMark;
|
|
3981
|
-
code = transformSlotSugar(code);
|
|
3982
|
-
code = transformSnippet(code, options, id);
|
|
3983
|
-
code = transformMermaid(code);
|
|
3984
|
-
code = transformPlantUml(code, config.plantUmlServer);
|
|
3985
|
-
code = monaco(code);
|
|
3986
|
-
code = transformHighlighter(code);
|
|
3987
|
-
code = transformPageCSS(code, id);
|
|
3988
|
-
code = transformKaTex(code);
|
|
3989
|
-
return code;
|
|
3990
|
-
}
|
|
3991
|
-
}
|
|
3992
|
-
});
|
|
3993
|
-
}
|
|
3994
|
-
function transformKaTex(md2) {
|
|
3995
|
-
return md2.replace(/^\$\$(?:\s*{([\d\w*,\|-]+)}\s*?({.*?})?\s*?)?\n([\s\S]+?)^\$\$/mg, (full, rangeStr = "", options = "", code) => {
|
|
3996
|
-
const ranges = rangeStr.split(/\|/g).map((i) => i.trim());
|
|
3997
|
-
code = code.trimEnd();
|
|
3998
|
-
options = options.trim() || "{}";
|
|
3999
|
-
return `<KaTexBlockWrapper v-bind="${options}" :ranges='${JSON.stringify(ranges)}'>
|
|
4000
|
-
|
|
4001
|
-
$$
|
|
4002
|
-
${code}
|
|
4003
|
-
$$
|
|
4004
|
-
</KaTexBlockWrapper>
|
|
4005
|
-
`;
|
|
4006
|
-
});
|
|
4007
|
-
}
|
|
4008
|
-
function transformMarkdownMonaco(md2) {
|
|
4009
|
-
md2 = md2.replace(/^```(\w+?)\s*{monaco-diff}\s*?({.*?})?\s*?\n([\s\S]+?)^~~~\s*?\n([\s\S]+?)^```/mg, (full, lang = "ts", options = "{}", code, diff) => {
|
|
4010
|
-
lang = lang.trim();
|
|
4011
|
-
options = options.trim() || "{}";
|
|
4012
|
-
const encoded = base64.encode(code, true);
|
|
4013
|
-
const encodedDiff = base64.encode(diff, true);
|
|
4014
|
-
return `<Monaco :code="'${encoded}'" :diff="'${encodedDiff}'" lang="${lang}" v-bind="${options}" />`;
|
|
4015
|
-
});
|
|
4016
|
-
md2 = md2.replace(/^```(\w+?)\s*{monaco}\s*?({.*?})?\s*?\n([\s\S]+?)^```/mg, (full, lang = "ts", options = "{}", code) => {
|
|
4017
|
-
lang = lang.trim();
|
|
4018
|
-
options = options.trim() || "{}";
|
|
4019
|
-
const encoded = base64.encode(code, true);
|
|
4020
|
-
return `<Monaco :code="'${encoded}'" lang="${lang}" v-bind="${options}" />`;
|
|
4021
|
-
});
|
|
4022
|
-
return md2;
|
|
4023
|
-
}
|
|
4024
|
-
function truncateMancoMark(md2) {
|
|
4025
|
-
return md2.replace(/{monaco.*?}/g, "");
|
|
4026
|
-
}
|
|
4027
|
-
function transformSlotSugar(md2) {
|
|
4028
|
-
const lines = md2.split(/\r?\n/g);
|
|
4029
|
-
let prevSlot = false;
|
|
4030
|
-
const { isLineInsideCodeblocks } = getCodeBlocks(md2);
|
|
4031
|
-
lines.forEach((line, idx) => {
|
|
4032
|
-
if (isLineInsideCodeblocks(idx))
|
|
4033
|
-
return;
|
|
4034
|
-
const match = line.trimEnd().match(/^::\s*([\w\.\-\:]+)\s*::$/);
|
|
4035
|
-
if (match) {
|
|
4036
|
-
lines[idx] = `${prevSlot ? "\n\n</template>\n" : "\n"}<template v-slot:${match[1]}="slotProps">
|
|
4037
|
-
`;
|
|
4038
|
-
prevSlot = true;
|
|
4039
|
-
}
|
|
4040
|
-
});
|
|
4041
|
-
if (prevSlot)
|
|
4042
|
-
lines[lines.length - 1] += "\n\n</template>";
|
|
4043
|
-
return lines.join("\n");
|
|
4044
|
-
}
|
|
4045
|
-
function transformHighlighter(md2) {
|
|
4046
|
-
return md2.replace(/^```(\w+?)(?:\s*{([\d\w*,\|-]+)}\s*?({.*?})?(.*?))?\n([\s\S]+?)^```/mg, (full, lang = "", rangeStr = "", options = "", attrs = "", code) => {
|
|
4047
|
-
const ranges = rangeStr.split(/\|/g).map((i) => i.trim());
|
|
4048
|
-
code = code.trimEnd();
|
|
4049
|
-
options = options.trim() || "{}";
|
|
4050
|
-
return `
|
|
4051
|
-
<CodeBlockWrapper v-bind="${options}" :ranges='${JSON.stringify(ranges)}'>
|
|
4052
|
-
|
|
4053
|
-
\`\`\`${lang}${attrs}
|
|
4054
|
-
${code}
|
|
4055
|
-
\`\`\`
|
|
4056
|
-
|
|
4057
|
-
</CodeBlockWrapper>`;
|
|
4058
|
-
});
|
|
4059
|
-
}
|
|
4060
|
-
function getCodeBlocks(md2) {
|
|
4061
|
-
const codeblocks = Array.from(md2.matchAll(/^```[\s\S]*?^```/mg)).map((m) => {
|
|
4062
|
-
const start = m.index;
|
|
4063
|
-
const end = m.index + m[0].length;
|
|
4064
|
-
const startLine = md2.slice(0, start).match(/\n/g)?.length || 0;
|
|
4065
|
-
const endLine = md2.slice(0, end).match(/\n/g)?.length || 0;
|
|
4066
|
-
return [start, end, startLine, endLine];
|
|
4067
|
-
});
|
|
4068
|
-
return {
|
|
4069
|
-
codeblocks,
|
|
4070
|
-
isInsideCodeblocks(idx) {
|
|
4071
|
-
return codeblocks.some(([s, e]) => s <= idx && idx <= e);
|
|
4072
|
-
},
|
|
4073
|
-
isLineInsideCodeblocks(line) {
|
|
4074
|
-
return codeblocks.some(([, , s, e]) => s <= line && line <= e);
|
|
4075
|
-
}
|
|
4076
|
-
};
|
|
4077
|
-
}
|
|
4078
|
-
function transformPageCSS(md2, id) {
|
|
4079
|
-
const page = id.match(/(\d+)\.md$/)?.[1];
|
|
4080
|
-
if (!page)
|
|
4081
|
-
return md2;
|
|
4082
|
-
const { isInsideCodeblocks } = getCodeBlocks(md2);
|
|
4083
|
-
const result = md2.replace(
|
|
4084
|
-
/(\n<style[^>]*?>)([\s\S]+?)(<\/style>)/g,
|
|
4085
|
-
(full, start, css, end, index) => {
|
|
4086
|
-
if (index < 0 || isInsideCodeblocks(index))
|
|
4087
|
-
return full;
|
|
4088
|
-
if (!start.includes("scoped"))
|
|
4089
|
-
start = start.replace("<style", "<style scoped");
|
|
4090
|
-
return `${start}
|
|
4091
|
-
${css}${end}`;
|
|
4092
|
-
}
|
|
4093
|
-
);
|
|
4094
|
-
return result;
|
|
4095
|
-
}
|
|
4096
|
-
function transformMermaid(md2) {
|
|
4097
|
-
return md2.replace(/^```mermaid\s*?({.*?})?\n([\s\S]+?)\n```/mg, (full, options = "", code = "") => {
|
|
4098
|
-
code = code.trim();
|
|
4099
|
-
options = options.trim() || "{}";
|
|
4100
|
-
const encoded = base64.encode(code, true);
|
|
4101
|
-
return `<Mermaid :code="'${encoded}'" v-bind="${options}" />`;
|
|
4102
|
-
});
|
|
4103
|
-
}
|
|
4104
|
-
function transformPlantUml(md2, server) {
|
|
4105
|
-
return md2.replace(/^```plantuml\s*?({.*?})?\n([\s\S]+?)\n```/mg, (full, options = "", content = "") => {
|
|
4106
|
-
const code = encode2(content.trim());
|
|
4107
|
-
options = options.trim() || "{}";
|
|
4108
|
-
return `<PlantUml :code="'${code}'" :server="'${server}'" v-bind="${options}" />`;
|
|
4109
|
-
});
|
|
4110
|
-
}
|
|
4111
|
-
function escapeVueInCode(md2) {
|
|
4112
|
-
return md2.replace(/{{/g, "{{");
|
|
4113
|
-
}
|
|
4114
|
-
async function loadShikiSetups(clientRoot, roots) {
|
|
4115
|
-
const result = await loadSetups(
|
|
4116
|
-
clientRoot,
|
|
4117
|
-
roots,
|
|
4118
|
-
"shiki.ts",
|
|
4119
|
-
{
|
|
4120
|
-
/** @deprecated */
|
|
4121
|
-
async loadTheme(path2) {
|
|
4122
|
-
console.warn("[slidev] `loadTheme` in `setup/shiki.ts` is deprecated. Pass directly the theme name it's supported by Shiki. For custom themes, load it manually via `JSON.parse(fs.readFileSync(path, 'utf-8'))` and pass the raw JSON object instead.");
|
|
4123
|
-
return JSON.parse(await fs6.readFile(path2, "utf-8"));
|
|
4124
|
-
}
|
|
4125
|
-
},
|
|
4126
|
-
{},
|
|
4127
|
-
false
|
|
4128
|
-
);
|
|
4129
|
-
if ("theme" in result && "themes" in result)
|
|
4130
|
-
delete result.theme;
|
|
4131
|
-
if (result.theme && typeof result.theme !== "string" && !result.theme.name && !result.theme.tokenColors) {
|
|
4132
|
-
result.themes = result.theme;
|
|
4133
|
-
delete result.theme;
|
|
4134
|
-
}
|
|
4135
|
-
if (!result.theme && !result.themes) {
|
|
4136
|
-
result.themes = {
|
|
4137
|
-
dark: "vitesse-dark",
|
|
4138
|
-
light: "vitesse-light"
|
|
4139
|
-
};
|
|
4140
|
-
}
|
|
4141
|
-
if (result.themes)
|
|
4142
|
-
result.defaultColor = false;
|
|
4143
|
-
return result;
|
|
4144
|
-
}
|
|
4145
|
-
|
|
4146
|
-
// node/plugins/patchTransform.ts
|
|
4147
|
-
import { objectEntries } from "@antfu/utils";
|
|
4148
|
-
function createFixPlugins(options) {
|
|
4149
|
-
const define = objectEntries(getDefine(options));
|
|
4150
|
-
return [
|
|
4151
|
-
{
|
|
4152
|
-
name: "slidev:flags",
|
|
4153
|
-
enforce: "pre",
|
|
4154
|
-
transform(code, id) {
|
|
4155
|
-
if (id.match(/\.vue($|\?)/)) {
|
|
4156
|
-
const original = code;
|
|
4157
|
-
define.forEach(([from, to]) => {
|
|
4158
|
-
code = code.replace(new RegExp(from, "g"), to);
|
|
4159
|
-
});
|
|
4160
|
-
if (original !== code)
|
|
4161
|
-
return code;
|
|
4162
|
-
}
|
|
4163
|
-
}
|
|
4164
|
-
}
|
|
4165
|
-
];
|
|
4166
|
-
}
|
|
4167
|
-
|
|
4168
|
-
// node/plugins/preset.ts
|
|
4169
|
-
var customElements = /* @__PURE__ */ new Set([
|
|
4170
|
-
// katex
|
|
4171
|
-
"annotation",
|
|
4172
|
-
"math",
|
|
4173
|
-
"menclose",
|
|
4174
|
-
"mfrac",
|
|
4175
|
-
"mglyph",
|
|
4176
|
-
"mi",
|
|
4177
|
-
"mlabeledtr",
|
|
4178
|
-
"mn",
|
|
4179
|
-
"mo",
|
|
4180
|
-
"mover",
|
|
4181
|
-
"mpadded",
|
|
4182
|
-
"mphantom",
|
|
4183
|
-
"mroot",
|
|
4184
|
-
"mrow",
|
|
4185
|
-
"mspace",
|
|
4186
|
-
"msqrt",
|
|
4187
|
-
"mstyle",
|
|
4188
|
-
"msub",
|
|
4189
|
-
"msubsup",
|
|
4190
|
-
"msup",
|
|
4191
|
-
"mtable",
|
|
4192
|
-
"mtd",
|
|
4193
|
-
"mtext",
|
|
4194
|
-
"mtr",
|
|
4195
|
-
"munder",
|
|
4196
|
-
"munderover",
|
|
4197
|
-
"semantics"
|
|
4198
|
-
]);
|
|
4199
|
-
async function ViteSlidevPlugin(options, pluginOptions, serverOptions = {}) {
|
|
4200
|
-
const {
|
|
4201
|
-
vue: vueOptions = {},
|
|
4202
|
-
vuejsx: vuejsxOptions = {},
|
|
4203
|
-
components: componentsOptions = {},
|
|
4204
|
-
icons: iconsOptions = {},
|
|
4205
|
-
remoteAssets: remoteAssetsOptions = {},
|
|
4206
|
-
serverRef: serverRefOptions = {}
|
|
4207
|
-
} = pluginOptions;
|
|
4208
|
-
const {
|
|
4209
|
-
mode,
|
|
4210
|
-
themeRoots,
|
|
4211
|
-
addonRoots,
|
|
4212
|
-
roots,
|
|
4213
|
-
data: { config }
|
|
4214
|
-
} = options;
|
|
4215
|
-
const VuePlugin = Vue({
|
|
4216
|
-
include: [/\.vue$/, /\.md$/],
|
|
4217
|
-
exclude: [],
|
|
4218
|
-
template: {
|
|
4219
|
-
compilerOptions: {
|
|
4220
|
-
isCustomElement(tag) {
|
|
4221
|
-
return customElements.has(tag);
|
|
4222
|
-
}
|
|
4223
|
-
},
|
|
4224
|
-
...vueOptions?.template
|
|
4225
|
-
},
|
|
4226
|
-
...vueOptions
|
|
4227
|
-
});
|
|
4228
|
-
const VueJsxPlugin = VueJsx(vuejsxOptions);
|
|
4229
|
-
const MarkdownPlugin = await createMarkdownPlugin(options, pluginOptions);
|
|
4230
|
-
const drawingData = await loadDrawings(options);
|
|
4231
|
-
const publicRoots = [...themeRoots, ...addonRoots].map((i) => join7(i, "public")).filter(existsSync3);
|
|
4232
|
-
const plugins = [
|
|
4233
|
-
MarkdownPlugin,
|
|
4234
|
-
VueJsxPlugin,
|
|
4235
|
-
VuePlugin,
|
|
4236
|
-
createSlidesLoader(options, pluginOptions, serverOptions),
|
|
4237
|
-
Components({
|
|
4238
|
-
extensions: ["vue", "md", "js", "ts", "jsx", "tsx"],
|
|
4239
|
-
dirs: [
|
|
4240
|
-
join7(options.clientRoot, "builtin"),
|
|
4241
|
-
...roots.map((i) => join7(i, "components")),
|
|
4242
|
-
"src/components",
|
|
4243
|
-
"components",
|
|
4244
|
-
join7(process3.cwd(), "components")
|
|
4245
|
-
],
|
|
4246
|
-
include: [/\.vue$/, /\.vue\?vue/, /\.vue\?v=/, /\.md$/, /\.md\?vue/],
|
|
4247
|
-
exclude: [],
|
|
4248
|
-
resolvers: [
|
|
4249
|
-
IconsResolver({
|
|
4250
|
-
prefix: "",
|
|
4251
|
-
customCollections: Object.keys(iconsOptions.customCollections || [])
|
|
4252
|
-
})
|
|
4253
|
-
],
|
|
4254
|
-
dts: false,
|
|
4255
|
-
...componentsOptions
|
|
4256
|
-
}),
|
|
4257
|
-
Icons({
|
|
4258
|
-
defaultClass: "slidev-icon",
|
|
4259
|
-
collectionsNodeResolvePath: fileURLToPath(import.meta.url),
|
|
4260
|
-
...iconsOptions
|
|
4261
|
-
}),
|
|
4262
|
-
config.remoteAssets === true || config.remoteAssets === mode ? import("vite-plugin-remote-assets").then((r) => r.VitePluginRemoteAssets({
|
|
4263
|
-
rules: [
|
|
4264
|
-
...r.DefaultRules,
|
|
4265
|
-
{
|
|
4266
|
-
match: /\b(https?:\/\/image.unsplash\.com.*?)(?=[`'")\]])/ig,
|
|
4267
|
-
ext: ".png"
|
|
4268
|
-
}
|
|
4269
|
-
],
|
|
4270
|
-
resolveMode: (id) => id.endsWith("index.html") ? "relative" : "@fs",
|
|
4271
|
-
awaitDownload: mode === "build",
|
|
4272
|
-
...remoteAssetsOptions
|
|
4273
|
-
})) : null,
|
|
4274
|
-
ServerRef({
|
|
4275
|
-
debug: process3.env.NODE_ENV === "development",
|
|
4276
|
-
state: {
|
|
4277
|
-
sync: false,
|
|
4278
|
-
nav: {
|
|
4279
|
-
page: 0,
|
|
4280
|
-
clicks: 0
|
|
4281
|
-
},
|
|
4282
|
-
drawings: drawingData,
|
|
4283
|
-
...serverRefOptions.state
|
|
4284
|
-
},
|
|
4285
|
-
onChanged(key, data, patch, timestamp) {
|
|
4286
|
-
serverRefOptions.onChanged && serverRefOptions.onChanged(key, data, patch, timestamp);
|
|
4287
|
-
if (!options.data.config.drawings.persist)
|
|
4288
|
-
return;
|
|
4289
|
-
if (key === "drawings")
|
|
4290
|
-
writeDrawings(options, patch ?? data);
|
|
4291
|
-
}
|
|
4292
|
-
}),
|
|
4293
|
-
createConfigPlugin(options),
|
|
4294
|
-
createClientSetupPlugin(options),
|
|
4295
|
-
createMonacoTypesLoader(),
|
|
4296
|
-
createFixPlugins(options),
|
|
4297
|
-
publicRoots.length ? import("vite-plugin-static-copy").then((r) => r.viteStaticCopy({
|
|
4298
|
-
silent: true,
|
|
4299
|
-
targets: publicRoots.map((r2) => ({
|
|
4300
|
-
src: `${r2}/*`,
|
|
4301
|
-
dest: "theme"
|
|
4302
|
-
}))
|
|
4303
|
-
})) : null,
|
|
4304
|
-
options.inspect ? import("vite-plugin-inspect").then((r) => (r.default || r)({
|
|
4305
|
-
dev: true,
|
|
4306
|
-
build: true
|
|
4307
|
-
})) : null,
|
|
4308
|
-
config.css === "none" ? null : import("./unocss-XALM635U.mjs").then((r) => r.createUnocssPlugin(options, pluginOptions))
|
|
4309
|
-
];
|
|
4310
|
-
return (await Promise.all(plugins)).flat().filter(notNullish2);
|
|
4311
|
-
}
|
|
4312
|
-
|
|
4313
|
-
export {
|
|
4314
|
-
require_semver2 as require_semver,
|
|
4315
|
-
version,
|
|
4316
|
-
checkEngine,
|
|
4317
|
-
getIndexHtml,
|
|
4318
|
-
mergeViteConfigs,
|
|
4319
|
-
ViteSlidevPlugin
|
|
4320
|
-
};
|