サンプル
baseline-browser-mapping 2.11.16
検証済みサンプル — npm baseline-browser-mapping 2.11.16. node 22 · linux alpine/x64 · docker で contract を実行し、成功しました: getCompatibleVersions returns minimum browser…
sha256:c68d07a66642c6dcaab8b334d138767e95db32a09582a985ec8cb2ab68ba44f5
このネットワークが提供するのは一つだけです。ビルドされるサンプル。サンドボックスで実行し、署名済みの受領証を保管します。等級はつけず、何も保証しません — 同じコードがあなたの環境でビルドされるかは測定していません。
合格した契約受領証を提出した異なる署名鍵の数です。1 なら作者だけ、2 以上なら他の誰かもビルドしています。鍵は自己生成で背後に登録された身元がないため、数えているのは人ではなく鍵です。
MIT-0
実行証拠
宣言された環境と署名済みの実行を分けてあります。このサンプルが何をどこで実行したかをそのまま確認できます。
- 証拠の基準
- 署名済みコントラクト合格
- 検証レシート
- 2
- ビルドした署名鍵
- 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 |
| node 22 · linux debian/x64 · docker ed25519:c1973797be207ac4 | PASS | compile:SKIPPED · contract:PASS · load:PASS · resolve:PASS CONTAINER_RUN · node-typescript@1node:22@sha256:8a34c4ab3ea2… |
2026-09-07 |
ケース
HOW- ゴール
- verify pkg:npm/baseline-browser-mapping@2.11.16
- 環境
- node 22.23.2
- 作成日
- 2026-08-26T06:55:59Z
コントラクト
- getCompatibleVersions returns minimum browser versions supporting Baseline Widely available by default
- getCompatibleVersions supports targetYear and widelyAvailableOnDate options
- getCompatibleVersions includes all compatible versions and downstream browsers when configured
- getCompatibleVersions validates mutually exclusive and invalid options
- getAllVersions returns browser versions with Baseline support across array, object, and csv output formats
- getAllVersions supports useSupports option to distinguish widely and newly available tiers
- getTimeline groups baseline event timelines by date or by browser
- _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.16
Kind: HOW
Use EXACTLY these public packages and versions:
- pkg:npm/baseline-browser-mapping@2.11.16
Constraints:
- executionContext: node
Required runtime conditions:
- ecosystem: npm
- language: javascript
- moduleSystem: cjs
- packageManager: npm@10.9.8
- runtime: node@22.23.2
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:4a3be78fc6aa5348f0b2c25b5a7e95ca0e768de5ad3d351141c9f412b6951b5e","constraints":{"executionContext":"node"},"contract":["getCompatibleVersions returns minimum browser versions supporting Baseline Widely available by default","getCompatibleVersions supports targetYear and widelyAvailableOnDate options","getCompatibleVersions includes all compatible versions and downstream browsers when configured","getCompatibleVersions validates mutually exclusive and invalid options","getAllVersions returns browser versions with Baseline support across array, object, and csv output formats","getAllVersions supports useSupports option to distinguish widely and newly available tiers","getTimeline groups baseline event timelines by date or by browser","_resetHasWarned resets internal warning state for stale data checks"],"goal":"verify pkg:npm/baseline-browser-mapping@2.11.16","kind":"HOW","packages":["pkg:npm/baseline-browser-mapping@2.11.16"],"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.16"],"schemaVersion":1,"subject":"pkg:npm/baseline-browser-mapping@2.11.16","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.16"
}
},
"node_modules/baseline-browser-mapping": {
"version": "2.11.16",
"resolved": "https://registry.npmjs.org/baseline-browser-mapping/-/baseline-browser-mapping-2.11.16.tgz",
"integrity": "sha512-H/bNPUFHewJHyCTdjn1n3Pit5+2GmWT6mmeHImPX+8MA9NA6b67jO4gYmi4jTbCJb2otq34KMZnovndDPqJwhQ==",
"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.16"
}
}
{
"schemaVersion": 1,
"goal": "verify pkg:npm/baseline-browser-mapping@2.11.16",
"kind": "HOW",
"packages": [
"pkg:npm/baseline-browser-mapping@2.11.16"
],
"constraints": {
"executionContext": "node"
},
"runtimeConditions": {
"ecosystem": "npm",
"language": "javascript",
"moduleSystem": "cjs",
"packageManager": "npm@10.9.8",
"runtime": "node@22.23.2"
}
}
const {
getCompatibleVersions,
getAllVersions,
getTimeline,
_resetHasWarned,
} = require('baseline-browser-mapping');
/**
* Retrieves browser versions compatible with Baseline as of a target date or year.
*
* @param {import('baseline-browser-mapping/dist/types.js').Options} [options]
* @returns {import('baseline-browser-mapping/dist/types.js').BrowserVersion[]}
*/
function findCompatibleBrowsers(options = {}) {
return getCompatibleVersions(options);
}
/**
* Retrieves all browser versions with their Baseline availability status in specified format.
*
* @param {import('baseline-browser-mapping/dist/types.js').AllVersionsOptions} [options]
* @returns {any}
*/
function fetchAllBrowserVersions(options = {}) {
return getAllVersions(options);
}
/**
* Retrieves the timeline of Baseline browser support changes.
*
* @param {import('baseline-browser-mapping/dist/types.js').TimelineOptions} [options]
* @returns {any}
*/
function fetchBaselineTimeline(options = {}) {
return getTimeline(options);
}
/**
* Resets the internal warning state for stale data checks.
*/
function resetWarningState() {
return _resetHasWarned();
}
module.exports = {
findCompatibleBrowsers,
fetchAllBrowserVersions,
fetchBaselineTimeline,
resetWarningState,
getCompatibleVersions,
getAllVersions,
getTimeline,
_resetHasWarned,
};
const assert = require('node:assert/strict');
const {
findCompatibleBrowsers,
fetchAllBrowserVersions,
fetchBaselineTimeline,
resetWarningState,
getCompatibleVersions,
getAllVersions,
getTimeline,
_resetHasWarned,
} = require('../src/index.js');
// Contract 1: getCompatibleVersions returns minimum browser versions supporting Baseline Widely available by default
{
const defaultVersions = findCompatibleBrowsers({ suppressWarnings: true });
assert.ok(Array.isArray(defaultVersions), 'getCompatibleVersions should return an array');
assert.ok(defaultVersions.length >= 4, 'should include core baseline browsers');
const chrome = defaultVersions.find((b) => b.browser === 'chrome');
assert.ok(chrome, 'chrome entry should exist');
assert.ok(typeof chrome.version === 'string', 'chrome version should be a string');
assert.ok(typeof chrome.release_date === 'string', 'chrome release_date should be a string');
const safari = defaultVersions.find((b) => b.browser === 'safari');
assert.ok(safari, 'safari entry should exist');
assert.ok(typeof safari.version === 'string', 'safari version should be a string');
const firefox = defaultVersions.find((b) => b.browser === 'firefox');
assert.ok(firefox, 'firefox entry should exist');
assert.ok(typeof firefox.version === 'string', 'firefox version should be a string');
const edge = defaultVersions.find((b) => b.browser === 'edge');
assert.ok(edge, 'edge entry should exist');
assert.ok(typeof edge.version === 'string', 'edge version should be a string');
}
// Contract 2: getCompatibleVersions supports targetYear and widelyAvailableOnDate options
{
const compatDate = findCompatibleBrowsers({
widelyAvailableOnDate: '2023-01-01',
suppressWarnings: true,
});
assert.ok(Array.isArray(compatDate), 'widelyAvailableOnDate should return an array');
assert.ok(compatDate.length >= 4, 'should include core browsers for target date');
const chromeDate = compatDate.find((b) => b.browser === 'chrome');
assert.ok(chromeDate, 'chrome should be present in target date query');
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 should be present in target year query');
}
// Contract 3: getCompatibleVersions includes all compatible versions and downstream browsers when configured
{
const allCompat = findCompatibleBrowsers({
listAllCompatibleVersions: true,
suppressWarnings: true,
});
assert.ok(Array.isArray(allCompat));
const minCompat = findCompatibleBrowsers({ suppressWarnings: true });
assert.ok(allCompat.length > minCompat.length, 'listAllCompatibleVersions should return more versions than default minimum');
const withDownstream = findCompatibleBrowsers({
includeDownstreamBrowsers: true,
suppressWarnings: true,
});
assert.ok(Array.isArray(withDownstream));
assert.ok(
withDownstream.some((b) => b.browser === 'opera' || b.browser === 'samsunginternet' || b.browser === 'edge'),
'includeDownstreamBrowsers should include downstream or engine-shared browsers'
);
}
// Contract 4: getCompatibleVersions validates mutually exclusive and invalid 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: getAllVersions returns browser versions with Baseline support across array, object, and csv output formats
{
// Array format
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');
// Object format
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');
// CSV format
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');
}
// Contract 6: getAllVersions supports useSupports option to distinguish widely and newly available tiers
{
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 7: getTimeline groups baseline event timelines by date or by browser
{
// Grouped by date (default)
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');
// Grouped by browser
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 8: _resetHasWarned resets internal warning state for stale data checks
{
assert.strictEqual(typeof resetWarningState, 'function');
resetWarningState();
_resetHasWarned();
}
console.log('All pkg:npm/baseline-browser-mapping@2.11.16 contracts passed successfully.');
オリジンシーダー
匿名