CodeSampleX

Ejemplo

@oxc-project/types 0.142.0

Muestra verificada para npm @oxc-project/types 0.142.0. El contrato se ejecutó en node 22 · linux alpine/x64 · docker y pasó: package manifest specifies…

sha256:58c2dbbca1d14d2175b19488cd4a78efd6a8ce95f7219d1a416822c32a5e0485

Esta red ofrece una sola cosa: una muestra que compila. La ejecutó en un sandbox y guardó el recibo firmado. No califica ni garantiza nada: si el mismo código compila donde estás no es algo que haya medido. Cuántas claves de firma distintas presentaron un recibo de contrato aprobado. Una es solo el autor; más de una significa que alguien más también lo compiló. Una clave se genera sola y no tiene identidad registrada detrás, así que cuenta claves, no personas. MIT-0

Evidencia de ejecución

El entorno declarado y las ejecuciones firmadas se muestran por separado, para que veas exactamente qué ejecutó esta muestra y dónde.

Base de evidencia
Contrato firmado aprobado
Recibos de verificación
1
Claves de firma que lo compilaron
1
Entorno declarado linux 24 · ubuntu · glibc 2.39 x64 npm

Entornos de las ejecuciones de verificación

Entorno Contrato Etapas Ejecución
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-27

Caso

HOW
Objetivo
verify pkg:npm/%40oxc-project/types@0.142.0
Paquetes
Creado
2026-08-27T23:43:39Z

Contrato

  1. package manifest specifies types.d.ts type declarations entry and ES module type
  2. declares Span base interface, Node union type, and Program root AST interface
  3. declares AST Expression and Literal interfaces including IdentifierReference, NumericLiteral, StringLiteral, BinaryExpression, and CallExpression
  4. declares AST Statement and Declaration interfaces including VariableDeclaration, VariableDeclarator, Function, and Class
  5. declares Module AST interfaces including ImportDeclaration, ImportSpecifier, ExportNamedDeclaration, and ExportDefaultDeclaration
  6. declares TypeScript AST interfaces including TSTypeAnnotation, TSInterfaceDeclaration, TSTypeAliasDeclaration, and TSEnumDeclaration
  7. declares JSX AST interfaces including JSXElement, JSXOpeningElement, JSXAttribute, and JSXIdentifier

Archivos

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

Descargar el artefacto de código fuente (tar.gz)

Código fuente

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/%40oxc-project/types@0.142.0
Kind: HOW

Use EXACTLY these public packages and versions:
  - pkg:npm/%40oxc-project/types@0.142.0

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:881f10868638e138f66009c94f1457f61f2ef3c354f3d1949fd6f9cb4fdb9ca3","contract":["package manifest specifies types.d.ts type declarations entry and ES module type","declares Span base interface, Node union type, and Program root AST interface","declares AST Expression and Literal interfaces including IdentifierReference, NumericLiteral, StringLiteral, BinaryExpression, and CallExpression","declares AST Statement and Declaration interfaces including VariableDeclaration, VariableDeclarator, Function, and Class","declares Module AST interfaces including ImportDeclaration, ImportSpecifier, ExportNamedDeclaration, and ExportDefaultDeclaration","declares TypeScript AST interfaces including TSTypeAnnotation, TSInterfaceDeclaration, TSTypeAliasDeclaration, and TSEnumDeclaration","declares JSX AST interfaces including JSXElement, JSXOpeningElement, JSXAttribute, and JSXIdentifier"],"goal":"verify pkg:npm/%40oxc-project/types@0.142.0","kind":"HOW","packages":["pkg:npm/%40oxc-project/types@0.142.0"],"schemaVersion":1},"contractCommand":["node","test/contract.mjs"],"environment":{"arch":"x64","distro":"ubuntu","ecosystem":"npm","libc":"glibc","libcVersion":"2.39","os":"linux","osVersionBucket":"24","packageManager":"npm","schemaVersion":1},"license":"MIT-0","packages":["pkg:npm/%40oxc-project/types@0.142.0"],"schemaVersion":1,"subject":"pkg:npm/%40oxc-project/types@0.142.0","verifierAdapter":"node-typescript@1"}
package-lock.json
{
  "name": "sample-oxc-project-types",
  "version": "1.0.0",
  "lockfileVersion": 3,
  "requires": true,
  "packages": {
    "": {
      "name": "sample-oxc-project-types",
      "version": "1.0.0",
      "license": "MIT-0",
      "dependencies": {
        "@oxc-project/types": "0.142.0"
      }
    },
    "node_modules/@oxc-project/types": {
      "version": "0.142.0",
      "resolved": "https://registry.npmjs.org/@oxc-project/types/-/types-0.142.0.tgz",
      "integrity": "sha512-7W+2q5AKQVU36fkaryontrHn3YDt1RyUYXatw9i5H8ocYe2sPKSFB6eS8WNPeRKiN1qAWWZUPm7gwFzJGrccqQ==",
      "license": "MIT",
      "funding": {
        "url": "https://github.com/sponsors/Boshen"
      }
    }
  }
}
package.json
{
  "name": "sample-oxc-project-types",
  "version": "1.0.0",
  "private": true,
  "type": "module",
  "license": "MIT-0",
  "dependencies": {
    "@oxc-project/types": "0.142.0"
  }
}
spec.json
{
  "schemaVersion": 1,
  "goal": "verify pkg:npm/%40oxc-project/types@0.142.0",
  "kind": "HOW",
  "packages": [
    "pkg:npm/%40oxc-project/types@0.142.0"
  ]
}
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 @oxc-project/types package manifest and verify type declaration entry points
const pkgPath = require.resolve('@oxc-project/types/package.json');
const pkg = JSON.parse(fs.readFileSync(pkgPath, 'utf8'));

