Sample
es-module-lexer 2.3.1: ImportType
Verified sample for npm es-module-lexer 2.3.1: ImportType. The contract ran on node 22 · linux debian/x64 · docker and passed.
sha256:c6911b683cfb17ab80feab38e46f5ef5e6b855b681b83825d49833fb1fdc2404
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 10
Verification-run environments
| Environment | Contract | Stages | Run |
|---|---|---|---|
| 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 |
Case
HOW- Goal
- verify es-module-lexer.ImportType in pkg:npm/es-module-lexer@2.3.1
- Packages
- Symbols
-
- es-module-lexer.ImportType
- Environment
- node 22.23.2
- Created
- 2026-09-06T12:58:54Z
Contract
- ImportType enum defines numeric discriminant values for Static (1), Dynamic (2), and ImportMeta (3)
- ImportType enum defines phase imports for StaticSourcePhase (4), DynamicSourcePhase (5), StaticDeferPhase (6), and DynamicDeferPhase (7)
- parse assigns ImportType.Static to static imports, ImportType.Dynamic to dynamic imports, and ImportType.ImportMeta to import.meta expressions
- parse classifies source phase and defer phase imports with corresponding ImportType values
Files
- PROMPT.md
- csx.json
- package-lock.json
- package.json
- spec.json
- src/index.js
- test/contract.mjs
Source
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.ImportType 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.ImportType
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:137e81417c75d54b7bfc05c575ff6123cffa2c22c110d0723510f41a91bc6fa8","contract":["ImportType enum defines numeric discriminant values for Static (1), Dynamic (2), and ImportMeta (3)","ImportType enum defines phase imports for StaticSourcePhase (4), DynamicSourcePhase (5), StaticDeferPhase (6), and DynamicDeferPhase (7)","parse assigns ImportType.Static to static imports, ImportType.Dynamic to dynamic imports, and ImportType.ImportMeta to import.meta expressions","parse classifies source phase and defer phase imports with corresponding ImportType values"],"goal":"verify es-module-lexer.ImportType 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.ImportType"]},"contractCommand":["node","test/contract.mjs"],"environment":{"arch":"x64","distro":"ubuntu","ecosystem":"npm","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.ImportType"],"verifierAdapter":"node-typescript@1"}
{
"name": "sample-es-module-lexer",
"version": "1.0.0",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "sample-es-module-lexer",
"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",
"version": "1.0.0",
"private": true,
"description": "verify es-module-lexer.ImportType 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.ImportType in pkg:npm/es-module-lexer@2.3.1",
"kind": "HOW",
"packages": [
"pkg:npm/es-module-lexer@2.3.1"
],
"symbols": [
"es-module-lexer.ImportType"
]
}
const { init, parse, ImportType } = require('es-module-lexer');
/**
* Initializes the lexer and parses ES module source code,
* returning the imports, exports, facade flag, and syntax flag.
* @param {string} source - JavaScript/ESM source code to parse.
* @param {string} [name] - Optional filename for error reporting.
* @returns {Promise<[readonly any[], readonly any[], boolean, boolean]>}
*/
async function parseModule(source, name) {
await init;
return parse(source, name);
}
module.exports = {
init,
parse,
ImportType,
parseModule
};
import assert from 'node:assert/strict';
import { createRequire } from 'node:module';
const require = createRequire(import.meta.url);
const { init, parse, ImportType, parseModule } = require('../src/index.js');
const esModuleLexer = require('es-module-lexer');
// 1. ImportType enum defines numeric discriminant values for Static (1), Dynamic (2), and ImportMeta (3)
assert.strictEqual(typeof ImportType, 'object', 'ImportType must be defined');
assert.strictEqual(ImportType.Static, 1, 'ImportType.Static must be 1');
assert.strictEqual(ImportType.Dynamic, 2, 'ImportType.Dynamic must be 2');
assert.strictEqual(ImportType.ImportMeta, 3, 'ImportType.ImportMeta must be 3');
assert.strictEqual(ImportType[1], 'Static', 'Reverse mapping for 1 must be Static');
assert.strictEqual(ImportType[2], 'Dynamic', 'Reverse mapping for 2 must be Dynamic');
assert.strictEqual(ImportType[3], 'ImportMeta', 'Reverse mapping for 3 must be ImportMeta');
assert.strictEqual(esModuleLexer.ImportType.Static, 1, 'matches es-module-lexer export');
// 2. ImportType enum defines phase imports for StaticSourcePhase (4), DynamicSourcePhase (5), StaticDeferPhase (6), and DynamicDeferPhase (7)
assert.strictEqual(ImportType.StaticSourcePhase, 4, 'ImportType.StaticSourcePhase must be 4');
assert.strictEqual(ImportType.DynamicSourcePhase, 5, 'ImportType.DynamicSourcePhase must be 5');
assert.strictEqual(ImportType.StaticDeferPhase, 6, 'ImportType.StaticDeferPhase must be 6');
assert.strictEqual(ImportType.DynamicDeferPhase, 7, 'ImportType.DynamicDeferPhase must be 7');
assert.strictEqual(ImportType[4], 'StaticSourcePhase');
assert.strictEqual(ImportType[5], 'DynamicSourcePhase');
assert.strictEqual(ImportType[6], 'StaticDeferPhase');
assert.strictEqual(ImportType[7], 'DynamicDeferPhase');
// 3. parse assigns ImportType.Static to static imports, ImportType.Dynamic to dynamic imports, and ImportType.ImportMeta to import.meta expressions
await init;
const standardSource = `
import defaultItem, { namedItem } from 'target-module';
const dynamicModule = import('./lazy-module.js');
const metaUrl = import.meta.url;
`;
const [standardImports] = await parseModule(standardSource);
assert.strictEqual(standardImports.length, 3, 'must detect 3 imports');
assert.strictEqual(standardImports[0].n, 'target-module');
assert.strictEqual(standardImports[0].t, ImportType.Static, 'static import t must be ImportType.Static');
assert.strictEqual(standardImports[0].d, -1);
assert.strictEqual(standardImports[1].n, './lazy-module.js');
assert.strictEqual(standardImports[1].t, ImportType.Dynamic, 'dynamic import t must be ImportType.Dynamic');
assert.ok(standardImports[1].d >= 0);
assert.strictEqual(standardImports[2].t, ImportType.ImportMeta, 'import.meta t must be ImportType.ImportMeta');
assert.strictEqual(standardImports[2].d, -2);
// 4. parse classifies source phase and defer phase imports with corresponding ImportType values
const phaseSource = `
import source sourceMod from 'source-module';
const dynamicSourceMod = import.source('dyn-source-module');
import defer * as deferMod from 'defer-module';
const dynamicDeferMod = import.defer('dyn-defer-module');
`;
const [phaseImports] = await parseModule(phaseSource);
assert.strictEqual(phaseImports.length, 4, 'must detect 4 phase imports');
assert.strictEqual(phaseImports[0].n, 'source-module');
assert.strictEqual(phaseImports[0].t, ImportType.StaticSourcePhase, 'static source import t must be ImportType.StaticSourcePhase');
assert.strictEqual(phaseImports[1].n, 'dyn-source-module');
assert.strictEqual(phaseImports[1].t, ImportType.DynamicSourcePhase, 'dynamic source import t must be ImportType.DynamicSourcePhase');
assert.strictEqual(phaseImports[2].n, 'defer-module');
assert.strictEqual(phaseImports[2].t, ImportType.StaticDeferPhase, 'static defer import t must be ImportType.StaticDeferPhase');
assert.strictEqual(phaseImports[3].n, 'dyn-defer-module');
assert.strictEqual(phaseImports[3].t, ImportType.DynamicDeferPhase, 'dynamic defer import t must be ImportType.DynamicDeferPhase');
console.log('All contract assertions passed.');
Origin Seeder
anonymous