CodeSampleX

샘플

@esbuild/openharmony-arm64 0.28.2

검증된 샘플 — npm @esbuild/openharmony-arm64 0.28.2. node 22 · linux alpine/x64 · docker에서 contract를 실행해 통과했습니다: package manifest specifies…

sha256:7ab3cc6fa079ae0084014881445eafa52fbd982c8a779b91d32356bd496d68f3

이 네트워크가 제공하는 것은 하나입니다. 빌드되는 샘플. 샌드박스에서 돌리고 서명된 영수증을 보관합니다. 등급을 매기지 않고 무엇도 보증하지 않습니다 — 같은 코드가 당신 환경에서 빌드되는지는 측정한 적이 없습니다. 통과한 계약 영수증을 낸 서로 다른 서명 키의 수입니다. 하나면 작성자 혼자이고, 둘 이상이면 다른 사람도 빌드했다는 뜻입니다. 키는 스스로 만드는 것이고 뒤에 등록된 신원이 없으므로, 세는 것은 사람이 아니라 키입니다. MIT-0

실행 증거

선언된 환경과 서명된 실행을 분리해 두었습니다. 이 샘플이 무엇을 어디서 실행했는지 그대로 볼 수 있습니다.

증거 기준
서명된 컨트랙트 통과
검증 영수증
1
빌드한 서명 키
1
선언된 환경 node 22.23 linux 24 · ubuntu · glibc 2.39 x64 node 22.23 javascript npm 10

검증 실행 환경

환경 컨트랙트 단계 실행일
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-28

케이스

HOW
목표
verify pkg:npm/%40esbuild/openharmony-arm64@0.28.2
패키지
환경
node 22.23.2
생성일
2026-08-28T04:48:35Z

컨트랙트

  1. package manifest specifies @esbuild/openharmony-arm64 name, version 0.28.2, openharmony OS, and arm64 CPU requirements
  2. locates WebAssembly binary esbuild.wasm and validates binary magic header bytes
  3. esbuild WebAssembly CLI reports matching package version 0.28.2
  4. esbuild transforms TypeScript code to JavaScript with minification
  5. esbuild transforms JSX syntax into standard JavaScript

파일

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

소스 아티팩트 내려받기 (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/%40esbuild/openharmony-arm64@0.28.2
Kind: HOW

Use EXACTLY these public packages and versions:
  - pkg:npm/%40esbuild/openharmony-arm64@0.28.2
Constraints:
  - executionContext: node
Required runtime conditions:
  - ecosystem: npm
  - language: javascript
  - moduleSystem: cjs
  - packageManager: npm@10.9.8
  - 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:b8b12f5280bc5fbe90718f9337cac3015c94811dd874c6a7bf6a54097a4f5a14","constraints":{"executionContext":"node"},"contract":["package manifest specifies @esbuild/openharmony-arm64 name, version 0.28.2, openharmony OS, and arm64 CPU requirements","locates WebAssembly binary esbuild.wasm and validates binary magic header bytes","esbuild WebAssembly CLI reports matching package version 0.28.2","esbuild transforms TypeScript code to JavaScript with minification","esbuild transforms JSX syntax into standard JavaScript"],"goal":"verify pkg:npm/%40esbuild/openharmony-arm64@0.28.2","kind":"HOW","packages":["pkg:npm/%40esbuild/openharmony-arm64@0.28.2"],"schemaVersion":1},"contractCommand":["node","test/contract.mjs"],"environment":{"arch":"x64","distro":"ubuntu","ecosystem":"npm","executionContext":"node","language":"javascript","libc":"glibc","libcVersion":"2.39","moduleSystem":"esm","os":"linux","osVersionBucket":"24","packageManager":"npm","packageManagerVersion":"10.9.8","runtime":"node","runtimeVersion":"22.23.2","schemaVersion":1},"license":"MIT-0","packages":["pkg:npm/%40esbuild/openharmony-arm64@0.28.2"],"schemaVersion":1,"subject":"pkg:npm/%40esbuild/openharmony-arm64@0.28.2","verifierAdapter":"node-typescript@1"}
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",
      "dependencies": {
        "@esbuild/openharmony-arm64": "0.28.2"
      }
    },
    "node_modules/@esbuild/openharmony-arm64": {
      "version": "0.28.2",
      "resolved": "https://registry.npmjs.org/@esbuild/openharmony-arm64/-/openharmony-arm64-0.28.2.tgz",
      "integrity": "sha512-WkhYDmpTjLvGlScA1rwjRUmhl4k8oXR3cIbtqWmELgU/dFeHHlEllxDvdWcNJV9rbzCexB5vz8gtNewWLgCT7Q==",
      "cpu": [
        "arm64"
      ],
      "license": "MIT",
      "os": [
        "openharmony"
      ],
      "engines": {
        "node": ">=18"
      }
    }
  }
}
package.json
{
  "name": "sample-esbuild-openharmony-arm64",
  "version": "1.0.0",
  "type": "module",
  "private": true,
  "dependencies": {
    "@esbuild/openharmony-arm64": "0.28.2"
  }
}
spec.json
{
  "schemaVersion": 1,
  "goal": "verify pkg:npm/%40esbuild/openharmony-arm64@0.28.2",
  "kind": "HOW",
  "packages": [
    "pkg:npm/%40esbuild/openharmony-arm64@0.28.2"
  ],
  "constraints": {
    "executionContext": "node"
  },
  "runtimeConditions": {
    "ecosystem": "npm",
    "language": "javascript",
    "moduleSystem": "cjs",
    "packageManager": "npm@10.9.8",
    "runtime": "node@22.23.2"
  }
}
test/contract.mjs
import assert from 'node:assert';
import fs from 'node:fs';
import path from 'node:path';
import { fileURLToPath } from 'node:url';
import { execFileSync } from 'node:child_process';
import os from 'node:os';

