diff --git a/src/modules/language.ts b/src/modules/language.ts index facfd78b..1502e21c 100644 --- a/src/modules/language.ts +++ b/src/modules/language.ts @@ -4,10 +4,6 @@ import { isValidLocalPath } from './utils'; import type { PreprocessorArgs } from '../types'; -// todo: remove on v5 -let hasLoggedDeprecatedLangTypescriptWarning = false; -let hasLoggedDeprecatedTypeWarning = false; - const LANGUAGE_DEFAULTS: Record = { sass: { indentedSyntax: true, @@ -90,27 +86,6 @@ export const getLanguage = (attributes: PreprocessorArgs['attributes']) => { } alias = attributes.lang; - - if (alias === 'typescript' && !hasLoggedDeprecatedLangTypescriptWarning) { - hasLoggedDeprecatedLangTypescriptWarning = true; - console.warn( - `[svelte-preprocess] Deprecation notice: using 'lang="typescript"' is no longer recommended and will be removed in the next major version. Please use 'lang="ts"' instead.`, - ); - } - } else if (attributes.type) { - // istanbul ignore if - if (typeof attributes.type !== 'string') { - throw new Error('type attribute must be string'); - } - - alias = attributes.type.replace(/^(text|application)\/(.*)$/, '$2'); - - if (attributes.type.includes('text/') && !hasLoggedDeprecatedTypeWarning) { - hasLoggedDeprecatedTypeWarning = true; - console.warn( - `[svelte-preprocess] Deprecation notice: using the "type" attribute is no longer recommended and will be removed in the next major version. Please use the "lang" attribute instead.`, - ); - } } else if ( typeof attributes.src === 'string' && isValidLocalPath(attributes.src) diff --git a/test/autoProcess/autoProcess.test.ts b/test/autoProcess/autoProcess.test.ts index 5e1a50ee..07086e6e 100644 --- a/test/autoProcess/autoProcess.test.ts +++ b/test/autoProcess/autoProcess.test.ts @@ -9,8 +9,6 @@ import { getLanguage } from '../../src/modules/language'; describe('detect - mimetype', () => { const MIMETYPES = [ - { type: 'application/ld+json', targetLanguage: 'ld+json' }, - { type: 'text/some-other', targetLanguage: 'some-other' }, { lang: 'stylus', targetLanguage: 'stylus' }, { src: '../foo.js', targetLanguage: 'javascript' }, { @@ -24,11 +22,9 @@ describe('detect - mimetype', () => { }, ]; - MIMETYPES.forEach(({ type, lang, src, targetLanguage }) => { - it(`should detect '${ - src ?? type ?? lang - }' as '${targetLanguage}'`, async () => { - const language = getLanguage({ type, lang, src } as any); + MIMETYPES.forEach(({ lang, src, targetLanguage }) => { + it(`should detect '${src ?? lang}' as '${targetLanguage}'`, async () => { + const language = getLanguage({ lang, src } as any); expect(language).toMatchObject({ lang: targetLanguage }); }); @@ -111,7 +107,7 @@ describe('options', () => { }); it('should NOT preprocess preserved languages', async () => { - const input = `
`; + const input = `
`; const opts = sveltePreprocess({ preserve: ['ld+json'], aliases: [['ld+json', 'structuredData']], @@ -123,7 +119,7 @@ describe('options', () => { const preprocessed = await preprocess(input, opts); expect(preprocessed.toString?.()).toContain( - ``, + ``, ); });