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

wane

v0.0.7

Published

A framework for building web-apps.

Downloads

30

Readme

Wane

Wane is a framework, compiler and a bundler: all at the same time. It aims to become the only tool you need to build a front-end application.

See what makes it special after the Hello World introduction below.

WARNING! This is still just an early prototype. Beware of super experimental stuff ahead, including bugs and obvious missing features. Feel free to play around, ask questions and report bugs in the issues section.

Hello World

To get started, create an empty folder for your project and do the usual yarn init ceremony. Then, install wane, create a new folder src, and within it a file index.ts.

$ yarn add wane
$ mkdir src
$ touch src/index.ts

Open it and write the following.

// src/index.ts

import { Template } from 'wane'

@Template(`Hello, {{ someone }}!`)
export default class App {
  someone = 'World'
}

Save the file and run the wane dev server.

$ yarn wane start

If everything went fine, you're now running the dev server which will watch for changes you make to the source code, re-compile the app and reload the browser for you.

You can also create the production build.

$ yarn wane build

The built app is contained within the newly created dist folder. Open the dist/index.html file from your browser to see the app in action.

The generated JavaScript file is only 272 bytes. Yes, that's less than 0.3kB. If you run that through gzip, you get 207 bytes. With brotli, you're down to only 166 bytes. Here's it again:

 272 index.js
 207 index.js.gz
 166 index.js.br

And it can only get better.

Below is a short overview of how it's achieved.

How's it different

The thing is, there's no framework in the traditional sense. It just feels like one because it lets you write TypeScript, which you should be already comfortable with. Add in some decorators and magic happens!

However, behind the scenes, the code you write is treated as a string. With help of the TypeScript compiler (and the awesome wrapper ts-simple-ast), it statically analyzes your code and completely code-generates everything.

This means that there is no framework code at all. All code that makes it to the final bundle is written just for your app.

In theory, this means that there is nothing stopping Wane from generating the best possible code without any overhead and without any unnecessary code:

  • You have an output (an event) on a component that no component listens to? Let's remove it then.
  • There is no method that can update the string that you've used for interpolation (someone in the Hello World example above)? Then there will be no code generating for updating it: it will be the same as if you've written the value ("World") right there in the template.
  • Your component can never be destroyed because it's not inside a w:if directive? Then it won't generate the destroy method for it.
  • Say when you fire an event, you change a variable. A variable that is not bound to the view. So let's not even run the change detection algorithm or re-render anything. Let's only update your model.

And the best thing is, improvements like these are happening in the compiler. When a new feature is implemented, you could just run the compiler again over the same code and you could get a smaller bundle and a faster application.

How to explore

Until I (or someone else) gets around to writing examples and tutorials, your best shot at seeing what is currently implemented are apps created for end-to-end tests under tests/e2e/apps.

There's also a work-in-progress website: wane.app.