Skip to content

Commit

Permalink
breaking: remove preserve option
Browse files Browse the repository at this point in the history
  • Loading branch information
benmccann committed Dec 17, 2023
1 parent 7f42697 commit 851a935
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 15 deletions.
5 changes: 0 additions & 5 deletions src/autoProcess.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@ export function sveltePreprocess(
{
aliases,
markupTagName = 'template',
preserve = [],
sourceMap = process?.env?.NODE_ENV === 'development' ?? false,
...rest
} = {} as AutoPreprocessOptions,
Expand Down Expand Up @@ -128,10 +127,6 @@ export function sveltePreprocess(
lang = getLanguageFromAlias(alias);
}

if ((lang && preserve.includes(lang)) || preserve.includes(alias)) {
return { code: content };
}

const transformerOptions = getTransformerOptions(lang, alias);

content = prepareContent({
Expand Down
1 change: 0 additions & 1 deletion src/types/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,6 @@ export type AutoPreprocessGroup = PreprocessorGroup;
export type AutoPreprocessOptions = {
markupTagName?: string;
aliases?: Array<[string, string]>;
preserve?: string[];
sourceMap?: boolean;

// transformers
Expand Down
12 changes: 3 additions & 9 deletions test/autoProcess/autoProcess.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -107,19 +107,13 @@ describe('options', () => {
});

it('should NOT preprocess preserved languages', async () => {
const input = `<div></div><script lang="ld+json">{"json":true}</script>`;
const opts = sveltePreprocess({
preserve: ['ld+json'],
aliases: [['ld+json', 'structuredData']],
structuredData() {
return { code: '', map: '' };
},
});
const input = `<div></div><script type="ld+json">{"json":true}</script>`;
const opts = sveltePreprocess();

const preprocessed = await preprocess(input, opts);

expect(preprocessed.toString?.()).toContain(
`<script lang="ld+json">{"json":true}</script>`,
`<script type="ld+json">{"json":true}</script>`,
);
});

Expand Down

0 comments on commit 851a935

Please sign in to comment.