http-proxy-middleware 0.17.1 → 0.17.4

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.
Files changed (51) hide show
  1. package/CHANGELOG.md +13 -0
  2. package/README.md +22 -8
  3. package/lib/handlers.js +13 -1
  4. package/lib/index.js +17 -6
  5. package/lib/logger.js +2 -2
  6. package/package.json +13 -9
  7. package/.editorconfig +0 -18
  8. package/.jscsrc +0 -8
  9. package/.npmignore +0 -2
  10. package/.travis.yml +0 -16
  11. package/CONTRIBUTING.md +0 -61
  12. package/ISSUE_TEMPLATE.md +0 -21
  13. package/coverage/coverage.json +0 -1
  14. package/coverage/lcov-report/base.css +0 -213
  15. package/coverage/lcov-report/http-proxy-middleware/index.html +0 -93
  16. package/coverage/lcov-report/http-proxy-middleware/index.js.html +0 -80
  17. package/coverage/lcov-report/http-proxy-middleware/lib/config-factory.js.html +0 -443
  18. package/coverage/lcov-report/http-proxy-middleware/lib/context-matcher.js.html +0 -347
  19. package/coverage/lcov-report/http-proxy-middleware/lib/handlers.js.html +0 -251
  20. package/coverage/lcov-report/http-proxy-middleware/lib/index.html +0 -171
  21. package/coverage/lcov-report/http-proxy-middleware/lib/index.js.html +0 -437
  22. package/coverage/lcov-report/http-proxy-middleware/lib/logger.js.html +0 -539
  23. package/coverage/lcov-report/http-proxy-middleware/lib/path-rewriter.js.html +0 -281
  24. package/coverage/lcov-report/http-proxy-middleware/lib/router.js.html +0 -224
  25. package/coverage/lcov-report/index.html +0 -106
  26. package/coverage/lcov-report/prettify.css +0 -1
  27. package/coverage/lcov-report/prettify.js +0 -1
  28. package/coverage/lcov-report/sort-arrow-sprite.png +0 -0
  29. package/coverage/lcov-report/sorter.js +0 -158
  30. package/coverage/lcov.info +0 -647
  31. package/examples/README.md +0 -33
  32. package/examples/browser-sync/index.js +0 -29
  33. package/examples/connect/index.js +0 -29
  34. package/examples/express/index.js +0 -28
  35. package/examples/websocket/index.html +0 -96
  36. package/examples/websocket/index.js +0 -41
  37. package/recipes/README.md +0 -110
  38. package/recipes/basic.md +0 -32
  39. package/recipes/context-matching.md +0 -99
  40. package/recipes/corporate-proxy.md +0 -21
  41. package/recipes/delay.md +0 -37
  42. package/recipes/logLevel.md +0 -40
  43. package/recipes/logProvider.md +0 -77
  44. package/recipes/modify-post.md +0 -74
  45. package/recipes/pathRewrite.md +0 -93
  46. package/recipes/proxy-events.md +0 -74
  47. package/recipes/router.md +0 -83
  48. package/recipes/servers.md +0 -252
  49. package/recipes/shorthand.md +0 -63
  50. package/recipes/virtual-hosts.md +0 -18
  51. package/recipes/websocket.md +0 -41
