Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F101834193
StyleguidistOptionsPlugin.js
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Fri, Feb 14, 05:02
Size
1 KB
Mime Type
text/x-c++
Expires
Sun, Feb 16, 05:02 (2 d)
Engine
blob
Format
Raw Data
Handle
24238631
Attached To
rOACCT Open Access Compliance Check Tool (OACCT)
StyleguidistOptionsPlugin.js
View Options
"use strict"
;
exports
.
__esModule
=
true
;
exports
.
default
=
void
0
;
var
_webpack
=
_interopRequireDefault
(
require
(
"webpack"
));
function
_interopRequireDefault
(
obj
)
{
return
obj
&&
obj
.
__esModule
?
obj
:
{
default
:
obj
};
}
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
;
}
// Webpack plugin that makes Styleguidist config available for Styleguidist webpack loaders.
// It will be available as `this._styleguidist`.
//
// Other working in webpack 2 way is to use LoaderOptionsPlugin, but it has problems.
// See this issue for details: https://github.com/styleguidist/react-styleguidist/issues/328
class
StyleguidistOptionsPlugin
{
constructor
(
options
)
{
_defineProperty
(
this
,
"options"
,
void
0
);
_defineProperty
(
this
,
"pluginFunc"
,
(
context
,
module
)
=>
{
if
(
!
module
.
resource
)
{
return
;
}
context
.
_styleguidist
=
this
.
options
;
});
_defineProperty
(
this
,
"plugin"
,
compil
=>
{
_webpack
.
default
.
NormalModule
.
getCompilationHooks
(
compil
).
loader
.
tap
(
'StyleguidistOptionsPlugin'
,
this
.
pluginFunc
);
});
this
.
options
=
options
;
}
apply
(
compiler
)
{
compiler
.
hooks
.
compilation
.
tap
(
'StyleguidistOptionsPlugin'
,
this
.
plugin
);
}
}
exports
.
default
=
StyleguidistOptionsPlugin
;
Event Timeline
Log In to Comment