Ejemplo
@xmldom/xmldom 0.8.13: DOMImplementation
Muestra verificada para npm @xmldom/xmldom 0.8.13: DOMImplementation. El contrato se ejecutó en node 22 · linux alpine/x64 · docker y pasó.
sha256:2729677372bec43b5d9b4924f10cdf8fa0a37a3c86280acab8c6732eb6c23747
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-23 |
| 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 @xmldom/xmldom.DOMImplementation in pkg:npm/%40xmldom/xmldom@0.8.13
- Paquetes
- Símbolos
-
- @xmldom/xmldom.DOMImplementation
- Creado
- 2026-08-23T13:59:57Z
Contrato
- DOMImplementation checks feature support via hasFeature
- DOMImplementation.createDocumentType creates a DocumentType node with qualifiedName, publicId, and systemId
- DOMImplementation.createDocument creates an XML Document with root element, namespace, doctype, and implementation reference
- DOMImplementation.createDocument creates a Document with namespaced qualified name prefix and populates child nodes
Archivos
- PROMPT.md
- csx.json
- index.mjs
- package-lock.json
- package.json
- spec.json
- test/contract.mjs
Código fuente
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 @xmldom/xmldom.DOMImplementation in pkg:npm/%40xmldom/xmldom@0.8.13
Kind: HOW
Use EXACTLY these public packages and versions:
- pkg:npm/%40xmldom/xmldom@0.8.13
Demonstrate these symbols/APIs:
- @xmldom/xmldom.DOMImplementation
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.
{"case":{"caseId":"case:sha256:cbac5b5f5d5c8cfc92e6df2c408252d6278f13d2d3f400078e94bb20cce20b16","contract":["DOMImplementation checks feature support via hasFeature","DOMImplementation.createDocumentType creates a DocumentType node with qualifiedName, publicId, and systemId","DOMImplementation.createDocument creates an XML Document with root element, namespace, doctype, and implementation reference","DOMImplementation.createDocument creates a Document with namespaced qualified name prefix and populates child nodes"],"goal":"verify @xmldom/xmldom.DOMImplementation in pkg:npm/%40xmldom/xmldom@0.8.13","kind":"HOW","packages":["pkg:npm/%40xmldom/xmldom@0.8.13"],"schemaVersion":1,"symbols":["@xmldom/xmldom.DOMImplementation"]},"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/%40xmldom/xmldom@0.8.13"],"schemaVersion":1,"subject":"pkg:npm/%40xmldom/xmldom@0.8.13","symbols":["@xmldom/xmldom.DOMImplementation"],"verifierAdapter":"node-typescript@1"}
import { DOMImplementation } from '@xmldom/xmldom';
/**
* Creates a new DOMImplementation instance.
* @returns {DOMImplementation}
*/
export function getDOMImplementation() {
return new DOMImplementation();
}
/**
* Creates a DocumentType node using DOMImplementation.
* @param {string} qualifiedName
* @param {string} [publicId]
* @param {string} [systemId]
* @returns {DocumentType}
*/
export function createDocType(qualifiedName, publicId = '', systemId = '') {
const impl = new DOMImplementation();
return impl.createDocumentType(qualifiedName, publicId, systemId);
}
/**
* Creates a new XML Document using DOMImplementation with optional namespace, qualifiedName, and doctype.
* @param {string|null} [namespaceURI]
* @param {string|null} [qualifiedName]
* @param {DocumentType|null} [doctype]
* @returns {Document}
*/
export function createXmlDocument(namespaceURI = null, qualifiedName = null, doctype = null) {
const impl = new DOMImplementation();
return impl.createDocument(namespaceURI, qualifiedName, doctype);
}
/**
* Checks if a feature and version is supported by DOMImplementation.
* @param {string} feature
* @param {string} [version]
* @returns {boolean}
*/
export function checkFeature(feature, version) {
const impl = new DOMImplementation();
return impl.hasFeature(feature, version);
}
export { DOMImplementation };
{
"name": "sample-xmldom-domimplementation",
"version": "1.0.0",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "sample-xmldom-domimplementation",
"version": "1.0.0",
"dependencies": {
"@xmldom/xmldom": "0.8.13"
}
},
"node_modules/@xmldom/xmldom": {
"version": "0.8.13",
"resolved": "https://registry.npmjs.org/@xmldom/xmldom/-/xmldom-0.8.13.tgz",
"integrity": "sha512-KRYzxepc14G/CEpEGc3Yn+JKaAeT63smlDr+vjB8jRfgTBBI9wRj/nkQEO+ucV8p8I9bfKLWp37uHgFrbntPvw==",
"deprecated": "this version has critical issues, please update to the latest version",
"license": "MIT",
"engines": {
"node": ">=10.0.0"
}
}
}
}
{
"name": "sample-xmldom-domimplementation",
"version": "1.0.0",
"private": true,
"type": "module",
"dependencies": {
"@xmldom/xmldom": "0.8.13"
}
}
{
"schemaVersion": 1,
"goal": "verify @xmldom/xmldom.DOMImplementation in pkg:npm/%40xmldom/xmldom@0.8.13",
"kind": "HOW",
"packages": [
"pkg:npm/%40xmldom/xmldom@0.8.13"
],
"symbols": [
"@xmldom/xmldom.DOMImplementation"
]
}
import assert from 'node:assert/strict';
import {
getDOMImplementation,
createDocType,
createXmlDocument,
checkFeature,
DOMImplementation
} from '../index.mjs';
// 1. DOMImplementation checks feature support via hasFeature
{
const impl = getDOMImplementation();
assert.ok(impl instanceof DOMImplementation, 'Expected DOMImplementation instance');
assert.strictEqual(checkFeature('XML', '2.0'), true, 'XML 2.0 feature should be supported');
assert.strictEqual(checkFeature('Core', '1.0'), true, 'Core 1.0 feature should be supported');
assert.strictEqual(impl.hasFeature('XML', '1.0'), true, 'hasFeature should return true on instance');
}
// 2. DOMImplementation.createDocumentType creates a DocumentType node with qualifiedName, publicId, and systemId
{
const name = 'html';
const publicId = '-//W3C//DTD XHTML 1.0 Strict//EN';
const systemId = 'http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd';
const doctype = createDocType(name, publicId, systemId);
assert.ok(doctype, 'DocumentType node should be created');
assert.strictEqual(doctype.name, name);
assert.strictEqual(doctype.publicId, publicId);
assert.strictEqual(doctype.systemId, systemId);
assert.strictEqual(doctype.nodeType, 10, 'nodeType should be DOCUMENT_TYPE_NODE (10)');
}
// 3. DOMImplementation.createDocument creates an XML Document with root element, namespace, doctype, and implementation reference
{
const impl = getDOMImplementation();
const doctype = impl.createDocumentType(
'html',
'-//W3C//DTD XHTML 1.0 Strict//EN',
'http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd'
);
const doc = impl.createDocument('http://www.w3.org/1999/xhtml', 'html', doctype);
assert.ok(doc, 'Document should be created');
assert.strictEqual(doc.nodeType, 9, 'nodeType should be DOCUMENT_NODE (9)');
assert.strictEqual(doc.doctype, doctype, 'Document doctype should match the provided doctype');
assert.strictEqual(doc.documentElement.tagName, 'html', 'Root element tag name should be html');
assert.strictEqual(doc.documentElement.namespaceURI, 'http://www.w3.org/1999/xhtml', 'Root element should have specified namespace');
assert.ok(doc.implementation, 'Document should have implementation reference');
}
// 4. DOMImplementation.createDocument creates a Document with namespaced qualified name prefix and populates child nodes
{
const ns = 'http://www.w3.org/2000/svg';
const doc = createXmlDocument(ns, 'svg:svg', null);
assert.ok(doc, 'SVG Document should be created');
assert.strictEqual(doc.documentElement.tagName, 'svg:svg');
assert.strictEqual(doc.documentElement.prefix, 'svg');
assert.strictEqual(doc.documentElement.localName, 'svg');
assert.strictEqual(doc.documentElement.namespaceURI, ns);
const circle = doc.createElementNS(ns, 'circle');
circle.setAttribute('cx', '50');
circle.setAttribute('cy', '50');
circle.setAttribute('r', '40');
doc.documentElement.appendChild(circle);
assert.strictEqual(doc.documentElement.childNodes.length, 1);
assert.strictEqual(doc.documentElement.firstChild, circle);
assert.strictEqual(doc.documentElement.firstChild.getAttribute('r'), '40');
}
console.log('All DOMImplementation contracts passed.');
Seeder de origen
anónimo