tools: pass custom template for js2c (#12593)

* Update node v9.7.0 ref

* tools: pass custom template to node/tools/js2c.py
This commit is contained in:
Robo 2018-04-13 17:50:04 +05:30 committed by Shelley Vohr
parent 9e5c264012
commit ad2baccefa
5 changed files with 31 additions and 31 deletions

View file

@ -181,11 +181,12 @@ void AtomRendererClient::SetupMainWorldOverrides(
// Wrap the bundle into a function that receives the binding object as
// an argument.
std::string bundle(node::isolated_bundle_data,
node::isolated_bundle_data + sizeof(node::isolated_bundle_data));
std::string wrapper = "(function (binding, require) {\n" + bundle + "\n})";
auto script = v8::Script::Compile(
mate::ConvertToV8(isolate, wrapper)->ToString());
std::string left = "(function (binding, require) {\n";
std::string right = "\n})";
auto script = v8::Script::Compile(v8::String::Concat(
mate::ConvertToV8(isolate, left)->ToString(),
v8::String::Concat(node::isolated_bundle_value.ToStringChecked(isolate),
mate::ConvertToV8(isolate, right)->ToString())));
auto func = v8::Handle<v8::Function>::Cast(
script->Run(context).ToLocalChecked());