Socket
Socket
Sign inDemoInstall

svelte-preprocess

Package Overview
Dependencies
Maintainers
1
Versions
174
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

svelte-preprocess - npm Package Compare versions

Comparing version 1.0.0 to 1.1.0

2

package.json
{
"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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc