Skip to content

Commit 15c99bf

Browse files
committed
feat: pass full markup source to preprocessors
1 parent c7e820e commit 15c99bf

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

src/compiler/preprocess/index.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ async function process_tag(
139139
preprocessor: Preprocessor,
140140
source: Source
141141
): Promise<SourceUpdate> {
142-
const { filename } = source;
142+
const { filename, source: raw_source } = source;
143143
const tag_regex =
144144
tag_name === 'style'
145145
? /<!--[^]*?-->|<style(\s[^]*?)?(?:>([^]*?)<\/style>|\/>)/gi
@@ -160,6 +160,7 @@ async function process_tag(
160160
const processed = await preprocessor({
161161
content: content || '',
162162
attributes: parse_tag_attributes(attributes || ''),
163+
source: raw_source,
163164
filename
164165
});
165166

src/compiler/preprocess/types.ts

+1
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ export type MarkupPreprocessor = (options: {
2222
export type Preprocessor = (options: {
2323
content: string;
2424
attributes: Record<string, string | boolean>;
25+
source: string;
2526
filename?: string;
2627
}) => Processed | Promise<Processed>;
2728

0 commit comments

Comments
 (0)