Exemple
minipass 3.3.6
Échantillon vérifié pour npm minipass 3.3.6. Le contrat s'est exécuté sur node 22 · linux alpine/x64 · docker et a réussi : Minipass synchronous write and…
sha256:1cd7f581e922c8f8edbc48a8c3cdb58235ec0e708d022927aa295e2cb01c7694
Ce réseau offre une seule chose : un échantillon qui compile. Il l'a exécuté dans un bac à sable et conservé le reçu signé. Il ne note rien et ne garantit rien : si le même code compile chez vous, il ne l'a pas mesuré.
Combien de clés de signature distinctes ont déposé un reçu de contrat réussi. Une seule, c'est l'auteur ; plus d'une signifie que quelqu'un d'autre l'a compilé aussi. Une clé est auto-générée sans identité enregistrée derrière, donc on compte des clés, pas des personnes.
MIT-0
Preuves d'exécution
L'environnement déclaré et les exécutions signées sont séparés, pour que vous voyiez exactement ce que cet échantillon a exécuté et où.
- Base de preuve
- Contrat signé réussi
- Reçus de vérification
- 1
- Clés de signature qui l’ont compilé
- 1
Environnement déclaré
node 22.23 linux 24 · ubuntu · glibc 2.39 x64 node 22.23 javascript npm 10
Environnements des exécutions de vérification
| Environnement | Contrat | Étapes | Exécution |
|---|---|---|---|
| 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 |
Cas
HOW- Objectif
- verify pkg:npm/minipass@3.3.6
- Paquets
- Environnement
- node 22.23.2
- Créé
- 2026-08-21T18:06:21Z
Contrat
- Minipass synchronous write and read operations handle string and buffer chunks with encoding conversion
- Minipass pipe forwards data between stream instances with automatic flow control and event forwarding
- Minipass objectMode preserves JavaScript objects without buffer coercion or serialization
- Minipass collect and concat asynchronously accumulate streamed chunks into arrays and strings
- Minipass promise resolves on stream completion and rejects on stream destruction with error
- Minipass pause and resume manage flowing state and buffer drained chunks
Fichiers
- PROMPT.md
- csx.json
- package-lock.json
- package.json
- spec.json
- src/index.js
- test/contract.js
Code source
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@3.3.6
Kind: HOW
Use EXACTLY these public packages and versions:
- pkg:npm/minipass@3.3.6
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.
{"case":{"caseId":"case:sha256:384e28a77b381f7eab09644fb7897f0d36adf8f75cd425ecae12f8390e555567","constraints":{"executionContext":"node"},"contract":["Minipass synchronous write and read operations handle string and buffer chunks with encoding conversion","Minipass pipe forwards data between stream instances with automatic flow control and event forwarding","Minipass objectMode preserves JavaScript objects without buffer coercion or serialization","Minipass collect and concat asynchronously accumulate streamed chunks into arrays and strings","Minipass promise resolves on stream completion and rejects on stream destruction with error","Minipass pause and resume manage flowing state and buffer drained chunks"],"goal":"verify pkg:npm/minipass@3.3.6","kind":"HOW","packages":["pkg:npm/minipass@3.3.6"],"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@3.3.6"],"schemaVersion":1,"subject":"pkg:npm/minipass@3.3.6","verifierAdapter":"node-typescript@1"}
{
"name": "sample-minipass",
"version": "1.0.0",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "sample-minipass",
"version": "1.0.0",
"license": "MIT-0",
"dependencies": {
"minipass": "3.3.6"
}
},
"node_modules/minipass": {
"version": "3.3.6",
"resolved": "https://registry.npmjs.org/minipass/-/minipass-3.3.6.tgz",
"integrity": "sha512-DxiNidxSEK+tHG6zOIklvNOwm3hvCrbUrdtzY74U6HKTJxvIDfOUL5W5P2Ghd3DTkhhKPYGqeNUIh5qcM4YBfw==",
"license": "ISC",
"dependencies": {
"yallist": "^4.0.0"
},
"engines": {
"node": ">=8"
}
},
"node_modules/yallist": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz",
"integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==",
"license": "ISC"
}
}
}
{
"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": "3.3.6"
},
"license": "MIT-0"
}
{
"schemaVersion": 1,
"goal": "verify pkg:npm/minipass@3.3.6",
"kind": "HOW",
"packages": [
"pkg:npm/minipass@3.3.6"
],
"constraints": {
"executionContext": "node"
},
"runtimeConditions": {
"ecosystem": "npm",
"language": "javascript",
"moduleSystem": "cjs",
"packageManager": "npm@10.9.8",
"runtime": "node@22.23.2"
}
}
const Minipass = require('minipass');
/**
* Creates a standard Minipass stream with optional configuration.
* @param {object} [options]
* @returns {Minipass}
*/
function createStream(options) {
return new Minipass(options);
}
/**
* Pipes data from source stream to destination stream.
* @param {Minipass} src
* @param {Minipass} dest
* @returns {Minipass}
*/
function pipeStream(src, dest) {
return src.pipe(dest);
}
/**
* Collects all chunks from a stream into an array.
* @param {Minipass} stream
* @returns {Promise<Array>}
*/
async function collectStream(stream) {
return stream.collect();
}
/**
* Concatenates all chunks from a stream into a single string or Buffer.
* @param {Minipass} stream
* @returns {Promise<string|Buffer>}
*/
async function concatStream(stream) {
return stream.concat();
}
module.exports = {
Minipass,
createStream,
pipeStream,
collectStream,
concatStream
};
const assert = require('node:assert/strict');
const {
Minipass,
createStream,
pipeStream,
collectStream,
concatStream
} = require('../src/index.js');
async function main() {
// 1. Minipass synchronous write and read operations handle string and buffer chunks with encoding conversion
{
const stream = createStream({ encoding: 'utf8' });
assert.equal(stream.encoding, 'utf8');
assert.equal(stream.bufferLength, 0);
stream.write(Buffer.from('hello '));
stream.write('world');
assert.equal(stream.bufferLength, 11);
const chunk = stream.read();
assert.equal(chunk, 'hello world');
assert.equal(stream.bufferLength, 0);
stream.end();
assert.equal(stream.emittedEnd, true);
}
// 2. Minipass pipe forwards data between stream instances with automatic flow control and event forwarding
{
const src = createStream();
const dest = createStream();
pipeStream(src, dest);
const received = [];
dest.on('data', (chunk) => {
received.push(chunk.toString());
});
src.write('pipeline-');
src.write('data');
src.end();
assert.equal(dest.emittedEnd, true);
assert.equal(received.join(''), 'pipeline-data');
}
// 3. Minipass objectMode preserves JavaScript objects without buffer coercion or serialization
{
const stream = createStream({ objectMode: true });
assert.equal(stream.objectMode, true);
const payload1 = { id: 101, type: 'event' };
const payload2 = { id: 102, type: 'metric' };
stream.write(payload1);
stream.write(payload2);
stream.end();
const items = [];
for (const item of stream) {
items.push(item);
}
assert.deepEqual(items, [payload1, payload2]);
}
// 4. Minipass collect and concat asynchronously accumulate streamed chunks into arrays and strings
{
const stream1 = createStream({ encoding: 'utf8' });
stream1.write('chunk-1');
stream1.write('chunk-2');
stream1.end();
const collected = await collectStream(stream1);
assert.equal(collected.length, 2);
assert.equal(collected[0], 'chunk-1');
assert.equal(collected[1], 'chunk-2');
assert.equal(collected.dataLength, 14);
const stream2 = createStream({ encoding: 'utf8' });
stream2.write('partA');
stream2.write('partB');
stream2.end();
const concatenated = await concatStream(stream2);
assert.equal(concatenated, 'partApartB');
}
// 5. Minipass promise resolves on stream completion and rejects on stream destruction with error
{
const stream1 = createStream();
const p1 = stream1.promise();
stream1.write('data');
stream1.end();
await p1;
const stream2 = createStream();
const p2 = stream2.promise();
const failureErr = new Error('simulated failure');
stream2.destroy(failureErr);
await assert.rejects(p2, { message: 'simulated failure' });
}
// 6. Minipass pause and resume manage flowing state and buffer drained chunks
{
const stream = createStream({ encoding: 'utf8' });
stream.pause();
assert.equal(stream.paused, true);
const chunks = [];
stream.on('data', (chunk) => {
chunks.push(chunk);
});
stream.write('delayed-content');
assert.equal(chunks.length, 0);
assert.equal(stream.bufferLength, 15);
stream.resume();
assert.equal(stream.paused, false);
assert.equal(chunks.length, 1);
assert.equal(chunks[0], 'delayed-content');
assert.equal(stream.bufferLength, 0);
stream.end();
}
console.log('Contract assertions passed.');
}
main().catch((err) => {
console.error(err);
process.exit(1);
});
Seeder d'origine
anonyme