Skip to content

Commit

Permalink
Improve coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
lukastaegert committed Jul 15, 2022
1 parent 40499ef commit f25bfe9
Show file tree
Hide file tree
Showing 17 changed files with 92 additions and 10 deletions.
18 changes: 8 additions & 10 deletions docs/999-big-list-of-options.md
Expand Up @@ -100,16 +100,14 @@ import { fileURLToPath } from 'url';

export default {
input: Object.fromEntries(
glob
.sync('src/**/*.js')
.map(file => [
// This remove `src/` as well as the file extension from each file, so e.g.
// src/nested/foo.js becomes nested/foo
path.relative('src', file.slice(0, file.length - path.extname(file).length)),
// This expands the relative paths to absolute paths, so e.g.
// src/nested/foo becomes /project/src/nested/foo.js
fileURLToPath(new URL(file, import.meta.url))
])
glob.sync('src/**/*.js').map(file => [
// This remove `src/` as well as the file extension from each file, so e.g.
// src/nested/foo.js becomes nested/foo
path.relative('src', file.slice(0, file.length - path.extname(file).length)),
// This expands the relative paths to absolute paths, so e.g.
// src/nested/foo becomes /project/src/nested/foo.js
fileURLToPath(new URL(file, import.meta.url))
])
),
output: {
format: 'es',
Expand Down
@@ -0,0 +1,18 @@
const path = require('path');

module.exports = {
description: 'Supports chunk names from config when preserving modules',
options: {
input: { 'main-entry': 'main.js' },
output: {
preserveModules: true
},
plugins: [
{
buildStart() {
this.emitFile({ type: 'chunk', id: path.join(__dirname, 'b.js'), name: 'emitted' });
}
}
]
}
};
@@ -0,0 +1,5 @@
define((function () { 'use strict';

console.log('a');

}));
@@ -0,0 +1,5 @@
define((function () { 'use strict';

console.log('b');

}));
@@ -0,0 +1,5 @@
define(['./a'], (function (a) { 'use strict';

console.log('main');

}));
@@ -0,0 +1,3 @@
'use strict';

console.log('a');
@@ -0,0 +1,3 @@
'use strict';

console.log('b');
@@ -0,0 +1,5 @@
'use strict';

require('./a.js');

console.log('main');
@@ -0,0 +1 @@
console.log('a');
@@ -0,0 +1 @@
console.log('b');
@@ -0,0 +1,3 @@
import './a.js';

console.log('main');
@@ -0,0 +1,10 @@
System.register([], (function () {
'use strict';
return {
execute: (function () {

console.log('a');

})
};
}));
@@ -0,0 +1,10 @@
System.register([], (function () {
'use strict';
return {
execute: (function () {

console.log('b');

})
};
}));
@@ -0,0 +1,11 @@
System.register(['./a.js'], (function () {
'use strict';
return {
setters: [function () {}],
execute: (function () {

console.log('main');

})
};
}));
@@ -0,0 +1 @@
console.log('a');
@@ -0,0 +1 @@
console.log('b');
@@ -0,0 +1,2 @@
import './a.js';
console.log('main');

0 comments on commit f25bfe9

Please sign in to comment.