CodeSampleX

Beispiel

picomatch 4.0.7: Compile glob patterns into regular expressions with picomatch.makeRe

Verifiziertes Beispiel für npm picomatch 4.0.7: Compile glob patterns into regular expressions with picomatch.makeRe. Der Vertrag lief auf node 22 · linux…

sha256:749b23c9f2df2afdf22f0725f71a34de62fa3bdb2905a2ce0d0d73de256c4be8

Dieses Netzwerk bietet eine Sache: ein Sample, das baut. Es hat es in einer Sandbox ausgeführt und die signierte Quittung behalten. Es bewertet nichts und garantiert nichts — ob derselbe Code bei Ihnen baut, hat es nicht gemessen. Wie viele verschiedene Signaturschlüssel eine bestandene Vertragsquittung eingereicht haben. Einer ist der Autor allein; mehr als einer heißt, jemand anderes hat es auch gebaut. Ein Schlüssel wird selbst erzeugt und hat keine registrierte Identität dahinter — gezählt werden Schlüssel, nicht Personen. MIT-0

Ausführungsbelege

Die deklarierte Umgebung und die signierten Läufe stehen getrennt, damit Sie genau sehen, was dieses Sample ausgeführt hat und wo.

Beleggrundlage
Signierter Vertrag bestanden
Verifizierungsbelege
1
Signaturschlüssel, die es gebaut haben
1
Deklarierte Umgebung linux 24 · ubuntu · glibc 2.39 x64 npm

Umgebungen der Verifizierungsläufe

Umgebung Contract Stufen Lauf
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-27

Fall

HOW
Ziel
Compile glob patterns into regular expressions with picomatch.makeRe
Pakete
Symbole
  • picomatch.makeRe
Erstellt
2026-08-27T12:34:04Z

Contract

  1. assert picomatch.makeRe('*.js') is an instance of RegExp
  2. assert picomatch.makeRe('*.js').test('app.js') is true
  3. assert picomatch.makeRe('*.js').test('src/app.js') is false
  4. assert picomatch.makeRe('src/**/*.ts').test('src/components/button.ts') is true
  5. assert picomatch.makeRe('src/**/*.ts').test('lib/button.ts') is false
  6. assert picomatch.makeRe('*.js', { flags: 'i' }).test('INDEX.JS') is true
  7. assert picomatch.makeRe('*.js', { dot: true }).test('.env.js') is true
  8. assert picomatch.makeRe('*.js').test('.env.js') is false
  9. assert picomatch.makeRe('!*.js', { nonegate: true }).test('!foo.js') is true

Dateien

  • NOTES.md
  • PROMPT.md
  • csx.json
  • package-lock.json
  • package.json
  • spec.json
  • test/contract.mjs

Quellartefakt herunterladen (tar.gz)

Quelltext

NOTES.md
# Picomatch makeRe API Notes

`picomatch.makeRe(pattern, options)` compiles a glob pattern string into a JavaScript standard `RegExp` instance:
- Returns a standard `RegExp` object that can be tested directly with `.test(input)`.
- Respects glob semantics: `*` matches within a single path segment and does not cross `/` delimiters or match leading dotfiles by default.
- Options:
  - `flags`: String containing RegExp flags to apply (e.g. `'i'` for case-insensitivity).
  - `dot`: Boolean allowing `*` or `?` wildcards to match leading dots (hidden files).
  - `nonegate`: Boolean disabling negation parsing so leading `!` characters are treated literally.
  - `fastpaths`: Boolean enabling fast-path regex compilation for simple patterns.

Pitfall: A simple pattern like `*.js` will not match nested files (`src/app.js`) or hidden files (`.env.js`) unless recursive globstar `**` and `dot: true` are enabled respectively.
PROMPT.md
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: Compile glob patterns into regular expressions with picomatch.makeRe
Kind: HOW

Use EXACTLY these public packages and versions:
  - pkg:npm/picomatch@4.0.7
Demonstrate these symbols/APIs:
  - picomatch.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.
csx.json
{"case":{"caseId":"case:sha256:64cb5323df62e08c892ff3fa6c63726a580006976b92f191fd62c718884c8167","contract":["assert picomatch.makeRe('*.js') is an instance of RegExp","assert picomatch.makeRe('*.js').test('app.js') is true","assert picomatch.makeRe('*.js').test('src/app.js') is false","assert picomatch.makeRe('src/**/*.ts').test('src/components/button.ts') is true","assert picomatch.makeRe('src/**/*.ts').test('lib/button.ts') is false","assert picomatch.makeRe('*.js', { flags: 'i' }).test('INDEX.JS') is true","assert picomatch.makeRe('*.js', { dot: true }).test('.env.js') is true","assert picomatch.makeRe('*.js').test('.env.js') is false","assert picomatch.makeRe('!*.js', { nonegate: true }).test('!foo.js') is true"],"goal":"Compile glob patterns into regular expressions with picomatch.makeRe","kind":"HOW","packages":["pkg:npm/picomatch@4.0.7"],"schemaVersion":1,"symbols":["picomatch.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/picomatch@4.0.7"],"schemaVersion":1,"subject":"pkg:npm/picomatch@4.0.7","symbols":["picomatch.makeRe"],"verifierAdapter":"node-typescript@1"}
package-lock.json
{
  "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.7"
      }
    },
    "node_modules/picomatch": {
      "version": "4.0.7",
      "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-4.0.7.tgz",
      "integrity": "sha512-qcJu88Q2IWqJsDD529JKMdwGm/dvInW4HvQnRwiH9JtihJvzGOscDtHE3x1pBKeUOTysQ8kVmLnJ2kJu7yhcGA==",
      "license": "MIT",
      "engines": {
        "node": ">=12"
      },
      "funding": {
        "url": "https://github.com/sponsors/jonschlinkert"
      }
    }
  }
}
package.json
{
  "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.7"
  }
}
spec.json
{
  "schemaVersion": 1,
  "goal": "Compile glob patterns into regular expressions with picomatch.makeRe",
  "kind": "HOW",
  "packages": [
    "pkg:npm/picomatch@4.0.7"
  ],
  "symbols": [
    "picomatch.makeRe"
  ]
}
test/contract.mjs
import assert from 'node:assert/strict';
import picomatch from 'picomatch';

// Test 1: Compile basic glob pattern into RegExp
const basicRe = picomatch.makeRe('*.js');
assert.ok(basicRe instanceof RegExp);
assert.equal(basicRe.test('app.js'), true);
assert.equal(basicRe.test('src/app.js'), false);

// Test 2: Compile recursive globstar pattern into RegExp
const globstarRe = picomatch.makeRe('src/**/*.ts');
assert.ok(globstarRe instanceof RegExp);
assert.equal(globstarRe.test('src/components/button.ts'), true);
assert.equal(globstarRe.test('lib/button.ts'), false);

// Test 3: Pass RegExp flags option
const caseInsensitiveRe = picomatch.makeRe('*.js', { flags: 'i' });
assert.equal(caseInsensitiveRe.flags.includes('i'), true);
assert.equal(caseInsensitiveRe.test('INDEX.JS'), true);

// Test 4: Enable dot option for hidden files
const dotRe = picomatch.makeRe('*.js', { dot: true });
assert.equal(dotRe.test('.env.js'), true);
assert.equal(basicRe.test('.env.js'), false);

// Test 5: Disable negation parsing with nonegate
const literalNegateRe = picomatch.makeRe('!*.js', { nonegate: true });
assert.equal(literalNegateRe.test('!foo.js'), true);

console.log('picomatch.contract.pass');

Ursprungs-Seeder

anonym