샘플
minimatch 9.0.9
검증된 샘플 — npm minimatch 9.0.9. node 22 · linux alpine/x64 · docker에서 contract를 실행해 통과했습니다: matchPath tests file paths against glob patterns with wildcards…
sha256:bd6d3e054d0c0e5105ccbace0b3714afa38ef995cd3aecfb209526468b51bf15
이 네트워크가 제공하는 것은 하나입니다. 빌드되는 샘플. 샌드박스에서 돌리고 서명된 영수증을 보관합니다. 등급을 매기지 않고 무엇도 보증하지 않습니다 — 같은 코드가 당신 환경에서 빌드되는지는 측정한 적이 없습니다.
통과한 계약 영수증을 낸 서로 다른 서명 키의 수입니다. 하나면 작성자 혼자이고, 둘 이상이면 다른 사람도 빌드했다는 뜻입니다. 키는 스스로 만드는 것이고 뒤에 등록된 신원이 없으므로, 세는 것은 사람이 아니라 키입니다.
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@9.0.9
- 패키지
- 환경
- node 22.23.2
- 생성일
- 2026-08-21T03:55:20Z
컨트랙트
- matchPath tests file paths against glob patterns with wildcards, single character matches, and character classes
- createFilter generates a predicate function for filtering path arrays with glob patterns
- matchFiles filters an array of paths matching a glob pattern directly
- globToRegex converts glob patterns into RegExp instances for pattern matching
- Minimatch class instantiates glob matchers with match and hasMagic methods
- expandBraces expands brace alternative patterns into multiple glob combinations
- escapeGlob and unescapeGlob escape and unescape glob magic characters
- matchPath supports dot, nocase, and matchBase options for specialized glob matching
파일
- 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@9.0.9
Kind: HOW
Use EXACTLY these public packages and versions:
- pkg:npm/minimatch@9.0.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:61837f036038392e784f8fdd478f2b225c8dfa356554543638bbfef3633f0627","constraints":{"executionContext":"node"},"contract":["matchPath tests file paths against glob patterns with wildcards, single character matches, and character classes","createFilter generates a predicate function for filtering path arrays with glob patterns","matchFiles filters an array of paths matching a glob pattern directly","globToRegex converts glob patterns into RegExp instances for pattern matching","Minimatch class instantiates glob matchers with match and hasMagic methods","expandBraces expands brace alternative patterns into multiple glob combinations","escapeGlob and unescapeGlob escape and unescape glob magic characters","matchPath supports dot, nocase, and matchBase options for specialized glob matching"],"goal":"verify pkg:npm/minimatch@9.0.9","kind":"HOW","packages":["pkg:npm/minimatch@9.0.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@9.0.9"],"schemaVersion":1,"subject":"pkg:npm/minimatch@9.0.9","verifierAdapter":"node-typescript@1"}
{
"name": "sample-minimatch",
"version": "1.0.0",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "sample-minimatch",
"version": "1.0.0",
"license": "MIT-0",
"dependencies": {
"minimatch": "9.0.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": "9.0.9",
"resolved": "https://registry.npmjs.org/minimatch/-/minimatch-9.0.9.tgz",
"integrity": "sha512-OBwBN9AL4dqmETlpS2zasx+vTeWclWzkblfZk7KTA5j3jeOONz/tRCnZomUyvNg83wL5Zv9Ss6HMJXAgL8R2Yg==",
"license": "ISC",
"dependencies": {
"brace-expansion": "^2.0.2"
},
"engines": {
"node": ">=16 || 14 >=14.17"
},
"funding": {
"url": "https://github.com/sponsors/isaacs"
}
}
}
}
{
"name": "sample-minimatch",
"version": "1.0.0",
"private": true,
"description": "Clean-room verification of minimatch",
"main": "src/index.js",
"license": "MIT-0",
"dependencies": {
"minimatch": "9.0.9"
}
}
{
"schemaVersion": 1,
"goal": "verify pkg:npm/minimatch@9.0.9",
"kind": "HOW",
"packages": [
"pkg:npm/minimatch@9.0.9"
],
"constraints": {
"executionContext": "node"
},
"runtimeConditions": {
"ecosystem": "npm",
"language": "javascript",
"moduleSystem": "cjs",
"packageManager": "npm@10.9.8",
"runtime": "node@22.23.2"
}
}
'use strict';
const minimatchPkg = require('minimatch');
const minimatch = typeof minimatchPkg === 'function' ? minimatchPkg : minimatchPkg.minimatch;
const {
filter = minimatch.filter,
match = minimatch.match,
makeRe = minimatch.makeRe,
braceExpand = minimatch.braceExpand,
escape = minimatch.escape,
unescape = minimatch.unescape,
Minimatch = minimatch.Minimatch
} = minimatchPkg;
/**
* Tests whether a path string matches a glob pattern.
* @param {string} p - File path to test
* @param {string} pattern - Glob pattern
* @param {object} [options] - Matching options
* @returns {boolean}
*/
function matchPath(p, pattern, options) {
return minimatch(p, pattern, options);
}
/**
* Returns a filter predicate function for arrays.
* @param {string} pattern - Glob pattern
* @param {object} [options] - Matching options
* @returns {Function}
*/
function createFilter(pattern, options) {
return filter(pattern, options);
}
/**
* Filters a list of path strings matching a pattern.
* @param {string[]} list - Array of path strings
* @param {string} pattern - Glob pattern
* @param {object} [options] - Matching options
* @returns {string[]}
*/
function matchFiles(list, pattern, options) {
return match(list, pattern, options);
}
/**
* Converts a glob pattern into a regular expression.
* @param {string} pattern - Glob pattern
* @param {object} [options] - Matching options
* @returns {RegExp|null}
*/
function globToRegex(pattern, options) {
return makeRe(pattern, options);
}
/**
* Expands brace patterns into an array of glob strings.
* @param {string} pattern - Glob pattern containing braces
* @param {object} [options] - Matching options
* @returns {string[]}
*/
function expandBraces(pattern, options) {
return braceExpand(pattern, options);
}
/**
* Escapes glob magic characters in a string.
* @param {string} pattern - Glob pattern
* @returns {string}
*/
function escapeGlob(pattern) {
return escape(pattern);
}
/**
* Unescapes glob magic characters in a string.
* @param {string} pattern - Glob pattern
* @returns {string}
*/
function unescapeGlob(pattern) {
return unescape(pattern);
}
/**
* Creates a Minimatch class instance for compiled glob operations.
* @param {string} pattern - Glob pattern
* @param {object} [options] - Matching options
* @returns {Minimatch}
*/
function createMinimatch(pattern, options) {
return new Minimatch(pattern, options);
}
module.exports = {
minimatch,
Minimatch,
matchPath,
createFilter,
matchFiles,
globToRegex,
expandBraces,
escapeGlob,
unescapeGlob,
createMinimatch
};
import assert from 'node:assert';
import { createRequire } from 'node:module';
const require = createRequire(import.meta.url);
const {
minimatch,
Minimatch,
matchPath,
createFilter,
matchFiles,
globToRegex,
expandBraces,
escapeGlob,
unescapeGlob,
createMinimatch
} = require('../src/index.js');
// 1. Direct glob matching with wildcards, single character matches, and character classes
assert.strictEqual(matchPath('file.txt', '*.txt'), true, '*.txt matches file.txt');
assert.strictEqual(matchPath('file.js', '*.txt'), false, '*.txt does not match file.js');
assert.strictEqual(matchPath('foo1.js', 'foo?.js'), true, 'foo?.js matches foo1.js');
assert.strictEqual(matchPath('foo12.js', 'foo?.js'), false, 'foo?.js does not match foo12.js');
assert.strictEqual(matchPath('file3.txt', 'file[0-9].txt'), true, 'character class [0-9] matches 3');
assert.strictEqual(matchPath('fileA.txt', 'file[0-9].txt'), false, 'character class [0-9] rejects A');
// 2. filter creates a predicate function for Array.prototype.filter
const fileList = ['src/a.ts', 'src/b.js', 'test/a.test.js', 'package.json'];
const jsFilter = createFilter('**/*.js');
assert.deepStrictEqual(fileList.filter(jsFilter), ['src/b.js', 'test/a.test.js'], 'filter should filter matching paths');
// 3. match filters an array of strings directly
const matchedJson = matchFiles(fileList, '*.json');
assert.deepStrictEqual(matchedJson, ['package.json'], 'matchFiles should filter top-level json file');
// 4. makeRe converts glob pattern into a regular expression
const re = globToRegex('*.spec.js');
assert.ok(re instanceof RegExp, 'makeRe must return a RegExp instance');
assert.strictEqual(re.test('index.spec.js'), true, 'makeRe RegExp matches index.spec.js');
assert.strictEqual(re.test('index.js'), false, 'makeRe RegExp rejects index.js');
// 5. Minimatch class instantiation and match method
const mm = createMinimatch('src/**/*.ts');
assert.strictEqual(mm.match('src/components/Button.ts'), true, 'Minimatch instance matches nested ts file');
assert.strictEqual(mm.match('dist/index.js'), false, 'Minimatch instance rejects dist/index.js');
assert.strictEqual(mm.hasMagic(), true, 'hasMagic returns true for glob pattern');
// 6. braceExpand expands brace patterns into multiple glob strings
const expanded = expandBraces('{src,test}/**/*.{js,ts}');
assert.deepStrictEqual(
expanded,
['src/**/*.js', 'src/**/*.ts', 'test/**/*.js', 'test/**/*.ts'],
'expandBraces expands brace options'
);
// 7. escape and unescape handle glob special characters
const escaped = escapeGlob('hello*[world]?');
assert.strictEqual(escaped, 'hello\\*\\[world\\]\\?', 'escape backslashes special glob characters');
const unescaped = unescapeGlob('hello\\[world\\]');
assert.strictEqual(unescaped, 'hello[world]', 'unescape unescapes bracket characters');
// 8. Pattern matching options: dot, nocase, and matchBase
assert.strictEqual(matchPath('.env', '*.env'), false, 'dotfiles not matched by default wildcard');
assert.strictEqual(matchPath('.env', '*.env', { dot: true }), true, 'dot:true matches dotfiles');
assert.strictEqual(matchPath('README.MD', '*.md'), false, 'case-sensitive by default');
assert.strictEqual(matchPath('README.MD', '*.md', { nocase: true }), true, 'nocase:true ignores case');
assert.strictEqual(matchPath('nested/dir/app.js', '*.js', { matchBase: true }), true, 'matchBase matches filename in subdirectories');
console.log('Contract tests passed successfully.');
오리진 시더
익명