-
Notifications
You must be signed in to change notification settings - Fork 12.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Consider the commonjs module indicator as a module indicator (#18490)
* Consider the commonjs module indicator as an indicator that something is effectively an external module * Only use commonjs module indicator when targeting commonjs
- Loading branch information
Showing
6 changed files
with
64 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
//// [index.js] | ||
class Foo {} | ||
|
||
class Bar extends Foo {} | ||
|
||
module.exports = Bar; | ||
|
||
|
||
//// [index.js] | ||
var tslib_1 = require("tslib"); | ||
var Foo = /** @class */ (function () { | ||
function Foo() { | ||
} | ||
return Foo; | ||
}()); | ||
var Bar = /** @class */ (function (_super) { | ||
tslib_1.__extends(Bar, _super); | ||
function Bar() { | ||
return _super !== null && _super.apply(this, arguments) || this; | ||
} | ||
return Bar; | ||
}(Foo)); | ||
module.exports = Bar; |
13 changes: 13 additions & 0 deletions
13
tests/baselines/reference/javascriptCommonjsModule.symbols
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
=== tests/cases/compiler/index.js === | ||
class Foo {} | ||
>Foo : Symbol(Foo, Decl(index.js, 0, 0)) | ||
|
||
class Bar extends Foo {} | ||
>Bar : Symbol(Bar, Decl(index.js, 0, 12)) | ||
>Foo : Symbol(Foo, Decl(index.js, 0, 0)) | ||
|
||
module.exports = Bar; | ||
>module : Symbol(export=, Decl(index.js, 2, 24)) | ||
>exports : Symbol(export=, Decl(index.js, 2, 24)) | ||
>Bar : Symbol(Bar, Decl(index.js, 0, 12)) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
=== tests/cases/compiler/index.js === | ||
class Foo {} | ||
>Foo : Foo | ||
|
||
class Bar extends Foo {} | ||
>Bar : Bar | ||
>Foo : Foo | ||
|
||
module.exports = Bar; | ||
>module.exports = Bar : typeof Bar | ||
>module.exports : any | ||
>module : any | ||
>exports : any | ||
>Bar : typeof Bar | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
// @allowJS: true | ||
// @outDir: ./out | ||
// @module: commonjs | ||
// @noEmitHelpers: true | ||
// @importHelpers: true | ||
// @filename: index.js | ||
class Foo {} | ||
|
||
class Bar extends Foo {} | ||
|
||
module.exports = Bar; |