Exemplo
micromatch 4.0.8: makeRe
Amostra verificada para npm micromatch 4.0.8: makeRe. O contrato rodou em node 22 · linux alpine/x64 · docker e passou: assert micromatch.makeRe returns a…
sha256:bf53e8249777194cbf9c29ab3d9c8f3a255dbbb0db02e9db19e98a7c9c0b14ea
Esta rede oferece uma coisa: uma amostra que compila. Ela a executou em um sandbox e guardou o recibo assinado. Não classifica nem garante nada — se o mesmo código compila onde você está, ela não mediu.
Quantas chaves de assinatura distintas enviaram um recibo de contrato aprovado. Uma é só o autor; mais de uma significa que outra pessoa também o compilou. Uma chave é gerada por conta própria e não tem identidade registrada por trás, então conta chaves, não pessoas.
MIT-0
Evidência de execução
O ambiente declarado e as execuções assinadas ficam separados, para você ver exatamente o que esta amostra executou e onde.
- Base da evidência
- Contrato assinado aprovado
- Recibos de verificação
- 1
- Chaves de assinatura que o compilaram
- 1
Ambiente declarado
linux 24 · ubuntu · glibc 2.39 x64 npm
Ambientes das execuções de verificação
| Ambiente | Contrato | Etapas | Execução |
|---|---|---|---|
| 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-28 |
Caso
HOW- Objetivo
- verify micromatch.makeRe in pkg:npm/micromatch@4.0.8
- Pacotes
- Símbolos
-
- micromatch.makeRe
- Criado
- 2026-08-28T02:48:09Z
Contrato
- assert micromatch.makeRe returns a RegExp instance for glob patterns
- assert micromatch.makeRe matches wildcard and globstar directory patterns
- assert micromatch.makeRe matches brace expansion patterns
- assert micromatch.makeRe respects dot option to include or exclude dotfiles
- assert micromatch.makeRe respects nocase option for case-insensitive matching
- assert micromatch.makeRe respects contains option for substring matching
- assert micromatch.makeRe applies custom regex flags when specified
- assert micromatch.makeRe throws TypeError for non-string or empty patterns
Arquivos
- PROMPT.md
- csx.json
- index.js
- package-lock.json
- package.json
- spec.json
- test/contract.mjs
Código-fonte
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 micromatch.makeRe in pkg:npm/micromatch@4.0.8
Kind: HOW
Use EXACTLY these public packages and versions:
- pkg:npm/micromatch@4.0.8
Demonstrate these symbols/APIs:
- micromatch.makeRe
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:d3a4cbfb27f92f220e1ec4d1e58194395daeb925c2b781997ab8e2f859eab9e1","contract":["assert micromatch.makeRe returns a RegExp instance for glob patterns","assert micromatch.makeRe matches wildcard and globstar directory patterns","assert micromatch.makeRe matches brace expansion patterns","assert micromatch.makeRe respects dot option to include or exclude dotfiles","assert micromatch.makeRe respects nocase option for case-insensitive matching","assert micromatch.makeRe respects contains option for substring matching","assert micromatch.makeRe applies custom regex flags when specified","assert micromatch.makeRe throws TypeError for non-string or empty patterns"],"goal":"verify micromatch.makeRe in pkg:npm/micromatch@4.0.8","kind":"HOW","packages":["pkg:npm/micromatch@4.0.8"],"schemaVersion":1,"symbols":["micromatch.makeRe"]},"contractCommand":["node","test/contract.mjs"],"environment":{"arch":"x64","distro":"ubuntu","ecosystem":"npm","libc":"glibc","libcVersion":"2.39","os":"linux","osVersionBucket":"24","packageManager":"npm","schemaVersion":1},"license":"MIT-0","packages":["pkg:npm/micromatch@4.0.8"],"schemaVersion":1,"subject":"pkg:npm/micromatch@4.0.8","symbols":["micromatch.makeRe"],"verifierAdapter":"node-typescript@1"}
const micromatch = require('micromatch');
/**
* Creates a regular expression from a glob pattern.
*
* @param {string} pattern - Glob pattern to convert.
* @param {object} [options] - Options passed to micromatch.makeRe.
* @returns {RegExp} Compiled regular expression.
*/
function createMatcher(pattern, options) {
return micromatch.makeRe(pattern, options);
}
/**
* Tests whether a given path matches a glob pattern using micromatch.makeRe.
*
* @param {string} path - Target path string.
* @param {string} pattern - Glob pattern.
* @param {object} [options] - Optional configuration.
* @returns {boolean} True if the path matches the pattern regex.
*/
function testPattern(path, pattern, options) {
const regex = micromatch.makeRe(pattern, options);
return regex.test(path);
}
module.exports = {
createMatcher,
testPattern,
micromatch,
};
{
"name": "sample-micromatch-make-re",
"version": "1.0.0",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "sample-micromatch-make-re",
"version": "1.0.0",
"license": "MIT-0",
"dependencies": {
"micromatch": "4.0.8"
}
},
"node_modules/braces": {
"version": "3.0.3",
"resolved": "https://registry.npmjs.org/braces/-/braces-3.0.3.tgz",
"integrity": "sha512-yQbXgO/OSZVD2IsiLlro+7Hf6Q18EJrKSEsdoMzKePKXct3gvD8oLcOQdIzGupr5Fj+EDe8gO/lxc1BzfMpxvA==",
"license": "MIT",
"dependencies": {
"fill-range": "^7.1.1"
},
"engines": {
"node": ">=8"
}
},
"node_modules/fill-range": {
"version": "7.1.1",
"resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.1.1.tgz",
"integrity": "sha512-YsGpe3WHLK8ZYi4tWDg2Jy3ebRz2rXowDxnld4bkQB00cc/1Zw9AWnC0i9ztDJitivtQvaI9KaLyKrc+hBW0yg==",
"license": "MIT",
"dependencies": {
"to-regex-range": "^5.0.1"
},
"engines": {
"node": ">=8"
}
},
"node_modules/is-number": {
"version": "7.0.0",
"resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz",
"integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==",
"license": "MIT",
"engines": {
"node": ">=0.12.0"
}
},
"node_modules/micromatch": {
"version": "4.0.8",
"resolved": "https://registry.npmjs.org/micromatch/-/micromatch-4.0.8.tgz",
"integrity": "sha512-PXwfBhYu0hBCPw8Dn0E+WDYb7af3dSLVWKi3HGv84IdF4TyFoC0ysxFd0Goxw7nSv4T/PzEJQxsYsEiFCKo2BA==",
"license": "MIT",
"dependencies": {
"braces": "^3.0.3",
"picomatch": "^2.3.1"
},
"engines": {
"node": ">=8.6"
}
},
"node_modules/picomatch": {
"version": "2.3.2",
"resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.2.tgz",
"integrity": "sha512-V7+vQEJ06Z+c5tSye8S+nHUfI51xoXIXjHQ99cQtKUkQqqO1kO/KCJUfZXuB47h/YBlDhah2H3hdUGXn8ie0oA==",
"license": "MIT",
"engines": {
"node": ">=8.6"
},
"funding": {
"url": "https://github.com/sponsors/jonschlinkert"
}
},
"node_modules/to-regex-range": {
"version": "5.0.1",
"resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz",
"integrity": "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==",
"license": "MIT",
"dependencies": {
"is-number": "^7.0.0"
},
"engines": {
"node": ">=8.0"
}
}
}
}
{
"name": "sample-micromatch-make-re",
"version": "1.0.0",
"description": "Clean-room sample verifying micromatch.makeRe functionality",
"main": "index.js",
"license": "MIT-0",
"dependencies": {
"micromatch": "4.0.8"
}
}
{
"schemaVersion": 1,
"goal": "verify micromatch.makeRe in pkg:npm/micromatch@4.0.8",
"kind": "HOW",
"packages": [
"pkg:npm/micromatch@4.0.8"
],
"symbols": [
"micromatch.makeRe"
]
}
import assert from 'node:assert';
import micromatch from 'micromatch';
import { createMatcher, testPattern } from '../index.js';
// 1. Returns a valid RegExp instance for standard glob patterns
const basicRe = createMatcher('*.js');
assert.ok(basicRe instanceof RegExp, 'makeRe must return a RegExp instance');
assert.strictEqual(basicRe.test('app.js'), true, 'makeRe regex matches matching filenames');
assert.strictEqual(basicRe.test('app.ts'), false, 'makeRe regex rejects non-matching filenames');
const directRe = micromatch.makeRe('*.js');
assert.ok(directRe instanceof RegExp, 'direct micromatch.makeRe must return a RegExp instance');
assert.strictEqual(directRe.test('index.js'), true);
assert.strictEqual(directRe.test('index.css'), false);
// 2. Supports globstar wildcard matching across directories
const globstarRe = createMatcher('src/**/*.ts');
assert.strictEqual(globstarRe.test('src/components/button.ts'), true, 'globstar pattern matches nested paths');
assert.strictEqual(globstarRe.test('lib/components/button.ts'), false, 'globstar pattern rejects non-matching root');
// 3. Supports brace expansion patterns
const braceRe = createMatcher('*.{js,jsx,ts,tsx}');
assert.strictEqual(braceRe.test('main.tsx'), true, 'brace expansion matches included extensions');
assert.strictEqual(braceRe.test('main.vue'), false, 'brace expansion rejects excluded extensions');
// 4. Respects dot option for hidden files
const dotDisabledRe = createMatcher('*.js', { dot: false });
assert.strictEqual(dotDisabledRe.test('.eslintrc.js'), false, 'dot=false rejects dotfiles');
const dotEnabledRe = createMatcher('*.js', { dot: true });
assert.strictEqual(dotEnabledRe.test('.eslintrc.js'), true, 'dot=true matches dotfiles');
// 5. Respects nocase option for case-insensitive matching
const caseSensitiveRe = createMatcher('*.JS', { nocase: false });
assert.strictEqual(caseSensitiveRe.test('index.js'), false, 'nocase=false is case sensitive');
const caseInsensitiveRe = createMatcher('*.JS', { nocase: true });
assert.strictEqual(caseInsensitiveRe.test('index.js'), true, 'nocase=true is case insensitive');
// 6. Respects contains option for substring / partial matching
const containsDisabledRe = createMatcher('build', { contains: false });
assert.strictEqual(containsDisabledRe.test('dist/build/output.js'), false, 'contains=false requires full match');
const containsEnabledRe = createMatcher('build', { contains: true });
assert.strictEqual(containsEnabledRe.test('dist/build/output.js'), true, 'contains=true matches substring');
// 7. Passes custom RegExp flags
const flagRe = createMatcher('sample', { flags: 'i' });
assert.ok(flagRe.flags.includes('i'), 'makeRe applies custom flags to the returned RegExp');
assert.strictEqual(flagRe.test('SAMPLE'), true, 'flags option allows case-insensitive matching');
// 8. testPattern helper integrates micromatch.makeRe
assert.strictEqual(testPattern('docs/guide.md', '**/*.md'), true, 'testPattern correctly evaluates glob matching');
assert.strictEqual(testPattern('docs/guide.txt', '**/*.md'), false, 'testPattern correctly rejects non-matching path');
// 9. Throws TypeError when invalid pattern is provided
assert.throws(
() => micromatch.makeRe(''),
{ name: 'TypeError', message: /Expected a non-empty string/ },
'makeRe throws TypeError for empty string pattern'
);
assert.throws(
() => micromatch.makeRe(null),
{ name: 'TypeError', message: /Expected a non-empty string/ },
'makeRe throws TypeError for null pattern'
);
assert.throws(
() => micromatch.makeRe(123),
{ name: 'TypeError', message: /Expected a non-empty string/ },
'makeRe throws TypeError for number pattern'
);
console.log('All micromatch.makeRe contract assertions passed.');
Seeder de origem
anônimo