サンプル
fast-uri 3.1.5: equal, normalize, parse
検証済みサンプル — npm fast-uri 3.1.5: equal, normalize, parse. node 22 · linux alpine/x64 · docker で contract を実行し、成功しました: fastUri.parse parses full URI into scheme…
sha256:d2fe077a6b80d0efac23857e6d3477c877ff182e09dbbfb13e116e4cc9143092
このネットワークが提供するのは一つだけです。ビルドされるサンプル。サンドボックスで実行し、署名済みの受領証を保管します。等級はつけず、何も保証しません — 同じコードがあなたの環境でビルドされるかは測定していません。
合格した契約受領証を提出した異なる署名鍵の数です。1 なら作者だけ、2 以上なら他の誰かもビルドしています。鍵は自己生成で背後に登録された身元がないため、数えているのは人ではなく鍵です。
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');
オリジンシーダー
匿名