CodeSampleX

Пример

@types/node 25.9.9

Проверенный пример — npm @types/node 25.9.9. Контракт выполнен на node 22 · linux debian/x64 · docker и пройден: @types/node@25.9.9 package manifest declares…

sha256:a34e7e9e548d20a1c411ec723e343b86b85f94bc273b9f120be69b561276f41d

Эта сеть предлагает одно: образец, который собирается. Она запустила его в песочнице и сохранила подписанную квитанцию. Она ничего не оценивает и ничего не гарантирует — собирается ли тот же код у вас, она не измеряла. Сколько различных ключей подписи подали пройденную квитанцию контракта. Один — только автор; больше одного — значит, кто-то ещё тоже собрал. Ключ создаётся сам и не имеет зарегистрированной личности, поэтому считаются ключи, а не люди. MIT-0

Свидетельства выполнения

Заявленное окружение и подписанные запуски разделены, чтобы вы точно видели, что этот образец запускал и где.

Основа свидетельства
Подписанный контракт пройден
Квитанции проверки
1
Ключи подписи, собравшие его
1
Заявленная среда node 22.23 linux 24 · ubuntu · glibc 2.39 x64 node 22.23 javascript npm 10

Среды запусков проверки

Окружение Контракт Этапы Запуск
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-11-28

Кейс

HOW
Цель
verify pkg:npm/%40types/node@25.9.9
Пакеты
Окружение
node 22.23.2
Создан
2026-11-28T23:28:57Z

Контракт

  1. @types/node@25.9.9 package manifest declares index.d.ts, typeScriptVersion 5.6, typesVersions for <=5.6 and <=5.7, and resolves undici-types (>=7.24.0 <7.24.7)
  2. every triple-slash reference path in index.d.ts, ts5.7/index.d.ts, and ts5.6/index.d.ts resolves to an existing non-empty declaration file
  3. root index.d.ts uses esnext.float16 and generic Buffer<ArrayBuffer> declarations while ts5.7 and ts5.6 provide float16array polyfills and ts5.6 provides non-generic Buffer declarations
  4. zlib/iter.d.ts declares node:zlib/iter and zlib/iter compression and decompression transforms for Brotli, Deflate, Gzip, and Zstd referencing node:stream/iter
  5. stream/iter.d.ts, quic.d.ts, sqlite.d.ts, and web-globals/storage.d.ts declare node:stream/iter, node:quic, node:sqlite, and global Web Storage interfaces

Файлы

  • PROMPT.md
  • csx.json
  • package-lock.json
  • package.json
  • spec.json
  • test/contract.cjs

