aabtop / reify

Reify lets you embed a customized TypeScript runtime within a C++ application.
MIT License
6 stars 0 forks source link

Design/implement model for references to external user-defined modules. #6

Closed aabtop closed 4 years ago

aabtop commented 4 years ago

While module support is provided by the existing system, users can still not load additional external modules, only internal modules compiled into the executable.

We need to design a model for how users can reference other modules, and implement it.

Perhaps something like letting the user specify a workspace root directory, and then all referenced modules will be relative to that?

aabtop commented 4 years ago

Okay 5818ed25a7fa70d026717af43bf0195e88f51aa7 now implements this functionality.

The design is:

Only modules that are sibling files or within a child directory of the primary module can be accessed. In the future, we may want to introduce the concept of "project directory" that is set via a command line parameter where only files within that directory can be accessed.

Multiple systems are interested in this "virtual filesystem" (the entity that would own project directory concept). e.g. the "mesh loader" might want to share the same restrictions. I may consider creating a system to formally capture this logic and then pass a reference of that to both the mesh loader and the typescript module.