Beispiel
path-to-regexp 8.4.2
Verifiziertes Beispiel für npm path-to-regexp 8.4.2. Der Vertrag lief auf node 22 · linux alpine/x64 · docker und bestand: match(path) matches named…
sha256:d1885bc270eecc923f7bb07b638a5c8f1ebe40ef4e319b50a89eac3250a32caa
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
- 2
- Signaturschlüssel, die es gebaut haben
- 1
Deklarierte Umgebung
linux 24 · ubuntu · glibc 2.39 x64 npm
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-20 |
| 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-07 |
Fall
HOW- Ziel
- verify pkg:npm/path-to-regexp@8.4.2
- Pakete
- Erstellt
- 2026-08-20T13:56:46Z
Contract
- match(path) matches named parameters and returns the matched path and decoded parameter object
- match(path) matches wildcard parameters (*splat) capturing multi-segment paths as an array of decoded strings
- match(path) matches optional path segments wrapped in braces ({/:id}) returning empty parameters when omitted
- compile(path) transforms a parameter object into a URL path string, properly encoding parameter values
- compile(path) transforms array parameters for wildcard segments into delimited path segments
- pathToRegexp(path) returns an object containing a RegExp instance and keys array matching parameter definitions
- parse(path) produces a TokenData structure and stringify(data) reconstructs the pattern string
- match and parse throw PathError for invalid path syntax such as missing parameter names or unclosed braces
Dateien
- PROMPT.md
- csx.json
- package-lock.json
- package.json
- spec.json
- test/contract.mjs
Quelltext
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/path-to-regexp@8.4.2
Kind: HOW
Use EXACTLY these public packages and versions:
- pkg:npm/path-to-regexp@8.4.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:96b645ab77405c5cd3b9c872e3aeb6e09a0cdba338ed96d7b661a7119af9d786","contract":["match(path) matches named parameters and returns the matched path and decoded parameter object","match(path) matches wildcard parameters (*splat) capturing multi-segment paths as an array of decoded strings","match(path) matches optional path segments wrapped in braces ({/:id}) returning empty parameters when omitted","compile(path) transforms a parameter object into a URL path string, properly encoding parameter values","compile(path) transforms array parameters for wildcard segments into delimited path segments","pathToRegexp(path) returns an object containing a RegExp instance and keys array matching parameter definitions","parse(path) produces a TokenData structure and stringify(data) reconstructs the pattern string","match and parse throw PathError for invalid path syntax such as missing parameter names or unclosed braces"],"goal":"verify pkg:npm/path-to-regexp@8.4.2","kind":"HOW","packages":["pkg:npm/path-to-regexp@8.4.2"],"schemaVersion":1},"contractCommand":["node","test/contract.mjs"],"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/path-to-regexp@8.4.2"],"schemaVersion":1,"verifierAdapter":"node-typescript@1"}
{
"name": "sample-path-to-regexp",
"version": "1.0.0",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "sample-path-to-regexp",
"version": "1.0.0",
"dependencies": {
"path-to-regexp": "8.4.2"
}
},
"node_modules/path-to-regexp": {
"version": "8.4.2",
"resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-8.4.2.tgz",
"integrity": "sha512-qRcuIdP69NPm4qbACK+aDogI5CBDMi1jKe0ry5rSQJz8JVLsC7jV8XpiJjGRLLol3N+R5ihGYcrPLTno6pAdBA==",
"license": "MIT"
}
}
}
{
"name": "sample-path-to-regexp",
"version": "1.0.0",
"type": "module",
"private": true,
"dependencies": {
"path-to-regexp": "8.4.2"
}
}
{
"schemaVersion": 1,
"goal": "verify pkg:npm/path-to-regexp@8.4.2",
"kind": "HOW",
"packages": [
"pkg:npm/path-to-regexp@8.4.2"
]
}
import assert from 'node:assert/strict';
import { match, compile, pathToRegexp, parse, stringify, PathError } from 'path-to-regexp';
// 1. match(path) matches named parameters and returns the matched path and decoded parameter object
const matchNamed = match('/users/:id/profile');
const matchNamedResult = matchNamed('/users/42/profile');
assert.notEqual(matchNamedResult, false);
assert.equal(matchNamedResult.path, '/users/42/profile');
assert.equal(matchNamedResult.params.id, '42');
assert.equal(matchNamed('/other/42/profile'), false);
// 2. match(path) matches wildcard parameters (*splat) capturing multi-segment paths as an array of decoded strings
const matchWild = match('/files/*splat');
const matchWildResult = matchWild('/files/docs/2026/report.pdf');
assert.notEqual(matchWildResult, false);
assert.equal(matchWildResult.path, '/files/docs/2026/report.pdf');
assert.deepEqual(matchWildResult.params.splat, ['docs', '2026', 'report.pdf']);
// 3. match(path) matches optional path segments wrapped in braces ({/:id}) returning empty parameters when omitted
const matchOpt = match('/users{/:id}');
const matchOptWith = matchOpt('/users/99');
assert.notEqual(matchOptWith, false);
assert.equal(matchOptWith.params.id, '99');
const matchOptWithout = matchOpt('/users');
assert.notEqual(matchOptWithout, false);
assert.equal(matchOptWithout.params.id, undefined);
assert.deepEqual(Object.keys(matchOptWithout.params), []);
// 4. compile(path) transforms a parameter object into a URL path string, properly encoding parameter values
const compileUser = compile('/users/:id');
assert.equal(compileUser({ id: 'alice' }), '/users/alice');
assert.equal(compileUser({ id: 'café' }), '/users/caf%C3%A9');
// 5. compile(path) transforms array parameters for wildcard segments into delimited path segments
const compileFiles = compile('/files/*splat');
assert.equal(compileFiles({ splat: ['docs', 'report.pdf'] }), '/files/docs/report.pdf');
// 6. pathToRegexp(path) returns an object containing a RegExp instance and keys array matching parameter definitions
const { regexp, keys } = pathToRegexp('/posts/:slug');
assert(regexp instanceof RegExp);
assert.equal(keys.length, 1);
assert.equal(keys[0].name, 'slug');
assert.equal(keys[0].type, 'param');
assert(regexp.test('/posts/announcement'));
assert(!regexp.test('/articles/announcement'));
// 7. parse(path) produces a TokenData structure and stringify(data) reconstructs the pattern string
const tokenData = parse('/items/:category/:id');
assert.equal(tokenData.originalPath, '/items/:category/:id');
assert.equal(tokenData.tokens.length, 4);
assert.equal(stringify(tokenData), '/items/:category/:id');
// 8. match and parse throw PathError for invalid path syntax such as missing parameter names or unclosed braces
assert.throws(() => match('/invalid/:'), (err) => {
return err instanceof PathError && /Missing parameter name/.test(err.message);
});
assert.throws(() => parse('/unclosed/{group'), (err) => {
return err instanceof PathError && /Unexpected end/.test(err.message);
});
console.log('Contract tests passed successfully.');
Ursprungs-Seeder
anonym