@zappdev/cli 0.5.0-alpha.0 → 0.5.0-alpha.1
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/native/app/app.zc +15 -1
- package/package.json +1 -1
- package/src/init.ts +6 -6
package/native/app/app.zc
CHANGED
|
@@ -164,12 +164,23 @@ fn zapp_handle_message_from_window(app_ptr: void*, msg: string, window_id: int)
|
|
|
164
164
|
struct AppConfig {
|
|
165
165
|
name: string;
|
|
166
166
|
applicationShouldTerminateAfterLastWindowClosed: bool;
|
|
167
|
-
webContentInspectable: int; // -1 =
|
|
167
|
+
webContentInspectable: int; // -1 = auto (dev → on, prod → off), 0 = off, 1 = on
|
|
168
168
|
maxWorkers: int;
|
|
169
169
|
qjsStackSize: int;
|
|
170
170
|
backend: bool; // enable backend worker (src/backend.ts)
|
|
171
171
|
}
|
|
172
172
|
|
|
173
|
+
// Named toggle values — use as AppConfig fields instead of raw int literals.
|
|
174
|
+
// webContentInspectable: Inspectable.auto,
|
|
175
|
+
// webContentInspectable: Inspectable.on,
|
|
176
|
+
// webContentInspectable: Inspectable.off,
|
|
177
|
+
struct Inspectable {}
|
|
178
|
+
impl Inspectable {
|
|
179
|
+
def auto: int = -1;
|
|
180
|
+
def off: int = 0;
|
|
181
|
+
def on: int = 1;
|
|
182
|
+
}
|
|
183
|
+
|
|
173
184
|
struct App {
|
|
174
185
|
config: AppConfig;
|
|
175
186
|
window: WindowManager;
|
|
@@ -188,6 +199,9 @@ impl App {
|
|
|
188
199
|
wm.webContentInspectable = true;
|
|
189
200
|
} else if config.webContentInspectable == 0 {
|
|
190
201
|
wm.webContentInspectable = false;
|
|
202
|
+
} else {
|
|
203
|
+
// -1 = inherit from build mode (dev → on, prod → off)
|
|
204
|
+
wm.webContentInspectable = zapp_build_dev_tools_default() > 0;
|
|
191
205
|
}
|
|
192
206
|
|
|
193
207
|
platform_init(config.name);
|
package/package.json
CHANGED
package/src/init.ts
CHANGED
|
@@ -39,8 +39,8 @@ export async function runInit(opts: InitOptions) {
|
|
|
39
39
|
|
|
40
40
|
await Bun.write(path.join(zappDir, "app.zc"), `import "app/app.zc";
|
|
41
41
|
|
|
42
|
-
fn greet(_app: App*,
|
|
43
|
-
return
|
|
42
|
+
fn greet(_app: App*, _args: JsonValue*) -> string {
|
|
43
|
+
return "Hello from Zapp!";
|
|
44
44
|
}
|
|
45
45
|
|
|
46
46
|
fn on_ready(_id: int, _handle: void*) -> void {
|
|
@@ -51,7 +51,7 @@ fn run_app() -> int {
|
|
|
51
51
|
let config = AppConfig{
|
|
52
52
|
name: "${name}",
|
|
53
53
|
applicationShouldTerminateAfterLastWindowClosed: true,
|
|
54
|
-
webContentInspectable:
|
|
54
|
+
webContentInspectable: Inspectable.auto,
|
|
55
55
|
maxWorkers: 0,
|
|
56
56
|
qjsStackSize: 0,
|
|
57
57
|
backend: false,
|
|
@@ -122,12 +122,12 @@ fn main() -> int {
|
|
|
122
122
|
|
|
123
123
|
pkgObj.dependencies = {
|
|
124
124
|
...(pkgObj.dependencies ?? {}),
|
|
125
|
-
"@zappdev/runtime": "
|
|
125
|
+
"@zappdev/runtime": "^0.5.0",
|
|
126
126
|
};
|
|
127
127
|
pkgObj.devDependencies = {
|
|
128
128
|
...(pkgObj.devDependencies ?? {}),
|
|
129
|
-
"@zappdev/cli": "
|
|
130
|
-
"@zappdev/vite": "
|
|
129
|
+
"@zappdev/cli": "^0.5.0",
|
|
130
|
+
"@zappdev/vite": "^0.5.0",
|
|
131
131
|
};
|
|
132
132
|
|
|
133
133
|
await Bun.write(pkgPath, JSON.stringify(pkgObj, null, 2));
|