Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 364401 - Soften dependencies between scripts
Summary: Soften dependencies between scripts
Status: RESOLVED WONTFIX
Alias: None
Product: Orion
Classification: ECD
Component: Editor (show other bugs)
Version: unspecified   Edit
Hardware: All All
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Project Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-11-21 13:12 EST by Mihai Sucan CLA
Modified: 2015-05-05 15:59 EDT (History)
4 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Mihai Sucan CLA 2011-11-21 13:12:40 EST
Currently there are some strong dependencies between various scripts - dependencies that are not strictly needed.

For example, tooltip.js is required in rulers.js even if the integrator doesn't need/use tooltips and annotations.

Such requirements make us integrate more code than needed - making it harder to track between updates what relevant changes have happened.

Would it be possible to soften the dependencies between scripts? I'll submit a proposed patch, but I assume you guys have better thoughts on this.

Thank you!
Comment 1 Mihai Sucan CLA 2011-11-21 13:22:45 EST
Proposed patch:

https://github.com/mihaisucan/orion.client/tree/bug-364401

The approach is simply finetuning the existing code, actually. The existing code already checks if there's no annotation model, or no tooltip, but it doesn't check if the actual modules are available or not.

This avoids breakage when we elect to not include some scripts (like tooltip.js, annotations.js and projectionTextModel.js) that we don't use features from (no tooltips/annotations/code folding).

Any thoughts? Would this be acceptable? Or is this not a valid concern? (as in, we should not bother - just include all code needed.)

Thanks!
Comment 2 Felipe Heidrich CLA 2011-11-21 16:09:34 EST
I think that is okay (I like fine tuning of the files being loaded), except that the change proposed in the patch only makes sense for non-requirejs users (using the global.js adaptor).

In the requirejs case, if the dependency is not loaded then the require/define call fails, thus it is not needed to test if mWhatever is defined.

Is there a way to specify, in requirejs, that a module is optional ?
or am I missing something  here ?
Comment 3 Mihai Sucan CLA 2011-11-21 16:48:09 EST
(In reply to comment #2)
> I think that is okay (I like fine tuning of the files being loaded), except
> that the change proposed in the patch only makes sense for non-requirejs users
> (using the global.js adaptor).
> 
> In the requirejs case, if the dependency is not loaded then the require/define
> call fails, thus it is not needed to test if mWhatever is defined.
> 
> Is there a way to specify, in requirejs, that a module is optional ?
> or am I missing something  here ?

I haven't seen anything like this in the requirejs API.

But here's what I found...
https://github.com/jrburke/requirejs/pull/16

(see the last comment)

As I understand one can write a loader plugin to make deps optional.
Comment 4 Felipe Heidrich CLA 2011-11-22 12:48:34 EST
Thanks for the link, I added comments to the feature request.
Comment 5 John Arthorne CLA 2015-05-05 15:46:09 EDT
Closing as part of a mass clean up of inactive bugs. Please reopen if this problem still occurs or is relevant to you. For more details see:


https://dev.eclipse.org/mhonarc/lists/orion-dev/msg03444.html
Comment 6 John Arthorne CLA 2015-05-05 15:59:52 EDT
Closing as part of a mass clean up of inactive bugs. Please reopen if this problem still occurs or is relevant to you. For more details see:


https://dev.eclipse.org/mhonarc/lists/orion-dev/msg03444.html