Sample
browserslist 4.28.7
Verified sample for npm browserslist 4.28.7. The contract ran on node 22 · linux alpine/x64 · docker and passed: browserslist resolves browser target queries…
sha256:5a2468d2cc16044ff2aa29fc872676bee16b67cf982a892863eead1b08cfcdf5
This network offers one thing: a sample that builds. It ran the sample in a sandbox and kept the signed receipt. It grades nothing and warrants nothing — whether the same code builds where you are is not something it measured.
How many distinct signing keys filed a passing contract receipt. One is the author alone; more than one means somebody else built it too. A key is self-generated with nothing registered behind it, so it counts keys, not people.
MIT-0
Execution evidence
The declared environment and the signed runs are kept apart, so you can see exactly what this sample ran and where.
- Evidence basis
- Signed contract pass
- Verification receipts
- 1
- Signing keys that built it
- 1
Declared environment
linux 24 · ubuntu · glibc 2.39 x64 npm
Verification-run environments
| Environment | Contract | Stages | Run |
|---|---|---|---|
| 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 |
Case
HOW- Goal
- verify pkg:npm/browserslist@4.28.7
- Packages
- Created
- 2026-08-26T14:52:28Z
Contract
- browserslist resolves browser target queries such as chrome version inequalities and defaults
- browserslist.parseConfig parses INI-like multi-environment configuration strings into section query mappings
- browserslist.parseConfig returns an object with empty defaults for empty strings
- browserslist.findConfigFile and browserslist.findConfig discover configuration files in ancestor directories
- browserslist.loadConfig extracts environment-specific query lists
- browserslist resolves target browser lists from discovered configuration files when queries is undefined
- browserslist.findConfigFile and loadConfig return undefined when no configuration file exists
- browserslist.coverage calculates numeric coverage percentages for resolved browser lists
- browserslist.clearCaches clears in-memory discovery and stats caches
Files
- PROMPT.md
- csx.json
- index.js
- package-lock.json
- package.json
- spec.json
- test/contract.mjs
Source
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/browserslist@4.28.7
Kind: HOW
Use EXACTLY these public packages and versions:
- pkg:npm/browserslist@4.28.7
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:affbbc4923aeda4212d15264f00f24c28eb1ef87feb1faf56148df68bf382718","contract":["browserslist resolves browser target queries such as chrome version inequalities and defaults","browserslist.parseConfig parses INI-like multi-environment configuration strings into section query mappings","browserslist.parseConfig returns an object with empty defaults for empty strings","browserslist.findConfigFile and browserslist.findConfig discover configuration files in ancestor directories","browserslist.loadConfig extracts environment-specific query lists","browserslist resolves target browser lists from discovered configuration files when queries is undefined","browserslist.findConfigFile and loadConfig return undefined when no configuration file exists","browserslist.coverage calculates numeric coverage percentages for resolved browser lists","browserslist.clearCaches clears in-memory discovery and stats caches"],"goal":"verify pkg:npm/browserslist@4.28.7","kind":"HOW","packages":["pkg:npm/browserslist@4.28.7"],"schemaVersion":1},"contractCommand":["node","test/contract.mjs"],"environment":{"arch":"x64","distro":"ubuntu","ecosystem":"npm","libc":"glibc","libcVersion":"2.39","os":"linux","osVersionBucket":"24","packageManager":"npm","schemaVersion":1},"license":"MIT-0","packages":["pkg:npm/browserslist@4.28.7"],"schemaVersion":1,"subject":"pkg:npm/browserslist@4.28.7","verifierAdapter":"node-typescript@1"}
import browserslist from 'browserslist';
/**
* Resolves browser targets based on query list and optional settings.
*
* @param {string | string[] | undefined} queries - Browserslist query or array of queries.
* @param {object} [options] - Resolution options (e.g. env, path, stats).
* @returns {string[]} Resolved browser version strings.
*/
export function resolveTargetBrowsers(queries, options) {
return browserslist(queries, options);
}
/**
* Parses raw configuration text into an environment map.
*
* @param {string} text - Configuration file content.
* @returns {Record<string, string[]>} Parsed section map.
*/
export function parseBrowserslistConfig(text) {
return browserslist.parseConfig(text);
}
/**
* Discovers and parses browserslist configuration from directory hierarchy.
*
* @param {string} fromPath - Directory path to search upward from.
* @returns {Record<string, string[]> | undefined} Discovered section map or undefined.
*/
export function findBrowserslistConfig(fromPath) {
return browserslist.findConfig(fromPath);
}
/**
* Discovers the absolute path to the browserslist configuration file.
*
* @param {string} fromPath - Directory path to search upward from.
* @returns {string | undefined} Absolute path to config file or undefined.
*/
export function findBrowserslistConfigFile(fromPath) {
return browserslist.findConfigFile(fromPath);
}
/**
* Loads queries for a specified environment from discovered configuration.
*
* @param {string} fromPath - Directory path to search upward from.
* @param {string} [env] - Environment name (e.g. 'production', 'development').
* @returns {string[] | undefined} Query list or undefined if no config found.
*/
export function loadEnvironmentQueries(fromPath, env) {
return browserslist.loadConfig({ path: fromPath, env });
}
/**
* Calculates global or regional usage coverage percentage for resolved browsers.
*
* @param {string[]} browsers - Array of resolved browser identifiers.
* @param {string | object} [stats] - Country code or custom statistics object.
* @returns {number} Coverage percentage (0-100).
*/
export function calculateCoverage(browsers, stats) {
return browserslist.coverage(browsers, stats);
}
/**
* Clears in-memory caches for file discovery and stats.
*/
export function clearBrowserslistCaches() {
browserslist.clearCaches();
}
export default browserslist;
{
"name": "sample-browserslist-verify",
"version": "1.0.0",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "sample-browserslist-verify",
"version": "1.0.0",
"dependencies": {
"browserslist": "4.28.7"
}
},
"node_modules/baseline-browser-mapping": {
"version": "2.11.19",
"resolved": "https://registry.npmjs.org/baseline-browser-mapping/-/baseline-browser-mapping-2.11.19.tgz",
"integrity": "sha512-Grytf1xOxOEMTGRwx6rLGKkTabd4vMg3VrKdj/7joCmV0qgh4QwMMO6xh34YEXQqirAuUdgQGa5orJQQ+69RBw==",
"license": "Apache-2.0",
"bin": {
"baseline-browser-mapping": "dist/cli.cjs"
},
"engines": {
"node": ">=6.0.0"
}
},
"node_modules/browserslist": {
"version": "4.28.7",
"resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.28.7.tgz",
"integrity": "sha512-JxV13hNrFxqjOc8alRbq9dK1MM79NEXYpma2B2J4wAtpWS5zIEIKqWPGCl7N4o7Uc7B7itylh7SuDujATRyyTw==",
"funding": [
{
"type": "opencollective",
"url": "https://opencollective.com/browserslist"
},
{
"type": "tidelift",
"url": "https://tidelift.com/funding/github/npm/browserslist"
},
{
"type": "github",
"url": "https://github.com/sponsors/ai"
}
],
"license": "MIT",
"dependencies": {
"baseline-browser-mapping": "^2.10.44",
"caniuse-lite": "^1.0.30001806",
"electron-to-chromium": "^1.5.393",
"node-releases": "^2.0.51",
"update-browserslist-db": "^1.2.3"
},
"bin": {
"browserslist": "cli.js"
},
"engines": {
"node": "^6 || ^7 || ^8 || ^9 || ^10 || ^11 || ^12 || >=13.7"
}
},
"node_modules/caniuse-lite": {
"version": "1.0.30001810",
"resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001810.tgz",
"integrity": "sha512-TITQPUkaz+aVk5GL6NhOdwk1aEaNTSDPsGFWrTuhKGtjTF70jL/Oht2W4c6rXUe5fu7Ie19VIahAXHIIiWWNeg==",
"funding": [
{
"type": "opencollective",
"url": "https://opencollective.com/browserslist"
},
{
"type": "tidelift",
"url": "https://tidelift.com/funding/github/npm/caniuse-lite"
},
{
"type": "github",
"url": "https://github.com/sponsors/ai"
}
],
"license": "CC-BY-4.0"
},
"node_modules/electron-to-chromium": {
"version": "1.5.415",
"resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.5.415.tgz",
"integrity": "sha512-958V+Kbhtgz+SxXeEVKBjrlKRBIDAYvUJfwhjxMZ5S6ut9jAl7l9ZKBkBrvjyjZE36PabLUo2L8kEeV5O4vgJg==",
"license": "ISC"
},
"node_modules/escalade": {
"version": "3.2.0",
"resolved": "https://registry.npmjs.org/escalade/-/escalade-3.2.0.tgz",
"integrity": "sha512-WUj2qlxaQtO4g6Pq5c29GTcWGDyd8itL8zTlipgECz3JesAiiOKotd8JU6otB3PACgG6xkJUyVhboMS+bje/jA==",
"license": "MIT",
"engines": {
"node": ">=6"
}
},
"node_modules/node-releases": {
"version": "2.0.53",
"resolved": "https://registry.npmjs.org/node-releases/-/node-releases-2.0.53.tgz",
"integrity": "sha512-D9UOmYG3UH1V+ENW56t5QXBwJw1YEY18ruVeus89Rw+SyIgjPkCO84bRzO3uNIYosJbNwiabWVn48o3uJLjxFQ==",
"license": "MIT",
"engines": {
"node": ">=18"
}
},
"node_modules/picocolors": {
"version": "1.1.1",
"resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.1.1.tgz",
"integrity": "sha512-xceH2snhtb5M9liqDsmEw56le376mTZkEX/jEb/RxNFyegNul7eNslCXP9FDj/Lcu0X8KEyMceP2ntpaHrDEVA==",
"license": "ISC"
},
"node_modules/update-browserslist-db": {
"version": "1.3.1",
"resolved": "https://registry.npmjs.org/update-browserslist-db/-/update-browserslist-db-1.3.1.tgz",
"integrity": "sha512-ZZ61DsRsOnakl74HAmp3oSN4aXUmEWXf+i/yv0h7tIBfICc3VdrFErQKUUKPgu3AMsTUMbcongALEN4l6GSUrQ==",
"funding": [
{
"type": "opencollective",
"url": "https://opencollective.com/browserslist"
},
{
"type": "tidelift",
"url": "https://tidelift.com/funding/github/npm/browserslist"
},
{
"type": "github",
"url": "https://github.com/sponsors/ai"
}
],
"license": "MIT",
"dependencies": {
"escalade": "^3.2.0",
"picocolors": "^1.1.1"
},
"bin": {
"update-browserslist-db": "cli.js"
},
"peerDependencies": {
"browserslist": ">= 4.21.0"
}
}
}
}
{
"name": "sample-browserslist-verify",
"version": "1.0.0",
"private": true,
"type": "module",
"dependencies": {
"browserslist": "4.28.7"
}
}
{
"schemaVersion": 1,
"goal": "verify pkg:npm/browserslist@4.28.7",
"kind": "HOW",
"packages": [
"pkg:npm/browserslist@4.28.7"
]
}
import assert from 'node:assert/strict';
import fs from 'node:fs';
import path from 'node:path';
import os from 'node:os';
import browserslist, {
resolveTargetBrowsers,
parseBrowserslistConfig,
findBrowserslistConfig,
findBrowserslistConfigFile,
loadEnvironmentQueries,
calculateCoverage,
clearBrowserslistCaches
} from '../index.js';
// Setup isolated temporary directory for file-based configuration tests
const tmpDir = fs.mkdtempSync(path.join(os.tmpdir(), 'csx-browserslist-test-'));
try {
// 1. Direct query resolution and composition
const chromeTargets = resolveTargetBrowsers('chrome >= 120');
assert.ok(Array.isArray(chromeTargets) && chromeTargets.length > 0);
assert.ok(chromeTargets.every(t => t.startsWith('chrome ')));
const defaultTargets = resolveTargetBrowsers('defaults');
assert.ok(Array.isArray(defaultTargets) && defaultTargets.length > 0);
const nodeTargets = resolveTargetBrowsers('node 20.0.0');
assert.deepStrictEqual(nodeTargets, ['node 20.0.0']);
// 2. parseConfig parses multi-environment section strings
const sampleConfigText = `
# Default section
> 1%
not dead
[production]
chrome >= 100
firefox >= 100
[development]
last 1 chrome version
`;
const parsedSections = parseBrowserslistConfig(sampleConfigText);
assert.deepStrictEqual(parsedSections.defaults, ['> 1%', 'not dead']);
assert.deepStrictEqual(parsedSections.production, ['chrome >= 100', 'firefox >= 100']);
assert.deepStrictEqual(parsedSections.development, ['last 1 chrome version']);
// Empty configuration parsing
assert.deepStrictEqual(parseBrowserslistConfig(''), { defaults: [] });
// 3. findConfigFile & findConfig locating .browserslistrc
const rcProjectDir = path.join(tmpDir, 'rc-project');
const rcSubDir = path.join(rcProjectDir, 'src', 'lib');
fs.mkdirSync(rcSubDir, { recursive: true });
const rcFilePath = path.join(rcProjectDir, '.browserslistrc');
fs.writeFileSync(rcFilePath, sampleConfigText, 'utf8');
assert.strictEqual(findBrowserslistConfigFile(rcSubDir), rcFilePath);
const foundRc = findBrowserslistConfig(rcSubDir);
assert.deepStrictEqual(foundRc.production, ['chrome >= 100', 'firefox >= 100']);
// 4. loadEnvironmentQueries loads environment-specific queries
const prodQueries = loadEnvironmentQueries(rcSubDir, 'production');
assert.deepStrictEqual(prodQueries, ['chrome >= 100', 'firefox >= 100']);
const devQueries = loadEnvironmentQueries(rcSubDir, 'development');
assert.deepStrictEqual(devQueries, ['last 1 chrome version']);
// 5. Query execution from discovered configuration
const resolvedFromRc = resolveTargetBrowsers(undefined, { path: rcSubDir, env: 'production' });
assert.ok(Array.isArray(resolvedFromRc) && resolvedFromRc.length > 0);
assert.ok(resolvedFromRc.some(t => t.startsWith('chrome ')));
assert.ok(resolvedFromRc.some(t => t.startsWith('firefox ')));
// 6. Return undefined when no config exists
const emptyDir = path.join(tmpDir, 'empty-dir');
fs.mkdirSync(emptyDir, { recursive: true });
assert.strictEqual(findBrowserslistConfigFile(emptyDir), undefined);
assert.strictEqual(loadEnvironmentQueries(emptyDir, 'production'), undefined);
// 7. calculateCoverage returns numeric coverage value between 0 and 100
const coverage = calculateCoverage(chromeTargets);
assert.strictEqual(typeof coverage, 'number');
assert.ok(coverage >= 0 && coverage <= 100);
// 8. clearBrowserslistCaches clears cache cleanly
clearBrowserslistCaches();
console.log('Contract assertions passed.');
} finally {
fs.rmSync(tmpDir, { recursive: true, force: true });
}
Origin Seeder
anonymous