@gjsify/nativescript-vite 0.64.12 → 0.64.13-next.283

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.
Files changed (2) hide show
  1. package/README.md +28 -1
  2. package/package.json +4 -3
package/README.md CHANGED
@@ -48,7 +48,7 @@ import { defineNativescriptConfig } from '@gjsify/nativescript-vite';
48
48
  export default defineNativescriptConfig();
49
49
  ```
50
50
 
51
- It returns an async Vite config **function**, so Vite resolves `mode` and passes it through; the upstream `@nativescript/vite` config is built for the right mode before the fixes + gjsify transforms are applied. The first argument is forwarded to the `gjsifyNativescript()` preset from `@gjsify/vite-plugin-gjsify` (`{ reflection?, aliases?, optimizeDepsExclude? }`); an optional second argument is a Vite config (object or `(env) => config`) that is `mergeConfig`'d in last, so you can compose your own settings on top.
51
+ It returns an async Vite config **function**, so Vite resolves `mode` and passes it through; the upstream `@nativescript/vite` config is built for the right mode before the fixes + gjsify transforms are applied. The first argument is forwarded to the `gjsifyNativescript()` preset from `@gjsify/vite-plugin-gjsify` (`{ reflection?, aliases?, optimizeDepsExclude?, giRenderer?, locale?, giNamespaces? }`); an optional second argument is a Vite config (object or `(env) => config`) that is `mergeConfig`'d in last, so you can compose your own settings on top.
52
52
 
53
53
  `nativescript.config.ts` — select the Vite bundler:
54
54
 
@@ -69,6 +69,33 @@ Then build as usual:
69
69
  ns prepare android # or: ns run android / ns run ios
70
70
  ```
71
71
 
72
+ ## Declaring the GI namespaces your APK carries
73
+
74
+ An Android APK carries its whole GI stack or does without it: there is no `apt install gir1.2-soup-3.0` on a device, so a namespace that is not in the APK surfaces as a throw at the first `requireGi`. `@gjsify/gi-runtime-android` therefore ships a fixed CORE set — `GLib`, `GObject`, `Gio` and the other typelibs its link closure happens to contain — and anything beyond that is **declared**, per app, at build time ([ADR 0117](https://github.com/gjsify/gjsify/blob/main/docs/adr/0117-android-gi-namespaces-are-selected-at-build-time.md)).
75
+
76
+ The declaration is `giNamespaces` in the first argument, `Ns` or `Ns-Version`:
77
+
78
+ ```ts
79
+ import { defineNativescriptConfig } from '@gjsify/nativescript-vite';
80
+
81
+ export default defineNativescriptConfig({
82
+ giNamespaces: ['Soup-3.0', 'Json'],
83
+ });
84
+ ```
85
+
86
+ Two things follow from it:
87
+
88
+ - **The build refuses to emit a bundle that imports a namespace the list omits**, naming the chunk the import was read from and the line to add. This is the direction that matters: a missing declaration is a crash on the device, so it is a build failure here.
89
+ - **A declared namespace the bundle does not appear to import is a warning**, not a failure. `GLib.Module`, a plugin loaded by name and `Gio.DBusProxy` reaching a namespace through a string are all legitimate and invisible to a scanner, and the declaration is how an app says so. The warning exists because every selected namespace costs APK size.
90
+
91
+ Declaring nothing selects exactly the core payload, which is what every app built before this option got — so adding the option to an existing config changes no bytes until you list something.
92
+
93
+ Under `giRenderer: true` a `gi://Gtk` import is **not** a reason to declare `Gtk`: the renderer answers those specifiers with `@gjsify/adwaita-nativescript`, no typelib is involved, and the scan reads the emitted bundle precisely so that it sees what survived the renderer rather than what the module graph contained.
94
+
95
+ The same declaration under `gjsify build --app nativescript` is `nativescript.giNamespaces` in `gjsify.config.ts`. Both paths share one scanner and one planner (in `@gjsify/rolldown-plugin-gjsify`), so a config means the same thing whichever drives the build.
96
+
97
+ What a namespace can resolve to is bounded by the pinned Android sysroot: a namespace whose backing library or typelib the sysroot does not carry fails the AAR build naming what is missing, rather than shipping a typelib that dies in `g_module_open`.
98
+
72
99
  ## Audio-context note
73
100
 
74
101
  `@nativescript/canvas` transitively pulls a Web-Audio module that references surface a canvas/WebGL app never executes. If your app only does 2D/WebGL rendering, mark it `external` via the composable second argument so it stays out of the bundle:
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gjsify/nativescript-vite",
3
- "version": "0.64.12",
3
+ "version": "0.64.13-next.283",
4
4
  "description": "Vite 8 / Rolldown compatibility + gjsify transforms for building NativeScript apps — composes @nativescript/vite and fixes the pieces Rolldown rejects.",
5
5
  "type": "module",
6
6
  "main": "lib/index.js",
@@ -39,7 +39,7 @@
39
39
  ],
40
40
  "license": "MIT",
41
41
  "dependencies": {
42
- "@gjsify/vite-plugin-gjsify": "^0.64.12"
42
+ "@gjsify/vite-plugin-gjsify": "0.64.13-next.283"
43
43
  },
44
44
  "peerDependencies": {
45
45
  "@nativescript/canvas": "*",
@@ -80,5 +80,6 @@
80
80
  },
81
81
  "gjsify": {
82
82
  "tier": 2
83
- }
83
+ },
84
+ "gitHead": "05fae97125a374e84bf57c2d2d086fb53523f205"
84
85
  }