CodeSampleX

샘플

react-router-dom 6.30.4: parsePath

검증된 샘플 — npm react-router-dom 6.30.4: parsePath. node 22 · linux debian/x64 · docker에서 contract를 실행해 통과했습니다: react-router-dom package.json declares export…

sha256:fef43779dc963b478dd5e74862e1f73fb1781d926dca47c692f3d433ae2017bf

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

실행 증거

선언된 환경과 서명된 실행을 분리해 두었습니다. 이 샘플이 무엇을 어디서 실행했는지 그대로 볼 수 있습니다.

증거 기준
서명된 컨트랙트 통과
검증 영수증
1
빌드한 서명 키
1
선언된 환경 node 22.23 linux 24 · ubuntu · glibc 2.39 x64 node 22.23 javascript npm 10

검증 실행 환경

환경 컨트랙트 단계 실행일
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-01

케이스

HOW
목표
verify parsePath in pkg:npm/react-router-dom@6.30.4
패키지
심벌
  • parsePath
환경
node 22.23.2
생성일
2026-09-01T16:00:48Z

컨트랙트

  1. react-router-dom package.json declares export mappings and version 6.30.4
  2. react-router-dom exports parsePath as a function
  3. parsePath parses a full path into pathname, search, and hash components
  4. parsePath parses path with pathname only leaving search and hash undefined
  5. parsePath parses path with search query string only without leading pathname
  6. parsePath parses path with hash fragment only without pathname or search
  7. parsePath returns an empty object when given an empty path string
  8. parsePath correctly parses relative paths containing query parameters and hash fragments

파일

  • 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 parsePath in pkg:npm/react-router-dom@6.30.4
Kind: HOW

Use EXACTLY these public packages and versions:
  - pkg:npm/react-router-dom@6.30.4
Demonstrate these symbols/APIs:
  - parsePath
Constraints:
  - executionContext: node
