starlight-links-validator 0.8.0 → 0.9.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/index.ts +1 -2
- package/libs/validation.ts +3 -2
- package/package.json +3 -1
package/index.ts
CHANGED
|
@@ -34,10 +34,9 @@ const starlightLinksValidatorOptionsSchema = z
|
|
|
34
34
|
*/
|
|
35
35
|
errorOnRelativeLinks: z.boolean().default(true),
|
|
36
36
|
/**
|
|
37
|
-
* Defines a list of links that should be excluded from validation.
|
|
37
|
+
* Defines a list of links or glob patterns that should be excluded from validation.
|
|
38
38
|
*
|
|
39
39
|
* The links in this list will be ignored by the plugin and will not be validated.
|
|
40
|
-
* The list must exactly match links as they appear in Markdown.
|
|
41
40
|
*
|
|
42
41
|
* @default []
|
|
43
42
|
*/
|
package/libs/validation.ts
CHANGED
|
@@ -5,6 +5,7 @@ import { fileURLToPath } from 'node:url'
|
|
|
5
5
|
import type { StarlightPlugin } from '@astrojs/starlight/types'
|
|
6
6
|
import type { AstroConfig, AstroIntegrationLogger } from 'astro'
|
|
7
7
|
import { bgGreen, black, blue, dim, green, red } from 'kleur/colors'
|
|
8
|
+
import picomatch from 'picomatch'
|
|
8
9
|
|
|
9
10
|
import type { StarlightLinksValidatorOptions } from '..'
|
|
10
11
|
|
|
@@ -216,10 +217,10 @@ function isValidAsset(path: string, context: ValidationContext) {
|
|
|
216
217
|
}
|
|
217
218
|
|
|
218
219
|
/**
|
|
219
|
-
* Check if a link is
|
|
220
|
+
* Check if a link is excluded from validation by the user.
|
|
220
221
|
*/
|
|
221
222
|
function isExcludedLink(link: string, context: ValidationContext) {
|
|
222
|
-
return context.options.exclude
|
|
223
|
+
return picomatch(context.options.exclude)(link)
|
|
223
224
|
}
|
|
224
225
|
|
|
225
226
|
function addError(errors: ValidationErrors, filePath: string, link: string, type: ValidationErrorType) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "starlight-links-validator",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.9.0",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"description": "Starlight plugin to validate internal links.",
|
|
6
6
|
"author": "HiDeoo <github@hideoo.dev> (https://hideoo.dev)",
|
|
@@ -16,6 +16,7 @@
|
|
|
16
16
|
"is-absolute-url": "4.0.1",
|
|
17
17
|
"kleur": "4.1.5",
|
|
18
18
|
"mdast-util-to-string": "4.0.0",
|
|
19
|
+
"picomatch": "4.0.2",
|
|
19
20
|
"unist-util-visit": "5.0.0"
|
|
20
21
|
},
|
|
21
22
|
"devDependencies": {
|
|
@@ -23,6 +24,7 @@
|
|
|
23
24
|
"@types/hast": "3.0.3",
|
|
24
25
|
"@types/mdast": "4.0.3",
|
|
25
26
|
"@types/node": "18.17.18",
|
|
27
|
+
"@types/picomatch": "2.3.3",
|
|
26
28
|
"astro": "4.0.4",
|
|
27
29
|
"mdast-util-mdx-jsx": "3.0.0",
|
|
28
30
|
"typescript": "5.1.3",
|