Скачать артефакт с исходным кодом (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@25.9.9
Kind: HOW

Use EXACTLY these public packages and versions:
  - pkg:npm/%40types/node@25.9.9
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.
csx.json
{"case":{"caseId":"case:sha256:9c0113b56a0d0bd8277974035502b59e109710c7bff25d6f8bf59880d413098a","constraints":{"executionContext":"node"},"contract":["@types/node@25.9.9 package manifest declares index.d.ts, typeScriptVersion 5.6, typesVersions for \u003c=5.6 and \u003c=5.7, and resolves undici-types (\u003e=7.24.0 \u003c7.24.7)","every triple-slash reference path in index.d.ts, ts5.7/index.d.ts, and ts5.6/index.d.ts resolves to an existing non-empty declaration file","root index.d.ts uses esnext.float16 and generic Buffer\u003cArrayBuffer\u003e declarations while ts5.7 and ts5.6 provide float16array polyfills and ts5.6 provides non-generic Buffer declarations","zlib/iter.d.ts declares node:zlib/iter and zlib/iter compression and decompression transforms for Brotli, Deflate, Gzip, and Zstd referencing node:stream/iter","stream/iter.d.ts, quic.d.ts, sqlite.d.ts, and web-globals/storage.d.ts declare node:stream/iter, node:quic, node:sqlite, and global Web Storage interfaces"],"goal":"verify pkg:npm/%40types/node@25.9.9","kind":"HOW","packages":["pkg:npm/%40types/node@25.9.9"],"schemaVersion":1},"contractCommand":["node","test/contract.cjs"],"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@25.9.9"],"schemaVersion":1,"subject":"pkg:npm/%40types/node@25.9.9","verifierAdapter":"node-typescript@1"}
package-lock.json
{
  "name": "types-node-25-9-9-verify",
  "version": "1.0.0",
  "lockfileVersion": 3,
  "requires": true,
  "packages": {
    "": {
      "name": "types-node-25-9-9-verify",
      "version": "1.0.0",
      "license": "MIT-0",
      "dependencies": {
        "@types/node": "25.9.9"
      }
    },
    "node_modules/@types/node": {
      "version": "25.9.9",
      "resolved": "https://registry.npmjs.org/@types/node/-/node-25.9.9.tgz",
      "integrity": "sha512-b4e2xxj/yMeT2hNlD6x7zNFiQK2Dlmkb9CQ6v3/1G2RezKN4YS2lcEv8lzGm1mhs4f2lM4yNAMI/zUDBZBBt7w==",
      "license": "MIT",
      "dependencies": {
        "undici-types": ">=7.24.0 <7.24.7"
      }
    },
    "node_modules/undici-types": {
      "version": "7.24.6",
      "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-7.24.6.tgz",
      "integrity": "sha512-WRNW+sJgj5OBN4/0JpHFqtqzhpbnV0GuB+OozA9gCL7a993SmU+1JBZCzLNxYsbMfIeDL+lTsphD5jN5N+n0zg==",
      "license": "MIT"
    }
  }
}
package.json
{
  "name": "types-node-25-9-9-verify",
  "version": "1.0.0",
  "private": true,
  "license": "MIT-0",
  "dependencies": {
    "@types/node": "25.9.9"
  }
}
spec.json
{
  "schemaVersion": 1,
  "goal": "verify pkg:npm/%40types/node@25.9.9",
  "kind": "HOW",
  "packages": [
    "pkg:npm/%40types/node@25.9.9"
  ],
  "constraints": {
    "executionContext": "node"
  },
  "runtimeConditions": {
    "ecosystem": "npm",
    "language": "javascript",
    "moduleSystem": "cjs",
    "packageManager": "npm@10.9.8",
    "runtime": "node@22.23.2"
  }
}
test/contract.cjs
'use strict';

const assert = require('node:assert/strict');
const fs = require('node:fs');
const path = require('node:path');

// 1. Verify @types/node@25.9.9 package manifest and undici-types dependency resolution
const pkgPath = require.resolve('@types/node/package.json');
const pkg = JSON.parse(fs.readFileSync(pkgPath, 'utf8'));

assert.equal(pkg.name, '@types/node');
assert.equal(pkg.version, '25.9.9');
assert.equal(pkg.types, 'index.d.ts');
assert.equal(pkg.main, '');
assert.equal(pkg.typeScriptVersion, '5.6');
assert.deepEqual(pkg.typesVersions['<=5.6']['*'], ['ts5.6/*']);
assert.deepEqual(pkg.typesVersions['<=5.7']['*'], ['ts5.7/*']);
assert.equal(pkg.dependencies['undici-types'], '>=7.24.0 <7.24.7');

const undiciPkgPath = require.resolve('undici-types/package.json');
const undiciPkg = JSON.parse(fs.readFileSync(undiciPkgPath, 'utf8'));
assert.equal(undiciPkg.name, 'undici-types');
assert.equal(undiciPkg.types, 'index.d.ts');
assert.ok(fs.existsSync(path.join(path.dirname(undiciPkgPath), undiciPkg.types)));

const typesDir = path.dirname(pkgPath);

// 2. Verify all triple-slash reference paths resolve to non-empty declaration files
function verifyReferenceTargets(entryRelPath) {
  const entryFullPath = path.join(typesDir, entryRelPath);
  const entryDir = path.dirname(entryFullPath);
  const content = fs.readFileSync(entryFullPath, 'utf8');
  const refs = [...content.matchAll(/\/\/\/\s*<reference\s+path="([^"]+)"\s*\/>/g)].map((m) => m[1]);
  assert.ok(refs.length > 50, `${entryRelPath} should reference >50 declaration files`);
  for (const ref of refs) {
    const target = path.resolve(entryDir, ref);
    assert.ok(fs.existsSync(target), `Missing referenced declaration ${ref} from ${entryRelPath}`);
    assert.ok(fs.statSync(target).size > 0, `Empty referenced declaration ${ref} from ${entryRelPath}`);
  }
  return content;
}

