File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -17,7 +17,7 @@ import assert from 'node:assert'
1717import { promises as fs } from 'node:fs'
1818import path from 'node:path'
1919import process from 'node:process'
20- import got from 'got '
20+ import fetch from 'node-fetch '
2121import { VFile } from 'vfile'
2222import { createFormatAwareProcessors } from '../util/create-format-aware-processors.js'
2323import { extnamesToRegex } from '../util/extnames-to-regex.js'
@@ -97,7 +97,17 @@ export function esbuild(options = {}) {
9797 async function onloadremote ( data ) {
9898 const href = data . path
9999 console . log ( '%s: downloading `%s`' , remoteNamespace , href )
100- const contents = ( await got ( href , { cache} ) ) . body
100+
101+ /** @type {string } */
102+ let contents
103+
104+ const cachedContents = cache . get ( href )
105+ if ( cachedContents ) {
106+ contents = cachedContents
107+ } else {
108+ contents = await ( await fetch ( href ) ) . text ( )
109+ cache . set ( href , contents )
110+ }
101111
102112 return filter . test ( href )
103113 ? onload ( {
Original file line number Diff line number Diff line change 5151 "estree-util-build-jsx" : " ^2.0.0" ,
5252 "estree-util-is-identifier-name" : " ^2.0.0" ,
5353 "estree-walker" : " ^3.0.0" ,
54- "got" : " ^11.0.0" ,
5554 "hast-util-to-estree" : " ^2.0.0" ,
5655 "markdown-extensions" : " ^1.0.0" ,
5756 "mdast-util-mdx" : " ^2.0.0" ,
5857 "micromark-extension-mdxjs" : " ^1.0.0" ,
58+ "node-fetch" : " ^3.2.0" ,
5959 "periscopic" : " ^3.0.0" ,
6060 "remark-parse" : " ^10.0.0" ,
6161 "remark-rehype" : " ^10.0.0" ,
You can’t perform that action at this time.
0 commit comments