-
Notifications
You must be signed in to change notification settings - Fork 34.6k
Description
Synopsis
Electron 5.0 disables node integration (by default). Explore if we can run VSCode in such an environment where node.js cannot be used from the renderer.
Development
All changes happen on master
. To run, simply append --nodeless
to the startup, e.g.
scripts/code.sh --nodeless
This will open a version of the workbench that can run without node by pulling in src/vs/workbench/workbench.nodeless.main.ts
. This is a list of dependencies that have no node.js or electron dependency. It closely mirrors src/vs/workbench/workbench.main.ts
as much as possible.
Many services in src/vs/workbench/workbench.nodeless.main.ts
are shimmed with a simple implementation until they are adopted (see src/vs/workbench/browser/nodeless.simpleservices.ts
).
Example: make emmet fit to run without node/electron
We recently pushed changes to support emmet fully in an environment without node. The steps involved:
- moving the code itself to a
common
orbrowser
layer (more info on our layers) - this typically means to avoid using node.js or electron API by using a service instead that can be referenced from
common
orbrowser
Example: make the hash service fit to run without node/electron
We have a IHashService
that can be used to compute SHA1 hashes of strings that is implemented by using the node.js API. To allow to use this service from an environment without node:
- we created as
src/vs/workbench/services/hash/common/hashService.ts
that is fully implemented to run without node - we updated
src/vs/workbench/workbench.nodeless.main.ts
to use that implementation instead of the simple implementations fromsrc/vs/workbench/browser/nodeless.simpleservices.ts
Note: if the new implementation of the service is good enough, we can drop the existing one to ensure we only have one service implementation.
Backlog
Related Issues:
- InstantiationService with proxys: allow to be used in browser namespace InstantiationService with proxys: allow to be used in browser namespace #69141
- Split up workbench/api into a electron-browser and browser part Split up workbench/api into a node and browser part #70319
- Implement a
IRequestService
that works inbrowser
context (using XHR) (blocks Revisit need for node/electron-browser in workbench/contrib/preferences #69111) - Revisit need for
node/electron-browser
inworkbench/contrib/watermark
Revisit need for node/electron-browser in workbench/contrib/watermark #69117 - Revisit need for
node/electron-browser
inworkbench/contrib/welcome
Revisit need for node/electron-browser in workbench/contrib/welcome #69116 - Revisit need for
node/electron-browser
inworkbench/contrib/terminal
Revisit need for node/electron-browser in workbench/contrib/terminal #69115 - Revisit need for
node/electron-browser
inworkbench/contrib/tasks
Revisit need for node/electron-browser in workbench/contrib/tasks #69113 - Revisit need for
node/electron-browser
inworkbench/contrib/scm
Revisit need for node/electron-browser in workbench/contrib/scm #69112 - Revisit need for
node/electron-browser
inworkbench/contrib/preferences
Revisit need for node/electron-browser in workbench/contrib/preferences #69111 - Revisit need for
node/electron-browser
inworkbench/contrib/output
Revisit need for node/electron-browser in workbench/contrib/output #69110 - Revisit need for
node/electron-browser
inworkbench/contrib/markers
Revisit need for node/electron-browser in workbench/contrib/markers #69109 - Revisit need for
node/electron-browser
inworkbench/contrib/experiments
Revisit need for node/electron-browser in workbench/contrib/experiments #69108 - Revisit need for
electron-browser
inworkbench/contrib/execution
Revisit need for electron-browser in workbench/contrib/execution #69107 - Revisit need for
electron-browser
inworkbench/contrib/emmet
Revisit need for electron-browser in workbench/contrib/emmet #69105 - Revisit need for
electron-browser
inworkbench/contrib/debug
Revisit need for electron-browser in workbench/contrib/debug #69104 - Revisit need for
electron-browser
inworkbench/contrib/comments
Revisit need for electron-browser in workbench/contrib/comments #69103 - Revisit need for
electron-browser
inworkbench/contrib/codeEditor
Revisit need for electron-browser in workbench/contrib/codeEditor #69102