샘플
bare-semver 1.1.0: parse, compare and validate semantic versions and ranges with bare-semver
검증된 샘플 — npm bare-semver 1.1.0: parse, compare and validate semantic versions and ranges with bare-semver. node 22 · linux alpine/x64 · docker에서 contract를…
sha256:f322af6da5f050ad6721686d4294b7f839f06092aee9f3822217e530cf347a9c
이 네트워크가 제공하는 것은 하나입니다. 빌드되는 샘플. 샌드박스에서 돌리고 서명된 영수증을 보관합니다. 등급을 매기지 않고 무엇도 보증하지 않습니다 — 같은 코드가 당신 환경에서 빌드되는지는 측정한 적이 없습니다.
통과한 계약 영수증을 낸 서로 다른 서명 키의 수입니다. 하나면 작성자 혼자이고, 둘 이상이면 다른 사람도 빌드했다는 뜻입니다. 키는 스스로 만드는 것이고 뒤에 등록된 신원이 없으므로, 세는 것은 사람이 아니라 키입니다.
MIT-0
실행 증거
선언된 환경과 서명된 실행을 분리해 두었습니다. 이 샘플이 무엇을 어디서 실행했는지 그대로 볼 수 있습니다.
- 증거 기준
- 서명된 컨트랙트 통과
- 검증 영수증
- 1
- 빌드한 서명 키
- 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-27 |
케이스
HOW- 목표
- parse, compare and validate semantic versions and ranges with bare-semver
- 심벌
-
- bare-semver.Range
- bare-semver.Version
- bare-semver.satisfies
- 생성일
- 2026-08-27T13:10:04Z
컨트랙트
- Version.parse parses semantic version strings into major, minor, patch, prerelease, and build components
- Version.compare and Version.prototype.compare correctly order semantic versions according to precedence rules
- Version.prototype.toString serializes Version instances back to standard semantic version format
- Range.parse parses caret, tilde, comparator expressions, and union ranges into Range instances
- Range.prototype.test checks whether Version instances satisfy the range constraints
- satisfies tests whether semantic version strings or Version instances satisfy range expressions
- Version.parse throws SemVerError with INVALID_VERSION for malformed version strings
파일
- PROMPT.md
- csx.json
- 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: parse, compare and validate semantic versions and ranges with bare-semver
Kind: HOW
Use EXACTLY these public packages and versions:
- pkg:npm/bare-semver@1.1.0
Demonstrate these symbols/APIs:
- bare-semver.Range
- bare-semver.Version
- bare-semver.satisfies
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:3f34050a532bca7e41fa6edddbced99953d3571900ebf93abaa0c61e32ca6acd","contract":["Version.parse parses semantic version strings into major, minor, patch, prerelease, and build components","Version.compare and Version.prototype.compare correctly order semantic versions according to precedence rules","Version.prototype.toString serializes Version instances back to standard semantic version format","Range.parse parses caret, tilde, comparator expressions, and union ranges into Range instances","Range.prototype.test checks whether Version instances satisfy the range constraints","satisfies tests whether semantic version strings or Version instances satisfy range expressions","Version.parse throws SemVerError with INVALID_VERSION for malformed version strings"],"goal":"parse, compare and validate semantic versions and ranges with bare-semver","kind":"HOW","packages":["pkg:npm/bare-semver@1.1.0"],"schemaVersion":1,"symbols":["bare-semver.Range","bare-semver.Version","bare-semver.satisfies"]},"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/bare-semver@1.1.0"],"schemaVersion":1,"subject":"pkg:npm/bare-semver@1.1.0","symbols":["bare-semver.Range","bare-semver.Version","bare-semver.satisfies"],"verifierAdapter":"node-typescript@1"}
{
"name": "bare-semver-sample",
"version": "1.0.0",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "bare-semver-sample",
"version": "1.0.0",
"dependencies": {
"bare-semver": "1.1.0"
}
},
"node_modules/bare-semver": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/bare-semver/-/bare-semver-1.1.0.tgz",
"integrity": "sha512-1Hw5qJ7hXdVt3uPUqjeFTuxyvBUJauvz5A1I2jk8gzjZMHp04n//6nV9MDbG9CMw78JHY2lGV0w6s//LrASm2w==",
"license": "Apache-2.0"
}
}
}
{
"name": "bare-semver-sample",
"version": "1.0.0",
"private": true,
"description": "Clean-room verification for bare-semver",
"dependencies": {
"bare-semver": "1.1.0"
}
}
{
"schemaVersion": 1,
"goal": "parse, compare and validate semantic versions and ranges with bare-semver",
"kind": "HOW",
"packages": [
"pkg:npm/bare-semver@1.1.0"
],
"symbols": [
"bare-semver.Range",
"bare-semver.Version",
"bare-semver.satisfies"
]
}
import assert from 'node:assert';
import semver from 'bare-semver';
// 1. Version.parse parses semantic version strings into major, minor, patch, prerelease, and build components
const v1 = semver.Version.parse('1.2.3-alpha.1+build.42');
assert.strictEqual(v1.major, 1);
assert.strictEqual(v1.minor, 2);
assert.strictEqual(v1.patch, 3);
assert.deepStrictEqual(v1.prerelease, ['alpha', '1']);
assert.deepStrictEqual(v1.build, ['build', '42']);
assert.strictEqual(v1.toString(), '1.2.3-alpha.1+build.42');
// 2. Version.compare and Version.prototype.compare correctly order semantic versions according to precedence rules
const vA = semver.Version.parse('1.0.0-alpha');
const vB = semver.Version.parse('1.0.0');
const vC = semver.Version.parse('1.2.3');
const vD = semver.Version.parse('1.2.4');
assert.strictEqual(semver.Version.compare(vA, vB), -1);
assert.strictEqual(semver.Version.compare(vB, vA), 1);
assert.strictEqual(semver.Version.compare(vC, vD), -1);
assert.strictEqual(semver.Version.compare(vD, vC), 1);
assert.strictEqual(semver.Version.compare(vC, vC), 0);
assert.strictEqual(vC.compare(vD), -1);
assert.strictEqual(vD.compare(vC), 1);
// 3. Version.prototype.toString serializes Version instances back to standard semantic version format
const created = new semver.Version(2, 5, 1, { prerelease: ['beta', '2'], build: ['exp', 'sha'] });
assert.strictEqual(created.toString(), '2.5.1-beta.2+exp.sha');
// 4. Range.parse parses caret, tilde, comparator expressions, and union ranges into Range instances
const caretRange = semver.Range.parse('^1.2.3');
const tildeRange = semver.Range.parse('~1.2.3');
const unionRange = semver.Range.parse('>=1.0.0 <2.0.0 || >=3.0.0');
assert.ok(caretRange instanceof semver.Range);
assert.ok(tildeRange instanceof semver.Range);
assert.ok(unionRange instanceof semver.Range);
// 5. Range.prototype.test checks whether Version instances satisfy the range constraints
assert.strictEqual(caretRange.test(semver.Version.parse('1.2.3')), true);
assert.strictEqual(caretRange.test(semver.Version.parse('1.9.0')), true);
assert.strictEqual(caretRange.test(semver.Version.parse('2.0.0')), false);
assert.strictEqual(tildeRange.test(semver.Version.parse('1.2.9')), true);
assert.strictEqual(tildeRange.test(semver.Version.parse('1.3.0')), false);
assert.strictEqual(unionRange.test(semver.Version.parse('1.5.0')), true);
assert.strictEqual(unionRange.test(semver.Version.parse('2.5.0')), false);
assert.strictEqual(unionRange.test(semver.Version.parse('3.1.0')), true);
// 6. satisfies tests whether semantic version strings or Version instances satisfy range expressions
assert.strictEqual(semver.satisfies('1.2.3', '>=1.0.0 <2.0.0'), true);
assert.strictEqual(semver.satisfies('2.0.0', '>=1.0.0 <2.0.0'), false);
assert.strictEqual(semver.satisfies('1.2.3', '^1.2.0'), true);
assert.strictEqual(semver.satisfies('1.3.0', '~1.2.3'), false);
assert.strictEqual(semver.satisfies(vC, '^1.0.0'), true);
// 7. Version.parse throws SemVerError with INVALID_VERSION for malformed version strings
assert.throws(() => {
semver.Version.parse('invalid.version.string');
}, (err) => {
return err.name === 'SemVerError' && err.code === 'INVALID_VERSION';
});
console.log('Contract passed');
오리진 시더
익명