-
-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
docs: migrate website on new template
- Loading branch information
Showing
114 changed files
with
12,613 additions
and
19,875 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,16 @@ | ||
api | ||
.vuepress/public/api.json | ||
dist | ||
.vitepress/public/api.json | ||
.vitepress/cache | ||
.vitepress/dist | ||
public/api.json | ||
|
||
# Yarn | ||
.pnp.* | ||
.yarn/* | ||
!.yarn/patches | ||
!.yarn/plugins | ||
!.yarn/releases | ||
!.yarn/cache | ||
!.yarn/sdks | ||
!.yarn/versions | ||
|
Empty file.
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,3 @@ | ||
```ts | ||
<%- code %> | ||
``` |
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,11 @@ | ||
import {stripsComments} from "@tsed/ts-doc/src/utils/strips.js"; | ||
|
||
export default { | ||
name: "codeHighlight", | ||
trim: false, | ||
method(overview, symbolName, deprecated) { | ||
return {code: stripsComments(overview | ||
.replace(/( )+#private;\n/gi, "")) | ||
.replace(/\n( )+\n/gi, '\n'), deprecated}; | ||
} | ||
}; |
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,41 @@ | ||
--- | ||
meta: | ||
- name: keywords | ||
description: api typescript node.js documentation <%- symbol.symbolName %> <%- symbol.symbolType %> | ||
--- | ||
|
||
<script setup> | ||
import ApiIcon from "@tsed/vitepress-theme/atoms/api-icon/ApiIcon.vue"; | ||
</script> | ||
|
||
<div class="flex space-x-3"> | ||
<ApiIcon type="<%- symbol.symbolType %>" class="mt-3" /> | ||
<div> | ||
<h1><%- symbol.symbolName %></h1> | ||
<div class="module-name"><%- symbol.module.moduleName %></div> | ||
</div> | ||
</div> | ||
|
||
<%- components.symbolSummary(symbol) %> | ||
<% if(symbol.overview) { %> | ||
## Overview | ||
<%- components.codeHighlight(symbol.overview, symbol.symbolName) %> | ||
<% } | ||
if (hasParams) { %> | ||
<%- components.symbolParams(params, symbol.overview) %> | ||
<% } | ||
if (description) { %> | ||
<!-- Description --> | ||
## Description | ||
<%- description %> | ||
<% } | ||
if (symbol.members.length) { %> | ||
<!-- Members --> | ||
<%- components.symbolMembers(symbol) %> | ||
<% } %> |
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,21 @@ | ||
export default { | ||
name: "page", | ||
trim: false, | ||
method(symbol) { | ||
let params = [], | ||
hasParams = false; | ||
let description = symbol.description || ""; | ||
|
||
if (symbol.symbolType === "function" || symbol.symbolType === "decorator") { | ||
params = symbol.getParams(); | ||
hasParams = params.length && symbol.overview.match(/\((.*)\):/); | ||
} | ||
|
||
return { | ||
params, | ||
hasParams, | ||
symbol, | ||
description | ||
}; | ||
} | ||
}; |
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,25 @@ | ||
<%- components.symbolHeader(symbol) %> | ||
<!-- summary --> | ||
<%- components.symbolSummary(symbol) %> | ||
<!-- overview --> | ||
<% if(symbol.overview) { %> | ||
|
||
### Overview | ||
|
||
<%- components.codeHighlight(symbol.overview, symbol.symbolName) %> | ||
<% } %> | ||
<!-- Parameters --> | ||
<% if (hasParams) { %> | ||
<%- components.symbolParams(params, symbol.overview) %> | ||
<% } %> | ||
<!-- Description --> | ||
<% if (description) { %> | ||
|
||
### Description | ||
|
||
<%- description %> | ||
<% } %> | ||
<!-- Members --> | ||
<% if (symbol.members.length) { %> | ||
<%- components.symbolMembers(symbol) %> | ||
<% } %> |
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 @@ | ||
<Badge text="<%- symbol.symbolLabel %>" type="<%- symbol.symbolType %>"/> <%- labels.map((label) => components.symbolLabel(label)).join(' ') %> |
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,28 @@ | ||
export default { | ||
name: "symbolHeader", | ||
trim: true, | ||
method(symbol) { | ||
const ignoreLabels = ["type", "returns", "decorator", "param", "constructor"]; | ||
const id = symbol.symbolName.replace(/ /gi, "").toLowerCase(); | ||
let isPrivateAdded; | ||
|
||
const labels = (symbol.labels || []) | ||
.filter((label) => ignoreLabels.indexOf(label.key) === -1) | ||
.filter((label) => { | ||
if (label.key === "private" && !isPrivateAdded) { | ||
isPrivateAdded = true; | ||
return true; | ||
} | ||
if (label.key === "private") { | ||
return !isPrivateAdded; | ||
} | ||
return true; | ||
}); | ||
|
||
return { | ||
id, | ||
symbol, | ||
labels | ||
}; | ||
} | ||
}; |
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 @@ | ||
<Badge text="<%- label.key %>" title="<%- label.value %>" type="<%- label.key %>"/> |
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,7 @@ | ||
export default { | ||
name: "symbolLabel", | ||
trim: true, | ||
method(label) { | ||
return {label}; | ||
} | ||
}; |
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,9 @@ | ||
## <%- title %> | ||
|
||
<%- components.codeHighlight(member.overview.trim(), undefined) %> | ||
<% if (hasParams) { %> | ||
<%- components.symbolParams(member.params, member.overview) %> | ||
<% } %> | ||
<% if (member.description) { %> | ||
<%- member.description %> | ||
<% } %> |
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,26 @@ | ||
export default { | ||
name: "symbolMember", | ||
method(member) { | ||
let deprecated = false; | ||
const hasParams = member.params.length && member.overview.match(/\((.*)\):/); | ||
|
||
if (member.labels) { | ||
if (member.labels.find((k) => k.key === "deprecated")) { | ||
deprecated = true; | ||
} | ||
} | ||
|
||
const title = member.overview.match(/(.*)(\(|\?|=|:)+/); | ||
|
||
return { | ||
title: title ? title[1] | ||
.split("(")[0] | ||
.split("<")[0] | ||
.trim() | ||
.replace("?", "") : "", | ||
member, | ||
deprecated, | ||
hasParams | ||
}; | ||
} | ||
}; |
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,19 @@ | ||
<%# Constructor %> | ||
<% if (hasConstructor) { %> | ||
## Constructor | ||
<% if (hasConstructorOverview) { %> | ||
<%- components.codeHighlight(construct.overview) %> | ||
<% } %> | ||
<% if (construct.description) { %> | ||
<%- construct.description %> | ||
<% } %> | ||
<% } %> | ||
<% if (members.length) { %> | ||
<% members.forEach((member, index, map) => { %> | ||
<%- components.symbolMember(member) %> | ||
<% }) %> | ||
<% } %> |
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,20 @@ | ||
export default { | ||
name: "symbolMembers", | ||
trim: false, | ||
method(symbol) { | ||
const flattenMembers = symbol.getMembers(); | ||
const construct = flattenMembers.filter((member) => member.overview.match("constructor"))[0]; | ||
const hasConstructor = construct && (construct.description || !construct.overview.match("constructor()")); | ||
let hasConstructorOverview = hasConstructor && construct.overview.match("constructor()"); | ||
const members = flattenMembers | ||
.filter((member) => !member.overview.includes("#private")) | ||
.filter((member) => !member.overview.match("constructor")); | ||
|
||
return { | ||
hasConstructor, | ||
hasConstructorOverview, | ||
members, | ||
construct | ||
}; | ||
} | ||
}; |
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,6 @@ | ||
|
||
<% params.forEach(param => { %> | ||
- **<%- param.paramKey %>** (<%- param.type %>): <%- param.description %> | ||
<% }) %> |
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,39 @@ | ||
|
||
export default { | ||
name: "symbolParams", | ||
trim: false, | ||
method(params, overview) { | ||
const signatureMatch = overview.match(/\((.*)\):/); | ||
const signature = signatureMatch[1] + ","; | ||
|
||
params = params.map((param) => { | ||
const matched = signature.match(new RegExp(`${param.paramKey}(\\?)?:?(.[^,]+),`)); | ||
const type = (param.type || matched && matched[2] ? matched[2].trim() : "") | ||
.split("|") | ||
.map((type) => { | ||
// type = bindSymbols(type.trim(), ""); | ||
|
||
// if (type.startsWith("<") && type.endsWith(">")) { | ||
// return type; | ||
// } | ||
|
||
return `\`${type.trim()}\``.trim(); | ||
}) | ||
.join(" | "); | ||
|
||
const description = (matched && matched[1] ? "Optional. " : "") + param.description.replace(/Optional\.?/gi, "").trim(); | ||
|
||
return { | ||
param, | ||
signature, | ||
paramKey: param.paramKey, | ||
type: type, | ||
description | ||
}; | ||
}); | ||
|
||
return { | ||
params | ||
}; | ||
} | ||
}; |
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,7 @@ | ||
## Usage | ||
|
||
```typescript | ||
import { <%- symbol.symbolName %> } from "<%- symbol.importFrom %>"; | ||
``` | ||
|
||
> See [<%- symbol.relativePath %>](<%- symbol.githubUrl %>). |
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,9 @@ | ||
export default { | ||
name: "symbolSummary", | ||
trim: false, | ||
method(symbol) { | ||
return { | ||
symbol | ||
}; | ||
} | ||
}; |
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,7 @@ | ||
{ | ||
"printWidth": 120, | ||
"singleQuote": false, | ||
"bracketSpacing": false, | ||
"trailingComma": "none", | ||
"arrowParens": "always" | ||
} |
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,42 @@ | ||
import {mapApiReferences} from "@tsed/vitepress-theme/composables/api/mappers/mapApiReferences.js"; | ||
import api from "../public/api.json"; | ||
|
||
const IS_CORES = /@tsed\/logger$/; | ||
|
||
export function getSidebar() { | ||
const coreModules = []; | ||
const thirdParties = []; | ||
|
||
Object.entries(mapApiReferences(api).modules) | ||
.forEach(([module, {symbols}]) => { | ||
const item = { | ||
text: module, | ||
collapsed: true, | ||
items: symbols.map((symbol) => { | ||
return { | ||
text: symbol.symbolName, | ||
link: symbol.path | ||
}; | ||
}) | ||
}; | ||
|
||
|
||
if (IS_CORES.test(module)) { | ||
coreModules.push(item); | ||
} else { | ||
thirdParties.push(item); | ||
} | ||
}); | ||
|
||
return [ | ||
{ | ||
text: "Core", | ||
items: coreModules.sort((a, b) => a.text.localeCompare(b.text)) | ||
}, | ||
{ | ||
text: "Third parties", | ||
items: thirdParties.sort((a, b) => a.text.localeCompare(b.text)) | ||
} | ||
]; | ||
} | ||
|
Oops, something went wrong.