CodeSampleX

샘플

normalize-path 3.0.0: normalize-path

검증된 샘플 — npm normalize-path 3.0.0: normalize-path. node 22 · linux alpine/x64 · docker에서 contract를 실행해 통과했습니다: assert normalize-path converts Windows…

sha256:b1be00664597e49ac87ffc036ec3f0dc18c2cf15a24c6c0a520289243b9d6da1

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

실행 증거

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

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

검증 실행 환경

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

케이스

HOW
목표
verify normalize-path in pkg:npm/normalize-path@3.0.0
패키지
심벌
  • normalize-path
환경
node 22.23.2
생성일
2026-08-26T11:13:02Z

컨트랙트

  1. assert normalize-path converts Windows backslashes to forward slashes
  2. assert normalize-path collapses duplicate consecutive slashes
  3. assert normalize-path strips trailing slash by default
  4. assert normalize-path preserves trailing slash when stripTrailing is false
  5. assert normalize-path preserves Win32 extended-length namespace prefix
  6. assert normalize-path throws TypeError when passed a non-string argument

파일

  • PROMPT.md
  • csx.json
  • index.js
  • 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 normalize-path in pkg:npm/normalize-path@3.0.0
Kind: HOW

Use EXACTLY these public packages and versions:
  - pkg:npm/normalize-path@3.0.0
Demonstrate these symbols/APIs:
  - normalize-path

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:63e6f67640f14b5150e15624d7a265f1f8a09b3a3c728e2de1bfe6282ba86e5c","contract":["assert normalize-path converts Windows backslashes to forward slashes","assert normalize-path collapses duplicate consecutive slashes","assert normalize-path strips trailing slash by default","assert normalize-path preserves trailing slash when stripTrailing is false","assert normalize-path preserves Win32 extended-length namespace prefix","assert normalize-path throws TypeError when passed a non-string argument"],"goal":"verify normalize-path in pkg:npm/normalize-path@3.0.0","kind":"HOW","packages":["pkg:npm/normalize-path@3.0.0"],"schemaVersion":1,"symbols":["normalize-path"]},"contractCommand":["node","test/contract.mjs"],"environment":{"arch":"x64","distro":"ubuntu","ecosystem":"npm","executionContext":"node","language":"javascript","libc":"glibc","libcVersion":"2.39","moduleSystem":"cjs","os":"linux","osVersionBucket":"24","packageManager":"npm","packageManagerVersion":"10.9.8","runtime":"node","runtimeVersion":"22.23.2","schemaVersion":1},"license":"MIT-0","packages":["pkg:npm/normalize-path@3.0.0"],"schemaVersion":1,"subject":"pkg:npm/normalize-path@3.0.0","symbols":["normalize-path"],"verifierAdapter":"node-typescript@1"}
index.js
const normalizePath = require('normalize-path');

/**
 * Normalizes file paths to use forward slashes.
 *
 * @param {string} path - The path string to normalize.
 * @param {boolean} [stripTrailing=true] - Whether to remove trailing slashes.
 * @returns {string} The normalized path.
 */
function normalize(path, stripTrailing) {
  return normalizePath(path, stripTrailing);
}

module.exports = {
  normalize,
  normalizePath,
};
package-lock.json
{
  "name": "sample-normalize-path",
  "version": "1.0.0",
  "lockfileVersion": 3,
  "requires": true,
  "packages": {
    "": {
      "name": "sample-normalize-path",
      "version": "1.0.0",
      "license": "MIT-0",
      "dependencies": {
        "normalize-path": "3.0.0"
      }
    },
    "node_modules/normalize-path": {
      "version": "3.0.0",
      "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-3.0.0.tgz",
      "integrity": "sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==",
      "license": "MIT",
      "engines": {
        "node": ">=0.10.0"
      }
    }
  }
}
package.json
{
  "name": "sample-normalize-path",
  "version": "1.0.0",
  "description": "Clean-room sample verifying normalize-path functionality",
  "main": "index.js",
  "license": "MIT-0",
  "dependencies": {
    "normalize-path": "3.0.0"
  }
}
spec.json
{
  "schemaVersion": 1,
  "goal": "verify normalize-path in pkg:npm/normalize-path@3.0.0",
  "kind": "HOW",
  "packages": [
    "pkg:npm/normalize-path@3.0.0"
  ],
  "symbols": [
    "normalize-path"
  ]
}
test/contract.mjs
import assert from 'node:assert';
import normalizePath from 'normalize-path';
import { normalize } from '../index.js';

// 1. Converts Windows backslashes to forward slashes
assert.strictEqual(
  normalize('foo\\bar\\baz'),
  'foo/bar/baz',
  'normalize-path must convert Windows backslashes to forward slashes'
);
assert.strictEqual(
  normalize('sub\\path\\to\\file.txt'),
  'sub/path/to/file.txt',
  'normalize-path must normalize Windows style path'
);

// 2. Collapses duplicate consecutive slashes
assert.strictEqual(
  normalize('foo//bar///baz'),
  'foo/bar/baz',
  'normalize-path must collapse multiple consecutive slashes'
);
assert.strictEqual(
  normalize('foo\\\\bar\\\\\\baz'),
  'foo/bar/baz',
  'normalize-path must collapse multiple consecutive backslashes'
);

// 3. Strips trailing slash by default
assert.strictEqual(
  normalize('foo/bar/'),
  'foo/bar',
  'normalize-path must strip trailing slash by default'
);
assert.strictEqual(
  normalize('foo\\bar\\'),
  'foo/bar',
  'normalize-path must strip trailing backslash by default'
);
assert.strictEqual(
  normalize('/'),
  '/',
  'normalize-path must preserve root slash'
);
assert.strictEqual(
  normalize('\\'),
  '/',
  'normalize-path must normalize single backslash to root slash'
);

// 4. Preserves trailing slash when stripTrailing is false
assert.strictEqual(
  normalize('foo/bar/', false),
  'foo/bar/',
  'normalize-path must preserve trailing slash when stripTrailing is false'
);
assert.strictEqual(
  normalize('foo\\bar\\', false),
  'foo/bar/',
  'normalize-path must convert backslash and preserve trailing slash when stripTrailing is false'
);

// 5. Preserves Win32 extended-length namespace prefix
assert.strictEqual(
  normalize('\\\\?\\dev\\foo\\bar'),
  '//?/dev/foo/bar',
  'normalize-path must handle Win32 ? namespace prefix'
);
assert.strictEqual(
  normalize('\\\\.\\dev\\foo\\bar'),
  '//./dev/foo/bar',
  'normalize-path must handle Win32 . namespace prefix'
);

// 6. Throws TypeError when passed a non-string argument
assert.throws(
  () => normalize(123),
  {
    name: 'TypeError',
    message: 'expected path to be a string',
  },
  'normalize-path must throw TypeError when argument is not a string'
);
assert.throws(
  () => normalize(null),
  {
    name: 'TypeError',
    message: 'expected path to be a string',
  },
  'normalize-path must throw TypeError for null input'
);

console.log('All contract assertions passed.');

오리진 시더

익명