Update dependencies
This commit is contained in:
parent
686c644751
commit
6b024302d3
7679 changed files with 179547 additions and 183379 deletions
61
node_modules/rtlcss/lib/config.js
generated
vendored
61
node_modules/rtlcss/lib/config.js
generated
vendored
|
@ -1,7 +1,12 @@
|
|||
'use strict'
|
||||
var options
|
||||
var config = {}
|
||||
var corePlugin = require('./plugin.js')
|
||||
|
||||
let options
|
||||
const config = {}
|
||||
const corePlugin = require('./plugin.js')
|
||||
|
||||
function sort (arr) {
|
||||
return arr.sort((a, b) => a.priority - b.priority)
|
||||
}
|
||||
|
||||
function optionOrDefault (option, def) {
|
||||
return option in options ? options[option] : def
|
||||
|
@ -22,12 +27,13 @@ function main (opts, plugins, hooks) {
|
|||
addKey('processUrls', false)
|
||||
addKey('stringMap', [])
|
||||
addKey('useCalc', false)
|
||||
addKey('aliases', {})
|
||||
addKey('processEnv', true)
|
||||
|
||||
// default strings map
|
||||
if (Array.isArray(config.stringMap)) {
|
||||
var hasLeftRight, hasLtrRtl
|
||||
for (var x = 0; x < config.stringMap.length; x++) {
|
||||
var map = config.stringMap[x]
|
||||
let hasLeftRight, hasLtrRtl
|
||||
for (const map of config.stringMap) {
|
||||
if (hasLeftRight && hasLtrRtl) {
|
||||
break
|
||||
} else if (map.name === 'left-right') {
|
||||
|
@ -36,51 +42,62 @@ function main (opts, plugins, hooks) {
|
|||
hasLtrRtl = true
|
||||
}
|
||||
}
|
||||
|
||||
if (!hasLeftRight) {
|
||||
config.stringMap.push({
|
||||
'name': 'left-right',
|
||||
'priority': 100,
|
||||
'exclusive': false,
|
||||
'search': ['left', 'Left', 'LEFT'],
|
||||
'replace': ['right', 'Right', 'RIGHT'],
|
||||
'options': { 'scope': '*', 'ignoreCase': false }
|
||||
name: 'left-right',
|
||||
priority: 100,
|
||||
exclusive: false,
|
||||
search: ['left', 'Left', 'LEFT'],
|
||||
replace: ['right', 'Right', 'RIGHT'],
|
||||
options: { scope: '*', ignoreCase: false }
|
||||
})
|
||||
}
|
||||
|
||||
if (!hasLtrRtl) {
|
||||
config.stringMap.push({
|
||||
'name': 'ltr-rtl',
|
||||
'priority': 100,
|
||||
'exclusive': false,
|
||||
'search': ['ltr', 'Ltr', 'LTR'],
|
||||
'replace': ['rtl', 'Rtl', 'RTL'],
|
||||
'options': { 'scope': '*', 'ignoreCase': false }
|
||||
name: 'ltr-rtl',
|
||||
priority: 100,
|
||||
exclusive: false,
|
||||
search: ['ltr', 'Ltr', 'LTR'],
|
||||
replace: ['rtl', 'Rtl', 'RTL'],
|
||||
options: { scope: '*', ignoreCase: false }
|
||||
})
|
||||
}
|
||||
config.stringMap.sort(function (a, b) { return a.priority - b.priority })
|
||||
|
||||
sort(config.stringMap)
|
||||
}
|
||||
|
||||
// plugins
|
||||
config.plugins = []
|
||||
|
||||
if (Array.isArray(plugins)) {
|
||||
if (!plugins.some(function (plugin) { return plugin.name === 'rtlcss' })) {
|
||||
if (!plugins.some((plugin) => plugin.name === 'rtlcss')) {
|
||||
config.plugins.push(corePlugin)
|
||||
}
|
||||
|
||||
config.plugins = config.plugins.concat(plugins)
|
||||
} else if (!plugins || plugins.name !== 'rtlcss') {
|
||||
config.plugins.push(corePlugin)
|
||||
}
|
||||
config.plugins.sort(function (a, b) { return a.priority - b.priority })
|
||||
|
||||
sort(config.plugins)
|
||||
|
||||
// hooks
|
||||
config.hooks = { pre: function () {}, post: function () {} }
|
||||
config.hooks = {
|
||||
pre () {},
|
||||
post () {}
|
||||
}
|
||||
|
||||
if (typeof hooks.pre === 'function') {
|
||||
config.hooks.pre = hooks.pre
|
||||
}
|
||||
|
||||
if (typeof hooks.post === 'function') {
|
||||
config.hooks.post = hooks.post
|
||||
}
|
||||
|
||||
return config
|
||||
}
|
||||
|
||||
module.exports.configure = main
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue