@@ -3491,6 +3491,7 @@ Generated by [AVA](https://avajs.dev).
3491
3491
var externalEsmDefault__namespace = /*#__PURE__*/_interopNamespaceCompat(externalEsmDefault);␊
3492
3492
␊
3493
3493
function getAugmentedNamespace(n) {␊
3494
+ if (n.__esModule) return n;␊
3494
3495
var f = n.default;␊
3495
3496
if (typeof f == "function") {␊
3496
3497
var a = function a () {␊
@@ -3577,6 +3578,7 @@ Generated by [AVA](https://avajs.dev).
3577
3578
var externalEsmDefault__namespace = /*#__PURE__*/_interopNamespaceCompat(externalEsmDefault);␊
3578
3579
␊
3579
3580
function getAugmentedNamespace(n) {␊
3581
+ if (n.__esModule) return n;␊
3580
3582
var f = n.default;␊
3581
3583
if (typeof f == "function") {␊
3582
3584
var a = function a () {␊
@@ -3657,6 +3659,7 @@ Generated by [AVA](https://avajs.dev).
3657
3659
var externalEsmDefault__namespace = /*#__PURE__*/_interopNamespaceCompat(externalEsmDefault);␊
3658
3660
␊
3659
3661
function getAugmentedNamespace(n) {␊
3662
+ if (n.__esModule) return n;␊
3660
3663
var f = n.default;␊
3661
3664
if (typeof f == "function") {␊
3662
3665
var a = function a () {␊
@@ -3750,6 +3753,7 @@ Generated by [AVA](https://avajs.dev).
3750
3753
'main.js': `'use strict';␊
3751
3754
␊
3752
3755
function getAugmentedNamespace(n) {␊
3756
+ if (n.__esModule) return n;␊
3753
3757
var f = n.default;␊
3754
3758
if (typeof f == "function") {␊
3755
3759
var a = function a () {␊
@@ -3834,6 +3838,64 @@ Generated by [AVA](https://avajs.dev).
3834
3838
`,
3835
3839
}
3836
3840
3841
+ ## esm-with-esmodule
3842
+
3843
+ > Snapshot 1
3844
+
3845
+ {
3846
+ 'main.js': `'use strict';␊
3847
+ ␊
3848
+ function getAugmentedNamespace(n) {␊
3849
+ if (n.__esModule) return n;␊
3850
+ var f = n.default;␊
3851
+ if (typeof f == "function") {␊
3852
+ var a = function a () {␊
3853
+ if (this instanceof a) {␊
3854
+ var args = [null];␊
3855
+ args.push.apply(args, arguments);␊
3856
+ var Ctor = Function.bind.apply(f, args);␊
3857
+ return new Ctor();␊
3858
+ }␊
3859
+ return f.apply(this, arguments);␊
3860
+ };␊
3861
+ a.prototype = f.prototype;␊
3862
+ } else a = {};␊
3863
+ Object.defineProperty(a, '__esModule', {value: true});␊
3864
+ Object.keys(n).forEach(function (k) {␊
3865
+ var d = Object.getOwnPropertyDescriptor(n, k);␊
3866
+ Object.defineProperty(a, k, d.get ? d : {␊
3867
+ enumerable: true,␊
3868
+ get: function () {␊
3869
+ return n[k];␊
3870
+ }␊
3871
+ });␊
3872
+ });␊
3873
+ return a;␊
3874
+ }␊
3875
+ ␊
3876
+ var main = {};␊
3877
+ ␊
3878
+ const foo = 'foo';␊
3879
+ ␊
3880
+ const __esModule = true;␊
3881
+ ␊
3882
+ var esm$1 = /*#__PURE__*/Object.freeze({␊
3883
+ __proto__: null,␊
3884
+ foo: foo,␊
3885
+ __esModule: __esModule␊
3886
+ });␊
3887
+ ␊
3888
+ var require$$0 = /*@__PURE__*/getAugmentedNamespace(esm$1);␊
3889
+ ␊
3890
+ const esm = require$$0;␊
3891
+ ␊
3892
+ t.is(esm.foo, 'foo');␊
3893
+ t.is(esm.__esModule, true);␊
3894
+ ␊
3895
+ module.exports = main;␊
3896
+ `,
3897
+ }
3898
+
3837
3899
## export-default-from
3838
3900
3839
3901
> Snapshot 1
@@ -3957,6 +4019,7 @@ Generated by [AVA](https://avajs.dev).
3957
4019
'main.js': `'use strict';␊
3958
4020
␊
3959
4021
function getAugmentedNamespace(n) {␊
4022
+ if (n.__esModule) return n;␊
3960
4023
var f = n.default;␊
3961
4024
if (typeof f == "function") {␊
3962
4025
var a = function a () {␊
@@ -4187,6 +4250,7 @@ Generated by [AVA](https://avajs.dev).
4187
4250
var externalEsmDefault__namespace = /*#__PURE__*/_interopNamespaceCompat(externalEsmDefault);␊
4188
4251
␊
4189
4252
function getAugmentedNamespace(n) {␊
4253
+ if (n.__esModule) return n;␊
4190
4254
var f = n.default;␊
4191
4255
if (typeof f == "function") {␊
4192
4256
var a = function a () {␊
@@ -4289,6 +4353,7 @@ Generated by [AVA](https://avajs.dev).
4289
4353
'main.js': `'use strict';␊
4290
4354
␊
4291
4355
function getAugmentedNamespace(n) {␊
4356
+ if (n.__esModule) return n;␊
4292
4357
var f = n.default;␊
4293
4358
if (typeof f == "function") {␊
4294
4359
var a = function a () {␊
@@ -4482,6 +4547,7 @@ Generated by [AVA](https://avajs.dev).
4482
4547
}␊
4483
4548
␊
4484
4549
function getAugmentedNamespace(n) {␊
4550
+ if (n.__esModule) return n;␊
4485
4551
var f = n.default;␊
4486
4552
if (typeof f == "function") {␊
4487
4553
var a = function a () {␊
@@ -4760,6 +4826,7 @@ Generated by [AVA](https://avajs.dev).
4760
4826
var externalEsmDefault__namespace = /*#__PURE__*/_interopNamespaceCompat(externalEsmDefault);␊
4761
4827
␊
4762
4828
function getAugmentedNamespace(n) {␊
4829
+ if (n.__esModule) return n;␊
4763
4830
var f = n.default;␊
4764
4831
if (typeof f == "function") {␊
4765
4832
var a = function a () {␊
@@ -4854,6 +4921,7 @@ Generated by [AVA](https://avajs.dev).
4854
4921
'main.js': `'use strict';␊
4855
4922
␊
4856
4923
function getAugmentedNamespace(n) {␊
4924
+ if (n.__esModule) return n;␊
4857
4925
var f = n.default;␊
4858
4926
if (typeof f == "function") {␊
4859
4927
var a = function a () {␊
@@ -6163,6 +6231,7 @@ Generated by [AVA](https://avajs.dev).
6163
6231
'main.js': `'use strict';␊
6164
6232
␊
6165
6233
function getAugmentedNamespace(n) {␊
6234
+ if (n.__esModule) return n;␊
6166
6235
var f = n.default;␊
6167
6236
if (typeof f == "function") {␊
6168
6237
var a = function a () {␊
@@ -6214,6 +6283,7 @@ Generated by [AVA](https://avajs.dev).
6214
6283
'main.js': `'use strict';␊
6215
6284
␊
6216
6285
function getAugmentedNamespace(n) {␊
6286
+ if (n.__esModule) return n;␊
6217
6287
var f = n.default;␊
6218
6288
if (typeof f == "function") {␊
6219
6289
var a = function a () {␊
@@ -7167,6 +7237,7 @@ Generated by [AVA](https://avajs.dev).
7167
7237
'main.js': `'use strict';␊
7168
7238
␊
7169
7239
function getAugmentedNamespace(n) {␊
7240
+ if (n.__esModule) return n;␊
7170
7241
var f = n.default;␊
7171
7242
if (typeof f == "function") {␊
7172
7243
var a = function a () {␊
@@ -7211,6 +7282,68 @@ Generated by [AVA](https://avajs.dev).
7211
7282
`,
7212
7283
}
7213
7284
7285
+ ## transform-mixed-modules-esmodule
7286
+
7287
+ > Snapshot 1
7288
+
7289
+ {
7290
+ 'main.js': `'use strict';␊
7291
+ ␊
7292
+ function getAugmentedNamespace(n) {␊
7293
+ if (n.__esModule) return n;␊
7294
+ var f = n.default;␊
7295
+ if (typeof f == "function") {␊
7296
+ var a = function a () {␊
7297
+ if (this instanceof a) {␊
7298
+ var args = [null];␊
7299
+ args.push.apply(args, arguments);␊
7300
+ var Ctor = Function.bind.apply(f, args);␊
7301
+ return new Ctor();␊
7302
+ }␊
7303
+ return f.apply(this, arguments);␊
7304
+ };␊
7305
+ a.prototype = f.prototype;␊
7306
+ } else a = {};␊
7307
+ Object.defineProperty(a, '__esModule', {value: true});␊
7308
+ Object.keys(n).forEach(function (k) {␊
7309
+ var d = Object.getOwnPropertyDescriptor(n, k);␊
7310
+ Object.defineProperty(a, k, d.get ? d : {␊
7311
+ enumerable: true,␊
7312
+ get: function () {␊
7313
+ return n[k];␊
7314
+ }␊
7315
+ });␊
7316
+ });␊
7317
+ return a;␊
7318
+ }␊
7319
+ ␊
7320
+ var otherExports = {};␊
7321
+ var other$1 = {␊
7322
+ get exports(){ return otherExports; },␊
7323
+ set exports(v){ otherExports = v; },␊
7324
+ };␊
7325
+ ␊
7326
+ Object.defineProperty(otherExports, '__esModule', {␊
7327
+ value: true␊
7328
+ });␊
7329
+ other$1.exports = 'other';␊
7330
+ ␊
7331
+ const other = otherExports;␊
7332
+ ␊
7333
+ var dep$1 = /*#__PURE__*/Object.freeze({␊
7334
+ __proto__: null,␊
7335
+ other: other␊
7336
+ });␊
7337
+ ␊
7338
+ var require$$0 = /*@__PURE__*/getAugmentedNamespace(dep$1);␊
7339
+ ␊
7340
+ const dep = require$$0;␊
7341
+ ␊
7342
+ t.is(other, 'other');␊
7343
+ t.deepEqual(dep, { other: 'other' });␊
7344
+ `,
7345
+ }
7346
+
7214
7347
## transpiled-esm-default
7215
7348
7216
7349
> Snapshot 1
0 commit comments