hmm, ok. So, I'll also try to rope some of your related comments from another thread into here to find a solution that could work.
I think the most straightforward solution would be to have a special, exotic object exist on globalThis, say, globalThis.useInitialDirectiveAllowed. When a module is first loaded, if 'use initial'
is present, it'll check for the existence of this exotic object on globalThis. If it exists, then useInitial will work as expected. If it does not exist, then either an error will be thrown during load time, or the 'use initial'
directives will be silently ignored.
Anyone who's written first-run code that white-lists certain globals and auto-deletes anything it does not recognize will continue to work as expected. This exotic object would automatically be deleted, and no later-run code would have access to non-white-listed built-ins.
This is a blunt solution, but hey, it works. It also frees us to brainstorm an additional, "finer-comb" solution if wanted, that let's people disable individual APIs on globalThis (that will be disabled, even when 'use initial'
is used) such as @rdking proposed, without fear of breaking backwards compatibility.