Skip to content

Commit 3b78c14

Browse files
authored
fix: make inline doc links valid (#10365)
* fix: make inline doc links valid * couple more * doh * ugh --------- Co-authored-by: Rich Harris <[email protected]>
1 parent 283366b commit 3b78c14

File tree

5 files changed

+28
-6
lines changed

5 files changed

+28
-6
lines changed

.changeset/thick-pans-tell.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'svelte': patch
3+
---
4+
5+
fix: make inline doc links valid

packages/svelte/scripts/generate-types.js

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,3 +37,20 @@ await createBundle({
3737
[`${pkg.name}/types/compiler/interfaces`]: `${dir}/src/compiler/types/legacy-interfaces.d.ts`
3838
}
3939
});
40+
41+
const types = fs.readFileSync(`${dir}/types/index.d.ts`, 'utf-8');
42+
43+
const bad_links = [...types.matchAll(/\]\((\/[^)]+)\)/g)];
44+
if (bad_links.length > 0) {
45+
// eslint-disable-next-line no-console
46+
console.error(
47+
`The following links in JSDoc annotations should be prefixed with https://svelte.dev:`
48+
);
49+
50+
for (const [, link] of bad_links) {
51+
// eslint-disable-next-line no-console
52+
console.error(`- ${link}`);
53+
}
54+
55+
process.exit(1);
56+
}

packages/svelte/src/main/main-client.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ import { is_array } from '../internal/client/utils.js';
1717
*
1818
* If a function is returned _synchronously_ from `onMount`, it will be called when the component is unmounted.
1919
*
20-
* `onMount` does not run inside a [server-side component](/docs#run-time-server-side-component-api).
20+
* `onMount` does not run inside a [server-side component](https://svelte.dev/docs#run-time-server-side-component-api).
2121
*
2222
* https://svelte.dev/docs/svelte#onmount
2323
* @template T
@@ -107,7 +107,7 @@ function create_custom_event(type, detail, { bubbles = false, cancelable = false
107107
}
108108

109109
/**
110-
* Creates an event dispatcher that can be used to dispatch [component events](/docs#template-syntax-component-directives-on-eventname).
110+
* Creates an event dispatcher that can be used to dispatch [component events](https://svelte.dev/docs#template-syntax-component-directives-on-eventname).
111111
* Event dispatchers are functions that can take two arguments: `name` and `detail`.
112112
*
113113
* Component events created with `createEventDispatcher` create a

packages/svelte/src/transition/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,7 @@ function assign(tar, src) {
215215
}
216216

217217
/**
218-
* The `crossfade` function creates a pair of [transitions](/docs#template-syntax-element-directives-transition-fn) called `send` and `receive`. When an element is 'sent', it looks for a corresponding element being 'received', and generates a transition that transforms the element to its counterpart's position and fades it out. When an element is 'received', the reverse happens. If there is no counterpart, the `fallback` transition is used.
218+
* The `crossfade` function creates a pair of [transitions](https://svelte.dev/docs#template-syntax-element-directives-transition-fn) called `send` and `receive`. When an element is 'sent', it looks for a corresponding element being 'received', and generates a transition that transforms the element to its counterpart's position and fades it out. When an element is 'received', the reverse happens. If there is no counterpart, the `fallback` transition is used.
219219
*
220220
* https://svelte.dev/docs/svelte-transition#crossfade
221221
* @param {import('./public').CrossfadeParams & {

packages/svelte/types/index.d.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -229,7 +229,7 @@ declare module 'svelte' {
229229
*
230230
* If a function is returned _synchronously_ from `onMount`, it will be called when the component is unmounted.
231231
*
232-
* `onMount` does not run inside a [server-side component](/docs#run-time-server-side-component-api).
232+
* `onMount` does not run inside a [server-side component](https://svelte.dev/docs#run-time-server-side-component-api).
233233
*
234234
* https://svelte.dev/docs/svelte#onmount
235235
* */
@@ -267,7 +267,7 @@ declare module 'svelte' {
267267
* */
268268
export function getAllContexts<T extends Map<any, any> = Map<any, any>>(): T;
269269
/**
270-
* Creates an event dispatcher that can be used to dispatch [component events](/docs#template-syntax-component-directives-on-eventname).
270+
* Creates an event dispatcher that can be used to dispatch [component events](https://svelte.dev/docs#template-syntax-component-directives-on-eventname).
271271
* Event dispatchers are functions that can take two arguments: `name` and `detail`.
272272
*
273273
* Component events created with `createEventDispatcher` create a
@@ -2169,7 +2169,7 @@ declare module 'svelte/transition' {
21692169
getTotalLength(): number;
21702170
}, { delay, speed, duration, easing }?: DrawParams | undefined): TransitionConfig;
21712171
/**
2172-
* The `crossfade` function creates a pair of [transitions](/docs#template-syntax-element-directives-transition-fn) called `send` and `receive`. When an element is 'sent', it looks for a corresponding element being 'received', and generates a transition that transforms the element to its counterpart's position and fades it out. When an element is 'received', the reverse happens. If there is no counterpart, the `fallback` transition is used.
2172+
* The `crossfade` function creates a pair of [transitions](https://svelte.dev/docs#template-syntax-element-directives-transition-fn) called `send` and `receive`. When an element is 'sent', it looks for a corresponding element being 'received', and generates a transition that transforms the element to its counterpart's position and fades it out. When an element is 'received', the reverse happens. If there is no counterpart, the `fallback` transition is used.
21732173
*
21742174
* https://svelte.dev/docs/svelte-transition#crossfade
21752175
* */

0 commit comments

Comments
 (0)