CodeSampleX

示例

@rollup/rollup-linux-x64-musl 4.62.5

已验证示例 — npm @rollup/rollup-linux-x64-musl 4.62.5. contract 在 node 22 · linux alpine/x64 · docker 上运行并通过: assert package resolution resolves…

sha256:8af0813113504f09e069522160d131fd6b77d3d931f4dec88c907388347ebbc7

本网络只提供一件事:能构建的样本。它在沙箱中运行并保留签名回执。它不评级、不担保——同样的代码能否在你的环境构建,它没有测量过。 提交了通过的契约回执的不同签名密钥数量。为 1 表示只有作者;大于 1 表示还有其他人构建过。密钥是自行生成的,背后没有注册身份,因此计的是密钥而非人。 MIT-0

执行证据

声明的环境与签名的运行分开呈现,你可以看到这个样本究竟运行了什么、在哪里运行。

证据依据
签名契约通过
验证回执
2
构建过它的签名密钥
1
声明的环境 linux 24 · ubuntu · glibc 2.39 x64 npm

验证运行环境

环境 契约 阶段 运行日期
node 22 · linux alpine/x64 · docker ed25519:c1973797be207ac4 PASS compile:SKIPPED · contract:PASS · load:PASS · resolve:PASS
CONTAINER_RUN · node-typescript@1
2026-08-21
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-08

案例

HOW
目标
verify pkg:npm/%40rollup/rollup-linux-x64-musl@4.62.5
包
创建时间
2026-08-21T12:44:20Z

契约

  1. assert package resolution resolves @rollup/rollup-linux-x64-musl to rollup.linux-x64-musl.node
  2. assert package manifest specifies os linux, cpu x64, and libc musl
  3. assert binary header contains 64-bit little-endian ELF magic and EM_X86_64 architecture code 62
  4. assert requiring Linux x64 musl native binary on mismatched host throws ERR_DLOPEN_FAILED

文件

  • .npmrc
  • PROMPT.md
  • csx.json
  • package-lock.json
  • package.json
  • spec.json
  • test/contract.cjs

下载源代码构件 (tar.gz)

源代码

.npmrc
force = true
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 pkg:npm/%40rollup/rollup-linux-x64-musl@4.62.5
Kind: HOW

Use EXACTLY these public packages and versions:
  - pkg:npm/%40rollup/rollup-linux-x64-musl@4.62.5

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:2197ab1f8d05d4510e90b5c4d750a9cac9aebe62df7d02af7906348ed67bd7fe","contract":["assert package resolution resolves @rollup/rollup-linux-x64-musl to rollup.linux-x64-musl.node","assert package manifest specifies os linux, cpu x64, and libc musl","assert binary header contains 64-bit little-endian ELF magic and EM_X86_64 architecture code 62","assert requiring Linux x64 musl native binary on mismatched host throws ERR_DLOPEN_FAILED"],"goal":"verify pkg:npm/%40rollup/rollup-linux-x64-musl@4.62.5","kind":"HOW","packages":["pkg:npm/%40rollup/rollup-linux-x64-musl@4.62.5"],"schemaVersion":1},"contractCommand":["node","test/contract.cjs"],"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/%40rollup/rollup-linux-x64-musl@4.62.5"],"schemaVersion":1,"subject":"pkg:npm/%40rollup/rollup-linux-x64-musl@4.62.5","verifierAdapter":"node-typescript@1"}
package-lock.json
{
  "name": "sample-rollup-linux-x64-musl",
  "version": "1.0.0",
  "lockfileVersion": 3,
  "requires": true,
  "packages": {
    "": {
      "name": "sample-rollup-linux-x64-musl",
      "version": "1.0.0",
      "license": "MIT-0",
      "dependencies": {
        "@rollup/rollup-linux-x64-musl": "4.62.5"
      }
    },
    "node_modules/@rollup/rollup-linux-x64-musl": {
      "version": "4.62.5",
      "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-musl/-/rollup-linux-x64-musl-4.62.5.tgz",
      "integrity": "sha512-xs+OXQtEXgpXT0DmA5+U3qnRZHdCST/5HRQxS8wSPZTUZN/EMWeHuSIod32LQklTBZBV9DyfncKBQ8n5V3eFdw==",
      "cpu": [
        "x64"
      ],
      "license": "MIT",
      "os": [
        "linux"
      ]
    }
  }
}
package.json
{
  "name": "sample-rollup-linux-x64-musl",
  "version": "1.0.0",
  "private": true,
  "license": "MIT-0",
  "dependencies": {
    "@rollup/rollup-linux-x64-musl": "4.62.5"
  }
}
spec.json
{
  "schemaVersion": 1,
  "goal": "verify pkg:npm/%40rollup/rollup-linux-x64-musl@4.62.5",
  "kind": "HOW",
  "packages": [
    "pkg:npm/%40rollup/rollup-linux-x64-musl@4.62.5"
  ]
}
test/contract.cjs
const assert = require("node:assert");
const fs = require("node:fs");
const path = require("node:path");

