sandbox-editor v0.0.19
sandbox-editor
NPM module for editing JS files in the browser and execute them inside a sandbox environment. Usage here, live demo here. Command line interface:
sandbox-editor [--type raw] --path foo.js [--basedir .] > foo-sandbox.jsIn the browserify sandbox, the nodejs pseudo global variables are always available: module, exports, require, __filename, __dirname.
__filename and __dirname are the (absolute) path of the current script relative to options.basedir.
As for the nodejs genuine global variables, if they are not already defined they are declared as:
global: the global object.process: ifoptions.noprocessis truthy then it is an empty object else it is the browserify process shim.Buffer: ifoptions.nobufferis truthy then it is an empty object else it is the browserify buffer shim.
Note that require("process") and require("buffer") are always available and consistent with their respective globally declared value.
RawSandbox
type :: stringpath :: stringcontent :: string
BrowserifySandbox
type :: stringpath :: stringcontent :: stringmodules :: [string]require :: string
Sandbox = require("sandbox-editor/sandbox");
Sandbox :: objectsandbox = raw(path, options, callback)path :: stringoptions :: objectbasedir :: stringeditor :: ace.c9.editor.Options
callback(error, sandbox)error :: Errorsandbox :: sandbox-editor.RawSandbox
sandbox = browserify(path, options, callback)path :: stringoptions :: objectbasedir :: stringeditor :: ace.c9.editor.Optionsnoprocess :: booleannobuffer :: boolean
callback(error, sandbox)error :: Errorsandbox :: sandbox-editor.BrowserifySandbox
editor = require("sandbox-editor")(container, sandbox, options)
container :: dom.Elementsandbox :: sandbox-editor.Sandboxoptions :: ace.c9.Editor.Optionseditor :: brace.Editorsandbox = getSandbox()sandbox :: sandbox-editor.Sandbox
script = getScript()script :: string
7 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago