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 🙏

© 2026 – Pkg Stats / Ryan Hefner

yuku-loader

v0.1.0

Published

Yuku-powered AST transform loader for webpack and Rspack.

Readme

yuku-loader

Yuku-powered AST transform loader for webpack and Rspack. It parses JavaScript and TypeScript into an ESTree-compatible AST, runs JavaScript plugins that mutate or replace that AST, and prints the transformed module back to code.

Install

npm install -D yuku-loader

Yuku is bundled as runtime dependencies through yuku-parser and yuku-codegen.

Webpack Usage

// webpack.config.mjs
export default {
  module: {
    rules: [
      {
        test: /\.[cm]?[jt]sx?$/,
        loader: "yuku-loader",
        type: "javascript/auto",
        options: {
          format: "compact",
          plugins: ["./build/rename-plugin.mjs"]
        }
      }
    ]
  }
};

Rspack Usage

// rspack.config.mjs
export default {
  module: {
    rules: [
      {
        test: /\.[cm]?[jt]sx?$/,
        loader: "yuku-loader",
        type: "javascript/auto",
        options: {
          format: "compact",
          plugins: ["./build/rename-plugin.mjs"]
        }
      }
    ]
  }
};

Plugin API

Plugins are JavaScript modules. A plugin can export a factory, a visitor object, or a plugin object.

// build/rename-plugin.mjs
export default function renamePlugin(api, options = {}) {
  const from = options.from ?? "__buildTarget";
  const to = options.to ?? "target";

  return api.visitor({
    Identifier(node) {
      if (node.name === from) {
        node.name = to;
      }
    }
  });
}

Pass plugin options with tuple syntax:

options: {
  plugins: [["./build/rename-plugin.mjs", { from: "answer", to: "total" }]]
}

You can also use an object plugin:

export default {
  name: "replace-literal",
  visitors: {
    Literal(node) {
      if (node.value === 1) {
        node.value = 42;
        node.raw = "42";
      }
    }
  }
};

Or return generated code directly:

export default {
  transform(program, context) {
    return "export default 42;";
  }
};

Options

interface YukuLoaderOptions {
  plugins?: LoaderPlugin[];
  parse?: ParseOptions;
  codegen?: CodegenOptions;
  generate?: "auto" | "print" | "strip" | "minify" | false;
  format?: "pretty" | "compact";
  ast?: boolean;
}

generate defaults to auto. JavaScript resources use print; TypeScript resources use strip so type syntax is removed before the bundler parses the module.

The transformed code is the source of truth for both webpack and Rspack.

Set ast: true to also pass { webpackAST: program } as loader metadata for experiments with bundlers that consume loader-provided ASTs.

Development

npm install
npm test

The basic example lives in examples/basic.