-
Notifications
You must be signed in to change notification settings - Fork 31
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Replace therubyracer with execjs #18
Comments
@jirutka I totally like the idea, but I'm not sure how easy it is to implement. It seems execjs has the lowest common denominator of features from the different engines, so it may not support everything we need. Do you have a good execjs tutorial or a project already implementing it? I couldn't, for example, Anyway - I'd totally love a PR, but a good example showing how to use execjs could also help to get this done 👍 |
Me neither. I thought that it should be easy, but after reading the code and ExecJS API, I’m afraid that it will not be so easy.
I’ve tried to find some examples, but without much success. I think that it’d be more feasible to reimplement the whole initialization logic in JavaScript and just pass data from Ruby as a serialized JSON object. Something like in https://github.com/18F/jekyll_pages_api_search. |
I'd really love to see your PR 😆😇 Jokes aside, that may be a lot of work for not-that-much gain. I know installing therubyracer is an issue itself, but "it works on my machine", he. I don't see we're doing this in the short term, unless we find a really good reason to do it ¯\_(ツ)_/¯ |
I gave it a try (PR #24) In the end it was more like a search-and-replace task, because the core logic didn't change. The hardest part was translating the Ruby-JS/V8 mixture to pure JS. I'm not 100% sure this is the correct way and there's certainly room for improvement, but "it works on my machine" 😉 I tested it sucessfully with Duktape and nodejs. JScript didn't work, but that's because the Lunr code cannot be executed by JScript. |
When user already has nodejs installed, (s)he really don’t want to install
therubyracer
and compile v8. It’s very problematic, does not work in many environments (e.g. on grsecurity kernel), other Ruby implementations, and takes long time to compile.The correct solution is to use execjs which allows to use various runtimes.
The text was updated successfully, but these errors were encountered: