https://github.com/jiawei397/deno_proxy
https://github.com/jiawei397/deno_proxy
Last synced: about 2 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/jiawei397/deno_proxy
- Owner: jiawei397
- Created: 2021-11-05T06:02:05.000Z (over 3 years ago)
- Default Branch: master
- Last Pushed: 2023-04-10T10:50:08.000Z (about 2 years ago)
- Last Synced: 2025-02-02T18:24:20.295Z (3 months ago)
- Language: TypeScript
- Size: 71.3 KB
- Stars: 0
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# deno_proxy
[](https://github.com/denoland/deno)
Start a proxy server locally to cache Deno resources. The main reason is the
current deno land occasionally fails to download.## start server
```bash
deno run --allow-net --allow-read --allow-write --allow-env https://deno.land/x/[email protected]/mod.ts
```Then your server will be started on `http://localhost`. You can use like this:
```ts
import { VERSION } from "http://localhost/https/deno.land/[email protected]/version.ts";console.log(VERSION);
```It just changed your origin URL `https://deno.land` to
`http://localhost/https/deno.land`.## use cli to generate one typescript or javascript file
```powershell
deno run --allow-read --allow-write https://deno.land/x/[email protected]/cli/mod.ts --baseUrl http://localhost:8000 --oldPath example/deps.ts --newPath example/deps_proxy.ts
```## use cli to generate import_map.json
If your `import_map.json` like this:
```json
{
"imports": {
"/std/": "https://deno.land/[email protected]/"
}
}
```Then generate your proxy `import_map.json` by the above:
```bash
deno run --allow-read --allow-write https://deno.land/x/[email protected]/cli/mod.ts --baseUrl http://localhost:8000 --oldPath example/import_map.json --newPath example/import_map_proxy.json
```The `import_map_proxy.json` should be this:
```json
{
"imports": {
"/std/": "http://localhost:8000/https/deno.land/[email protected]/"
}
}
```If you have to ignore your urls, you can add `ignoreOrigins` such as
`--ignoreOrigins /baidu.com/,/xunlei.cn/`.Then you can run your code:
```
deno run -A --import-map ./example/import_map_proxy.json ./example/mod.ts
```See [here](https://deno.land/[email protected]/npm_nodejs/import_maps) for more
information.