vitepress 1.2.2 → 1.3.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/client/app/data.js +1 -1
- package/dist/client/app/router.js +41 -40
- package/dist/client/theme-default/components/VPDocFooter.vue +29 -13
- package/dist/client/theme-default/components/VPDocFooterLastUpdated.vue +2 -2
- package/dist/client/theme-default/components/VPMenu.vue +7 -2
- package/dist/client/theme-default/components/VPNavBar.vue +10 -3
- package/dist/client/theme-default/components/VPNavBarAppearance.vue +8 -1
- package/dist/client/theme-default/components/VPNavBarExtra.vue +17 -3
- package/dist/client/theme-default/components/VPNavBarMenu.vue +14 -3
- package/dist/client/theme-default/components/VPNavBarMenuGroup.vue +7 -7
- package/dist/client/theme-default/components/VPNavScreen.vue +2 -2
- package/dist/client/theme-default/components/VPNavScreenAppearance.vue +8 -1
- package/dist/client/theme-default/components/VPNavScreenMenu.vue +7 -4
- package/dist/client/theme-default/components/VPNavScreenMenuGroup.vue +9 -8
- package/dist/client/theme-default/components/VPSidebar.vue +18 -19
- package/dist/client/theme-default/components/VPSidebarGroup.vue +56 -0
- package/dist/client/theme-default/components/VPSidebarItem.vue +3 -3
- package/dist/client/theme-default/components/VPSwitchAppearance.vue +5 -3
- package/dist/client/theme-default/styles/base.css +1 -2
- package/dist/client/theme-default/styles/components/vp-doc.css +10 -2
- package/dist/client/theme-default/without-fonts.js +1 -0
- package/dist/node/cli.js +20 -14
- package/dist/node/index.d.ts +7 -6
- package/dist/node/index.js +2 -2
- package/dist/node/{serve-BwR5EPUJ.js → serve-BhLFz9dF.js} +713 -395
- package/package.json +41 -44
- package/theme.d.ts +1 -0
- package/types/default-theme.d.ts +9 -4
- package/types/shared.d.ts +1 -0
|
@@ -4268,10 +4268,11 @@ class Minimatch {
|
|
|
4268
4268
|
for (let i = 0; i < globParts.length - 1; i++) {
|
|
4269
4269
|
for (let j = i + 1; j < globParts.length; j++) {
|
|
4270
4270
|
const matched = this.partsMatch(globParts[i], globParts[j], !this.preserveMultipleSlashes);
|
|
4271
|
-
if (
|
|
4272
|
-
|
|
4273
|
-
|
|
4274
|
-
|
|
4271
|
+
if (matched) {
|
|
4272
|
+
globParts[i] = [];
|
|
4273
|
+
globParts[j] = matched;
|
|
4274
|
+
break;
|
|
4275
|
+
}
|
|
4275
4276
|
}
|
|
4276
4277
|
}
|
|
4277
4278
|
return globParts.filter(gs => gs.length);
|
|
@@ -4871,21 +4872,26 @@ class Stack {
|
|
|
4871
4872
|
/**
|
|
4872
4873
|
* Default export, the thing you're using this module to get.
|
|
4873
4874
|
*
|
|
4874
|
-
*
|
|
4875
|
-
*
|
|
4876
|
-
*
|
|
4877
|
-
*
|
|
4878
|
-
*
|
|
4875
|
+
* The `K` and `V` types define the key and value types, respectively. The
|
|
4876
|
+
* optional `FC` type defines the type of the `context` object passed to
|
|
4877
|
+
* `cache.fetch()` and `cache.memo()`.
|
|
4878
|
+
*
|
|
4879
|
+
* Keys and values **must not** be `null` or `undefined`.
|
|
4880
|
+
*
|
|
4881
|
+
* All properties from the options object (with the exception of `max`,
|
|
4882
|
+
* `maxSize`, `fetchMethod`, `memoMethod`, `dispose` and `disposeAfter`) are
|
|
4883
|
+
* added as normal public members. (The listed options are read-only getters.)
|
|
4884
|
+
*
|
|
4885
|
+
* Changing any of these will alter the defaults for subsequent method calls.
|
|
4879
4886
|
*/
|
|
4880
4887
|
class LRUCache {
|
|
4881
|
-
//
|
|
4882
|
-
// really *need* to be protected. The rest can be modified, as they just
|
|
4883
|
-
// set defaults for various methods.
|
|
4888
|
+
// options that cannot be changed without disaster
|
|
4884
4889
|
#max;
|
|
4885
4890
|
#maxSize;
|
|
4886
4891
|
#dispose;
|
|
4887
4892
|
#disposeAfter;
|
|
4888
4893
|
#fetchMethod;
|
|
4894
|
+
#memoMethod;
|
|
4889
4895
|
/**
|
|
4890
4896
|
* {@link LRUCache.OptionsBase.ttl}
|
|
4891
4897
|
*/
|
|
@@ -5031,6 +5037,9 @@ class LRUCache {
|
|
|
5031
5037
|
get fetchMethod() {
|
|
5032
5038
|
return this.#fetchMethod;
|
|
5033
5039
|
}
|
|
5040
|
+
get memoMethod() {
|
|
5041
|
+
return this.#memoMethod;
|
|
5042
|
+
}
|
|
5034
5043
|
/**
|
|
5035
5044
|
* {@link LRUCache.OptionsBase.dispose} (read-only)
|
|
5036
5045
|
*/
|
|
@@ -5044,7 +5053,7 @@ class LRUCache {
|
|
|
5044
5053
|
return this.#disposeAfter;
|
|
5045
5054
|
}
|
|
5046
5055
|
constructor(options) {
|
|
5047
|
-
const { max = 0, ttl, ttlResolution = 1, ttlAutopurge, updateAgeOnGet, updateAgeOnHas, allowStale, dispose, disposeAfter, noDisposeOnSet, noUpdateTTL, maxSize = 0, maxEntrySize = 0, sizeCalculation, fetchMethod, noDeleteOnFetchRejection, noDeleteOnStaleGet, allowStaleOnFetchRejection, allowStaleOnFetchAbort, ignoreFetchAbort, } = options;
|
|
5056
|
+
const { max = 0, ttl, ttlResolution = 1, ttlAutopurge, updateAgeOnGet, updateAgeOnHas, allowStale, dispose, disposeAfter, noDisposeOnSet, noUpdateTTL, maxSize = 0, maxEntrySize = 0, sizeCalculation, fetchMethod, memoMethod, noDeleteOnFetchRejection, noDeleteOnStaleGet, allowStaleOnFetchRejection, allowStaleOnFetchAbort, ignoreFetchAbort, } = options;
|
|
5048
5057
|
if (max !== 0 && !isPosInt(max)) {
|
|
5049
5058
|
throw new TypeError('max option must be a nonnegative integer');
|
|
5050
5059
|
}
|
|
@@ -5064,6 +5073,11 @@ class LRUCache {
|
|
|
5064
5073
|
throw new TypeError('sizeCalculation set to non-function');
|
|
5065
5074
|
}
|
|
5066
5075
|
}
|
|
5076
|
+
if (memoMethod !== undefined &&
|
|
5077
|
+
typeof memoMethod !== 'function') {
|
|
5078
|
+
throw new TypeError('memoMethod must be a function if defined');
|
|
5079
|
+
}
|
|
5080
|
+
this.#memoMethod = memoMethod;
|
|
5067
5081
|
if (fetchMethod !== undefined &&
|
|
5068
5082
|
typeof fetchMethod !== 'function') {
|
|
5069
5083
|
throw new TypeError('fetchMethod must be a function if specified');
|
|
@@ -5142,7 +5156,8 @@ class LRUCache {
|
|
|
5142
5156
|
}
|
|
5143
5157
|
}
|
|
5144
5158
|
/**
|
|
5145
|
-
* Return the
|
|
5159
|
+
* Return the number of ms left in the item's TTL. If item is not in cache,
|
|
5160
|
+
* returns `0`. Returns `Infinity` if item is in cache without a defined TTL.
|
|
5146
5161
|
*/
|
|
5147
5162
|
getRemainingTTL(key) {
|
|
5148
5163
|
return this.#keyMap.has(key) ? Infinity : 0;
|
|
@@ -5158,7 +5173,7 @@ class LRUCache {
|
|
|
5158
5173
|
if (ttl !== 0 && this.ttlAutopurge) {
|
|
5159
5174
|
const t = setTimeout(() => {
|
|
5160
5175
|
if (this.#isStale(index)) {
|
|
5161
|
-
this
|
|
5176
|
+
this.#delete(this.#keyList[index], 'expire');
|
|
5162
5177
|
}
|
|
5163
5178
|
}, ttl + 1);
|
|
5164
5179
|
// unref() not supported on all platforms
|
|
@@ -5415,13 +5430,14 @@ class LRUCache {
|
|
|
5415
5430
|
return this.entries();
|
|
5416
5431
|
}
|
|
5417
5432
|
/**
|
|
5418
|
-
* A String value that is used in the creation of the default string
|
|
5419
|
-
* Called by the built-in method
|
|
5433
|
+
* A String value that is used in the creation of the default string
|
|
5434
|
+
* description of an object. Called by the built-in method
|
|
5435
|
+
* `Object.prototype.toString`.
|
|
5420
5436
|
*/
|
|
5421
5437
|
[Symbol.toStringTag] = 'LRUCache';
|
|
5422
5438
|
/**
|
|
5423
5439
|
* Find a value for which the supplied fn method returns a truthy value,
|
|
5424
|
-
* similar to Array.find()
|
|
5440
|
+
* similar to `Array.find()`. fn is called as `fn(value, key, cache)`.
|
|
5425
5441
|
*/
|
|
5426
5442
|
find(fn, getOptions = {}) {
|
|
5427
5443
|
for (const i of this.#indexes()) {
|
|
@@ -5437,10 +5453,15 @@ class LRUCache {
|
|
|
5437
5453
|
}
|
|
5438
5454
|
}
|
|
5439
5455
|
/**
|
|
5440
|
-
* Call the supplied function on each item in the cache, in order from
|
|
5441
|
-
*
|
|
5442
|
-
*
|
|
5443
|
-
*
|
|
5456
|
+
* Call the supplied function on each item in the cache, in order from most
|
|
5457
|
+
* recently used to least recently used.
|
|
5458
|
+
*
|
|
5459
|
+
* `fn` is called as `fn(value, key, cache)`.
|
|
5460
|
+
*
|
|
5461
|
+
* If `thisp` is provided, function will be called in the `this`-context of
|
|
5462
|
+
* the provided object, or the cache if no `thisp` object is provided.
|
|
5463
|
+
*
|
|
5464
|
+
* Does not update age or recenty of use, or iterate over stale values.
|
|
5444
5465
|
*/
|
|
5445
5466
|
forEach(fn, thisp = this) {
|
|
5446
5467
|
for (const i of this.#indexes()) {
|
|
@@ -5476,7 +5497,7 @@ class LRUCache {
|
|
|
5476
5497
|
let deleted = false;
|
|
5477
5498
|
for (const i of this.#rindexes({ allowStale: true })) {
|
|
5478
5499
|
if (this.#isStale(i)) {
|
|
5479
|
-
this
|
|
5500
|
+
this.#delete(this.#keyList[i], 'expire');
|
|
5480
5501
|
deleted = true;
|
|
5481
5502
|
}
|
|
5482
5503
|
}
|
|
@@ -5484,9 +5505,15 @@ class LRUCache {
|
|
|
5484
5505
|
}
|
|
5485
5506
|
/**
|
|
5486
5507
|
* Get the extended info about a given entry, to get its value, size, and
|
|
5487
|
-
* TTL info simultaneously.
|
|
5488
|
-
*
|
|
5489
|
-
*
|
|
5508
|
+
* TTL info simultaneously. Returns `undefined` if the key is not present.
|
|
5509
|
+
*
|
|
5510
|
+
* Unlike {@link LRUCache#dump}, which is designed to be portable and survive
|
|
5511
|
+
* serialization, the `start` value is always the current timestamp, and the
|
|
5512
|
+
* `ttl` is a calculated remaining time to live (negative if expired).
|
|
5513
|
+
*
|
|
5514
|
+
* Always returns stale values, if their info is found in the cache, so be
|
|
5515
|
+
* sure to check for expirations (ie, a negative {@link LRUCache.Entry#ttl})
|
|
5516
|
+
* if relevant.
|
|
5490
5517
|
*/
|
|
5491
5518
|
info(key) {
|
|
5492
5519
|
const i = this.#keyMap.get(key);
|
|
@@ -5515,7 +5542,16 @@ class LRUCache {
|
|
|
5515
5542
|
}
|
|
5516
5543
|
/**
|
|
5517
5544
|
* Return an array of [key, {@link LRUCache.Entry}] tuples which can be
|
|
5518
|
-
* passed to
|
|
5545
|
+
* passed to {@link LRLUCache#load}.
|
|
5546
|
+
*
|
|
5547
|
+
* The `start` fields are calculated relative to a portable `Date.now()`
|
|
5548
|
+
* timestamp, even if `performance.now()` is available.
|
|
5549
|
+
*
|
|
5550
|
+
* Stale entries are always included in the `dump`, even if
|
|
5551
|
+
* {@link LRUCache.OptionsBase.allowStale} is false.
|
|
5552
|
+
*
|
|
5553
|
+
* Note: this returns an actual array, not a generator, so it can be more
|
|
5554
|
+
* easily passed around.
|
|
5519
5555
|
*/
|
|
5520
5556
|
dump() {
|
|
5521
5557
|
const arr = [];
|
|
@@ -5544,8 +5580,12 @@ class LRUCache {
|
|
|
5544
5580
|
}
|
|
5545
5581
|
/**
|
|
5546
5582
|
* Reset the cache and load in the items in entries in the order listed.
|
|
5547
|
-
*
|
|
5548
|
-
*
|
|
5583
|
+
*
|
|
5584
|
+
* The shape of the resulting cache may be different if the same options are
|
|
5585
|
+
* not used in both caches.
|
|
5586
|
+
*
|
|
5587
|
+
* The `start` fields are assumed to be calculated relative to a portable
|
|
5588
|
+
* `Date.now()` timestamp, even if `performance.now()` is available.
|
|
5549
5589
|
*/
|
|
5550
5590
|
load(arr) {
|
|
5551
5591
|
this.clear();
|
|
@@ -5568,6 +5608,30 @@ class LRUCache {
|
|
|
5568
5608
|
*
|
|
5569
5609
|
* Note: if `undefined` is specified as a value, this is an alias for
|
|
5570
5610
|
* {@link LRUCache#delete}
|
|
5611
|
+
*
|
|
5612
|
+
* Fields on the {@link LRUCache.SetOptions} options param will override
|
|
5613
|
+
* their corresponding values in the constructor options for the scope
|
|
5614
|
+
* of this single `set()` operation.
|
|
5615
|
+
*
|
|
5616
|
+
* If `start` is provided, then that will set the effective start
|
|
5617
|
+
* time for the TTL calculation. Note that this must be a previous
|
|
5618
|
+
* value of `performance.now()` if supported, or a previous value of
|
|
5619
|
+
* `Date.now()` if not.
|
|
5620
|
+
*
|
|
5621
|
+
* Options object may also include `size`, which will prevent
|
|
5622
|
+
* calling the `sizeCalculation` function and just use the specified
|
|
5623
|
+
* number if it is a positive integer, and `noDisposeOnSet` which
|
|
5624
|
+
* will prevent calling a `dispose` function in the case of
|
|
5625
|
+
* overwrites.
|
|
5626
|
+
*
|
|
5627
|
+
* If the `size` (or return value of `sizeCalculation`) for a given
|
|
5628
|
+
* entry is greater than `maxEntrySize`, then the item will not be
|
|
5629
|
+
* added to the cache.
|
|
5630
|
+
*
|
|
5631
|
+
* Will update the recency of the entry.
|
|
5632
|
+
*
|
|
5633
|
+
* If the value is `undefined`, then this is an alias for
|
|
5634
|
+
* `cache.delete(key)`. `undefined` is never stored in the cache.
|
|
5571
5635
|
*/
|
|
5572
5636
|
set(k, v, setOptions = {}) {
|
|
5573
5637
|
if (v === undefined) {
|
|
@@ -5585,7 +5649,7 @@ class LRUCache {
|
|
|
5585
5649
|
status.maxEntrySizeExceeded = true;
|
|
5586
5650
|
}
|
|
5587
5651
|
// have to delete, in case something is there already.
|
|
5588
|
-
this
|
|
5652
|
+
this.#delete(k, 'set');
|
|
5589
5653
|
return this;
|
|
5590
5654
|
}
|
|
5591
5655
|
let index = this.#size === 0 ? undefined : this.#keyMap.get(k);
|
|
@@ -5737,6 +5801,14 @@ class LRUCache {
|
|
|
5737
5801
|
* Will return false if the item is stale, even though it is technically
|
|
5738
5802
|
* in the cache.
|
|
5739
5803
|
*
|
|
5804
|
+
* Check if a key is in the cache, without updating the recency of
|
|
5805
|
+
* use. Age is updated if {@link LRUCache.OptionsBase.updateAgeOnHas} is set
|
|
5806
|
+
* to `true` in either the options or the constructor.
|
|
5807
|
+
*
|
|
5808
|
+
* Will return `false` if the item is stale, even though it is technically in
|
|
5809
|
+
* the cache. The difference can be determined (if it matters) by using a
|
|
5810
|
+
* `status` argument, and inspecting the `has` field.
|
|
5811
|
+
*
|
|
5740
5812
|
* Will not update item age unless
|
|
5741
5813
|
* {@link LRUCache.OptionsBase.updateAgeOnHas} is set.
|
|
5742
5814
|
*/
|
|
@@ -5828,7 +5900,7 @@ class LRUCache {
|
|
|
5828
5900
|
this.#valList[index] = bf.__staleWhileFetching;
|
|
5829
5901
|
}
|
|
5830
5902
|
else {
|
|
5831
|
-
this
|
|
5903
|
+
this.#delete(k, 'fetch');
|
|
5832
5904
|
}
|
|
5833
5905
|
}
|
|
5834
5906
|
else {
|
|
@@ -5857,7 +5929,7 @@ class LRUCache {
|
|
|
5857
5929
|
// the stale value is not removed from the cache when the fetch fails.
|
|
5858
5930
|
const del = !noDelete || bf.__staleWhileFetching === undefined;
|
|
5859
5931
|
if (del) {
|
|
5860
|
-
this
|
|
5932
|
+
this.#delete(k, 'fetch');
|
|
5861
5933
|
}
|
|
5862
5934
|
else if (!allowStaleAborted) {
|
|
5863
5935
|
// still replace the *promise* with the stale value,
|
|
@@ -6003,6 +6075,28 @@ class LRUCache {
|
|
|
6003
6075
|
return staleVal ? p.__staleWhileFetching : (p.__returned = p);
|
|
6004
6076
|
}
|
|
6005
6077
|
}
|
|
6078
|
+
async forceFetch(k, fetchOptions = {}) {
|
|
6079
|
+
const v = await this.fetch(k, fetchOptions);
|
|
6080
|
+
if (v === undefined)
|
|
6081
|
+
throw new Error('fetch() returned undefined');
|
|
6082
|
+
return v;
|
|
6083
|
+
}
|
|
6084
|
+
memo(k, memoOptions = {}) {
|
|
6085
|
+
const memoMethod = this.#memoMethod;
|
|
6086
|
+
if (!memoMethod) {
|
|
6087
|
+
throw new Error('no memoMethod provided to constructor');
|
|
6088
|
+
}
|
|
6089
|
+
const { context, forceRefresh, ...options } = memoOptions;
|
|
6090
|
+
const v = this.get(k, options);
|
|
6091
|
+
if (!forceRefresh && v !== undefined)
|
|
6092
|
+
return v;
|
|
6093
|
+
const vv = memoMethod(k, v, {
|
|
6094
|
+
options,
|
|
6095
|
+
context,
|
|
6096
|
+
});
|
|
6097
|
+
this.set(k, vv, options);
|
|
6098
|
+
return vv;
|
|
6099
|
+
}
|
|
6006
6100
|
/**
|
|
6007
6101
|
* Return a value from the cache. Will update the recency of the cache
|
|
6008
6102
|
* entry found.
|
|
@@ -6023,7 +6117,7 @@ class LRUCache {
|
|
|
6023
6117
|
// delete only if not an in-flight background fetch
|
|
6024
6118
|
if (!fetching) {
|
|
6025
6119
|
if (!noDeleteOnStaleGet) {
|
|
6026
|
-
this
|
|
6120
|
+
this.#delete(k, 'expire');
|
|
6027
6121
|
}
|
|
6028
6122
|
if (status && allowStale)
|
|
6029
6123
|
status.returnedStale = true;
|
|
@@ -6086,16 +6180,20 @@ class LRUCache {
|
|
|
6086
6180
|
}
|
|
6087
6181
|
/**
|
|
6088
6182
|
* Deletes a key out of the cache.
|
|
6183
|
+
*
|
|
6089
6184
|
* Returns true if the key was deleted, false otherwise.
|
|
6090
6185
|
*/
|
|
6091
6186
|
delete(k) {
|
|
6187
|
+
return this.#delete(k, 'delete');
|
|
6188
|
+
}
|
|
6189
|
+
#delete(k, reason) {
|
|
6092
6190
|
let deleted = false;
|
|
6093
6191
|
if (this.#size !== 0) {
|
|
6094
6192
|
const index = this.#keyMap.get(k);
|
|
6095
6193
|
if (index !== undefined) {
|
|
6096
6194
|
deleted = true;
|
|
6097
6195
|
if (this.#size === 1) {
|
|
6098
|
-
this
|
|
6196
|
+
this.#clear(reason);
|
|
6099
6197
|
}
|
|
6100
6198
|
else {
|
|
6101
6199
|
this.#removeItemSize(index);
|
|
@@ -6105,10 +6203,10 @@ class LRUCache {
|
|
|
6105
6203
|
}
|
|
6106
6204
|
else if (this.#hasDispose || this.#hasDisposeAfter) {
|
|
6107
6205
|
if (this.#hasDispose) {
|
|
6108
|
-
this.#dispose?.(v, k,
|
|
6206
|
+
this.#dispose?.(v, k, reason);
|
|
6109
6207
|
}
|
|
6110
6208
|
if (this.#hasDisposeAfter) {
|
|
6111
|
-
this.#disposed?.push([v, k,
|
|
6209
|
+
this.#disposed?.push([v, k, reason]);
|
|
6112
6210
|
}
|
|
6113
6211
|
}
|
|
6114
6212
|
this.#keyMap.delete(k);
|
|
@@ -6144,6 +6242,9 @@ class LRUCache {
|
|
|
6144
6242
|
* Clear the cache entirely, throwing away all values.
|
|
6145
6243
|
*/
|
|
6146
6244
|
clear() {
|
|
6245
|
+
return this.#clear('delete');
|
|
6246
|
+
}
|
|
6247
|
+
#clear(reason) {
|
|
6147
6248
|
for (const index of this.#rindexes({ allowStale: true })) {
|
|
6148
6249
|
const v = this.#valList[index];
|
|
6149
6250
|
if (this.#isBackgroundFetch(v)) {
|
|
@@ -6152,10 +6253,10 @@ class LRUCache {
|
|
|
6152
6253
|
else {
|
|
6153
6254
|
const k = this.#keyList[index];
|
|
6154
6255
|
if (this.#hasDispose) {
|
|
6155
|
-
this.#dispose?.(v, k,
|
|
6256
|
+
this.#dispose?.(v, k, reason);
|
|
6156
6257
|
}
|
|
6157
6258
|
if (this.#hasDisposeAfter) {
|
|
6158
|
-
this.#disposed?.push([v, k,
|
|
6259
|
+
this.#disposed?.push([v, k, reason]);
|
|
6159
6260
|
}
|
|
6160
6261
|
}
|
|
6161
6262
|
}
|
|
@@ -9277,9 +9378,9 @@ class Pattern {
|
|
|
9277
9378
|
globString() {
|
|
9278
9379
|
return (this.#globString =
|
|
9279
9380
|
this.#globString ||
|
|
9280
|
-
(this.#index === 0
|
|
9281
|
-
|
|
9282
|
-
|
|
9381
|
+
(this.#index === 0 ?
|
|
9382
|
+
this.isAbsolute() ?
|
|
9383
|
+
this.#globList[0] + this.#globList.slice(1).join('/')
|
|
9283
9384
|
: this.#globList.join('/')
|
|
9284
9385
|
: this.#globList.slice(this.#index).join('/')));
|
|
9285
9386
|
}
|
|
@@ -9308,8 +9409,8 @@ class Pattern {
|
|
|
9308
9409
|
*/
|
|
9309
9410
|
isUNC() {
|
|
9310
9411
|
const pl = this.#patternList;
|
|
9311
|
-
return this.#isUNC !== undefined
|
|
9312
|
-
|
|
9412
|
+
return this.#isUNC !== undefined ?
|
|
9413
|
+
this.#isUNC
|
|
9313
9414
|
: (this.#isUNC =
|
|
9314
9415
|
this.#platform === 'win32' &&
|
|
9315
9416
|
this.#index === 0 &&
|
|
@@ -9330,8 +9431,8 @@ class Pattern {
|
|
|
9330
9431
|
*/
|
|
9331
9432
|
isDrive() {
|
|
9332
9433
|
const pl = this.#patternList;
|
|
9333
|
-
return this.#isDrive !== undefined
|
|
9334
|
-
|
|
9434
|
+
return this.#isDrive !== undefined ?
|
|
9435
|
+
this.#isDrive
|
|
9335
9436
|
: (this.#isDrive =
|
|
9336
9437
|
this.#platform === 'win32' &&
|
|
9337
9438
|
this.#index === 0 &&
|
|
@@ -9347,8 +9448,8 @@ class Pattern {
|
|
|
9347
9448
|
*/
|
|
9348
9449
|
isAbsolute() {
|
|
9349
9450
|
const pl = this.#patternList;
|
|
9350
|
-
return this.#isAbsolute !== undefined
|
|
9351
|
-
|
|
9451
|
+
return this.#isAbsolute !== undefined ?
|
|
9452
|
+
this.#isAbsolute
|
|
9352
9453
|
: (this.#isAbsolute =
|
|
9353
9454
|
(pl[0] === '' && pl.length > 1) ||
|
|
9354
9455
|
this.isDrive() ||
|
|
@@ -9359,8 +9460,8 @@ class Pattern {
|
|
|
9359
9460
|
*/
|
|
9360
9461
|
root() {
|
|
9361
9462
|
const p = this.#patternList[0];
|
|
9362
|
-
return typeof p === 'string' && this.isAbsolute() && this.#index === 0
|
|
9363
|
-
|
|
9463
|
+
return (typeof p === 'string' && this.isAbsolute() && this.#index === 0) ?
|
|
9464
|
+
p
|
|
9364
9465
|
: '';
|
|
9365
9466
|
}
|
|
9366
9467
|
/**
|
|
@@ -9387,10 +9488,10 @@ class Pattern {
|
|
|
9387
9488
|
// a given path should be ignored.
|
|
9388
9489
|
// Ignoring a path ignores its children if the pattern ends in /**
|
|
9389
9490
|
// Ignores are always parsed in dot:true mode
|
|
9390
|
-
const defaultPlatform$1 = typeof process === 'object' &&
|
|
9491
|
+
const defaultPlatform$1 = (typeof process === 'object' &&
|
|
9391
9492
|
process &&
|
|
9392
|
-
typeof process.platform === 'string'
|
|
9393
|
-
|
|
9493
|
+
typeof process.platform === 'string') ?
|
|
9494
|
+
process.platform
|
|
9394
9495
|
: 'linux';
|
|
9395
9496
|
/**
|
|
9396
9497
|
* Class used to process ignored patterns
|
|
@@ -9400,12 +9501,15 @@ class Ignore {
|
|
|
9400
9501
|
relativeChildren;
|
|
9401
9502
|
absolute;
|
|
9402
9503
|
absoluteChildren;
|
|
9504
|
+
platform;
|
|
9505
|
+
mmopts;
|
|
9403
9506
|
constructor(ignored, { nobrace, nocase, noext, noglobstar, platform = defaultPlatform$1, }) {
|
|
9404
9507
|
this.relative = [];
|
|
9405
9508
|
this.absolute = [];
|
|
9406
9509
|
this.relativeChildren = [];
|
|
9407
9510
|
this.absoluteChildren = [];
|
|
9408
|
-
|
|
9511
|
+
this.platform = platform;
|
|
9512
|
+
this.mmopts = {
|
|
9409
9513
|
dot: true,
|
|
9410
9514
|
nobrace,
|
|
9411
9515
|
nocase,
|
|
@@ -9416,6 +9520,10 @@ class Ignore {
|
|
|
9416
9520
|
nocomment: true,
|
|
9417
9521
|
nonegate: true,
|
|
9418
9522
|
};
|
|
9523
|
+
for (const ign of ignored)
|
|
9524
|
+
this.add(ign);
|
|
9525
|
+
}
|
|
9526
|
+
add(ign) {
|
|
9419
9527
|
// this is a little weird, but it gives us a clean set of optimized
|
|
9420
9528
|
// minimatch matchers, without getting tripped up if one of them
|
|
9421
9529
|
// ends in /** inside a brace section, and it's only inefficient at
|
|
@@ -9428,36 +9536,34 @@ class Ignore {
|
|
|
9428
9536
|
// for absolute-ness.
|
|
9429
9537
|
// Yet another way, Minimatch could take an array of glob strings, and
|
|
9430
9538
|
// 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
|
-
|
|
9539
|
+
const mm = new Minimatch(ign, this.mmopts);
|
|
9540
|
+
for (let i = 0; i < mm.set.length; i++) {
|
|
9541
|
+
const parsed = mm.set[i];
|
|
9542
|
+
const globParts = mm.globParts[i];
|
|
9543
|
+
/* c8 ignore start */
|
|
9544
|
+
if (!parsed || !globParts) {
|
|
9545
|
+
throw new Error('invalid pattern object');
|
|
9546
|
+
}
|
|
9547
|
+
// strip off leading ./ portions
|
|
9548
|
+
// https://github.com/isaacs/node-glob/issues/570
|
|
9549
|
+
while (parsed[0] === '.' && globParts[0] === '.') {
|
|
9550
|
+
parsed.shift();
|
|
9551
|
+
globParts.shift();
|
|
9552
|
+
}
|
|
9553
|
+
/* c8 ignore stop */
|
|
9554
|
+
const p = new Pattern(parsed, globParts, 0, this.platform);
|
|
9555
|
+
const m = new Minimatch(p.globString(), this.mmopts);
|
|
9556
|
+
const children = globParts[globParts.length - 1] === '**';
|
|
9557
|
+
const absolute = p.isAbsolute();
|
|
9558
|
+
if (absolute)
|
|
9559
|
+
this.absolute.push(m);
|
|
9560
|
+
else
|
|
9561
|
+
this.relative.push(m);
|
|
9562
|
+
if (children) {
|
|
9451
9563
|
if (absolute)
|
|
9452
|
-
this.
|
|
9564
|
+
this.absoluteChildren.push(m);
|
|
9453
9565
|
else
|
|
9454
|
-
this.
|
|
9455
|
-
if (children) {
|
|
9456
|
-
if (absolute)
|
|
9457
|
-
this.absoluteChildren.push(m);
|
|
9458
|
-
else
|
|
9459
|
-
this.relativeChildren.push(m);
|
|
9460
|
-
}
|
|
9566
|
+
this.relativeChildren.push(m);
|
|
9461
9567
|
}
|
|
9462
9568
|
}
|
|
9463
9569
|
}
|
|
@@ -9589,9 +9695,8 @@ class Processor {
|
|
|
9589
9695
|
this.opts = opts;
|
|
9590
9696
|
this.follow = !!opts.follow;
|
|
9591
9697
|
this.dot = !!opts.dot;
|
|
9592
|
-
this.hasWalkedCache =
|
|
9593
|
-
? hasWalkedCache.copy()
|
|
9594
|
-
: new HasWalkedCache();
|
|
9698
|
+
this.hasWalkedCache =
|
|
9699
|
+
hasWalkedCache ? hasWalkedCache.copy() : new HasWalkedCache();
|
|
9595
9700
|
}
|
|
9596
9701
|
processPatterns(target, patterns) {
|
|
9597
9702
|
this.patterns = patterns;
|
|
@@ -9604,8 +9709,8 @@ class Processor {
|
|
|
9604
9709
|
const absolute = pattern.isAbsolute() && this.opts.absolute !== false;
|
|
9605
9710
|
// start absolute patterns at root
|
|
9606
9711
|
if (root) {
|
|
9607
|
-
t = t.resolve(root === '/' && this.opts.root !== undefined
|
|
9608
|
-
|
|
9712
|
+
t = t.resolve(root === '/' && this.opts.root !== undefined ?
|
|
9713
|
+
this.opts.root
|
|
9609
9714
|
: root);
|
|
9610
9715
|
const rest = pattern.rest();
|
|
9611
9716
|
if (!rest) {
|
|
@@ -9791,10 +9896,8 @@ class Processor {
|
|
|
9791
9896
|
*
|
|
9792
9897
|
* @module
|
|
9793
9898
|
*/
|
|
9794
|
-
const makeIgnore = (ignore, opts) => typeof ignore === 'string'
|
|
9795
|
-
? new Ignore(
|
|
9796
|
-
: Array.isArray(ignore)
|
|
9797
|
-
? new Ignore(ignore, opts)
|
|
9899
|
+
const makeIgnore = (ignore, opts) => typeof ignore === 'string' ? new Ignore([ignore], opts)
|
|
9900
|
+
: Array.isArray(ignore) ? new Ignore(ignore, opts)
|
|
9798
9901
|
: ignore;
|
|
9799
9902
|
/**
|
|
9800
9903
|
* basic walking utilities that all the glob walker types use
|
|
@@ -9811,13 +9914,20 @@ class GlobUtil {
|
|
|
9811
9914
|
#sep;
|
|
9812
9915
|
signal;
|
|
9813
9916
|
maxDepth;
|
|
9917
|
+
includeChildMatches;
|
|
9814
9918
|
constructor(patterns, path, opts) {
|
|
9815
9919
|
this.patterns = patterns;
|
|
9816
9920
|
this.path = path;
|
|
9817
9921
|
this.opts = opts;
|
|
9818
9922
|
this.#sep = !opts.posix && opts.platform === 'win32' ? '\\' : '/';
|
|
9819
|
-
|
|
9820
|
-
|
|
9923
|
+
this.includeChildMatches = opts.includeChildMatches !== false;
|
|
9924
|
+
if (opts.ignore || !this.includeChildMatches) {
|
|
9925
|
+
this.#ignore = makeIgnore(opts.ignore ?? [], opts);
|
|
9926
|
+
if (!this.includeChildMatches &&
|
|
9927
|
+
typeof this.#ignore.add !== 'function') {
|
|
9928
|
+
const m = 'cannot ignore child matches, ignore lacks add() method.';
|
|
9929
|
+
throw new Error(m);
|
|
9930
|
+
}
|
|
9821
9931
|
}
|
|
9822
9932
|
// ignore, always set with maxDepth, but it's optional on the
|
|
9823
9933
|
// GlobOptions type
|
|
@@ -9889,7 +9999,7 @@ class GlobUtil {
|
|
|
9889
9999
|
return this.matchCheckTest(s, ifDir);
|
|
9890
10000
|
}
|
|
9891
10001
|
matchCheckTest(e, ifDir) {
|
|
9892
|
-
return e &&
|
|
10002
|
+
return (e &&
|
|
9893
10003
|
(this.maxDepth === Infinity || e.depth() <= this.maxDepth) &&
|
|
9894
10004
|
(!ifDir || e.canReaddir()) &&
|
|
9895
10005
|
(!this.opts.nodir || !e.isDirectory()) &&
|
|
@@ -9897,8 +10007,8 @@ class GlobUtil {
|
|
|
9897
10007
|
!this.opts.follow ||
|
|
9898
10008
|
!e.isSymbolicLink() ||
|
|
9899
10009
|
!e.realpathCached()?.isDirectory()) &&
|
|
9900
|
-
!this.#ignored(e)
|
|
9901
|
-
|
|
10010
|
+
!this.#ignored(e)) ?
|
|
10011
|
+
e
|
|
9902
10012
|
: undefined;
|
|
9903
10013
|
}
|
|
9904
10014
|
matchCheckSync(e, ifDir) {
|
|
@@ -9924,6 +10034,11 @@ class GlobUtil {
|
|
|
9924
10034
|
matchFinish(e, absolute) {
|
|
9925
10035
|
if (this.#ignored(e))
|
|
9926
10036
|
return;
|
|
10037
|
+
// we know we have an ignore if this is false, but TS doesn't
|
|
10038
|
+
if (!this.includeChildMatches && this.#ignore?.add) {
|
|
10039
|
+
const ign = `${e.relativePosix()}/**`;
|
|
10040
|
+
this.#ignore.add(ign);
|
|
10041
|
+
}
|
|
9927
10042
|
const abs = this.opts.absolute === undefined ? absolute : this.opts.absolute;
|
|
9928
10043
|
this.seen.add(e);
|
|
9929
10044
|
const mark = this.opts.mark && e.isDirectory() ? this.#sep : '';
|
|
@@ -9937,8 +10052,8 @@ class GlobUtil {
|
|
|
9937
10052
|
}
|
|
9938
10053
|
else {
|
|
9939
10054
|
const rel = this.opts.posix ? e.relativePosix() : e.relative();
|
|
9940
|
-
const pre = this.opts.dotRelative && !rel.startsWith('..' + this.#sep)
|
|
9941
|
-
|
|
10055
|
+
const pre = this.opts.dotRelative && !rel.startsWith('..' + this.#sep) ?
|
|
10056
|
+
'.' + this.#sep
|
|
9942
10057
|
: '';
|
|
9943
10058
|
this.matchEmit(!rel ? '.' + mark : pre + rel + mark);
|
|
9944
10059
|
}
|
|
@@ -10077,10 +10192,9 @@ class GlobUtil {
|
|
|
10077
10192
|
}
|
|
10078
10193
|
}
|
|
10079
10194
|
class GlobWalker extends GlobUtil {
|
|
10080
|
-
matches;
|
|
10195
|
+
matches = new Set();
|
|
10081
10196
|
constructor(patterns, path, opts) {
|
|
10082
10197
|
super(patterns, path, opts);
|
|
10083
|
-
this.matches = new Set();
|
|
10084
10198
|
}
|
|
10085
10199
|
matchEmit(e) {
|
|
10086
10200
|
this.matches.add(e);
|
|
@@ -10156,10 +10270,10 @@ class GlobStream extends GlobUtil {
|
|
|
10156
10270
|
|
|
10157
10271
|
// if no process global, just call it linux.
|
|
10158
10272
|
// so we default to case-sensitive, / separators
|
|
10159
|
-
const defaultPlatform = typeof process === 'object' &&
|
|
10273
|
+
const defaultPlatform = (typeof process === 'object' &&
|
|
10160
10274
|
process &&
|
|
10161
|
-
typeof process.platform === 'string'
|
|
10162
|
-
|
|
10275
|
+
typeof process.platform === 'string') ?
|
|
10276
|
+
process.platform
|
|
10163
10277
|
: 'linux';
|
|
10164
10278
|
/**
|
|
10165
10279
|
* An object that can perform glob pattern traversals.
|
|
@@ -10189,6 +10303,7 @@ class Glob {
|
|
|
10189
10303
|
signal;
|
|
10190
10304
|
windowsPathsNoEscape;
|
|
10191
10305
|
withFileTypes;
|
|
10306
|
+
includeChildMatches;
|
|
10192
10307
|
/**
|
|
10193
10308
|
* The options provided to the constructor.
|
|
10194
10309
|
*/
|
|
@@ -10234,6 +10349,7 @@ class Glob {
|
|
|
10234
10349
|
this.noext = !!opts.noext;
|
|
10235
10350
|
this.realpath = !!opts.realpath;
|
|
10236
10351
|
this.absolute = opts.absolute;
|
|
10352
|
+
this.includeChildMatches = opts.includeChildMatches !== false;
|
|
10237
10353
|
this.noglobstar = !!opts.noglobstar;
|
|
10238
10354
|
this.matchBase = !!opts.matchBase;
|
|
10239
10355
|
this.maxDepth =
|
|
@@ -10248,7 +10364,8 @@ class Glob {
|
|
|
10248
10364
|
}
|
|
10249
10365
|
this.windowsPathsNoEscape =
|
|
10250
10366
|
!!opts.windowsPathsNoEscape ||
|
|
10251
|
-
opts.allowWindowsEscape ===
|
|
10367
|
+
opts.allowWindowsEscape ===
|
|
10368
|
+
false;
|
|
10252
10369
|
if (this.windowsPathsNoEscape) {
|
|
10253
10370
|
pattern = pattern.map(p => p.replace(/\\/g, '/'));
|
|
10254
10371
|
}
|
|
@@ -10269,12 +10386,9 @@ class Glob {
|
|
|
10269
10386
|
}
|
|
10270
10387
|
}
|
|
10271
10388
|
else {
|
|
10272
|
-
const Scurry = opts.platform === 'win32'
|
|
10273
|
-
?
|
|
10274
|
-
|
|
10275
|
-
? PathScurryDarwin
|
|
10276
|
-
: opts.platform
|
|
10277
|
-
? PathScurryPosix
|
|
10389
|
+
const Scurry = opts.platform === 'win32' ? PathScurryWin32
|
|
10390
|
+
: opts.platform === 'darwin' ? PathScurryDarwin
|
|
10391
|
+
: opts.platform ? PathScurryPosix
|
|
10278
10392
|
: PathScurry;
|
|
10279
10393
|
this.scurry = new Scurry(this.cwd, {
|
|
10280
10394
|
nocase: opts.nocase,
|
|
@@ -10326,11 +10440,12 @@ class Glob {
|
|
|
10326
10440
|
return [
|
|
10327
10441
|
...(await new GlobWalker(this.patterns, this.scurry.cwd, {
|
|
10328
10442
|
...this.opts,
|
|
10329
|
-
maxDepth: this.maxDepth !== Infinity
|
|
10330
|
-
|
|
10443
|
+
maxDepth: this.maxDepth !== Infinity ?
|
|
10444
|
+
this.maxDepth + this.scurry.cwd.depth()
|
|
10331
10445
|
: Infinity,
|
|
10332
10446
|
platform: this.platform,
|
|
10333
10447
|
nocase: this.nocase,
|
|
10448
|
+
includeChildMatches: this.includeChildMatches,
|
|
10334
10449
|
}).walk()),
|
|
10335
10450
|
];
|
|
10336
10451
|
}
|
|
@@ -10338,32 +10453,35 @@ class Glob {
|
|
|
10338
10453
|
return [
|
|
10339
10454
|
...new GlobWalker(this.patterns, this.scurry.cwd, {
|
|
10340
10455
|
...this.opts,
|
|
10341
|
-
maxDepth: this.maxDepth !== Infinity
|
|
10342
|
-
|
|
10456
|
+
maxDepth: this.maxDepth !== Infinity ?
|
|
10457
|
+
this.maxDepth + this.scurry.cwd.depth()
|
|
10343
10458
|
: Infinity,
|
|
10344
10459
|
platform: this.platform,
|
|
10345
10460
|
nocase: this.nocase,
|
|
10461
|
+
includeChildMatches: this.includeChildMatches,
|
|
10346
10462
|
}).walkSync(),
|
|
10347
10463
|
];
|
|
10348
10464
|
}
|
|
10349
10465
|
stream() {
|
|
10350
10466
|
return new GlobStream(this.patterns, this.scurry.cwd, {
|
|
10351
10467
|
...this.opts,
|
|
10352
|
-
maxDepth: this.maxDepth !== Infinity
|
|
10353
|
-
|
|
10468
|
+
maxDepth: this.maxDepth !== Infinity ?
|
|
10469
|
+
this.maxDepth + this.scurry.cwd.depth()
|
|
10354
10470
|
: Infinity,
|
|
10355
10471
|
platform: this.platform,
|
|
10356
10472
|
nocase: this.nocase,
|
|
10473
|
+
includeChildMatches: this.includeChildMatches,
|
|
10357
10474
|
}).stream();
|
|
10358
10475
|
}
|
|
10359
10476
|
streamSync() {
|
|
10360
10477
|
return new GlobStream(this.patterns, this.scurry.cwd, {
|
|
10361
10478
|
...this.opts,
|
|
10362
|
-
maxDepth: this.maxDepth !== Infinity
|
|
10363
|
-
|
|
10479
|
+
maxDepth: this.maxDepth !== Infinity ?
|
|
10480
|
+
this.maxDepth + this.scurry.cwd.depth()
|
|
10364
10481
|
: Infinity,
|
|
10365
10482
|
platform: this.platform,
|
|
10366
10483
|
nocase: this.nocase,
|
|
10484
|
+
includeChildMatches: this.includeChildMatches,
|
|
10367
10485
|
}).streamSync();
|
|
10368
10486
|
}
|
|
10369
10487
|
/**
|
|
@@ -10439,7 +10557,6 @@ const sync$9 = Object.assign(globSync, {
|
|
|
10439
10557
|
stream: globStreamSync,
|
|
10440
10558
|
iterate: globIterateSync,
|
|
10441
10559
|
});
|
|
10442
|
-
/* c8 ignore stop */
|
|
10443
10560
|
const glob$1 = Object.assign(glob_, {
|
|
10444
10561
|
glob: glob_,
|
|
10445
10562
|
globSync,
|
|
@@ -12296,11 +12413,11 @@ function requireNode () {
|
|
|
12296
12413
|
}
|
|
12297
12414
|
|
|
12298
12415
|
/**
|
|
12299
|
-
* Invokes `util.
|
|
12416
|
+
* Invokes `util.formatWithOptions()` with the specified arguments and writes to stderr.
|
|
12300
12417
|
*/
|
|
12301
12418
|
|
|
12302
12419
|
function log(...args) {
|
|
12303
|
-
return process.stderr.write(util.
|
|
12420
|
+
return process.stderr.write(util.formatWithOptions(exports.inspectOpts, ...args) + '\n');
|
|
12304
12421
|
}
|
|
12305
12422
|
|
|
12306
12423
|
/**
|
|
@@ -12888,7 +13005,7 @@ var utils$r = {};
|
|
|
12888
13005
|
*/
|
|
12889
13006
|
|
|
12890
13007
|
exports.escapeNode = (block, n = 0, type) => {
|
|
12891
|
-
|
|
13008
|
+
const node = block.nodes[n];
|
|
12892
13009
|
if (!node) return;
|
|
12893
13010
|
|
|
12894
13011
|
if ((type && node.type === type) || node.type === 'open' || node.type === 'close') {
|
|
@@ -12957,13 +13074,23 @@ var utils$r = {};
|
|
|
12957
13074
|
|
|
12958
13075
|
exports.flatten = (...args) => {
|
|
12959
13076
|
const result = [];
|
|
13077
|
+
|
|
12960
13078
|
const flat = arr => {
|
|
12961
13079
|
for (let i = 0; i < arr.length; i++) {
|
|
12962
|
-
|
|
12963
|
-
|
|
13080
|
+
const ele = arr[i];
|
|
13081
|
+
|
|
13082
|
+
if (Array.isArray(ele)) {
|
|
13083
|
+
flat(ele);
|
|
13084
|
+
continue;
|
|
13085
|
+
}
|
|
13086
|
+
|
|
13087
|
+
if (ele !== undefined) {
|
|
13088
|
+
result.push(ele);
|
|
13089
|
+
}
|
|
12964
13090
|
}
|
|
12965
13091
|
return result;
|
|
12966
13092
|
};
|
|
13093
|
+
|
|
12967
13094
|
flat(args);
|
|
12968
13095
|
return result;
|
|
12969
13096
|
};
|
|
@@ -12972,9 +13099,9 @@ var utils$r = {};
|
|
|
12972
13099
|
const utils$q = utils$r;
|
|
12973
13100
|
|
|
12974
13101
|
var stringify$7 = (ast, options = {}) => {
|
|
12975
|
-
|
|
12976
|
-
|
|
12977
|
-
|
|
13102
|
+
const stringify = (node, parent = {}) => {
|
|
13103
|
+
const invalidBlock = options.escapeInvalid && utils$q.isInvalidBrace(parent);
|
|
13104
|
+
const invalidNode = node.invalid === true && options.escapeInvalid === true;
|
|
12978
13105
|
let output = '';
|
|
12979
13106
|
|
|
12980
13107
|
if (node.value) {
|
|
@@ -12989,7 +13116,7 @@ var stringify$7 = (ast, options = {}) => {
|
|
|
12989
13116
|
}
|
|
12990
13117
|
|
|
12991
13118
|
if (node.nodes) {
|
|
12992
|
-
for (
|
|
13119
|
+
for (const child of node.nodes) {
|
|
12993
13120
|
output += stringify(child);
|
|
12994
13121
|
}
|
|
12995
13122
|
}
|
|
@@ -13363,7 +13490,7 @@ const toMaxLen = (input, maxLength) => {
|
|
|
13363
13490
|
return negative ? ('-' + input) : input;
|
|
13364
13491
|
};
|
|
13365
13492
|
|
|
13366
|
-
const toSequence = (parts, options) => {
|
|
13493
|
+
const toSequence = (parts, options, maxLen) => {
|
|
13367
13494
|
parts.negatives.sort((a, b) => a < b ? -1 : a > b ? 1 : 0);
|
|
13368
13495
|
parts.positives.sort((a, b) => a < b ? -1 : a > b ? 1 : 0);
|
|
13369
13496
|
|
|
@@ -13373,11 +13500,11 @@ const toSequence = (parts, options) => {
|
|
|
13373
13500
|
let result;
|
|
13374
13501
|
|
|
13375
13502
|
if (parts.positives.length) {
|
|
13376
|
-
positives = parts.positives.join('|');
|
|
13503
|
+
positives = parts.positives.map(v => toMaxLen(String(v), maxLen)).join('|');
|
|
13377
13504
|
}
|
|
13378
13505
|
|
|
13379
13506
|
if (parts.negatives.length) {
|
|
13380
|
-
negatives = `-(${prefix}${parts.negatives.join('|')})`;
|
|
13507
|
+
negatives = `-(${prefix}${parts.negatives.map(v => toMaxLen(String(v), maxLen)).join('|')})`;
|
|
13381
13508
|
}
|
|
13382
13509
|
|
|
13383
13510
|
if (positives && negatives) {
|
|
@@ -13475,7 +13602,7 @@ const fillNumbers = (start, end, step = 1, options = {}) => {
|
|
|
13475
13602
|
|
|
13476
13603
|
if (options.toRegex === true) {
|
|
13477
13604
|
return step > 1
|
|
13478
|
-
? toSequence(parts, options)
|
|
13605
|
+
? toSequence(parts, options, maxLen)
|
|
13479
13606
|
: toRegex(range, null, { wrap: false, ...options });
|
|
13480
13607
|
}
|
|
13481
13608
|
|
|
@@ -13487,7 +13614,6 @@ const fillLetters = (start, end, step = 1, options = {}) => {
|
|
|
13487
13614
|
return invalidRange(start, end, options);
|
|
13488
13615
|
}
|
|
13489
13616
|
|
|
13490
|
-
|
|
13491
13617
|
let format = options.transform || (val => String.fromCharCode(val));
|
|
13492
13618
|
let a = `${start}`.charCodeAt(0);
|
|
13493
13619
|
let b = `${end}`.charCodeAt(0);
|
|
@@ -13555,30 +13681,32 @@ const fill$1 = fillRange;
|
|
|
13555
13681
|
const utils$p = utils$r;
|
|
13556
13682
|
|
|
13557
13683
|
const compile$3 = (ast, options = {}) => {
|
|
13558
|
-
|
|
13559
|
-
|
|
13560
|
-
|
|
13561
|
-
|
|
13562
|
-
|
|
13684
|
+
const walk = (node, parent = {}) => {
|
|
13685
|
+
const invalidBlock = utils$p.isInvalidBrace(parent);
|
|
13686
|
+
const invalidNode = node.invalid === true && options.escapeInvalid === true;
|
|
13687
|
+
const invalid = invalidBlock === true || invalidNode === true;
|
|
13688
|
+
const prefix = options.escapeInvalid === true ? '\\' : '';
|
|
13563
13689
|
let output = '';
|
|
13564
13690
|
|
|
13565
13691
|
if (node.isOpen === true) {
|
|
13566
13692
|
return prefix + node.value;
|
|
13567
13693
|
}
|
|
13694
|
+
|
|
13568
13695
|
if (node.isClose === true) {
|
|
13696
|
+
console.log('node.isClose', prefix, node.value);
|
|
13569
13697
|
return prefix + node.value;
|
|
13570
13698
|
}
|
|
13571
13699
|
|
|
13572
13700
|
if (node.type === 'open') {
|
|
13573
|
-
return invalid ?
|
|
13701
|
+
return invalid ? prefix + node.value : '(';
|
|
13574
13702
|
}
|
|
13575
13703
|
|
|
13576
13704
|
if (node.type === 'close') {
|
|
13577
|
-
return invalid ?
|
|
13705
|
+
return invalid ? prefix + node.value : ')';
|
|
13578
13706
|
}
|
|
13579
13707
|
|
|
13580
13708
|
if (node.type === 'comma') {
|
|
13581
|
-
return node.prev.type === 'comma' ? '' :
|
|
13709
|
+
return node.prev.type === 'comma' ? '' : invalid ? node.value : '|';
|
|
13582
13710
|
}
|
|
13583
13711
|
|
|
13584
13712
|
if (node.value) {
|
|
@@ -13586,8 +13714,8 @@ const compile$3 = (ast, options = {}) => {
|
|
|
13586
13714
|
}
|
|
13587
13715
|
|
|
13588
13716
|
if (node.nodes && node.ranges > 0) {
|
|
13589
|
-
|
|
13590
|
-
|
|
13717
|
+
const args = utils$p.reduce(node.nodes);
|
|
13718
|
+
const range = fill$1(...args, { ...options, wrap: false, toRegex: true, strictZeros: true });
|
|
13591
13719
|
|
|
13592
13720
|
if (range.length !== 0) {
|
|
13593
13721
|
return args.length > 1 && range.length > 1 ? `(${range})` : range;
|
|
@@ -13595,10 +13723,11 @@ const compile$3 = (ast, options = {}) => {
|
|
|
13595
13723
|
}
|
|
13596
13724
|
|
|
13597
13725
|
if (node.nodes) {
|
|
13598
|
-
for (
|
|
13726
|
+
for (const child of node.nodes) {
|
|
13599
13727
|
output += walk(child, node);
|
|
13600
13728
|
}
|
|
13601
13729
|
}
|
|
13730
|
+
|
|
13602
13731
|
return output;
|
|
13603
13732
|
};
|
|
13604
13733
|
|
|
@@ -13612,7 +13741,7 @@ const stringify$5 = stringify$7;
|
|
|
13612
13741
|
const utils$o = utils$r;
|
|
13613
13742
|
|
|
13614
13743
|
const append = (queue = '', stash = '', enclose = false) => {
|
|
13615
|
-
|
|
13744
|
+
const result = [];
|
|
13616
13745
|
|
|
13617
13746
|
queue = [].concat(queue);
|
|
13618
13747
|
stash = [].concat(stash);
|
|
@@ -13622,15 +13751,15 @@ const append = (queue = '', stash = '', enclose = false) => {
|
|
|
13622
13751
|
return enclose ? utils$o.flatten(stash).map(ele => `{${ele}}`) : stash;
|
|
13623
13752
|
}
|
|
13624
13753
|
|
|
13625
|
-
for (
|
|
13754
|
+
for (const item of queue) {
|
|
13626
13755
|
if (Array.isArray(item)) {
|
|
13627
|
-
for (
|
|
13756
|
+
for (const value of item) {
|
|
13628
13757
|
result.push(append(value, stash, enclose));
|
|
13629
13758
|
}
|
|
13630
13759
|
} else {
|
|
13631
13760
|
for (let ele of stash) {
|
|
13632
13761
|
if (enclose === true && typeof ele === 'string') ele = `{${ele}}`;
|
|
13633
|
-
result.push(Array.isArray(ele) ? append(item, ele, enclose) :
|
|
13762
|
+
result.push(Array.isArray(ele) ? append(item, ele, enclose) : item + ele);
|
|
13634
13763
|
}
|
|
13635
13764
|
}
|
|
13636
13765
|
}
|
|
@@ -13638,9 +13767,9 @@ const append = (queue = '', stash = '', enclose = false) => {
|
|
|
13638
13767
|
};
|
|
13639
13768
|
|
|
13640
13769
|
const expand$1 = (ast, options = {}) => {
|
|
13641
|
-
|
|
13770
|
+
const rangeLimit = options.rangeLimit === undefined ? 1000 : options.rangeLimit;
|
|
13642
13771
|
|
|
13643
|
-
|
|
13772
|
+
const walk = (node, parent = {}) => {
|
|
13644
13773
|
node.queue = [];
|
|
13645
13774
|
|
|
13646
13775
|
let p = parent;
|
|
@@ -13662,7 +13791,7 @@ const expand$1 = (ast, options = {}) => {
|
|
|
13662
13791
|
}
|
|
13663
13792
|
|
|
13664
13793
|
if (node.nodes && node.ranges > 0) {
|
|
13665
|
-
|
|
13794
|
+
const args = utils$o.reduce(node.nodes);
|
|
13666
13795
|
|
|
13667
13796
|
if (utils$o.exceedsLimit(...args, options.step, rangeLimit)) {
|
|
13668
13797
|
throw new RangeError('expanded array length exceeds range limit. Use options.rangeLimit to increase or disable the limit.');
|
|
@@ -13678,7 +13807,7 @@ const expand$1 = (ast, options = {}) => {
|
|
|
13678
13807
|
return;
|
|
13679
13808
|
}
|
|
13680
13809
|
|
|
13681
|
-
|
|
13810
|
+
const enclose = utils$o.encloseBrace(node);
|
|
13682
13811
|
let queue = node.queue;
|
|
13683
13812
|
let block = node;
|
|
13684
13813
|
|
|
@@ -13688,7 +13817,7 @@ const expand$1 = (ast, options = {}) => {
|
|
|
13688
13817
|
}
|
|
13689
13818
|
|
|
13690
13819
|
for (let i = 0; i < node.nodes.length; i++) {
|
|
13691
|
-
|
|
13820
|
+
const child = node.nodes[i];
|
|
13692
13821
|
|
|
13693
13822
|
if (child.type === 'comma' && node.type === 'brace') {
|
|
13694
13823
|
if (i === 1) queue.push('');
|
|
@@ -13720,7 +13849,7 @@ const expand$1 = (ast, options = {}) => {
|
|
|
13720
13849
|
var expand_1 = expand$1;
|
|
13721
13850
|
|
|
13722
13851
|
var constants$4 = {
|
|
13723
|
-
MAX_LENGTH:
|
|
13852
|
+
MAX_LENGTH: 10000,
|
|
13724
13853
|
|
|
13725
13854
|
// Digits
|
|
13726
13855
|
CHAR_0: '0', /* 0 */
|
|
@@ -13808,18 +13937,18 @@ const parse$a = (input, options = {}) => {
|
|
|
13808
13937
|
throw new TypeError('Expected a string');
|
|
13809
13938
|
}
|
|
13810
13939
|
|
|
13811
|
-
|
|
13812
|
-
|
|
13940
|
+
const opts = options || {};
|
|
13941
|
+
const max = typeof opts.maxLength === 'number' ? Math.min(MAX_LENGTH$1, opts.maxLength) : MAX_LENGTH$1;
|
|
13813
13942
|
if (input.length > max) {
|
|
13814
13943
|
throw new SyntaxError(`Input length (${input.length}), exceeds max characters (${max})`);
|
|
13815
13944
|
}
|
|
13816
13945
|
|
|
13817
|
-
|
|
13818
|
-
|
|
13946
|
+
const ast = { type: 'root', input, nodes: [] };
|
|
13947
|
+
const stack = [ast];
|
|
13819
13948
|
let block = ast;
|
|
13820
13949
|
let prev = ast;
|
|
13821
13950
|
let brackets = 0;
|
|
13822
|
-
|
|
13951
|
+
const length = input.length;
|
|
13823
13952
|
let index = 0;
|
|
13824
13953
|
let depth = 0;
|
|
13825
13954
|
let value;
|
|
@@ -13884,6 +14013,7 @@ const parse$a = (input, options = {}) => {
|
|
|
13884
14013
|
|
|
13885
14014
|
if (value === CHAR_LEFT_SQUARE_BRACKET$2) {
|
|
13886
14015
|
brackets++;
|
|
14016
|
+
|
|
13887
14017
|
let next;
|
|
13888
14018
|
|
|
13889
14019
|
while (index < length && (next = advance())) {
|
|
@@ -13939,7 +14069,7 @@ const parse$a = (input, options = {}) => {
|
|
|
13939
14069
|
*/
|
|
13940
14070
|
|
|
13941
14071
|
if (value === CHAR_DOUBLE_QUOTE$1 || value === CHAR_SINGLE_QUOTE$1 || value === CHAR_BACKTICK) {
|
|
13942
|
-
|
|
14072
|
+
const open = value;
|
|
13943
14073
|
let next;
|
|
13944
14074
|
|
|
13945
14075
|
if (options.keepQuotes !== true) {
|
|
@@ -13971,8 +14101,8 @@ const parse$a = (input, options = {}) => {
|
|
|
13971
14101
|
if (value === CHAR_LEFT_CURLY_BRACE$1) {
|
|
13972
14102
|
depth++;
|
|
13973
14103
|
|
|
13974
|
-
|
|
13975
|
-
|
|
14104
|
+
const dollar = prev.value && prev.value.slice(-1) === '$' || block.dollar === true;
|
|
14105
|
+
const brace = {
|
|
13976
14106
|
type: 'brace',
|
|
13977
14107
|
open: true,
|
|
13978
14108
|
close: false,
|
|
@@ -13999,7 +14129,7 @@ const parse$a = (input, options = {}) => {
|
|
|
13999
14129
|
continue;
|
|
14000
14130
|
}
|
|
14001
14131
|
|
|
14002
|
-
|
|
14132
|
+
const type = 'close';
|
|
14003
14133
|
block = stack.pop();
|
|
14004
14134
|
block.close = true;
|
|
14005
14135
|
|
|
@@ -14017,7 +14147,7 @@ const parse$a = (input, options = {}) => {
|
|
|
14017
14147
|
if (value === CHAR_COMMA$2 && depth > 0) {
|
|
14018
14148
|
if (block.ranges > 0) {
|
|
14019
14149
|
block.ranges = 0;
|
|
14020
|
-
|
|
14150
|
+
const open = block.nodes.shift();
|
|
14021
14151
|
block.nodes = [open, { type: 'text', value: stringify$4(block) }];
|
|
14022
14152
|
}
|
|
14023
14153
|
|
|
@@ -14031,7 +14161,7 @@ const parse$a = (input, options = {}) => {
|
|
|
14031
14161
|
*/
|
|
14032
14162
|
|
|
14033
14163
|
if (value === CHAR_DOT$1 && depth > 0 && block.commas === 0) {
|
|
14034
|
-
|
|
14164
|
+
const siblings = block.nodes;
|
|
14035
14165
|
|
|
14036
14166
|
if (depth === 0 || siblings.length === 0) {
|
|
14037
14167
|
push({ type: 'text', value });
|
|
@@ -14058,7 +14188,7 @@ const parse$a = (input, options = {}) => {
|
|
|
14058
14188
|
if (prev.type === 'range') {
|
|
14059
14189
|
siblings.pop();
|
|
14060
14190
|
|
|
14061
|
-
|
|
14191
|
+
const before = siblings[siblings.length - 1];
|
|
14062
14192
|
before.value += prev.value + value;
|
|
14063
14193
|
prev = before;
|
|
14064
14194
|
block.ranges--;
|
|
@@ -14091,8 +14221,8 @@ const parse$a = (input, options = {}) => {
|
|
|
14091
14221
|
});
|
|
14092
14222
|
|
|
14093
14223
|
// get the location of the block on parent.nodes (block's siblings)
|
|
14094
|
-
|
|
14095
|
-
|
|
14224
|
+
const parent = stack[stack.length - 1];
|
|
14225
|
+
const index = parent.nodes.indexOf(block);
|
|
14096
14226
|
// replace the (invalid) block with it's nodes
|
|
14097
14227
|
parent.nodes.splice(index, 1, ...block.nodes);
|
|
14098
14228
|
}
|
|
@@ -14127,8 +14257,8 @@ const braces$1 = (input, options = {}) => {
|
|
|
14127
14257
|
let output = [];
|
|
14128
14258
|
|
|
14129
14259
|
if (Array.isArray(input)) {
|
|
14130
|
-
for (
|
|
14131
|
-
|
|
14260
|
+
for (const pattern of input) {
|
|
14261
|
+
const result = braces$1.create(pattern, options);
|
|
14132
14262
|
if (Array.isArray(result)) {
|
|
14133
14263
|
output.push(...result);
|
|
14134
14264
|
} else {
|
|
@@ -14262,7 +14392,7 @@ braces$1.create = (input, options = {}) => {
|
|
|
14262
14392
|
return [input];
|
|
14263
14393
|
}
|
|
14264
14394
|
|
|
14265
|
-
|
|
14395
|
+
return options.expand !== true
|
|
14266
14396
|
? braces$1.compile(input, options)
|
|
14267
14397
|
: braces$1.expand(input, options);
|
|
14268
14398
|
};
|
|
@@ -20113,12 +20243,15 @@ function resolveSiteDataHead(userConfig) {
|
|
|
20113
20243
|
head.push([
|
|
20114
20244
|
"script",
|
|
20115
20245
|
{ id: "check-dark-mode" },
|
|
20116
|
-
fallbackPreference === "force-dark" ? `document.documentElement.classList.add('dark')` : `;(() => {
|
|
20117
|
-
|
|
20118
|
-
|
|
20119
|
-
|
|
20120
|
-
|
|
20121
|
-
|
|
20246
|
+
fallbackPreference === "force-dark" ? `document.documentElement.classList.add('dark')` : fallbackPreference === "force-auto" ? `;(() => {
|
|
20247
|
+
if (window.matchMedia('(prefers-color-scheme: dark)').matches)
|
|
20248
|
+
document.documentElement.classList.add('dark')
|
|
20249
|
+
})()` : `;(() => {
|
|
20250
|
+
const preference = localStorage.getItem('${APPEARANCE_KEY}') || '${fallbackPreference}'
|
|
20251
|
+
const prefersDark = window.matchMedia('(prefers-color-scheme: dark)').matches
|
|
20252
|
+
if (!preference || preference === 'auto' ? prefersDark : preference === 'dark')
|
|
20253
|
+
document.documentElement.classList.add('dark')
|
|
20254
|
+
})()`
|
|
20122
20255
|
]);
|
|
20123
20256
|
}
|
|
20124
20257
|
head.push([
|
|
@@ -37296,7 +37429,9 @@ const linkPlugin = (md, externalAttrs, base) => {
|
|
|
37296
37429
|
md.renderer.rules.link_open = (tokens, idx, options, env, self) => {
|
|
37297
37430
|
const token = tokens[idx];
|
|
37298
37431
|
const hrefIndex = token.attrIndex("href");
|
|
37299
|
-
|
|
37432
|
+
const targetIndex = token.attrIndex("target");
|
|
37433
|
+
const downloadIndex = token.attrIndex("download");
|
|
37434
|
+
if (hrefIndex >= 0 && targetIndex < 0 && downloadIndex < 0) {
|
|
37300
37435
|
const hrefAttr = token.attrs[hrefIndex];
|
|
37301
37436
|
const url = hrefAttr[1];
|
|
37302
37437
|
if (isExternal(url)) {
|
|
@@ -37529,6 +37664,9 @@ const createMarkdownRenderer = async (srcDir, options = {}, base = "/", logger =
|
|
|
37529
37664
|
{ target: "_blank", rel: "noreferrer", ...options.externalLinks },
|
|
37530
37665
|
base
|
|
37531
37666
|
).use(lineNumberPlugin, options.lineNumbers);
|
|
37667
|
+
md.renderer.rules.table_open = function(tokens, idx, options2, env, self) {
|
|
37668
|
+
return '<table tabindex="0">\n';
|
|
37669
|
+
};
|
|
37532
37670
|
if (options.gfmAlerts !== false) {
|
|
37533
37671
|
md.use(gitHubAlertsPlugin);
|
|
37534
37672
|
}
|
|
@@ -37574,6 +37712,13 @@ const createMarkdownRenderer = async (srcDir, options = {}, base = "/", logger =
|
|
|
37574
37712
|
md.use(mathPlugin.default ?? mathPlugin, {
|
|
37575
37713
|
...typeof options.math === "boolean" ? {} : options.math
|
|
37576
37714
|
});
|
|
37715
|
+
const orig = md.renderer.rules.math_block;
|
|
37716
|
+
md.renderer.rules.math_block = (tokens, idx, options2, env, self) => {
|
|
37717
|
+
return orig(tokens, idx, options2, env, self).replace(
|
|
37718
|
+
/^<mjx-container /,
|
|
37719
|
+
'<mjx-container tabindex="0" '
|
|
37720
|
+
);
|
|
37721
|
+
};
|
|
37577
37722
|
} catch (error) {
|
|
37578
37723
|
throw new Error(
|
|
37579
37724
|
"You need to install `markdown-it-mathjax3` to use math support."
|
|
@@ -38221,13 +38366,13 @@ const cache$2 = /* @__PURE__ */ new Map();
|
|
|
38221
38366
|
function getGitTimestamp(file) {
|
|
38222
38367
|
const cached = cache$2.get(file);
|
|
38223
38368
|
if (cached) return cached;
|
|
38369
|
+
if (!fs$a.existsSync(file)) return 0;
|
|
38224
38370
|
return new Promise((resolve, reject) => {
|
|
38225
|
-
const
|
|
38226
|
-
|
|
38227
|
-
|
|
38228
|
-
|
|
38229
|
-
|
|
38230
|
-
});
|
|
38371
|
+
const child = spawn_1(
|
|
38372
|
+
"git",
|
|
38373
|
+
["log", "-1", '--pretty="%ai"', basename(file)],
|
|
38374
|
+
{ cwd: dirname(file) }
|
|
38375
|
+
);
|
|
38231
38376
|
let output = "";
|
|
38232
38377
|
child.stdout.on("data", (d) => output += String(d));
|
|
38233
38378
|
child.on("close", () => {
|
|
@@ -38241,15 +38386,27 @@ function getGitTimestamp(file) {
|
|
|
38241
38386
|
|
|
38242
38387
|
function processIncludes(srcDir, src, file, includes) {
|
|
38243
38388
|
const includesRE = /<!--\s*@include:\s*(.*?)\s*-->/g;
|
|
38389
|
+
const regionRE = /(#[\w-]+)/;
|
|
38244
38390
|
const rangeRE = /\{(\d*),(\d*)\}$/;
|
|
38245
38391
|
return src.replace(includesRE, (m, m1) => {
|
|
38246
38392
|
if (!m1.length) return m;
|
|
38247
38393
|
const range = m1.match(rangeRE);
|
|
38248
|
-
|
|
38394
|
+
const region = m1.match(regionRE);
|
|
38395
|
+
const hasMeta = !!(region || range);
|
|
38396
|
+
if (hasMeta) {
|
|
38397
|
+
const len = (region?.[0].length || 0) + (range?.[0].length || 0);
|
|
38398
|
+
m1 = m1.slice(0, -len);
|
|
38399
|
+
}
|
|
38249
38400
|
const atPresent = m1[0] === "@";
|
|
38250
38401
|
try {
|
|
38251
38402
|
const includePath = atPresent ? path$q.join(srcDir, m1.slice(m1[1] === "/" ? 2 : 1)) : path$q.join(path$q.dirname(file), m1);
|
|
38252
38403
|
let content = fs$a.readFileSync(includePath, "utf-8");
|
|
38404
|
+
if (region) {
|
|
38405
|
+
const [regionName] = region;
|
|
38406
|
+
const lines = content.split(/\r?\n/);
|
|
38407
|
+
const regionLines = findRegion(lines, regionName.slice(1));
|
|
38408
|
+
content = lines.slice(regionLines?.start, regionLines?.end).join("\n");
|
|
38409
|
+
}
|
|
38253
38410
|
if (range) {
|
|
38254
38411
|
const [, startLine, endLine] = range;
|
|
38255
38412
|
const lines = content.split(/\r?\n/);
|
|
@@ -38257,12 +38414,17 @@ function processIncludes(srcDir, src, file, includes) {
|
|
|
38257
38414
|
startLine ? parseInt(startLine, 10) - 1 : void 0,
|
|
38258
38415
|
endLine ? parseInt(endLine, 10) : void 0
|
|
38259
38416
|
).join("\n");
|
|
38260
|
-
}
|
|
38417
|
+
}
|
|
38418
|
+
if (!hasMeta && path$q.extname(includePath) === ".md") {
|
|
38261
38419
|
content = matter$1(content).content;
|
|
38262
38420
|
}
|
|
38263
38421
|
includes.push(slash(includePath));
|
|
38264
38422
|
return processIncludes(srcDir, content, includePath, includes);
|
|
38265
38423
|
} catch (error) {
|
|
38424
|
+
if (process.env.DEBUG) {
|
|
38425
|
+
process.stderr.write(c$1.yellow(`
|
|
38426
|
+
Include file not found: ${m1}`));
|
|
38427
|
+
}
|
|
38266
38428
|
return m;
|
|
38267
38429
|
}
|
|
38268
38430
|
});
|
|
@@ -38383,8 +38545,12 @@ async function createMarkdownToVueRenderFn(srcDir, options = {}, pages, isBuild
|
|
|
38383
38545
|
relativePath,
|
|
38384
38546
|
filePath: slash(path$q.relative(srcDir, fileOrig))
|
|
38385
38547
|
};
|
|
38386
|
-
if (includeLastUpdatedData) {
|
|
38387
|
-
|
|
38548
|
+
if (includeLastUpdatedData && frontmatter.lastUpdated !== false) {
|
|
38549
|
+
if (frontmatter.lastUpdated instanceof Date) {
|
|
38550
|
+
pageData.lastUpdated = +frontmatter.lastUpdated;
|
|
38551
|
+
} else {
|
|
38552
|
+
pageData.lastUpdated = await getGitTimestamp(fileOrig);
|
|
38553
|
+
}
|
|
38388
38554
|
}
|
|
38389
38555
|
if (siteConfig?.transformPageData) {
|
|
38390
38556
|
const dataToMerge = await siteConfig.transformPageData(pageData, {
|
|
@@ -42283,7 +42449,7 @@ async function createVitePressPlugin(siteConfig, ssr = false, pageToHashMap, cli
|
|
|
42283
42449
|
let isCustomElement = userCustomElementChecker;
|
|
42284
42450
|
if (markdown?.math) {
|
|
42285
42451
|
isCustomElement = (tag) => {
|
|
42286
|
-
if (
|
|
42452
|
+
if (tag.startsWith("mjx-")) {
|
|
42287
42453
|
return true;
|
|
42288
42454
|
}
|
|
42289
42455
|
return userCustomElementChecker?.(tag) ?? false;
|
|
@@ -42750,7 +42916,11 @@ async function bundle(config, options) {
|
|
|
42750
42916
|
clientResult = await buildMPAClient(clientJSMap, config);
|
|
42751
42917
|
}
|
|
42752
42918
|
}
|
|
42753
|
-
|
|
42919
|
+
const sortedPageToHashMap = /* @__PURE__ */ Object.create(null);
|
|
42920
|
+
Object.keys(pageToHashMap).sort().forEach((key) => {
|
|
42921
|
+
sortedPageToHashMap[key] = pageToHashMap[key];
|
|
42922
|
+
});
|
|
42923
|
+
return { clientResult, serverResult, pageToHashMap: sortedPageToHashMap };
|
|
42754
42924
|
}
|
|
42755
42925
|
const cache = /* @__PURE__ */ new Map();
|
|
42756
42926
|
const cacheTheme = /* @__PURE__ */ new Map();
|
|
@@ -43853,8 +44023,12 @@ utils.normalizeURL = normalizeURL;
|
|
|
43853
44023
|
this.hasHeadOutput = true;
|
|
43854
44024
|
this.push(getURLSetNs(this.xmlNS, this.xslUrl));
|
|
43855
44025
|
}
|
|
43856
|
-
this.smiStream.write((0, utils_1.validateSMIOptions)((0, utils_1.normalizeURL)(item, this.hostname, this.lastmodDateOnly), this.level, this.errorHandler))
|
|
43857
|
-
|
|
44026
|
+
if (!this.smiStream.write((0, utils_1.validateSMIOptions)((0, utils_1.normalizeURL)(item, this.hostname, this.lastmodDateOnly), this.level, this.errorHandler))) {
|
|
44027
|
+
this.smiStream.once('drain', callback);
|
|
44028
|
+
}
|
|
44029
|
+
else {
|
|
44030
|
+
process.nextTick(callback);
|
|
44031
|
+
}
|
|
43858
44032
|
}
|
|
43859
44033
|
_flush(cb) {
|
|
43860
44034
|
if (!this.hasHeadOutput) {
|
|
@@ -43868,19 +44042,31 @@ utils.normalizeURL = normalizeURL;
|
|
|
43868
44042
|
}
|
|
43869
44043
|
exports.SitemapStream = SitemapStream;
|
|
43870
44044
|
/**
|
|
43871
|
-
*
|
|
43872
|
-
*
|
|
44045
|
+
* Converts a readable stream into a promise that resolves with the concatenated data from the stream.
|
|
44046
|
+
*
|
|
44047
|
+
* 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.
|
|
44048
|
+
*
|
|
44049
|
+
* ⚠️ 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.
|
|
44050
|
+
*
|
|
44051
|
+
* @param {Readable} stream - The readable stream to convert to a promise.
|
|
44052
|
+
* @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.
|
|
44053
|
+
* @throws {EmptyStream} If the stream is empty.
|
|
43873
44054
|
*/
|
|
43874
44055
|
function streamToPromise(stream) {
|
|
43875
44056
|
return new Promise((resolve, reject) => {
|
|
43876
44057
|
const drain = [];
|
|
43877
44058
|
stream
|
|
44059
|
+
// Error propagation is not automatic
|
|
44060
|
+
// Bubble up errors on the read stream
|
|
44061
|
+
.on('error', reject)
|
|
43878
44062
|
.pipe(new stream_1.Writable({
|
|
43879
44063
|
write(chunk, enc, next) {
|
|
43880
44064
|
drain.push(chunk);
|
|
43881
44065
|
next();
|
|
43882
44066
|
},
|
|
43883
44067
|
}))
|
|
44068
|
+
// This bubbles up errors when writing to the internal buffer
|
|
44069
|
+
// This is unlikely to happen, but we have this for completeness
|
|
43884
44070
|
.on('error', reject)
|
|
43885
44071
|
.on('finish', () => {
|
|
43886
44072
|
if (!drain.length) {
|
|
@@ -43912,7 +44098,27 @@ utils.normalizeURL = normalizeURL;
|
|
|
43912
44098
|
const sitemapIndexTagStart = '<sitemapindex xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">';
|
|
43913
44099
|
const closetag = '</sitemapindex>';
|
|
43914
44100
|
const defaultStreamOpts = {};
|
|
44101
|
+
/**
|
|
44102
|
+
* `SitemapIndexStream` is a Transform stream that takes `IndexItem`s or sitemap URL strings and outputs a stream of sitemap index XML.
|
|
44103
|
+
*
|
|
44104
|
+
* It automatically handles the XML declaration and the opening and closing tags for the sitemap index.
|
|
44105
|
+
*
|
|
44106
|
+
* ⚠️ CAUTION: This object is `readable` and must be read (e.g. piped to a file or to /dev/null)
|
|
44107
|
+
* before `finish` will be emitted. Failure to read the stream will result in hangs.
|
|
44108
|
+
*
|
|
44109
|
+
* @extends {Transform}
|
|
44110
|
+
*/
|
|
43915
44111
|
class SitemapIndexStream extends stream_1.Transform {
|
|
44112
|
+
/**
|
|
44113
|
+
* `SitemapIndexStream` is a Transform stream that takes `IndexItem`s or sitemap URL strings and outputs a stream of sitemap index XML.
|
|
44114
|
+
*
|
|
44115
|
+
* It automatically handles the XML declaration and the opening and closing tags for the sitemap index.
|
|
44116
|
+
*
|
|
44117
|
+
* ⚠️ CAUTION: This object is `readable` and must be read (e.g. piped to a file or to /dev/null)
|
|
44118
|
+
* before `finish` will be emitted. Failure to read the stream will result in hangs.
|
|
44119
|
+
*
|
|
44120
|
+
* @param {SitemapIndexStreamOptions} [opts=defaultStreamOpts] - Stream options.
|
|
44121
|
+
*/
|
|
43916
44122
|
constructor(opts = defaultStreamOpts) {
|
|
43917
44123
|
var _a;
|
|
43918
44124
|
opts.objectMode = true;
|
|
@@ -43922,14 +44128,17 @@ utils.normalizeURL = normalizeURL;
|
|
|
43922
44128
|
this.level = (_a = opts.level) !== null && _a !== void 0 ? _a : types_1.ErrorLevel.WARN;
|
|
43923
44129
|
this.xslUrl = opts.xslUrl;
|
|
43924
44130
|
}
|
|
44131
|
+
writeHeadOutput() {
|
|
44132
|
+
this.hasHeadOutput = true;
|
|
44133
|
+
let stylesheet = '';
|
|
44134
|
+
if (this.xslUrl) {
|
|
44135
|
+
stylesheet = (0, sitemap_stream_1.stylesheetInclude)(this.xslUrl);
|
|
44136
|
+
}
|
|
44137
|
+
this.push(xmlDec + stylesheet + sitemapIndexTagStart);
|
|
44138
|
+
}
|
|
43925
44139
|
_transform(item, encoding, callback) {
|
|
43926
44140
|
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);
|
|
44141
|
+
this.writeHeadOutput();
|
|
43933
44142
|
}
|
|
43934
44143
|
this.push((0, sitemap_xml_1.otag)(IndexTagNames.sitemap));
|
|
43935
44144
|
if (typeof item === 'string') {
|
|
@@ -43946,55 +44155,143 @@ utils.normalizeURL = normalizeURL;
|
|
|
43946
44155
|
callback();
|
|
43947
44156
|
}
|
|
43948
44157
|
_flush(cb) {
|
|
44158
|
+
if (!this.hasHeadOutput) {
|
|
44159
|
+
this.writeHeadOutput();
|
|
44160
|
+
}
|
|
43949
44161
|
this.push(closetag);
|
|
43950
44162
|
cb();
|
|
43951
44163
|
}
|
|
43952
44164
|
}
|
|
43953
44165
|
exports.SitemapIndexStream = SitemapIndexStream;
|
|
43954
|
-
|
|
44166
|
+
/**
|
|
44167
|
+
* `SitemapAndIndexStream` is a Transform stream that takes in sitemap items,
|
|
44168
|
+
* writes them to sitemap files, adds the sitemap files to a sitemap index,
|
|
44169
|
+
* and creates new sitemap files when the count limit is reached.
|
|
44170
|
+
*
|
|
44171
|
+
* It waits for the target stream of the current sitemap file to finish before
|
|
44172
|
+
* moving on to the next if the target stream is returned by the `getSitemapStream`
|
|
44173
|
+
* callback in the 3rd position of the tuple.
|
|
44174
|
+
*
|
|
44175
|
+
* ⚠️ CAUTION: This object is `readable` and must be read (e.g. piped to a file or to /dev/null)
|
|
44176
|
+
* before `finish` will be emitted. Failure to read the stream will result in hangs.
|
|
44177
|
+
*
|
|
44178
|
+
* @extends {SitemapIndexStream}
|
|
44179
|
+
*/
|
|
43955
44180
|
class SitemapAndIndexStream extends SitemapIndexStream {
|
|
44181
|
+
/**
|
|
44182
|
+
* `SitemapAndIndexStream` is a Transform stream that takes in sitemap items,
|
|
44183
|
+
* writes them to sitemap files, adds the sitemap files to a sitemap index,
|
|
44184
|
+
* and creates new sitemap files when the count limit is reached.
|
|
44185
|
+
*
|
|
44186
|
+
* It waits for the target stream of the current sitemap file to finish before
|
|
44187
|
+
* moving on to the next if the target stream is returned by the `getSitemapStream`
|
|
44188
|
+
* callback in the 3rd position of the tuple.
|
|
44189
|
+
*
|
|
44190
|
+
* ⚠️ CAUTION: This object is `readable` and must be read (e.g. piped to a file or to /dev/null)
|
|
44191
|
+
* before `finish` will be emitted. Failure to read the stream will result in hangs.
|
|
44192
|
+
*
|
|
44193
|
+
* @param {SitemapAndIndexStreamOptions} opts - Stream options.
|
|
44194
|
+
*/
|
|
43956
44195
|
constructor(opts) {
|
|
43957
44196
|
var _a;
|
|
43958
44197
|
opts.objectMode = true;
|
|
43959
44198
|
super(opts);
|
|
43960
|
-
this.
|
|
44199
|
+
this.itemsWritten = 0;
|
|
43961
44200
|
this.getSitemapStream = opts.getSitemapStream;
|
|
43962
|
-
[this.idxItem, this.currentSitemap, this.currentSitemapPipeline] =
|
|
43963
|
-
this.getSitemapStream(0);
|
|
43964
44201
|
this.limit = (_a = opts.limit) !== null && _a !== void 0 ? _a : 45000;
|
|
43965
44202
|
}
|
|
43966
|
-
_writeSMI(item) {
|
|
43967
|
-
this.currentSitemap.write(item);
|
|
43968
|
-
this.i++;
|
|
43969
|
-
}
|
|
43970
44203
|
_transform(item, encoding, callback) {
|
|
43971
|
-
|
|
43972
|
-
|
|
43973
|
-
|
|
43974
|
-
|
|
44204
|
+
if (this.itemsWritten % this.limit === 0) {
|
|
44205
|
+
if (this.currentSitemap) {
|
|
44206
|
+
const onFinish = new Promise((resolve, reject) => {
|
|
44207
|
+
var _a, _b, _c;
|
|
44208
|
+
(_a = this.currentSitemap) === null || _a === void 0 ? void 0 : _a.on('finish', resolve);
|
|
44209
|
+
(_b = this.currentSitemap) === null || _b === void 0 ? void 0 : _b.on('error', reject);
|
|
44210
|
+
(_c = this.currentSitemap) === null || _c === void 0 ? void 0 : _c.end();
|
|
44211
|
+
});
|
|
44212
|
+
const onPipelineFinish = this.currentSitemapPipeline
|
|
44213
|
+
? new Promise((resolve, reject) => {
|
|
44214
|
+
var _a, _b;
|
|
44215
|
+
(_a = this.currentSitemapPipeline) === null || _a === void 0 ? void 0 : _a.on('finish', resolve);
|
|
44216
|
+
(_b = this.currentSitemapPipeline) === null || _b === void 0 ? void 0 : _b.on('error', reject);
|
|
44217
|
+
})
|
|
44218
|
+
: Promise.resolve();
|
|
44219
|
+
Promise.all([onFinish, onPipelineFinish])
|
|
44220
|
+
.then(() => {
|
|
44221
|
+
this.createSitemap(encoding);
|
|
44222
|
+
this.writeItem(item, callback);
|
|
44223
|
+
})
|
|
44224
|
+
.catch(callback);
|
|
44225
|
+
return;
|
|
44226
|
+
}
|
|
44227
|
+
else {
|
|
44228
|
+
this.createSitemap(encoding);
|
|
44229
|
+
}
|
|
43975
44230
|
}
|
|
43976
|
-
|
|
43977
|
-
|
|
43978
|
-
|
|
43979
|
-
|
|
43980
|
-
|
|
43981
|
-
|
|
43982
|
-
|
|
43983
|
-
|
|
43984
|
-
|
|
43985
|
-
(_a = this.currentSitemapPipeline) === null || _a === void 0 ? void 0 : _a.on('finish', onFinish);
|
|
43986
|
-
this.currentSitemap.end(!this.currentSitemapPipeline ? onFinish : undefined);
|
|
44231
|
+
this.writeItem(item, callback);
|
|
44232
|
+
}
|
|
44233
|
+
writeItem(item, callback) {
|
|
44234
|
+
if (!this.currentSitemap) {
|
|
44235
|
+
callback(new Error('No sitemap stream available'));
|
|
44236
|
+
return;
|
|
44237
|
+
}
|
|
44238
|
+
if (!this.currentSitemap.write(item)) {
|
|
44239
|
+
this.currentSitemap.once('drain', callback);
|
|
43987
44240
|
}
|
|
43988
44241
|
else {
|
|
43989
|
-
|
|
43990
|
-
callback();
|
|
44242
|
+
process.nextTick(callback);
|
|
43991
44243
|
}
|
|
44244
|
+
// Increment the count of items written
|
|
44245
|
+
this.itemsWritten++;
|
|
43992
44246
|
}
|
|
44247
|
+
/**
|
|
44248
|
+
* Called when the stream is finished.
|
|
44249
|
+
* If there is a current sitemap, we wait for it to finish before calling the callback.
|
|
44250
|
+
*
|
|
44251
|
+
* @param cb
|
|
44252
|
+
*/
|
|
43993
44253
|
_flush(cb) {
|
|
43994
|
-
|
|
43995
|
-
|
|
43996
|
-
|
|
43997
|
-
|
|
44254
|
+
const onFinish = new Promise((resolve, reject) => {
|
|
44255
|
+
if (this.currentSitemap) {
|
|
44256
|
+
this.currentSitemap.on('finish', resolve);
|
|
44257
|
+
this.currentSitemap.on('error', reject);
|
|
44258
|
+
this.currentSitemap.end();
|
|
44259
|
+
}
|
|
44260
|
+
else {
|
|
44261
|
+
resolve();
|
|
44262
|
+
}
|
|
44263
|
+
});
|
|
44264
|
+
const onPipelineFinish = new Promise((resolve, reject) => {
|
|
44265
|
+
if (this.currentSitemapPipeline) {
|
|
44266
|
+
this.currentSitemapPipeline.on('finish', resolve);
|
|
44267
|
+
this.currentSitemapPipeline.on('error', reject);
|
|
44268
|
+
// The pipeline (pipe target) will get it's end() call
|
|
44269
|
+
// from the sitemap stream ending.
|
|
44270
|
+
}
|
|
44271
|
+
else {
|
|
44272
|
+
resolve();
|
|
44273
|
+
}
|
|
44274
|
+
});
|
|
44275
|
+
Promise.all([onFinish, onPipelineFinish])
|
|
44276
|
+
.then(() => {
|
|
44277
|
+
super._flush(cb);
|
|
44278
|
+
})
|
|
44279
|
+
.catch((err) => {
|
|
44280
|
+
cb(err);
|
|
44281
|
+
});
|
|
44282
|
+
}
|
|
44283
|
+
createSitemap(encoding) {
|
|
44284
|
+
const [idxItem, currentSitemap, currentSitemapPipeline] = this.getSitemapStream(this.itemsWritten / this.limit);
|
|
44285
|
+
currentSitemap.on('error', (err) => this.emit('error', err));
|
|
44286
|
+
this.currentSitemap = currentSitemap;
|
|
44287
|
+
this.currentSitemapPipeline = currentSitemapPipeline;
|
|
44288
|
+
super._transform(idxItem, encoding, () => {
|
|
44289
|
+
// We are not too fussed about waiting for the index item to be written
|
|
44290
|
+
// we we'll wait for the file to finish at the end
|
|
44291
|
+
// and index file write volume tends to be small in comprarison to sitemap
|
|
44292
|
+
// writes.
|
|
44293
|
+
// noop
|
|
44294
|
+
});
|
|
43998
44295
|
}
|
|
43999
44296
|
}
|
|
44000
44297
|
exports.SitemapAndIndexStream = SitemapAndIndexStream;
|
|
@@ -44123,6 +44420,12 @@ var sax = {};
|
|
|
44123
44420
|
parser.ns = Object.create(rootNS);
|
|
44124
44421
|
}
|
|
44125
44422
|
|
|
44423
|
+
// disallow unquoted attribute values if not otherwise configured
|
|
44424
|
+
// and strict mode is true
|
|
44425
|
+
if (parser.opt.unquotedAttributeValues === undefined) {
|
|
44426
|
+
parser.opt.unquotedAttributeValues = !strict;
|
|
44427
|
+
}
|
|
44428
|
+
|
|
44126
44429
|
// mostly just for error reporting
|
|
44127
44430
|
parser.trackPosition = parser.opt.position !== false;
|
|
44128
44431
|
if (parser.trackPosition) {
|
|
@@ -45140,15 +45443,22 @@ var sax = {};
|
|
|
45140
45443
|
continue
|
|
45141
45444
|
|
|
45142
45445
|
case S.SGML_DECL:
|
|
45143
|
-
if (
|
|
45446
|
+
if (parser.sgmlDecl + c === '--') {
|
|
45447
|
+
parser.state = S.COMMENT;
|
|
45448
|
+
parser.comment = '';
|
|
45449
|
+
parser.sgmlDecl = '';
|
|
45450
|
+
continue;
|
|
45451
|
+
}
|
|
45452
|
+
|
|
45453
|
+
if (parser.doctype && parser.doctype !== true && parser.sgmlDecl) {
|
|
45454
|
+
parser.state = S.DOCTYPE_DTD;
|
|
45455
|
+
parser.doctype += '<!' + parser.sgmlDecl + c;
|
|
45456
|
+
parser.sgmlDecl = '';
|
|
45457
|
+
} else if ((parser.sgmlDecl + c).toUpperCase() === CDATA) {
|
|
45144
45458
|
emitNode(parser, 'onopencdata');
|
|
45145
45459
|
parser.state = S.CDATA;
|
|
45146
45460
|
parser.sgmlDecl = '';
|
|
45147
45461
|
parser.cdata = '';
|
|
45148
|
-
} else if (parser.sgmlDecl + c === '--') {
|
|
45149
|
-
parser.state = S.COMMENT;
|
|
45150
|
-
parser.comment = '';
|
|
45151
|
-
parser.sgmlDecl = '';
|
|
45152
45462
|
} else if ((parser.sgmlDecl + c).toUpperCase() === DOCTYPE) {
|
|
45153
45463
|
parser.state = S.DOCTYPE;
|
|
45154
45464
|
if (parser.doctype || parser.sawRoot) {
|
|
@@ -45202,12 +45512,18 @@ var sax = {};
|
|
|
45202
45512
|
continue
|
|
45203
45513
|
|
|
45204
45514
|
case S.DOCTYPE_DTD:
|
|
45205
|
-
parser.doctype += c;
|
|
45206
45515
|
if (c === ']') {
|
|
45516
|
+
parser.doctype += c;
|
|
45207
45517
|
parser.state = S.DOCTYPE;
|
|
45518
|
+
} else if (c === '<') {
|
|
45519
|
+
parser.state = S.OPEN_WAKA;
|
|
45520
|
+
parser.startTagPosition = parser.position;
|
|
45208
45521
|
} else if (isQuote(c)) {
|
|
45522
|
+
parser.doctype += c;
|
|
45209
45523
|
parser.state = S.DOCTYPE_DTD_QUOTED;
|
|
45210
45524
|
parser.q = c;
|
|
45525
|
+
} else {
|
|
45526
|
+
parser.doctype += c;
|
|
45211
45527
|
}
|
|
45212
45528
|
continue
|
|
45213
45529
|
|
|
@@ -45248,6 +45564,8 @@ var sax = {};
|
|
|
45248
45564
|
// which is a comment of " blah -- bloo "
|
|
45249
45565
|
parser.comment += '--' + c;
|
|
45250
45566
|
parser.state = S.COMMENT;
|
|
45567
|
+
} else if (parser.doctype && parser.doctype !== true) {
|
|
45568
|
+
parser.state = S.DOCTYPE_DTD;
|
|
45251
45569
|
} else {
|
|
45252
45570
|
parser.state = S.TEXT;
|
|
45253
45571
|
}
|
|
@@ -45415,7 +45733,9 @@ var sax = {};
|
|
|
45415
45733
|
parser.q = c;
|
|
45416
45734
|
parser.state = S.ATTRIB_VALUE_QUOTED;
|
|
45417
45735
|
} else {
|
|
45418
|
-
|
|
45736
|
+
if (!parser.opt.unquotedAttributeValues) {
|
|
45737
|
+
error(parser, 'Unquoted attribute value');
|
|
45738
|
+
}
|
|
45419
45739
|
parser.state = S.ATTRIB_VALUE_UNQUOTED;
|
|
45420
45740
|
parser.attribValue = c;
|
|
45421
45741
|
}
|
|
@@ -45533,13 +45853,13 @@ var sax = {};
|
|
|
45533
45853
|
}
|
|
45534
45854
|
|
|
45535
45855
|
if (c === ';') {
|
|
45536
|
-
|
|
45537
|
-
|
|
45856
|
+
var parsedEntity = parseEntity(parser);
|
|
45857
|
+
if (parser.opt.unparsedEntities && !Object.values(sax.XML_ENTITIES).includes(parsedEntity)) {
|
|
45538
45858
|
parser.entity = '';
|
|
45539
45859
|
parser.state = returnState;
|
|
45540
45860
|
parser.write(parsedEntity);
|
|
45541
45861
|
} else {
|
|
45542
|
-
parser[buffer] +=
|
|
45862
|
+
parser[buffer] += parsedEntity;
|
|
45543
45863
|
parser.entity = '';
|
|
45544
45864
|
parser.state = returnState;
|
|
45545
45865
|
}
|
|
@@ -46047,12 +46367,17 @@ class XMLToSitemapItemStream extends stream_1$1.Transform {
|
|
|
46047
46367
|
}
|
|
46048
46368
|
_transform(data, encoding, callback) {
|
|
46049
46369
|
try {
|
|
46370
|
+
const cb = () => callback(this.level === types_1$1.ErrorLevel.THROW ? this.error : null);
|
|
46050
46371
|
// correcting the type here can be done without making it a breaking change
|
|
46051
46372
|
// TODO fix this
|
|
46052
46373
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
46053
46374
|
// @ts-ignore
|
|
46054
|
-
this.saxStream.write(data, encoding)
|
|
46055
|
-
|
|
46375
|
+
if (!this.saxStream.write(data, encoding)) {
|
|
46376
|
+
this.saxStream.once('drain', cb);
|
|
46377
|
+
}
|
|
46378
|
+
else {
|
|
46379
|
+
process.nextTick(cb);
|
|
46380
|
+
}
|
|
46056
46381
|
}
|
|
46057
46382
|
catch (error) {
|
|
46058
46383
|
callback(error);
|
|
@@ -46321,152 +46646,138 @@ sitemapIndexParser.IndexObjectStreamToJSON = IndexObjectStreamToJSON;
|
|
|
46321
46646
|
|
|
46322
46647
|
var sitemapSimple = {};
|
|
46323
46648
|
|
|
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();
|
|
46649
|
+
(function (exports) {
|
|
46650
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
46651
|
+
exports.simpleSitemapAndIndex = void 0;
|
|
46652
|
+
const sitemap_index_stream_1 = sitemapIndexStream;
|
|
46653
|
+
const sitemap_stream_1 = sitemapStream;
|
|
46654
|
+
const utils_1 = utils;
|
|
46655
|
+
const zlib_1 = zlib;
|
|
46656
|
+
const fs_1 = fs__default;
|
|
46657
|
+
const path_1 = path$q;
|
|
46658
|
+
const stream_1 = require$$0$2;
|
|
46659
|
+
const util_1 = require$$0$3;
|
|
46660
|
+
const url_1 = require$$3;
|
|
46661
|
+
const pipeline = (0, util_1.promisify)(stream_1.pipeline);
|
|
46662
|
+
/**
|
|
46663
|
+
*
|
|
46664
|
+
* @param {object} options -
|
|
46665
|
+
* @param {string} options.hostname - The hostname for all URLs
|
|
46666
|
+
* @param {string} [options.sitemapHostname] - The hostname for the sitemaps if different than hostname
|
|
46667
|
+
* @param {SitemapItemLoose[] | string | Readable | string[]} options.sourceData - The urls you want to make a sitemap out of.
|
|
46668
|
+
* @param {string} options.destinationDir - where to write the sitemaps and index
|
|
46669
|
+
* @param {string} [options.publicBasePath] - where the sitemaps are relative to the hostname. Defaults to root.
|
|
46670
|
+
* @param {number} [options.limit] - how many URLs to write before switching to a new file. Defaults to 50k
|
|
46671
|
+
* @param {boolean} [options.gzip] - whether to compress the written files. Defaults to true
|
|
46672
|
+
* @returns {Promise<void>} an empty promise that resolves when everything is done
|
|
46673
|
+
*/
|
|
46674
|
+
const simpleSitemapAndIndex = async ({ hostname, sitemapHostname = hostname, // if different
|
|
46675
|
+
/**
|
|
46676
|
+
* Pass a line separated list of sitemap items or a stream or an array
|
|
46677
|
+
*/
|
|
46678
|
+
sourceData, destinationDir, limit = 50000, gzip = true, publicBasePath = './', }) => {
|
|
46679
|
+
await fs_1.promises.mkdir(destinationDir, { recursive: true });
|
|
46680
|
+
const sitemapAndIndexStream = new sitemap_index_stream_1.SitemapAndIndexStream({
|
|
46681
|
+
limit,
|
|
46682
|
+
getSitemapStream: (i) => {
|
|
46683
|
+
const sitemapStream = new sitemap_stream_1.SitemapStream({
|
|
46684
|
+
hostname,
|
|
46685
|
+
});
|
|
46686
|
+
const path = `./sitemap-${i}.xml`;
|
|
46687
|
+
const writePath = (0, path_1.resolve)(destinationDir, path + (gzip ? '.gz' : ''));
|
|
46688
|
+
if (!publicBasePath.endsWith('/')) {
|
|
46689
|
+
publicBasePath += '/';
|
|
46690
|
+
}
|
|
46691
|
+
const publicPath = (0, path_1.normalize)(publicBasePath + path);
|
|
46692
|
+
let pipeline;
|
|
46693
|
+
if (gzip) {
|
|
46694
|
+
pipeline = sitemapStream
|
|
46695
|
+
.pipe((0, zlib_1.createGzip)()) // compress the output of the sitemap
|
|
46696
|
+
.pipe((0, fs_1.createWriteStream)(writePath)); // write it to sitemap-NUMBER.xml
|
|
46697
|
+
}
|
|
46698
|
+
else {
|
|
46699
|
+
pipeline = sitemapStream.pipe((0, fs_1.createWriteStream)(writePath)); // write it to sitemap-NUMBER.xml
|
|
46700
|
+
}
|
|
46701
|
+
return [
|
|
46702
|
+
new url_1.URL(`${publicPath}${gzip ? '.gz' : ''}`, sitemapHostname).toString(),
|
|
46703
|
+
sitemapStream,
|
|
46704
|
+
pipeline,
|
|
46705
|
+
];
|
|
46706
|
+
},
|
|
46707
|
+
});
|
|
46708
|
+
let src;
|
|
46709
|
+
if (typeof sourceData === 'string') {
|
|
46710
|
+
src = (0, utils_1.lineSeparatedURLsToSitemapOptions)((0, fs_1.createReadStream)(sourceData));
|
|
46711
|
+
}
|
|
46712
|
+
else if (sourceData instanceof stream_1.Readable) {
|
|
46713
|
+
src = sourceData;
|
|
46714
|
+
}
|
|
46715
|
+
else if (Array.isArray(sourceData)) {
|
|
46716
|
+
src = stream_1.Readable.from(sourceData);
|
|
46717
|
+
}
|
|
46718
|
+
else {
|
|
46719
|
+
throw new Error("unhandled source type. You've passed in data that is not supported");
|
|
46720
|
+
}
|
|
46721
|
+
const writePath = (0, path_1.resolve)(destinationDir, `./sitemap-index.xml${gzip ? '.gz' : ''}`);
|
|
46722
|
+
if (gzip) {
|
|
46723
|
+
return pipeline(src, sitemapAndIndexStream, (0, zlib_1.createGzip)(), (0, fs_1.createWriteStream)(writePath));
|
|
46724
|
+
}
|
|
46725
|
+
else {
|
|
46726
|
+
return pipeline(src, sitemapAndIndexStream, (0, fs_1.createWriteStream)(writePath));
|
|
46727
|
+
}
|
|
46728
|
+
};
|
|
46729
|
+
exports.simpleSitemapAndIndex = simpleSitemapAndIndex;
|
|
46730
|
+
exports.default = exports.simpleSitemapAndIndex;
|
|
46731
|
+
} (sitemapSimple));
|
|
46732
|
+
|
|
46733
|
+
(function (exports) {
|
|
46734
|
+
var __createBinding = (commonjsGlobal && commonjsGlobal.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
46735
|
+
if (k2 === undefined) k2 = k;
|
|
46736
|
+
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
46737
|
+
}) : (function(o, m, k, k2) {
|
|
46738
|
+
if (k2 === undefined) k2 = k;
|
|
46739
|
+
o[k2] = m[k];
|
|
46740
|
+
}));
|
|
46741
|
+
var __exportStar = (commonjsGlobal && commonjsGlobal.__exportStar) || function(m, exports) {
|
|
46742
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
46743
|
+
};
|
|
46744
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
46745
|
+
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;
|
|
46746
|
+
/*!
|
|
46747
|
+
* Sitemap
|
|
46748
|
+
* Copyright(c) 2011 Eugene Kalinin
|
|
46749
|
+
* MIT Licensed
|
|
46750
|
+
*/
|
|
46751
|
+
var sitemap_item_stream_1 = sitemapItemStream;
|
|
46752
|
+
Object.defineProperty(exports, "SitemapItemStream", { enumerable: true, get: function () { return sitemap_item_stream_1.SitemapItemStream; } });
|
|
46753
|
+
var sitemap_index_stream_1 = sitemapIndexStream;
|
|
46754
|
+
Object.defineProperty(exports, "IndexTagNames", { enumerable: true, get: function () { return sitemap_index_stream_1.IndexTagNames; } });
|
|
46755
|
+
Object.defineProperty(exports, "SitemapIndexStream", { enumerable: true, get: function () { return sitemap_index_stream_1.SitemapIndexStream; } });
|
|
46756
|
+
Object.defineProperty(exports, "SitemapAndIndexStream", { enumerable: true, get: function () { return sitemap_index_stream_1.SitemapAndIndexStream; } });
|
|
46757
|
+
var sitemap_stream_1 = sitemapStream;
|
|
46758
|
+
Object.defineProperty(exports, "streamToPromise", { enumerable: true, get: function () { return sitemap_stream_1.streamToPromise; } });
|
|
46759
|
+
Object.defineProperty(exports, "SitemapStream", { enumerable: true, get: function () { return sitemap_stream_1.SitemapStream; } });
|
|
46760
|
+
__exportStar(errors, exports);
|
|
46761
|
+
__exportStar(types, exports);
|
|
46762
|
+
var utils_1 = utils;
|
|
46763
|
+
Object.defineProperty(exports, "lineSeparatedURLsToSitemapOptions", { enumerable: true, get: function () { return utils_1.lineSeparatedURLsToSitemapOptions; } });
|
|
46764
|
+
Object.defineProperty(exports, "mergeStreams", { enumerable: true, get: function () { return utils_1.mergeStreams; } });
|
|
46765
|
+
Object.defineProperty(exports, "validateSMIOptions", { enumerable: true, get: function () { return utils_1.validateSMIOptions; } });
|
|
46766
|
+
Object.defineProperty(exports, "normalizeURL", { enumerable: true, get: function () { return utils_1.normalizeURL; } });
|
|
46767
|
+
Object.defineProperty(exports, "ReadlineStream", { enumerable: true, get: function () { return utils_1.ReadlineStream; } });
|
|
46768
|
+
var xmllint_1 = xmllint;
|
|
46769
|
+
Object.defineProperty(exports, "xmlLint", { enumerable: true, get: function () { return xmllint_1.xmlLint; } });
|
|
46770
|
+
var sitemap_parser_1 = sitemapParser;
|
|
46771
|
+
Object.defineProperty(exports, "parseSitemap", { enumerable: true, get: function () { return sitemap_parser_1.parseSitemap; } });
|
|
46772
|
+
Object.defineProperty(exports, "XMLToSitemapItemStream", { enumerable: true, get: function () { return sitemap_parser_1.XMLToSitemapItemStream; } });
|
|
46773
|
+
Object.defineProperty(exports, "ObjectStreamToJSON", { enumerable: true, get: function () { return sitemap_parser_1.ObjectStreamToJSON; } });
|
|
46774
|
+
var sitemap_index_parser_1 = sitemapIndexParser;
|
|
46775
|
+
Object.defineProperty(exports, "parseSitemapIndex", { enumerable: true, get: function () { return sitemap_index_parser_1.parseSitemapIndex; } });
|
|
46776
|
+
Object.defineProperty(exports, "XMLToSitemapIndexStream", { enumerable: true, get: function () { return sitemap_index_parser_1.XMLToSitemapIndexStream; } });
|
|
46777
|
+
Object.defineProperty(exports, "IndexObjectStreamToJSON", { enumerable: true, get: function () { return sitemap_index_parser_1.IndexObjectStreamToJSON; } });
|
|
46778
|
+
var sitemap_simple_1 = sitemapSimple;
|
|
46779
|
+
Object.defineProperty(exports, "simpleSitemapAndIndex", { enumerable: true, get: function () { return sitemap_simple_1.simpleSitemapAndIndex; } });
|
|
46780
|
+
} (dist));
|
|
46470
46781
|
|
|
46471
46782
|
async function generateSitemap(siteConfig) {
|
|
46472
46783
|
if (!siteConfig.sitemap?.hostname) return;
|
|
@@ -46476,6 +46787,10 @@ async function generateSitemap(siteConfig) {
|
|
|
46476
46787
|
file = file.replace(/(\.html)?$/, ".md");
|
|
46477
46788
|
file = siteConfig.rewrites.inv[file] || file;
|
|
46478
46789
|
file = path$q.join(siteConfig.srcDir, file);
|
|
46790
|
+
if (!fs$a.existsSync(file)) return void 0;
|
|
46791
|
+
const { data } = matter$1.read(file);
|
|
46792
|
+
if (data.lastUpdated === false) return void 0;
|
|
46793
|
+
if (data.lastUpdated instanceof Date) return +data.lastUpdated;
|
|
46479
46794
|
return await getGitTimestamp(file) || void 0;
|
|
46480
46795
|
};
|
|
46481
46796
|
await task("generating sitemap", async () => {
|
|
@@ -46510,7 +46825,7 @@ async function generateSitemap(siteConfig) {
|
|
|
46510
46825
|
);
|
|
46511
46826
|
let items = _items.flat();
|
|
46512
46827
|
items = await siteConfig.sitemap?.transformItems?.(items) || items;
|
|
46513
|
-
const sitemapStream = new
|
|
46828
|
+
const sitemapStream = new dist.SitemapStream(siteConfig.sitemap);
|
|
46514
46829
|
const sitemapPath = path$q.join(siteConfig.outDir, "sitemap.xml");
|
|
46515
46830
|
const writeStream = fs$a.createWriteStream(sitemapPath);
|
|
46516
46831
|
sitemapStream.pipe(writeStream);
|
|
@@ -46519,7 +46834,7 @@ async function generateSitemap(siteConfig) {
|
|
|
46519
46834
|
});
|
|
46520
46835
|
}
|
|
46521
46836
|
|
|
46522
|
-
var version = "1.
|
|
46837
|
+
var version = "1.3.0";
|
|
46523
46838
|
|
|
46524
46839
|
async function renderPage(render, config, page, result, appChunk, cssChunk, assets, pageToHashMap, metadataScript, additionalHeadTags) {
|
|
46525
46840
|
const routePath = `/${page.replace(/\.md$/, "")}`;
|
|
@@ -49012,16 +49327,19 @@ const getPackageManger = () => {
|
|
|
49012
49327
|
const name = process.env?.npm_config_user_agent || "npm";
|
|
49013
49328
|
return name.split("/")[0];
|
|
49014
49329
|
};
|
|
49015
|
-
async function init() {
|
|
49330
|
+
async function init(root) {
|
|
49016
49331
|
oe(picocolorsExports.bold(picocolorsExports.cyan("Welcome to VitePress!")));
|
|
49017
49332
|
const options = await he(
|
|
49018
49333
|
{
|
|
49019
|
-
root: () =>
|
|
49020
|
-
|
|
49021
|
-
|
|
49022
|
-
|
|
49023
|
-
|
|
49024
|
-
|
|
49334
|
+
root: async () => {
|
|
49335
|
+
if (root) return root;
|
|
49336
|
+
return te({
|
|
49337
|
+
message: "Where should VitePress initialize the config?",
|
|
49338
|
+
initialValue: "./",
|
|
49339
|
+
validate(value) {
|
|
49340
|
+
}
|
|
49341
|
+
});
|
|
49342
|
+
},
|
|
49025
49343
|
title: () => te({
|
|
49026
49344
|
message: "Site title:",
|
|
49027
49345
|
placeholder: "My Awesome Project"
|