サンプル
@babel/helpers 8.0.0: Retrieve AST nodes, dependencies, minimum version, and metadata for runtime helpers with @babel/helpers
検証済みサンプル — npm @babel/helpers 8.0.0: Retrieve AST nodes, dependencies, minimum version, and metadata for runtime helpers with @babel/helpers. node 22 · linux…
sha256:5af1e96ca115e335bdc16d2538e1001bae469f6b375379a69fe30b8485ab73b3
このネットワークが提供するのは一つだけです。ビルドされるサンプル。サンドボックスで実行し、署名済みの受領証を保管します。等級はつけず、何も保証しません — 同じコードがあなたの環境でビルドされるかは測定していません。
合格した契約受領証を提出した異なる署名鍵の数です。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@1 |
2026-08-20 |
ケース
HOW- ゴール
- Retrieve AST nodes, dependencies, minimum version, and metadata for runtime helpers with @babel/helpers
- パッケージ
- 作成日
- 2026-08-20T21:24:14Z
コントラクト
- listAllHelpers returns an array of runtime helper names including typeof, classCallCheck, and wrapRegExp
- hasHelper checks if a helper is registered in @babel/helpers list
- getHelperAst retrieves the AST node statements for a helper declaration
- getHelperGlobals returns the required global identifiers for a helper
- getHelperMinVersion returns the minimum Babel runtime version for a helper
- getHelperDependencies returns dependent helper names required by a helper
- isHelperInternal indicates whether a helper is flagged for internal compiler use
- getHelperAst throws BABEL_HELPER_UNKNOWN ReferenceError when requesting an unknown helper name
ファイル
- PROMPT.md
- csx.json
- package-lock.json
- package.json
- spec.json
- src/index.js
- test/contract.mjs
ソース
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: Retrieve AST nodes, dependencies, minimum version, and metadata for runtime helpers with @babel/helpers
Kind: HOW
Use EXACTLY these public packages and versions:
- pkg:npm/%40babel/helpers@8.0.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.
{"case":{"caseId":"case:sha256:6e79ed0fb65a75c7e4485d11f3eae882c1e147d8845d306677b0e8968e14b238","contract":["listAllHelpers returns an array of runtime helper names including typeof, classCallCheck, and wrapRegExp","hasHelper checks if a helper is registered in @babel/helpers list","getHelperAst retrieves the AST node statements for a helper declaration","getHelperGlobals returns the required global identifiers for a helper","getHelperMinVersion returns the minimum Babel runtime version for a helper","getHelperDependencies returns dependent helper names required by a helper","isHelperInternal indicates whether a helper is flagged for internal compiler use","getHelperAst throws BABEL_HELPER_UNKNOWN ReferenceError when requesting an unknown helper name"],"goal":"Retrieve AST nodes, dependencies, minimum version, and metadata for runtime helpers with @babel/helpers","kind":"HOW","packages":["pkg:npm/%40babel/helpers@8.0.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/%40babel/helpers@8.0.0"],"schemaVersion":1,"subject":"pkg:npm/%40babel/helpers@8.0.0","verifierAdapter":"node-typescript@1"}
{
"name": "sample-babel-helpers",
"version": "1.0.0",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "sample-babel-helpers",
"version": "1.0.0",
"license": "MIT-0",
"dependencies": {
"@babel/helpers": "8.0.0"
}
},
"node_modules/@babel/code-frame": {
"version": "8.0.0",
"resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-8.0.0.tgz",
"integrity": "sha512-dYYg153EyN2Ekbqw2zAsbd6/JR+9N2SEoC7YV2GyyqMM7x9bLDTjBD6XBhSMLH0wtIVyJj03jWNriQhaN+eoCw==",
"license": "MIT",
"dependencies": {
"@babel/helper-validator-identifier": "^8.0.0",
"js-tokens": "^10.0.0"
},
"engines": {
"node": "^22.18.0 || >=24.11.0"
}
},
"node_modules/@babel/helper-string-parser": {
"version": "8.0.0",
"resolved": "https://registry.npmjs.org/@babel/helper-string-parser/-/helper-string-parser-8.0.0.tgz",
"integrity": "sha512-6mJgmFFFIIO82vvoLt9XtRC7/TkzXfts1t/SpRX4IHSzMgqoPYCWesVu1udUPUWioAE/2fcG6WuI8zrkE1gwrg==",
"license": "MIT",
"engines": {
"node": "^22.18.0 || >=24.11.0"
}
},
"node_modules/@babel/helper-validator-identifier": {
"version": "8.0.4",
"resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-8.0.4.tgz",
"integrity": "sha512-4wFaiLd0bVo4cIoTXI3zKI038NIWE/cr3jvBjejOVYVxV/m8Ltav1USiGzG1fmS5J2RhgEOgXNNK46cRPnRsrg==",
"license": "MIT",
"engines": {
"node": "^22.18.0 || >=24.11.0"
}
},
"node_modules/@babel/helpers": {
"version": "8.0.0",
"resolved": "https://registry.npmjs.org/@babel/helpers/-/helpers-8.0.0.tgz",
"integrity": "sha512-wfbi91pM3py96oIiJEz7qIpyXDytgr9zQC1HEWwlGNVRAEmItuU/0a41ZUKu1sJGyhhOIpc4t5vk4PYzt8wpsg==",
"license": "MIT",
"dependencies": {
"@babel/template": "^8.0.0",
"@babel/types": "^8.0.0"
},
"engines": {
"node": "^22.18.0 || >=24.11.0"
}
},
"node_modules/@babel/parser": {
"version": "8.0.4",
"resolved": "https://registry.npmjs.org/@babel/parser/-/parser-8.0.4.tgz",
"integrity": "sha512-srpptsAkEbbNIC/q8nT7o+m6CQe8CJUTV/t7MYc9NnWlgYVtHOb7JH6SorxMhN0kuRJjVqXbKClG6xSbPtzz+g==",
"license": "MIT",
"dependencies": {
"@babel/types": "^8.0.4"
},
"bin": {
"parser": "bin/babel-parser.js"
},
"engines": {
"node": "^22.18.0 || >=24.11.0"
}
},
"node_modules/@babel/template": {
"version": "8.0.0",
"resolved": "https://registry.npmjs.org/@babel/template/-/template-8.0.0.tgz",
"integrity": "sha512-eAD0QW/AlbamBbw0FeGiwasbCVPq5ncW0HNVyLP3B9czqLyh4gvw+5JTSNt6le9+ziAU7mqDZsKTHf3jTb4chQ==",
"license": "MIT",
"dependencies": {
"@babel/code-frame": "^8.0.0",
"@babel/parser": "^8.0.0",
"@babel/types": "^8.0.0"
},
"engines": {
"node": "^22.18.0 || >=24.11.0"
}
},
"node_modules/@babel/types": {
"version": "8.0.4",
"resolved": "https://registry.npmjs.org/@babel/types/-/types-8.0.4.tgz",
"integrity": "sha512-eY+Yn3dCqTGmyiq2QRU66lA5FL8lqqqvecHt0fF3uHONIa7ToYsaCiWV8lOKqAs0Rb2SjixiKFROngnulPtt2g==",
"license": "MIT",
"dependencies": {
"@babel/helper-string-parser": "^8.0.0",
"@babel/helper-validator-identifier": "^8.0.4"
},
"engines": {
"node": "^22.18.0 || >=24.11.0"
}
},
"node_modules/js-tokens": {
"version": "10.0.0",
"resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-10.0.0.tgz",
"integrity": "sha512-lM/UBzQmfJRo9ABXbPWemivdCW8V2G8FHaHdypQaIy523snUjog0W71ayWXTjiR+ixeMyVHN2XcpnTd/liPg/Q==",
"license": "MIT"
}
}
}
{
"name": "sample-babel-helpers",
"version": "1.0.0",
"private": true,
"description": "Clean-room verification of @babel/helpers",
"main": "src/index.js",
"license": "MIT-0",
"dependencies": {
"@babel/helpers": "8.0.0"
}
}
{
"schemaVersion": 1,
"goal": "Retrieve AST nodes, dependencies, minimum version, and metadata for runtime helpers with @babel/helpers",
"kind": "HOW",
"packages": [
"pkg:npm/%40babel/helpers@8.0.0"
]
}
const helpers = require('@babel/helpers');
/**
* Returns a list of all helper names available in @babel/helpers.
* @returns {string[]}
*/
function listAllHelpers() {
return [...helpers.list];
}
/**
* Checks if a helper is defined in @babel/helpers.
* @param {string} name
* @returns {boolean}
*/
function hasHelper(name) {
return helpers.list.includes(name);
}
/**
* Retrieves AST node statements for a runtime helper.
* @param {string} name
* @param {Function} [getDependency]
* @param {string} [bindingName]
* @param {string[]} [localBindings]
* @returns {object[]}
*/
function getHelperAst(name, getDependency, bindingName, localBindings) {
const result = helpers.get(name, getDependency, bindingName, localBindings);
return result.nodes;
}
/**
* Retrieves required global identifiers for a helper.
* @param {string} name
* @returns {string[]}
*/
function getHelperGlobals(name) {
const result = helpers.get(name);
return result.globals;
}
/**
* Retrieves the minimum Babel version required for a helper.
* @param {string} name
* @returns {string}
*/
function getHelperMinVersion(name) {
return helpers.minVersion(name);
}
/**
* Retrieves dependent helper names for a helper.
* @param {string} name
* @returns {string[]}
*/
function getHelperDependencies(name) {
return helpers.getDependencies(name);
}
/**
* Checks if a helper is marked internal.
* @param {string} name
* @returns {boolean}
*/
function isHelperInternal(name) {
return Boolean(helpers.isInternal(name));
}
module.exports = {
listAllHelpers,
hasHelper,
getHelperAst,
getHelperGlobals,
getHelperMinVersion,
getHelperDependencies,
isHelperInternal,
};
import assert from 'node:assert';
import { createRequire } from 'node:module';
const require = createRequire(import.meta.url);
const {
listAllHelpers,
hasHelper,
getHelperAst,
getHelperGlobals,
getHelperMinVersion,
getHelperDependencies,
isHelperInternal,
} = require('../src/index.js');
async function runContract() {
// 1. listAllHelpers
const helpersList = listAllHelpers();
assert.ok(Array.isArray(helpersList), 'listAllHelpers should return an array');
assert.ok(helpersList.length > 50, 'helpers list should contain many helper definitions');
assert.ok(helpersList.includes('typeof'), 'helpers list should include typeof');
assert.ok(helpersList.includes('classCallCheck'), 'helpers list should include classCallCheck');
assert.ok(helpersList.includes('wrapRegExp'), 'helpers list should include wrapRegExp');
assert.ok(helpersList.includes('inherits'), 'helpers list should include inherits');
// 2. hasHelper
assert.strictEqual(hasHelper('typeof'), true, 'hasHelper should return true for typeof');
assert.strictEqual(hasHelper('wrapRegExp'), true, 'hasHelper should return true for wrapRegExp');
assert.strictEqual(hasHelper('nonExistentHelper123'), false, 'hasHelper should return false for unknown helper');
// 3. getHelperAst
const typeofAstNodes = getHelperAst('typeof');
assert.ok(Array.isArray(typeofAstNodes), 'getHelperAst should return an array of AST nodes');
assert.strictEqual(typeofAstNodes.length, 1, 'typeof helper should have 1 top-level AST node');
assert.strictEqual(typeofAstNodes[0].type, 'FunctionDeclaration', 'typeof helper AST node should be FunctionDeclaration');
assert.strictEqual(typeofAstNodes[0].id.name, '_typeof', 'typeof helper default function name should be _typeof');
// 4. getHelperGlobals
const typeofGlobals = getHelperGlobals('typeof');
assert.ok(Array.isArray(typeofGlobals), 'getHelperGlobals should return an array of global identifiers');
assert.ok(typeofGlobals.includes('Symbol'), 'typeof helper globals should include Symbol');
const classCallCheckGlobals = getHelperGlobals('classCallCheck');
assert.ok(Array.isArray(classCallCheckGlobals), 'classCallCheck globals should be an array');
assert.ok(classCallCheckGlobals.includes('TypeError'), 'classCallCheck globals should include TypeError');
// 5. getHelperMinVersion
const typeofMinVer = getHelperMinVersion('typeof');
assert.strictEqual(typeofMinVer, '7.0.0-beta.0', 'typeof helper minimum version should match 7.0.0-beta.0');
const wrapRegExpMinVer = getHelperMinVersion('wrapRegExp');
assert.strictEqual(wrapRegExpMinVer, '7.19.0', 'wrapRegExp helper minimum version should match 7.19.0');
// 6. getHelperDependencies
const typeofDeps = getHelperDependencies('typeof');
assert.ok(Array.isArray(typeofDeps), 'getHelperDependencies should return an array');
assert.deepStrictEqual(typeofDeps, [], 'typeof helper should have no dependencies');
const wrapRegExpDeps = getHelperDependencies('wrapRegExp');
assert.ok(Array.isArray(wrapRegExpDeps), 'wrapRegExp dependencies should be an array');
assert.ok(wrapRegExpDeps.includes('setPrototypeOf'), 'wrapRegExp dependencies should include setPrototypeOf');
assert.ok(wrapRegExpDeps.includes('inherits'), 'wrapRegExp dependencies should include inherits');
// 7. isHelperInternal
assert.strictEqual(isHelperInternal('typeof'), false, 'typeof helper is not internal');
assert.strictEqual(isHelperInternal('wrapRegExp'), false, 'wrapRegExp helper is not internal');
// 8. Unknown helper error handling
assert.throws(
() => getHelperAst('unknownHelperNameXYZ'),
(err) => {
return (
err instanceof ReferenceError &&
err.code === 'BABEL_HELPER_UNKNOWN' &&
err.helper === 'unknownHelperNameXYZ'
);
},
'getHelperAst should throw BABEL_HELPER_UNKNOWN ReferenceError for unknown helper'
);
console.log('Contract assertions passed successfully.');
}
runContract().catch((err) => {
console.error('Contract test failed:', err);
process.exit(1);
});
オリジンシーダー
匿名