CodeSampleX

Ejemplo

bare-runtime 1.31.0: locate Bare binary prebuild path and spawn child process to execute JavaScript code

Muestra verificada para npm bare-runtime 1.31.0: locate Bare binary prebuild path and spawn child process to execute JavaScript code. El contrato se ejecutó…

sha256:ab14ff6c327311e00454a625e60b58d0b9072d571da4ef05e643b46d01b9fbc8

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

Caso

HOW
Objetivo
locate Bare binary prebuild path and spawn child process to execute JavaScript code
Paquetes
Símbolos
  • runtime
  • spawn
Creado
2026-08-27T13:10:11Z

Contrato

  1. verifies bare-runtime package manifest exports mapping and CLI bin specification
  2. runtime resolves prebuilt Bare binary path for current platform and architecture
  3. runtime throws error when target platform has no prebuilt binary
  4. runtime throws error when specified referrer binary is missing
  5. spawn sets executable permissions and spawns ChildProcess with stdio streams
  6. verifies bin/bare CLI launcher script structure and delegation to spawn

Archivos

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

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: locate Bare binary prebuild path and spawn child process to execute JavaScript code
Kind: HOW

Use EXACTLY these public packages and versions:
  - pkg:npm/bare-runtime@1.31.0
Demonstrate these symbols/APIs:
  - runtime
  - spawn

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:60384c6b96d587265f5e3b9cc4a9cc144ce047aec715cbbd70cbc8a076b5afe5","contract":["verifies bare-runtime package manifest exports mapping and CLI bin specification","runtime resolves prebuilt Bare binary path for current platform and architecture","runtime throws error when target platform has no prebuilt binary","runtime throws error when specified referrer binary is missing","spawn sets executable permissions and spawns ChildProcess with stdio streams","verifies bin/bare CLI launcher script structure and delegation to spawn"],"goal":"locate Bare binary prebuild path and spawn child process to execute JavaScript code","kind":"HOW","packages":["pkg:npm/bare-runtime@1.31.0"],"schemaVersion":1,"symbols":["runtime","spawn"]},"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-runtime@1.31.0"],"schemaVersion":1,"subject":"pkg:npm/bare-runtime@1.31.0","symbols":["runtime","spawn"],"verifierAdapter":"node-typescript@1"}
index.js
import runtime from 'bare-runtime';
import spawn from 'bare-runtime/spawn';

export function getRuntimePath(referrer, opts) {
  return runtime(referrer, opts);
}

export function spawnBare(referrer, opts) {
  return spawn(referrer, opts);
}

