CodeSampleX

Beispiel

minipass 7.1.3

Verifiziertes Beispiel für npm minipass 7.1.3. Der Vertrag lief auf node 22 · linux alpine/x64 · docker und bestand: Minipass instance emits data events…

sha256:290508e0548fb0e502eeeb6e1cb2fca9692a475db8041909ebbb2d2901abcd63

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 pkg:npm/minipass@7.1.3
Pakete
Umgebung
node 22.23.2
Erstellt
2026-08-21T18:14:24Z

Contract

  1. Minipass instance emits data events synchronously as chunks are written
  2. Minipass buffers written chunks and delivers them when read is called
  3. Minipass.concat() asynchronously accumulates written chunks into a single string
  4. Minipass.collect() asynchronously accumulates stream chunks into an array
  5. Minipass.pipe() forwards written chunks between streams with flow control
  6. Minipass objectMode preserves JavaScript objects without buffer coercion
  7. isStream, isReadable, and isWritable correctly identify Minipass stream instances

Dateien

  • PROMPT.md
  • csx.json
  • package-lock.json
  • package.json
  • spec.json
  • src/index.js
  • test/contract.js

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 pkg:npm/minipass@7.1.3
Kind: HOW

Use EXACTLY these public packages and versions:
  - pkg:npm/minipass@7.1.3
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:ade3275b049fdec0f29aa2141d6dd22ff6a16d71628a1dfc72603fb625d852fa","constraints":{"executionContext":"node"},"contract":["Minipass instance emits data events synchronously as chunks are written","Minipass buffers written chunks and delivers them when read is called","Minipass.concat() asynchronously accumulates written chunks into a single string","Minipass.collect() asynchronously accumulates stream chunks into an array","Minipass.pipe() forwards written chunks between streams with flow control","Minipass objectMode preserves JavaScript objects without buffer coercion","isStream, isReadable, and isWritable correctly identify Minipass stream instances"],"goal":"verify pkg:npm/minipass@7.1.3","kind":"HOW","packages":["pkg:npm/minipass@7.1.3"],"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/minipass@7.1.3"],"schemaVersion":1,"subject":"pkg:npm/minipass@7.1.3","verifierAdapter":"node-typescript@1"}
package-lock.json
{
  "name": "sample-minipass",
  "version": "1.0.0",
  "lockfileVersion": 3,
  "requires": true,
  "packages": {
    "": {
      "name": "sample-minipass",
      "version": "1.0.0",
      "license": "MIT-0",
      "dependencies": {
        "minipass": "7.1.3"
      }
    },
    "node_modules/minipass": {
      "version": "7.1.3",
      "resolved": "https://registry.npmjs.org/minipass/-/minipass-7.1.3.tgz",
      "integrity": "sha512-tEBHqDnIoM/1rXME1zgka9g6Q2lcoCkxHLuc7ODJ5BxbP5d4c2Z5cGgtXAku59200Cx7diuHTOYfSBD8n6mm8A==",
      "license": "BlueOak-1.0.0",
      "engines": {
        "node": ">=16 || 14 >=14.17"
      }
    }
  }
}
package.json
{
  "name": "sample-minipass",
  "version": "1.0.0",
  "private": true,
  "description": "Clean-room verification sample for minipass",
  "main": "src/index.js",
  "scripts": {
    "test": "node test/contract.js"
  },
  "dependencies": {
    "minipass": "7.1.3"
  },
  "license": "MIT-0"
}
spec.json
{
  "schemaVersion": 1,
  "goal": "verify pkg:npm/minipass@7.1.3",
  "kind": "HOW",
  "packages": [
    "pkg:npm/minipass@7.1.3"
  ],
  "constraints": {
    "executionContext": "node"
  },
  "runtimeConditions": {
    "ecosystem": "npm",
    "language": "javascript",
    "moduleSystem": "cjs",
    "packageManager": "npm@10.9.8",
    "runtime": "node@22.23.2"
  }
}
src/index.js
const { Minipass, isStream, isReadable, isWritable } = require("minipass");

function createStream(options = {}) {
  return new Minipass(options);
}