Required runtime conditions:
  - ecosystem: npm
  - language: javascript
  - moduleSystem: cjs
  - packageManager: npm@10.9.8
  - runtime: node@22.23.2

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:0d7ff7bf3794e78584fa7236fe015de4a0d3b86df3d31891a91de8e77d20b574","constraints":{"executionContext":"node"},"contract":["react-router-dom package.json declares export mappings and version 6.30.4","react-router-dom exports parsePath as a function","parsePath parses a full path into pathname, search, and hash components","parsePath parses path with pathname only leaving search and hash undefined","parsePath parses path with search query string only without leading pathname","parsePath parses path with hash fragment only without pathname or search","parsePath returns an empty object when given an empty path string","parsePath correctly parses relative paths containing query parameters and hash fragments"],"goal":"verify parsePath in pkg:npm/react-router-dom@6.30.4","kind":"HOW","packages":["pkg:npm/react-router-dom@6.30.4"],"schemaVersion":1,"symbols":["parsePath"]},"contractCommand":["node","test/contract.mjs"],"environment":{"arch":"x64","distro":"ubuntu","ecosystem":"npm","executionContext":"node","language":"javascript","libc":"glibc","libcVersion":"2.39","moduleSystem":"esm","os":"linux","osVersionBucket":"24","packageManager":"npm","packageManagerVersion":"10.9.8","runtime":"node","runtimeVersion":"22.23.2","schemaVersion":1},"license":"MIT-0","packages":["pkg:npm/react-router-dom@6.30.4"],"schemaVersion":1,"subject":"pkg:npm/react-router-dom@6.30.4","symbols":["parsePath"],"verifierAdapter":"node-typescript@1"}
package-lock.json
{
  "name": "sample-react-router-dom-parse-path",
  "version": "1.0.0",
  "lockfileVersion": 3,
  "requires": true,
  "packages": {
    "": {
      "name": "sample-react-router-dom-parse-path",
      "version": "1.0.0",
      "license": "MIT-0",
      "dependencies": {
        "react-router-dom": "6.30.4"
      }
    },
    "node_modules/@remix-run/router": {
      "version": "1.23.3",
      "resolved": "https://registry.npmjs.org/@remix-run/router/-/router-1.23.3.tgz",
      "integrity": "sha512-4An71tdz9X8+3sI4Qqqd2LWd9vS39J7sqd9EU4Scw7TJE/qB10Flv/UuqbPVgfQV9XoK8Np6jNquZitnZq5i+Q==",
      "license": "MIT",
      "engines": {
        "node": ">=14.0.0"
      }
    },
    "node_modules/react": {
      "version": "19.2.8",
      "resolved": "https://registry.npmjs.org/react/-/react-19.2.8.tgz",
      "integrity": "sha512-PWaYA1L/q9u2u7xYQi+Y3L3Yfnie7XyLeaJICV1MGD6LprsBxcAqGjYyr0eY3p+QdsA+x/Irkt4Qif8D63+Sbw==",
      "license": "MIT",
      "peer": true,
      "engines": {
        "node": ">=0.10.0"
      }
    },
    "node_modules/react-dom": {
      "version": "19.2.8",
      "resolved": "https://registry.npmjs.org/react-dom/-/react-dom-19.2.8.tgz",
      "integrity": "sha512-rVprimfGBG3DR+Tq0IQG2DT5PxKth1WIGDmj5yPmlzr4YBe7uyE+Du4oVqTDXZSHGGGXRtTJEGSSePyQCMBglQ==",
      "license": "MIT",
      "peer": true,
      "dependencies": {
        "scheduler": "^0.27.0"
      },
      "peerDependencies": {
        "react": "^19.2.8"
      }
    },
    "node_modules/react-router": {
      "version": "6.30.4",
      "resolved": "https://registry.npmjs.org/react-router/-/react-router-6.30.4.tgz",
      "integrity": "sha512-SVUsDe+DybHM/WmYKIVYhZh1o5Dcuf16yM6WjG02Q9XVFMZIJyHYhwrr6bFBXZkVP6z69kNkMyBCujt8FaFLJA==",
      "license": "MIT",
      "dependencies": {
        "@remix-run/router": "1.23.3"
      },
      "engines": {
        "node": ">=14.0.0"
      },
      "peerDependencies": {
        "react": ">=16.8"
      }
    },
    "node_modules/react-router-dom": {
      "version": "6.30.4",
      "resolved": "https://registry.npmjs.org/react-router-dom/-/react-router-dom-6.30.4.tgz",
      "integrity": "sha512-q4HvNl+mmDdkS0g+MqiBZNteQJCuimWoOyHMy4T/RQLAn9Z29+E91QXRaxOujeMl2HTzRSS0KFPd7lxX3PjV0Q==",
      "license": "MIT",
      "dependencies": {
        "@remix-run/router": "1.23.3",
        "react-router": "6.30.4"
      },
      "engines": {
        "node": ">=14.0.0"
      },
      "peerDependencies": {
        "react": ">=16.8",
        "react-dom": ">=16.8"
      }
    },
    "node_modules/scheduler": {
      "version": "0.27.0",
      "resolved": "https://registry.npmjs.org/scheduler/-/scheduler-0.27.0.tgz",
      "integrity": "sha512-eNv+WrVbKu1f3vbYJT/xtiF5syA5HPIMtf9IgY/nKg0sWqzAUEvqY/xm7OcZc/qafLx/iO9FgOmeSAp4v5ti/Q==",
      "license": "MIT",
      "peer": true
    }
  }
}
package.json
{
  "name": "sample-react-router-dom-parse-path",
  "version": "1.0.0",
  "type": "module",
  "private": true,
  "license": "MIT-0",
  "dependencies": {
    "react-router-dom": "6.30.4"
  }
}
spec.json
{
  "schemaVersion": 1,
  "goal": "verify parsePath in pkg:npm/react-router-dom@6.30.4",
  "kind": "HOW",
  "packages": [
    "pkg:npm/react-router-dom@6.30.4"
  ],
  "symbols": [
    "parsePath"
  ],
  "constraints": {
    "executionContext": "node"
  },
  "runtimeConditions": {
    "ecosystem": "npm",
    "language": "javascript",
    "moduleSystem": "cjs",
    "packageManager": "npm@10.9.8",
    "runtime": "node@22.23.2"
  }
}
test/contract.mjs
import assert from 'node:assert/strict';
import fs from 'node:fs';
import { createRequire } from 'node:module';
import { parsePath } from 'react-router-dom';

