CodeSampleX

샘플

@babel/runtime 7.29.15: mark

검증된 샘플 — npm @babel/runtime 7.29.15: mark. node 22 · linux debian/x64 · docker에서 contract를 실행해 통과했습니다: require('@babel/runtime') throws…

sha256:9839300e0c51a63ce177b0ea6f859e25af90e31b6a6c5bf0a8aa194b13d1ca80

이 네트워크가 제공하는 것은 하나입니다. 빌드되는 샘플. 샌드박스에서 돌리고 서명된 영수증을 보관합니다. 등급을 매기지 않고 무엇도 보증하지 않습니다 — 같은 코드가 당신 환경에서 빌드되는지는 측정한 적이 없습니다. 통과한 계약 영수증을 낸 서로 다른 서명 키의 수입니다. 하나면 작성자 혼자이고, 둘 이상이면 다른 사람도 빌드했다는 뜻입니다. 키는 스스로 만드는 것이고 뒤에 등록된 신원이 없으므로, 세는 것은 사람이 아니라 키입니다. 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 @babel/runtime.mark in pkg:npm/%40babel/runtime@7.29.15
패키지
심벌
  • @babel/runtime.mark
환경
node 22.23.2
생성일
2026-11-21T23:06:56Z

컨트랙트

  1. require('@babel/runtime') throws ERR_PACKAGE_PATH_NOT_EXPORTED; mark is exposed via @babel/runtime/regenerator and @babel/runtime/helpers/regeneratorRuntime
  2. regeneratorRuntime.mark is identical to require('@babel/runtime/helpers/regeneratorRuntime')().mark
  3. regeneratorRuntime.mark(fn) returns fn in place, makes regeneratorRuntime.isGeneratorFunction(fn) true, sets Object.prototype.toString.call(fn) to '[object GeneratorFunction]', and installs Generator prototype methods on fn.prototype
  4. calling a marked generator returns an iterable Generator instance (instanceof marked, Symbol.iterator returns self, toString is '[object Generator]')
  5. generator instances support next() with sent values, Array.from/for..of iteration, early return(value), and throw(err) termination
  6. regeneratorRuntime.mark(null) throws TypeError

파일

  • PROMPT.md
  • csx.json
  • index.js
  • 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 @babel/runtime.mark in pkg:npm/%40babel/runtime@7.29.15
Kind: HOW

Use EXACTLY these public packages and versions:
  - pkg:npm/%40babel/runtime@7.29.15
Demonstrate these symbols/APIs:
  - @babel/runtime.mark
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:d60f763eceadb963a9ccd27a7b4e1c4d7b5f2cf91fbd435467f9fda17cd522d2","constraints":{"executionContext":"node"},"contract":["require('@babel/runtime') throws ERR_PACKAGE_PATH_NOT_EXPORTED; mark is exposed via @babel/runtime/regenerator and @babel/runtime/helpers/regeneratorRuntime","regeneratorRuntime.mark is identical to require('@babel/runtime/helpers/regeneratorRuntime')().mark","regeneratorRuntime.mark(fn) returns fn in place, makes regeneratorRuntime.isGeneratorFunction(fn) true, sets Object.prototype.toString.call(fn) to '[object GeneratorFunction]', and installs Generator prototype methods on fn.prototype","calling a marked generator returns an iterable Generator instance (instanceof marked, Symbol.iterator returns self, toString is '[object Generator]')","generator instances support next() with sent values, Array.from/for..of iteration, early return(value), and throw(err) termination","regeneratorRuntime.mark(null) throws TypeError"],"goal":"verify @babel/runtime.mark in pkg:npm/%40babel/runtime@7.29.15","kind":"HOW","packages":["pkg:npm/%40babel/runtime@7.29.15"],"schemaVersion":1,"symbols":["@babel/runtime.mark"]},"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","symbols":["@babel/runtime.mark"],"verifierAdapter":"node-typescript@1"}
index.js
"use strict";

const regeneratorRuntime = require("@babel/runtime/regenerator");
const getRegeneratorRuntime = require("@babel/runtime/helpers/regeneratorRuntime");

function createCounterGeneratorFactory() {
  const marked = regeneratorRuntime.mark(function counter(start, end) {
    let current;
    let step;
    return regeneratorRuntime.wrap(function counter$(ctx) {
      while (true) {
        switch ((ctx.prev = ctx.next)) {
          case 0:
            current = start;
          case 1:
            if (!(current <= end)) {
              ctx.next = 7;
              break;
            }
            ctx.next = 4;
            return current;
          case 4:
            step = ctx.sent;
            current += typeof step === "number" ? step : 1;
            ctx.next = 1;
            break;
          case 7:
            return ctx.abrupt("return", current);
          case 8:
          case "end":
            return ctx.stop();
        }
      }
    }, marked);
  });

  return marked;
}

