CodeSampleX

サンプル

fast-uri 3.1.9: parse

検証済みサンプル — npm fast-uri 3.1.9: parse. node 22 · linux debian/x64 · docker で contract を実行し、成功しました: fastUri.parse extracts scheme, host, port, path, query, and…

sha256:0ff1d25930b9e7da4828b8f63c5bb8da59435aff9d6f923bf7e7c3887a84b903

このネットワークが提供するのは一つだけです。ビルドされるサンプル。サンドボックスで実行し、署名済みの受領証を保管します。等級はつけず、何も保証しません — 同じコードがあなたの環境でビルドされるかは測定していません。 合格した契約受領証を提出した異なる署名鍵の数です。1 なら作者だけ、2 以上なら他の誰かもビルドしています。鍵は自己生成で背後に登録された身元がないため、数えているのは人ではなく鍵です。 MIT-0

実行証拠

宣言された環境と署名済みの実行を分けてあります。このサンプルが何をどこで実行したかをそのまま確認できます。

証拠の基準
署名済みコントラクト合格
検証レシート
1
ビルドした署名鍵
1
宣言された環境 linux 24 · ubuntu · glibc 2.39 x64 npm

検証実行環境

環境 コントラクト ステージ 実行日
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-10-21

ケース

HOW
ゴール
verify fast-uri.parse in pkg:npm/fast-uri@3.1.9
パッケージ
シンボル
  • fast-uri.parse
作成日
2026-10-21T04:58:48Z

コントラクト

  1. fastUri.parse extracts scheme, host, port, path, query, and fragment from an absolute URI
  2. fastUri.parse extracts userinfo and host from network-path authority
  3. fastUri.parse parses relative path and query without scheme or host
  4. fastUri.parse parses IPv6 host and port
  5. fastUri.parse parses URN scheme with nid and nss
  6. fastUri.parse parses URN UUID scheme with uuid property
  7. fastUri.parse parses empty string as same-document reference with empty path
  8. fastUri.parse sets error property on malformed URI authority

ファイル

  • 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 fast-uri.parse in pkg:npm/fast-uri@3.1.9
Kind: HOW

Use EXACTLY these public packages and versions:
  - pkg:npm/fast-uri@3.1.9