export { runtime, spawn };
export default runtime;
package-lock.json
{
  "name": "sample-bare-runtime",
  "version": "1.0.0",
  "lockfileVersion": 3,
  "requires": true,
  "packages": {
    "": {
      "name": "sample-bare-runtime",
      "version": "1.0.0",
      "dependencies": {
        "bare-runtime": "1.31.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-abort": {
      "version": "2.0.13",
      "resolved": "https://registry.npmjs.org/bare-abort/-/bare-abort-2.0.13.tgz",
      "integrity": "sha512-zdc8l88eB11Jsz5rDd6sCAgv2kUFXgdrZWoMlgU6JMkfAi1/uuGFC3IEHswKbIRQTk5H3T5CMuechsXYxiaHlQ==",
      "license": "Apache-2.0"
    },
    "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-dns": {
      "version": "2.2.0",
      "resolved": "https://registry.npmjs.org/bare-dns/-/bare-dns-2.2.0.tgz",
      "integrity": "sha512-iEqjj122eXdbDP5gXwk/NG/XVI5xoGjQA24UlGBPafUeMIGesxUZ5rxDvjNXPBHDyTkO+H3IsV5izZ8T5IGAXA==",
      "license": "Apache-2.0",
      "engines": {
        "bare": ">=1.7.0"
      },
      "peerDependencies": {
        "bare-buffer": "*"
      },
      "peerDependenciesMeta": {
        "bare-buffer": {
          "optional": true
        }
      }
    },
    "node_modules/bare-env": {
      "version": "3.0.1",
      "resolved": "https://registry.npmjs.org/bare-env/-/bare-env-3.0.1.tgz",
      "integrity": "sha512-BdoLvnzaWR0YyyJreEx4zG2Od0AC/s9JSZ+EXyMZKunpn8zEgR/dGv37hdFUaY1bjDkcRKvcKkFyJIwlJ0CaYA==",
      "license": "Apache-2.0",
      "dependencies": {
        "bare-os": "^3.0.1"
      }
    },
    "node_modules/bare-events": {
      "version": "2.9.2",
      "resolved": "https://registry.npmjs.org/bare-events/-/bare-events-2.9.2.tgz",
      "integrity": "sha512-AIPKioV7/Y/8KfZ3AAhjPJxLLbY49S64Ym5DakZlUg75qQiTgUq9hEJoEwa4eUezPUlXRy/i5NpsKvo9jgKmoA==",
      "license": "Apache-2.0",
      "peerDependencies": {
        "bare-abort-controller": "*"
      },
      "peerDependenciesMeta": {
        "bare-abort-controller": {
          "optional": true
        }
      }
    },
    "node_modules/bare-fs": {
      "version": "4.8.1",
      "resolved": "https://registry.npmjs.org/bare-fs/-/bare-fs-4.8.1.tgz",
      "integrity": "sha512-N1nnXdHZAOSstz0XiHikGS4HGMH4CnSwhqWdGQQMqqdvp4Jybm9sE3R1WVnpWVd4SFkc8ryPDBLViNLwiEqECg==",
      "license": "Apache-2.0",
      "dependencies": {
        "bare-events": "^2.5.4",
        "bare-path": "^3.0.0",
        "bare-stream": "^2.6.4",
        "bare-url": "^2.2.2",
        "fast-fifo": "^1.3.2"
      },
      "engines": {
        "bare": ">=1.28.0"
      },
      "peerDependencies": {
        "bare-buffer": "*"
      },
      "peerDependenciesMeta": {
        "bare-buffer": {
          "optional": true
        }
      }
    },
    "node_modules/bare-hrtime": {
      "version": "2.1.1",
      "resolved": "https://registry.npmjs.org/bare-hrtime/-/bare-hrtime-2.1.1.tgz",
      "integrity": "sha512-VMb3tHo05gsnbu3OXTmkDiwTjMlOsbQmKoysKqKEyR09m77TuDrYFbj3Q5GGk10dAKsUHrnXmwCaeJqzVpB5ZA==",
      "license": "Apache-2.0"
    },
    "node_modules/bare-module-resolve": {
      "version": "1.12.4",
      "resolved": "https://registry.npmjs.org/bare-module-resolve/-/bare-module-resolve-1.12.4.tgz",
      "integrity": "sha512-xcfgg2u7HqgJiBmah71O9vvdFAgHCvkqC/WSC2O7Bbgosoc1eC/BWe/6IDJ4OsfKlkxuvC/TDWXC+oH5yeW8mA==",
      "license": "Apache-2.0",
      "optional": true,
      "dependencies": {
        "bare-semver": "^1.0.0"
      },
      "peerDependencies": {
        "bare-url": "*"
      },
      "peerDependenciesMeta": {
        "bare-url": {
          "optional": true
        }
      }
    },
    "node_modules/bare-os": {
      "version": "3.9.3",
      "resolved": "https://registry.npmjs.org/bare-os/-/bare-os-3.9.3.tgz",
      "integrity": "sha512-fF4Q7QsyKVF5Rj0qvI8BgUNjqzC2JvQlpTaPLjVJVxYVUX5Zr9un+y3w1HmA4nNKdFmRBT8z/WmrjvXzXVerKQ==",
      "license": "Apache-2.0",
      "engines": {
        "bare": ">=1.14.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-pipe": {
      "version": "4.2.3",
      "resolved": "https://registry.npmjs.org/bare-pipe/-/bare-pipe-4.2.3.tgz",
      "integrity": "sha512-MJYji+Vy8cNMAB2fwg1WQAm1hFIOe5ojw5V9EhEa/wEEYpKT8c36WjHBDwgkgAZfUSX6wQcEFX+Q7wN09SgRow==",
      "license": "Apache-2.0",
      "dependencies": {
        "bare-events": "^2.0.0",
        "bare-stream": "^2.0.0"
      },
      "engines": {
        "bare": ">=1.16.0"
      }
    },
    "node_modules/bare-posix": {
      "version": "1.0.1",
      "resolved": "https://registry.npmjs.org/bare-posix/-/bare-posix-1.0.1.tgz",
      "integrity": "sha512-b4quA8dyRVvX0aFIAIiev5zFATHwIUGr42Gmt+CqiBNg/bdsNkrj4bbkeotMOMiljJS4DCME5kywJO/TFwKo1A==",
      "license": "Apache-2.0"
    },
    "node_modules/bare-process": {
      "version": "4.5.1",
      "resolved": "https://registry.npmjs.org/bare-process/-/bare-process-4.5.1.tgz",
      "integrity": "sha512-CaAvy1trputD49mtwfJ6G75vydhnirLrW/F3Sznp4H556e1uZn8YMo9ELicBTrGYy7RBNUgPl9bpB/ERzRCiDw==",
      "license": "Apache-2.0",
      "dependencies": {
        "bare-abort": "^2.0.13",
        "bare-env": "^3.0.0",
        "bare-events": "^2.3.1",
        "bare-hrtime": "^2.0.0",
        "bare-os": "^3.7.1",
        "bare-posix": "^1.0.1",
        "bare-signals": "^5.0.0",
        "bare-stdio": "^1.0.1"
      }
    },
    "node_modules/bare-runtime": {
      "version": "1.31.0",
      "resolved": "https://registry.npmjs.org/bare-runtime/-/bare-runtime-1.31.0.tgz",
      "integrity": "sha512-Bzx7Z3hcfJ8IqDr8Rzyw07sfANZ3ZyetNYdp+1pO/JacdCi7jGiDVUiO42eygvibAAcQo+lR2P6kgrDqjc8DJQ==",
      "license": "Apache-2.0",
      "workspaces": [
        "npm/*"
      ],
      "dependencies": {
        "bare-fs": "^4.4.4",
        "bare-os": "^3.0.1",
        "bare-path": "^3.0.0",
        "bare-process": "^4.2.1",
        "bare-subprocess": "^6.1.0"
      },
      "bin": {
        "bare": "bin/bare"
      },
      "optionalDependencies": {
        "bare-runtime-android-arm": "1.31.0",
        "bare-runtime-android-arm64": "1.31.0",
        "bare-runtime-android-ia32": "1.31.0",
        "bare-runtime-android-x64": "1.31.0",
        "bare-runtime-darwin-arm64": "1.31.0",
        "bare-runtime-darwin-x64": "1.31.0",
        "bare-runtime-ios-arm64": "1.31.0",
        "bare-runtime-ios-arm64-simulator": "1.31.0",
        "bare-runtime-ios-x64-simulator": "1.31.0",
        "bare-runtime-linux-arm64": "1.31.0",
        "bare-runtime-linux-x64": "1.31.0",
        "bare-runtime-win32-arm64": "1.31.0",
        "bare-runtime-win32-x64": "1.31.0"
      }
    },
    "node_modules/bare-runtime-android-arm": {
      "version": "1.31.0",
      "resolved": "https://registry.npmjs.org/bare-runtime-android-arm/-/bare-runtime-android-arm-1.31.0.tgz",
      "integrity": "sha512-rgnRa6eV38wtIQ/CS5Vy845Q9m9DKG4mCOpaEt7Eqee2dpQeg5uuqksqt/aktAiIaxXGYUaGkL+m9l0/tJHiyQ==",
      "cpu": [
        "arm"
      ],
      "license": "Apache-2.0",
      "optional": true,
      "os": [
        "android"
      ],
      "dependencies": {
        "require-asset": "^1.0.2"
      },
      "bin": {
        "bare": "bin/bare"
      }
    },
    "node_modules/bare-runtime-android-arm64": {
      "version": "1.31.0",
      "resolved": "https://registry.npmjs.org/bare-runtime-android-arm64/-/bare-runtime-android-arm64-1.31.0.tgz",
      "integrity": "sha512-L7oedAx2TsWb1BkZL2i5QtAZnEc0nDeg/myLGhgqhjd5guGEFxhn1blLP/oSS4TggkVDtlnTv/DBhW4KJYevyg==",
      "cpu": [
        "arm64"
      ],
      "license": "Apache-2.0",
      "optional": true,
      "os": [
        "android"
      ],
      "dependencies": {
        "require-asset": "^1.0.2"
      },
      "bin": {
        "bare": "bin/bare"
      }
    },
    "node_modules/bare-runtime-android-ia32": {
      "version": "1.31.0",
      "resolved": "https://registry.npmjs.org/bare-runtime-android-ia32/-/bare-runtime-android-ia32-1.31.0.tgz",
      "integrity": "sha512-GALoMyUtbqUw+KCV0uLV7kEZbGJUkbO2JI+vB0oJw48bZ0QM0YcPA+IV+Atucz63NslS7z0l7zoD8jwzEgihTw==",
      "cpu": [
        "ia32"
      ],
      "license": "Apache-2.0",
      "optional": true,
      "os": [
        "android"
      ],
      "dependencies": {
        "require-asset": "^1.0.2"
      },
      "bin": {
        "bare": "bin/bare"
      }
    },
    "node_modules/bare-runtime-android-x64": {
      "version": "1.31.0",
      "resolved": "https://registry.npmjs.org/bare-runtime-android-x64/-/bare-runtime-android-x64-1.31.0.tgz",
      "integrity": "sha512-ECLmyx6jiD4P7hXuqWhrZdp5h7BiiuXB7Dtgb1H3S+UZxNqKkMp+rv71x0685ZFK81iqhe0fTjUWrWMgmWO2Tw==",
      "cpu": [
        "x64"
      ],
      "license": "Apache-2.0",
      "optional": true,
      "os": [
        "android"
      ],
      "dependencies": {
        "require-asset": "^1.0.2"
      },
      "bin": {
        "bare": "bin/bare"
      }
    },
    "node_modules/bare-runtime-darwin-arm64": {
      "version": "1.31.0",
      "resolved": "https://registry.npmjs.org/bare-runtime-darwin-arm64/-/bare-runtime-darwin-arm64-1.31.0.tgz",
      "integrity": "sha512-WcDMErk9Z+aXykvWrntKHZd3886w8dSFlBKB7vCRq4fRhVvOOuQA3dAfZOyoyjapLDbAmDuz3z1J3oWi1ejTHg==",
      "cpu": [
        "arm64"
      ],
      "license": "Apache-2.0",
      "optional": true,
      "os": [
        "darwin"
      ],
      "dependencies": {
        "require-asset": "^1.0.2"
      },
      "bin": {
        "bare": "bin/bare"
      }
    },
    "node_modules/bare-runtime-darwin-x64": {
      "version": "1.31.0",
      "resolved": "https://registry.npmjs.org/bare-runtime-darwin-x64/-/bare-runtime-darwin-x64-1.31.0.tgz",
      "integrity": "sha512-IHxuWqxis7KIEgxSJN+R14Xy/ixdw+FdOUfeFQlLsNkFMWNVMvi65As3lJKcrNFFQh0OV1Bvj+M4yRsxhGIvxw==",
      "cpu": [
        "x64"
      ],
      "license": "Apache-2.0",
      "optional": true,
      "os": [
        "darwin"
      ],
      "dependencies": {
        "require-asset": "^1.0.2"
      },
      "bin": {
        "bare": "bin/bare"
      }
    },
    "node_modules/bare-runtime-ios-arm64": {
      "version": "1.31.0",
      "resolved": "https://registry.npmjs.org/bare-runtime-ios-arm64/-/bare-runtime-ios-arm64-1.31.0.tgz",
      "integrity": "sha512-n0VVNzhg9C4W9D5B8NB4J6LB9dUTRKShY5Iqp2d/2Ss1hmhyF/rcKLX9ffXqdcVJ0I9Tj1kCRelYLNl5rVeaBg==",
      "cpu": [
        "arm64"
      ],
      "license": "Apache-2.0",
      "optional": true,
      "os": [
        "ios"
      ],
      "dependencies": {
        "require-asset": "^1.0.2"
      },
      "bin": {
        "bare": "bin/bare"
      }
    },
    "node_modules/bare-runtime-ios-arm64-simulator": {
      "version": "1.31.0",
      "resolved": "https://registry.npmjs.org/bare-runtime-ios-arm64-simulator/-/bare-runtime-ios-arm64-simulator-1.31.0.tgz",
      "integrity": "sha512-Q5LbSRQou5Ls0Wn2SN+WsLdwZanlaUB8KPdGvuR/5m13un7iOLL5EO53ZOwaBrtJz+Cru/WVZJefv6LQqTOaZQ==",
      "cpu": [
        "arm64"
      ],
      "license": "Apache-2.0",
      "optional": true,
      "os": [
        "ios"
      ],
      "dependencies": {
        "require-asset": "^1.0.2"
      },
      "bin": {
        "bare": "bin/bare"
      }
    },
    "node_modules/bare-runtime-ios-x64-simulator": {
      "version": "1.31.0",
      "resolved": "https://registry.npmjs.org/bare-runtime-ios-x64-simulator/-/bare-runtime-ios-x64-simulator-1.31.0.tgz",
      "integrity": "sha512-A+EIZwLpzI9V6GdPsrHe5+/v8qtglMoj042fM8XvuCRpe7frc4tPtccwkDmdUkc8LUbKt9w3hN3DF4c4M1Hl8g==",
      "cpu": [
        "x64"
      ],
      "license": "Apache-2.0",
      "optional": true,
      "os": [
        "ios"
      ],
      "dependencies": {
        "require-asset": "^1.0.2"
      },
      "bin": {
        "bare": "bin/bare"
      }
    },
    "node_modules/bare-runtime-linux-arm64": {
      "version": "1.31.0",
      "resolved": "https://registry.npmjs.org/bare-runtime-linux-arm64/-/bare-runtime-linux-arm64-1.31.0.tgz",
      "integrity": "sha512-Kp6CxjcqRpqpUlps6I3oz609vVAzOAiw88skd82eCzLBnfqv1c/ZREF6SnEwyySDZBIMz913RGafEtprbjEbVg==",
      "cpu": [
        "arm64"
      ],
      "license": "Apache-2.0",
      "optional": true,
      "os": [
        "linux"
      ],
      "dependencies": {
        "require-asset": "^1.0.2"
      },
      "bin": {
        "bare": "bin/bare"
      }
    },
    "node_modules/bare-runtime-linux-x64": {
      "version": "1.31.0",
      "resolved": "https://registry.npmjs.org/bare-runtime-linux-x64/-/bare-runtime-linux-x64-1.31.0.tgz",
      "integrity": "sha512-nAb6155Du4DAPSoiE+sS8HHmiHRSmI6zEvcCIfQwb677SGIhm4hlKfWfV9vpGKdHrKmlcTdjmxsALihU8KQPdg==",
      "cpu": [
        "x64"
      ],
      "license": "Apache-2.0",
      "optional": true,
      "os": [
        "linux"
      ],
      "dependencies": {
        "require-asset": "^1.0.2"
      },
      "bin": {
        "bare": "bin/bare"
      }
    },
    "node_modules/bare-runtime-win32-arm64": {
      "version": "1.31.0",
      "resolved": "https://registry.npmjs.org/bare-runtime-win32-arm64/-/bare-runtime-win32-arm64-1.31.0.tgz",
      "integrity": "sha512-eT2kSBXysu8W7WZqgtEsYMT4jibkbTTy/miNUJfePCzWaae74sczP8M35vyLVAWGw7jL38lOvFYZ+FQ6ZL5e/w==",
      "cpu": [
        "arm64"
      ],
      "license": "Apache-2.0",
      "optional": true,
      "os": [
        "win32"
      ],
      "dependencies": {
        "require-asset": "^1.0.2"
      },
      "bin": {
        "bare": "bin/bare.exe"
      }
    },
    "node_modules/bare-runtime-win32-x64": {
      "version": "1.31.0",
      "resolved": "https://registry.npmjs.org/bare-runtime-win32-x64/-/bare-runtime-win32-x64-1.31.0.tgz",
      "integrity": "sha512-9XXLtxpp6LXx7PpfCa6DNUepJHBA0rclqPqyAqkDu7ZpVSxF/fZyWw2r9H1JHVGhzNcxs7LJbLIQ4yXzdM2HHA==",
      "cpu": [
        "x64"
      ],
      "license": "Apache-2.0",
      "optional": true,
      "os": [
        "win32"
      ],
      "dependencies": {
        "require-asset": "^1.0.2"
      },
      "bin": {
        "bare": "bin/bare.exe"
      }
    },
    "node_modules/bare-semver": {
      "version": "1.1.0",
      "resolved": "https://registry.npmjs.org/bare-semver/-/bare-semver-1.1.0.tgz",
      "integrity": "sha512-1Hw5qJ7hXdVt3uPUqjeFTuxyvBUJauvz5A1I2jk8gzjZMHp04n//6nV9MDbG9CMw78JHY2lGV0w6s//LrASm2w==",
      "license": "Apache-2.0",
      "optional": true
    },
    "node_modules/bare-signals": {
      "version": "5.0.0",
      "resolved": "https://registry.npmjs.org/bare-signals/-/bare-signals-5.0.0.tgz",
      "integrity": "sha512-8Gn8bBFUh2AUCJ9wWWFjSGWIo1HIUSIQnXRJGSm/f7GCDMqsuJhRmR1dT+HtDaDBkeu2l8Koxt2JLurfJ5yHVw==",
      "license": "Apache-2.0",
      "dependencies": {
        "bare-events": "^2.5.3"
      },
      "engines": {
        "bare": ">=1.7.0"
      }
    },
    "node_modules/bare-stdio": {
      "version": "1.0.3",
      "resolved": "https://registry.npmjs.org/bare-stdio/-/bare-stdio-1.0.3.tgz",
      "integrity": "sha512-8BRMx7RWMWCbBmKhyHgBco62J+Pgss7+EPI21L3R9+w0UpwDYWUUcbE0YTOesGyt7M6N7VtoshYbzwrP0pI52Q==",
      "license": "Apache-2.0",
      "dependencies": {
        "bare-fs": "^4.5.2",
        "bare-pipe": "^4.1.5",
        "bare-tty": "^5.0.3"
      }
    },
    "node_modules/bare-stream": {
      "version": "2.13.4",
      "resolved": "https://registry.npmjs.org/bare-stream/-/bare-stream-2.13.4.tgz",
      "integrity": "sha512-PcrQ8lVLbiJscNm1Kez+Yp4Gy4AHGcN1lzwjvf5NybWen7VvEgUfyfnXYJ2zNqWnzOfCb1Abq6lH8ti0syQszA==",
      "license": "Apache-2.0",
      "dependencies": {
        "b4a": "^1.8.1",
        "streamx": "^2.25.0",
        "teex": "^1.0.1"
      },
      "peerDependencies": {
        "bare-abort-controller": "*",
        "bare-buffer": "*",
        "bare-events": "*"
      },
      "peerDependenciesMeta": {
        "bare-abort-controller": {
          "optional": true
        },
        "bare-buffer": {
          "optional": true
        },
        "bare-events": {
          "optional": true
        }
      }
    },
    "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-subprocess": {
      "version": "6.1.0",
      "resolved": "https://registry.npmjs.org/bare-subprocess/-/bare-subprocess-6.1.0.tgz",
      "integrity": "sha512-8L6KtbmreDy4Fc1BdDqaDo9fg0nbedUmTSFQxYPV0uHIM2BBAX8+E0LyMDKgkk0I+mlKto80WYzOnIhT8VDdOg==",
      "license": "Apache-2.0",
      "dependencies": {
        "bare-env": "^3.0.0",
        "bare-events": "^2.5.4",
        "bare-os": "^3.0.1",
        "bare-pipe": "^4.2.0",
        "bare-structured-clone": "^1.5.2",
        "bare-tcp": "^2.4.1",
        "bare-url": "^2.2.2"
      },
      "engines": {
        "bare": ">=1.7.0"
      },
      "peerDependencies": {
        "bare-buffer": "*"
      },
      "peerDependenciesMeta": {
        "bare-buffer": {
          "optional": true
        }
      }
    },
    "node_modules/bare-tcp": {
      "version": "2.5.4",
      "resolved": "https://registry.npmjs.org/bare-tcp/-/bare-tcp-2.5.4.tgz",
      "integrity": "sha512-o3weBBYeN3tgvTJyglSMpZOfHkfz1nG53M913fvhAKF9ubQ4XsljdX6Uq7H0g/CkyGnR4Ii3OdXJHz7PxgDLGA==",
      "license": "Apache-2.0",
      "dependencies": {
        "bare-dns": "^2.0.4",
        "bare-events": "^2.5.4",
        "bare-stream": "^2.6.4"
      },
      "engines": {
        "bare": ">=1.16.0"
      },
      "peerDependencies": {
        "bare-pipe": "*"
      },
      "peerDependenciesMeta": {
        "bare-pipe": {
          "optional": true
        }
      }
    },
    "node_modules/bare-tty": {
      "version": "5.1.2",
      "resolved": "https://registry.npmjs.org/bare-tty/-/bare-tty-5.1.2.tgz",
      "integrity": "sha512-wDHPU/yVQtrDCUrKVdIVOLmfIw7dFPETz30UayuFlROvgz8Juv2SmISSMhqxYQVO+fVnG/1ZoLcbGh/35eAjDA==",
      "license": "Apache-2.0",
      "dependencies": {
        "bare-events": "^2.2.0",
        "bare-signals": "^5.0.0",
        "bare-stream": "^2.0.0"
      },
      "engines": {
        "bare": ">=1.16.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"
      }
    },
    "node_modules/events-universal": {
      "version": "1.0.1",
      "resolved": "https://registry.npmjs.org/events-universal/-/events-universal-1.0.1.tgz",
      "integrity": "sha512-LUd5euvbMLpwOF8m6ivPCbhQeSiYVNb8Vs0fQ8QjXo0JTkEHpz8pxdQf0gStltaPpw0Cca8b39KxvK9cfKRiAw==",
      "license": "Apache-2.0",
      "dependencies": {
        "bare-events": "^2.7.0"
      }
    },
    "node_modules/fast-fifo": {
      "version": "1.3.2",
      "resolved": "https://registry.npmjs.org/fast-fifo/-/fast-fifo-1.3.2.tgz",
      "integrity": "sha512-/d9sfos4yxzpwkDkuN7k2SqFKtYNmCTzgfEpz82x34IM9/zc8KGxQoXg1liNC/izpRM/MBdt44Nmx41ZWqk+FQ==",
      "license": "MIT"
    },
    "node_modules/require-asset": {
      "version": "1.2.2",
      "resolved": "https://registry.npmjs.org/require-asset/-/require-asset-1.2.2.tgz",
      "integrity": "sha512-uc8nWKhqAxVD9Z4rST2b4yaemrC9Xb5vA1wlCz5AiCYnBYdwGRWNqFjneA5zRILzlo1MNrB63ry9+pc8wNR26w==",
      "license": "Apache-2.0",
      "optional": true,
      "dependencies": {
        "bare-module-resolve": "^1.6.2"
      },
      "engines": {
        "bare": ">=1.10.0",
        "node": ">=18"
      }
    },
    "node_modules/streamx": {
      "version": "2.28.1",
      "resolved": "https://registry.npmjs.org/streamx/-/streamx-2.28.1.tgz",
      "integrity": "sha512-zEzXb0s5Cds7tqMH6rhZ05lcJydCWiQPEwiNngVqzsxCc962vLY4Uw+mW7od8kDH258k2Uz/JrOkdIAAhSh9VA==",
      "license": "MIT",
      "dependencies": {
        "events-universal": "^1.0.0",
        "fast-fifo": "^1.3.2",
        "text-decoder": "^1.1.0"
      }
    },
    "node_modules/teex": {
      "version": "1.0.1",
      "resolved": "https://registry.npmjs.org/teex/-/teex-1.0.1.tgz",
      "integrity": "sha512-eYE6iEI62Ni1H8oIa7KlDU6uQBtqr4Eajni3wX7rpfXD8ysFx8z0+dri+KWEPWpBsxXfxu58x/0jvTVT1ekOSg==",
      "license": "MIT",
      "dependencies": {
        "streamx": "^2.12.5"
      }
    },
    "node_modules/text-decoder": {
      "version": "1.2.7",
      "resolved": "https://registry.npmjs.org/text-decoder/-/text-decoder-1.2.7.tgz",
      "integrity": "sha512-vlLytXkeP4xvEq2otHeJfSQIRyWxo/oZGEbXrtEEF9Hnmrdly59sUbzZ/QgyWuLYHctCHxFF4tRQZNQ9k60ExQ==",
      "license": "Apache-2.0",
      "dependencies": {
        "b4a": "^1.6.4"
      }
    }
  }
}
package.json
{
  "name": "sample-bare-runtime",
  "version": "1.0.0",
  "type": "module",
  "private": true,
  "dependencies": {
    "bare-runtime": "1.31.0"
  }
}
spec.json
{
  "schemaVersion": 1,
  "goal": "locate Bare binary prebuild path and spawn child process to execute JavaScript code",
  "kind": "HOW",
  "packages": [
    "pkg:npm/bare-runtime@1.31.0"
  ],
  "symbols": [
    "runtime",
    "spawn"
  ]
}
test/contract.mjs
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);

const runtime = require('bare-runtime');
const spawn = require('bare-runtime/spawn');
const pkg = require('bare-runtime/package');

// 1. Verify package manifest exports and metadata
assert.equal(pkg.name, 'bare-runtime', 'Package name must be bare-runtime');
assert.equal(pkg.version, '1.31.0', 'Package version must be 1.31.0');
assert.equal(pkg.exports['.'], './index.js', 'Root export must point to index.js');
assert.equal(pkg.exports['./spawn'], './lib/spawn.js', 'Spawn export must point to lib/spawn.js');
assert.equal(pkg.exports['./package'], './package.json', 'Package export must point to package.json');
assert.equal(pkg.bin.bare, 'bin/bare', 'CLI bin must point to bin/bare');

// 2. runtime resolves prebuilt Bare binary path for current platform and arch
const binPath = runtime();
assert.equal(typeof binPath, 'string', 'Binary path must be a string');
assert.ok(binPath.endsWith(path.join('bin', 'bare')) || binPath.endsWith('bare.exe'), 'Binary path must point to bare binary');
assert.ok(fs.existsSync(binPath), 'Prebuilt binary executable file must exist on disk');

// 3. runtime throws error when target platform has no prebuilt binary
assert.throws(() => {
  runtime({ platform: 'nonexistent_platform', arch: 'unknown_arch' });
}, {
  message: /No binaries found for target 'nonexistent_platform-unknown_arch'/
}, 'Unsupported target platform/arch must throw error');

// 4. runtime throws error when specified referrer binary is missing
assert.throws(() => {
  runtime('nonexistent_referrer_module');
}, {
  message: /No binary found for target/
}, 'Missing referrer binary must throw error');

// 5. spawn sets executable permissions and spawns ChildProcess
const proc = spawn({ args: ['-v'] });
assert.ok(proc && typeof proc.on === 'function', 'spawn must return a ChildProcess instance');
assert.ok(proc.stdin && proc.stdout && proc.stderr, 'ChildProcess must have stdio streams');

let errored = false;
await new Promise((resolve) => {
  proc.on('error', (err) => {
    errored = true;
    // In environments lacking the host glibc dynamic linker (such as musl/Alpine test containers),
    // spawning a glibc-linked ELF binary correctly emits ENOENT
    assert.ok(err.code === 'ENOENT' || err.code === 'EACCES', `Expected ENOENT or EACCES, got ${err.code}`);
    resolve();
  });
  proc.on('close', (code) => {
    if (!errored) {
      assert.strictEqual(code, 0, 'On supported execution environments, bare -v exits with 0');
    }
    resolve();
  });
});

// 6. Verify CLI launcher script in bin/bare
const pkgDir = path.dirname(require.resolve('bare-runtime/package'));
const binBarePath = path.join(pkgDir, 'bin', 'bare');
assert.ok(fs.existsSync(binBarePath), 'bin/bare launcher must exist');
const binBareContent = fs.readFileSync(binBarePath, 'utf8');
assert.ok(binBareContent.includes("require('../lib/spawn')"), 'bin/bare must invoke lib/spawn');

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

Seeder de origen

anónimo