• Stars
    star
    175
  • Rank 218,059 (Top 5 %)
  • Language
    JavaScript
  • Created over 5 years ago
  • Updated over 1 year ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Native ESM Package Manager

reg - Native ESM Package Management

reg is a package manager for native ES Modules. It's built to enable dependency management for Universal JavaScript (JavaScript that can run in the Browser and in Node.js w/o a compiler).

This library is highly experimental and still likely to break without notice. DO NOT USE THIS IN PRODUCTION.

Supporting Universal JavaScript is quite difficult as the Browser's module system has a very unique set of constraints. In order to build effective dependency management on-par with the features you'd expect from npm the approach reg takes is radically different.

reg statically links the dependency tree by hash reference, re-writing the import statements of the output files (this is the only alteration to your source file reg does, it is not a compiler). A package registry is then just a namespace that maps users, package names, and versions to specific package hashes. You can then directly import the resulting package references in a Browser or in Node.js with a special loader.

Note: since this is built for Universal JavaScript, you cannot use any of the Node.js standard library or any packages from npm since none of this is available in Browsers without a compiler.

CLI

reg input-file.js

This command takes an input file, statically links the dependency tree, stages it in a local cache and executes the input file.

reg @mikeal/test/1.0.0

The same command can also take a package reference from the registry.

reg publish <filename> <name> <semver>

Publish an input file to a package to the registry.

Positionals:
    filename  Filename of script to run. Example `reg input.js`
    semver    Package version number.

    Options:
      --help     Show help
      --version  Show version number
      --token    GitHub personal access token
                 Defaults to process.env.GHTOKEN || process.env.GITHUB_TOKEN

Note that this command requires a GitHub Token that only needs enough permissions to validate the user, no write or read access to any of your repositories are required.

All package names must be proceeded by the user's GitHub username. There are currently no top level packages.

Developer CLI

There are several more commands that have been useful while developin this software. They may eventually be removed from the public API.

Run a local script file in reg

Commands:
  cli.js stage <filename>                   Run the linker and stage the tree in
                                            local cache
  cli.js linker <filename>                  Run the static linker
  cli.js info <name>                        Get info for named alias
  cli.js cat <name>                         Print the file data for the named
                                            alias
  cli.js pkg-info <cid|name>                Get package information

Data Model

reg implements a data model for its package data that is similar to git in many ways. The highlights of this data structure are:

  • Optimized for offline, sync, and decentralization (just like git!)
  • A module is only a single file (the Browser requires this) with the dependency tree attached.
  • Every module gets a unique hash (like a git commit) which means cache de-duplication works across differing module names and version.
  • Every file is chunked with an algorithm called Rabin which creates good block boundaries for diffing (this is what rsync uses). This gives us sub-file de-duplication in cache which is especially useful for de-duplicating file parts between versions.

This data structure also enables some important HTTP/2 features we need in order to be competitive with bundle performance.

  • HTTP/2 Push for all of the dependencies required by a single import.
  • If an old e-tag is presented for a module, reg can diff the two dependency trees and use HTTP/2 Push of only the assets that have changed.

For a more detailed look at the data structure you can read the schema.

Some visual examples follow:

IMG_0306

IMG_0307

IMG_0308

IMG_0309

IMG_0310

IMG_0311

More Repositories

1

r2

HTTP client. Spiritual successor to request.
JavaScript
4,473
star
2

bent

Functional JS HTTP client (Node.js & Fetch) w/ async await
JavaScript
2,198
star
3

roll-call

πŸ“ž Free and reliable audio calls for everyone w/ browser p2p.
JavaScript
1,566
star
4

watch

Utilities for watching file trees in node.js
JavaScript
1,273
star
5

spider

Programmable spidering of web sites with node.js and jQuery
JavaScript
725
star
6

webtorrent-element

WebTorrent HTML element.
JavaScript
526
star
7

merge-release

Automatically release all merges to master on npm.
JavaScript
468
star
8

node.couchapp.js

