Skip to content

Commit

Permalink
Fix existing tests
Browse files Browse the repository at this point in the history
- virtual files now have a .js extension by default
- systemjs module references include this file extension
- amd module references omit this file extension. this seems to be
  consistent with amd output of other chunks
  • Loading branch information
BPScott committed Nov 14, 2021
1 parent e67174e commit 8c5030d
Show file tree
Hide file tree
Showing 50 changed files with 44 additions and 39 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

var require$$0 = require('external');
require('./other.js');
var other = require('./_virtual/other.js_commonjs-exports');
var other = require('./_virtual/other.js_commonjs-exports.js');

function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
'use strict';

var other = require('./_virtual/other.js_commonjs-exports');
var other = require('./_virtual/other.js_commonjs-exports.js');

other.__exports.value = 43;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import require$$0 from 'external';
import './other.js';
import { __exports as other } from './_virtual/other.js_commonjs-exports';
import { __exports as other } from './_virtual/other.js_commonjs-exports.js';

const external = require$$0;
const { value } = other;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { __exports as other } from './_virtual/other.js_commonjs-exports';
export { __exports as default } from './_virtual/other.js_commonjs-exports';
import { __exports as other } from './_virtual/other.js_commonjs-exports.js';
export { __exports as default } from './_virtual/other.js_commonjs-exports.js';

