CodeSampleX

샘플

@types/js-yaml 4.0.9: name

검증된 샘플 — npm @types/js-yaml 4.0.9: name. node 22 · linux alpine/x64 · docker에서 contract를 실행해 통과했습니다: @types/js-yaml package.json defines package name…

sha256:ce90d5d546bcbba626926d68e868ad0fa80be8d7f73f88100decf563c7e3c116

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

실행 증거

선언된 환경과 서명된 실행을 분리해 두었습니다. 이 샘플이 무엇을 어디서 실행했는지 그대로 볼 수 있습니다.

증거 기준
서명된 컨트랙트 통과
검증 영수증
2
빌드한 서명 키
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-26
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-09-07

케이스

HOW
목표
verify @types/js-yaml.name in pkg:npm/%40types/js-yaml@4.0.9
패키지
심벌
  • @types/js-yaml.name
환경
node 22.23.2
생성일
2026-08-26T12:30:11Z

컨트랙트

  1. @types/js-yaml package.json defines package name @types/js-yaml and version 4.0.9
  2. @types/js-yaml package.json configures types and exports entries pointing to declaration files
  3. @types/js-yaml index.d.ts declares jsyaml global namespace
  4. @types/js-yaml index.d.ts declares YAMLException error class with name property
  5. @types/js-yaml index.d.ts declares Mark interface with name property
  6. @types/js-yaml index.d.ts declares Type class with representName property

파일

  • 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 @types/js-yaml.name in pkg:npm/%40types/js-yaml@4.0.9
Kind: HOW

Use EXACTLY these public packages and versions:
  - pkg:npm/%40types/js-yaml@4.0.9
Demonstrate these symbols/APIs:
  - @types/js-yaml.name

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:6977b677e416c1432bafdbbf8f15ac216f3d269fdcb9f31e8cee63ce3c608343","contract":["@types/js-yaml package.json defines package name @types/js-yaml and version 4.0.9","@types/js-yaml package.json configures types and exports entries pointing to declaration files","@types/js-yaml index.d.ts declares jsyaml global namespace","@types/js-yaml index.d.ts declares YAMLException error class with name property","@types/js-yaml index.d.ts declares Mark interface with name property","@types/js-yaml index.d.ts declares Type class with representName property"],"goal":"verify @types/js-yaml.name in pkg:npm/%40types/js-yaml@4.0.9","kind":"HOW","packages":["pkg:npm/%40types/js-yaml@4.0.9"],"schemaVersion":1,"symbols":["@types/js-yaml.name"]},"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/js-yaml@4.0.9"],"schemaVersion":1,"subject":"pkg:npm/%40types/js-yaml@4.0.9","symbols":["@types/js-yaml.name"],"verifierAdapter":"node-typescript@1"}
package-lock.json
{
  "name": "sample-types-js-yaml-name",
  "version": "1.0.0",
  "lockfileVersion": 3,
  "requires": true,
  "packages": {
    "": {
      "name": "sample-types-js-yaml-name",
      "version": "1.0.0",
      "license": "MIT-0",
      "dependencies": {
        "@types/js-yaml": "4.0.9"
      }
    },
    "node_modules/@types/js-yaml": {
      "version": "4.0.9",
      "resolved": "https://registry.npmjs.org/@types/js-yaml/-/js-yaml-4.0.9.tgz",
      "integrity": "sha512-k4MGaQl5TGo/iipqb2UDG2UwjXziSWkh0uysQelTlJpX1qGlpUZYm8PnO4DxG1qBomtJUdYJ6qR6xdIah10JLg==",
      "license": "MIT"
    }
  }
}
package.json
{
  "name": "sample-types-js-yaml-name",
  "version": "1.0.0",
  "private": true,
  "description": "Clean-room verification sample for @types/js-yaml name",
  "main": "src/index.js",
  "scripts": {
    "test": "node test/contract.js"
  },
  "dependencies": {
    "@types/js-yaml": "4.0.9"
  },
  "license": "MIT-0"
}
spec.json
{
  "schemaVersion": 1,
  "goal": "verify @types/js-yaml.name in pkg:npm/%40types/js-yaml@4.0.9",
  "kind": "HOW",
  "packages": [
    "pkg:npm/%40types/js-yaml@4.0.9"
  ],
  "symbols": [
    "@types/js-yaml.name"
  ]
}
src/index.js
const fs = require('node:fs');
const path = require('node:path');

/**
 * Resolves the path to the @types/js-yaml package.json and declaration file.
 * @returns {{ pkgJsonPath: string, declPath: string }} Paths to package.json and index.d.ts
 */
function resolvePackagePaths() {
  const pkgJsonPath = require.resolve('@types/js-yaml/package.json');
  const pkgDir = path.dirname(pkgJsonPath);
  const declPath = path.join(pkgDir, 'index.d.ts');
  return { pkgJsonPath, declPath };
}

/**
 * Reads and parses the @types/js-yaml package.json manifest.
 * @returns {object} Parsed package.json object
 */
