This file is already "browserified", meaning that it should be fine to
embed it verbatim inside the snapshot. The errors observed in e.g.
https://circleci.com/gh/atom/atom/7139 were in fact caused by trying to
process xregexp's already "browserified" modules again using
electron-link.
Previously, we used to verify the snapshot script by running it in a
new, empty context (similar to the one that `mksnapshot` creates when
generating the startup blob).
However, this context was being created using the Node version that
`script/build` was executed with. Such version may not match the Node
version shipped with Electron, and could thus cause the build script to
report "false negatives" when verifying the snapshot script. For
instance, running `script/build` with Node 4 would cause it to throw an
error when encountering keywords like `async`/`await`, even if they're
100% supported in Electron 1.6.9.
With this commit we are changing the snapshot verification code to use
the Node version bundled in Electron in order to avoid the
aforementioned mismatches.
When deciding which methods to export, `iconv-lite` verifies the
availability of some Node features, which is clearly an unsupported
behavior when executing it via `mksnapshot`.
In this case we were not getting any exception at compile-time, but we
noticed some methods were missing from iconv-lite's API. With this
commit we are excluding this module from the snapshot, thus making all
of its methods available again.
This module uses Node's `path` for determinining which path separator to
use on the current platform. On browsers (and every other environment
that does not support `require`, such as v8 snapshots) it falls back to
always using a forward slash.
As a result, `PackageTranspilationRegistry` (and potentially other
bundled packages that depend on `minimatch`) couldn't match glob
expressions against any given path on Windows, thus causing the custom
transpiler code to not work properly.
This will report the correct file and line numbers on stack traces
instead of always showing `<embedded>:absoluteLineNumber`. As a result,
it will also fix the `notifications` package, which will be able again
to identify which package threw an exception and to create an issue on
its repository.