|
|
|
@ -326,6 +326,8 @@ export default function dom(
|
|
|
|
|
return generator.alias(name);
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
let banner = `/* ${options.filename ? `${options.filename} ` : ``}generated by Svelte v${version} */\n`;
|
|
|
|
|
|
|
|
|
|
if (sharedPath) {
|
|
|
|
|
const used = Array.from(usedHelpers).sort();
|
|
|
|
|
if (format === 'es') {
|
|
|
|
@ -334,9 +336,7 @@ export default function dom(
|
|
|
|
|
return name !== alias ? `${name} as ${alias}` : name;
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
result =
|
|
|
|
|
`import { ${names.join(', ')} } from ${JSON.stringify(sharedPath)};\n\n` +
|
|
|
|
|
result;
|
|
|
|
|
banner += `import { ${names.join(', ')} } from ${JSON.stringify(sharedPath)};\n\n`;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
else if (format === 'cjs') {
|
|
|
|
@ -347,7 +347,7 @@ export default function dom(
|
|
|
|
|
requires += `\nvar ${alias} = ${SHARED}.${name};`;
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
result = `${requires}\n\n${result}`;
|
|
|
|
|
banner += requires + '\n\n';
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
else {
|
|
|
|
@ -391,20 +391,19 @@ export default function dom(
|
|
|
|
|
// special case
|
|
|
|
|
const global = `_svelteTransitionManager`;
|
|
|
|
|
|
|
|
|
|
result += `\n\nvar ${generator.alias('transitionManager')} = window.${global} || (window.${global} = ${code});`;
|
|
|
|
|
banner += `\n\nvar ${generator.alias('transitionManager')} = window.${global} || (window.${global} = ${code});`;
|
|
|
|
|
} else {
|
|
|
|
|
const alias = generator.alias(expression.id.name);
|
|
|
|
|
if (alias !== expression.id.name)
|
|
|
|
|
code.overwrite(expression.id.start, expression.id.end, alias);
|
|
|
|
|
|
|
|
|
|
result += `\n\n${code}`;
|
|
|
|
|
banner += `\n\n${code}`;
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
result = `/* ${options.filename ? `${options.filename} ` : ``}generated by Svelte v${version} */\n\n${result}`;
|
|
|
|
|
|
|
|
|
|
return generator.generate(result, options, {
|
|
|
|
|
banner,
|
|
|
|
|
name,
|
|
|
|
|
format,
|
|
|
|
|
});
|
|
|
|
|