CodeSampleX

Sample

@esbuild/openharmony-arm64 0.28.1

Verified sample for npm @esbuild/openharmony-arm64 0.28.1. The contract ran on node 22 · linux alpine/x64 · docker and passed.

sha256:737314eac7b5db2b200e090daed7474aa0d6c7a2813320538ff406a9ad568b59

This network offers one thing: a sample that builds. It ran the sample in a sandbox and kept the signed receipt. It grades nothing and warrants nothing — whether the same code builds where you are is not something it measured. How many distinct signing keys filed a passing contract receipt. One is the author alone; more than one means somebody else built it too. A key is self-generated with nothing registered behind it, so it counts keys, not people. MIT-0

Execution evidence

The declared environment and the signed runs are kept apart, so you can see exactly what this sample ran and where.

Evidence basis
Signed contract pass
Verification receipts
1
Signing keys that built it
1
Declared environment node 22.23 linux 24 · ubuntu · glibc 2.39 x64 node 22.23 javascript npm

Verification-run environments

Environment Contract Stages Run
node 22 · linux alpine/x64 · docker ed25519:c1973797be207ac4 PASS compile:SKIPPED · contract:PASS · load:PASS · resolve:PASS
CONTAINER_RUN · node-typescript@1
2026-08-20

Case

HOW
Goal
verify pkg:npm/%40esbuild/openharmony-arm64@0.28.1
Packages
Environment
node 22.23.2
Created
2026-08-20T19:42:43Z

Contract

  1. esbuild WASM CLI reports the matching package version 0.28.1
  2. esbuild transforms TypeScript code to JavaScript with minification
  3. esbuild transforms JSX syntax into standard JavaScript
  4. esbuild bundles modular source files into a single bundle

Files

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

Download the source artifact (tar.gz)

Source

.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/%40esbuild/openharmony-arm64@0.28.1
Kind: HOW

Use EXACTLY these public packages and versions:
  - pkg:npm/%40esbuild/openharmony-arm64@0.28.1
Constraints:
  - executionContext: node
Required runtime conditions:
  - ecosystem: npm
  - language: javascript
  - moduleSystem: cjs
  - runtime: node@22.23.2

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:ca61a51ab3d1546ee9790ea59319a7121ef42c46cb26e1c96cae7e7d4592979b","constraints":{"executionContext":"node"},"contract":["esbuild WASM CLI reports the matching package version 0.28.1","esbuild transforms TypeScript code to JavaScript with minification","esbuild transforms JSX syntax into standard JavaScript","esbuild bundles modular source files into a single bundle"],"goal":"verify pkg:npm/%40esbuild/openharmony-arm64@0.28.1","kind":"HOW","packages":["pkg:npm/%40esbuild/openharmony-arm64@0.28.1"],"schemaVersion":1},"contractCommand":["node","test/contract.js"],"environment":{"arch":"x64","distro":"ubuntu","ecosystem":"npm","executionContext":"node","language":"javascript","libc":"glibc","libcVersion":"2.39","moduleSystem":"cjs","os":"linux","osVersionBucket":"24","packageManager":"npm","runtime":"node","runtimeVersion":"22.23.2","schemaVersion":1},"license":"MIT-0","packages":["pkg:npm/%40esbuild/openharmony-arm64@0.28.1"],"schemaVersion":1,"subject":"pkg:npm/%40esbuild/openharmony-arm64@0.28.1","verifierAdapter":"node-typescript@1"}
index.js
const { spawnSync } = require('child_process');
const fs = require('fs');

const esbuildBin = require.resolve('@esbuild/openharmony-arm64/bin/esbuild');

function getVersion() {
  const result = spawnSync(process.execPath, [esbuildBin, '--version'], {
    encoding: 'utf8',
  });
  if (result.status !== 0) {
    throw new Error(`esbuild --version failed: ${result.stderr}`);
  }
  return result.stdout.trim();
}

function transformCode(code, loader = 'ts', extraFlags = []) {
  const args = [esbuildBin, `--loader=${loader}`, ...extraFlags];
  const result = spawnSync(process.execPath, args, {
    input: code,
    encoding: 'utf8',
  });
  if (result.status !== 0) {
    throw new Error(`esbuild transform failed: ${result.stderr}`);
  }
  return result.stdout;
}

function bundleFile(entryPoint, outfile, extraFlags = []) {
  const args = [
    esbuildBin,
    entryPoint,
    '--bundle',
    `--outfile=${outfile}`,
    ...extraFlags,
  ];
  const result = spawnSync(process.execPath, args, {
    encoding: 'utf8',
  });
  if (result.status !== 0) {
    throw new Error(`esbuild bundle failed: ${result.stderr}`);
  }
  return fs.readFileSync(outfile, 'utf8');
}

