(perhaps Protevangelium of James 17.3-22.1 should be in the middle)
(I had done this for another thread but may as well put it here)
Dial. Trypho 78
Matthew 2:1-12 (NRSV)
17.3 And having come halfway, Mary said to him, “Joseph, take me down from the jenny, for the child within me presses me to come forth.” And he took her down from the jenny and said to her, “Where shall I take you and hide your shame? For the place is desert.”
18.1 And he found a cave there and brought her into it, and left her in the care of his sons and went out to seek for a Hebrew midwife in the region of Bethlehem.
18.2 Now I, Joseph, was walking, and yet I did not walk, and I looked up to the air and ... saw it standing still ... And then suddenly everything went on its course.
19.1a And behold, a woman came down from the hill country and said to me, “Man, where are you going?” And I said, “I seek a Hebrew midwife.” And she answered me, “Are you from Israel?” And I said to her, “Yes.” And she said, “And who is she who brings forth in the cave?” And I said, “My betrothed.” And she said to me, “Is she not your wife?” And I said to her, “She is Mary, who was brought up in the temple of the Lord, and I received her by lot as my wife, and she is not my wife, but she has conceived by the Holy Spirit.” And the midwife said to him, “Is this true?” And Joseph said to her, “Come and see.” And she went with him.
19.2 They stopped at the entrance to the cave, and behold, a bright cloud overshadowed the cave. And the midwife said, “My soul is magnified today, for my eyes have seen wonderful things; for salvation is born to Israel.”
And immediately the cloud disappeared from the cave and a great light appeared, so that our eyes could not bear it. A short time afterwards that light withdrew until the baby appeared, and it came and took the breast of its mother Mary ...
3 And the midwife came out of the cave, and Salome met her ...
20.1 ...Salome...tested Mary's 'condition' ... [the Lord spoke] Salome came near and touched him, saying, “I will worship him, for a great king has been born to Israel.” ... she went out of the cave ... an angel of the Lord cried, “Salome, Salome, do not report what marvels you have seen, until the child has come to Jerusalem.”
21.1 And behold, Joseph was ready to go to Judea. And there took place a great tumult in Bethlehem of Judea. For there came wise men saying, “Where is the newborn king of the Jews? For we have seen his star in the east and have come to worship him” (= Matthew 2.1-2).
21.2 When Herod heard this he was troubled and sent officers to the wise men, and sent for the high priests and questioned them, “How is it written concerning the Messiah? Where is he born?” They said to him, “In Bethlehem of Judea, for thus it is written.” And he let them go. And he questioned the wise men and said to them, “What sign did you see concerning the newborn king?” And the wise men said, “We saw how an indescribably greater star shone among these stars and dimmed them so that the stars no longer shone; and so we knew that a king was born for Israel. And we have come to worship him.” And Herod said, “Go and seek, and when you have found him, tell me, that I also may come to worship him.” 3a And the wise men went out. And behold, the star which they had seen in the east, went before them until they came to the cave. And it stood over the head of the cave
(= Matthew 2.3-10)
21.3b And the wise men saw the young child with Mary his mother, and they took out of their pouch gifts: gold, and frankincense, and myrrh. 4 And having been warned by the angel that they should not go into Judea, they went to their own country by another route
(= Matthew 2.11-12)
22.1 But when Herod realized that he had been deceived by the wise men he was angry and sent his murderers and commanded them to kill all the babies who were two years old and under (= Matthew 2.16). 2 When Mary heard that the babies were to be killed, she was afraid and took the child and wrapped him in swaddling clothes and laid him in an ox manger (= Luke 2.7).
Now this king Herod, at the time when the
Magi came to him from Arabia, and said
they knew from a star which appeared in the
heavens that a King had been born in your
country, and that they had come to worship
Him, learned from the elders of your people that it was thus written regarding Bethlehem in the prophet:
‘And thou, Bethlehem, in the land of Judah,
art by no means least among the princes of Judah; for out of thee shall go forth the leader who shall feed my people’
Accordingly the Magi from Arabia came to Bethlehem and worshipped the Child, and presented Him with gifts, gold and frankincense, and myrrh; but returned not to Herod, being warned in a revelation after worshipping the Child in Bethlehem.
[essentially Matt 1:18-24 here] Then along with Mary he [Joseph] is ordered to proceed into Egypt, and remain there with the Child until another revelation warn them to return into Judæa.
But when the Child was born in Bethlehem, since Joseph could not find a lodging in that village, he took up his quarters in a certain cave near the village; and while they were there Mary brought forth the Christ and placed Him in a manger, and here the Magi who came from Arabia found Him.
I have repeated to you,” I continued, “what Isaiah foretold about the sign which foreshadowed the cave; but for the sake of those who have come with us to-day, I shall again remind you of the passage.”
Then I repeated the passage from Isaiah which I have already written [Isaiah 33:13-19] adding that, by means of those words, those who presided over the mysteries of Mithras were stirred up by the devil to say that in a place, called among them a cave, they were initiated by him/them. 
“So Herod, when the Magi from Arabia did not return to him, as he had asked them to do, but had departed by another way to their own country, according to the commands laid on them; and when Joseph, with Mary and the Child, had now gone into Egypt, as it was revealed to them to do; as he [Herod] did not know the Child whom the Magi had gone to worship, ordered simply the whole of the children then in Bethlehem to be massacred. And Jeremiah prophesied that this would happen, speaking by the Holy Ghost thus:
‘A voice was heard in Ramah,
lamentation and much wailing,
Rachel weeping for her children;
and she would not be comforted,
because they are not’
"Therefore, on account of the voice which would be heard from Ramah, i.e., from Arabia (for there is in Arabia at this very time a place called Rama), wailing would come on the place where Rachel the wife of Jacob called Israel, the holy patriarch, has been buried, i.e., on Bethlehem; while the women weep for their own slaughtered children, and have no consolation by reason of what has happened to them.
In the time of King Herod, after Jesus was born in Bethlehem of Judea, wise men from the East came to Jerusalem, asking, "Where is the child who has been born king of the Jews? For we observed his star at its rising, and have come to pay him homage."
When King Herod heard this, he was frightened and all Jerusalem with him; and calling together all the chief priests and scribes of the people, he inquired of them where the Messiah was to be born. They told him, "In Bethlehem of Judea, for so it has been written by the prophet:
'And you, Bethlehem, in the land of Judah,
are by no means least among the rulers
of Judah; for from you shall come a ruler
who is to shepherd my people Israel'."
[Micah 5.2, modified(?)]
Then Herod secretly called for the wise men and learned from them the exact time when the star had appeared. Then he sent them to Bethlehem, saying, "Go and search diligently for the child; and when you have found him, bring me word so that I may also go and pay him homage."
When they had heard the king, they set out; and there, ahead of them, went the star that they had seen at its rising, until it stopped over the place where the child was. When they saw that the star had stopped, they were overwhelmed with joy. On entering the house, they saw the child with Mary his mother; and they knelt down and paid him homage. Then, opening their treasure chests, they offered him gifts of gold, frankincense, and myrrh.
And having been warned in a dream not to return to Herod, they [the Magi] left for their own country by another path.
13 Now after they had left, an angel of the Lord appeared to Joseph in a dream and said, “Get up, take the child and his mother, and flee to Egypt, and remain there until I tell you; for Herod is about to search for the child, to destroy him.” 14 Then Joseph got up, took the child and his mother by night, and went to Egypt, 15 and remained there until the death of Herod. This was to fulfill what had been spoken by the Lord through the prophet [Hosea], “Out of Egypt I have called my son.” [Hos. 11:1]
16 When Herod saw that he had been tricked by the wise men, he was infuriated, and he sent and killed all the children in and around Bethlehem who were two years old or under, according to the time that he had learned from the wise men. 17 Then was fulfilled what had been spoken through the prophet Jeremiah:
18 “A voice was heard in Ramah,
wailing and loud lamentation,
Rachel weeping for her children;
she refused to be consoled,
because they are no more.”