@ait-co/devtools 0.1.142 → 0.1.144
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.en.md +87 -1
- package/README.md +87 -1
- package/dist/{chii-relay-BZ3HqWL5.js → chii-relay-B3ZhjGMi.js} +1 -1
- package/dist/{chii-relay-BZ3HqWL5.js.map → chii-relay-B3ZhjGMi.js.map} +1 -1
- package/dist/{chii-relay-D7eK2acz.cjs → chii-relay-CGMlePMd.cjs} +1 -1
- package/dist/{chii-relay-D7eK2acz.cjs.map → chii-relay-CGMlePMd.cjs.map} +1 -1
- package/dist/mcp/cli.js +3 -3
- package/dist/mcp/server.js +1 -1
- package/dist/mock/index.d.ts +32 -9
- package/dist/mock/index.d.ts.map +1 -1
- package/dist/mock/index.js +31 -19
- package/dist/mock/index.js.map +1 -1
- package/dist/optional-peers-CDEFhlhJ.cjs +131 -0
- package/dist/optional-peers-CDEFhlhJ.cjs.map +1 -0
- package/dist/optional-peers-FdVbUJst.js +96 -0
- package/dist/optional-peers-FdVbUJst.js.map +1 -0
- package/dist/panel/index.js +3 -3
- package/dist/panel/index.js.map +1 -1
- package/dist/{pool-CrP5CPvU.d.ts → pool-DcaaOwUq.d.ts} +2 -2
- package/dist/{pool-CrP5CPvU.d.ts.map → pool-DcaaOwUq.d.ts.map} +1 -1
- package/dist/{relay-secret-store-DWKdV-eY.cjs → relay-secret-store-BR0YIkNv.cjs} +2 -2
- package/dist/{relay-secret-store-DWKdV-eY.cjs.map → relay-secret-store-BR0YIkNv.cjs.map} +1 -1
- package/dist/{relay-secret-store-BPhN1upr.js → relay-secret-store-CYM8CBIF.js} +2 -2
- package/dist/{relay-secret-store-BPhN1upr.js.map → relay-secret-store-CYM8CBIF.js.map} +1 -1
- package/dist/{relay-url-store-1FGuSYAn.cjs → relay-url-store-C1as_m5G.cjs} +2 -2
- package/dist/{relay-url-store-1FGuSYAn.cjs.map → relay-url-store-C1as_m5G.cjs.map} +1 -1
- package/dist/{relay-url-store-Bskcyeg8.js → relay-url-store-CzFo_84F.js} +2 -2
- package/dist/{relay-url-store-Bskcyeg8.js.map → relay-url-store-CzFo_84F.js.map} +1 -1
- package/dist/{relay-worker-DcyboK43.d.ts → relay-worker-YdlpZQl9.d.ts} +2 -2
- package/dist/{relay-worker-DcyboK43.d.ts.map → relay-worker-YdlpZQl9.d.ts.map} +1 -1
- package/dist/{runtime-BiigOuvb.d.ts → runtime-kn9DxOeg.d.ts} +2 -1
- package/dist/runtime-kn9DxOeg.d.ts.map +1 -0
- package/dist/test-runner/config.d.ts +1 -1
- package/dist/test-runner/pool.d.ts +1 -1
- package/dist/test-runner/relay-worker.d.ts +1 -1
- package/dist/test-runner/report.d.ts +2 -2
- package/dist/test-runner/rpc.d.ts +1 -1
- package/dist/test-runner/runtime.d.ts +1 -1
- package/dist/test-runner/runtime.js +4 -0
- package/dist/test-runner/runtime.js.map +1 -1
- package/dist/test-runner/task-graph.d.ts +1 -1
- package/dist/{totp-DIbrZtI7.js → totp-BqmCLSNA.js} +2 -2
- package/dist/{totp-DIbrZtI7.js.map → totp-BqmCLSNA.js.map} +1 -1
- package/dist/{totp-Df252ZdA.cjs → totp-CMHR5lsW.cjs} +1 -2
- package/dist/{totp-Df252ZdA.cjs.map → totp-CMHR5lsW.cjs.map} +1 -1
- package/dist/{tunnel-BVSMXctM.cjs → tunnel-BGT9Curk.cjs} +27 -75
- package/dist/tunnel-BGT9Curk.cjs.map +1 -0
- package/dist/{tunnel-D7xkimBu.js → tunnel-BOKmLzBO.js} +27 -75
- package/dist/tunnel-BOKmLzBO.js.map +1 -0
- package/dist/unplugin/index.cjs +13 -17
- package/dist/unplugin/index.cjs.map +1 -1
- package/dist/unplugin/index.d.cts +12 -2
- package/dist/unplugin/index.d.cts.map +1 -1
- package/dist/unplugin/index.d.ts +12 -2
- package/dist/unplugin/index.d.ts.map +1 -1
- package/dist/unplugin/index.js +13 -17
- package/dist/unplugin/index.js.map +1 -1
- package/dist/unplugin/tunnel.cjs +61 -74
- package/dist/unplugin/tunnel.cjs.map +1 -1
- package/dist/unplugin/tunnel.d.cts +22 -16
- package/dist/unplugin/tunnel.d.cts.map +1 -1
- package/dist/unplugin/tunnel.d.ts +22 -16
- package/dist/unplugin/tunnel.d.ts.map +1 -1
- package/dist/unplugin/tunnel.js +61 -74
- package/dist/unplugin/tunnel.js.map +1 -1
- package/package.json +11 -1
- package/dist/deeplink-B5-Hxu0Q.js +0 -62
- package/dist/deeplink-B5-Hxu0Q.js.map +0 -1
- package/dist/deeplink-BpO9qc-D.js +0 -62
- package/dist/deeplink-BpO9qc-D.js.map +0 -1
- package/dist/deeplink-BzdbA1gV.cjs +0 -62
- package/dist/deeplink-BzdbA1gV.cjs.map +0 -1
- package/dist/deeplink-DCScMYcp.cjs +0 -62
- package/dist/deeplink-DCScMYcp.cjs.map +0 -1
- package/dist/devtools-opener-B8nxrxqu.js +0 -71
- package/dist/devtools-opener-B8nxrxqu.js.map +0 -1
- package/dist/devtools-opener-BDY0w3_0.cjs +0 -68
- package/dist/devtools-opener-BDY0w3_0.cjs.map +0 -1
- package/dist/devtools-opener-BTl5A6Cd.js +0 -71
- package/dist/devtools-opener-BTl5A6Cd.js.map +0 -1
- package/dist/devtools-opener-iv1OwfJN.cjs +0 -68
- package/dist/devtools-opener-iv1OwfJN.cjs.map +0 -1
- package/dist/qr-http-server--gl2-WKc.cjs +0 -1644
- package/dist/qr-http-server--gl2-WKc.cjs.map +0 -1
- package/dist/qr-http-server-Bb7lMeqi.js +0 -1644
- package/dist/qr-http-server-Bb7lMeqi.js.map +0 -1
- package/dist/qr-http-server-D-Off6K1.cjs +0 -1644
- package/dist/qr-http-server-D-Off6K1.cjs.map +0 -1
- package/dist/qr-http-server-n1twN18z.js +0 -1644
- package/dist/qr-http-server-n1twN18z.js.map +0 -1
- package/dist/runtime-BiigOuvb.d.ts.map +0 -1
- package/dist/totp-95OAa20j.js +0 -64
- package/dist/totp-95OAa20j.js.map +0 -1
- package/dist/totp-BjtoQNfu.cjs +0 -64
- package/dist/totp-BjtoQNfu.cjs.map +0 -1
- package/dist/tunnel-BVSMXctM.cjs.map +0 -1
- package/dist/tunnel-D7xkimBu.js.map +0 -1
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
//#region src/unplugin/optional-peers.ts
|
|
2
|
+
/**
|
|
3
|
+
* Optional-peer resolution gates for the debug surface (issue #817).
|
|
4
|
+
*
|
|
5
|
+
* The debug surface now ships as two SEPARATE packages, declared here as
|
|
6
|
+
* OPTIONAL peerDependencies of `@ait-co/devtools`:
|
|
7
|
+
*
|
|
8
|
+
* - `@ait-co/debugger` — MCP daemon / test runner / dev-bridge. devDependency
|
|
9
|
+
* or `npx` only; never part of an app bundle.
|
|
10
|
+
* - `@ait-co/debug-console` — on-device attach + eruda console. The ONLY debug
|
|
11
|
+
* package that can legitimately enter an app bundle.
|
|
12
|
+
*
|
|
13
|
+
* Neither may become a hard dependency. The overwhelming majority of consumers
|
|
14
|
+
* use environment 1 only (browser + mock SDK + panel) and must install NOTHING
|
|
15
|
+
* extra — that is the whole point of splitting the packages apart. So every
|
|
16
|
+
* call site reaches them through the resolution gates below and degrades
|
|
17
|
+
* gracefully when they are absent:
|
|
18
|
+
*
|
|
19
|
+
* - env-2 CDP wiring (`tunnel.cdp`) → falls back to the plain screen-preview
|
|
20
|
+
* tunnel (no relay, no dashboard) and prints {@link INSTALL_HINT}.
|
|
21
|
+
* - in-app attach injection → the snippet is simply not injected, so the
|
|
22
|
+
* attach code is STRUCTURALLY ABSENT from the bundle rather than merely
|
|
23
|
+
* gated at runtime. This gate is the technical enforcement point of the
|
|
24
|
+
* debug surface's security scope: no `@ait-co/debug-console` installed
|
|
25
|
+
* means no attach code can reach a bundle at all.
|
|
26
|
+
*
|
|
27
|
+
* The `import.meta.resolve` probe follows the `MOCK_PATH` precedent in
|
|
28
|
+
* `./index.ts`: resolution is attempted once at plugin-load time and a failure
|
|
29
|
+
* is a plain "not installed" signal, never an error.
|
|
30
|
+
*
|
|
31
|
+
* SECRET-HANDLING: nothing here touches a relay URL, tunnel host, TOTP secret
|
|
32
|
+
* or code. The only strings emitted are fixed specifiers and the install hint.
|
|
33
|
+
*/
|
|
34
|
+
/** Subpath of `@ait-co/debugger` that the unplugin's dev loop delegates to. */
|
|
35
|
+
const DEBUGGER_DEV_BRIDGE_ID = "@ait-co/debugger/dev-bridge";
|
|
36
|
+
/** The on-device attach package injected into a consumer entry point. */
|
|
37
|
+
const DEBUG_CONSOLE_ID = "@ait-co/debug-console";
|
|
38
|
+
/** One-line install hint printed whenever a gate closes on a missing package. */
|
|
39
|
+
const INSTALL_HINT = "pnpm add -D @ait-co/debugger @ait-co/debug-console";
|
|
40
|
+
/**
|
|
41
|
+
* Returns whether `specifier` resolves from this package's location.
|
|
42
|
+
*
|
|
43
|
+
* `import.meta.resolve` throws (rather than returning a falsy value) for an
|
|
44
|
+
* unresolvable specifier, and is itself absent on a few older runtimes — both
|
|
45
|
+
* are treated as "not installed", which is the safe direction: the caller then
|
|
46
|
+
* takes the degraded path instead of importing something that is not there.
|
|
47
|
+
*/
|
|
48
|
+
function canResolveOptionalPeer(specifier) {
|
|
49
|
+
try {
|
|
50
|
+
return typeof {}.resolve(specifier) === "string";
|
|
51
|
+
} catch {
|
|
52
|
+
return false;
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
/** Whether `@ait-co/debugger`'s dev-bridge is installed (env-2 CDP path). */
|
|
56
|
+
function hasDebugger() {
|
|
57
|
+
return canResolveOptionalPeer(DEBUGGER_DEV_BRIDGE_ID);
|
|
58
|
+
}
|
|
59
|
+
/** Whether `@ait-co/debug-console` is installed (in-app attach injection). */
|
|
60
|
+
function hasDebugConsole() {
|
|
61
|
+
return canResolveOptionalPeer(DEBUG_CONSOLE_ID);
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Whether `code` already wires the in-app debug attach itself.
|
|
65
|
+
*
|
|
66
|
+
* Both the current (`@ait-co/debug-console`) and the pre-split
|
|
67
|
+
* (`@ait-co/devtools/in-app`) specifier count, so a consumer who wired either
|
|
68
|
+
* one by hand never gets a duplicate auto-injection.
|
|
69
|
+
*/
|
|
70
|
+
function hasInAppWiring(code) {
|
|
71
|
+
return code.includes("@ait-co/debug-console") || code.includes("@ait-co/devtools/in-app");
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* The gated dynamic-import snippet prepended to a consumer entry point.
|
|
75
|
+
*
|
|
76
|
+
* The runtime gate (`?debug=1` + a `relay` param) keeps the chunk unloaded on a
|
|
77
|
+
* normal page load, and a production build dead-code-eliminates it. The
|
|
78
|
+
* build-time gate is {@link hasDebugConsole} at the call site: when the package
|
|
79
|
+
* is absent this snippet is never produced, so the attach code cannot be in the
|
|
80
|
+
* bundle at all.
|
|
81
|
+
*/
|
|
82
|
+
function buildInAppSnippet() {
|
|
83
|
+
return [
|
|
84
|
+
"// @ait-co/devtools: in-app attach auto-injected by unplugin — 수동 배선 불필요",
|
|
85
|
+
"if (typeof window !== 'undefined') {",
|
|
86
|
+
" const __ait_p = new URLSearchParams(window.location.search);",
|
|
87
|
+
" if (__ait_p.get('debug') === '1' && __ait_p.get('relay')) {",
|
|
88
|
+
` void import('${DEBUG_CONSOLE_ID}').then((m) => m.maybeAttach());`,
|
|
89
|
+
" }",
|
|
90
|
+
"}"
|
|
91
|
+
].join("\n");
|
|
92
|
+
}
|
|
93
|
+
//#endregion
|
|
94
|
+
Object.defineProperty(exports, "DEBUGGER_DEV_BRIDGE_ID", {
|
|
95
|
+
enumerable: true,
|
|
96
|
+
get: function() {
|
|
97
|
+
return DEBUGGER_DEV_BRIDGE_ID;
|
|
98
|
+
}
|
|
99
|
+
});
|
|
100
|
+
Object.defineProperty(exports, "INSTALL_HINT", {
|
|
101
|
+
enumerable: true,
|
|
102
|
+
get: function() {
|
|
103
|
+
return INSTALL_HINT;
|
|
104
|
+
}
|
|
105
|
+
});
|
|
106
|
+
Object.defineProperty(exports, "buildInAppSnippet", {
|
|
107
|
+
enumerable: true,
|
|
108
|
+
get: function() {
|
|
109
|
+
return buildInAppSnippet;
|
|
110
|
+
}
|
|
111
|
+
});
|
|
112
|
+
Object.defineProperty(exports, "hasDebugConsole", {
|
|
113
|
+
enumerable: true,
|
|
114
|
+
get: function() {
|
|
115
|
+
return hasDebugConsole;
|
|
116
|
+
}
|
|
117
|
+
});
|
|
118
|
+
Object.defineProperty(exports, "hasDebugger", {
|
|
119
|
+
enumerable: true,
|
|
120
|
+
get: function() {
|
|
121
|
+
return hasDebugger;
|
|
122
|
+
}
|
|
123
|
+
});
|
|
124
|
+
Object.defineProperty(exports, "hasInAppWiring", {
|
|
125
|
+
enumerable: true,
|
|
126
|
+
get: function() {
|
|
127
|
+
return hasInAppWiring;
|
|
128
|
+
}
|
|
129
|
+
});
|
|
130
|
+
|
|
131
|
+
//# sourceMappingURL=optional-peers-CDEFhlhJ.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"optional-peers-CDEFhlhJ.cjs","names":[],"sources":["../src/unplugin/optional-peers.ts"],"sourcesContent":["/**\n * Optional-peer resolution gates for the debug surface (issue #817).\n *\n * The debug surface now ships as two SEPARATE packages, declared here as\n * OPTIONAL peerDependencies of `@ait-co/devtools`:\n *\n * - `@ait-co/debugger` — MCP daemon / test runner / dev-bridge. devDependency\n * or `npx` only; never part of an app bundle.\n * - `@ait-co/debug-console` — on-device attach + eruda console. The ONLY debug\n * package that can legitimately enter an app bundle.\n *\n * Neither may become a hard dependency. The overwhelming majority of consumers\n * use environment 1 only (browser + mock SDK + panel) and must install NOTHING\n * extra — that is the whole point of splitting the packages apart. So every\n * call site reaches them through the resolution gates below and degrades\n * gracefully when they are absent:\n *\n * - env-2 CDP wiring (`tunnel.cdp`) → falls back to the plain screen-preview\n * tunnel (no relay, no dashboard) and prints {@link INSTALL_HINT}.\n * - in-app attach injection → the snippet is simply not injected, so the\n * attach code is STRUCTURALLY ABSENT from the bundle rather than merely\n * gated at runtime. This gate is the technical enforcement point of the\n * debug surface's security scope: no `@ait-co/debug-console` installed\n * means no attach code can reach a bundle at all.\n *\n * The `import.meta.resolve` probe follows the `MOCK_PATH` precedent in\n * `./index.ts`: resolution is attempted once at plugin-load time and a failure\n * is a plain \"not installed\" signal, never an error.\n *\n * SECRET-HANDLING: nothing here touches a relay URL, tunnel host, TOTP secret\n * or code. The only strings emitted are fixed specifiers and the install hint.\n */\n\n/** Subpath of `@ait-co/debugger` that the unplugin's dev loop delegates to. */\nexport const DEBUGGER_DEV_BRIDGE_ID = '@ait-co/debugger/dev-bridge';\n\n/** The on-device attach package injected into a consumer entry point. */\nexport const DEBUG_CONSOLE_ID = '@ait-co/debug-console';\n\n/**\n * The pre-split in-app specifier. Still recognised for DEDUPE only — a consumer\n * who wired `@ait-co/devtools/in-app` by hand must not also receive the new\n * auto-injected snippet. It is never injected any more.\n */\nexport const LEGACY_IN_APP_ID = '@ait-co/devtools/in-app';\n\n/** One-line install hint printed whenever a gate closes on a missing package. */\nexport const INSTALL_HINT = 'pnpm add -D @ait-co/debugger @ait-co/debug-console';\n\n/**\n * Returns whether `specifier` resolves from this package's location.\n *\n * `import.meta.resolve` throws (rather than returning a falsy value) for an\n * unresolvable specifier, and is itself absent on a few older runtimes — both\n * are treated as \"not installed\", which is the safe direction: the caller then\n * takes the degraded path instead of importing something that is not there.\n */\nexport function canResolveOptionalPeer(specifier: string): boolean {\n try {\n return typeof import.meta.resolve(specifier) === 'string';\n } catch {\n return false;\n }\n}\n\n/** Whether `@ait-co/debugger`'s dev-bridge is installed (env-2 CDP path). */\nexport function hasDebugger(): boolean {\n return canResolveOptionalPeer(DEBUGGER_DEV_BRIDGE_ID);\n}\n\n/** Whether `@ait-co/debug-console` is installed (in-app attach injection). */\nexport function hasDebugConsole(): boolean {\n return canResolveOptionalPeer(DEBUG_CONSOLE_ID);\n}\n\n/**\n * Whether `code` already wires the in-app debug attach itself.\n *\n * Both the current (`@ait-co/debug-console`) and the pre-split\n * (`@ait-co/devtools/in-app`) specifier count, so a consumer who wired either\n * one by hand never gets a duplicate auto-injection.\n */\nexport function hasInAppWiring(code: string): boolean {\n return code.includes(DEBUG_CONSOLE_ID) || code.includes(LEGACY_IN_APP_ID);\n}\n\n/**\n * The gated dynamic-import snippet prepended to a consumer entry point.\n *\n * The runtime gate (`?debug=1` + a `relay` param) keeps the chunk unloaded on a\n * normal page load, and a production build dead-code-eliminates it. The\n * build-time gate is {@link hasDebugConsole} at the call site: when the package\n * is absent this snippet is never produced, so the attach code cannot be in the\n * bundle at all.\n */\nexport function buildInAppSnippet(): string {\n return [\n '// @ait-co/devtools: in-app attach auto-injected by unplugin — 수동 배선 불필요',\n \"if (typeof window !== 'undefined') {\",\n ' const __ait_p = new URLSearchParams(window.location.search);',\n \" if (__ait_p.get('debug') === '1' && __ait_p.get('relay')) {\",\n ` void import('${DEBUG_CONSOLE_ID}').then((m) => m.maybeAttach());`,\n ' }',\n '}',\n ].join('\\n');\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAkCA,MAAa,yBAAyB;;AAGtC,MAAa,mBAAmB;;AAUhC,MAAa,eAAe;;;;;;;;;AAU5B,SAAgB,uBAAuB,WAA4B;AACjE,KAAI;AACF,SAAO,OAAA,EAAA,CAAmB,QAAQ,UAAU,KAAK;SAC3C;AACN,SAAO;;;;AAKX,SAAgB,cAAuB;AACrC,QAAO,uBAAuB,uBAAuB;;;AAIvD,SAAgB,kBAA2B;AACzC,QAAO,uBAAuB,iBAAiB;;;;;;;;;AAUjD,SAAgB,eAAe,MAAuB;AACpD,QAAO,KAAK,SAAA,wBAA0B,IAAI,KAAK,SAAA,0BAA0B;;;;;;;;;;;AAY3E,SAAgB,oBAA4B;AAC1C,QAAO;EACL;EACA;EACA;EACA;EACA,oBAAoB,iBAAiB;EACrC;EACA;EACD,CAAC,KAAK,KAAK"}
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
//#region src/unplugin/optional-peers.ts
|
|
2
|
+
/**
|
|
3
|
+
* Optional-peer resolution gates for the debug surface (issue #817).
|
|
4
|
+
*
|
|
5
|
+
* The debug surface now ships as two SEPARATE packages, declared here as
|
|
6
|
+
* OPTIONAL peerDependencies of `@ait-co/devtools`:
|
|
7
|
+
*
|
|
8
|
+
* - `@ait-co/debugger` — MCP daemon / test runner / dev-bridge. devDependency
|
|
9
|
+
* or `npx` only; never part of an app bundle.
|
|
10
|
+
* - `@ait-co/debug-console` — on-device attach + eruda console. The ONLY debug
|
|
11
|
+
* package that can legitimately enter an app bundle.
|
|
12
|
+
*
|
|
13
|
+
* Neither may become a hard dependency. The overwhelming majority of consumers
|
|
14
|
+
* use environment 1 only (browser + mock SDK + panel) and must install NOTHING
|
|
15
|
+
* extra — that is the whole point of splitting the packages apart. So every
|
|
16
|
+
* call site reaches them through the resolution gates below and degrades
|
|
17
|
+
* gracefully when they are absent:
|
|
18
|
+
*
|
|
19
|
+
* - env-2 CDP wiring (`tunnel.cdp`) → falls back to the plain screen-preview
|
|
20
|
+
* tunnel (no relay, no dashboard) and prints {@link INSTALL_HINT}.
|
|
21
|
+
* - in-app attach injection → the snippet is simply not injected, so the
|
|
22
|
+
* attach code is STRUCTURALLY ABSENT from the bundle rather than merely
|
|
23
|
+
* gated at runtime. This gate is the technical enforcement point of the
|
|
24
|
+
* debug surface's security scope: no `@ait-co/debug-console` installed
|
|
25
|
+
* means no attach code can reach a bundle at all.
|
|
26
|
+
*
|
|
27
|
+
* The `import.meta.resolve` probe follows the `MOCK_PATH` precedent in
|
|
28
|
+
* `./index.ts`: resolution is attempted once at plugin-load time and a failure
|
|
29
|
+
* is a plain "not installed" signal, never an error.
|
|
30
|
+
*
|
|
31
|
+
* SECRET-HANDLING: nothing here touches a relay URL, tunnel host, TOTP secret
|
|
32
|
+
* or code. The only strings emitted are fixed specifiers and the install hint.
|
|
33
|
+
*/
|
|
34
|
+
/** Subpath of `@ait-co/debugger` that the unplugin's dev loop delegates to. */
|
|
35
|
+
const DEBUGGER_DEV_BRIDGE_ID = "@ait-co/debugger/dev-bridge";
|
|
36
|
+
/** The on-device attach package injected into a consumer entry point. */
|
|
37
|
+
const DEBUG_CONSOLE_ID = "@ait-co/debug-console";
|
|
38
|
+
/** One-line install hint printed whenever a gate closes on a missing package. */
|
|
39
|
+
const INSTALL_HINT = "pnpm add -D @ait-co/debugger @ait-co/debug-console";
|
|
40
|
+
/**
|
|
41
|
+
* Returns whether `specifier` resolves from this package's location.
|
|
42
|
+
*
|
|
43
|
+
* `import.meta.resolve` throws (rather than returning a falsy value) for an
|
|
44
|
+
* unresolvable specifier, and is itself absent on a few older runtimes — both
|
|
45
|
+
* are treated as "not installed", which is the safe direction: the caller then
|
|
46
|
+
* takes the degraded path instead of importing something that is not there.
|
|
47
|
+
*/
|
|
48
|
+
function canResolveOptionalPeer(specifier) {
|
|
49
|
+
try {
|
|
50
|
+
return typeof import.meta.resolve(specifier) === "string";
|
|
51
|
+
} catch {
|
|
52
|
+
return false;
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
/** Whether `@ait-co/debugger`'s dev-bridge is installed (env-2 CDP path). */
|
|
56
|
+
function hasDebugger() {
|
|
57
|
+
return canResolveOptionalPeer(DEBUGGER_DEV_BRIDGE_ID);
|
|
58
|
+
}
|
|
59
|
+
/** Whether `@ait-co/debug-console` is installed (in-app attach injection). */
|
|
60
|
+
function hasDebugConsole() {
|
|
61
|
+
return canResolveOptionalPeer(DEBUG_CONSOLE_ID);
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Whether `code` already wires the in-app debug attach itself.
|
|
65
|
+
*
|
|
66
|
+
* Both the current (`@ait-co/debug-console`) and the pre-split
|
|
67
|
+
* (`@ait-co/devtools/in-app`) specifier count, so a consumer who wired either
|
|
68
|
+
* one by hand never gets a duplicate auto-injection.
|
|
69
|
+
*/
|
|
70
|
+
function hasInAppWiring(code) {
|
|
71
|
+
return code.includes("@ait-co/debug-console") || code.includes("@ait-co/devtools/in-app");
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* The gated dynamic-import snippet prepended to a consumer entry point.
|
|
75
|
+
*
|
|
76
|
+
* The runtime gate (`?debug=1` + a `relay` param) keeps the chunk unloaded on a
|
|
77
|
+
* normal page load, and a production build dead-code-eliminates it. The
|
|
78
|
+
* build-time gate is {@link hasDebugConsole} at the call site: when the package
|
|
79
|
+
* is absent this snippet is never produced, so the attach code cannot be in the
|
|
80
|
+
* bundle at all.
|
|
81
|
+
*/
|
|
82
|
+
function buildInAppSnippet() {
|
|
83
|
+
return [
|
|
84
|
+
"// @ait-co/devtools: in-app attach auto-injected by unplugin — 수동 배선 불필요",
|
|
85
|
+
"if (typeof window !== 'undefined') {",
|
|
86
|
+
" const __ait_p = new URLSearchParams(window.location.search);",
|
|
87
|
+
" if (__ait_p.get('debug') === '1' && __ait_p.get('relay')) {",
|
|
88
|
+
` void import('${DEBUG_CONSOLE_ID}').then((m) => m.maybeAttach());`,
|
|
89
|
+
" }",
|
|
90
|
+
"}"
|
|
91
|
+
].join("\n");
|
|
92
|
+
}
|
|
93
|
+
//#endregion
|
|
94
|
+
export { hasDebugger as a, hasDebugConsole as i, INSTALL_HINT as n, hasInAppWiring as o, buildInAppSnippet as r, DEBUGGER_DEV_BRIDGE_ID as t };
|
|
95
|
+
|
|
96
|
+
//# sourceMappingURL=optional-peers-FdVbUJst.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"optional-peers-FdVbUJst.js","names":[],"sources":["../src/unplugin/optional-peers.ts"],"sourcesContent":["/**\n * Optional-peer resolution gates for the debug surface (issue #817).\n *\n * The debug surface now ships as two SEPARATE packages, declared here as\n * OPTIONAL peerDependencies of `@ait-co/devtools`:\n *\n * - `@ait-co/debugger` — MCP daemon / test runner / dev-bridge. devDependency\n * or `npx` only; never part of an app bundle.\n * - `@ait-co/debug-console` — on-device attach + eruda console. The ONLY debug\n * package that can legitimately enter an app bundle.\n *\n * Neither may become a hard dependency. The overwhelming majority of consumers\n * use environment 1 only (browser + mock SDK + panel) and must install NOTHING\n * extra — that is the whole point of splitting the packages apart. So every\n * call site reaches them through the resolution gates below and degrades\n * gracefully when they are absent:\n *\n * - env-2 CDP wiring (`tunnel.cdp`) → falls back to the plain screen-preview\n * tunnel (no relay, no dashboard) and prints {@link INSTALL_HINT}.\n * - in-app attach injection → the snippet is simply not injected, so the\n * attach code is STRUCTURALLY ABSENT from the bundle rather than merely\n * gated at runtime. This gate is the technical enforcement point of the\n * debug surface's security scope: no `@ait-co/debug-console` installed\n * means no attach code can reach a bundle at all.\n *\n * The `import.meta.resolve` probe follows the `MOCK_PATH` precedent in\n * `./index.ts`: resolution is attempted once at plugin-load time and a failure\n * is a plain \"not installed\" signal, never an error.\n *\n * SECRET-HANDLING: nothing here touches a relay URL, tunnel host, TOTP secret\n * or code. The only strings emitted are fixed specifiers and the install hint.\n */\n\n/** Subpath of `@ait-co/debugger` that the unplugin's dev loop delegates to. */\nexport const DEBUGGER_DEV_BRIDGE_ID = '@ait-co/debugger/dev-bridge';\n\n/** The on-device attach package injected into a consumer entry point. */\nexport const DEBUG_CONSOLE_ID = '@ait-co/debug-console';\n\n/**\n * The pre-split in-app specifier. Still recognised for DEDUPE only — a consumer\n * who wired `@ait-co/devtools/in-app` by hand must not also receive the new\n * auto-injected snippet. It is never injected any more.\n */\nexport const LEGACY_IN_APP_ID = '@ait-co/devtools/in-app';\n\n/** One-line install hint printed whenever a gate closes on a missing package. */\nexport const INSTALL_HINT = 'pnpm add -D @ait-co/debugger @ait-co/debug-console';\n\n/**\n * Returns whether `specifier` resolves from this package's location.\n *\n * `import.meta.resolve` throws (rather than returning a falsy value) for an\n * unresolvable specifier, and is itself absent on a few older runtimes — both\n * are treated as \"not installed\", which is the safe direction: the caller then\n * takes the degraded path instead of importing something that is not there.\n */\nexport function canResolveOptionalPeer(specifier: string): boolean {\n try {\n return typeof import.meta.resolve(specifier) === 'string';\n } catch {\n return false;\n }\n}\n\n/** Whether `@ait-co/debugger`'s dev-bridge is installed (env-2 CDP path). */\nexport function hasDebugger(): boolean {\n return canResolveOptionalPeer(DEBUGGER_DEV_BRIDGE_ID);\n}\n\n/** Whether `@ait-co/debug-console` is installed (in-app attach injection). */\nexport function hasDebugConsole(): boolean {\n return canResolveOptionalPeer(DEBUG_CONSOLE_ID);\n}\n\n/**\n * Whether `code` already wires the in-app debug attach itself.\n *\n * Both the current (`@ait-co/debug-console`) and the pre-split\n * (`@ait-co/devtools/in-app`) specifier count, so a consumer who wired either\n * one by hand never gets a duplicate auto-injection.\n */\nexport function hasInAppWiring(code: string): boolean {\n return code.includes(DEBUG_CONSOLE_ID) || code.includes(LEGACY_IN_APP_ID);\n}\n\n/**\n * The gated dynamic-import snippet prepended to a consumer entry point.\n *\n * The runtime gate (`?debug=1` + a `relay` param) keeps the chunk unloaded on a\n * normal page load, and a production build dead-code-eliminates it. The\n * build-time gate is {@link hasDebugConsole} at the call site: when the package\n * is absent this snippet is never produced, so the attach code cannot be in the\n * bundle at all.\n */\nexport function buildInAppSnippet(): string {\n return [\n '// @ait-co/devtools: in-app attach auto-injected by unplugin — 수동 배선 불필요',\n \"if (typeof window !== 'undefined') {\",\n ' const __ait_p = new URLSearchParams(window.location.search);',\n \" if (__ait_p.get('debug') === '1' && __ait_p.get('relay')) {\",\n ` void import('${DEBUG_CONSOLE_ID}').then((m) => m.maybeAttach());`,\n ' }',\n '}',\n ].join('\\n');\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAkCA,MAAa,yBAAyB;;AAGtC,MAAa,mBAAmB;;AAUhC,MAAa,eAAe;;;;;;;;;AAU5B,SAAgB,uBAAuB,WAA4B;AACjE,KAAI;AACF,SAAO,OAAO,OAAO,KAAK,QAAQ,UAAU,KAAK;SAC3C;AACN,SAAO;;;;AAKX,SAAgB,cAAuB;AACrC,QAAO,uBAAuB,uBAAuB;;;AAIvD,SAAgB,kBAA2B;AACzC,QAAO,uBAAuB,iBAAiB;;;;;;;;;AAUjD,SAAgB,eAAe,MAAuB;AACpD,QAAO,KAAK,SAAA,wBAA0B,IAAI,KAAK,SAAA,0BAA0B;;;;;;;;;;;AAY3E,SAAgB,oBAA4B;AAC1C,QAAO;EACL;EACA;EACA;EACA;EACA,oBAAoB,iBAAiB;EACrC;EACA;EACD,CAAC,KAAK,KAAK"}
|
package/dist/panel/index.js
CHANGED
|
@@ -27567,7 +27567,7 @@ const TossAds = createMockProxy("TossAds", {
|
|
|
27567
27567
|
_slotRegistry.clear();
|
|
27568
27568
|
}))
|
|
27569
27569
|
});
|
|
27570
|
-
const loadFullScreenAd =
|
|
27570
|
+
const loadFullScreenAd = observe("loadFullScreenAd", "faithful", (args) => {
|
|
27571
27571
|
setTimeout(() => {
|
|
27572
27572
|
const failureCode = aitState.state.failureModes.loadFullScreenAd;
|
|
27573
27573
|
if (failureCode) {
|
|
@@ -27582,7 +27582,7 @@ const loadFullScreenAd = withIsSupported(observe("loadFullScreenAd", "faithful",
|
|
|
27582
27582
|
args.onEvent({ type: "loaded" });
|
|
27583
27583
|
}, 200);
|
|
27584
27584
|
return () => {};
|
|
27585
|
-
})
|
|
27585
|
+
});
|
|
27586
27586
|
const showFullScreenAd = withIsSupported(observe("showFullScreenAd", "faithful", (args) => {
|
|
27587
27587
|
if (!aitState.state.ads.isLoaded) {
|
|
27588
27588
|
args.onError(/* @__PURE__ */ new Error("Ad not loaded"));
|
|
@@ -30295,7 +30295,7 @@ function Panel() {
|
|
|
30295
30295
|
color: "#666",
|
|
30296
30296
|
fontWeight: 400
|
|
30297
30297
|
},
|
|
30298
|
-
children: ["v", "0.1.
|
|
30298
|
+
children: ["v", "0.1.144"]
|
|
30299
30299
|
}),
|
|
30300
30300
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", {
|
|
30301
30301
|
type: "button",
|