mirror of
https://github.com/vercel-labs/scriptc.git
synced 2026-10-24 06:14:01 +08:00
17 lines
550 B
TypeScript
17 lines
550 B
TypeScript
// Namespace-import objects and dynamic import() share the same singleton
|
|
// identity, while qualified reads stay live aliases of exporter storage.
|
|
import * as declared from "./mod.ts";
|
|
|
|
const alias = declared;
|
|
|
|
async function main(): Promise<void> {
|
|
const dynamic = await import("./mod.ts");
|
|
console.log("identity", alias === declared, declared === dynamic);
|
|
console.log("keys", Object.keys(alias).join(","));
|
|
console.log("value", alias.value);
|
|
dynamic.bump();
|
|
console.log("live", alias.value, declared.value, dynamic.value);
|
|
}
|
|
|
|
main();
|