stargazers

package
v1.2.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 13, 2026 License: MIT Imports: 13 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package stargazers owns the M4 "stargazers" plugin. Per the contract this plugin targets the repository-template account kind, which M4 does not support yet. Worldmap (`_worldmap=true`) is explicitly deferred per research note R-012 — the M4 implementation always returns Skipped=true with an explanatory reason.

Index

Constants

View Source
const Name = "stargazers"

Name is the canonical plugin slug.

Variables

View Source
var Plugin plugins.Plugin = &stargazersPlugin{}

Plugin is the singleton registered with the global plugin registry.

Functions

func Partial

Partial renders the classic SVG fragment for the stargazers plugin. Mirrors upstream org_repo/source/templates/classic/partials/stargazers.ejs.

Returns "" until stargazers.go's Run is wired with chart data (current M4 path stays Skipped). When data arrives, emits the upstream two chart-bars columns ("Total stargazers" + "New stargazers") for the classic chart type, or the single line plot for the graph type.

Output structure (classic):

<section data-section="stargazers">
  <h2 class="field"><svg star/>Stargazers</h2>
  <div class="row margin-bottom">
    <section class="column chart">
      <h3>Total stargazers</h3>
      <div class="chart-bars">…cumulative…</div>
    </section>
    <section class="column chart">
      <h3>New stargazers per month</h3>
      <div class="chart-bars">…per-bucket increments…</div>
    </section>
  </div>
</section>

func SetNowForTest added in v1.2.0

func SetNowForTest(fn func() time.Time) func()

SetNowForTest overrides the stargazers clock and returns a restore function.

Types

type ChartPoint

type ChartPoint struct {
	Date  time.Time `json:"date"`
	Count int       `json:"count"`
	New   int       `json:"new,omitempty"`
}

ChartPoint is one data point on the stargazers chart.

type Result

type Result struct {
	Skipped       bool                `json:"skipped,omitempty"`
	SkippedReason string              `json:"-"`
	Mode          string              `json:"mode,omitempty"`
	List          []Stargazer         `json:"list"`
	Charts        StargazersCharts    `json:"charts"`
	Worldmap      *StargazersWorldmap `json:"worldmap,omitempty"`
}

Result is the JSON payload published under data.Plugins["stargazers"]. Worldmap is always nil in M4 (R-012).

func (*Result) IsSkipped

func (r *Result) IsSkipped() bool

IsSkipped lets the classic dispatcher detect the skipped path.

type Stargazer

type Stargazer struct {
	Login     string    `json:"login"`
	StarredAt time.Time `json:"starredAt"`
	Location  string    `json:"location"`
}

Stargazer represents one starrer.

type StargazersCharts

type StargazersCharts struct {
	Type   string       `json:"type"`
	Series []ChartPoint `json:"series"`
}

StargazersCharts is the chart data slice.

type StargazersWorldmap

type StargazersWorldmap struct{}

StargazersWorldmap is a placeholder that always serializes to null in M4 per R-012.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL