1
0
mirror of https://github.com/twbs/bootstrap.git synced 2025-08-19 03:41:19 +02:00

move util in a util folder with the sanitizer

This commit is contained in:
Johann-S
2019-02-23 00:37:55 +02:00
committed by XhmikosR
parent 8affe84c72
commit 8a37045b79
34 changed files with 559 additions and 589 deletions

View File

@@ -41,23 +41,25 @@ const bsPlugins = {
ScrollSpy: path.resolve(__dirname, '../js/src/scrollspy.js'),
Tab: path.resolve(__dirname, '../js/src/tab.js'),
Toast: path.resolve(__dirname, '../js/src/toast.js'),
Tooltip: path.resolve(__dirname, '../js/src/tooltip.js'),
Util: path.resolve(__dirname, '../js/src/util.js')
Tooltip: path.resolve(__dirname, '../js/src/tooltip.js')
}
const rootPath = TEST ? '../js/coverage/dist/' : '../js/dist/'
if (TEST) {
bsPlugins.Util = path.resolve(__dirname, '../js/src/util/index.js')
bsPlugins.Sanitizer = path.resolve(__dirname, '../js/src/util/sanitizer.js')
}
const defaultPluginConfig = {
external: [
bsPlugins.Data,
bsPlugins.EventHandler,
bsPlugins.SelectorEngine,
bsPlugins.Util
bsPlugins.SelectorEngine
],
globals: {
[bsPlugins.Data]: 'Data',
[bsPlugins.EventHandler]: 'EventHandler',
[bsPlugins.SelectorEngine]: 'SelectorEngine',
[bsPlugins.Util]: 'Util'
[bsPlugins.SelectorEngine]: 'SelectorEngine'
}
}
@@ -65,7 +67,9 @@ function getConfigByPluginKey(pluginKey) {
if (
pluginKey === 'Data' ||
pluginKey === 'Manipulator' ||
pluginKey === 'Util'
pluginKey === 'Polyfill' ||
pluginKey === 'Util' ||
pluginKey === 'Sanitizer'
) {
return {
external: [],
@@ -76,21 +80,10 @@ function getConfigByPluginKey(pluginKey) {
if (pluginKey === 'EventHandler' || pluginKey === 'SelectorEngine') {
return {
external: [
bsPlugins.Polyfill,
bsPlugins.Util
bsPlugins.Polyfill
],
globals: {
[bsPlugins.Polyfill]: 'Polyfill',
[bsPlugins.Util]: 'Util'
}
}
}
if (pluginKey === 'Polyfill') {
return {
external: [bsPlugins.Util],
globals: {
[bsPlugins.Util]: 'Util'
[bsPlugins.Polyfill]: 'Polyfill'
}
}
}
@@ -125,14 +118,12 @@ function getConfigByPluginKey(pluginKey) {
external: [
bsPlugins.Data,
bsPlugins.SelectorEngine,
bsPlugins.Tooltip,
bsPlugins.Util
bsPlugins.Tooltip
],
globals: {
[bsPlugins.Data]: 'Data',
[bsPlugins.SelectorEngine]: 'SelectorEngine',
[bsPlugins.Tooltip]: 'Tooltip',
[bsPlugins.Util]: 'Util'
[bsPlugins.Tooltip]: 'Tooltip'
}
}
}
@@ -142,14 +133,12 @@ function getConfigByPluginKey(pluginKey) {
external: [
bsPlugins.Data,
bsPlugins.EventHandler,
bsPlugins.Manipulator,
bsPlugins.Util
bsPlugins.Manipulator
],
globals: {
[bsPlugins.Data]: 'Data',
[bsPlugins.EventHandler]: 'EventHandler',
[bsPlugins.Manipulator]: 'Manipulator',
[bsPlugins.Util]: 'Util'
[bsPlugins.Manipulator]: 'Manipulator'
}
}
}
@@ -161,14 +150,28 @@ function build(plugin) {
const config = getConfigByPluginKey(plugin)
const external = config.external
const globals = config.globals
let pluginPath = rootPath
const pluginPath = [
const utilObjects = [
'Util',
'Sanitizer'
]
const domObjects = [
'Data',
'EventHandler',
'Manipulator',
'Polyfill',
'SelectorEngine'
].includes(plugin) ? `${rootPath}/dom/` : rootPath
]
if (utilObjects.includes(plugin)) {
pluginPath = `${rootPath}/util/`
}
if (domObjects.includes(plugin)) {
pluginPath = `${rootPath}/dom/`
}
const pluginFilename = `${plugin.toLowerCase()}.js`