vite-plugin-sitemap 0.3.0 → 0.4.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/README.md +7 -0
- package/dist/index.d.ts +13 -2
- package/dist/index.js +454 -492
- package/dist/index.mjs +452 -490
- package/package.json +12 -11
package/dist/index.js
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var node_fs = require('node:fs');
|
|
4
4
|
var require$$0 = require('stream');
|
|
5
|
+
var require$$0$1 = require('fs');
|
|
5
6
|
var require$$2 = require('readline');
|
|
6
7
|
var require$$3 = require('url');
|
|
7
8
|
var require$$0$2 = require('path');
|
|
@@ -10,13 +11,14 @@ var module$1 = require('module');
|
|
|
10
11
|
var require$$1$1 = require('string_decoder');
|
|
11
12
|
var require$$1$2 = require('zlib');
|
|
12
13
|
var require$$0$3 = require('util');
|
|
14
|
+
var node_path = require('node:path');
|
|
13
15
|
var require$$2$1 = require('os');
|
|
14
16
|
var require$$0$4 = require('events');
|
|
15
17
|
|
|
16
18
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
17
19
|
|
|
18
|
-
var require$$0__default$1 = /*#__PURE__*/_interopDefaultLegacy(require$$0$1);
|
|
19
20
|
var require$$0__default = /*#__PURE__*/_interopDefaultLegacy(require$$0);
|
|
21
|
+
var require$$0__default$1 = /*#__PURE__*/_interopDefaultLegacy(require$$0$1);
|
|
20
22
|
var require$$2__default = /*#__PURE__*/_interopDefaultLegacy(require$$2);
|
|
21
23
|
var require$$3__default = /*#__PURE__*/_interopDefaultLegacy(require$$3);
|
|
22
24
|
var require$$0__default$2 = /*#__PURE__*/_interopDefaultLegacy(require$$0$2);
|
|
@@ -29,6 +31,10 @@ var require$$0__default$4 = /*#__PURE__*/_interopDefaultLegacy(require$$0$4);
|
|
|
29
31
|
|
|
30
32
|
var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
|
|
31
33
|
|
|
34
|
+
function getDefaultExportFromCjs (x) {
|
|
35
|
+
return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
|
|
36
|
+
}
|
|
37
|
+
|
|
32
38
|
var dist = {};
|
|
33
39
|
|
|
34
40
|
var sitemapItemStream = {};
|
|
@@ -416,7 +422,7 @@ var types = {};
|
|
|
416
422
|
IndexTagNames["sitemapindex"] = "sitemapindex";
|
|
417
423
|
IndexTagNames["loc"] = "loc";
|
|
418
424
|
IndexTagNames["lastmod"] = "lastmod";
|
|
419
|
-
})(exports.IndexTagNames || (exports.IndexTagNames = {}));
|
|
425
|
+
})(exports.IndexTagNames || (exports.IndexTagNames = {}));
|
|
420
426
|
} (types));
|
|
421
427
|
|
|
422
428
|
var sitemapXml = {};
|
|
@@ -1132,7 +1138,7 @@ utils$l.normalizeURL = normalizeURL;
|
|
|
1132
1138
|
});
|
|
1133
1139
|
});
|
|
1134
1140
|
}
|
|
1135
|
-
exports.streamToPromise = streamToPromise;
|
|
1141
|
+
exports.streamToPromise = streamToPromise;
|
|
1136
1142
|
} (sitemapStream));
|
|
1137
1143
|
|
|
1138
1144
|
(function (exports) {
|
|
@@ -1237,7 +1243,7 @@ utils$l.normalizeURL = normalizeURL;
|
|
|
1237
1243
|
this.currentSitemap.end(!this.currentSitemapPipeline ? onFinish : undefined);
|
|
1238
1244
|
}
|
|
1239
1245
|
}
|
|
1240
|
-
exports.SitemapAndIndexStream = SitemapAndIndexStream;
|
|
1246
|
+
exports.SitemapAndIndexStream = SitemapAndIndexStream;
|
|
1241
1247
|
} (sitemapIndexStream));
|
|
1242
1248
|
|
|
1243
1249
|
var xmllint = {};
|
|
@@ -2858,7 +2864,7 @@ var sax = {};
|
|
|
2858
2864
|
}
|
|
2859
2865
|
}());
|
|
2860
2866
|
}
|
|
2861
|
-
})(exports);
|
|
2867
|
+
})(exports);
|
|
2862
2868
|
} (sax));
|
|
2863
2869
|
|
|
2864
2870
|
var __importDefault$1 = (commonjsGlobal && commonjsGlobal.__importDefault) || function (mod) {
|
|
@@ -3642,8 +3648,8 @@ function requireSitemapSimple () {
|
|
|
3642
3648
|
}
|
|
3643
3649
|
};
|
|
3644
3650
|
exports.simpleSitemapAndIndex = simpleSitemapAndIndex;
|
|
3645
|
-
exports.default = exports.simpleSitemapAndIndex;
|
|
3646
|
-
} (sitemapSimple));
|
|
3651
|
+
exports.default = exports.simpleSitemapAndIndex;
|
|
3652
|
+
} (sitemapSimple));
|
|
3647
3653
|
return sitemapSimple;
|
|
3648
3654
|
}
|
|
3649
3655
|
|
|
@@ -3698,472 +3704,434 @@ function requireDist () {
|
|
|
3698
3704
|
Object.defineProperty(exports, "XMLToSitemapIndexStream", { enumerable: true, get: function () { return sitemap_index_parser_1.XMLToSitemapIndexStream; } });
|
|
3699
3705
|
Object.defineProperty(exports, "IndexObjectStreamToJSON", { enumerable: true, get: function () { return sitemap_index_parser_1.IndexObjectStreamToJSON; } });
|
|
3700
3706
|
var sitemap_simple_1 = requireSitemapSimple();
|
|
3701
|
-
Object.defineProperty(exports, "simpleSitemapAndIndex", { enumerable: true, get: function () { return sitemap_simple_1.simpleSitemapAndIndex; } });
|
|
3702
|
-
} (dist));
|
|
3707
|
+
Object.defineProperty(exports, "simpleSitemapAndIndex", { enumerable: true, get: function () { return sitemap_simple_1.simpleSitemapAndIndex; } });
|
|
3708
|
+
} (dist));
|
|
3703
3709
|
return dist;
|
|
3704
3710
|
}
|
|
3705
3711
|
|
|
3706
3712
|
var distExports = requireDist();
|
|
3707
3713
|
|
|
3708
|
-
|
|
3709
|
-
* @typedef {Object} ParsingOptions
|
|
3710
|
-
* @property {function(node)} filter Returns false to exclude a node. Default is true.
|
|
3711
|
-
*/
|
|
3714
|
+
var cjs$1 = {exports: {}};
|
|
3712
3715
|
|
|
3713
|
-
var
|
|
3714
|
-
var hasRequiredXmlParserXo;
|
|
3716
|
+
var cjs = {exports: {}};
|
|
3715
3717
|
|
|
3716
|
-
|
|
3717
|
-
if (hasRequiredXmlParserXo) return xmlParserXo;
|
|
3718
|
-
hasRequiredXmlParserXo = 1;
|
|
3719
|
-
/**
|
|
3720
|
-
* Parse the given XML string into an object.
|
|
3721
|
-
*
|
|
3722
|
-
* @param {String} xml
|
|
3723
|
-
* @param {ParsingOptions} [options]
|
|
3724
|
-
* @return {Object}
|
|
3725
|
-
* @api public
|
|
3726
|
-
*/
|
|
3727
|
-
function parse(xml, options = {}) {
|
|
3728
|
-
|
|
3729
|
-
options.filter = options.filter || (() => true);
|
|
3718
|
+
cjs.exports;
|
|
3730
3719
|
|
|
3731
|
-
|
|
3732
|
-
|
|
3733
|
-
|
|
3734
|
-
|
|
3735
|
-
|
|
3736
|
-
|
|
3737
|
-
|
|
3720
|
+
(function (module, exports) {
|
|
3721
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3722
|
+
exports.ParsingError = void 0;
|
|
3723
|
+
class ParsingError extends Error {
|
|
3724
|
+
constructor(message, cause) {
|
|
3725
|
+
super(message);
|
|
3726
|
+
this.cause = cause;
|
|
3738
3727
|
}
|
|
3739
|
-
|
|
3740
|
-
|
|
3741
|
-
|
|
3742
|
-
|
|
3743
|
-
|
|
3744
|
-
|
|
3745
|
-
|
|
3746
|
-
|
|
3747
|
-
|
|
3748
|
-
|
|
3749
|
-
|
|
3750
|
-
|
|
3751
|
-
|
|
3752
|
-
|
|
3753
|
-
|
|
3754
|
-
|
|
3755
|
-
|
|
3728
|
+
}
|
|
3729
|
+
exports.ParsingError = ParsingError;
|
|
3730
|
+
let parsingState;
|
|
3731
|
+
function nextChild() {
|
|
3732
|
+
return element(false) || text() || comment() || cdata();
|
|
3733
|
+
}
|
|
3734
|
+
function nextRootChild() {
|
|
3735
|
+
match(/\s*/);
|
|
3736
|
+
return element(true) || comment() || doctype() || processingInstruction(false);
|
|
3737
|
+
}
|
|
3738
|
+
function parseDocument() {
|
|
3739
|
+
const declaration = processingInstruction(true);
|
|
3740
|
+
const children = [];
|
|
3741
|
+
let documentRootNode;
|
|
3742
|
+
let child = nextRootChild();
|
|
3743
|
+
while (child) {
|
|
3744
|
+
if (child.node.type === 'Element') {
|
|
3745
|
+
if (documentRootNode) {
|
|
3746
|
+
throw new Error('Found multiple root nodes');
|
|
3756
3747
|
}
|
|
3757
|
-
|
|
3758
|
-
child = nextRootChild();
|
|
3748
|
+
documentRootNode = child.node;
|
|
3759
3749
|
}
|
|
3760
|
-
|
|
3761
|
-
|
|
3762
|
-
throw new Error('Failed to parse XML');
|
|
3750
|
+
if (!child.excluded) {
|
|
3751
|
+
children.push(child.node);
|
|
3763
3752
|
}
|
|
3764
|
-
|
|
3765
|
-
return {
|
|
3766
|
-
declaration: decl ? decl.node : null,
|
|
3767
|
-
root: documentRootNode,
|
|
3768
|
-
children
|
|
3769
|
-
};
|
|
3753
|
+
child = nextRootChild();
|
|
3770
3754
|
}
|
|
3771
|
-
|
|
3772
|
-
|
|
3773
|
-
return processingInstruction(true);
|
|
3755
|
+
if (!documentRootNode) {
|
|
3756
|
+
throw new ParsingError('Failed to parse XML', 'Root Element not found');
|
|
3774
3757
|
}
|
|
3775
|
-
|
|
3776
|
-
|
|
3777
|
-
|
|
3778
|
-
|
|
3779
|
-
|
|
3780
|
-
|
|
3781
|
-
|
|
3782
|
-
|
|
3783
|
-
|
|
3784
|
-
|
|
3785
|
-
|
|
3786
|
-
|
|
3787
|
-
|
|
3788
|
-
|
|
3789
|
-
|
|
3790
|
-
|
|
3758
|
+
if (parsingState.xml.length !== 0) {
|
|
3759
|
+
throw new ParsingError('Failed to parse XML', 'Not Well-Formed XML');
|
|
3760
|
+
}
|
|
3761
|
+
return {
|
|
3762
|
+
declaration: declaration ? declaration.node : null,
|
|
3763
|
+
root: documentRootNode,
|
|
3764
|
+
children
|
|
3765
|
+
};
|
|
3766
|
+
}
|
|
3767
|
+
function processingInstruction(matchDeclaration) {
|
|
3768
|
+
const m = matchDeclaration ? match(/^<\?(xml)\s*/) : match(/^<\?([\w-:.]+)\s*/);
|
|
3769
|
+
if (!m)
|
|
3770
|
+
return;
|
|
3771
|
+
// tag
|
|
3772
|
+
const node = {
|
|
3773
|
+
name: m[1],
|
|
3774
|
+
type: 'ProcessingInstruction',
|
|
3775
|
+
attributes: {}
|
|
3776
|
+
};
|
|
3777
|
+
// attributes
|
|
3778
|
+
while (!(eos() || is('?>'))) {
|
|
3779
|
+
const attr = attribute();
|
|
3780
|
+
if (attr) {
|
|
3791
3781
|
node.attributes[attr.name] = attr.value;
|
|
3792
3782
|
}
|
|
3793
|
-
|
|
3794
|
-
|
|
3795
|
-
|
|
3796
|
-
return {
|
|
3797
|
-
excluded: matchDeclaration ? false : options.filter(node) === false,
|
|
3798
|
-
node
|
|
3799
|
-
};
|
|
3783
|
+
else {
|
|
3784
|
+
return;
|
|
3785
|
+
}
|
|
3800
3786
|
}
|
|
3801
|
-
|
|
3802
|
-
|
|
3803
|
-
|
|
3804
|
-
|
|
3805
|
-
|
|
3806
|
-
|
|
3807
|
-
|
|
3808
|
-
|
|
3809
|
-
|
|
3810
|
-
|
|
3811
|
-
|
|
3812
|
-
|
|
3813
|
-
|
|
3814
|
-
|
|
3815
|
-
|
|
3816
|
-
|
|
3817
|
-
|
|
3787
|
+
match(/\?>/);
|
|
3788
|
+
return {
|
|
3789
|
+
excluded: matchDeclaration ? false : parsingState.options.filter(node) === false,
|
|
3790
|
+
node
|
|
3791
|
+
};
|
|
3792
|
+
}
|
|
3793
|
+
function element(matchRoot) {
|
|
3794
|
+
const m = match(/^<([^?!</>\s]+)\s*/);
|
|
3795
|
+
if (!m)
|
|
3796
|
+
return;
|
|
3797
|
+
// name
|
|
3798
|
+
const node = {
|
|
3799
|
+
type: 'Element',
|
|
3800
|
+
name: m[1],
|
|
3801
|
+
attributes: {},
|
|
3802
|
+
children: []
|
|
3803
|
+
};
|
|
3804
|
+
const excluded = matchRoot ? false : parsingState.options.filter(node) === false;
|
|
3805
|
+
// attributes
|
|
3806
|
+
while (!(eos() || is('>') || is('?>') || is('/>'))) {
|
|
3807
|
+
const attr = attribute();
|
|
3808
|
+
if (attr) {
|
|
3818
3809
|
node.attributes[attr.name] = attr.value;
|
|
3819
3810
|
}
|
|
3820
|
-
|
|
3821
|
-
|
|
3822
|
-
|
|
3823
|
-
// self closing tag
|
|
3824
|
-
if (match(/^\s*\/>/)) {
|
|
3825
|
-
node.children = null;
|
|
3826
|
-
return {
|
|
3827
|
-
excluded,
|
|
3828
|
-
node
|
|
3829
|
-
};
|
|
3830
|
-
}
|
|
3831
|
-
|
|
3832
|
-
match(/\??>/);
|
|
3833
|
-
|
|
3834
|
-
if (!excluded) {
|
|
3835
|
-
// children
|
|
3836
|
-
let child = nextChild();
|
|
3837
|
-
while (child) {
|
|
3838
|
-
if (!child.excluded) {
|
|
3839
|
-
node.children.push(child.node);
|
|
3840
|
-
}
|
|
3841
|
-
child = nextChild();
|
|
3842
|
-
}
|
|
3811
|
+
else {
|
|
3812
|
+
return;
|
|
3843
3813
|
}
|
|
3844
|
-
|
|
3845
|
-
|
|
3846
|
-
|
|
3847
|
-
|
|
3814
|
+
}
|
|
3815
|
+
// self closing tag
|
|
3816
|
+
if (match(/^\s*\/>/)) {
|
|
3817
|
+
node.children = null;
|
|
3848
3818
|
return {
|
|
3849
3819
|
excluded,
|
|
3850
3820
|
node
|
|
3851
3821
|
};
|
|
3852
3822
|
}
|
|
3853
|
-
|
|
3854
|
-
|
|
3855
|
-
|
|
3856
|
-
|
|
3857
|
-
|
|
3858
|
-
|
|
3859
|
-
content: m[0]
|
|
3860
|
-
};
|
|
3861
|
-
return {
|
|
3862
|
-
excluded: options.filter(node) === false,
|
|
3863
|
-
node
|
|
3864
|
-
};
|
|
3823
|
+
match(/\??>/);
|
|
3824
|
+
// children
|
|
3825
|
+
let child = nextChild();
|
|
3826
|
+
while (child) {
|
|
3827
|
+
if (!child.excluded) {
|
|
3828
|
+
node.children.push(child.node);
|
|
3865
3829
|
}
|
|
3830
|
+
child = nextChild();
|
|
3866
3831
|
}
|
|
3867
|
-
|
|
3868
|
-
|
|
3869
|
-
|
|
3870
|
-
|
|
3871
|
-
|
|
3872
|
-
|
|
3873
|
-
|
|
3874
|
-
|
|
3875
|
-
|
|
3876
|
-
|
|
3877
|
-
|
|
3878
|
-
|
|
3879
|
-
|
|
3880
|
-
|
|
3881
|
-
|
|
3882
|
-
|
|
3883
|
-
|
|
3832
|
+
// closing
|
|
3833
|
+
match(/^<\/\s*[\w-:.\u00C0-\u00FF]+>/);
|
|
3834
|
+
return {
|
|
3835
|
+
excluded,
|
|
3836
|
+
node
|
|
3837
|
+
};
|
|
3838
|
+
}
|
|
3839
|
+
function doctype() {
|
|
3840
|
+
const m = match(/^<!DOCTYPE\s+[^>]*>/);
|
|
3841
|
+
if (m) {
|
|
3842
|
+
const node = {
|
|
3843
|
+
type: 'DocumentType',
|
|
3844
|
+
content: m[0]
|
|
3845
|
+
};
|
|
3846
|
+
return {
|
|
3847
|
+
excluded: parsingState.options.filter(node) === false,
|
|
3848
|
+
node
|
|
3849
|
+
};
|
|
3884
3850
|
}
|
|
3885
|
-
|
|
3886
|
-
|
|
3887
|
-
|
|
3888
|
-
|
|
3851
|
+
}
|
|
3852
|
+
function cdata() {
|
|
3853
|
+
if (parsingState.xml.startsWith('<![CDATA[')) {
|
|
3854
|
+
const endPositionStart = parsingState.xml.indexOf(']]>');
|
|
3855
|
+
if (endPositionStart > -1) {
|
|
3856
|
+
const endPositionFinish = endPositionStart + 3;
|
|
3889
3857
|
const node = {
|
|
3890
|
-
type: '
|
|
3891
|
-
content:
|
|
3858
|
+
type: 'CDATA',
|
|
3859
|
+
content: parsingState.xml.substring(0, endPositionFinish)
|
|
3892
3860
|
};
|
|
3861
|
+
parsingState.xml = parsingState.xml.slice(endPositionFinish);
|
|
3893
3862
|
return {
|
|
3894
|
-
excluded: options.filter(node) === false,
|
|
3863
|
+
excluded: parsingState.options.filter(node) === false,
|
|
3895
3864
|
node
|
|
3896
3865
|
};
|
|
3897
3866
|
}
|
|
3898
3867
|
}
|
|
3899
|
-
|
|
3900
|
-
|
|
3901
|
-
|
|
3902
|
-
|
|
3903
|
-
|
|
3904
|
-
|
|
3905
|
-
|
|
3906
|
-
|
|
3907
|
-
|
|
3908
|
-
|
|
3909
|
-
|
|
3910
|
-
|
|
3911
|
-
}
|
|
3868
|
+
}
|
|
3869
|
+
function comment() {
|
|
3870
|
+
const m = match(/^<!--[\s\S]*?-->/);
|
|
3871
|
+
if (m) {
|
|
3872
|
+
const node = {
|
|
3873
|
+
type: 'Comment',
|
|
3874
|
+
content: m[0]
|
|
3875
|
+
};
|
|
3876
|
+
return {
|
|
3877
|
+
excluded: parsingState.options.filter(node) === false,
|
|
3878
|
+
node
|
|
3879
|
+
};
|
|
3912
3880
|
}
|
|
3913
|
-
|
|
3914
|
-
|
|
3915
|
-
|
|
3916
|
-
|
|
3917
|
-
|
|
3881
|
+
}
|
|
3882
|
+
function text() {
|
|
3883
|
+
const m = match(/^([^<]+)/);
|
|
3884
|
+
if (m) {
|
|
3885
|
+
const node = {
|
|
3886
|
+
type: 'Text',
|
|
3887
|
+
content: m[1]
|
|
3888
|
+
};
|
|
3889
|
+
return {
|
|
3890
|
+
excluded: parsingState.options.filter(node) === false,
|
|
3891
|
+
node
|
|
3892
|
+
};
|
|
3918
3893
|
}
|
|
3919
|
-
|
|
3920
|
-
|
|
3921
|
-
|
|
3922
|
-
|
|
3923
|
-
|
|
3924
|
-
|
|
3894
|
+
}
|
|
3895
|
+
function attribute() {
|
|
3896
|
+
const m = match(/([^=]+)\s*=\s*("[^"]*"|'[^']*'|[^>\s]+)\s*/);
|
|
3897
|
+
if (m) {
|
|
3898
|
+
return {
|
|
3899
|
+
name: m[1].trim(),
|
|
3900
|
+
value: stripQuotes(m[2].trim())
|
|
3901
|
+
};
|
|
3925
3902
|
}
|
|
3926
|
-
|
|
3927
|
-
|
|
3928
|
-
|
|
3929
|
-
|
|
3930
|
-
|
|
3931
|
-
|
|
3932
|
-
|
|
3933
|
-
|
|
3903
|
+
}
|
|
3904
|
+
function stripQuotes(val) {
|
|
3905
|
+
return val.replace(/^['"]|['"]$/g, '');
|
|
3906
|
+
}
|
|
3907
|
+
/**
|
|
3908
|
+
* Match `re` and advance the string.
|
|
3909
|
+
*/
|
|
3910
|
+
function match(re) {
|
|
3911
|
+
const m = parsingState.xml.match(re);
|
|
3912
|
+
if (m) {
|
|
3913
|
+
parsingState.xml = parsingState.xml.slice(m[0].length);
|
|
3934
3914
|
return m;
|
|
3935
3915
|
}
|
|
3936
|
-
|
|
3937
|
-
|
|
3938
|
-
|
|
3939
|
-
|
|
3940
|
-
|
|
3941
|
-
|
|
3942
|
-
|
|
3943
|
-
|
|
3944
|
-
|
|
3945
|
-
|
|
3946
|
-
|
|
3947
|
-
|
|
3948
|
-
|
|
3949
|
-
|
|
3950
|
-
|
|
3916
|
+
}
|
|
3917
|
+
/**
|
|
3918
|
+
* End-of-source.
|
|
3919
|
+
*/
|
|
3920
|
+
function eos() {
|
|
3921
|
+
return 0 === parsingState.xml.length;
|
|
3922
|
+
}
|
|
3923
|
+
/**
|
|
3924
|
+
* Check for `prefix`.
|
|
3925
|
+
*/
|
|
3926
|
+
function is(prefix) {
|
|
3927
|
+
return 0 === parsingState.xml.indexOf(prefix);
|
|
3928
|
+
}
|
|
3929
|
+
/**
|
|
3930
|
+
* Parse the given XML string into an object.
|
|
3931
|
+
*/
|
|
3932
|
+
function parseXml(xml, options = {}) {
|
|
3951
3933
|
xml = xml.trim();
|
|
3952
|
-
|
|
3953
|
-
|
|
3934
|
+
const filter = options.filter || (() => true);
|
|
3935
|
+
parsingState = {
|
|
3936
|
+
xml,
|
|
3937
|
+
options: Object.assign(Object.assign({}, options), { filter })
|
|
3938
|
+
};
|
|
3939
|
+
return parseDocument();
|
|
3954
3940
|
}
|
|
3941
|
+
{
|
|
3942
|
+
module.exports = parseXml;
|
|
3943
|
+
}
|
|
3944
|
+
exports.default = parseXml;
|
|
3945
|
+
|
|
3946
|
+
} (cjs, cjs.exports));
|
|
3955
3947
|
|
|
3956
|
-
|
|
3957
|
-
return xmlParserXo;
|
|
3958
|
-
}
|
|
3959
|
-
|
|
3960
|
-
/**
|
|
3961
|
-
* @typedef {Object} XMLFormatterOptions
|
|
3962
|
-
* @property {String} [indentation=' '] The value used for indentation
|
|
3963
|
-
* @property {function(node): boolean} [filter] Return false to exclude the node.
|
|
3964
|
-
* @property {Boolean} [collapseContent=false] True to keep content in the same line as the element. Only works if element contains at least one text node
|
|
3965
|
-
* @property {String} [lineSeparator='\r\n'] The line separator to use
|
|
3966
|
-
* @property {String} [whiteSpaceAtEndOfSelfclosingTag=false] to either end ad self closing tag with `<tag/>` or `<tag />`
|
|
3967
|
-
*/
|
|
3968
|
-
|
|
3969
|
-
/**
|
|
3970
|
-
* @typedef {Object} XMLFormatterState
|
|
3971
|
-
* @param {String} content
|
|
3972
|
-
* @param {Number} level
|
|
3973
|
-
* @param {XMLFormatterOptions} options
|
|
3974
|
-
*/
|
|
3975
|
-
|
|
3976
|
-
/**
|
|
3977
|
-
* @param {XMLFormatterState} state
|
|
3978
|
-
* @return {void}
|
|
3979
|
-
*/
|
|
3980
|
-
function newLine(state) {
|
|
3981
|
-
if (!state.options.indentation && !state.options.lineSeparator) return;
|
|
3982
|
-
state.content += state.options.lineSeparator;
|
|
3983
|
-
let i;
|
|
3984
|
-
for (i = 0; i < state.level; i++) {
|
|
3985
|
-
state.content += state.options.indentation;
|
|
3986
|
-
}
|
|
3987
|
-
}
|
|
3988
|
-
|
|
3989
|
-
/**
|
|
3990
|
-
* @param {XMLFormatterState} state
|
|
3991
|
-
* @param {String} content
|
|
3992
|
-
* @return {void}
|
|
3993
|
-
*/
|
|
3994
|
-
function appendContent(state, content) {
|
|
3995
|
-
state.content += content;
|
|
3996
|
-
}
|
|
3997
|
-
|
|
3998
|
-
/**
|
|
3999
|
-
* @param {Object} node
|
|
4000
|
-
* @param {XMLFormatterState} state
|
|
4001
|
-
* @param {Boolean} preserveSpace
|
|
4002
|
-
* @return {void}
|
|
4003
|
-
*/
|
|
4004
|
-
function processNode(node, state, preserveSpace) {
|
|
4005
|
-
if (typeof node.content === 'string') {
|
|
4006
|
-
processContentNode(node, state, preserveSpace);
|
|
4007
|
-
} else if (node.type === 'Element') {
|
|
4008
|
-
processElementNode(node, state, preserveSpace);
|
|
4009
|
-
} else if (node.type === 'ProcessingInstruction') {
|
|
4010
|
-
processProcessingIntruction(node, state);
|
|
4011
|
-
} else {
|
|
4012
|
-
throw new Error('Unknown node type: ' + node.type);
|
|
4013
|
-
}
|
|
4014
|
-
}
|
|
4015
|
-
|
|
4016
|
-
/**
|
|
4017
|
-
* @param {Object} node
|
|
4018
|
-
* @param {XMLFormatterState} state
|
|
4019
|
-
* @param {Boolean} preserveSpace
|
|
4020
|
-
* @return {void}
|
|
4021
|
-
*/
|
|
4022
|
-
function processContentNode(node, state, preserveSpace) {
|
|
4023
|
-
if (!preserveSpace) {
|
|
4024
|
-
node.content = node.content.trim();
|
|
4025
|
-
}
|
|
4026
|
-
if (node.content.length > 0) {
|
|
4027
|
-
if (!preserveSpace && state.content.length > 0) {
|
|
4028
|
-
newLine(state);
|
|
4029
|
-
}
|
|
4030
|
-
appendContent(state, node.content);
|
|
4031
|
-
}
|
|
4032
|
-
}
|
|
4033
|
-
|
|
4034
|
-
/**
|
|
4035
|
-
* @param {Object} node
|
|
4036
|
-
* @param {XMLFormatterState} state
|
|
4037
|
-
* @param {Boolean} preserveSpace
|
|
4038
|
-
* @return {void}
|
|
4039
|
-
*/
|
|
4040
|
-
function processElementNode(node, state, preserveSpace) {
|
|
4041
|
-
if (!preserveSpace && state.content.length > 0) {
|
|
4042
|
-
newLine(state);
|
|
4043
|
-
}
|
|
4044
|
-
|
|
4045
|
-
appendContent(state, '<' + node.name);
|
|
4046
|
-
processAttributes(state, node.attributes);
|
|
4047
|
-
|
|
4048
|
-
if (node.children === null) {
|
|
4049
|
-
const selfClosingNodeClosingTag = state.options.whiteSpaceAtEndOfSelfclosingTag ? ' />' : '/>';
|
|
4050
|
-
// self-closing node
|
|
4051
|
-
appendContent(state, selfClosingNodeClosingTag);
|
|
4052
|
-
} else if (node.children.length === 0) {
|
|
4053
|
-
// empty node
|
|
4054
|
-
appendContent(state, '></' + node.name + '>');
|
|
4055
|
-
} else {
|
|
4056
|
-
|
|
4057
|
-
appendContent(state, '>');
|
|
4058
|
-
|
|
4059
|
-
state.level++;
|
|
4060
|
-
|
|
4061
|
-
let nodePreserveSpace = node.attributes['xml:space'] === 'preserve';
|
|
4062
|
-
|
|
4063
|
-
if (!nodePreserveSpace && state.options.collapseContent) {
|
|
4064
|
-
let containsTextNodes = false;
|
|
4065
|
-
let containsTextNodesWithLineBreaks = false;
|
|
4066
|
-
let containsNonTextNodes = false;
|
|
4067
|
-
|
|
4068
|
-
node.children.forEach(function(child, index) {
|
|
4069
|
-
if (child.type === 'Text') {
|
|
4070
|
-
if (child.content.includes('\n')) {
|
|
4071
|
-
containsTextNodesWithLineBreaks = true;
|
|
4072
|
-
child.content = child.content.trim();
|
|
4073
|
-
} else if (index === 0 || index === node.children.length - 1) {
|
|
4074
|
-
if (child.content.trim().length === 0) {
|
|
4075
|
-
// If the text node is at the start or end and is empty, it should be ignored when formatting
|
|
4076
|
-
child.content = '';
|
|
4077
|
-
}
|
|
4078
|
-
}
|
|
4079
|
-
if (child.content.length > 0) {
|
|
4080
|
-
containsTextNodes = true;
|
|
4081
|
-
}
|
|
4082
|
-
} else if (child.type === 'CDATA') {
|
|
4083
|
-
containsTextNodes = true;
|
|
4084
|
-
} else {
|
|
4085
|
-
containsNonTextNodes = true;
|
|
4086
|
-
}
|
|
4087
|
-
});
|
|
4088
|
-
|
|
4089
|
-
if (containsTextNodes && (!containsNonTextNodes || !containsTextNodesWithLineBreaks)) {
|
|
4090
|
-
nodePreserveSpace = true;
|
|
4091
|
-
}
|
|
4092
|
-
}
|
|
3948
|
+
var cjsExports$1 = cjs.exports;
|
|
4093
3949
|
|
|
4094
|
-
|
|
4095
|
-
processNode(child, state, preserveSpace || nodePreserveSpace, state.options);
|
|
4096
|
-
});
|
|
3950
|
+
cjs$1.exports;
|
|
4097
3951
|
|
|
4098
|
-
|
|
3952
|
+
(function (module, exports) {
|
|
3953
|
+
var __importDefault = (commonjsGlobal && commonjsGlobal.__importDefault) || function (mod) {
|
|
3954
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
3955
|
+
};
|
|
3956
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3957
|
+
const xml_parser_xo_1 = __importDefault(cjsExports$1);
|
|
3958
|
+
function newLine(state) {
|
|
3959
|
+
if (!state.options.indentation && !state.options.lineSeparator)
|
|
3960
|
+
return;
|
|
3961
|
+
state.content += state.options.lineSeparator;
|
|
3962
|
+
let i;
|
|
3963
|
+
for (i = 0; i < state.level; i++) {
|
|
3964
|
+
state.content += state.options.indentation;
|
|
3965
|
+
}
|
|
3966
|
+
}
|
|
3967
|
+
function appendContent(state, content) {
|
|
3968
|
+
state.content += content;
|
|
3969
|
+
}
|
|
3970
|
+
function processNode(node, state, preserveSpace) {
|
|
3971
|
+
if (typeof node.content === 'string') {
|
|
3972
|
+
processContent(node.content, state, preserveSpace);
|
|
3973
|
+
}
|
|
3974
|
+
else if (node.type === 'Element') {
|
|
3975
|
+
processElementNode(node, state, preserveSpace);
|
|
3976
|
+
}
|
|
3977
|
+
else if (node.type === 'ProcessingInstruction') {
|
|
3978
|
+
processProcessingIntruction(node, state);
|
|
3979
|
+
}
|
|
3980
|
+
else {
|
|
3981
|
+
throw new Error('Unknown node type: ' + node.type);
|
|
3982
|
+
}
|
|
3983
|
+
}
|
|
3984
|
+
function processContent(content, state, preserveSpace) {
|
|
3985
|
+
if (!preserveSpace) {
|
|
3986
|
+
const trimmedContent = content.trim();
|
|
3987
|
+
if (state.options.lineSeparator) {
|
|
3988
|
+
content = trimmedContent;
|
|
3989
|
+
}
|
|
3990
|
+
else if (trimmedContent.length === 0) {
|
|
3991
|
+
content = trimmedContent;
|
|
3992
|
+
}
|
|
3993
|
+
}
|
|
3994
|
+
if (content.length > 0) {
|
|
3995
|
+
if (!preserveSpace && state.content.length > 0) {
|
|
3996
|
+
newLine(state);
|
|
3997
|
+
}
|
|
3998
|
+
appendContent(state, content);
|
|
3999
|
+
}
|
|
4000
|
+
}
|
|
4001
|
+
function processElementNode(node, state, preserveSpace) {
|
|
4002
|
+
if (!preserveSpace && state.content.length > 0) {
|
|
4003
|
+
newLine(state);
|
|
4004
|
+
}
|
|
4005
|
+
appendContent(state, '<' + node.name);
|
|
4006
|
+
processAttributes(state, node.attributes);
|
|
4007
|
+
if (node.children === null) {
|
|
4008
|
+
const selfClosingNodeClosingTag = state.options.whiteSpaceAtEndOfSelfclosingTag ? ' />' : '/>';
|
|
4009
|
+
// self-closing node
|
|
4010
|
+
appendContent(state, selfClosingNodeClosingTag);
|
|
4011
|
+
}
|
|
4012
|
+
else if (node.children.length === 0) {
|
|
4013
|
+
// empty node
|
|
4014
|
+
appendContent(state, '></' + node.name + '>');
|
|
4015
|
+
}
|
|
4016
|
+
else {
|
|
4017
|
+
const nodeChildren = node.children;
|
|
4018
|
+
appendContent(state, '>');
|
|
4019
|
+
state.level++;
|
|
4020
|
+
let nodePreserveSpace = node.attributes['xml:space'] === 'preserve';
|
|
4021
|
+
if (!nodePreserveSpace && state.options.collapseContent) {
|
|
4022
|
+
let containsTextNodes = false;
|
|
4023
|
+
let containsTextNodesWithLineBreaks = false;
|
|
4024
|
+
let containsNonTextNodes = false;
|
|
4025
|
+
nodeChildren.forEach(function (child, index) {
|
|
4026
|
+
if (child.type === 'Text') {
|
|
4027
|
+
if (child.content.includes('\n')) {
|
|
4028
|
+
containsTextNodesWithLineBreaks = true;
|
|
4029
|
+
child.content = child.content.trim();
|
|
4030
|
+
}
|
|
4031
|
+
else if (index === 0 || index === nodeChildren.length - 1) {
|
|
4032
|
+
if (child.content.trim().length === 0) {
|
|
4033
|
+
// If the text node is at the start or end and is empty, it should be ignored when formatting
|
|
4034
|
+
child.content = '';
|
|
4035
|
+
}
|
|
4036
|
+
}
|
|
4037
|
+
if (child.content.trim().length > 0) {
|
|
4038
|
+
containsTextNodes = true;
|
|
4039
|
+
}
|
|
4040
|
+
}
|
|
4041
|
+
else if (child.type === 'CDATA') {
|
|
4042
|
+
containsTextNodes = true;
|
|
4043
|
+
}
|
|
4044
|
+
else {
|
|
4045
|
+
containsNonTextNodes = true;
|
|
4046
|
+
}
|
|
4047
|
+
});
|
|
4048
|
+
if (containsTextNodes && (!containsNonTextNodes || !containsTextNodesWithLineBreaks)) {
|
|
4049
|
+
nodePreserveSpace = true;
|
|
4050
|
+
}
|
|
4051
|
+
}
|
|
4052
|
+
nodeChildren.forEach(function (child) {
|
|
4053
|
+
processNode(child, state, preserveSpace || nodePreserveSpace);
|
|
4054
|
+
});
|
|
4055
|
+
state.level--;
|
|
4056
|
+
if (!preserveSpace && !nodePreserveSpace) {
|
|
4057
|
+
newLine(state);
|
|
4058
|
+
}
|
|
4059
|
+
appendContent(state, '</' + node.name + '>');
|
|
4060
|
+
}
|
|
4061
|
+
}
|
|
4062
|
+
function processAttributes(state, attributes) {
|
|
4063
|
+
Object.keys(attributes).forEach(function (attr) {
|
|
4064
|
+
const escaped = attributes[attr].replace(/"/g, '"');
|
|
4065
|
+
appendContent(state, ' ' + attr + '="' + escaped + '"');
|
|
4066
|
+
});
|
|
4067
|
+
}
|
|
4068
|
+
function processProcessingIntruction(node, state) {
|
|
4069
|
+
if (state.content.length > 0) {
|
|
4070
|
+
newLine(state);
|
|
4071
|
+
}
|
|
4072
|
+
appendContent(state, '<?' + node.name);
|
|
4073
|
+
processAttributes(state, node.attributes);
|
|
4074
|
+
appendContent(state, '?>');
|
|
4075
|
+
}
|
|
4076
|
+
/**
|
|
4077
|
+
* Converts the given XML into human readable format.
|
|
4078
|
+
*/
|
|
4079
|
+
function formatXml(xml, options = {}) {
|
|
4080
|
+
options.indentation = 'indentation' in options ? options.indentation : ' ';
|
|
4081
|
+
options.collapseContent = options.collapseContent === true;
|
|
4082
|
+
options.lineSeparator = 'lineSeparator' in options ? options.lineSeparator : '\r\n';
|
|
4083
|
+
options.whiteSpaceAtEndOfSelfclosingTag = options.whiteSpaceAtEndOfSelfclosingTag === true;
|
|
4084
|
+
options.throwOnFailure = options.throwOnFailure !== false;
|
|
4085
|
+
try {
|
|
4086
|
+
const parsedXml = (0, xml_parser_xo_1.default)(xml, { filter: options.filter });
|
|
4087
|
+
const state = { content: '', level: 0, options: options };
|
|
4088
|
+
if (parsedXml.declaration) {
|
|
4089
|
+
processProcessingIntruction(parsedXml.declaration, state);
|
|
4090
|
+
}
|
|
4091
|
+
parsedXml.children.forEach(function (child) {
|
|
4092
|
+
processNode(child, state, false);
|
|
4093
|
+
});
|
|
4094
|
+
if (!options.lineSeparator) {
|
|
4095
|
+
return state.content;
|
|
4096
|
+
}
|
|
4097
|
+
return state.content
|
|
4098
|
+
.replace(/\r\n/g, '\n')
|
|
4099
|
+
.replace(/\n/g, options.lineSeparator);
|
|
4100
|
+
}
|
|
4101
|
+
catch (err) {
|
|
4102
|
+
if (options.throwOnFailure) {
|
|
4103
|
+
throw err;
|
|
4104
|
+
}
|
|
4105
|
+
return xml;
|
|
4106
|
+
}
|
|
4107
|
+
}
|
|
4108
|
+
formatXml.minify = (xml, options = {}) => {
|
|
4109
|
+
return formatXml(xml, Object.assign(Object.assign({}, options), { indentation: '', lineSeparator: '' }));
|
|
4110
|
+
};
|
|
4111
|
+
{
|
|
4112
|
+
module.exports = formatXml;
|
|
4113
|
+
}
|
|
4114
|
+
exports.default = formatXml;
|
|
4115
|
+
|
|
4116
|
+
} (cjs$1, cjs$1.exports));
|
|
4099
4117
|
|
|
4100
|
-
|
|
4101
|
-
|
|
4102
|
-
}
|
|
4103
|
-
appendContent(state, '</' + node.name + '>');
|
|
4104
|
-
}
|
|
4105
|
-
}
|
|
4118
|
+
var cjsExports = cjs$1.exports;
|
|
4119
|
+
var format = /*@__PURE__*/getDefaultExportFromCjs(cjsExports);
|
|
4106
4120
|
|
|
4107
|
-
|
|
4108
|
-
|
|
4109
|
-
* @param {Record<String, String>} attributes
|
|
4110
|
-
* @return {void}
|
|
4111
|
-
*/
|
|
4112
|
-
function processAttributes(state, attributes) {
|
|
4113
|
-
Object.keys(attributes).forEach(function(attr) {
|
|
4114
|
-
const escaped = attributes[attr].replace(/"/g, '"');
|
|
4115
|
-
appendContent(state, ' ' + attr + '="' + escaped + '"');
|
|
4116
|
-
});
|
|
4121
|
+
function slash$1(str) {
|
|
4122
|
+
return str.replace(/\\/g, "/");
|
|
4117
4123
|
}
|
|
4118
|
-
|
|
4119
|
-
|
|
4120
|
-
|
|
4121
|
-
|
|
4122
|
-
* @return {void}
|
|
4123
|
-
*/
|
|
4124
|
-
function processProcessingIntruction(node, state) {
|
|
4125
|
-
if (state.content.length > 0) {
|
|
4126
|
-
newLine(state);
|
|
4127
|
-
}
|
|
4128
|
-
appendContent(state, '<?' + node.name);
|
|
4129
|
-
processAttributes(state, node.attributes);
|
|
4130
|
-
appendContent(state, '?>');
|
|
4124
|
+
function ensurePrefix(prefix, str) {
|
|
4125
|
+
if (!str.startsWith(prefix))
|
|
4126
|
+
return prefix + str;
|
|
4127
|
+
return str;
|
|
4131
4128
|
}
|
|
4132
|
-
|
|
4133
|
-
|
|
4134
|
-
|
|
4135
|
-
|
|
4136
|
-
*
|
|
4137
|
-
* @param {String} xml
|
|
4138
|
-
* @param {XMLFormatterOptions} options
|
|
4139
|
-
* @returns {string}
|
|
4140
|
-
*/
|
|
4141
|
-
function format(xml, options = {}) {
|
|
4142
|
-
options.indentation = 'indentation' in options ? options.indentation : ' ';
|
|
4143
|
-
options.collapseContent = options.collapseContent === true;
|
|
4144
|
-
options.lineSeparator = 'lineSeparator' in options ? options.lineSeparator : '\r\n';
|
|
4145
|
-
options.whiteSpaceAtEndOfSelfclosingTag = !!options.whiteSpaceAtEndOfSelfclosingTag;
|
|
4146
|
-
|
|
4147
|
-
const parser = requireXmlParserXo();
|
|
4148
|
-
const parsedXml = parser(xml, {filter: options.filter});
|
|
4149
|
-
const state = {content: '', level: 0, options: options};
|
|
4150
|
-
|
|
4151
|
-
if (parsedXml.declaration) {
|
|
4152
|
-
processProcessingIntruction(parsedXml.declaration, state);
|
|
4153
|
-
}
|
|
4154
|
-
|
|
4155
|
-
parsedXml.children.forEach(function(child) {
|
|
4156
|
-
processNode(child, state, false);
|
|
4157
|
-
});
|
|
4158
|
-
|
|
4159
|
-
return state.content
|
|
4160
|
-
.replace(/\r\n/g, '\n')
|
|
4161
|
-
.replace(/\n/g, options.lineSeparator);
|
|
4129
|
+
function ensureSuffix(suffix, str) {
|
|
4130
|
+
if (!str.endsWith(suffix))
|
|
4131
|
+
return str + suffix;
|
|
4132
|
+
return str;
|
|
4162
4133
|
}
|
|
4163
4134
|
|
|
4164
|
-
|
|
4165
|
-
var xmlFormatter = format;
|
|
4166
|
-
|
|
4167
4135
|
var tasks = {};
|
|
4168
4136
|
|
|
4169
4137
|
var utils$k = {};
|
|
@@ -4435,7 +4403,7 @@ var isGlob = isGlob$1;
|
|
|
4435
4403
|
var pathPosixDirname = require$$0__default$2["default"].posix.dirname;
|
|
4436
4404
|
var isWin32 = require$$2__default$1["default"].platform() === 'win32';
|
|
4437
4405
|
|
|
4438
|
-
var slash
|
|
4406
|
+
var slash = '/';
|
|
4439
4407
|
var backslash = /\\/g;
|
|
4440
4408
|
var enclosure = /[\{\[].*[\}\]]$/;
|
|
4441
4409
|
var globby = /(^|[^\\])([\{\[]|\([^\)]+$)/;
|
|
@@ -4451,13 +4419,13 @@ var globParent$1 = function globParent(str, opts) {
|
|
|
4451
4419
|
var options = Object.assign({ flipBackslashes: true }, opts);
|
|
4452
4420
|
|
|
4453
4421
|
// flip windows path separators
|
|
4454
|
-
if (options.flipBackslashes && isWin32 && str.indexOf(slash
|
|
4455
|
-
str = str.replace(backslash, slash
|
|
4422
|
+
if (options.flipBackslashes && isWin32 && str.indexOf(slash) < 0) {
|
|
4423
|
+
str = str.replace(backslash, slash);
|
|
4456
4424
|
}
|
|
4457
4425
|
|
|
4458
4426
|
// special case for strings ending in enclosure containing path separator
|
|
4459
4427
|
if (enclosure.test(str)) {
|
|
4460
|
-
str += slash
|
|
4428
|
+
str += slash;
|
|
4461
4429
|
}
|
|
4462
4430
|
|
|
4463
4431
|
// preserves full path in case of trailing path separator
|
|
@@ -4585,7 +4553,7 @@ var utils$j = {};
|
|
|
4585
4553
|
};
|
|
4586
4554
|
flat(args);
|
|
4587
4555
|
return result;
|
|
4588
|
-
};
|
|
4556
|
+
};
|
|
4589
4557
|
} (utils$j));
|
|
4590
4558
|
|
|
4591
4559
|
const utils$i = utils$j;
|
|
@@ -5892,8 +5860,6 @@ braces$1.create = (input, options = {}) => {
|
|
|
5892
5860
|
|
|
5893
5861
|
var braces_1 = braces$1;
|
|
5894
5862
|
|
|
5895
|
-
var picomatch$2 = {exports: {}};
|
|
5896
|
-
|
|
5897
5863
|
var utils$f = {};
|
|
5898
5864
|
|
|
5899
5865
|
const path$7 = require$$0__default$2["default"];
|
|
@@ -6137,7 +6103,7 @@ var constants$3 = {
|
|
|
6137
6103
|
output = `(?:^(?!${output}).*$)`;
|
|
6138
6104
|
}
|
|
6139
6105
|
return output;
|
|
6140
|
-
};
|
|
6106
|
+
};
|
|
6141
6107
|
} (utils$f));
|
|
6142
6108
|
|
|
6143
6109
|
const utils$e = utils$f;
|
|
@@ -7649,9 +7615,9 @@ const isObject = val => val && typeof val === 'object' && !Array.isArray(val);
|
|
|
7649
7615
|
* @api public
|
|
7650
7616
|
*/
|
|
7651
7617
|
|
|
7652
|
-
const picomatch$
|
|
7618
|
+
const picomatch$2 = (glob, options, returnState = false) => {
|
|
7653
7619
|
if (Array.isArray(glob)) {
|
|
7654
|
-
const fns = glob.map(input => picomatch$
|
|
7620
|
+
const fns = glob.map(input => picomatch$2(input, options, returnState));
|
|
7655
7621
|
const arrayMatcher = str => {
|
|
7656
7622
|
for (const isMatch of fns) {
|
|
7657
7623
|
const state = isMatch(str);
|
|
@@ -7671,8 +7637,8 @@ const picomatch$1 = (glob, options, returnState = false) => {
|
|
|
7671
7637
|
const opts = options || {};
|
|
7672
7638
|
const posix = utils$c.isWindows(options);
|
|
7673
7639
|
const regex = isState
|
|
7674
|
-
? picomatch$
|
|
7675
|
-
: picomatch$
|
|
7640
|
+
? picomatch$2.compileRe(glob, options)
|
|
7641
|
+
: picomatch$2.makeRe(glob, options, false, true);
|
|
7676
7642
|
|
|
7677
7643
|
const state = regex.state;
|
|
7678
7644
|
delete regex.state;
|
|
@@ -7680,11 +7646,11 @@ const picomatch$1 = (glob, options, returnState = false) => {
|
|
|
7680
7646
|
let isIgnored = () => false;
|
|
7681
7647
|
if (opts.ignore) {
|
|
7682
7648
|
const ignoreOpts = { ...options, ignore: null, onMatch: null, onResult: null };
|
|
7683
|
-
isIgnored = picomatch$
|
|
7649
|
+
isIgnored = picomatch$2(opts.ignore, ignoreOpts, returnState);
|
|
7684
7650
|
}
|
|
7685
7651
|
|
|
7686
7652
|
const matcher = (input, returnObject = false) => {
|
|
7687
|
-
const { isMatch, match, output } = picomatch$
|
|
7653
|
+
const { isMatch, match, output } = picomatch$2.test(input, regex, options, { glob, posix });
|
|
7688
7654
|
const result = { glob, state, regex, posix, input, output, match, isMatch };
|
|
7689
7655
|
|
|
7690
7656
|
if (typeof opts.onResult === 'function') {
|
|
@@ -7734,7 +7700,7 @@ const picomatch$1 = (glob, options, returnState = false) => {
|
|
|
7734
7700
|
* @api public
|
|
7735
7701
|
*/
|
|
7736
7702
|
|
|
7737
|
-
picomatch$
|
|
7703
|
+
picomatch$2.test = (input, regex, options, { glob, posix } = {}) => {
|
|
7738
7704
|
if (typeof input !== 'string') {
|
|
7739
7705
|
throw new TypeError('Expected input to be a string');
|
|
7740
7706
|
}
|
|
@@ -7755,7 +7721,7 @@ picomatch$1.test = (input, regex, options, { glob, posix } = {}) => {
|
|
|
7755
7721
|
|
|
7756
7722
|
if (match === false || opts.capture === true) {
|
|
7757
7723
|
if (opts.matchBase === true || opts.basename === true) {
|
|
7758
|
-
match = picomatch$
|
|
7724
|
+
match = picomatch$2.matchBase(input, regex, options, posix);
|
|
7759
7725
|
} else {
|
|
7760
7726
|
match = regex.exec(output);
|
|
7761
7727
|
}
|
|
@@ -7778,8 +7744,8 @@ picomatch$1.test = (input, regex, options, { glob, posix } = {}) => {
|
|
|
7778
7744
|
* @api public
|
|
7779
7745
|
*/
|
|
7780
7746
|
|
|
7781
|
-
picomatch$
|
|
7782
|
-
const regex = glob instanceof RegExp ? glob : picomatch$
|
|
7747
|
+
picomatch$2.matchBase = (input, glob, options, posix = utils$c.isWindows(options)) => {
|
|
7748
|
+
const regex = glob instanceof RegExp ? glob : picomatch$2.makeRe(glob, options);
|
|
7783
7749
|
return regex.test(path$6.basename(input));
|
|
7784
7750
|
};
|
|
7785
7751
|
|
|
@@ -7800,7 +7766,7 @@ picomatch$1.matchBase = (input, glob, options, posix = utils$c.isWindows(options
|
|
|
7800
7766
|
* @api public
|
|
7801
7767
|
*/
|
|
7802
7768
|
|
|
7803
|
-
picomatch$
|
|
7769
|
+
picomatch$2.isMatch = (str, patterns, options) => picomatch$2(patterns, options)(str);
|
|
7804
7770
|
|
|
7805
7771
|
/**
|
|
7806
7772
|
* Parse a glob pattern to create the source string for a regular
|
|
@@ -7816,8 +7782,8 @@ picomatch$1.isMatch = (str, patterns, options) => picomatch$1(patterns, options)
|
|
|
7816
7782
|
* @api public
|
|
7817
7783
|
*/
|
|
7818
7784
|
|
|
7819
|
-
picomatch$
|
|
7820
|
-
if (Array.isArray(pattern)) return pattern.map(p => picomatch$
|
|
7785
|
+
picomatch$2.parse = (pattern, options) => {
|
|
7786
|
+
if (Array.isArray(pattern)) return pattern.map(p => picomatch$2.parse(p, options));
|
|
7821
7787
|
return parse(pattern, { ...options, fastpaths: false });
|
|
7822
7788
|
};
|
|
7823
7789
|
|
|
@@ -7848,7 +7814,7 @@ picomatch$1.parse = (pattern, options) => {
|
|
|
7848
7814
|
* @api public
|
|
7849
7815
|
*/
|
|
7850
7816
|
|
|
7851
|
-
picomatch$
|
|
7817
|
+
picomatch$2.scan = (input, options) => scan(input, options);
|
|
7852
7818
|
|
|
7853
7819
|
/**
|
|
7854
7820
|
* Compile a regular expression from the `state` object returned by the
|
|
@@ -7862,7 +7828,7 @@ picomatch$1.scan = (input, options) => scan(input, options);
|
|
|
7862
7828
|
* @api public
|
|
7863
7829
|
*/
|
|
7864
7830
|
|
|
7865
|
-
picomatch$
|
|
7831
|
+
picomatch$2.compileRe = (state, options, returnOutput = false, returnState = false) => {
|
|
7866
7832
|
if (returnOutput === true) {
|
|
7867
7833
|
return state.output;
|
|
7868
7834
|
}
|
|
@@ -7876,7 +7842,7 @@ picomatch$1.compileRe = (state, options, returnOutput = false, returnState = fal
|
|
|
7876
7842
|
source = `^(?!${source}).*$`;
|
|
7877
7843
|
}
|
|
7878
7844
|
|
|
7879
|
-
const regex = picomatch$
|
|
7845
|
+
const regex = picomatch$2.toRegex(source, options);
|
|
7880
7846
|
if (returnState === true) {
|
|
7881
7847
|
regex.state = state;
|
|
7882
7848
|
}
|
|
@@ -7903,7 +7869,7 @@ picomatch$1.compileRe = (state, options, returnOutput = false, returnState = fal
|
|
|
7903
7869
|
* @api public
|
|
7904
7870
|
*/
|
|
7905
7871
|
|
|
7906
|
-
picomatch$
|
|
7872
|
+
picomatch$2.makeRe = (input, options = {}, returnOutput = false, returnState = false) => {
|
|
7907
7873
|
if (!input || typeof input !== 'string') {
|
|
7908
7874
|
throw new TypeError('Expected a non-empty string');
|
|
7909
7875
|
}
|
|
@@ -7918,7 +7884,7 @@ picomatch$1.makeRe = (input, options = {}, returnOutput = false, returnState = f
|
|
|
7918
7884
|
parsed = parse(input, options);
|
|
7919
7885
|
}
|
|
7920
7886
|
|
|
7921
|
-
return picomatch$
|
|
7887
|
+
return picomatch$2.compileRe(parsed, options, returnOutput, returnState);
|
|
7922
7888
|
};
|
|
7923
7889
|
|
|
7924
7890
|
/**
|
|
@@ -7938,7 +7904,7 @@ picomatch$1.makeRe = (input, options = {}, returnOutput = false, returnState = f
|
|
|
7938
7904
|
* @api public
|
|
7939
7905
|
*/
|
|
7940
7906
|
|
|
7941
|
-
picomatch$
|
|
7907
|
+
picomatch$2.toRegex = (source, options) => {
|
|
7942
7908
|
try {
|
|
7943
7909
|
const opts = options || {};
|
|
7944
7910
|
return new RegExp(source, opts.flags || (opts.nocase ? 'i' : ''));
|
|
@@ -7953,22 +7919,19 @@ picomatch$1.toRegex = (source, options) => {
|
|
|
7953
7919
|
* @return {Object}
|
|
7954
7920
|
*/
|
|
7955
7921
|
|
|
7956
|
-
picomatch$
|
|
7922
|
+
picomatch$2.constants = constants$1;
|
|
7957
7923
|
|
|
7958
7924
|
/**
|
|
7959
7925
|
* Expose "picomatch"
|
|
7960
7926
|
*/
|
|
7961
7927
|
|
|
7962
|
-
var picomatch_1 = picomatch$
|
|
7963
|
-
|
|
7964
|
-
(function (module) {
|
|
7928
|
+
var picomatch_1 = picomatch$2;
|
|
7965
7929
|
|
|
7966
|
-
|
|
7967
|
-
} (picomatch$2));
|
|
7930
|
+
var picomatch$1 = picomatch_1;
|
|
7968
7931
|
|
|
7969
7932
|
const util = require$$0__default$3["default"];
|
|
7970
7933
|
const braces = braces_1;
|
|
7971
|
-
const picomatch = picomatch$
|
|
7934
|
+
const picomatch = picomatch$1;
|
|
7972
7935
|
const utils$b = utils$f;
|
|
7973
7936
|
const isEmptyString = val => val === '' || val === './';
|
|
7974
7937
|
|
|
@@ -8996,7 +8959,7 @@ var fs$5 = {};
|
|
|
8996
8959
|
}
|
|
8997
8960
|
return Object.assign(Object.assign({}, exports.FILE_SYSTEM_ADAPTER), fsMethods);
|
|
8998
8961
|
}
|
|
8999
|
-
exports.createFileSystemAdapter = createFileSystemAdapter;
|
|
8962
|
+
exports.createFileSystemAdapter = createFileSystemAdapter;
|
|
9000
8963
|
} (fs$5));
|
|
9001
8964
|
|
|
9002
8965
|
Object.defineProperty(settings$3, "__esModule", { value: true });
|
|
@@ -9349,7 +9312,7 @@ var fs$1 = {};
|
|
|
9349
9312
|
}
|
|
9350
9313
|
return Object.assign(Object.assign({}, exports.FILE_SYSTEM_ADAPTER), fsMethods);
|
|
9351
9314
|
}
|
|
9352
|
-
exports.createFileSystemAdapter = createFileSystemAdapter;
|
|
9315
|
+
exports.createFileSystemAdapter = createFileSystemAdapter;
|
|
9353
9316
|
} (fs$1));
|
|
9354
9317
|
|
|
9355
9318
|
Object.defineProperty(settings$2, "__esModule", { value: true });
|
|
@@ -9718,6 +9681,8 @@ function queueAsPromised (context, worker, concurrency) {
|
|
|
9718
9681
|
queue.exports = fastqueue;
|
|
9719
9682
|
queue.exports.promise = queueAsPromised;
|
|
9720
9683
|
|
|
9684
|
+
var queueExports = queue.exports;
|
|
9685
|
+
|
|
9721
9686
|
var common$3 = {};
|
|
9722
9687
|
|
|
9723
9688
|
Object.defineProperty(common$3, "__esModule", { value: true });
|
|
@@ -9767,7 +9732,7 @@ reader$1.default = Reader$1;
|
|
|
9767
9732
|
Object.defineProperty(async$4, "__esModule", { value: true });
|
|
9768
9733
|
const events_1 = require$$0__default$4["default"];
|
|
9769
9734
|
const fsScandir$2 = out$2;
|
|
9770
|
-
const fastq =
|
|
9735
|
+
const fastq = queueExports;
|
|
9771
9736
|
const common$1 = common$3;
|
|
9772
9737
|
const reader_1$4 = reader$1;
|
|
9773
9738
|
class AsyncReader extends reader_1$4.default {
|
|
@@ -10694,7 +10659,7 @@ var settings = {};
|
|
|
10694
10659
|
return Object.assign(Object.assign({}, exports.DEFAULT_FILE_SYSTEM_ADAPTER), methods);
|
|
10695
10660
|
}
|
|
10696
10661
|
}
|
|
10697
|
-
exports.default = Settings;
|
|
10662
|
+
exports.default = Settings;
|
|
10698
10663
|
} (settings));
|
|
10699
10664
|
|
|
10700
10665
|
const taskManager = tasks;
|
|
@@ -10765,18 +10730,22 @@ function assertPatternsInput(input) {
|
|
|
10765
10730
|
}
|
|
10766
10731
|
var out = FastGlob;
|
|
10767
10732
|
|
|
10733
|
+
var fg = /*@__PURE__*/getDefaultExportFromCjs(out);
|
|
10734
|
+
|
|
10768
10735
|
function resolveOptions(userOptions) {
|
|
10769
10736
|
return Object.assign(
|
|
10770
10737
|
{
|
|
10771
10738
|
hostname: "http://localhost/",
|
|
10772
10739
|
dynamicRoutes: [],
|
|
10773
10740
|
exclude: [],
|
|
10741
|
+
basePath: "",
|
|
10774
10742
|
outDir: "dist",
|
|
10775
10743
|
extensions: "html",
|
|
10776
10744
|
changefreq: "daily",
|
|
10777
10745
|
priority: 1,
|
|
10778
|
-
lastmod: new Date(),
|
|
10746
|
+
lastmod: /* @__PURE__ */ new Date(),
|
|
10779
10747
|
readable: false,
|
|
10748
|
+
generateRobotsTxt: true,
|
|
10780
10749
|
robots: [{
|
|
10781
10750
|
userAgent: "*",
|
|
10782
10751
|
allow: "/"
|
|
@@ -10786,20 +10755,6 @@ function resolveOptions(userOptions) {
|
|
|
10786
10755
|
);
|
|
10787
10756
|
}
|
|
10788
10757
|
|
|
10789
|
-
function slash(str) {
|
|
10790
|
-
return str.replace(/\\/g, "/");
|
|
10791
|
-
}
|
|
10792
|
-
function ensurePrefix(prefix, str) {
|
|
10793
|
-
if (!str.startsWith(prefix))
|
|
10794
|
-
return prefix + str;
|
|
10795
|
-
return str;
|
|
10796
|
-
}
|
|
10797
|
-
function ensureSuffix(suffix, str) {
|
|
10798
|
-
if (!str.endsWith(suffix))
|
|
10799
|
-
return str + suffix;
|
|
10800
|
-
return str;
|
|
10801
|
-
}
|
|
10802
|
-
|
|
10803
10758
|
var RobotCorrespondences = /* @__PURE__ */ ((RobotCorrespondences2) => {
|
|
10804
10759
|
RobotCorrespondences2["userAgent"] = "User-agent";
|
|
10805
10760
|
RobotCorrespondences2["allow"] = "Allow";
|
|
@@ -10833,42 +10788,49 @@ function getFinalSitemapPath(hostname) {
|
|
|
10833
10788
|
return `${ensureSuffix("/", hostname)}sitemap.xml`;
|
|
10834
10789
|
}
|
|
10835
10790
|
|
|
10791
|
+
function getResolvedPath(file, resolvedOptions) {
|
|
10792
|
+
if (node_path.isAbsolute(resolvedOptions.outDir))
|
|
10793
|
+
return node_path.resolve(`${resolvedOptions.outDir}/${file}`);
|
|
10794
|
+
return node_path.resolve(`${ensurePrefix("./", resolvedOptions.outDir)}/${file}`);
|
|
10795
|
+
}
|
|
10796
|
+
function removeMaybeSuffix(suffix, str) {
|
|
10797
|
+
if (!str.endsWith(suffix))
|
|
10798
|
+
return str;
|
|
10799
|
+
return str.slice(0, -suffix.length);
|
|
10800
|
+
}
|
|
10801
|
+
|
|
10836
10802
|
function getRoutes(options) {
|
|
10837
10803
|
const ext = typeof options.extensions === "string" ? [options.extensions] : options.extensions;
|
|
10838
10804
|
const strExt = ext.map((e) => `**/*.${e}`);
|
|
10839
10805
|
return [
|
|
10840
|
-
...
|
|
10806
|
+
...fg.sync(strExt, { cwd: options.outDir }).map((route) => {
|
|
10841
10807
|
let r = route;
|
|
10842
10808
|
ext.forEach((e) => {
|
|
10843
10809
|
const regex = new RegExp(`index.${e}`, "g");
|
|
10844
10810
|
r = r.replace(regex, "");
|
|
10845
10811
|
});
|
|
10846
|
-
const parsedRoute =
|
|
10847
|
-
return slash(
|
|
10812
|
+
const parsedRoute = node_path.parse(r);
|
|
10813
|
+
return slash$1(node_path.join("/", parsedRoute.dir, parsedRoute.name));
|
|
10848
10814
|
}),
|
|
10849
|
-
...options.dynamicRoutes.map((route) => slash(
|
|
10815
|
+
...options.dynamicRoutes.map((route) => slash$1(node_path.join("/", node_path.join(node_path.parse(route).dir, node_path.parse(route).name))))
|
|
10850
10816
|
].filter((route) => !options.exclude.includes(route));
|
|
10851
10817
|
}
|
|
10852
10818
|
function getFormattedSitemap(options, routes) {
|
|
10853
10819
|
return routes.map((route) => ({
|
|
10854
|
-
url: new URL(route, options.hostname).href,
|
|
10820
|
+
url: new URL(options.basePath ? ensurePrefix("/", options.basePath) + ensurePrefix("/", route) : ensurePrefix("/", "/route"), removeMaybeSuffix("/", options.hostname)).href,
|
|
10855
10821
|
changefreq: options.changefreq,
|
|
10856
10822
|
priority: options.priority,
|
|
10857
10823
|
lastmod: options.lastmod
|
|
10858
10824
|
}));
|
|
10859
10825
|
}
|
|
10860
10826
|
|
|
10861
|
-
function getResolvedPath(file, resolvedOptions) {
|
|
10862
|
-
if (require$$0$2.isAbsolute(resolvedOptions.outDir))
|
|
10863
|
-
return require$$0$2.resolve(`${resolvedOptions.outDir}/${file}`);
|
|
10864
|
-
return require$$0$2.resolve(`${ensurePrefix("./", resolvedOptions.outDir)}/${file}`);
|
|
10865
|
-
}
|
|
10866
|
-
|
|
10867
10827
|
function generateSitemap(options = {}) {
|
|
10868
10828
|
const resolvedOptions = resolveOptions(options);
|
|
10869
|
-
|
|
10870
|
-
|
|
10871
|
-
|
|
10829
|
+
if (resolvedOptions.generateRobotsTxt) {
|
|
10830
|
+
const robotRules = getRules(resolvedOptions.robots);
|
|
10831
|
+
const robotContent = getContent(robotRules, resolvedOptions.hostname);
|
|
10832
|
+
node_fs.writeFileSync(getResolvedPath("robots.txt", resolvedOptions), robotContent);
|
|
10833
|
+
}
|
|
10872
10834
|
const routes = getRoutes(resolvedOptions);
|
|
10873
10835
|
if (!routes.length)
|
|
10874
10836
|
return;
|
|
@@ -10877,8 +10839,8 @@ function generateSitemap(options = {}) {
|
|
|
10877
10839
|
formattedSitemap.forEach((item) => stream.write(item));
|
|
10878
10840
|
distExports.streamToPromise(stream).then((sitemap) => {
|
|
10879
10841
|
const utfSitemap = sitemap.toString("utf-8");
|
|
10880
|
-
const formattedSitemap2 = resolvedOptions.readable ?
|
|
10881
|
-
|
|
10842
|
+
const formattedSitemap2 = resolvedOptions.readable ? format(utfSitemap) : utfSitemap;
|
|
10843
|
+
node_fs.writeFileSync(getResolvedPath("sitemap.xml", resolvedOptions), formattedSitemap2);
|
|
10882
10844
|
});
|
|
10883
10845
|
stream.end();
|
|
10884
10846
|
}
|