Utility for writing couchapps.
JavaScript
407
star
9

tako

Functional web framework.
JavaScript
320
star
10

sequest

Simplified API for SSH and SFTP similar to request.
JavaScript
283
star
11

filed

Simplified file library.
JavaScript
282
star
12

daily

What’s happening in Open Source. Everyday πŸ€“
JavaScript
262
star
13

dropub

P2P publishing for everyone.
Vue
222
star
14

IPSQL

InterPlanetary SQL
JavaScript
208
star
15

znode

Bi-directional RPC through any stream.
JavaScript
205
star
16

node-utils

A collection of small, simple, and useful node packages.
JavaScript
173
star
17

markdown-element

HTML Element that renders markdown content.
JavaScript
137
star
18

dagdb

Syncable database built on IPLD
JavaScript
135
star
19

publish-to-github-action

A GitHub Action to push any local file changes, including new files, back to master
Dockerfile
109
star
20

browsercouch

CouchDB in the browser
JavaScript
98
star
21

rza

Create simple HTML elements
JavaScript
92
star
22

prolly-trees

Hash consistent search trees.
JavaScript
89
star
23

gza

Functional custom HTML elements.
JavaScript
88
star
24

self-care

Discussion repo for developers to share their self-care routines
88
star
25

shaolin

The easiest way to build Web Components.
JavaScript
87
star
26

snapkit

Capture screenshots of websites on command line or REST API.
JavaScript
83
star
27

jaws

Build HTTP applications as a cache.
JavaScript
77
star
28

killa-beez

🐝 We on a WebRTC Swarm!
JavaScript
73
star
29

response

πŸ„πŸ» Streaming and mutation API for HTTP responses.
JavaScript
73
star
30

node.couch.js

CouchDB + node.js == Crazy Delicious
JavaScript
70
star
31

couchup

A CouchDB implementation on top of levelup.
JavaScript
66
star
32

jspp

JavaScript Pre-Processor
JavaScript
60
star
33

vuejs-electron-demo

Simple Vue.js Electron demo
Vue
59
star
34

zcomponent

DEPRECATED: Use rza for a class based approach or gza for a functional approach.
JavaScript
57
star
35

vanilla

Compile-to-JavaScript language for people that write JavaScript
JavaScript
55
star
36

dkv

Decentralized key-value store running on IPFS
JavaScript
53
star
37

replicate

A customizable CouchDB replicator in node.js.
JavaScript
52
star
38

cappadonna

Headless browser testing for tap with coverage reporting.
JavaScript
48
star
39

tweetstream

node.js stream API for the twitter streaming HTTP API
JavaScript
47
star
40

way-of-code

Organizing my thoughts about the process and states of mind of programming
45
star
41

distjs

Distribute standalone WebComponents w/ npm.
JavaScript
41
star
42

ipjs

Universal JavaScript Build and Packaging
JavaScript
41
star
43

planet

A node.js planet (blog aggregator)
CSS
40
star
44

morestreams

Collection of useful stream objects.
JavaScript
40
star
45

funky

πŸ’ͺ🏿 Front-end view system using basic functional programming and template literals.
JavaScript
40
star
46

couchdb-pythonviews

Python view server for CouchDB.
JavaScript
40
star
47

bytesish

Cross-Platform Binary API
JavaScript
35
star
48

stud-proxy

Round Robin proxy/balancer for the stud TLS terminator
JavaScript
33
star
49

dbemitter

EventEmitters for remote database events
JavaScript
32
star
50

couchdb-wsgi

WSGI compliant handler for CouchDB external processes.
Python
32
star
51

getport

Find an open port to listen on.
JavaScript
32
star
52

redcouch

A client that stores data in both CouchDB and Redis.
JavaScript
32
star
53

sustainable-oss

Sustainable Open Source: The Book (Maybe)
31
star
54

nodeconf2013

NodeConf 2013 Planning and Sessions
JavaScript
31
star
55

SLEEP

