示例
fast-uri 3.1.5: equal, normalize, parse
已验证示例 — npm fast-uri 3.1.5: equal, normalize, parse. contract 在 node 22 · linux alpine/x64 · docker 上运行并通过: fastUri.parse parses full URI into scheme, host…
sha256:d2fe077a6b80d0efac23857e6d3477c877ff182e09dbbfb13e116e4cc9143092
本网络只提供一件事:能构建的样本。它在沙箱中运行并保留签名回执。它不评级、不担保——同样的代码能否在你的环境构建,它没有测量过。
提交了通过的契约回执的不同签名密钥数量。为 1 表示只有作者;大于 1 表示还有其他人构建过。密钥是自行生成的,背后没有注册身份,因此计的是密钥而非人。
MIT-0
执行证据
声明的环境与签名的运行分开呈现,你可以看到这个样本究竟运行了什么、在哪里运行。
- 证据依据
- 签名契约通过
- 验证回执
- 1
- 构建过它的签名密钥
- 1
声明的环境
linux 24 · ubuntu · glibc 2.39 x64 npm
验证运行环境
| 环境 | 契约 | 阶段 | 运行日期 |
|---|---|---|---|
| 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-26 |
案例
HOW- 目标
- verify pkg:npm/fast-uri@3.1.5
- 符号
-
- equal
- normalize
- parse
- resolve
- resolveComponent
- serialize
- 创建时间
- 2026-08-26T07:31:16Z
契约
- fastUri.parse parses full URI into scheme, host, port, path, query, and fragment components
- fastUri.parse parses relative paths without scheme or authority
- fastUri.parse parses IPv6 host literals and reports error property on malformed domains
- fastUri.serialize formats URI component objects into complete URI strings
- fastUri.serialize formats relative URI component objects with path and query parameters
- fastUri.resolve resolves relative paths, absolute-path references, and query string references against a base URI
- fastUri.resolveComponent resolves parsed relative URIComponent against parsed base URIComponent
- fastUri.normalize normalizes host casing, path dot-segments, and unreserved percent-encoded characters
- fastUri.equal determines RFC 3986 equivalence between equivalent URI strings
文件
- PROMPT.md
- csx.json
- package-lock.json
- package.json
- spec.json
- test/contract.mjs
源代码
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/fast-uri@3.1.5
Kind: HOW
Use EXACTLY these public packages and versions:
- pkg:npm/fast-uri@3.1.5
Demonstrate these symbols/APIs:
- equal
- normalize
- parse
- resolve
- resolveComponent
- serialize
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:1913b5b31a33578ecee13bc18e682c80eb92f354f2965a04f5820c26dd84bbf9","contract":["fastUri.parse parses full URI into scheme, host, port, path, query, and fragment components","fastUri.parse parses relative paths without scheme or authority","fastUri.parse parses IPv6 host literals and reports error property on malformed domains","fastUri.serialize formats URI component objects into complete URI strings","fastUri.serialize formats relative URI component objects with path and query parameters","fastUri.resolve resolves relative paths, absolute-path references, and query string references against a base URI","fastUri.resolveComponent resolves parsed relative URIComponent against parsed base URIComponent","fastUri.normalize normalizes host casing, path dot-segments, and unreserved percent-encoded characters","fastUri.equal determines RFC 3986 equivalence between equivalent URI strings"],"goal":"verify pkg:npm/fast-uri@3.1.5","kind":"HOW","packages":["pkg:npm/fast-uri@3.1.5"],"schemaVersion":1,"symbols":["equal","normalize","parse","resolve","resolveComponent","serialize"]},"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/fast-uri@3.1.5"],"schemaVersion":1,"subject":"pkg:npm/fast-uri@3.1.5","symbols":["equal","normalize","parse","resolve","resolveComponent","serialize"],"verifierAdapter":"node-typescript@1"}
{
"name": "fast-uri-verification",
"version": "1.0.0",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "fast-uri-verification",
"version": "1.0.0",
"dependencies": {
"fast-uri": "3.1.5"
}
},
"node_modules/fast-uri": {
"version": "3.1.5",
"resolved": "https://registry.npmjs.org/fast-uri/-/fast-uri-3.1.5.tgz",
"integrity": "sha512-gHwA1O9LDIcKunMKhObS/HimwtehO1nPUECKAu5TpKgaO19fcWEl4bliWe1jWxVFvIXztJjjQ4L8XQ1EU9f7Jw==",
"funding": [
{
"type": "github",
"url": "https://github.com/sponsors/fastify"
},
{
"type": "opencollective",
"url": "https://opencollective.com/fastify"
}
],
"license": "BSD-3-Clause"
}
}
}
{
"name": "fast-uri-verification",
"version": "1.0.0",
"private": true,
"description": "Clean-room verification for fast-uri",
"dependencies": {
"fast-uri": "3.1.5"
}
}
{
"schemaVersion": 1,
"goal": "verify pkg:npm/fast-uri@3.1.5",
"kind": "HOW",
"packages": [
"pkg:npm/fast-uri@3.1.5"
],
"symbols": [
"equal",
"normalize",
"parse",
"resolve",
"resolveComponent",
"serialize"
]
}
import assert from 'node:assert';
import uri from 'fast-uri';
// 1. fastUri.parse parses full URI into scheme, host, port, path, query, and fragment components
const parsed = uri.parse('http://example.com:8080/path/sub?q=test#heading');
assert.strictEqual(parsed.scheme, 'http');
assert.strictEqual(parsed.host, 'example.com');
assert.strictEqual(parsed.port, 8080);
assert.strictEqual(parsed.path, '/path/sub');
assert.strictEqual(parsed.query, 'q=test');
assert.strictEqual(parsed.fragment, 'heading');
assert.strictEqual(parsed.reference, 'uri');
// 2. fastUri.parse parses relative paths without scheme or authority
const rel = uri.parse('/api/v1/users?page=2#top');
assert.strictEqual(rel.scheme, undefined);
assert.strictEqual(rel.host, undefined);
assert.strictEqual(rel.port, undefined);
assert.strictEqual(rel.path, '/api/v1/users');
assert.strictEqual(rel.query, 'page=2');
assert.strictEqual(rel.fragment, 'top');
assert.strictEqual(rel.reference, 'relative');
// 3. fastUri.parse parses IPv6 host literals and reports error property on malformed domains
const ipv6 = uri.parse('http://[::1]:3000/');
assert.strictEqual(ipv6.scheme, 'http');
assert.strictEqual(ipv6.host, '::1');
assert.strictEqual(ipv6.port, 3000);
const malformed = uri.parse('http://invalid domain with spaces');
assert.ok(malformed.error);
// 4. fastUri.serialize formats URI component objects into complete URI strings
const serialized = uri.serialize({
scheme: 'http',
host: 'example.com',
port: 8080,
path: '/api/resource',
query: 'filter=active',
fragment: 'section1'
});
assert.strictEqual(serialized, 'http://example.com:8080/api/resource?filter=active#section1');
// 5. fastUri.serialize formats relative URI component objects with path and query parameters
const relSerialized = uri.serialize({
path: '/docs',
query: 'lang=en'
});
assert.strictEqual(relSerialized, '/docs?lang=en');
// 6. fastUri.resolve resolves relative paths, absolute-path references, and query string references against a base URI
assert.strictEqual(uri.resolve('http://example.com/a/b/c', '../d'), 'http://example.com/a/d');
assert.strictEqual(uri.resolve('http://example.com/a/b/c', '/main/target'), 'http://example.com/main/target');
assert.strictEqual(uri.resolve('http://example.com/a/b', '?filter=all'), 'http://example.com/a/b?filter=all');
assert.strictEqual(uri.resolve('http://example.com/a/b', '#section2'), 'http://example.com/a/b#section2');
// 7. fastUri.resolveComponent resolves parsed relative URIComponent against parsed base URIComponent
const baseComp = uri.parse('http://example.com/a/b');
const relComp = uri.parse('c');
const resolvedComp = uri.resolveComponent(baseComp, relComp);
assert.strictEqual(resolvedComp.scheme, 'http');
assert.strictEqual(resolvedComp.host, 'example.com');
assert.strictEqual(resolvedComp.path, '/a/c');
// 8. fastUri.normalize normalizes host casing, path dot-segments, and unreserved percent-encoded characters
assert.strictEqual(uri.normalize('http://EXAMPLE.COM/a/b/../c/%7A'), 'http://example.com/a/c/z');
assert.strictEqual(uri.normalize('http://example.com/a/./b'), 'http://example.com/a/b');
// 9. fastUri.equal determines RFC 3986 equivalence between equivalent URI strings
assert.strictEqual(uri.equal('http://EXAMPLE.COM/a/b/../c/%7A', 'http://example.com/a/c/z'), true);
assert.strictEqual(uri.equal('http://example.com:8080/test', 'http://example.com:8080/test'), true);
assert.strictEqual(uri.equal('http://example.com/a', 'http://example.com/b'), false);
console.log('Contract passed');
原始种子者
匿名