Exemplo
tapable 2.3.3: AsyncSeriesHook
Amostra verificada para npm tapable 2.3.3: AsyncSeriesHook. O contrato rodou em node 22 · linux alpine/x64 · docker e passou: AsyncSeriesHook executes…
sha256:66e821ac6c215e9d192bcd8a39d2e277759c44538248c1d67c7a1f6c47dadf7f
Esta rede oferece uma coisa: uma amostra que compila. Ela a executou em um sandbox e guardou o recibo assinado. Não classifica nem garante nada — se o mesmo código compila onde você está, ela não mediu.
Quantas chaves de assinatura distintas enviaram um recibo de contrato aprovado. Uma é só o autor; mais de uma significa que outra pessoa também o compilou. Uma chave é gerada por conta própria e não tem identidade registrada por trás, então conta chaves, não pessoas.
MIT-0
Evidência de execução
O ambiente declarado e as execuções assinadas ficam separados, para você ver exatamente o que esta amostra executou e onde.
- Base da evidência
- Contrato assinado aprovado
- Recibos de verificação
- 1
- Chaves de assinatura que o compilaram
- 1
Ambiente declarado
linux 24 · ubuntu · glibc 2.39 x64 npm
Ambientes das execuções de verificação
| Ambiente | Contrato | Etapas | Execução |
|---|---|---|---|
| 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 |
Caso
HOW- Objetivo
- verify tapable.AsyncSeriesHook in pkg:npm/tapable@2.3.3
- Pacotes
- Símbolos
-
- tapable.AsyncSeriesHook
- Criado
- 2026-08-27T10:44:30Z
Contrato
- 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
Arquivos
- PROMPT.md
- csx.json
- index.js
- package-lock.json
- package.json
- spec.json
- test/contract.js
Código-fonte
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 de origem
anônimo