@grimoire-rs/indexer 0.3.3 → 0.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +220 -9
- package/dist/ci.d.ts +6 -1
- package/dist/ci.d.ts.map +1 -1
- package/dist/ci.js +32 -1
- package/dist/ci.js.map +1 -1
- package/dist/cli/build.d.ts.map +1 -1
- package/dist/cli/build.js +3 -1
- package/dist/cli/build.js.map +1 -1
- package/dist/cli/ci.d.ts.map +1 -1
- package/dist/cli/ci.js +5 -1
- package/dist/cli/ci.js.map +1 -1
- package/dist/cli/enrich.d.ts +1 -0
- package/dist/cli/enrich.d.ts.map +1 -1
- package/dist/cli/enrich.js +38 -0
- package/dist/cli/enrich.js.map +1 -1
- package/dist/cli/init.d.ts.map +1 -1
- package/dist/cli/init.js +17 -3
- package/dist/cli/init.js.map +1 -1
- package/dist/cli/main.d.ts.map +1 -1
- package/dist/cli/main.js +9 -0
- package/dist/cli/main.js.map +1 -1
- package/dist/cli/ratings.d.ts +3 -0
- package/dist/cli/ratings.d.ts.map +1 -0
- package/dist/cli/ratings.js +160 -0
- package/dist/cli/ratings.js.map +1 -0
- package/dist/config.d.ts +19 -0
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +47 -1
- package/dist/config.js.map +1 -1
- package/dist/data/index.d.ts.map +1 -1
- package/dist/data/index.js +13 -0
- package/dist/data/index.js.map +1 -1
- package/dist/enrich/checkpoint.d.ts +53 -0
- package/dist/enrich/checkpoint.d.ts.map +1 -0
- package/dist/enrich/checkpoint.js +296 -0
- package/dist/enrich/checkpoint.js.map +1 -0
- package/dist/enrich/index.d.ts +14 -0
- package/dist/enrich/index.d.ts.map +1 -1
- package/dist/enrich/index.js +77 -4
- package/dist/enrich/index.js.map +1 -1
- package/dist/ratings/budget.d.ts +16 -0
- package/dist/ratings/budget.d.ts.map +1 -0
- package/dist/ratings/budget.js +7 -0
- package/dist/ratings/budget.js.map +1 -0
- package/dist/ratings/config.d.ts +56 -0
- package/dist/ratings/config.d.ts.map +1 -0
- package/dist/ratings/config.js +86 -0
- package/dist/ratings/config.js.map +1 -0
- package/dist/ratings/marker.d.ts +105 -0
- package/dist/ratings/marker.d.ts.map +1 -0
- package/dist/ratings/marker.js +141 -0
- package/dist/ratings/marker.js.map +1 -0
- package/dist/ratings/paging.d.ts +16 -0
- package/dist/ratings/paging.d.ts.map +1 -0
- package/dist/ratings/paging.js +36 -0
- package/dist/ratings/paging.js.map +1 -0
- package/dist/ratings/provider.d.ts +100 -0
- package/dist/ratings/provider.d.ts.map +1 -0
- package/dist/ratings/provider.js +203 -0
- package/dist/ratings/provider.js.map +1 -0
- package/dist/ratings/provider_github.d.ts +3 -0
- package/dist/ratings/provider_github.d.ts.map +1 -0
- package/dist/ratings/provider_github.js +135 -0
- package/dist/ratings/provider_github.js.map +1 -0
- package/dist/ratings/provider_gitlab.d.ts +3 -0
- package/dist/ratings/provider_gitlab.d.ts.map +1 -0
- package/dist/ratings/provider_gitlab.js +153 -0
- package/dist/ratings/provider_gitlab.js.map +1 -0
- package/dist/ratings/provider_memory.d.ts +28 -0
- package/dist/ratings/provider_memory.d.ts.map +1 -0
- package/dist/ratings/provider_memory.js +49 -0
- package/dist/ratings/provider_memory.js.map +1 -0
- package/dist/ratings/reconcile.d.ts +47 -0
- package/dist/ratings/reconcile.d.ts.map +1 -0
- package/dist/ratings/reconcile.js +133 -0
- package/dist/ratings/reconcile.js.map +1 -0
- package/dist/ratings/seed.d.ts +60 -0
- package/dist/ratings/seed.d.ts.map +1 -0
- package/dist/ratings/seed.js +132 -0
- package/dist/ratings/seed.js.map +1 -0
- package/dist/renderer/astro/components/Catalog.d.ts +2 -0
- package/dist/renderer/astro/components/Catalog.js +65 -16
- package/dist/renderer/astro/components/Catalog.tsx +119 -26
- package/dist/renderer/astro/components/CommandField.astro +1 -0
- package/dist/renderer/astro/components/VersionMenu.astro +31 -23
- package/dist/renderer/astro/layouts/Base.astro +218 -263
- package/dist/renderer/astro/lib/catalog.d.ts +25 -0
- package/dist/renderer/astro/lib/catalog.js +46 -0
- package/dist/renderer/astro/lib/catalog.ts +49 -0
- package/dist/renderer/astro/pages/p/[...slug].astro +238 -85
- package/dist/renderer/astro/styles/tokens.css +157 -0
- package/dist/renderer/index.d.ts.map +1 -1
- package/dist/renderer/index.js +101 -2
- package/dist/renderer/index.js.map +1 -1
- package/dist/renderer/types.d.ts +41 -0
- package/dist/renderer/types.d.ts.map +1 -1
- package/dist/validate/adapters/http.d.ts +29 -1
- package/dist/validate/adapters/http.d.ts.map +1 -1
- package/dist/validate/adapters/http.js +17 -2
- package/dist/validate/adapters/http.js.map +1 -1
- package/package.json +1 -1
- package/templates/ci/github-enrich.yml +9 -1
- package/templates/ci/github-pages.yml +11 -5
- package/templates/ci/github-ratings-seed.yml +88 -0
- package/templates/ci/github-ratings.yml +51 -0
- package/templates/ci/gitlab-ci.yml +3 -3
- package/templates/ci/gitlab-enrich.sh +10 -1
- package/templates/ci/gitlab-ratings-seed.sh +83 -0
- package/templates/ci/gitlab-ratings.yml +37 -0
- package/templates/gitignore +8 -0
|
@@ -1,7 +1,32 @@
|
|
|
1
|
+
import type { CatalogPackage } from "../../types.js";
|
|
1
2
|
export type { CatalogPackage } from "../../types.js";
|
|
3
|
+
/**
|
|
4
|
+
* When a package last moved, for sorting and for the "updated" stamp.
|
|
5
|
+
*
|
|
6
|
+
* `updated` is what `enrich` derived — the artifact's own `created` when it
|
|
7
|
+
* has one, and the first build that saw the current digest when it does not.
|
|
8
|
+
* The fallback to `created` is for a sidecar written before that field
|
|
9
|
+
* existed: those records still date correctly instead of dropping into the
|
|
10
|
+
* unknown bucket on the first build after an upgrade.
|
|
11
|
+
*/
|
|
12
|
+
export declare function lastUpdated(p: CatalogPackage): string | undefined;
|
|
2
13
|
export declare function versionCascade(version: string | undefined, tags: string[]): string[];
|
|
3
14
|
export declare function compareVersions(a: string, b: string): number;
|
|
4
15
|
export declare function timeAgo(iso: string): string;
|
|
16
|
+
/**
|
|
17
|
+
* One registry-supplied string as an outbound href, or null.
|
|
18
|
+
*
|
|
19
|
+
* Every URL on a package page — its repository, its home page, its docs, its
|
|
20
|
+
* four support channels — is a string the index was handed by a registry it
|
|
21
|
+
* does not control, and an `href` is not made safe by escaping: `javascript:`
|
|
22
|
+
* is a perfectly well-formed attribute value that runs on click. Only the
|
|
23
|
+
* three schemes a link here can legitimately use survive; everything else
|
|
24
|
+
* renders as no link at all rather than as a live one.
|
|
25
|
+
*
|
|
26
|
+
* The raw string is returned rather than `URL.href`, so a link that was
|
|
27
|
+
* already fine is published exactly as the registry spelled it.
|
|
28
|
+
*/
|
|
29
|
+
export declare function externalUrl(raw: unknown): string | null;
|
|
5
30
|
/** `vscode://<publisher.extension>/open?repo=<ref>`, or null when disabled. */
|
|
6
31
|
export declare function vscodeUrl(extension: string | null, ref: string): string | null;
|
|
7
32
|
/**
|
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
// SPDX-License-Identifier: Apache-2.0
|
|
2
2
|
// Copyright 2026 The Grimoire Authors
|
|
3
|
+
/**
|
|
4
|
+
* When a package last moved, for sorting and for the "updated" stamp.
|
|
5
|
+
*
|
|
6
|
+
* `updated` is what `enrich` derived — the artifact's own `created` when it
|
|
7
|
+
* has one, and the first build that saw the current digest when it does not.
|
|
8
|
+
* The fallback to `created` is for a sidecar written before that field
|
|
9
|
+
* existed: those records still date correctly instead of dropping into the
|
|
10
|
+
* unknown bucket on the first build after an upgrade.
|
|
11
|
+
*/
|
|
12
|
+
export function lastUpdated(p) {
|
|
13
|
+
return p.updated ?? p.created;
|
|
14
|
+
}
|
|
3
15
|
// Publishing 0.10.0 also moves the rolling tags 0.10, 0 and latest, so the
|
|
4
16
|
// full tag list is mostly history. Return just the current release's chain
|
|
5
17
|
// (latest | 0 | 0.10 | 0.10.0). `tags` must already be sorted newest-first.
|
|
@@ -54,6 +66,40 @@ export function timeAgo(iso) {
|
|
|
54
66
|
}
|
|
55
67
|
return RTF.format(Math.round(duration), "years");
|
|
56
68
|
}
|
|
69
|
+
/** A bare address, which `support.contact` is far more likely to hold than a URL. */
|
|
70
|
+
const EMAIL = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
|
|
71
|
+
/** The only schemes a link on this site may carry. */
|
|
72
|
+
const LINK_SCHEMES = ["https:", "http:", "mailto:"];
|
|
73
|
+
/**
|
|
74
|
+
* One registry-supplied string as an outbound href, or null.
|
|
75
|
+
*
|
|
76
|
+
* Every URL on a package page — its repository, its home page, its docs, its
|
|
77
|
+
* four support channels — is a string the index was handed by a registry it
|
|
78
|
+
* does not control, and an `href` is not made safe by escaping: `javascript:`
|
|
79
|
+
* is a perfectly well-formed attribute value that runs on click. Only the
|
|
80
|
+
* three schemes a link here can legitimately use survive; everything else
|
|
81
|
+
* renders as no link at all rather than as a live one.
|
|
82
|
+
*
|
|
83
|
+
* The raw string is returned rather than `URL.href`, so a link that was
|
|
84
|
+
* already fine is published exactly as the registry spelled it.
|
|
85
|
+
*/
|
|
86
|
+
export function externalUrl(raw) {
|
|
87
|
+
if (typeof raw !== "string")
|
|
88
|
+
return null;
|
|
89
|
+
const value = raw.trim();
|
|
90
|
+
if (value === "")
|
|
91
|
+
return null;
|
|
92
|
+
try {
|
|
93
|
+
return LINK_SCHEMES.includes(new URL(value).protocol) ? value : null;
|
|
94
|
+
}
|
|
95
|
+
catch {
|
|
96
|
+
// Not a URL at all. `mailto:` is only added to something that carries no
|
|
97
|
+
// scheme of its own — testing for an address first would read the
|
|
98
|
+
// `mailto:alice@acme.example` a publisher already wrote as a bare
|
|
99
|
+
// address and prefix it a second time.
|
|
100
|
+
return EMAIL.test(value) ? `mailto:${value}` : null;
|
|
101
|
+
}
|
|
102
|
+
}
|
|
57
103
|
/** `vscode://<publisher.extension>/open?repo=<ref>`, or null when disabled. */
|
|
58
104
|
export function vscodeUrl(extension, ref) {
|
|
59
105
|
return extension ? `vscode://${extension}/open?repo=${encodeURIComponent(ref)}` : null;
|
|
@@ -5,8 +5,23 @@
|
|
|
5
5
|
// client bundle. The build-time payload lives in `./data.ts`; the package
|
|
6
6
|
// data itself is compiled by `src/data/` into `<outDir>/all.json`, so
|
|
7
7
|
// nothing here walks the index tree.
|
|
8
|
+
import type { CatalogPackage } from "../../types.js";
|
|
9
|
+
|
|
8
10
|
export type { CatalogPackage } from "../../types.js";
|
|
9
11
|
|
|
12
|
+
/**
|
|
13
|
+
* When a package last moved, for sorting and for the "updated" stamp.
|
|
14
|
+
*
|
|
15
|
+
* `updated` is what `enrich` derived — the artifact's own `created` when it
|
|
16
|
+
* has one, and the first build that saw the current digest when it does not.
|
|
17
|
+
* The fallback to `created` is for a sidecar written before that field
|
|
18
|
+
* existed: those records still date correctly instead of dropping into the
|
|
19
|
+
* unknown bucket on the first build after an upgrade.
|
|
20
|
+
*/
|
|
21
|
+
export function lastUpdated(p: CatalogPackage): string | undefined {
|
|
22
|
+
return p.updated ?? p.created;
|
|
23
|
+
}
|
|
24
|
+
|
|
10
25
|
// Publishing 0.10.0 also moves the rolling tags 0.10, 0 and latest, so the
|
|
11
26
|
// full tag list is mostly history. Return just the current release's chain
|
|
12
27
|
// (latest | 0 | 0.10 | 0.10.0). `tags` must already be sorted newest-first.
|
|
@@ -63,6 +78,40 @@ export function timeAgo(iso: string): string {
|
|
|
63
78
|
return RTF.format(Math.round(duration), "years");
|
|
64
79
|
}
|
|
65
80
|
|
|
81
|
+
/** A bare address, which `support.contact` is far more likely to hold than a URL. */
|
|
82
|
+
const EMAIL = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
|
|
83
|
+
|
|
84
|
+
/** The only schemes a link on this site may carry. */
|
|
85
|
+
const LINK_SCHEMES = ["https:", "http:", "mailto:"];
|
|
86
|
+
|
|
87
|
+
/**
|
|
88
|
+
* One registry-supplied string as an outbound href, or null.
|
|
89
|
+
*
|
|
90
|
+
* Every URL on a package page — its repository, its home page, its docs, its
|
|
91
|
+
* four support channels — is a string the index was handed by a registry it
|
|
92
|
+
* does not control, and an `href` is not made safe by escaping: `javascript:`
|
|
93
|
+
* is a perfectly well-formed attribute value that runs on click. Only the
|
|
94
|
+
* three schemes a link here can legitimately use survive; everything else
|
|
95
|
+
* renders as no link at all rather than as a live one.
|
|
96
|
+
*
|
|
97
|
+
* The raw string is returned rather than `URL.href`, so a link that was
|
|
98
|
+
* already fine is published exactly as the registry spelled it.
|
|
99
|
+
*/
|
|
100
|
+
export function externalUrl(raw: unknown): string | null {
|
|
101
|
+
if (typeof raw !== "string") return null;
|
|
102
|
+
const value = raw.trim();
|
|
103
|
+
if (value === "") return null;
|
|
104
|
+
try {
|
|
105
|
+
return LINK_SCHEMES.includes(new URL(value).protocol) ? value : null;
|
|
106
|
+
} catch {
|
|
107
|
+
// Not a URL at all. `mailto:` is only added to something that carries no
|
|
108
|
+
// scheme of its own — testing for an address first would read the
|
|
109
|
+
// `mailto:alice@acme.example` a publisher already wrote as a bare
|
|
110
|
+
// address and prefix it a second time.
|
|
111
|
+
return EMAIL.test(value) ? `mailto:${value}` : null;
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
|
|
66
115
|
/** `vscode://<publisher.extension>/open?repo=<ref>`, or null when disabled. */
|
|
67
116
|
export function vscodeUrl(extension: string | null, ref: string): string | null {
|
|
68
117
|
return extension ? `vscode://${extension}/open?repo=${encodeURIComponent(ref)}` : null;
|