サンプル
minimatch 10.2.6
検証済みサンプル — npm minimatch 10.2.6. node 22 · linux alpine/x64 · docker で contract を実行し、成功しました: matchPaths filters an array of file paths against glob patterns…
sha256:5c7faa03759ca818b307887d9bdf363606ed55c56db750b4d5c44a30c5fd61c9
このネットワークが提供するのは一つだけです。ビルドされるサンプル。サンドボックスで実行し、署名済みの受領証を保管します。等級はつけず、何も保証しません — 同じコードがあなたの環境でビルドされるかは測定していません。
合格した契約受領証を提出した異なる署名鍵の数です。1 なら作者だけ、2 以上なら他の誰かもビルドしています。鍵は自己生成で背後に登録された身元がないため、数えているのは人ではなく鍵です。
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@10.2.6
- パッケージ
- 環境
- node 22.23.2
- 作成日
- 2026-08-21T03:50:18Z
コントラクト
- matchPaths filters an array of file paths against glob patterns returning matching paths
- matchBase option enables matching slashless glob patterns against filename basenames across directory structures
- dotfiles are excluded from wildcard pattern matching by default and included when dot option is enabled
- nocase option enables case-insensitive glob matching across path segments and extensions
- makePatternRegex compiles glob expressions into valid RegExp objects preserving flags such as nocase
- escapePattern escapes special glob characters so they are treated as literal characters
- createMatcher produces Minimatch class instances providing hasMagic and match verification methods
ファイル
- 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@10.2.6
Kind: HOW
Use EXACTLY these public packages and versions:
- pkg:npm/minimatch@10.2.6
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:d95e8923f94cb5c596d44867c38e67a9cc5d014b62e56805d3b1874a42f91472","constraints":{"executionContext":"node"},"contract":["matchPaths filters an array of file paths against glob patterns returning matching paths","matchBase option enables matching slashless glob patterns against filename basenames across directory structures","dotfiles are excluded from wildcard pattern matching by default and included when dot option is enabled","nocase option enables case-insensitive glob matching across path segments and extensions","makePatternRegex compiles glob expressions into valid RegExp objects preserving flags such as nocase","escapePattern escapes special glob characters so they are treated as literal characters","createMatcher produces Minimatch class instances providing hasMagic and match verification methods"],"goal":"verify pkg:npm/minimatch@10.2.6","kind":"HOW","packages":["pkg:npm/minimatch@10.2.6"],"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@10.2.6"],"schemaVersion":1,"subject":"pkg:npm/minimatch@10.2.6","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": "10.2.6"
}
},
"node_modules/balanced-match": {
"version": "4.0.4",
"resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-4.0.4.tgz",
"integrity": "sha512-BLrgEcRTwX2o6gGxGOCNyMvGSp35YofuYzw9h1IMTRmKqttAZZVU67bdb9Pr2vUHA8+j3i2tJfjO6C6+4myGTA==",
"license": "MIT",
"engines": {
"node": "18 || 20 || >=22"
}
},
"node_modules/brace-expansion": {
"version": "5.0.9",
"resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-5.0.9.tgz",
"integrity": "sha512-ScQ4IuvIEF1TMlP7Zt+vjJ//9zlPb2SDcxWxM3bk8s6t6GGdJ7KO1dCcTidOPJKePW30LE/2cT7wCyPho9/Wxg==",
"license": "MIT",
"dependencies": {
"balanced-match": "^4.0.2"
},
"engines": {
"node": "20 || >=22"
}
},
"node_modules/minimatch": {
"version": "10.2.6",
"resolved": "https://registry.npmjs.org/minimatch/-/minimatch-10.2.6.tgz",
"integrity": "sha512-vpLQEs+VLCr1nU0BXS07maYoFwlDAH0gngQuuttxIwutDFEMHq2blX+8vpgxDdK3J1PwjCJiep77OitTZ4Ll1A==",
"license": "BlueOak-1.0.0",
"dependencies": {
"brace-expansion": "^5.0.8"
},
"engines": {
"node": "18 || 20 || >=22"
},
"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",
"dependencies": {
"minimatch": "10.2.6"
}
}
{
"schemaVersion": 1,
"goal": "verify pkg:npm/minimatch@10.2.6",
"kind": "HOW",
"packages": [
"pkg:npm/minimatch@10.2.6"
],
"constraints": {
"executionContext": "node"
},
"runtimeConditions": {
"ecosystem": "npm",
"language": "javascript",
"moduleSystem": "cjs",
"packageManager": "npm@10.9.8",
"runtime": "node@22.23.2"
}
}
'use strict';
const { minimatch, Minimatch, match, makeRe, escape } = require('minimatch');
/**
* Filter an array of file paths against a glob pattern.
* @param {string[]} list - Array of path strings to filter
* @param {string} pattern - Glob pattern
* @param {object} [options] - Minimatch options
* @returns {string[]} Filtered array of matching paths
*/
function matchPaths(list, pattern, options) {
return match(list, 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 or false if invalid
*/
function makePatternRegex(pattern, options) {
return makeRe(pattern, options);
}
/**
* Escape special glob characters in a pattern.
* @param {string} pattern - Glob pattern to escape
* @param {object} [options] - Minimatch options
* @returns {string} Escaped pattern string
*/
function escapePattern(pattern, options) {
return escape(pattern, options);
}
/**
* Create a Minimatch instance for reusable pattern matching.
* @param {string} pattern - Glob pattern
* @param {object} [options] - Minimatch options
* @returns {Minimatch} Minimatch instance
*/
function createMatcher(pattern, options) {
return new Minimatch(pattern, options);
}
module.exports = {
minimatch,
Minimatch,
match,
makeRe,
escape,
matchPaths,
makePatternRegex,
escapePattern,
createMatcher
};
import assert from 'node:assert';
import { createRequire } from 'node:module';
const require = createRequire(import.meta.url);
const {
minimatch,
Minimatch,
match,
makeRe,
escape,
matchPaths,
makePatternRegex,
escapePattern,
createMatcher
} = require('../src/index.js');
// 1. Export verification
assert.strictEqual(typeof minimatch, 'function', 'minimatch should be exported as a function');
assert.strictEqual(typeof Minimatch, 'function', 'Minimatch class should be exported');
assert.strictEqual(typeof match, 'function', 'match should be a function');
assert.strictEqual(typeof makeRe, 'function', 'makeRe should be a function');
assert.strictEqual(typeof escape, 'function', 'escape should be a function');
assert.strictEqual(typeof matchPaths, 'function', 'matchPaths should be a function');
assert.strictEqual(typeof makePatternRegex, 'function', 'makePatternRegex should be a function');
assert.strictEqual(typeof escapePattern, 'function', 'escapePattern should be a function');
assert.strictEqual(typeof createMatcher, 'function', 'createMatcher should be a function');
const sampleFiles = [
'src/index.js',
'src/utils.ts',
'test/contract.mjs',
'docs/guide.md',
'.env',
'.eslintrc.json',
'dist/app.JS'
];
// 2. matchPaths filters array of paths against glob pattern
const jsMatches = matchPaths(sampleFiles, '**/*.js');
assert.deepStrictEqual(jsMatches, ['src/index.js']);
const allCodeMatches = matchPaths(sampleFiles, '**/*.{js,ts,mjs}');
assert.deepStrictEqual(allCodeMatches, ['src/index.js', 'src/utils.ts', 'test/contract.mjs']);
// 3. matchBase option matches slash-less patterns against file basenames across directories
const baseMatches = matchPaths(sampleFiles, '*.js', { matchBase: true });
assert.deepStrictEqual(baseMatches, ['src/index.js']);
const tsBaseMatches = matchPaths(sampleFiles, '*.ts', { matchBase: true });
assert.deepStrictEqual(tsBaseMatches, ['src/utils.ts']);
// 4. dot option includes dotfiles in wildcard matching which are excluded by default
const defaultWildcard = matchPaths(sampleFiles, '*');
assert.strictEqual(defaultWildcard.includes('.env'), false);
assert.strictEqual(defaultWildcard.includes('.eslintrc.json'), false);
const dotWildcard = matchPaths(sampleFiles, '.*', { dot: true });
assert.deepStrictEqual(dotWildcard, ['.env', '.eslintrc.json']);
// 5. nocase option performs case-insensitive glob matching
const caseSensitive = matchPaths(sampleFiles, '**/*.js');
assert.strictEqual(caseSensitive.includes('dist/app.JS'), false);
const caseInsensitive = matchPaths(sampleFiles, '**/*.js', { nocase: true });
assert.deepStrictEqual(caseInsensitive, ['src/index.js', 'dist/app.JS']);
// 6. makePatternRegex compiles glob pattern to RegExp with appropriate flags and matching
const regex = makePatternRegex('**/*.js');
assert(regex instanceof RegExp);
assert.strictEqual(regex.test('src/index.js'), true);
assert.strictEqual(regex.test('src/utils.ts'), false);
const nocaseRegex = makePatternRegex('*.js', { nocase: true });
assert(nocaseRegex instanceof RegExp);
assert.strictEqual(nocaseRegex.flags.includes('i'), true);
assert.strictEqual(nocaseRegex.test('INDEX.JS'), true);
// 7. escapePattern escapes special glob characters for literal matching
const escaped = escapePattern('file[1]*.js');
assert.strictEqual(escaped, 'file\\[1\\]\\*.js');
// 8. createMatcher produces Minimatch instances with match and hasMagic methods
const matcher = createMatcher('**/*.ts', { nocase: true });
assert.strictEqual(matcher.hasMagic(), true);
assert.strictEqual(matcher.match('src/utils.ts'), true);
assert.strictEqual(matcher.match('src/utils.TS'), true);
assert.strictEqual(matcher.match('src/index.js'), false);
const literalMatcher = createMatcher('src/index.js');
assert.strictEqual(literalMatcher.hasMagic(), false);
assert.strictEqual(literalMatcher.match('src/index.js'), true);
console.log('Contract tests passed successfully.');
オリジンシーダー
匿名