Exemple
@types/markdown-it 14.2.0
Échantillon vérifié pour npm @types/markdown-it 14.2.0. Le contrat s'est exécuté sur node 22 · linux debian/x64 · docker et a réussi.
sha256:807dac4223fe8eccf05f9da10537ff92b9444547201ecf8beee0ba20705bf9ab
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 debian/x64 · docker ed25519:c1973797be207ac4 | PASS | compile:SKIPPED · contract:PASS · load:PASS · resolve:PASS CONTAINER_RUN · node-typescript@1node:22@sha256:8a34c4ab3ea2… |
2026-09-15 |
Cas
HOW- Objectif
- verify pkg:npm/%40types/markdown-it@14.2.0
- Paquets
- Environnement
- node 22.23.2
- Créé
- 2026-09-15T04:19:33Z
Contrat
- package manifest specifies index.d.ts type declarations and TypeScript version 5.6
- exports ESM module declarations with MarkdownIt, Options, and Parser type definitions
- exports CommonJS declarations with MarkdownIt constructor supporting presets and options
- declares MarkdownIt interface with parser, renderer, linkify, and rule configuration methods
- declares Token class with tag, nesting, content, and attribute manipulation methods
Fichiers
- PROMPT.md
- csx.json
- package-lock.json
- package.json
- spec.json
- test/contract.mjs
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/%40types/markdown-it@14.2.0
Kind: HOW
Use EXACTLY these public packages and versions:
- pkg:npm/%40types/markdown-it@14.2.0
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:61191f7dea4332e738a5284cb5046009d7b0ab9ebd1851e543ba8132457f83f8","contract":["package manifest specifies index.d.ts type declarations and TypeScript version 5.6","exports ESM module declarations with MarkdownIt, Options, and Parser type definitions","exports CommonJS declarations with MarkdownIt constructor supporting presets and options","declares MarkdownIt interface with parser, renderer, linkify, and rule configuration methods","declares Token class with tag, nesting, content, and attribute manipulation methods"],"goal":"verify pkg:npm/%40types/markdown-it@14.2.0","kind":"HOW","packages":["pkg:npm/%40types/markdown-it@14.2.0"],"schemaVersion":1},"contractCommand":["node","test/contract.mjs"],"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/%40types/markdown-it@14.2.0"],"schemaVersion":1,"subject":"pkg:npm/%40types/markdown-it@14.2.0","verifierAdapter":"node-typescript@1"}
{
"name": "sample-types-markdown-it",
"version": "1.0.0",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "sample-types-markdown-it",
"version": "1.0.0",
"license": "MIT-0",
"dependencies": {
"@types/markdown-it": "14.2.0"
}
},
"node_modules/@types/linkify-it": {
"version": "5.0.0",
"resolved": "https://registry.npmjs.org/@types/linkify-it/-/linkify-it-5.0.0.tgz",
"integrity": "sha512-sVDA58zAw4eWAffKOaQH5/5j3XeayukzDk+ewSsnv3p4yJEZHCCzMDiZM8e0OUrRvmpGZ85jf4yDHkHsgBNr9Q==",
"license": "MIT"
},
"node_modules/@types/markdown-it": {
"version": "14.2.0",
"resolved": "https://registry.npmjs.org/@types/markdown-it/-/markdown-it-14.2.0.tgz",
"integrity": "sha512-NoQ2yGlLWj4wpxMs+TYmRKk3thDrQ97agr7sFqfLsAlvoS8SNQuTrlObhFqG9iugdTtgOE9jpJ6FNM4ZGsa5xQ==",
"license": "MIT",
"dependencies": {
"@types/linkify-it": "^5",
"@types/mdurl": "^2"
}
},
"node_modules/@types/mdurl": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/@types/mdurl/-/mdurl-2.0.0.tgz",
"integrity": "sha512-RGdgjQUZba5p6QEFAVx2OGb8rQDL/cPRG7GiedRzMcJ1tYnUANBncjbSB1NRGwbvjcPeikRABz2nshyPk1bhWg==",
"license": "MIT"
}
}
}
{
"name": "sample-types-markdown-it",
"version": "1.0.0",
"private": true,
"type": "module",
"license": "MIT-0",
"dependencies": {
"@types/markdown-it": "14.2.0"
}
}
{
"schemaVersion": 1,
"goal": "verify pkg:npm/%40types/markdown-it@14.2.0",
"kind": "HOW",
"packages": [
"pkg:npm/%40types/markdown-it@14.2.0"
]
}
import assert from 'node:assert/strict';
import { createRequire } from 'node:module';
import fs from 'node:fs';
import path from 'node:path';
const require = createRequire(import.meta.url);
// 1. Resolve @types/markdown-it package manifest and verify package metadata and exports
const pkgPath = require.resolve('@types/markdown-it/package.json');
const pkg = JSON.parse(fs.readFileSync(pkgPath, 'utf8'));
assert.equal(pkg.name, '@types/markdown-it', 'Package name must be @types/markdown-it');
assert.equal(pkg.version, '14.2.0', 'Package version must be 14.2.0');
assert.equal(pkg.types, 'index.d.ts', 'Package types entry must point to index.d.ts');
assert.equal(pkg.typeScriptVersion, '5.6', 'TypeScript version must be 5.6');
assert.ok(pkg.exports && pkg.exports['.'], 'Package must define root exports map');
assert.equal(pkg.exports['.'].import, './index.d.mts', 'Root ESM export must point to ./index.d.mts');
assert.equal(pkg.exports['.'].require, './dist/index.cjs.d.ts', 'Root CJS export must point to ./dist/index.cjs.d.ts');
assert.ok(pkg.dependencies && pkg.dependencies['@types/linkify-it'], 'Package must depend on @types/linkify-it');
assert.ok(pkg.dependencies && pkg.dependencies['@types/mdurl'], 'Package must depend on @types/mdurl');
const typesDir = path.dirname(pkgPath);
// 2. Verify ESM type declarations in index.d.mts
const esmDts = fs.readFileSync(path.join(typesDir, 'index.d.mts'), 'utf8');
assert.ok(
esmDts.includes('default') &&
esmDts.includes('type default as MarkdownIt') &&
esmDts.includes('Options') &&
esmDts.includes('PresetName'),
'index.d.mts must re-export default MarkdownIt, Options, and PresetName'
);
assert.ok(
esmDts.includes('export type { default as ParserBlock } from "./lib/parser_block.mts";') &&
esmDts.includes('export type { default as ParserCore } from "./lib/parser_core.mts";') &&
esmDts.includes('export type { default as ParserInline } from "./lib/parser_inline.mts";') &&
esmDts.includes('export type { default as Renderer, RenderRule as RendererRule } from "./lib/renderer.mts";') &&
esmDts.includes('export type { default as Token } from "./lib/token.mts";'),
'index.d.mts must export parser, renderer, and token types'
);
// 3. Verify CommonJS entry in index.d.ts and dist/index.cjs.d.ts
const cjsDts = fs.readFileSync(path.join(typesDir, 'index.d.ts'), 'utf8');
assert.ok(
cjsDts.includes('import MarkdownIt = require("./dist/index.cjs.js");') &&
cjsDts.includes('export = MarkdownIt;'),
'index.d.ts must export MarkdownIt via CommonJS export assignment'
);
const distCjsDts = fs.readFileSync(path.join(typesDir, 'dist/index.cjs.d.ts'), 'utf8');
assert.ok(
distCjsDts.includes('declare const MarkdownIt: MarkdownItConstructor;') &&
distCjsDts.includes('export = MarkdownIt;'),
'dist/index.cjs.d.ts must declare MarkdownIt constructor and export = MarkdownIt'
);
assert.ok(
distCjsDts.includes('type PresetName = "default" | "zero" | "commonmark";'),
'dist/index.cjs.d.ts must define PresetName type'
);
// 4. Verify MarkdownIt interface methods and options
assert.ok(
distCjsDts.includes('interface Options {') &&
distCjsDts.includes('html?: boolean | undefined;') &&
distCjsDts.includes('linkify?: boolean | undefined;') &&
distCjsDts.includes('typographer?: boolean | undefined;') &&
distCjsDts.includes('highlight?: ((str: string, lang: string, attrs: string) => string) | null | undefined;'),
'Options interface must declare markdown configuration fields'
);
assert.ok(
distCjsDts.includes('interface MarkdownIt {') &&
distCjsDts.includes('render(src: string, env?: any): string;') &&
distCjsDts.includes('renderInline(src: string, env?: any): string;') &&
distCjsDts.includes('parse(src: string, env: any): Token[];') &&
distCjsDts.includes('parseInline(src: string, env: any): Token[];') &&
distCjsDts.includes('use(plugin: MarkdownIt.PluginSimple): this;') &&
distCjsDts.includes('enable(list: string | string[], ignoreInvalid?: boolean): this;') &&
distCjsDts.includes('disable(list: string | string[], ignoreInvalid?: boolean): this;'),
'MarkdownIt interface must declare core render, parse, and configuration methods'
);
// 5. Verify Token class and attribute manipulation declarations
assert.ok(
distCjsDts.includes('declare class Token {') &&
distCjsDts.includes('type: string;') &&
distCjsDts.includes('tag: string;') &&
distCjsDts.includes('attrs: Array<[string, string]> | null;') &&
distCjsDts.includes('nesting: MarkdownIt.Token.Nesting;') &&
distCjsDts.includes('level: number;') &&
distCjsDts.includes('children: Token[] | null;') &&
distCjsDts.includes('content: string;') &&
distCjsDts.includes('attrIndex(name: string): number;') &&
distCjsDts.includes('attrPush(attrData: [string, string]): void;') &&
distCjsDts.includes('attrSet(name: string, value: string): void;') &&
distCjsDts.includes('attrGet(name: string): string | null;') &&
distCjsDts.includes('attrJoin(name: string, value: string): void;'),
'Token class must declare token structure and attribute manipulation methods'
);
console.log('Contract tests passed successfully.');
Seeder d'origine
anonyme