phantomas

基於無頭 Chromium 的網頁效能指標收集與監控工具

phantomas 是什麼?

基於無頭 Chromium 的網頁效能指標收集與監控工具(Headless Chromium-based web performance metrics collector and monitoring tool)

phantomas 概覽

這是什麼

phantomas 是一個以 Headless Chromium 為基礎的模組化網頁效能指標收集與監控工具。它使用 Node.js 與 Puppeteer 驅動無頭瀏覽器,從網頁中擷取多種效能與品質指標。本專案採用 BSD-2-Clause 授權,為開放原始碼,可作為 CommonJS 模組或命令列工具使用。

主要功能

  • 模組化架構:每個指標由獨立模組產生,核心作為事件發射器供模組掛接 - 深入指標:包括 jQuery 綁定事件數量、window.write 呼叫次數、複雜或重複的 CSS 選擇器(透過 analyze-css) - JSON 輸出格式,便於與其他工具整合 - 裝置設定檔:可模擬手機或平板,設定使用者代理與視窗大小 - 可透過頁面 JavaScript 中的 window.__phantomas 輔助函式發射指標 - 透過 CommonJS 模組輕鬆整合至 Node.js 專案

使用情境

  • 在 CI/CD 管線中進行自動化前端效能測試 - 效能預算與迴歸偵測(例如搭配 Jenkins 或 Grunt) - 開發期間測量與監控網頁效能指標 - 分析 CSS 與 JavaScript 以進行最佳化 - 將效能資料整合至儀表板或監控系統

快速開始

透過 npm 安裝: npm install phantomas 或使用 Docker 映像: docker pull macbre/phantomas:latest 作為 Node.js 模組的基本用法: js const phantomas = require('phantomas'), promise = phantomas('http://example.com/'); promise.then(results => { console.log('Metrics', results.getMetrics()); console.log('Offenders', results.getAllOffenders()); }).catch(res => { console.error(res); }); 命令列用法請執行 phantomas -h。

授權與價格

採用 BSD-2-Clause 授權。本專案為開放原始碼,可免費使用。

內容整理自該專案公開的 README 與儲存庫資訊。

將此徽章加入你的 README

Featured on YunoDB 徽章樣式與說明

你是這個專案的維護者嗎?展示它已收錄於 YunoDB。

Markdown[![Featured on YunoDB](https://yunodb.com/badge/macbrephantomas.svg)](https://yunodb.com/tools/macbrephantomas?utm_source=github&utm_medium=badge)
HTML<a href="https://yunodb.com/tools/macbrephantomas?utm_source=github&utm_medium=badge"><img src="https://yunodb.com/badge/macbrephantomas.svg" alt="Featured on YunoDB" height="20"></a>