-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
Browser-only static extension support #14776
base: master
Are you sure you want to change the base?
Browser-only static extension support #14776
Conversation
…r-only implementation
…e naming of package.json scripts
…r-only-extension-support
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.
Thanks for the contribution!
Sadly I was not able to get the TS plugin working on my machine. It seems that some plugin storage directory was not creatable in opfs.
failed to load plugins: Unknown (FileSystemError): Error while accessing resource file:///globalStorage
at createFileSystemProviderError (http://localhost:3000/bundle.js:381479:27)
at OPFSFileSystemProvider.stat (http://localhost:3000/packages_filesystem_lib_browser-only_browser-only-filesystem-frontend-module_js.js:235:61)
at async FileService.mkdirp (http://localhost:3000/bundle.js:378429:30)
at async FileService.createFolder (http://localhost:3000/bundle.js:378413:9)
at async HostedPluginSupport.getHostGlobalStoragePath (http://localhost:3000/packages_plugin-ext_lib_hosted_browser_hosted-plugin_js.js:732:13)
at async Promise.all (index 2)
at async HostedPluginSupport.startPlugins (http://localhost:3000/packages_plugin-ext_lib_hosted_browser_hosted-plugin_js.js:1401:71)
at async HostedPluginSupport.doLoad (http://localhost:3000/packages_plugin-ext_lib_hosted_browser_hosted-plugin_js.js:1265:9)
at async ProgressService.withProgress (http://localhost:3000/bundle.js:357799:20)
at async http://localhost:3000/packages_plugin-ext_lib_hosted_browser_hosted-plugin_js.js:1214:17
metadata: { | ||
'host': 'main', // Should always be set to 'main' | ||
'model': { | ||
'packagePath': '/home/user/theia/examples/browser-only/plugins/theia.helloworld-web-sample/extension', // Deprecated |
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.
What do you mean with "Deprecated"?
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.
According to /theia/packages/plugin-ext/src/common/plugin-protocol.ts:573
this property is deprecated but in /theia/packages/plugin-ext/src/common/plugin-protocol.ts:60
it is not 🤔
packages/terminal/src/browser-only/terminal-frontend-only-module.ts
Outdated
Show resolved
Hide resolved
packages/terminal/src/browser-only/terminal-frontend-only-module.ts
Outdated
Show resolved
Hide resolved
packages/terminal/src/browser-only/terminal-frontend-only-contribution.ts
Outdated
Show resolved
Hide resolved
Co-authored-by: Stefan Dirix <[email protected]>
…le.ts to remove unnecessary imports Co-authored-by: Stefan Dirix <[email protected]>
What it does
This PR introduces support for static extension/plugin declaration in the Browser-Only mode. The required plugins can either be download and added manually to the respective directory or automatically through the
theiaPlugins
property. I've added a script which automatically unpacks the.vsix
files in thetheiaPluginsDir
property and bundles them with the browser-only variant of Theia.Currently, the metadata have to be specified by hand afterwards and will be injected at startup. An example of this can be found the in the respective directory.
Details on how to specify and craft those metadata are described in the file
ADOPTING.md
How to test
As an example, I have chosen the Typescript Language tools as they run smoothly and represent a real world use case:
npm run download:plugins
example-static-plugin-metadata.ts
to the respective path on your system. Currently, it assumes/home/user/theia
as path, just replace this part with your local theia locationnpm run build
command to build and package the plugins with the browser-only versionnpm run start
localhost:3000
builtin
)Follow-ups
Unfortunately, there are some limitation which can/should be tackled in future work
node
directory which would come in handy in automatic this. These should be outsourced into a independent package for handling Extensionpackage.json
files in both thenode
andbrowser-only
variantmodule is undefined
occurs when the plugin is executed and it happens in statements likemodule.export = i
. This is strange asmodule
is typically a Node.js thing. However, the general installation and bundling works and the error occurs directly in the plugin's bundled code when executed. To be investigated further ...Breaking changes
Attribution
Review checklist
Reminder for reviewers