This repository has been archived by the owner on Oct 31, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
54 lines (50 loc) · 1.58 KB
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
const mix = require('laravel-mix');
class LaravelMixDump {
/**
* The optional name to be used when called by Mix.
* Defaults to the class name, lowercased.
*
* Ex: mix.example();
*
* @return {String|Array}
*/
name() {
return ['dump', 'dd'];
}
/**
* Register the component.
*
* When your component is called, all user parameters
* will be passed to this method.
*
* Ex: register(src, output) {}
* Ex: mix.yourPlugin('src/path', 'output/path');
*
* @param {object} userOptions
* @param {object} die
* @return {void}
*
*/
register(userOptions, die) {
this.dumpDepth = typeof userOptions == 'number' ? userOptions : userOptions.depth || 1;
this.die = ((typeof userOptions == 'object') && (typeof(userOptions.die) !== undefined)) ? userOptions.die : ((typeof die == 'boolean') ? die : die.die || true);
}
/**
* Boot the component. This method is triggered after the
* user's webpack.mix.js file has executed.
*/
boot() {
console.log("WebpackConfig:");
console.log("-------------- \n");
console.dir(Config, {depth: 1});
console.log("----------------------------------------------- \n");
console.log("Mix Object:");
console.log("------------- \n");
console.dir(Mix, {depth: this.dumpDepth});
console.log("----------------------------------------------- \n");
if (this.die) {
process.exit(0);
}
}
}
mix.extend(['dump', 'dd'], new LaravelMixDump());