From 25dedbe73e0d1705244aa9801092ae3d45f1ed66 Mon Sep 17 00:00:00 2001 From: Maxime LUCE Date: Tue, 6 Apr 2021 19:55:20 +0200 Subject: [PATCH] feat: pass full markup source to preprocessors --- src/compiler/preprocess/index.ts | 3 ++- src/compiler/preprocess/types.ts | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/compiler/preprocess/index.ts b/src/compiler/preprocess/index.ts index 16bcdf1687..e66fb4ba14 100644 --- a/src/compiler/preprocess/index.ts +++ b/src/compiler/preprocess/index.ts @@ -139,7 +139,7 @@ async function process_tag( preprocessor: Preprocessor, source: Source ): Promise { - const { filename } = source; + const { filename, source: markup } = source; const tag_regex = tag_name === 'style' ? /|([^]*?)<\/style>|\/>)/gi @@ -160,6 +160,7 @@ async function process_tag( const processed = await preprocessor({ content: content || '', attributes: parse_tag_attributes(attributes || ''), + markup, filename }); diff --git a/src/compiler/preprocess/types.ts b/src/compiler/preprocess/types.ts index 06890ad7b5..b65f85c6c8 100644 --- a/src/compiler/preprocess/types.ts +++ b/src/compiler/preprocess/types.ts @@ -22,6 +22,7 @@ export type MarkupPreprocessor = (options: { export type Preprocessor = (options: { content: string; attributes: Record; + markup: string; filename?: string; }) => Processed | Promise;