Cleanup Theia's core extension APIs #10772
Replies: 3 comments 3 replies
-
I support this proposal under the general heading of API management. At the moment, we don't have much of notion of what parts of our code represent API that we should really avoid changing. In principle, every method and every field of every class becomes API as soon as it's merged, and every change of signature, however minor, is potentially breaking for somebody. It would be a great step forward for the framework to establish a way of managing adopters' expectations about what will be maintained across releases and when they may be venturing into more unstable waters. |
Beta Was this translation helpful? Give feedback.
-
While we're add it, I would suggest to re-export the
That allows us to reference stuff like |
Beta Was this translation helpful? Give feedback.
-
I'm having an unpleasant issue trying to make this happen: We export both vanilla TS/JS components along with Inversify components from our core/common modules. If we import an Inversify component decorated with From there either:
I could be in favor of (1), as it requires the least refactoring... Note that (1) is only an issue when dealing with code in subprocesses, the backend process is already patched. |
Beta Was this translation helpful? Give feedback.
-
Almost no other npm package requires you to import symbols from nested files, e.g.
Theia's API is currently scattered in various files, and not properly exposing those through a common
index.ts
entry-point makes internal refactorings painful as renaming files or moving symbols will break dependents.One problem is that Theia packages often contain code for multiple runtimes, which means there can't really be a single entry point.
It would still help if we exposed all public symbols through each entry point, e.g.
In some situations we already have
index.ts
files that re-export symbols but it is done in a blanket way and symbols can be missing, e.g.As a rule of thumb, we should never have to go one level below
@theia/<package>/lib/<runtime>
to import a symbol from another extension. Doing so would imply relying on non-public/non-standard internal API and we reserve ourselves the right to change it for any reason.Re-exports should also look a bit more like the following:
This way we get a more fine-grained control over what gets exposed so that we minimize the leak of internal classes.
Beta Was this translation helpful? Give feedback.
All reactions