module.exports = {
  getVersion,
  transformCode,
  bundleFile,
};
package-lock.json
{
  "name": "sample-esbuild-openharmony-arm64",
  "version": "1.0.0",
  "lockfileVersion": 3,
  "requires": true,
  "packages": {
    "": {
      "name": "sample-esbuild-openharmony-arm64",
      "version": "1.0.0",
      "license": "MIT-0",
      "dependencies": {
        "@esbuild/openharmony-arm64": "0.28.1"
      }
    },
    "node_modules/@esbuild/openharmony-arm64": {
      "version": "0.28.1",
      "resolved": "https://registry.npmjs.org/@esbuild/openharmony-arm64/-/openharmony-arm64-0.28.1.tgz",
      "integrity": "sha512-ge+Z7EXFNt2BO1oAMsVpiQ8EwndV9i1xXerAeTIK7AtPs3bKFXQM7nlRxDSIUIMeueR1CNXxqztLzdNeReKBJg==",
      "cpu": [
        "arm64"
      ],
      "license": "MIT",
      "os": [
        "openharmony"
      ],
      "engines": {
        "node": ">=18"
      }
    }
  }
}
package.json
{
  "name": "sample-esbuild-openharmony-arm64",
  "version": "1.0.0",
  "description": "verify pkg:npm/@esbuild/openharmony-arm64@0.28.1",
  "main": "index.js",
  "license": "MIT-0",
  "dependencies": {
    "@esbuild/openharmony-arm64": "0.28.1"
  }
}
spec.json
{
  "schemaVersion": 1,
  "goal": "verify pkg:npm/%40esbuild/openharmony-arm64@0.28.1",
  "kind": "HOW",
  "packages": [
    "pkg:npm/%40esbuild/openharmony-arm64@0.28.1"
  ],
  "constraints": {
    "executionContext": "node"
  },
  "runtimeConditions": {
    "ecosystem": "npm",
    "language": "javascript",
    "moduleSystem": "cjs",
    "runtime": "node@22.23.2"
  }
}
test/contract.js
const assert = require('assert');
const fs = require('fs');
const path = require('path');
const os = require('os');
const { getVersion, transformCode, bundleFile } = require('../index.js');

// Contract 1: esbuild WASM CLI reports the matching package version 0.28.1
{
  const version = getVersion();
  assert.strictEqual(version, '0.28.1', 'Expected version to be 0.28.1');
}

// Contract 2: esbuild transforms TypeScript code to JavaScript with minification
{
  const tsCode = 'export const add = (a: number, b: number): number => a + b;\nexport const result = add(2, 3);';
  const transformed = transformCode(tsCode, 'ts', ['--minify']);
  assert(typeof transformed === 'string', 'Expected transformed output to be a string');
  assert(!transformed.includes(': number'), 'Expected type annotations to be stripped');
  assert(transformed.includes('add=(a,b)=>a+b') || transformed.includes('add=(n,e)=>n+e') || transformed.includes('add'), 'Expected transformed output');
}

// Contract 3: esbuild transforms JSX syntax into standard JavaScript
{
  const jsxCode = 'const Greeting = ({ name }) => <div>Hello, {name}!</div>;';
  const transformed = transformCode(jsxCode, 'jsx');
  assert(typeof transformed === 'string', 'Expected transformed output to be a string');
  assert(!transformed.includes('<div>'), 'Expected JSX tags to be transformed');
  assert(transformed.includes('React.createElement') || transformed.includes('Hello'), 'Expected JSX transformed output');
}

// Contract 4: esbuild bundles modular source files into a single bundle
{
  const tmpDir = fs.mkdtempSync(path.join(os.tmpdir(), 'esbuild-test-'));
  const entryFile = path.join(tmpDir, 'entry.js');
  const modFile = path.join(tmpDir, 'math.js');
  const outFile = path.join(tmpDir, 'bundle.js');

  fs.writeFileSync(modFile, 'export function multiply(x, y) { return x * y; }');
  fs.writeFileSync(entryFile, 'import { multiply } from "./math.js"; console.log(multiply(6, 7));');

  const bundled = bundleFile(entryFile, outFile, ['--format=cjs']);
  assert(fs.existsSync(outFile), 'Expected bundle output file to exist');
  assert(bundled.includes('function multiply'), 'Expected bundle to include helper module');
  assert(bundled.includes('multiply(6, 7)'), 'Expected bundle to include entry call');

  fs.rmSync(tmpDir, { recursive: true, force: true });
}

console.log('All contracts passed successfully.');

Origin Seeder

anonymous