code: function isSourceFileLevelDeclarationInSystemJsModule(node, isExported) {
                  if (!node || !isCurrentFileSystemExternalModule()) {
                      return false;
                  }
                  var current = ts.getRootDeclaration(node).parent;
                  while (current) {
                      if (current.kind === 256 /* SourceFile */) {
                          return !isExported || ((ts.getCombinedNodeFlags(node) & 1 /* Export */) !== 0);
                      }
                      else if (ts.isDeclaration(current)) {
                          return false;
                      }
                      else {
                          current = current.parent;
                      }
                  }
              }
docs: /*
  Checks if given node is a source file level declaration (not nested in module/function).
  If 'isExported' is true - then declaration must also be exported.
  This function is used in two cases:
  - check if node is a exported source file level value to determine
  if we should also export the value after its it changed
  - check if node is a source level declaration to emit it differently,
  i.e non-exported variable statement 'var x = 1' is hoisted so
  when we emit variable statement 'var' should be dropped.