CodeSampleX

Ejemplo

csstype 3.2.3: StandardProperties

Muestra verificada para npm csstype 3.2.3: StandardProperties. El contrato se ejecutó en node 22 · linux alpine/x64 · docker y pasó.

sha256:116d131d8e57a2cc00650c7108f2d190e0fdacb1eb3d0c508bbe67112f628189

Esta red ofrece una sola cosa: una muestra que compila. La ejecutó en un sandbox y guardó el recibo firmado. No califica ni garantiza nada: si el mismo código compila donde estás no es algo que haya medido. Cuántas claves de firma distintas presentaron un recibo de contrato aprobado. Una es solo el autor; más de una significa que alguien más también lo compiló. Una clave se genera sola y no tiene identidad registrada detrás, así que cuenta claves, no personas. MIT-0

Evidencia de ejecución

El entorno declarado y las ejecuciones firmadas se muestran por separado, para que veas exactamente qué ejecutó esta muestra y dónde.

Base de evidencia
Contrato firmado aprobado
Recibos de verificación
2
Claves de firma que lo compilaron
1
Entorno declarado linux 24 · ubuntu · glibc 2.39 x64 npm

Entornos de las ejecuciones de verificación

Entorno Contrato Etapas Ejecución
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
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-07

Caso

HOW
Objetivo
verify StandardProperties in pkg:npm/csstype@3.2.3
Paquetes
Símbolos
  • StandardProperties
Creado
2026-08-27T10:01:40Z

Contrato

  1. csstype package.json declares type definitions entry point index.d.ts and version 3.2.3
  2. csstype index.d.ts exports interface StandardProperties extending StandardLonghandProperties and StandardShorthandProperties with generic type parameters TLength and TTime
  3. csstype index.d.ts defines StandardLonghandProperties with camelCase CSS longhand properties including color, display, fontSize, and opacity
  4. csstype index.d.ts defines StandardShorthandProperties with camelCase CSS shorthand properties including margin, padding, flex, and background
  5. csstype index.d.ts defines Properties interface extending StandardProperties with vendor, obsolete, and SVG properties
  6. csstype index.d.ts defines kebab-case and fallback variants StandardPropertiesHyphen and StandardPropertiesFallback

Archivos

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

Descargar el artefacto de código fuente (tar.gz)

Código fuente

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 StandardProperties in pkg:npm/csstype@3.2.3
Kind: HOW

Use EXACTLY these public packages and versions:
  - pkg:npm/csstype@3.2.3
Demonstrate these symbols/APIs:
  - StandardProperties

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:5159136fc5ef77949ffa4b0a15f5a39690a9571e5c4ea3575625db508402918a","contract":["csstype package.json declares type definitions entry point index.d.ts and version 3.2.3","csstype index.d.ts exports interface StandardProperties extending StandardLonghandProperties and StandardShorthandProperties with generic type parameters TLength and TTime","csstype index.d.ts defines StandardLonghandProperties with camelCase CSS longhand properties including color, display, fontSize, and opacity","csstype index.d.ts defines StandardShorthandProperties with camelCase CSS shorthand properties including margin, padding, flex, and background","csstype index.d.ts defines Properties interface extending StandardProperties with vendor, obsolete, and SVG properties","csstype index.d.ts defines kebab-case and fallback variants StandardPropertiesHyphen and StandardPropertiesFallback"],"goal":"verify StandardProperties in pkg:npm/csstype@3.2.3","kind":"HOW","packages":["pkg:npm/csstype@3.2.3"],"schemaVersion":1,"symbols":["StandardProperties"]},"contractCommand":["node","test/contract.js"],"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/csstype@3.2.3"],"schemaVersion":1,"subject":"pkg:npm/csstype@3.2.3","symbols":["StandardProperties"],"verifierAdapter":"node-typescript@1"}
package-lock.json
{
  "name": "sample-csstype-standard-properties",
  "version": "1.0.0",
  "lockfileVersion": 3,
  "requires": true,
  "packages": {
    "": {
      "name": "sample-csstype-standard-properties",
      "version": "1.0.0",
      "license": "MIT-0",
      "dependencies": {
        "csstype": "3.2.3"
      }
    },
    "node_modules/csstype": {
      "version": "3.2.3",
      "resolved": "https://registry.npmjs.org/csstype/-/csstype-3.2.3.tgz",
      "integrity": "sha512-z1HGKcYy2xA8AGQfwrn0PAy+PB7X/GSj3UVJW9qKyn43xWa+gl5nXmU4qqLMRzWVLFC8KusUX8T/0kCiOYpAIQ==",
      "license": "MIT"
    }
  }
}
package.json
{
  "name": "sample-csstype-standard-properties",
  "version": "1.0.0",
  "private": true,
  "description": "Clean-room verification sample for csstype StandardProperties",
  "main": "src/index.js",
  "scripts": {
    "test": "node test/contract.js"
  },
  "dependencies": {
    "csstype": "3.2.3"
  },
  "license": "MIT-0"
}
spec.json
{
  "schemaVersion": 1,
  "goal": "verify StandardProperties in pkg:npm/csstype@3.2.3",
  "kind": "HOW",
  "packages": [
    "pkg:npm/csstype@3.2.3"
  ],
  "symbols": [
    "StandardProperties"
  ]
}
src/index.js
const fs = require('node:fs');
const path = require('node:path');

