示例
caniuse-lite 1.0.30001809
已验证示例 — npm caniuse-lite 1.0.30001809. contract 在 node 22 · linux alpine/x64 · docker 上运行并通过: getAgent(browserName) returns browser metadata including name…
sha256:d48f542445447037d8db0fe373d0608532c32a60a8026b2f27b6b798f6644f8b
本网络只提供一件事:能构建的样本。它在沙箱中运行并保留签名回执。它不评级、不担保——同样的代码能否在你的环境构建,它没有测量过。
提交了通过的契约回执的不同签名密钥数量。为 1 表示只有作者;大于 1 表示还有其他人构建过。密钥是自行生成的,背后没有注册身份,因此计的是密钥而非人。
MIT-0
执行证据
声明的环境与签名的运行分开呈现,你可以看到这个样本究竟运行了什么、在哪里运行。
- 证据依据
- 签名契约通过
- 验证回执
- 2
- 构建过它的签名密钥
- 1
声明的环境
linux 24 · ubuntu · glibc 2.39 x64 npm
验证运行环境
| 环境 | 契约 | 阶段 | 运行日期 |
|---|---|---|---|
| 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/caniuse-lite@1.0.30001809
- 创建时间
- 2026-08-26T06:52:09Z
契约
- getAgent(browserName) returns browser metadata including name, prefix, and supported versions
- getFeature(featureName) unpacks and returns feature title, status, and browser support stats
- getFeatureSupport(featureName, browserName, version) returns support status string or null for invalid queries
- isFeatureSupported(featureName, browserName, version) returns true for supported browser versions and false otherwise
- getRegionStats(regionData) unpacks regional browser usage statistics
文件
- PROMPT.md
- csx.json
- index.mjs
- package-lock.json
- package.json
- spec.json
- test/contract.mjs
源代码
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/caniuse-lite@1.0.30001809
Kind: HOW
Use EXACTLY these public packages and versions:
- pkg:npm/caniuse-lite@1.0.30001809
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:b665d2079a5acefe0c3887b7ebe0f23ca335f2a7ce8bfaf5d4c32012a256bbb4","contract":["getAgent(browserName) returns browser metadata including name, prefix, and supported versions","getFeature(featureName) unpacks and returns feature title, status, and browser support stats","getFeatureSupport(featureName, browserName, version) returns support status string or null for invalid queries","isFeatureSupported(featureName, browserName, version) returns true for supported browser versions and false otherwise","getRegionStats(regionData) unpacks regional browser usage statistics"],"goal":"verify pkg:npm/caniuse-lite@1.0.30001809","kind":"HOW","packages":["pkg:npm/caniuse-lite@1.0.30001809"],"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/caniuse-lite@1.0.30001809"],"schemaVersion":1,"subject":"pkg:npm/caniuse-lite@1.0.30001809","verifierAdapter":"node-typescript@1"}
import { agents, feature, features, region } from 'caniuse-lite';
export function getAgent(browserName) {
return agents[browserName] ?? null;
}
export function getFeature(featureName) {
const raw = features[featureName];
if (!raw) return null;
return feature(raw);
}
export function getFeatureSupport(featureName, browserName, version) {
const feat = getFeature(featureName);
if (!feat || !feat.stats || !feat.stats[browserName]) return null;
return feat.stats[browserName][version] ?? null;
}
export function isFeatureSupported(featureName, browserName, version) {
const support = getFeatureSupport(featureName, browserName, version);
if (!support) return false;
return support.startsWith('y');
}
export function getRegionStats(regionData) {
return region(regionData);
}
{
"name": "sample-caniuse-lite",
"version": "1.0.0",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "sample-caniuse-lite",
"version": "1.0.0",
"dependencies": {
"caniuse-lite": "1.0.30001809"
}
},
"node_modules/caniuse-lite": {
"version": "1.0.30001809",
"resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001809.tgz",
"integrity": "sha512-xxWVywk6a6Arlk+hymeycyn/VgqEfLDxupvhH/xiY5SJ/18kmi9o6MiO320DCUzypORHLtvh0I4i04tUhCNHNQ==",
"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"
}
}
}
{
"name": "sample-caniuse-lite",
"version": "1.0.0",
"description": "Clean-room verification sample for caniuse-lite",
"type": "module",
"private": true,
"dependencies": {
"caniuse-lite": "1.0.30001809"
}
}
{
"schemaVersion": 1,
"goal": "verify pkg:npm/caniuse-lite@1.0.30001809",
"kind": "HOW",
"packages": [
"pkg:npm/caniuse-lite@1.0.30001809"
]
}
import assert from 'node:assert/strict';
import usRegion from 'caniuse-lite/data/regions/US.js';
import {
getAgent,
getFeature,
getFeatureSupport,
isFeatureSupported,
getRegionStats
} from '../index.mjs';
// 1. getAgent(browserName) returns browser metadata including name, prefix, and supported versions
const chromeAgent = getAgent('chrome');
assert.ok(chromeAgent !== null, 'Chrome agent should exist');
assert.equal(chromeAgent.browser, 'Chrome');
assert.equal(chromeAgent.prefix, 'webkit');
assert.ok(Array.isArray(chromeAgent.versions), 'Versions should be an array');
assert.ok(chromeAgent.versions.includes('150'), 'Versions should include version 150');
assert.equal(typeof chromeAgent.usage_global['150'], 'number');
assert.equal(getAgent('nonexistent_browser'), null);
// 2. getFeature(featureName) unpacks and returns feature title, status, and browser support stats
const fetchFeature = getFeature('fetch');
assert.ok(fetchFeature !== null, 'Fetch feature should exist');
assert.equal(fetchFeature.title, 'Fetch');
assert.equal(typeof fetchFeature.status, 'string');
assert.ok(fetchFeature.stats && typeof fetchFeature.stats === 'object');
assert.equal(getFeature('nonexistent_feature'), null);
// 3. getFeatureSupport(featureName, browserName, version) returns support status string or null for invalid queries
assert.equal(getFeatureSupport('fetch', 'chrome', '100'), 'y');
assert.equal(getFeatureSupport('fetch', 'ie', '11'), 'n');
assert.equal(getFeatureSupport('css-grid', 'ie', '11'), 'a x #2');
assert.equal(getFeatureSupport('fetch', 'chrome', 'invalid_ver_9999'), null);
assert.equal(getFeatureSupport('nonexistent_feature', 'chrome', '100'), null);
// 4. isFeatureSupported(featureName, browserName, version) returns true for supported browser versions and false otherwise
assert.equal(isFeatureSupported('fetch', 'chrome', '100'), true);
assert.equal(isFeatureSupported('fetch', 'ie', '11'), false);
assert.equal(isFeatureSupported('css-grid', 'chrome', '60'), true);
assert.equal(isFeatureSupported('css-grid', 'chrome', '57'), true);
assert.equal(isFeatureSupported('css-grid', 'ie', '11'), false);
assert.equal(isFeatureSupported('nonexistent_feature', 'chrome', '100'), false);
// 5. getRegionStats(regionData) unpacks regional browser usage statistics
const usStats = getRegionStats(usRegion);
assert.ok(usStats && typeof usStats === 'object');
assert.ok('chrome' in usStats);
assert.equal(typeof usStats.chrome['150'], 'number');
console.log('All caniuse-lite@1.0.30001809 contract assertions passed.');
原始种子者
匿名