other.value = 43;
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
System.register(['external', './other.js', './_virtual/other.js_commonjs-exports'], (function (exports) {
System.register(['external', './other.js', './_virtual/other.js_commonjs-exports.js'], (function (exports) {
'use strict';
var require$$0, other;
return {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
System.register(['./_virtual/other.js_commonjs-exports'], (function (exports) {
System.register(['./_virtual/other.js_commonjs-exports.js'], (function (exports) {
'use strict';
var other;
return {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
'use strict';

var _virtualModule = require('./_virtual/_virtualModule');
var _virtualModule = require('./_virtual/_virtualModule.js');

assert.equal(_virtualModule.virtual, 'Virtual!');
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
import { virtual } from './_virtual/_virtualModule';
import { virtual } from './_virtual/_virtualModule.js';

assert.equal(virtual, 'Virtual!');
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
System.register(['./_virtual/_virtualModule'], (function () {
System.register(['./_virtual/_virtualModule.js'], (function () {
'use strict';
var virtual;
return {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

var require$$0 = require('external');
require('./other.js');
var other = require('./_virtual/other.js_commonjs-exports');
var other = require('./_virtual/other.js_commonjs-exports.js');

function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
'use strict';

var other = require('./_virtual/other.js_commonjs-exports');
var other = require('./_virtual/other.js_commonjs-exports.js');

other.__exports.value = 43;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import require$$0 from 'external';
import './other.js';
import { __exports as other } from './_virtual/other.js_commonjs-exports';
import { __exports as other } from './_virtual/other.js_commonjs-exports.js';

const external = require$$0;
const { value } = other;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { __exports as other } from './_virtual/other.js_commonjs-exports';
export { __exports as default } from './_virtual/other.js_commonjs-exports';
import { __exports as other } from './_virtual/other.js_commonjs-exports.js';
export { __exports as default } from './_virtual/other.js_commonjs-exports.js';

other.value = 43;
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
System.register(['external', './other.js', './_virtual/other.js_commonjs-exports'], (function (exports) {
System.register(['external', './other.js', './_virtual/other.js_commonjs-exports.js'], (function (exports) {
'use strict';
var require$$0, other;
return {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
System.register(['./_virtual/other.js_commonjs-exports'], (function (exports) {
System.register(['./_virtual/other.js_commonjs-exports.js'], (function (exports) {
'use strict';
var other;
return {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
'use strict';

require('../custom_modules/@my-scope/my-base-pkg/index.js');
var index = require('../_virtual/index.js_commonjs-exports');
var index = require('../_virtual/index.js_commonjs-exports.js');

const base2 = index.__exports;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
'use strict';

var index = require('../../../_virtual/index.js_commonjs-exports');
var index = require('../../../_virtual/index.js_commonjs-exports.js');

Object.defineProperty(index.__exports, '__esModule', { value: true });

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
'use strict';

require('./custom_modules/@my-scope/my-base-pkg/index.js');
var index = require('./_virtual/index.js_commonjs-exports');
var index = require('./_virtual/index.js_commonjs-exports.js');

const base = index.__exports;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import '../custom_modules/@my-scope/my-base-pkg/index.js';
import { __exports as myBasePkg } from '../_virtual/index.js_commonjs-exports';
import { __exports as myBasePkg } from '../_virtual/index.js_commonjs-exports.js';

const base2 = myBasePkg;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { __exports as myBasePkg } from '../../../_virtual/index.js_commonjs-exports';
export { __exports as default } from '../../../_virtual/index.js_commonjs-exports';
import { __exports as myBasePkg } from '../../../_virtual/index.js_commonjs-exports.js';
export { __exports as default } from '../../../_virtual/index.js_commonjs-exports.js';

Object.defineProperty(myBasePkg, '__esModule', { value: true });

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import './custom_modules/@my-scope/my-base-pkg/index.js';
import { __exports as myBasePkg } from './_virtual/index.js_commonjs-exports';
import { __exports as myBasePkg } from './_virtual/index.js_commonjs-exports.js';

const base = myBasePkg;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
System.register(['../custom_modules/@my-scope/my-base-pkg/index.js', '../_virtual/index.js_commonjs-exports'], (function (exports) {
System.register(['../custom_modules/@my-scope/my-base-pkg/index.js', '../_virtual/index.js_commonjs-exports.js'], (function (exports) {
'use strict';
var myBasePkg;
return {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
System.register(['../../../_virtual/index.js_commonjs-exports'], (function (exports) {
System.register(['../../../_virtual/index.js_commonjs-exports.js'], (function (exports) {
'use strict';
var myBasePkg;
return {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
System.register(['./custom_modules/@my-scope/my-base-pkg/index.js', './_virtual/index.js_commonjs-exports'], (function (exports) {
System.register(['./custom_modules/@my-scope/my-base-pkg/index.js', './_virtual/index.js_commonjs-exports.js'], (function (exports) {
'use strict';
var myBasePkg;
return {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
'use strict';

var _virtualModule = require('./_virtual/_virtualModule');
var _virtualModule = require('./_virtual/_virtualModule.js');

assert.equal(_virtualModule.virtual, 'Virtual!');
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
import { virtual } from './_virtual/_virtualModule';
import { virtual } from './_virtual/_virtualModule.js';

assert.equal(virtual, 'Virtual!');
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
System.register(['./_virtual/_virtualModule'], (function () {
System.register(['./_virtual/_virtualModule.js'], (function () {
'use strict';
var virtual;
return {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ module.exports = {
return bundle.generate({ format: 'es' }).then(generated =>
assert.deepEqual(
generated.output.map(chunk => chunk.fileName),
['main.js', '_virtual/_virtualModule', 'lib/lib.js']
['main.js', '_virtual/_virtualModule.js', 'lib/lib.js']
)
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ module.exports = {
return bundle.generate({ format: 'es', preserveModules: true }).then(generated =>
assert.deepEqual(
generated.output.map(chunk => chunk.fileName),
['main.js', '_virtual/_virtualModule', 'lib/lib.js']
['main.js', '_virtual/_virtualModule.js', 'lib/lib.js']
)
);
}
Expand Down
19 changes: 12 additions & 7 deletions test/misc/bundle-information.js
Original file line number Diff line number Diff line change
Expand Up @@ -480,7 +480,12 @@ describe('The bundle object', () => {
.then(({ output }) => {
assert.deepEqual(
output.map(chunk => chunk.fileName),
['_virtual/input', '_virtual/dynamic1', '_virtual/other', '_virtual/dynamic2'],
[
'_virtual/input.js',
'_virtual/dynamic1.js',
'_virtual/other.js',
'_virtual/dynamic2.js'
],
'fileName'
);
assert.deepEqual(
Expand All @@ -491,9 +496,9 @@ describe('The bundle object', () => {
assert.deepEqual(
output.map(chunk => chunk.code),
[
`import { other } from './other';
`import { other } from './other.js';
console.log(other);Promise.all([import('./dynamic1'), import('./dynamic2')]).then(([{dynamic1}, {dynamic2}]) => console.log(dynamic1, dynamic2));\n`,
console.log(other);Promise.all([import('./dynamic1.js'), import('./dynamic2.js')]).then(([{dynamic1}, {dynamic2}]) => console.log(dynamic1, dynamic2));\n`,
'const dynamic1 = "dynamic1";\n\nexport { dynamic1 };\n',
'const other = "other";\n\nexport { other };\n',
'const dynamic2 = "dynamic2";\n\nexport { dynamic2 };\n'
Expand All @@ -507,12 +512,12 @@ console.log(other);Promise.all([import('./dynamic1'), import('./dynamic2')]).the
);
assert.deepEqual(
output.map(chunk => chunk.imports),
[['_virtual/other'], [], [], []],
[['_virtual/other.js'], [], [], []],
'imports'
);
assert.deepEqual(
output.map(chunk => chunk.importedBindings),
[{ '_virtual/other': ['other'] }, {}, {}, {}],
[{ '_virtual/other.js': ['other'] }, {}, {}, {}],
'importedBindings'
);
assert.deepEqual(
Expand All @@ -522,15 +527,15 @@ console.log(other);Promise.all([import('./dynamic1'), import('./dynamic2')]).the
);
assert.deepEqual(
output.map(chunk => chunk.dynamicImports),
[['_virtual/dynamic1', '_virtual/dynamic2'], [], [], []],
[['_virtual/dynamic1.js', '_virtual/dynamic2.js'], [], [], []],
'dynamicImports'
);
assert.deepEqual(
output.map(chunk => chunk.modules),
[
{
input: {
code: "console.log(other);Promise.all([import('./dynamic1'), import('./dynamic2')]).then(([{dynamic1}, {dynamic2}]) => console.log(dynamic1, dynamic2));",
code: "console.log(other);Promise.all([import('./dynamic1.js'), import('./dynamic2.js')]).then(([{dynamic1}, {dynamic2}]) => console.log(dynamic1, dynamic2));",
originalLength: 169,
removedExports: [],
renderedExports: [],
Expand Down

0 comments on commit 8c5030d

Please sign in to comment.