admin管理员组

文章数量:1431420

I'd like to use some CommonJS pliant modules in some of my scripts. Those scripts are just meant to do things on my laptop: it's not in the browser, it's not really in the server either. I just manipulate a mongodb that I use locally.

So I wonder, what is the best way to do that? I only found outdated wrappers that would provide CommonJS capabilities and the mongo shell.

Should I handcode a require system? Should I handcode a workaround? Is there already a minimal loader existing?

All your ideas regarding the matter will be appreciated, for sure.

Pointers towards implementation of other parts of CommonJS would be appreciated too.

I'd like to use some CommonJS pliant modules in some of my scripts. Those scripts are just meant to do things on my laptop: it's not in the browser, it's not really in the server either. I just manipulate a mongodb that I use locally.

So I wonder, what is the best way to do that? I only found outdated wrappers that would provide CommonJS capabilities and the mongo shell.

Should I handcode a require system? Should I handcode a workaround? Is there already a minimal loader existing?

All your ideas regarding the matter will be appreciated, for sure.

Pointers towards implementation of other parts of CommonJS would be appreciated too.

Share Improve this question edited Sep 12, 2012 at 17:46 m09 asked Sep 1, 2012 at 8:29 m09m09 7,5213 gold badges33 silver badges61 bronze badges 6
  • 1 Is there a reason that node.js wouldn't work here? – Joe Commented Sep 6, 2012 at 16:59
  • Well node.js does work here but I'd rather use the mongo shell and another way to include monJS modules – m09 Commented Sep 6, 2012 at 17:01
  • Ah - your question didn't really mention using mongo shell as a requirement. – Joe Commented Sep 6, 2012 at 17:17
  • well mongo shell is just an extended SpiderMonkey so a good general answer should fit – m09 Commented Sep 6, 2012 at 17:19
  • There is a list on the monjs website. Several of these wrap SpiderMonkey. – Steve Campbell Commented Sep 7, 2012 at 21:09
 |  Show 1 more ment

1 Answer 1

Reset to default 10 +500

@Mog

You should try out http://code.google./p/gpsee/ which is having general-purpose C API for embedding SpiderMonkey & CommonJS.

本文标签: javascriptMinimal CommonJS implementationStack Overflow