function streamToString(stream) {
  return stream.concat();
}

function streamToArray(stream) {
  return stream.collect();
}

function pipeStreams(src, dest) {
  return src.pipe(dest);
}

module.exports = {
  Minipass,
  isStream,
  isReadable,
  isWritable,
  createStream,
  streamToString,
  streamToArray,
  pipeStreams
};
test/contract.js
const assert = require("node:assert");
const { Minipass, isStream, isReadable, isWritable } = require("minipass");
const {
  createStream,
  streamToString,
  streamToArray,
  pipeStreams
} = require("../src/index.js");

async function main() {
  // 1. Minipass instance emits data events synchronously as chunks are written
  {
    const stream = createStream({ encoding: "utf8" });
    const received = [];
    stream.on("data", (chunk) => {
      received.push(chunk);
    });
    assert.strictEqual(received.length, 0, "no data before write");
    stream.write("hello ");
    assert.strictEqual(received.length, 1, "data emitted synchronously on write");
    assert.strictEqual(received[0], "hello ");
    stream.write("world");
    assert.strictEqual(received.length, 2, "second write emitted synchronously");
    assert.strictEqual(received[1], "world");
    stream.end();
  }

  // 2. Minipass buffers written chunks and delivers them when read is called
  {
    const stream = createStream({ encoding: "utf8" });
    stream.write("chunk1");
    stream.write("chunk2");
    assert.strictEqual(stream.read(6), "chunk1", "read(size) returns requested chunk size");
    assert.strictEqual(stream.read(), "chunk2", "read() returns remaining buffer");
    assert.strictEqual(stream.read(), null, "read() returns null when buffer is empty");
  }

  // 3. Minipass.concat() asynchronously accumulates written chunks into a single string
  {
    const stream = createStream({ encoding: "utf8" });
    stream.write("alpha-");
    stream.write("beta-");
    stream.write("gamma");
    stream.end();
    const result = await streamToString(stream);
    assert.strictEqual(result, "alpha-beta-gamma", "concat resolves full string");
  }

  // 4. Minipass.collect() asynchronously accumulates stream chunks into an array
  {
    const stream = createStream({ objectMode: true });
    stream.write({ id: 1 });
    stream.write({ id: 2 });
    stream.end();
    const result = await streamToArray(stream);
    assert.strictEqual(Array.isArray(result), true, "collect returns an array");
    assert.deepStrictEqual([...result], [{ id: 1 }, { id: 2 }], "collect resolves array of chunks");
  }

  // 5. Minipass.pipe() forwards written chunks between streams with flow control
  {
    const src = createStream({ encoding: "utf8" });
    const dest = createStream({ encoding: "utf8" });
    pipeStreams(src, dest);
    src.write("piped-chunk-1");
    src.write("piped-chunk-2");
    src.end();
    const result = await dest.concat();
    assert.strictEqual(result, "piped-chunk-1piped-chunk-2", "pipe forwards all data to destination");
  }

  // 6. Minipass objectMode preserves JavaScript objects without buffer coercion
  {
    const stream = createStream({ objectMode: true });
    const items = [];
    stream.on("data", (item) => items.push(item));
    stream.write({ key: "val1" });
    stream.write({ key: "val2" });
    stream.end();
    assert.deepStrictEqual(items, [{ key: "val1" }, { key: "val2" }], "objectMode preserves objects");
  }

  // 7. isStream, isReadable, and isWritable correctly identify Minipass stream instances
  {
    const stream = new Minipass();
    assert.strictEqual(isStream(stream), true, "isStream identifies Minipass");
    assert.strictEqual(isReadable(stream), true, "isReadable is true for Minipass");
    assert.strictEqual(isWritable(stream), true, "isWritable is true for Minipass");
    assert.strictEqual(isStream({}), false, "plain object is not a stream");
    assert.strictEqual(isReadable({}), false, "plain object is not readable");
    assert.strictEqual(isWritable({}), false, "plain object is not writable");
  }

  console.log("All pkg:npm/minipass@7.1.3 contract assertions passed successfully.");
}

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

Ursprungs-Seeder

anonym