|
|
|
@ -418,7 +418,7 @@ export function client_component(source, analysis, options) {
|
|
|
|
|
|
|
|
|
|
if (options.hmr) {
|
|
|
|
|
const accept_fn_body = [
|
|
|
|
|
b.stmt(b.call('$.set', b.id('s'), b.member(b.id('module.default'), b.id('original'))))
|
|
|
|
|
b.stmt(b.call('$.set', b.id('s'), b.member(b.id('module.default'), b.id('$.ORIGINAL'), true)))
|
|
|
|
|
];
|
|
|
|
|
|
|
|
|
|
if (analysis.css.hash) {
|
|
|
|
@ -446,7 +446,11 @@ export function client_component(source, analysis, options) {
|
|
|
|
|
// Assign the original component to the wrapper so we can use it on hot reload patching,
|
|
|
|
|
// else we would call the HMR function two times
|
|
|
|
|
b.stmt(
|
|
|
|
|
b.assignment('=', b.member(b.id(analysis.name), b.id('original')), b.id('$$original'))
|
|
|
|
|
b.assignment(
|
|
|
|
|
'=',
|
|
|
|
|
b.member(b.id(analysis.name), b.id('$.ORIGINAL'), true),
|
|
|
|
|
b.id('$$original')
|
|
|
|
|
)
|
|
|
|
|
),
|
|
|
|
|
b.stmt(b.call('import.meta.hot.accept', b.arrow([b.id('module')], b.block(accept_fn_body))))
|
|
|
|
|
]);
|
|
|
|
@ -458,10 +462,14 @@ export function client_component(source, analysis, options) {
|
|
|
|
|
|
|
|
|
|
if (options.dev) {
|
|
|
|
|
if (filename) {
|
|
|
|
|
// add `App.filename = 'App.svelte'` so that we can print useful messages later
|
|
|
|
|
// add `App[$.FILENAME] = 'App.svelte'` so that we can print useful messages later
|
|
|
|
|
body.unshift(
|
|
|
|
|
b.stmt(
|
|
|
|
|
b.assignment('=', b.member(b.id(analysis.name), b.id('filename')), b.literal(filename))
|
|
|
|
|
b.assignment(
|
|
|
|
|
'=',
|
|
|
|
|
b.member(b.id(analysis.name), b.id('$.FILENAME'), true),
|
|
|
|
|
b.literal(filename)
|
|
|
|
|
)
|
|
|
|
|
)
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|