Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@gracile/sitemap

Package Overview
Dependencies
Maintainers
0
Versions
25
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@gracile/sitemap - npm Package Compare versions

Comparing version 0.1.1 to 0.1.2-next.0

2

dist/vite.d.ts

@@ -11,3 +11,3 @@ export declare function viteSitemapPlugin(options: {

robotsTxt?: [string, string][] | false;
}): any;
}): any[];
//# sourceMappingURL=vite.d.ts.map

@@ -8,44 +8,45 @@ import { Readable } from 'node:stream';

let isSsrBuild = false;
return {
name: VITE_PLUGIN_NAME,
enforce: 'post',
config(_, env) {
isSsrBuild = env.isSsrBuild || false;
},
async generateBundle(_, bundle) {
if (isSsrBuild) {
logger.warn(`\n${VITE_PLUGIN_NAME} is only compatible with static output! Skipping…\n`);
return;
}
const links = Object.entries(bundle)
.filter(([, asset]) => asset.fileName.endsWith('.html'))
.map(([, asset]) => `/${asset.fileName}`.replace(/\/index\.html$/, '/'));
if (links.length < 2) {
logger.warn(`\n${VITE_PLUGIN_NAME} hasn't found any built HTML pages! Skipping…\n`);
return;
}
const hostname = options.siteUrl.endsWith('/')
? options.siteUrl
: `${options.siteUrl}/`;
const stream = new SitemapStream({
hostname,
});
const map = await streamToPromise(Readable.from(links).pipe(stream)).then((data) => {
return data.toString();
});
this.emitFile({
fileName: 'sitemap.xml',
type: 'asset',
source: map,
});
if (options.robotsTxt !== false) {
return [
{
name: VITE_PLUGIN_NAME,
enforce: 'post',
config(_, env) {
isSsrBuild = env.isSsrBuild || false;
},
async generateBundle(_, bundle) {
if (isSsrBuild) {
logger.warn(`\n${VITE_PLUGIN_NAME} is only compatible with static output! Skipping…\n`);
return;
}
const links = Object.entries(bundle)
.filter(([, asset]) => asset.fileName.endsWith('.html'))
.map(([, asset]) => `/${asset.fileName}`.replace(/\/index\.html$/, '/'));
if (links.length < 2) {
logger.warn(`\n${VITE_PLUGIN_NAME} hasn't found any built HTML pages! Skipping…\n`);
return;
}
const hostname = options.siteUrl.endsWith('/')
? options.siteUrl
: `${options.siteUrl}/`;
const stream = new SitemapStream({
hostname,
});
const map = await streamToPromise(Readable.from(links).pipe(stream)).then((data) => {
return data.toString();
});
this.emitFile({
fileName: 'robots.txt',
fileName: 'sitemap.xml',
type: 'asset',
source: `
source: map,
});
if (options.robotsTxt !== false) {
this.emitFile({
fileName: 'robots.txt',
type: 'asset',
source: `
${typeof options.robotsTxt === 'object'
? options.robotsTxt
.map(([option, value]) => `${option}: ${value}`)
.join('\n')
: `
? options.robotsTxt
.map(([option, value]) => `${option}: ${value}`)
.join('\n')
: `
User-agent: *

@@ -57,8 +58,9 @@ Allow: /

`.trim(),
});
}
logger.info(c.cyan(c.bold('Sitemap generated. Found links:')));
logger.info(c.gray(`- ${links.join('\n- ')}`));
});
}
logger.info(c.cyan(c.bold('Sitemap generated. Found links:')));
logger.info(c.gray(`- ${links.join('\n- ')}`));
},
},
};
];
}
{
"name": "@gracile/sitemap",
"version": "0.1.1",
"version": "0.1.2-next.0",
"description": "A thin, full-stack, web framework",

@@ -48,3 +48,3 @@ "keywords": [

},
"gitHead": "970e457d0382b48beb531a1803393373cae38dcb"
"gitHead": "ed69f4d4d482a43fdb12bc0a02f12093337d91c7"
}

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc