svelte-preprocess
Advanced tools
Comparing version 2.3.0 to 2.3.1
{ | ||
"name": "svelte-preprocess", | ||
"version": "2.3.0", | ||
"version": "2.3.1", | ||
"license": "MIT", | ||
@@ -5,0 +5,0 @@ "main": "src/index.js", |
@@ -13,2 +13,3 @@ const stripIndent = require('strip-indent') | ||
sliceReplace, | ||
aliasOverrides, | ||
} = require('./utils.js') | ||
@@ -19,2 +20,4 @@ | ||
module.exports = ({ onBefore, transformers = {}, aliases } = {}) => { | ||
const optionsCache = {} | ||
if (aliases && aliases.length) { | ||
@@ -28,11 +31,18 @@ addLanguageAlias(aliases) | ||
} | ||
let opts = transformers[lang] || {} | ||
if (lang !== alias && typeof transformerOpts !== 'function') { | ||
opts = { | ||
...opts, | ||
...(transformers[alias] || {}), | ||
if (typeof optionsCache[alias] === 'undefined') { | ||
let opts = transformers[lang] || {} | ||
if (lang !== alias) { | ||
opts = { | ||
...opts, | ||
...(aliasOverrides[alias] || {}), | ||
...(transformers[alias] || {}), | ||
} | ||
} | ||
optionsCache[alias] = opts | ||
} | ||
return opts | ||
return optionsCache[alias] | ||
} | ||
@@ -57,3 +67,6 @@ | ||
if (transformers[lang] === false) { | ||
if ( | ||
transformers[lang] === false || | ||
(lang !== alias && transformers[alias] === false) | ||
) { | ||
throwUnsupportedError(alias, filename) | ||
@@ -60,0 +73,0 @@ } |
@@ -18,2 +18,8 @@ const { readFileSync } = require('fs') | ||
exports.aliasOverrides = { | ||
sass: { | ||
indentedSyntax: true, | ||
}, | ||
} | ||
exports.throwError = msg => { | ||
@@ -20,0 +26,0 @@ throw new Error(`[svelte-preprocess] ${msg}`) |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
19827
328