module.exports = {
  regeneratorRuntime,
  getRegeneratorRuntime,
  createCounterGeneratorFactory,
};
package-lock.json
{
  "name": "babel-runtime-mark-sample",
  "version": "1.0.0",
  "lockfileVersion": 3,
  "requires": true,
  "packages": {
    "": {
      "name": "babel-runtime-mark-sample",
      "version": "1.0.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-mark-sample",
  "version": "1.0.0",
  "private": true,
  "description": "Minimal verification of @babel/runtime.mark via @babel/runtime/regenerator",
  "main": "index.js",
  "scripts": {
    "test": "node test/contract.js"
  },
  "dependencies": {
    "@babel/runtime": "7.29.15"
  }
}
spec.json
{
  "schemaVersion": 1,
  "goal": "verify @babel/runtime.mark in pkg:npm/%40babel/runtime@7.29.15",
  "kind": "HOW",
  "packages": [
    "pkg:npm/%40babel/runtime@7.29.15"
  ],
  "symbols": [
    "@babel/runtime.mark"
  ],
  "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 {
  regeneratorRuntime,
  getRegeneratorRuntime,
  createCounterGeneratorFactory,
} = require("../index.js");

// 1. Root import is not exported; mark must be accessed via subpath exports.
assert.throws(
  () => require("@babel/runtime"),
  (err) => err && err.code === "ERR_PACKAGE_PATH_NOT_EXPORTED"
);

// 2. Subpath exports expose the same mark function.
const helperRuntime = getRegeneratorRuntime();
assert.equal(typeof regeneratorRuntime.mark, "function");
assert.equal(regeneratorRuntime.mark, helperRuntime.mark);

// 3. mark() mutates and returns the target function with GeneratorFunction prototype and Generator.prototype.
function plainFn() {}
assert.equal(regeneratorRuntime.isGeneratorFunction(plainFn), false);

function rawFn() {
  return regeneratorRuntime.wrap(function rawFn$(ctx) {
    switch ((ctx.prev = ctx.next)) {
      case 0:
        return ctx.stop();
    }
  }, rawFn);
}
const markedRaw = regeneratorRuntime.mark(rawFn);
assert.equal(markedRaw, rawFn);
assert.equal(regeneratorRuntime.isGeneratorFunction(markedRaw), true);
assert.equal(
  Object.prototype.toString.call(markedRaw),
  "[object GeneratorFunction]"
);
assert.equal(typeof markedRaw.prototype.next, "function");
assert.equal(typeof markedRaw.prototype.throw, "function");
assert.equal(typeof markedRaw.prototype.return, "function");

// 4. Calling a marked generator produces a Generator instance inheriting from marked.prototype.
const counterGen = createCounterGeneratorFactory();
assert.equal(regeneratorRuntime.isGeneratorFunction(counterGen), true);

const iter = counterGen(1, 5);
assert.equal(iter instanceof counterGen, true);
assert.equal(Object.getPrototypeOf(iter), counterGen.prototype);
assert.equal(Object.prototype.toString.call(iter), "[object Generator]");
assert.equal(iter[Symbol.iterator](), iter);

// 5. Stepping with next() yields values, receives sent values, and completes with the return value.
assert.deepEqual(iter.next(), { value: 1, done: false });
assert.deepEqual(iter.next(2), { value: 3, done: false });
assert.deepEqual(iter.next(2), { value: 5, done: false });
assert.deepEqual(iter.next(1), { value: 6, done: true });
assert.deepEqual(iter.next(), { value: undefined, done: true });

// 6. Standard for..of iteration works over the marked generator.
assert.deepEqual(Array.from(counterGen(2, 4)), [2, 3, 4]);

// 7. Early return() terminates the generator and returns the provided completion value.
const earlyReturnIter = counterGen(10, 20);
assert.deepEqual(earlyReturnIter.next(), { value: 10, done: false });
assert.deepEqual(earlyReturnIter.return("stopped"), {
  value: "stopped",
  done: true,
});
assert.deepEqual(earlyReturnIter.next(), { value: undefined, done: true });

// 8. throw() propagates the error and closes the generator.
const throwingIter = counterGen(1, 3);
assert.deepEqual(throwingIter.next(), { value: 1, done: false });
assert.throws(
  () => throwingIter.throw(new Error("injected failure")),
  /injected failure/
);
assert.deepEqual(throwingIter.next(), { value: undefined, done: true });

// 9. Passing a non-object (such as null) to mark() throws a TypeError.
assert.throws(() => regeneratorRuntime.mark(null), TypeError);

오리진 시더

익명