Demonstrate these symbols/APIs:
  - fast-uri.parse

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:4d0398b08984496abb031934933f79b814feea95c1da6bed1777d35f5104f8ed","contract":["fastUri.parse extracts scheme, host, port, path, query, and fragment from an absolute URI","fastUri.parse extracts userinfo and host from network-path authority","fastUri.parse parses relative path and query without scheme or host","fastUri.parse parses IPv6 host and port","fastUri.parse parses URN scheme with nid and nss","fastUri.parse parses URN UUID scheme with uuid property","fastUri.parse parses empty string as same-document reference with empty path","fastUri.parse sets error property on malformed URI authority"],"goal":"verify fast-uri.parse in pkg:npm/fast-uri@3.1.9","kind":"HOW","packages":["pkg:npm/fast-uri@3.1.9"],"schemaVersion":1,"symbols":["fast-uri.parse"]},"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.9"],"schemaVersion":1,"subject":"pkg:npm/fast-uri@3.1.9","symbols":["fast-uri.parse"],"verifierAdapter":"node-typescript@1"}
package-lock.json
{
  "name": "fast-uri-parse-verification",
  "version": "1.0.0",
  "lockfileVersion": 3,
  "requires": true,
  "packages": {
    "": {
      "name": "fast-uri-parse-verification",
      "version": "1.0.0",
      "dependencies": {
        "fast-uri": "3.1.9"
      }
    },
    "node_modules/fast-uri": {
      "version": "3.1.9",
      "resolved": "https://registry.npmjs.org/fast-uri/-/fast-uri-3.1.9.tgz",
      "integrity": "sha512-hS/0Wt3Ya043oKXs0sIxrMpKQITXhMLIrVAKKXi4gozGC9v7YRWVnXIZzjNPTO02M9BdxLCWqK1yRXgNziVyJQ==",
      "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-parse-verification",
  "version": "1.0.0",
  "private": true,
  "description": "Clean-room verification of fast-uri.parse",
  "dependencies": {
    "fast-uri": "3.1.9"
  }
}
spec.json
{
  "schemaVersion": 1,
  "goal": "verify fast-uri.parse in pkg:npm/fast-uri@3.1.9",
  "kind": "HOW",
  "packages": [
    "pkg:npm/fast-uri@3.1.9"
  ],
  "symbols": [
    "fast-uri.parse"
  ]
}
test/contract.mjs
import assert from 'node:assert';
import uri from 'fast-uri';

// 1. fastUri.parse extracts scheme, host, port, path, query, and fragment from an absolute URI
const full = uri.parse('https://example.com:8080/api/v1/resource?filter=active&sort=desc#section-2');
assert.strictEqual(full.scheme, 'https');
assert.strictEqual(full.host, 'example.com');
assert.strictEqual(full.port, 8080);
assert.strictEqual(full.path, '/api/v1/resource');
assert.strictEqual(full.query, 'filter=active&sort=desc');
assert.strictEqual(full.fragment, 'section-2');
assert.strictEqual(full.reference, 'uri');

// 2. fastUri.parse extracts userinfo and host from network-path authority
const auth = uri.parse('//user:info@example.com/assets/app.js');
assert.strictEqual(auth.scheme, undefined);
assert.strictEqual(auth.userinfo, 'user:info');
assert.strictEqual(auth.host, 'example.com');
assert.strictEqual(auth.path, '/assets/app.js');
assert.strictEqual(auth.reference, 'relative');

// 3. fastUri.parse parses relative path and query without scheme or host
const rel = uri.parse('/search?q=test#top');
assert.strictEqual(rel.scheme, undefined);
assert.strictEqual(rel.userinfo, undefined);
assert.strictEqual(rel.host, undefined);
assert.strictEqual(rel.port, undefined);
assert.strictEqual(rel.path, '/search');
assert.strictEqual(rel.query, 'q=test');
assert.strictEqual(rel.fragment, 'top');
assert.strictEqual(rel.reference, 'relative');

// 4. fastUri.parse parses IPv6 host and port
const v6 = uri.parse('http://[2001:db8::1]:8080/status');
assert.strictEqual(v6.scheme, 'http');
assert.strictEqual(v6.host, '2001:db8::1');
assert.strictEqual(v6.port, 8080);
assert.strictEqual(v6.path, '/status');

// 5. fastUri.parse parses URN scheme with nid and nss
const urn = uri.parse('urn:isbn:0451450523');
assert.strictEqual(urn.scheme, 'urn');
assert.strictEqual(urn.nid, 'isbn');
assert.strictEqual(urn.nss, '0451450523');
assert.strictEqual(urn.reference, 'absolute');

// 6. fastUri.parse parses URN UUID scheme with uuid property
const uuidUrn = uri.parse('urn:uuid:f81d4fae-7dec-11d0-a765-00a0c91e6bf6');
assert.strictEqual(uuidUrn.scheme, 'urn');
assert.strictEqual(uuidUrn.nid, 'uuid');
assert.strictEqual(uuidUrn.uuid, 'f81d4fae-7dec-11d0-a765-00a0c91e6bf6');

// 7. fastUri.parse parses empty string as same-document reference with empty path
const empty = uri.parse('');
assert.strictEqual(empty.scheme, undefined);
assert.strictEqual(empty.path, '');
assert.strictEqual(empty.reference, 'same-document');

// 8. fastUri.parse sets error property on malformed URI authority
const malformed = uri.parse('http://example.com:notaport/');
assert.strictEqual(typeof malformed.error, 'string');
assert.ok(malformed.error.length > 0);

console.log('Contract passed');

オリジンシーダー

匿名