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/README.md CHANGED
@@ -101,12 +101,12 @@ You can find a working example in example folder.
101
101
 
102
102
  Output directory.
103
103
 
104
- ### extentions
104
+ ### extensions
105
105
 
106
106
  - **Type:** `string | string[]`
107
107
  - **Default:** `'html'`
108
108
 
109
- File extentions that need to be generated.
109
+ File extensions that need to be generated.
110
110
  Example: ['html', 'md']
111
111
 
112
112
  ### changefreq
package/dist/index.js CHANGED
@@ -1,26 +1,10 @@
1
+ "use strict";
1
2
  var __create = Object.create;
2
3
  var __defProp = Object.defineProperty;
3
- var __defProps = Object.defineProperties;
4
4
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
- var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
6
5
  var __getOwnPropNames = Object.getOwnPropertyNames;
7
- var __getOwnPropSymbols = Object.getOwnPropertySymbols;
8
6
  var __getProtoOf = Object.getPrototypeOf;
9
7
  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
8
  var __commonJS = (cb, mod) => function __require() {
25
9
  return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
26
10
  };
@@ -36,7 +20,10 @@ var __copyProps = (to, from, except, desc) => {
36
20
  }
37
21
  return to;
38
22
  };
39
- 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));
23
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
24
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
25
+ mod
26
+ ));
40
27
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
41
28
 
42
29
  // node_modules/.pnpm/sitemap@7.1.1/node_modules/sitemap/dist/lib/errors.js
@@ -826,7 +813,8 @@ var require_utils = __commonJS({
826
813
  }
827
814
  img = smiLoose.img.map((el) => typeof el === "string" ? { url: el } : el);
828
815
  }
