typedoc-plugin-dt-links 1.0.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/LICENSE ADDED
@@ -0,0 +1,19 @@
1
+ Copyright 2024 Gerrit Birkeland
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining a copy
4
+ of this software and associated documentation files (the "Software"), to deal
5
+ in the Software without restriction, including without limitation the rights
6
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7
+ copies of the Software, and to permit persons to whom the Software is
8
+ furnished to do so, subject to the following conditions:
9
+
10
+ The above copyright notice and this permission notice shall be included in all
11
+ copies or substantial portions of the Software.
12
+
13
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
19
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,53 @@
1
+ # typedoc-plugin-dt-links
2
+
3
+ Adds support for linking references to types declared in `@types` packages
4
+ to their source code on GitHub.
5
+
6
+ > Note: If TypeDoc's [useTsLinkResolution] option is off, this plugin won't work.
7
+
8
+ If VSCode can follow a link into an `@types` package, this plugin should also
9
+ be able to provide links to that package.
10
+
11
+ > Note: Using TypeDoc before 0.26.8 may result in links which go to the start of
12
+ > the doc comment rather to the symbol name.
13
+
14
+ Supports TypeDoc 0.23.14 through 0.26.x.
15
+
16
+ ## Options
17
+
18
+ - `warnOnUnstableDtLink`
19
+
20
+ Defaults to `true`. If set, and an `@types` package is referenced which is newer
21
+ than this plugin, produces a warning as this plugin won't be able to produce a stable
22
+ link.
23
+
24
+ This plugin is automatically published weekly, so if you are upgrading `@types` packages
25
+ and rebuilding docs more frequently than that, you may want to disable this option as
26
+ the link won't be dead long enough to matter.
27
+
28
+ ## Changelog
29
+
30
+ See full changelog [here](./CHANGELOG.md).
31
+
32
+ ## How It Works
33
+
34
+ TypeDoc exposes an API which plugins can use to provide links to external
35
+ symbols. TypeDoc will also provide plugins with a [ReflectionSymbolId] object
36
+ which plugins can use to determine where TypeScript thinks the link should
37
+ resolve to.
38
+
39
+ This plugin uses that object to figure out which `@types` package a symbol
40
+ belongs to by checking the path for `node_modules/@types` and constructs
41
+ a link to GitHub for the package.
42
+
43
+ The constructed link must include a version reference in order to not break when
44
+ the referenced package receives updates. As `@types` packages do not include any
45
+ information about what git hash they were published with, this plugin attempts
46
+ to infer what the git hash for the version must have been by parsing the "Last
47
+ Updated" date out of the README.md file for the plugin and matching it to a list
48
+ of all commits in DefinitelyTyped published with this package. If the package
49
+ was released more recently than this plugin, the plugin can't know what git hash
50
+ should be used and will instead use `master` as the reference.
51
+
52
+ [useTsLinkResolution]: https://typedoc.org/options/comments/#usetslinkresolution
53
+ [ReflectionSymbolId]: (https://typedoc.org/api/classes/Models.ReflectionSymbolId.html)