Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork2.8k
chore(website): [playground] correct issues with libs#5162
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Merged
Uh oh!
There was an error while loading.Please reload this page.
Merged
Changes fromall commits
Commits
Show all changes
12 commits Select commitHold shift + click to select a range
ac39c5f chore(website): [playground] correct issues with changing default lib…
armano225d8f18 chore(website): [playground] default lib to es6 + dom
armano25e77452 chore(website): [playground] further refine lib handling, and remove …
armano286e97b9 chore(website): [playground] remove unnecessary ?.
armano297266b0 chore(website): [playground] improve resolving default libs
armano23cf6e47 chore(website): [playground] revert incorrect change
armano26ac8fbb chore(website): [playground] move module augmentation to typings
armano24997135 fix: improve default lib selection
armano25ebc151 Merge remote-tracking branch 'origin/main' into fix/default-lib-impor…
armano234aa7bb Merge remote-tracking branch 'origin/main' into fix/default-lib-impor…
armano2ba22b89 fix: use ts build-in config parsing
armano2036f13c Merge branch 'main' into fix/default-lib-import-5142
armano2File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Uh oh!
There was an error while loading.Please reload this page.
Jump to
Jump to file
Failed to load files.
Loading
Uh oh!
There was an error while loading.Please reload this page.
Diff view
Diff view
There are no files selected for viewing
16 changes: 10 additions & 6 deletionspackages/website/src/components/config/utils.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
4 changes: 2 additions & 2 deletionspackages/website/src/components/editor/LoadedEditor.tsx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
39 changes: 25 additions & 14 deletionspackages/website/src/components/editor/config.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
42 changes: 29 additions & 13 deletionspackages/website/src/components/editor/useSandboxServices.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -64,6 +64,7 @@ export const useSandboxServices = ( | ||
| formatOnType: true, | ||
| wrappingIndent: 'same', | ||
| }, | ||
| acquireTypes: false, | ||
armano2 marked this conversation as resolved. Show resolvedHide resolvedUh oh!There was an error while loading.Please reload this page. | ||
| compilerOptions: compilerOptions, | ||
| domID: editorEmbedId, | ||
| }; | ||
| @@ -77,19 +78,34 @@ export const useSandboxServices = ( | ||
| colorMode === 'dark' ? 'vs-dark' : 'vs-light', | ||
| ); | ||
| let libEntries: Map<string, string> | undefined; | ||
| const worker = await sandboxInstance.getWorkerProcess(); | ||
| if (worker.getLibFiles) { | ||
| libEntries = new Map( | ||
| Object.entries((await worker.getLibFiles()) ?? {}).map(item => [ | ||
| '/' + item[0], | ||
| item[1], | ||
| ]), | ||
| ); | ||
| } else { | ||
| // for some older version of playground we do not have definitions available | ||
| libEntries = await sandboxInstance.tsvfs.createDefaultMapFromCDN( | ||
armano2 marked this conversation as resolved. Show resolvedHide resolvedUh oh!There was an error while loading.Please reload this page. | ||
| { | ||
| lib: Array.from(window.ts.libMap.keys()), | ||
| }, | ||
| props.ts, | ||
| true, | ||
| window.ts, | ||
| ); | ||
| for (const pair of libEntries) { | ||
| sandboxInstance.languageServiceDefaults.addExtraLib( | ||
| pair[1], | ||
| 'ts:' + pair[0], | ||
| ); | ||
| } | ||
| } | ||
| const system = sandboxInstance.tsvfs.createSystem(libEntries); | ||
| const webLinter = new WebLinter(system, compilerOptions, lintUtils); | ||
3 changes: 2 additions & 1 deletionpackages/website/src/vendor/sandbox.d.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
4 changes: 4 additions & 0 deletionspackages/website/src/vendor/tsWorker.d.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
1 change: 1 addition & 0 deletionspackages/website/typings/remark-docusaurus-tabs.d.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,6 @@ | ||
| declare module 'remark-docusaurus-tabs' { | ||
| import type { Plugin } from 'unified'; | ||
| const plugin: Plugin; | ||
| export = plugin; | ||
| } |
13 changes: 13 additions & 0 deletionspackages/website/typings/typescript.d.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| import 'typescript'; | ||
| type StringMap = Map<string, string>; | ||
| declare module 'typescript' { | ||
| /** | ||
| * Map of available libraries | ||
| * | ||
| * The key is the key used in compilerOptions.lib | ||
| * The value is the file name | ||
| */ | ||
| const libMap: StringMap; | ||
| } |
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.