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

astro-sitemap

Package Overview
Dependencies
Maintainers
1
Versions
19
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

astro-sitemap - npm Package Compare versions

Comparing version 0.5.1 to 0.6.0

38

dist/index.js
// src/index.ts
import path from "path";
import { fileURLToPath } from "url";
import path from "node:path";
import { fileURLToPath } from "node:url";
import { ZodError } from "zod";
import merge from "deepmerge";
import load from "@proload/core";
import typescript from "@proload/plugin-tsm";

@@ -191,8 +188,8 @@ // ../utils/src/logger.ts

import { SitemapAndIndexStream, SitemapStream } from "sitemap";
import { createWriteStream, promises } from "fs";
import { normalize, resolve } from "path";
import { Readable, pipeline } from "stream";
import { createGzip } from "zlib";
import { format, promisify } from "util";
import { URL as URL2 } from "url";
import { createWriteStream, promises } from "node:fs";
import { normalize, resolve } from "node:path";
import { Readable, pipeline } from "node:stream";
import { createGzip } from "node:zlib";
import { format, promisify } from "node:util";
import { URL as URL2 } from "node:url";

@@ -264,3 +261,3 @@ // src/output-files.ts

// src/process-pages.ts
import { promises as fs } from "fs";
import { promises as fs } from "node:fs";
var addTailSlash = (s) => s.endsWith("/") ? s : s + "/";

@@ -297,8 +294,8 @@ var removeHeadingSlash = (s) => s.replace(/^\/+/, "");

// src/helpers/exclude-routes.ts
import mmpkg from "minimatch";
import { minimatch } from "minimatch";
function excludeRoutes(patterns, routes) {
patterns.forEach((pattern) => {
const minimatch = new mmpkg.Minimatch(pattern);
minimatch.negate = true;
routes = routes.filter((path2) => minimatch.match(path2));
const mm = new minimatch.Minimatch(pattern);
mm.negate = true;
routes = routes.filter((path2) => mm.match(path2));
});

@@ -327,11 +324,4 @@ return routes;

"astro:build:done": async ({ dir, pages: srcPages }) => {
const namespace = packageName.replace("astro-", "");
load.use([typescript]);
const external = await load(namespace, {
mustExist: false,
cwd: fileURLToPath(config.root)
});
const merged = merge((external == null ? void 0 : external.value) || {}, options);
try {
const opts = validateOptions(config.site, merged);
const opts = validateOptions(config.site, options);
const { filter, exclude, customPages, canonicalURL, entryLimit, lastmodDateOnly, xslUrl, xmlns, serialize, createLinkInHead } = opts;

@@ -338,0 +328,0 @@ let finalSiteUrl;

{
"name": "astro-sitemap",
"version": "0.5.1",
"version": "0.6.0",
"description": "Generate a sitemap for Astro with more control",

@@ -36,6 +36,3 @@ "keywords": [

"dependencies": {
"@proload/core": "^0.3.3",
"@proload/plugin-tsm": "^0.2.1",
"deepmerge": "^4.3.1",
"minimatch": "^7.4.3",
"minimatch": "^9.0.0",
"sitemap": "^7.1.1",

@@ -45,10 +42,9 @@ "zod": "^3.21.4"

"devDependencies": {
"@types/minimatch": "^5.1.2",
"@types/node": "^18.15.5",
"astro": "^2.1.5",
"@types/node": "^18.15.11",
"astro": "^2.3.0",
"at-scripts": "0.0.4",
"c8": "^7.13.0",
"typescript": "^5.0.2",
"vite": "^4.2.1",
"vitest": "^0.29.7",
"at-scripts": "0.0.4"
"typescript": "^5.0.4",
"vite": "^4.2.2",
"vitest": "^0.30.1"
},

@@ -55,0 +51,0 @@ "publishConfig": {

@@ -14,3 +14,2 @@ [![Help Ukraine now!](https://raw.githubusercontent.com/alextim/help-ukraine-win-flag/master/stop-russian-agressian-help-ukraine-now-link.svg 'Help Ukraine now!')](https://war.ukraine.ua/support-ukraine/)

- <strong>[Localization](#localization)</strong>
- <strong>[External config file](#external-config-file)</strong>
- <strong>[Examples](#examples)</strong>

@@ -36,3 +35,2 @@ - <strong>[Contributing](#contributing)</strong>

- Automatically creates a link to the sitemap in the `<head>` section of generated pages.
- Flexible configuration: configure the integration with an external config, `astro.config.*` or a combination of both.
- Better logging.

@@ -109,2 +107,3 @@

__`astro.config.mjs`__

@@ -171,2 +170,4 @@

:bulb: For this integration to work correctly, it is recommended to use the `mjs` or `js` configuration file extensions.
__`astro.config.mjs`__

@@ -183,2 +184,3 @@

<details>

@@ -717,35 +719,3 @@ <summary><strong>canonicalURL</strong></summary>

## External config file
You can configure the integration using the external file `sitemap.config.*` (`js`, `cjs`, `mjs`, `ts`). Put it in the application `root` folder (see about `root` in official [docs](https://docs.astro.build/en/reference/configuration-reference/)).
The external config must contain the default export statement:
```js
// ESM
export default {
...
};
```
or
```js
// CommonJS
module.exports = {
...
};
```
**How does the integration internally resolve a config?**
| Options parameter provided? | External config exists? | Result |
| :-------------------------- | :---------------------: | :----------------------------------------------- |
| No | No | Default config used |
| Yes | No | Options parameter used |
| No | Yes | External config used |
| Yes | Yes | External config is merged with options parameter |
The external configuration usage example is in this demo [repo](https://github.com/alextim/astro-lib/tree/main/examples/sitemap/advanced).
## Examples

@@ -752,0 +722,0 @@

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