@moku-labs/native 0.3.11 → 0.3.13

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/index.d.cts CHANGED
@@ -34,26 +34,41 @@ type BuildFlavor = {
34
34
  aab?: boolean | undefined;
35
35
  /**
36
36
  * Build the debug profile instead of the store one: a still-optimized build that installs
37
- * next to the store app (`.debug` id, "(debug)" name), is signed with the debug keystore,
38
- * forwards the page console and allows cleartext. Unset means the store profile.
37
+ * next to the store app. On Android native gives it the `.debug` id and "(debug)" name, signs
38
+ * it with the debug keystore, forwards the page console and allows cleartext. On iOS the
39
+ * config names the app, and native adds the local-network keys and the Web Inspector. Unset
40
+ * means the store profile.
39
41
  *
40
42
  * @example
41
43
  * ```ts
42
- * await native.build.run({ target: "android", debug: true });
44
+ * await app.build.run({ target: "android", debug: true });
43
45
  * ```
44
46
  */
45
47
  debug?: boolean | undefined;
48
+ /**
49
+ * Build the dev profile instead of the store one: the store build a tester installs, with
50
+ * the same signing, `.aab`, `exportMethod` and delivery, whose page may carry the editor
51
+ * agent. The app config names the separate app (id, name, icon, `projectDir`, `outDir`);
52
+ * native renames nothing. Combining it with `debug` is an error.
53
+ *
54
+ * @example
55
+ * ```ts
56
+ * await app.build.run({ target: "android", aab: true, dev: true });
57
+ * ```
58
+ */
59
+ dev?: boolean | undefined;
46
60
  };
47
61
  /**
48
62
  * Which profile a build is made in. `"store"` is the shippable build; `"debug"` is the
49
- * on-device test build of {@link BuildFlavor.debug}. The page sees `"store"` as `"release"`.
63
+ * on-device test build of {@link BuildFlavor.debug}; `"dev"` is the store-signed test build
64
+ * of {@link BuildFlavor.dev}. The page sees `"store"` and `"dev"` as `"release"`.
50
65
  *
51
66
  * @example
52
67
  * ```ts
53
- * const profile: BuildProfile = flavor.debug ? "debug" : "store";
68
+ * const profile: BuildProfile = flavor.dev ? "dev" : "store";
54
69
  * ```
55
70
  */
56
- type BuildProfile = "store" | "debug";
71
+ type BuildProfile = "store" | "debug" | "dev";
57
72
  /**
58
73
  * Resolves the packaging targets a host can build with no extra opt-in — the default
59
74
  * `config.targets`. Exactly one desktop target per host (`darwin` → `macos`,
@@ -113,6 +128,19 @@ type CapabilityConfigMap = {
113
128
  * ```
114
129
  */
115
130
  type Orientation = "portrait" | "landscape" | "any";
131
+ /**
132
+ * One Info.plist value: a `<string>`, a `<true/>`/`<false/>`, an `<array>` or a `<dict>`,
133
+ * nested as deep as the key needs.
134
+ *
135
+ * @example
136
+ * ```ts
137
+ * const encryption: PlistValue = false; // ITSAppUsesNonExemptEncryption
138
+ * const transport: PlistValue = { NSAllowsLocalNetworking: true }; // NSAppTransportSecurity
139
+ * ```
140
+ */
141
+ type PlistValue = string | boolean | readonly PlistValue[] | {
142
+ readonly [key: string]: PlistValue;
143
+ };
116
144
  /** How `tauri ios build` exports the signed archive (`--export-method`). */
117
145
  type AppleExportMethod = "app-store-connect" | "release-testing" | "debugging";
118
146
  /**
@@ -153,8 +181,8 @@ type Config = {
153
181
  * App identity, store metadata and presentation — project.onInit validates
154
182
  * name/identifier are non-empty (reverse-DNS identifier). `icon` is a 1024x1024 PNG
155
183
  * relative to cwd (a placeholder is generated when unset); `category` maps to
156
- * `bundle.category`; `buildNumber` maps to the iOS/macOS `bundleVersion`;
157
- * `orientation` locks the mobile screen at build time; `backgroundColor` paints the
184
+ * `bundle.category`; `buildNumber` maps to the iOS/macOS `bundleVersion` and, a whole
185
+ * number from 1 to 2 100 000 000, to the Android `versionCode`; `orientation` locks the mobile screen at build time; `backgroundColor` paints the
158
186
  * native window behind the page.
159
187
  */
