vite-plugin-sitemap 0.1.5 → 0.2.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/index.mjs CHANGED
@@ -1,26 +1,9 @@
1
1
  var __create = Object.create;
2
2
  var __defProp = Object.defineProperty;
3
- var __defProps = Object.defineProperties;
4
3
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
- var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
6
4
  var __getOwnPropNames = Object.getOwnPropertyNames;
7
- var __getOwnPropSymbols = Object.getOwnPropertySymbols;
8
5
  var __getProtoOf = Object.getPrototypeOf;
9
6
  var __hasOwnProp = Object.prototype.hasOwnProperty;
10
- var __propIsEnum = Object.prototype.propertyIsEnumerable;
11
- var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
12
- var __spreadValues = (a, b) => {
13
- for (var prop in b || (b = {}))
14
- if (__hasOwnProp.call(b, prop))
15
- __defNormalProp(a, prop, b[prop]);
16
- if (__getOwnPropSymbols)
17
- for (var prop of __getOwnPropSymbols(b)) {
18
- if (__propIsEnum.call(b, prop))
19
- __defNormalProp(a, prop, b[prop]);
20
- }
21
- return a;
22
- };
23
- var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
24
7
  var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
25
8
  get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
26
9
  }) : x)(function(x) {
@@ -39,7 +22,10 @@ var __copyProps = (to, from, except, desc) => {
39
22
  }
40
23
  return to;
41
24
  };
42
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, mod));
25
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
26
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
27
+ mod
28
+ ));
43
29
 
44
30
  // node_modules/.pnpm/sitemap@7.1.1/node_modules/sitemap/dist/lib/errors.js
