-
Notifications
You must be signed in to change notification settings - Fork 304
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support using a CDN for widgets #10076
Conversation
@@ -19,11 +19,11 @@ export class ScriptUriConverter implements ILocalResourceUriConverter { | |||
return this.requestUriEmitter.event; | |||
} | |||
public get rootScriptFolder(): Uri { | |||
return Uri.file(this._rootScriptFolder); | |||
return this._rootScriptFolder; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This file isn't node specific anymore, but doesn't actually work in the web because we can't write to the extensionUri location. It isn't used for web right now but once #10060 is implemented, it can be used to support that scenario.
That's why I left this being usable for web too.
@@ -165,7 +167,8 @@ export class VSCodeNotebookController implements Disposable, IVSCodeNotebookCont | |||
viewType, | |||
label, | |||
this.handleExecution.bind(this), | |||
this.getRendererScripts() | |||
this.getRendererScripts(), | |||
[this.scriptConverter.rootScriptFolder] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Whoops. This is the change needed for @mjbvz's new API (which hasn't gone through yet)
I'll just comment this out with a note saying this is how we'd use it.
@@ -192,29 +192,9 @@ export type DownloadOptions = { | |||
extension: 'tmp' | string; | |||
}; | |||
|
|||
export const IFileDownloader = Symbol('IFileDownloader'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IFileDownloader is not used. Leftovers from the python extension.
@@ -2183,8 +2183,6 @@ | |||
"redux": "^4.0.4", | |||
"redux-logger": "^3.0.6", | |||
"reflect-metadata": "^0.1.12", | |||
"request": "^2.87.0", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Request has been deprecated, switched to 'cross-fetch' instead.
Codecov Report
@@ Coverage Diff @@
## main #10076 +/- ##
======================================
- Coverage 64% 64% -1%
======================================
Files 216 214 -2
Lines 10060 9989 -71
Branches 1613 1605 -8
======================================
- Hits 6509 6442 -67
+ Misses 3028 3023 -5
- Partials 523 524 +1
|
return fetch.fetch(uri, this.requestOptions); | ||
} | ||
|
||
public async getJSON<T>(uri: string, strict: boolean = true): Promise<T> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Going to remove these. Not used anywhere.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I removed the unit test for this class well because it's just a light wrapper around fetch. I don't think it needs a unit test
@injectable() | ||
export class HttpClient implements IHttpClient { | ||
public readonly requestOptions: RequestInit; | ||
constructor(@inject(IServiceContainer) serviceContainer: IServiceContainer) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why inject the entire service container instead of the actual dependencies?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It was doing that before, I didn't notice. I'll change it if there's another update.
@@ -0,0 +1,99 @@ | |||
// Copyright (c) Microsoft Corporation. All rights reserved. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is '.base' needed in the filename?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No. I just used it to distinguish that this is a base class for the .node and .web files. I've done this in other spots.
@@ -101,4 +109,64 @@ export class FileSystem implements IFileSystem { | |||
const data = typeof text === 'string' ? Buffer.from(text) : text; | |||
return this.vscfs.writeFile(uri, data); | |||
} | |||
|
|||
async createTemporaryFile(options: { fileExtension?: string; prefix?: string }): Promise<TemporaryFileUri> { | |||
// In non node situations, temporary files are created in the globalStorageUri location (extension specific) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This seems to be in node context as well since it's in a common file. Does globalStorageUri mean different things in those contexts, or will this only be called in web?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No it works for both. It's intended to work for both (using it in the tests now). globalStorageUri is just a location on disk for desktop, and it's an in memory location for web.
I should change the comment though.
Fixes #9984
Most widgets will work after this change but not all. Some require js to load from the jupyter server and that requires some changes in VS code to accomplish #10060