npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

wasm-git

v0.0.13

Published

Wasm-git ======== (Wasm should be pronounced like `awesome` starting with a `W` ).

Downloads

360

Readme

Wasm-git

(Wasm should be pronounced like awesome starting with a W ).

GIT for nodejs and the browser using libgit2 compiled to WebAssembly with Emscripten.

The main purpose of bringing git to the browser, is to enable storage of web application data locally in the users web browser, with the option to synchronize with a remote server.

Demo in the browser

A simple demo in the browser can be found at:

https://wasm-git.petersalomonsen.com/

Please do not abuse, this is open for you to test and see the proof of concept

The sources for the demo can be found in the githttpserver project. It shows basic operations like cloning, edit files, add and commit, push and pull.

Demo videos

Videos showing example applications using wasm-git can bee seen in this playlist. Wasm-git is used for local and offline storage of web application data, and for syncing with a remote server.

Examples

Wasm-git packages are built in two variants: Synchronuous and Asynchronuous. To run the sync version in the browser, a webworker is needed. This is because of the use of synchronous http requests and long running operations that would block if running on the main thread. The sync version has the smallest binary, but need extra client code to communicate with the web worker. When using the sync version in nodejs worker_threads are used, with Atomics to exchange data between threads.

The async version use Emscripten Asyncify, which allows calling the Wasm-git functions with async / await. It can also run from the main thread in the browser. Asyncify increase the binary size because of instrumentation to unwind and rewind WebAssembly state, but makes it possible to have simple client code without exchanging data with worker threads like in the sync version.

Examples of using Wasm-git can be found in the tests:

The examples shows importing the lg2.js / lg2-async.js modules from the local build, but you may also access these from releases available at public CDNs.

Building and developing

The Github actions test pipeline shows all the commands needed to install dependencies, build the packages and run the tests.

Another option is loading the repository into a github codespace, where the configuration in .devcontainer folder will be used to install dependencies and set up a full development environment.

Emscripten fixes that were needed for making Wasm-git work

As part of being able to compile libgit2 to WebAssembly and run it in a Javascript environment, some fixes to Emscripten were needed.

Here are the Pull Requests that resolved the issues identified when the first version was developed:

  • https://github.com/emscripten-core/emscripten/pull/10095
  • https://github.com/emscripten-core/emscripten/pull/10526
  • https://github.com/emscripten-core/emscripten/pull/10782

for using with NODEFS you'll also need https://github.com/emscripten-core/emscripten/pull/10669

All of these pull requests are merged to emscripten master as of 2020-03-29.