@sgedda/mockifyer-fetch 1.8.85 → 1.8.86
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/metro-atlas-key-handlers.d.ts +8 -6
- package/dist/metro-atlas-key-handlers.js +20 -8
- package/dist/metro-config.d.ts +1 -1
- package/dist/metro-config.js +1 -1
- package/dist/metro-sync-middleware.d.ts +3 -3
- package/dist/metro-sync-middleware.js +1 -1
- package/package.json +1 -1
- package/src/metro-atlas-key-handlers.ts +23 -11
- package/src/metro-config.ts +1 -1
- package/src/metro-sync-middleware.ts +3 -3
|
@@ -1,15 +1,17 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Metro terminal keys for Mockifyer:
|
|
3
|
-
* - `
|
|
3
|
+
* - `t` (default): start/stop Atlas capture (stop generates HTML)
|
|
4
4
|
* - `m` (default): open the Mockifyer dashboard in the browser
|
|
5
5
|
*
|
|
6
6
|
* Opening `mockifyer-atlas` (SSE `/mockifyer-network-events/stream`) auto-starts
|
|
7
|
-
* capture when idle — then press `
|
|
7
|
+
* capture when idle — then press `t` once to stop & generate.
|
|
8
8
|
*
|
|
9
|
+
* `a` is reserved by Metro for Android (`i` iOS, `r` reload, `d` Dev Menu, `j` DevTools).
|
|
9
10
|
* Disable Atlas with `atlasKey: false`, dashboard with `dashboardKey: false`.
|
|
10
11
|
*/
|
|
11
12
|
import * as readline from "readline";
|
|
12
|
-
|
|
13
|
+
/** `t` — `a` launches Android in the Metro / RN CLI. */
|
|
14
|
+
export declare const DEFAULT_METRO_ATLAS_KEY = "t";
|
|
13
15
|
export declare const DEFAULT_METRO_DASHBOARD_KEY = "m";
|
|
14
16
|
export declare const DEFAULT_METRO_DASHBOARD_URL = "http://localhost:3002";
|
|
15
17
|
export type AtlasKeyOption = string | false;
|
|
@@ -17,8 +19,8 @@ export type MetroAtlasSessionPhase = "idle" | "capturing" | "rendering";
|
|
|
17
19
|
export type MetroAtlasSessionStartReason = "key" | "stream";
|
|
18
20
|
export interface AttachMetroAtlasKeyHandlerOptions {
|
|
19
21
|
/**
|
|
20
|
-
* Key that toggles Atlas capture (default `"
|
|
21
|
-
* Pass `false` to disable.
|
|
22
|
+
* Key that toggles Atlas capture (default `"t"`).
|
|
23
|
+
* Pass `false` to disable. `a` is reserved by Metro for Android.
|
|
22
24
|
*/
|
|
23
25
|
atlasKey?: AtlasKeyOption;
|
|
24
26
|
/**
|
|
@@ -57,7 +59,7 @@ export interface AttachedMetroAtlasKeyHandler {
|
|
|
57
59
|
*/
|
|
58
60
|
export declare function resolveKeyOption(value: AtlasKeyOption | undefined, defaultKey: string): string | null;
|
|
59
61
|
/**
|
|
60
|
-
* Normalize `atlasKey` option: default `"
|
|
62
|
+
* Normalize `atlasKey` option: default `"t"`, `false` → disabled, else single char.
|
|
61
63
|
*/
|
|
62
64
|
export declare function resolveAtlasKeyOption(atlasKey?: AtlasKeyOption): string | null;
|
|
63
65
|
/**
|
|
@@ -51,20 +51,31 @@ exports.detachMetroAtlasKeyHandler = detachMetroAtlasKeyHandler;
|
|
|
51
51
|
exports.attachMetroAtlasKeyHandler = attachMetroAtlasKeyHandler;
|
|
52
52
|
/**
|
|
53
53
|
* Metro terminal keys for Mockifyer:
|
|
54
|
-
* - `
|
|
54
|
+
* - `t` (default): start/stop Atlas capture (stop generates HTML)
|
|
55
55
|
* - `m` (default): open the Mockifyer dashboard in the browser
|
|
56
56
|
*
|
|
57
57
|
* Opening `mockifyer-atlas` (SSE `/mockifyer-network-events/stream`) auto-starts
|
|
58
|
-
* capture when idle — then press `
|
|
58
|
+
* capture when idle — then press `t` once to stop & generate.
|
|
59
59
|
*
|
|
60
|
+
* `a` is reserved by Metro for Android (`i` iOS, `r` reload, `d` Dev Menu, `j` DevTools).
|
|
60
61
|
* Disable Atlas with `atlasKey: false`, dashboard with `dashboardKey: false`.
|
|
61
62
|
*/
|
|
62
63
|
const readline = __importStar(require("readline"));
|
|
63
64
|
const child_process_1 = require("child_process");
|
|
64
65
|
const mockifyer_core_1 = require("@sgedda/mockifyer-core");
|
|
65
|
-
/**
|
|
66
|
-
|
|
67
|
-
|
|
66
|
+
/**
|
|
67
|
+
* Keys already used by @react-native/community-cli-plugin (avoid stealing).
|
|
68
|
+
* Value is the short reason shown when a binding collides.
|
|
69
|
+
*/
|
|
70
|
+
const RESERVED_METRO_KEYS = new Map([
|
|
71
|
+
["a", "Android"],
|
|
72
|
+
["d", "the Dev Menu"],
|
|
73
|
+
["i", "iOS"],
|
|
74
|
+
["j", "DevTools"],
|
|
75
|
+
["r", "reload"],
|
|
76
|
+
]);
|
|
77
|
+
/** `t` — `a` launches Android in the Metro / RN CLI. */
|
|
78
|
+
exports.DEFAULT_METRO_ATLAS_KEY = "t";
|
|
68
79
|
exports.DEFAULT_METRO_DASHBOARD_KEY = "m";
|
|
69
80
|
exports.DEFAULT_METRO_DASHBOARD_URL = "http://localhost:3002";
|
|
70
81
|
/** Delay so RN/Expo CLI can own raw-mode stdin first. */
|
|
@@ -91,7 +102,7 @@ function resolveKeyOption(value, defaultKey) {
|
|
|
91
102
|
return key || null;
|
|
92
103
|
}
|
|
93
104
|
/**
|
|
94
|
-
* Normalize `atlasKey` option: default `"
|
|
105
|
+
* Normalize `atlasKey` option: default `"t"`, `false` → disabled, else single char.
|
|
95
106
|
*/
|
|
96
107
|
function resolveAtlasKeyOption(atlasKey) {
|
|
97
108
|
return resolveKeyOption(atlasKey, exports.DEFAULT_METRO_ATLAS_KEY);
|
|
@@ -296,8 +307,9 @@ function detachMetroAtlasKeyHandler() {
|
|
|
296
307
|
streamSubscriberCount = 0;
|
|
297
308
|
}
|
|
298
309
|
function warnIfReserved(key, label) {
|
|
299
|
-
|
|
300
|
-
|
|
310
|
+
const reason = RESERVED_METRO_KEYS.get(key);
|
|
311
|
+
if (reason) {
|
|
312
|
+
mockifyer_core_1.logger.warn(`[Mockifyer] ${label} "${key}" is reserved for ${reason} — pick another letter`);
|
|
301
313
|
}
|
|
302
314
|
}
|
|
303
315
|
/**
|
package/dist/metro-config.d.ts
CHANGED
|
@@ -108,7 +108,7 @@ export interface ConfigureMetroOptions {
|
|
|
108
108
|
* syncMiddleware: {
|
|
109
109
|
* projectRoot: __dirname,
|
|
110
110
|
* mockDataPath: './mock-data',
|
|
111
|
-
* // atlasKey: '
|
|
111
|
+
* // atlasKey: 't' (default) — Metro terminal: start/stop Atlas capture (stop → HTML). `a` is Android.
|
|
112
112
|
* // dashboardKey: 'm' (default) — open dashboard in browser
|
|
113
113
|
* // dashboardUrl: 'http://localhost:3002' — or MOCKIFYER_DASHBOARD_URL
|
|
114
114
|
* },
|
package/dist/metro-config.js
CHANGED
|
@@ -127,7 +127,7 @@ function resolveMockifyerCoreReactNativeEntry(moduleName, platform) {
|
|
|
127
127
|
* syncMiddleware: {
|
|
128
128
|
* projectRoot: __dirname,
|
|
129
129
|
* mockDataPath: './mock-data',
|
|
130
|
-
* // atlasKey: '
|
|
130
|
+
* // atlasKey: 't' (default) — Metro terminal: start/stop Atlas capture (stop → HTML). `a` is Android.
|
|
131
131
|
* // dashboardKey: 'm' (default) — open dashboard in browser
|
|
132
132
|
* // dashboardUrl: 'http://localhost:3002' — or MOCKIFYER_DASHBOARD_URL
|
|
133
133
|
* },
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
* 15. POST /mockifyer-network-events/snapshot — write hops JSON/NDJSON under atlas-html/
|
|
20
20
|
* 16. POST /mockifyer-network-events/render — render Atlas HTML from buffer hops
|
|
21
21
|
* 17. POST /mockifyer-network-events/clear — clear ring buffer
|
|
22
|
-
* 18. Metro terminal key `
|
|
22
|
+
* 18. Metro terminal key `t` — start/stop Atlas capture (stop generates HTML; stream auto-starts; `atlasKey: false` to disable). `a` is reserved for Android.
|
|
23
23
|
* 19. Metro terminal key `m` — open Mockifyer dashboard in the browser (`dashboardKey: false` to disable)
|
|
24
24
|
*
|
|
25
25
|
* The Hybrid Provider (recommended) uses POST /mockifyer-save for instant file sync.
|
|
@@ -34,9 +34,9 @@ export interface MetroSyncMiddlewareOptions {
|
|
|
34
34
|
/** Path to mock data directory relative to project root (default: 'mock-data') */
|
|
35
35
|
mockDataPath?: string;
|
|
36
36
|
/**
|
|
37
|
-
* Metro terminal key that starts/stops Atlas capture (default `"
|
|
37
|
+
* Metro terminal key that starts/stops Atlas capture (default `"t"`).
|
|
38
38
|
* Start clears the hop buffer; stop generates HTML (same as `POST /mockifyer-network-events/render`).
|
|
39
|
-
* Pass `false` to disable.
|
|
39
|
+
* Pass `false` to disable. `a` is reserved by Metro for Android.
|
|
40
40
|
*/
|
|
41
41
|
atlasKey?: AtlasKeyOption;
|
|
42
42
|
/**
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
* 15. POST /mockifyer-network-events/snapshot — write hops JSON/NDJSON under atlas-html/
|
|
21
21
|
* 16. POST /mockifyer-network-events/render — render Atlas HTML from buffer hops
|
|
22
22
|
* 17. POST /mockifyer-network-events/clear — clear ring buffer
|
|
23
|
-
* 18. Metro terminal key `
|
|
23
|
+
* 18. Metro terminal key `t` — start/stop Atlas capture (stop generates HTML; stream auto-starts; `atlasKey: false` to disable). `a` is reserved for Android.
|
|
24
24
|
* 19. Metro terminal key `m` — open Mockifyer dashboard in the browser (`dashboardKey: false` to disable)
|
|
25
25
|
*
|
|
26
26
|
* The Hybrid Provider (recommended) uses POST /mockifyer-save for instant file sync.
|
package/package.json
CHANGED
|
@@ -1,21 +1,32 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Metro terminal keys for Mockifyer:
|
|
3
|
-
* - `
|
|
3
|
+
* - `t` (default): start/stop Atlas capture (stop generates HTML)
|
|
4
4
|
* - `m` (default): open the Mockifyer dashboard in the browser
|
|
5
5
|
*
|
|
6
6
|
* Opening `mockifyer-atlas` (SSE `/mockifyer-network-events/stream`) auto-starts
|
|
7
|
-
* capture when idle — then press `
|
|
7
|
+
* capture when idle — then press `t` once to stop & generate.
|
|
8
8
|
*
|
|
9
|
+
* `a` is reserved by Metro for Android (`i` iOS, `r` reload, `d` Dev Menu, `j` DevTools).
|
|
9
10
|
* Disable Atlas with `atlasKey: false`, dashboard with `dashboardKey: false`.
|
|
10
11
|
*/
|
|
11
12
|
import * as readline from "readline";
|
|
12
13
|
import { spawn } from "child_process";
|
|
13
14
|
import { logger } from "@sgedda/mockifyer-core";
|
|
14
15
|
|
|
15
|
-
/**
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
16
|
+
/**
|
|
17
|
+
* Keys already used by @react-native/community-cli-plugin (avoid stealing).
|
|
18
|
+
* Value is the short reason shown when a binding collides.
|
|
19
|
+
*/
|
|
20
|
+
const RESERVED_METRO_KEYS: ReadonlyMap<string, string> = new Map([
|
|
21
|
+
["a", "Android"],
|
|
22
|
+
["d", "the Dev Menu"],
|
|
23
|
+
["i", "iOS"],
|
|
24
|
+
["j", "DevTools"],
|
|
25
|
+
["r", "reload"],
|
|
26
|
+
]);
|
|
27
|
+
|
|
28
|
+
/** `t` — `a` launches Android in the Metro / RN CLI. */
|
|
29
|
+
export const DEFAULT_METRO_ATLAS_KEY = "t";
|
|
19
30
|
export const DEFAULT_METRO_DASHBOARD_KEY = "m";
|
|
20
31
|
export const DEFAULT_METRO_DASHBOARD_URL = "http://localhost:3002";
|
|
21
32
|
|
|
@@ -30,8 +41,8 @@ export type MetroAtlasSessionStartReason = "key" | "stream";
|
|
|
30
41
|
|
|
31
42
|
export interface AttachMetroAtlasKeyHandlerOptions {
|
|
32
43
|
/**
|
|
33
|
-
* Key that toggles Atlas capture (default `"
|
|
34
|
-
* Pass `false` to disable.
|
|
44
|
+
* Key that toggles Atlas capture (default `"t"`).
|
|
45
|
+
* Pass `false` to disable. `a` is reserved by Metro for Android.
|
|
35
46
|
*/
|
|
36
47
|
atlasKey?: AtlasKeyOption;
|
|
37
48
|
/**
|
|
@@ -102,7 +113,7 @@ export function resolveKeyOption(
|
|
|
102
113
|
}
|
|
103
114
|
|
|
104
115
|
/**
|
|
105
|
-
* Normalize `atlasKey` option: default `"
|
|
116
|
+
* Normalize `atlasKey` option: default `"t"`, `false` → disabled, else single char.
|
|
106
117
|
*/
|
|
107
118
|
export function resolveAtlasKeyOption(
|
|
108
119
|
atlasKey?: AtlasKeyOption,
|
|
@@ -331,9 +342,10 @@ export function detachMetroAtlasKeyHandler(): void {
|
|
|
331
342
|
}
|
|
332
343
|
|
|
333
344
|
function warnIfReserved(key: string, label: string): void {
|
|
334
|
-
|
|
345
|
+
const reason = RESERVED_METRO_KEYS.get(key);
|
|
346
|
+
if (reason) {
|
|
335
347
|
logger.warn(
|
|
336
|
-
`[Mockifyer] ${label} "${key}"
|
|
348
|
+
`[Mockifyer] ${label} "${key}" is reserved for ${reason} — pick another letter`,
|
|
337
349
|
);
|
|
338
350
|
}
|
|
339
351
|
}
|
package/src/metro-config.ts
CHANGED
|
@@ -171,7 +171,7 @@ export interface ConfigureMetroOptions {
|
|
|
171
171
|
* syncMiddleware: {
|
|
172
172
|
* projectRoot: __dirname,
|
|
173
173
|
* mockDataPath: './mock-data',
|
|
174
|
-
* // atlasKey: '
|
|
174
|
+
* // atlasKey: 't' (default) — Metro terminal: start/stop Atlas capture (stop → HTML). `a` is Android.
|
|
175
175
|
* // dashboardKey: 'm' (default) — open dashboard in browser
|
|
176
176
|
* // dashboardUrl: 'http://localhost:3002' — or MOCKIFYER_DASHBOARD_URL
|
|
177
177
|
* },
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
* 15. POST /mockifyer-network-events/snapshot — write hops JSON/NDJSON under atlas-html/
|
|
20
20
|
* 16. POST /mockifyer-network-events/render — render Atlas HTML from buffer hops
|
|
21
21
|
* 17. POST /mockifyer-network-events/clear — clear ring buffer
|
|
22
|
-
* 18. Metro terminal key `
|
|
22
|
+
* 18. Metro terminal key `t` — start/stop Atlas capture (stop generates HTML; stream auto-starts; `atlasKey: false` to disable). `a` is reserved for Android.
|
|
23
23
|
* 19. Metro terminal key `m` — open Mockifyer dashboard in the browser (`dashboardKey: false` to disable)
|
|
24
24
|
*
|
|
25
25
|
* The Hybrid Provider (recommended) uses POST /mockifyer-save for instant file sync.
|
|
@@ -77,9 +77,9 @@ export interface MetroSyncMiddlewareOptions {
|
|
|
77
77
|
/** Path to mock data directory relative to project root (default: 'mock-data') */
|
|
78
78
|
mockDataPath?: string;
|
|
79
79
|
/**
|
|
80
|
-
* Metro terminal key that starts/stops Atlas capture (default `"
|
|
80
|
+
* Metro terminal key that starts/stops Atlas capture (default `"t"`).
|
|
81
81
|
* Start clears the hop buffer; stop generates HTML (same as `POST /mockifyer-network-events/render`).
|
|
82
|
-
* Pass `false` to disable.
|
|
82
|
+
* Pass `false` to disable. `a` is reserved by Metro for Android.
|
|
83
83
|
*/
|
|
84
84
|
atlasKey?: AtlasKeyOption;
|
|
85
85
|
/**
|