Skip to content

Commit b0b11cb

Browse files
committed
Merge main into docs/site-improvements
2 parents 61cbd1c + 4266251 commit b0b11cb

31 files changed

Lines changed: 1997 additions & 56 deletions

‎apps/docs/src/content/api/index.md‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,15 +16,15 @@ Each entry point of `@pangular-inspector/devtools` has a page with every symbol
1616
| [`@pangular-inspector/devtools/devframe`](./devframe.md) | `createPangular`, `default`, `DEFAULT_POPUP_HOTKEY`, `initDevframe`, `PANGULAR_ACTIONS`, `PANGULAR_INSPECTORS`, `PANGULAR_LIMITS`, `PangularAction`, `PangularConfig`, `PangularHostOptions`, `PangularInspector`, `PangularLimit`, `PluginSwitchInput`, `ResolvedPangularConfig`, `resolvePangularConfig` |
1717
| [`@pangular-inspector/devtools/config`](./config.md) | `DEFAULT_POPUP_HOTKEY`, `PANGULAR_ACTIONS`, `PANGULAR_INSPECTORS`, `PANGULAR_LIMITS`, `PangularAction`, `PangularConfig`, `PangularInspector`, `PangularLimit`, `PluginSwitchInput`, `ResolvedPangularConfig`, `resolvePangularConfig` |
1818
| [`@pangular-inspector/devtools/cd-data`](./cd-data.md) | `CD_CAUSE_KINDS`, `CD_CAUSE_LABEL`, `CD_EXPORT_FORMAT`, `CD_HINT_MAX_CHANGED`, `CD_HINT_MIN_CHECKS`, `CD_SPAN_KIND`, `cdCauseText`, `cdExportFile`, `CdExportFile`, `CdHint`, `cdHints`, `CdOptionsRequest`, `CdTraceEvent`, `cdTraceFile`, `CdTraceFile`, `MAX_CD_IMPORT_BYTES`, `MAX_SPANS`, `parseCdImport`, `sanitizeCdDiagnosis`, `sanitizeCdRecording`, `toCdOptions`, `toCdOptionsRequest`, `UNNAMED_SIGNAL` |
19-
| [`@pangular-inspector/devtools/overlay`](./overlay.md) | `disposeOverlay`, `initOverlay`, `installSignalWriteHook`, `OverlayConnectionMeta`, `OverlayOptions`, `registerNgrxSignals` |
20-
| [`@pangular-inspector/devtools/overlay-manual`](./overlay-manual.md) | `disposeOverlay`, `initOverlay`, `installSignalWriteHook`, `OverlayConnectionMeta`, `OverlayOptions`, `registerNgrxSignals` |
19+
| [`@pangular-inspector/devtools/overlay`](./overlay.md) | `disposeOverlay`, `initOverlay`, `installSignalWriteHook`, `lanDevtoolsURL`, `OverlayConnectionMeta`, `OverlayOptions`, `registerNgrxSignals` |
20+
| [`@pangular-inspector/devtools/overlay-manual`](./overlay-manual.md) | `disposeOverlay`, `initOverlay`, `installSignalWriteHook`, `lanDevtoolsURL`, `OverlayConnectionMeta`, `OverlayOptions`, `registerNgrxSignals` |
2121
| [`@pangular-inspector/devtools/plugin`](./plugin.md) | `definePangularServerPlugin`, `PANGULAR_PLUGIN_API_VERSION`, `PangularPagePlugin`, `PangularPluginAction`, `PangularPluginContext`, `PangularPluginPage`, `pangularPluginRegistry`, `PangularPluginRegistry`, `PangularPluginTool`, `PangularPluginToolContext`, `PangularPluginToolSafety`, `PangularServerPlugin`, `PangularServerPluginContext`, `PluginActionResult`, `PluginBadge`, `PluginCell`, `PluginListSection`, `PluginSection`, `PluginSerializeLimits`, `PluginStatsSection`, `PluginTableSection`, `PluginTextSection`, `PluginTone`, `PluginTreeSection`, `PluginView`, `PluginViewAction`, `registerPangularPlugin` |
2222
| [`@pangular-inspector/devtools/capacitor-hook`](./capacitor-hook.md) | `installCapacitorHook` |
2323
| [`@pangular-inspector/devtools/store-hook`](./store-hook.md) | `installStoreHook` |
2424
| [`@pangular-inspector/devtools/startup-hook`](./startup-hook.md) | `installStartupHook` |
2525
| [`@pangular-inspector/devtools/overlay-angular-native`](./overlay-angular-native.md) | `AngularNativeNode`, `AngularNativeOverlayOptions`, `DEFAULT_ANGULAR_NATIVE_BASE_URL`, `initAngularNativeOverlay`, `withWebShims` |
2626
| [`@pangular-inspector/devtools/popup`](./popup.md) | `createDevtoolsPopup`, `hideDevtools`, `LauncherCounts`, `shortCount`, `showDevtools` |
27-
| [`@pangular-inspector/devtools/overlay-nativescript`](./overlay-nativescript.md) | `defaultDevtoolsBaseURL`, `initNativeScriptOverlay`, `NativeScriptOverlayOptions` |
27+
| [`@pangular-inspector/devtools/overlay-nativescript`](./overlay-nativescript.md) | `defaultDevtoolsBaseURL`, `initNativeScriptOverlay`, `lanDevtoolsURL`, `NativeScriptOverlayOptions` |
2828
| [`@pangular-inspector/devtools/cli`](./cli.md) | `buildReport`, `BuildReportOptions`, `BuildReportResult`, `createPangularCli`, `DEFAULT_REPORT_DIR`, `PangularCliOptions` |
2929
| [`@pangular-inspector/devtools/http`](./http.md) | `providePangularHttp`, `withPangular` |
3030
| [`@pangular-inspector/devtools/hub`](./hub.md) | `hubEnabled`, `initPangularHub`, `PANGULAR_HUB_BASE`, `PangularConfig`, `PangularHubOptions` |

