···11+import {
22+ mid as midValue,
33+ fromLeaf as leafValue,
44+} from "./module_eval_reentrant_mid.mjs";
55+66+export const root = "root-ok";
77+export const fromMid = midValue;
88+export const fromLeaf = leafValue;
+14
tests/test_cjs_accessor_exports.mjs
···11+import * as ns from "./cjs_accessor_module.cjs";
22+import def from "./cjs_accessor_module.cjs";
33+44+function assert(condition, message) {
55+ if (!condition) throw new Error(message);
66+}
77+88+assert(ns.answer === 42, "namespace accessor export should resolve to 42");
99+assert(ns.getterCalls >= 1, "accessor getter should have been invoked");
1010+1111+assert(def.answer === 42, "default CJS export accessor should resolve to 42");
1212+assert(ns.default === def, "namespace.default should match default import");
1313+1414+console.log("test_cjs_accessor_exports: OK");
+19
tests/test_cjs_esbuild_named_exports.mjs
···11+import * as ns from "./cjs_esbuild_like_module.cjs";
22+import def from "./cjs_esbuild_like_module.cjs";
33+44+function assert(condition, message) {
55+ if (!condition) throw new Error(message);
66+}
77+88+assert(typeof ns.build === "function", "missing named build export");
99+assert(typeof ns.transform === "function", "missing named transform export");
1010+assert(ns.version === "0.0-test", "missing named version export");
1111+1212+const buildResult = ns.build({ minify: false });
1313+assert(buildResult && buildResult.ok === true, "named build export returned wrong value");
1414+assert(ns.transform("ab") === "AB", "named transform export returned wrong value");
1515+1616+assert(def.build === ns.build, "default and named build exports diverged");
1717+assert(ns.default === def, "namespace.default should match default import");
1818+1919+console.log("test_cjs_esbuild_named_exports: OK");
+21
tests/test_cjs_esm_circular.mjs
···11+import * as esmNs from "./cjs_esm_circular_entry.mjs";
22+import cjsDefault from "./cjs_esm_circular_bridge.cjs";
33+import * as cjsNs from "./cjs_esm_circular_bridge.cjs";
44+55+function assert(condition, message) {
66+ if (!condition) throw new Error(message);
77+}
88+99+assert(esmNs.esmValue === "esm-value", "esm circular export mismatch");
1010+assert(esmNs.fromCjs === "cjs-value", "esm should read cjs export in circular edge");
1111+1212+assert(cjsDefault.cjsValue === "cjs-value", "cjs default export mismatch");
1313+assert(cjsDefault.esmValueSeen === "esm-value", "cjs getter should see resolved esm export");
1414+1515+assert(cjsNs.default === cjsDefault, "namespace.default should match cjs default import");
1616+assert(
1717+ cjsNs.esmValueSeen === "esm-value" || cjsNs.esmValueSeen === undefined,
1818+ "cjs named accessor export should be stable under circular loading"
1919+);
2020+2121+console.log("test_cjs_esm_circular: OK");
+22
tests/test_module_eval_reentrancy.mjs
···11+import * as root from "./module_eval_reentrant_root.mjs";
22+import * as mid from "./module_eval_reentrant_mid.mjs";
33+import * as leaf from "./module_eval_reentrant_leaf.mjs";
44+55+function assert(condition, message) {
66+ if (!condition) throw new Error(message);
77+}
88+99+assert(root.root === "root-ok", "root export mismatch");
1010+assert(root.fromMid === "mid-ok", "root->mid export mismatch");
1111+assert(root.fromLeaf === "leaf-ok", "root->leaf export mismatch");
1212+1313+assert(mid.mid === "mid-ok", "mid export mismatch");
1414+assert(mid.fromLeaf === "leaf-ok", "mid->leaf export mismatch");
1515+1616+assert(leaf.leaf === "leaf-ok", "leaf export mismatch");
1717+1818+assert(root.mid === undefined, "root namespace was polluted by mid exports");
1919+assert(mid.root === undefined, "mid namespace was polluted by root exports");
2020+assert(leaf.root === undefined, "leaf namespace was polluted by root exports");
2121+2222+console.log("test_module_eval_reentrancy: OK");