Skip to content

Commit 0f7bf47

Browse files
committed
Fix downloading subtypes
1 parent 1a742ec commit 0f7bf47

File tree

2 files changed

+7
-21
lines changed

2 files changed

+7
-21
lines changed

standalone-packages/monaco-typescript/src/fetchDependencyTypings.ts

Lines changed: 6 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -306,25 +306,17 @@ const getFileTypes = (
306306

307307
const isNoDependency = dep => dep.startsWith(".") || dep.endsWith(".d.ts");
308308

309-
const dependencies = requireStatements
310-
.filter(x => !isNoDependency(x))
311-
.reduce(
312-
(p, n) => ({
313-
...p,
314-
[n]: "latest"
315-
}),
316-
{}
317-
);
309+
const dependencies = requireStatements.filter(x => !isNoDependency(x));
318310

319311
// Now find all require statements, so we can download those types too
320312
return Promise.all(
321-
[
322-
fetchAndAddDependencies(dependencies, () => {}, fetchedPaths).catch(
313+
dependencies.map(dep => {
314+
fetchAndAddDependencies(dep, 'latest', () => {}, fetchedPaths).catch(
323315
() => {
324316
/* ignore */
325317
}
326318
)
327-
].concat(
319+
}).concat(
328320
requireStatements
329321
.filter(
330322
// Don't add global deps, only if those are typing files as they are often relative
@@ -432,18 +424,12 @@ export async function fetchAndAddDependencies(
432424
let depVersion = version;
433425

434426
try {
435-
await doFetch(
436-
`https://data.jsdelivr.com/v1/package/resolve/npm/${dep}@${
437-
version
438-
}`
439-
)
427+
await doFetch(`https://unpkg.com/${dep}@${version}/package.json`)
440428
.then(x => JSON.parse(x))
441429
.then(x => {
442430
depVersion = x.version
443431
});
444-
} catch (e) {
445-
446-
}
432+
} catch (e) {}
447433
// eslint-disable-next-line no-await-in-loop
448434
await fetchFromTypings(dep, depVersion, fetchedPaths).catch(() =>
449435
// not available in package.json, try checking meta for inline .d.ts files

standalone-packages/vscode-editor/release/min/vs/language/typescript/tsWorker.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)