StackGenVis: Alignment of Data, Algorithms, and Models for Stacking Ensemble Learning Using Performance Metrics https://doi.org/10.1109/TVCG.2020.3030352
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
StackGenVis/frontend/node_modules/vuetify-loader/progressive-loader/module.js

37 lines
933 B

4 years ago
const { hyphenate } = require('../lib/util')
module.exports = {
postTransformNode: transform
}
// Modified from @vue/component-compiler-utils
function transform(node) {
const tags = ['v-img', 'v-card-media', 'v-carousel-item']
if (tags.includes(hyphenate(node.tag)) && node.attrs) {
const attr = node.attrs.find(a => a.name === 'src')
if (!attr) return
const value = attr.value
// only transform static URLs
if (value.charAt(0) === '"' && value.charAt(value.length - 1) === '"') {
attr.value = urlToRequire(value.slice(1, -1))
}
}
return node
}
function urlToRequire(url) {
const firstChar = url.charAt(0)
if (firstChar === '.' || firstChar === '~' || firstChar === '@') {
if (firstChar === '~') {
const secondChar = url.charAt(1)
url = url.slice(secondChar === '/' ? 2 : 1)
}
return `require("${url}?vuetify-preload")`
} else {
return `"${url}"`
}
}