Implementation of the SLEEP protocol.
JavaScript
29
star
56

bundle-size-action

Calculate the bundle size of your module. Useful for GitHub Actions.
JavaScript
28
star
57

occupy

Deployment for the 99%
JavaScript
28
star
58

ipfs-elements

HTML Elements for IPFS.
JavaScript
27
star
59

estest

ESM native testing across all JS platforms.
JavaScript
24
star
60

couchcache

CouchCache is a finely tuned caching HTTP proxy for CouchDB written in node.js
JavaScript
24
star
61

ZDAG

JSON/CBOR style format as a compressor
JavaScript
24
star
62

couch

Stupid simple Couch wrapper based on Request
JavaScript
24
star
63

framework

A framework for node.js (inspired by vapor.js)
JavaScript
23
star
64

sst

Super Simple Test Format
23
star
65

raindrop

git checkout of the labs.mozilla.com/raindrop hg repo
JavaScript
22
star
66

hostproxy

HTTP Proxy that searches for Host header and avoids any parsing
JavaScript
22
star
67

relaximation

Some relaxed automation
JavaScript
21
star
68

learnjs

Workshopper for learning JavaScript.
JavaScript
21
star
69

compretend

Web application building blocks power by ML.
JavaScript
20
star
70

buddhism.js

Buddhist concepts as JavaScript
20
star
71

webtouch

Validate that a web site and all its required resources are available.
JavaScript
20
star
72

couchie

Minimalist localStorage database API. Works well as a cache for CouchDB documents.
JavaScript
20
star
73

lucass

Lightweight Universal Content Addressable Storage Spec
JavaScript
18
star
74

peer-room

Ephemeral and secure peer-to-peer chat rooms.
JavaScript
17
star
75

requirein

A require() that works in a specified directory.
JavaScript
17
star
76

jsonfiles

Simple database as flat JSON files.
JavaScript
17
star
77

bong-bong

Open public chat service built for the web.
JavaScript
17
star
78

siofile

Stream a file to a socket.io client.
JavaScript
16
star
79

signal-exchange

WebRTC signal exchange using public keys and socket.io
JavaScript
16
star
80

mikeal.js

My blog code, node-couchapp and sammy.js code.
JavaScript
16
star
81

brrp

ESM bundle npm modules for browsers and nodejs
JavaScript
15
star
82

tasked

Background task state machines on top of CouchDB.
JavaScript
15
star
83

stoopid

Loggers are stupid and I'm resentful that I had to write this.
JavaScript
15
star
84

deferred

Deferred objects without Twisted
Python
15
star
85

methodman

Bidirectional rpc and streams for WebSockets and WebRTC.
JavaScript
14
star
86

iterp

Controlled parallelism w/ async iterables.
JavaScript
14
star
87

block-box

Universal hash addressed block container.
JavaScript
14
star
88

node.proxy.js

HTTP Proxy for node.js
JavaScript
14
star
89

go-stats

Crunching some data on the size of the Go ecosystem.
JavaScript
14
star
90

pushdb

A programmable database with document storage and unique indexing capabilities.
JavaScript
13
star
91

car-transaction

IPLD transaction as CAR buffer [for use in databases]
JavaScript
13
star
92

matrika

Next Generation Decentralized Database
JavaScript
13
star
93

level-mutex

Mutex read/write lock for levelup.
JavaScript
13
star
94

php-analytics

Scripts to pull down dependency analytics for PHP packages.
JavaScript
13
star
95

githubarchive

Streaming parsers for the github archive.
JavaScript
12
star
96

requestdb

A request wrapper that stores and retrieves responses from a leveldb cache.
JavaScript
12
star
97

brasstacks

A large scale results and graphing server using CouchDB.
JavaScript
12
star
98

waudio

Web Audio made sane.
JavaScript
12
star
99

logref

Logging for node.js
JavaScript
12
star
100

libp2p-simple

Pre-configured libp2p for browser and node.js.
JavaScript
12
star