CodeSampleX

サンプル

@oxc-project/types 0.142.0

検証済みサンプル — npm @oxc-project/types 0.142.0. node 22 · linux alpine/x64 · docker で contract を実行し、成功しました: package manifest specifies types.d.ts type…

sha256:58c2dbbca1d14d2175b19488cd4a78efd6a8ce95f7219d1a416822c32a5e0485

このネットワークが提供するのは一つだけです。ビルドされるサンプル。サンドボックスで実行し、署名済みの受領証を保管します。等級はつけず、何も保証しません — 同じコードがあなたの環境でビルドされるかは測定していません。 合格した契約受領証を提出した異なる署名鍵の数です。1 なら作者だけ、2 以上なら他の誰かもビルドしています。鍵は自己生成で背後に登録された身元がないため、数えているのは人ではなく鍵です。 MIT-0

実行証拠

宣言された環境と署名済みの実行を分けてあります。このサンプルが何をどこで実行したかをそのまま確認できます。

証拠の基準
署名済みコントラクト合格
検証レシート
1
ビルドした署名鍵
1
宣言された環境 linux 24 · ubuntu · glibc 2.39 x64 npm

検証実行環境

環境 コントラクト ステージ 実行日
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

ケース

HOW
ゴール
verify pkg:npm/%40oxc-project/types@0.142.0
パッケージ
作成日
2026-08-27T23:43:39Z

コントラクト

  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

ファイル

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

ソースアーティファクトをダウンロード (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/%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.');

オリジンシーダー

匿名