svelte-preprocess
Advanced tools
Comparing version 1.0.0 to 1.1.0
{ | ||
"name": "svelte-preprocess", | ||
"version": "1.0.0", | ||
"version": "1.1.0", | ||
"license": "MIT", | ||
@@ -5,0 +5,0 @@ "main": "src/index.js", |
@@ -19,3 +19,3 @@ # Svelte (Magical) Preprocess | ||
/** Pass options to the default preprocessor an object */ | ||
/** Pass options to the default preprocessor method */ | ||
stylus: { | ||
@@ -30,4 +30,24 @@ paths: ['node_modules'] | ||
return { code, map: null } | ||
} | ||
} | ||
}, | ||
/** Add a custom language preprocessor */ | ||
customLanguage(content, filename) { | ||
const { code, map } = require('custom-language-compiler')(content) | ||
return { code, map } | ||
} | ||
}, | ||
/** | ||
* Extend the default language alias dictionary. | ||
* Each entry must follow: ['alias', 'languageName'] | ||
*/ | ||
aliases: [ | ||
/** | ||
* Means | ||
* <... src="file.cst"> or | ||
* <... lang="cst"> or | ||
* <... type="text/cst"> | ||
* will be treated as the language 'customLanguage' | ||
*/ | ||
['cst', 'customLanguage'] | ||
], | ||
} | ||
@@ -34,0 +54,0 @@ |
const stripIndent = require('strip-indent') | ||
const { | ||
appendLanguageAliases, | ||
getLanguage, | ||
@@ -20,4 +21,10 @@ runPreprocessor, | ||
onBefore, | ||
languages = {} | ||
languages = {}, | ||
aliases = undefined | ||
} = {}) => { | ||
if(aliases) { | ||
appendLanguageAliases(aliases) | ||
} | ||
const getAssetParser = (targetLanguage) => { | ||
@@ -24,0 +31,0 @@ return ({ content = '', attributes, filename }) => { |
@@ -28,2 +28,4 @@ const { existsSync, readFileSync } = require('fs') | ||
exports.appendLanguageAliases = entries => entries.forEach(entry => LANG_DICT.set(...entry)) | ||
exports.getLanguage = (attributes, defaultLang) => { | ||
@@ -30,0 +32,0 @@ let lang |
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
10778
235
102