starlight-links-validator 0.19.0 → 0.19.2
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/CHANGELOG.md +12 -0
- package/libs/validation.ts +3 -1
- package/package.json +3 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# starlight-links-validator
|
|
2
2
|
|
|
3
|
+
## 0.19.2
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#131](https://github.com/HiDeoo/starlight-links-validator/pull/131) [`14f4d8d`](https://github.com/HiDeoo/starlight-links-validator/commit/14f4d8db5a6df3d95d3c4859b8a41468a99b3d63) Thanks [@DaniFoldi](https://github.com/DaniFoldi)! - Adds `astro` as a peer dependency to prevent potential build errors in monorepos with hoisting disabled.
|
|
8
|
+
|
|
9
|
+
## 0.19.1
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- [#127](https://github.com/HiDeoo/starlight-links-validator/pull/127) [`2c0e83d`](https://github.com/HiDeoo/starlight-links-validator/commit/2c0e83d8abdbe9fca9eedfefc7a054a31c75979e) Thanks [@HiDeoo](https://github.com/HiDeoo)! - Fixes validation issues with links containing query strings when using the Astro `trailingSlash` option.
|
|
14
|
+
|
|
3
15
|
## 0.19.0
|
|
4
16
|
|
|
5
17
|
### Minor Changes
|
package/libs/validation.ts
CHANGED
|
@@ -140,13 +140,15 @@ function validateLink(context: ValidationContext) {
|
|
|
140
140
|
const sanitizedLink = linkToValidate.replace(/^\//, '')
|
|
141
141
|
const segments = sanitizedLink.split('#')
|
|
142
142
|
|
|
143
|
-
|
|
143
|
+
let path = segments[0]
|
|
144
144
|
const hash = segments[1]
|
|
145
145
|
|
|
146
146
|
if (path === undefined) {
|
|
147
147
|
throw new Error('Failed to validate a link with no path.')
|
|
148
148
|
}
|
|
149
149
|
|
|
150
|
+
path = stripQueryString(path)
|
|
151
|
+
|
|
150
152
|
if (path.startsWith('.') || (!linkToValidate.startsWith('/') && !linkToValidate.startsWith('?'))) {
|
|
151
153
|
if (options.errorOnRelativeLinks) {
|
|
152
154
|
addError(errors, id, file, link, ValidationErrorType.RelativeLink)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "starlight-links-validator",
|
|
3
|
-
"version": "0.19.
|
|
3
|
+
"version": "0.19.2",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"description": "Starlight plugin to validate internal links.",
|
|
6
6
|
"author": "HiDeoo <github@hideoo.dev> (https://hideoo.dev)",
|
|
@@ -34,7 +34,8 @@
|
|
|
34
34
|
"vitest": "2.1.6"
|
|
35
35
|
},
|
|
36
36
|
"peerDependencies": {
|
|
37
|
-
"@astrojs/starlight": ">=0.32.0"
|
|
37
|
+
"@astrojs/starlight": ">=0.32.0",
|
|
38
|
+
"astro": ">=5.1.5"
|
|
38
39
|
},
|
|
39
40
|
"engines": {
|
|
40
41
|
"node": ">=18.17.1"
|