parent
fb2e9d9e88
commit
137a6c1b61
|
@ -536,6 +536,7 @@ async function createProjectService(
|
||||||
let userPurge
|
let userPurge
|
||||||
let userVariants: any
|
let userVariants: any
|
||||||
let userMode: any
|
let userMode: any
|
||||||
|
let userPlugins: any
|
||||||
let hook = new Hook(fs.realpathSync(state.configPath), (exports) => {
|
let hook = new Hook(fs.realpathSync(state.configPath), (exports) => {
|
||||||
userSeperator = dlv(exports, sepLocation)
|
userSeperator = dlv(exports, sepLocation)
|
||||||
if (typeof userSeperator !== 'string') {
|
if (typeof userSeperator !== 'string') {
|
||||||
|
@ -560,25 +561,33 @@ async function createProjectService(
|
||||||
|
|
||||||
// inject JIT `matchUtilities` function
|
// inject JIT `matchUtilities` function
|
||||||
if (Array.isArray(exports.plugins)) {
|
if (Array.isArray(exports.plugins)) {
|
||||||
for (let index in exports.plugins) {
|
userPlugins = exports.plugins
|
||||||
let plugin = exports.plugins[index]
|
exports.plugins = exports.plugins.map((plugin) => {
|
||||||
if (typeof plugin === 'function') {
|
if (typeof plugin === 'function') {
|
||||||
exports.plugins[index] = (...args) => {
|
let newPlugin = (...args) => {
|
||||||
if (!args[0].matchUtilities) {
|
if (!args[0].matchUtilities) {
|
||||||
args[0].matchUtilities = () => {}
|
args[0].matchUtilities = () => {}
|
||||||
}
|
}
|
||||||
return plugin(...args)
|
return plugin(...args)
|
||||||
}
|
}
|
||||||
} else if (plugin.handler) {
|
// @ts-ignore
|
||||||
let oldHandler = plugin.handler
|
newPlugin.__intellisense_cache_bust = Math.random()
|
||||||
plugin.handler = (...args) => {
|
return newPlugin
|
||||||
|
}
|
||||||
|
if (plugin.handler) {
|
||||||
|
return {
|
||||||
|
...plugin,
|
||||||
|
handler: (...args) => {
|
||||||
if (!args[0].matchUtilities) {
|
if (!args[0].matchUtilities) {
|
||||||
args[0].matchUtilities = () => {}
|
args[0].matchUtilities = () => {}
|
||||||
}
|
}
|
||||||
return oldHandler(...args)
|
return plugin.handler(...args)
|
||||||
}
|
},
|
||||||
|
__intellisense_cache_bust: Math.random(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return plugin
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
return exports
|
return exports
|
||||||
|
@ -640,6 +649,9 @@ async function createProjectService(
|
||||||
if (typeof userMode !== 'undefined') {
|
if (typeof userMode !== 'undefined') {
|
||||||
config.mode = userMode
|
config.mode = userMode
|
||||||
}
|
}
|
||||||
|
if (typeof userPlugins !== 'undefined') {
|
||||||
|
config.plugins = userPlugins
|
||||||
|
}
|
||||||
|
|
||||||
if (state.dependencies) {
|
if (state.dependencies) {
|
||||||
watcher.unwatch(state.dependencies)
|
watcher.unwatch(state.dependencies)
|
||||||
|
|
Loading…
Reference in New Issue