const rootIndex = verifyReferenceTargets('index.d.ts');
const ts57Index = verifyReferenceTargets('ts5.7/index.d.ts');
const ts56Index = verifyReferenceTargets('ts5.6/index.d.ts');

// 3. Verify TypeScript 5.8+, 5.7, and <=5.6 compatibility declaration split
assert.ok(rootIndex.includes('/// <reference lib="esnext.float16" />'));
assert.ok(rootIndex.includes('/// <reference path="buffer.buffer.d.ts" />'));
assert.ok(ts57Index.includes('/// <reference path="./compatibility/float16array.d.ts" />'));
assert.ok(ts57Index.includes('/// <reference path="../buffer.buffer.d.ts" />'));
assert.ok(ts56Index.includes('/// <reference path="./compatibility/float16array.d.ts" />'));
assert.ok(ts56Index.includes('/// <reference path="./buffer.buffer.d.ts" />'));

const genericBufferDts = fs.readFileSync(path.join(typesDir, 'buffer.buffer.d.ts'), 'utf8');
assert.ok(genericBufferDts.includes('new(size: number): Buffer<ArrayBuffer>;'));

const ts56BufferDts = fs.readFileSync(path.join(typesDir, 'ts5.6/buffer.buffer.d.ts'), 'utf8');
assert.ok(ts56BufferDts.includes('new(size: number): Buffer;'));

// 4. Verify node:zlib/iter and node:stream/iter declarations
const zlibIterDts = fs.readFileSync(path.join(typesDir, 'zlib/iter.d.ts'), 'utf8');
assert.ok(zlibIterDts.includes('declare module "node:zlib/iter"'));
assert.ok(zlibIterDts.includes('declare module "zlib/iter"'));
assert.ok(zlibIterDts.includes('import { StatefulTransform, SyncStatefulTransform } from "node:stream/iter";'));
for (const fn of [
  'compressBrotli',
  'compressBrotliSync',
  'compressDeflate',
  'compressDeflateSync',
  'compressGzip',
  'compressGzipSync',
  'compressZstd',
  'compressZstdSync',
  'decompressBrotli',
  'decompressBrotliSync',
  'decompressDeflate',
  'decompressDeflateSync',
  'decompressGzip',
  'decompressGzipSync',
  'decompressZstd',
  'decompressZstdSync',
]) {
  assert.ok(zlibIterDts.includes(`function ${fn}(`), `zlib/iter.d.ts missing ${fn}`);
}

const streamIterDts = fs.readFileSync(path.join(typesDir, 'stream/iter.d.ts'), 'utf8');
assert.ok(streamIterDts.includes('declare module "node:stream/iter"'));
assert.ok(streamIterDts.includes('type BackpressurePolicy = "strict" | "block" | "drop-oldest" | "drop-newest";'));
assert.ok(streamIterDts.includes('interface PushStreamOptions'));
assert.ok(streamIterDts.includes('type ByteReadableStream = AsyncIterable<Uint8Array[]>;'));

// 5. Verify node:quic, node:sqlite, and web-globals/storage declarations
const quicDts = fs.readFileSync(path.join(typesDir, 'quic.d.ts'), 'utf8');
assert.ok(quicDts.includes('declare module "node:quic"'));
assert.ok(quicDts.includes('interface TransportParams'));
assert.ok(quicDts.includes('type OnSessionCallback'));
assert.ok(quicDts.includes('type OnStreamCallback'));

const sqliteDts = fs.readFileSync(path.join(typesDir, 'sqlite.d.ts'), 'utf8');
assert.ok(sqliteDts.includes('declare module "node:sqlite"'));
assert.ok(sqliteDts.includes('interface DatabaseSyncOptions'));
assert.ok(sqliteDts.includes('type SQLInputValue'));
assert.ok(sqliteDts.includes('type SQLOutputValue'));

const storageDts = fs.readFileSync(path.join(typesDir, 'web-globals/storage.d.ts'), 'utf8');
assert.ok(storageDts.includes('interface Storage'));
assert.ok(storageDts.includes('var localStorage: Storage;'));
assert.ok(storageDts.includes('var sessionStorage: Storage;'));

console.log('Verified @types/node@25.9.9 contract.');

Исходный сидер

аноним