`${unused.slice(0,-1).map(name=>`'${name}'`).join(', ')} and '${unused.pop()}' are`;
`${unused.slice(0,-1).map(name=>`'${name}'`).join(', ')} and '${unused.pop()}' are`;
this.onwarn(`${names} imported from external module '${module.id}' but never used`);
this.warn({
code:'UNUSED_EXTERNAL_IMPORT',
message:`${names} imported from external module '${module.id}' but never used`
});
});
});
this.orderedModules=this.sort();
this.orderedModules=this.sort();
@ -309,7 +312,10 @@ export default class Bundle {
keys(exportAllModule.exportsAll).forEach(name=>{
keys(exportAllModule.exportsAll).forEach(name=>{
if(nameinmodule.exportsAll){
if(nameinmodule.exportsAll){
this.onwarn(`Conflicting namespaces: ${module.id} re-exports '${name}' from both ${module.exportsAll[name]} (will be ignored) and ${exportAllModule.exportsAll[name]}.`);
this.warn({
code:'NAMESPACE_CONFLICT',
message:`Conflicting namespaces: ${relativeId(module.id)} re-exports '${name}' from both ${relativeId(module.exportsAll[name])} (will be ignored) and ${relativeId(exportAllModule.exportsAll[name])}`
if(isRelative(source))thrownewError(`Could not resolve '${source}' from ${module.id}`);
if(isRelative(source))thrownewError(`Could not resolve '${source}' from ${module.id}`);
this.onwarn(`'${source}' is imported by ${relativeId(module.id)}, but could not be resolved – treating it as an external dependency. For help see https://github.com/rollup/rollup/wiki/Troubleshooting#treating-module-as-external-dependency`);
this.warn({
code:'UNRESOLVED_IMPORT',
message:`'${source}' is imported by ${relativeId(module.id)}, but could not be resolved – treating it as an external dependency`,
this.module.bundle.onwarn(`${relativeId(this.module.id)} (${line}:${column}) Ambiguous default export (is a call expression, but looks like a function declaration). See https://github.com/rollup/rollup/wiki/Troubleshooting#ambiguous-default-export`);
code:'AMBIGUOUS_DEFAULT_EXPORT',
message:`Ambiguous default export (is a call expression, but looks like a function declaration)`,
this.module.bundle.onwarn(`${relativeId(this.module.id)} (${line}:${column}) '${part.name}' is not exported by '${relativeId(exporterId)}'. See https://github.com/rollup/rollup/wiki/Troubleshooting#name-is-not-exported-by-module`);
code:'MISSING_EXPORT',
message:`'${part.name}' is not exported by '${relativeId(exporterId)}'`,
constwarning=`The 'this' keyword is equivalent to 'undefined' at the top level of an ES module, and has been rewritten. See https://github.com/rollup/rollup/wiki/Troubleshooting#this-is-undefined for more information`;
`modules (${externalBuiltins.slice(0,-1).map(name=>`'${name}'`).join(', ')} and '${externalBuiltins.pop()}')`;
`modules (${externalBuiltins.slice(0,-1).map(name=>`'${name}'`).join(', ')} and '${externalBuiltins.pop()}')`;
bundle.onwarn(`Creating a browser bundle that depends on Node.js built-in ${detail}. You might need to include https://www.npmjs.com/package/rollup-plugin-node-builtins`);
bundle.warn({
code:'MISSING_NODE_BUILTINS',
message:`Creating a browser bundle that depends on Node.js built-in ${detail}. You might need to include https://www.npmjs.com/package/rollup-plugin-node-builtins`
onwarn(`Sourcemap is likely to be incorrect: a plugin${map.plugin?` ('${map.plugin}')`:``} was used to transform files, but didn't generate a sourcemap for the transformation. Consult https://github.com/rollup/rollup/wiki/Troubleshooting and the plugin documentation for more information`);
bundle.warn({
code:'SOURCEMAP_BROKEN',
message:`Sourcemap is likely to be incorrect: a plugin${map.plugin?` ('${map.plugin}')`:``} was used to transform files, but didn't generate a sourcemap for the transformation. Consult the plugin documentation for help`,
bundle.onwarn(`Using named and default exports together. Consumers of your bundle will have to use ${moduleName||'bundle'}['default'] to access the default export, which may not be what you want. Use \`exports: 'named'\` to disable this warning. See https://github.com/rollup/rollup/wiki/JavaScript-API#exports for more information`);
bundle.warn({
code:'MIXED_EXPORTS',
message:`Using named and default exports together. Consumers of your bundle will have to use ${moduleName||'bundle'}['default'] to access the default export, which may not be what you want. Use \`exports: 'named'\` to disable this warning`,
`'path' is imported by main.js, but could not be resolved – treating it as an external dependency. For help see https://github.com/rollup/rollup/wiki/Troubleshooting#treating-module-as-external-dependency`
code:'UNRESOLVED_IMPORT',
]);
message:`'path' is imported by main.js, but could not be resolved – treating it as an external dependency`,
`'path' is imported by main.js, but could not be resolved – treating it as an external dependency. For help see https://github.com/rollup/rollup/wiki/Troubleshooting#treating-module-as-external-dependency`
code:'UNRESOLVED_IMPORT',
]);
message:`'path' is imported by main.js, but could not be resolved – treating it as an external dependency`,
@ -2,11 +2,13 @@ var assert = require( 'assert' );
module.exports={
module.exports={
description:'does not hang on missing module (#53)',
description:'does not hang on missing module (#53)',
warnings:warnings=>{
warnings:[
assert.deepEqual(warnings,[
{
`'unlessYouCreatedThisFileForSomeReason' is imported by main.js, but could not be resolved – treating it as an external dependency. For help see https://github.com/rollup/rollup/wiki/Troubleshooting#treating-module-as-external-dependency`
code:'UNRESOLVED_IMPORT',
]);
message:`'unlessYouCreatedThisFileForSomeReason' is imported by main.js, but could not be resolved – treating it as an external dependency`,
assert.equal(msg,`main.js (3:21) 'foo' is not exported by 'empty.js'. See https://github.com/rollup/rollup/wiki/Troubleshooting#name-is-not-exported-by-module`);
`'external' is imported by main.js, but could not be resolved – treating it as an external dependency. For help see https://github.com/rollup/rollup/wiki/Troubleshooting#treating-module-as-external-dependency`,
code:'UNRESOLVED_IMPORT',
`'unused', 'notused' and 'neverused' are imported from external module 'external' but never used`,
message:`'external' is imported by main.js, but could not be resolved – treating it as an external dependency`,
description:'uses original name of default export function (#1011)',
description:'uses original name of default export function (#1011)',
warnings:warnings=>{
warnings:[
assert.deepEqual(warnings,[
{
'foo.js (1:15) Ambiguous default export (is a call expression, but looks like a function declaration). See https://github.com/rollup/rollup/wiki/Troubleshooting#ambiguous-default-export'
code:'AMBIGUOUS_DEFAULT_EXPORT',
]);
message:`Ambiguous default export (is a call expression, but looks like a function declaration)`,
description:'warns if default and named exports are used in auto mode',
description:'warns if default and named exports are used in auto mode',
warnings:function(warnings){
warnings:[
assert.deepEqual(warnings,[
{
'Using named and default exports together. Consumers of your bundle will have to use bundle[\'default\'] to access the default export, which may not be what you want. Use `exports: \'named\'` to disable this warning. See https://github.com/rollup/rollup/wiki/JavaScript-API#exports for more information'
code:'MIXED_EXPORTS',
]);
message:`Using named and default exports together. Consumers of your bundle will have to use bundle['default'] to access the default export, which may not be what you want. Use \`exports: 'named'\` to disable this warning`,
`main.js (3:1) The 'this' keyword is equivalent to 'undefined' at the top level of an ES module, and has been rewritten. See https://github.com/rollup/rollup/wiki/Troubleshooting#this-is-undefined for more information`
code:'THIS_IS_UNDEFINED',
]);
message:`The 'this' keyword is equivalent to 'undefined' at the top level of an ES module, and has been rewritten`,
description:'preserves sourcemap chains when transforming',
description:'preserves sourcemap chains when transforming',
before:()=>warnings=[],// reset
options:{
options:{
plugins:[
plugins:[
{
{
@ -13,14 +8,13 @@ module.exports = {
returncode;
returncode;
}
}
}
}
],
]
onwarn(msg){
warnings.push(msg);
}
},
},
test:()=>{
warnings:[
assert.deepEqual(warnings,[
{
`Sourcemap is likely to be incorrect: a plugin ('fake plugin') was used to transform files, but didn't generate a sourcemap for the transformation. Consult https://github.com/rollup/rollup/wiki/Troubleshooting and the plugin documentation for more information`
code:`SOURCEMAP_BROKEN`,
]);
message:`Sourcemap is likely to be incorrect: a plugin ('fake plugin') was used to transform files, but didn't generate a sourcemap for the transformation. Consult the plugin documentation for help`,
`'util' is imported by entry, but could not be resolved – treating it as an external dependency. For help see https://github.com/rollup/rollup/wiki/Troubleshooting#treating-module-as-external-dependency`,
assert.equal(relevantWarnings.length,1);
`Creating a browser bundle that depends on Node.js built-in module ('util'). You might need to include https://www.npmjs.com/package/rollup-plugin-node-builtins`,
assert.equal(relevantWarnings[0].message,`Creating a browser bundle that depends on Node.js built-in module ('util'). You might need to include https://www.npmjs.com/package/rollup-plugin-node-builtins`);
`No name was provided for external module 'util' in options.globals – guessing 'util'`