샘플
@types/node 20.19.43
검증된 샘플 — npm @types/node 20.19.43. node 22 · linux alpine/x64 · docker에서 contract를 실행해 통과했습니다: @types/node package.json declares type definitions entry point…
sha256:1a67b064abe20ead78feb785c8cd4c2c27af745b647fd26674a7e9a7863e1c06
이 네트워크가 제공하는 것은 하나입니다. 빌드되는 샘플. 샌드박스에서 돌리고 서명된 영수증을 보관합니다. 등급을 매기지 않고 무엇도 보증하지 않습니다 — 같은 코드가 당신 환경에서 빌드되는지는 측정한 적이 없습니다.
통과한 계약 영수증을 낸 서로 다른 서명 키의 수입니다. 하나면 작성자 혼자이고, 둘 이상이면 다른 사람도 빌드했다는 뜻입니다. 키는 스스로 만드는 것이고 뒤에 등록된 신원이 없으므로, 세는 것은 사람이 아니라 키입니다.
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@1 |
2026-08-21 |
케이스
HOW- 목표
- verify pkg:npm/%40types/node@20.19.43
- 환경
- node 22.23.2
- 생성일
- 2026-08-21T15:22:26Z
컨트랙트
- @types/node package.json declares type definitions entry point index.d.ts and version 20.19.43
- @types/node index.d.ts references core Node.js module declaration files including buffer, crypto, events, fs, and stream
- @types/node buffer.d.ts declares Buffer interface and BufferEncoding type
- @types/node crypto.d.ts declares createHash, createHmac, and randomBytes cryptographic functions
- @types/node events.d.ts declares EventEmitter class and listenerCount method
- @types/node fs.d.ts declares readFileSync and writeFileSync signatures
- @types/node stream.d.ts declares Readable, Writable, and Transform stream classes
파일
- 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/%40types/node@20.19.43
Kind: HOW
Use EXACTLY these public packages and versions:
- pkg:npm/%40types/node@20.19.43
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:9a99a020e2dfd1f91e8d9012a58cbb52103ea35f0c6ad32ee61e9578c97fc5f9","contract":["@types/node package.json declares type definitions entry point index.d.ts and version 20.19.43","@types/node index.d.ts references core Node.js module declaration files including buffer, crypto, events, fs, and stream","@types/node buffer.d.ts declares Buffer interface and BufferEncoding type","@types/node crypto.d.ts declares createHash, createHmac, and randomBytes cryptographic functions","@types/node events.d.ts declares EventEmitter class and listenerCount method","@types/node fs.d.ts declares readFileSync and writeFileSync signatures","@types/node stream.d.ts declares Readable, Writable, and Transform stream classes"],"goal":"verify pkg:npm/%40types/node@20.19.43","kind":"HOW","packages":["pkg:npm/%40types/node@20.19.43"],"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/%40types/node@20.19.43"],"schemaVersion":1,"subject":"pkg:npm/%40types/node@20.19.43","verifierAdapter":"node-typescript@1"}
{
"name": "sample-node-types",
"version": "1.0.0",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "sample-node-types",
"version": "1.0.0",
"license": "MIT-0",
"dependencies": {
"@types/node": "20.19.43"
}
},
"node_modules/@types/node": {
"version": "20.19.43",
"resolved": "https://registry.npmjs.org/@types/node/-/node-20.19.43.tgz",
"integrity": "sha512-6oYBAi5ikg4Pl+kGsoYtawUMBT2zZMCvPNF7pVLnHZfd1zf38DRiWn/gT01RYCdUqkv7Fhr+C9ot4/tb+2sVvA==",
"license": "MIT",
"dependencies": {
"undici-types": "~6.21.0"
}
},
"node_modules/undici-types": {
"version": "6.21.0",
"resolved": "https://registry.npmjs.org/undici-types/-/undici-types-6.21.0.tgz",
"integrity": "sha512-iwDZqg0QAGrg9Rav5H4n0M64c3mkR59cJ6wQp+7C4nI0gsmExaedaYLNO44eT4AtBBwjbTiGPMlt2Md0T9H9JQ==",
"license": "MIT"
}
}
}
{
"name": "sample-node-types",
"version": "1.0.0",
"private": true,
"description": "Clean-room verification sample for @types/node",
"main": "src/index.js",
"scripts": {
"test": "node test/contract.js"
},
"dependencies": {
"@types/node": "20.19.43"
},
"license": "MIT-0"
}
{
"schemaVersion": 1,
"goal": "verify pkg:npm/%40types/node@20.19.43",
"kind": "HOW",
"packages": [
"pkg:npm/%40types/node@20.19.43"
]
}
const fs = require('node:fs');
const path = require('node:path');
/**
* Resolves the path to the @types/node declaration directory.
* @returns {string} Absolute path to @types/node directory
*/
function getNodeTypesDir() {
const pkgJsonPath = require.resolve('@types/node/package.json');
return path.dirname(pkgJsonPath);
}
/**
* Resolves the path to a specific declaration file inside @types/node.
* @param {string} [subPath='index.d.ts'] - Relative declaration file path
* @returns {string} Absolute path to the declaration file
*/
function getDeclarationPath(subPath = 'index.d.ts') {
const baseDir = getNodeTypesDir();
return path.join(baseDir, subPath);
}
/**
* Loads the text content of a declaration file in @types/node.
* @param {string} [subPath='index.d.ts'] - Relative declaration file path
* @returns {string} Text content of the declaration file
*/
function loadDeclarationContent(subPath = 'index.d.ts') {
const declPath = getDeclarationPath(subPath);
return fs.readFileSync(declPath, 'utf8');
}
/**
* Inspects core Node.js TypeScript declaration files and signatures.
* @returns {object} Summary of discovered type definitions
*/
function inspectTypeDefinitions() {
const indexContent = loadDeclarationContent('index.d.ts');
const bufferContent = loadDeclarationContent('buffer.d.ts');
const cryptoContent = loadDeclarationContent('crypto.d.ts');
const eventsContent = loadDeclarationContent('events.d.ts');
const fsContent = loadDeclarationContent('fs.d.ts');
const streamContent = loadDeclarationContent('stream.d.ts');
return {
indexHasBuffer: indexContent.includes('buffer.d.ts'),
indexHasCrypto: indexContent.includes('crypto.d.ts'),
indexHasEvents: indexContent.includes('events.d.ts'),
indexHasFs: indexContent.includes('fs.d.ts'),
indexHasStream: indexContent.includes('stream.d.ts'),
bufferHasInterface: bufferContent.includes('interface Buffer'),
bufferHasEncoding: bufferContent.includes('type BufferEncoding ='),
cryptoHasCreateHash: cryptoContent.includes('function createHash('),
cryptoHasCreateHmac: cryptoContent.includes('function createHmac('),
cryptoHasRandomBytes: cryptoContent.includes('function randomBytes('),
eventsHasEventEmitter: eventsContent.includes('class EventEmitter'),
eventsHasListenerCount: eventsContent.includes('listenerCount('),
fsHasReadFileSync: fsContent.includes('function readFileSync('),
fsHasWriteFileSync: fsContent.includes('function writeFileSync('),
streamHasReadable: streamContent.includes('class Readable'),
streamHasWritable: streamContent.includes('class Writable'),
streamHasTransform: streamContent.includes('class Transform')
};
}
module.exports = {
getNodeTypesDir,
getDeclarationPath,
loadDeclarationContent,
inspectTypeDefinitions
};
const assert = require('node:assert');
const fs = require('node:fs');
const path = require('node:path');
const {
getNodeTypesDir,
getDeclarationPath,
loadDeclarationContent,
inspectTypeDefinitions
} = require('../src/index.js');
// 1. Verify package manifest exports and metadata
const pkgJson = require('@types/node/package.json');
assert.strictEqual(pkgJson.name, '@types/node', 'package name should match @types/node');
assert.strictEqual(pkgJson.version, '20.19.43', 'package version should match 20.19.43');
assert.strictEqual(pkgJson.types, 'index.d.ts', 'package types entry should point to index.d.ts');
// 2. Verify declaration files existence
const indexDeclPath = getDeclarationPath('index.d.ts');
assert.strictEqual(fs.existsSync(indexDeclPath), true, 'index.d.ts should exist on disk');
assert.strictEqual(fs.existsSync(getDeclarationPath('buffer.d.ts')), true, 'buffer.d.ts should exist on disk');
assert.strictEqual(fs.existsSync(getDeclarationPath('crypto.d.ts')), true, 'crypto.d.ts should exist on disk');
assert.strictEqual(fs.existsSync(getDeclarationPath('events.d.ts')), true, 'events.d.ts should exist on disk');
assert.strictEqual(fs.existsSync(getDeclarationPath('fs.d.ts')), true, 'fs.d.ts should exist on disk');
assert.strictEqual(fs.existsSync(getDeclarationPath('stream.d.ts')), true, 'stream.d.ts should exist on disk');
// 3. Verify index.d.ts references core modules
const indexContent = loadDeclarationContent('index.d.ts');
assert.strictEqual(typeof indexContent, 'string', 'index.d.ts content should be a string');
assert.strictEqual(indexContent.includes('buffer.d.ts'), true, 'index.d.ts should reference buffer.d.ts');
assert.strictEqual(indexContent.includes('crypto.d.ts'), true, 'index.d.ts should reference crypto.d.ts');
assert.strictEqual(indexContent.includes('events.d.ts'), true, 'index.d.ts should reference events.d.ts');
assert.strictEqual(indexContent.includes('fs.d.ts'), true, 'index.d.ts should reference fs.d.ts');
assert.strictEqual(indexContent.includes('stream.d.ts'), true, 'index.d.ts should reference stream.d.ts');
// 4. Verify buffer.d.ts declarations
const bufferContent = loadDeclarationContent('buffer.d.ts');
assert.strictEqual(bufferContent.includes('interface Buffer'), true, 'buffer.d.ts must declare Buffer interface');
assert.strictEqual(bufferContent.includes('type BufferEncoding ='), true, 'buffer.d.ts must declare BufferEncoding type');
// 5. Verify crypto.d.ts declarations
const cryptoContent = loadDeclarationContent('crypto.d.ts');
assert.strictEqual(cryptoContent.includes('function createHash('), true, 'crypto.d.ts must declare createHash');
assert.strictEqual(cryptoContent.includes('function createHmac('), true, 'crypto.d.ts must declare createHmac');
assert.strictEqual(cryptoContent.includes('function randomBytes('), true, 'crypto.d.ts must declare randomBytes');
// 6. Verify events.d.ts declarations
const eventsContent = loadDeclarationContent('events.d.ts');
assert.strictEqual(eventsContent.includes('class EventEmitter'), true, 'events.d.ts must declare EventEmitter class');
assert.strictEqual(eventsContent.includes('listenerCount('), true, 'events.d.ts must declare listenerCount');
// 7. Verify fs.d.ts declarations
const fsContent = loadDeclarationContent('fs.d.ts');
assert.strictEqual(fsContent.includes('function readFileSync('), true, 'fs.d.ts must declare readFileSync');
assert.strictEqual(fsContent.includes('function writeFileSync('), true, 'fs.d.ts must declare writeFileSync');
// 8. Verify stream.d.ts declarations
const streamContent = loadDeclarationContent('stream.d.ts');
assert.strictEqual(streamContent.includes('class Readable'), true, 'stream.d.ts must declare Readable class');
assert.strictEqual(streamContent.includes('class Writable'), true, 'stream.d.ts must declare Writable class');
assert.strictEqual(streamContent.includes('class Transform'), true, 'stream.d.ts must declare Transform class');
// 9. Verify helper inspection module
const inspection = inspectTypeDefinitions();
assert.strictEqual(inspection.indexHasBuffer, true, 'inspection should confirm buffer reference');
assert.strictEqual(inspection.indexHasCrypto, true, 'inspection should confirm crypto reference');
assert.strictEqual(inspection.indexHasEvents, true, 'inspection should confirm events reference');
assert.strictEqual(inspection.indexHasFs, true, 'inspection should confirm fs reference');
assert.strictEqual(inspection.indexHasStream, true, 'inspection should confirm stream reference');
assert.strictEqual(inspection.bufferHasInterface, true, 'inspection should confirm Buffer interface');
assert.strictEqual(inspection.bufferHasEncoding, true, 'inspection should confirm BufferEncoding type');
assert.strictEqual(inspection.cryptoHasCreateHash, true, 'inspection should confirm createHash function');
assert.strictEqual(inspection.cryptoHasCreateHmac, true, 'inspection should confirm createHmac function');
assert.strictEqual(inspection.cryptoHasRandomBytes, true, 'inspection should confirm randomBytes function');
assert.strictEqual(inspection.eventsHasEventEmitter, true, 'inspection should confirm EventEmitter class');
assert.strictEqual(inspection.eventsHasListenerCount, true, 'inspection should confirm listenerCount method');
assert.strictEqual(inspection.fsHasReadFileSync, true, 'inspection should confirm readFileSync function');
assert.strictEqual(inspection.fsHasWriteFileSync, true, 'inspection should confirm writeFileSync function');
assert.strictEqual(inspection.streamHasReadable, true, 'inspection should confirm Readable class');
assert.strictEqual(inspection.streamHasWritable, true, 'inspection should confirm Writable class');
assert.strictEqual(inspection.streamHasTransform, true, 'inspection should confirm Transform class');
console.log('Contract tests passed successfully.');
오리진 시더
익명