 Issue 29399569:
  Issue 5060 - Move require into modules template, make info a module  (Closed)
    
  
    Issue 29399569:
  Issue 5060 - Move require into modules template, make info a module  (Closed) 
  | Left: | ||
| Right: | 
| OLD | NEW | 
|---|---|
| 1 {%- if args["module"] -%} | 1 {%- if args["module"] -%} | 
| 
Sebastian Noack
2017/03/31 16:33:11
It seems we can get rid of the "module" argument n
 
kzar
2017/04/01 01:32:56
Not quite yet, there are a few scripts that we nee
 
Sebastian Noack
2017/04/01 10:02:56
It seems elemHideEmulation.js can just be added un
 
kzar
2017/04/01 10:50:28
We agree that at some point we can probably remove
 
Sebastian Noack
2017/04/01 11:04:54
Merging those scripts, while on it, is trivial. If
 
kzar
2017/04/01 12:13:13
Honestly I've have had enough of these "while at i
 
Sebastian Noack
2017/04/01 13:09:06
Well, you were the one pushing for the ESLint conf
 | |
| 2 if (typeof require == "undefined") | |
| 3 { | |
| 4 var require = function(module) | |
| 5 { | |
| 6 if (!(module in require.scopes)) | |
| 7 { | |
| 8 let scope = {exports: {}}; | |
| 9 require.scopes[module] = require.modules[module](scope, scope.exports); | |
| 10 } | |
| 11 return require.scopes[module]; | |
| 12 }; | |
| 13 require.modules = Object.create(null); | |
| 14 require.scopes = Object.create(null); | |
| 15 } | |
| 16 | |
| 17 {% if args["injectinfomodule"] %} | |
| 18 require.modules["info"] = function(module, exports) | |
| 19 { | |
| 20 {% if type == "gecko-webext" %} | |
| 21 {% include "geckoInfo.js.tmpl" %} | |
| 22 {% elif type == "chrome" or type == "edge" %} | |
| 23 {% include "chromeInfo.js.tmpl" %} | |
| 24 {% endif %} | |
| 25 return module.exports; | |
| 26 }; | |
| 27 {% endif %} | |
| 28 | |
| 2 {%- for module_name, script in modules -%} | 29 {%- for module_name, script in modules -%} | 
| 3 require.modules[{{ module_name|json }}] = function(module, exports) | 30 require.modules[{{ module_name|json }}] = function(module, exports) | 
| 4 { | 31 { | 
| 5 {{ script }} | 32 {{ script }} | 
| 6 return module.exports; | 33 return module.exports; | 
| 7 }; | 34 }; | 
| 8 | 35 | 
| 9 {% endfor -%} | 36 {% endfor -%} | 
| 10 {%- set modules = dict(modules) -%} | 37 {%- set modules = dict(modules) -%} | 
| 11 {%- for module_name in args["autoload"] -%} | 38 {%- for module_name in args["autoload"] -%} | 
| 12 {%- if module_name in modules -%} | 39 {%- if module_name in modules -%} | 
| 13 require({{ module_name|json }}); | 40 require({{ module_name|json }}); | 
| 14 {% endif %} | 41 {% endif %} | 
| 15 {%- endfor -%} | 42 {%- endfor -%} | 
| 16 {%- else -%} | 43 {%- else -%} | 
| 17 {%- for module_name, script in modules -%} | 44 {%- for module_name, script in modules -%} | 
| 18 {{ script }} | 45 {{ script }} | 
| 19 {% endfor -%} | 46 {% endfor -%} | 
| 20 {%- endif -%} | 47 {%- endif -%} | 
| OLD | NEW |