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

duckweed-devtool

v0.2.0

Published

Developer tool for inspecting, exporting, and importing Duckweed app models

Downloads

5

Readme

Duckweed devtool

Developer tool that allows developers to inspect the Duckweed application model state.

The Duckweed devtool is a proper web application that runs alongside your main application, in the same tab, and monitors the application state changes. Its interface allows you to inspect the application state and also rewind the application to a previous state.

Features

screenshot of the Duckweed devtool

  • Time travel
  • Model state inspection
  • Model patch performance chart
  • In-browser (no extensions, works in any reasonably modern browser)

Demo

The Duckweed demo app is build with the devtool. Also refer to the manua to learn more about the devtool usage.

Installation

npm install --save-dev duckweed-devtool

Usage

Include the package in the webpack bundle alongside your app:

// Webpack config
// ...

module.export = function (env) {
 return {
   // ...
   entry: env && env.devtool === "yes"
    ? ["duckweed-devtool", "./src/index.js"]
    : ["./src/index.js"],
  // ...
 };
};

When invoking duckweed.runner() pass window.__DUCKWEED_DEVTOOL__.middlware and window.__DUCKWEED_DEVTOOL__.plugin as appropriate options:

const {plugin, middleware} = window.__DUCKWEED_DEVTOOL__ || {};
duckweed.runner(model, actions, views, {
  plugins: plugin ? [plugin] : [],
  middleware: middleware ? [middleware] : [],
});

How it works

For the information on how to use the devtool, see the User manual.

For the technical information, see the Under the hood.

Limitations

The following conditions may cause the devtool to behave in unexpected ways:

You patch the model in Snabbdom hooks

You patched the model in a hook, and then rewind the state in the devtool to a state that causes the hook to trigger. A new state change occurs at that point, causing the state after the last-selected state to be erased. This is not a bug. Devtool is designed to do that.

You use state other than the one in the model

If you use global state, like window.location, that is outside Duckweed's control, the time travel may not work as expected. Access to such state should be limited to event handlers and the rest of the apps should use the model state exclusively.

You use document.body as your root

If your application uses document.body as the root, it will overwrite the devtool's UI elements. Currently the only solution is to use a different root.

Dependencies are duplicated

Both your app and the devtool will use the same core dependencies (Snabbdom, Duckweed itself, etc). Since the devtool comes pre-bundled with them as well as an ES6 Object.assign() shim, there could be some duplication. Keep in mind, though, that the devtool does not necessarily use the same versions of those dependencies as your app, and that the devtool should not end up in the production bundle anyway, so it's fine that the dependencies are duplicated.

No Chrome extension

Because Duckweed application state can store any type of object (i.e., objects that are not necessarili serializable), writing a Chrome extension for this tool is a bit involved. I originally planned on having just a Chrome extension, but the final conslusion was that creating a tool that would run in-browser is probably faster.

Having said that, the current design is a bit too intrusive. In future, the devtool may provide a development server that will host your app in an iframe, for much cleaner separation of the two programs.

License

This software is made available to you under the terms of the MIT liecense. Please see the full text of the license in the LICENSE file in the source tree.