Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Unified Diff: templates/modules.js.tmpl

Issue 29399569: Issue 5060 - Move require into modules template, make info a module (Closed)
Patch Set: Addressed more feedback Created March 31, 2017, 3:15 p.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « templates/geckoInfo.js.tmpl ('k') | tests/test_packagerEdge.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: templates/modules.js.tmpl
diff --git a/templates/modules.js.tmpl b/templates/modules.js.tmpl
index c826d892704589d344ecb9fadb61348ab8448b3b..65004f0f94dd773ac8720011418a9bd18b8d6c57 100644
--- a/templates/modules.js.tmpl
+++ b/templates/modules.js.tmpl
@@ -1,4 +1,31 @@
{%- 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
+if (typeof require == "undefined")
+{
+ var require = function(module)
+ {
+ if (!(module in require.scopes))
+ {
+ let scope = {exports: {}};
+ require.scopes[module] = require.modules[module](scope, scope.exports);
+ }
+ return require.scopes[module];
+ };
+ require.modules = Object.create(null);
+ require.scopes = Object.create(null);
+}
+
+{% if args["injectinfomodule"] %}
+require.modules["info"] = function(module, exports)
+{
+{% if type == "gecko-webext" %}
+{% include "geckoInfo.js.tmpl" %}
+{% elif type == "chrome" or type == "edge" %}
+{% include "chromeInfo.js.tmpl" %}
+{% endif %}
+return module.exports;
+};
+{% endif %}
+
{%- for module_name, script in modules -%}
require.modules[{{ module_name|json }}] = function(module, exports)
{
« no previous file with comments | « templates/geckoInfo.js.tmpl ('k') | tests/test_packagerEdge.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld