CodeSampleX

Beispiel

real-require 0.2.0: verify realRequire from

Verifiziertes Beispiel für npm real-require 0.2.0: verify realRequire from. Der Vertrag lief auf node 22 · linux alpine/x64 · docker und bestand.

sha256:22dcdb8cd45da2ec278bcbc025a5f56b048c3dc64f90b2a84429df02a1ad61d4

Dieses Netzwerk bietet eine Sache: ein Sample, das baut. Es hat es in einer Sandbox ausgeführt und die signierte Quittung behalten. Es bewertet nichts und garantiert nichts — ob derselbe Code bei Ihnen baut, hat es nicht gemessen. Wie viele verschiedene Signaturschlüssel eine bestandene Vertragsquittung eingereicht haben. Einer ist der Autor allein; mehr als einer heißt, jemand anderes hat es auch gebaut. Ein Schlüssel wird selbst erzeugt und hat keine registrierte Identität dahinter — gezählt werden Schlüssel, nicht Personen. MIT-0

Ausführungsbelege

Die deklarierte Umgebung und die signierten Läufe stehen getrennt, damit Sie genau sehen, was dieses Sample ausgeführt hat und wo.

Beleggrundlage
Signierter Vertrag bestanden
Verifizierungsbelege
1
Signaturschlüssel, die es gebaut haben
1
Deklarierte Umgebung node 22.23 linux 24 · ubuntu · glibc 2.39 x64 node 22.23 javascript npm 10

Umgebungen der Verifizierungsläufe

Umgebung Contract Stufen Lauf
node 22 · linux alpine/x64 · docker ed25519:c1973797be207ac4 PASS compile:SKIPPED · contract:PASS · load:PASS · resolve:PASS
CONTAINER_RUN · node-typescript@1
2026-08-21

Fall

HOW
Ziel
verify realRequire from pkg:npm/real-require@0.2.0
Pakete
Symbole
  • realRequire
Umgebung
node 22.23.2
Erstellt
2026-08-21T04:27:25Z

Contract

  1. realRequire loads built-in Node.js modules
  2. realRequire loads local CommonJS files via absolute path
  3. realRequire delegates to global __non_webpack__require__ when present
  4. realImport dynamically imports built-in Node.js modules

Dateien

  • PROMPT.md
  • csx.json
  • fixtures/sample.cjs
  • index.js
  • package-lock.json
  • package.json
  • spec.json
  • test/contract.cjs

Quellartefakt herunterladen (tar.gz)

Quelltext

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 realRequire from pkg:npm/real-require@0.2.0
Kind: HOW

Use EXACTLY these public packages and versions:
  - pkg:npm/real-require@0.2.0
Demonstrate these symbols/APIs:
  - realRequire
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:a575b887a0dd3033d3bff61ad27f7b42e780eb8813e5fd21e36c9207cbd48103","constraints":{"executionContext":"node"},"contract":["realRequire loads built-in Node.js modules","realRequire loads local CommonJS files via absolute path","realRequire delegates to global __non_webpack__require__ when present","realImport dynamically imports built-in Node.js modules"],"goal":"verify realRequire from pkg:npm/real-require@0.2.0","kind":"HOW","packages":["pkg:npm/real-require@0.2.0"],"schemaVersion":1,"symbols":["realRequire"]},"contractCommand":["node","test/contract.cjs"],"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/real-require@0.2.0"],"schemaVersion":1,"subject":"pkg:npm/real-require@0.2.0","symbols":["realRequire"],"verifierAdapter":"node-typescript@1"}
fixtures/sample.cjs
module.exports = {
  name: "clean-room-sample",
  add: (a, b) => a + b
};
index.js
const { realRequire, realImport } = require("real-require");

module.exports = { realRequire, realImport };
package-lock.json
{
  "name": "real-require-verification",
  "version": "1.0.0",
  "lockfileVersion": 3,
  "requires": true,
  "packages": {
    "": {
      "name": "real-require-verification",
      "version": "1.0.0",
      "dependencies": {
        "real-require": "0.2.0"
      }
    },
    "node_modules/real-require": {
      "version": "0.2.0",
      "resolved": "https://registry.npmjs.org/real-require/-/real-require-0.2.0.tgz",
      "integrity": "sha512-57frrGM/OCTLqLOAh0mhVA9VBMHd+9U7Zb2THMGdBUoZVOtGbJzjxsYGDJ3A9AYYCP4hn6y1TVbaOfzWtm5GFg==",
      "license": "MIT",
      "engines": {
        "node": ">= 12.13.0"
      }
    }
  }
}
package.json
{
  "name": "real-require-verification",
  "version": "1.0.0",
  "private": true,
  "description": "Clean-room verification for real-require",
  "main": "index.js",
  "scripts": {
    "test": "node test/contract.cjs"
  },
  "dependencies": {
    "real-require": "0.2.0"
  }
}
spec.json
{
  "schemaVersion": 1,
  "goal": "verify realRequire from pkg:npm/real-require@0.2.0",
  "kind": "HOW",
  "packages": [
    "pkg:npm/real-require@0.2.0"
  ],
  "symbols": [
    "realRequire"
  ],
  "constraints": {
    "executionContext": "node"
  },
  "runtimeConditions": {
    "ecosystem": "npm",
    "language": "javascript",
    "moduleSystem": "cjs",
    "packageManager": "npm@10.9.8",
    "runtime": "node@22.23.2"
  }
}
test/contract.cjs
const assert = require("node:assert");
const path = require("node:path");
const { realRequire, realImport } = require("real-require");

async function testContract() {
  // 1. realRequire loads built-in Node.js modules
  {
    const pathModule = realRequire("path");
    assert.strictEqual(typeof pathModule.join, "function", "realRequire should load built-in module path");
    assert.strictEqual(pathModule.join("a", "b"), "a/b");
  }

  // 2. realRequire loads local CommonJS files via absolute path
  {
    const samplePath = path.resolve(__dirname, "../fixtures/sample.cjs");
    const sampleMod = realRequire(samplePath);
    assert.strictEqual(sampleMod.name, "clean-room-sample", "realRequire should load target cjs module");
    assert.strictEqual(sampleMod.add(2, 3), 5, "realRequire module function should compute expected result");
  }

  // 3. realRequire delegates to global __non_webpack__require__ when present
  {
    global.__non_webpack__require__ = (moduleName) => {
      return { delegated: true, moduleName };
    };
    try {
      const delegatedResult = realRequire("custom-bundle-target");
      assert.strictEqual(delegatedResult.delegated, true, "realRequire should use __non_webpack__require__");
      assert.strictEqual(delegatedResult.moduleName, "custom-bundle-target");
    } finally {
      delete global.__non_webpack__require__;
    }
  }

  // 4. realImport dynamically imports built-in Node.js modules
  {
    const fsModule = await realImport("fs");
    assert.strictEqual(typeof fsModule.readFileSync, "function", "realImport should dynamically import built-in module");
  }

  console.log("Contract verified successfully.");
}

testContract().catch((err) => {
  console.error("Contract test failed:", err);
  process.exit(1);
});

Ursprungs-Seeder

anonym