Embed setup bundle for preload scripts in sandboxed renderers.

Add a gyp target that creates a browserify bundle starting with
`lib/sandboxed_renderer/init.js`, which is embedded into the executable using
the `atom_js2c` target.

The goal of this bundle is to provide a very basic environment for preload
scripts where a `require` function is available.
This commit is contained in:
Thiago de Arruda 2016-08-21 07:30:14 -03:00
parent 695509e267
commit 72154b64ed
6 changed files with 101 additions and 4 deletions

View file

@ -423,11 +423,44 @@
},
],
}, # target atom_js2c_copy
{
'target_name': 'atom_browserify',
'type': 'none',
'dependencies': [
# depend on this target to ensure the '<(js2c_input_dir)' is created
'atom_js2c_copy',
],
'actions': [
{
'action_name': 'atom_browserify',
'inputs': [
'<@(browserify_entries)',
# Any js file under `lib/` can be included in the preload bundle.
# Add all js sources as dependencies so any change to a js file will
# trigger a rebuild of the bundle(and consequently of js2c).
'<@(js_sources)',
],
'outputs': [
'<(js2c_input_dir)/preload_bundle.js',
],
'action': [
'npm',
'run',
'browserify',
'--',
'<@(browserify_entries)',
'-o',
'<@(_outputs)',
],
}
],
}, # target atom_browserify
{
'target_name': 'atom_js2c',
'type': 'none',
'dependencies': [
'atom_js2c_copy',
'atom_browserify',
],
'actions': [
{
@ -435,6 +468,7 @@
'inputs': [
# List all input files that should trigger a rebuild with js2c
'<@(js2c_sources)',
'<(js2c_input_dir)/preload_bundle.js',
],
'outputs': [
'<(SHARED_INTERMEDIATE_DIR)/atom_natives.h',