我已经设置了一个 apache2 服务器并将我的库定位在 http://example.com/lib/deno/<a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="2b5f4e585f6b1a051b051b" rel="noreferrer noopener nofollow">[email protected]</a>/
然后从 http://example.com/lib/deno/test/
创建 301 重定向到前者。在 VS Code(使用 deno 插件)中,我注意到当我导入类似 https://deno.land/std/http/server.ts
的内容时我收到一条警告消息:
Implicitly using latest version (0.140.0) for https://deno.land/std/http/server.ts deno(deno-warn)
按照 URL 重定向到 https://deno.land/<a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="ef9c9b8bafdec1dedbdfc1df" rel="noreferrer noopener nofollow">[email protected]</a>/http/server.ts
但是当我导入自己的 http://example.com/lib/deno/test/mod.ts
时我没有收到类似的消息。此警告是否以某种方式硬编码为仅适用于 deno.land,还是我没有正确托管内容?
最佳答案
Deno 提供 Language Server Protocol 的实现。要与模块发现、自动完成等方面的所有功能紧密集成,您将需要实现一个模块注册表,如下所述:
https://deno.land/[email protected]/language_server/imports
以下是所需的基础知识,但您需要了解 API 端点、架构等的详细信息才能成功实现。
Registry support for import completions
In order to support having a registry be discoverable by the Deno language server, the registry needs to provide a few things:
A schema definition file. This file needs to be located at
/.well-known/deno-import-intellisense.json
. This file provides the configuration needed to allow the Deno language server query the registry and construct import specifiers.A series of API endpoints that provide the values to be provided to the user to complete an import specifier.
关于typescript - 自行托管 Deno 库的正确方法是什么?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/72349400/