signFile(data) {
    if (!data.includes(NEWTOKEN)) {
      if (SignedSource.isSigned(data)) {
        // Signing a file that was previously signed.
        data = data.replace(PATTERN, SignedSource.getSigningToken());
      } else {
        throw TokenNotFoundError;
      }
    }
    return data.replace(NEWTOKEN, `SignedSource<<${hash(data, 'utf8')}>>`);
  }
Signs a source file which contains a signing token. Signing modifies only
the signing token, so the token should be placed inside a comment in order
for signing to not change code semantics.