This repository was archived by the owner on Sep 2, 2023. It is now read-only.

Description
recently updated to attempting to use SourceTextModule so I could use import in scripts from the server; like I have been doing on the client side; in order to reduce places where the same classes are defined in entirely different files (especially when one was cjs and one mjs).
I'm now running into lots of problems like 'if( obj instanceof ArrayBuffer )' fails; and I have to now do if( obj instanceof ArrayBuffer || Object.getPrototypeOf(obj).constructor.name === "ArrayBuffer" ) I guess having a new context means having new instances of everything including 'Array' so if I register a handler for some existing classes, I have to re-register the same handler for a whole new family of classes.
Why can't I just use my existing context? Why do I have to wrap modules in other modules; although I can pass existing preloaded imports in the vm.Context... if I know to specify "Array","ArrayBuffer",.... (all known types?!) in the context, I wonder if that would be used first instead of the context builtins.
related : nodejs/help#3068 - on wrapping imports in SyntheticModules...
Due to the security requirements for getting the code in the first place, there is no alternative but to manually evaluate it on the slave side; I have all the linking working; but now I have to re-comb through a bunch of code a make it assume it's not ever running in the same context as itself.