You're Invited: Meet the Socket team at BSidesSF and RSAC - April 27 - May 1.RSVP
Socket
Sign inDemoInstall
Socket

vuepress-plugin-sitemap2

Package Overview
Dependencies
Maintainers
1
Versions
307
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

vuepress-plugin-sitemap2 - npm Package Compare versions

Comparing version

to
2.0.0-alpha.6

3

node/index.d.ts

@@ -174,3 +174,2 @@ import { PageData, Plugin } from '@vuepress/core';

export default sitemapPlugin;
export { DateFormatter, SitemapFrontmatterOption, SitemapImageOption, SitemapLinkOption, SitemapOptions, SitemapVideoOption };
export { DateFormatter, SitemapFrontmatterOption, SitemapImageOption, SitemapLinkOption, SitemapOptions, SitemapVideoOption, sitemapPlugin as default };

@@ -1,2 +0,2 @@

"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("@mr-hope/vuepress-shared"),t=require("chalk"),a=require("fs-extra"),n=require("sitemap");const r=new e.Logger("Sitemap"),s=e=>({defaultPath:e.path.replace(e.pathLocale,"/"),pathLocale:e.pathLocale}),o=async(e,o)=>{r.load("Generating sitemap");const{urls:i=[],xslUrl:p,exclude:l=[],xmlNameSpace:c}=e,u=e.hostname.replace(/\/$/u,""),m=e.outFile?e.outFile.replace(/^\//u,""):"sitemap.xml",{dir:d,options:{base:h}}=o,g=new n.SitemapStream({hostname:u,xslUrl:p,xmlns:c}),f=((e,t)=>{const{changefreq:a="daily",exclude:n=[],dateFormatter:r=(e=>{const{git:t={}}=e;return t.updatedTime?new Date(t.updatedTime).toISOString():""})}=e,{pages:o,options:{base:i,locales:p}}=t,l=o.reduce(((e,t)=>{const{defaultPath:a,pathLocale:n}=s(t),r=e.get(a)||[];return r.push(n),e.set(a,r)}),new Map),c=new Map;return o.forEach((e=>{const t=e.frontmatter.sitemap||{},o=(e.frontmatter.head||[]).find((e=>"robots"===e[1].name));(o?(o[1].content||"").split(/,/u).map((e=>e.trim())).includes("noindex"):t.exclude)&&n.push(e.path);const u=r(e),{defaultPath:m}=s(e),d=l.get(m)||[];let h=[];d.length>1&&(h=d.map((e=>({lang:p[e].lang||"en",url:`${i}${m.replace(/^\//u,e)}`})))),c.set(e.path,{alternateLinks:h,changefreq:a,lastmod:u,...t})})),c})(e,o),x=d.dest(m),w=a.createWriteStream(x);g.pipe(w),f.forEach(((e,t)=>{l.includes(t)||g.write({url:`${h}${t.replace(/^\//u,"")}`,...e})})),i.forEach((e=>g.write(e))),g.end(),r.success(),r.update(`Sitemap generated and saved to ${t.cyan(m)}`),r.load(`Appended sitemap path to ${t.cyan("robots.txt")}`);const $=d.dest("robots.txt"),S=`${(a.existsSync($)?await a.readFile($,{encoding:"utf8"}):"").replace(/^Sitemap: .*$/u,"")}\nSitemap: ${u}${h}${m}\n`;await a.writeFile($,S,{flag:"w"}),r.success()};exports.default=(e,t)=>{const{themeConfig:a}=t.options,n=e.hostname||a.hostname;if(!n)return r.error("Required 'hostname' option is missing!"),{name:"sitemap2"};const s=Object.keys(e).length>0?{...e,hostname:n}:{...a.sitemap||{},hostname:n};return{name:"sitemap2",async onGenerated(){await o(s,t)}}};
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("@mr-hope/vuepress-shared"),t=require("@vuepress/utils"),a=require("sitemap");const s=new e.Logger("Sitemap"),n=e=>({defaultPath:e.path.replace(e.pathLocale,"/"),pathLocale:e.pathLocale}),r=async(e,r)=>{s.load("Generating sitemap");const{urls:o=[],xslUrl:i,exclude:p=[],xmlNameSpace:l}=e,c=e.hostname.replace(/\/$/u,""),u=e.outFile?e.outFile.replace(/^\//u,""):"sitemap.xml",{dir:m,options:{base:d}}=r,h=new a.SitemapStream({hostname:c,xslUrl:i,xmlns:l}),f=((e,t)=>{const{changefreq:a="daily",exclude:s=[],dateFormatter:r=(e=>{const{git:t={}}=e;return t.updatedTime?new Date(t.updatedTime).toISOString():""})}=e,{pages:o,options:{base:i,locales:p}}=t,l=o.reduce(((e,t)=>{const{defaultPath:a,pathLocale:s}=n(t),r=e.get(a)||[];return r.push(s),e.set(a,r)}),new Map),c=new Map;return o.forEach((e=>{const t=e.frontmatter.sitemap||{},o=(e.frontmatter.head||[]).find((e=>"robots"===e[1].name));(o?(o[1].content||"").split(/,/u).map((e=>e.trim())).includes("noindex"):t.exclude)&&s.push(e.path);const u=r(e),{defaultPath:m}=n(e),d=l.get(m)||[];let h=[];d.length>1&&(h=d.map((e=>({lang:p[e].lang||"en",url:`${i}${m.replace(/^\//u,e)}`})))),c.set(e.path,{alternateLinks:h,changefreq:a,lastmod:u,...t})})),c})(e,r),g=m.dest(u),x=t.fs.createWriteStream(g);h.pipe(x),f.forEach(((e,t)=>{p.includes(t)||h.write({url:`${d}${t.replace(/^\//u,"")}`,...e})})),o.forEach((e=>h.write(e))),h.end(),s.success(),s.update(`Sitemap generated and saved to ${t.chalk.cyan(u)}`),s.load(`Appended sitemap path to ${t.chalk.cyan("robots.txt")}`);const w=m.dest("robots.txt"),$=`${(t.fs.existsSync(w)?await t.fs.readFile(w,{encoding:"utf8"}):"").replace(/^Sitemap: .*$/u,"")}\nSitemap: ${c}${d}${u}\n`;await t.fs.writeFile(w,$,{flag:"w"}),s.success()};exports.default=(e,t)=>{const{themeConfig:a}=t.options,n=e.hostname||a.hostname;if(!n)return s.error("Required 'hostname' option is missing!"),{name:"sitemap2"};const o=Object.keys(e).length>0?{...e,hostname:n}:{...a.sitemap||{},hostname:n};return{name:"sitemap2",async onGenerated(){await r(o,t)}}};
//# sourceMappingURL=index.js.map
{
"name": "vuepress-plugin-sitemap2",
"version": "2.0.0-alpha.5",
"version": "2.0.0-alpha.6",
"description": "Sitemap plugin for vuepress",

@@ -42,6 +42,4 @@ "keywords": [

"dependencies": {
"@mr-hope/vuepress-shared": "2.0.0-alpha.5",
"@types/fs-extra": "^9.0.11",
"chalk": "^4.1.1",
"fs-extra": "^10.0.0",
"@mr-hope/vuepress-shared": "2.0.0-alpha.6",
"@vuepress/utils": "2.0.0-beta.23",
"sitemap": "^7.0.0"

@@ -52,3 +50,3 @@ },

},
"gitHead": "4e4fb1c3d529c25913738550b9c74d574022a541"
"gitHead": "a3bbd5850499d6708af92d189f4503d0c1d8d4a8"
}

Sorry, the diff of this file is not supported yet