mockaton 12.3.4 → 12.3.6

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/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "mockaton",
3
3
  "description": "HTTP Mock Server",
4
4
  "type": "module",
5
- "version": "12.3.4",
5
+ "version": "12.3.6",
6
6
  "exports": {
7
7
  ".": {
8
8
  "import": "./index.js",
package/src/client/app.js CHANGED
@@ -734,7 +734,7 @@ function CloudIcon() {
734
734
  function HelpIcon() {
735
735
  return (
736
736
  s('svg', { viewBox: '0 0 24 24' },
737
- s('path', { d: 'M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2m1 17h-2v-2h2zm2.07-7.75-.9.92C13.45 12.9 13 13.5 13 15h-2v-.5c0-1.1.45-2.1 1.17-2.83l1.24-1.26c.37-.36.59-.86.59-1.41 0-1.1-.9-2-2-2s-2 .9-2 2H8c0-2.21 1.79-4 4-4s4 1.79 4 4c0 .88-.36 1.68-.93 2.25' })))
737
+ s('path', { d: 'M11 18h2v-2h-2zm1-16C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2m0 18c-4.41 0-8-3.59-8-8s3.59-8 8-8 8 3.59 8 8-3.59 8-8 8m0-14c-2.21 0-4 1.79-4 4h2c0-1.1.9-2 2-2s2 .9 2 2c0 2-3 1.75-3 5h2c0-2.25 3-2.5 3-5 0-2.21-1.79-4-4-4' })))
738
738
  }
739
739
 
740
740
 
@@ -18,7 +18,6 @@
18
18
  --colorDisabledMockSelector: #444;
19
19
  --colorHover: rgba(119, 193, 255, 0.4);
20
20
  --colorLabel: #555;
21
- --colorLightRed: #ffe4ee;
22
21
  --colorRed: #da0f00;
23
22
  --colorText: #000;
24
23
  --colorPink: #ed206a;
@@ -41,7 +40,6 @@
41
40
  --colorDisabledMockSelector: #b9b9b9;
42
41
  --colorHover: rgba(0, 63, 115, 0.5);
43
42
  --colorLabel: #aaa;
44
- --colorLightRed: #ffe4ee;
45
43
  --colorRed: #f41606;
46
44
  --colorText: #fff;
47
45
  --colorPink: #f92672;
@@ -138,7 +136,7 @@ header {
138
136
  align-self: end;
139
137
  margin-right: 22px;
140
138
  margin-bottom: 3px;
141
- opacity: 85%;
139
+ opacity: 90%;
142
140
  transition: opacity 240ms ease-in-out;
143
141
 
144
142
  &:hover {
@@ -183,8 +181,9 @@ header {
183
181
  background: transparent;
184
182
  border-radius: 50px;
185
183
  color: var(--colorRed);
184
+
186
185
  @media (prefers-color-scheme: dark) {
187
- color: var(--colorLightRed);
186
+ color: var(--colorText);
188
187
  }
189
188
 
190
189
  &:hover {
@@ -591,7 +590,7 @@ main {
591
590
  &:not(:checked):enabled:hover + .checkboxBody {
592
591
  border-color: var(--colorRed);
593
592
  color: var(--colorRed);
594
- background: var(--colorLightRed);
593
+ background: transparent;
595
594
  }
596
595
  &:checked + .checkboxBody {
597
596
  border-color: var(--colorRed);
@@ -68,7 +68,7 @@ async function applyPlugins(filePath, req, response) {
68
68
  }
69
69
 
70
70
  export async function jsToJsonPlugin(filePath, req, response) {
71
- const jsExport = (await import(pathToFileURL(filePath) + '?' + Date.now())).default // date for cache busting
71
+ const jsExport = (await import(pathToFileURL(filePath))).default
72
72
  const body = typeof jsExport === 'function'
73
73
  ? await jsExport(req, response)
74
74
  : JSON.stringify(jsExport, null, 2)
@@ -1,3 +1,4 @@
1
+ import { register } from 'node:module'
1
2
  import { createServer } from 'node:http'
2
3
 
3
4
  import pkgJSON from '../../package.json' with { type: 'json' }
@@ -25,6 +26,7 @@ import { watchMocksDir, watchStaticDir } from './Watcher.js'
25
26
 
26
27
  export function Mockaton(options) {
27
28
  return new Promise((resolve, reject) => {
29
+ register('./cacheBustResolver.js', import.meta.url)
28
30
  setup(options)
29
31
 
30
32
  mockBrokerCollection.init()
@@ -0,0 +1,14 @@
1
+ // We register this hook at runtime so it doesn’t interfere with non-dynamic imports.
2
+ export async function resolve(specifier, context, nextResolve) {
3
+ const result = await nextResolve(specifier, context)
4
+ if (result.url?.startsWith('file:')) {
5
+ const url = new URL(result.url)
6
+ url.searchParams.set('t', performance.now())
7
+ return {
8
+ ...result,
9
+ url: url.href,
10
+ shortCircuit: true
11
+ }
12
+ }
13
+ return result
14
+ }