@@ -1,158 +0,0 @@
1
- var addSorting = (function () {
2
- "use strict";
3
- var cols,
4
- currentSort = {
5
- index: 0,
6
- desc: false
7
- };
8
-
9
- // returns the summary table element
10
- function getTable() { return document.querySelector('.coverage-summary'); }
11
- // returns the thead element of the summary table
12
- function getTableHeader() { return getTable().querySelector('thead tr'); }
13
- // returns the tbody element of the summary table
14
- function getTableBody() { return getTable().querySelector('tbody'); }
15
- // returns the th element for nth column
16
- function getNthColumn(n) { return getTableHeader().querySelectorAll('th')[n]; }
17
-
18
- // loads all columns
19
- function loadColumns() {
20
- var colNodes = getTableHeader().querySelectorAll('th'),
21
- colNode,
22
- cols = [],
23
- col,
24
- i;
25
-
26
- for (i = 0; i < colNodes.length; i += 1) {
27
- colNode = colNodes[i];
28
- col = {
29
- key: colNode.getAttribute('data-col'),
30
- sortable: !colNode.getAttribute('data-nosort'),
31
- type: colNode.getAttribute('data-type') || 'string'
32
- };
33
- cols.push(col);
34
- if (col.sortable) {
35
- col.defaultDescSort = col.type === 'number';
36
- colNode.innerHTML = colNode.innerHTML + '<span class="sorter"></span>';
37
- }
38
- }
39
- return cols;
40
- }
41
- // attaches a data attribute to every tr element with an object
42
- // of data values keyed by column name
43
- function loadRowData(tableRow) {
44
- var tableCols = tableRow.querySelectorAll('td'),
45
- colNode,
46
- col,
47
- data = {},
48
- i,
49
- val;
50
- for (i = 0; i < tableCols.length; i += 1) {
51
- colNode = tableCols[i];
52
- col = cols[i];
53
- val = colNode.getAttribute('data-value');
54
- if (col.type === 'number') {
55
- val = Number(val);
56
- }
57
- data[col.key] = val;
58
- }
59
- return data;
60
- }
61
- // loads all row data
62
- function loadData() {
63
- var rows = getTableBody().querySelectorAll('tr'),
64
- i;
65
-
66
- for (i = 0; i < rows.length; i += 1) {
67
- rows[i].data = loadRowData(rows[i]);
68
- }
69
- }
70
- // sorts the table using the data for the ith column
71
- function sortByIndex(index, desc) {
72
- var key = cols[index].key,
73
- sorter = function (a, b) {
74
- a = a.data[key];
75
- b = b.data[key];
76
- return a < b ? -1 : a > b ? 1 : 0;
77
- },
78
- finalSorter = sorter,
79
- tableBody = document.querySelector('.coverage-summary tbody'),
80
- rowNodes = tableBody.querySelectorAll('tr'),
81
- rows = [],
82
- i;
83
-
84
- if (desc) {
85
- finalSorter = function (a, b) {
86
- return -1 * sorter(a, b);
87
- };
88
- }
89
-
90
- for (i = 0; i < rowNodes.length; i += 1) {
91
- rows.push(rowNodes[i]);
92
- tableBody.removeChild(rowNodes[i]);
93
- }
94
-
95
- rows.sort(finalSorter);
96
-
97
- for (i = 0; i < rows.length; i += 1) {
98
- tableBody.appendChild(rows[i]);
99
- }
100
- }
101
- // removes sort indicators for current column being sorted
102
- function removeSortIndicators() {
103
- var col = getNthColumn(currentSort.index),
104
- cls = col.className;
105
-
106
- cls = cls.replace(/ sorted$/, '').replace(/ sorted-desc$/, '');
107
- col.className = cls;
108
- }
109
- // adds sort indicators for current column being sorted
110
- function addSortIndicators() {
111
- getNthColumn(currentSort.index).className += currentSort.desc ? ' sorted-desc' : ' sorted';
112
- }
113
- // adds event listeners for all sorter widgets
114
- function enableUI() {
115
- var i,
116
- el,
117
- ithSorter = function ithSorter(i) {
118
- var col = cols[i];
119
-
120
- return function () {
121
- var desc = col.defaultDescSort;
122
-
123
- if (currentSort.index === i) {
124
- desc = !currentSort.desc;
125
- }
126
- sortByIndex(i, desc);
127
- removeSortIndicators();
128
- currentSort.index = i;
129
- currentSort.desc = desc;
130
- addSortIndicators();
131
- };
132
- };
133
- for (i =0 ; i < cols.length; i += 1) {
134
- if (cols[i].sortable) {
135
- // add the click event handler on the th so users
136
- // dont have to click on those tiny arrows
137
- el = getNthColumn(i).querySelector('.sorter').parentElement;
138
- if (el.addEventListener) {
139
- el.addEventListener('click', ithSorter(i));
140
- } else {
141
- el.attachEvent('onclick', ithSorter(i));
142
- }
143
- }
144
- }
145
- }
146
- // adds sorting functionality to the UI
147
- return function () {
148
- if (!getTable()) {
149
- return;
150
- }
151
- cols = loadColumns();
152
- loadData(cols);
153
- addSortIndicators();
154
- enableUI();
155
- };
156
- })();
157
-
158
- window.addEventListener('load', addSorting);