CodeSampleX

サンプル

@babel/runtime 7.29.15

検証済みサンプル — npm @babel/runtime 7.29.15. node 22 · linux debian/x64 · docker で contract を実行し、成功しました: assert helpers/typeof identifies strings, numbers, symbols…

sha256:911952cdddee2067f6beddc75a391cf48728e88b28813f73dabb0806441ffad2

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

実行証拠

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

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

検証実行環境

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

ケース

HOW
ゴール
verify pkg:npm/%40babel/runtime@7.29.15
パッケージ
環境
node 22.23.2
作成日
2026-11-21T16:52:01Z

コントラクト

  1. assert helpers/typeof identifies strings, numbers, symbols, objects, null, and undefined
  2. assert helpers/objectSpread2 merges enumerable string and symbol properties
  3. assert helpers/objectWithoutProperties omits excluded string and symbol keys and returns an empty object for null
  4. assert helpers/slicedToArray and helpers/toConsumableArray convert Set iterables into expected arrays
  5. assert helpers/classCallCheck throws TypeError without new and helpers/createClass plus helpers/inherits wire prototype and static inheritance
  6. assert helpers/asyncToGenerator resolves yielded promises and propagates rejected promises
  7. assert helpers/usingCtx invokes Symbol.dispose handlers in LIFO order and throws TypeError for non-disposable objects
  8. assert helpers/interopRequireDefault preserves __esModule objects and wraps plain CommonJS exports under default
  9. assert regenerator exposes mark and wrap functions

ファイル

  • 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/%40babel/runtime@7.29.15
Kind: HOW

Use EXACTLY these public packages and versions:
  - pkg:npm/%40babel/runtime@7.29.15
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:f4a1bbf656612ad02650e89c5a8b38248db419526876b8fc1f0bba6151068280","constraints":{"executionContext":"node"},"contract":["assert helpers/typeof identifies strings, numbers, symbols, objects, null, and undefined","assert helpers/objectSpread2 merges enumerable string and symbol properties","assert helpers/objectWithoutProperties omits excluded string and symbol keys and returns an empty object for null","assert helpers/slicedToArray and helpers/toConsumableArray convert Set iterables into expected arrays","assert helpers/classCallCheck throws TypeError without new and helpers/createClass plus helpers/inherits wire prototype and static inheritance","assert helpers/asyncToGenerator resolves yielded promises and propagates rejected promises","assert helpers/usingCtx invokes Symbol.dispose handlers in LIFO order and throws TypeError for non-disposable objects","assert helpers/interopRequireDefault preserves __esModule objects and wraps plain CommonJS exports under default","assert regenerator exposes mark and wrap functions"],"goal":"verify pkg:npm/%40babel/runtime@7.29.15","kind":"HOW","packages":["pkg:npm/%40babel/runtime@7.29.15"],"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/%40babel/runtime@7.29.15"],"schemaVersion":1,"subject":"pkg:npm/%40babel/runtime@7.29.15","verifierAdapter":"node-typescript@1"}
package-lock.json
{
  "name": "babel-runtime-cjs-sample",
  "version": "1.0.0",
  "lockfileVersion": 3,
  "requires": true,
  "packages": {
    "": {
      "name": "babel-runtime-cjs-sample",
      "version": "1.0.0",
      "license": "MIT-0",
      "dependencies": {
        "@babel/runtime": "7.29.15"
      }
    },
    "node_modules/@babel/runtime": {
      "version": "7.29.15",
      "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.29.15.tgz",
      "integrity": "sha512-304gsbbGVmQc+cNGHzwHBlqepYdWLKj3VXCQBGt/EGcV7PUPfKI7kAUNW1FZEOCwlQiLvQjg1JEaAlRQ616h+Q==",
      "license": "MIT",
      "engines": {
        "node": ">=6.9.0"
      }
    }
  }
}
package.json
{
  "name": "babel-runtime-cjs-sample",
  "version": "1.0.0",
  "private": true,
  "license": "MIT-0",
  "scripts": {
    "test": "node test/contract.js"
  },
  "dependencies": {
    "@babel/runtime": "7.29.15"
  }
}
spec.json
{
  "schemaVersion": 1,
  "goal": "verify pkg:npm/%40babel/runtime@7.29.15",
  "kind": "HOW",
  "packages": [
    "pkg:npm/%40babel/runtime@7.29.15"
  ],
  "constraints": {
    "executionContext": "node"
  },
  "runtimeConditions": {
    "ecosystem": "npm",
    "language": "javascript",
    "moduleSystem": "cjs",
    "packageManager": "npm@10.9.8",
    "runtime": "node@22.23.2"
  }
}
test/contract.js
'use strict';

