| 1070 | |
| 1071 | // `target = value`, where target may be a property |
| 1072 | private write(target: Node, module: SourceModule, held: Held): void { |
| 1073 | target = unwrapExpression(target) |
| 1074 | if (target.type !== "MemberExpression") |
| 1075 | return this.bindPattern(target, module, held) |
| 1076 | const owner = globalNameOf(target.object, module) |
| 1077 | if (owner && globalObjects.has(owner)) { |
| 1078 | return this.lose( |
| 1079 | target, |
| 1080 | module, |
| 1081 | "stores it on the global object, which code outside the bundle may read" |
| 1082 | ) |
| 1083 | } |
| 1084 | if (isCommonJsExports(owner, memberNameOf(target))) |
| 1085 | return this.lose(target, module, "exports it from CommonJS") |
| 1086 | // `o.__proto__ = T` makes o inherit T's members, which no read of a key |
| 1087 | // shows, though `o.__proto__ = { schema: T }` holds it at a key to follow |
| 1088 | if (memberNameOf(target) === "__proto__" && !held.path.length) { |
| 1089 | return this.lose( |
| 1090 | target, |
| 1091 | module, |
| 1092 | "sets it as a prototype, which inherits its members" |
| 1093 | ) |
| 1094 | } |
| 1095 | this.followField(memberNameOf(target), target, module, held) |
| 1096 | } |
| 1097 | |
| 1098 | // stored at a key, which any read of it by name may read |
| 1099 | private followField( |