Reputation: 5557
I've set up an apache2 server and have located my library at http://example.com/lib/deno/[email protected]/
and then created a 301 redirect from http://example.com/lib/deno/test/
to the former. In VS Code (using deno plugin) I noticed that when I import something like https://deno.land/std/http/server.ts
I get a warning message:
Implicitly using latest version (0.140.0) for https://deno.land/std/http/server.ts deno(deno-warn)
Following the url it re-directs to https://deno.land/[email protected]/http/server.ts
However when I import my own http://example.com/lib/deno/test/mod.ts
I do not get a similar message. Is this warning somehow hard coded to only work with deno.land or am I not hosting things correctly?
Upvotes: 2
Views: 914
Reputation: 441
The "Implicitly using latest version" message is actually transmitted by the deno.land server as an HTTP response header. To serve a similar warning message from your own server, you will need to add a similar response header to your HTTP 302 redirect responses. You can supply any message to be displayed.
The response header from deno.land can be viewed like so:
> curl -XGET -I https://deno.land/std/http/server.ts
HTTP/2 302
location: /[email protected]/http/server.ts
x-deno-warning: Implicitly using latest version (0.140.0) for https://deno.land/std/http/server.ts
How you attach this header to your redirects will depend on your web server.
For reference, you can view the relevant deno.land/x source on Github: https://github.com/denoland/dotland/blob/cd43f5f4a8d2dcb8982f96c0265dde8c8d69a304/routes/x/module.tsx#L638-L645
Upvotes: 1
Reputation: 33788
Deno provides an implementation of the Language Server Protocol. To integrate tightly with all of its capabilities in regard to module discovery, autocomplete, etc. you will need to implement a module registry, which is described here:
https://deno.land/[email protected]/language_server/imports
Here are the basics of what is required, but you'll need to understand the details of the API endpoints, schema, etc. to succeed in your implementation.
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.
Upvotes: 2