/**
 * Resolves the path to the csstype package directory.
 * @returns {string} Absolute path to csstype package root
 */
function getPackageRoot() {
  const pkgJsonPath = require.resolve('csstype/package.json');
  return path.dirname(pkgJsonPath);
}

/**
 * Resolves the path to the csstype TypeScript declaration file.
 * @returns {string} Absolute path to index.d.ts
 */
function getDeclarationPath() {
  return path.join(getPackageRoot(), 'index.d.ts');
}

/**
 * Reads the declaration file content of csstype.
 * @returns {string} Text content of index.d.ts
 */
function loadDeclarationContent() {
  const declPath = getDeclarationPath();
  return fs.readFileSync(declPath, 'utf8');
}

/**
 * Inspects the type definitions for StandardProperties and related interfaces.
 * @returns {object} Summary of discovered interfaces and properties
 */
function inspectStandardProperties() {
  const content = loadDeclarationContent();

  const hasStandardProperties = content.includes(
    'export interface StandardProperties<TLength = (string & {}) | 0, TTime = string & {}>'
  );
  const extendsStandardLonghand = content.includes('extends StandardLonghandProperties<TLength, TTime>');
  const extendsStandardShorthand = content.includes('StandardShorthandProperties<TLength, TTime>');

  const hasStandardLonghandInterface = content.includes(
    'export interface StandardLonghandProperties<TLength = (string & {}) | 0, TTime = string & {}>'
  );
  const hasStandardShorthandInterface = content.includes(
    'export interface StandardShorthandProperties<TLength = (string & {}) | 0, TTime = string & {}>'
  );

  const hasPropertiesInterface = content.includes(
    'export interface Properties<TLength = (string & {}) | 0, TTime = string & {}>'
  );
  const propertiesExtendsStandard = content.includes('extends StandardProperties<TLength, TTime>');

  const hasHyphenVariant = content.includes(
    'export interface StandardPropertiesHyphen<TLength = (string & {}) | 0, TTime = string & {}>'
  );
  const hasFallbackVariant = content.includes(
    'export interface StandardPropertiesFallback<TLength = (string & {}) | 0, TTime = string & {}>'
  );

  const hasLonghandProperties = {
    color: content.includes('color?: Property.Color | undefined;'),
    display: content.includes('display?: Property.Display | undefined;'),
    fontSize: content.includes('fontSize?: Property.FontSize<TLength> | undefined;'),
    opacity: content.includes('opacity?: Property.Opacity | undefined;'),
    position: content.includes('position?: Property.Position | undefined;'),
    zIndex: content.includes('zIndex?: Property.ZIndex | undefined;'),
  };

  const hasShorthandProperties = {
    background: content.includes('background?: Property.Background<TLength> | undefined;'),
    border: content.includes('border?: Property.Border<TLength> | undefined;'),
    flex: content.includes('flex?: Property.Flex<TLength> | undefined;'),
    font: content.includes('font?: Property.Font | undefined;'),
    margin: content.includes('margin?: Property.Margin<TLength> | undefined;'),
    padding: content.includes('padding?: Property.Padding<TLength> | undefined;'),
  };

  return {
    hasStandardProperties,
    extendsStandardLonghand,
    extendsStandardShorthand,
    hasStandardLonghandInterface,
    hasStandardShorthandInterface,
    hasPropertiesInterface,
    propertiesExtendsStandard,
    hasHyphenVariant,
    hasFallbackVariant,
    hasLonghandProperties,
    hasShorthandProperties,
  };
}