‎apps/docs/src/content/api/overlay-manual.md‎

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,18 @@ async function installSignalWriteHook(
4343
): Promise<(() => void) | null>;
4444
```
4545

46+
## lanDevtoolsURL
47+
48+
Function. Source: [`packages/devtools/src/lan-url.ts`](https://github.com/pangular-inspector/devtools/blob/main/packages/devtools/src/lan-url.ts).
49+
50+
The devtools server URL on the LAN that the build injected, or `undefined`
51+
when it injected none. Bundlers replace the constant at build time; Vite's
52+
dev server may define it on `globalThis` instead, so both are read.
53+
54+
```ts
55+
function lanDevtoolsURL(): string | undefined;
56+
```
57+
4658
## OverlayConnectionMeta
4759

4860
Type. Source: [`packages/devtools/src/overlay.ts`](https://github.com/pangular-inspector/devtools/blob/main/packages/devtools/src/overlay.ts).

‎apps/docs/src/content/api/overlay-nativescript.md‎

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,13 +30,28 @@ Function. Source: [`packages/devtools/src/overlay-nativescript.ts`](https://gith
3030
function initNativeScriptOverlay(options: NativeScriptOverlayOptions = {}): () => void;
3131
```
3232

33+
## lanDevtoolsURL
34+
35+
Function. Source: [`packages/devtools/src/lan-url.ts`](https://github.com/pangular-inspector/devtools/blob/main/packages/devtools/src/lan-url.ts).
36+
37+
The devtools server URL on the LAN that the build injected, or `undefined`
38+
when it injected none. Bundlers replace the constant at build time; Vite's
39+
dev server may define it on `globalThis` instead, so both are read.
40+
41+
```ts
42+
function lanDevtoolsURL(): string | undefined;
43+
```
44+
3345
## NativeScriptOverlayOptions
3446

3547
Interface. Source: [`packages/devtools/src/overlay-nativescript.ts`](https://github.com/pangular-inspector/devtools/blob/main/packages/devtools/src/overlay-nativescript.ts).
3648

3749
```ts
3850
interface NativeScriptOverlayOptions {
39-
/** Absolute URL of the devtools server. Defaults to `defaultDevtoolsBaseURL()`. */
51+
/**
52+
* Absolute URL of the devtools server. Defaults to the LAN address the build
53+
* injected (`lanDevtoolsURL()`), then to `defaultDevtoolsBaseURL()`.
54+
*/
4055
baseURL?: string;
4156
/** How often the app reports, in milliseconds. Defaults to the server's `limits.refreshMs`. */
4257
intervalMs?: number;

‎apps/docs/src/content/api/overlay.md‎

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,18 @@ async function installSignalWriteHook(
4343
): Promise<(() => void) | null>;
4444
```
4545

46+
## lanDevtoolsURL
47+
48+
Function. Source: [`packages/devtools/src/lan-url.ts`](https://github.com/pangular-inspector/devtools/blob/main/packages/devtools/src/lan-url.ts).
49+
50+
The devtools server URL on the LAN that the build injected, or `undefined`
51+
when it injected none. Bundlers replace the constant at build time; Vite's
52+
dev server may define it on `globalThis` instead, so both are read.
53+
54+
```ts
55+
function lanDevtoolsURL(): string | undefined;
56+
```
57+
4658
## OverlayConnectionMeta
4759

4860
Type. Source: [`packages/devtools/src/overlay.ts`](https://github.com/pangular-inspector/devtools/blob/main/packages/devtools/src/overlay.ts).

‎apps/docs/src/content/api/vite.md‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,14 @@ interface PangularViteOptions extends PangularConfig {
163163
* default. Ignored with `allowLan`.
164164
*/
165165
terminals?: boolean;
166+
/**
167+
* Inject the dev server's LAN address into the app as `__PANGULAR_LAN_URL__`,
168+
* so a phone app (Capacitor, NativeScript) built in development mode finds
169+
* the devtools. `true` picks this machine's address; a string names one,
170+
* such as `'192.168.1.20'`. Off by default. Needs `allowLan` in effect and
171+
* `server.host` on the network; it changes nothing about who may connect.
172+
*/
173+
lanAddress?: boolean | string;
166174
/** Pangular plugins' server sides: their agent tools and shared state. */
167175
serverPlugins?: readonly PangularServerPlugin[];
168176
}

‎apps/docs/src/content/getting-started/cli.md‎

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,11 +126,32 @@ When the server listens on your network (`--host 0.0.0.0` or a network address),
126126
| `--allowed-origin <origin>` | An extra origin allowed to reach the server, such as `http://192.168.1.20:8100`. Repeat it for more. |
127127
| `--proxy-origin <origin>` | The origin of your app's dev server when it proxies `/__pangular/` to this server, such as `http://localhost:4200`. The panel URL on that origin and the one-time code link point there, and the server accepts requests from that origin. See [Client-only Angular CLI app](./installation.md#client-only-angular-cli-app). |
128128
| `--auth-token <token>` | A [pairing token](../security.md#pairing-tokens) a client may send instead of the one-time code. Repeat it for more. Prefer the `PANGULAR_AUTH_TOKEN` environment variable. |
129+
| `--lan-address [address]` | Print the server's URL on your network and the define that injects it into a development build of a phone app. Off by default. Without a value it picks this machine's first private IPv4 address. Needs `--host` on the network. See [Inject the LAN address](#inject-the-lan-address). |
129130

130131
<ngmd-callout type="warning" title="Keep it on localhost">
131132
The server binds to <code>localhost</code> by default and asks for a one-time code. Changing <code>--host</code> or passing <code>--no-auth</code> widens who can reach it. See <a href="../security.md">Access and redaction</a>.
132133
</ngmd-callout>
133134

135+
### Inject the LAN address
136+
137+
A phone app (Capacitor, NativeScript) needs the server's address on your network. The CLI doesn't build your app, so `--lan-address` prints the URL and the define to pass to your app's build. Start the server on the network with it:
138+
139+
```bash
140+
npx pangular dev --host 0.0.0.0 --lan-address
141+
```
142+
143+
It prints lines like these after the startup lines:
144+
145+
```text
146+
LAN address for a device build: http://192.168.1.20:9999/
147+
Inject it as __PANGULAR_LAN_URL__, for example in an Angular CLI app:
148+
ng build --configuration development --define "__PANGULAR_LAN_URL__='http://192.168.1.20:9999/'"
149+
```
150+
151+
The `--define` flag needs the `application` builder of Angular 17.2 or later. The NativeScript overlay connects to the injected URL when you pass no `baseURL`, and `lanDevtoolsURL()` from `@pangular-inspector/devtools/overlay-manual` reads it in a Capacitor app. See [Set up Capacitor](../guides/capacitor.md#use-the-injected-lan-address) and [Set up NativeScript](./nativescript.md#use-the-injected-lan-address).
152+
153+
`--lan-address` only prints. It doesn't change the host the server binds to, the origin check or the one-time code. With `--host localhost`, the default, it prints a warning and no address, since a phone can't reach that server. `--lan-address 192.168.1.20` names the address, for a machine on several networks. A loopback address is refused.
154+
134155
### What it shows
135156

136157
When no app is connected, the tabs show what your source declares. An [Angular Native](./angular-native.md) app connects through the **Angular Native apps** URL above and shows live data there:

0 commit comments

Comments
 (0)