@cyanheads/browser-compat-mcp-server 0.1.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/AGENTS.md +451 -0
- package/CLAUDE.md +451 -0
- package/Dockerfile +140 -0
- package/LICENSE +201 -0
- package/README.md +306 -0
- package/THIRD_PARTY_NOTICES.md +279 -0
- package/changelog/0.1.x/0.1.1.md +20 -0
- package/changelog/template.md +151 -0
- package/dist/data/browserslist-bcd-map.d.ts +40 -0
- package/dist/data/browserslist-bcd-map.d.ts.map +1 -0
- package/dist/data/browserslist-bcd-map.js +42 -0
- package/dist/data/browserslist-bcd-map.js.map +1 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +51 -0
- package/dist/index.js.map +1 -0
- package/dist/mcp-server/tools/definitions/browsercompat-check-baseline.tool.d.ts +79 -0
- package/dist/mcp-server/tools/definitions/browsercompat-check-baseline.tool.d.ts.map +1 -0
- package/dist/mcp-server/tools/definitions/browsercompat-check-baseline.tool.js +213 -0
- package/dist/mcp-server/tools/definitions/browsercompat-check-baseline.tool.js.map +1 -0
- package/dist/mcp-server/tools/definitions/browsercompat-compare-support.tool.d.ts +103 -0
- package/dist/mcp-server/tools/definitions/browsercompat-compare-support.tool.d.ts.map +1 -0
- package/dist/mcp-server/tools/definitions/browsercompat-compare-support.tool.js +320 -0
- package/dist/mcp-server/tools/definitions/browsercompat-compare-support.tool.js.map +1 -0
- package/dist/mcp-server/tools/definitions/browsercompat-get-feature.tool.d.ts +110 -0
- package/dist/mcp-server/tools/definitions/browsercompat-get-feature.tool.d.ts.map +1 -0
- package/dist/mcp-server/tools/definitions/browsercompat-get-feature.tool.js +229 -0
- package/dist/mcp-server/tools/definitions/browsercompat-get-feature.tool.js.map +1 -0
- package/dist/mcp-server/tools/definitions/browsercompat-list-reference.tool.d.ts +40 -0
- package/dist/mcp-server/tools/definitions/browsercompat-list-reference.tool.d.ts.map +1 -0
- package/dist/mcp-server/tools/definitions/browsercompat-list-reference.tool.js +237 -0
- package/dist/mcp-server/tools/definitions/browsercompat-list-reference.tool.js.map +1 -0
- package/dist/mcp-server/tools/definitions/browsercompat-search-features.tool.d.ts +79 -0
- package/dist/mcp-server/tools/definitions/browsercompat-search-features.tool.d.ts.map +1 -0
- package/dist/mcp-server/tools/definitions/browsercompat-search-features.tool.js +208 -0
- package/dist/mcp-server/tools/definitions/browsercompat-search-features.tool.js.map +1 -0
- package/dist/mcp-server/tools/definitions/compat-shapes.d.ts +96 -0
- package/dist/mcp-server/tools/definitions/compat-shapes.d.ts.map +1 -0
- package/dist/mcp-server/tools/definitions/compat-shapes.js +164 -0
- package/dist/mcp-server/tools/definitions/compat-shapes.js.map +1 -0
- package/dist/services/baseline/baseline-service.d.ts +45 -0
- package/dist/services/baseline/baseline-service.d.ts.map +1 -0
- package/dist/services/baseline/baseline-service.js +119 -0
- package/dist/services/baseline/baseline-service.js.map +1 -0
- package/dist/services/baseline/feature-resolver.d.ts +21 -0
- package/dist/services/baseline/feature-resolver.d.ts.map +1 -0
- package/dist/services/baseline/feature-resolver.js +85 -0
- package/dist/services/baseline/feature-resolver.js.map +1 -0
- package/dist/services/baseline/types.d.ts +83 -0
- package/dist/services/baseline/types.d.ts.map +1 -0
- package/dist/services/baseline/types.js +8 -0
- package/dist/services/baseline/types.js.map +1 -0
- package/dist/services/bcd/bcd-service.d.ts +89 -0
- package/dist/services/bcd/bcd-service.d.ts.map +1 -0
- package/dist/services/bcd/bcd-service.js +420 -0
- package/dist/services/bcd/bcd-service.js.map +1 -0
- package/dist/services/bcd/types.d.ts +54 -0
- package/dist/services/bcd/types.d.ts.map +1 -0
- package/dist/services/bcd/types.js +7 -0
- package/dist/services/bcd/types.js.map +1 -0
- package/dist/services/data-version/data-version-service.d.ts +21 -0
- package/dist/services/data-version/data-version-service.d.ts.map +1 -0
- package/dist/services/data-version/data-version-service.js +60 -0
- package/dist/services/data-version/data-version-service.js.map +1 -0
- package/dist/services/search/search-service.d.ts +37 -0
- package/dist/services/search/search-service.d.ts.map +1 -0
- package/dist/services/search/search-service.js +264 -0
- package/dist/services/search/search-service.js.map +1 -0
- package/dist/services/search/types.d.ts +37 -0
- package/dist/services/search/types.d.ts.map +1 -0
- package/dist/services/search/types.js +7 -0
- package/dist/services/search/types.js.map +1 -0
- package/dist/services/targets/targets-service.d.ts +58 -0
- package/dist/services/targets/targets-service.d.ts.map +1 -0
- package/dist/services/targets/targets-service.js +176 -0
- package/dist/services/targets/targets-service.js.map +1 -0
- package/dist/services/targets/types.d.ts +28 -0
- package/dist/services/targets/types.d.ts.map +1 -0
- package/dist/services/targets/types.js +7 -0
- package/dist/services/targets/types.js.map +1 -0
- package/package.json +118 -0
- package/server.json +99 -0
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Baseline service — the web-features feature map, the
|
|
3
|
+
* `by_compat_key` index that is the authority for per-key Baseline state, the
|
|
4
|
+
* redirect map for moved and split entries, groups, and snapshots.
|
|
5
|
+
* @module services/baseline/baseline-service
|
|
6
|
+
*/
|
|
7
|
+
/** Map a raw web-features baseline value onto the reported state word. */
|
|
8
|
+
function stateFor(raw) {
|
|
9
|
+
if (raw === 'high')
|
|
10
|
+
return 'widely';
|
|
11
|
+
if (raw === 'low')
|
|
12
|
+
return 'newly';
|
|
13
|
+
return 'limited';
|
|
14
|
+
}
|
|
15
|
+
/** Build the reported Baseline shape from a status block, preserving `≤` dates verbatim. */
|
|
16
|
+
function baselineFrom(status) {
|
|
17
|
+
const low = status.baseline_low_date;
|
|
18
|
+
const high = status.baseline_high_date;
|
|
19
|
+
const isUpperBound = Boolean(low?.startsWith('≤')) || Boolean(high?.startsWith('≤'));
|
|
20
|
+
return {
|
|
21
|
+
state: stateFor(status.baseline),
|
|
22
|
+
...(low === undefined ? {} : { since_date: low }),
|
|
23
|
+
...(high === undefined ? {} : { high_date: high }),
|
|
24
|
+
...(isUpperBound ? { date_is_upper_bound: true } : {}),
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* In-memory index over the bundled web-features snapshot. Immutable and
|
|
29
|
+
* process-global.
|
|
30
|
+
*/
|
|
31
|
+
export class BaselineService {
|
|
32
|
+
features;
|
|
33
|
+
groups;
|
|
34
|
+
snapshots;
|
|
35
|
+
coreBrowserIds;
|
|
36
|
+
owners;
|
|
37
|
+
constructor(features, groups, snapshots, browsers) {
|
|
38
|
+
this.features = features;
|
|
39
|
+
this.groups = groups;
|
|
40
|
+
this.snapshots = snapshots;
|
|
41
|
+
this.coreBrowserIds = Object.keys(browsers).sort();
|
|
42
|
+
this.owners = new Map();
|
|
43
|
+
for (const [featureId, entry] of Object.entries(features)) {
|
|
44
|
+
if (entry.kind !== 'feature')
|
|
45
|
+
continue;
|
|
46
|
+
const byCompatKey = entry.status.by_compat_key;
|
|
47
|
+
if (!byCompatKey)
|
|
48
|
+
continue;
|
|
49
|
+
for (const [key, status] of Object.entries(byCompatKey)) {
|
|
50
|
+
this.owners.set(key, { featureId, status });
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
/** True when the id names a web-features entry of any kind. */
|
|
55
|
+
has(id) {
|
|
56
|
+
return Object.hasOwn(this.features, id);
|
|
57
|
+
}
|
|
58
|
+
/** The web-features entry for an id, or `undefined`. */
|
|
59
|
+
entry(id) {
|
|
60
|
+
return this.features[id];
|
|
61
|
+
}
|
|
62
|
+
/** The entry for an id when it is a real feature rather than a redirect. */
|
|
63
|
+
feature(id) {
|
|
64
|
+
const entry = this.features[id];
|
|
65
|
+
return entry && entry.kind === 'feature' ? entry : undefined;
|
|
66
|
+
}
|
|
67
|
+
/** Targets of a moved or split entry, in declaration order. */
|
|
68
|
+
redirectTargets(id) {
|
|
69
|
+
const entry = this.features[id];
|
|
70
|
+
if (!entry || entry.kind === 'feature')
|
|
71
|
+
return [];
|
|
72
|
+
if (entry.redirect_targets)
|
|
73
|
+
return [...entry.redirect_targets];
|
|
74
|
+
return entry.redirect_target ? [entry.redirect_target] : [];
|
|
75
|
+
}
|
|
76
|
+
/** The feature that owns a BCD key in `by_compat_key`, the authority for Baseline. */
|
|
77
|
+
keyOwner(bcdKey) {
|
|
78
|
+
return this.owners.get(bcdKey);
|
|
79
|
+
}
|
|
80
|
+
/** Baseline reported for one BCD key — `not_mapped` when web-features owns no entry. */
|
|
81
|
+
baselineForKey(bcdKey) {
|
|
82
|
+
const owner = this.owners.get(bcdKey);
|
|
83
|
+
if (!owner)
|
|
84
|
+
return { state: 'not_mapped' };
|
|
85
|
+
return baselineFrom(owner.status);
|
|
86
|
+
}
|
|
87
|
+
/** Baseline rolled up for one feature id, when the id names a real feature. */
|
|
88
|
+
baselineForFeature(id) {
|
|
89
|
+
const feature = this.feature(id);
|
|
90
|
+
return feature ? baselineFrom(feature.status) : undefined;
|
|
91
|
+
}
|
|
92
|
+
/** The BCD keys a feature owns, in declaration order. */
|
|
93
|
+
compatKeys(id) {
|
|
94
|
+
return [...(this.feature(id)?.compat_features ?? [])];
|
|
95
|
+
}
|
|
96
|
+
/** caniuse feature ids a web feature maps onto, in declaration order. */
|
|
97
|
+
caniuseIds(id) {
|
|
98
|
+
return [...(this.feature(id)?.caniuse ?? [])];
|
|
99
|
+
}
|
|
100
|
+
/** Why a feature is discouraged, when web-features says so. */
|
|
101
|
+
discouraged(id) {
|
|
102
|
+
const discouraged = this.feature(id)?.discouraged;
|
|
103
|
+
if (!discouraged)
|
|
104
|
+
return undefined;
|
|
105
|
+
return { reason: discouraged.reason, according_to: [...discouraged.according_to] };
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
let servicePromise;
|
|
109
|
+
/** Load and index the bundled web-features snapshot exactly once per process. */
|
|
110
|
+
async function loadBaselineService() {
|
|
111
|
+
const imported = await import('web-features');
|
|
112
|
+
return new BaselineService(imported.features, imported.groups, imported.snapshots, imported.browsers);
|
|
113
|
+
}
|
|
114
|
+
/** Promise-memoized accessor — the first caller pays the load, everyone else awaits it. */
|
|
115
|
+
export function getBaselineService() {
|
|
116
|
+
servicePromise ??= loadBaselineService();
|
|
117
|
+
return servicePromise;
|
|
118
|
+
}
|
|
119
|
+
//# sourceMappingURL=baseline-service.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"baseline-service.js","sourceRoot":"","sources":["../../../src/services/baseline/baseline-service.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAcH,0EAA0E;AAC1E,SAAS,QAAQ,CAAC,GAAgB;IAChC,IAAI,GAAG,KAAK,MAAM;QAAE,OAAO,QAAQ,CAAC;IACpC,IAAI,GAAG,KAAK,KAAK;QAAE,OAAO,OAAO,CAAC;IAClC,OAAO,SAAS,CAAC;AACnB,CAAC;AAED,4FAA4F;AAC5F,SAAS,YAAY,CAAC,MAAwB;IAC5C,MAAM,GAAG,GAAG,MAAM,CAAC,iBAAiB,CAAC;IACrC,MAAM,IAAI,GAAG,MAAM,CAAC,kBAAkB,CAAC;IACvC,MAAM,YAAY,GAAG,OAAO,CAAC,GAAG,EAAE,UAAU,CAAC,GAAG,CAAC,CAAC,IAAI,OAAO,CAAC,IAAI,EAAE,UAAU,CAAC,GAAG,CAAC,CAAC,CAAC;IACrF,OAAO;QACL,KAAK,EAAE,QAAQ,CAAC,MAAM,CAAC,QAAQ,CAAC;QAChC,GAAG,CAAC,GAAG,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,UAAU,EAAE,GAAG,EAAE,CAAC;QACjD,GAAG,CAAC,IAAI,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC;QAClD,GAAG,CAAC,YAAY,CAAC,CAAC,CAAC,EAAE,mBAAmB,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;KACvD,CAAC;AACJ,CAAC;AAED;;;GAGG;AACH,MAAM,OAAO,eAAe;IACjB,QAA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,OAAO,CAAC,EAAE,CAAC,EAAE,eAAe,IAAI,EAAE,CAAC,CAAC,CAAC;IACxD,CAAC;IAED,yEAAyE;IACzE,UAAU,CAAC,EAAU;QACnB,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,OAAO,CAAC,EAAE,CAAC,EAAE,OAAO,IAAI,EAAE,CAAC,CAAC,CAAC;IAChD,CAAC;IAED,+DAA+D;IAC/D,WAAW,CAAC,EAAU;QACpB,MAAM,WAAW,GAAG,IAAI,CAAC,OAAO,CAAC,EAAE,CAAC,EAAE,WAAW,CAAC;QAClD,IAAI,CAAC,WAAW;YAAE,OAAO,SAAS,CAAC;QACnC,OAAO,EAAE,MAAM,EAAE,WAAW,CAAC,MAAM,EAAE,YAAY,EAAE,CAAC,GAAG,WAAW,CAAC,YAAY,CAAC,EAAE,CAAC;IACrF,CAAC;CACF;AAED,IAAI,cAAoD,CAAC;AAEzD,iFAAiF;AACjF,KAAK,UAAU,mBAAmB;IAChC,MAAM,QAAQ,GAAG,MAAM,MAAM,CAAC,cAAc,CAAC,CAAC;IAC9C,OAAO,IAAI,eAAe,CACxB,QAAQ,CAAC,QAAsD,EAC/D,QAAQ,CAAC,MAAoD,EAC7D,QAAQ,CAAC,SAA0D,EACnE,QAAQ,CAAC,QAA8C,CACxD,CAAC;AACJ,CAAC;AAED,2FAA2F;AAC3F,MAAM,UAAU,kBAAkB;IAChC,cAAc,KAAK,mBAAmB,EAAE,CAAC;IACzC,OAAO,cAAc,CAAC;AACxB,CAAC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview The shared feature resolver every tool runs its `feature`
|
|
3
|
+
* string through: exact BCD key, exact web-features id, lowercased id, redirect
|
|
4
|
+
* follow, then — only when asked — the single unambiguous top search hit.
|
|
5
|
+
* @module services/baseline/feature-resolver
|
|
6
|
+
*/
|
|
7
|
+
import type { FeatureResolution } from './types.js';
|
|
8
|
+
/** Options controlling the optional search step and the tool named in split guidance. */
|
|
9
|
+
export interface ResolveOptions {
|
|
10
|
+
/** Enables the single-best-search-hit fallback (resolver step 6). */
|
|
11
|
+
resolve: boolean;
|
|
12
|
+
/** Tool the caller should re-run with one concrete target after a split. */
|
|
13
|
+
toolName: string;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Resolve a caller's feature string. BCD keys always contain a dot and
|
|
17
|
+
* web-features ids never do, so the two namespaces cannot collide. A miss is a
|
|
18
|
+
* result carrying guidance, never a throw.
|
|
19
|
+
*/
|
|
20
|
+
export declare function resolveFeature(input: string, options: ResolveOptions): Promise<FeatureResolution>;
|
|
21
|
+
//# sourceMappingURL=feature-resolver.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"feature-resolver.d.ts","sourceRoot":"","sources":["../../../src/services/baseline/feature-resolver.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,KAAK,EAAE,iBAAiB,EAAc,MAAM,8BAA8B,CAAC;AAalF,yFAAyF;AACzF,MAAM,WAAW,cAAc;IAC7B,qEAAqE;IACrE,OAAO,EAAE,OAAO,CAAC;IACjB,4EAA4E;IAC5E,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED;;;;GAIG;AACH,wBAAsB,cAAc,CAClC,KAAK,EAAE,MAAM,EACb,OAAO,EAAE,cAAc,GACtB,OAAO,CAAC,iBAAiB,CAAC,CAkE5B"}
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview The shared feature resolver every tool runs its `feature`
|
|
3
|
+
* string through: exact BCD key, exact web-features id, lowercased id, redirect
|
|
4
|
+
* follow, then — only when asked — the single unambiguous top search hit.
|
|
5
|
+
* @module services/baseline/feature-resolver
|
|
6
|
+
*/
|
|
7
|
+
import { getBaselineService } from './baseline-service.js';
|
|
8
|
+
import { getBcdService } from '../bcd/bcd-service.js';
|
|
9
|
+
import { getSearchService } from '../search/search-service.js';
|
|
10
|
+
/** Guidance returned when nothing in either namespace matched the caller's string. */
|
|
11
|
+
function missGuidance(input, namespaceCount) {
|
|
12
|
+
return (`No BCD key or web-features id matched "${input}". Call browsercompat_search_features with ` +
|
|
13
|
+
`a plain-language name, or browsercompat_list_reference with topic bcd_namespaces to see ` +
|
|
14
|
+
`the ${namespaceCount} top-level namespaces.`);
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Resolve a caller's feature string. BCD keys always contain a dot and
|
|
18
|
+
* web-features ids never do, so the two namespaces cannot collide. A miss is a
|
|
19
|
+
* result carrying guidance, never a throw.
|
|
20
|
+
*/
|
|
21
|
+
export async function resolveFeature(input, options) {
|
|
22
|
+
const trimmed = input.trim();
|
|
23
|
+
const [bcd, baseline] = await Promise.all([getBcdService(), getBaselineService()]);
|
|
24
|
+
const fromBcdKey = (key, via) => {
|
|
25
|
+
const leaf = bcd.leaf(key);
|
|
26
|
+
const owner = baseline.keyOwner(key);
|
|
27
|
+
const taggedId = leaf ? bcd.webFeatureTags(leaf)[0] : undefined;
|
|
28
|
+
return {
|
|
29
|
+
found: true,
|
|
30
|
+
resolved_as: {
|
|
31
|
+
input: trimmed,
|
|
32
|
+
bcd_key: key,
|
|
33
|
+
baseline_id: owner?.featureId ?? taggedId ?? null,
|
|
34
|
+
resolved_via: via,
|
|
35
|
+
},
|
|
36
|
+
};
|
|
37
|
+
};
|
|
38
|
+
const fromFeatureId = (id, via) => {
|
|
39
|
+
const keys = baseline.compatKeys(id);
|
|
40
|
+
const single = keys.length === 1 ? keys[0] : undefined;
|
|
41
|
+
return {
|
|
42
|
+
found: true,
|
|
43
|
+
resolved_as: {
|
|
44
|
+
input: trimmed,
|
|
45
|
+
bcd_key: single ?? null,
|
|
46
|
+
baseline_id: id,
|
|
47
|
+
resolved_via: via,
|
|
48
|
+
},
|
|
49
|
+
...(single === undefined ? { compat_keys: keys } : {}),
|
|
50
|
+
};
|
|
51
|
+
};
|
|
52
|
+
if (bcd.leaf(trimmed))
|
|
53
|
+
return fromBcdKey(trimmed, 'bcd_key');
|
|
54
|
+
const lowered = trimmed.toLowerCase();
|
|
55
|
+
const matchedId = baseline.has(trimmed) ? trimmed : baseline.has(lowered) ? lowered : undefined;
|
|
56
|
+
if (matchedId !== undefined) {
|
|
57
|
+
const via = matchedId === trimmed ? 'web_features_id' : 'web_features_id_normalized';
|
|
58
|
+
const entry = baseline.entry(matchedId);
|
|
59
|
+
if (entry && entry.kind !== 'feature') {
|
|
60
|
+
const targets = baseline.redirectTargets(matchedId);
|
|
61
|
+
const singleTarget = targets.length === 1 ? targets[0] : undefined;
|
|
62
|
+
if (singleTarget !== undefined)
|
|
63
|
+
return fromFeatureId(singleTarget, 'redirect');
|
|
64
|
+
return {
|
|
65
|
+
found: false,
|
|
66
|
+
guidance: `"${trimmed}" was split into ${targets.join(', ')}. ` +
|
|
67
|
+
`Call ${options.toolName} again with one of them.`,
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
return fromFeatureId(matchedId, via);
|
|
71
|
+
}
|
|
72
|
+
if (options.resolve) {
|
|
73
|
+
const search = await getSearchService();
|
|
74
|
+
const hits = search.rank(trimmed, {});
|
|
75
|
+
const top = hits[0];
|
|
76
|
+
if (top && (top.tier === 1 || top.tier === 2) && hits[1]?.tier !== top.tier) {
|
|
77
|
+
if (top.row.bcd_key !== undefined)
|
|
78
|
+
return fromBcdKey(top.row.bcd_key, 'search');
|
|
79
|
+
if (top.row.baseline_id !== undefined)
|
|
80
|
+
return fromFeatureId(top.row.baseline_id, 'search');
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
return { found: false, guidance: missGuidance(trimmed, bcd.namespaces.length) };
|
|
84
|
+
}
|
|
85
|
+
//# sourceMappingURL=feature-resolver.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"feature-resolver.js","sourceRoot":"","sources":["../../../src/services/baseline/feature-resolver.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,kBAAkB,EAAE,M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+1,83 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Domain types for the Baseline service — the web-features
|
|
3
|
+
* entries this server reads, the four reported Baseline states, and the shape
|
|
4
|
+
* every tool echoes back describing how a feature string was resolved.
|
|
5
|
+
* @module services/baseline/types
|
|
6
|
+
*/
|
|
7
|
+
/** Reported Baseline state. `not_mapped` covers BCD keys web-features does not own. */
|
|
8
|
+
export type BaselineState = 'widely' | 'newly' | 'limited' | 'not_mapped';
|
|
9
|
+
/** Raw `status.baseline` value as web-features records it. */
|
|
10
|
+
export type RawBaseline = 'high' | 'low' | false;
|
|
11
|
+
/** Baseline state plus the dates it crossed, with `≤` bounds passed through verbatim. */
|
|
12
|
+
export interface BaselineInfo {
|
|
13
|
+
date_is_upper_bound?: boolean;
|
|
14
|
+
high_date?: string;
|
|
15
|
+
since_date?: string;
|
|
16
|
+
state: BaselineState;
|
|
17
|
+
}
|
|
18
|
+
/** Baseline status computed for one BCD key, or rolled up for one feature. */
|
|
19
|
+
export interface WebFeatureStatus {
|
|
20
|
+
baseline: RawBaseline;
|
|
21
|
+
baseline_high_date?: string;
|
|
22
|
+
baseline_low_date?: string;
|
|
23
|
+
by_compat_key?: Record<string, WebFeatureStatus>;
|
|
24
|
+
support?: Record<string, string>;
|
|
25
|
+
}
|
|
26
|
+
/** Why a feature is discouraged, straight from web-features. */
|
|
27
|
+
export interface DiscouragedInfo {
|
|
28
|
+
according_to: string[];
|
|
29
|
+
reason: string;
|
|
30
|
+
}
|
|
31
|
+
/** A tracked web platform feature. */
|
|
32
|
+
export interface WebFeature {
|
|
33
|
+
caniuse?: string[];
|
|
34
|
+
compat_features?: string[];
|
|
35
|
+
description: string;
|
|
36
|
+
description_html: string;
|
|
37
|
+
discouraged?: {
|
|
38
|
+
according_to: string[];
|
|
39
|
+
reason: string;
|
|
40
|
+
reason_html: string;
|
|
41
|
+
};
|
|
42
|
+
group?: string[];
|
|
43
|
+
kind: 'feature';
|
|
44
|
+
name: string;
|
|
45
|
+
snapshot?: string[];
|
|
46
|
+
spec: string[];
|
|
47
|
+
status: WebFeatureStatus;
|
|
48
|
+
}
|
|
49
|
+
/** A web-features entry that has moved or split into other entries. */
|
|
50
|
+
export interface WebFeatureRedirect {
|
|
51
|
+
kind: 'moved' | 'split';
|
|
52
|
+
redirect_target?: string;
|
|
53
|
+
redirect_targets?: string[];
|
|
54
|
+
}
|
|
55
|
+
/** Any entry in the web-features `features` map. */
|
|
56
|
+
export type WebFeatureEntry = WebFeature | WebFeatureRedirect;
|
|
57
|
+
/** A web-features group. */
|
|
58
|
+
export interface WebFeatureGroup {
|
|
59
|
+
name: string;
|
|
60
|
+
parent?: string;
|
|
61
|
+
}
|
|
62
|
+
/** An ECMAScript snapshot web-features tracks. */
|
|
63
|
+
export interface WebFeatureSnapshot {
|
|
64
|
+
name: string;
|
|
65
|
+
spec: string;
|
|
66
|
+
}
|
|
67
|
+
/** How a caller's feature string was matched, echoed on every tool response. */
|
|
68
|
+
export interface ResolvedAs {
|
|
69
|
+
baseline_id: string | null;
|
|
70
|
+
bcd_key: string | null;
|
|
71
|
+
input: string;
|
|
72
|
+
resolved_via: 'bcd_key' | 'web_features_id' | 'web_features_id_normalized' | 'redirect' | 'search';
|
|
73
|
+
}
|
|
74
|
+
/** Result of running a feature string through the fixed resolution order. */
|
|
75
|
+
export type FeatureResolution = {
|
|
76
|
+
found: true;
|
|
77
|
+
resolved_as: ResolvedAs;
|
|
78
|
+
compat_keys?: string[];
|
|
79
|
+
} | {
|
|
80
|
+
found: false;
|
|
81
|
+
guidance: string;
|
|
82
|
+
};
|
|
83
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/services/baseline/types.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,uFAAuF;AACvF,MAAM,MAAM,aAAa,GAAG,QAAQ,GAAG,OAAO,GAAG,SAAS,GAAG,YAAY,CAAC;A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MAAM,WAAW,kBAAkB;IACjC,IAAI,EAAE,OAAO,GAAG,OAAO,CAAC;IACxB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,gBAAgB,CAAC,EAAE,MAAM,EAAE,CAAC;CAC7B;AAED,oDAAoD;AACpD,MAAM,MAAM,eAAe,GAAG,UAAU,GAAG,kBAAkB,CAAC;AAE9D,4BAA4B;AAC5B,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,kDAAkD;AAClD,MAAM,WAAW,kBAAkB;IACjC,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;CACd;AAED,gFAAgF;AAChF,MAAM,WAAW,UAAU;IACzB,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IACvB,KAAK,EAAE,MAAM,CAAC;IACd,YAAY,EACR,SAAS,GACT,iBAAiB,GACjB,4BAA4B,GAC5B,UAAU,GACV,QAAQ,CAAC;CACd;AAED,6EAA6E;AAC7E,MAAM,MAAM,iBAAiB,GACzB;IAAE,KAAK,EAAE,IAAI,CAAC;IAAC,WAAW,EAAE,UAAU,CAAC;IAAC,WAAW,CAAC,EAAE,MAAM,EAAE,CAAA;CAAE,GAChE;IAAE,KAAK,EAAE,KAAK,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAA;CAAE,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Domain types for the Baseline service — the web-features
|
|
3
|
+
* entries this server reads, the four reported Baseline states, and the shape
|
|
4
|
+
* every tool echoes back describing how a feature string was resolved.
|
|
5
|
+
* @module services/baseline/types
|
|
6
|
+
*/
|
|
7
|
+
export {};
|
|
8
|
+
//# sourceMappingURL=types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/services/baseline/types.ts"],"names":[],"mappings":"AAAA;;;;;GAKG"}
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview browser-compat-data service — flat leaf index over the 12 BCD
|
|
3
|
+
* namespaces, per-browser release orderings keyed by `releases[v].index`, the
|
|
4
|
+
* reported browser set derived from `browsers[id].type`, version-token
|
|
5
|
+
* resolution, and per-browser support evaluation.
|
|
6
|
+
* @module services/bcd/bcd-service
|
|
7
|
+
*/
|
|
8
|
+
import type { BrowserStatement, CompatStatement } from '@mdn/browser-compat-data/types';
|
|
9
|
+
import type { ReleaseEntry, SupportDetail, SupportRow, SupportVerdict, VersionResolution } from './types.js';
|
|
10
|
+
/** Evaluation of one browser's support at a target release index. */
|
|
11
|
+
export interface SupportEvaluation {
|
|
12
|
+
detail: SupportDetail;
|
|
13
|
+
verdict: SupportVerdict;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* In-memory index over the bundled browser-compat-data snapshot. Immutable and
|
|
17
|
+
* process-global: nothing here is tenant-scoped or mutated after construction.
|
|
18
|
+
*/
|
|
19
|
+
export declare class BcdService {
|
|
20
|
+
readonly meta: {
|
|
21
|
+
version: string;
|
|
22
|
+
timestamp: string;
|
|
23
|
+
};
|
|
24
|
+
readonly browsers: Record<string, BrowserStatement>;
|
|
25
|
+
readonly namespaces: readonly string[];
|
|
26
|
+
readonly reportedBrowserIds: readonly string[];
|
|
27
|
+
readonly runtimeBrowserIds: readonly string[];
|
|
28
|
+
private readonly leaves;
|
|
29
|
+
private readonly namespaceCounts;
|
|
30
|
+
private readonly namespaceExamples;
|
|
31
|
+
private readonly releasesByBrowser;
|
|
32
|
+
private readonly indexByVersion;
|
|
33
|
+
constructor(data: Record<string, unknown>);
|
|
34
|
+
/** Walk one namespace subtree, recording every `__compat` leaf by dotted path. */
|
|
35
|
+
private collectLeaves;
|
|
36
|
+
/** The compat leaf at a dotted BCD key, or `undefined` when the key is not a leaf. */
|
|
37
|
+
leaf(key: string): CompatStatement | undefined;
|
|
38
|
+
/** Every leaf keyed by its dotted BCD path, in namespace-walk order. */
|
|
39
|
+
entries(): IterableIterator<[string, CompatStatement]>;
|
|
40
|
+
/** Total number of `__compat` leaves across all namespaces. */
|
|
41
|
+
get leafCount(): number;
|
|
42
|
+
/** Leaf count for one top-level namespace. */
|
|
43
|
+
namespaceLeafCount(namespace: string): number;
|
|
44
|
+
/** A representative leaf key inside one namespace, for orientation. */
|
|
45
|
+
namespaceExample(namespace: string): string | undefined;
|
|
46
|
+
/** Human-readable browser name, falling back to the id for unknown browsers. */
|
|
47
|
+
browserName(id: string): string;
|
|
48
|
+
/** Number of releases BCD records for a browser. */
|
|
49
|
+
releaseCount(id: string): number;
|
|
50
|
+
/** The newest release that has actually shipped (not beta, nightly, or planned). */
|
|
51
|
+
latestShippedRelease(id: string): ReleaseEntry | undefined;
|
|
52
|
+
/** Release date of a specific version key, when BCD records one. */
|
|
53
|
+
releaseDate(id: string, version: string): string | undefined;
|
|
54
|
+
/** web-features ids named by a leaf's `tags`, in declaration order. */
|
|
55
|
+
webFeatureTags(leaf: CompatStatement): string[];
|
|
56
|
+
/**
|
|
57
|
+
* Map a version token onto a browser's release ordering. Handles the literal
|
|
58
|
+
* `all`, `a-b` ranges (lower bound wins), trailing-zero drift between caniuse
|
|
59
|
+
* and BCD in both directions, and nearest-at-or-below for tokens BCD never
|
|
60
|
+
* published. Returns index `-1` when the token predates every release.
|
|
61
|
+
*/
|
|
62
|
+
resolveTargetVersion(browserId: string, token: string): VersionResolution;
|
|
63
|
+
/**
|
|
64
|
+
* Evaluate a leaf's support for one browser at a target release index. A
|
|
65
|
+
* browser absent from `support` is `unknown`, never unsupported; so is a `≤X`
|
|
66
|
+
* statement evaluated before X, because BCD is saying it does not know.
|
|
67
|
+
*/
|
|
68
|
+
supportAt(leaf: CompatStatement, browserId: string, targetIndex: number): SupportEvaluation;
|
|
69
|
+
/**
|
|
70
|
+
* Evaluate a leaf against each browser's newest shipped release — the "current
|
|
71
|
+
* support" view `browsercompat_get_feature` and the search summary report.
|
|
72
|
+
*/
|
|
73
|
+
supportRows(leaf: CompatStatement, browserIds: readonly string[]): SupportRow[];
|
|
74
|
+
/**
|
|
75
|
+
* The Baseline core browser requiring the newest release, by release date.
|
|
76
|
+
* Undefined until every core browser has shipped a resolvable version, since
|
|
77
|
+
* "the newest version required" has no answer while one browser has none.
|
|
78
|
+
*/
|
|
79
|
+
limitingBrowser(leaf: CompatStatement, coreBrowserIds: readonly string[]): {
|
|
80
|
+
browser_id: string;
|
|
81
|
+
name: string;
|
|
82
|
+
version: string;
|
|
83
|
+
} | undefined;
|
|
84
|
+
/** Project a resolved statement into the normalized, absence-preserving detail shape. */
|
|
85
|
+
private detailOf;
|
|
86
|
+
}
|
|
87
|
+
/** Promise-memoized accessor — the first caller pays the load, everyone else awaits it. */
|
|
88
|
+
export declare function getBcdService(): Promise<BcdService>;
|
|
89
|
+
//# sourceMappingURL=bcd-service.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bcd-service.d.ts","sourceRoot":"","sources":["../../../src/services/bcd/bcd-service.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EACV,gBAAgB,EAChB,eAAe,EAEhB,MAAM,gCAAgC,CAAC;AACxC,OAAO,KAAK,EACV,YAAY,EACZ,aAAa,EAEb,UAAU,EACV,cAAc,EACd,iBAAiB,EAClB,MAAM,YAAY,CAAC;AAuBpB,qEAAqE;AACrE,MAAM,WAAW,iBAAiB;IAChC,MAAM,EAAE,aAAa,CAAC;IACtB,OAAO,EAAE,cAAc,CAAC;CACzB;AAkDD;;;GAGG;AACH,qBAAa,UAAU;IACrB,QAAQ,CAAC,IAAI,EAAE;QAAE,OAAO,EAAE,MAAM,CAAC;QAAC,SAAS,EAAE,MAAM,CAAA;KAAE,CAAC;IACtD,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,gBAAgB,C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