index.js
function packageStatesSerialize () {
  if (atom.packages.serialize != null) {
    return atom.packages.serialize()
  }

  atom.packages.getActivePackages().forEach((pack) => {
    var state
    if (pack.serialize != null) state = pack.serialize()
    if (state) {
      atom.packages.setPackageState(pack.name, state)
    }
  })

  return atom.packages.packageStates
}
function packageStatesSerialize () {
  if (atom.packages.serialize != null) {
    return atom.packages.serialize()
  }

  atom.packages.getActivePackages().forEach((pack) => {
    var state
    if (pack.serialize != null) state = pack.serialize()
    if (state) {
      atom.packages.setPackageState(pack.name, state)
    }
  })

  return atom.packages.packageStates
}
shim atom.packages.serialize in <= 1.6