CodeSampleX

샘플

@types/node 24.13.3

검증된 샘플 — npm @types/node 24.13.3. node 22 · linux alpine/x64 · docker에서 contract를 실행해 통과했습니다: @types/node package.json declares type definitions entry point…

sha256:9f390b3256bdd7e69d7ed10518b4f68b8e6d4a9ce530e8aeebe9a8a145c8bfaf

이 네트워크가 제공하는 것은 하나입니다. 빌드되는 샘플. 샌드박스에서 돌리고 서명된 영수증을 보관합니다. 등급을 매기지 않고 무엇도 보증하지 않습니다 — 같은 코드가 당신 환경에서 빌드되는지는 측정한 적이 없습니다. 통과한 계약 영수증을 낸 서로 다른 서명 키의 수입니다. 하나면 작성자 혼자이고, 둘 이상이면 다른 사람도 빌드했다는 뜻입니다. 키는 스스로 만드는 것이고 뒤에 등록된 신원이 없으므로, 세는 것은 사람이 아니라 키입니다. 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@24.13.3
패키지
환경
node 22.23.2
생성일
2026-08-21T16:25:08Z

컨트랙트

  1. @types/node package.json declares type definitions entry point index.d.ts and version 24.13.3
  2. @types/node index.d.ts references core Node.js module declaration files including buffer, crypto, events, fs, and stream
  3. @types/node buffer.d.ts declares Buffer interface and BufferEncoding type
  4. @types/node crypto.d.ts declares createHash, createHmac, and randomBytes cryptographic functions
  5. @types/node events.d.ts declares EventEmitter class and listenerCount method
  6. @types/node fs.d.ts declares readFileSync and writeFileSync signatures
  7. @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

소스 아티팩트 내려받기 (tar.gz)

소스

PROMPT.md
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@24.13.3
Kind: HOW

Use EXACTLY these public packages and versions:
  - pkg:npm/%40types/node@24.13.3

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.
csx.json
{"case":{"caseId":"case:sha256:befcf2c2926963793549ded01807a125f8f01f2fc1122f3232c08282323fecdb","contract":["@types/node package.json declares type definitions entry point index.d.ts and version 24.13.3","@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@24.13.3","kind":"HOW","packages":["pkg:npm/%40types/node@24.13.3"],"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@24.13.3"],"schemaVersion":1,"subject":"pkg:npm/%40types/node@24.13.3","verifierAdapter":"node-typescript@1"}
package-lock.json
{
  "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": "24.13.3"
      }
    },
    "node_modules/@types/node": {
      "version": "24.13.3",
      "resolved": "https://registry.npmjs.org/@types/node/-/node-24.13.3.tgz",
      "integrity": "sha512-Dh8vAsV36ig5wa9OX4pXvMc9D3Veibfw2wix0CUwYODLD8nkj9UsLjASr49nPg+2eKzxhBV+v7L8pXvT4e639Q==",
      "license": "MIT",
      "dependencies": {
        "undici-types": "~7.18.0"
      }
    },
    "node_modules/undici-types": {
      "version": "7.18.2",
      "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-7.18.2.tgz",
      "integrity": "sha512-AsuCzffGHJybSaRrmr5eHr81mwJU3kjw6M+uprWvCXiNeN9SOGwQ3Jn8jb8m3Z6izVgknn1R0FTCEAP2QrLY/w==",
      "license": "MIT"
    }
  }
}
package.json
{
  "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": "24.13.3"
  },
  "license": "MIT-0"
}
spec.json
{
  "schemaVersion": 1,
  "goal": "verify pkg:npm/%40types/node@24.13.3",
  "kind": "HOW",
  "packages": [
    "pkg:npm/%40types/node@24.13.3"
  ]
}
src/index.js
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
};
test/contract.js
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, '24.13.3', 'package version should match 24.13.3');
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.');

오리진 시더

익명