SvelteViewEngine: update backend calls prefix to $locals (store)

This commit is contained in:
Alice Gaudon 2021-05-12 13:55:47 +02:00
parent 85b4b39dd2
commit e851630be4

View File

@ -14,7 +14,7 @@ import {logger} from "../Logger.js";
import FileCache from "../utils/FileCache.js";
import ViewEngine from "./ViewEngine.js";
const BACKEND_CODE_PREFIX = 'locals.';
const BACKEND_CODE_PREFIX = '$locals.';
const BACKEND_CODE_PREFIX_TEMPORARY_HOLDER = '$$locals$$';
const COMPILED_SVELTE_EXTENSION = '.precompiled';
@ -250,7 +250,7 @@ export default class SvelteViewEngine extends ViewEngine {
backendCalls.add(backendCall);
output = output.substring(0, index) +
'locals(' + backendCall.split(BACKEND_CODE_PREFIX).join(BACKEND_CODE_PREFIX_TEMPORARY_HOLDER) + ')' +
'$locals(' + backendCall.split(BACKEND_CODE_PREFIX).join(BACKEND_CODE_PREFIX_TEMPORARY_HOLDER) + ')' +
output.substring(endIndex, output.length);
}
output = output.split(BACKEND_CODE_PREFIX_TEMPORARY_HOLDER).join(BACKEND_CODE_PREFIX);