CodeSampleX

Sample

react-is 17.0.2: Profiler

Verified sample for npm react-is 17.0.2: Profiler. The contract ran on node 22 · linux debian/x64 · docker and passed: Profiler export is a distinct Symbol…

sha256:fb396146aa6fb450455a3bf5f11597d1289a7a33799537936851dcecec73dcdc

This network offers one thing: a sample that builds. It ran the sample in a sandbox and kept the signed receipt. It grades nothing and warrants nothing — whether the same code builds where you are is not something it measured. How many distinct signing keys filed a passing contract receipt. One is the author alone; more than one means somebody else built it too. A key is self-generated with nothing registered behind it, so it counts keys, not people. MIT-0

Execution evidence

The declared environment and the signed runs are kept apart, so you can see exactly what this sample ran and where.

Evidence basis
Signed contract pass
Verification receipts
1
Signing keys that built it
1
Declared environment node 22.23 linux 24 · ubuntu · glibc 2.39 x64 node 22.23 javascript npm 10

Verification-run environments

Environment Contract Stages Run
node 22 · linux debian/x64 · docker ed25519:c1973797be207ac4 PASS compile:SKIPPED · contract:PASS · load:PASS · resolve:PASS
CONTAINER_RUN · node-typescript@1node:22@sha256:8a34c4ab3ea2…
2026-09-06

Case

HOW
Goal
verify react-is.Profiler in pkg:npm/react-is@17.0.2
Packages
Symbols
  • react-is.Profiler
Environment
node 22.23.2
Created
2026-09-06T09:56:03Z

Contract

  1. Profiler export is a distinct Symbol representing the React Profiler component type
  2. isValidElementType evaluates to true for the Profiler symbol
  3. isProfiler returns true for React elements configured with type Profiler
  4. typeOf returns the Profiler symbol for React elements configured with type Profiler
  5. isProfiler rejects plain objects, non-profiler React elements, primitives, null, and undefined
  6. typeOf returns undefined or different symbols for non-profiler values and plain objects
  7. Profiler is a component type symbol rather than a React element instance

Files

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

Download the source artifact (tar.gz)

Source

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 react-is.Profiler in pkg:npm/react-is@17.0.2
Kind: HOW

Use EXACTLY these public packages and versions:
  - pkg:npm/react-is@17.0.2
Demonstrate these symbols/APIs:
  - react-is.Profiler
Constraints:
  - executionContext: node
Required runtime conditions:
  - ecosystem: npm
  - language: javascript
  - moduleSystem: cjs
  - packageManager: npm@10.9.8
  - runtime: node@22.23.2

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:e33a60a46d90bf8f48033791a47951c5f459ebfa09388ad37e1a750daf665b50","constraints":{"executionContext":"node"},"contract":["Profiler export is a distinct Symbol representing the React Profiler component type","isValidElementType evaluates to true for the Profiler symbol","isProfiler returns true for React elements configured with type Profiler","typeOf returns the Profiler symbol for React elements configured with type Profiler","isProfiler rejects plain objects, non-profiler React elements, primitives, null, and undefined","typeOf returns undefined or different symbols for non-profiler values and plain objects","Profiler is a component type symbol rather than a React element instance"],"goal":"verify react-is.Profiler in pkg:npm/react-is@17.0.2","kind":"HOW","packages":["pkg:npm/react-is@17.0.2"],"schemaVersion":1,"symbols":["react-is.Profiler"]},"contractCommand":["node","test/contract.mjs"],"environment":{"arch":"x64","distro":"ubuntu","ecosystem":"npm","executionContext":"node","language":"javascript","libc":"glibc","libcVersion":"2.39","moduleSystem":"cjs","os":"linux","osVersionBucket":"24","packageManager":"npm","packageManagerVersion":"10.9.8","runtime":"node","runtimeVersion":"22.23.2","schemaVersion":1},"license":"MIT-0","packages":["pkg:npm/react-is@17.0.2"],"schemaVersion":1,"subject":"pkg:npm/react-is@17.0.2","symbols":["react-is.Profiler"],"verifierAdapter":"node-typescript@1"}
package-lock.json
{
  "name": "sample-react-is-profiler",
  "version": "1.0.0",
  "lockfileVersion": 3,
  "requires": true,
  "packages": {
    "": {
      "name": "sample-react-is-profiler",
      "version": "1.0.0",
      "dependencies": {
        "react-is": "17.0.2"
      }
    },
    "node_modules/react-is": {
      "version": "17.0.2",
      "resolved": "https://registry.npmjs.org/react-is/-/react-is-17.0.2.tgz",
      "integrity": "sha512-w2GsyukL62IJnlaff/nRegPQR94C/XXamvMWmSHRJ4y7Ts/4ocGRmTHvOs8PSE6pB3dWOrD/nueuU5sduBsQ4w==",
      "license": "MIT"
    }
  }
}
package.json
{
  "name": "sample-react-is-profiler",
  "version": "1.0.0",
  "private": true,
  "description": "Clean-room verification of react-is.Profiler in react-is 17.0.2",
  "main": "src/index.js",
  "dependencies": {
    "react-is": "17.0.2"
  }
}
spec.json
{
  "schemaVersion": 1,
  "goal": "verify react-is.Profiler in pkg:npm/react-is@17.0.2",
  "kind": "HOW",
  "packages": [
    "pkg:npm/react-is@17.0.2"
  ],
  "symbols": [
    "react-is.Profiler"
  ],
  "constraints": {
    "executionContext": "node"
  },
  "runtimeConditions": {
    "ecosystem": "npm",
    "language": "javascript",
    "moduleSystem": "cjs",
    "packageManager": "npm@10.9.8",
    "runtime": "node@22.23.2"
  }
}
src/index.js
const {
  Profiler,
  isProfiler,
  isElement,
  isValidElementType,
  typeOf,
} = require('react-is');

