You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Sep 2, 2023. It is now read-only.
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.
The text was updated successfully, but these errors were encountered:
I'm not sure I understand the question. If you provide a context it uses that context. In JS (browser and in Node) a context has a completely new set of builtins (Array constructor etc.) and each of those has a unique identity. What you are describing seems to be the Identity Discontinuity that is known as part of the language due to browser history but becoming part of the language design itself.
Yes; Identify Discontinuity is what this is about....
I guess I just want vm.CreateContext(globalThis) (err no, that doesn't seem to work either).
If I was deliberately separating contexts I'd be less annoyed; but this code should just work within the current context, extending some existing object in the existing context...
And then I'd love to be able to just return import(spec) for newModule.link( (spec,ref)=>import(spec)) or have SyntheticModule just take an object as a reference and do all the key looping itself.... (the actual code only actually does a native import if there's no leading '/')
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
The text was updated successfully, but these errors were encountered: