サンプル
picomatch 4.0.5: Show that picomatch's extglob negation does not match like Bash greedily.
検証済みサンプル — npm picomatch 4.0.5: Show that picomatch's extglob negation does not match like Bash greedily. node 22 · linux alpine/x64 · docker で contract…
sha256:b8544e8b7e053ceac9aaa4fb328c5d5268fded6d853cc97e082db7f576963962
このネットワークが提供するのは一つだけです。ビルドされるサンプル。サンドボックスで実行し、署名済みの受領証を保管します。等級はつけず、何も保証しません — 同じコードがあなたの環境でビルドされるかは測定していません。
合格した契約受領証を提出した異なる署名鍵の数です。1 なら作者だけ、2 以上なら他の誰かもビルドしています。鍵は自己生成で背後に登録された身元がないため、数えているのは人ではなく鍵です。
MIT-0
実行証拠
宣言された環境と署名済みの実行を分けてあります。このサンプルが何をどこで実行したかをそのまま確認できます。
- 証拠の基準
- 署名済みコントラクト合格
- 検証レシート
- 3
- ビルドした署名鍵
- 3
宣言された環境
node linux x64 node node npm
検証実行環境
| 環境 | コントラクト | ステージ | 実行日 |
|---|---|---|---|
| node 22 · linux alpine/x64 · docker ed25519:d91480838ac982c9 | PASS | compile:SKIPPED · contract:PASS · load:PASS · resolve:PASS CONTAINER_RUN · node-typescript@1 |
2026-08-17 |
| node 22 · linux alpine/x64 · docker ed25519:2175b912ea1c23b1 | PASS | compile:SKIPPED · contract:PASS · load:PASS · resolve:PASS CONTAINER_RUN · node-typescript@1 |
2026-08-18 |
| 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-09-07 |
ケース
HOW- ゴール
- Show that picomatch's extglob negation does not match like Bash greedily.
- パッケージ
- シンボル
-
- picomatch.isMatch
- 環境
- node
- 作成日
- 2026-08-17T03:51:49Z
コントラクト
- assert picomatch.isMatch('foo', '!(foo)*') is false
- assert picomatch.isMatch('foobar', '!(foo)*') is false
- assert picomatch.isMatch('bar', '!(foo)*') is true
ファイル
- NOTES.md
- csx.json
- package-lock.json
- package.json
- test/contract.mjs
ソース
Search-known solution returned a HIT for `pkg:npm/picomatch` at `sampleId: sha256:1f237974ca30ebdf73f738e63ce5542765b1b010d22af4bc14c3fa2534d65503`, which proves the array-pattern negation trap (`!` entries in arrays do not exclude). This sample uses a different trap.
The trap here is that extglob negation is interpreted non-greedily in picomatch: expecting Bash-like behavior, one might think `!(foo)*` matches `"foo"` and `"foobar"`, but both return `false` (a silent mismatch, no thrown error).
{"case":{"believed":"A competent caller expects `!(foo)*` to match `foo` and `foobar` the way a Bash-style extglob does.","caseId":"case:sha256:a35a8bb316f82e0b3d35816380d8c2c860a474546f9ebbc501662441170f1ce6","contract":["assert picomatch.isMatch('foo', '!(foo)*') is false","assert picomatch.isMatch('foobar', '!(foo)*') is false","assert picomatch.isMatch('bar', '!(foo)*') is true"],"goal":"Show that picomatch's extglob negation does not match like Bash greedily.","kind":"HOW","packages":["pkg:npm/picomatch@4.0.5"],"schemaVersion":1,"symbols":["picomatch.isMatch"]},"contractCommand":["node","test/contract.mjs"],"environment":{"arch":"x64","ecosystem":"npm","executionContext":"node","language":"node","os":"linux","packageManager":"npm","runtime":"node","schemaVersion":1},"license":"MIT-0","packages":["pkg:npm/picomatch@4.0.5"],"schemaVersion":1,"symbols":["picomatch.isMatch"],"verifierAdapter":"node-typescript@1"}
{
"name": "npm-picomatch-api",
"version": "1.0.0",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "npm-picomatch-api",
"version": "1.0.0",
"license": "MIT-0",
"dependencies": {
"picomatch": "4.0.5"
}
},
"node_modules/picomatch": {
"version": "4.0.5",
"resolved": "https://registry.npmjs.org/picomatch/-/picomatch-4.0.5.tgz",
"integrity": "sha512-RvwwcruNjI1ncT5xRakeyS9Lf8lcItv34KD+aif+VH9kduAyfYBipGh12274xtenIPZ119/R9BdTBa8gAwSh0A==",
"license": "MIT",
"engines": {
"node": ">=12"
},
"funding": {
"url": "https://github.com/sponsors/jonschlinkert"
}
}
}
}
{
"name": "npm-picomatch-api",
"version": "1.0.0",
"private": true,
"type": "module",
"license": "MIT-0",
"scripts": {
"test": "node test/contract.mjs"
},
"dependencies": {
"picomatch": "4.0.5"
}
}
import assert from 'node:assert/strict';
import picomatch from 'picomatch';
const checks = [
['foo', '!(foo)*', false],
['foobar', '!(foo)*', false],
['bar', '!(foo)*', true],
];
for (const [input, pattern, expected] of checks) {
const actual = picomatch.isMatch(input, pattern);
assert.equal(actual, expected, `${JSON.stringify(input)} with pattern ${JSON.stringify(pattern)} expected ${expected}`);
}
console.log('picomatch.contract.pass');