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

@dumbjs/preland

v0.0.2

Published

<p align="center"> <img width="1200" alt="header" src="https://github.com/dumbjs/preland/assets/43572006/49e9d708-4b88-4922-9094-7ad25d53906e"> </p>

Downloads

58

Readme

Preact Island

Framework Agnostic utils to generate atomic islands for preact components

What is this?

preland is a set of utilities that allow you to read, find , transform and generate island components for preact. None of the utlities in this set have any dependency on any bundler or framework and just statically analyse the given code to look for preact islands.

Highlights

  • Tiny
  • Supports Typescript
  • Handles individual named island exports from the same file
  • Provides utils to help parse and generate preact compatible ASTs and add imports to it

Usage

  • Installation as simple as adding @dumbjs/preland to your dependencies.

    $ npm i @dumbjs/preland

API

@dumbjs/preland

export function readSourceFile(file: any): any
export function findIslands(sourceCode: any): {
  id: any
  node: any
  nodeItem: any
}[]
export function islandNodeToTemplate(island: any): {
  server: any
  client: string
}
export function getExportedNodes(astBody: any): any
export function generateServerTemplate(name: any): string
export function generateClientTemplate(name: any): string
/**
 *
 * @param {import("acorn").Node} functionAST
 * @param {object} options
 * @param {string[]} options.transpiledIdentifiers , identifiers to look for when
 * searching the function ast. These are generally `_jsx` and `_jsxs` when working with
 * the `automatic` JSX Runtime in bundlers but might differ in your scenario
 * @returns
 */
export function isFunctionIsland(
  functionAST: import('acorn').Node,
  {
    transpiledIdentifiers,
  }?: {
    transpiledIdentifiers: string[]
  }
): boolean
export function getIslandName(name: any): string
export const DEFAULT_TRANSPILED_IDENTIFIERS: string[]

@dumbjs/preland/ast

export function walker(ast: any, visitors: any): void
export function astFromCode(code: any): import('acorn').Program
export function codeFromAST(ast: any): any
/**
 * Takes in an AST node and returns the name of the default
 * export for it
 * @param {*} ast
 * @returns
 */
export function getDefaultExportName(ast: any): any
export function getDefaultExport(ast: any): any[]
/**
 * NOT A PURE FUNCTION!
 * modifies the passed AST with the
 * requested import
 *
 * Note:
 * This function does not rename / or add a new identifier for the
 * requested import as that could add in a lot more complexity
 * and is easier handled in the user land. Changing and renaming
 * import specifier would also need proper tranformation to be handled
 * for cases where the imports might be responsible for things
 * like JSX.
 * @returns
 */
export function addImportToAST(ast: any): (
  name: string,
  from: string,
  {
    named,
  }: {
    named: boolean
  }
) => void
export function getNamedExport(ast: any, name: any): any
/**
 * NOT A PURE FUNCTION!
 * removes the export from the passed AST
 */
export function removeExportFromAST(ast: any): (
  name: string,
  options: {
    named: boolean
  }
) => void
export function isTopLevelFunction(parents: any): any

License

MIT