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

astro-page-insight

v0.8.3

Published

Shows everything to improve from Lighthouse results directly on the page.

Downloads

1,179

Readme

astro-page-insight

docs | demo

This is an Astro integration that shows everything to improve from Lighthouse results directly on the page.

[!IMPORTANT] This result is by dev mode, so it may not be accurate.
Especially, the Score is not accurate.

Usage

Prerequisites

Astro 4.0 or later is required.

Installation

Install the integration automatically using the Astro CLI:

pnpm astro add astro-page-insight
npx astro add astro-page-insight
yarn astro add astro-page-insight

Or install it manually:

  1. Install the required dependencies
pnpm add astro-page-insight
npm install astro-page-insight
yarn add astro-page-insight
  1. Add the integration to your astro config
+import pageInsight from "astro-page-insight";

export default defineConfig({
  integrations: [
+    pageInsight(),
  ],
});

Configuration

Here is the options:

| Property | Type | Default | Description | | --- | --- | --- | --- | | lh.weight | number | 0 | weight is the threshold value in the audit. | | lh.breakPoint | number | 767 | breakPoint is used to determine whether on mobile or desktop. | | firstFetch | load, open, none | none | firstFetch is used for when to do the first fetch.if firstFetch is load, will fetch on page load.if firstFetch is open, will fetch on first app open.if firstFetch is none, only fetch on user interaction. | | cache | boolean | false | cache is used to enable the cache.if cache is true, will enable to cache the lighthouse report. | | build.bundle | boolean | false | bundle is used to determine whether to bundle the page insight.if bundle is true, will bundle the page insight. so you can see the insight after build.It will bundle results from local cache. | | build.showOnLoad | boolean | false | showOnLoad is used to determine whether to show the page insight on page load.if showOnLoad is true, will show the page insight on page load. |

Example

import pageInsight from "astro-page-insight";

export default defineConfig({
  integrations: [
    pageInsight({
      lh: {
        weight: 0.5,
        breakPoint: 1024,
      },
      firstFetch: "open",
      cache: true,
      build: {
        bundle: true, // You should get value from the environment variable. (e.g. process.env.STAGING === "true")
        showOnLoad: true, // This option is only available when `bundle` is `true`.
      },
    }),
  ],
});

gitignore

If you want to ignore the cache, add the following to your .gitignore:

+ .pageinsight

Notification

You can sometimes see that the notification is displayed in the app.
There are three types of notifications:

| Color | Description | | --- | --- | | Blue | blue means that results are fresh. | | Yellow | yellow has two meanings.One is that the results are from the cache.The other is that fetching is in progress. | | Red | red means that fetching failed. |

build.bundle

If you set build.bundle to true, It will bundle results from local cache, So you need to have lighthouse results(cache) on build time.

Contributing

This package is structured as a monorepo:

  • playground contains code for testing the package
  • package contains the actual package

Install dependencies using pnpm:

pnpm i --frozen-lockfile

Watch for package changes:

pnpm package:dev

Start the playground with blog:

pnpm playground:blog

Start the playground with ssr:

pnpm playground:ssr

Start the playground with starlog:

pnpm playground:starlog

You can now edit files in package. Please note that making changes to those files may require restarting the playground dev server.

Licensing

MIT Licensed. Made with ❤️ by ktym4a.