@grove-dev/core 0.7.0 → 0.8.0
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/dist/audit.d.ts +3 -3
- package/dist/audit.d.ts.map +1 -1
- package/dist/audit.js +25 -6
- package/dist/audit.js.map +1 -1
- package/dist/awesome-readme.d.ts.map +1 -1
- package/dist/awesome-readme.js +31 -31
- package/dist/awesome-readme.js.map +1 -1
- package/dist/build-data.d.ts +1 -1
- package/dist/build-data.d.ts.map +1 -1
- package/dist/build-data.js +82 -77
- package/dist/build-data.js.map +1 -1
- package/dist/collections-io.d.ts +1 -1
- package/dist/collections-io.js +8 -8
- package/dist/collections-io.js.map +1 -1
- package/dist/collections.d.ts +2 -2
- package/dist/collections.d.ts.map +1 -1
- package/dist/collections.js +8 -9
- package/dist/collections.js.map +1 -1
- package/dist/collector.d.ts +1 -1
- package/dist/collector.d.ts.map +1 -1
- package/dist/collector.js +2 -2
- package/dist/collector.js.map +1 -1
- package/dist/config.d.ts +1 -1
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +4 -4
- package/dist/config.js.map +1 -1
- package/dist/content-body.d.ts.map +1 -1
- package/dist/content-body.js +22 -22
- package/dist/content-body.js.map +1 -1
- package/dist/contributors.d.ts.map +1 -1
- package/dist/contributors.js +22 -23
- package/dist/contributors.js.map +1 -1
- package/dist/decisions.d.ts +1 -1
- package/dist/decisions.d.ts.map +1 -1
- package/dist/decisions.js +18 -20
- package/dist/decisions.js.map +1 -1
- package/dist/directory-client.d.ts +6 -4
- package/dist/directory-client.d.ts.map +1 -1
- package/dist/directory-client.js +9 -4
- package/dist/directory-client.js.map +1 -1
- package/dist/directory-facets.d.ts +1 -1
- package/dist/directory-facets.d.ts.map +1 -1
- package/dist/directory-facets.js +35 -17
- package/dist/directory-facets.js.map +1 -1
- package/dist/directory-filter-keys.d.ts +53 -0
- package/dist/directory-filter-keys.d.ts.map +1 -0
- package/dist/directory-filter-keys.js +66 -0
- package/dist/directory-filter-keys.js.map +1 -0
- package/dist/directory-format.d.ts.map +1 -1
- package/dist/directory-format.js +15 -15
- package/dist/directory-format.js.map +1 -1
- package/dist/directory-lenses.d.ts +1 -1
- package/dist/directory-lenses.d.ts.map +1 -1
- package/dist/directory-lenses.js +66 -61
- package/dist/directory-lenses.js.map +1 -1
- package/dist/directory-repo.js +2 -2
- package/dist/directory-scores.d.ts.map +1 -1
- package/dist/directory-scores.js +25 -25
- package/dist/directory-scores.js.map +1 -1
- package/dist/directory-search.d.ts +4 -4
- package/dist/directory-search.d.ts.map +1 -1
- package/dist/directory-search.js +99 -107
- package/dist/directory-search.js.map +1 -1
- package/dist/directory-taxonomy.d.ts +1 -1
- package/dist/directory-taxonomy.d.ts.map +1 -1
- package/dist/directory-taxonomy.js +2 -2
- package/dist/directory-taxonomy.js.map +1 -1
- package/dist/enrich.d.ts.map +1 -1
- package/dist/enrich.js +15 -12
- package/dist/enrich.js.map +1 -1
- package/dist/github-client.js +6 -6
- package/dist/github.d.ts +1 -1
- package/dist/github.d.ts.map +1 -1
- package/dist/github.js +15 -13
- package/dist/github.js.map +1 -1
- package/dist/health.d.ts +1 -1
- package/dist/health.js +44 -44
- package/dist/host.js +2 -2
- package/dist/importer.d.ts +2 -2
- package/dist/importer.d.ts.map +1 -1
- package/dist/importer.js +1 -1
- package/dist/importer.js.map +1 -1
- package/dist/index.d.ts +66 -63
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +86 -75
- package/dist/index.js.map +1 -1
- package/dist/io.js +8 -8
- package/dist/llms.d.ts +1 -1
- package/dist/llms.d.ts.map +1 -1
- package/dist/llms.js +65 -64
- package/dist/llms.js.map +1 -1
- package/dist/markdown.d.ts.map +1 -1
- package/dist/markdown.js.map +1 -1
- package/dist/og-image.d.ts +8 -8
- package/dist/og-image.d.ts.map +1 -1
- package/dist/og-image.js +91 -84
- package/dist/og-image.js.map +1 -1
- package/dist/page-document.d.ts +8 -8
- package/dist/page-document.d.ts.map +1 -1
- package/dist/page-document.js +48 -54
- package/dist/page-document.js.map +1 -1
- package/dist/parseReadme.d.ts.map +1 -1
- package/dist/parseReadme.js +9 -11
- package/dist/parseReadme.js.map +1 -1
- package/dist/prepare.d.ts +5 -5
- package/dist/prepare.d.ts.map +1 -1
- package/dist/prepare.js +25 -35
- package/dist/prepare.js.map +1 -1
- package/dist/related.d.ts +1 -1
- package/dist/schema.d.ts +21 -21
- package/dist/schema.d.ts.map +1 -1
- package/dist/schema.js +130 -141
- package/dist/schema.js.map +1 -1
- package/dist/site-artifacts.js +1 -1
- package/dist/sitemap.d.ts +2 -2
- package/dist/sitemap.d.ts.map +1 -1
- package/dist/sitemap.js +39 -39
- package/dist/sitemap.js.map +1 -1
- package/dist/slug.js +4 -4
- package/dist/sync-icons.js +15 -15
- package/dist/taxonomy-inference.d.ts +27 -0
- package/dist/taxonomy-inference.d.ts.map +1 -0
- package/dist/taxonomy-inference.js +38 -0
- package/dist/taxonomy-inference.js.map +1 -0
- package/dist/validate.d.ts +3 -3
- package/dist/validate.d.ts.map +1 -1
- package/dist/validate.js +56 -58
- package/dist/validate.js.map +1 -1
- package/dist/yaml.d.ts +47 -0
- package/dist/yaml.d.ts.map +1 -0
- package/dist/yaml.js +56 -0
- package/dist/yaml.js.map +1 -0
- package/package.json +1 -1
package/dist/decisions.js
CHANGED
|
@@ -1,21 +1,19 @@
|
|
|
1
|
-
import { mkdir, readdir, readFile, writeFile } from
|
|
2
|
-
import { basename, join, resolve } from
|
|
3
|
-
import { parse as parseYaml } from
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
1
|
+
import { mkdir, readdir, readFile, writeFile } from 'node:fs/promises';
|
|
2
|
+
import { basename, join, resolve } from 'node:path';
|
|
3
|
+
import { parse as parseYaml } from 'yaml';
|
|
4
|
+
import { loadConfig } from './config.js';
|
|
5
|
+
import { blueprintKind, recordsFileSchema } from './schema.js';
|
|
6
6
|
function toCandidate(record) {
|
|
7
|
-
const name = record.kind ===
|
|
8
|
-
const url = record.links?.github ?? record.links?.website ?? record.links?.source ??
|
|
9
|
-
const health = record
|
|
10
|
-
|
|
11
|
-
const gh = record
|
|
12
|
-
.github?.repository;
|
|
7
|
+
const name = record.kind === 'resource' ? record.title : record.name;
|
|
8
|
+
const url = record.links?.github ?? record.links?.website ?? record.links?.source ?? '';
|
|
9
|
+
const health = record.health;
|
|
10
|
+
const gh = record.github?.repository;
|
|
13
11
|
return {
|
|
14
12
|
slug: record.slug,
|
|
15
13
|
name,
|
|
16
14
|
url,
|
|
17
|
-
status: health?.status ??
|
|
18
|
-
tier: health?.tier ??
|
|
15
|
+
status: health?.status ?? 'unknown',
|
|
16
|
+
tier: health?.tier ?? 'experimental',
|
|
19
17
|
staleReason: health?.staleReason ?? null,
|
|
20
18
|
lastCommitAt: gh?.pushed_at ?? null,
|
|
21
19
|
stars: gh?.stargazers_count ?? 0,
|
|
@@ -27,7 +25,7 @@ export function pickCleanupCandidates(records) {
|
|
|
27
25
|
const health = r.health;
|
|
28
26
|
if (health?.cleanupCandidate)
|
|
29
27
|
return true;
|
|
30
|
-
if (health?.status ===
|
|
28
|
+
if (health?.status === 'unknown' || health?.status === 'needs_review')
|
|
31
29
|
return true;
|
|
32
30
|
return false;
|
|
33
31
|
});
|
|
@@ -46,12 +44,12 @@ export async function cleanupStale(cwd = process.cwd(), config) {
|
|
|
46
44
|
await mkdir(outDir, { recursive: true });
|
|
47
45
|
const expectedKind = blueprintKind[cfg.blueprint];
|
|
48
46
|
const entries = await readdir(recordsDir).catch(() => []);
|
|
49
|
-
const files = entries.filter((f) => f.endsWith(
|
|
47
|
+
const files = entries.filter((f) => f.endsWith('.yml')).sort();
|
|
50
48
|
const records = [];
|
|
51
49
|
for (const file of files) {
|
|
52
|
-
const fileSlug = basename(file,
|
|
53
|
-
const text = await readFile(join(recordsDir, file),
|
|
54
|
-
const raw = (parseYaml(text, { schema:
|
|
50
|
+
const fileSlug = basename(file, '.yml');
|
|
51
|
+
const text = await readFile(join(recordsDir, file), 'utf8');
|
|
52
|
+
const raw = (parseYaml(text, { schema: 'core' }) ?? {});
|
|
55
53
|
if (!raw.kind)
|
|
56
54
|
raw.kind = expectedKind;
|
|
57
55
|
try {
|
|
@@ -70,8 +68,8 @@ export async function cleanupStale(cwd = process.cwd(), config) {
|
|
|
70
68
|
totalCandidates: candidates.length,
|
|
71
69
|
candidates,
|
|
72
70
|
};
|
|
73
|
-
const path = join(outDir,
|
|
74
|
-
await writeFile(path, JSON.stringify(report, null, 2),
|
|
71
|
+
const path = join(outDir, 'cleanup-report.json');
|
|
72
|
+
await writeFile(path, JSON.stringify(report, null, 2), 'utf8');
|
|
75
73
|
return { report, path };
|
|
76
74
|
}
|
|
77
75
|
//# sourceMappingURL=decisions.js.map
|
package/dist/decisions.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"decisions.js","sourceRoot":"","sources":["../src/decisions.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AACvE,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpD,OAAO,EAAE,KAAK,IAAI,SAAS,EAAE,MAAM,MAAM,CAAC;AAC1C,OAAO,
|
|
1
|
+
{"version":3,"file":"decisions.js","sourceRoot":"","sources":["../src/decisions.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AACvE,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpD,OAAO,EAAE,KAAK,IAAI,SAAS,EAAE,MAAM,MAAM,CAAC;AAC1C,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,aAAa,EAAmC,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAoBhG,SAA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AAQ,CAAC;YAC3B,OAAO,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;QAC3B,CAAC;QAAC,MAAM,CAAC;YACP,uCAAuC;QACzC,CAAC;IACH,CAAC;IAED,MAAM,UAAU,GAAG,qBAAqB,CAAC,OAAO,CAAC,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC;IACnE,MAAM,MAAM,GAAkB;QAC5B,WAAW,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;QACrC,SAAS,EAAE,GAAG,CAAC,SAAS;QACxB,eAAe,EAAE,UAAU,CAAC,MAAM;QAClC,UAAU;KACX,CAAC;IACF,MAAM,IAAI,GAAG,IAAI,CAAC,MAAM,EAAE,qBAAqB,CAAC,CAAC;IACjD,MAAM,SAAS,CAAC,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC,EAAE,MAAM,CAAC,CAAC;IAC/D,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC;AAC1B,CAAC"}
|
|
@@ -5,8 +5,10 @@
|
|
|
5
5
|
* validation, and generation so client controllers can reuse Grove's
|
|
6
6
|
* canonical filter, sort, and lens rules without Node-only dependencies.
|
|
7
7
|
*/
|
|
8
|
-
export * from
|
|
9
|
-
export * from
|
|
10
|
-
export
|
|
11
|
-
export
|
|
8
|
+
export * from './directory-display.js';
|
|
9
|
+
export * from './directory-facets.js';
|
|
10
|
+
export type { DirectoryFilterGroupKey, DirectoryFilterLabel, DirectoryFilterParamKey, DirectoryTaxonomyKind, } from './directory-filter-keys.js';
|
|
11
|
+
export { DIRECTORY_FILTER_KEYS, DIRECTORY_FILTER_LABELS, DIRECTORY_TAXONOMY_KINDS, FACET_DIMENSION_FOR_KEY, isDirectoryFilterGroupKey, } from './directory-filter-keys.js';
|
|
12
|
+
export * from './directory-lenses.js';
|
|
13
|
+
export * from './directory-search.js';
|
|
12
14
|
//# sourceMappingURL=directory-client.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"directory-client.d.ts","sourceRoot":"","sources":["../src/directory-client.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,cAAc,wBAAwB,CAAC;AACvC,cAAc,uBAAuB,CAAC;AACtC,cAAc,uBAAuB,CAAC;AACtC,cAAc,uBAAuB,CAAC"}
|
|
1
|
+
{"version":3,"file":"directory-client.d.ts","sourceRoot":"","sources":["../src/directory-client.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,cAAc,wBAAwB,CAAC;AACvC,cAAc,uBAAuB,CAAC;AACtC,YAAY,EACV,uBAAuB,EACvB,oBAAoB,EACpB,uBAAuB,EACvB,qBAAqB,GACtB,MAAM,4BAA4B,CAAC;AAKpC,OAAO,EACL,qBAAqB,EACrB,uBAAuB,EACvB,wBAAwB,EACxB,uBAAuB,EACvB,yBAAyB,GAC1B,MAAM,4BAA4B,CAAC;AACpC,cAAc,uBAAuB,CAAC;AACtC,cAAc,uBAAuB,CAAC"}
|
package/dist/directory-client.js
CHANGED
|
@@ -5,8 +5,13 @@
|
|
|
5
5
|
* validation, and generation so client controllers can reuse Grove's
|
|
6
6
|
* canonical filter, sort, and lens rules without Node-only dependencies.
|
|
7
7
|
*/
|
|
8
|
-
export * from
|
|
9
|
-
export * from
|
|
10
|
-
|
|
11
|
-
|
|
8
|
+
export * from './directory-display.js';
|
|
9
|
+
export * from './directory-facets.js';
|
|
10
|
+
// Filter-key mapping is a pure data table (no IO, no schema deps).
|
|
11
|
+
// Re-exported here so client controllers like DirectoryIndexClient
|
|
12
|
+
// can import the same single source the server uses, instead of
|
|
13
|
+
// duplicating the keys/labels/kinds inline.
|
|
14
|
+
export { DIRECTORY_FILTER_KEYS, DIRECTORY_FILTER_LABELS, DIRECTORY_TAXONOMY_KINDS, FACET_DIMENSION_FOR_KEY, isDirectoryFilterGroupKey, } from './directory-filter-keys.js';
|
|
15
|
+
export * from './directory-lenses.js';
|
|
16
|
+
export * from './directory-search.js';
|
|
12
17
|
//# sourceMappingURL=directory-client.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"directory-client.js","sourceRoot":"","sources":["../src/directory-client.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,cAAc,wBAAwB,CAAC;AACvC,cAAc,uBAAuB,CAAC;
|
|
1
|
+
{"version":3,"file":"directory-client.js","sourceRoot":"","sources":["../src/directory-client.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,cAAc,wBAAwB,CAAC;AACvC,cAAc,uBAAuB,CAAC;AAOtC,mEAAmE;AACnE,mEAAmE;AACnE,gEAAgE;AAChE,4CAA4C;AAC5C,OAAO,EACL,qBAAqB,EACrB,uBAAuB,EACvB,wBAAwB,EACxB,uBAAuB,EACvB,yBAAyB,GAC1B,MAAM,4BAA4B,CAAC;AACpC,cAAc,uBAAuB,CAAC;AACtC,cAAc,uBAAuB,CAAC"}
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
export declare const FACET_IDS: readonly ["category", "stack", "platform", "tags", "license"];
|
|
13
13
|
export type FacetId = (typeof FACET_IDS)[number];
|
|
14
14
|
/** Keys of the `buildFacets()` result / `IndexFilters` dimensions. */
|
|
15
|
-
export type FacetDimension =
|
|
15
|
+
export type FacetDimension = 'categories' | 'stacks' | 'platforms' | 'tags' | 'licenses';
|
|
16
16
|
export interface FacetDef {
|
|
17
17
|
id: FacetId;
|
|
18
18
|
/** Key into `buildFacets()` output and `IndexFilters`. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"directory-facets.d.ts","sourceRoot":"","sources":["../src/directory-facets.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,0EAA0E;AAC1E,eAAO,MAAM,SAAS,+DAAgE,CAAC;AACvF,MAAM,MAAM,OAAO,GAAG,CAAC,OAAO,SAAS,CAAC,CAAC,MAAM,CAAC,CAAC;AAEjD,sEAAsE;AACtE,MAAM,MAAM,cAAc,GAAG,YAAY,GAAG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AC,EAAE,SAAS,MAAM,EAAE,GAAG,QAAQ,EAAE,CAW1E"}
|
package/dist/directory-facets.js
CHANGED
|
@@ -9,27 +9,45 @@
|
|
|
9
9
|
* can't drift into parallel alias tables.
|
|
10
10
|
*/
|
|
11
11
|
/** Canonical facet ids accepted by `browse.facets` (validated by zod). */
|
|
12
|
-
export const FACET_IDS = [
|
|
12
|
+
export const FACET_IDS = ['category', 'stack', 'platform', 'tags', 'license'];
|
|
13
13
|
export const FACET_DEFS = {
|
|
14
|
-
category: {
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
14
|
+
category: {
|
|
15
|
+
id: 'category',
|
|
16
|
+
dimension: 'categories',
|
|
17
|
+
label: 'Category',
|
|
18
|
+
urlParam: 'category',
|
|
19
|
+
single: false,
|
|
20
|
+
},
|
|
21
|
+
stack: { id: 'stack', dimension: 'stacks', label: 'Stack', urlParam: 'stack', single: false },
|
|
22
|
+
platform: {
|
|
23
|
+
id: 'platform',
|
|
24
|
+
dimension: 'platforms',
|
|
25
|
+
label: 'Platform',
|
|
26
|
+
urlParam: 'platform',
|
|
27
|
+
single: false,
|
|
28
|
+
},
|
|
29
|
+
tags: { id: 'tags', dimension: 'tags', label: 'Tag', urlParam: 'tag', single: false },
|
|
30
|
+
license: {
|
|
31
|
+
id: 'license',
|
|
32
|
+
dimension: 'licenses',
|
|
33
|
+
label: 'License',
|
|
34
|
+
urlParam: 'license',
|
|
35
|
+
single: true,
|
|
36
|
+
},
|
|
19
37
|
};
|
|
20
38
|
/** Default facet set when `browse.facets` is not configured. */
|
|
21
|
-
export const DEFAULT_FACETS = [
|
|
39
|
+
export const DEFAULT_FACETS = ['category', 'tags'];
|
|
22
40
|
const FACET_ALIASES = {
|
|
23
|
-
category:
|
|
24
|
-
categories:
|
|
25
|
-
stack:
|
|
26
|
-
stacks:
|
|
27
|
-
platform:
|
|
28
|
-
platforms:
|
|
29
|
-
tag:
|
|
30
|
-
tags:
|
|
31
|
-
license:
|
|
32
|
-
licenses:
|
|
41
|
+
category: 'category',
|
|
42
|
+
categories: 'category',
|
|
43
|
+
stack: 'stack',
|
|
44
|
+
stacks: 'stack',
|
|
45
|
+
platform: 'platform',
|
|
46
|
+
platforms: 'platform',
|
|
47
|
+
tag: 'tags',
|
|
48
|
+
tags: 'tags',
|
|
49
|
+
license: 'license',
|
|
50
|
+
licenses: 'license',
|
|
33
51
|
};
|
|
34
52
|
/**
|
|
35
53
|
* Normalize a facet spelling to its canonical id. The config schema
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"directory-facets.js","sourceRoot":"","sources":["../src/directory-facets.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,0EAA0E;AAC1E,MAAM,CAAC,MAAM,SAAS,GAAG,CAAC,UAAU,EAAE,OAAO,EAAE,UAAU,EAAE,MAAM,EAAE,SAAS,CAAU,CAAC;AAkBvF,MAAM,CAAC,MAAM,UAAU,GAA8B;IACnD,QAAQ,EAAE,EAAE,EAAE,
|
|
1
|
+
{"version":3,"file":"directory-facets.js","sourceRoot":"","sources":["../src/directory-facets.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,0EAA0E;AAC1E,MAAM,CAAC,MAAM,SAAS,GAAG,CAAC,UAAU,EAAE,OAAO,EAAE,UAAU,EAAE,MAAM,EAAE,SAAS,CAAU,CAAC;AAkBvF,MAAM,CAAC,MAAM,UAAU,GAA8B;IACnD,QAAQ,EAAE;QACR,EAAE,EAAE,UAAU;QACd,SAAS,EAAE,YAAY;QACvB,KAAK,EAAE,UAAU;QACjB,QAAQ,EAAE,UAAU;QACpB,MAAM,EAAE,KAAK;KACd;IACD,KAAK,EAAE,EAAE,EAAE,EAAE,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,KAAK,EAAE,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE;IAC7F,QAAQ,EAAE;QACR,EAAE,EAAE,UAAU;QACd,SAA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AC,EAAE,CAAC,CAAC;YACb,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,EAAE,CAAC,CAAC,CAAC;QAC5B,CAAC;IACH,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC"}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Single source of truth for the directory filter-key mapping.
|
|
3
|
+
*
|
|
4
|
+
* The browse-page controller (`DirectoryIndexClient.astro`), the
|
|
5
|
+
* refine panel (`RefinePanel.astro`), and the view-model builder
|
|
6
|
+
* (`server/directory.ts`) all need to know that the facet group
|
|
7
|
+
* with `data-filter-group-key="stacks"` writes its selections to
|
|
8
|
+
* the `stack` URL param, belongs to the `stacks` taxonomy kind,
|
|
9
|
+
* and displays with the "Stack" label. Pre-v1 these were three
|
|
10
|
+
* inline copies; this module is the one the v1 registry migration
|
|
11
|
+
* relies on so consumer-installed UI never drifts out of sync
|
|
12
|
+
* with the server's URL and taxonomy understanding.
|
|
13
|
+
*
|
|
14
|
+
* Per §22 of `apps/docs/v1-architecture.md`, this is pure-domain
|
|
15
|
+
* data. It can be imported by both server view-models and the
|
|
16
|
+
* client-side controller without creating a forbidden dependency
|
|
17
|
+
* from UI to engine internals.
|
|
18
|
+
*/
|
|
19
|
+
/** Group key written into `data-filter-group-key` on a facet group. */
|
|
20
|
+
export type DirectoryFilterGroupKey = 'stacks' | 'platforms' | 'categories' | 'tags' | 'licenses';
|
|
21
|
+
/**
|
|
22
|
+
* The URL search-param key the group writes its selected values to.
|
|
23
|
+
* Singular because each value is one record's id, not a multi.
|
|
24
|
+
*/
|
|
25
|
+
export type DirectoryFilterParamKey = 'stack' | 'platform' | 'category' | 'tag' | 'license';
|
|
26
|
+
/**
|
|
27
|
+
* The taxonomy kind the group belongs to. `tags` maps to the
|
|
28
|
+
* `topics` taxonomy kind (per the schema in `schema.ts`).
|
|
29
|
+
*/
|
|
30
|
+
export type DirectoryTaxonomyKind = 'stacks' | 'platforms' | 'categories' | 'topics' | 'licenses';
|
|
31
|
+
/** Singular, human-readable label rendered in chip/option UIs. */
|
|
32
|
+
export type DirectoryFilterLabel = 'Stack' | 'Platform' | 'Category' | 'Tag' | 'License';
|
|
33
|
+
/**
|
|
34
|
+
* Group key → URL param key. Single definition; consumed by every
|
|
35
|
+
* filter-aware surface.
|
|
36
|
+
*/
|
|
37
|
+
export declare const DIRECTORY_FILTER_KEYS: Readonly<Record<DirectoryFilterGroupKey, DirectoryFilterParamKey>>;
|
|
38
|
+
/**
|
|
39
|
+
* Group key → taxonomy kind the group's options are sourced from.
|
|
40
|
+
*/
|
|
41
|
+
export declare const DIRECTORY_TAXONOMY_KINDS: Readonly<Record<DirectoryFilterGroupKey, DirectoryTaxonomyKind>>;
|
|
42
|
+
/** Group key → display label for chips, trigger buttons, headings. */
|
|
43
|
+
export declare const DIRECTORY_FILTER_LABELS: Readonly<Record<DirectoryFilterGroupKey, DirectoryFilterLabel>>;
|
|
44
|
+
/**
|
|
45
|
+
* Reverse map. Given a URL param key, returns the set of group
|
|
46
|
+
* keys that map to it. Most params are 1:1; this is exposed so
|
|
47
|
+
* server helpers can answer "which group does this param belong
|
|
48
|
+
* to?" without re-implementing the table.
|
|
49
|
+
*/
|
|
50
|
+
export declare const FACET_DIMENSION_FOR_KEY: Readonly<Record<DirectoryFilterParamKey, DirectoryFilterGroupKey>>;
|
|
51
|
+
/** Type guard. */
|
|
52
|
+
export declare function isDirectoryFilterGroupKey(value: string): value is DirectoryFilterGroupKey;
|
|
53
|
+
//# sourceMappingURL=directory-filter-keys.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"directory-filter-keys.d.ts","sourceRoot":"","sources":["../src/directory-filter-keys.ts"],"names":[],"mappings":"AACA;;;;;;;;;;;;;;;;;GAiBG;AAEH,uEAAuE;AACvE,MAAM,MAAM,uBAAuB,GAAG,QAAQ,GAAG,WAAW,GAAG,YAAY,GAAG,MAAM,GAAG,UAAU,CAAC;AAElG;;;GAGG;AACH,MAAM,MAAM,uBAAuB,GAAG,OAAO,GAAG,UAAU,GAAG,UAAU,GAAG,KAAK,GAAG,SAAS,CAAC;AAE5F;;;GAGG;AACH,MAAM,MAAM,qBAAqB,GAAG,QAAQ,GAAG,WAAW,GAAG,YAAY,GAAG,QAAQ,GAAG,UAAU,CAAC;AAElG,kEAAkE;AAClE,MAAM,MAAM,oBAAoB,GAAG,OAAO,GAAG,UAAU,GAAG,UAAU,GAAG,KAAK,GAAG,SAAS,CAAC;AAEzF;;;GAGG;AACH,eAAO,MAAM,qBAAqB,EAAE,QAAQ,CAC1C,MAAM,CAAC,uBAAuB,EAAE,uBAAuB,CAAC,CAOxD,CAAC;AAEH;;GAEG;AACH,eAAO,MAAM,wBAAwB,EAAE,QAAQ,CAC7C,MAAM,CAAC,uBAAuB,EAAE,qBAAqB,CAAC,CAOtD,CAAC;AAEH,sEAAsE;AACtE,eAAO,MAAM,uBAAuB,EAAE,QAAQ,CAC5C,MAAM,CAAC,uBAAuB,EAAE,oBAAoB,CAAC,CAOrD,CAAC;AAEH;;;;;GAKG;AACH,eAAO,MAAM,uBAAuB,EAAE,QAAQ,CAC5C,MAAM,CAAC,uBAAuB,EAAE,uBAAuB,CAAC,CAOxD,CAAC;AAEH,kBAAkB;AAClB,wBAAgB,yBAAyB,CAAC,KAAK,EAAE,MAAM,GAAG,KAAK,IAAI,uBAAuB,CAEzF"}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
// SPDX-License-Identifier: MIT
|
|
2
|
+
/**
|
|
3
|
+
* Single source of truth for the directory filter-key mapping.
|
|
4
|
+
*
|
|
5
|
+
* The browse-page controller (`DirectoryIndexClient.astro`), the
|
|
6
|
+
* refine panel (`RefinePanel.astro`), and the view-model builder
|
|
7
|
+
* (`server/directory.ts`) all need to know that the facet group
|
|
8
|
+
* with `data-filter-group-key="stacks"` writes its selections to
|
|
9
|
+
* the `stack` URL param, belongs to the `stacks` taxonomy kind,
|
|
10
|
+
* and displays with the "Stack" label. Pre-v1 these were three
|
|
11
|
+
* inline copies; this module is the one the v1 registry migration
|
|
12
|
+
* relies on so consumer-installed UI never drifts out of sync
|
|
13
|
+
* with the server's URL and taxonomy understanding.
|
|
14
|
+
*
|
|
15
|
+
* Per §22 of `apps/docs/v1-architecture.md`, this is pure-domain
|
|
16
|
+
* data. It can be imported by both server view-models and the
|
|
17
|
+
* client-side controller without creating a forbidden dependency
|
|
18
|
+
* from UI to engine internals.
|
|
19
|
+
*/
|
|
20
|
+
/**
|
|
21
|
+
* Group key → URL param key. Single definition; consumed by every
|
|
22
|
+
* filter-aware surface.
|
|
23
|
+
*/
|
|
24
|
+
export const DIRECTORY_FILTER_KEYS = Object.freeze({
|
|
25
|
+
stacks: 'stack',
|
|
26
|
+
platforms: 'platform',
|
|
27
|
+
categories: 'category',
|
|
28
|
+
tags: 'tag',
|
|
29
|
+
licenses: 'license',
|
|
30
|
+
});
|
|
31
|
+
/**
|
|
32
|
+
* Group key → taxonomy kind the group's options are sourced from.
|
|
33
|
+
*/
|
|
34
|
+
export const DIRECTORY_TAXONOMY_KINDS = Object.freeze({
|
|
35
|
+
stacks: 'stacks',
|
|
36
|
+
platforms: 'platforms',
|
|
37
|
+
categories: 'categories',
|
|
38
|
+
tags: 'topics',
|
|
39
|
+
licenses: 'licenses',
|
|
40
|
+
});
|
|
41
|
+
/** Group key → display label for chips, trigger buttons, headings. */
|
|
42
|
+
export const DIRECTORY_FILTER_LABELS = Object.freeze({
|
|
43
|
+
stacks: 'Stack',
|
|
44
|
+
platforms: 'Platform',
|
|
45
|
+
categories: 'Category',
|
|
46
|
+
tags: 'Tag',
|
|
47
|
+
licenses: 'License',
|
|
48
|
+
});
|
|
49
|
+
/**
|
|
50
|
+
* Reverse map. Given a URL param key, returns the set of group
|
|
51
|
+
* keys that map to it. Most params are 1:1; this is exposed so
|
|
52
|
+
* server helpers can answer "which group does this param belong
|
|
53
|
+
* to?" without re-implementing the table.
|
|
54
|
+
*/
|
|
55
|
+
export const FACET_DIMENSION_FOR_KEY = Object.freeze({
|
|
56
|
+
stack: 'stacks',
|
|
57
|
+
platform: 'platforms',
|
|
58
|
+
category: 'categories',
|
|
59
|
+
tag: 'tags',
|
|
60
|
+
license: 'licenses',
|
|
61
|
+
});
|
|
62
|
+
/** Type guard. */
|
|
63
|
+
export function isDirectoryFilterGroupKey(value) {
|
|
64
|
+
return value in DIRECTORY_FILTER_KEYS;
|
|
65
|
+
}
|
|
66
|
+
//# sourceMappingURL=directory-filter-keys.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"directory-filter-keys.js","sourceRoot":"","sources":["../src/directory-filter-keys.ts"],"names":[],"mappings":"AAAA,+BAA+B;AAC/B;;;;;;;;;;;;;;;;;GAiBG;AAoBH;;;GAGG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAE9B,MAAM,CAAC,MAAM,CAAC;IAChB,MAAM,EAAE,OAAO;IACf,SAAS,EAAE,UAAU;IACrB,UAAU,EAAE,UAAU;IACtB,IAAI,EAAE,KAAK;IACX,QAAQ,EAAE,SAAS;CACpB,CAAC,CAAC;AAEH;;GAEG;AACH,MAAM,CAAC,MAAM,wBAAwB,GAEjC,MAAM,CAAC,MAAM,CAAC;IAChB,MAAM,EAAE,QAAQ;IAChB,SAAS,EAAE,WAAW;IACtB,UAAU,EAAE,YAAY;IACxB,IAAI,EAAE,QAAQ;IACd,QAAQ,EAAE,UAAU;CACrB,CAAC,CAAC;AAEH,sEAAsE;AACtE,MAAM,CAAC,MAAM,uBAAuB,GAEhC,MAAM,CAAC,MAAM,CAAC;IAChB,MAAM,EAAE,OAAO;IACf,SAAS,EAAE,UAAU;IACrB,UAAU,EAAE,UAAU;IACtB,IAAI,EAAE,KAAK;IACX,QAAQ,EAAE,SAAS;CACpB,CAAC,CAAC;AAEH;;;;;GAKG;AACH,MAAM,CAAC,MAAM,uBAAuB,GAEhC,MAAM,CAAC,MAAM,CAAC;IAChB,KAAK,EAAE,QAAQ;IACf,QAAQ,EAAE,WAAW;IACrB,QAAQ,EAAE,YAAY;IACtB,GAAG,EAAE,MAAM;IACX,OAAO,EAAE,UAAU;CACpB,CAAC,CAAC;AAEH,kBAAkB;AAClB,MAAM,UAAU,yBAAyB,CAAC,KAAa;IACrD,OAAO,KAAK,IAAI,qBAAqB,CAAC;AACxC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"directory-format.d.ts","sourceRoot":"","sources":["../src/directory-format.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH;;;GAGG;AACH,wBAAgB,OAAO,CAAC,CAAC,EAAE,MAAM,GAAG,MAAM,CAMzC;AAED;;;GAGG;AACH,wBAAgB,WAAW,CAAC,CAAC,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,GAAG,MAAM,GAAG,IAAI,CAGvE;AAED;;;;GAIG;AACH,wBAAgB,cAAc,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,GAAG,MAAM,CAcrE;AAED;;;;;;;;GAQG;AACH,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,SAAM,GAAG,MAAM,CAS7D;AAED;;;;GAIG;AACH,wBAAgB,SAAS,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM,CAEjF;AAED;;;;;GAKG;AACH,wBAAgB,WAAW,
|
|
1
|
+
{"version":3,"file":"directory-format.d.ts","sourceRoot":"","sources":["../src/directory-format.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH;;;GAGG;AACH,wBAAgB,OAAO,CAAC,CAAC,EAAE,MAAM,GAAG,MAAM,CAMzC;AAED;;;GAGG;AACH,wBAAgB,WAAW,CAAC,CAAC,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,GAAG,MAAM,GAAG,IAAI,CAGvE;AAED;;;;GAIG;AACH,wBAAgB,cAAc,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,GAAG,MAAM,CAcrE;AAED;;;;;;;;GAQG;AACH,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,SAAM,GAAG,MAAM,CAS7D;AAED;;;;GAIG;AACH,wBAAgB,SAAS,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM,CAEjF;AAED;;;;;GAKG;AACH,wBAAgB,WAAW,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE;IAAE,QAAQ,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,GAAG,MAAM,CAE7F;AAED;;;;GAIG;AACH,wBAAgB,UAAU,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,GAAG,MAAM,CASjE"}
|
package/dist/directory-format.js
CHANGED
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
export function compact(n) {
|
|
12
12
|
if (n >= 1000) {
|
|
13
13
|
const k = n / 1000;
|
|
14
|
-
return (k >= 10 ? Math.round(k).toString() : k.toFixed(1)) +
|
|
14
|
+
return (k >= 10 ? Math.round(k).toString() : k.toFixed(1)) + 'k';
|
|
15
15
|
}
|
|
16
16
|
return n.toString();
|
|
17
17
|
}
|
|
@@ -20,7 +20,7 @@ export function compact(n) {
|
|
|
20
20
|
* finite number, so callers can render "—" without an extra guard.
|
|
21
21
|
*/
|
|
22
22
|
export function formatStars(n) {
|
|
23
|
-
if (typeof n !==
|
|
23
|
+
if (typeof n !== 'number' || !Number.isFinite(n))
|
|
24
24
|
return null;
|
|
25
25
|
return compact(n);
|
|
26
26
|
}
|
|
@@ -31,25 +31,25 @@ export function formatStars(n) {
|
|
|
31
31
|
*/
|
|
32
32
|
export function formatRelative(iso) {
|
|
33
33
|
if (!iso)
|
|
34
|
-
return
|
|
34
|
+
return '—';
|
|
35
35
|
const d = new Date(iso);
|
|
36
36
|
if (Number.isNaN(d.valueOf()))
|
|
37
|
-
return
|
|
37
|
+
return '—';
|
|
38
38
|
const days = Math.floor((Date.now() - d.valueOf()) / (1000 * 60 * 60 * 24));
|
|
39
39
|
if (days <= 0)
|
|
40
|
-
return
|
|
40
|
+
return 'today';
|
|
41
41
|
if (days === 1)
|
|
42
|
-
return
|
|
42
|
+
return '1d ago';
|
|
43
43
|
if (days < 30)
|
|
44
44
|
return `${days}d ago`;
|
|
45
45
|
const months = Math.floor(days / 30);
|
|
46
46
|
if (months === 1)
|
|
47
|
-
return
|
|
47
|
+
return '1mo ago';
|
|
48
48
|
if (months < 12)
|
|
49
49
|
return `${months}mo ago`;
|
|
50
50
|
const years = Math.floor(months / 12);
|
|
51
51
|
if (years === 1)
|
|
52
|
-
return
|
|
52
|
+
return '1y ago';
|
|
53
53
|
return `${years}y ago`;
|
|
54
54
|
}
|
|
55
55
|
/**
|
|
@@ -66,11 +66,11 @@ export function truncateWords(text, max = 140) {
|
|
|
66
66
|
if (value.length <= max)
|
|
67
67
|
return value;
|
|
68
68
|
const window = value.slice(0, max);
|
|
69
|
-
const lastSpace = window.lastIndexOf(
|
|
69
|
+
const lastSpace = window.lastIndexOf(' ');
|
|
70
70
|
// A single word longer than the budget has no boundary to cut on;
|
|
71
71
|
// the hard slice is the honest fallback.
|
|
72
72
|
const head = lastSpace > max * 0.5 ? window.slice(0, lastSpace) : window;
|
|
73
|
-
return `${head.replace(/[\s.,;:!?—-]+$/,
|
|
73
|
+
return `${head.replace(/[\s.,;:!?—-]+$/, '')}…`;
|
|
74
74
|
}
|
|
75
75
|
/**
|
|
76
76
|
* Pick the singular or plural noun for a count. The plural form is
|
|
@@ -96,14 +96,14 @@ export function formatCount(count, noun) {
|
|
|
96
96
|
*/
|
|
97
97
|
export function formatDate(iso) {
|
|
98
98
|
if (!iso)
|
|
99
|
-
return
|
|
99
|
+
return '—';
|
|
100
100
|
const d = new Date(iso);
|
|
101
101
|
if (Number.isNaN(d.valueOf()))
|
|
102
102
|
return iso;
|
|
103
|
-
return d.toLocaleDateString(
|
|
104
|
-
year:
|
|
105
|
-
month:
|
|
106
|
-
day:
|
|
103
|
+
return d.toLocaleDateString('en-US', {
|
|
104
|
+
year: 'numeric',
|
|
105
|
+
month: 'short',
|
|
106
|
+
day: 'numeric',
|
|
107
107
|
});
|
|
108
108
|
}
|
|
109
109
|
//# sourceMappingURL=directory-format.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"directory-format.js","sourceRoot":"","sources":["../src/directory-format.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH;;;GAGG;AACH,MAAM,UAAU,OAAO,CAAC,CAAS;IAC/B,IAAI,CAAC,IAAI,IAAI,EAAE,CAAC;QACd,MAAM,CAAC,GAAG,CAAC,GAAG,IAAI,CAAC;QACnB,OAAO,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,GAAG,GAAG,CAAC;IACnE,CAAC;IACD,OAAO,CAAC,CAAC,QAAQ,EAAE,CAAC;AACtB,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,WAAW,CAAC,CAA4B;IACtD,IAAI,OAAO,CAAC,KAAK,QAAQ,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAC;QAAE,OAAO,IAAI,CAAC;IAC9D,OAAO,OAAO,CAAC,CAAC,CAAC,CAAC;AACpB,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,cAAc,CAAC,GAA8B;IAC3D,IAAI,CAAC,GAAG;QAAE,OAAO,GAAG,CAAC;IACrB,MAAM,CAAC,GAAG,IAAI,IAAI,CAAC,GAAG,CAAC,CAAC;IACxB,IAAI,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,OAAO,EAAE,CAAC;QAAE,OAAO,GAAG,CAAC;IAC1C,MAAM,IAAI,GAAG,IAA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AAM,CAAC,KAAK,CAAC,CAAC,EAAE,SAAS,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC;IACzE,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC,gBAAgB,EAAE,EAAE,CAAC,GAAG,CAAC;AAClD,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,SAAS,CAAC,KAAa,EAAE,QAAgB,EAAE,MAAc;IACvE,OAAO,KAAK,KAAK,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAC;AACzC,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,WAAW,CAAC,KAAa,EAAE,IAA0C;IACnF,OAAO,GAAG,KAAK,IAAI,SAAS,CAAC,KAAK,EAAE,IAAI,CAAC,QAAQ,EAAE,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC;AACpE,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,UAAU,CAAC,GAA8B;IACvD,IAAI,CAAC,GAAG;QAAE,OAAO,GAAG,CAAC;IACrB,MAAM,CAAC,GAAG,IAAI,IAAI,CAAC,GAAG,CAAC,CAAC;IACxB,IAAI,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,OAAO,EAAE,CAAC;QAAE,OAAO,GAAG,CAAC;IAC1C,OAAO,CAAC,CAAC,kBAAkB,CAAC,OAAO,EAAE;QACnC,IAAI,EAAE,SAAS;QACf,KAAK,EAAE,OAAO;QACd,GAAG,EAAE,SAAS;KACf,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
* remain in the union type for URL deep-linking and future use, but are
|
|
15
15
|
* not shown in the UI by default.
|
|
16
16
|
*/
|
|
17
|
-
export type LensId =
|
|
17
|
+
export type LensId = 'all' | 'recently-updated' | 'new' | 'hot' | 'mature' | 'good-to-learn' | 'production-like' | 'beginner-friendly' | 'contribution-ready' | 'launches' | 'actively-developed' | 'needs-maintainer';
|
|
18
18
|
export interface LensDef {
|
|
19
19
|
id: LensId;
|
|
20
20
|
label: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"directory-lenses.d.ts","sourceRoot":"","sources":["../src/directory-lenses.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,MAAM,MAAM,MAAM,GAEd,KAAK,GACL,kBAAkB,GAClB,KAAK,GAEL,KAAK,GACL,QAAQ,GAER,eAAe,GACf,iBAAiB,GAEjB,mBAAmB,GACnB,oBAAoB,GACpB,UAAU,GAEV,oBAAoB,GACpB,kBAAkB,CAAC;AAEvB,MAAM,WAAW,OAAO;IACtB,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,iDAAiD;IACjD,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,+DAA+D;IAC/D,QAAQ,EAAE,MAAM,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC,CAAC;CACnD;AAED,eAAO,MAAM,MAAM,EAAE,OAAO,
|
|
1
|
+
{"version":3,"file":"directory-lenses.d.ts","sourceRoot":"","sources":["../src/directory-lenses.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,MAAM,MAAM,MAAM,GAEd,KAAK,GACL,kBAAkB,GAClB,KAAK,GAEL,KAAK,GACL,QAAQ,GAER,eAAe,GACf,iBAAiB,GAEjB,mBAAmB,GACnB,oBAAoB,GACpB,UAAU,GAEV,oBAAoB,GACpB,kBAAkB,CAAC;AAEvB,MAAM,WAAW,OAAO;IACtB,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,iDAAiD;IACjD,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,+DAA+D;IAC/D,QAAQ,EAAE,MAAM,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC,CAAC;CACnD;AAED,eAAO,MAAM,MAAM,EAAE,OAAO,EA0E3B,CAAC;AAEF;;;;;;;;;;;;;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