[英]How to make typedoc works with deno
我在我的一個項目中使用 Deno,我想用 typedoc 生成文檔。 我面臨着很多依賴關系的問題,因為它們沒有得到正確解決,所以 typedoc 失敗了。 我有以下tsconfig.json
:
{
"compilerOptions": {
"module": "amd",
"target": "esnext",
"baseUrl": ".",
"paths": {
"http://*": ["../../../.deno/deps/http/*"],
"https://*": ["../../../.deno/deps/https/*"],
"*.ts": ["*"]
},
"plugins": [
{
"name": "typescript-deno-plugin"
}
]
}
}
paths
的前兩個條目解析 Deno 的本機模塊(如其斷言庫)。 當我使用像deps.ts
這樣的另一個庫時,問題就出現了,在我的deps.ts
文件中像這樣導入它:
// @deno-types="https://cdn.jsdelivr.net/gh/justjavac/deno_cheerio/cheerio.d.ts"
import cheerio from "https://dev.jspm.io/cheerio/index";
注意:我必須從外部源導入類型,因為 dev.jspm.io 中聲明的類型不起作用,因為它們包含/// reference
指令。
我有以下typedoc.js
配置文件:
// deno-lint-ignore-file
module.exports = {
out: "./docs-build",
mode: "file",
};
如果我運行typedoc src/
,我會收到以下錯誤:
Using TypeScript 4.0.3 from /home/antonio/.nvm/versions/node/v12.18.1/lib/node_modules/typescript/lib
Error: /home/antonio/manga-api/src/deps.ts(8)
Cannot find module 'https://dev.jspm.io/cheerio/index'. Did you mean to set the 'moduleResolution' option to 'node', or to add aliases to the 'paths' option?
注2:我使用傑諾但typedoc
安裝有NPM全球范圍內,沿typescript
及typescript-deno-plugin
。
知道如何使typedoc
與typedoc
一起正常工作嗎?
Typedoc 不適用於 Deno。 Deno 支持模塊解析和 URL 解析,這是 Node(Typedoc 的當前運行時)所缺乏的。 它可以工作的唯一方法是 Typedoc 本身在 Deno 中運行,但目前它不提供支持。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.