@moku-labs/native 0.3.12 → 0.3.14

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
@@ -14,7 +14,7 @@
14
14
 
15
15
  <br/>
16
16
 
17
- [Quick start](#quick-start) · [Two apps, one contract](#two-apps-one-contract) · [Plugins](#plugins) · [Configuration](#configuration) · [Signing and store builds](#signing-and-store-builds) · [Debug builds](#debug-builds-android) · [iOS simulator](#ios-simulator) · [Events](#events) · [Docs](#docs)
17
+ [Quick start](#quick-start) · [Two apps, one contract](#two-apps-one-contract) · [Plugins](#plugins) · [Configuration](#configuration) · [Signing and store builds](#signing-and-store-builds) · [Debug builds](#debug-builds) · [Dev profile](#dev-profile) · [iOS simulator](#ios-simulator) · [Events](#events) · [Docs](#docs)
18
18
 
19
19
  ---
20
20
 
@@ -271,21 +271,21 @@ What each piece does:
271
271
 
272
272
  What the generated project adds for a store:
273
273
 
274
- - **A smaller library.** Every `Cargo.toml` carries a `[profile.release]` table (`codegen-units = 1`, `lto = true`, `opt-level = "s"`, `panic = "abort"`, `strip = true`), on every target and in both build profiles. It costs compile time.
275
- - **No unused commands.** A store build sets `build.removeUnusedCommands: true` in `tauri.conf.json`. A debug build leaves it out.
274
+ - **A smaller library.** Every `Cargo.toml` carries a `[profile.release]` table (`codegen-units = 1`, `lto = true`, `opt-level = "s"`, `panic = "abort"`, `strip = true`), on every target and in every build profile. It costs compile time.
275
+ - **No unused commands.** A store build sets `build.removeUnusedCommands: true` in `tauri.conf.json`. A debug or dev build leaves it out.
276
276
  - **An Android `versionCode`.** An android build with `app.buildNumber` writes it to `bundle.android.versionCode`, as a number.
277
277
  - **`Info.plist` keys and a privacy manifest.** `ios.infoPlist` and `ios.privacyManifest`, see [Configuration](#configuration).
278
278
 
279
- ## Debug builds (Android)
279
+ ## Debug builds
280
280
 
281
281
  ```ts
282
282
  await native.cli.build({ target: "android", debug: true });
283
283
  // debug build → dist-native/android-debug/
284
284
  ```
285
285
 
286
- `debug: true` (on `cli.build`, `build.run`, `build.runAll` and `build.prepare`) builds the **debug profile**: an on-device test build that is still a *release* build type — Rust and Gradle optimized, so what you measure on the phone is what the store app does — but marked so it can never be mistaken for one, and installed **beside** the store app rather than over it:
286
+ `debug: true` (on `cli.build`, `build.run`, `build.runAll` and `build.prepare`) builds the **debug profile**: an on-device test build that is still a *release* build type — Rust and Gradle optimized, so what you measure on the phone is what the store app does. On Android it is marked so it can never be mistaken for the store app, and installed **beside** it rather than over it:
287
287
 
288
- | | Debug profile | Store profile (default) |
288
+ | Android | Debug profile | Store profile (default) |
289
289
  |---|---|---|
290
290
  | Application id | `<app.identifier>.debug` (`applicationIdSuffix`) | `app.identifier` |
291
291
  | Launcher name | `<app.name> (debug)` | `app.name` |
@@ -295,16 +295,26 @@ await native.cli.build({ target: "android", debug: true });
295
295
  | Page | `__MOKU_NATIVE__.build.profile === "debug"`, `console.*` also forwarded to logcat under the tag `moku-page`, WebView debugging on, `share` present | `build.profile === "release"`, none of these |
296
296
  | Delivered to | `<outDir>/android-debug/` | `<outDir>/android/` |
297
297
 
298
- Every debug patch is idempotent, and the next store build reverts each one to the bytes the tree had before. The run's profile also reaches your web build: the tauri CLI is spawned with `MOKU_NATIVE_PROFILE` (`"store"` or `"debug"`) in its environment, and tauri runs `web.build` inside `tauri build`. `BuildResult.profile` and `native:complete`'s `profile` carry the same value, and `cli` marks the delivery as `debug build → <outPath>`.
298
+ Every debug patch is idempotent, and the next store or dev build reverts each one to the bytes the tree had before. The run's profile also reaches your web build: the tauri CLI is spawned with `MOKU_NATIVE_PROFILE` (`"store"`, `"debug"` or `"dev"`) in its environment, and tauri runs `web.build` inside `tauri build`. `BuildResult.profile` and `native:complete`'s `profile` carry the same value, and `cli` marks the delivery as `debug build → <outPath>`.
299
299
 
300
- **Android only for now.** `debug` on any other target throws before the first phase; `runAll` (and `cli.build({ all: true, debug: true })`) checks every target up front and refuses the whole run if one is not Android:
300
+ **iOS works too**, and there native renames nothing. The debug profile opens the page to the local network and to Safari, and that is all it adds:
301
+
302
+ | iOS | What the debug profile adds |
303
+ |---|---|
304
+ | `NSLocalNetworkUsageDescription` | The local-network prompt, in `Info.ios.plist`, after your `ios.infoPlist` keys. |
305
+ | `NSAppTransportSecurity` | `{ NSAllowsLocalNetworking: true }`, so `ws://` reaches a machine on the LAN. It replaces your own `NSAppTransportSecurity`, in this profile only. |
306
+ | Web Inspector | `devtools: true` on the main window and the `devtools` feature on the `tauri` crate. iOS stays a release build, so it takes both. |
307
+
308
+ The separate app comes from the config: the engine passes the id, the name and its own `projectDir`, so `gen/apple` is never regenerated for a new id. The next store or dev build of a kept tree takes both keys out of the generated `Info.plist` again, and whatever your `ios.infoPlist` asks for merges back in. `teamId`, `iosMinimumSystemVersion`, `exportMethod` and `simulator` work as in the store profile, and the build lands in `<outDir>/ios-debug/`. So far this is **verified on a simulator only**.
309
+
310
+ **Android and iOS only for now.** `debug` on any other target throws before the first phase; `runAll` (and `cli.build({ all: true, debug: true })`) checks every target up front and refuses the whole run if one is neither:
301
311
 
302
312
  ```
303
- [native] --debug builds Android only for now (asked for ios).
304
- Build the debug profile for android, or drop debug to build ios.
313
+ [native] --debug builds Android and iOS only for now (asked for macos).
314
+ Build the debug profile for android or ios, or drop debug to build macos.
305
315
  ```
306
316
 
307
- **A store build refuses a page that carries the editor agent.** After the compile, `project.detectPageAgent()` scans every `.js` file under `web.dist` for the editor agent's markers; a store build whose page still carries it fails before `collect`, so no store artifact with the agent reaches `outDir`. A debug build with the agent passes:
317
+ **A store build refuses a page that carries the editor agent.** After the compile, `project.detectPageAgent()` scans every `.js` file under `web.dist` for the editor agent's markers; a store build whose page still carries it fails before `collect`, so no store artifact with the agent reaches `outDir`. A debug or dev build with the agent passes:
308
318
 
309
319
  ```
310
320
  [native] store build refused: the page carries the editor agent (<dist>/<file>).
@@ -313,6 +323,33 @@ Every debug patch is idempotent, and the next store build reverts each one to th
313
323
 
314
324
  `native doctor` covers the Android side with two checks: `android-platform` (fail) — the SDK platform the build compiles against (`compileSdk`) is installed, fix-it `sdkmanager "platforms;android-N"` — and `android-debug-signing` (warn) — the debug keystore exists, with the `keytool` command that creates it as the fix-it. A debug build with no debug keystore fails in `codegen` with that same command.
315
325
 
326
+ ## Dev profile
327
+
328
+ ```ts
329
+ await native.cli.build({ target: "android", aab: true, dev: true });
330
+ // installers land in dist-native/android/
331
+ ```
332
+
333
+ `dev: true` (on `cli.build`, `build.run` and `build.runAll`) builds the **dev profile**: the store build a tester installs from TestFlight or a Play track, whose page may carry the editor agent. Native renames nothing. The app config names the test app — `app.identifier`, `app.name`, `app.icon`, `projectDir`, `outDir` — and everything else is the store build:
334
+
335
+ | | Dev profile | Store profile (default) |
336
+ |---|---|---|
337
+ | Page with the editor agent | allowed | refused after the compile |
338
+ | `MOKU_NATIVE_PROFILE` | `"dev"` | `"store"` |
339
+ | `build.removeUnusedCommands` | left out: a dev page may call what a store page does not | `true` |
340
+ | Signing | `signing.android`, `signing.apple` | the same |
341
+ | Application id, name | as configured: no `.debug`, no `(debug)` | the same |
342
+ | Network | cleartext closed | the same |
343
+ | Page | `__MOKU_NATIVE__.build.profile === "release"`, no WebView debugging, no `share` | the same |
344
+ | Delivered to | `<outDir>/<target>/` | the same |
345
+
346
+ `BuildResult.profile` and `native:complete`'s `profile` say `"dev"`, and `cli` shows the delivery like a store one. A run picks one profile, and the pair is refused before the first phase, whatever the target:
347
+
348
+ ```
349
+ [native] debug and dev cannot be combined.
350
+ Build one profile: debug for the local app, dev for the store-signed test app.
351
+ ```
352
+
316
353
  ## iOS simulator
317
354
 
318
355
  ```ts
@@ -375,7 +412,7 @@ Two **global framework events** are declared in `src/config.ts` — emitted by `
375
412
  outPath: string; // dist-native/<target>/ — dist-native/<target>-debug/ for a debug build
376
413
  artifacts: readonly string[];
377
414
  durationMs: number;
378
- profile: BuildProfile; // "store" | "debug" — cli marks a debug delivery
415
+ profile: BuildProfile; // "store" | "debug" | "dev" — cli marks a debug delivery
379
416
  };
380
417
  ```
381
418
 
@@ -390,7 +427,7 @@ One **per-plugin event** is declared by `doctor` (hookable via a `depends: [doct
390
427
 
391
428
  ## Breaking changes in this release
392
429
 
393
- The Android shell, the debug profile, `app.adaptiveIconInset` and the two new doctor checks are additive — nothing in the table below comes from them. So are `ios`, `app.keepScreenOn` and the store-build changes, with one earlier stop: a non-numeric `app.buildNumber` on an android build is now refused at generate, where Tauri would have failed on it anyway. `Project.PlistValue` widens to the recursive `PlistValue`, which the package root exports too.
430
+ The Android shell, the debug profile, `app.adaptiveIconInset` and the two new doctor checks are additive — nothing in the table below comes from them. So are the `dev` profile, `debug` on iOS, `ios`, `app.keepScreenOn` and the store-build changes, with one earlier stop: a non-numeric `app.buildNumber` on an android build is now refused at generate, where Tauri would have failed on it anyway. `Project.PlistValue` widens to the recursive `PlistValue`, which the package root exports too.
394
431
 
395
432
  | What breaks | Migration |
396
433
  |---|---|