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

astro-manifestor

v1.0.4

Published

Extracts JS, CSS, and Astro islands from built HTML into manifest.json

Readme

🌟 astro-manifestor

astro-manifestor — CLI-инструмент для генерации manifest-файла и выноса inline-скриптов из HTML, например, после сборки Astro в режиме static или других SSG.

  • Рекурсивно сканирует HTML-файлы в dist
  • Извлекает inline-скрипты во внешние .js-файлы
  • Генерирует manifest.json, отображающий зависимости файлов

❓ Зачем это нужно

Astro и похожие SSG создают HTML, в котором используются:

  • ресурсы с динамическими хэшами (скрипты, CSS, изображения)
  • inline-скрипты (например, island-компоненты)

При интеграции такой статики в серверные фреймворки типа Laravel, Bitrix, Symfony, где HTML собирается из Blade/Twig/PHP, требуется знать, какие именно ресурсы нужны для каждой страницы, чтобы корректно их подключить.

astro-manifestor помогает:

  • получить список ресурсов для каждой HTML-страницы
  • вынести inline-скрипты во внешние файлы (что удобно для кеширования и CSP)
  • упростить интеграцию Astro-статик в монолитные проекты без REST API

🚀 Быстрый старт

1. Использование без установки

npx astro-manifestor \
  --inputDir ./dist \
  --manifestOutFile ./dist/assets/manifest.json \
  --inlineScriptsOutDir ./dist/assets/js \
  --inlineScriptsPublicPath /assets/js \
  --inlineScriptPrefix inline-script- \
  --verbose
{
  "scripts": {
    "build:manifest": "npx astro-manifestor"
  }
}

2. Или установка как зависимость

npm install --save-dev astro-manifestor

⚙️ CLI-параметры

| Параметр | Описание | |-----------------------------|-------------------------------------------------------------------------| | --inputDir | Путь к директории с HTML-файлами (например, dist/) | | --manifestOutFile | Путь к выходному manifest.json | | --inlineScriptsOutDir | Куда складывать вынесенные inline-скрипты | | --inlineScriptsPublicPath | Публичный путь (используется в манифесте) | | --inlineScriptPrefix | Префикс имени для inline-скриптов (например, inline-script-) | | --verbose | (опц.) Вывод подробной информации |


🔧 Кастомизация

Используйте файл astro-manifestor.config.{js,ts} в корне проекта:

export default {
  inputDir: 'dist',
  manifestOutFile: 'dist/assets/manifest.json',
  inlineScriptsOutDir: 'dist/assets/js',
  inlineScriptsPublicPath: '/assets/js',
  inlineScriptPrefix: 'inline-script-',
  verbose: true,
  prettierOptions: {
    tabWidth: 4,
    printWidth: 80,
    htmlWhitespaceSensitivity: 'ignore',
  },
}

Изменить содержимое манифеста перед его сохранением

export default {
  transformManifest: (manifestMap) => {
    for (const key in manifestMap) {
      const entry = manifestMap[key];

      for (const islandName in entry.islands) {
        const island = entry.islands[islandName];

        if (island.componentUrl) {
          island.componentUrl = 'https://example.com' + island.componentUrl;
        }
      }
    }
    
    return manifestMap;
  },
};

👆 Это особенно удобно, если:

  • вы перемещаете скрипты после билда
  • у вас есть CDN или прокси, меняющий пути
  • нужно добавить дополнительные данные в манифест

Файл может быть .ts или .js. Он автоматически подхватывается CLI.


✨ Примеры

Пример выходного манифеста

{
  "dist/index.html": {
    "js": [
      "/assets/js/inline-script-2mu117.js",
      "/assets/js/ModuleOne.astro_astro_type_script_index_0_lang-CTXcsgZ5.js",
      "/assets/js/Layout.astro_astro_type_script_index_0_lang-DvaTEbLM.js"
    ],
    "css": [
      "/assets/css/index-mR53M-XZ.css",
      "/assets/css/chunk-Bj5H1zmF.css"
    ],
    "islands": {
      "Hello": {
        "uid": "Z2f1Nmm",
        "componentUrl": "https://example.com/assets/js/Hello-CGVomTcg.js",
        "componentExport": "default",
        "rendererUrl": "/assets/js/client-dDWe5wvR.js",
        "client": "only",
        "props": "{}",
        "ssr": ""
      }
    }
  },
  "dist/about/index.html": {
    "js": [],
    "css": [],
    "islands": {}
  }
}

Пример до / после

До:

<body>
  <script type="module" src="/assets/js/component-A.js"></script>
  
  <h1>Hello</h1>
  
  <script>(() => {
    console.log('inline logic');
  })();</script>

  <script type="module" src="/assets/js/component-B.js"></script>
</body>

После:

<body>
  <h1>Hello</h1>

  <script src="/assets/js/inline-script-abc123.js"></script>
  <script type="module" src="/assets/js/component-A.js"></script>
  <script type="module" src="/assets/js/component-B.js"></script>
</body>

Что происходит:

  • Все <script> элементы перемещаются в низ <body>
  • Инлайновые скрипты сохраняются в отдельные .js файлы
  • Сохраняется порядок выполнения

👀 TODO / планы

  • [ ] Поддержка CSS inline-стилей