The French parliament has passed an immigration law that caused widespread unease, after a debate that ran through the weekend and opened rifts within President Emmanuel Macron's party.