CodeSampleX

샘플

espree 10.4.0

검증된 샘플 — npm espree 10.4.0. node 22 · linux alpine/x64 · docker에서 contract를 실행해 통과했습니다: validates espree package version is 10.4.0, supported ECMAScript…

sha256:00c39e4aac9d04e880b28b6bb0656aacae0173816d9b991c4a76d822b2097b54

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

실행 증거

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

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

케이스

HOW
목표
verify pkg:npm/espree@10.4.0
패키지
환경
node 22.23.2
생성일
2026-08-26T08:31:55Z

컨트랙트

  1. validates espree package version is 10.4.0, supported ECMAScript versions include 17, and Syntax/VisitorKeys metadata
  2. parses modern ECMAScript module AST with tokens, comments, location, and range
  3. parses JSX syntax when enabled in ecmaFeatures
  4. tokenizes JavaScript code with location and range metadata
  5. throws SyntaxError with line and column numbers on invalid syntax
  6. throws SyntaxError when parsing JSX without jsx feature enabled

파일

  • PROMPT.md
  • csx.json
  • package-lock.json
  • package.json
  • spec.json
  • 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 pkg:npm/espree@10.4.0
Kind: HOW

Use EXACTLY these public packages and versions:
  - pkg:npm/espree@10.4.0
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:bac1890ed9d79c0bd831492cef6e717f20b49fcb8a6eff3bba86715d89cbb9b3","constraints":{"executionContext":"node"},"contract":["validates espree package version is 10.4.0, supported ECMAScript versions include 17, and Syntax/VisitorKeys metadata","parses modern ECMAScript module AST with tokens, comments, location, and range","parses JSX syntax when enabled in ecmaFeatures","tokenizes JavaScript code with location and range metadata","throws SyntaxError with line and column numbers on invalid syntax","throws SyntaxError when parsing JSX without jsx feature enabled"],"goal":"verify pkg:npm/espree@10.4.0","kind":"HOW","packages":["pkg:npm/espree@10.4.0"],"schemaVersion":1},"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/espree@10.4.0"],"schemaVersion":1,"subject":"pkg:npm/espree@10.4.0","verifierAdapter":"node-typescript@1"}
package-lock.json
{
  "name": "sample-espree",
  "version": "1.0.0",
  "lockfileVersion": 3,
  "requires": true,
  "packages": {
    "": {
      "name": "sample-espree",
      "version": "1.0.0",
      "dependencies": {
        "espree": "10.4.0"
      }
    },
    "node_modules/acorn": {
      "version": "8.18.0",
      "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.18.0.tgz",
      "integrity": "sha512-lGq+9yr1/GuAWaVYIHRjvvySG5/4VfKIvC8EWxStPdcDh/Ka7FG3twP6v4d5BkravUilhIAsG4Qj83t02LWUPQ==",
      "license": "MIT",
      "bin": {
        "acorn": "bin/acorn"
      },
      "engines": {
        "node": ">=0.4.0"
      }
    },
    "node_modules/acorn-jsx": {
      "version": "5.3.2",
      "resolved": "https://registry.npmjs.org/acorn-jsx/-/acorn-jsx-5.3.2.tgz",
      "integrity": "sha512-rq9s+JNhf0IChjtDXxllJ7g41oZk5SlXtp0LHwyA5cejwn7vKmKp4pPri6YEePv2PU65sAsegbXtIinmDFDXgQ==",
      "license": "MIT",
      "peerDependencies": {
        "acorn": "^6.0.0 || ^7.0.0 || ^8.0.0"
      }
    },
    "node_modules/eslint-visitor-keys": {
      "version": "4.2.1",
      "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-4.2.1.tgz",
      "integrity": "sha512-Uhdk5sfqcee/9H/rCOJikYz67o0a2Tw2hGRPOG2Y1R2dg7brRe1uG0yaNQDHu+TO/uQPF/5eCapvYSmHUjt7JQ==",
      "license": "Apache-2.0",
      "engines": {
        "node": "^18.18.0 || ^20.9.0 || >=21.1.0"
      },
      "funding": {
        "url": "https://opencollective.com/eslint"
      }
    },
    "node_modules/espree": {
      "version": "10.4.0",
      "resolved": "https://registry.npmjs.org/espree/-/espree-10.4.0.tgz",
      "integrity": "sha512-j6PAQ2uUr79PZhBjP5C5fhl8e39FmRnOjsD5lGnWrFU8i2G776tBK7+nP8KuQUTTyAZUwfQqXAgrVH5MbH9CYQ==",
      "license": "BSD-2-Clause",
      "dependencies": {
        "acorn": "^8.15.0",
        "acorn-jsx": "^5.3.2",
        "eslint-visitor-keys": "^4.2.1"
      },
      "engines": {
        "node": "^18.18.0 || ^20.9.0 || >=21.1.0"
      },
      "funding": {
        "url": "https://opencollective.com/eslint"
      }
    }
  }
}
package.json
{
  "name": "sample-espree",
  "version": "1.0.0",
  "description": "Clean-room verification sample for espree",
  "main": "test/contract.js",
  "scripts": {
    "test": "node test/contract.js"
  },
  "dependencies": {
    "espree": "10.4.0"
  }
}
spec.json
{
  "schemaVersion": 1,
  "goal": "verify pkg:npm/espree@10.4.0",
  "kind": "HOW",
  "packages": [
    "pkg:npm/espree@10.4.0"
  ],
  "constraints": {
    "executionContext": "node"
  },
  "runtimeConditions": {
    "ecosystem": "npm",
    "language": "javascript",
    "moduleSystem": "cjs",
    "packageManager": "npm@10.9.8",
    "runtime": "node@22.23.2"
  }
}
test/contract.js
const assert = require("assert");
const espree = require("espree");

