Earlier independence of Indonesia (Pre-1900)

In the OTL, Indonesia becomes independent in 1945. So what if in this AH scenario by some event, Indonesia or at least one of the major Indonesian states won their independence against the Dutch rule before 1900s?

So, was it possible for Indonesia or any Indonesian state to be independent from the Dutch before 1900s?
I can’t really think of many that don’t involve simply becoming someone else’s colony, but perhaps with a napoleonic victory tl, that manages to keep Haiti by acknowledging a vassal like independent relationship and then roll that out to the rest of the colonies if movements agitate for independence, and then when napoleonic france crumbles, you already have the centralised state with native control but just now it’s fully sovereign and able to resist future incursion.
By the way, I've noticed there's already a similar thread on the same subject as this one.

If I have to say, mayhaps Diponegoro's rebellion can be the starting point for early Indonesian independence.
The challenge you face isn't earlier Indonesian independence; most of the states in the archipelago are de jure independent until 1800, and the last hold-outs aren't brought under Dutch colonial control until 1900.

The challenge is limiting Dutch or European influence sufficiently that one or more Indonesian powers can play them off against one another and remain independent.

So, a couple of parameters. First, East Indonesia's getting colonized; nothing's well-organized enough to stand up to first the Portuguese and later the Dutch in time. Add that to the sheer value the spices endemic to East Indonesian islands represent, and you're going to see colonization there. It's possible you get independent but associated kingdoms in Ambone or Maluku; these areas converted to Christianity both early and thoroughly, so in a context of less intensive colonialization, they could emerge first as protectorates and later as independent states.

Your best bets, then, are Java and Sumatra. Particularly, the Mataram Kingdom and/or the Sultanate of Aceh [which IIRC was conquered pretty late anyway].

For the most dramatic effect, you'd need an effective Mataram consolidation of control over Java. Easiest time and place to do this is probably under Agong [SIC?], which is, I believe, the 1630s. If he and his Mataram predecessors have more success unifying Java, they might limit the Dutch colonial enclave significantly early on.

But you need one more POD; after all, Mataram was a pretty powerful state in the time period even OTL, and the Dutch were still able to split their kingdom. What you really need is a real competitor to the Dutch. So, imagine the British take the Dutch enclave in Java during one of the Anglo-Dutch conflicts [say the 1660s one, for argument's sake]. It eventually gets handed back over, but Britain establishes diplomatic relations with Mataram, and the Mataram kings realize they can play the Dutch and British off against one another.

If they're good enough at doing this over the long-term, Java could, theoretically, stay independent long enough to have some sort of Maiji-style reformation in the 1800s.

The problem, though, is that you probably don't get a fully unified Indonesia that way. IMO, the thing that was most formative in the creation of the idea of Indonesia was a combination of Dutch colonial rule with the patterns of Hajj that existed--and were tacitly encouraged by the the Dutch--throughout the 1800s. If Mataram is independent, then Javanese pilgrims will have a different pattern of pilgrimage, and a different self-identification, than OTL, plus you won't have the unifying experience of colonial rule. So Java is probably its own thing, with some sort of post-colonial state in the East, and, well, almost anything could happen on Bornio, Sumatra and Bali.

For a couple English-language references: the single best English-language history of the entire post-Islamicization history of the archipelago is Ricklefs' History of Indonesia. It's actually the starting text one of the best Indonesia scholars in the U.S. recommended to me, and if you're doing an Indonesia-based AH and read English as your primary language, Ricklefs is a must. For 1900 and after, Robert Elson's The Idea of Indonesia is excellent and readable. If you're really interested in 19th-century Islam in the archipelago, Michael Francis Laffan has two books that are useful: Umma Below the Winds and The Makings of Indonesian Islam. And Martin Van Bruinessan is also quite good on historical and contemporary expressions of Islam in Indonesia.

I have a lot of other suggested sources, but they're all from the post-independence period. For example, Faisal Ismail's study of the relationship between Pancasila and Muslim organizations in Indonesia is excellent, but really only a few bits of the intro and first chapter are helpful with a pre-1900 POD.