829
- smi.img = img.map((el) => __spreadProps(__spreadValues({}, el), {
816
+ smi.img = img.map((el) => ({
817
+ ...el,
830
818
  url: new url_1.URL(el.url, hostname).toString()
831
819
  }));
832
820
  let links = [];
@@ -834,20 +822,21 @@ var require_utils = __commonJS({
834
822
  links = smiLoose.links;
835
823
  }
836
824
  smi.links = links.map((link) => {
837
- return __spreadProps(__spreadValues({}, link), { url: new url_1.URL(link.url, hostname).toString() });
825
+ return { ...link, url: new url_1.URL(link.url, hostname).toString() };
838
826
  });
839
827
  if (smiLoose.video) {
840
828
  if (!Array.isArray(smiLoose.video)) {
841
829
  smiLoose.video = [smiLoose.video];
842
830
  }
843
831
  smi.video = smiLoose.video.map((video) => {
844
- const nv = __spreadProps(__spreadValues({}, video), {
832
+ const nv = {
833
+ ...video,
845
834
  family_friendly: boolToYESNO(video.family_friendly),
846
835
  live: boolToYESNO(video.live),
847
836
  requires_subscription: boolToYESNO(video.requires_subscription),
848
837
  tag: [],
849
838
  rating: void 0
850
- });
839
+ };
851
840
  if (video.tag !== void 0) {
852
841
  nv.tag = !Array.isArray(video.tag) ? [video.tag] : video.tag;
853
842
  }
@@ -879,7 +868,7 @@ var require_utils = __commonJS({
879
868
  }
880
869
  delete smiLoose.lastmodfile;
881
870
  delete smiLoose.lastmodISO;
882
- smi = __spreadValues(__spreadValues({}, smiLoose), smi);
871
+ smi = { ...smiLoose, ...smi };
883
872
  return smi;
884
873
  }
885
874
  exports.normalizeURL = normalizeURL;
@@ -1792,9 +1781,15 @@ var require_sax = __commonJS({
1792
1781
  var local = qn.local;
1793
1782
  if (prefix === "xmlns") {
1794
1783
  if (local === "xml" && parser.attribValue !== XML_NAMESPACE) {
1795
- strictFail(parser, "xml: prefix must be bound to " + XML_NAMESPACE + "\nActual: " + parser.attribValue);
1784
+ strictFail(
1785
+ parser,
1786
+ "xml: prefix must be bound to " + XML_NAMESPACE + "\nActual: " + parser.attribValue
1787
+ );
1796
1788
  } else if (local === "xmlns" && parser.attribValue !== XMLNS_NAMESPACE) {
1797
- strictFail(parser, "xmlns: prefix must be bound to " + XMLNS_NAMESPACE + "\nActual: " + parser.attribValue);
1789
+ strictFail(
1790
+ parser,
1791
+ "xmlns: prefix must be bound to " + XMLNS_NAMESPACE + "\nActual: " + parser.attribValue
1792
+ );
1798
1793
  } else {
1799
1794
  var tag = parser.tag;
1800
1795
  var parent = parser.tags[parser.tags.length - 1] || parser;
@@ -1988,7 +1983,10 @@ var require_sax = __commonJS({
1988
1983
  throw this.error;
1989
1984
  }
1990
1985
  if (parser.closed) {
1991
- return error(parser, "Cannot write after close. Assign an onready handler.");
1986
+ return error(
1987
+ parser,
1988
+ "Cannot write after close. Assign an onready handler."
1989
+ );
1992
1990
  }
1993
1991
  if (chunk === null) {
1994
1992
  return end(parser);
@@ -2107,7 +2105,10 @@ var require_sax = __commonJS({
2107
2105
  } else if ((parser.sgmlDecl + c).toUpperCase() === DOCTYPE) {
2108
2106
  parser.state = S.DOCTYPE;
2109
2107
  if (parser.doctype || parser.sawRoot) {
2110
- strictFail(parser, "Inappropriately located doctype declaration");
2108
+ strictFail(
2109
+ parser,
2110
+ "Inappropriately located doctype declaration"
2111
+ );
2111
2112
  }
2112
2113
  parser.doctype = "";
2113
2114
  parser.sgmlDecl = "";
@@ -2595,8 +2596,8 @@ var require_sitemap_parser = __commonJS({
2595
2596
  let currentItem = tagTemplate();
2596
2597
  let currentTag;
2597
2598
  let currentVideo = videoTemplate();
2598
- let currentImage = __spreadValues({}, imageTemplate);
2599
- let currentLink = __spreadValues({}, linkTemplate);
2599
+ let currentImage = { ...imageTemplate };
2600
+ let currentLink = { ...linkTemplate };
2600
2601
  let dontpushCurrentLink = false;
2601
2602
  this.saxStream.on("opentagstart", (tag) => {
2602
2603
  currentTag = tag.name;
@@ -2912,13 +2913,13 @@ var require_sitemap_parser = __commonJS({
2912
2913
  break;
2913
2914
  case types_1.TagNames["image:image"]:
2914
2915
  currentItem.img.push(currentImage);
2915
- currentImage = __spreadValues({}, imageTemplate);
2916
+ currentImage = { ...imageTemplate };
2916
2917
  break;
2917
2918
  case types_1.TagNames["xhtml:link"]:
2918
2919
  if (!dontpushCurrentLink) {
2919
2920
  currentItem.links.push(currentLink);
2920
2921
  }
2921
- currentLink = __spreadValues({}, linkTemplate);
2922
+ currentLink = { ...linkTemplate };
2922
2923
  break;
2923
2924
  default:
2924
2925
  break;
@@ -3472,10 +3473,10 @@ var require_xml_parser_xo = __commonJS({
3472
3473
  return m;
3473
3474
  }
3474
3475
  function eos() {
3475
- return xml.length === 0;
3476
+ return 0 === xml.length;
3476
3477
  }
3477
3478
  function is(prefix) {
3478
- return xml.indexOf(prefix) === 0;
3479
+ return 0 === xml.indexOf(prefix);
3479
3480
  }
3480
3481
  xml = xml.trim();
3481
3482
  return document();
@@ -4030,7 +4031,7 @@ var require_to_regex_range = __commonJS({
4030
4031
  if (isNumber(max) === false) {
4031
4032
  throw new TypeError("toRegexRange: expected the second argument to be a number.");
4032
4033
  }
4033
- let opts = __spreadValues({ relaxZeros: true }, options);
4034
+ let opts = { relaxZeros: true, ...options };
4034
4035
  if (typeof opts.strictZeros === "boolean") {
4035
4036
  opts.relaxZeros = opts.strictZeros === false;
4036
4037
  }
@@ -4305,7 +4306,7 @@ var require_fill_range = __commonJS({
4305
4306
  };
4306
4307
  var toRange = (a, b, isNumbers, options) => {
4307
4308
  if (isNumbers) {
4308
- return toRegexRange(a, b, __spreadValues({ wrap: false }, options));
4309
+ return toRegexRange(a, b, { wrap: false, ...options });
4309
4310
  }
4310
4311
  let start = String.fromCharCode(a);
4311
4312
  if (a === b)
@@ -4373,7 +4374,7 @@ var require_fill_range = __commonJS({
4373
4374
  index++;
4374
4375
  }
4375
4376
  if (options.toRegex === true) {
4376
- return step > 1 ? toSequence(parts, options) : toRegex(range, null, __spreadValues({ wrap: false }, options));
4377
+ return step > 1 ? toSequence(parts, options) : toRegex(range, null, { wrap: false, ...options });
4377
4378
  }
4378
4379
  return range;
4379
4380
  };
@@ -4415,7 +4416,7 @@ var require_fill_range = __commonJS({
4415
4416
  if (isObject(step)) {
4416
4417
  return fill(start, end, 0, step);
4417
4418
  }
4418
- let opts = __spreadValues({}, options);
4419
+ let opts = { ...options };
4419
4420
  if (opts.capture === true)
4420
4421
  opts.wrap = true;
4421
4422
  step = step || opts.step || 1;
@@ -4466,7 +4467,7 @@ var require_compile = __commonJS({
4466
4467
  }
4467
4468
  if (node.nodes && node.ranges > 0) {
4468
4469
  let args = utils.reduce(node.nodes);
4469
- let range = fill(...args, __spreadProps(__spreadValues({}, options), { wrap: false, toRegex: true }));
4470
+ let range = fill(...args, { ...options, wrap: false, toRegex: true });
4470
4471
  if (range.length !== 0) {
4471
4472
  return args.length > 1 && range.length > 1 ? `(${range})` : range;
4472
4473
  }
@@ -4969,7 +4970,8 @@ var require_constants2 = __commonJS({
4969
4970
  STAR,
4970
4971
  START_ANCHOR
4971
4972
  };
4972
- var WINDOWS_CHARS = __spreadProps(__spreadValues({}, POSIX_CHARS), {
4973
+ var WINDOWS_CHARS = {
4974
+ ...POSIX_CHARS,
4973
4975
  SLASH_LITERAL: `[${WIN_SLASH}]`,
4974
4976
  QMARK: WIN_NO_SLASH,
4975
4977
  STAR: `${WIN_NO_SLASH}*?`,
@@ -4981,7 +4983,7 @@ var require_constants2 = __commonJS({
4981
4983
  QMARK_NO_DOT: `[^.${WIN_SLASH}]`,
4982
4984
  START_ANCHOR: `(?:^|[${WIN_SLASH}])`,
4983
4985
  END_ANCHOR: `(?:[${WIN_SLASH}]|$)`
4984
- });
4986
+ };
4985
4987
  var POSIX_REGEX_SOURCE = {
4986
4988
  alnum: "a-zA-Z0-9",
4987
4989
  alpha: "a-zA-Z",
@@ -5487,7 +5489,7 @@ var require_parse2 = __commonJS({
5487
5489
  throw new TypeError("Expected a string");
5488
5490
  }
5489
5491
  input = REPLACEMENTS[input] || input;
5490
- const opts = __spreadValues({}, options);
5492
+ const opts = { ...options };
5491
5493
  const max = typeof opts.maxLength === "number" ? Math.min(MAX_LENGTH, opts.maxLength) : MAX_LENGTH;
5492
5494
  let len = input.length;
5493
5495
  if (len > max) {
@@ -5610,7 +5612,7 @@ var require_parse2 = __commonJS({
5610
5612
  prev = tok;
5611
5613
  };
5612
5614
  const extglobOpen = (type, value2) => {
5613
- const token = __spreadProps(__spreadValues({}, EXTGLOB_CHARS[value2]), { conditions: 1, inner: "" });
5615
+ const token = { ...EXTGLOB_CHARS[value2], conditions: 1, inner: "" };
5614
5616
  token.prev = prev;
5615
5617
  token.parens = state.parens;
5616
5618
  token.output = state.output;
@@ -5632,7 +5634,7 @@ var require_parse2 = __commonJS({
5632
5634
  output = token.close = `)$))${extglobStar}`;
5633
5635
  }
5634
5636
  if (token.inner.includes("*") && (rest = remaining()) && /^\.[^\\/.]+$/.test(rest)) {
5635
- const expression = parse2(rest, __spreadProps(__spreadValues({}, options), { fastpaths: false })).output;
5637
+ const expression = parse2(rest, { ...options, fastpaths: false }).output;
5636
5638
  output = token.close = `)${expression})${extglobStar})`;
5637
5639
  }
5638
5640
  if (token.prev.type === "bos") {
@@ -6162,7 +6164,7 @@ var require_parse2 = __commonJS({
6162
6164
  return state;
6163
6165
  };
6164
6166
  parse2.fastpaths = (input, options) => {
6165
- const opts = __spreadValues({}, options);
6167
+ const opts = { ...options };
6166
6168
  const max = typeof opts.maxLength === "number" ? Math.min(MAX_LENGTH, opts.maxLength) : MAX_LENGTH;
6167
6169
  const len = input.length;
6168
6170
  if (len > max) {
@@ -6268,7 +6270,7 @@ var require_picomatch = __commonJS({
6268
6270
  delete regex.state;
6269
6271
  let isIgnored = () => false;
6270
6272
  if (opts.ignore) {
6271
- const ignoreOpts = __spreadProps(__spreadValues({}, options), { ignore: null, onMatch: null, onResult: null });
6273
+ const ignoreOpts = { ...options, ignore: null, onMatch: null, onResult: null };
6272
6274
  isIgnored = picomatch(opts.ignore, ignoreOpts, returnState);
6273
6275
  }
6274
6276
  const matcher = (input, returnObject = false) => {
@@ -6330,7 +6332,7 @@ var require_picomatch = __commonJS({
6330
6332
  picomatch.parse = (pattern, options) => {
6331
6333
  if (Array.isArray(pattern))
6332
6334
  return pattern.map((p) => picomatch.parse(p, options));
6333
- return parse2(pattern, __spreadProps(__spreadValues({}, options), { fastpaths: false }));
6335
+ return parse2(pattern, { ...options, fastpaths: false });
6334
6336
  };
6335
6337
  picomatch.scan = (input, options) => scan(input, options);
6336
6338
  picomatch.compileRe = (state, options, returnOutput = false, returnState = false) => {
@@ -6409,7 +6411,7 @@ var require_micromatch = __commonJS({
6409
6411
  }
6410
6412
  };
6411
6413
  for (let i = 0; i < patterns.length; i++) {
6412
- let isMatch = picomatch(String(patterns[i]), __spreadProps(__spreadValues({}, options), { onResult }), true);
6414
+ let isMatch = picomatch(String(patterns[i]), { ...options, onResult }, true);
6413
6415
  let negated = isMatch.state.negated || isMatch.state.negatedExtglob;
6414
6416
  if (negated)
6415
6417
  negatives++;
@@ -6451,7 +6453,7 @@ var require_micromatch = __commonJS({
6451
6453
  options.onResult(state);
6452
6454
  items.push(state.output);
6453
6455
  };
6454
- let matches = new Set(micromatch(list, patterns, __spreadProps(__spreadValues({}, options), { onResult })));
6456
+ let matches = new Set(micromatch(list, patterns, { ...options, onResult }));
6455
6457
  for (let item of items) {
6456
6458
  if (!matches.has(item)) {
6457
6459
  result.add(item);
@@ -6474,7 +6476,7 @@ var require_micromatch = __commonJS({
6474
6476
  return true;
6475
6477
  }
6476
6478
  }
6477
- return micromatch.isMatch(str, pattern, __spreadProps(__spreadValues({}, options), { contains: true }));
6479
+ return micromatch.isMatch(str, pattern, { ...options, contains: true });
6478
6480
  };
6479
6481
  micromatch.matchKeys = (obj, patterns, options) => {
6480
6482
  if (!utils.isObject(obj)) {
@@ -6514,7 +6516,7 @@ var require_micromatch = __commonJS({
6514
6516
  };
6515
6517
  micromatch.capture = (glob, input, options) => {
6516
6518
  let posix = utils.isWindows(options);
6517
- let regex = picomatch.makeRe(String(glob), __spreadProps(__spreadValues({}, options), { capture: true }));
6519
+ let regex = picomatch.makeRe(String(glob), { ...options, capture: true });
6518
6520
  let match = regex.exec(posix ? utils.toPosixSlashes(input) : input);
6519
6521
  if (match) {
6520
6522
  return match.slice(1).map((v) => v === void 0 ? "" : v);
@@ -6542,7 +6544,7 @@ var require_micromatch = __commonJS({
6542
6544
  micromatch.braceExpand = (pattern, options) => {
6543
6545
  if (typeof pattern !== "string")
6544
6546
  throw new TypeError("Expected a string");
6545
- return micromatch.braces(pattern, __spreadProps(__spreadValues({}, options), { expand: true }));
6547
+ return micromatch.braces(pattern, { ...options, expand: true });
6546
6548
  };
6547
6549
  module2.exports = micromatch;
6548
6550
  }
@@ -8855,28 +8857,31 @@ __export(src_exports, {
8855
8857
  });
8856
8858
  module.exports = __toCommonJS(src_exports);
8857
8859
 
8858
- // node_modules/.pnpm/sitemap-ts@0.2.1/node_modules/sitemap-ts/dist/index.mjs
8860
+ // node_modules/.pnpm/sitemap-ts@1.0.0/node_modules/sitemap-ts/dist/index.mjs
8859
8861
  var import_fs = require("fs");
8860
8862
  var import_sitemap = __toESM(require_dist(), 1);
8861
8863
  var import_xml_formatter = __toESM(require_xml_formatter(), 1);
8862
8864
  var import_path = require("path");
8863
8865
  var import_fast_glob = __toESM(require_out4(), 1);
8864
8866
  function resolveOptions(userOptions) {
8865
- return Object.assign({
8866
- hostname: "http://localhost/",
8867
- dynamicRoutes: [],
8868
- exclude: [],
8869
- outDir: "dist",
8870
- extentions: "html",
8871
- changefreq: "daily",
8872
- priority: 1,
8873
- lastmod: new Date(),
8874
- readable: false,
8875
- robots: [{
8876
- userAgent: "*",
8877
- allow: "/"
8878
- }]
8879
- }, userOptions);
8867
+ return Object.assign(
8868
+ {
8869
+ hostname: "http://localhost/",
8870
+ dynamicRoutes: [],
8871
+ exclude: [],
8872
+ outDir: "dist",
8873
+ extensions: "html",
8874
+ changefreq: "daily",
8875
+ priority: 1,
8876
+ lastmod: new Date(),
8877
+ readable: false,
8878
+ robots: [{
8879
+ userAgent: "*",
8880
+ allow: "/"
8881
+ }]
8882
+ },
8883
+ userOptions
8884
+ );
8880
8885
  }
8881
8886
  function slash(str) {
8882
8887
  return str.replace(/\\/g, "/");
@@ -8924,13 +8929,13 @@ function getFinalSitemapPath(hostname) {
8924
8929
  return `${ensureSuffix("/", hostname)}sitemap.xml`;
8925
8930
  }
8926
8931
  function getRoutes(options) {
8927
- const ext = typeof options.extentions === "string" ? [options.extentions] : options.extentions;
8932
+ const ext = typeof options.extensions === "string" ? [options.extensions] : options.extensions;
8928
8933
  const strExt = ext.map((e) => `**/*.${e}`);
8929
8934
  return [
8930
8935
  ...(0, import_fast_glob.sync)(strExt, { cwd: options.outDir }).map((route) => {
8931
8936
  let r = route;
8932
8937
  ext.forEach((e) => {
8933
- const regex = new RegExp(`/index.${e}`, "g");
8938
+ const regex = new RegExp(`index.${e}`, "g");
8934
8939
  r = r.replace(regex, "");
8935
8940
  });
8936
8941
  const parsedRoute = (0, import_path.parse)(r);