const assert = require('node:assert/strict');
const _typeof = require('@babel/runtime/helpers/typeof');
const _objectSpread2 = require('@babel/runtime/helpers/objectSpread2');
const _objectWithoutProperties = require('@babel/runtime/helpers/objectWithoutProperties');
const _slicedToArray = require('@babel/runtime/helpers/slicedToArray');
const _toConsumableArray = require('@babel/runtime/helpers/toConsumableArray');
const _classCallCheck = require('@babel/runtime/helpers/classCallCheck');
const _createClass = require('@babel/runtime/helpers/createClass');
const _inherits = require('@babel/runtime/helpers/inherits');
const _asyncToGenerator = require('@babel/runtime/helpers/asyncToGenerator');
const _usingCtx = require('@babel/runtime/helpers/usingCtx');
const _interopRequireDefault = require('@babel/runtime/helpers/interopRequireDefault');
const regeneratorRuntime = require('@babel/runtime/regenerator');

async function main() {
  // 1. helpers/typeof identifies primitives, objects, null, undefined, and symbols
  assert.equal(_typeof('text'), 'string');
  assert.equal(_typeof(123), 'number');
  assert.equal(_typeof(Symbol('tag')), 'symbol');
  assert.equal(_typeof({ ok: true }), 'object');
  assert.equal(_typeof(null), 'object');
  assert.equal(_typeof(undefined), 'undefined');

  // 2. helpers/objectSpread2 merges enumerable string and symbol keys
  const keepSym = Symbol('keep');
  const merged = _objectSpread2({ a: 1 }, { b: 2, [keepSym]: 'v' });
  assert.equal(merged.a, 1);
  assert.equal(merged.b, 2);
  assert.equal(merged[keepSym], 'v');

  // 3. helpers/objectWithoutProperties omits listed keys while keeping other string and symbol keys
  const dropSym = Symbol('drop');
  const rest = _objectWithoutProperties(
    { a: 1, b: 2, c: 3, [keepSym]: 'kept', [dropSym]: 'dropped' },
    ['b', dropSym]
  );
  assert.equal(rest.a, 1);
  assert.equal(rest.c, 3);
  assert.equal('b' in rest, false);
  assert.equal(rest[keepSym], 'kept');
  assert.equal(dropSym in rest, false);
  assert.deepEqual(_objectWithoutProperties(null, ['a']), {});

  // 4. helpers/slicedToArray and helpers/toConsumableArray handle iterables
  assert.deepEqual(_slicedToArray(new Set([10, 20, 30]), 2), [10, 20]);
  assert.deepEqual(_toConsumableArray(new Set(['x', 'y', 'z'])), ['x', 'y', 'z']);

  // 5. helpers/classCallCheck, helpers/createClass, and helpers/inherits build class hierarchies
  function Base(name) {
    _classCallCheck(this, Base);
    this.name = name;
  }
  _createClass(
    Base,
    [
      {
        key: 'describe',
        value: function describe() {
          return 'base:' + this.name;
        },
      },
    ],
    [
      {
        key: 'kind',
        value: function kind() {
          return 'Base';
        },
      },
    ]
  );

  assert.throws(
    () => {
      Base.call({}, 'bad');
    },
    { name: 'TypeError' }
  );

  function Child(name, level) {
    _classCallCheck(this, Child);
    Base.call(this, name);
    this.level = level;
  }
  _inherits(Child, Base);
  _createClass(Child, [
    {
      key: 'summary',
      value: function summary() {
        return this.describe() + ':' + this.level;
      },
    },
  ]);

  const child = new Child('node', 2);
  assert.equal(child instanceof Base, true);
  assert.equal(child instanceof Child, true);
  assert.equal(child.summary(), 'base:node:2');
  assert.equal(Child.kind(), 'Base');

  // 6. helpers/asyncToGenerator drives generator-based async functions and propagates rejections
  const compute = _asyncToGenerator(function* (n) {
    const doubled = yield Promise.resolve(n * 2);
    return doubled + 1;
  });
  assert.equal(await compute(20), 41);

  const failing = _asyncToGenerator(function* () {
    yield Promise.reject(new Error('boom'));
  });
  await assert.rejects(() => failing(), { message: 'boom' });

  // 7. helpers/usingCtx disposes resources in LIFO order and rejects non-disposable objects
  const disposeSym = Symbol.dispose || Symbol.for('Symbol.dispose');
  const order = [];
  const ctx = _usingCtx();
  ctx.u({
    [disposeSym]() {
      order.push('first');
    },
  });
  ctx.u({
    [disposeSym]() {
      order.push('second');
    },
  });
  ctx.d();
  assert.deepEqual(order, ['second', 'first']);

  const badCtx = _usingCtx();
  assert.throws(() => badCtx.u({}), { name: 'TypeError' });

  // 8. helpers/interopRequireDefault normalizes ESM and CJS module shapes
  const esmObj = { __esModule: true, default: 42 };
  assert.equal(_interopRequireDefault(esmObj), esmObj);
  const cjsObj = { value: 42 };
  assert.deepEqual(_interopRequireDefault(cjsObj), { default: cjsObj });

  // 9. regenerator exposes mark and wrap functions
  assert.equal(typeof regeneratorRuntime.mark, 'function');
  assert.equal(typeof regeneratorRuntime.wrap, 'function');

  console.log('babel-runtime-cjs-contract:pass');
}

main().catch((err) => {
  console.error(err);
  process.exitCode = 1;
});

オリジンシーダー

匿名