fix: improve ata for bun

This commit is contained in:
Ruben Fiszel
2023-12-27 02:29:38 +01:00
parent 27b24f6c5e
commit 37002b8dc4
2 changed files with 5 additions and 5 deletions
+4 -5
View File
@@ -74,9 +74,9 @@ export const setupTypeAcquisition = (config: ATABootstrapConfig) => {
}
async function resolveDeps(initialSourceFile: string, depth: number) {
if (depth > 2) {
return
}
// if (depth > 2) {
// return
// }
let depsToGet = config
.depsParser(initialSourceFile)
@@ -103,7 +103,6 @@ export const setupTypeAcquisition = (config: ATABootstrapConfig) => {
? ''
: '/' + config.scriptPath + (f.raw.startsWith('../') ? '/../' : '/.') + f.raw
let url = config.root + path
console.log('path', config.scriptPath, path, url)
const res = await fetch(url)
if (res.ok) {
config.delegate.localFile?.(await res.text(), f.raw)
@@ -156,7 +155,7 @@ export const setupTypeAcquisition = (config: ATABootstrapConfig) => {
tree.version,
'/package.json'
)
let prefix = `/node_modules/${tree.moduleName}`
let prefix = `/node_modules/${tree.raw}`
if (dtTreesOnly.includes(tree))
prefix = `/node_modules/@types/${getDTName(tree.raw).replace('types__', '')}`
const path = prefix + '/package.json'
@@ -769,6 +769,7 @@
const addLibraryToRuntime = async (code: string, _path: string) => {
const path = 'file://' + _path
let uri = mUri.parse(path)
console.log('adding library to runtime', path)
languages.typescript.javascriptDefaults.addExtraLib(code, path)
try {
await vscode.workspace.fs.writeFile(uri, new TextEncoder().encode(code))