Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 472745

Summary: Provide requirejs plugin to load dependent JSON
Product: [ECD] Orion Reporter: Michael Rennie <Michael_Rennie>
Component: ClientAssignee: Michael Rennie <Michael_Rennie>
Status: RESOLVED FIXED QA Contact:
Severity: enhancement    
Priority: P3 CC: Silenio_Quarti, simon_kaegi, steve_northover
Version: 10.0   
Target Milestone: 10.0   
Hardware: All   
OS: All   
See Also: https://git.eclipse.org/r/51992
https://git.eclipse.org/c/orion/org.eclipse.orion.client.git/commit/?id=b09833b34a87e8c49fce1dc52d03d81abdfba861
Whiteboard:

Description Michael Rennie CLA 2015-07-15 10:56:05 EDT
In JS tools (and probably elsewhere) there are a few of our libraries that use JSON config / index / data files - for example the ecma6 defs file for Tern. In the current world, when we update versions I have to wrap that JSON in a define(...) call in a js file.

It would be super handy to have a require plugin that could load these JSON files rather than having to use the fileClient (since the contents of these files don't change).

so an old define from ternWorkerCore like:
...
'tern/plugin/orionRequire',
'tern/plugin/ternPlugins',
'tern/defs/ecma6',
'tern/defs/browser',
'javascript/handlers/ternAssistHandler',
'javascript/handlers/ternDeclarationHandler',
...

would become:
...
'tern/plugin/orionRequire',
'tern/plugin/ternPlugins',
'json!tern/defs/ecma6.json',
'json!tern/defs/browser.json',
'javascript/handlers/ternAssistHandler',
'javascript/handlers/ternDeclarationHandler',
...

and I would no longer have to wrap the JSON in a js file.
Comment 1 Eclipse Genie CLA 2015-07-15 11:00:02 EDT
New Gerrit change created: https://git.eclipse.org/r/51992
Comment 2 Michael Rennie CLA 2015-07-15 11:01:15 EDT
The gerrit change adds the new plugin, updates the build scripts and adds its use the JS bundle (others can use it as they wish).
Comment 4 Michael Rennie CLA 2015-07-15 12:26:06 EDT
merged.