function loadPackageManifest() {
  const { pkgJsonPath } = resolvePackagePaths();
  return JSON.parse(fs.readFileSync(pkgJsonPath, 'utf8'));
}

/**
 * Loads the declaration file content from @types/js-yaml.
 * @returns {string} The text content of index.d.ts
 */
function loadDeclarationContent() {
  const { declPath } = resolvePackagePaths();
  return fs.readFileSync(declPath, 'utf8');
}

/**
 * Inspects name-related declarations and package metadata in @types/js-yaml.
 * @returns {object} Detailed report of discovered symbols and manifest fields
 */
function inspectNameDefinitions() {
  const manifest = loadPackageManifest();
  const declContent = loadDeclarationContent();

  const packageName = manifest.name;
  const packageVersion = manifest.version;
  const hasTypesField = Boolean(manifest.types && manifest.types === 'index.d.ts');
  const hasExportsMapping = Boolean(
    manifest.exports &&
    manifest.exports['.'] &&
    manifest.exports['.'].types
  );

  const hasNamespaceDeclaration = declContent.includes('export as namespace jsyaml;');
  const hasYAMLExceptionName = declContent.includes('export class YAMLException extends Error') &&
    declContent.includes('name: string;');
  const hasMarkName = declContent.includes('export interface Mark') &&
    declContent.includes('name: string;');
  const hasTypeRepresentName = declContent.includes('export class Type') &&
    declContent.includes('representName: ((data: object) => any) | null;');

  return {
    packageName,
    packageVersion,
    hasTypesField,
    hasExportsMapping,
    hasNamespaceDeclaration,
    hasYAMLExceptionName,
    hasMarkName,
    hasTypeRepresentName
  };
}

module.exports = {
  resolvePackagePaths,
  loadPackageManifest,
  loadDeclarationContent,
  inspectNameDefinitions
};
test/contract.js
const assert = require('node:assert/strict');
const fs = require('node:fs');
const {
  resolvePackagePaths,
  loadPackageManifest,
  loadDeclarationContent,
  inspectNameDefinitions
} = require('../src/index.js');

// Contract 1: @types/js-yaml package.json defines package name @types/js-yaml and version 4.0.9
const manifest = loadPackageManifest();
assert.strictEqual(manifest.name, '@types/js-yaml', 'package name must be @types/js-yaml');
assert.strictEqual(manifest.version, '4.0.9', 'package version must be 4.0.9');

// Contract 2: @types/js-yaml package.json configures types and exports entries pointing to declaration files
assert.strictEqual(manifest.types, 'index.d.ts', 'types field must point to index.d.ts');
assert.ok(manifest.exports && manifest.exports['.'], 'exports dot entry must be defined');
assert.strictEqual(manifest.exports['.'].types.default, './index.d.ts', 'exports default types must point to ./index.d.ts');
assert.strictEqual(manifest.exports['.'].types.import, './index.d.mts', 'exports import types must point to ./index.d.mts');

// Contract 3: @types/js-yaml index.d.ts declares jsyaml global namespace
const { declPath } = resolvePackagePaths();
assert.strictEqual(fs.existsSync(declPath), true, 'index.d.ts declaration file must exist on disk');
const declContent = loadDeclarationContent();
assert.strictEqual(
  declContent.includes('export as namespace jsyaml;'),
  true,
  'index.d.ts must declare global jsyaml namespace'
);

// Contract 4: @types/js-yaml index.d.ts declares YAMLException error class with name property
assert.strictEqual(
  declContent.includes('export class YAMLException extends Error'),
  true,
  'index.d.ts must declare YAMLException class'
);
assert.strictEqual(
  declContent.includes('name: string;'),
  true,
  'index.d.ts must declare name property on error/mark constructs'
);

// Contract 5: @types/js-yaml index.d.ts declares Mark interface with name property
assert.strictEqual(
  declContent.includes('export interface Mark'),
  true,
  'index.d.ts must declare Mark interface'
);

// Contract 6: @types/js-yaml index.d.ts declares Type class with representName property
assert.strictEqual(
  declContent.includes('export class Type'),
  true,
  'index.d.ts must declare Type class'
);
assert.strictEqual(
  declContent.includes('representName: ((data: object) => any) | null;'),
  true,
  'Type class must declare representName property'
);

// High-level inspection verification
const inspection = inspectNameDefinitions();
assert.strictEqual(inspection.packageName, '@types/js-yaml');
assert.strictEqual(inspection.packageVersion, '4.0.9');
assert.strictEqual(inspection.hasTypesField, true);
assert.strictEqual(inspection.hasExportsMapping, true);
assert.strictEqual(inspection.hasNamespaceDeclaration, true);
assert.strictEqual(inspection.hasYAMLExceptionName, true);
assert.strictEqual(inspection.hasMarkName, true);
assert.strictEqual(inspection.hasTypeRepresentName, true);

console.log('Contract tests for @types/js-yaml.name in pkg:npm/%40types/js-yaml@4.0.9 passed successfully.');

오리진 시더

익명