forked from dpwilhelmsen/new-relic-source-map-webpack-plugin
-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathuploadSourceMap.js
37 lines (34 loc) · 905 Bytes
/
uploadSourceMap.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
'use strict';
const { publishSourcemap } = require('@newrelic/publish-sourcemap');
module.exports = opts => assets => {
const {
staticAssetUrlBuilder,
publicPath,
outputPath,
applicationId,
apiKey,
url,
releaseName,
releaseId,
} = opts;
const javascriptUrl = staticAssetUrlBuilder(url, publicPath, assets.fileName);
const sourcemapPath = outputPath + '/' + assets.mapName;
return new Promise((resolve, reject) => {
publishSourcemap(
{
sourcemapPath,
javascriptUrl,
applicationId,
apiKey,
releaseName,
releaseId,
},
err => {
if (err) {
reject(err);
}
resolve(javascriptUrl);
}
);
});
};