Exemple
tapable 2.3.3: AsyncSeriesHook
Échantillon vérifié pour npm tapable 2.3.3: AsyncSeriesHook. Le contrat s'est exécuté sur node 22 · linux alpine/x64 · docker et a réussi.
sha256:66e821ac6c215e9d192bcd8a39d2e277759c44538248c1d67c7a1f6c47dadf7f
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é
linux 24 · ubuntu · glibc 2.39 x64 npm
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@1node:22-alpine@sha256:c610fcdfb1d5… |
2026-08-27 |
Cas
HOW- Objectif
- verify tapable.AsyncSeriesHook in pkg:npm/tapable@2.3.3
- Paquets
- Symboles
-
- tapable.AsyncSeriesHook
- Créé
- 2026-08-27T10:44:30Z
Contrat
- AsyncSeriesHook executes synchronous tapped functions sequentially in series with promise()
- AsyncSeriesHook executes asynchronous tapped functions sequentially in series with callAsync()
- AsyncSeriesHook executes promise-returning tapped functions sequentially in series with promise()
- AsyncSeriesHook passes arguments to all tapped functions
- AsyncSeriesHook halts execution and passes error to callback when a tapAsync plugin reports an error
- AsyncSeriesHook halts execution and rejects promise when a tapPromise plugin throws an error
Fichiers
- PROMPT.md
- csx.json
- index.js
- package-lock.json
- package.json
- spec.json
- 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 tapable.AsyncSeriesHook in pkg:npm/tapable@2.3.3
Kind: HOW
Use EXACTLY these public packages and versions:
- pkg:npm/tapable@2.3.3
Demonstrate these symbols/APIs:
- tapable.AsyncSeriesHook
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:73d96b9f8ad27fb4a9b50f99d4c57dbb4c56d9db486f2cb4af938aab79a598ed","contract":["AsyncSeriesHook executes synchronous tapped functions sequentially in series with promise()","AsyncSeriesHook executes asynchronous tapped functions sequentially in series with callAsync()","AsyncSeriesHook executes promise-returning tapped functions sequentially in series with promise()","AsyncSeriesHook passes arguments to all tapped functions","AsyncSeriesHook halts execution and passes error to callback when a tapAsync plugin reports an error","AsyncSeriesHook halts execution and rejects promise when a tapPromise plugin throws an error"],"goal":"verify tapable.AsyncSeriesHook in pkg:npm/tapable@2.3.3","kind":"HOW","packages":["pkg:npm/tapable@2.3.3"],"schemaVersion":1,"symbols":["tapable.AsyncSeriesHook"]},"contractCommand":["node","test/contract.js"],"environment":{"arch":"x64","distro":"ubuntu","ecosystem":"npm","libc":"glibc","libcVersion":"2.39","os":"linux","osVersionBucket":"24","packageManager":"npm","schemaVersion":1},"license":"MIT-0","packages":["pkg:npm/tapable@2.3.3"],"schemaVersion":1,"subject":"pkg:npm/tapable@2.3.3","symbols":["tapable.AsyncSeriesHook"],"verifierAdapter":"node-typescript@1"}
'use strict';
const { AsyncSeriesHook } = require('tapable');
function createAsyncSeriesHook(args) {
return new AsyncSeriesHook(args);
}
module.exports = {
AsyncSeriesHook,
createAsyncSeriesHook
};
{
"name": "sample-tapable-asyncserieshook",
"version": "1.0.0",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "sample-tapable-asyncserieshook",
"version": "1.0.0",
"license": "MIT-0",
"dependencies": {
"tapable": "2.3.3"
}
},
"node_modules/tapable": {
"version": "2.3.3",
"resolved": "https://registry.npmjs.org/tapable/-/tapable-2.3.3.tgz",
"integrity": "sha512-uxc/zpqFg6x7C8vOE7lh6Lbda8eEL9zmVm/PLeTPBRhh1xCgdWaQ+J1CUieGpIfm2HdtsUpRv+HshiasBMcc6A==",
"license": "MIT",
"engines": {
"node": ">=6"
},
"funding": {
"type": "opencollective",
"url": "https://opencollective.com/webpack"
}
}
}
}
{
"name": "sample-tapable-asyncserieshook",
"version": "1.0.0",
"description": "verify tapable.AsyncSeriesHook in pkg:npm/tapable@2.3.3",
"main": "index.js",
"scripts": {
"test": "node test/contract.js"
},
"license": "MIT-0",
"dependencies": {
"tapable": "2.3.3"
}
}
{
"schemaVersion": 1,
"goal": "verify tapable.AsyncSeriesHook in pkg:npm/tapable@2.3.3",
"kind": "HOW",
"packages": [
"pkg:npm/tapable@2.3.3"
],
"symbols": [
"tapable.AsyncSeriesHook"
]
}
'use strict';
const assert = require('assert');
const { AsyncSeriesHook, createAsyncSeriesHook } = require('../index.js');
async function testContract() {
// 1. AsyncSeriesHook executes synchronous tapped functions sequentially in series with promise()
{
const hook = createAsyncSeriesHook(['arg1', 'arg2']);
const order = [];
hook.tap('Sync1', (a, b) => {
order.push(`sync1:${a}:${b}`);
});
hook.tap('Sync2', (a, b) => {
order.push(`sync2:${a}:${b}`);
});
await hook.promise('alpha', 'beta');
assert.deepStrictEqual(order, ['sync1:alpha:beta', 'sync2:alpha:beta']);
}
// 2. AsyncSeriesHook executes asynchronous tapped functions sequentially in series with callAsync()
{
const hook = new AsyncSeriesHook(['arg']);
const order = [];
hook.tapAsync('Async1', (arg, callback) => {
setTimeout(() => {
order.push(`async1:${arg}`);
callback();
}, 15);
});
hook.tapAsync('Async2', (arg, callback) => {
setTimeout(() => {
order.push(`async2:${arg}`);
callback();
}, 5);
});
await new Promise((resolve, reject) => {
hook.callAsync('payload', (err) => {
if (err) return reject(err);
resolve();
});
});
assert.deepStrictEqual(order, ['async1:payload', 'async2:payload']);
}
// 3. AsyncSeriesHook executes promise-returning tapped functions sequentially in series with promise()
{
const hook = new AsyncSeriesHook(['item']);
const order = [];
hook.tapPromise('Promise1', async (item) => {
await new Promise((resolve) => setTimeout(resolve, 15));
order.push(`promise1:${item}`);
});
hook.tapPromise('Promise2', async (item) => {
await new Promise((resolve) => setTimeout(resolve, 5));
order.push(`promise2:${item}`);
});
await hook.promise('itemValue');
assert.deepStrictEqual(order, ['promise1:itemValue', 'promise2:itemValue']);
}
// 4. AsyncSeriesHook passes arguments to all tapped functions
{
const hook = new AsyncSeriesHook(['first', 'second', 'third']);
const receivedArgs = [];
hook.tap('TapSync', (a, b, c) => {
receivedArgs.push(['sync', a, b, c]);
});
hook.tapAsync('TapAsync', (a, b, c, callback) => {
receivedArgs.push(['async', a, b, c]);
callback();
});
hook.tapPromise('TapPromise', async (a, b, c) => {
receivedArgs.push(['promise', a, b, c]);
});
await hook.promise(10, 20, 30);
assert.deepStrictEqual(receivedArgs, [
['sync', 10, 20, 30],
['async', 10, 20, 30],
['promise', 10, 20, 30]
]);
}
// 5. AsyncSeriesHook halts execution and passes error to callback when a tapAsync plugin reports an error
{
const hook = new AsyncSeriesHook(['val']);
const log = [];
hook.tapAsync('SuccessPlugin', (val, callback) => {
log.push('success');
callback();
});
hook.tapAsync('FailPlugin', (val, callback) => {
log.push('fail');
callback(new Error('async callback error'));
});
hook.tapAsync('UnreachablePlugin', (val, callback) => {
log.push('unreachable');
callback();
});
await new Promise((resolve, reject) => {
hook.callAsync('test', (err) => {
assert(err instanceof Error, 'Expected error to be passed to callback');
assert.strictEqual(err.message, 'async callback error');
resolve();
});
});
assert.deepStrictEqual(log, ['success', 'fail']);
}
// 6. AsyncSeriesHook halts execution and rejects promise when a tapPromise plugin throws an error
{
const hook = new AsyncSeriesHook(['val']);
const log = [];
hook.tapPromise('SuccessPromise', async (val) => {
log.push('success');
});
hook.tapPromise('FailPromise', async (val) => {
log.push('fail');
throw new Error('promise rejection error');
});
hook.tapPromise('UnreachablePromise', async (val) => {
log.push('unreachable');
});
await assert.rejects(
() => hook.promise('test'),
{
name: 'Error',
message: 'promise rejection error'
}
);
assert.deepStrictEqual(log, ['success', 'fail']);
}
console.log('Contract tests passed successfully.');
}
testContract().catch((err) => {
console.error('Contract test failed:', err);
process.exit(1);
});
Seeder d'origine
anonyme