From b71db9f6e8278cedf999e6d858a9b38a2809b00a Mon Sep 17 00:00:00 2001 From: Non <19non91@gmail.com> Date: Sat, 16 Jan 2021 08:31:59 +0200 Subject: [PATCH 01/11] Remove deprecation warnings and tests for them (tests fail) --- index.js | 20 +------------------- test/loader.spec.js | 29 ----------------------------- 2 files changed, 1 insertion(+), 48 deletions(-) diff --git a/index.js b/index.js index 0d8a171e..0b51125f 100644 --- a/index.js +++ b/index.js @@ -20,23 +20,6 @@ function normalize(compiled) { return { js, css, ast: compiled.ast, warnings: compiled.warnings || compiled.stats.warnings || [] }; } -const warned = {}; -function deprecatePreprocessOptions(options) { - const preprocessOptions = {}; - - ['markup', 'style', 'script'].forEach(kind => { - if (options[kind]) { - if (!warned[kind]) { - console.warn(`[svelte-loader] DEPRECATION: options.${kind} is now options.preprocess.${kind}`); - warned[kind] = true; - } - preprocessOptions[kind] = options[kind]; - } - }); - - options.preprocess = options.preprocess || preprocessOptions; -} - const virtualModules = new Map(); let index = 0; @@ -65,8 +48,7 @@ module.exports = function(source, map) { const handleWarning = warning => this.emitWarning(new Error(warning)); - deprecatePreprocessOptions(options); - options.preprocess.filename = compileOptions.filename; + options.preprocess = { filename: compileOptions.filename }; preprocess(source, options.preprocess).then(processed => { if (processed.dependencies && this.addDependency) { diff --git a/test/loader.spec.js b/test/loader.spec.js index a23ad919..d634606c 100644 --- a/test/loader.spec.js +++ b/test/loader.spec.js @@ -270,35 +270,6 @@ describe('loader', () => { }); }); - describe('deprecations', () => { - it('should warn on options.style', done => { - const { warn } = console; - const warnings = []; - - console.warn = msg => { - warnings.push(msg); - }; - - testLoader( - 'test/fixtures/style-valid.html', - (err, code, map) => { - expect(code).to.contain('50px'); - expect(warnings).to.deep.equal([ - '[svelte-loader] DEPRECATION: options.style is now options.preprocess.style' - ]); - console.warn = warn; - }, - { - style: ({ content }) => { - return { - code: content.replace(/\$size/gi, '50px') - }; - } - } - )(done); - }); - }); - describe('hotReload', () => { it( 'should configure hotReload=false (default)', From 0570c91afb07a27a1d3c0ed43aa4c109fa5754e2 Mon Sep 17 00:00:00 2001 From: Adam Green Date: Thu, 19 Nov 2020 21:41:29 +0000 Subject: [PATCH 02/11] Updated readme to reflect the new minicss plugin --- README.md | 25 +++++++++++++++++++------ 1 file changed, 19 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index f52466c3..edec6ca0 100644 --- a/README.md +++ b/README.md @@ -61,9 +61,11 @@ Webpack's [`resolve.mainFields`](https://webpack.js.org/configuration/resolve/#r If your Svelte components contain `