Software: Apache/2.4.41 (Ubuntu). PHP/8.0.30 uname -a: Linux apirnd 5.4.0-204-generic #224-Ubuntu SMP Thu Dec 5 13:38:28 UTC 2024 x86_64 uid=33(www-data) gid=33(www-data) groups=33(www-data) Safe-mode: OFF (not secure) /var/www/html/queuepro/node_modules/browser-sync-webpack-plugin/lib/ drwxrwxr-x | |
| Viewing file: Select action/file-type: const browserSync = require('browser-sync')
const getCssOnlyEmittedAssetsNames = require('./getCssOnlyEmittedAssetsNames')
const defaultPluginOptions = {
reload: true,
name: 'bs-webpack-plugin',
callback: undefined,
injectCss: false
}
class BrowserSyncPlugin {
constructor (browserSyncOptions, pluginOptions) {
this.browserSyncOptions = Object.assign({}, browserSyncOptions)
this.options = Object.assign({}, defaultPluginOptions, pluginOptions)
this.browserSync = browserSync.create(this.options.name)
this.isWebpackWatching = false
this.isBrowserSyncRunning = false
}
apply (compiler) {
const watchRunCallback = () => {
this.isWebpackWatching = true
}
const compilationCallback = () => {
if (this.isBrowserSyncRunning && this.browserSyncOptions.notify) {
this.browserSync.notify('Rebuilding...')
}
}
const doneCallback = stats => {
if (!this.isWebpackWatching) {
return
}
if (!this.isBrowserSyncRunning) {
this.browserSync.init(this.browserSyncOptions, this.options.callback)
this.isBrowserSyncRunning = true
}
if (this.options.reload) {
this.browserSync.reload(this.options.injectCss && getCssOnlyEmittedAssetsNames(stats))
}
}
if (typeof compiler.hooks !== 'undefined') {
compiler.hooks.watchRun.tap(BrowserSyncPlugin.name, watchRunCallback)
compiler.hooks.compilation.tap(BrowserSyncPlugin.name, compilationCallback)
compiler.hooks.done.tap(BrowserSyncPlugin.name, doneCallback)
} else {
compiler.plugin('watch-run', (watching, callback) => {
watchRunCallback()
callback(null, null)
})
compiler.plugin('compilation', compilationCallback)
compiler.plugin('done', doneCallback)
}
}
}
module.exports = BrowserSyncPlugin
|
:: Command execute :: | |
--[ c99shell v. 2.5 [PHP 8 Update] [24.05.2025] | Generation time: 0.0081 ]-- |