diff --git a/docs/preprocessing.md b/docs/preprocessing.md index ef33ffd..fe738c5 100644 --- a/docs/preprocessing.md +++ b/docs/preprocessing.md @@ -71,7 +71,6 @@ The following options can be passed to the preprocessor. None are required: | --------------- | ------------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `markupTagName` | `"template"` | `string` that sets the name of the tag `svelte-preprocess` looks for markup in custom languages.

i.e `markup` makes it possible to write your markup between `` tag. | | `aliases` | `null` | A list of tuples `[alias: string, language: string]` that correlates an `alias` to a `language`

i.e `['cst', 'customLanguage']` means
`<... src="./file.cst">`
`<... lang="cst">`
are treated as `customLanguage`. | -| `preserve` | `[]` | A `string` list of languages/aliases that shouldn't pass through the preprocessor. (i.e `ld+json`) | | `sourceMap` | `false` | If `true`, `svelte-preprocess` generates sourcemap for every language that supports it. | ##### Configuring preprocessors diff --git a/src/autoProcess.ts b/src/autoProcess.ts index 4db8509..09da514 100644 --- a/src/autoProcess.ts +++ b/src/autoProcess.ts @@ -58,7 +58,6 @@ export function sveltePreprocess( { aliases, markupTagName = 'template', - preserve = [], sourceMap = process?.env?.NODE_ENV === 'development' ?? false, ...rest } = {} as AutoPreprocessOptions, @@ -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({ diff --git a/src/types/index.ts b/src/types/index.ts index 2bf98ad..fe8a0eb 100644 --- a/src/types/index.ts +++ b/src/types/index.ts @@ -68,7 +68,6 @@ export type AutoPreprocessGroup = PreprocessorGroup; export type AutoPreprocessOptions = { markupTagName?: string; aliases?: Array<[string, string]>; - preserve?: string[]; sourceMap?: boolean; // transformers diff --git a/test/autoProcess/autoProcess.test.ts b/test/autoProcess/autoProcess.test.ts index d663cb4..89c6b40 100644 --- a/test/autoProcess/autoProcess.test.ts +++ b/test/autoProcess/autoProcess.test.ts @@ -107,20 +107,14 @@ describe('options', () => { expect(preprocessed.toString?.()).toContain('div{}'); }); - it('should NOT preprocess preserved languages', async () => { - const input = `
`; - const opts = sveltePreprocess({ - preserve: ['ld+json'], - aliases: [['ld+json', 'structuredData']], - structuredData() { - return { code: '', map: '' }; - }, - }); + it('should NOT preprocess unrecognized languages', async () => { + const input = `
`; + const opts = sveltePreprocess(); const preprocessed = await preprocess(input, opts); expect(preprocessed.toString?.()).toContain( - ``, + ``, ); });