Commit 8266abb
committed
re-export common packages
Enable errors for import/no-extraneous-dependencies.
Relying on hoisting makes building Theia application somewhat unstable.
In general cases, everything is fine. But as soon as Yarn decides to
hoist things differently then it can become difficult to fix.
This commit fixes the issue by re-exporting dependencies from
@theia/core, this way instead of relying on implicit dependencies one
can directly import what @theia/core uses like:
import * as dep from '@theia/core/shared/dep'
To make this work I added a 'shared' folder under 'packages/core' with
js scripts that re-export everything from their matching library.
To ease with the development there is a script named
'packages/core/scripts/generate-shared.js' that will read values
from 'packages/core/package.json#theiaReExports' in order to more easily
add new packages. Depending on how the package exports things we need to
re-export things the same way.
@theia/electron now re-exports all members from electron. This
prevents having to use electron as an implicit dependency.
@theia/electron now also is a @theia/core optional peer dependency. This
directly represent the use case we have for this package where we will
only use electron features if this package is installed by application
makers.
If people don't know about this way to consume @theia/core's shared
dependencies then nothing will change and they might keep using implicit
dependencies. But the new recommended method is to use those re-exports
in order to make builds more stable in the face of hoisting and other
dependency tree optimizations.
Noteworthy: There was an issue with sharing @theia/application-package
since I only re-export the main 'index.js' it tried to include
Node-specific code in frontend applications. I fixed this by
re-exporting @theia/application-package/lib/environment separately.
Signed-off-by: Paul <paul.marechal@ericsson.com>1 parent 73a1732 commit 8266abb
File tree
887 files changed
+1638
-1170
lines changed- configs
- dev-packages
- application-manager
- src
- electron
- examples/api-samples
- src
- browser
- file-watching
- label
- output
- view
- vsx
- electron-browser
- updater
- electron-main/update
- packages
- bulk-edit/src/browser
- bulk-edit-tree
- callhierarchy/src/browser
- callhierarchy-tree
- console/src/browser
- core
- scripts
- src
- browser
- keyboard
- preferences
- test
- common
- keyboard
- messaging
- test
- electron-browser
- keyboard
- messaging
- token
- window
- electron-main
- messaging
- electron-node/keyboard
- node/messaging
- debug/src
- browser
- breakpoint
- console
- editor
- model
- preferences
- view
- node
- vscode
- editor-preview/src/browser
- editor/src/browser
- decorations
- file-search/src
- browser
- node
- filesystem/src
- browser
- download
- file-dialog
- file-tree
- location
- common
- electron-browser/file-dialog
- node
- download
- nsfw-watcher
- getting-started/src/browser
- git/src
- browser
- blame
- diff
- dirty-diff
- history
- prompt
- common
- electron-browser/prompt
- electron-node
- askpass
- env
- node
- env
- git-locator
- init
- test
- keymaps/src/browser
- markers/src
- browser
- problem
- common
- messages/src/browser
- metrics/src/node
- mini-browser/src
- browser
- environment
- electron-browser/environment
- electron-main
- node
- monaco/src
- browser
- textmate
- electron-browser
- outline-view/src/browser
- output/src
- browser
- common
- plugin-dev/src
- browser
- node-electron
- node
- plugin-ext-vscode
- src
- browser
- common
- node
- plugin-ext/src
- common
- hosted
- browser
- node-electron
- node
- scanners
- main
- browser
- callhierarchy
- comments
- debug
- decorations
- dialogs
- editor
- keybindings
- view
- webview
- common
- electron-browser
- webview
- node
- handlers
- paths
- resolvers
- plugin
- languages
- node/debug
- preferences
- status-bar
- plugin-metrics/src
- browser
- node
- metric-output
- preferences/src/browser
- util
- views
- components
- preview/src/browser
- markdown
- process/src
- common
- node
- test
- scm-extra/src/browser
- history
- scm/src/browser
- decorations
- dirty-diff
- search-in-workspace/src
- browser
- node
- task
- src
- browser
- process
- common
- node
- process
- test
- terminal/src
- browser
- search
- common
- node
- test
- timeline
- src
- browser
- common
- typehierarchy/src/browser
- tree
- userstorage/src/browser
- variable-resolver/src/browser
- vsx-registry
- src
- browser
- common
- node
- workspace/src
- browser
- common/test
- node
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
887 files changed
+1638
-1170
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
34 | 34 | | |
35 | 35 | | |
36 | 36 | | |
37 | | - | |
| 37 | + | |
38 | 38 | | |
39 | 39 | | |
40 | 40 | | |
| |||
130 | 130 | | |
131 | 131 | | |
132 | 132 | | |
133 | | - | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
134 | 144 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
53 | 53 | | |
54 | 54 | | |
55 | 55 | | |
56 | | - | |
| 56 | + | |
| 57 | + | |
57 | 58 | | |
58 | 59 | | |
59 | 60 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
19 | | - | |
20 | | - | |
| 19 | + | |
| 20 | + | |
21 | 21 | | |
22 | 22 | | |
23 | 23 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
29 | 29 | | |
30 | 30 | | |
31 | 31 | | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
32 | 37 | | |
33 | 38 | | |
34 | 39 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
14 | 14 | | |
15 | 15 | | |
16 | 16 | | |
| 17 | + | |
| 18 | + | |
17 | 19 | | |
18 | 20 | | |
19 | 21 | | |
| |||
26 | 28 | | |
27 | 29 | | |
28 | 30 | | |
| 31 | + | |
29 | 32 | | |
30 | 33 | | |
31 | 34 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
17 | 17 | | |
18 | 18 | | |
19 | 19 | | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
20 | 26 | | |
21 | 27 | | |
22 | 28 | | |
0 commit comments