160
188
  app: {
@@ -190,6 +218,16 @@ type Config = {
190
218
  * ```
191
219
  */
192
220
  adaptiveIconInset?: number;
221
+ /**
222
+ * iOS: the app turns the idle timer off at launch, so the screen does not dim while it
223
+ * runs. Android keeps it on from the page. Unset leaves the idle timer on.
224
+ *
225
+ * @example
226
+ * ```ts
227
+ * createApp({ config: { app: { name: "Demo", identifier: "com.acme.demo", keepScreenOn: true } } });
228
+ * ```
229
+ */
230
+ keepScreenOn?: boolean;
193
231
  }; /** Web build/dev wiring codegenned into tauri.conf.json. cwd for monorepo layouts. */
194
232
  web: {
195
233
  build: string;
@@ -206,6 +244,21 @@ type Config = {
206
244
  projectDir: string; /** Installer delivery root. */
207
245
  outDir: string; /** Signing env-var references. */
208
246
  signing: SigningConfig;
247
+ /**
248
+ * What an iOS app adds to its bundle. `infoPlist` merges into `Info.plist`, where
249
+ * `app.orientation` wins a shared key; `privacyManifest` is the absolute path of the file
250
+ * the bundle carries as `PrivacyInfo.xcprivacy`. Unset, a manifest an earlier build left
251
+ * in the generated tree is removed.
252
+ *
253
+ * @example
254
+ * ```ts
255
+ * createApp({ config: { ios: { infoPlist: { ITSAppUsesNonExemptEncryption: false } } } });
256
+ * ```
257
+ */
258
+ ios?: {
259
+ infoPlist?: Readonly<Record<string, PlistValue>>;
260
+ privacyManifest?: string;
261
+ };
209
262
  };
210
263
  /** native:phase payload — one flat event, target as a field (context decision). */
211
264
  type NativePhaseEvent = {
@@ -269,8 +322,9 @@ type CompletenessResult = {
269
322
  };
270
323
  /**
271
324
  * Result of the idempotent mobile patch pass: Android release signing and the main
272
- * activity's manifest attributes, the iOS Xcode build settings, and the runner command
273
- * on both platforms. A file several patches touched is listed once.
325
+ * activity's manifest attributes, the iOS Xcode build settings, deployment target, privacy
326
+ * manifest and `Info.plist`, and the runner command on both platforms. A file several
327
+ * patches touched is listed once; a file a patch removed is listed as patched.
274
328
  */
275
329
  type PatchResult = {
276
330
  readonly patched: readonly string[];
@@ -288,8 +342,9 @@ type PatchMobileOptions = {
288
342
  /**
289
343
  * The build profile one Android patch pass applies, with what that profile needs: the
290
344
  * debug profile names the app `"<name> (debug)"` and signs with the debug keystore the
291
- * caller resolved from `ctx.env`. `log` receives the warning about a network security
292
- * config this plugin did not write.
345
+ * caller resolved from `ctx.env`. The `dev` build profile applies as `store`: it is the
346
+ * store build a tester installs, signed with the game's key. `log` receives the warning about
347
+ * a network security config this plugin did not write.
293
348
  *
294
349
  * @example
295
350
  * ```ts
@@ -386,21 +441,10 @@ type DeepLinkConf = {
386
441
  * the app at startup.
387
442
  */
388
443
  type TauriConfFragment = Record<string, never> | DeepLinkConf;
389
- /**
390
- * One Info.plist value: a `<string>`, a `<true/>`/`<false/>`, or an `<array>` of strings.
391
- *
392
- * @example
393
- * ```ts
394
- * const fullScreen: PlistValue = true; // <true/>
395
- * const portrait: PlistValue = ["UIInterfaceOrientationPortrait"];
396
- * // <array><string>UIInterfaceOrientationPortrait</string></array>
397
- * ```
398
- */
399
- type PlistValue = string | boolean | readonly string[];
400
444
  /**
401
445
  * An Info.ios.plist sidecar entry (src-tauri root, outside gen/), which Tauri merges into
402
446
  * the app's Info.plist on every iOS build. No registry row carries one today; the
403
- * orientation lock does.
447
+ * orientation lock, `ios.infoPlist` and the iOS debug profile do.
404
448
  */
405
449
  type PlistEntry = {
406
450
  key: string;
@@ -451,8 +495,11 @@ type Api$4 = {
451
495
  * write-if-changed writer. When the `shell` capability is composed for the target (named
452
496
  * in `config.system`, or implied by the debug profile on android), the
453
497
  * `tauri-plugin-moku-shell` crate is generated under `plugins/moku-shell/` too, with the
454
- * profile baked into its page script. Without the shell, the output is the same for both
455
- * profiles.
498
+ * profile baked into its page script. Without the shell, the profile changes one key: the
499
+ * store profile sets `build.removeUnusedCommands` in `tauri.conf.json`, and the debug and
500
+ * dev profiles do not. An iOS build in the debug profile also opens to Safari Web Inspector
501
+ * (`devtools` on the main window and in the `tauri` features) and to the editor on the local
502
+ * network (`NSLocalNetworkUsageDescription` and `NSAppTransportSecurity` in `Info.ios.plist`).
456
503
  *
457
504
  * @param opts - The generate options.
458
505
  * @param opts.target - The packaging target to generate for.
@@ -512,13 +559,19 @@ type Api$4 = {
512
559
  /**
513
560
  * Runs the idempotent mobile post-init patch pass. Android gets its build-profile
514
561
  * patches (debug: the `.debug` id suffix, the `"<name> (debug)"` label, a cleartext
515
- * network security config; store: all three reverted to the bytes before), its release
516
- * signing (the debug keystore under `HOME` ?? `USERPROFILE` in the debug profile), the
562
+ * network security config; store and dev: all three reverted to the bytes before), its
563
+ * release signing (the debug keystore under `HOME` ?? `USERPROFILE` in the debug profile), the
517
564
  * main activity's manifest attributes (the orientation lock among them) and the status
518
565
  * bar style in MainActivity.kt (light icons on a dark `app.backgroundColor`, dark icons
519
- * on a light one); iOS gets the Xcode entitlements-modification setting; both get the
520
- * Xcode/Android-Studio runner-command rewrite when a `runner` is supplied. The build
566
+ * on a light one); iOS gets the Xcode entitlements-modification setting, the deployment
567
+ * target (`signing.apple.iosMinimumSystemVersion`, or its default) and the privacy manifest
568
+ * (`ios.privacyManifest`; unset removes one an earlier pass added), each in `project.yml`
569
+ * and `project.pbxproj`, because a kept tree never runs xcodegen again, and outside the
570
+ * debug profile it loses the debug keys an earlier debug build merged into
571
+ * `<slug>_iOS/Info.plist`; both get the Xcode/Android-Studio runner-command rewrite when a
572
+ * `runner` is supplied. The build
521
573
  * plugin calls it after the mobile init pass, with the runner from `tauri.getRunner()`.
574
+ * A `gen/apple` tree that was never initialised reports nothing.
522
575
  *
523
576
  * @param opts - The patch options.
524
577
  * @param opts.target - The mobile platform to patch.
@@ -526,7 +579,9 @@ type Api$4 = {
526
579
  * @param opts.profile - The build profile; `"store"` when omitted.
527
580
  * @returns The paths patched vs. left unchanged.
528
581
  * @throws {Error} `[native]` in the debug profile when the debug keystore is missing,
529
- * with the `keytool` command that creates it.
582
+ * with the `keytool` command that creates it; when `ios.privacyManifest` names no file,
583
+ * before anything is written; when `project.yml` or `project.pbxproj` lacks a line a
584
+ * patch needs; when a debug key in `Info.plist` has no value.
530
585
  * @example
531
586
  * ```ts
532
587
  * // app.orientation is "portrait", app.backgroundColor is "#10161d", app.identifier is
@@ -940,7 +995,7 @@ type Api$3 = {
940
995
  * @param opts.onOutput - Called with each scrubbed output line.
941
996
  * @param opts.env - Extra environment for the tauri CLI, merged over the inherited one, so
942
997
  * the web build tauri runs (`beforeBuildCommand`) can read it. Never changes the argv: the
943
- * debug profile is still a release build (no `--debug`).
998
+ * debug and dev profiles are still release builds (no `--debug`).
944
999
  * @returns The completed run's result.
945
1000
  * @throws {Error} A classified `TauriError` on a non-zero exit.
946
1001
  * @example
@@ -1043,19 +1098,34 @@ type PhaseTiming = {
1043
1098
  };
1044
1099
  /** Result of one target's full pipeline pass — `phases` always carries all six entries. */
1045
1100
  type BuildResult = {
1046
- target: Target; /** `<outDir>/<target>` for a store build, `<outDir>/<target>-debug` for a debug one. */
1101
+ target: Target; /** `<outDir>/<target>` for a store or dev build, `<outDir>/<target>-debug` for a debug one. */
1047
1102
  outPath: string;
1048
1103
  artifacts: readonly string[];
1049
1104
  durationMs: number;
1050
1105
  phases: readonly PhaseTiming[]; /** The profile the artifacts were built in — the same value `native:complete` carries. */
1051
1106
  profile: BuildProfile;
1052
1107
  };
1053
- /** Options for a prepare pass: the target, and `debug` for the debug profile (Android only). */
1108
+ /**
1109
+ * Options for a prepare pass: the target, and `debug` for the debug profile (Android, iOS).
1110
+ * It takes no `dev` on purpose: a dev build is only ever a full `run`.
1111
+ *
1112
+ * @example
1113
+ * ```ts
1114
+ * const opts: PrepareOptions = { target: "ios", debug: true };
1115
+ * ```
1116
+ */
1054
1117
  type PrepareOptions = {
1055
1118
  target: Target;
1056
1119
  debug?: boolean | undefined;
1057
1120
  };
1058
- /** Options for one target's pipeline pass. Platform-specific flags are ignored elsewhere. */
1121
+ /**
1122
+ * Options for one target's pipeline pass. Platform-specific flags are ignored elsewhere.
1123
+ *
1124
+ * @example
1125
+ * ```ts
1126
+ * const opts: RunOptions = { target: "android", aab: true, dev: true };
1127
+ * ```
1128
+ */
1059
1129
  type RunOptions = BuildFlavor & {
1060
1130
  target: Target;
1061
1131
  };
@@ -1087,13 +1157,13 @@ type Api$2 = {
1087
1157
  *
1088
1158
  * @param opts - The target to prepare, and `debug` for the debug profile.
1089
1159
  * @returns Nothing; the tree under `projectDir` is ready for the build verb.
1090
- * @throws {Error} `[native] --debug builds Android only for now (asked for <target>).` when
1091
- * `debug` is set for any target but android — before any phase runs.
1160
+ * @throws {Error} `[native] --debug builds Android and iOS only for now (asked for <target>).`
1161
+ * when `debug` is set for any target but android and ios — before any phase runs.
1092
1162
  * @example
1093
1163
  * ```ts
1094
1164
  * // A consumer prepares the debug tree of the phone build to open it in Android Studio: the
1095
1165
  * // shell crate is generated and the debug patches are applied, nothing is compiled.
1096
- * await ctx.require(buildPlugin).prepare({ target: "android", debug: true });
1166
+ * await app.build.prepare({ target: "android", debug: true });
1097
1167
  * ```
1098
1168
  */
1099
1169
  prepare(opts: PrepareOptions): Promise<void>;
@@ -1102,32 +1172,43 @@ type Api$2 = {
1102
1172
  * target, emitting `native:phase` per phase and `native:complete` on success. A store build
1103
1173
  * whose page carries the editor agent is refused after the compile, before anything is
1104
1174
  * collected; a debug build is delivered into `<outDir>/<target>-debug`, beside the store one.
1175
+ * A dev build is the store build with the agent allowed: same signing, same delivery.
1105
1176
  *
1106
- * @param opts - The target plus the platform flags (`simulator`, `aab`, `debug`).
1177
+ * @param opts - The target plus the platform flags (`simulator`, `aab`, `debug`, `dev`).
1107
1178
  * @returns The completed pipeline's result.
1108
- * @throws {Error} The first failing phase's error; `[native] --debug builds Android only …`
1109
- * for `debug` on another target, before any phase.
1179
+ * @throws {Error} The first failing phase's error; before any phase,
1180
+ * `[native] --debug builds Android and iOS only …` for `debug` on another target and
1181
+ * `[native] debug and dev cannot be combined.` for both flags together.
1110
1182
  * @example
1111
1183
  * ```ts
1112
1184
  * // A debug build for the phone, installed beside the store app.
1113
1185
  * const result = await app.build.run({ target: "android", debug: true });
1114
1186
  * // result.outPath === "dist-native/android-debug", result.profile === "debug"
1187
+ *
1188
+ * // The bundle a tester gets from the Play track, its page carrying the editor agent.
1189
+ * const test = await app.build.run({ target: "android", aab: true, dev: true });
1190
+ * // test.outPath === "dist-native/android", test.profile === "dev"
1115
1191
  * ```
1116
1192
  */
1117
1193
  run(opts: RunOptions): Promise<BuildResult>;
1118
1194
  /**
1119
1195
  * Runs the pipeline sequentially for every target in `opts.targets` (default: the configured
1120
1196
  * `targets`), stopping at the first failing target. With `debug`, every target is checked up
1121
- * front and the whole run is refused when one is not android — nothing is half-built.
1197
+ * front and the whole run is refused when one is neither android nor ios; `debug` and `dev`
1198
+ * together are refused up front too — nothing is half-built.
1122
1199
  *
1123
1200
  * @param opts - The targets plus the platform flags threaded into every run.
1124
1201
  * @returns Every completed target's result, in target order.
1125
- * @throws {Error} Whatever the first failing target's pipeline throws.
1202
+ * @throws {Error} The up-front refusals, or whatever the first failing target's pipeline throws.
1126
1203
  * @example
1127
1204
  * ```ts
1128
1205
  * // targets: ["android"] in the app config
1129
1206
  * const [phone] = await app.build.runAll({ debug: true });
1130
1207
  * // phone.profile === "debug", phone.outPath === "dist-native/android-debug"
1208
+ *
1209
+ * // The test app of both phones in one pass, each in the dev profile.
1210
+ * const results = await app.build.runAll({ targets: ["android", "ios"], dev: true });
1211
+ * // results.map(result => result.profile) is ["dev", "dev"]
1131
1212
  * ```
1132
1213
  */
1133
1214
  runAll(opts?: RunAllOptions): Promise<readonly BuildResult[]>;
@@ -1254,25 +1335,29 @@ type Api = {
1254
1335
  * `{ all: true }` (which ignores any given `target`). The flavor flags pass straight
1255
1336
  * through to `build.run`/`build.runAll`. Progress renders live through the plugin's
1256
1337
  * `native:phase`/`native:complete` hooks — a debug delivery is marked
1257
- * `debug build → <outPath>` in the completion panel. A failure (the store refusal of an
1258
- * editor-agent page included) renders the scrubbed stderr tail before the `[native]`
1259
- * error line, then rethrows unchanged.
1338
+ * `debug build → <outPath>` in the completion panel, a dev delivery reads like a store one.
1339
+ * A failure (the store refusal of an editor-agent page included) renders the scrubbed stderr
1340
+ * tail before the `[native]` error line, then rethrows unchanged.
1260
1341
  *
1261
1342
  * @param opts - Build options.
1262
1343
  * @param opts.target - The packaging target (default: the resolved host target).
1263
1344
  * @param opts.all - Build every configured target instead of one (ignores `target`).
1264
1345
  * @param opts.simulator - iOS: build for the host's simulator arch instead of a device archive.
1265
1346
  * @param opts.aab - Android: emit a store bundle (`.aab`) instead of an `.apk`.
1266
- * @param opts.debug - Build the debug profile (Android only), delivered to `<outDir>/<target>-debug`.
1347
+ * @param opts.debug - Build the debug profile (Android, iOS), delivered to `<outDir>/<target>-debug`.
1348
+ * @param opts.dev - Build the dev profile: the store build a tester installs, agent allowed.
1267
1349
  * @returns Resolves once the build (or all builds) complete.
1268
1350
  * @throws {Error} Whatever the pipeline throws — after rendering the failure.
1269
- * `[native] --debug builds Android only …` when `debug` is set with a non-android target,
1270
- * (or `all: true` with a non-android target).
1351
+ * `[native] --debug builds Android and iOS only …` when `debug` is set with another target
1352
+ * (or `all: true` with another target); `[native] debug and dev cannot be combined.` for
1353
+ * both flags together.
1271
1354
  * @example
1272
1355
  * ```ts
1273
1356
  * // A debug build for the phone, installed beside the store app; the completion panel
1274
1357
  * // reads "debug build → dist-native/android-debug".
1275
1358
  * await app.cli.build({ target: "android", debug: true });
1359
+ * // The bundle a tester gets from the Play track, in dist-native/android.
1360
+ * await app.cli.build({ target: "android", aab: true, dev: true });
1276
1361
  * // Every configured target, store profile.
1277
1362
  * await app.cli.build({ all: true });
1278
1363
  * ```
@@ -1417,8 +1502,9 @@ declare const doctorPlugin: import("@moku-labs/core").PluginInstance<"doctor", C
1417
1502
  * Complex tier — capability registry + generators/ (the `tauri-plugin-moku-shell` crate
1418
1503
  * among them) + write-if-changed writer + the mobile/ sub-domain (completeness gate, build
1419
1504
  * profile patches, Android signing block, Android manifest attributes, adaptive icon inset,
1420
- * shell link check, Xcode settings, runner-command rewrite) + the build-time orientation
1421
- * lock + the page agent scan + the guarded clean.
1505
+ * shell link check, Xcode settings, iOS deployment target and privacy manifest,
1506
+ * runner-command rewrite) + the build-time orientation lock + the page agent scan + the
1507
+ * guarded clean.
1422
1508
  *
1423
1509
  * @see README.md
1424
1510
  * @example
@@ -1483,4 +1569,4 @@ declare const createApp: <const ExtraPlugins extends readonly import("@moku-labs
1483
1569
  */
1484
1570
  declare const createPlugin: import("@moku-labs/core").BoundCreatePluginFunction<Config, Events, import("@moku-labs/core").CoreApisFromTuple<[import("@moku-labs/core").CorePluginInstance<"log", import("@moku-labs/common").LogConfig, import("@moku-labs/common").LogState, import("@moku-labs/common").LogApi>, import("@moku-labs/core").CorePluginInstance<"env", import("@moku-labs/common").EnvConfig, import("@moku-labs/common").EnvState, import("@moku-labs/common").EnvApi>]>>;
1485
1571
  //#endregion
1486
- export { type AppleExportMethod, type AppleSigning, type types_d_exports as Build, type BuildFlavor, type BuildProfile, type CapabilityConfigMap, type types_d_exports$1 as Cli, type Config, type types_d_exports$2 as Doctor, type Events, type MobileTarget, type NativeCompleteEvent, type NativePhase, type NativePhaseEvent, type Orientation, PHASE_ORDER, type types_d_exports$3 as Project, type SigningConfig, TARGETS, type Target, type types_d_exports$4 as Tauri, TauriError, type TauriRunner, buildPlugin, cliPlugin, createApp, createPlugin, doctorPlugin, hostTargets, projectPlugin, tauriPlugin };
1572
+ export { type AppleExportMethod, type AppleSigning, type types_d_exports as Build, type BuildFlavor, type BuildProfile, type CapabilityConfigMap, type types_d_exports$1 as Cli, type Config, type types_d_exports$2 as Doctor, type Events, type MobileTarget, type NativeCompleteEvent, type NativePhase, type NativePhaseEvent, type Orientation, PHASE_ORDER, type PlistValue, type types_d_exports$3 as Project, type SigningConfig, TARGETS, type Target, type types_d_exports$4 as Tauri, TauriError, type TauriRunner, buildPlugin, cliPlugin, createApp, createPlugin, doctorPlugin, hostTargets, projectPlugin, tauriPlugin };