1 | "use strict";
|
2 |
|
3 | exports.__esModule = true;
|
4 | exports.default = void 0;
|
5 |
|
6 | var _webpack = _interopRequireDefault(require("webpack"));
|
7 |
|
8 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
9 |
|
10 | function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
11 |
|
12 |
|
13 |
|
14 |
|
15 |
|
16 |
|
17 | class StyleguidistOptionsPlugin {
|
18 | constructor(options) {
|
19 | _defineProperty(this, "options", void 0);
|
20 |
|
21 | _defineProperty(this, "pluginFunc", (context, module) => {
|
22 | if (!module.resource) {
|
23 | return;
|
24 | }
|
25 |
|
26 | context._styleguidist = this.options;
|
27 | });
|
28 |
|
29 | _defineProperty(this, "plugin", compil => {
|
30 |
|
31 |
|
32 |
|
33 | if ('NormalModule' in _webpack.default) {
|
34 |
|
35 | _webpack.default.NormalModule.getCompilationHooks(compil).loader.tap('StyleguidistOptionsPlugin', this.pluginFunc);
|
36 |
|
37 | return;
|
38 | }
|
39 |
|
40 |
|
41 | compil.hooks.normalModuleLoader.tap('StyleguidistOptionsPlugin', this.pluginFunc);
|
42 | });
|
43 |
|
44 | this.options = options;
|
45 | }
|
46 |
|
47 | apply(compiler) {
|
48 | compiler.hooks.compilation.tap('StyleguidistOptionsPlugin', this.plugin);
|
49 | }
|
50 |
|
51 | }
|
52 |
|
53 | exports.default = StyleguidistOptionsPlugin; |
\ | No newline at end of file |