Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function genVueLoaderCacheConfig() {
return api.genCacheConfig('vue-loader', {
'vue-loader': require('vue-loader/package.json').version,
/* eslint-disable-next-line node/no-extraneous-require */
'@vue/component-compiler-utils': require('@vue/component-compiler-utils/package.json')
.version,
'vue-template-compiler': require('vue-template-compiler/package.json')
.version,
testAttrsOptions: JSON.stringify(options),
})
}
}
.modules
.add('node_modules')
.add(api.resolve('node_modules'))
.add(resolveLocal('node_modules'))
webpackConfig.module
.noParse(/^(vue|vue-router|vuex|vuex-router-sync)$/)
// js is handled by cli-plugin-babel ---------------------------------------
// vue-loader --------------------------------------------------------------
const vueLoaderCacheConfig = api.genCacheConfig('vue-loader', {
'vue-loader': require('vue-loader/package.json').version,
/* eslint-disable-next-line node/no-extraneous-require */
'@vue/component-compiler-utils': require('@vue/component-compiler-utils/package.json').version,
'vue-template-compiler': require('vue-template-compiler/package.json').version
})
webpackConfig.module
.rule('vue')
.test(/\.vue$/)
.use('cache-loader')
.loader(require.resolve('cache-loader'))
.options(vueLoaderCacheConfig)
.end()
.use('vue-loader')
.loader(require.resolve('vue-loader'))
.options(Object.assign({
compilerOptions: {
whitespace: 'condense'
}
}, vueLoaderCacheConfig))
api.webpackUtils.getCacheOptions('vue-loader', () => ({
// Increse `key` to invalid cache
key: 0,
type,
'vue-loader': require('vue-loader/package.json').version,
'vue-template-compiler': require('vue-template-compiler/package.json')
.version
}))
)
import defaultParserInterface from '../utils/defaultParserInterface';
import pkg from 'vue-template-compiler/package.json';
const ID = 'vue';
export default {
...defaultParserInterface,
id: ID,
displayName: ID,
version: pkg.version,
homepage: pkg.homepage,
locationProps: new Set(['start', 'end']),
typeProps: new Set(['tag']),
loadParser(callback) {
require(['vue-template-compiler/browser'], callback);
},
parse(parser, code, options) {
return parser.compile(code, options).ast;
},
nodeToRange(node) {
if (node.type || node.name) {
return [node.start, node.end];
}