felixge / node-sandboxed-module

A sandboxed node.js module loader that lets you inject dependencies into your modules.
MIT License
342 stars 42 forks source link

v 1.0.0 fails with missing dependencies, see example with graceful-fs #33

Closed robrich closed 10 years ago

robrich commented 10 years ago

https://github.com/robrich/sandboxed-module-graceful-fs is a project showing how v. 1.0.0 fails with ENOENT, no such file or directory 'path/to/this/project/constants' on [line 262 of sandboxed_module.js] when dependencies don't exist. v. 0.3.0 didn't have this concern.

domenic commented 10 years ago

Hmm interesting. There were a lot of changes. Hope it's an easy fix. Pull request would be much appreciated...

It might be just that we're missing constants from the list of built-in modules. If you're up for testing that fix it might be an easy PR.

robrich commented 10 years ago

Similar issue posted to graceful-fs: https://github.com/isaacs/node-graceful-fs/issues/29

robrich commented 10 years ago

I haven't found any documentation on a native constants module, though because normal resolve doesn't die, I'm quite curious.

robrich commented 10 years ago

Wow, that's a bunny trail.

Based on that, check out https://github.com/felixge/node-sandboxed-module/pull/34 which asks Node for the list of native modules, and tests that we can SandboxedModule.require() a file that contains each one.