babel-plugin-prismjs
Advanced tools
Comparing version 2.0.0 to 2.0.1
@@ -28,2 +28,6 @@ "use strict"; | ||
var isPlugin = function isPlugin(dep) { | ||
return _components["default"].plugins[dep] != null; | ||
}; | ||
var getNoCSS = function getNoCSS(type, name) { | ||
@@ -44,2 +48,3 @@ return _components["default"][type][name].noCSS; | ||
var getPluginPath = getPath('plugins'); | ||
var getLanguagePath = getPath('languages'); | ||
@@ -56,6 +61,7 @@ var _default = function _default() { | ||
return [].concat(_toConsumableArray((0, _dependencies["default"])(_components["default"], languages).getIds().map(getPath('languages'))), _toConsumableArray((0, _dependencies["default"])(_components["default"], plugins).getIds().reduce(function (deps, dep) { | ||
var add = [getPluginPath(dep)]; | ||
return [].concat(_toConsumableArray((0, _dependencies["default"])(_components["default"], [].concat(_toConsumableArray(languages), _toConsumableArray(plugins))).getIds().reduce(function (deps, dep) { | ||
// Plugins can have language dependencies. | ||
var add = [isPlugin(dep) ? getPluginPath(dep) : getLanguagePath(dep)]; | ||
if (css && !getNoCSS('plugins', dep)) { | ||
if (css && isPlugin(dep) && !getNoCSS('plugins', dep)) { | ||
add.unshift(getPluginPath(dep) + '.css'); | ||
@@ -62,0 +68,0 @@ } |
{ | ||
"name": "babel-plugin-prismjs", | ||
"version": "2.0.0", | ||
"version": "2.0.1", | ||
"description": "A babel plugin to use PrismJS with standard bundlers.", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
@@ -7,2 +7,3 @@ import config from 'prismjs/components.js'; | ||
const isPlugin = dep => config.plugins[dep] != null; | ||
const getNoCSS = (type, name) => config[type][name].noCSS; | ||
@@ -21,9 +22,10 @@ | ||
const getPluginPath = getPath('plugins'); | ||
const getLanguagePath = getPath('languages'); | ||
export default ({ languages = [], plugins = [], theme, css = false } = {}) => [ | ||
...getLoader(config, languages).getIds().map(getPath('languages')), | ||
...getLoader(config, plugins).getIds().reduce((deps, dep) => { | ||
const add = [getPluginPath(dep)]; | ||
...getLoader(config, [...languages, ...plugins]).getIds().reduce((deps, dep) => { | ||
// Plugins can have language dependencies. | ||
const add = [isPlugin(dep) ? getPluginPath(dep) : getLanguagePath(dep)]; | ||
if (css && !getNoCSS('plugins', dep)) { | ||
if (css && isPlugin(dep) && !getNoCSS('plugins', dep)) { | ||
add.unshift(getPluginPath(dep) + '.css'); | ||
@@ -30,0 +32,0 @@ } |
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
7963
124