Exemplo n.º 1
0
    def _wrap_js_content(self, path):
        template = '''"use strict";
(function() {
var exports = {};
%s
})();'''
        replace_file_content(path, lambda c: template % c)
Exemplo n.º 2
0
    def _wrap_js_module(self, extension_out_path, path):
        template = '''"use strict";
_kangoLoader.add("%s", function(require, exports, module) {
%s
});'''
        module_id = os.path.relpath(path, extension_out_path).replace('.js', '').replace('\\', '/')
        replace_file_content(path, lambda c: template % (module_id, c))
Exemplo n.º 3
0
    def _wrap_js_module(self, extension_out_path, path):
        template = """"use strict";
_kangoLoader.add("%s", function(require, exports, module) {
%s
});"""
        module_id = os.path.relpath(path, extension_out_path).replace(".js", "").replace("\\", "/")
        replace_file_content(path, lambda c: template % (module_id, c))
Exemplo n.º 4
0
 def patch_background_host(self, path, modules):
     replace_file_content(path, lambda c: self.insert_modules(c, modules))
Exemplo n.º 5
0
 def _add_text_to_beginning(self, path, text):
     replace_file_content(path, lambda c: text + c)
Exemplo n.º 6
0
 def _patch_chrome_manifest(self, path):
     replace_file_content(path, lambda c: c.replace(KEYWORDS['product'], self._info.package_id), 'ascii')