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

yepyep

v0.0.2

Published

![repo-banner](https://user-images.githubusercontent.com/4732330/54318359-74f6a480-45bc-11e9-8548-d7b12b08257f.png)

Downloads

2

Readme

repo-banner

npm i hypr -g

This project is alpha, so I don't recommend using it in production yet. I welcome all ideas, critiques, and PRs :)

features

  • static page generation
  • server side rendering
  • client-side application bundle
  • css compilation w/ PostCSS
  • routing
  • state management
  • builds to lambda function
  • "hello world" 50kb gzipped
  • pick and choose build type
    • client + static
    • static + SSR
    • SSR + API
    • SSR + client
    • static
    • etc

beta roadmap

  • production server for non lambda envs
  • prefetch route API
  • plugins
    • think like better css-in-js support, sass, babel config, etc
  • named 404.html support

usage

hypr build
hypr watch

hypr cli

setup

routes/Home.js

import React from 'react'

export const pathname = '/'
export function view () {
  return <h1>Hello World</h1>
}

routes.js

import React from 'react'
import Home from '@routes/Home.js'

export default [ Home ]

client.js

import React from 'react'
import { client } from 'hypr'
import routes from '@routes.js'

client(routes, { title: 'hello world' })(document.getElementById('root'))

server.js

import React from 'react'
import { server } from 'hypr'
import routes from '@routes.js'

export default server(routes, { title: 'hello world' })

static

To render a route statically, define a config() for biti.

routes/Home.js

import React from 'react'

export const pathname = '/'
export function config () {
  return {
    state: { title: 'homepage' }
  }
}
export function view ({ state }) {
  return <h1>{state.title}</h1>
}

data loading

A load() export will be resolved on both the server and client before rendering the view. The returned object should match biti API as well. Any props on the state object returned will be merged with application state.

During a static render, load is not called.

routes/Home.js

import React from 'react'

export const pathname = '/'
export function config () {
  return load()
}
export function load (state, req) {
  return {
    state: { title: 'loaded title' }
  }
}
export function view ({ state }) {
  return <h1>{state.title}</h1>
}

routing

hypr comes with routing built in. Use the Link export to navigate throughout your app.

routes/Home.js

import React from 'react'
import { Link } from 'hypr'

export const pathname = '/'
export function config () {
  return load()
}
export function load (state, req) {
  return {
    state: { title: 'loaded title' }
  }
}
export function view ({ state }) {
  return (
    <>
      <h1>{state.title}</h1>

      <nav>
        <Link href='/'>home</Link>
        <Link href='/about'>about</Link>
      </nav>
    </>
  )
}

state

hypr comes with state management built in also. Use the withState export to pass state to individual components. Refer to the picostate docs for more info.

components/ChangeTitle.js

import React from 'react'
import { withState } from 'hypr'

export default withState(state => ({
  myTitle: state.title
}))(
  function ChangeTitle ({ myTitle, hydrate }) {
    return (
      <button onClick={() => {
        hydrate({ title: 'new title' })()
      }}>update title</button>
    )
  }
)

routes/Home.js

import React from 'react'
import { Link, withState } from 'hypr'
import ChangeTitle from '@/components/ChangeTitle.js'

export const pathname = '/'
export function config () {
  return load()
}
export function load (state, req) {
  return {
    state: { title: 'loaded title' }
  }
}
export function view ({ state }) {
  return (
    <>
      <h1>{state.myTitle}</h1>

      <ChangeTitle />

      <nav>
        <Link href='/'>home</Link>
        <Link href='/about'>about</Link>
      </nav>
    </>
  )
}

motivation

This will be a blog post, but think Next plus Gatsby.

contributing

Wowee would I welcome some help :)

the name

Massive thanks to idmitriev for passing on the name, very kind of them :)

license

MIT © 2019 Eric Bailey