Store PklProject annotations in the project metadata (#708)

Write annotations to project metadata, and provide them to pkl-doc\

The following annotations have meaning for pkl-doc:
* `@Unlisted`: hide package from documentation site
* `@Deprecated`: add deprecated information
This commit is contained in:
Islon Scherer
2024-10-25 02:21:58 +02:00
committed by GitHub
parent 93cc3253eb
commit 8b0118fec5
22 changed files with 976 additions and 17 deletions

View File

@@ -0,0 +1,33 @@
{
"schemaVersion": 1,
"packageUri": "package://localhost:0/deprecated@1.0.0",
"name": "deprecated",
"version": "1.0.0",
"packageZipUrl": "https://localhost:0/deprecated@1.0.0/deprecated@1.0.0.zip",
"dependencies": {},
"packageZipChecksums": {
"sha256": "$computedChecksum"
},
"sourceCode": "https://example.com/deprecated",
"documentation": "https://example.com/deprecated-docs",
"license": "UNLICENSED",
"authors": [
"deprecated@example.com"
],
"issueTracker": "https://example.com/deprecated/issues",
"annotations": [
{
"type": "PObject",
"classInfo": {
"moduleName": "pkl.base",
"class": "Deprecated",
"moduleUri": "pkl:base"
},
"properties": {
"since": "1.0.0",
"message": "don't use",
"replaceWith": null
}
}
]
}

View File

@@ -0,0 +1,9 @@
/// A module from a deprecated package
module deprecated.deprecated
/// Old foo
@Deprecated { replaceWith = "bar" }
foo: Int = 1
/// New bar
bar: Int = 2

View File

@@ -0,0 +1,5 @@
/// No docs are actually generated for this module
module unlisted.unlisted
/// 1
foo: Int = 1

View File

@@ -0,0 +1,29 @@
{
"schemaVersion": 1,
"packageUri": "package://localhost:0/unlisted@1.0.0",
"name": "unlisted",
"version": "1.0.0",
"packageZipUrl": "https://localhost:0/unlisted@1.0.0/unlisted@1.0.0.zip",
"dependencies": {},
"packageZipChecksums": {
"sha256": "$computedChecksum"
},
"sourceCode": "https://example.com/unlisted",
"documentation": "https://example.com/unlisted-docs",
"license": "UNLICENSED",
"authors": [
"unlisted@example.com"
],
"issueTracker": "https://example.com/unlisted/issues",
"annotations": [
{
"type": "PObject",
"classInfo": {
"moduleName": "pkl.base",
"class": "Unlisted",
"moduleUri": "pkl:base"
},
"properties": {}
}
]
}