샘플
pathe 2.0.3: resolve
검증된 샘플 — npm pathe 2.0.3: resolve. node 22 · linux alpine/x64 · docker에서 contract를 실행해 통과했습니다: pathe.resolve resolves multiple path segments into a…
sha256:52a9f5b4160a1ec69563512e658e53ba187df95789245d25ad58a482df5f607e
이 네트워크가 제공하는 것은 하나입니다. 빌드되는 샘플. 샌드박스에서 돌리고 서명된 영수증을 보관합니다. 등급을 매기지 않고 무엇도 보증하지 않습니다 — 같은 코드가 당신 환경에서 빌드되는지는 측정한 적이 없습니다.
통과한 계약 영수증을 낸 서로 다른 서명 키의 수입니다. 하나면 작성자 혼자이고, 둘 이상이면 다른 사람도 빌드했다는 뜻입니다. 키는 스스로 만드는 것이고 뒤에 등록된 신원이 없으므로, 세는 것은 사람이 아니라 키입니다.
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 pathe.resolve in pkg:npm/pathe@2.0.3
- 패키지
- 심벌
-
- pathe.resolve
- 생성일
- 2026-08-26T10:49:51Z
컨트랙트
- pathe.resolve resolves multiple path segments into a normalized POSIX path string
- pathe.resolve resolves relative path segments and parent directory navigation (..)
- pathe.resolve processes paths from right to left until an absolute path is constructed
- pathe.resolve strips trailing slashes from resolved paths unless resolving to root directory
- pathe.resolve normalizes redundant slashes and relative dot segments
- pathe.resolve defaults to the current working directory in POSIX format when given empty or no arguments
- pathe.resolve ignores empty string segments between non-empty path arguments
파일
- PROMPT.md
- csx.json
- package-lock.json
- package.json
- spec.json
- src/index.js
- 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 pathe.resolve in pkg:npm/pathe@2.0.3
Kind: HOW
Use EXACTLY these public packages and versions:
- pkg:npm/pathe@2.0.3
Demonstrate these symbols/APIs:
- pathe.resolve
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:3a2a6c2f7d37c0c0bd325a20386fd774557a8d1794c233fd1ba96e117a194392","contract":["pathe.resolve resolves multiple path segments into a normalized POSIX path string","pathe.resolve resolves relative path segments and parent directory navigation (..)","pathe.resolve processes paths from right to left until an absolute path is constructed","pathe.resolve strips trailing slashes from resolved paths unless resolving to root directory","pathe.resolve normalizes redundant slashes and relative dot segments","pathe.resolve defaults to the current working directory in POSIX format when given empty or no arguments","pathe.resolve ignores empty string segments between non-empty path arguments"],"goal":"verify pathe.resolve in pkg:npm/pathe@2.0.3","kind":"HOW","packages":["pkg:npm/pathe@2.0.3"],"schemaVersion":1,"symbols":["pathe.resolve"]},"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/pathe@2.0.3"],"schemaVersion":1,"subject":"pkg:npm/pathe@2.0.3","symbols":["pathe.resolve"],"verifierAdapter":"node-typescript@1"}
{
"name": "sample-pathe-resolve",
"version": "1.0.0",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "sample-pathe-resolve",
"version": "1.0.0",
"license": "MIT-0",
"dependencies": {
"pathe": "2.0.3"
}
},
"node_modules/pathe": {
"version": "2.0.3",
"resolved": "https://registry.npmjs.org/pathe/-/pathe-2.0.3.tgz",
"integrity": "sha512-WUjGcAqP1gQacoQe+OBJsFA7Ld4DyXuUIjZ5cc75cLHvJ7dtNsTugphxIADwspS+AraAUePCKrSVtPLFj/F88w==",
"license": "MIT"
}
}
}
{
"name": "sample-pathe-resolve",
"version": "1.0.0",
"private": true,
"description": "Clean-room code sample for pathe.resolve in pathe@2.0.3",
"main": "src/index.js",
"license": "MIT-0",
"dependencies": {
"pathe": "2.0.3"
}
}
{
"schemaVersion": 1,
"goal": "verify pathe.resolve in pkg:npm/pathe@2.0.3",
"kind": "HOW",
"packages": [
"pkg:npm/pathe@2.0.3"
],
"symbols": [
"pathe.resolve"
]
}
const pathe = require('pathe');
const { resolve, normalize } = pathe;
/**
* Resolves a sequence of paths or path segments into an absolute POSIX path.
*
* @param {...string} paths - Path segments to resolve.
* @returns {string} Normalized absolute POSIX path.
*/
function resolvePath(...paths) {
return resolve(...paths);
}
/**
* Resolves path segments relative to a specified base directory.
*
* @param {string} base - Base directory path.
* @param {...string} segments - Additional segments to resolve against the base.
* @returns {string} Resolved POSIX path.
*/
function resolveRelative(base, ...segments) {
return resolve(base, ...segments);
}
module.exports = {
pathe,
resolve,
normalize,
resolvePath,
resolveRelative
};
import assert from 'node:assert/strict';
import { createRequire } from 'node:module';
const require = createRequire(import.meta.url);
const { pathe, resolve, normalize, resolvePath, resolveRelative } = require('../src/index.js');
async function runTests() {
const cwd = normalize(process.cwd());
// 1. pathe.resolve resolves multiple path segments into a normalized POSIX path string
assert.equal(typeof pathe.resolve, 'function', 'pathe.resolve must be a function');
assert.equal(typeof resolve, 'function', 'resolve must be a function');
assert.equal(resolve('/a', 'b', 'c'), '/a/b/c', 'resolve should join and normalize path segments');
assert.equal(resolvePath('/foo', 'bar', 'baz'), '/foo/bar/baz', 'resolvePath helper should resolve segments');
// 2. pathe.resolve resolves relative path segments and parent directory navigation (..)
assert.equal(resolve('/foo/bar', '../baz'), '/foo/baz', 'resolve should handle .. navigation');
assert.equal(resolve('/a/b/c', 'd', '../e'), '/a/b/c/e', 'resolve should traverse relative parent correctly');
assert.equal(resolveRelative('/base/dir', './sub', '../other'), '/base/dir/other', 'resolveRelative helper should resolve ..');
// 3. pathe.resolve processes paths from right to left until an absolute path is constructed
assert.equal(resolve('/first/path', '/second/path'), '/second/path', 'Rightmost absolute path takes precedence');
assert.equal(resolve('/root', 'sub1', '/target', 'file.txt'), '/target/file.txt', 'Absolute segment overrides earlier segments');
// 4. pathe.resolve strips trailing slashes from resolved paths unless resolving to root directory
assert.equal(resolve('/foo/bar/'), '/foo/bar', 'Trailing slash should be removed for non-root paths');
assert.equal(resolve('/'), '/', 'Root slash must be preserved');
// 5. pathe.resolve normalizes redundant slashes and relative dot segments
assert.equal(resolve('/foo//bar///baz'), '/foo/bar/baz', 'Redundant slashes should be normalized');
assert.equal(resolve('/foo/./bar/../baz'), '/foo/baz', 'Dot segments should be resolved');
// 6. pathe.resolve defaults to the current working directory in POSIX format when given empty or no arguments
assert.equal(resolve(''), cwd, 'Empty string should resolve to normalized current working directory');
assert.equal(resolve(), cwd, 'No arguments should resolve to normalized current working directory');
// 7. pathe.resolve ignores empty string segments between non-empty path arguments
assert.equal(resolve('/foo', '', 'bar'), '/foo/bar', 'Empty string segments should be ignored');
assert.equal(resolve('/foo', '', '', 'bar'), '/foo/bar', 'Multiple empty string segments should be ignored');
console.log('All contract assertions for pathe.resolve passed successfully.');
}
runTests().catch((err) => {
console.error('Contract test failed:', err);
process.exit(1);
});
오리진 시더
익명