Files
scriptc/tests/diagnostics/cjs-member-alias-writes/node_modules/metrics/lib.js
T
Chris Tate 59dd6d1742 Read member aliases only while the binding holds the exported value
A member export resolves to its binding only when the binding is declared
before the write and never reassigned, so a consumer reads the value the
member stored. A module that re-exports another module's exports through
module.exports = require("./x") now counts its own writes after the
re-exported module's: a member it adds resolves, and a member both modules
write stays refused. The exports rebinding refusal and its test now cover
the form that stays refused, exports = value without module.exports.
2026-10-20 00:02:49 -05:00

9 lines
169 B
JavaScript

"use strict";
let counter = 1;
exports = module.exports = function metrics() {
return "metrics";
};
exports.counter = counter;
exports.version = "1.0.0";
counter = 5;