Closed
Bug 1356146
Opened 9 years ago
Closed 9 years ago
Link webpack alias to m-c shared if possible
Categories
(DevTools :: Netmonitor, enhancement, P1)
DevTools
Netmonitor
Tracking
(firefox55 fixed)
| Tracking | Status | |
|---|---|---|
| firefox55 | --- | fixed |
People
(Reporter: rickychien, Assigned: rickychien)
References
Details
(Whiteboard: [netmonitor])
Attachments
(1 file)
We're moving shared modules from devtools-core to m-c. For those modules who haven't modified in devtools-core, we'd prefer to reuse m-c ones instead and remove from devtools-modules.
Updated•9 years ago
|
Blocks: netmonitor-phaseII
Flags: qe-verify?
Comment 1•9 years ago
|
||
Honza created a document that lists code duplicated between m-c and devtools-core: https://docs.google.com/document/d/17VX8T1QyfhAfLa9vSLSNEpzinvl6nZEbVq5KhqkHwDk/edit#
In this doc, I highlighted in orange what I think is not used by anything on GitHub, but only used by things in m-c.
These things are here because they were needed to run panels in launchpad.
If instead we use webpack aliases to local files in m-c, we can remove these things from devtools-core safely and therefore get rid of a lot of duplication.
It would be great if you could update the document in parallel, so that it always reflects that state of things (you could, for instance, just delete the entries in the list that have been taken care of).
I'm wondering about something: you said that you'll do this only for the modules that have not been modified in devtools-core, but I'm not sure we want this.
Take the example of the splitter: it is used both in m-c (by several panels) and on GitHub (by the debugger). And it has evolved in both locations differently.
But, when the netmonitor runs in its normal environment, in the toolbox, it uses the splitter from m-c.
So, when the netmonitor runs in a browser tab, via launchpad, I think it would be better it is also used the splitter from m-c. This way, it always uses the same code, and there are no surprises. So, I would tend to use webpack aliases to local m-c files for everything that is in m-c, so that no matter if you use the netmonitor in the toolbox or in launchpad, they run the exact same code.
| Comment hidden (mozreview-request) |
| Comment hidden (mozreview-request) |
Comment 4•9 years ago
|
||
| mozreview-review | ||
Comment on attachment 8858264 [details]
Bug 1356146 - Link webpack alias to m-c shared
https://reviewboard.mozilla.org/r/130244/#review132938
::: devtools/client/netmonitor/webpack.config.js:41
(Diff revision 2)
> // Fallback compatibility for npm link
> resolve: {
> fallback: path.join(__dirname, "node_modules"),
> alias: {
> "react": path.join(__dirname, "node_modules/react"),
> "devtools/client/framework/devtools": "devtools-modules",
we can move the netmonitor only mock back to `utils/shim/devtool.js`
::: devtools/client/netmonitor/webpack.config.js:76
(Diff revision 2)
> + "devtools/client/shared/widgets/Chart": path.join(__dirname, "../../client/shared/widgets/Chart"),
> "devtools/client/sourceeditor/editor": "devtools-source-editor/src/source-editor",
> + "devtools/shared/async-utils": path.join(__dirname, "../../shared/async-utils"),
> + "devtools/shared/defer": path.join(__dirname, "../../shared/defer"),
> + "devtools/shared/event-emitter": "devtools-modules/shared/event-emitter",
> "devtools/shared/fronts/timeline": "devtools-modules",
we can move the netmonitor only mock back to `utils/shim/timeline.js`
Comment 5•9 years ago
|
||
| mozreview-review | ||
Comment on attachment 8858264 [details]
Bug 1356146 - Link webpack alias to m-c shared
https://reviewboard.mozilla.org/r/130244/#review132942
::: devtools/shared/plural-form.js
(Diff revision 2)
> * @return The plural rule number
> */
> get ruleNum()
> {
> - try {
> - return parseInt(L10N.getStr("pluralRule"), 10);
we can't remove that in m-c, or the locale support will be broken
| Assignee | ||
Comment 6•9 years ago
|
||
| mozreview-review-reply | ||
Comment on attachment 8858264 [details]
Bug 1356146 - Link webpack alias to m-c shared
https://reviewboard.mozilla.org/r/130244/#review132938
> we can move the netmonitor only mock back to `utils/shim/devtool.js`
Nice catch Fred! Instead of moving devtool.js and timeline.js to netmonitor/src/utils/shim/, I'd prefer to move them to those existing shims folders in devtools/shared or devtools/client/shared since they are derived from m-c shared folders, and this way can also bring benefit to other panels (console or inspector) who are try to support launchpad like us.
| Comment hidden (mozreview-request) |
| Comment hidden (mozreview-request) |
| Assignee | ||
Comment 9•9 years ago
|
||
(In reply to Patrick Brosset <:pbro> from comment #1)
> Honza created a document that lists code duplicated between m-c and
> devtools-core:
> https://docs.google.com/document/d/
> 17VX8T1QyfhAfLa9vSLSNEpzinvl6nZEbVq5KhqkHwDk/edit#
> In this doc, I highlighted in orange what I think is not used by anything on
> GitHub, but only used by things in m-c.
> These things are here because they were needed to run panels in launchpad.
> If instead we use webpack aliases to local files in m-c, we can remove these
> things from devtools-core safely and therefore get rid of a lot of
> duplication.
>
> It would be great if you could update the document in parallel, so that it
> always reflects that state of things (you could, for instance, just delete
> the entries in the list that have been taken care of).
Sure I'll do it.
> I'm wondering about something: you said that you'll do this only for the
> modules that have not been modified in devtools-core, but I'm not sure we
> want this.
> Take the example of the splitter: it is used both in m-c (by several panels)
> and on GitHub (by the debugger). And it has evolved in both locations
> differently.
> But, when the netmonitor runs in its normal environment, in the toolbox, it
> uses the splitter from m-c.
> So, when the netmonitor runs in a browser tab, via launchpad, I think it
> would be better it is also used the splitter from m-c. This way, it always
> uses the same code, and there are no surprises. So, I would tend to use
> webpack aliases to local m-c files for everything that is in m-c, so that no
> matter if you use the netmonitor in the toolbox or in launchpad, they run
> the exact same code.
Agree.
Sorry for the title is not so clear. Words of "Link webpack alias to m-c shared if possible" is like you mentioned "use webpack aliases to local m-c files for everything that is in m-c". For some of reasons there remain four modules which cannot alias to m-c directly.
* devtools-modules/client/framework/menu
* devtools-modules/shared/event-emitter
* devtools-modules/client/shared/shim/Services
* devtools-source-editor/src/source-editor
These four modules have their own modifications which differ from m-c ones, so the duplication is existed but it's not too bad. IMO, a separate bug can be filed to implement the shims in m-c for above fours modules, and then remove other useless modules in devtools-core.
Comment 10•9 years ago
|
||
| mozreview-review | ||
Comment on attachment 8858264 [details]
Bug 1356146 - Link webpack alias to m-c shared
https://reviewboard.mozilla.org/r/130244/#review132950
Looks reasonable to me. Testing on my machine and I don't see any problems.
R+ assuming try is green.
Honza
::: devtools/client/netmonitor/src/components/monitor-panel.js:119
(Diff revision 4)
> className: "devtools-responsive-container",
> - initialWidth,
> - initialHeight,
> + initialWidth: `${initialWidth}px`,
> + initialHeight: `${initialHeight}px`,
> minSize: "50px",
> maxSize: "80%",
> - splitterSize: 1,
> + splitterSize: "1px",
Ah, yes, splitter is different in m-c.
Attachment #8858264 -
Flags: review?(odvarko) → review+
Comment 11•9 years ago
|
||
Pushed by rchien@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/558ecea44374
Link webpack alias to m-c shared r=Honza
Comment 12•9 years ago
|
||
@ricky: follow up for your question on IRC...
I found a workaround for the 'cannot find module lockfile/parse.js' on Win.
So, when I am testing on Windows now, I see:
ERROR in ../shared/curl.js
Module build failed: ReferenceError: Unknown plugin "transform-flow-strip-types"
Honza
Flags: needinfo?(rchien)
| Assignee | ||
Comment 13•9 years ago
|
||
After discussing on IRC, at least it's clear the root cause is the complicated regex at webpackConfig.babelExcludes. This issue is weird that can be reproduced on Windows only.
Honza, feel free to file a bug to simplify regex and fix the issue for Windows. Thanks!
Flags: needinfo?(rchien)
Comment 14•9 years ago
|
||
(In reply to Ricky Chien [:rickychien] from comment #13)
> After discussing on IRC, at least it's clear the root cause is the
> complicated regex at webpackConfig.babelExcludes. This issue is weird that
> can be reproduced on Windows only.
>
> Honza, feel free to file a bug to simplify regex and fix the issue for
> Windows. Thanks!
bug 1356586
Honza
Comment 15•9 years ago
|
||
| bugherder | ||
Status: ASSIGNED → RESOLVED
Closed: 9 years ago
status-firefox55:
--- → fixed
Resolution: --- → FIXED
Target Milestone: --- → Firefox 55
| Assignee | ||
Comment 16•9 years ago
|
||
Docs has been updated https://docs.google.com/document/d/17VX8T1QyfhAfLa9vSLSNEpzinvl6nZEbVq5KhqkHwDk/edit.
PR in devtools-core to remove duplicated and unused modules, see https://github.com/devtools-html/devtools-core/pull/335.
Patrick, please take a look and feel free to add comment or clear ni if everything makes sense. :)
Flags: needinfo?(pbrosset)
Updated•9 years ago
|
Flags: qe-verify? → qe-verify-
Updated•8 years ago
|
Product: Firefox → DevTools
You need to log in
before you can comment on or make changes to this bug.
Description
•