vitepress 1.2.2 → 1.2.3
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.
|
@@ -9277,9 +9277,9 @@ class Pattern {
|
|
|
9277
9277
|
globString() {
|
|
9278
9278
|
return (this.#globString =
|
|
9279
9279
|
this.#globString ||
|
|
9280
|
-
(this.#index === 0
|
|
9281
|
-
|
|
9282
|
-
|
|
9280
|
+
(this.#index === 0 ?
|
|
9281
|
+
this.isAbsolute() ?
|
|
9282
|
+
this.#globList[0] + this.#globList.slice(1).join('/')
|
|
9283
9283
|
: this.#globList.join('/')
|
|
9284
9284
|
: this.#globList.slice(this.#index).join('/')));
|
|
9285
9285
|
}
|
|
@@ -9308,8 +9308,8 @@ class Pattern {
|
|
|
9308
9308
|
*/
|
|
9309
9309
|
isUNC() {
|
|
9310
9310
|
const pl = this.#patternList;
|
|
9311
|
-
return this.#isUNC !== undefined
|
|
9312
|
-
|
|
9311
|
+
return this.#isUNC !== undefined ?
|
|
9312
|
+
this.#isUNC
|
|
9313
9313
|
: (this.#isUNC =
|
|
9314
9314
|
this.#platform === 'win32' &&
|
|
9315
9315
|
this.#index === 0 &&
|
|
@@ -9330,8 +9330,8 @@ class Pattern {
|
|
|
9330
9330
|
*/
|
|
9331
9331
|
isDrive() {
|
|
9332
9332
|
const pl = this.#patternList;
|
|
9333
|
-
return this.#isDrive !== undefined
|
|
9334
|
-
|
|
9333
|
+
return this.#isDrive !== undefined ?
|
|
9334
|
+
this.#isDrive
|
|
9335
9335
|
: (this.#isDrive =
|
|
9336
9336
|
this.#platform === 'win32' &&
|
|
9337
9337
|
this.#index === 0 &&
|
|
@@ -9347,8 +9347,8 @@ class Pattern {
|
|
|
9347
9347
|
*/
|
|
9348
9348
|
isAbsolute() {
|
|
9349
9349
|
const pl = this.#patternList;
|
|
9350
|
-
return this.#isAbsolute !== undefined
|
|
9351
|
-
|
|
9350
|
+
return this.#isAbsolute !== undefined ?
|
|
9351
|
+
this.#isAbsolute
|
|
9352
9352
|
: (this.#isAbsolute =
|
|
9353
9353
|
(pl[0] === '' && pl.length > 1) ||
|
|
9354
9354
|
this.isDrive() ||
|
|
@@ -9359,8 +9359,8 @@ class Pattern {
|
|
|
9359
9359
|
*/
|
|
9360
9360
|
root() {
|
|
9361
9361
|
const p = this.#patternList[0];
|
|
9362
|
-
return typeof p === 'string' && this.isAbsolute() && this.#index === 0
|
|
9363
|
-
|
|
9362
|
+
return (typeof p === 'string' && this.isAbsolute() && this.#index === 0) ?
|
|
9363
|
+
p
|
|
9364
9364
|
: '';
|
|
9365
9365
|
}
|
|
9366
9366
|
/**
|
|
@@ -9387,10 +9387,10 @@ class Pattern {
|
|
|
9387
9387
|
// a given path should be ignored.
|
|
9388
9388
|
// Ignoring a path ignores its children if the pattern ends in /**
|
|
9389
9389
|
// Ignores are always parsed in dot:true mode
|
|
9390
|
-
const defaultPlatform$1 = typeof process === 'object' &&
|
|
9390
|
+
const defaultPlatform$1 = (typeof process === 'object' &&
|
|
9391
9391
|
process &&
|
|
9392
|
-
typeof process.platform === 'string'
|
|
9393
|
-
|
|
9392
|
+
typeof process.platform === 'string') ?
|
|
9393
|
+
process.platform
|
|
9394
9394
|
: 'linux';
|
|
9395
9395
|
/**
|
|
9396
9396
|
* Class used to process ignored patterns
|
|
@@ -9400,12 +9400,15 @@ class Ignore {
|
|
|
9400
9400
|
relativeChildren;
|
|
9401
9401
|
absolute;
|
|
9402
9402
|
absoluteChildren;
|
|
9403
|
+
platform;
|
|
9404
|
+
mmopts;
|
|
9403
9405
|
constructor(ignored, { nobrace, nocase, noext, noglobstar, platform = defaultPlatform$1, }) {
|
|
9404
9406
|
this.relative = [];
|
|
9405
9407
|
this.absolute = [];
|
|
9406
9408
|
this.relativeChildren = [];
|
|
9407
9409
|
this.absoluteChildren = [];
|
|
9408
|
-
|
|
9410
|
+
this.platform = platform;
|
|
9411
|
+
this.mmopts = {
|
|
9409
9412
|
dot: true,
|
|
9410
9413
|
nobrace,
|
|
9411
9414
|
nocase,
|
|
@@ -9416,6 +9419,10 @@ class Ignore {
|
|
|
9416
9419
|
nocomment: true,
|
|
9417
9420
|
nonegate: true,
|
|
9418
9421
|
};
|
|
9422
|
+
for (const ign of ignored)
|
|
9423
|
+
this.add(ign);
|
|
9424
|
+
}
|
|
9425
|
+
add(ign) {
|
|
9419
9426
|
// this is a little weird, but it gives us a clean set of optimized
|
|
9420
9427
|
// minimatch matchers, without getting tripped up if one of them
|
|
9421
9428
|
// ends in /** inside a brace section, and it's only inefficient at
|
|
@@ -9428,36 +9435,34 @@ class Ignore {
|
|
|
9428
9435
|
// for absolute-ness.
|
|
9429
9436
|
// Yet another way, Minimatch could take an array of glob strings, and
|
|
9430
9437
|
// a cwd option, and do the right thing.
|
|
9431
|
-
|
|
9432
|
-
|
|
9433
|
-
|
|
9434
|
-
|
|
9435
|
-
|
|
9436
|
-
|
|
9437
|
-
|
|
9438
|
-
|
|
9439
|
-
|
|
9440
|
-
|
|
9441
|
-
|
|
9442
|
-
|
|
9443
|
-
|
|
9444
|
-
|
|
9445
|
-
|
|
9446
|
-
|
|
9447
|
-
|
|
9448
|
-
|
|
9449
|
-
|
|
9450
|
-
|
|
9438
|
+
const mm = new Minimatch(ign, this.mmopts);
|
|
9439
|
+
for (let i = 0; i < mm.set.length; i++) {
|
|
9440
|
+
const parsed = mm.set[i];
|
|
9441
|
+
const globParts = mm.globParts[i];
|
|
9442
|
+
/* c8 ignore start */
|
|
9443
|
+
if (!parsed || !globParts) {
|
|
9444
|
+
throw new Error('invalid pattern object');
|
|
9445
|
+
}
|
|
9446
|
+
// strip off leading ./ portions
|
|
9447
|
+
// https://github.com/isaacs/node-glob/issues/570
|
|
9448
|
+
while (parsed[0] === '.' && globParts[0] === '.') {
|
|
9449
|
+
parsed.shift();
|
|
9450
|
+
globParts.shift();
|
|
9451
|
+
}
|
|
9452
|
+
/* c8 ignore stop */
|
|
9453
|
+
const p = new Pattern(parsed, globParts, 0, this.platform);
|
|
9454
|
+
const m = new Minimatch(p.globString(), this.mmopts);
|
|
9455
|
+
const children = globParts[globParts.length - 1] === '**';
|
|
9456
|
+
const absolute = p.isAbsolute();
|
|
9457
|
+
if (absolute)
|
|
9458
|
+
this.absolute.push(m);
|
|
9459
|
+
else
|
|
9460
|
+
this.relative.push(m);
|
|
9461
|
+
if (children) {
|
|
9451
9462
|
if (absolute)
|
|
9452
|
-
this.
|
|
9463
|
+
this.absoluteChildren.push(m);
|
|
9453
9464
|
else
|
|
9454
|
-
this.
|
|
9455
|
-
if (children) {
|
|
9456
|
-
if (absolute)
|
|
9457
|
-
this.absoluteChildren.push(m);
|
|
9458
|
-
else
|
|
9459
|
-
this.relativeChildren.push(m);
|
|
9460
|
-
}
|
|
9465
|
+
this.relativeChildren.push(m);
|
|
9461
9466
|
}
|
|
9462
9467
|
}
|
|
9463
9468
|
}
|
|
@@ -9589,9 +9594,8 @@ class Processor {
|
|
|
9589
9594
|
this.opts = opts;
|
|
9590
9595
|
this.follow = !!opts.follow;
|
|
9591
9596
|
this.dot = !!opts.dot;
|
|
9592
|
-
this.hasWalkedCache =
|
|
9593
|
-
? hasWalkedCache.copy()
|
|
9594
|
-
: new HasWalkedCache();
|
|
9597
|
+
this.hasWalkedCache =
|
|
9598
|
+
hasWalkedCache ? hasWalkedCache.copy() : new HasWalkedCache();
|
|
9595
9599
|
}
|
|
9596
9600
|
processPatterns(target, patterns) {
|
|
9597
9601
|
this.patterns = patterns;
|
|
@@ -9604,8 +9608,8 @@ class Processor {
|
|
|
9604
9608
|
const absolute = pattern.isAbsolute() && this.opts.absolute !== false;
|
|
9605
9609
|
// start absolute patterns at root
|
|
9606
9610
|
if (root) {
|
|
9607
|
-
t = t.resolve(root === '/' && this.opts.root !== undefined
|
|
9608
|
-
|
|
9611
|
+
t = t.resolve(root === '/' && this.opts.root !== undefined ?
|
|
9612
|
+
this.opts.root
|
|
9609
9613
|
: root);
|
|
9610
9614
|
const rest = pattern.rest();
|
|
9611
9615
|
if (!rest) {
|
|
@@ -9791,10 +9795,8 @@ class Processor {
|
|
|
9791
9795
|
*
|
|
9792
9796
|
* @module
|
|
9793
9797
|
*/
|
|
9794
|
-
const makeIgnore = (ignore, opts) => typeof ignore === 'string'
|
|
9795
|
-
? new Ignore(
|
|
9796
|
-
: Array.isArray(ignore)
|
|
9797
|
-
? new Ignore(ignore, opts)
|
|
9798
|
+
const makeIgnore = (ignore, opts) => typeof ignore === 'string' ? new Ignore([ignore], opts)
|
|
9799
|
+
: Array.isArray(ignore) ? new Ignore(ignore, opts)
|
|
9798
9800
|
: ignore;
|
|
9799
9801
|
/**
|
|
9800
9802
|
* basic walking utilities that all the glob walker types use
|
|
@@ -9811,13 +9813,20 @@ class GlobUtil {
|
|
|
9811
9813
|
#sep;
|
|
9812
9814
|
signal;
|
|
9813
9815
|
maxDepth;
|
|
9816
|
+
includeChildMatches;
|
|
9814
9817
|
constructor(patterns, path, opts) {
|
|
9815
9818
|
this.patterns = patterns;
|
|
9816
9819
|
this.path = path;
|
|
9817
9820
|
this.opts = opts;
|
|
9818
9821
|
this.#sep = !opts.posix && opts.platform === 'win32' ? '\\' : '/';
|
|
9819
|
-
|
|
9820
|
-
|
|
9822
|
+
this.includeChildMatches = opts.includeChildMatches !== false;
|
|
9823
|
+
if (opts.ignore || !this.includeChildMatches) {
|
|
9824
|
+
this.#ignore = makeIgnore(opts.ignore ?? [], opts);
|
|
9825
|
+
if (!this.includeChildMatches &&
|
|
9826
|
+
typeof this.#ignore.add !== 'function') {
|
|
9827
|
+
const m = 'cannot ignore child matches, ignore lacks add() method.';
|
|
9828
|
+
throw new Error(m);
|
|
9829
|
+
}
|
|
9821
9830
|
}
|
|
9822
9831
|
// ignore, always set with maxDepth, but it's optional on the
|
|
9823
9832
|
// GlobOptions type
|
|
@@ -9889,7 +9898,7 @@ class GlobUtil {
|
|
|
9889
9898
|
return this.matchCheckTest(s, ifDir);
|
|
9890
9899
|
}
|
|
9891
9900
|
matchCheckTest(e, ifDir) {
|
|
9892
|
-
return e &&
|
|
9901
|
+
return (e &&
|
|
9893
9902
|
(this.maxDepth === Infinity || e.depth() <= this.maxDepth) &&
|
|
9894
9903
|
(!ifDir || e.canReaddir()) &&
|
|
9895
9904
|
(!this.opts.nodir || !e.isDirectory()) &&
|
|
@@ -9897,8 +9906,8 @@ class GlobUtil {
|
|
|
9897
9906
|
!this.opts.follow ||
|
|
9898
9907
|
!e.isSymbolicLink() ||
|
|
9899
9908
|
!e.realpathCached()?.isDirectory()) &&
|
|
9900
|
-
!this.#ignored(e)
|
|
9901
|
-
|
|
9909
|
+
!this.#ignored(e)) ?
|
|
9910
|
+
e
|
|
9902
9911
|
: undefined;
|
|
9903
9912
|
}
|
|
9904
9913
|
matchCheckSync(e, ifDir) {
|
|
@@ -9924,6 +9933,11 @@ class GlobUtil {
|
|
|
9924
9933
|
matchFinish(e, absolute) {
|
|
9925
9934
|
if (this.#ignored(e))
|
|
9926
9935
|
return;
|
|
9936
|
+
// we know we have an ignore if this is false, but TS doesn't
|
|
9937
|
+
if (!this.includeChildMatches && this.#ignore?.add) {
|
|
9938
|
+
const ign = `${e.relativePosix()}/**`;
|
|
9939
|
+
this.#ignore.add(ign);
|
|
9940
|
+
}
|
|
9927
9941
|
const abs = this.opts.absolute === undefined ? absolute : this.opts.absolute;
|
|
9928
9942
|
this.seen.add(e);
|
|
9929
9943
|
const mark = this.opts.mark && e.isDirectory() ? this.#sep : '';
|
|
@@ -9937,8 +9951,8 @@ class GlobUtil {
|
|
|
9937
9951
|
}
|
|
9938
9952
|
else {
|
|
9939
9953
|
const rel = this.opts.posix ? e.relativePosix() : e.relative();
|
|
9940
|
-
const pre = this.opts.dotRelative && !rel.startsWith('..' + this.#sep)
|
|
9941
|
-
|
|
9954
|
+
const pre = this.opts.dotRelative && !rel.startsWith('..' + this.#sep) ?
|
|
9955
|
+
'.' + this.#sep
|
|
9942
9956
|
: '';
|
|
9943
9957
|
this.matchEmit(!rel ? '.' + mark : pre + rel + mark);
|
|
9944
9958
|
}
|
|
@@ -10077,10 +10091,9 @@ class GlobUtil {
|
|
|
10077
10091
|
}
|
|
10078
10092
|
}
|
|
10079
10093
|
class GlobWalker extends GlobUtil {
|
|
10080
|
-
matches;
|
|
10094
|
+
matches = new Set();
|
|
10081
10095
|
constructor(patterns, path, opts) {
|
|
10082
10096
|
super(patterns, path, opts);
|
|
10083
|
-
this.matches = new Set();
|
|
10084
10097
|
}
|
|
10085
10098
|
matchEmit(e) {
|
|
10086
10099
|
this.matches.add(e);
|
|
@@ -10156,10 +10169,10 @@ class GlobStream extends GlobUtil {
|
|
|
10156
10169
|
|
|
10157
10170
|
// if no process global, just call it linux.
|
|
10158
10171
|
// so we default to case-sensitive, / separators
|
|
10159
|
-
const defaultPlatform = typeof process === 'object' &&
|
|
10172
|
+
const defaultPlatform = (typeof process === 'object' &&
|
|
10160
10173
|
process &&
|
|
10161
|
-
typeof process.platform === 'string'
|
|
10162
|
-
|
|
10174
|
+
typeof process.platform === 'string') ?
|
|
10175
|
+
process.platform
|
|
10163
10176
|
: 'linux';
|
|
10164
10177
|
/**
|
|
10165
10178
|
* An object that can perform glob pattern traversals.
|
|
@@ -10189,6 +10202,7 @@ class Glob {
|
|
|
10189
10202
|
signal;
|
|
10190
10203
|
windowsPathsNoEscape;
|
|
10191
10204
|
withFileTypes;
|
|
10205
|
+
includeChildMatches;
|
|
10192
10206
|
/**
|
|
10193
10207
|
* The options provided to the constructor.
|
|
10194
10208
|
*/
|
|
@@ -10234,6 +10248,7 @@ class Glob {
|
|
|
10234
10248
|
this.noext = !!opts.noext;
|
|
10235
10249
|
this.realpath = !!opts.realpath;
|
|
10236
10250
|
this.absolute = opts.absolute;
|
|
10251
|
+
this.includeChildMatches = opts.includeChildMatches !== false;
|
|
10237
10252
|
this.noglobstar = !!opts.noglobstar;
|
|
10238
10253
|
this.matchBase = !!opts.matchBase;
|
|
10239
10254
|
this.maxDepth =
|
|
@@ -10248,7 +10263,8 @@ class Glob {
|
|
|
10248
10263
|
}
|
|
10249
10264
|
this.windowsPathsNoEscape =
|
|
10250
10265
|
!!opts.windowsPathsNoEscape ||
|
|
10251
|
-
opts.allowWindowsEscape ===
|
|
10266
|
+
opts.allowWindowsEscape ===
|
|
10267
|
+
false;
|
|
10252
10268
|
if (this.windowsPathsNoEscape) {
|
|
10253
10269
|
pattern = pattern.map(p => p.replace(/\\/g, '/'));
|
|
10254
10270
|
}
|
|
@@ -10269,12 +10285,9 @@ class Glob {
|
|
|
10269
10285
|
}
|
|
10270
10286
|
}
|
|
10271
10287
|
else {
|
|
10272
|
-
const Scurry = opts.platform === 'win32'
|
|
10273
|
-
?
|
|
10274
|
-
|
|
10275
|
-
? PathScurryDarwin
|
|
10276
|
-
: opts.platform
|
|
10277
|
-
? PathScurryPosix
|
|
10288
|
+
const Scurry = opts.platform === 'win32' ? PathScurryWin32
|
|
10289
|
+
: opts.platform === 'darwin' ? PathScurryDarwin
|
|
10290
|
+
: opts.platform ? PathScurryPosix
|
|
10278
10291
|
: PathScurry;
|
|
10279
10292
|
this.scurry = new Scurry(this.cwd, {
|
|
10280
10293
|
nocase: opts.nocase,
|
|
@@ -10326,11 +10339,12 @@ class Glob {
|
|
|
10326
10339
|
return [
|
|
10327
10340
|
...(await new GlobWalker(this.patterns, this.scurry.cwd, {
|
|
10328
10341
|
...this.opts,
|
|
10329
|
-
maxDepth: this.maxDepth !== Infinity
|
|
10330
|
-
|
|
10342
|
+
maxDepth: this.maxDepth !== Infinity ?
|
|
10343
|
+
this.maxDepth + this.scurry.cwd.depth()
|
|
10331
10344
|
: Infinity,
|
|
10332
10345
|
platform: this.platform,
|
|
10333
10346
|
nocase: this.nocase,
|
|
10347
|
+
includeChildMatches: this.includeChildMatches,
|
|
10334
10348
|
}).walk()),
|
|
10335
10349
|
];
|
|
10336
10350
|
}
|
|
@@ -10338,32 +10352,35 @@ class Glob {
|
|
|
10338
10352
|
return [
|
|
10339
10353
|
...new GlobWalker(this.patterns, this.scurry.cwd, {
|
|
10340
10354
|
...this.opts,
|
|
10341
|
-
maxDepth: this.maxDepth !== Infinity
|
|
10342
|
-
|
|
10355
|
+
maxDepth: this.maxDepth !== Infinity ?
|
|
10356
|
+
this.maxDepth + this.scurry.cwd.depth()
|
|
10343
10357
|
: Infinity,
|
|
10344
10358
|
platform: this.platform,
|
|
10345
10359
|
nocase: this.nocase,
|
|
10360
|
+
includeChildMatches: this.includeChildMatches,
|
|
10346
10361
|
}).walkSync(),
|
|
10347
10362
|
];
|
|
10348
10363
|
}
|
|
10349
10364
|
stream() {
|
|
10350
10365
|
return new GlobStream(this.patterns, this.scurry.cwd, {
|
|
10351
10366
|
...this.opts,
|
|
10352
|
-
maxDepth: this.maxDepth !== Infinity
|
|
10353
|
-
|
|
10367
|
+
maxDepth: this.maxDepth !== Infinity ?
|
|
10368
|
+
this.maxDepth + this.scurry.cwd.depth()
|
|
10354
10369
|
: Infinity,
|
|
10355
10370
|
platform: this.platform,
|
|
10356
10371
|
nocase: this.nocase,
|
|
10372
|
+
includeChildMatches: this.includeChildMatches,
|
|
10357
10373
|
}).stream();
|
|
10358
10374
|
}
|
|
10359
10375
|
streamSync() {
|
|
10360
10376
|
return new GlobStream(this.patterns, this.scurry.cwd, {
|
|
10361
10377
|
...this.opts,
|
|
10362
|
-
maxDepth: this.maxDepth !== Infinity
|
|
10363
|
-
|
|
10378
|
+
maxDepth: this.maxDepth !== Infinity ?
|
|
10379
|
+
this.maxDepth + this.scurry.cwd.depth()
|
|
10364
10380
|
: Infinity,
|
|
10365
10381
|
platform: this.platform,
|
|
10366
10382
|
nocase: this.nocase,
|
|
10383
|
+
includeChildMatches: this.includeChildMatches,
|
|
10367
10384
|
}).streamSync();
|
|
10368
10385
|
}
|
|
10369
10386
|
/**
|
|
@@ -10439,7 +10456,6 @@ const sync$9 = Object.assign(globSync, {
|
|
|
10439
10456
|
stream: globStreamSync,
|
|
10440
10457
|
iterate: globIterateSync,
|
|
10441
10458
|
});
|
|
10442
|
-
/* c8 ignore stop */
|
|
10443
10459
|
const glob$1 = Object.assign(glob_, {
|
|
10444
10460
|
glob: glob_,
|
|
10445
10461
|
globSync,
|
|
@@ -12296,11 +12312,11 @@ function requireNode () {
|
|
|
12296
12312
|
}
|
|
12297
12313
|
|
|
12298
12314
|
/**
|
|
12299
|
-
* Invokes `util.
|
|
12315
|
+
* Invokes `util.formatWithOptions()` with the specified arguments and writes to stderr.
|
|
12300
12316
|
*/
|
|
12301
12317
|
|
|
12302
12318
|
function log(...args) {
|
|
12303
|
-
return process.stderr.write(util.
|
|
12319
|
+
return process.stderr.write(util.formatWithOptions(exports.inspectOpts, ...args) + '\n');
|
|
12304
12320
|
}
|
|
12305
12321
|
|
|
12306
12322
|
/**
|
|
@@ -12888,7 +12904,7 @@ var utils$r = {};
|
|
|
12888
12904
|
*/
|
|
12889
12905
|
|
|
12890
12906
|
exports.escapeNode = (block, n = 0, type) => {
|
|
12891
|
-
|
|
12907
|
+
const node = block.nodes[n];
|
|
12892
12908
|
if (!node) return;
|
|
12893
12909
|
|
|
12894
12910
|
if ((type && node.type === type) || node.type === 'open' || node.type === 'close') {
|
|
@@ -12957,13 +12973,23 @@ var utils$r = {};
|
|
|
12957
12973
|
|
|
12958
12974
|
exports.flatten = (...args) => {
|
|
12959
12975
|
const result = [];
|
|
12976
|
+
|
|
12960
12977
|
const flat = arr => {
|
|
12961
12978
|
for (let i = 0; i < arr.length; i++) {
|
|
12962
|
-
|
|
12963
|
-
|
|
12979
|
+
const ele = arr[i];
|
|
12980
|
+
|
|
12981
|
+
if (Array.isArray(ele)) {
|
|
12982
|
+
flat(ele);
|
|
12983
|
+
continue;
|
|
12984
|
+
}
|
|
12985
|
+
|
|
12986
|
+
if (ele !== undefined) {
|
|
12987
|
+
result.push(ele);
|
|
12988
|
+
}
|
|
12964
12989
|
}
|
|
12965
12990
|
return result;
|
|
12966
12991
|
};
|
|
12992
|
+
|
|
12967
12993
|
flat(args);
|
|
12968
12994
|
return result;
|
|
12969
12995
|
};
|
|
@@ -12972,9 +12998,9 @@ var utils$r = {};
|
|
|
12972
12998
|
const utils$q = utils$r;
|
|
12973
12999
|
|
|
12974
13000
|
var stringify$7 = (ast, options = {}) => {
|
|
12975
|
-
|
|
12976
|
-
|
|
12977
|
-
|
|
13001
|
+
const stringify = (node, parent = {}) => {
|
|
13002
|
+
const invalidBlock = options.escapeInvalid && utils$q.isInvalidBrace(parent);
|
|
13003
|
+
const invalidNode = node.invalid === true && options.escapeInvalid === true;
|
|
12978
13004
|
let output = '';
|
|
12979
13005
|
|
|
12980
13006
|
if (node.value) {
|
|
@@ -12989,7 +13015,7 @@ var stringify$7 = (ast, options = {}) => {
|
|
|
12989
13015
|
}
|
|
12990
13016
|
|
|
12991
13017
|
if (node.nodes) {
|
|
12992
|
-
for (
|
|
13018
|
+
for (const child of node.nodes) {
|
|
12993
13019
|
output += stringify(child);
|
|
12994
13020
|
}
|
|
12995
13021
|
}
|
|
@@ -13363,7 +13389,7 @@ const toMaxLen = (input, maxLength) => {
|
|
|
13363
13389
|
return negative ? ('-' + input) : input;
|
|
13364
13390
|
};
|
|
13365
13391
|
|
|
13366
|
-
const toSequence = (parts, options) => {
|
|
13392
|
+
const toSequence = (parts, options, maxLen) => {
|
|
13367
13393
|
parts.negatives.sort((a, b) => a < b ? -1 : a > b ? 1 : 0);
|
|
13368
13394
|
parts.positives.sort((a, b) => a < b ? -1 : a > b ? 1 : 0);
|
|
13369
13395
|
|
|
@@ -13373,11 +13399,11 @@ const toSequence = (parts, options) => {
|
|
|
13373
13399
|
let result;
|
|
13374
13400
|
|
|
13375
13401
|
if (parts.positives.length) {
|
|
13376
|
-
positives = parts.positives.join('|');
|
|
13402
|
+
positives = parts.positives.map(v => toMaxLen(String(v), maxLen)).join('|');
|
|
13377
13403
|
}
|
|
13378
13404
|
|
|
13379
13405
|
if (parts.negatives.length) {
|
|
13380
|
-
negatives = `-(${prefix}${parts.negatives.join('|')})`;
|
|
13406
|
+
negatives = `-(${prefix}${parts.negatives.map(v => toMaxLen(String(v), maxLen)).join('|')})`;
|
|
13381
13407
|
}
|
|
13382
13408
|
|
|
13383
13409
|
if (positives && negatives) {
|
|
@@ -13475,7 +13501,7 @@ const fillNumbers = (start, end, step = 1, options = {}) => {
|
|
|
13475
13501
|
|
|
13476
13502
|
if (options.toRegex === true) {
|
|
13477
13503
|
return step > 1
|
|
13478
|
-
? toSequence(parts, options)
|
|
13504
|
+
? toSequence(parts, options, maxLen)
|
|
13479
13505
|
: toRegex(range, null, { wrap: false, ...options });
|
|
13480
13506
|
}
|
|
13481
13507
|
|
|
@@ -13487,7 +13513,6 @@ const fillLetters = (start, end, step = 1, options = {}) => {
|
|
|
13487
13513
|
return invalidRange(start, end, options);
|
|
13488
13514
|
}
|
|
13489
13515
|
|
|
13490
|
-
|
|
13491
13516
|
let format = options.transform || (val => String.fromCharCode(val));
|
|
13492
13517
|
let a = `${start}`.charCodeAt(0);
|
|
13493
13518
|
let b = `${end}`.charCodeAt(0);
|
|
@@ -13555,30 +13580,32 @@ const fill$1 = fillRange;
|
|
|
13555
13580
|
const utils$p = utils$r;
|
|
13556
13581
|
|
|
13557
13582
|
const compile$3 = (ast, options = {}) => {
|
|
13558
|
-
|
|
13559
|
-
|
|
13560
|
-
|
|
13561
|
-
|
|
13562
|
-
|
|
13583
|
+
const walk = (node, parent = {}) => {
|
|
13584
|
+
const invalidBlock = utils$p.isInvalidBrace(parent);
|
|
13585
|
+
const invalidNode = node.invalid === true && options.escapeInvalid === true;
|
|
13586
|
+
const invalid = invalidBlock === true || invalidNode === true;
|
|
13587
|
+
const prefix = options.escapeInvalid === true ? '\\' : '';
|
|
13563
13588
|
let output = '';
|
|
13564
13589
|
|
|
13565
13590
|
if (node.isOpen === true) {
|
|
13566
13591
|
return prefix + node.value;
|
|
13567
13592
|
}
|
|
13593
|
+
|
|
13568
13594
|
if (node.isClose === true) {
|
|
13595
|
+
console.log('node.isClose', prefix, node.value);
|
|
13569
13596
|
return prefix + node.value;
|
|
13570
13597
|
}
|
|
13571
13598
|
|
|
13572
13599
|
if (node.type === 'open') {
|
|
13573
|
-
return invalid ?
|
|
13600
|
+
return invalid ? prefix + node.value : '(';
|
|
13574
13601
|
}
|
|
13575
13602
|
|
|
13576
13603
|
if (node.type === 'close') {
|
|
13577
|
-
return invalid ?
|
|
13604
|
+
return invalid ? prefix + node.value : ')';
|
|
13578
13605
|
}
|
|
13579
13606
|
|
|
13580
13607
|
if (node.type === 'comma') {
|
|
13581
|
-
return node.prev.type === 'comma' ? '' :
|
|
13608
|
+
return node.prev.type === 'comma' ? '' : invalid ? node.value : '|';
|
|
13582
13609
|
}
|
|
13583
13610
|
|
|
13584
13611
|
if (node.value) {
|
|
@@ -13586,8 +13613,8 @@ const compile$3 = (ast, options = {}) => {
|
|
|
13586
13613
|
}
|
|
13587
13614
|
|
|
13588
13615
|
if (node.nodes && node.ranges > 0) {
|
|
13589
|
-
|
|
13590
|
-
|
|
13616
|
+
const args = utils$p.reduce(node.nodes);
|
|
13617
|
+
const range = fill$1(...args, { ...options, wrap: false, toRegex: true, strictZeros: true });
|
|
13591
13618
|
|
|
13592
13619
|
if (range.length !== 0) {
|
|
13593
13620
|
return args.length > 1 && range.length > 1 ? `(${range})` : range;
|
|
@@ -13595,10 +13622,11 @@ const compile$3 = (ast, options = {}) => {
|
|
|
13595
13622
|
}
|
|
13596
13623
|
|
|
13597
13624
|
if (node.nodes) {
|
|
13598
|
-
for (
|
|
13625
|
+
for (const child of node.nodes) {
|
|
13599
13626
|
output += walk(child, node);
|
|
13600
13627
|
}
|
|
13601
13628
|
}
|
|
13629
|
+
|
|
13602
13630
|
return output;
|
|
13603
13631
|
};
|
|
13604
13632
|
|
|
@@ -13612,7 +13640,7 @@ const stringify$5 = stringify$7;
|
|
|
13612
13640
|
const utils$o = utils$r;
|
|
13613
13641
|
|
|
13614
13642
|
const append = (queue = '', stash = '', enclose = false) => {
|
|
13615
|
-
|
|
13643
|
+
const result = [];
|
|
13616
13644
|
|
|
13617
13645
|
queue = [].concat(queue);
|
|
13618
13646
|
stash = [].concat(stash);
|
|
@@ -13622,15 +13650,15 @@ const append = (queue = '', stash = '', enclose = false) => {
|
|
|
13622
13650
|
return enclose ? utils$o.flatten(stash).map(ele => `{${ele}}`) : stash;
|
|
13623
13651
|
}
|
|
13624
13652
|
|
|
13625
|
-
for (
|
|
13653
|
+
for (const item of queue) {
|
|
13626
13654
|
if (Array.isArray(item)) {
|
|
13627
|
-
for (
|
|
13655
|
+
for (const value of item) {
|
|
13628
13656
|
result.push(append(value, stash, enclose));
|
|
13629
13657
|
}
|
|
13630
13658
|
} else {
|
|
13631
13659
|
for (let ele of stash) {
|
|
13632
13660
|
if (enclose === true && typeof ele === 'string') ele = `{${ele}}`;
|
|
13633
|
-
result.push(Array.isArray(ele) ? append(item, ele, enclose) :
|
|
13661
|
+
result.push(Array.isArray(ele) ? append(item, ele, enclose) : item + ele);
|
|
13634
13662
|
}
|
|
13635
13663
|
}
|
|
13636
13664
|
}
|
|
@@ -13638,9 +13666,9 @@ const append = (queue = '', stash = '', enclose = false) => {
|
|
|
13638
13666
|
};
|
|
13639
13667
|
|
|
13640
13668
|
const expand$1 = (ast, options = {}) => {
|
|
13641
|
-
|
|
13669
|
+
const rangeLimit = options.rangeLimit === undefined ? 1000 : options.rangeLimit;
|
|
13642
13670
|
|
|
13643
|
-
|
|
13671
|
+
const walk = (node, parent = {}) => {
|
|
13644
13672
|
node.queue = [];
|
|
13645
13673
|
|
|
13646
13674
|
let p = parent;
|
|
@@ -13662,7 +13690,7 @@ const expand$1 = (ast, options = {}) => {
|
|
|
13662
13690
|
}
|
|
13663
13691
|
|
|
13664
13692
|
if (node.nodes && node.ranges > 0) {
|
|
13665
|
-
|
|
13693
|
+
const args = utils$o.reduce(node.nodes);
|
|
13666
13694
|
|
|
13667
13695
|
if (utils$o.exceedsLimit(...args, options.step, rangeLimit)) {
|
|
13668
13696
|
throw new RangeError('expanded array length exceeds range limit. Use options.rangeLimit to increase or disable the limit.');
|
|
@@ -13678,7 +13706,7 @@ const expand$1 = (ast, options = {}) => {
|
|
|
13678
13706
|
return;
|
|
13679
13707
|
}
|
|
13680
13708
|
|
|
13681
|
-
|
|
13709
|
+
const enclose = utils$o.encloseBrace(node);
|
|
13682
13710
|
let queue = node.queue;
|
|
13683
13711
|
let block = node;
|
|
13684
13712
|
|
|
@@ -13688,7 +13716,7 @@ const expand$1 = (ast, options = {}) => {
|
|
|
13688
13716
|
}
|
|
13689
13717
|
|
|
13690
13718
|
for (let i = 0; i < node.nodes.length; i++) {
|
|
13691
|
-
|
|
13719
|
+
const child = node.nodes[i];
|
|
13692
13720
|
|
|
13693
13721
|
if (child.type === 'comma' && node.type === 'brace') {
|
|
13694
13722
|
if (i === 1) queue.push('');
|
|
@@ -13720,7 +13748,7 @@ const expand$1 = (ast, options = {}) => {
|
|
|
13720
13748
|
var expand_1 = expand$1;
|
|
13721
13749
|
|
|
13722
13750
|
var constants$4 = {
|
|
13723
|
-
MAX_LENGTH:
|
|
13751
|
+
MAX_LENGTH: 10000,
|
|
13724
13752
|
|
|
13725
13753
|
// Digits
|
|
13726
13754
|
CHAR_0: '0', /* 0 */
|
|
@@ -13808,18 +13836,18 @@ const parse$a = (input, options = {}) => {
|
|
|
13808
13836
|
throw new TypeError('Expected a string');
|
|
13809
13837
|
}
|
|
13810
13838
|
|
|
13811
|
-
|
|
13812
|
-
|
|
13839
|
+
const opts = options || {};
|
|
13840
|
+
const max = typeof opts.maxLength === 'number' ? Math.min(MAX_LENGTH$1, opts.maxLength) : MAX_LENGTH$1;
|
|
13813
13841
|
if (input.length > max) {
|
|
13814
13842
|
throw new SyntaxError(`Input length (${input.length}), exceeds max characters (${max})`);
|
|
13815
13843
|
}
|
|
13816
13844
|
|
|
13817
|
-
|
|
13818
|
-
|
|
13845
|
+
const ast = { type: 'root', input, nodes: [] };
|
|
13846
|
+
const stack = [ast];
|
|
13819
13847
|
let block = ast;
|
|
13820
13848
|
let prev = ast;
|
|
13821
13849
|
let brackets = 0;
|
|
13822
|
-
|
|
13850
|
+
const length = input.length;
|
|
13823
13851
|
let index = 0;
|
|
13824
13852
|
let depth = 0;
|
|
13825
13853
|
let value;
|
|
@@ -13884,6 +13912,7 @@ const parse$a = (input, options = {}) => {
|
|
|
13884
13912
|
|
|
13885
13913
|
if (value === CHAR_LEFT_SQUARE_BRACKET$2) {
|
|
13886
13914
|
brackets++;
|
|
13915
|
+
|
|
13887
13916
|
let next;
|
|
13888
13917
|
|
|
13889
13918
|
while (index < length && (next = advance())) {
|
|
@@ -13939,7 +13968,7 @@ const parse$a = (input, options = {}) => {
|
|
|
13939
13968
|
*/
|
|
13940
13969
|
|
|
13941
13970
|
if (value === CHAR_DOUBLE_QUOTE$1 || value === CHAR_SINGLE_QUOTE$1 || value === CHAR_BACKTICK) {
|
|
13942
|
-
|
|
13971
|
+
const open = value;
|
|
13943
13972
|
let next;
|
|
13944
13973
|
|
|
13945
13974
|
if (options.keepQuotes !== true) {
|
|
@@ -13971,8 +14000,8 @@ const parse$a = (input, options = {}) => {
|
|
|
13971
14000
|
if (value === CHAR_LEFT_CURLY_BRACE$1) {
|
|
13972
14001
|
depth++;
|
|
13973
14002
|
|
|
13974
|
-
|
|
13975
|
-
|
|
14003
|
+
const dollar = prev.value && prev.value.slice(-1) === '$' || block.dollar === true;
|
|
14004
|
+
const brace = {
|
|
13976
14005
|
type: 'brace',
|
|
13977
14006
|
open: true,
|
|
13978
14007
|
close: false,
|
|
@@ -13999,7 +14028,7 @@ const parse$a = (input, options = {}) => {
|
|
|
13999
14028
|
continue;
|
|
14000
14029
|
}
|
|
14001
14030
|
|
|
14002
|
-
|
|
14031
|
+
const type = 'close';
|
|
14003
14032
|
block = stack.pop();
|
|
14004
14033
|
block.close = true;
|
|
14005
14034
|
|
|
@@ -14017,7 +14046,7 @@ const parse$a = (input, options = {}) => {
|
|
|
14017
14046
|
if (value === CHAR_COMMA$2 && depth > 0) {
|
|
14018
14047
|
if (block.ranges > 0) {
|
|
14019
14048
|
block.ranges = 0;
|
|
14020
|
-
|
|
14049
|
+
const open = block.nodes.shift();
|
|
14021
14050
|
block.nodes = [open, { type: 'text', value: stringify$4(block) }];
|
|
14022
14051
|
}
|
|
14023
14052
|
|
|
@@ -14031,7 +14060,7 @@ const parse$a = (input, options = {}) => {
|
|
|
14031
14060
|
*/
|
|
14032
14061
|
|
|
14033
14062
|
if (value === CHAR_DOT$1 && depth > 0 && block.commas === 0) {
|
|
14034
|
-
|
|
14063
|
+
const siblings = block.nodes;
|
|
14035
14064
|
|
|
14036
14065
|
if (depth === 0 || siblings.length === 0) {
|
|
14037
14066
|
push({ type: 'text', value });
|
|
@@ -14058,7 +14087,7 @@ const parse$a = (input, options = {}) => {
|
|
|
14058
14087
|
if (prev.type === 'range') {
|
|
14059
14088
|
siblings.pop();
|
|
14060
14089
|
|
|
14061
|
-
|
|
14090
|
+
const before = siblings[siblings.length - 1];
|
|
14062
14091
|
before.value += prev.value + value;
|
|
14063
14092
|
prev = before;
|
|
14064
14093
|
block.ranges--;
|
|
@@ -14091,8 +14120,8 @@ const parse$a = (input, options = {}) => {
|
|
|
14091
14120
|
});
|
|
14092
14121
|
|
|
14093
14122
|
// get the location of the block on parent.nodes (block's siblings)
|
|
14094
|
-
|
|
14095
|
-
|
|
14123
|
+
const parent = stack[stack.length - 1];
|
|
14124
|
+
const index = parent.nodes.indexOf(block);
|
|
14096
14125
|
// replace the (invalid) block with it's nodes
|
|
14097
14126
|
parent.nodes.splice(index, 1, ...block.nodes);
|
|
14098
14127
|
}
|
|
@@ -14127,8 +14156,8 @@ const braces$1 = (input, options = {}) => {
|
|
|
14127
14156
|
let output = [];
|
|
14128
14157
|
|
|
14129
14158
|
if (Array.isArray(input)) {
|
|
14130
|
-
for (
|
|
14131
|
-
|
|
14159
|
+
for (const pattern of input) {
|
|
14160
|
+
const result = braces$1.create(pattern, options);
|
|
14132
14161
|
if (Array.isArray(result)) {
|
|
14133
14162
|
output.push(...result);
|
|
14134
14163
|
} else {
|
|
@@ -14262,7 +14291,7 @@ braces$1.create = (input, options = {}) => {
|
|
|
14262
14291
|
return [input];
|
|
14263
14292
|
}
|
|
14264
14293
|
|
|
14265
|
-
|
|
14294
|
+
return options.expand !== true
|
|
14266
14295
|
? braces$1.compile(input, options)
|
|
14267
14296
|
: braces$1.expand(input, options);
|
|
14268
14297
|
};
|
|
@@ -37529,6 +37558,9 @@ const createMarkdownRenderer = async (srcDir, options = {}, base = "/", logger =
|
|
|
37529
37558
|
{ target: "_blank", rel: "noreferrer", ...options.externalLinks },
|
|
37530
37559
|
base
|
|
37531
37560
|
).use(lineNumberPlugin, options.lineNumbers);
|
|
37561
|
+
md.renderer.rules.table_open = function(tokens, idx, options2, env, self) {
|
|
37562
|
+
return '<table tabindex="0">\n';
|
|
37563
|
+
};
|
|
37532
37564
|
if (options.gfmAlerts !== false) {
|
|
37533
37565
|
md.use(gitHubAlertsPlugin);
|
|
37534
37566
|
}
|
|
@@ -37574,6 +37606,13 @@ const createMarkdownRenderer = async (srcDir, options = {}, base = "/", logger =
|
|
|
37574
37606
|
md.use(mathPlugin.default ?? mathPlugin, {
|
|
37575
37607
|
...typeof options.math === "boolean" ? {} : options.math
|
|
37576
37608
|
});
|
|
37609
|
+
const orig = md.renderer.rules.math_block;
|
|
37610
|
+
md.renderer.rules.math_block = (tokens, idx, options2, env, self) => {
|
|
37611
|
+
return orig(tokens, idx, options2, env, self).replace(
|
|
37612
|
+
/^<mjx-container /,
|
|
37613
|
+
'<mjx-container tabindex="0" '
|
|
37614
|
+
);
|
|
37615
|
+
};
|
|
37577
37616
|
} catch (error) {
|
|
37578
37617
|
throw new Error(
|
|
37579
37618
|
"You need to install `markdown-it-mathjax3` to use math support."
|
|
@@ -42283,7 +42322,7 @@ async function createVitePressPlugin(siteConfig, ssr = false, pageToHashMap, cli
|
|
|
42283
42322
|
let isCustomElement = userCustomElementChecker;
|
|
42284
42323
|
if (markdown?.math) {
|
|
42285
42324
|
isCustomElement = (tag) => {
|
|
42286
|
-
if (
|
|
42325
|
+
if (tag.startsWith("mjx-")) {
|
|
42287
42326
|
return true;
|
|
42288
42327
|
}
|
|
42289
42328
|
return userCustomElementChecker?.(tag) ?? false;
|
|
@@ -43853,8 +43892,12 @@ utils.normalizeURL = normalizeURL;
|
|
|
43853
43892
|
this.hasHeadOutput = true;
|
|
43854
43893
|
this.push(getURLSetNs(this.xmlNS, this.xslUrl));
|
|
43855
43894
|
}
|
|
43856
|
-
this.smiStream.write((0, utils_1.validateSMIOptions)((0, utils_1.normalizeURL)(item, this.hostname, this.lastmodDateOnly), this.level, this.errorHandler))
|
|
43857
|
-
|
|
43895
|
+
if (!this.smiStream.write((0, utils_1.validateSMIOptions)((0, utils_1.normalizeURL)(item, this.hostname, this.lastmodDateOnly), this.level, this.errorHandler))) {
|
|
43896
|
+
this.smiStream.once('drain', callback);
|
|
43897
|
+
}
|
|
43898
|
+
else {
|
|
43899
|
+
process.nextTick(callback);
|
|
43900
|
+
}
|
|
43858
43901
|
}
|
|
43859
43902
|
_flush(cb) {
|
|
43860
43903
|
if (!this.hasHeadOutput) {
|
|
@@ -43868,19 +43911,31 @@ utils.normalizeURL = normalizeURL;
|
|
|
43868
43911
|
}
|
|
43869
43912
|
exports.SitemapStream = SitemapStream;
|
|
43870
43913
|
/**
|
|
43871
|
-
*
|
|
43872
|
-
*
|
|
43914
|
+
* Converts a readable stream into a promise that resolves with the concatenated data from the stream.
|
|
43915
|
+
*
|
|
43916
|
+
* The function listens for 'data' events from the stream, and when the stream ends, it resolves the promise with the concatenated data. If an error occurs while reading from the stream, the promise is rejected with the error.
|
|
43917
|
+
*
|
|
43918
|
+
* ⚠️ CAUTION: This function should not generally be used in production / when writing to files as it holds a copy of the entire file contents in memory until finished.
|
|
43919
|
+
*
|
|
43920
|
+
* @param {Readable} stream - The readable stream to convert to a promise.
|
|
43921
|
+
* @returns {Promise<Buffer>} A promise that resolves with the concatenated data from the stream as a Buffer, or rejects with an error if one occurred while reading from the stream. If the stream is empty, the promise is rejected with an EmptyStream error.
|
|
43922
|
+
* @throws {EmptyStream} If the stream is empty.
|
|
43873
43923
|
*/
|
|
43874
43924
|
function streamToPromise(stream) {
|
|
43875
43925
|
return new Promise((resolve, reject) => {
|
|
43876
43926
|
const drain = [];
|
|
43877
43927
|
stream
|
|
43928
|
+
// Error propagation is not automatic
|
|
43929
|
+
// Bubble up errors on the read stream
|
|
43930
|
+
.on('error', reject)
|
|
43878
43931
|
.pipe(new stream_1.Writable({
|
|
43879
43932
|
write(chunk, enc, next) {
|
|
43880
43933
|
drain.push(chunk);
|
|
43881
43934
|
next();
|
|
43882
43935
|
},
|
|
43883
43936
|
}))
|
|
43937
|
+
// This bubbles up errors when writing to the internal buffer
|
|
43938
|
+
// This is unlikely to happen, but we have this for completeness
|
|
43884
43939
|
.on('error', reject)
|
|
43885
43940
|
.on('finish', () => {
|
|
43886
43941
|
if (!drain.length) {
|
|
@@ -43912,7 +43967,27 @@ utils.normalizeURL = normalizeURL;
|
|
|
43912
43967
|
const sitemapIndexTagStart = '<sitemapindex xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">';
|
|
43913
43968
|
const closetag = '</sitemapindex>';
|
|
43914
43969
|
const defaultStreamOpts = {};
|
|
43970
|
+
/**
|
|
43971
|
+
* `SitemapIndexStream` is a Transform stream that takes `IndexItem`s or sitemap URL strings and outputs a stream of sitemap index XML.
|
|
43972
|
+
*
|
|
43973
|
+
* It automatically handles the XML declaration and the opening and closing tags for the sitemap index.
|
|
43974
|
+
*
|
|
43975
|
+
* ⚠️ CAUTION: This object is `readable` and must be read (e.g. piped to a file or to /dev/null)
|
|
43976
|
+
* before `finish` will be emitted. Failure to read the stream will result in hangs.
|
|
43977
|
+
*
|
|
43978
|
+
* @extends {Transform}
|
|
43979
|
+
*/
|
|
43915
43980
|
class SitemapIndexStream extends stream_1.Transform {
|
|
43981
|
+
/**
|
|
43982
|
+
* `SitemapIndexStream` is a Transform stream that takes `IndexItem`s or sitemap URL strings and outputs a stream of sitemap index XML.
|
|
43983
|
+
*
|
|
43984
|
+
* It automatically handles the XML declaration and the opening and closing tags for the sitemap index.
|
|
43985
|
+
*
|
|
43986
|
+
* ⚠️ CAUTION: This object is `readable` and must be read (e.g. piped to a file or to /dev/null)
|
|
43987
|
+
* before `finish` will be emitted. Failure to read the stream will result in hangs.
|
|
43988
|
+
*
|
|
43989
|
+
* @param {SitemapIndexStreamOptions} [opts=defaultStreamOpts] - Stream options.
|
|
43990
|
+
*/
|
|
43916
43991
|
constructor(opts = defaultStreamOpts) {
|
|
43917
43992
|
var _a;
|
|
43918
43993
|
opts.objectMode = true;
|
|
@@ -43922,14 +43997,17 @@ utils.normalizeURL = normalizeURL;
|
|
|
43922
43997
|
this.level = (_a = opts.level) !== null && _a !== void 0 ? _a : types_1.ErrorLevel.WARN;
|
|
43923
43998
|
this.xslUrl = opts.xslUrl;
|
|
43924
43999
|
}
|
|
44000
|
+
writeHeadOutput() {
|
|
44001
|
+
this.hasHeadOutput = true;
|
|
44002
|
+
let stylesheet = '';
|
|
44003
|
+
if (this.xslUrl) {
|
|
44004
|
+
stylesheet = (0, sitemap_stream_1.stylesheetInclude)(this.xslUrl);
|
|
44005
|
+
}
|
|
44006
|
+
this.push(xmlDec + stylesheet + sitemapIndexTagStart);
|
|
44007
|
+
}
|
|
43925
44008
|
_transform(item, encoding, callback) {
|
|
43926
44009
|
if (!this.hasHeadOutput) {
|
|
43927
|
-
this.
|
|
43928
|
-
let stylesheet = '';
|
|
43929
|
-
if (this.xslUrl) {
|
|
43930
|
-
stylesheet = (0, sitemap_stream_1.stylesheetInclude)(this.xslUrl);
|
|
43931
|
-
}
|
|
43932
|
-
this.push(xmlDec + stylesheet + sitemapIndexTagStart);
|
|
44010
|
+
this.writeHeadOutput();
|
|
43933
44011
|
}
|
|
43934
44012
|
this.push((0, sitemap_xml_1.otag)(IndexTagNames.sitemap));
|
|
43935
44013
|
if (typeof item === 'string') {
|
|
@@ -43946,55 +44024,143 @@ utils.normalizeURL = normalizeURL;
|
|
|
43946
44024
|
callback();
|
|
43947
44025
|
}
|
|
43948
44026
|
_flush(cb) {
|
|
44027
|
+
if (!this.hasHeadOutput) {
|
|
44028
|
+
this.writeHeadOutput();
|
|
44029
|
+
}
|
|
43949
44030
|
this.push(closetag);
|
|
43950
44031
|
cb();
|
|
43951
44032
|
}
|
|
43952
44033
|
}
|
|
43953
44034
|
exports.SitemapIndexStream = SitemapIndexStream;
|
|
43954
|
-
|
|
44035
|
+
/**
|
|
44036
|
+
* `SitemapAndIndexStream` is a Transform stream that takes in sitemap items,
|
|
44037
|
+
* writes them to sitemap files, adds the sitemap files to a sitemap index,
|
|
44038
|
+
* and creates new sitemap files when the count limit is reached.
|
|
44039
|
+
*
|
|
44040
|
+
* It waits for the target stream of the current sitemap file to finish before
|
|
44041
|
+
* moving on to the next if the target stream is returned by the `getSitemapStream`
|
|
44042
|
+
* callback in the 3rd position of the tuple.
|
|
44043
|
+
*
|
|
44044
|
+
* ⚠️ CAUTION: This object is `readable` and must be read (e.g. piped to a file or to /dev/null)
|
|
44045
|
+
* before `finish` will be emitted. Failure to read the stream will result in hangs.
|
|
44046
|
+
*
|
|
44047
|
+
* @extends {SitemapIndexStream}
|
|
44048
|
+
*/
|
|
43955
44049
|
class SitemapAndIndexStream extends SitemapIndexStream {
|
|
44050
|
+
/**
|
|
44051
|
+
* `SitemapAndIndexStream` is a Transform stream that takes in sitemap items,
|
|
44052
|
+
* writes them to sitemap files, adds the sitemap files to a sitemap index,
|
|
44053
|
+
* and creates new sitemap files when the count limit is reached.
|
|
44054
|
+
*
|
|
44055
|
+
* It waits for the target stream of the current sitemap file to finish before
|
|
44056
|
+
* moving on to the next if the target stream is returned by the `getSitemapStream`
|
|
44057
|
+
* callback in the 3rd position of the tuple.
|
|
44058
|
+
*
|
|
44059
|
+
* ⚠️ CAUTION: This object is `readable` and must be read (e.g. piped to a file or to /dev/null)
|
|
44060
|
+
* before `finish` will be emitted. Failure to read the stream will result in hangs.
|
|
44061
|
+
*
|
|
44062
|
+
* @param {SitemapAndIndexStreamOptions} opts - Stream options.
|
|
44063
|
+
*/
|
|
43956
44064
|
constructor(opts) {
|
|
43957
44065
|
var _a;
|
|
43958
44066
|
opts.objectMode = true;
|
|
43959
44067
|
super(opts);
|
|
43960
|
-
this.
|
|
44068
|
+
this.itemsWritten = 0;
|
|
43961
44069
|
this.getSitemapStream = opts.getSitemapStream;
|
|
43962
|
-
[this.idxItem, this.currentSitemap, this.currentSitemapPipeline] =
|
|
43963
|
-
this.getSitemapStream(0);
|
|
43964
44070
|
this.limit = (_a = opts.limit) !== null && _a !== void 0 ? _a : 45000;
|
|
43965
44071
|
}
|
|
43966
|
-
_writeSMI(item) {
|
|
43967
|
-
this.currentSitemap.write(item);
|
|
43968
|
-
this.i++;
|
|
43969
|
-
}
|
|
43970
44072
|
_transform(item, encoding, callback) {
|
|
43971
|
-
|
|
43972
|
-
|
|
43973
|
-
|
|
43974
|
-
|
|
44073
|
+
if (this.itemsWritten % this.limit === 0) {
|
|
44074
|
+
if (this.currentSitemap) {
|
|
44075
|
+
const onFinish = new Promise((resolve, reject) => {
|
|
44076
|
+
var _a, _b, _c;
|
|
44077
|
+
(_a = this.currentSitemap) === null || _a === void 0 ? void 0 : _a.on('finish', resolve);
|
|
44078
|
+
(_b = this.currentSitemap) === null || _b === void 0 ? void 0 : _b.on('error', reject);
|
|
44079
|
+
(_c = this.currentSitemap) === null || _c === void 0 ? void 0 : _c.end();
|
|
44080
|
+
});
|
|
44081
|
+
const onPipelineFinish = this.currentSitemapPipeline
|
|
44082
|
+
? new Promise((resolve, reject) => {
|
|
44083
|
+
var _a, _b;
|
|
44084
|
+
(_a = this.currentSitemapPipeline) === null || _a === void 0 ? void 0 : _a.on('finish', resolve);
|
|
44085
|
+
(_b = this.currentSitemapPipeline) === null || _b === void 0 ? void 0 : _b.on('error', reject);
|
|
44086
|
+
})
|
|
44087
|
+
: Promise.resolve();
|
|
44088
|
+
Promise.all([onFinish, onPipelineFinish])
|
|
44089
|
+
.then(() => {
|
|
44090
|
+
this.createSitemap(encoding);
|
|
44091
|
+
this.writeItem(item, callback);
|
|
44092
|
+
})
|
|
44093
|
+
.catch(callback);
|
|
44094
|
+
return;
|
|
44095
|
+
}
|
|
44096
|
+
else {
|
|
44097
|
+
this.createSitemap(encoding);
|
|
44098
|
+
}
|
|
44099
|
+
}
|
|
44100
|
+
this.writeItem(item, callback);
|
|
44101
|
+
}
|
|
44102
|
+
writeItem(item, callback) {
|
|
44103
|
+
if (!this.currentSitemap) {
|
|
44104
|
+
callback(new Error('No sitemap stream available'));
|
|
44105
|
+
return;
|
|
43975
44106
|
}
|
|
43976
|
-
|
|
43977
|
-
|
|
43978
|
-
const [idxItem, currentSitemap, currentSitemapPipeline] = this.getSitemapStream(this.i / this.limit);
|
|
43979
|
-
this.currentSitemap = currentSitemap;
|
|
43980
|
-
this.currentSitemapPipeline = currentSitemapPipeline;
|
|
43981
|
-
this._writeSMI(item);
|
|
43982
|
-
// push to index stream
|
|
43983
|
-
super._transform(idxItem, encoding, callback);
|
|
43984
|
-
};
|
|
43985
|
-
(_a = this.currentSitemapPipeline) === null || _a === void 0 ? void 0 : _a.on('finish', onFinish);
|
|
43986
|
-
this.currentSitemap.end(!this.currentSitemapPipeline ? onFinish : undefined);
|
|
44107
|
+
if (!this.currentSitemap.write(item)) {
|
|
44108
|
+
this.currentSitemap.once('drain', callback);
|
|
43987
44109
|
}
|
|
43988
44110
|
else {
|
|
43989
|
-
|
|
43990
|
-
callback();
|
|
44111
|
+
process.nextTick(callback);
|
|
43991
44112
|
}
|
|
44113
|
+
// Increment the count of items written
|
|
44114
|
+
this.itemsWritten++;
|
|
43992
44115
|
}
|
|
44116
|
+
/**
|
|
44117
|
+
* Called when the stream is finished.
|
|
44118
|
+
* If there is a current sitemap, we wait for it to finish before calling the callback.
|
|
44119
|
+
*
|
|
44120
|
+
* @param cb
|
|
44121
|
+
*/
|
|
43993
44122
|
_flush(cb) {
|
|
43994
|
-
|
|
43995
|
-
|
|
43996
|
-
|
|
43997
|
-
|
|
44123
|
+
const onFinish = new Promise((resolve, reject) => {
|
|
44124
|
+
if (this.currentSitemap) {
|
|
44125
|
+
this.currentSitemap.on('finish', resolve);
|
|
44126
|
+
this.currentSitemap.on('error', reject);
|
|
44127
|
+
this.currentSitemap.end();
|
|
44128
|
+
}
|
|
44129
|
+
else {
|
|
44130
|
+
resolve();
|
|
44131
|
+
}
|
|
44132
|
+
});
|
|
44133
|
+
const onPipelineFinish = new Promise((resolve, reject) => {
|
|
44134
|
+
if (this.currentSitemapPipeline) {
|
|
44135
|
+
this.currentSitemapPipeline.on('finish', resolve);
|
|
44136
|
+
this.currentSitemapPipeline.on('error', reject);
|
|
44137
|
+
// The pipeline (pipe target) will get it's end() call
|
|
44138
|
+
// from the sitemap stream ending.
|
|
44139
|
+
}
|
|
44140
|
+
else {
|
|
44141
|
+
resolve();
|
|
44142
|
+
}
|
|
44143
|
+
});
|
|
44144
|
+
Promise.all([onFinish, onPipelineFinish])
|
|
44145
|
+
.then(() => {
|
|
44146
|
+
super._flush(cb);
|
|
44147
|
+
})
|
|
44148
|
+
.catch((err) => {
|
|
44149
|
+
cb(err);
|
|
44150
|
+
});
|
|
44151
|
+
}
|
|
44152
|
+
createSitemap(encoding) {
|
|
44153
|
+
const [idxItem, currentSitemap, currentSitemapPipeline] = this.getSitemapStream(this.itemsWritten / this.limit);
|
|
44154
|
+
currentSitemap.on('error', (err) => this.emit('error', err));
|
|
44155
|
+
this.currentSitemap = currentSitemap;
|
|
44156
|
+
this.currentSitemapPipeline = currentSitemapPipeline;
|
|
44157
|
+
super._transform(idxItem, encoding, () => {
|
|
44158
|
+
// We are not too fussed about waiting for the index item to be written
|
|
44159
|
+
// we we'll wait for the file to finish at the end
|
|
44160
|
+
// and index file write volume tends to be small in comprarison to sitemap
|
|
44161
|
+
// writes.
|
|
44162
|
+
// noop
|
|
44163
|
+
});
|
|
43998
44164
|
}
|
|
43999
44165
|
}
|
|
44000
44166
|
exports.SitemapAndIndexStream = SitemapAndIndexStream;
|
|
@@ -44123,6 +44289,12 @@ var sax = {};
|
|
|
44123
44289
|
parser.ns = Object.create(rootNS);
|
|
44124
44290
|
}
|
|
44125
44291
|
|
|
44292
|
+
// disallow unquoted attribute values if not otherwise configured
|
|
44293
|
+
// and strict mode is true
|
|
44294
|
+
if (parser.opt.unquotedAttributeValues === undefined) {
|
|
44295
|
+
parser.opt.unquotedAttributeValues = !strict;
|
|
44296
|
+
}
|
|
44297
|
+
|
|
44126
44298
|
// mostly just for error reporting
|
|
44127
44299
|
parser.trackPosition = parser.opt.position !== false;
|
|
44128
44300
|
if (parser.trackPosition) {
|
|
@@ -45140,15 +45312,22 @@ var sax = {};
|
|
|
45140
45312
|
continue
|
|
45141
45313
|
|
|
45142
45314
|
case S.SGML_DECL:
|
|
45143
|
-
if (
|
|
45315
|
+
if (parser.sgmlDecl + c === '--') {
|
|
45316
|
+
parser.state = S.COMMENT;
|
|
45317
|
+
parser.comment = '';
|
|
45318
|
+
parser.sgmlDecl = '';
|
|
45319
|
+
continue;
|
|
45320
|
+
}
|
|
45321
|
+
|
|
45322
|
+
if (parser.doctype && parser.doctype !== true && parser.sgmlDecl) {
|
|
45323
|
+
parser.state = S.DOCTYPE_DTD;
|
|
45324
|
+
parser.doctype += '<!' + parser.sgmlDecl + c;
|
|
45325
|
+
parser.sgmlDecl = '';
|
|
45326
|
+
} else if ((parser.sgmlDecl + c).toUpperCase() === CDATA) {
|
|
45144
45327
|
emitNode(parser, 'onopencdata');
|
|
45145
45328
|
parser.state = S.CDATA;
|
|
45146
45329
|
parser.sgmlDecl = '';
|
|
45147
45330
|
parser.cdata = '';
|
|
45148
|
-
} else if (parser.sgmlDecl + c === '--') {
|
|
45149
|
-
parser.state = S.COMMENT;
|
|
45150
|
-
parser.comment = '';
|
|
45151
|
-
parser.sgmlDecl = '';
|
|
45152
45331
|
} else if ((parser.sgmlDecl + c).toUpperCase() === DOCTYPE) {
|
|
45153
45332
|
parser.state = S.DOCTYPE;
|
|
45154
45333
|
if (parser.doctype || parser.sawRoot) {
|
|
@@ -45202,12 +45381,18 @@ var sax = {};
|
|
|
45202
45381
|
continue
|
|
45203
45382
|
|
|
45204
45383
|
case S.DOCTYPE_DTD:
|
|
45205
|
-
parser.doctype += c;
|
|
45206
45384
|
if (c === ']') {
|
|
45385
|
+
parser.doctype += c;
|
|
45207
45386
|
parser.state = S.DOCTYPE;
|
|
45387
|
+
} else if (c === '<') {
|
|
45388
|
+
parser.state = S.OPEN_WAKA;
|
|
45389
|
+
parser.startTagPosition = parser.position;
|
|
45208
45390
|
} else if (isQuote(c)) {
|
|
45391
|
+
parser.doctype += c;
|
|
45209
45392
|
parser.state = S.DOCTYPE_DTD_QUOTED;
|
|
45210
45393
|
parser.q = c;
|
|
45394
|
+
} else {
|
|
45395
|
+
parser.doctype += c;
|
|
45211
45396
|
}
|
|
45212
45397
|
continue
|
|
45213
45398
|
|
|
@@ -45248,6 +45433,8 @@ var sax = {};
|
|
|
45248
45433
|
// which is a comment of " blah -- bloo "
|
|
45249
45434
|
parser.comment += '--' + c;
|
|
45250
45435
|
parser.state = S.COMMENT;
|
|
45436
|
+
} else if (parser.doctype && parser.doctype !== true) {
|
|
45437
|
+
parser.state = S.DOCTYPE_DTD;
|
|
45251
45438
|
} else {
|
|
45252
45439
|
parser.state = S.TEXT;
|
|
45253
45440
|
}
|
|
@@ -45415,7 +45602,9 @@ var sax = {};
|
|
|
45415
45602
|
parser.q = c;
|
|
45416
45603
|
parser.state = S.ATTRIB_VALUE_QUOTED;
|
|
45417
45604
|
} else {
|
|
45418
|
-
|
|
45605
|
+
if (!parser.opt.unquotedAttributeValues) {
|
|
45606
|
+
error(parser, 'Unquoted attribute value');
|
|
45607
|
+
}
|
|
45419
45608
|
parser.state = S.ATTRIB_VALUE_UNQUOTED;
|
|
45420
45609
|
parser.attribValue = c;
|
|
45421
45610
|
}
|
|
@@ -45533,13 +45722,13 @@ var sax = {};
|
|
|
45533
45722
|
}
|
|
45534
45723
|
|
|
45535
45724
|
if (c === ';') {
|
|
45536
|
-
|
|
45537
|
-
|
|
45725
|
+
var parsedEntity = parseEntity(parser);
|
|
45726
|
+
if (parser.opt.unparsedEntities && !Object.values(sax.XML_ENTITIES).includes(parsedEntity)) {
|
|
45538
45727
|
parser.entity = '';
|
|
45539
45728
|
parser.state = returnState;
|
|
45540
45729
|
parser.write(parsedEntity);
|
|
45541
45730
|
} else {
|
|
45542
|
-
parser[buffer] +=
|
|
45731
|
+
parser[buffer] += parsedEntity;
|
|
45543
45732
|
parser.entity = '';
|
|
45544
45733
|
parser.state = returnState;
|
|
45545
45734
|
}
|
|
@@ -46047,12 +46236,17 @@ class XMLToSitemapItemStream extends stream_1$1.Transform {
|
|
|
46047
46236
|
}
|
|
46048
46237
|
_transform(data, encoding, callback) {
|
|
46049
46238
|
try {
|
|
46239
|
+
const cb = () => callback(this.level === types_1$1.ErrorLevel.THROW ? this.error : null);
|
|
46050
46240
|
// correcting the type here can be done without making it a breaking change
|
|
46051
46241
|
// TODO fix this
|
|
46052
46242
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
46053
46243
|
// @ts-ignore
|
|
46054
|
-
this.saxStream.write(data, encoding)
|
|
46055
|
-
|
|
46244
|
+
if (!this.saxStream.write(data, encoding)) {
|
|
46245
|
+
this.saxStream.once('drain', cb);
|
|
46246
|
+
}
|
|
46247
|
+
else {
|
|
46248
|
+
process.nextTick(cb);
|
|
46249
|
+
}
|
|
46056
46250
|
}
|
|
46057
46251
|
catch (error) {
|
|
46058
46252
|
callback(error);
|
|
@@ -46321,152 +46515,138 @@ sitemapIndexParser.IndexObjectStreamToJSON = IndexObjectStreamToJSON;
|
|
|
46321
46515
|
|
|
46322
46516
|
var sitemapSimple = {};
|
|
46323
46517
|
|
|
46324
|
-
|
|
46325
|
-
|
|
46326
|
-
|
|
46327
|
-
|
|
46328
|
-
|
|
46329
|
-
|
|
46330
|
-
|
|
46331
|
-
|
|
46332
|
-
|
|
46333
|
-
|
|
46334
|
-
|
|
46335
|
-
|
|
46336
|
-
|
|
46337
|
-
|
|
46338
|
-
|
|
46339
|
-
|
|
46340
|
-
|
|
46341
|
-
|
|
46342
|
-
|
|
46343
|
-
|
|
46344
|
-
|
|
46345
|
-
|
|
46346
|
-
|
|
46347
|
-
|
|
46348
|
-
|
|
46349
|
-
|
|
46350
|
-
|
|
46351
|
-
|
|
46352
|
-
|
|
46353
|
-
|
|
46354
|
-
|
|
46355
|
-
|
|
46356
|
-
|
|
46357
|
-
|
|
46358
|
-
|
|
46359
|
-
|
|
46360
|
-
|
|
46361
|
-
|
|
46362
|
-
|
|
46363
|
-
|
|
46364
|
-
|
|
46365
|
-
|
|
46366
|
-
|
|
46367
|
-
|
|
46368
|
-
|
|
46369
|
-
|
|
46370
|
-
|
|
46371
|
-
|
|
46372
|
-
|
|
46373
|
-
|
|
46374
|
-
|
|
46375
|
-
|
|
46376
|
-
|
|
46377
|
-
|
|
46378
|
-
|
|
46379
|
-
|
|
46380
|
-
|
|
46381
|
-
|
|
46382
|
-
|
|
46383
|
-
|
|
46384
|
-
|
|
46385
|
-
|
|
46386
|
-
|
|
46387
|
-
|
|
46388
|
-
|
|
46389
|
-
|
|
46390
|
-
|
|
46391
|
-
|
|
46392
|
-
|
|
46393
|
-
|
|
46394
|
-
|
|
46395
|
-
|
|
46396
|
-
|
|
46397
|
-
|
|
46398
|
-
|
|
46399
|
-
|
|
46400
|
-
|
|
46401
|
-
|
|
46402
|
-
|
|
46403
|
-
|
|
46404
|
-
|
|
46405
|
-
|
|
46406
|
-
|
|
46407
|
-
|
|
46408
|
-
|
|
46409
|
-
|
|
46410
|
-
|
|
46411
|
-
}
|
|
46412
|
-
|
|
46413
|
-
|
|
46414
|
-
|
|
46415
|
-
|
|
46416
|
-
|
|
46417
|
-
|
|
46418
|
-
|
|
46419
|
-
|
|
46420
|
-
|
|
46421
|
-
|
|
46422
|
-
|
|
46423
|
-
|
|
46424
|
-
|
|
46425
|
-
|
|
46426
|
-
|
|
46427
|
-
|
|
46428
|
-
|
|
46429
|
-
|
|
46430
|
-
|
|
46431
|
-
|
|
46432
|
-
|
|
46433
|
-
|
|
46434
|
-
|
|
46435
|
-
|
|
46436
|
-
|
|
46437
|
-
|
|
46438
|
-
|
|
46439
|
-
|
|
46440
|
-
|
|
46441
|
-
|
|
46442
|
-
|
|
46443
|
-
|
|
46444
|
-
|
|
46445
|
-
|
|
46446
|
-
|
|
46447
|
-
|
|
46448
|
-
|
|
46449
|
-
|
|
46450
|
-
|
|
46451
|
-
|
|
46452
|
-
|
|
46453
|
-
|
|
46454
|
-
|
|
46455
|
-
|
|
46456
|
-
Object.defineProperty(exports, "parseSitemap", { enumerable: true, get: function () { return sitemap_parser_1.parseSitemap; } });
|
|
46457
|
-
Object.defineProperty(exports, "XMLToSitemapItemStream", { enumerable: true, get: function () { return sitemap_parser_1.XMLToSitemapItemStream; } });
|
|
46458
|
-
Object.defineProperty(exports, "ObjectStreamToJSON", { enumerable: true, get: function () { return sitemap_parser_1.ObjectStreamToJSON; } });
|
|
46459
|
-
var sitemap_index_parser_1 = sitemapIndexParser;
|
|
46460
|
-
Object.defineProperty(exports, "parseSitemapIndex", { enumerable: true, get: function () { return sitemap_index_parser_1.parseSitemapIndex; } });
|
|
46461
|
-
Object.defineProperty(exports, "XMLToSitemapIndexStream", { enumerable: true, get: function () { return sitemap_index_parser_1.XMLToSitemapIndexStream; } });
|
|
46462
|
-
Object.defineProperty(exports, "IndexObjectStreamToJSON", { enumerable: true, get: function () { return sitemap_index_parser_1.IndexObjectStreamToJSON; } });
|
|
46463
|
-
var sitemap_simple_1 = requireSitemapSimple();
|
|
46464
|
-
Object.defineProperty(exports, "simpleSitemapAndIndex", { enumerable: true, get: function () { return sitemap_simple_1.simpleSitemapAndIndex; } });
|
|
46465
|
-
} (dist));
|
|
46466
|
-
return dist;
|
|
46467
|
-
}
|
|
46468
|
-
|
|
46469
|
-
var distExports = requireDist();
|
|
46518
|
+
(function (exports) {
|
|
46519
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
46520
|
+
exports.simpleSitemapAndIndex = void 0;
|
|
46521
|
+
const sitemap_index_stream_1 = sitemapIndexStream;
|
|
46522
|
+
const sitemap_stream_1 = sitemapStream;
|
|
46523
|
+
const utils_1 = utils;
|
|
46524
|
+
const zlib_1 = zlib;
|
|
46525
|
+
const fs_1 = fs__default;
|
|
46526
|
+
const path_1 = path$q;
|
|
46527
|
+
const stream_1 = require$$0$2;
|
|
46528
|
+
const util_1 = require$$0$3;
|
|
46529
|
+
const url_1 = require$$3;
|
|
46530
|
+
const pipeline = (0, util_1.promisify)(stream_1.pipeline);
|
|
46531
|
+
/**
|
|
46532
|
+
*
|
|
46533
|
+
* @param {object} options -
|
|
46534
|
+
* @param {string} options.hostname - The hostname for all URLs
|
|
46535
|
+
* @param {string} [options.sitemapHostname] - The hostname for the sitemaps if different than hostname
|
|
46536
|
+
* @param {SitemapItemLoose[] | string | Readable | string[]} options.sourceData - The urls you want to make a sitemap out of.
|
|
46537
|
+
* @param {string} options.destinationDir - where to write the sitemaps and index
|
|
46538
|
+
* @param {string} [options.publicBasePath] - where the sitemaps are relative to the hostname. Defaults to root.
|
|
46539
|
+
* @param {number} [options.limit] - how many URLs to write before switching to a new file. Defaults to 50k
|
|
46540
|
+
* @param {boolean} [options.gzip] - whether to compress the written files. Defaults to true
|
|
46541
|
+
* @returns {Promise<void>} an empty promise that resolves when everything is done
|
|
46542
|
+
*/
|
|
46543
|
+
const simpleSitemapAndIndex = async ({ hostname, sitemapHostname = hostname, // if different
|
|
46544
|
+
/**
|
|
46545
|
+
* Pass a line separated list of sitemap items or a stream or an array
|
|
46546
|
+
*/
|
|
46547
|
+
sourceData, destinationDir, limit = 50000, gzip = true, publicBasePath = './', }) => {
|
|
46548
|
+
await fs_1.promises.mkdir(destinationDir, { recursive: true });
|
|
46549
|
+
const sitemapAndIndexStream = new sitemap_index_stream_1.SitemapAndIndexStream({
|
|
46550
|
+
limit,
|
|
46551
|
+
getSitemapStream: (i) => {
|
|
46552
|
+
const sitemapStream = new sitemap_stream_1.SitemapStream({
|
|
46553
|
+
hostname,
|
|
46554
|
+
});
|
|
46555
|
+
const path = `./sitemap-${i}.xml`;
|
|
46556
|
+
const writePath = (0, path_1.resolve)(destinationDir, path + (gzip ? '.gz' : ''));
|
|
46557
|
+
if (!publicBasePath.endsWith('/')) {
|
|
46558
|
+
publicBasePath += '/';
|
|
46559
|
+
}
|
|
46560
|
+
const publicPath = (0, path_1.normalize)(publicBasePath + path);
|
|
46561
|
+
let pipeline;
|
|
46562
|
+
if (gzip) {
|
|
46563
|
+
pipeline = sitemapStream
|
|
46564
|
+
.pipe((0, zlib_1.createGzip)()) // compress the output of the sitemap
|
|
46565
|
+
.pipe((0, fs_1.createWriteStream)(writePath)); // write it to sitemap-NUMBER.xml
|
|
46566
|
+
}
|
|
46567
|
+
else {
|
|
46568
|
+
pipeline = sitemapStream.pipe((0, fs_1.createWriteStream)(writePath)); // write it to sitemap-NUMBER.xml
|
|
46569
|
+
}
|
|
46570
|
+
return [
|
|
46571
|
+
new url_1.URL(`${publicPath}${gzip ? '.gz' : ''}`, sitemapHostname).toString(),
|
|
46572
|
+
sitemapStream,
|
|
46573
|
+
pipeline,
|
|
46574
|
+
];
|
|
46575
|
+
},
|
|
46576
|
+
});
|
|
46577
|
+
let src;
|
|
46578
|
+
if (typeof sourceData === 'string') {
|
|
46579
|
+
src = (0, utils_1.lineSeparatedURLsToSitemapOptions)((0, fs_1.createReadStream)(sourceData));
|
|
46580
|
+
}
|
|
46581
|
+
else if (sourceData instanceof stream_1.Readable) {
|
|
46582
|
+
src = sourceData;
|
|
46583
|
+
}
|
|
46584
|
+
else if (Array.isArray(sourceData)) {
|
|
46585
|
+
src = stream_1.Readable.from(sourceData);
|
|
46586
|
+
}
|
|
46587
|
+
else {
|
|
46588
|
+
throw new Error("unhandled source type. You've passed in data that is not supported");
|
|
46589
|
+
}
|
|
46590
|
+
const writePath = (0, path_1.resolve)(destinationDir, `./sitemap-index.xml${gzip ? '.gz' : ''}`);
|
|
46591
|
+
if (gzip) {
|
|
46592
|
+
return pipeline(src, sitemapAndIndexStream, (0, zlib_1.createGzip)(), (0, fs_1.createWriteStream)(writePath));
|
|
46593
|
+
}
|
|
46594
|
+
else {
|
|
46595
|
+
return pipeline(src, sitemapAndIndexStream, (0, fs_1.createWriteStream)(writePath));
|
|
46596
|
+
}
|
|
46597
|
+
};
|
|
46598
|
+
exports.simpleSitemapAndIndex = simpleSitemapAndIndex;
|
|
46599
|
+
exports.default = exports.simpleSitemapAndIndex;
|
|
46600
|
+
} (sitemapSimple));
|
|
46601
|
+
|
|
46602
|
+
(function (exports) {
|
|
46603
|
+
var __createBinding = (commonjsGlobal && commonjsGlobal.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
46604
|
+
if (k2 === undefined) k2 = k;
|
|
46605
|
+
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
46606
|
+
}) : (function(o, m, k, k2) {
|
|
46607
|
+
if (k2 === undefined) k2 = k;
|
|
46608
|
+
o[k2] = m[k];
|
|
46609
|
+
}));
|
|
46610
|
+
var __exportStar = (commonjsGlobal && commonjsGlobal.__exportStar) || function(m, exports) {
|
|
46611
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
46612
|
+
};
|
|
46613
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
46614
|
+
exports.simpleSitemapAndIndex = exports.IndexObjectStreamToJSON = exports.XMLToSitemapIndexStream = exports.parseSitemapIndex = exports.ObjectStreamToJSON = exports.XMLToSitemapItemStream = exports.parseSitemap = exports.xmlLint = exports.ReadlineStream = exports.normalizeURL = exports.validateSMIOptions = exports.mergeStreams = exports.lineSeparatedURLsToSitemapOptions = exports.SitemapStream = exports.streamToPromise = exports.SitemapAndIndexStream = exports.SitemapIndexStream = exports.IndexTagNames = exports.SitemapItemStream = void 0;
|
|
46615
|
+
/*!
|
|
46616
|
+
* Sitemap
|
|
46617
|
+
* Copyright(c) 2011 Eugene Kalinin
|
|
46618
|
+
* MIT Licensed
|
|
46619
|
+
*/
|
|
46620
|
+
var sitemap_item_stream_1 = sitemapItemStream;
|
|
46621
|
+
Object.defineProperty(exports, "SitemapItemStream", { enumerable: true, get: function () { return sitemap_item_stream_1.SitemapItemStream; } });
|
|
46622
|
+
var sitemap_index_stream_1 = sitemapIndexStream;
|
|
46623
|
+
Object.defineProperty(exports, "IndexTagNames", { enumerable: true, get: function () { return sitemap_index_stream_1.IndexTagNames; } });
|
|
46624
|
+
Object.defineProperty(exports, "SitemapIndexStream", { enumerable: true, get: function () { return sitemap_index_stream_1.SitemapIndexStream; } });
|
|
46625
|
+
Object.defineProperty(exports, "SitemapAndIndexStream", { enumerable: true, get: function () { return sitemap_index_stream_1.SitemapAndIndexStream; } });
|
|
46626
|
+
var sitemap_stream_1 = sitemapStream;
|
|
46627
|
+
Object.defineProperty(exports, "streamToPromise", { enumerable: true, get: function () { return sitemap_stream_1.streamToPromise; } });
|
|
46628
|
+
Object.defineProperty(exports, "SitemapStream", { enumerable: true, get: function () { return sitemap_stream_1.SitemapStream; } });
|
|
46629
|
+
__exportStar(errors, exports);
|
|
46630
|
+
__exportStar(types, exports);
|
|
46631
|
+
var utils_1 = utils;
|
|
46632
|
+
Object.defineProperty(exports, "lineSeparatedURLsToSitemapOptions", { enumerable: true, get: function () { return utils_1.lineSeparatedURLsToSitemapOptions; } });
|
|
46633
|
+
Object.defineProperty(exports, "mergeStreams", { enumerable: true, get: function () { return utils_1.mergeStreams; } });
|
|
46634
|
+
Object.defineProperty(exports, "validateSMIOptions", { enumerable: true, get: function () { return utils_1.validateSMIOptions; } });
|
|
46635
|
+
Object.defineProperty(exports, "normalizeURL", { enumerable: true, get: function () { return utils_1.normalizeURL; } });
|
|
46636
|
+
Object.defineProperty(exports, "ReadlineStream", { enumerable: true, get: function () { return utils_1.ReadlineStream; } });
|
|
46637
|
+
var xmllint_1 = xmllint;
|
|
46638
|
+
Object.defineProperty(exports, "xmlLint", { enumerable: true, get: function () { return xmllint_1.xmlLint; } });
|
|
46639
|
+
var sitemap_parser_1 = sitemapParser;
|
|
46640
|
+
Object.defineProperty(exports, "parseSitemap", { enumerable: true, get: function () { return sitemap_parser_1.parseSitemap; } });
|
|
46641
|
+
Object.defineProperty(exports, "XMLToSitemapItemStream", { enumerable: true, get: function () { return sitemap_parser_1.XMLToSitemapItemStream; } });
|
|
46642
|
+
Object.defineProperty(exports, "ObjectStreamToJSON", { enumerable: true, get: function () { return sitemap_parser_1.ObjectStreamToJSON; } });
|
|
46643
|
+
var sitemap_index_parser_1 = sitemapIndexParser;
|
|
46644
|
+
Object.defineProperty(exports, "parseSitemapIndex", { enumerable: true, get: function () { return sitemap_index_parser_1.parseSitemapIndex; } });
|
|
46645
|
+
Object.defineProperty(exports, "XMLToSitemapIndexStream", { enumerable: true, get: function () { return sitemap_index_parser_1.XMLToSitemapIndexStream; } });
|
|
46646
|
+
Object.defineProperty(exports, "IndexObjectStreamToJSON", { enumerable: true, get: function () { return sitemap_index_parser_1.IndexObjectStreamToJSON; } });
|
|
46647
|
+
var sitemap_simple_1 = sitemapSimple;
|
|
46648
|
+
Object.defineProperty(exports, "simpleSitemapAndIndex", { enumerable: true, get: function () { return sitemap_simple_1.simpleSitemapAndIndex; } });
|
|
46649
|
+
} (dist));
|
|
46470
46650
|
|
|
46471
46651
|
async function generateSitemap(siteConfig) {
|
|
46472
46652
|
if (!siteConfig.sitemap?.hostname) return;
|
|
@@ -46510,7 +46690,7 @@ async function generateSitemap(siteConfig) {
|
|
|
46510
46690
|
);
|
|
46511
46691
|
let items = _items.flat();
|
|
46512
46692
|
items = await siteConfig.sitemap?.transformItems?.(items) || items;
|
|
46513
|
-
const sitemapStream = new
|
|
46693
|
+
const sitemapStream = new dist.SitemapStream(siteConfig.sitemap);
|
|
46514
46694
|
const sitemapPath = path$q.join(siteConfig.outDir, "sitemap.xml");
|
|
46515
46695
|
const writeStream = fs$a.createWriteStream(sitemapPath);
|
|
46516
46696
|
sitemapStream.pipe(writeStream);
|
|
@@ -46519,7 +46699,7 @@ async function generateSitemap(siteConfig) {
|
|
|
46519
46699
|
});
|
|
46520
46700
|
}
|
|
46521
46701
|
|
|
46522
|
-
var version = "1.2.
|
|
46702
|
+
var version = "1.2.3";
|
|
46523
46703
|
|
|
46524
46704
|
async function renderPage(render, config, page, result, appChunk, cssChunk, assets, pageToHashMap, metadataScript, additionalHeadTags) {
|
|
46525
46705
|
const routePath = `/${page.replace(/\.md$/, "")}`;
|