From aee1054c862a18f723b7cd133be496d7f094eb77 Mon Sep 17 00:00:00 2001 From: Maarten van Sambeek Date: Wed, 27 May 2020 14:08:37 +0200 Subject: [PATCH] Adds a markup parameter to Preprocessors. This parameter will hold the entire processed source file up until the current preprocessor. Fixes #4912 --- src/compiler/preprocess/index.ts | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/compiler/preprocess/index.ts b/src/compiler/preprocess/index.ts index 1a13b869e7af..ccb36f04e1ec 100644 --- a/src/compiler/preprocess/index.ts +++ b/src/compiler/preprocess/index.ts @@ -17,6 +17,7 @@ export type Preprocessor = (options: { content: string; attributes: Record; filename?: string; + markup: string; }) => Processed | Promise; function parse_attributes(str: string) { @@ -103,7 +104,8 @@ export default async function preprocess( const processed = await fn({ content, attributes: parse_attributes(attributes), - filename + filename, + markup: source }); if (processed && processed.dependencies) dependencies.push(...processed.dependencies); return processed ? `${processed.code}` : match; @@ -122,7 +124,8 @@ export default async function preprocess( const processed: Processed = await fn({ content, attributes: parse_attributes(attributes), - filename + filename, + markup: source }); if (processed && processed.dependencies) dependencies.push(...processed.dependencies); return processed ? `${processed.code}` : match;