샘플
minimatch 5.1.9
검증된 샘플 — npm minimatch 5.1.9. node 22 · linux alpine/x64 · docker에서 contract를 실행해 통과했습니다: matchPath tests if a file path matches a glob pattern with optional…
sha256:518346c78ff1b82396f1f753ae310b741cc6c50c16dfb141a3bb24c49b2a88e6
이 네트워크가 제공하는 것은 하나입니다. 빌드되는 샘플. 샌드박스에서 돌리고 서명된 영수증을 보관합니다. 등급을 매기지 않고 무엇도 보증하지 않습니다 — 같은 코드가 당신 환경에서 빌드되는지는 측정한 적이 없습니다.
통과한 계약 영수증을 낸 서로 다른 서명 키의 수입니다. 하나면 작성자 혼자이고, 둘 이상이면 다른 사람도 빌드했다는 뜻입니다. 키는 스스로 만드는 것이고 뒤에 등록된 신원이 없으므로, 세는 것은 사람이 아니라 키입니다.
MIT-0
실행 증거
선언된 환경과 서명된 실행을 분리해 두었습니다. 이 샘플이 무엇을 어디서 실행했는지 그대로 볼 수 있습니다.
- 증거 기준
- 서명된 컨트랙트 통과
- 검증 영수증
- 1
- 빌드한 서명 키
- 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@1 |
2026-08-21 |
케이스
HOW- 목표
- verify pkg:npm/minimatch@5.1.9
- 패키지
- 환경
- node 22.23.2
- 생성일
- 2026-08-21T03:52:16Z
컨트랙트
- matchPath tests if a file path matches a glob pattern with optional flags
- filterPaths filters an array of file paths matching a glob pattern
- createMatcher instantiates a Minimatch object for reusable pattern matching
- compileRegex compiles a glob pattern into a regular expression using makeRe
- supports dotfile matching and case-insensitive options
파일
- 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 pkg:npm/minimatch@5.1.9
Kind: HOW
Use EXACTLY these public packages and versions:
- pkg:npm/minimatch@5.1.9
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.
{"case":{"caseId":"case:sha256:bd8c109474c50264fadc71fcb714a29e5eb3f6133c236153c8fa5b5950f3f749","constraints":{"executionContext":"node"},"contract":["matchPath tests if a file path matches a glob pattern with optional flags","filterPaths filters an array of file paths matching a glob pattern","createMatcher instantiates a Minimatch object for reusable pattern matching","compileRegex compiles a glob pattern into a regular expression using makeRe","supports dotfile matching and case-insensitive options"],"goal":"verify pkg:npm/minimatch@5.1.9","kind":"HOW","packages":["pkg:npm/minimatch@5.1.9"],"schemaVersion":1},"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/minimatch@5.1.9"],"schemaVersion":1,"subject":"pkg:npm/minimatch@5.1.9","verifierAdapter":"node-typescript@1"}
{
"name": "sample-minimatch",
"version": "1.0.0",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "sample-minimatch",
"version": "1.0.0",
"dependencies": {
"minimatch": "5.1.9"
}
},
"node_modules/balanced-match": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz",
"integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==",
"license": "MIT"
},
"node_modules/brace-expansion": {
"version": "2.1.4",
"resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.1.4.tgz",
"integrity": "sha512-hGfVzPxthbf3+2yjg/RBs60cB0FhqBS/zvdV/4wn4/BmN0bNMMHPc4V/BbFieqf1TKAGGAHnY4eSjajCl0f2Xg==",
"license": "MIT",
"dependencies": {
"balanced-match": "^1.0.0"
}
},
"node_modules/minimatch": {
"version": "5.1.9",
"resolved": "https://registry.npmjs.org/minimatch/-/minimatch-5.1.9.tgz",
"integrity": "sha512-7o1wEA2RyMP7Iu7GNba9vc0RWWGACJOCZBJX2GJWip0ikV+wcOsgVuY9uE8CPiyQhkGFSlhuSkZPavN7u1c2Fw==",
"license": "ISC",
"dependencies": {
"brace-expansion": "^2.0.1"
},
"engines": {
"node": ">=10"
}
}
}
}
{
"name": "sample-minimatch",
"version": "1.0.0",
"private": true,
"description": "Clean-room verification of minimatch",
"main": "src/index.js",
"dependencies": {
"minimatch": "5.1.9"
}
}
{
"schemaVersion": 1,
"goal": "verify pkg:npm/minimatch@5.1.9",
"kind": "HOW",
"packages": [
"pkg:npm/minimatch@5.1.9"
],
"constraints": {
"executionContext": "node"
},
"runtimeConditions": {
"ecosystem": "npm",
"language": "javascript",
"moduleSystem": "cjs",
"packageManager": "npm@10.9.8",
"runtime": "node@22.23.2"
}
}
const minimatch = require('minimatch');
/**
* Match a file path against a glob pattern.
* @param {string} path - File path to test
* @param {string} pattern - Glob pattern
* @param {object} [options] - Minimatch options
* @returns {boolean} True if matches
*/
function matchPath(path, pattern, options) {
return minimatch(path, pattern, options);
}
/**
* Filter an array of paths against a glob pattern.
* @param {string[]} paths - Array of file paths
* @param {string} pattern - Glob pattern
* @param {object} [options] - Minimatch options
* @returns {string[]} Filtered matching paths
*/
function filterPaths(paths, pattern, options) {
return minimatch.match(paths, pattern, options);
}
/**
* Create a reusable Minimatch instance for pattern matching.
* @param {string} pattern - Glob pattern
* @param {object} [options] - Minimatch options
* @returns {minimatch.Minimatch} Minimatch instance
*/
function createMatcher(pattern, options) {
return new minimatch.Minimatch(pattern, options);
}
/**
* Compile a glob pattern into a regular expression.
* @param {string} pattern - Glob pattern
* @param {object} [options] - Minimatch options
* @returns {RegExp|false} Compiled RegExp
*/
function compileRegex(pattern, options) {
return minimatch.makeRe(pattern, options);
}
module.exports = {
matchPath,
filterPaths,
createMatcher,
compileRegex,
minimatch
};
import assert from 'node:assert';
import { createRequire } from 'node:module';
const require = createRequire(import.meta.url);
const {
matchPath,
filterPaths,
createMatcher,
compileRegex,
minimatch
} = require('../src/index.js');
// 1. Export verification
assert.strictEqual(typeof minimatch, 'function', 'minimatch should be exported as a function');
assert.strictEqual(typeof matchPath, 'function', 'matchPath should be a function');
assert.strictEqual(typeof filterPaths, 'function', 'filterPaths should be a function');
assert.strictEqual(typeof createMatcher, 'function', 'createMatcher should be a function');
assert.strictEqual(typeof compileRegex, 'function', 'compileRegex should be a function');
// 2. matchPath tests if a file path matches a glob pattern with optional flags
assert.strictEqual(matchPath('foo.js', '*.js'), true, 'foo.js should match *.js');
assert.strictEqual(matchPath('foo.txt', '*.js'), false, 'foo.txt should not match *.js');
assert.strictEqual(matchPath('src/nested/file.js', '**/*.js'), true, 'globstar should match nested files');
// 3. filterPaths filters an array of file paths matching a glob pattern
const fileList = ['index.js', 'styles.css', 'app.js', 'README.md'];
const jsFiles = filterPaths(fileList, '*.js');
assert.deepStrictEqual(jsFiles, ['index.js', 'app.js'], 'filterPaths should match only js files');
// 4. createMatcher instantiates a Minimatch object for reusable pattern matching
const matcher = createMatcher('src/**/*.ts');
assert.strictEqual(matcher.match('src/components/button.ts'), true, 'Minimatch instance match should be true');
assert.strictEqual(matcher.match('docs/readme.md'), false, 'Minimatch instance match should be false');
// 5. compileRegex compiles a glob pattern into a regular expression using makeRe
const regex = compileRegex('*.json');
assert.ok(regex instanceof RegExp, 'compileRegex should return a RegExp');
assert.strictEqual(regex.test('config.json'), true, 'compiled regex should match config.json');
assert.strictEqual(regex.test('config.yaml'), false, 'compiled regex should not match config.yaml');
// 6. Supports dotfile matching and case-insensitive options
assert.strictEqual(matchPath('.env', '*.env'), false, 'dotfiles should be excluded by default');
assert.strictEqual(matchPath('.env', '*.env', { dot: true }), true, 'dotfiles should match when dot is true');
assert.strictEqual(matchPath('FILE.JS', '*.js'), false, 'case matching should be strict by default');
assert.strictEqual(matchPath('FILE.JS', '*.js', { nocase: true }), true, 'nocase option should enable case insensitivity');
console.log('Contract tests passed successfully.');
오리진 시더
익명