aba932aefa
* Commonjs module:create synthetic exports symbol Previously, the `module` identifier in commonjs modules got a synthetic type with a single property `exports`. The exports property reused the file's symbol, which, for a module file, gives the correct exported properties. However, the name of this symbol was still the filename of the file, not `exports`. This PR creates a synthetic symbol for `exports` by copying in a similar way to esModuleInterop's `default` symbol in `resolveESModuleSymbol` (although the intent there is to strip off signatures from the symbol). * correct parent of synthetic symbol
22 lines
787 B
Plaintext
22 lines
787 B
Plaintext
=== tests/cases/conformance/salsa/npm.js ===
|
|
var mod = require('./mod')
|
|
>mod : Symbol(mod, Decl(npm.js, 0, 3))
|
|
>require : Symbol(require)
|
|
>'./mod' : Symbol("tests/cases/conformance/salsa/mod", Decl(mod.js, 0, 0))
|
|
|
|
mod() // should be callable from here too
|
|
>mod : Symbol(mod, Decl(npm.js, 0, 3))
|
|
|
|
=== tests/cases/conformance/salsa/mod.js ===
|
|
module.exports = function x() { }
|
|
>module.exports : Symbol(module.exports, Decl(mod.js, 0, 0))
|
|
>module : Symbol(export=, Decl(mod.js, 0, 0))
|
|
>exports : Symbol(export=, Decl(mod.js, 0, 0))
|
|
>x : Symbol(x, Decl(mod.js, 0, 16))
|
|
|
|
module.exports() // should be callable
|
|
>module.exports : Symbol(module.exports, Decl(mod.js, 0, 0))
|
|
>module : Symbol(module, Decl(mod.js, 0, 0))
|
|
>exports : Symbol(module.exports, Decl(mod.js, 0, 0))
|
|
|