mockaton 8.25.0 → 8.26.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/README.md +3 -3
- package/package.json +2 -2
- package/src/Dashboard.css +6 -9
- package/src/Dashboard.js +31 -9
package/README.md
CHANGED
|
@@ -55,9 +55,9 @@ Nonetheless, there’s a programmatic API, which is handy
|
|
|
55
55
|
for setting up tests (see **Commander API** section below).
|
|
56
56
|
|
|
57
57
|
<picture>
|
|
58
|
-
<source media="(prefers-color-scheme: light)" srcset="pixaton-tests/macos/pic-for-readme.
|
|
59
|
-
<source media="(prefers-color-scheme: dark)" srcset="pixaton-tests/macos/pic-for-readme.
|
|
60
|
-
<img alt="Mockaton Dashboard" src="pixaton-tests/macos/pic-for-readme.
|
|
58
|
+
<source media="(prefers-color-scheme: light)" srcset="pixaton-tests/macos/pic-for-readme.vp880x768.light.gold.png">
|
|
59
|
+
<source media="(prefers-color-scheme: dark)" srcset="pixaton-tests/macos/pic-for-readme.vp880x768.dark.gold.png">
|
|
60
|
+
<img alt="Mockaton Dashboard" src="pixaton-tests/macos/pic-for-readme.vp880x768.light.gold.png">
|
|
61
61
|
</picture>
|
|
62
62
|
|
|
63
63
|
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "mockaton",
|
|
3
3
|
"description": "HTTP Mock Server",
|
|
4
4
|
"type": "module",
|
|
5
|
-
"version": "8.
|
|
5
|
+
"version": "8.26.1",
|
|
6
6
|
"main": "index.js",
|
|
7
7
|
"types": "index.d.ts",
|
|
8
8
|
"license": "MIT",
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
"scripts": {
|
|
21
21
|
"test": "node --test \"src/**/*.test.js\"",
|
|
22
22
|
"coverage": "node --test --test-reporter=lcov --test-reporter-destination=.coverage/lcov.info --experimental-test-coverage \"src/**/*.test.js\"",
|
|
23
|
-
"start": "node --watch src/cli.js
|
|
23
|
+
"start": "node --watch src/cli.js",
|
|
24
24
|
"pixaton": "node --test --import=./pixaton-tests/_setup.js --experimental-test-isolation=none \"pixaton-tests/**/*.test.js\"",
|
|
25
25
|
"outdated": "npm outdated --parseable | awk -F: '{ printf \"npm i %-30s ;# %s\\n\", $4, $2 }'"
|
|
26
26
|
},
|
package/src/Dashboard.css
CHANGED
|
@@ -305,6 +305,10 @@ main {
|
|
|
305
305
|
table {
|
|
306
306
|
border-collapse: collapse;
|
|
307
307
|
|
|
308
|
+
tr {
|
|
309
|
+
border-top: 2px solid transparent;
|
|
310
|
+
}
|
|
311
|
+
|
|
308
312
|
th {
|
|
309
313
|
padding-bottom: 2px;
|
|
310
314
|
padding-left: 4px;
|
|
@@ -314,12 +318,6 @@ table {
|
|
|
314
318
|
tbody {
|
|
315
319
|
border-bottom: 20px solid transparent;
|
|
316
320
|
}
|
|
317
|
-
|
|
318
|
-
td:nth-child(3),
|
|
319
|
-
td:nth-child(4),
|
|
320
|
-
td:nth-child(5) {
|
|
321
|
-
max-width: 280px;
|
|
322
|
-
}
|
|
323
321
|
}
|
|
324
322
|
|
|
325
323
|
.empty {
|
|
@@ -332,7 +330,7 @@ table {
|
|
|
332
330
|
left: -8px;
|
|
333
331
|
display: inline-block;
|
|
334
332
|
width: 100%;
|
|
335
|
-
padding: 8px;
|
|
333
|
+
padding: 6px 8px;
|
|
336
334
|
margin-left: 4px;
|
|
337
335
|
border-radius: var(--radius);
|
|
338
336
|
color: var(--colorAccent);
|
|
@@ -349,9 +347,8 @@ table {
|
|
|
349
347
|
}
|
|
350
348
|
|
|
351
349
|
.MockSelector {
|
|
352
|
-
width: 100%;
|
|
353
350
|
height: 26px;
|
|
354
|
-
padding-right:
|
|
351
|
+
padding-right: 20px;
|
|
355
352
|
padding-left: 8px;
|
|
356
353
|
text-overflow: ellipsis;
|
|
357
354
|
font-size: 12px;
|
package/src/Dashboard.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { DEFAULT_500_COMMENT, HEADER_FOR_502 } from './ApiConstants.js'
|
|
2
|
-
import { parseFilename } from './Filename.js'
|
|
2
|
+
import { parseFilename, extractComments } from './Filename.js'
|
|
3
3
|
import { Commander } from './ApiCommander.js'
|
|
4
4
|
|
|
5
5
|
|
|
@@ -383,7 +383,7 @@ function MockSelector({ broker }) {
|
|
|
383
383
|
selected = Strings.proxied
|
|
384
384
|
files.push(selected)
|
|
385
385
|
}
|
|
386
|
-
|
|
386
|
+
|
|
387
387
|
return (
|
|
388
388
|
r('select', {
|
|
389
389
|
onChange,
|
|
@@ -394,11 +394,17 @@ function MockSelector({ broker }) {
|
|
|
394
394
|
CSS.MockSelector,
|
|
395
395
|
selected !== files[0] && CSS.nonDefault,
|
|
396
396
|
status >= 400 && status < 500 && CSS.status4xx)
|
|
397
|
-
}, files.map(file =>
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
397
|
+
}, files.map(file => {
|
|
398
|
+
const { status, ext } = parseFilename(file)
|
|
399
|
+
return (
|
|
400
|
+
r('option', {
|
|
401
|
+
value: file,
|
|
402
|
+
selected: file === selected
|
|
403
|
+
}, file === Strings.proxied
|
|
404
|
+
? Strings.proxied
|
|
405
|
+
: `${status} ${ext} ${extractComments(file).join(' ')}`)
|
|
406
|
+
)
|
|
407
|
+
})))
|
|
402
408
|
}
|
|
403
409
|
|
|
404
410
|
/** @param {{ broker: ClientMockBroker }} props */
|
|
@@ -582,7 +588,7 @@ function PayloadViewerTitle({ file, status, statusText }) {
|
|
|
582
588
|
const { urlMask, method, ext } = parseFilename(file)
|
|
583
589
|
return (
|
|
584
590
|
r('span', null,
|
|
585
|
-
urlMask + '.' + method + '.',
|
|
591
|
+
urlMask.replace(/^\//, '') + '.' + method + '.',
|
|
586
592
|
r('abbr', { title: statusText }, status),
|
|
587
593
|
'.' + ext))
|
|
588
594
|
}
|
|
@@ -851,9 +857,12 @@ function dittoSplitPaths(paths) {
|
|
|
851
857
|
|
|
852
858
|
|
|
853
859
|
function syntaxJSON(json) {
|
|
860
|
+
const MAX_NODES = 1000
|
|
861
|
+
let nNodes = 0
|
|
854
862
|
const frag = document.createDocumentFragment()
|
|
855
863
|
|
|
856
864
|
function span(className, textContent) {
|
|
865
|
+
nNodes++
|
|
857
866
|
const s = document.createElement('span')
|
|
858
867
|
s.className = className
|
|
859
868
|
s.textContent = textContent
|
|
@@ -861,13 +870,17 @@ function syntaxJSON(json) {
|
|
|
861
870
|
}
|
|
862
871
|
|
|
863
872
|
function text(t) {
|
|
873
|
+
nNodes++
|
|
864
874
|
frag.appendChild(document.createTextNode(t))
|
|
865
875
|
}
|
|
866
876
|
|
|
867
877
|
let match
|
|
868
878
|
let lastIndex = 0
|
|
869
|
-
syntaxJSON.regex.lastIndex = 0
|
|
879
|
+
syntaxJSON.regex.lastIndex = 0 // resets regex
|
|
870
880
|
while ((match = syntaxJSON.regex.exec(json)) !== null) {
|
|
881
|
+
if (nNodes > MAX_NODES)
|
|
882
|
+
break
|
|
883
|
+
|
|
871
884
|
if (match.index > lastIndex)
|
|
872
885
|
text(json.slice(lastIndex, match.index))
|
|
873
886
|
|
|
@@ -882,6 +895,7 @@ function syntaxJSON(json) {
|
|
|
882
895
|
else if (str) span(CSS.syntaxStr, str)
|
|
883
896
|
else span(CSS.syntaxVal, full)
|
|
884
897
|
}
|
|
898
|
+
frag.normalize()
|
|
885
899
|
text(json.slice(lastIndex))
|
|
886
900
|
return frag
|
|
887
901
|
}
|
|
@@ -891,9 +905,12 @@ syntaxJSON.regex = /("(?:\\u[a-fA-F0-9]{4}|\\[^u]|[^\\"])*")(\s*:)?|([{}\[\],:\s
|
|
|
891
905
|
|
|
892
906
|
|
|
893
907
|
function syntaxXML(xml) {
|
|
908
|
+
const MAX_NODES = 1000
|
|
909
|
+
let nNodes = 0
|
|
894
910
|
const frag = document.createDocumentFragment()
|
|
895
911
|
|
|
896
912
|
function span(className, textContent) {
|
|
913
|
+
nNodes++
|
|
897
914
|
const s = document.createElement('span')
|
|
898
915
|
s.className = className
|
|
899
916
|
s.textContent = textContent
|
|
@@ -901,6 +918,7 @@ function syntaxXML(xml) {
|
|
|
901
918
|
}
|
|
902
919
|
|
|
903
920
|
function text(t) {
|
|
921
|
+
nNodes++
|
|
904
922
|
frag.appendChild(document.createTextNode(t))
|
|
905
923
|
}
|
|
906
924
|
|
|
@@ -908,6 +926,9 @@ function syntaxXML(xml) {
|
|
|
908
926
|
let lastIndex = 0
|
|
909
927
|
syntaxXML.regex.lastIndex = 0
|
|
910
928
|
while ((match = syntaxXML.regex.exec(xml)) !== null) {
|
|
929
|
+
if (nNodes > MAX_NODES)
|
|
930
|
+
break
|
|
931
|
+
|
|
911
932
|
if (match.index > lastIndex)
|
|
912
933
|
text(xml.slice(lastIndex, match.index))
|
|
913
934
|
|
|
@@ -919,6 +940,7 @@ function syntaxXML(xml) {
|
|
|
919
940
|
else if (match[4]) span(CSS.syntaxAttrVal, match[4])
|
|
920
941
|
}
|
|
921
942
|
text(xml.slice(lastIndex))
|
|
943
|
+
frag.normalize()
|
|
922
944
|
return frag
|
|
923
945
|
}
|
|
924
946
|
syntaxXML.regex = /(<\/?|\/?>|\?>)|(?<=<\??\/?)([A-Za-z_:][\w:.-]*)|([A-Za-z_:][\w:.-]*)(?==)|("(?:[^"\\]|\\.)*")/g
|