mockaton 12.3.5 → 12.3.7

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 CHANGED
@@ -35,15 +35,15 @@ For example, for [/api/company/123](#), the filename could be:
35
35
 
36
36
  ## Quick Start (Docker)
37
37
  This will spin up Mockaton with the sample directories
38
- included in this repo mounted on the container ([mockaton-mocks/](./mockaton-mocks)
39
- and [mockaton-static-mocks/](./mockaton-static-mocks))
38
+ included in this repo mounted on the container. Mentioned dirs are: [mockaton-mocks/](./mockaton-mocks)
39
+ and [mockaton-static-mocks/](./mockaton-static-mocks).
40
40
 
41
41
  ```sh
42
42
  git clone https://github.com/ericfortis/mockaton.git --depth 1
43
43
  cd mockaton
44
44
  make docker
45
45
  ```
46
- Dashboard: http://localhost:2020/mockaton
46
+ Dashboard: [localhost:2020/mockaton](http://localhost:2020/mockaton)
47
47
 
48
48
  Test it:
49
49
  ```shell
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.5",
5
+ "version": "12.3.7",
6
6
  "exports": {
7
7
  ".": {
8
8
  "import": "./index.js",
@@ -6,45 +6,45 @@
6
6
  @media (prefers-color-scheme: light) {
7
7
  :root {
8
8
  color-scheme: light;
9
- --color4xxBackground: #ffedd1;
10
- --colorAccent: #0059dd;
11
9
  --colorBackground: #fff;
12
10
  --colorComboBoxHeaderBackground: #fff;
13
- --colorComboBoxBackground: #eee;
14
- --colorHeaderBackground: #f2f2f3;
15
11
  --colorSecondaryButtonBackground: #fcfcfc;
12
+ --colorHeaderBackground: #f2f2f3;
13
+ --colorComboBoxBackground: #eee;
16
14
  --colorSecondaryActionBorder: #e0e0e0;
17
15
  --colorSecondaryAction: #666;
16
+ --colorLabel: #555;
18
17
  --colorDisabledMockSelector: #444;
18
+ --colorText: #000;
19
+ --colorAccent: #0059dd;
19
20
  --colorHover: rgba(119, 193, 255, 0.4);
20
- --colorLabel: #555;
21
21
  --colorRed: #da0f00;
22
- --colorText: #000;
23
22
  --colorPink: #ed206a;
24
23
  --colorPurple: #9b71e8;
25
24
  --colorGreen: #388e3c;
25
+ --color4xxBackground: #ffedd1;
26
26
  }
27
27
  }
28
28
  @media (prefers-color-scheme: dark) {
29
29
  :root {
30
30
  color-scheme: dark;
31
- --color4xxBackground: #68554a;
32
- --colorAccent: #2495ff;
33
31
  --colorBackground: #181818;
32
+ --colorComboBoxHeaderBackground: #222;
33
+ --colorSecondaryButtonBackground: #2c2c2c;
34
34
  --colorHeaderBackground: #141414;
35
35
  --colorComboBoxBackground: #2a2a2a;
36
- --colorSecondaryButtonBackground: #2c2c2c;
37
36
  --colorSecondaryActionBorder: #333;
38
37
  --colorSecondaryAction: #aaa;
39
- --colorComboBoxHeaderBackground: #222;
40
- --colorDisabledMockSelector: #b9b9b9;
41
- --colorHover: rgba(0, 63, 115, 0.5);
42
38
  --colorLabel: #aaa;
43
- --colorRed: #f41606;
39
+ --colorDisabledMockSelector: #a9b9b9;
44
40
  --colorText: #fff;
41
+ --colorAccent: #2495ff;
42
+ --colorHover: rgba(0, 63, 115, 0.5);
43
+ --colorRed: #f41606;
45
44
  --colorPink: #f92672;
46
45
  --colorPurple: #ae81ff;
47
46
  --colorGreen: #a6e22e;
47
+ --color4xxBackground: #68554a;
48
48
  }
49
49
  }
50
50
 
@@ -181,7 +181,7 @@ header {
181
181
  background: transparent;
182
182
  border-radius: 50px;
183
183
  color: var(--colorRed);
184
-
184
+
185
185
  @media (prefers-color-scheme: dark) {
186
186
  color: var(--colorText);
187
187
  }
@@ -663,7 +663,7 @@ main {
663
663
  animation-timing-function: linear;
664
664
  animation-iteration-count: infinite;
665
665
  animation-direction: alternate;
666
- /* duration in JavaScript */
666
+ /* animation-duration is set in JS */
667
667
  }
668
668
  }
669
669
  @keyframes _kfProgress {
@@ -26,13 +26,12 @@ import { watchMocksDir, watchStaticDir } from './Watcher.js'
26
26
 
27
27
  export function Mockaton(options) {
28
28
  return new Promise((resolve, reject) => {
29
- register('./cacheBustResolver.js', import.meta.url)
30
29
  setup(options)
31
-
32
30
  mockBrokerCollection.init()
33
31
  staticCollection.init()
34
32
 
35
33
  if (config.watcherEnabled) {
34
+ register('./cacheBustResolver.js', import.meta.url)
36
35
  watchMocksDir()
37
36
  watchStaticDir()
38
37
  }
@@ -1,11 +1,16 @@
1
1
  // We register this hook at runtime so it doesn’t interfere with non-dynamic imports.
2
2
  export async function resolve(specifier, context, nextResolve) {
3
3
  const result = await nextResolve(specifier, context)
4
- const url = new URL(result.url)
5
- url.searchParams.set('t', performance.now())
6
- return {
7
- ...result,
8
- url: url.href,
9
- shortCircuit: true
4
+ if (specifier === 'debug')
5
+ return result
6
+ if (result.url?.startsWith('file:')) {
7
+ const url = new URL(result.url)
8
+ url.searchParams.set('t', performance.now())
9
+ return {
10
+ ...result,
11
+ url: url.href,
12
+ shortCircuit: true
13
+ }
10
14
  }
15
+ return result
11
16
  }
package/src/server/cli.js CHANGED
@@ -60,9 +60,9 @@ Options:
60
60
  -v, --version Show version
61
61
 
62
62
  Notes:
63
- * mockaton.config.js supports more options, see:
64
- https://github.com/ericfortis/mockaton?tab=readme-ov-file#mockatonconfigjs-optional
65
- * CLI options override their mockaton.config.js counterparts`)
63
+ * mockaton.config.js supports more options, see: https://mockaton.com/config
64
+ * CLI options override their mockaton.config.js counterparts
65
+ `.trim())
66
66
 
67
67
  else if (args.config && !isFile(args.config)) {
68
68
  console.error(`Invalid config file: ${args.config}`)
@@ -26,7 +26,7 @@ export class ServerResponse extends http.ServerResponse {
26
26
 
27
27
  json(payload) {
28
28
  logger.access(this)
29
- this.setHeader('Content-Type', 'application/json')
29
+ this.setHeader('Content-Type', mimeFor('json'))
30
30
  this.end(JSON.stringify(payload))
31
31
  }
32
32