Beispiel
bare-structured-clone 1.6.0: structured cloning with bare-structured-clone
Verifiziertes Beispiel für npm bare-structured-clone 1.6.0: structured cloning with bare-structured-clone. Der Vertrag lief auf node 22 · linux alpine/x64 …
sha256:5777d6a238366c6293cc0ea32055a8e661d021b273b1abf9be62c85e4d034d82
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-27 |
Fall
HOW- Ziel
- structured cloning with bare-structured-clone
- Pakete
- Symbole
-
- deserialize
- serialize
- structuredClone
- Erstellt
- 2026-08-27T14:26:01Z
Contract
- package manifest specifies Bare native addon configuration, Apache-2.0 license, and exports for root, global, constants, errors, and package subpaths
- bare-structured-clone/errors exports DataCloneError class extending Error with static factory constructors
- bare-structured-clone/constants exports VERSION and type constants for primitives, composite objects, references, and transfers
- declares structuredClone, serialize, deserialize, Serializable, Transferable, and symbols in index.d.ts
- implements native Bare module binding in binding.c with CMakeLists.txt and provides multi-platform precompiled .bare addon binaries
Dateien
- PROMPT.md
- csx.json
- package-lock.json
- package.json
- spec.json
- test/contract.mjs
Quelltext
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: structured cloning with bare-structured-clone
Kind: HOW
Use EXACTLY these public packages and versions:
- pkg:npm/bare-structured-clone@1.6.0
Demonstrate these symbols/APIs:
- deserialize
- serialize
- structuredClone
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:144442d6bfd64aed22a5e00868bd56697ebd068ec9d7472a51287301b6cbdeab","contract":["package manifest specifies Bare native addon configuration, Apache-2.0 license, and exports for root, global, constants, errors, and package subpaths","bare-structured-clone/errors exports DataCloneError class extending Error with static factory constructors","bare-structured-clone/constants exports VERSION and type constants for primitives, composite objects, references, and transfers","declares structuredClone, serialize, deserialize, Serializable, Transferable, and symbols in index.d.ts","implements native Bare module binding in binding.c with CMakeLists.txt and provides multi-platform precompiled .bare addon binaries"],"goal":"structured cloning with bare-structured-clone","kind":"HOW","packages":["pkg:npm/bare-structured-clone@1.6.0"],"schemaVersion":1,"symbols":["deserialize","serialize","structuredClone"]},"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/bare-structured-clone@1.6.0"],"schemaVersion":1,"subject":"pkg:npm/bare-structured-clone@1.6.0","symbols":["deserialize","serialize","structuredClone"],"verifierAdapter":"node-typescript@1"}
{
"name": "sample-bare-structured-clone",
"version": "1.0.0",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "sample-bare-structured-clone",
"version": "1.0.0",
"license": "MIT-0",
"dependencies": {
"bare-structured-clone": "1.6.0"
}
},
"node_modules/b4a": {
"version": "1.8.1",
"resolved": "https://registry.npmjs.org/b4a/-/b4a-1.8.1.tgz",
"integrity": "sha512-aiqre1Nr0B/6DgE2N5vwTc+2/oQZ4Wh1t4NznYY4E00y8LCt6NqdRv81so00oo27D8MVKTpUa/MwUUtBLXCoDw==",
"license": "Apache-2.0",
"peerDependencies": {
"react-native-b4a": "*"
},
"peerDependenciesMeta": {
"react-native-b4a": {
"optional": true
}
}
},
"node_modules/bare-buffer": {
"version": "3.7.0",
"resolved": "https://registry.npmjs.org/bare-buffer/-/bare-buffer-3.7.0.tgz",
"integrity": "sha512-/xRTbBuLis7sE3Izii0A0yOm+WqH1/gh12UVqkpIAOLZ4gWluyK0THbGB+UysKI8ZBjcZ+MaEs9Auxcyiz2yLA==",
"license": "Apache-2.0",
"engines": {
"bare": ">=1.20.0"
}
},
"node_modules/bare-path": {
"version": "3.1.1",
"resolved": "https://registry.npmjs.org/bare-path/-/bare-path-3.1.1.tgz",
"integrity": "sha512-JprUlveX3QjApC1cTpsUOiscADftCGVWkzitbHsRqv84hzYwYHw2mbluddsq5TvI8mH/8Ov1f4BiMAdcB0oYnQ==",
"license": "Apache-2.0"
},
"node_modules/bare-structured-clone": {
"version": "1.6.0",
"resolved": "https://registry.npmjs.org/bare-structured-clone/-/bare-structured-clone-1.6.0.tgz",
"integrity": "sha512-AZjEERyqF7kAuudlmgrweT2KwwWM0LsGG4Gx/bWyFwJrKU7E3wNG8c09z2DIrdw93p3vDtfOX8fyHOcXfy5m+g==",
"license": "Apache-2.0",
"dependencies": {
"bare-buffer": "^3.6.0",
"bare-type": "^1.1.0",
"bare-url": "^2.4.0",
"compact-encoding": "^3.0.1"
},
"engines": {
"bare": ">=1.2.0"
}
},
"node_modules/bare-type": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/bare-type/-/bare-type-1.1.0.tgz",
"integrity": "sha512-LdtnnEEYldOc87Dr4GpsKnStStZk3zfgoEMXy8yvEZkXrcCv9RtYDrUYWFsBQHtaB0s1EUWmcvS6XmEZYIj3Bw==",
"license": "Apache-2.0",
"engines": {
"bare": ">=1.2.0"
}
},
"node_modules/bare-url": {
"version": "2.5.2",
"resolved": "https://registry.npmjs.org/bare-url/-/bare-url-2.5.2.tgz",
"integrity": "sha512-L13PCJzKG8RGvx8V1/DdMi12ERhC3tprr7/8a94BxpmnRsFqxh5XZNdhtMxu5HPkRshYOOWRGY8lDP7ZhpG9Cg==",
"license": "Apache-2.0",
"dependencies": {
"bare-path": "^3.0.0"
}
},
"node_modules/compact-encoding": {
"version": "3.3.2",
"resolved": "https://registry.npmjs.org/compact-encoding/-/compact-encoding-3.3.2.tgz",
"integrity": "sha512-bgZ84oVSzjQmVHXBYWON+wQUkdVflrr8fM5+0X6UwQHZyzolsGIkdsjNK3vLLn22dhdASGFz5mS6Lf7rfrPdlg==",
"license": "Apache-2.0",
"dependencies": {
"b4a": "^1.3.0"
}
}
}
}
{
"name": "sample-bare-structured-clone",
"version": "1.0.0",
"private": true,
"type": "module",
"license": "MIT-0",
"dependencies": {
"bare-structured-clone": "1.6.0"
}
}
{
"schemaVersion": 1,
"goal": "structured cloning with bare-structured-clone",
"kind": "HOW",
"packages": [
"pkg:npm/bare-structured-clone@1.6.0"
],
"symbols": [
"deserialize",
"serialize",
"structuredClone"
]
}
import assert from 'node:assert/strict';
import { createRequire } from 'node:module';
import fs from 'node:fs';
import path from 'node:path';
const require = createRequire(import.meta.url);
// 1. Resolve package manifest and verify exports and metadata
const pkgPath = require.resolve('bare-structured-clone/package');
const pkg = JSON.parse(fs.readFileSync(pkgPath, 'utf8'));
assert.equal(pkg.name, 'bare-structured-clone', 'Package name must be bare-structured-clone');
assert.equal(pkg.version, '1.6.0', 'Package version must be 1.6.0');
assert.equal(pkg.license, 'Apache-2.0', 'Package license must be Apache-2.0');
assert.equal(pkg.addon, true, 'Package must be marked as addon');
assert.ok(pkg.exports, 'Package must define exports');
assert.equal(pkg.exports['.'].types, './index.d.ts', 'Root types export must point to ./index.d.ts');
assert.equal(pkg.exports['.'].default, './index.js', 'Root default export must point to ./index.js');
assert.equal(pkg.exports['./global'].types, './global.d.ts', 'Global types export must point to ./global.d.ts');
assert.equal(pkg.exports['./global'].default, './global.js', 'Global default export must point to ./global.js');
assert.equal(pkg.exports['./constants'].types, './lib/constants.d.ts', 'Constants types export must point to ./lib/constants.d.ts');
assert.equal(pkg.exports['./constants'].default, './lib/constants.js', 'Constants default export must point to ./lib/constants.js');
assert.equal(pkg.exports['./errors'].types, './lib/errors.d.ts', 'Errors types export must point to ./lib/errors.d.ts');
assert.equal(pkg.exports['./errors'].default, './lib/errors.js', 'Errors default export must point to ./lib/errors.js');
assert.equal(pkg.exports['./package'], './package.json', 'Package export must point to ./package.json');
const pkgDir = path.dirname(pkgPath);
// 2. Verify errors submodule functionality (DataCloneError)
const DataCloneError = require('bare-structured-clone/errors');
assert.equal(typeof DataCloneError, 'function', 'bare-structured-clone/errors must export DataCloneError');
assert.ok(DataCloneError.prototype instanceof Error, 'DataCloneError must extend Error');
const verErr = DataCloneError.INVALID_VERSION('Unsupported version 99');
assert.ok(verErr instanceof DataCloneError, 'INVALID_VERSION must return DataCloneError instance');
assert.equal(verErr.name, 'DataCloneError', 'Error name must be DataCloneError');
assert.equal(verErr.code, 'INVALID_VERSION', 'Error code must be INVALID_VERSION');
assert.equal(verErr.message, 'INVALID_VERSION: Unsupported version 99');
const unsubErr = DataCloneError.UNSERIALIZABLE_TYPE('Cannot serialize function');
assert.equal(unsubErr.code, 'UNSERIALIZABLE_TYPE');
const untransErr = DataCloneError.UNTRANSFERABLE_TYPE('Cannot transfer non-transferable');
assert.equal(untransErr.code, 'UNTRANSFERABLE_TYPE');
const alreadyTransErr = DataCloneError.ALREADY_TRANSFERRED('Buffer is detached');
assert.equal(alreadyTransErr.code, 'ALREADY_TRANSFERRED');
const refErr = DataCloneError.INVALID_REFERENCE('Unknown reference ID');
assert.equal(refErr.code, 'INVALID_REFERENCE');
const ifaceErr = DataCloneError.INVALID_INTERFACE('Interface not found');
assert.equal(ifaceErr.code, 'INVALID_INTERFACE');
// 3. Verify constants submodule values
const constants = require('bare-structured-clone/constants');
assert.equal(typeof constants, 'object', 'constants must be an object');
assert.equal(constants.VERSION, 0, 'VERSION constant must be 0');
assert.equal(constants.type.UNDEFINED, 0);
assert.equal(constants.type.NULL, 1);
assert.equal(constants.type.TRUE, 2);
assert.equal(constants.type.FALSE, 3);
assert.equal(constants.type.NUMBER, 4);
assert.equal(constants.type.BIGINT, 5);
assert.equal(constants.type.STRING, 6);
assert.equal(constants.type.DATE, 7);
assert.equal(constants.type.REGEXP, 8);
assert.equal(constants.type.ERROR, 9);
assert.equal(constants.type.ARRAYBUFFER, 10);
assert.equal(constants.type.RESIZABLEARRAYBUFFER, 11);
assert.equal(constants.type.SHAREDARRAYBUFFER, 12);
assert.equal(constants.type.GROWABLESHAREDARRAYBUFFER, 13);
assert.equal(constants.type.TYPEDARRAY, 14);
assert.equal(constants.type.DATAVIEW, 15);
assert.equal(constants.type.MAP, 16);
assert.equal(constants.type.SET, 17);
assert.equal(constants.type.ARRAY, 18);
assert.equal(constants.type.OBJECT, 19);
assert.equal(constants.type.REFERENCE, 20);
assert.equal(constants.type.TRANSFER, 21);
assert.equal(constants.type.URL, 22);
assert.equal(constants.type.BUFFER, 23);
assert.equal(constants.type.EXTERNAL, 24);
assert.equal(constants.type.SERIALIZABLE, 25);
assert.equal(constants.type.TRANSFERABLE, 26);
assert.equal(constants.type.typedarray.UINT8ARRAY, 1);
assert.equal(constants.type.typedarray.FLOAT64ARRAY, 11);
assert.equal(constants.type.error.AGGREGATE, 1);
assert.equal(constants.type.error.TYPE, 6);
// 4. Verify TypeScript declarations (index.d.ts)
const indexDtsPath = path.join(pkgDir, 'index.d.ts');
assert.ok(fs.existsSync(indexDtsPath), 'index.d.ts must exist');
const indexDts = fs.readFileSync(indexDtsPath, 'utf8');
assert.ok(indexDts.includes('declare function structuredClone'), 'index.d.ts must declare structuredClone');
assert.ok(indexDts.includes('export function serialize'), 'index.d.ts must declare serialize');
assert.ok(indexDts.includes('export function deserialize'), 'index.d.ts must declare deserialize');
assert.ok(indexDts.includes('export function serializeWithTransfer'), 'index.d.ts must declare serializeWithTransfer');
assert.ok(indexDts.includes('export function deserializeWithTransfer'), 'index.d.ts must declare deserializeWithTransfer');
assert.ok(indexDts.includes('declare class Serializable'), 'index.d.ts must declare Serializable class');
assert.ok(indexDts.includes('declare class Transferable'), 'index.d.ts must declare Transferable class');
assert.ok(indexDts.includes('readonly serialize: unique symbol'), 'index.d.ts must declare serialize symbol');
assert.ok(indexDts.includes('readonly deserialize: unique symbol'), 'index.d.ts must declare deserialize symbol');
assert.ok(indexDts.includes('readonly detach: unique symbol'), 'index.d.ts must declare detach symbol');
assert.ok(indexDts.includes('readonly attach: unique symbol'), 'index.d.ts must declare attach symbol');
// 5. Verify C native addon source and build configuration
const bindingCPath = path.join(pkgDir, 'binding.c');
assert.ok(fs.existsSync(bindingCPath), 'binding.c must exist');
const bindingC = fs.readFileSync(bindingCPath, 'utf8');
assert.ok(bindingC.includes('#include <bare.h>'), 'binding.c must include <bare.h>');
assert.ok(bindingC.includes('#include <js.h>'), 'binding.c must include <js.h>');
assert.ok(bindingC.includes('BARE_MODULE(bare_structured_clone, bare_structured_clone_exports)'), 'binding.c must define BARE_MODULE');
const cmakePath = path.join(pkgDir, 'CMakeLists.txt');
assert.ok(fs.existsSync(cmakePath), 'CMakeLists.txt must exist');
const cmake = fs.readFileSync(cmakePath, 'utf8');
assert.ok(cmake.includes('project(bare_structured_clone C)'), 'CMakeLists.txt must define project');
assert.ok(cmake.includes('add_bare_module(bare_structured_clone)'), 'CMakeLists.txt must declare bare module');
// 6. Verify prebuilt native binaries across architectures
const prebuildsDir = path.join(pkgDir, 'prebuilds');
assert.ok(fs.existsSync(prebuildsDir), 'prebuilds directory must exist');
const expectedTargets = [
'android-arm',
'android-arm64',
'android-ia32',
'android-x64',
'darwin-arm64',
'darwin-x64',
'ios-arm64-simulator',
'ios-arm64',
'ios-x64-simulator',
'linux-arm64',
'linux-x64',
'win32-arm64',
'win32-x64'
];
for (const target of expectedTargets) {
const binaryPath = path.join(prebuildsDir, target, 'bare-structured-clone.bare');
assert.ok(fs.existsSync(binaryPath), `Prebuild binary must exist for target: ${target}`);
const stat = fs.statSync(binaryPath);
assert.ok(stat.size > 0, `Prebuild binary for ${target} must not be empty`);
}
const linuxX64Binary = fs.readFileSync(path.join(prebuildsDir, 'linux-x64', 'bare-structured-clone.bare'));
assert.ok(linuxX64Binary.length > 1000, 'linux-x64 prebuild binary size must exceed 1000 bytes');
console.log('Contract tests passed successfully.');
Ursprungs-Seeder
anonym