샘플
bare-url 2.5.2
검증된 샘플 — npm bare-url 2.5.2. node 22 · linux alpine/x64 · docker에서 contract를 실행해 통과했습니다: package manifest specifies Bare addon configuration and exports for…
sha256:d0b51bfd1aae9188136b48f9947c886d9634889d29ebe82f273d34642c4a8c7c
이 네트워크가 제공하는 것은 하나입니다. 빌드되는 샘플. 샌드박스에서 돌리고 서명된 영수증을 보관합니다. 등급을 매기지 않고 무엇도 보증하지 않습니다 — 같은 코드가 당신 환경에서 빌드되는지는 측정한 적이 없습니다.
통과한 계약 영수증을 낸 서로 다른 서명 키의 수입니다. 하나면 작성자 혼자이고, 둘 이상이면 다른 사람도 빌드했다는 뜻입니다. 키는 스스로 만드는 것이고 뒤에 등록된 신원이 없으므로, 세는 것은 사람이 아니라 키입니다.
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-23 |
케이스
HOW- 목표
- verify pkg:npm/bare-url@2.5.2
- 패키지
- 환경
- node 22.23.2
- 생성일
- 2026-08-23T16:01:41Z
컨트랙트
- package manifest specifies Bare addon configuration and exports for root, global, and package subpaths
- declares URL interface, URL namespace helper functions, and ambient global types in index.d.ts and global.d.ts
- URLSearchParams parses query strings, supports get, getAll, has, append, delete, set, size, serialization, and iteration
- URLError defines error hierarchy with specific static constructors including INVALID_URL and INVALID_FILE_URL_PATH
- ships native Bare C addon binding and CMakeLists build configuration
파일
- 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: verify pkg:npm/bare-url@2.5.2
Kind: HOW
Use EXACTLY these public packages and versions:
- pkg:npm/bare-url@2.5.2
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:41f8fa80ae399b3457bae2a21d100289b10f53c295361f52db739b9961c0b187","constraints":{"executionContext":"node"},"contract":["package manifest specifies Bare addon configuration and exports for root, global, and package subpaths","declares URL interface, URL namespace helper functions, and ambient global types in index.d.ts and global.d.ts","URLSearchParams parses query strings, supports get, getAll, has, append, delete, set, size, serialization, and iteration","URLError defines error hierarchy with specific static constructors including INVALID_URL and INVALID_FILE_URL_PATH","ships native Bare C addon binding and CMakeLists build configuration"],"goal":"verify pkg:npm/bare-url@2.5.2","kind":"HOW","packages":["pkg:npm/bare-url@2.5.2"],"schemaVersion":1},"contractCommand":["node","test/contract.mjs"],"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/bare-url@2.5.2"],"schemaVersion":1,"subject":"pkg:npm/bare-url@2.5.2","verifierAdapter":"node-typescript@1"}
{
"name": "sample-bare-url",
"version": "1.0.0",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "sample-bare-url",
"version": "1.0.0",
"license": "MIT-0",
"dependencies": {
"bare-url": "2.5.2"
}
},
"node_modules/bare-path": {
"version": "3.1.1",
"resolved": "https://registry.npmjs.org/bare-path/-/bare-path-3.1.1.tgz",
"integrity": "sha512-JprUlveX3QjApC1cTpsUOiscADftCGVWkzitbHsRqv84hzYwYHw2mbluddsq5TvI8mH/8Ov1f4BiMAdcB0oYnQ==",
"license": "Apache-2.0"
},
"node_modules/bare-url": {
"version": "2.5.2",
"resolved": "https://registry.npmjs.org/bare-url/-/bare-url-2.5.2.tgz",
"integrity": "sha512-L13PCJzKG8RGvx8V1/DdMi12ERhC3tprr7/8a94BxpmnRsFqxh5XZNdhtMxu5HPkRshYOOWRGY8lDP7ZhpG9Cg==",
"license": "Apache-2.0",
"dependencies": {
"bare-path": "^3.0.0"
}
}
}
}
{
"name": "sample-bare-url",
"version": "1.0.0",
"private": true,
"type": "module",
"license": "MIT-0",
"dependencies": {
"bare-url": "2.5.2"
}
}
{
"schemaVersion": 1,
"goal": "verify pkg:npm/bare-url@2.5.2",
"kind": "HOW",
"packages": [
"pkg:npm/bare-url@2.5.2"
],
"constraints": {
"executionContext": "node"
},
"runtimeConditions": {
"ecosystem": "npm",
"language": "javascript",
"moduleSystem": "cjs",
"packageManager": "npm@10.9.8",
"runtime": "node@22.23.2"
}
}
import assert from 'node:assert/strict';
import { createRequire } from 'node:module';
import fs from 'node:fs';
import path from 'node:path';
const require = createRequire(import.meta.url);
// 1. Resolve bare-url package manifest and verify exports and metadata
const pkgPath = require.resolve('bare-url/package');
const pkg = JSON.parse(fs.readFileSync(pkgPath, 'utf8'));
assert.equal(pkg.name, 'bare-url', 'Package name must be bare-url');
assert.equal(pkg.version, '2.5.2', 'Package version must be 2.5.2');
assert.equal(pkg.license, 'Apache-2.0', 'Package license must be Apache-2.0');
assert.equal(pkg.addon, true, 'Package must be marked as addon');
assert.ok(pkg.exports, 'Package must define exports');
assert.equal(pkg.exports['.'].types, './index.d.ts', 'Root export must specify index.d.ts types');
assert.equal(pkg.exports['.'].default, './index.js', 'Root export must specify index.js default');
assert.equal(pkg.exports['./global'].types, './global.d.ts', 'Global export must specify global.d.ts types');
assert.equal(pkg.exports['./global'].default, './global.js', 'Global export must specify global.js default');
assert.equal(pkg.exports['./package'], './package.json', 'Package export must point to package.json');
const pkgDir = path.dirname(pkgPath);
const indexDts = fs.readFileSync(path.join(pkgDir, 'index.d.ts'), 'utf8');
const globalDts = fs.readFileSync(path.join(pkgDir, 'global.d.ts'), 'utf8');
// 2. Verify index.d.ts and global.d.ts type definitions and API declarations
assert.ok(indexDts.includes('interface URL {'), 'index.d.ts must declare URL interface');
assert.ok(indexDts.includes('searchParams: URLSearchParams'), 'index.d.ts must declare searchParams property');
assert.ok(indexDts.includes('declare class URL {'), 'index.d.ts must declare URL class constructor');
assert.ok(indexDts.includes('export function isURL(value: unknown): value is URL'), 'index.d.ts must declare isURL guard');
assert.ok(indexDts.includes('export function isURLSearchParams(value: unknown): value is URLSearchParams'), 'index.d.ts must declare isURLSearchParams guard');
assert.ok(indexDts.includes('export function parse(input: string, base?: string | URL): URL | null'), 'index.d.ts must declare parse function');
assert.ok(indexDts.includes('export function canParse(input: string, base?: string | URL): boolean'), 'index.d.ts must declare canParse function');
assert.ok(indexDts.includes('export function fileURLToPath(url: URL | string): string'), 'index.d.ts must declare fileURLToPath');
assert.ok(indexDts.includes('export function pathToFileURL(pathname: string): URL'), 'index.d.ts must declare pathToFileURL');
assert.ok(globalDts.includes('declare global {'), 'global.d.ts must declare global augmentations');
assert.ok(globalDts.includes('type URL = url.URL'), 'global.d.ts must define URL global type');
assert.ok(globalDts.includes('type URLSearchParams = url.URLSearchParams'), 'global.d.ts must define URLSearchParams global type');
// 3. Verify URLSearchParams query parsing, manipulation, serialization, and iteration
const URLSearchParams = require(path.join(pkgDir, 'lib', 'url-search-params.js'));
const params = new URLSearchParams('topic=api&tag=v1&tag=v2&filter=active');
assert.equal(params.size, 4, 'size should count all parameters');
assert.equal(params.get('topic'), 'api', 'get should return first match');
assert.deepEqual(params.getAll('tag'), ['v1', 'v2'], 'getAll should return all matching values');
assert.equal(params.has('topic'), true, 'has should return true for existing key');
assert.equal(params.has('topic', 'api'), true, 'has should verify key and value');
assert.equal(params.has('topic', 'other'), false, 'has should return false for mismatched value');
params.append('tag', 'v3');
assert.deepEqual(params.getAll('tag'), ['v1', 'v2', 'v3']);
params.delete('tag', 'v1');
assert.deepEqual(params.getAll('tag'), ['v2', 'v3']);
params.set('filter', 'all');
assert.equal(params.get('filter'), 'all');
assert.equal(params.toString(), 'topic=api&tag=v2&tag=v3&filter=all');
assert.deepEqual(params.toJSON(), [
['topic', 'api'],
['tag', 'v2'],
['tag', 'v3'],
['filter', 'all']
]);
// Test iterator
const entries = Array.from(params);
assert.equal(entries.length, 4);
assert.deepEqual(entries[0], ['topic', 'api']);
// 4. Verify URLError error hierarchy and static error constructors
const URLError = require(path.join(pkgDir, 'lib', 'errors.js'));
const invalidUrlErr = URLError.INVALID_URL('bad input', 'ht!tp');
assert.equal(invalidUrlErr.name, 'URLError');
assert.equal(invalidUrlErr.code, 'INVALID_URL');
assert.equal(invalidUrlErr.input, 'ht!tp');
const schemeErr = URLError.INVALID_URL_SCHEME();
assert.equal(schemeErr.code, 'INVALID_URL_SCHEME');
const hostErr = URLError.INVALID_FILE_URL_HOST();
assert.equal(hostErr.code, 'INVALID_FILE_URL_HOST');
const pathErr = URLError.INVALID_FILE_URL_PATH();
assert.equal(pathErr.code, 'INVALID_FILE_URL_PATH');
// 5. Verify C binding and CMake native build files exist
assert.ok(fs.existsSync(path.join(pkgDir, 'binding.c')), 'binding.c must exist');
assert.ok(fs.existsSync(path.join(pkgDir, 'binding.js')), 'binding.js must exist');
assert.ok(fs.existsSync(path.join(pkgDir, 'CMakeLists.txt')), 'CMakeLists.txt must exist');
assert.ok(fs.existsSync(path.join(pkgDir, 'prebuilds')), 'prebuilds directory must exist');
console.log('Contract tests passed successfully.');
오리진 시더
익명