module.exports = {
  getPackageRoot,
  getDeclarationPath,
  loadDeclarationContent,
  inspectStandardProperties,
};
test/contract.js
const assert = require('node:assert');
const fs = require('node:fs');
const path = require('node:path');
const {
  getPackageRoot,
  getDeclarationPath,
  loadDeclarationContent,
  inspectStandardProperties,
} = require('../src/index.js');

// 1. csstype package.json declares type definitions entry point index.d.ts and version 3.2.3
const pkgJson = require('csstype/package.json');
assert.strictEqual(pkgJson.name, 'csstype', 'package name must be csstype');
assert.strictEqual(pkgJson.version, '3.2.3', 'package version must be 3.2.3');
assert.strictEqual(pkgJson.types, 'index.d.ts', 'package types entry must point to index.d.ts');

// 2. csstype index.d.ts exports interface StandardProperties extending StandardLonghandProperties and StandardShorthandProperties with generic type parameters TLength and TTime
const declPath = getDeclarationPath();
assert.strictEqual(fs.existsSync(declPath), true, 'index.d.ts must exist on disk');

const content = loadDeclarationContent();
assert.strictEqual(typeof content, 'string', 'declaration content must be string');
assert.strictEqual(
  content.includes('export interface StandardProperties<TLength = (string & {}) | 0, TTime = string & {}>'),
  true,
  'index.d.ts must export generic interface StandardProperties'
);
assert.strictEqual(
  content.includes('extends StandardLonghandProperties<TLength, TTime>'),
  true,
  'StandardProperties must extend StandardLonghandProperties'
);
assert.strictEqual(
  content.includes('StandardShorthandProperties<TLength, TTime>'),
  true,
  'StandardProperties must extend StandardShorthandProperties'
);

// 3. csstype index.d.ts defines StandardLonghandProperties with camelCase CSS longhand properties including color, display, fontSize, and opacity
assert.strictEqual(
  content.includes('export interface StandardLonghandProperties<TLength = (string & {}) | 0, TTime = string & {}>'),
  true,
  'index.d.ts must export interface StandardLonghandProperties'
);
assert.strictEqual(content.includes('color?: Property.Color | undefined;'), true, 'StandardLonghandProperties must declare color');
assert.strictEqual(content.includes('display?: Property.Display | undefined;'), true, 'StandardLonghandProperties must declare display');
assert.strictEqual(
  content.includes('fontSize?: Property.FontSize<TLength> | undefined;'),
  true,
  'StandardLonghandProperties must declare fontSize with TLength'
);
assert.strictEqual(content.includes('opacity?: Property.Opacity | undefined;'), true, 'StandardLonghandProperties must declare opacity');

