xtool/contrib/mORMot/SyNode
Razor12911 39fb5ae479 support for delphi 11.1 2022-05-13 19:02:12 +02:00
..
Samples source upload 2022-01-17 22:16:47 +02:00
core_modules source upload 2022-01-17 22:16:47 +02:00
mozjs source upload 2022-01-17 22:16:47 +02:00
tools source upload 2022-01-17 22:16:47 +02:00
.gitignore source upload 2022-01-17 22:16:47 +02:00
NSPRAPI.pas source upload 2022-01-17 22:16:47 +02:00
README.md source upload 2022-01-17 22:16:47 +02:00
SpiderMonkey.pas support for delphi 11.1 2022-05-13 19:02:12 +02:00
SyNode.inc support for delphi 11.1 2022-05-13 19:02:12 +02:00
SyNode.pas support for delphi 11.1 2022-05-13 19:02:12 +02:00
SyNodeBinding_HTTPClient.pas source upload 2022-01-17 22:16:47 +02:00
SyNodeBinding_buffer.pas source upload 2022-01-17 22:16:47 +02:00
SyNodeBinding_const.pas source upload 2022-01-17 22:16:47 +02:00
SyNodeBinding_fs.pas support for delphi 11.1 2022-05-13 19:02:12 +02:00
SyNodeBinding_util.pas source upload 2022-01-17 22:16:47 +02:00
SyNodeBinding_uv.pas source upload 2022-01-17 22:16:47 +02:00
SyNodeBinding_worker.pas source upload 2022-01-17 22:16:47 +02:00
SyNodeNewProto.pas support for delphi 11.1 2022-05-13 19:02:12 +02:00
SyNodePluginIntf.pas source upload 2022-01-17 22:16:47 +02:00
SyNodeProto.pas support for delphi 11.1 2022-05-13 19:02:12 +02:00
SyNodeReadWrite.pas source upload 2022-01-17 22:16:47 +02:00
SyNodeRemoteDebugger.pas support for delphi 11.1 2022-05-13 19:02:12 +02:00
SyNodeSimpleProto.pas support for delphi 11.1 2022-05-13 19:02:12 +02:00
_SynodePluginTemplate.dpr source upload 2022-01-17 22:16:47 +02:00
build_res.sh source upload 2022-01-17 22:16:47 +02:00
core_modules.res source upload 2022-01-17 22:16:47 +02:00
synodebinding_os.pas source upload 2022-01-17 22:16:47 +02:00

README.md

The server-side JavaScript execution using the SpiderMonkey library with nodeJS modules support

  • win32/64 target (FPC 3.1.1, Delphi), linux 64 (FPC 3.1.1)
  • based on SpiderMonkey52, almost full support of ES6
  • a remote debugger protocol, can be debugged remotely using Firefox - see SyNode\Samples\02 - Bindings
  • CommonJS modules, compatible with NPM modules
  • native modules can be implemented using Delphi/FPC (as a dll/so) - see SyNode\Samples\01 - Dll Modules
  • JavaScript prototype definition based on Delphi RTTI (supported both "new" and old)

SpiderMonkey library

Precompiled binary can be downloaded here:

Or compiled from sources as described in instructions inside mozjs folder

SpiderMonkey 45 (not supported)

Precompiled binary can be downloaded here:

Embadding SyNode JavaScript files into executable

Files from core_modules folder can be embadded into executable by enabling CORE_MODULES_IN_RES define in the SyNode.inc file (enabled by default).

Compiled core_modules.res resources is commited into the git repositiry.

To create your own resource pack use a /tool/core_res tool to prepare files for embadding.

To compile rc -> res we use mingq tools under linux

sudo apt install mingw-w64 mingw-w64-tools
cd SyNode
./tools/core_res -i ./core_modules/ -o ./.resources/
cd ./resources
x86_64-w64-mingw32-windres ./core_res.rc ../core_modules.res

From inside JS files embadded into resources can be evaluated using process.binding('modules').runInThisContextRes function

Form Pascal code using TSMEngine.EvaluateRes() function