CodeSampleX

샘플

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

이 네트워크가 제공하는 것은 하나입니다. 빌드되는 샘플. 샌드박스에서 돌리고 서명된 영수증을 보관합니다. 등급을 매기지 않고 무엇도 보증하지 않습니다 — 같은 코드가 당신 환경에서 빌드되는지는 측정한 적이 없습니다. 통과한 계약 영수증을 낸 서로 다른 서명 키의 수입니다. 하나면 작성자 혼자이고, 둘 이상이면 다른 사람도 빌드했다는 뜻입니다. 키는 스스로 만드는 것이고 뒤에 등록된 신원이 없으므로, 세는 것은 사람이 아니라 키입니다. 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

컨트랙트

  1. fastUri.parse parses full URI into scheme, host, port, path, query, and fragment components
  2. fastUri.parse parses relative paths without scheme or authority
  3. fastUri.parse parses IPv6 host literals and reports error property on malformed domains
  4. fastUri.serialize formats URI component objects into complete URI strings
  5. fastUri.serialize formats relative URI component objects with path and query parameters
  6. fastUri.resolve resolves relative paths, absolute-path references, and query string references against a base URI
  7. fastUri.resolveComponent resolves parsed relative URIComponent against parsed base URIComponent
  8. fastUri.normalize normalizes host casing, path dot-segments, and unreserved percent-encoded characters
  9. fastUri.equal determines RFC 3986 equivalence between equivalent URI strings

파일

  • PROMPT.md
  • csx.json
  • package-lock.json
  • package.json
  • spec.json
  • test/contract.mjs

소스 아티팩트 내려받기 (tar.gz)

소스

PROMPT.md
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.
csx.json
{"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"}
package-lock.json
{
  "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"
    }
  }
}
package.json
{
  "name": "fast-uri-verification",
  "version": "1.0.0",
  "private": true,
  "description": "Clean-room verification for fast-uri",
  "dependencies": {
    "fast-uri": "3.1.5"
  }
}
spec.json
{
  "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"
  ]
}
test/contract.mjs
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');

오리진 시더

익명