@@ -4,15 +4,13 @@ import { join } from 'https://deno.land/
[email protected] /path/mod.ts'
4
4
import { existsFileSync } from '../shared/fs.ts'
5
5
import util from '../shared/util.ts'
6
6
import log from '../shared/log.ts'
7
- import { getDenoDir , reFullVersion } from './helper.ts'
7
+ import { getDenoDir } from './helper.ts'
8
8
9
9
/** download and cache remote content */
10
10
export async function cache ( url : string , options ?: { forceRefresh ?: boolean , retryTimes ?: number } ) {
11
11
const u = new URL ( url )
12
12
const { protocol, hostname, port, pathname, search } = u
13
13
const isLocalhost = hostname === 'localhost' || hostname === '0.0.0.0' || hostname === '172.0.0.1'
14
- const versioned = reFullVersion . test ( pathname )
15
- const reload = ! ! options ?. forceRefresh || ! versioned
16
14
const cacheDir = join (
17
15
await getDenoDir ( ) ,
18
16
'deps' ,
@@ -23,7 +21,7 @@ export async function cache(url: string, options?: { forceRefresh?: boolean, ret
23
21
const contentFile = join ( cacheDir , hash )
24
22
const metaFile = join ( cacheDir , hash + '.metadata.json' )
25
23
26
- if ( ! reload && ! isLocalhost && existsFileSync ( contentFile ) && existsFileSync ( metaFile ) ) {
24
+ if ( ! options ?. forceRefresh && ! isLocalhost && existsFileSync ( contentFile ) && existsFileSync ( metaFile ) ) {
27
25
const [ content , meta ] = await Promise . all ( [
28
26
Deno . readFile ( contentFile ) ,
29
27
Deno . readTextFile ( metaFile ) ,
0 commit comments