@front10/danger-plugins 0.11.0 → 2.0.0-alpha.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/danger-plugins.cjs.development.js +73 -275
- package/dist/danger-plugins.cjs.development.js.map +1 -1
- package/dist/danger-plugins.cjs.production.min.js +1 -1
- package/dist/danger-plugins.cjs.production.min.js.map +1 -1
- package/dist/danger-plugins.esm.js +73 -272
- package/dist/danger-plugins.esm.js.map +1 -1
- package/dist/index.d.ts +0 -2
- package/package.json +6 -7
- package/src/index.ts +0 -2
- package/src/plugin-bundle-size.ts +13 -6
- package/CHANGELOG.md +0 -13
- package/dist/plugin-eslint.d.ts +0 -5
- package/dist/plugin-jest.d.ts +0 -7
- package/src/plugin-eslint.ts +0 -53
- package/src/plugin-jest.ts +0 -202
|
@@ -1,10 +1,7 @@
|
|
|
1
|
-
import fs__default, { readFileSync, existsSync, readdirSync, lstatSync, readFile as readFile$1 } from 'fs';
|
|
2
|
-
import path__default, { relative, basename } from 'path';
|
|
3
|
-
import stripANSI from 'strip-ansi';
|
|
4
|
-
import { run } from 'jest';
|
|
5
|
-
import { CLIEngine } from 'eslint';
|
|
6
1
|
import NetlifyAPI from 'netlify';
|
|
7
|
-
import
|
|
2
|
+
import fs__default, { existsSync, readFileSync, readdirSync, lstatSync, readFile as readFile$1 } from 'fs';
|
|
3
|
+
import { fetch } from 'undici';
|
|
4
|
+
import path from 'path';
|
|
8
5
|
import zlib from 'zlib';
|
|
9
6
|
import { promisify } from 'util';
|
|
10
7
|
|
|
@@ -141,6 +138,24 @@ var runtime = (function (exports) {
|
|
|
141
138
|
var asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator";
|
|
142
139
|
var toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag";
|
|
143
140
|
|
|
141
|
+
function define(obj, key, value) {
|
|
142
|
+
Object.defineProperty(obj, key, {
|
|
143
|
+
value: value,
|
|
144
|
+
enumerable: true,
|
|
145
|
+
configurable: true,
|
|
146
|
+
writable: true
|
|
147
|
+
});
|
|
148
|
+
return obj[key];
|
|
149
|
+
}
|
|
150
|
+
try {
|
|
151
|
+
// IE 8 has a broken Object.defineProperty that only works on DOM objects.
|
|
152
|
+
define({}, "");
|
|
153
|
+
} catch (err) {
|
|
154
|
+
define = function(obj, key, value) {
|
|
155
|
+
return obj[key] = value;
|
|
156
|
+
};
|
|
157
|
+
}
|
|
158
|
+
|
|
144
159
|
function wrap(innerFn, outerFn, self, tryLocsList) {
|
|
145
160
|
// If outerFn provided and outerFn.prototype is a Generator, then outerFn.prototype instanceof Generator.
|
|
146
161
|
var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator;
|
|
@@ -193,9 +208,9 @@ var runtime = (function (exports) {
|
|
|
193
208
|
// This is a polyfill for %IteratorPrototype% for environments that
|
|
194
209
|
// don't natively support it.
|
|
195
210
|
var IteratorPrototype = {};
|
|
196
|
-
IteratorPrototype
|
|
211
|
+
define(IteratorPrototype, iteratorSymbol, function () {
|
|
197
212
|
return this;
|
|
198
|
-
};
|
|
213
|
+
});
|
|
199
214
|
|
|
200
215
|
var getProto = Object.getPrototypeOf;
|
|
201
216
|
var NativeIteratorPrototype = getProto && getProto(getProto(values([])));
|
|
@@ -209,18 +224,22 @@ var runtime = (function (exports) {
|
|
|
209
224
|
|
|
210
225
|
var Gp = GeneratorFunctionPrototype.prototype =
|
|
211
226
|
Generator.prototype = Object.create(IteratorPrototype);
|
|
212
|
-
GeneratorFunction.prototype =
|
|
213
|
-
|
|
214
|
-
GeneratorFunctionPrototype
|
|
215
|
-
|
|
227
|
+
GeneratorFunction.prototype = GeneratorFunctionPrototype;
|
|
228
|
+
define(Gp, "constructor", GeneratorFunctionPrototype);
|
|
229
|
+
define(GeneratorFunctionPrototype, "constructor", GeneratorFunction);
|
|
230
|
+
GeneratorFunction.displayName = define(
|
|
231
|
+
GeneratorFunctionPrototype,
|
|
232
|
+
toStringTagSymbol,
|
|
233
|
+
"GeneratorFunction"
|
|
234
|
+
);
|
|
216
235
|
|
|
217
236
|
// Helper for defining the .next, .throw, and .return methods of the
|
|
218
237
|
// Iterator interface in terms of a single ._invoke method.
|
|
219
238
|
function defineIteratorMethods(prototype) {
|
|
220
239
|
["next", "throw", "return"].forEach(function(method) {
|
|
221
|
-
prototype
|
|
240
|
+
define(prototype, method, function(arg) {
|
|
222
241
|
return this._invoke(method, arg);
|
|
223
|
-
};
|
|
242
|
+
});
|
|
224
243
|
});
|
|
225
244
|
}
|
|
226
245
|
|
|
@@ -239,9 +258,7 @@ var runtime = (function (exports) {
|
|
|
239
258
|
Object.setPrototypeOf(genFun, GeneratorFunctionPrototype);
|
|
240
259
|
} else {
|
|
241
260
|
genFun.__proto__ = GeneratorFunctionPrototype;
|
|
242
|
-
|
|
243
|
-
genFun[toStringTagSymbol] = "GeneratorFunction";
|
|
244
|
-
}
|
|
261
|
+
define(genFun, toStringTagSymbol, "GeneratorFunction");
|
|
245
262
|
}
|
|
246
263
|
genFun.prototype = Object.create(Gp);
|
|
247
264
|
return genFun;
|
|
@@ -323,9 +340,9 @@ var runtime = (function (exports) {
|
|
|
323
340
|
}
|
|
324
341
|
|
|
325
342
|
defineIteratorMethods(AsyncIterator.prototype);
|
|
326
|
-
AsyncIterator.prototype
|
|
343
|
+
define(AsyncIterator.prototype, asyncIteratorSymbol, function () {
|
|
327
344
|
return this;
|
|
328
|
-
};
|
|
345
|
+
});
|
|
329
346
|
exports.AsyncIterator = AsyncIterator;
|
|
330
347
|
|
|
331
348
|
// Note that simple async functions are implemented on top of
|
|
@@ -511,20 +528,20 @@ var runtime = (function (exports) {
|
|
|
511
528
|
// unified ._invoke helper method.
|
|
512
529
|
defineIteratorMethods(Gp);
|
|
513
530
|
|
|
514
|
-
Gp
|
|
531
|
+
define(Gp, toStringTagSymbol, "Generator");
|
|
515
532
|
|
|
516
533
|
// A Generator should always return itself as the iterator object when the
|
|
517
534
|
// @@iterator function is called on it. Some browsers' implementations of the
|
|
518
535
|
// iterator prototype chain incorrectly implement this, causing the Generator
|
|
519
536
|
// object to not be returned from this call. This ensures that doesn't happen.
|
|
520
537
|
// See https://github.com/facebook/regenerator/issues/274 for more details.
|
|
521
|
-
Gp
|
|
538
|
+
define(Gp, iteratorSymbol, function() {
|
|
522
539
|
return this;
|
|
523
|
-
};
|
|
540
|
+
});
|
|
524
541
|
|
|
525
|
-
Gp
|
|
542
|
+
define(Gp, "toString", function() {
|
|
526
543
|
return "[object Generator]";
|
|
527
|
-
};
|
|
544
|
+
});
|
|
528
545
|
|
|
529
546
|
function pushTryEntry(locs) {
|
|
530
547
|
var entry = { tryLoc: locs[0] };
|
|
@@ -843,250 +860,21 @@ try {
|
|
|
843
860
|
} catch (accidentalStrictMode) {
|
|
844
861
|
// This module should not be running in strict mode, so the above
|
|
845
862
|
// assignment should always work unless something is misconfigured. Just
|
|
846
|
-
// in case runtime.js accidentally runs in strict mode,
|
|
863
|
+
// in case runtime.js accidentally runs in strict mode, in modern engines
|
|
864
|
+
// we can explicitly access globalThis. In older engines we can escape
|
|
847
865
|
// strict mode using a global Function call. This could conceivably fail
|
|
848
866
|
// if a Content Security Policy forbids using Function, but in that case
|
|
849
867
|
// the proper solution is to fix the accidental strict mode problem. If
|
|
850
868
|
// you've misconfigured your bundler to force strict mode and applied a
|
|
851
869
|
// CSP to forbid Function, and you're not willing to fix either of those
|
|
852
870
|
// problems, please detail your unique predicament in a GitHub issue.
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
});
|
|
856
|
-
|
|
857
|
-
var jestSuccessFeedback = function jestSuccessFeedback(jsonResults, showSuccessMessage) {
|
|
858
|
-
if (!showSuccessMessage) {
|
|
859
|
-
// tslint:disable-next-line:no-console
|
|
860
|
-
console.log(":+1: Jest tests passed");
|
|
871
|
+
if (typeof globalThis === "object") {
|
|
872
|
+
globalThis.regeneratorRuntime = runtime;
|
|
861
873
|
} else {
|
|
862
|
-
|
|
874
|
+
Function("r", "regeneratorRuntime = r")(runtime);
|
|
863
875
|
}
|
|
864
|
-
};
|
|
865
|
-
|
|
866
|
-
function getUrl(file, line) {
|
|
867
|
-
var gitlab = danger.gitlab;
|
|
868
|
-
|
|
869
|
-
if (gitlab) {
|
|
870
|
-
var headSha = danger.gitlab.mr.diff_refs.head_sha;
|
|
871
|
-
var repoSlug = gitlab.metadata.repoSlug;
|
|
872
|
-
var baseUrl = "https://gitlab.com/" + repoSlug + "/-/blob";
|
|
873
|
-
return baseUrl + "/" + headSha + "/" + file + (line ? "#L" + line : "");
|
|
874
|
-
}
|
|
875
|
-
|
|
876
|
-
return "#";
|
|
877
|
-
}
|
|
878
|
-
|
|
879
|
-
var lineOfError = function lineOfError(msg, filePath) {
|
|
880
|
-
var filename = basename(filePath);
|
|
881
|
-
var restOfTrace = msg.split(filename, 2)[1];
|
|
882
|
-
return restOfTrace ? parseInt(restOfTrace.split(":")[1], 10) : null;
|
|
883
|
-
};
|
|
884
|
-
|
|
885
|
-
var sanitizeShortErrorMessage = function sanitizeShortErrorMessage(msg) {
|
|
886
|
-
if (msg.includes("does not match stored snapshot")) {
|
|
887
|
-
return "Snapshot has changed";
|
|
888
|
-
}
|
|
889
|
-
|
|
890
|
-
return msg.split(" at", 1)[0].trim().split("\n").splice(2).join("").replace(/\s\s+/g, " ").replace("Received:", ", received:").replace("., received", ", received").split("Difference:")[0];
|
|
891
|
-
}; // e.g. https://gitlab.com/carburo/danger/-/blob/802af5c0b057c4439ef465a75009f017423fbf98/simple.test.js#L6
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
var linkToTest = function linkToTest(file, msg, title) {
|
|
895
|
-
var line = lineOfError(msg, file);
|
|
896
|
-
return "<a href='" + getUrl(file, line) + "'>" + title + "</a>";
|
|
897
|
-
};
|
|
898
|
-
|
|
899
|
-
var assertionFailString = function assertionFailString(file, status) {
|
|
900
|
-
return "\n <li>\n " + linkToTest(file, status.failureMessages && status.failureMessages[0], status.title) + "\n <br/>\n " + sanitizeShortErrorMessage(status.failureMessages && stripANSI(status.failureMessages[0])) + "\n \n <details>\n <summary>Full message</summary>\n <pre><code>\n " + (status.failureMessages && stripANSI(status.failureMessages.join("\n"))) + "\n </code></pre>\n </details>\n </li>\n <br/>\n ";
|
|
901
|
-
};
|
|
902
|
-
|
|
903
|
-
var fileToFailString = function fileToFailString( // tslint:disable-next-line:no-shadowed-variable
|
|
904
|
-
path, failedAssertions) {
|
|
905
|
-
return "\n <b>:black_joker: FAIL</b> in " + path + "\n \n " + failedAssertions.map(function (a) {
|
|
906
|
-
return assertionFailString(path, a);
|
|
907
|
-
}).join("\n\n") + "\n ";
|
|
908
|
-
};
|
|
909
|
-
|
|
910
|
-
var presentErrors = function presentErrors(jsonResults) {
|
|
911
|
-
var failing = jsonResults.testResults.filter(function (tr) {
|
|
912
|
-
return tr.status === "failed";
|
|
913
|
-
});
|
|
914
|
-
failing.forEach(function (results) {
|
|
915
|
-
var relativeFilePath = relative(process.cwd(), results.name);
|
|
916
|
-
var failedAssertions = results.assertionResults.filter(function (r) {
|
|
917
|
-
return r.status === "failed";
|
|
918
|
-
});
|
|
919
|
-
var failMessage = fileToFailString(relativeFilePath, failedAssertions);
|
|
920
|
-
fail(failMessage);
|
|
921
|
-
});
|
|
922
|
-
};
|
|
923
|
-
|
|
924
|
-
function jest(_x) {
|
|
925
|
-
return _jest.apply(this, arguments);
|
|
926
|
-
}
|
|
927
|
-
|
|
928
|
-
function _jest() {
|
|
929
|
-
_jest = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee(config) {
|
|
930
|
-
var _config, _config$testResultsJs, testResultsJsonPath, _config$showSuccessMe, showSuccessMessage, _config$runJest, runJest, jsonFileContents, jsonResults;
|
|
931
|
-
|
|
932
|
-
return runtime_1.wrap(function _callee$(_context) {
|
|
933
|
-
while (1) {
|
|
934
|
-
switch (_context.prev = _context.next) {
|
|
935
|
-
case 0:
|
|
936
|
-
if (config === void 0) {
|
|
937
|
-
config = {};
|
|
938
|
-
}
|
|
939
|
-
|
|
940
|
-
_config = config, _config$testResultsJs = _config.testResultsJsonPath, testResultsJsonPath = _config$testResultsJs === void 0 ? "test-results.json" : _config$testResultsJs, _config$showSuccessMe = _config.showSuccessMessage, showSuccessMessage = _config$showSuccessMe === void 0 ? true : _config$showSuccessMe, _config$runJest = _config.runJest, runJest = _config$runJest === void 0 ? true : _config$runJest;
|
|
941
|
-
|
|
942
|
-
if (!runJest) {
|
|
943
|
-
_context.next = 11;
|
|
944
|
-
break;
|
|
945
|
-
}
|
|
946
|
-
|
|
947
|
-
_context.prev = 3;
|
|
948
|
-
_context.next = 6;
|
|
949
|
-
return run(["--outputFile", "test-results.json", "--json"]);
|
|
950
|
-
|
|
951
|
-
case 6:
|
|
952
|
-
_context.next = 11;
|
|
953
|
-
break;
|
|
954
|
-
|
|
955
|
-
case 8:
|
|
956
|
-
_context.prev = 8;
|
|
957
|
-
_context.t0 = _context["catch"](3);
|
|
958
|
-
console.error(_context.t0);
|
|
959
|
-
|
|
960
|
-
case 11:
|
|
961
|
-
_context.prev = 11;
|
|
962
|
-
jsonFileContents = readFileSync(testResultsJsonPath, "utf8");
|
|
963
|
-
jsonResults = JSON.parse(jsonFileContents);
|
|
964
|
-
|
|
965
|
-
if (!jsonResults.success) {
|
|
966
|
-
_context.next = 17;
|
|
967
|
-
break;
|
|
968
|
-
}
|
|
969
|
-
|
|
970
|
-
jestSuccessFeedback(jsonResults, showSuccessMessage);
|
|
971
|
-
return _context.abrupt("return");
|
|
972
|
-
|
|
973
|
-
case 17:
|
|
974
|
-
presentErrors(jsonResults);
|
|
975
|
-
_context.next = 24;
|
|
976
|
-
break;
|
|
977
|
-
|
|
978
|
-
case 20:
|
|
979
|
-
_context.prev = 20;
|
|
980
|
-
_context.t1 = _context["catch"](11);
|
|
981
|
-
// tslint:disable-next-line:no-console
|
|
982
|
-
console.error(_context.t1);
|
|
983
|
-
fail("[danger-plugin-jest] Could not read test results. Danger cannot pass or fail the build.");
|
|
984
|
-
|
|
985
|
-
case 24:
|
|
986
|
-
case "end":
|
|
987
|
-
return _context.stop();
|
|
988
|
-
}
|
|
989
|
-
}
|
|
990
|
-
}, _callee, null, [[3, 8], [11, 20]]);
|
|
991
|
-
}));
|
|
992
|
-
return _jest.apply(this, arguments);
|
|
993
|
-
}
|
|
994
|
-
|
|
995
|
-
function getFileContents(path) {
|
|
996
|
-
if (danger.gitlab) {
|
|
997
|
-
return danger.gitlab.utils.fileContents(path);
|
|
998
|
-
} else if (danger.github) {
|
|
999
|
-
return danger.github.utils.fileContents(path);
|
|
1000
|
-
}
|
|
1001
|
-
|
|
1002
|
-
return readFileSync(path, "utf8");
|
|
1003
|
-
}
|
|
1004
|
-
|
|
1005
|
-
function lintFile(_x, _x2, _x3) {
|
|
1006
|
-
return _lintFile.apply(this, arguments);
|
|
1007
|
-
}
|
|
1008
|
-
/**
|
|
1009
|
-
* Eslint your code with Danger
|
|
1010
|
-
*/
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
function _lintFile() {
|
|
1014
|
-
_lintFile = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee(linter, _config, path) {
|
|
1015
|
-
var contents, report;
|
|
1016
|
-
return runtime_1.wrap(function _callee$(_context) {
|
|
1017
|
-
while (1) {
|
|
1018
|
-
switch (_context.prev = _context.next) {
|
|
1019
|
-
case 0:
|
|
1020
|
-
_context.next = 2;
|
|
1021
|
-
return getFileContents(path);
|
|
1022
|
-
|
|
1023
|
-
case 2:
|
|
1024
|
-
contents = _context.sent;
|
|
1025
|
-
report = linter.executeOnText(contents, path);
|
|
1026
|
-
|
|
1027
|
-
if (report.results.length) {
|
|
1028
|
-
report.results[0].messages.map(function (msg) {
|
|
1029
|
-
if (msg.fatal) {
|
|
1030
|
-
fail("Fatal error linting " + path + " with eslint.");
|
|
1031
|
-
return undefined;
|
|
1032
|
-
}
|
|
1033
|
-
|
|
1034
|
-
if (msg.severity === 1 || msg.severity === 2) {
|
|
1035
|
-
var fn = {
|
|
1036
|
-
1: warn,
|
|
1037
|
-
2: fail
|
|
1038
|
-
}[msg.severity];
|
|
1039
|
-
fn(path + " line " + msg.line + " \u2013 " + msg.message + " (" + msg.ruleId + ")");
|
|
1040
|
-
}
|
|
1041
|
-
|
|
1042
|
-
return undefined;
|
|
1043
|
-
});
|
|
1044
|
-
}
|
|
1045
|
-
|
|
1046
|
-
case 5:
|
|
1047
|
-
case "end":
|
|
1048
|
-
return _context.stop();
|
|
1049
|
-
}
|
|
1050
|
-
}
|
|
1051
|
-
}, _callee);
|
|
1052
|
-
}));
|
|
1053
|
-
return _lintFile.apply(this, arguments);
|
|
1054
|
-
}
|
|
1055
|
-
|
|
1056
|
-
function eslint(_x4, _x5) {
|
|
1057
|
-
return _eslint.apply(this, arguments);
|
|
1058
|
-
}
|
|
1059
|
-
|
|
1060
|
-
function _eslint() {
|
|
1061
|
-
_eslint = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee2(config, extensions) {
|
|
1062
|
-
var allFiles, cli, filesToLint;
|
|
1063
|
-
return runtime_1.wrap(function _callee2$(_context2) {
|
|
1064
|
-
while (1) {
|
|
1065
|
-
switch (_context2.prev = _context2.next) {
|
|
1066
|
-
case 0:
|
|
1067
|
-
allFiles = danger.git.created_files.concat(danger.git.modified_files);
|
|
1068
|
-
cli = new CLIEngine({
|
|
1069
|
-
baseConfig: config
|
|
1070
|
-
}); // let eslint filter down to non-ignored, matching the extensions expected
|
|
1071
|
-
|
|
1072
|
-
filesToLint = allFiles.filter(function (f) {
|
|
1073
|
-
return !cli.isPathIgnored(f) && (extensions == null ? void 0 : extensions.some(function (ext) {
|
|
1074
|
-
return f.endsWith(ext);
|
|
1075
|
-
}));
|
|
1076
|
-
});
|
|
1077
|
-
return _context2.abrupt("return", Promise.all(filesToLint.map(function (f) {
|
|
1078
|
-
return lintFile(cli, config, f);
|
|
1079
|
-
})));
|
|
1080
|
-
|
|
1081
|
-
case 4:
|
|
1082
|
-
case "end":
|
|
1083
|
-
return _context2.stop();
|
|
1084
|
-
}
|
|
1085
|
-
}
|
|
1086
|
-
}, _callee2);
|
|
1087
|
-
}));
|
|
1088
|
-
return _eslint.apply(this, arguments);
|
|
1089
876
|
}
|
|
877
|
+
});
|
|
1090
878
|
|
|
1091
879
|
function deploySite(_ref) {
|
|
1092
880
|
var siteId = _ref.siteId,
|
|
@@ -1206,11 +994,11 @@ function generateMDTable(headers, body) {
|
|
|
1206
994
|
function getDefaultGetBundlesFn(bundlePrefix) {
|
|
1207
995
|
return function defaultGetBundlesFn(bundlesDir) {
|
|
1208
996
|
return readdirSync(bundlesDir).map(function (name) {
|
|
1209
|
-
return
|
|
997
|
+
return path.join(bundlesDir, name);
|
|
1210
998
|
}).filter(function (dirName) {
|
|
1211
999
|
return lstatSync(dirName).isDirectory();
|
|
1212
1000
|
}).map(function (dirName) {
|
|
1213
|
-
return
|
|
1001
|
+
return path.join(dirName, path.basename(dirName).replace(bundlePrefix, "") + ".bundle.js");
|
|
1214
1002
|
});
|
|
1215
1003
|
};
|
|
1216
1004
|
}
|
|
@@ -1243,7 +1031,7 @@ function bundleSizeResults(_ref) {
|
|
|
1243
1031
|
var jsFile = readFileSync(filePath);
|
|
1244
1032
|
var fileSizes = [jsFile].concat(gzip ? [zlib.gzipSync(jsFile)] : [], brotli ? [zlib.brotliCompressSync(jsFile)] : []);
|
|
1245
1033
|
return {
|
|
1246
|
-
filename: renameFn(
|
|
1034
|
+
filename: renameFn(path.basename(filePath)),
|
|
1247
1035
|
sizes: fileSizes.map(function (file) {
|
|
1248
1036
|
return file.length;
|
|
1249
1037
|
})
|
|
@@ -1283,7 +1071,7 @@ function bundleSize(_x) {
|
|
|
1283
1071
|
|
|
1284
1072
|
function _bundleSize() {
|
|
1285
1073
|
_bundleSize = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee(options) {
|
|
1286
|
-
var results, reportPath, _options$baseBundleJo, baseBundleJob, baseResults, projectId, authToken, targetBranch, baseBundlesUrl, baseBundles, diffHeaders, _baseResults, bundles, brotli, gzip, headers, body;
|
|
1074
|
+
var results, reportPath, _options$baseBundleJo, baseBundleJob, baseResults, projectId, authToken, targetBranch, baseBundlesUrl, baseResultsResponse, baseBundles, diffHeaders, _baseResults, bundles, brotli, gzip, headers, body;
|
|
1287
1075
|
|
|
1288
1076
|
return runtime_1.wrap(function _callee$(_context) {
|
|
1289
1077
|
while (1) {
|
|
@@ -1293,7 +1081,7 @@ function _bundleSize() {
|
|
|
1293
1081
|
reportPath = options.reportPath, _options$baseBundleJo = options.baseBundleJob, baseBundleJob = _options$baseBundleJo === void 0 ? "publish" : _options$baseBundleJo;
|
|
1294
1082
|
|
|
1295
1083
|
if (!reportPath) {
|
|
1296
|
-
_context.next =
|
|
1084
|
+
_context.next = 14;
|
|
1297
1085
|
break;
|
|
1298
1086
|
}
|
|
1299
1087
|
|
|
@@ -1306,22 +1094,35 @@ function _bundleSize() {
|
|
|
1306
1094
|
headers: {
|
|
1307
1095
|
"PRIVATE-TOKEN": authToken
|
|
1308
1096
|
}
|
|
1309
|
-
}).then(function (response) {
|
|
1310
|
-
return response.json();
|
|
1311
1097
|
});
|
|
1312
1098
|
|
|
1313
1099
|
case 9:
|
|
1100
|
+
baseResultsResponse = _context.sent;
|
|
1101
|
+
|
|
1102
|
+
if (!baseResultsResponse.ok) {
|
|
1103
|
+
_context.next = 14;
|
|
1104
|
+
break;
|
|
1105
|
+
}
|
|
1106
|
+
|
|
1107
|
+
_context.next = 13;
|
|
1108
|
+
return baseResultsResponse.json();
|
|
1109
|
+
|
|
1110
|
+
case 13:
|
|
1314
1111
|
baseResults = _context.sent;
|
|
1315
1112
|
|
|
1316
|
-
case
|
|
1113
|
+
case 14:
|
|
1317
1114
|
baseBundles = new Map();
|
|
1318
1115
|
diffHeaders = [];
|
|
1319
1116
|
|
|
1320
1117
|
if (baseResults) {
|
|
1321
1118
|
_baseResults = baseResults, bundles = _baseResults.bundles, brotli = _baseResults.brotli, gzip = _baseResults.gzip;
|
|
1322
|
-
|
|
1323
|
-
|
|
1324
|
-
|
|
1119
|
+
|
|
1120
|
+
if (bundles) {
|
|
1121
|
+
bundles.forEach(function (bundle) {
|
|
1122
|
+
baseBundles.set(bundle.filename, bundle.sizes);
|
|
1123
|
+
});
|
|
1124
|
+
}
|
|
1125
|
+
|
|
1325
1126
|
diffHeaders = ["Filesize diff"].concat(gzip ? ["Gzip diff"] : [], brotli ? ["Brotli diff"] : []);
|
|
1326
1127
|
}
|
|
1327
1128
|
|
|
@@ -1350,7 +1151,7 @@ function _bundleSize() {
|
|
|
1350
1151
|
});
|
|
1351
1152
|
markdown(["## Bundle size", generateMDTable(headers, body)].join("\n\n"));
|
|
1352
1153
|
|
|
1353
|
-
case
|
|
1154
|
+
case 20:
|
|
1354
1155
|
case "end":
|
|
1355
1156
|
return _context.stop();
|
|
1356
1157
|
}
|
|
@@ -1405,5 +1206,5 @@ function _lighthouse() {
|
|
|
1405
1206
|
return _lighthouse.apply(this, arguments);
|
|
1406
1207
|
}
|
|
1407
1208
|
|
|
1408
|
-
export { bundleSize, bundleSizeResults,
|
|
1209
|
+
export { bundleSize, bundleSizeResults, lighthouse, pluginNetlify as netlify };
|
|
1409
1210
|
//# sourceMappingURL=danger-plugins.esm.js.map
|