示例
baseline-browser-mapping 2.11.12
已验证示例 — npm baseline-browser-mapping 2.11.12. contract 在 node 22 · linux alpine/x64 · docker 上运行并通过: getCompatibleVersions returns minimum browser versions…
sha256:84e322b59d7239c21cee9fae11198dbc0a0b790475f5e376558b3cc9d74e5faa
本网络只提供一件事:能构建的样本。它在沙箱中运行并保留签名回执。它不评级、不担保——同样的代码能否在你的环境构建,它没有测量过。
提交了通过的契约回执的不同签名密钥数量。为 1 表示只有作者;大于 1 表示还有其他人构建过。密钥是自行生成的,背后没有注册身份,因此计的是密钥而非人。
MIT-0
执行证据
声明的环境与签名的运行分开呈现,你可以看到这个样本究竟运行了什么、在哪里运行。
- 证据依据
- 签名契约通过
- 验证回执
- 1
- 构建过它的签名密钥
- 1
声明的环境
node 22.23 linux 24 · ubuntu · glibc 2.39 x64 node 22.23 javascript npm 10
验证运行环境
| 环境 | 契约 | 阶段 | 运行日期 |
|---|---|---|---|
| node 22 · linux alpine/x64 · docker ed25519:c1973797be207ac4 | PASS | compile:SKIPPED · contract:PASS · load:PASS · resolve:PASS CONTAINER_RUN · node-typescript@1node:22-alpine@sha256:c610fcdfb1d5… |
2026-08-26 |
案例
HOW- 目标
- verify pkg:npm/baseline-browser-mapping@2.11.12
- 环境
- node 22.23.2
- 创建时间
- 2026-08-26T14:51:28Z
契约
- getCompatibleVersions returns minimum browser versions supporting Baseline for a given date or year
- getAllVersions returns browser versions in array, object, and csv formats with baseline status
- getTimeline returns baseline event timelines grouped by date or browser
- getCompatibleVersions validates mutually exclusive targetYear and widelyAvailableOnDate options
- _resetHasWarned resets internal warning state for stale data checks
文件
- PROMPT.md
- csx.json
- package-lock.json
- package.json
- spec.json
- src/index.js
- test/contract.js
源代码
Clean-room public code sample — generation instructions
Write a brand-new, minimal, self-contained code sample in this clean-room directory.
Do not copy, paraphrase, or reference any existing project source. Work only from this spec.
A csx.json manifest scaffold already exists. Do not recreate it from memory. Preserve its case.goal, packages and symbols; fill its empty case.contract with exact assertions and correct its environment, commands and verifierAdapter for the files you generate.
Goal: verify pkg:npm/baseline-browser-mapping@2.11.12
Kind: HOW
Use EXACTLY these public packages and versions:
- pkg:npm/baseline-browser-mapping@2.11.12
Rules:
- One focused purpose; the smallest project that proves the goal.
- Include a contract test (test/contract.*) that runs OFFLINE and exits 0 exactly when the goal behavior works.
- Pin every dependency with a lockfile so resolution is reproducible.
- No secrets, credentials, or tokens. No real URLs (only example.com or localhost). No absolute paths.
- No personal names, emails, company names, or project identifiers of any kind.
- No binaries and no generated output (node_modules, dist, target, venv, .git, .env).
- Keep it under 200 files and 256KB packed.
{"case":{"caseId":"case:sha256:f43e3421f13870b962ea703aa4f0d3df108995959276811374993b131f69df85","constraints":{"executionContext":"node"},"contract":["getCompatibleVersions returns minimum browser versions supporting Baseline for a given date or year","getAllVersions returns browser versions in array, object, and csv formats with baseline status","getTimeline returns baseline event timelines grouped by date or browser","getCompatibleVersions validates mutually exclusive targetYear and widelyAvailableOnDate options","_resetHasWarned resets internal warning state for stale data checks"],"goal":"verify pkg:npm/baseline-browser-mapping@2.11.12","kind":"HOW","packages":["pkg:npm/baseline-browser-mapping@2.11.12"],"schemaVersion":1},"contractCommand":["node","test/contract.js"],"environment":{"arch":"x64","distro":"ubuntu","ecosystem":"npm","executionContext":"node","language":"javascript","libc":"glibc","libcVersion":"2.39","moduleSystem":"cjs","os":"linux","osVersionBucket":"24","packageManager":"npm","packageManagerVersion":"10.9.8","runtime":"node","runtimeVersion":"22.23.2","schemaVersion":1},"license":"MIT-0","packages":["pkg:npm/baseline-browser-mapping@2.11.12"],"schemaVersion":1,"subject":"pkg:npm/baseline-browser-mapping@2.11.12","verifierAdapter":"node-typescript@1"}
{
"name": "baseline-browser-mapping-sample",
"version": "1.0.0",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "baseline-browser-mapping-sample",
"version": "1.0.0",
"dependencies": {
"baseline-browser-mapping": "2.11.12"
}
},
"node_modules/baseline-browser-mapping": {
"version": "2.11.12",
"resolved": "https://registry.npmjs.org/baseline-browser-mapping/-/baseline-browser-mapping-2.11.12.tgz",
"integrity": "sha512-r7WnVImvVCeFpf2DOXfy41aPWzeNg3H/A2X4dKmy1QL0MSyyk/e7z8ihJ3N6Nn2PsdhkVlqnEfnUE4a05P2aTA==",
"license": "Apache-2.0",
"bin": {
"baseline-browser-mapping": "dist/cli.cjs"
},
"engines": {
"node": ">=6.0.0"
}
}
}
}
{
"name": "baseline-browser-mapping-sample",
"version": "1.0.0",
"dependencies": {
"baseline-browser-mapping": "2.11.12"
}
}
{
"schemaVersion": 1,
"goal": "verify pkg:npm/baseline-browser-mapping@2.11.12",
"kind": "HOW",
"packages": [
"pkg:npm/baseline-browser-mapping@2.11.12"
]
}
const {
getCompatibleVersions,
getAllVersions,
getTimeline,
_resetHasWarned,
} = require('baseline-browser-mapping');
/**
* Retrieves browser versions compatible with Baseline as of a target date or year.
*
* @param {object} [options]
* @returns {Array<object>}
*/
function findCompatibleBrowsers(options = {}) {
return getCompatibleVersions(options);
}
/**
* Retrieves all browser versions with their Baseline availability status in specified format.
*
* @param {object} [options]
* @returns {any}
*/
function fetchAllBrowserVersions(options = {}) {
return getAllVersions(options);
}
/**
* Retrieves the timeline of Baseline browser support changes.
*
* @param {object} [options]
* @returns {any}
*/
function fetchBaselineTimeline(options = {}) {
return getTimeline(options);
}
module.exports = {
findCompatibleBrowsers,
fetchAllBrowserVersions,
fetchBaselineTimeline,
getCompatibleVersions,
getAllVersions,
getTimeline,
_resetHasWarned,
};
const assert = require('node:assert/strict');
const {
findCompatibleBrowsers,
fetchAllBrowserVersions,
fetchBaselineTimeline,
getCompatibleVersions,
_resetHasWarned,
} = require('../src/index.js');
// Contract 1: getCompatibleVersions returns minimum browser versions supporting Baseline for a given date or year
{
const compatDate = findCompatibleBrowsers({
widelyAvailableOnDate: '2023-01-01',
suppressWarnings: true,
});
assert.ok(Array.isArray(compatDate), 'getCompatibleVersions should return an array');
assert.ok(compatDate.length >= 4, 'should include core browsers');
const chrome = compatDate.find((b) => b.browser === 'chrome');
assert.ok(chrome, 'chrome entry should exist');
assert.ok(typeof chrome.version === 'string', 'version should be a string');
assert.ok(typeof chrome.release_date === 'string', 'release_date should be a string');
const safari = compatDate.find((b) => b.browser === 'safari');
assert.ok(safari, 'safari entry should exist');
assert.ok(typeof safari.version === 'string', 'version should be a string');
const compatYear = findCompatibleBrowsers({
targetYear: 2022,
suppressWarnings: true,
});
assert.ok(Array.isArray(compatYear), 'targetYear query should return an array');
assert.ok(compatYear.some((b) => b.browser === 'firefox'), 'firefox entry should exist');
}
// Contract 2: getAllVersions returns browser versions in array, object, and csv formats with baseline status
{
const list = fetchAllBrowserVersions({
outputFormat: 'array',
suppressWarnings: true,
});
assert.ok(Array.isArray(list), 'outputFormat array should return an array');
assert.ok(list.length > 0, 'array should not be empty');
assert.ok('browser' in list[0], 'items should contain browser');
assert.ok('version' in list[0], 'items should contain version');
assert.ok('year' in list[0], 'items should contain year');
const obj = fetchAllBrowserVersions({
outputFormat: 'object',
suppressWarnings: true,
});
assert.strictEqual(typeof obj, 'object', 'outputFormat object should return an object');
assert.ok(obj.chrome, 'nested chrome object should exist');
assert.ok(typeof obj.chrome === 'object', 'chrome property should be an object');
const csv = fetchAllBrowserVersions({
outputFormat: 'csv',
suppressWarnings: true,
});
assert.strictEqual(typeof csv, 'string', 'outputFormat csv should return a string');
assert.ok(csv.includes('"browser","version"'), 'CSV should contain header');
const listWithSupports = fetchAllBrowserVersions({
outputFormat: 'array',
useSupports: true,
suppressWarnings: true,
});
assert.ok(Array.isArray(listWithSupports));
const hasSupportsField = listWithSupports.some((item) => item.supports !== undefined);
assert.ok(hasSupportsField, 'items should include supports property when useSupports is true');
}
// Contract 3: getTimeline returns baseline event timelines grouped by date or browser
{
const timelineByDate = fetchBaselineTimeline({ groupBy: 'date' });
assert.ok(Array.isArray(timelineByDate), 'timeline by date should return an array');
assert.ok(timelineByDate.length > 0, 'timeline should have events');
assert.ok(typeof timelineByDate[0].date === 'string', 'event should contain date');
assert.ok(Array.isArray(timelineByDate[0].browsers), 'event should contain browsers array');
const timelineByBrowser = fetchBaselineTimeline({ groupBy: 'browser' });
assert.strictEqual(typeof timelineByBrowser, 'object', 'timeline by browser should return an object');
assert.ok(Array.isArray(timelineByBrowser.chrome), 'chrome timeline should be an array');
assert.ok(timelineByBrowser.chrome.length > 0, 'chrome timeline should not be empty');
assert.ok(typeof timelineByBrowser.chrome[0].date === 'string', 'timeline entry should contain date');
assert.ok(typeof timelineByBrowser.chrome[0].version === 'string', 'timeline entry should contain version');
}
// Contract 4: getCompatibleVersions validates mutually exclusive targetYear and widelyAvailableOnDate options
{
assert.throws(
() => {
getCompatibleVersions({
widelyAvailableOnDate: '2023-01-01',
targetYear: 2022,
suppressWarnings: true,
});
},
/You cannot use targetYear and widelyAvailableOnDate at the same time/,
'Should throw when both targetYear and widelyAvailableOnDate are specified'
);
assert.throws(
() => {
getCompatibleVersions({
includeDownstreamBrowsers: false,
includeKaiOS: true,
});
},
/KaiOS is a downstream browser and can only be included if you include other downstream browsers/,
'Should throw when includeKaiOS is true without includeDownstreamBrowsers'
);
}
// Contract 5: _resetHasWarned resets internal warning state for stale data checks
{
assert.doesNotThrow(() => {
_resetHasWarned();
}, 'Should not throw when resetting hasWarned state');
}
console.log('All pkg:npm/baseline-browser-mapping@2.11.12 contracts passed successfully.');
原始种子者
匿名