// 1. Version and metadata assertions
assert.strictEqual(typeof espree.version, "string");
assert.strictEqual(espree.version, "10.4.0");
assert(Array.isArray(espree.supportedEcmaVersions));
assert(espree.supportedEcmaVersions.includes(17));
assert.strictEqual(espree.Syntax.Program, "Program");
assert.strictEqual(espree.Syntax.JSXElement, "JSXElement");
assert.strictEqual(espree.Syntax.ClassDeclaration, "ClassDeclaration");
assert(Array.isArray(espree.VisitorKeys.Program));
assert(Array.isArray(espree.VisitorKeys.ClassDeclaration));

// 2. Parse modern ECMAScript with tokens, comments, location, and range
const modernCode = `
// calculate answer
export async function getResult(val) {
  const data = { x: val, y: 20 };
  const combined = { ...data, z: 30 };
  const fallback = combined?.extra ?? "default_value";
  return fallback;
}
`;

const ast = espree.parse(modernCode, {
  ecmaVersion: "latest",
  sourceType: "module",
  loc: true,
  range: true,
  tokens: true,
  comment: true
});

assert.strictEqual(ast.type, "Program");
assert.strictEqual(ast.sourceType, "module");
assert(Array.isArray(ast.body));
assert.strictEqual(ast.body.length, 1);
assert.strictEqual(ast.body[0].type, "ExportNamedDeclaration");
assert.strictEqual(ast.body[0].declaration.type, "FunctionDeclaration");
assert.strictEqual(ast.body[0].declaration.id.name, "getResult");
assert.strictEqual(ast.body[0].declaration.async, true);
assert(Array.isArray(ast.tokens));
assert(ast.tokens.length > 0);
assert(Array.isArray(ast.comments));
assert.strictEqual(ast.comments.length, 1);
assert.strictEqual(ast.comments[0].value.trim(), "calculate answer");

// 3. Parse JSX syntax when enabled in ecmaFeatures
const jsxCode = `<div className="container"><Header title="test" /><span>hello</span></div>`;
const jsxAst = espree.parse(jsxCode, {
  ecmaVersion: "latest",
  sourceType: "module",
  ecmaFeatures: {
    jsx: true
  }
});

assert.strictEqual(jsxAst.type, "Program");
assert.strictEqual(jsxAst.body.length, 1);
assert.strictEqual(jsxAst.body[0].type, "ExpressionStatement");
assert.strictEqual(jsxAst.body[0].expression.type, "JSXElement");
assert.strictEqual(jsxAst.body[0].expression.openingElement.name.name, "div");
assert.strictEqual(jsxAst.body[0].expression.children.length, 2);

// 4. Tokenize JavaScript code with token locations
const tokens = espree.tokenize("const total = 100;", {
  ecmaVersion: "latest",
  loc: true,
  range: true
});

assert(Array.isArray(tokens));
assert.strictEqual(tokens.length, 5);
assert.strictEqual(tokens[0].type, "Keyword");
assert.strictEqual(tokens[0].value, "const");
assert.strictEqual(tokens[1].type, "Identifier");
assert.strictEqual(tokens[1].value, "total");
assert.strictEqual(tokens[2].type, "Punctuator");
assert.strictEqual(tokens[2].value, "=");
assert.strictEqual(tokens[3].type, "Numeric");
assert.strictEqual(tokens[3].value, "100");
assert.strictEqual(tokens[4].type, "Punctuator");
assert.strictEqual(tokens[4].value, ";");
assert.strictEqual(tokens[0].loc.start.line, 1);
assert.strictEqual(tokens[0].loc.start.column, 0);

// 5. Throws SyntaxError on invalid JavaScript syntax
assert.throws(() => {
  espree.parse("const 123invalid = ;", { ecmaVersion: "latest" });
}, (err) => {
  return err.name === "SyntaxError" && typeof err.lineNumber === "number" && typeof err.column === "number";
});

// 6. Throws SyntaxError when parsing JSX without jsx feature enabled
assert.throws(() => {
  espree.parse("const el = <div />;", { ecmaVersion: "latest" });
}, (err) => {
  return err.name === "SyntaxError";
});

console.log("espree contract passed");

오리진 시더

익명