45
31
  var require_errors = __commonJS({
@@ -828,7 +814,8 @@ var require_utils = __commonJS({
828
814
  }
829
815
  img = smiLoose.img.map((el) => typeof el === "string" ? { url: el } : el);
830
816
  }
831
- smi.img = img.map((el) => __spreadProps(__spreadValues({}, el), {
817
+ smi.img = img.map((el) => ({
818
+ ...el,
832
819
  url: new url_1.URL(el.url, hostname).toString()
833
820
  }));
834
821
  let links = [];
@@ -836,20 +823,21 @@ var require_utils = __commonJS({
836
823
  links = smiLoose.links;
837
824
  }
838
825
  smi.links = links.map((link) => {
839
- return __spreadProps(__spreadValues({}, link), { url: new url_1.URL(link.url, hostname).toString() });
826
+ return { ...link, url: new url_1.URL(link.url, hostname).toString() };
840
827
  });
841
828
  if (smiLoose.video) {
842
829
  if (!Array.isArray(smiLoose.video)) {
843
830
  smiLoose.video = [smiLoose.video];
844
831
  }
845
832
  smi.video = smiLoose.video.map((video) => {
846
- const nv = __spreadProps(__spreadValues({}, video), {
833
+ const nv = {
834
+ ...video,
847
835
  family_friendly: boolToYESNO(video.family_friendly),
848
836
  live: boolToYESNO(video.live),
849
837
  requires_subscription: boolToYESNO(video.requires_subscription),
850
838
  tag: [],
851
839
  rating: void 0
852
- });
840
+ };
853
841
  if (video.tag !== void 0) {
854
842
  nv.tag = !Array.isArray(video.tag) ? [video.tag] : video.tag;
855
843
  }
@@ -881,7 +869,7 @@ var require_utils = __commonJS({
881
869
  }
882
870
  delete smiLoose.lastmodfile;
883
871
  delete smiLoose.lastmodISO;
884
- smi = __spreadValues(__spreadValues({}, smiLoose), smi);
872
+ smi = { ...smiLoose, ...smi };
885
873
  return smi;
886
874
  }
887
875
  exports.normalizeURL = normalizeURL;
@@ -1794,9 +1782,15 @@ var require_sax = __commonJS({
1794
1782
  var local = qn.local;
1795
1783
  if (prefix === "xmlns") {
1796
1784
  if (local === "xml" && parser.attribValue !== XML_NAMESPACE) {
1797
- strictFail(parser, "xml: prefix must be bound to " + XML_NAMESPACE + "\nActual: " + parser.attribValue);
1785
+ strictFail(
1786
+ parser,
1787
+ "xml: prefix must be bound to " + XML_NAMESPACE + "\nActual: " + parser.attribValue
1788
+ );
1798
1789
  } else if (local === "xmlns" && parser.attribValue !== XMLNS_NAMESPACE) {
1799
- strictFail(parser, "xmlns: prefix must be bound to " + XMLNS_NAMESPACE + "\nActual: " + parser.attribValue);
1790
+ strictFail(
1791
+ parser,
1792
+ "xmlns: prefix must be bound to " + XMLNS_NAMESPACE + "\nActual: " + parser.attribValue
1793
+ );
1800
1794
  } else {
1801
1795
  var tag = parser.tag;
1802
1796
  var parent = parser.tags[parser.tags.length - 1] || parser;
@@ -1990,7 +1984,10 @@ var require_sax = __commonJS({
1990
1984
  throw this.error;
1991
1985
  }
1992
1986
  if (parser.closed) {
1993
- return error(parser, "Cannot write after close. Assign an onready handler.");
1987
+ return error(
1988
+ parser,
1989
+ "Cannot write after close. Assign an onready handler."
1990
+ );
1994
1991
  }
1995
1992
  if (chunk === null) {
1996
1993
  return end(parser);
@@ -2109,7 +2106,10 @@ var require_sax = __commonJS({
2109
2106
  } else if ((parser.sgmlDecl + c).toUpperCase() === DOCTYPE) {
2110
2107
  parser.state = S.DOCTYPE;
2111
2108
  if (parser.doctype || parser.sawRoot) {
2112
- strictFail(parser, "Inappropriately located doctype declaration");
2109
+ strictFail(
2110
+ parser,
2111
+ "Inappropriately located doctype declaration"
2112
+ );
2113
2113
  }
2114
2114
  parser.doctype = "";
2115
2115
  parser.sgmlDecl = "";
@@ -2597,8 +2597,8 @@ var require_sitemap_parser = __commonJS({
2597
2597
  let currentItem = tagTemplate();
2598
2598
  let currentTag;
2599
2599
  let currentVideo = videoTemplate();
2600
- let currentImage = __spreadValues({}, imageTemplate);
2601
- let currentLink = __spreadValues({}, linkTemplate);
2600
+ let currentImage = { ...imageTemplate };
2601
+ let currentLink = { ...linkTemplate };
2602
2602
  let dontpushCurrentLink = false;
2603
2603
  this.saxStream.on("opentagstart", (tag) => {
2604
2604
  currentTag = tag.name;
@@ -2914,13 +2914,13 @@ var require_sitemap_parser = __commonJS({
2914
2914
  break;
2915
2915
  case types_1.TagNames["image:image"]:
2916
2916
  currentItem.img.push(currentImage);
2917
- currentImage = __spreadValues({}, imageTemplate);
2917
+ currentImage = { ...imageTemplate };
2918
2918
  break;
2919
2919
  case types_1.TagNames["xhtml:link"]:
2920
2920
  if (!dontpushCurrentLink) {
2921
2921
  currentItem.links.push(currentLink);
2922
2922
  }
2923
- currentLink = __spreadValues({}, linkTemplate);
2923
+ currentLink = { ...linkTemplate };
2924
2924
  break;
2925
2925
  default:
2926
2926
  break;
@@ -3474,10 +3474,10 @@ var require_xml_parser_xo = __commonJS({
3474
3474
  return m;
3475
3475
  }
3476
3476
  function eos() {
3477
- return xml.length === 0;
3477
+ return 0 === xml.length;
3478
3478
  }
3479
3479
  function is(prefix) {
3480
- return xml.indexOf(prefix) === 0;
3480
+ return 0 === xml.indexOf(prefix);
3481
3481
  }
3482
3482
  xml = xml.trim();
3483
3483
  return document();
@@ -4032,7 +4032,7 @@ var require_to_regex_range = __commonJS({
4032
4032
  if (isNumber(max) === false) {
4033
4033
  throw new TypeError("toRegexRange: expected the second argument to be a number.");
4034
4034
  }
4035
- let opts = __spreadValues({ relaxZeros: true }, options);
4035
+ let opts = { relaxZeros: true, ...options };
4036
4036
  if (typeof opts.strictZeros === "boolean") {
4037
4037
  opts.relaxZeros = opts.strictZeros === false;
4038
4038
  }
@@ -4307,7 +4307,7 @@ var require_fill_range = __commonJS({
4307
4307
  };
4308
4308
  var toRange = (a, b, isNumbers, options) => {
4309
4309
  if (isNumbers) {
4310
- return toRegexRange(a, b, __spreadValues({ wrap: false }, options));
4310
+ return toRegexRange(a, b, { wrap: false, ...options });
4311
4311
  }
4312
4312
  let start = String.fromCharCode(a);
4313
4313
  if (a === b)
@@ -4375,7 +4375,7 @@ var require_fill_range = __commonJS({
4375
4375
  index++;
4376
4376
  }
4377
4377
  if (options.toRegex === true) {
4378
- return step > 1 ? toSequence(parts, options) : toRegex(range, null, __spreadValues({ wrap: false }, options));
4378
+ return step > 1 ? toSequence(parts, options) : toRegex(range, null, { wrap: false, ...options });
4379
4379
  }
4380
4380
  return range;
4381
4381
  };
@@ -4417,7 +4417,7 @@ var require_fill_range = __commonJS({
4417
4417
  if (isObject(step)) {
4418
4418
  return fill(start, end, 0, step);
4419
4419
  }
4420
- let opts = __spreadValues({}, options);
4420
+ let opts = { ...options };
4421
4421
  if (opts.capture === true)
4422
4422
  opts.wrap = true;
4423
4423
  step = step || opts.step || 1;
@@ -4468,7 +4468,7 @@ var require_compile = __commonJS({
4468
4468
  }
4469
4469
  if (node.nodes && node.ranges > 0) {
4470
4470
  let args = utils.reduce(node.nodes);
4471
- let range = fill(...args, __spreadProps(__spreadValues({}, options), { wrap: false, toRegex: true }));
4471
+ let range = fill(...args, { ...options, wrap: false, toRegex: true });
4472
4472
  if (range.length !== 0) {
4473
4473
  return args.length > 1 && range.length > 1 ? `(${range})` : range;
4474
4474
  }
@@ -4971,7 +4971,8 @@ var require_constants2 = __commonJS({
4971
4971
  STAR,
4972
4972
  START_ANCHOR
4973
4973
  };
4974
- var WINDOWS_CHARS = __spreadProps(__spreadValues({}, POSIX_CHARS), {
4974
+ var WINDOWS_CHARS = {
4975
+ ...POSIX_CHARS,
4975
4976
  SLASH_LITERAL: `[${WIN_SLASH}]`,
4976
4977
  QMARK: WIN_NO_SLASH,
4977
4978
  STAR: `${WIN_NO_SLASH}*?`,
@@ -4983,7 +4984,7 @@ var require_constants2 = __commonJS({
4983
4984
  QMARK_NO_DOT: `[^.${WIN_SLASH}]`,
4984
4985
  START_ANCHOR: `(?:^|[${WIN_SLASH}])`,
4985
4986
  END_ANCHOR: `(?:[${WIN_SLASH}]|$)`
4986
- });
4987
+ };
4987
4988
  var POSIX_REGEX_SOURCE = {
4988
4989
  alnum: "a-zA-Z0-9",
4989
4990
  alpha: "a-zA-Z",
@@ -5489,7 +5490,7 @@ var require_parse2 = __commonJS({
5489
5490
  throw new TypeError("Expected a string");
5490
5491
  }
5491
5492
  input = REPLACEMENTS[input] || input;
5492
- const opts = __spreadValues({}, options);
5493
+ const opts = { ...options };
5493
5494
  const max = typeof opts.maxLength === "number" ? Math.min(MAX_LENGTH, opts.maxLength) : MAX_LENGTH;
5494
5495
  let len = input.length;
5495
5496
  if (len > max) {
@@ -5612,7 +5613,7 @@ var require_parse2 = __commonJS({
5612
5613
  prev = tok;
5613
5614
  };
5614
5615
  const extglobOpen = (type, value2) => {
5615
- const token = __spreadProps(__spreadValues({}, EXTGLOB_CHARS[value2]), { conditions: 1, inner: "" });
5616
+ const token = { ...EXTGLOB_CHARS[value2], conditions: 1, inner: "" };
5616
5617
  token.prev = prev;
5617
5618
  token.parens = state.parens;
5618
5619
  token.output = state.output;
@@ -5634,7 +5635,7 @@ var require_parse2 = __commonJS({
5634
5635
  output = token.close = `)$))${extglobStar}`;
5635
5636
  }
5636
5637
  if (token.inner.includes("*") && (rest = remaining()) && /^\.[^\\/.]+$/.test(rest)) {
5637
- const expression = parse2(rest, __spreadProps(__spreadValues({}, options), { fastpaths: false })).output;
5638
+ const expression = parse2(rest, { ...options, fastpaths: false }).output;
5638
5639
  output = token.close = `)${expression})${extglobStar})`;
5639
5640
  }
5640
5641
  if (token.prev.type === "bos") {
@@ -6164,7 +6165,7 @@ var require_parse2 = __commonJS({
6164
6165
  return state;
6165
6166
  };
6166
6167
  parse2.fastpaths = (input, options) => {
6167
- const opts = __spreadValues({}, options);
6168
+ const opts = { ...options };
6168
6169
  const max = typeof opts.maxLength === "number" ? Math.min(MAX_LENGTH, opts.maxLength) : MAX_LENGTH;
6169
6170
  const len = input.length;
6170
6171
  if (len > max) {
@@ -6270,7 +6271,7 @@ var require_picomatch = __commonJS({
6270
6271
  delete regex.state;
6271
6272
  let isIgnored = () => false;
6272
6273
  if (opts.ignore) {
6273
- const ignoreOpts = __spreadProps(__spreadValues({}, options), { ignore: null, onMatch: null, onResult: null });
6274
+ const ignoreOpts = { ...options, ignore: null, onMatch: null, onResult: null };
6274
6275
  isIgnored = picomatch(opts.ignore, ignoreOpts, returnState);
6275
6276
  }
6276
6277
  const matcher = (input, returnObject = false) => {
@@ -6332,7 +6333,7 @@ var require_picomatch = __commonJS({
6332
6333
  picomatch.parse = (pattern, options) => {
6333
6334
  if (Array.isArray(pattern))
6334
6335
  return pattern.map((p) => picomatch.parse(p, options));
6335
- return parse2(pattern, __spreadProps(__spreadValues({}, options), { fastpaths: false }));
6336
+ return parse2(pattern, { ...options, fastpaths: false });
6336
6337
  };
6337
6338
  picomatch.scan = (input, options) => scan(input, options);
6338
6339
  picomatch.compileRe = (state, options, returnOutput = false, returnState = false) => {
@@ -6411,7 +6412,7 @@ var require_micromatch = __commonJS({
6411
6412
  }
6412
6413
  };
6413
6414
  for (let i = 0; i < patterns.length; i++) {
6414
- let isMatch = picomatch(String(patterns[i]), __spreadProps(__spreadValues({}, options), { onResult }), true);
6415
+ let isMatch = picomatch(String(patterns[i]), { ...options, onResult }, true);
6415
6416
  let negated = isMatch.state.negated || isMatch.state.negatedExtglob;
6416
6417
  if (negated)
6417
6418
  negatives++;
@@ -6453,7 +6454,7 @@ var require_micromatch = __commonJS({
6453
6454
  options.onResult(state);
6454
6455
  items.push(state.output);
6455
6456
  };
6456
- let matches = new Set(micromatch(list, patterns, __spreadProps(__spreadValues({}, options), { onResult })));
6457
+ let matches = new Set(micromatch(list, patterns, { ...options, onResult }));
6457
6458
  for (let item of items) {
6458
6459
  if (!matches.has(item)) {
6459
6460
  result.add(item);
@@ -6476,7 +6477,7 @@ var require_micromatch = __commonJS({
6476
6477
  return true;
6477
6478
  }
6478
6479
  }
6479
- return micromatch.isMatch(str, pattern, __spreadProps(__spreadValues({}, options), { contains: true }));
6480
+ return micromatch.isMatch(str, pattern, { ...options, contains: true });
6480
6481
  };
6481
6482
  micromatch.matchKeys = (obj, patterns, options) => {
6482
6483
  if (!utils.isObject(obj)) {
@@ -6516,7 +6517,7 @@ var require_micromatch = __commonJS({
6516
6517
  };
6517
6518
  micromatch.capture = (glob, input, options) => {
6518
6519
  let posix = utils.isWindows(options);
6519
- let regex = picomatch.makeRe(String(glob), __spreadProps(__spreadValues({}, options), { capture: true }));
6520
+ let regex = picomatch.makeRe(String(glob), { ...options, capture: true });
6520
6521
  let match = regex.exec(posix ? utils.toPosixSlashes(input) : input);
6521
6522
  if (match) {
6522
6523
  return match.slice(1).map((v) => v === void 0 ? "" : v);
@@ -6544,7 +6545,7 @@ var require_micromatch = __commonJS({
6544
6545
  micromatch.braceExpand = (pattern, options) => {
6545
6546
  if (typeof pattern !== "string")
6546
6547
  throw new TypeError("Expected a string");
6547
- return micromatch.braces(pattern, __spreadProps(__spreadValues({}, options), { expand: true }));
6548
+ return micromatch.braces(pattern, { ...options, expand: true });
6548
6549
  };
6549
6550
  module.exports = micromatch;
6550
6551
  }
@@ -8850,28 +8851,31 @@ var require_out4 = __commonJS({
8850
8851
  }
8851
8852
  });
8852
8853
 
8853
- // node_modules/.pnpm/sitemap-ts@0.2.1/node_modules/sitemap-ts/dist/index.mjs
8854
+ // node_modules/.pnpm/sitemap-ts@1.0.0/node_modules/sitemap-ts/dist/index.mjs
8854
8855
  var import_sitemap = __toESM(require_dist(), 1);
8855
8856
  var import_xml_formatter = __toESM(require_xml_formatter(), 1);
8856
8857
  var import_fast_glob = __toESM(require_out4(), 1);
8857
8858
  import { writeFileSync } from "fs";
8858
8859
  import { parse, join, resolve } from "path";
8859
8860
  function resolveOptions(userOptions) {
8860
- return Object.assign({
8861
- hostname: "http://localhost/",
8862
- dynamicRoutes: [],
8863
- exclude: [],
8864
- outDir: "dist",
8865
- extentions: "html",
8866
- changefreq: "daily",
8867
- priority: 1,
8868
- lastmod: new Date(),
8869
- readable: false,
8870
- robots: [{
8871
- userAgent: "*",
8872
- allow: "/"
8873
- }]
8874
- }, userOptions);
8861
+ return Object.assign(
8862
+ {
8863
+ hostname: "http://localhost/",
8864
+ dynamicRoutes: [],
8865
+ exclude: [],
8866
+ outDir: "dist",
8867
+ extensions: "html",
8868
+ changefreq: "daily",
8869
+ priority: 1,
8870
+ lastmod: new Date(),
8871
+ readable: false,
8872
+ robots: [{
8873
+ userAgent: "*",
8874
+ allow: "/"
8875
+ }]
8876
+ },
8877
+ userOptions
8878
+ );
8875
8879
  }
8876
8880
  function slash(str) {
8877
8881
  return str.replace(/\\/g, "/");
@@ -8919,13 +8923,13 @@ function getFinalSitemapPath(hostname) {
8919
8923
  return `${ensureSuffix("/", hostname)}sitemap.xml`;
8920
8924
  }
8921
8925
  function getRoutes(options) {
8922
- const ext = typeof options.extentions === "string" ? [options.extentions] : options.extentions;
8926
+ const ext = typeof options.extensions === "string" ? [options.extensions] : options.extensions;
8923
8927
  const strExt = ext.map((e) => `**/*.${e}`);
8924
8928
  return [
8925
8929
  ...(0, import_fast_glob.sync)(strExt, { cwd: options.outDir }).map((route) => {
8926
8930
  let r = route;
8927
8931
  ext.forEach((e) => {
8928
- const regex = new RegExp(`/index.${e}`, "g");
8932
+ const regex = new RegExp(`index.${e}`, "g");
8929
8933
  r = r.replace(regex, "");
8930
8934
  });
8931
8935
  const parsedRoute = parse(r);