assert.equal(pkg.name, '@oxc-project/types', 'Package name must be @oxc-project/types');
assert.equal(pkg.version, '0.142.0', 'Package version must be 0.142.0');
assert.equal(pkg.types, 'types.d.ts', 'Package types entry must point to types.d.ts');
assert.equal(pkg.type, 'module', 'Package type must be module');

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

// 2. Verify Span base interface, Node union type, and Program root AST interface
assert.ok(
  dtsContent.includes('export interface Span {') &&
  dtsContent.includes('start: number;') &&
  dtsContent.includes('end: number;'),
  'Span interface with start and end offsets must be declared'
);
assert.ok(
  dtsContent.includes('export type Node =') &&
  dtsContent.includes('| Program') &&
  dtsContent.includes('| IdentifierReference') &&
  dtsContent.includes('| BinaryExpression'),
  'Node union type encompassing AST node variants must be declared'
);
assert.ok(
  dtsContent.includes('export interface Program extends Span {') &&
  dtsContent.includes('type: "Program";') &&
  dtsContent.includes('body: Array<Directive | Statement>;') &&
  dtsContent.includes('sourceType: ModuleKind;'),
  'Program root AST interface must be declared'
);

// 3. Verify AST Expression and Literal interfaces including IdentifierReference, NumericLiteral, StringLiteral, BinaryExpression, and CallExpression
assert.ok(
  dtsContent.includes('export interface IdentifierReference extends Span {') &&
  dtsContent.includes('type: "Identifier";') &&
  dtsContent.includes('name: string;'),
  'IdentifierReference interface must be declared'
);
assert.ok(
  dtsContent.includes('export interface NumericLiteral extends Span {') &&
  dtsContent.includes('type: "Literal";') &&
  dtsContent.includes('value: number;'),
  'NumericLiteral interface must be declared'
);
assert.ok(
  dtsContent.includes('export interface StringLiteral extends Span {') &&
  dtsContent.includes('type: "Literal";') &&
  dtsContent.includes('value: string;'),
  'StringLiteral interface must be declared'
);
assert.ok(
  dtsContent.includes('export interface BinaryExpression extends Span {') &&
  dtsContent.includes('type: "BinaryExpression";') &&
  dtsContent.includes('left: Expression;') &&
  dtsContent.includes('operator: BinaryOperator;') &&
  dtsContent.includes('right: Expression;'),
  'BinaryExpression interface must be declared'
);
assert.ok(
  dtsContent.includes('export interface CallExpression extends Span {') &&
  dtsContent.includes('type: "CallExpression";') &&
  dtsContent.includes('callee: Expression;') &&
  dtsContent.includes('arguments: Array<Argument>;'),
  'CallExpression interface must be declared'
);

// 4. Verify AST Statement and Declaration interfaces including VariableDeclaration, VariableDeclarator, Function, and Class
assert.ok(
  dtsContent.includes('export interface VariableDeclaration extends Span {') &&
  dtsContent.includes('type: "VariableDeclaration";') &&
  dtsContent.includes('kind: VariableDeclarationKind;') &&
  dtsContent.includes('declarations: Array<VariableDeclarator>;'),
  'VariableDeclaration interface must be declared'
);
assert.ok(
  dtsContent.includes('export interface VariableDeclarator extends Span {') &&
  dtsContent.includes('type: "VariableDeclarator";') &&
  dtsContent.includes('id: BindingPattern;'),
  'VariableDeclarator interface must be declared'
);
assert.ok(
  dtsContent.includes('export interface Function extends Span {') &&
  dtsContent.includes('type: FunctionType;') &&
  dtsContent.includes('id: BindingIdentifier | null;') &&
  dtsContent.includes('generator: boolean;') &&
  dtsContent.includes('async: boolean;') &&
  dtsContent.includes('params: ParamPattern[];'),
  'Function interface must be declared'
);
assert.ok(
  dtsContent.includes('export interface Class extends Span {') &&
  dtsContent.includes('type: ClassType;') &&
  dtsContent.includes('superClass: Expression | null;') &&
  dtsContent.includes('body: ClassBody;'),
  'Class interface must be declared'
);

