-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
30 lines (26 loc) · 704 Bytes
/
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
const yn = require('yn');
const {
processAccordingFoundShebangs,
processAccordingConfiguration,
} = require('./process');
const { getBundles } = require('./utils');
const { getConfig } = require('./config');
module.exports = (bundler, dynamicConfig = null) => {
if (
'PARCEL_PLUGIN_SHEBANG' in process.env &&
!yn(process.env.PARCEL_PLUGIN_SHEBANG)
) {
return false;
}
bundler.on('bundled', (bundle) => {
const bundles = getBundles(bundle);
const conf = getConfig(dynamicConfig);
if (bundles.length) {
processAccordingFoundShebangs(bundles);
if (conf.length) {
processAccordingConfiguration(bundles, conf);
}
}
});
return true;
};