Open Fishrock123 opened 8 years ago
nucleus.base
and nucleus.compile
should be quite easy now if someone wants to pick them up -- the relevant base_path
handling code already exists in the code base, as well as a compile function for dofile
.
Hmm, looks like this guide is a bit out of date, will update soon. Most of the core bits should still be correct though.
Edit: done, I think.
From https://github.com/nucleus-js/design/blob/master/api/nucleus.md
Guide
Properties should be added in
src/nucleus.rs
.The Duktape API is documented at http://duktape.org/api.html
Functions should be put in
src/nucleus_functions.rs
and accessed vianucleus_functions::your_fn
. Functions should be exposed under this comment insrc/nucleus.rs
in the following manner:If new duktape APIs are necessary they should probably be exposed in
src/duk_api.rs
for easy use and re-use.A direct declaration of the duktape C api is required in the
extern { }
block.The new exposed API should then drop the
duk_
(it will be accessed viaduk::
) and handle the unsafe block and any major type conversions (such asCString
).New command line options can be added to this code in
src/main.rs
.System
nucleus.cmd
nucleus.args
nucleus.rawArgs
nucleus.exit(code)
nucleus.getenv(name) -> value
nucleus.setenv(name, value)
nucleus.unsetenv(name)
nucleus.envkeys(showHidden) -> array of keys
Runtime
nucleus.engine
nucleus.compile(string, path) -> function
Resources
nucleus.base
nucleus.versions
nucleus.readfile(path) -> data
nucleus.scandir(path, onEntry(name, type)) -> exists
nucleus.dofile(path) -> value
nucleus.pathjoin(...parts) -> path