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

@rbxts/sapphire

v0.1.2-ts.1

Published

A lightweight module loader or a batteries included framework

Downloads

5

Readme

sapphire

A lightweight module loader or a batteries included framework

Vision

  • A simple, short module loader that can be extended into a fully fledged framework taking care of networking, logging, data, ECS system scheduling, etc.
  • roblox-ts support
  • By default can be as simple as:
local sapphire = require("@packages/sapphire")
local singletons = ...

sapphire()
    .add_singletons(singletons)
    .start()
  • Singletons don't have to require sapphire itself for anything:
local singleton = {}

function singleton.start()
end

return singleton
  • Singletons can have priority by specifying an optional priority property:
local singleton = {}
singleton.priority = 1234
  • Doesn't use any custom module loaders, depends on require() to not sacrifice types:
local dependency = require("@singletons/dependency")
  • Can be extended with .use(), which instantly runs a singleton that can add extra functionality:
type extension = {
    start: (sapphire) -> (), -- extensions' `.start()` lifecycle is additionally called with the framework itself
    lifecycles: { [string]: () -> () }, -- to add extra lifecycles to singletons
}
type use = (extension) -> builder
local sapphire_lifecycles = require("@packages/sapphire_lifecycles")
local sapphire_net = require("@packages/sapphire_net")

sapphire()
    .use(sapphire_lifecycles) -- Adds extra lifecycles
    .use(sapphire_net) -- Initializes the networking library
-- Extensions are ran instantly! `sapphire_net` can use a `.heartbeat()` lifecycle if `sapphire_lifecycles` adds it, but also `sapphire_lifecycles` can't use any features from `sapphire_net`
  • If an extension needs complex functionality and doesn't need custom functionality or functionality that doesn't exist, it should use an existing libary. For example:
    • A sapphire_lifecycles extension wouldn't need any complex functionality and wouldn't use any library
    • A sapphire_net extension would be different from existing networking libraries and wouldn't use any networking library, but would use a library such as Squash to not re-implement serdes
    • A sapphire_ecs or sapphire_data extension wouldn't need any new functionality so it would use an existing library like ECR or keyForm (in order)

Todo

  • [ ] Set up project
  • [ ] Make basic, extensible module loader
  • [ ] Add pre-built extensions:
    • [ ] sapphire_lifecycles - extra lifecycles for RunService and Players
    • [ ] sapphire_logging - a nice logging library with a log history
    • [ ] sapphire_net - optimized networking library that features defined (like ByteNet) events and undefined events, both with buffer serdes, albeit undefined events performing worse due to having to define types and lengths in the buffer
    • [ ] sapphire_data - batteries included wrapper for an existing data library like keyForm
    • [ ] sapphire_ecr - scheduler for ECR with niceties
    • [ ] sapphire_jecs - scheduler for JECS with niceties
  • [ ] Testing

Note

Partially inspired by team-fireworks/ohmyprvd!