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