const __dirname = path.dirname(fileURLToPath(import.meta.url));
const rootDir = path.resolve(__dirname, '..');
const pkgDir = path.join(rootDir, 'node_modules', '@esbuild', 'openharmony-arm64');

// 1. Validate package manifest
const pkgJsonPath = path.join(pkgDir, 'package.json');
assert.ok(fs.existsSync(pkgJsonPath), 'package.json must exist');
const pkgJson = JSON.parse(fs.readFileSync(pkgJsonPath, 'utf8'));
assert.strictEqual(pkgJson.name, '@esbuild/openharmony-arm64', 'Package name must match');
assert.strictEqual(pkgJson.version, '0.28.2', 'Package version must be 0.28.2');
assert.ok(Array.isArray(pkgJson.os) && pkgJson.os.includes('openharmony'), 'os must include openharmony');
assert.ok(Array.isArray(pkgJson.cpu) && pkgJson.cpu.includes('arm64'), 'cpu must include arm64');

// 2. Validate WebAssembly binary format
const wasmPath = path.join(pkgDir, 'esbuild.wasm');
assert.ok(fs.existsSync(wasmPath), 'esbuild.wasm binary must exist');
const wasmStats = fs.statSync(wasmPath);
assert.ok(wasmStats.size > 1000000, `esbuild.wasm size must be > 1MB (actual: ${wasmStats.size})`);

const wasmBuffer = Buffer.alloc(8);
const fd = fs.openSync(wasmPath, 'r');
fs.readSync(fd, wasmBuffer, 0, 8, 0);
fs.closeSync(fd);

// WebAssembly binary format starts with \0asm followed by version 0x01
const expectedMagic = Buffer.from([0x00, 0x61, 0x73, 0x6d, 0x01, 0x00, 0x00, 0x00]);
assert.deepStrictEqual(wasmBuffer, expectedMagic, 'esbuild.wasm must have valid WebAssembly magic header');

// 3. Validate CLI version report
const binPath = path.join(pkgDir, 'bin', 'esbuild');
assert.ok(fs.existsSync(binPath), 'bin/esbuild must exist');

const versionOutput = execFileSync(process.execPath, [binPath, '--version'], {
  encoding: 'utf8',
  timeout: 10000,
}).trim();
assert.strictEqual(versionOutput, '0.28.2', 'esbuild CLI version output must match package version 0.28.2');

// 4. Validate TypeScript transformation with minification
const tempDir = fs.mkdtempSync(path.join(os.tmpdir(), 'esbuild-contract-'));
try {
  const tsInputFile = path.join(tempDir, 'input.ts');
  const tsOutputFile = path.join(tempDir, 'output.js');
  fs.writeFileSync(tsInputFile, 'const multiply = (x: number, y: number): number => x * y;\nconsole.log(multiply(6, 7));\n');

  execFileSync(process.execPath, [
    binPath,
    tsInputFile,
    '--minify',
    `--outfile=${tsOutputFile}`,
  ], {
    timeout: 15000,
  });

  assert.ok(fs.existsSync(tsOutputFile), 'TypeScript output file must exist');
  const tsResult = fs.readFileSync(tsOutputFile, 'utf8');
  assert.ok(!tsResult.includes(': number'), 'TypeScript type annotations must be stripped');
  assert.ok(tsResult.includes('multiply'), 'Minified output must include the function symbol');
  assert.ok(tsResult.includes('console.log('), 'Minified output must include invocation');

  // 5. Validate JSX transformation
  const jsxInputFile = path.join(tempDir, 'input.jsx');
  const jsxOutputFile = path.join(tempDir, 'jsx-output.js');
  fs.writeFileSync(jsxInputFile, 'const App = () => <div className="test">Hello OpenHarmony</div>;\n');

  execFileSync(process.execPath, [
    binPath,
    jsxInputFile,
    '--jsx=transform',
    `--outfile=${jsxOutputFile}`,
  ], {
    timeout: 15000,
  });

  assert.ok(fs.existsSync(jsxOutputFile), 'JSX output file must exist');
  const jsxResult = fs.readFileSync(jsxOutputFile, 'utf8');
  assert.ok(jsxResult.includes('React.createElement("div"'), `JSX output should transform JSX tags to React.createElement: ${jsxResult}`);
  assert.ok(jsxResult.includes('Hello OpenHarmony'), `JSX output should retain content: ${jsxResult}`);
} finally {
  fs.rmSync(tempDir, { recursive: true, force: true });
}

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

오리진 시더

익명