Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

JavaScript (engine) Version Updater

License

NotificationsYou must be signed in to change notification settings

GoogleChromeLabs/jsvu

Repository files navigation

jsvu is theJavaScript (engine)VersionUpdater.

jsvu makes it easy to install recent versions of various JavaScript engines without having to compile them from source.

Installation

Note:jsvu requires Node.js v18+. (jsvu follows the latestactive LTS version of Node.)

Install thejsvu CLI:

npm install jsvu -g

Modify your dotfiles (e.g.~/.bashrc) to add~/.jsvu/bin to yourPATH:

export PATH="${HOME}/.jsvu/bin:${PATH}"

Then, runjsvu:

jsvu

On first run,jsvu prompts you for your operating system and architecture, and the list of JavaScript engines you wish to manage throughjsvu. It then downloads and installs the latest version of each of the engines you selected.

To update the installed JavaScript engines later on, just runjsvu again.

Supported engines per OS

JavaScript engineBinary namemac64mac64armwin32win64linux32linux64
GraalJSgraaljs
Hermeshermes &hermes-repl
JavaScriptCorejavascriptcore orjsc*
QuickJS-ngquickjs
SpiderMonkeyspidermonkey orsm
V8v8
V8 debugv8-debug
XSxs

* JavaScriptCore requires external dependencies to run on Windows:

  • On 32-bit Windows, installiTunes.
  • On 64-bit Windows, download the latestWebKitRequirements and add itsbin64 directory to yourPATH.

Integration witheshost-cli

eshost-cli makes it easy to run and compare code in all JavaScript engines thatjsvu installs.

First, installeshost-cli:

npm install -g eshost-cli

Then, either automatically configurejsvu-installed hosts:

eshost --configure-jsvu

…or telleshost-cli wherejsvu installs each JavaScript engine following the instructions below.

Linux/Mac

eshost --add'GraalJS' graaljs~/.jsvu/bin/graaljseshost --add'JavaScriptCore' jsc~/.jsvu/bin/javascriptcoreeshost --add'QuickJS' qjs~/.jsvu/bin/quickjseshost --add'SpiderMonkey' jsshell~/.jsvu/bin/spidermonkeyeshost --add'V8 --harmony' d8~/.jsvu/bin/v8 --args'--harmony'eshost --add'V8' d8~/.jsvu/bin/v8eshost --add'XS' xs~/.jsvu/bin/xs

Windows

eshost --add"GraalJS" graaljs"%USERPROFILE%\.jsvu\bin\graaljs.cmd"eshost --add"JavaScriptCore" jsc"%USERPROFILE%\.jsvu\bin\javascriptcore.cmd"eshost --add"SpiderMonkey" jsshell"%USERPROFILE%\.jsvu\bin\spidermonkey.cmd"eshost --add"V8 --harmony" d8"%USERPROFILE%\.jsvu\bin\v8.cmd" --args"--harmony"eshost --add"V8" d8"%USERPROFILE%\.jsvu\bin\v8.cmd"eshost --add"XS" xs"%USERPROFILE%\.jsvu\bin\xs.cmd"

That’s it! You can now run code snippets in all those engines with a single command:

eshost -e'new RegExp("\n").toString()'# https://crbug.com/v8/1982eshost -e'(function maxCallStackSize() { try { return 1 + maxCallStackSize(); } catch (_) { return 1; }}())'eshost -e'Date.parse("1 Octopus 2018")'

Integration with non-interactive environments

On your personal devices, the only command you’ll ever need isjsvu as described above. There are no command-line flags to remember. 👋🏻

However, there are use cases for running jsvu within non-interactive environments (e.g. as part of continuous integration), where it’s desirable to bypass the initialjsvu prompt asking to confirm your operating system, architecture, and the list of JavaScript engines to install. Here’s how to do that:

jsvu --os=linux64 --engines=all# Equivalent to:jsvu --os=linux64 --engines=graaljs,hermes,javascriptcore,quickjs,spidermonkey,v8,xs

If the operating system and architecture are not known in advance, the--os=default flag attempts to guess the correct value from the running environment. This might not be right for example if running a 32-bit Node.js process on a 64-bit machine.

Note that--engines=all does not install thev8-debug binaries.

Installing specific versions

jsvu also supports installing specific versions alongside the main engine binaries (which it keeps up to date). Here’s an example:

jsvu v8@7.2.502

Binaries installed using this method are named${BINARY}-${VERSION}, so that the above example installs a binary namedv8-7.2.502. This way, there’s never any conflict with the mainv8 binary, which jsvu can keep up to date.

This feature works for all the supported engines:

jsvu graaljs@20.2.0jsvu hermes@0.6.0jsvu javascriptcore@242640jsvu quickjs@2019-08-18jsvu spidermonkey@66.0b13jsvu v8@7.2.502jsvu v8-debug@7.1.302jsvu xs@8.7.0

If you pass in an invalid version number, or if the JavaScript engine creators don’t provide a precompiled binary for that specific version, jsvu shows an error.

As a shorthand, forv8 andv8-debug builds, jsvu can even figure out the last known good revision within amilestone. To install the latest available V8 v7.2.x for example, run:

jsvu v8@7.2# jsvu figures out that this means v7.2.502, and then installs that version.

Security considerations

jsvu avoids the need forsudo privileges by installing everything in~/.jsvu/bin rather than, say,/usr/bin.

jsvu downloads files over HTTPS, and only uses URLs that are controlled by the creators of the JavaScript engine or, in the case of JavaScriptCore on Linux, the port maintainers.

For maintainers

How to publish new releases

  1. On themain branch, bump the version number inpackage.json:

    npm version patch -m'Release v%s'

    Instead ofpatch, useminor ormajoras needed.

    Note that this produces a Git commit + tag.

  2. Push the release commit and tag:

    git push&& git push --tags

    Our CI then automatically publishes the new release to npm.

Author

Mathias Bynens (@mathias)

About

JavaScript (engine) Version Updater

Topics

Resources

License

Contributing

Stars

Watchers

Forks

Packages

No packages published

[8]ページ先頭

©2009-2025 Movatter.jp