/**
 * Creates a mock React Profiler element object.
 *
 * @param {string} [id='test-profiler'] - Unique Profiler identifier.
 * @param {Function} [onRender=() => {}] - Profiler render callback.
 * @returns {object} React element with type Profiler.
 */
function createProfilerElement(id = 'test-profiler', onRender = () => {}) {
  return {
    $$typeof: Symbol.for('react.element'),
    type: Profiler,
    props: { id, onRender, children: null },
    key: null,
    ref: null,
  };
}

/**
 * Validates whether the given value is a React Profiler element.
 *
 * @param {*} value - The value to inspect.
 * @returns {boolean} True if the value is a Profiler element.
 */
function checkIsProfiler(value) {
  return isProfiler(value);
}

/**
 * Validates whether the Profiler export is a valid React element type.
 *
 * @returns {boolean} True if Profiler is a valid element type.
 */
function checkIsValidProfilerType() {
  return isValidElementType(Profiler);
}

/**
 * Identifies the element type of the given object using typeOf.
 *
 * @param {*} value - The object to inspect.
 * @returns {symbol|undefined} The matched element symbol or undefined.
 */
function identifyTypeOf(value) {
  return typeOf(value);
}

module.exports = {
  Profiler,
  isProfiler,
  isElement,
  isValidElementType,
  typeOf,
  createProfilerElement,
  checkIsProfiler,
  checkIsValidProfilerType,
  identifyTypeOf,
};
test/contract.mjs
import assert from 'node:assert/strict';
import { Profiler, isProfiler, isElement, isValidElementType, typeOf } from 'react-is';
import sample from '../src/index.js';

const {
  createProfilerElement,
  checkIsProfiler,
  checkIsValidProfilerType,
  identifyTypeOf,
} = sample;

// 1. Profiler export is a distinct Symbol representing the React Profiler component type
assert.equal(typeof Profiler, 'symbol', 'Profiler must be a symbol');
assert.equal(Profiler, Symbol.for('react.profiler'), 'Profiler must equal Symbol.for("react.profiler")');
assert.equal(sample.Profiler, Profiler, 'Re-exported Profiler must match react-is Profiler');

// 2. isValidElementType evaluates to true for the Profiler symbol
assert.equal(isValidElementType(Profiler), true, 'isValidElementType(Profiler) must return true');
assert.equal(checkIsValidProfilerType(), true, 'checkIsValidProfilerType helper must return true');

// 3. isProfiler returns true for React elements configured with type Profiler
const profilerElement = createProfilerElement('metrics-profiler', () => {});
assert.equal(isProfiler(profilerElement), true, 'isProfiler must return true for Profiler element');
assert.equal(checkIsProfiler(profilerElement), true, 'checkIsProfiler helper must return true');

// 4. typeOf returns the Profiler symbol for React elements configured with type Profiler
assert.equal(typeOf(profilerElement), Profiler, 'typeOf(profilerElement) must return Profiler symbol');
assert.equal(identifyTypeOf(profilerElement), Profiler, 'identifyTypeOf helper must return Profiler symbol');

// 5. isProfiler rejects plain objects, non-profiler React elements, primitives, null, and undefined
const divElement = {
  $$typeof: Symbol.for('react.element'),
  type: 'div',
  props: {},
  key: null,
  ref: null,
};
assert.equal(isProfiler(divElement), false, 'div element must not be identified as Profiler');
assert.equal(checkIsProfiler(divElement), false, 'checkIsProfiler helper must return false for div element');
assert.equal(isProfiler({}), false, 'empty object is not a Profiler');
assert.equal(isProfiler(null), false, 'null is not a Profiler');
assert.equal(isProfiler(undefined), false, 'undefined is not a Profiler');
assert.equal(isProfiler('Profiler'), false, 'string is not a Profiler');
assert.equal(isProfiler(123), false, 'number is not a Profiler');

// 6. typeOf returns undefined or different symbols for non-profiler values and plain objects
assert.notEqual(typeOf(divElement), Profiler, 'typeOf(divElement) must not equal Profiler');
assert.equal(typeOf({}), undefined, 'typeOf({}) must return undefined');
assert.equal(typeOf(null), undefined, 'typeOf(null) must return undefined');
assert.equal(typeOf(undefined), undefined, 'typeOf(undefined) must return undefined');

// 7. Profiler is a component type symbol rather than a React element instance
assert.equal(isElement(Profiler), false, 'Profiler symbol itself must not be an element');
assert.equal(isElement(profilerElement), true, 'profilerElement must be a valid element');

console.log('Contract tests for react-is.Profiler passed successfully.');

Origin Seeder

anonymous