CodeSampleX

Beispiel

@types/babel__traverse 7.28.0: traverse

Verifiziertes Beispiel für npm @types/babel__traverse 7.28.0: traverse. Der Vertrag lief auf node 22 · linux alpine/x64 · docker und bestand.

sha256:d71e2823940b59e4762b904a33e396f94e2d4d75e2f7dac2003b270f40b1650b

Dieses Netzwerk bietet eine Sache: ein Sample, das baut. Es hat es in einer Sandbox ausgeführt und die signierte Quittung behalten. Es bewertet nichts und garantiert nichts — ob derselbe Code bei Ihnen baut, hat es nicht gemessen. Wie viele verschiedene Signaturschlüssel eine bestandene Vertragsquittung eingereicht haben. Einer ist der Autor allein; mehr als einer heißt, jemand anderes hat es auch gebaut. Ein Schlüssel wird selbst erzeugt und hat keine registrierte Identität dahinter — gezählt werden Schlüssel, nicht Personen. MIT-0

Ausführungsbelege

Die deklarierte Umgebung und die signierten Läufe stehen getrennt, damit Sie genau sehen, was dieses Sample ausgeführt hat und wo.

Beleggrundlage
Signierter Vertrag bestanden
Verifizierungsbelege
1
Signaturschlüssel, die es gebaut haben
1
Deklarierte Umgebung node 22.23 linux 24 · ubuntu · glibc 2.39 x64 node 22.23 javascript npm 10

Umgebungen der Verifizierungsläufe

Umgebung Contract Stufen Lauf
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

Fall

HOW
Ziel
verify traverse in pkg:npm/%40types/babel__traverse@7.28.0
Pakete
Symbole
  • traverse
Umgebung
node 22.23.2
Erstellt
2026-08-23T17:40:05Z

Contract

  1. package manifest specifies index.d.ts type declarations and TypeScript version 5.1
  2. declares traverse function overloads accepting parent Node, TraverseOptions, Scope, and state
  3. declares traverse static properties and methods including visitors, verify, explode, and cheap
  4. declares visitors namespace with explode, verify, and merge utilities
  5. declares cache namespace with path and scope WeakMaps and cache clearing functions
  6. declares TraverseOptions type alias combining Scope options and Visitor mapping
  7. declares Scope and NodePath class declarations

Dateien

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

Quellartefakt herunterladen (tar.gz)

Quelltext

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 traverse in pkg:npm/%40types/babel__traverse@7.28.0
Kind: HOW

Use EXACTLY these public packages and versions:
  - pkg:npm/%40types/babel__traverse@7.28.0
