-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(code-gen/experimental): generate type docs strings as JSDoc blocks
This improves usage of tags like `@deprecated` on fields on `@link` tags to link to routes and other types.
- Loading branch information
Showing
13 changed files
with
492 additions
and
187 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
/** | ||
* Format the provided contents as an inline comment for the specific file. | ||
* | ||
* @param {import("./context").GenerateFile} file | ||
* @param {string} contents | ||
* @returns {string} | ||
*/ | ||
export function fileFormatInlineComment( | ||
file: import("./context").GenerateFile, | ||
contents: string, | ||
): string; | ||
/** | ||
* Format the provided contents as a doc block comment. Compatible with things like JSDoc | ||
* blocks. | ||
* | ||
* @param {import("./context").GenerateFile} file | ||
* @param {string} contents | ||
* @returns {void} | ||
*/ | ||
export function fileWriteDocBlock( | ||
file: import("./context").GenerateFile, | ||
contents: string, | ||
): void; | ||
//# sourceMappingURL=docs.d.ts.map |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
import { | ||
fileContextAddLinePrefix, | ||
fileContextRemoveLinePrefix, | ||
} from "./context.js"; | ||
import { fileWrite } from "./write.js"; | ||
|
||
/** | ||
* Format the provided contents as an inline comment for the specific file. | ||
* | ||
* @param {import("./context").GenerateFile} file | ||
* @param {string} contents | ||
* @returns {string} | ||
*/ | ||
export function fileFormatInlineComment(file, contents) { | ||
return `${file.inlineCommentPrefix}${contents.replace( | ||
/\n/g, | ||
`\n${file.inlineCommentPrefix}`, | ||
)}`; | ||
} | ||
|
||
/** | ||
* Format the provided contents as a doc block comment. Compatible with things like JSDoc | ||
* blocks. | ||
* | ||
* @param {import("./context").GenerateFile} file | ||
* @param {string} contents | ||
* @returns {void} | ||
*/ | ||
export function fileWriteDocBlock(file, contents) { | ||
fileWrite(file, `/**`); | ||
fileContextAddLinePrefix(file, " * "); | ||
fileWrite(file, contents); | ||
|
||
fileContextRemoveLinePrefix(file, 3); | ||
fileWrite(file, " */"); | ||
} |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.