Beispiel
es-module-lexer 2.3.2
Verifiziertes Beispiel für npm es-module-lexer 2.3.2. Der Vertrag lief auf node 22 · linux alpine/x64 · docker und bestand: init resolves asynchronously and…
sha256:4d653046ddd17b03eca63411b27f3e3b14c709a400f0686d183db2d6c69555e4
Dieses Netzwerk bietet eine Sache: ein Sample, das baut. Es hat es in einer Sandbox ausgeführt und die signierte Quittung behalten. Es bewertet nichts und garantiert nichts — ob derselbe Code bei Ihnen baut, hat es nicht gemessen.
Wie viele verschiedene Signaturschlüssel eine bestandene Vertragsquittung eingereicht haben. Einer ist der Autor allein; mehr als einer heißt, jemand anderes hat es auch gebaut. Ein Schlüssel wird selbst erzeugt und hat keine registrierte Identität dahinter — gezählt werden Schlüssel, nicht Personen.
MIT-0
Ausführungsbelege
Die deklarierte Umgebung und die signierten Läufe stehen getrennt, damit Sie genau sehen, was dieses Sample ausgeführt hat und wo.
- Beleggrundlage
- Signierter Vertrag bestanden
- Verifizierungsbelege
- 1
- Signaturschlüssel, die es gebaut haben
- 1
Deklarierte Umgebung
node 22.23 linux 24 · ubuntu · glibc 2.39 x64 node 22.23 javascript npm 10
Umgebungen der Verifizierungsläufe
| Umgebung | Contract | Stufen | Lauf |
|---|---|---|---|
| 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 |
Fall
HOW- Ziel
- verify pkg:npm/es-module-lexer@2.3.2
- Pakete
- Umgebung
- node 22.23.2
- Erstellt
- 2026-08-28T06:29:22Z
Contract
- init resolves asynchronously and initSync initializes the WebAssembly lexer synchronously
- parse extracts static imports, dynamic imports, import.meta expressions, and import attributes with ImportType classifications
- parse extracts export specifiers including named exports, aliased exports, and default exports with location ranges
- parse identifies facade re-export modules and distinguishes ESM syntax from plain scripts
Dateien
- PROMPT.md
- csx.json
- package-lock.json
- package.json
- spec.json
- src/index.js
- test/contract.mjs
Quelltext
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/es-module-lexer@2.3.2
Kind: HOW
Use EXACTLY these public packages and versions:
- pkg:npm/es-module-lexer@2.3.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.
{"case":{"caseId":"case:sha256:32f8d9095d4e953a3e7a467bcf838e9aab88a7caf07ead2a38b1172425cae9c9","constraints":{"executionContext":"node"},"contract":["init resolves asynchronously and initSync initializes the WebAssembly lexer synchronously","parse extracts static imports, dynamic imports, import.meta expressions, and import attributes with ImportType classifications","parse extracts export specifiers including named exports, aliased exports, and default exports with location ranges","parse identifies facade re-export modules and distinguishes ESM syntax from plain scripts"],"goal":"verify pkg:npm/es-module-lexer@2.3.2","kind":"HOW","packages":["pkg:npm/es-module-lexer@2.3.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":"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.2"],"schemaVersion":1,"subject":"pkg:npm/es-module-lexer@2.3.2","verifierAdapter":"node-typescript@1"}
{
"name": "sample-es-module-lexer-verify",
"version": "1.0.0",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "sample-es-module-lexer-verify",
"version": "1.0.0",
"license": "MIT-0",
"dependencies": {
"es-module-lexer": "2.3.2"
}
},
"node_modules/es-module-lexer": {
"version": "2.3.2",
"resolved": "https://registry.npmjs.org/es-module-lexer/-/es-module-lexer-2.3.2.tgz",
"integrity": "sha512-poHGpORABojJJucnV9KbOavETW8lBVnphkW77ER5/BQ5Fz7oXSoCNek7IH3vR5nRjdsEz926ibFYX8KtLQmdyw==",
"license": "MIT"
}
}
}
{
"name": "sample-es-module-lexer-verify",
"version": "1.0.0",
"private": true,
"description": "verify pkg:npm/es-module-lexer@2.3.2",
"main": "src/index.js",
"license": "MIT-0",
"dependencies": {
"es-module-lexer": "2.3.2"
}
}
{
"schemaVersion": 1,
"goal": "verify pkg:npm/es-module-lexer@2.3.2",
"kind": "HOW",
"packages": [
"pkg:npm/es-module-lexer@2.3.2"
],
"constraints": {
"executionContext": "node"
},
"runtimeConditions": {
"ecosystem": "npm",
"language": "javascript",
"moduleSystem": "cjs",
"packageManager": "npm@10.9.8",
"runtime": "node@22.23.2"
}
}
const { init, initSync, parse, ImportType } = require('es-module-lexer');
/**
* Initializes the WebAssembly lexer and parses ES module source code asynchronously.
*
* @param {string} source - JavaScript / ES module source code.
* @param {string} [name] - Optional file name/identifier for error reporting.
* @returns {Promise<readonly [readonly any[], readonly any[], boolean, boolean]>}
*/
async function parseModule(source, name) {
await init;
return parse(source, name);
}
/**
* Parses ES module source code synchronously after calling initSync.
*
* @param {string} source - JavaScript / ES module source code.
* @param {string} [name] - Optional file name/identifier for error reporting.
* @returns {readonly [readonly any[], readonly any[], boolean, boolean]}
*/
function parseModuleSync(source, name) {
initSync();
return parse(source, name);
}
module.exports = {
init,
initSync,
parse,
ImportType,
parseModule,
parseModuleSync
};
import assert from 'node:assert/strict';
import { createRequire } from 'node:module';
const require = createRequire(import.meta.url);
const {
init,
initSync,
parse,
ImportType,
parseModule,
parseModuleSync
} = require('../src/index.js');
const esModuleLexer = require('es-module-lexer');
// 1. init resolves asynchronously and initSync initializes the WebAssembly lexer synchronously
assert.strictEqual(typeof parse, 'function', 'parse must be a function');
assert.strictEqual(typeof initSync, 'function', 'initSync must be a function');
assert.ok(init && typeof init.then === 'function', 'init must be a Promise');
assert.strictEqual(typeof ImportType, 'object', 'ImportType must be exported as an enum object');
// Test async initialization and parseModule
await init;
const asyncResult = await parseModule('export const a = 1;');
assert.strictEqual(asyncResult[1].length, 1, 'must find 1 export via parseModule');
// Test sync initialization and parseModuleSync
const syncResult = parseModuleSync('export const b = 2;');
assert.strictEqual(syncResult[1].length, 1, 'must find 1 export via parseModuleSync');
// 2. parse extracts static imports, dynamic imports, import.meta expressions, and import attributes with ImportType classifications
const importCode = `
import defaultItem, { namedItem as renamed } from 'my-pkg';
import config from 'config.json' with { type: 'json' };
const dynamicDep = import('dyn-pkg');
const fileUrl = import.meta.url;
`;
const [imports, , , hasSyntaxImports] = parseModuleSync(importCode);
assert.strictEqual(hasSyntaxImports, true, 'import statements indicate module syntax');
assert.strictEqual(imports.length, 4, 'must detect 4 import expressions');
// Static import
assert.strictEqual(imports[0].n, 'my-pkg');
assert.strictEqual(imports[0].t, ImportType.Static);
assert.strictEqual(imports[0].d, -1);
assert.strictEqual(imports[0].at, null);
assert.strictEqual(importCode.slice(imports[0].s, imports[0].e), 'my-pkg');
// Import with attributes (with { type: 'json' })
assert.strictEqual(imports[1].n, 'config.json');
assert.strictEqual(imports[1].t, ImportType.Static);
assert.strictEqual(imports[1].d, -1);
assert.ok(imports[1].a > 0, 'attribute start position should be positive');
assert.deepStrictEqual(imports[1].at, [['type', 'json']]);
// Dynamic import
assert.strictEqual(imports[2].n, 'dyn-pkg');
assert.strictEqual(imports[2].t, ImportType.Dynamic);
assert.ok(imports[2].d >= 0, 'dynamic import index must be non-negative');
// import.meta
assert.strictEqual(imports[3].n, undefined);
assert.strictEqual(imports[3].t, ImportType.ImportMeta);
assert.strictEqual(imports[3].d, -2, 'import.meta expression index is -2');
// 3. parse extracts export specifiers including named exports, aliased exports, and default exports with location ranges
const exportCode = `
export const answer = 42;
const localVal = 'hello';
export { localVal as publicVal };
export default function defaultFn() {}
`;
const [, exports, isFacadeExports, hasSyntaxExports] = parseModuleSync(exportCode);
assert.strictEqual(isFacadeExports, false);
assert.strictEqual(hasSyntaxExports, true);
assert.strictEqual(exports.length, 3, 'must detect 3 exports');
// Named export
assert.strictEqual(exports[0].n, 'answer');
assert.strictEqual(exports[0].ln, 'answer');
assert.strictEqual(exportCode.slice(exports[0].s, exports[0].e), 'answer');
// Aliased export
assert.strictEqual(exports[1].n, 'publicVal');
assert.strictEqual(exports[1].ln, 'localVal');
assert.strictEqual(exportCode.slice(exports[1].s, exports[1].e), 'publicVal');
assert.strictEqual(exportCode.slice(exports[1].ls, exports[1].le), 'localVal');
// Default export
assert.strictEqual(exports[2].n, 'default');
assert.strictEqual(exports[2].ln, 'defaultFn');
// 4. parse identifies facade re-export modules and distinguishes ESM syntax from plain scripts
const facadeCode = `export * from 'other-lib';`;
const [facadeImports, facadeExportsList, isFacade, hasSyntaxFacade] = parseModuleSync(facadeCode);
assert.strictEqual(facadeImports.length, 1);
assert.strictEqual(facadeImports[0].n, 'other-lib');
assert.strictEqual(isFacade, true, 'pure export * is a facade module');
assert.strictEqual(hasSyntaxFacade, true);
const plainScript = `const x = 10; const y = 20; console.log(x + y);`;
const [scriptImports, scriptExports, isFacadeScript, hasSyntaxScript] = parseModuleSync(plainScript);
assert.strictEqual(scriptImports.length, 0);
assert.strictEqual(scriptExports.length, 0);
assert.strictEqual(isFacadeScript, false);
assert.strictEqual(hasSyntaxScript, false, 'plain script has no module syntax');
console.log('All es-module-lexer contract assertions passed.');
Ursprungs-Seeder
anonym