const require = createRequire(import.meta.url);

// Contract 1: react-router-dom package.json declares export mappings and version 6.30.4
{
  const pkgJsonPath = require.resolve('react-router-dom/package.json');
  assert.ok(fs.existsSync(pkgJsonPath));
  const pkgJson = JSON.parse(fs.readFileSync(pkgJsonPath, 'utf8'));
  assert.strictEqual(pkgJson.name, 'react-router-dom');
  assert.strictEqual(pkgJson.version, '6.30.4');
  assert.ok(pkgJson.main || pkgJson.module || pkgJson.exports);
}

// Contract 2: react-router-dom exports parsePath as a function
{
  assert.strictEqual(typeof parsePath, 'function');
}

// Contract 3: parsePath parses a full path into pathname, search, and hash components
{
  const parsed = parsePath('/users/profile?tab=settings#notifications');
  assert.deepStrictEqual(parsed, {
    pathname: '/users/profile',
    search: '?tab=settings',
    hash: '#notifications'
  });
  assert.strictEqual(parsed.pathname, '/users/profile');
  assert.strictEqual(parsed.search, '?tab=settings');
  assert.strictEqual(parsed.hash, '#notifications');
}

// Contract 4: parsePath parses path with pathname only leaving search and hash undefined
{
  const parsed = parsePath('/about/team');
  assert.deepStrictEqual(parsed, {
    pathname: '/about/team'
  });
  assert.strictEqual(parsed.pathname, '/about/team');
  assert.strictEqual(parsed.search, undefined);
  assert.strictEqual(parsed.hash, undefined);
}

// Contract 5: parsePath parses path with search query string only without leading pathname
{
  const parsed = parsePath('?filter=active&sort=desc');
  assert.deepStrictEqual(parsed, {
    search: '?filter=active&sort=desc'
  });
  assert.strictEqual(parsed.pathname, undefined);
  assert.strictEqual(parsed.search, '?filter=active&sort=desc');
  assert.strictEqual(parsed.hash, undefined);
}

// Contract 6: parsePath parses path with hash fragment only without pathname or search
{
  const parsed = parsePath('#overview');
  assert.deepStrictEqual(parsed, {
    hash: '#overview'
  });
  assert.strictEqual(parsed.pathname, undefined);
  assert.strictEqual(parsed.search, undefined);
  assert.strictEqual(parsed.hash, '#overview');
}

// Contract 7: parsePath returns an empty object when given an empty path string
{
  const parsed = parsePath('');
  assert.deepStrictEqual(parsed, {});
  assert.strictEqual(parsed.pathname, undefined);
  assert.strictEqual(parsed.search, undefined);
  assert.strictEqual(parsed.hash, undefined);
}

// Contract 8: parsePath correctly parses relative paths containing query parameters and hash fragments
{
  const parsed = parsePath('search?q=test#top');
  assert.deepStrictEqual(parsed, {
    pathname: 'search',
    search: '?q=test',
    hash: '#top'
  });
  assert.strictEqual(parsed.pathname, 'search');
  assert.strictEqual(parsed.search, '?q=test');
  assert.strictEqual(parsed.hash, '#top');
}

console.log('All react-router-dom parsePath contract tests passed.');

오리진 시더

익명