@xsynaptic/satteri-trailing-slash 0.1.0 → 0.2.1

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
@@ -1,13 +1,8 @@
1
1
  # @xsynaptic/satteri-trailing-slash
2
2
 
3
- A [Sätteri][] hast plugin that normalizes trailing slashes on internal markdown links to match your
4
- Astro project's [`trailingSlash`][astro-trailing-slash] setting. Hand-authored links like
5
- `[text](/path)` emit whatever slash the author typed; when that disagrees with the site's canonical
6
- form, each link costs a redirect hop. This rewrites them at compile time.
3
+ A [Sätteri][] hast plugin that normalizes trailing slashes on internal markdown links to match your Astro project's [`trailingSlash`][astro-trailing-slash] setting. Hand-authored links like `[text](/path)` emit whatever slash the author typed; when that disagrees with the site's canonical form, each link costs a redirect hop. This rewrites them at compile time.
7
4
 
8
- Only internal root-relative `<a href>` links are touched, and any `?query`/`#hash` suffix is
9
- preserved. External, protocol-relative (`//`), hash-only, `mailto:`/`tel:`, and file-extension links
10
- are left alone, as are MDX components like `<Link>` (they aren't `<a>` nodes at hast time).
5
+ Only internal root-relative `<a href>` links are touched, and any `?query`/`#hash` suffix is preserved. External, protocol-relative (`//`), hash-only, `mailto:`/`tel:`, and file-extension links are left alone, as are MDX components like `<Link>` (they aren't `<a>` nodes at hast time).
11
6
 
12
7
  ## Install
13
8
 
@@ -19,9 +14,7 @@ This package is ESM-only.
19
14
 
20
15
  ## Use
21
16
 
22
- Pass the same value your `astro.config` uses for `trailingSlash`. The one option, `trailingSlash`,
23
- takes `'always'` (append a slash), `'never'` (strip it), or `'ignore'` (the default: a no-op, matching
24
- Astro's own default).
17
+ Pass the same value your `astro.config` uses for `trailingSlash`. The one option, `trailingSlash`, takes `'always'` (append a slash), `'never'` (strip it), or `'ignore'` (the default: a no-op, matching Astro's own default).
25
18
 
26
19
  ```ts
27
20
  import { satteri } from '@astrojs/markdown-satteri';
package/dist/index.d.mts CHANGED
@@ -1,6 +1,4 @@
1
1
  import { z } from "zod";
2
-
3
- //#region src/index.d.ts
4
2
  declare const optionsSchema: z.ZodObject<{
5
3
  trailingSlash: z.ZodDefault<z.ZodEnum<{
6
4
  always: "always";
@@ -9,7 +7,7 @@ declare const optionsSchema: z.ZodObject<{
9
7
  }>>;
10
8
  }, z.core.$strip>;
11
9
  type TrailingSlashOptions = z.input<typeof optionsSchema>;
12
- declare function trailingSlash(options?: null | Readonly<TrailingSlashOptions>): {
10
+ export declare function trailingSlash(options?: null | Readonly<TrailingSlashOptions>): {
13
11
  element: {
14
12
  filter: string[];
15
13
  visit(node: Readonly<import("hast").Element>, ctx: import("satteri").HastVisitorContext): void;
@@ -17,6 +15,5 @@ declare function trailingSlash(options?: null | Readonly<TrailingSlashOptions>):
17
15
  name: string;
18
16
  };
19
17
  declare function normalizeHref(href: string, mode: 'always' | 'never'): string | undefined;
20
- //#endregion
21
- export { type TrailingSlashOptions, normalizeHref, trailingSlash };
18
+ export { type TrailingSlashOptions, normalizeHref };
22
19
  //# sourceMappingURL=index.d.mts.map
package/dist/index.mjs CHANGED
@@ -1,6 +1,6 @@
1
1
  import { defineHastPlugin } from "satteri";
2
2
  import { z } from "zod";
3
- //#region src/index.ts
3
+ // src/index.ts
4
4
  const optionsSchema = z.object({ trailingSlash: z.enum([
5
5
  "always",
6
6
  "never",
@@ -37,7 +37,6 @@ function normalizeHref(href, mode) {
37
37
  if (!path.endsWith("/")) return void 0;
38
38
  return `${path.slice(0, -1)}${suffix}`;
39
39
  }
40
- //#endregion
41
40
  export { normalizeHref, trailingSlash };
42
41
 
43
42
  //# sourceMappingURL=index.mjs.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xsynaptic/satteri-trailing-slash",
3
- "version": "0.1.0",
3
+ "version": "0.2.1",
4
4
  "description": "Sätteri hast plugin that normalizes trailing slashes on internal markdown links to match an Astro project's trailingSlash setting.",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -20,6 +20,7 @@
20
20
  "hast",
21
21
  "trailing-slash",
22
22
  "astro",
23
+ "withastro",
23
24
  "seo"
24
25
  ],
25
26
  "main": "./dist/index.mjs",
@@ -35,14 +36,14 @@
35
36
  ],
36
37
  "sideEffects": false,
37
38
  "dependencies": {
38
- "@types/hast": "^3.0.4",
39
- "zod": "^4.4.3"
39
+ "@types/hast": "^3.0.5",
40
+ "zod": "^4.6.7"
40
41
  },
41
42
  "peerDependencies": {
42
- "satteri": "^0.9.0"
43
+ "satteri": "^0.10.0 || ^0.11.0"
43
44
  },
44
45
  "devDependencies": {
45
- "satteri": "^0.9.5"
46
+ "satteri": "^0.11.5"
46
47
  },
47
48
  "scripts": {
48
49
  "build": "tsdown",