CodeSampleX

Beispiel

glob 7.2.3

Verifiziertes Beispiel für npm glob 7.2.3. Der Vertrag lief auf node 22 · linux alpine/x64 · docker und bestand: glob matches file paths asynchronously via…

sha256:37b71e9a06aae6fbcfd95106e0f57f6e5376439575a31fcd8f9a8e926979b18e

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@1
2026-08-21

Fall

HOW
Ziel
verify pkg:npm/glob@7.2.3
Pakete
Erstellt
2026-08-21T14:24:48Z

Contract

  1. glob matches file paths asynchronously via callback across directory hierarchies using wildcard patterns
  2. glob.sync matches file paths synchronously matching specified wildcard patterns
  3. glob.sync excludes paths matching the ignore pattern option and filters directories when nodir is enabled
  4. glob.hasMagic accurately detects whether a pattern contains glob magic characters
  5. Glob instance provides an EventEmitter interface emitting match and end events for matching files

Dateien

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

Quellartefakt herunterladen (tar.gz)

Quelltext

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: verify pkg:npm/glob@7.2.3
Kind: HOW

Use EXACTLY these public packages and versions:
  - pkg:npm/glob@7.2.3

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:611f7947582e41f8eec0c9042aa00678ed63254e727a928152e6b5cdae3fde26","contract":["glob matches file paths asynchronously via callback across directory hierarchies using wildcard patterns","glob.sync matches file paths synchronously matching specified wildcard patterns","glob.sync excludes paths matching the ignore pattern option and filters directories when nodir is enabled","glob.hasMagic accurately detects whether a pattern contains glob magic characters","Glob instance provides an EventEmitter interface emitting match and end events for matching files"],"goal":"verify pkg:npm/glob@7.2.3","kind":"HOW","packages":["pkg:npm/glob@7.2.3"],"schemaVersion":1},"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/glob@7.2.3"],"schemaVersion":1,"subject":"pkg:npm/glob@7.2.3","verifierAdapter":"node-typescript@1"}
package-lock.json
{
  "name": "sample-glob",
  "version": "1.0.0",
  "lockfileVersion": 3,
  "requires": true,
  "packages": {
    "": {
      "name": "sample-glob",
      "version": "1.0.0",
      "license": "MIT-0",
      "dependencies": {
        "glob": "7.2.3"
      }
    },
    "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": "1.1.18",
      "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.18.tgz",
      "integrity": "sha512-Edep/X9fGqVNmzKBVsDYIOtD+z1tuezV70LBjdCst9Tqu76lsnvRiZ6oTic1n+/BIwX6QDGAO94PN4N2SADvtw==",
      "license": "MIT",
      "dependencies": {
        "balanced-match": "^1.0.0",
        "concat-map": "0.0.1"
      }
    },
    "node_modules/concat-map": {
      "version": "0.0.1",
      "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz",
      "integrity": "sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==",
      "license": "MIT"
    },
    "node_modules/fs.realpath": {
      "version": "1.0.0",
      "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz",
      "integrity": "sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw==",
      "license": "ISC"
    },
    "node_modules/glob": {
      "version": "7.2.3",
      "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.3.tgz",
      "integrity": "sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==",
      "deprecated": "Old versions of glob are not supported, and contain widely publicized security vulnerabilities, which have been fixed in the current version. Please update. Support for old versions may be purchased (at exorbitant rates) by contacting i@izs.me",
      "license": "ISC",
      "dependencies": {
        "fs.realpath": "^1.0.0",
        "inflight": "^1.0.4",
        "inherits": "2",
        "minimatch": "^3.1.1",
        "once": "^1.3.0",
        "path-is-absolute": "^1.0.0"
      },
      "engines": {
        "node": "*"
      },
      "funding": {
        "url": "https://github.com/sponsors/isaacs"
      }
    },
    "node_modules/inflight": {
      "version": "1.0.6",
      "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz",
      "integrity": "sha512-k92I/b08q4wvFscXCLvqfsHCrjrF7yiXsQuIVvVE7N82W3+aqpzuUdBbfhWcy/FZR3/4IgflMgKLOsvPDrGCJA==",
      "deprecated": "This module is not supported, and leaks memory. Do not use it. Check out lru-cache if you want a good and tested way to coalesce async requests by a key value, which is much more comprehensive and powerful.",
      "license": "ISC",
      "dependencies": {
        "once": "^1.3.0",
        "wrappy": "1"
      }
    },
    "node_modules/inherits": {
      "version": "2.0.4",
      "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz",
      "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==",
      "license": "ISC"
    },
    "node_modules/minimatch": {
      "version": "3.1.5",
      "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.5.tgz",
      "integrity": "sha512-VgjWUsnnT6n+NUk6eZq77zeFdpW2LWDzP6zFGrCbHXiYNul5Dzqk2HHQ5uFH2DNW5Xbp8+jVzaeNt94ssEEl4w==",
      "license": "ISC",
      "dependencies": {
        "brace-expansion": "^1.1.7"
      },
      "engines": {
        "node": "*"
      }
    },
    "node_modules/once": {
      "version": "1.4.0",
      "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz",
      "integrity": "sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==",
      "license": "ISC",
      "dependencies": {
        "wrappy": "1"
      }
    },
    "node_modules/path-is-absolute": {
      "version": "1.0.1",
      "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz",
      "integrity": "sha512-AVbw3UJ2e9bq64vSaS9Am0fje1Pa8pbGqTTsmXfaIiMpnr5DlDhfJOuLj9Sf95ZPVDAUerDfEk88MPmPe7UCQg==",
      "license": "MIT",
      "engines": {
        "node": ">=0.10.0"
      }
    },
    "node_modules/wrappy": {
      "version": "1.0.2",
      "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz",
      "integrity": "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==",
      "license": "ISC"
    }
  }
}
package.json
{
  "name": "sample-glob",
  "version": "1.0.0",
  "private": true,
  "license": "MIT-0",
  "dependencies": {
    "glob": "7.2.3"
  }
}
spec.json
{
  "schemaVersion": 1,
  "goal": "verify pkg:npm/glob@7.2.3",
  "kind": "HOW",
  "packages": [
    "pkg:npm/glob@7.2.3"
  ]
}
src/index.mjs
import glob from 'glob';