// 5. Verify Module AST interfaces including ImportDeclaration, ImportSpecifier, ExportNamedDeclaration, and ExportDefaultDeclaration
assert.ok(
  dtsContent.includes('export interface ImportDeclaration extends Span {') &&
  dtsContent.includes('type: "ImportDeclaration";') &&
  dtsContent.includes('specifiers: Array<ImportDeclarationSpecifier>;') &&
  dtsContent.includes('source: StringLiteral;'),
  'ImportDeclaration interface must be declared'
);
assert.ok(
  dtsContent.includes('export interface ImportSpecifier extends Span {') &&
  dtsContent.includes('type: "ImportSpecifier";') &&
  dtsContent.includes('imported: ModuleExportName;') &&
  dtsContent.includes('local: BindingIdentifier;'),
  'ImportSpecifier interface must be declared'
);
assert.ok(
  dtsContent.includes('export interface ExportNamedDeclaration extends Span {') &&
  dtsContent.includes('type: "ExportNamedDeclaration";') &&
  dtsContent.includes('declaration: Declaration | null;'),
  'ExportNamedDeclaration interface must be declared'
);
assert.ok(
  dtsContent.includes('export interface ExportDefaultDeclaration extends Span {') &&
  dtsContent.includes('type: "ExportDefaultDeclaration";') &&
  dtsContent.includes('declaration: ExportDefaultDeclarationKind;'),
  'ExportDefaultDeclaration interface must be declared'
);

// 6. Verify TypeScript AST interfaces including TSTypeAnnotation, TSInterfaceDeclaration, TSTypeAliasDeclaration, and TSEnumDeclaration
assert.ok(
  dtsContent.includes('export interface TSTypeAnnotation extends Span {') &&
  dtsContent.includes('type: "TSTypeAnnotation";') &&
  dtsContent.includes('typeAnnotation: TSType;'),
  'TSTypeAnnotation interface must be declared'
);
assert.ok(
  dtsContent.includes('export interface TSInterfaceDeclaration extends Span {') &&
  dtsContent.includes('type: "TSInterfaceDeclaration";') &&
  dtsContent.includes('id: BindingIdentifier;') &&
  dtsContent.includes('body: TSInterfaceBody;'),
  'TSInterfaceDeclaration interface must be declared'
);
assert.ok(
  dtsContent.includes('export interface TSTypeAliasDeclaration extends Span {') &&
  dtsContent.includes('type: "TSTypeAliasDeclaration";') &&
  dtsContent.includes('id: BindingIdentifier;') &&
  dtsContent.includes('typeAnnotation: TSType;'),
  'TSTypeAliasDeclaration interface must be declared'
);
assert.ok(
  dtsContent.includes('export interface TSEnumDeclaration extends Span {') &&
  dtsContent.includes('type: "TSEnumDeclaration";') &&
  dtsContent.includes('id: BindingIdentifier;') &&
  dtsContent.includes('body: TSEnumBody;'),
  'TSEnumDeclaration interface must be declared'
);

// 7. Verify JSX AST interfaces including JSXElement, JSXOpeningElement, JSXAttribute, and JSXIdentifier
assert.ok(
  dtsContent.includes('export interface JSXElement extends Span {') &&
  dtsContent.includes('type: "JSXElement";') &&
  dtsContent.includes('openingElement: JSXOpeningElement;') &&
  dtsContent.includes('children: Array<JSXChild>;') &&
  dtsContent.includes('closingElement: JSXClosingElement | null;'),
  'JSXElement interface must be declared'
);
assert.ok(
  dtsContent.includes('export interface JSXOpeningElement extends Span {') &&
  dtsContent.includes('type: "JSXOpeningElement";') &&
  dtsContent.includes('name: JSXElementName;') &&
  dtsContent.includes('attributes: Array<JSXAttributeItem>;'),
  'JSXOpeningElement interface must be declared'
);
assert.ok(
  dtsContent.includes('export interface JSXAttribute extends Span {') &&
  dtsContent.includes('type: "JSXAttribute";') &&
  dtsContent.includes('name: JSXAttributeName;'),
  'JSXAttribute interface must be declared'
);
assert.ok(
  dtsContent.includes('export interface JSXIdentifier extends Span {') &&
  dtsContent.includes('type: "JSXIdentifier";') &&
  dtsContent.includes('name: string;'),
  'JSXIdentifier interface must be declared'
);

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

Seeder de origen

anónimo