サンプル
es-module-lexer 2.3.1: initSync
検証済みサンプル — npm es-module-lexer 2.3.1: initSync. node 22 · linux debian/x64 · docker で contract を実行し、成功しました: initSync is exported as a function from…
sha256:72ee15e16c1fabaf3e9f9ff60f243f039de0b6ebc82b513a19e49e51fd723f43
このネットワークが提供するのは一つだけです。ビルドされるサンプル。サンドボックスで実行し、署名済みの受領証を保管します。等級はつけず、何も保証しません — 同じコードがあなたの環境でビルドされるかは測定していません。
合格した契約受領証を提出した異なる署名鍵の数です。1 なら作者だけ、2 以上なら他の誰かもビルドしています。鍵は自己生成で背後に登録された身元がないため、数えているのは人ではなく鍵です。
MIT-0
実行証拠
宣言された環境と署名済みの実行を分けてあります。このサンプルが何をどこで実行したかをそのまま確認できます。
- 証拠の基準
- 署名済みコントラクト合格
- 検証レシート
- 1
- ビルドした署名鍵
- 1
宣言された環境
node 22.23 linux 24 · ubuntu · glibc 2.39 x64 node 22.23 javascript npm 10
検証実行環境
| 環境 | コントラクト | ステージ | 実行日 |
|---|---|---|---|
| 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-06 |
ケース
HOW- ゴール
- verify es-module-lexer.initSync in pkg:npm/es-module-lexer@2.3.1
- パッケージ
- シンボル
-
- es-module-lexer.initSync
- 環境
- node 22.23.2
- 作成日
- 2026-09-06T13:27:25Z
コントラクト
- initSync is exported as a function from es-module-lexer
- initSync() executes synchronously and initializes the WebAssembly lexer
- parseModuleSync parses static imports, exports, and syntax metadata synchronously without awaiting init
ファイル
- PROMPT.md
- csx.json
- package-lock.json
- package.json
- spec.json
- src/index.js
- test/contract.mjs
ソース
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 es-module-lexer.initSync in pkg:npm/es-module-lexer@2.3.1
Kind: HOW
Use EXACTLY these public packages and versions:
- pkg:npm/es-module-lexer@2.3.1
Demonstrate these symbols/APIs:
- es-module-lexer.initSync
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:66eb1024a2afc29c3f47e92fa00b4afc0ed156cedeadf7ca0ce25a01382db87a","contract":["initSync is exported as a function from es-module-lexer","initSync() executes synchronously and initializes the WebAssembly lexer","parseModuleSync parses static imports, exports, and syntax metadata synchronously without awaiting init"],"goal":"verify es-module-lexer.initSync in pkg:npm/es-module-lexer@2.3.1","kind":"HOW","packages":["pkg:npm/es-module-lexer@2.3.1"],"schemaVersion":1,"symbols":["es-module-lexer.initSync"]},"contractCommand":["node","test/contract.mjs"],"environment":{"arch":"x64","distro":"ubuntu","ecosystem":"npm","executionContext":"node","language":"javascript","libc":"glibc","libcVersion":"2.39","moduleSystem":"cjs","os":"linux","osVersionBucket":"24","packageManager":"npm","packageManagerVersion":"10.9.8","runtime":"node","runtimeVersion":"22.23.2","schemaVersion":1},"license":"MIT-0","packages":["pkg:npm/es-module-lexer@2.3.1"],"schemaVersion":1,"subject":"pkg:npm/es-module-lexer@2.3.1","symbols":["es-module-lexer.initSync"],"verifierAdapter":"node-typescript@1"}
{
"name": "sample-es-module-lexer-init-sync",
"version": "1.0.0",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "sample-es-module-lexer-init-sync",
"version": "1.0.0",
"license": "MIT-0",
"dependencies": {
"es-module-lexer": "2.3.1"
}
},
"node_modules/es-module-lexer": {
"version": "2.3.1",
"resolved": "https://registry.npmjs.org/es-module-lexer/-/es-module-lexer-2.3.1.tgz",
"integrity": "sha512-shc1dbU90Yl/xq1QrC7QRtfcwURZuVRfPhZbDoldJ1cn1gzDvBaBWlv0eFolj5+0znnPJz5TXLxsN77X/12KTA==",
"license": "MIT"
}
}
}
{
"name": "sample-es-module-lexer-init-sync",
"version": "1.0.0",
"private": true,
"description": "verify es-module-lexer.initSync in pkg:npm/es-module-lexer@2.3.1",
"main": "src/index.js",
"license": "MIT-0",
"dependencies": {
"es-module-lexer": "2.3.1"
}
}
{
"schemaVersion": 1,
"goal": "verify es-module-lexer.initSync in pkg:npm/es-module-lexer@2.3.1",
"kind": "HOW",
"packages": [
"pkg:npm/es-module-lexer@2.3.1"
],
"symbols": [
"es-module-lexer.initSync"
]
}
const { initSync, parse } = require('es-module-lexer');
/**
* Synchronously initializes the es-module-lexer WebAssembly module.
*/
function initializeLexerSync() {
initSync();
}
/**
* Synchronously parses ES module source code using initSync.
* @param {string} source - JavaScript / ES module source code.
* @returns {[readonly any[], readonly any[], boolean, boolean]} Parse results [imports, exports, facade, hasModuleSyntax].
*/
function parseModuleSync(source) {
initSync();
return parse(source);
}
module.exports = {
initSync,
initializeLexerSync,
parseModuleSync
};
import assert from 'node:assert/strict';
import { createRequire } from 'node:module';
const require = createRequire(import.meta.url);
const { initSync, initializeLexerSync, parseModuleSync } = require('../src/index.js');
const esModuleLexer = require('es-module-lexer');
// 1. Verify initSync is exported as a function from es-module-lexer
assert.equal(typeof initSync, 'function', 'initSync must be a function');
assert.strictEqual(initSync, esModuleLexer.initSync, 'initSync must match es-module-lexer.initSync export');
// 2. Verify initSync() executes synchronously and initializes the WebAssembly lexer
assert.doesNotThrow(() => {
initializeLexerSync();
}, 'initializeLexerSync must execute synchronously without errors');
// 3. Verify parseModuleSync parses static imports, exports, and syntax metadata synchronously without awaiting init
const sampleCode = `
import { helper } from 'utils';
export const value = 123;
`;
const [imports, exports, facade, hasModuleSyntax] = parseModuleSync(sampleCode);
assert.strictEqual(imports.length, 1, 'should identify 1 import');
assert.strictEqual(imports[0].n, 'utils', 'import specifier should match');
assert.strictEqual(exports.length, 1, 'should identify 1 export');
assert.strictEqual(exports[0].n, 'value', 'export specifier should match');
assert.strictEqual(facade, false, 'facade should be false');
assert.strictEqual(hasModuleSyntax, true, 'hasModuleSyntax should be true');
console.log('Contract assertions passed.');
オリジンシーダー
匿名