サンプル
acorn-jsx 5.3.2
検証済みサンプル — npm acorn-jsx 5.3.2. node 22 · linux alpine/x64 · docker で contract を実行し、成功しました: acorn.Parser.extend(jsx()) parses JSX elements into JSXElement…
sha256:e5313d07dbb7bb42c2d815dd9ca0ec07b913f8c96a6a752b2bf1628d0a395e78
このネットワークが提供するのは一つだけです。ビルドされるサンプル。サンドボックスで実行し、署名済みの受領証を保管します。等級はつけず、何も保証しません — 同じコードがあなたの環境でビルドされるかは測定していません。
合格した契約受領証を提出した異なる署名鍵の数です。1 なら作者だけ、2 以上なら他の誰かもビルドしています。鍵は自己生成で背後に登録された身元がないため、数えているのは人ではなく鍵です。
MIT-0
実行証拠
宣言された環境と署名済みの実行を分けてあります。このサンプルが何をどこで実行したかをそのまま確認できます。
- 証拠の基準
- 署名済みコントラクト合格
- 検証レシート
- 2
- ビルドした署名鍵
- 1
宣言された環境
node 22.23 linux 24 · ubuntu · glibc 2.39 x64 node 22.23 javascript npm
検証実行環境
| 環境 | コントラクト | ステージ | 実行日 |
|---|---|---|---|
| node 22 · linux alpine/x64 · docker ed25519:c1973797be207ac4 | PASS | compile:SKIPPED · contract:PASS · load:PASS · resolve:PASS CONTAINER_RUN · node-typescript@1 |
2026-08-20 |
| 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 pkg:npm/acorn-jsx@5.3.2
- パッケージ
- 環境
- node 22.23.2
- 作成日
- 2026-08-20T22:56:04Z
コントラクト
- acorn.Parser.extend(jsx()) parses JSX elements into JSXElement, JSXOpeningElement, and JSXClosingElement AST nodes
- acorn.Parser.extend(jsx()) parses self-closing JSX elements with attributes
- acorn.Parser.extend(jsx()) parses JSX fragments (<>...</>)
- acorn.Parser.extend(jsx()) parses JSX member expressions (<UI.Button />)
- acorn.Parser.extend(jsx()) parses JSX expression containers in attributes and child nodes
- jsx({ allowNamespaces: true }) parses XML namespaced tags like <svg:path /> into JSXNamespacedName
- jsx({ allowNamespaces: false }) rejects XML namespaced tags with a SyntaxError
ファイル
- PROMPT.md
- csx.json
- index.js
- package-lock.json
- package.json
- spec.json
- test/contract.js
ソース
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/acorn-jsx@5.3.2
Kind: HOW
Use EXACTLY these public packages and versions:
- pkg:npm/acorn-jsx@5.3.2
Constraints:
- executionContext: node
Required runtime conditions:
- ecosystem: npm
- language: javascript
- moduleSystem: cjs
- 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.
{"case":{"caseId":"case:sha256:cd26cf6f8ec467a8a10e307d7340eae41dd25248d351b81787c4950013a4f462","constraints":{"executionContext":"node"},"contract":["acorn.Parser.extend(jsx()) parses JSX elements into JSXElement, JSXOpeningElement, and JSXClosingElement AST nodes","acorn.Parser.extend(jsx()) parses self-closing JSX elements with attributes","acorn.Parser.extend(jsx()) parses JSX fragments (\u003c\u003e...\u003c/\u003e)","acorn.Parser.extend(jsx()) parses JSX member expressions (\u003cUI.Button /\u003e)","acorn.Parser.extend(jsx()) parses JSX expression containers in attributes and child nodes","jsx({ allowNamespaces: true }) parses XML namespaced tags like \u003csvg:path /\u003e into JSXNamespacedName","jsx({ allowNamespaces: false }) rejects XML namespaced tags with a SyntaxError"],"goal":"verify pkg:npm/acorn-jsx@5.3.2","kind":"HOW","packages":["pkg:npm/acorn-jsx@5.3.2"],"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","runtime":"node","runtimeVersion":"22.23.2","schemaVersion":1},"license":"MIT-0","packages":["pkg:npm/acorn-jsx@5.3.2"],"schemaVersion":1,"subject":"pkg:npm/acorn-jsx@5.3.2","verifierAdapter":"node-typescript@1"}
const acorn = require('acorn');
const jsx = require('acorn-jsx');
function createJSXParser(options) {
return acorn.Parser.extend(jsx(options));
}
function parseJSX(code, options = {}) {
const parser = createJSXParser(options.jsxOptions);
return parser.parse(code, {
ecmaVersion: options.ecmaVersion || 'latest',
sourceType: options.sourceType || 'module',
});
}
module.exports = {
createJSXParser,
parseJSX,
};
{
"name": "acorn-jsx-verify",
"version": "1.0.0",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "acorn-jsx-verify",
"version": "1.0.0",
"license": "MIT-0",
"dependencies": {
"acorn": "^8.18.0",
"acorn-jsx": "5.3.2"
}
},
"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"
}
}
}
}
{
"name": "acorn-jsx-verify",
"version": "1.0.0",
"private": true,
"description": "Clean-room verification sample for acorn-jsx",
"main": "index.js",
"scripts": {
"test": "node test/contract.js"
},
"dependencies": {
"acorn": "^8.18.0",
"acorn-jsx": "5.3.2"
}
}
{
"schemaVersion": 1,
"goal": "verify pkg:npm/acorn-jsx@5.3.2",
"kind": "HOW",
"packages": [
"pkg:npm/acorn-jsx@5.3.2"
],
"constraints": {
"executionContext": "node"
},
"runtimeConditions": {
"ecosystem": "npm",
"language": "javascript",
"moduleSystem": "cjs",
"runtime": "node@22.23.2"
}
}
const assert = require('node:assert');
const acorn = require('acorn');
const jsx = require('acorn-jsx');
const { parseJSX } = require('../index.js');
// 1. Basic JSX Element parsing with default jsx plugin
{
const parser = acorn.Parser.extend(jsx());
const code = '<div className="container">Hello World</div>';
const ast = parser.parse(code, { ecmaVersion: 'latest' });
assert.strictEqual(ast.type, 'Program');
assert.strictEqual(ast.body.length, 1);
const expr = ast.body[0].expression;
assert.strictEqual(expr.type, 'JSXElement');
assert.strictEqual(expr.openingElement.type, 'JSXOpeningElement');
assert.strictEqual(expr.openingElement.name.type, 'JSXIdentifier');
assert.strictEqual(expr.openingElement.name.name, 'div');
assert.strictEqual(expr.openingElement.selfClosing, false);
assert.strictEqual(expr.openingElement.attributes.length, 1);
const attr = expr.openingElement.attributes[0];
assert.strictEqual(attr.type, 'JSXAttribute');
assert.strictEqual(attr.name.type, 'JSXIdentifier');
assert.strictEqual(attr.name.name, 'className');
assert.strictEqual(attr.value.type, 'Literal');
assert.strictEqual(attr.value.value, 'container');
assert.strictEqual(expr.children.length, 1);
assert.strictEqual(expr.children[0].type, 'JSXText');
assert.strictEqual(expr.children[0].value, 'Hello World');
assert.strictEqual(expr.closingElement.type, 'JSXClosingElement');
assert.strictEqual(expr.closingElement.name.name, 'div');
}
// 2. Self-closing JSX elements
{
const parser = acorn.Parser.extend(jsx());
const code = '<img src="icon.png" alt="icon" />';
const ast = parser.parse(code, { ecmaVersion: 'latest' });
const expr = ast.body[0].expression;
assert.strictEqual(expr.type, 'JSXElement');
assert.strictEqual(expr.openingElement.selfClosing, true);
assert.strictEqual(expr.closingElement, null);
assert.strictEqual(expr.openingElement.attributes.length, 2);
}
// 3. JSX Fragments
{
const parser = acorn.Parser.extend(jsx());
const code = '<><span>A</span><span>B</span></>';
const ast = parser.parse(code, { ecmaVersion: 'latest' });
const expr = ast.body[0].expression;
assert.strictEqual(expr.type, 'JSXFragment');
assert.strictEqual(expr.openingFragment.type, 'JSXOpeningFragment');
assert.strictEqual(expr.closingFragment.type, 'JSXClosingFragment');
assert.strictEqual(expr.children.length, 2);
}
// 4. JSX Member Expressions (e.g. <UI.Button />)
{
const parser = acorn.Parser.extend(jsx());
const code = '<UI.Button label="Submit" />';
const ast = parser.parse(code, { ecmaVersion: 'latest' });
const expr = ast.body[0].expression;
assert.strictEqual(expr.openingElement.name.type, 'JSXMemberExpression');
assert.strictEqual(expr.openingElement.name.object.type, 'JSXIdentifier');
assert.strictEqual(expr.openingElement.name.object.name, 'UI');
assert.strictEqual(expr.openingElement.name.property.type, 'JSXIdentifier');
assert.strictEqual(expr.openingElement.name.property.name, 'Button');
}
// 5. JSX Expressions in attributes and children
{
const parser = acorn.Parser.extend(jsx());
const code = '<Counter count={10 + 2}>{"count is: " + 12}</Counter>';
const ast = parser.parse(code, { ecmaVersion: 'latest' });
const expr = ast.body[0].expression;
const attr = expr.openingElement.attributes[0];
assert.strictEqual(attr.value.type, 'JSXExpressionContainer');
assert.strictEqual(attr.value.expression.type, 'BinaryExpression');
assert.strictEqual(expr.children[0].type, 'JSXExpressionContainer');
assert.strictEqual(expr.children[0].expression.type, 'BinaryExpression');
}
// 6. Namespaces option: allowNamespaces: false vs allowNamespaces: true
{
const parserWithNs = acorn.Parser.extend(jsx({ allowNamespaces: true }));
const astWithNs = parserWithNs.parse('<svg:path d="M0 0" />', { ecmaVersion: 'latest' });
const expr = astWithNs.body[0].expression;
assert.strictEqual(expr.openingElement.name.type, 'JSXNamespacedName');
assert.strictEqual(expr.openingElement.name.namespace.name, 'svg');
assert.strictEqual(expr.openingElement.name.name.name, 'path');
const parserNoNs = acorn.Parser.extend(jsx({ allowNamespaces: false }));
assert.throws(() => {
parserNoNs.parse('<svg:path d="M0 0" />', { ecmaVersion: 'latest' });
}, /Unexpected token/);
}
// 7. Helper wrapper function verification
{
const ast = parseJSX('<header id="main-header">Title</header>');
assert.strictEqual(ast.type, 'Program');
assert.strictEqual(ast.body[0].expression.type, 'JSXElement');
}
console.log('Contract assertions passed successfully.');
オリジンシーダー
匿名