starlight-links-validator 0.15.0 → 0.16.0

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 CHANGED
@@ -1,5 +1,19 @@
1
1
  # starlight-links-validator
2
2
 
3
+ ## 0.16.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [#104](https://github.com/HiDeoo/starlight-links-validator/pull/104) [`cbeaa0f`](https://github.com/HiDeoo/starlight-links-validator/commit/cbeaa0f10d757947940af77e5e9de308f97993a8) Thanks [@HiDeoo](https://github.com/HiDeoo)! - Ignores query strings when checking for [excluded links](https://starlight-links-validator.vercel.app/configuration#exclude).
8
+
9
+ Previously, to exclude links with query strings, you may have needed to rely on fairly loose glob patterns, e.g. `/playground/**` to exclude `/playground/`, `/playground/?id=foo` and `/playground/?id=bar`. With this change, excluding `/playground/` will ignore all query strings, so `/playground/`, `/playground/?id=foo` and `/playground/?id=bar` will all be excluded.
10
+
11
+ ## 0.15.1
12
+
13
+ ### Patch Changes
14
+
15
+ - [#102](https://github.com/HiDeoo/starlight-links-validator/pull/102) [`88e66a8`](https://github.com/HiDeoo/starlight-links-validator/commit/88e66a8236eeb419ae50e4aac046500600951cc9) Thanks [@HiDeoo](https://github.com/HiDeoo)! - Fixes a regression with version `0.15.0` where the `errorOnLocalLinks` option was not being applied correctly.
16
+
3
17
  ## 0.15.0
4
18
 
5
19
  ### Minor Changes
package/libs/remark.ts CHANGED
@@ -184,6 +184,8 @@ function getLinkToValidate(link: string, { options, site }: RemarkStarlightLinks
184
184
  }
185
185
  }
186
186
 
187
+ if (!options.errorOnLocalLinks) return
188
+
187
189
  return url.hostname === 'localhost' || url.hostname === '127.0.0.1'
188
190
  ? { ...linkTovalidate, error: ValidationErrorType.LocalLink }
189
191
  : undefined
@@ -249,7 +249,7 @@ function isValidAsset(path: string, context: ValidationContext) {
249
249
  * Check if a link is excluded from validation by the user.
250
250
  */
251
251
  function isExcludedLink(link: Link, context: ValidationContext) {
252
- return picomatch(context.options.exclude)(link.raw)
252
+ return picomatch(context.options.exclude)(stripQueryString(link.raw))
253
253
  }
254
254
 
255
255
  function stripQueryString(path: string): string {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "starlight-links-validator",
3
- "version": "0.15.0",
3
+ "version": "0.16.0",
4
4
  "license": "MIT",
5
5
  "description": "Starlight plugin to validate internal links.",
6
6
  "author": "HiDeoo <github@hideoo.dev> (https://hideoo.dev)",