The Talmud records the tradition that Joshua wrote the book of Joshua, with the exception of the last few verses. The book itself names no author, and there is no way, at this late date, to know who wrote it or whether the book had more than one author.
Whoever the author(s), the book itself names one of the sources to which he/she had access. The book of Jashar is cited in 10:13. Another book is mentioned in 18:9, though its name is not recorded. It is reasonable to assume that the descriptions of these territories as they were allotted to the remaining seven tribes could have been taken from this unknown book. The same could be true of the list of the cities of refuge and the list of the Levitical cities. These and other records would have been available to the author(s) of Joshua. It is also possible that Joshua and/or some of his officers wrote some accounts of their adventures, which survived long enough to be used in writing the book.
If indeed so many sources were available, we can, in one sense, speak of a compiler(s) of the book. Yet a historical writer, even though utilizing historical sources for the whole of an account, still is an author. It is the author who decides what material to use, what emphasis to give it, how the various events shall be arranged, and what shall be the theme(s) of the work, and from what perspective he/she will write the account. This is the task to which the prompting of God's Holy Spirit set the author(s) of Joshua.
When was Joshua written? Dates as early as Joshua himself and as late as the postexilic period of Judah's history (sixth-fifth centuries b.c.) have been proposed. An extremely late dating of the book may be rejected, though there is not space here to enumerate the reasons. The availability of the kinds of written source material mentioned above and the repetition of the phrase “until this day” (it appears twelve times) seem to indicate that the author was not Joshua. A date some time in the period of the united monarchy would be a reasonable assumption, though the later monarchy cannot be ruled out on the basis of present evidence.