Demonstrate these symbols/APIs:
  - traverse
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:46efcf46dcd86d5846828e64d97c443bb737a43fff38e90d6a8f15e81e50836e","constraints":{"executionContext":"node"},"contract":["package manifest specifies index.d.ts type declarations and TypeScript version 5.1","declares traverse function overloads accepting parent Node, TraverseOptions, Scope, and state","declares traverse static properties and methods including visitors, verify, explode, and cheap","declares visitors namespace with explode, verify, and merge utilities","declares cache namespace with path and scope WeakMaps and cache clearing functions","declares TraverseOptions type alias combining Scope options and Visitor mapping","declares Scope and NodePath class declarations"],"goal":"verify traverse in pkg:npm/%40types/babel__traverse@7.28.0","kind":"HOW","packages":["pkg:npm/%40types/babel__traverse@7.28.0"],"schemaVersion":1,"symbols":["traverse"]},"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/%40types/babel__traverse@7.28.0"],"schemaVersion":1,"subject":"pkg:npm/%40types/babel__traverse@7.28.0","symbols":["traverse"],"verifierAdapter":"node-typescript@1"}
package-lock.json
{
  "name": "test-babel-traverse",
  "version": "1.0.0",
  "lockfileVersion": 3,
  "requires": true,
  "packages": {
    "": {
      "name": "test-babel-traverse",
      "version": "1.0.0",
      "license": "ISC",
      "dependencies": {
        "@types/babel__traverse": "^7.28.0"
      }
    },
    "node_modules/@babel/helper-string-parser": {
      "version": "7.29.7",
      "resolved": "https://registry.npmjs.org/@babel/helper-string-parser/-/helper-string-parser-7.29.7.tgz",
      "integrity": "sha512-Pb5ijPrZ89GDH8223L4UP8i6QApWxs04RbPQJTeWDV0/keR2E36MeKnyr6LYmUUvqRRI+Iv87SuF1W6ErINzYw==",
      "license": "MIT",
      "engines": {
        "node": ">=6.9.0"
      }
    },
    "node_modules/@babel/helper-validator-identifier": {
      "version": "7.29.7",
      "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.29.7.tgz",
      "integrity": "sha512-qehxGkRj55h/ff8EMaJ+cYhyaKlHIxqYDn682wQD7RNp9UujOQsHog2uS0r2vzr4pW+sXf90NeeayjcNaX3fFg==",
      "license": "MIT",
      "engines": {
        "node": ">=6.9.0"
      }
    },
    "node_modules/@babel/types": {
      "version": "7.29.8",
      "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.29.8.tgz",
      "integrity": "sha512-Vj1jF3cPfxg7OAfoI7QnVKLoILlm2JF9pnVHrX8qx7AHMiYWT+NDAA7jChlNgRS4WTLc/fD1lXLmPixluj+3Gg==",
      "license": "MIT",
      "dependencies": {
        "@babel/helper-string-parser": "^7.29.7",
        "@babel/helper-validator-identifier": "^7.29.7"
      },
      "engines": {
        "node": ">=6.9.0"
      }
    },
    "node_modules/@types/babel__traverse": {
      "version": "7.28.0",
      "resolved": "https://registry.npmjs.org/@types/babel__traverse/-/babel__traverse-7.28.0.tgz",
      "integrity": "sha512-8PvcXf70gTDZBgt9ptxJ8elBeBjcLOAcOtoO/mPJjtji1+CdGbHgm77om1GrsPxsiE+uXIpNSK64UYaIwQXd4Q==",
      "license": "MIT",
      "dependencies": {
        "@babel/types": "^7.28.2"
      }
    }
  }
}
package.json
{
  "name": "test-babel-traverse",
  "version": "1.0.0",
  "license": "ISC",
  "type": "module",
  "dependencies": {
    "@types/babel__traverse": "^7.28.0"
  }
}
spec.json
{
  "schemaVersion": 1,
  "goal": "verify traverse in pkg:npm/%40types/babel__traverse@7.28.0",
  "kind": "HOW",
  "packages": [
    "pkg:npm/%40types/babel__traverse@7.28.0"
  ],
  "symbols": [
    "traverse"
  ],
  "constraints": {
    "executionContext": "node"
  },
  "runtimeConditions": {
    "ecosystem": "npm",
    "language": "javascript",
    "moduleSystem": "cjs",
    "packageManager": "npm@10.9.8",
    "runtime": "node@22.23.2"
  }
}
test/contract.mjs
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 @types/babel__traverse package manifest and verify type declaration entry points
const pkgPath = require.resolve('@types/babel__traverse/package.json');
const pkg = JSON.parse(fs.readFileSync(pkgPath, 'utf8'));

assert.equal(pkg.name, '@types/babel__traverse', 'Package name must be @types/babel__traverse');
assert.equal(pkg.version, '7.28.0', 'Package version must be 7.28.0');
assert.equal(pkg.types, 'index.d.ts', 'Package types entry must point to index.d.ts');
assert.equal(pkg.typeScriptVersion, '5.1', 'TypeScript version must be 5.1');
assert.ok(pkg.dependencies && pkg.dependencies['@babel/types'], 'Must declare dependency on @babel/types');