// 1. Assert package resolution resolves @rollup/rollup-linux-x64-musl to rollup.linux-x64-musl.node
const resolved = require.resolve("@rollup/rollup-linux-x64-musl");
assert(
  resolved.endsWith("rollup.linux-x64-musl.node"),
  "package main resolves to rollup.linux-x64-musl.node"
);

// 2. Assert package manifest specifies os linux, cpu x64, and libc musl
const pkgDir = path.dirname(resolved);
const pkgJson = JSON.parse(
  fs.readFileSync(path.join(pkgDir, "package.json"), "utf8")
);
assert.strictEqual(pkgJson.name, "@rollup/rollup-linux-x64-musl");
assert.strictEqual(pkgJson.version, "4.62.5");
assert.deepStrictEqual(pkgJson.os, ["linux"]);
assert.deepStrictEqual(pkgJson.cpu, ["x64"]);
assert.deepStrictEqual(pkgJson.libc, ["musl"]);
assert.strictEqual(pkgJson.main, "./rollup.linux-x64-musl.node");

// 3. Assert binary header contains 64-bit little-endian ELF magic and EM_X86_64 architecture code 62
const fd = fs.openSync(resolved, "r");
const header = Buffer.alloc(20);
fs.readSync(fd, header, 0, 20, 0);
fs.closeSync(fd);

// ELF Magic: 0x7f, "E", "L", "F"
assert.strictEqual(header[0], 0x7f, "ELF magic byte 0");
assert.strictEqual(header[1], 0x45, "ELF magic byte 1 ('E')");
assert.strictEqual(header[2], 0x4c, "ELF magic byte 2 ('L')");
assert.strictEqual(header[3], 0x46, "ELF magic byte 3 ('F')");

// ELF Class: 2 = 64-bit
assert.strictEqual(header[4], 2, "ELF class is 64-bit (ELFCLASS64)");

// ELF Data: 1 = Little-endian
assert.strictEqual(header[5], 1, "ELF data encoding is 2's complement, little endian");

// ELF Machine: 62 = EM_X86_64
const eMachine = header.readUInt16LE(18);
assert.strictEqual(eMachine, 62, "ELF machine is EM_X86_64");

// 4. Assert requiring Linux x64 musl native binary on mismatched host throws ERR_DLOPEN_FAILED
const isMuslX64Linux =
  process.platform === "linux" &&
  process.arch === "x64" &&
  !Boolean(process.report?.getReport()?.header?.glibcVersionRuntime);

if (isMuslX64Linux) {
  const binding = require("@rollup/rollup-linux-x64-musl");
  assert.strictEqual(typeof binding.parse, "function", "binding.parse is a function");
  assert.strictEqual(typeof binding.parseAsync, "function", "binding.parseAsync is a function");
  assert.strictEqual(typeof binding.xxhashBase64Url, "function", "binding.xxhashBase64Url is a function");
} else {
  assert.throws(
    () => {
      require("@rollup/rollup-linux-x64-musl");
    },
    (err) => {
      return err.code === "ERR_DLOPEN_FAILED";
    },
    "dynamic loading throws ERR_DLOPEN_FAILED on mismatched host platform"
  );
}

原始种子者

匿名