You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
svelte/compiler/generate/utils/getOutro.js

27 lines
576 B

import getGlobals from './getGlobals.js';
export default function getOutro ( format, name, options, imports ) {
if ( format === 'es' ) {
return `export default ${name};`;
}
if ( format === 'amd' ) {
return `return ${name};\n\n});`;
}
if ( format === 'cjs' ) {
return `module.exports = ${name};`;
}
if ( format === 'iife' ) {
const globals = getGlobals( imports, options );
return `return ${name};\n\n}(${globals.join( ', ' )}));`;
}
if ( format === 'umd' ) {
return `return ${name};\n\n})));`;
}
throw new Error( `Not implemented: ${format}` );
}