// 4. csstype index.d.ts defines StandardShorthandProperties with camelCase CSS shorthand properties including margin, padding, flex, and background
assert.strictEqual(
  content.includes('export interface StandardShorthandProperties<TLength = (string & {}) | 0, TTime = string & {}>'),
  true,
  'index.d.ts must export interface StandardShorthandProperties'
);
assert.strictEqual(
  content.includes('margin?: Property.Margin<TLength> | undefined;'),
  true,
  'StandardShorthandProperties must declare margin with TLength'
);
assert.strictEqual(
  content.includes('padding?: Property.Padding<TLength> | undefined;'),
  true,
  'StandardShorthandProperties must declare padding with TLength'
);
assert.strictEqual(
  content.includes('flex?: Property.Flex<TLength> | undefined;'),
  true,
  'StandardShorthandProperties must declare flex with TLength'
);
assert.strictEqual(
  content.includes('background?: Property.Background<TLength> | undefined;'),
  true,
  'StandardShorthandProperties must declare background with TLength'
);

// 5. csstype index.d.ts defines Properties interface extending StandardProperties with vendor, obsolete, and SVG properties
assert.strictEqual(
  content.includes('export interface Properties<TLength = (string & {}) | 0, TTime = string & {}>'),
  true,
  'index.d.ts must export interface Properties'
);
assert.strictEqual(
  content.includes('extends StandardProperties<TLength, TTime>'),
  true,
  'Properties must extend StandardProperties'
);

// 6. csstype index.d.ts defines kebab-case and fallback variants StandardPropertiesHyphen and StandardPropertiesFallback
assert.strictEqual(
  content.includes('export interface StandardPropertiesHyphen<TLength = (string & {}) | 0, TTime = string & {}>'),
  true,
  'index.d.ts must export interface StandardPropertiesHyphen'
);
assert.strictEqual(
  content.includes('export interface StandardPropertiesFallback<TLength = (string & {}) | 0, TTime = string & {}>'),
  true,
  'index.d.ts must export interface StandardPropertiesFallback'
);

// 7. Verify helper module inspection matches all criteria
const inspection = inspectStandardProperties();
assert.strictEqual(inspection.hasStandardProperties, true, 'inspection should verify StandardProperties');
assert.strictEqual(inspection.extendsStandardLonghand, true, 'inspection should verify StandardLonghand extension');
assert.strictEqual(inspection.extendsStandardShorthand, true, 'inspection should verify StandardShorthand extension');
assert.strictEqual(inspection.hasStandardLonghandInterface, true, 'inspection should verify StandardLonghand interface');
assert.strictEqual(inspection.hasStandardShorthandInterface, true, 'inspection should verify StandardShorthand interface');
assert.strictEqual(inspection.hasPropertiesInterface, true, 'inspection should verify Properties interface');
assert.strictEqual(inspection.propertiesExtendsStandard, true, 'inspection should verify Properties extends StandardProperties');
assert.strictEqual(inspection.hasHyphenVariant, true, 'inspection should verify StandardPropertiesHyphen');
assert.strictEqual(inspection.hasFallbackVariant, true, 'inspection should verify StandardPropertiesFallback');
assert.strictEqual(inspection.hasLonghandProperties.color, true, 'inspection should verify color property');
assert.strictEqual(inspection.hasLonghandProperties.display, true, 'inspection should verify display property');
assert.strictEqual(inspection.hasLonghandProperties.fontSize, true, 'inspection should verify fontSize property');
assert.strictEqual(inspection.hasLonghandProperties.opacity, true, 'inspection should verify opacity property');
assert.strictEqual(inspection.hasLonghandProperties.position, true, 'inspection should verify position property');
assert.strictEqual(inspection.hasLonghandProperties.zIndex, true, 'inspection should verify zIndex property');
assert.strictEqual(inspection.hasShorthandProperties.background, true, 'inspection should verify background property');
assert.strictEqual(inspection.hasShorthandProperties.border, true, 'inspection should verify border property');
assert.strictEqual(inspection.hasShorthandProperties.flex, true, 'inspection should verify flex property');
assert.strictEqual(inspection.hasShorthandProperties.font, true, 'inspection should verify font property');
assert.strictEqual(inspection.hasShorthandProperties.margin, true, 'inspection should verify margin property');
assert.strictEqual(inspection.hasShorthandProperties.padding, true, 'inspection should verify padding property');

console.log('All contract assertions passed successfully.');

Seeder de origen

anónimo