CodeSampleX

Beispiel

micromatch 4.0.8: some

Verifiziertes Beispiel für npm micromatch 4.0.8: some. Der Vertrag lief auf node 22 · linux alpine/x64 · docker und bestand: micromatch.some is exported as a…

sha256:6044d202acd6d3dc52439e2dfedbef3e68e04b919ba55ade84f2b1766e8beb4f

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-28

Fall

HOW
Ziel
verify micromatch.some in pkg:npm/micromatch@4.0.8
Pakete
Symbole
  • micromatch.some
Erstellt
2026-08-28T02:54:41Z

Contract

  1. micromatch.some is exported as a function on the micromatch module
  2. micromatch.some returns true if a single string matches any pattern in an array
  3. micromatch.some returns true if any string in an array matches any pattern in an array
  4. micromatch.some returns false if no string matches any pattern
  5. micromatch.some supports single string pattern and custom options like nocase and dot
  6. micromatch.some throws TypeError when input is not a string or array of strings

Dateien

  • PROMPT.md
  • csx.json
  • package-lock.json
  • package.json
  • spec.json
  • src/index.js
  • 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 micromatch.some 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.some

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:fb2a389bc03abde8404f9c77049c63d57e977b8ecccc9b494ad8b9fa8a106577","contract":["micromatch.some is exported as a function on the micromatch module","micromatch.some returns true if a single string matches any pattern in an array","micromatch.some returns true if any string in an array matches any pattern in an array","micromatch.some returns false if no string matches any pattern","micromatch.some supports single string pattern and custom options like nocase and dot","micromatch.some throws TypeError when input is not a string or array of strings"],"goal":"verify micromatch.some in pkg:npm/micromatch@4.0.8","kind":"HOW","packages":["pkg:npm/micromatch@4.0.8"],"schemaVersion":1,"symbols":["micromatch.some"]},"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.some"],"verifierAdapter":"node-typescript@1"}
package-lock.json
{
  "name": "sample-micromatch-some",
  "version": "1.0.0",
  "lockfileVersion": 3,
  "requires": true,
  "packages": {
    "": {
      "name": "sample-micromatch-some",
      "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"
      }
    }
  }
}
package.json
{
  "name": "sample-micromatch-some",
  "version": "1.0.0",
  "private": true,
  "description": "Clean-room verification of micromatch.some in micromatch@4.0.8",
  "main": "src/index.js",
  "license": "MIT-0",
  "dependencies": {
    "micromatch": "4.0.8"
  }
}
spec.json
{
  "schemaVersion": 1,
  "goal": "verify micromatch.some in pkg:npm/micromatch@4.0.8",
  "kind": "HOW",
  "packages": [
    "pkg:npm/micromatch@4.0.8"
  ],
  "symbols": [
    "micromatch.some"
  ]
}
src/index.js
const micromatch = require('micromatch');

/**
 * Check if any string in a list (or a single string) matches any of the glob patterns.
 *
 * @param {string|string[]} list - String or array of strings to test
 * @param {string|string[]} patterns - Glob pattern or array of glob patterns
 * @param {object} [options] - Micromatch options (e.g. nocase, dot)
 * @returns {boolean} True if any string matches any pattern
 */
function someMatch(list, patterns, options) {
  return micromatch.some(list, patterns, options);
}

/**
 * Check if at least one file in a given list matches the target file extensions or patterns.
 *
 * @param {string[]} filepaths - List of file paths
 * @param {string|string[]} patterns - Target patterns to check
 * @param {object} [options] - Options passed to micromatch
 * @returns {boolean} True if at least one file matches
 */
function hasMatchingFile(filepaths, patterns, options) {
  if (!Array.isArray(filepaths) || filepaths.length === 0) {
    return false;
  }
  return micromatch.some(filepaths, patterns, options);
}

module.exports = {
  micromatch,
  some: micromatch.some,
  someMatch,
  hasMatchingFile
};
test/contract.mjs
import assert from 'node:assert/strict';
import { createRequire } from 'node:module';

const require = createRequire(import.meta.url);
const {
  micromatch,
  some,
  someMatch,
  hasMatchingFile
} = require('../src/index.js');

// 1. Module and function export verification
assert.equal(typeof micromatch, 'function', 'micromatch must be a function');
assert.equal(typeof micromatch.some, 'function', 'micromatch.some must be a function');
assert.equal(typeof some, 'function', 'some must be a function');
assert.equal(typeof someMatch, 'function', 'someMatch must be a function');
assert.equal(typeof hasMatchingFile, 'function', 'hasMatchingFile must be a function');
assert.equal(some, micromatch.some, 'some should reference micromatch.some');

// 2. Returns true if a single string matches any pattern in an array
assert.equal(
  micromatch.some('src/components/Button.tsx', ['**/*.js', '**/*.tsx']),
  true,
  'micromatch.some should return true when a string matches one of the patterns'
);
assert.equal(
  someMatch('dist/bundle.min.js', ['**/*.min.js', '**/*.css']),
  true,
  'someMatch should return true when single string matches'
);

// 3. Returns true if any string in an array matches any pattern
assert.equal(
  micromatch.some(['README.md', 'src/index.js', 'package.json'], ['*.js', '**/*.js']),
  true,
  'micromatch.some should return true if any element matches'
);
assert.equal(
  hasMatchingFile(['images/logo.png', 'docs/guide.md', 'styles/main.css'], ['**/*.css']),
  true,
  'hasMatchingFile should return true when matching file is in list'
);

// 4. Returns false if no string matches any pattern
assert.equal(
  micromatch.some('src/index.ts', ['**/*.js', '**/*.css']),
  false,
  'micromatch.some should return false when no pattern matches single string'
);
assert.equal(
  micromatch.some(['docs/a.md', 'docs/b.md'], ['src/**', '**/*.js']),
  false,
  'micromatch.some should return false when no element matches pattern'
);
assert.equal(
  hasMatchingFile([], ['*.js']),
  false,
  'hasMatchingFile should return false for empty list'
);
assert.equal(
  micromatch.some([], ['*.js']),
  false,
  'micromatch.some should return false for empty array input'
);

// 5. Supports single string pattern and options (nocase, dot)
assert.equal(
  micromatch.some('app.js', '*.js'),
  true,
  'micromatch.some should accept single string pattern'
);
assert.equal(
  micromatch.some(['IMAGE.PNG', 'style.css'], '*.png', { nocase: true }),
  true,
  'micromatch.some should respect nocase option'
);
assert.equal(
  micromatch.some(['.gitignore', '.env'], '.*', { dot: true }),
  true,
  'micromatch.some should respect dot option for hidden files'
);
assert.equal(
  micromatch.some('.hidden', '*', { dot: false }),
  false,
  'micromatch.some should not match dotfiles when dot is false'
);

// 6. Throws TypeError when input is not a string or array of strings
assert.throws(
  () => micromatch.some(123, ['*.js']),
  {
    name: 'TypeError',
    message: /Expected input to be a string/
  },
  'micromatch.some should throw TypeError when input is a number'
);
assert.throws(
  () => micromatch.some(null, ['*.js']),
  {
    name: 'TypeError',
    message: /Expected input to be a string/
  },
  'micromatch.some should throw TypeError when input is null'
);
assert.throws(
  () => micromatch.some({}, ['*.js']),
  {
    name: 'TypeError',
    message: /Expected input to be a string/
  },
  'micromatch.some should throw TypeError when input is an object'
);

console.log('Contract tests passed successfully.');

Ursprungs-Seeder

anonym