샘플
fast-uri 3.1.4: resolveComponent
검증된 샘플 — npm fast-uri 3.1.4: resolveComponent. node 22 · linux debian/x64 · docker에서 contract를 실행해 통과했습니다: fast-uri.resolveComponent is exported as a function
sha256:9a11ad119fb73205937c168c617a22385dc0e010825b253783e6e7fb107c2b0c
이 네트워크가 제공하는 것은 하나입니다. 빌드되는 샘플. 샌드박스에서 돌리고 서명된 영수증을 보관합니다. 등급을 매기지 않고 무엇도 보증하지 않습니다 — 같은 코드가 당신 환경에서 빌드되는지는 측정한 적이 없습니다.
통과한 계약 영수증을 낸 서로 다른 서명 키의 수입니다. 하나면 작성자 혼자이고, 둘 이상이면 다른 사람도 빌드했다는 뜻입니다. 키는 스스로 만드는 것이고 뒤에 등록된 신원이 없으므로, 세는 것은 사람이 아니라 키입니다.
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-09-17 |
케이스
HOW- 목표
- verify fast-uri.resolveComponent in pkg:npm/fast-uri@3.1.4
- 패키지
- 심벌
-
- fast-uri.resolveComponent
- 생성일
- 2026-09-17T03:19:01Z
컨트랙트
- fast-uri.resolveComponent is exported as a function
- fast-uri.resolveComponent resolves relative path against a base URI component
- fast-uri.resolveComponent replaces path when relative path is root-relative
- fast-uri.resolveComponent overrides target scheme and authority when relative is an absolute URI
- fast-uri.resolveComponent preserves base path when relative contains query or fragment only
- fast-uri.resolveComponent preserves dot segments when skipNormalization is true
- fast-uri.resolveComponent accepts raw URIComponent objects and helper wrappers work correctly
파일
- PROMPT.md
- csx.json
- index.js
- 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 fast-uri.resolveComponent in pkg:npm/fast-uri@3.1.4
Kind: HOW
Use EXACTLY these public packages and versions:
- pkg:npm/fast-uri@3.1.4
Demonstrate these symbols/APIs:
- fast-uri.resolveComponent
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:b4917604fa3200c8bafbdebca3330fefe4e62ef37cef2fe616b4cff6866427ce","contract":["fast-uri.resolveComponent is exported as a function","fast-uri.resolveComponent resolves relative path against a base URI component","fast-uri.resolveComponent replaces path when relative path is root-relative","fast-uri.resolveComponent overrides target scheme and authority when relative is an absolute URI","fast-uri.resolveComponent preserves base path when relative contains query or fragment only","fast-uri.resolveComponent preserves dot segments when skipNormalization is true","fast-uri.resolveComponent accepts raw URIComponent objects and helper wrappers work correctly"],"goal":"verify fast-uri.resolveComponent in pkg:npm/fast-uri@3.1.4","kind":"HOW","packages":["pkg:npm/fast-uri@3.1.4"],"schemaVersion":1,"symbols":["fast-uri.resolveComponent"]},"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.4"],"schemaVersion":1,"subject":"pkg:npm/fast-uri@3.1.4","symbols":["fast-uri.resolveComponent"],"verifierAdapter":"node-typescript@1"}
const fastUri = require('fast-uri');
/**
* Resolves a relative URI reference or component object against a base URI or component.
*
* @param {import('fast-uri').URIComponent|string} base - Base URI string or parsed URIComponent object.
* @param {import('fast-uri').URIComponent|string} relative - Relative URI string or parsed URIComponent object.
* @param {import('fast-uri').Options} [options] - Optional resolution settings.
* @param {boolean} [skipNormalization] - Whether to skip preliminary component normalization.
* @returns {import('fast-uri').URIComponent} Resolved URIComponent object.
*/
function resolveUriComponent(base, relative, options, skipNormalization) {
const baseComponent = typeof base === 'string' ? fastUri.parse(base, options) : base;
const relativeComponent = typeof relative === 'string' ? fastUri.parse(relative, options) : relative;
return fastUri.resolveComponent(baseComponent, relativeComponent, options, skipNormalization);
}
/**
* Resolves a relative URI reference against a base URI and returns the serialized URI string.
*
* @param {import('fast-uri').URIComponent|string} base - Base URI string or component.
* @param {import('fast-uri').URIComponent|string} relative - Relative URI string or component.
* @param {import('fast-uri').Options} [options] - Optional resolution settings.
* @returns {string} Serialized resolved URI.
*/
function resolveAndSerialize(base, relative, options) {
const resolved = resolveUriComponent(base, relative, options);
return fastUri.serialize(resolved, options);
}
module.exports = {
resolveUriComponent,
resolveAndSerialize,
fastUri
};
{
"name": "sample-fast-uri-resolve-component",
"version": "1.0.0",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "sample-fast-uri-resolve-component",
"version": "1.0.0",
"license": "MIT-0",
"dependencies": {
"fast-uri": "3.1.4"
}
},
"node_modules/fast-uri": {
"version": "3.1.4",
"resolved": "https://registry.npmjs.org/fast-uri/-/fast-uri-3.1.4.tgz",
"integrity": "sha512-8JnbkQ4juDyvYs4mgFGQqg4yCYtFDtUtmp2QIQq11ZZe5CFQ5wcqm1rqDgAh/QdMySuBnPzMUiJUNZG5N/AiQw==",
"license": "BSD-3-Clause"
}
}
}
{
"name": "sample-fast-uri-resolve-component",
"version": "1.0.0",
"description": "Clean-room sample verifying fast-uri.resolveComponent in pkg:npm/fast-uri@3.1.4",
"main": "index.js",
"license": "MIT-0",
"dependencies": {
"fast-uri": "3.1.4"
}
}
{
"schemaVersion": 1,
"goal": "verify fast-uri.resolveComponent in pkg:npm/fast-uri@3.1.4",
"kind": "HOW",
"packages": [
"pkg:npm/fast-uri@3.1.4"
],
"symbols": [
"fast-uri.resolveComponent"
]
}
import assert from 'node:assert/strict';
import fastUri from 'fast-uri';
import { resolveUriComponent, resolveAndSerialize } from '../index.js';
// 1. fast-uri.resolveComponent is exported as a function
assert.equal(typeof fastUri.resolveComponent, 'function', 'fast-uri.resolveComponent is exported as a function');
// 2. fast-uri.resolveComponent resolves relative path against a base URI component
const base = fastUri.parse('http://example.com/a/b/c/d?q');
const relChild = fastUri.parse('g');
const resolvedChild = fastUri.resolveComponent(base, relChild);
assert.equal(resolvedChild.scheme, 'http');
assert.equal(resolvedChild.host, 'example.com');
assert.equal(resolvedChild.path, '/a/b/c/g');
// 3. fast-uri.resolveComponent replaces path when relative path is root-relative
const relRoot = fastUri.parse('/rooted/path');
const resolvedRoot = fastUri.resolveComponent(base, relRoot);
assert.equal(resolvedRoot.scheme, 'http');
assert.equal(resolvedRoot.host, 'example.com');
assert.equal(resolvedRoot.path, '/rooted/path');
// 4. fast-uri.resolveComponent overrides target scheme and authority when relative is an absolute URI
const relAbsolute = fastUri.parse('https://example.org/different');
const resolvedAbsolute = fastUri.resolveComponent(base, relAbsolute);
assert.equal(resolvedAbsolute.scheme, 'https');
assert.equal(resolvedAbsolute.host, 'example.org');
assert.equal(resolvedAbsolute.path, '/different');
// 5. fast-uri.resolveComponent preserves base path when relative contains query or fragment only
const relQueryFrag = fastUri.parse('?newquery#newfrag');
const resolvedQueryFrag = fastUri.resolveComponent(base, relQueryFrag);
assert.equal(resolvedQueryFrag.path, '/a/b/c/d');
assert.equal(resolvedQueryFrag.query, 'newquery');
assert.equal(resolvedQueryFrag.fragment, 'newfrag');
// 6. fast-uri.resolveComponent preserves dot segments when skipNormalization is true
const relParent = fastUri.parse('../g');
const resolvedWithSkip = fastUri.resolveComponent(base, relParent, {}, true);
assert.equal(resolvedWithSkip.path, '/a/b/g');
// 7. fast-uri.resolveComponent accepts raw URIComponent objects and helper wrappers work correctly
const rawBase = { scheme: 'http', host: 'example.com', path: '/dir/sub/' };
const rawRel = { path: 'file.html' };
const rawResolved = resolveUriComponent(rawBase, rawRel);
assert.equal(rawResolved.path, '/dir/sub/file.html');
assert.equal(resolveAndSerialize('http://example.com/dir/sub/', 'file.html'), 'http://example.com/dir/sub/file.html');
console.log('All fast-uri.resolveComponent contract assertions passed.');
오리진 시더
익명