export function findFiles(pattern, options = {}) {
  return new Promise((resolve, reject) => {
    glob(pattern, options, (err, matches) => {
      if (err) return reject(err);
      resolve(matches);
    });
  });
}

export function findFilesSync(pattern, options = {}) {
  return glob.sync(pattern, options);
}

export function checkHasMagic(pattern, options = {}) {
  return glob.hasMagic(pattern, options);
}

export { glob };
test/contract.mjs
import assert from 'node:assert/strict';
import fs from 'node:fs';
import path from 'node:path';
import os from 'node:os';
import glob from 'glob';
import {
  findFiles,
  findFilesSync,
  checkHasMagic,
} from '../src/index.mjs';

const testDir = fs.mkdtempSync(path.join(os.tmpdir(), 'csx-glob7-contract-'));

try {
  fs.mkdirSync(path.join(testDir, 'src', 'nested'), { recursive: true });
  fs.mkdirSync(path.join(testDir, 'docs'), { recursive: true });
  fs.writeFileSync(path.join(testDir, 'src', 'index.js'), 'export default 1;');
  fs.writeFileSync(path.join(testDir, 'src', 'nested', 'helper.js'), 'export const h = 2;');
  fs.writeFileSync(path.join(testDir, 'src', 'data.txt'), 'hello world');
  fs.writeFileSync(path.join(testDir, 'docs', 'README.md'), '# Documentation');

  // 1. glob matches file paths asynchronously via callback across directory hierarchies using wildcard patterns
  {
    await new Promise((resolve, reject) => {
      glob('**/*.js', { cwd: testDir }, (err, matches) => {
        if (err) return reject(err);
        try {
          assert.deepEqual(matches.sort(), ['src/index.js', 'src/nested/helper.js']);
          resolve();
        } catch (e) {
          reject(e);
        }
      });
    });

    const asyncWrapperResults = await findFiles('**/*.txt', { cwd: testDir });
    assert.deepEqual(asyncWrapperResults, ['src/data.txt']);
  }

  // 2. glob.sync matches file paths synchronously matching specified wildcard patterns
  {
    const syncResults = glob.sync('**/*.js', { cwd: testDir });
    assert.deepEqual(syncResults.sort(), ['src/index.js', 'src/nested/helper.js']);

    const wrapperResults = findFilesSync('docs/*.md', { cwd: testDir });
    assert.deepEqual(wrapperResults, ['docs/README.md']);
  }

  // 3. glob.sync excludes paths matching the ignore pattern option and filters directories when nodir is enabled
  {
    const filteredSync = glob.sync('**/*.js', {
      cwd: testDir,
      ignore: '**/nested/**',
    });
    assert.deepEqual(filteredSync, ['src/index.js']);

    const wrapperFiltered = findFilesSync('**/*', {
      cwd: testDir,
      ignore: ['**/*.js', '**/*.md'],
      nodir: true,
    });
    assert.deepEqual(wrapperFiltered, ['src/data.txt']);
  }

  // 4. glob.hasMagic accurately detects whether a pattern contains glob magic characters
  {
    assert.equal(glob.hasMagic('**/*.js'), true);
    assert.equal(glob.hasMagic('src/[a-z]/*.js'), true);
    assert.equal(glob.hasMagic('src/plain-file.js'), false);
    assert.equal(checkHasMagic('plain/path/file.txt'), false);
    assert.equal(checkHasMagic('file?.txt'), true);
  }

  // 5. Glob instance provides an EventEmitter interface emitting match and end events for matching files
  {
    await new Promise((resolve, reject) => {
      const g = new glob.Glob('src/**/*.js', { cwd: testDir });
      const matched = [];
      g.on('match', (match) => {
        matched.push(match);
      });
      g.on('error', (err) => {
        reject(err);
      });
      g.on('end', (allMatches) => {
        try {
          assert.deepEqual(matched.sort(), ['src/index.js', 'src/nested/helper.js']);
          assert.deepEqual(allMatches.sort(), ['src/index.js', 'src/nested/helper.js']);
          resolve();
        } catch (e) {
          reject(e);
        }
      });
    });
  }

  console.log('Contract tests passed successfully.');
} finally {
  fs.rmSync(testDir, { recursive: true, force: true });
}

Ursprungs-Seeder

anonym