const typesDir = path.dirname(pkgPath);
const dtsContent = fs.readFileSync(path.join(typesDir, 'index.d.ts'), 'utf8');

// 2. Verify traverse main function declaration and default export
assert.ok(
  dtsContent.includes('declare const traverse: {'),
  'traverse constant declaration must be present'
);
assert.ok(
  dtsContent.includes('<S>(parent: Node, opts: TraverseOptions<S>, scope: Scope | undefined, state: S, parentPath?: NodePath): void;') &&
  dtsContent.includes('(parent: Node, opts?: TraverseOptions, scope?: Scope, state?: any, parentPath?: NodePath): void;'),
  'traverse function overloads must accept Node, TraverseOptions, Scope, state, and NodePath'
);
assert.ok(
  dtsContent.includes('export default traverse;'),
  'Default export traverse must be present'
);

// 3. Verify traverse static properties and methods
assert.ok(
  dtsContent.includes('visitors: typeof visitors;') &&
  dtsContent.includes('verify: typeof visitors.verify;') &&
  dtsContent.includes('explode: typeof visitors.explode;') &&
  dtsContent.includes('cheap: (node: Node, enter: (node: Node) => void) => void;') &&
  dtsContent.includes('clearNode: (node: Node, opts?: RemovePropertiesOptions) => void;') &&
  dtsContent.includes('removeProperties: (tree: Node, opts?: RemovePropertiesOptions) => Node;') &&
  dtsContent.includes('hasType: (tree: Node, type: Node["type"], denylistTypes?: string[]) => boolean;') &&
  dtsContent.includes('cache: typeof cache;'),
  'traverse must declare visitors, verify, explode, cheap, clearNode, removeProperties, hasType, and cache properties'
);

// 4. Verify visitors namespace utilities
assert.ok(
  dtsContent.includes('export namespace visitors {') &&
  dtsContent.includes('function explode<S = unknown>(') &&
  dtsContent.includes('function verify(visitor: Visitor): void;') &&
  dtsContent.includes('function merge<State>(visitors: Array<Visitor<State>>): Visitor<State>;'),
  'visitors namespace must declare explode, verify, and merge functions'
);

// 5. Verify cache namespace and TraverseOptions type definition
assert.ok(
  dtsContent.includes('export namespace cache {') &&
  dtsContent.includes('let path: WeakMap<t.Node, Map<t.Node, NodePath>>;') &&
  dtsContent.includes('let scope: WeakMap<t.Node, Scope>;') &&
  dtsContent.includes('function clear(): void;') &&
  dtsContent.includes('function clearPath(): void;') &&
  dtsContent.includes('function clearScope(): void;'),
  'cache namespace must declare path, scope WeakMaps and cache clearing functions'
);
assert.ok(
  dtsContent.includes('export type TraverseOptions<S = Node> = {') &&
  dtsContent.includes('scope?: Scope;') &&
  dtsContent.includes('noScope?: boolean;') &&
  dtsContent.includes('denylist?: NodeType[];') &&
  dtsContent.includes('shouldSkip?: (node: NodePath) => boolean;'),
  'TraverseOptions type alias must declare scope, noScope, denylist, and shouldSkip properties'
);

// 6. Verify Scope and NodePath class declarations
assert.ok(
  dtsContent.includes('export class Scope {') &&
  dtsContent.includes('constructor(path: NodePath, parentScope?: Scope);') &&
  dtsContent.includes('traverse<S>(node: Node | Node[], opts: TraverseOptions<S>, state: S): void;') &&
  dtsContent.includes('generateUidIdentifier(name?: string): t.Identifier;'),
  'Scope class declaration must declare constructor, traverse, and identifier generator methods'
);
assert.ok(
  dtsContent.includes('export class NodePath<T = Node>') &&
  dtsContent.includes('export class Binding {'),
  'NodePath and Binding classes must be exported'
);

console.log('Contract tests passed successfully.');

Ursprungs-Seeder

anonym