slopcode 0.2.140 → 0.2.141

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/bin/slopcode CHANGED
@@ -7,7 +7,19 @@ const path = require("path")
7
7
  const os = require("os")
8
8
  const pkg = require("../package.json")
9
9
 
10
+ const startupStart = Date.now()
11
+ function startupTraceEnabled() {
12
+ const value = (process.env.SLOPCODE_ANDROID_STARTUP_LOG || "").toLowerCase()
13
+ return value === "1" || value === "true" || value === "on"
14
+ }
15
+
16
+ function startupLog(phase, extra = {}) {
17
+ if (!startupTraceEnabled()) return
18
+ console.error(JSON.stringify({ event: "android.startup", phase, ms: Date.now() - startupStart, ...extra }))
19
+ }
20
+
10
21
  function run(target, options = {}) {
22
+ startupLog("launcher.exec", { target: path.basename(target) })
11
23
  const result = childProcess.spawnSync(target, options.args || process.argv.slice(2), {
12
24
  stdio: "inherit",
13
25
  env: options.env ? { ...process.env, ...options.env } : process.env,
@@ -51,6 +63,7 @@ const supported = {
51
63
 
52
64
  const rawPlatform = process.env.SLOPCODE_TEST_PLATFORM || os.platform()
53
65
  const rawArch = process.env.SLOPCODE_TEST_ARCH || os.arch()
66
+ startupLog("launcher.start", { platform: rawPlatform, arch: rawArch })
54
67
  let platform = platformMap[rawPlatform]
55
68
  if (!platform) {
56
69
  platform = rawPlatform
@@ -311,6 +324,11 @@ if (!resolved) {
311
324
  const args = process.argv.slice(2)
312
325
  if (libc() === "bionic" && androidInteractive(args)) {
313
326
  const bun = androidBun(arch)
327
+ startupLog("launcher.android.interactive", {
328
+ runtime: path.basename(resolved.path),
329
+ bun: bun ? path.basename(bun) : undefined,
330
+ legacy: process.env.SLOPCODE_ANDROID_BOOTSTRAP === "legacy",
331
+ })
314
332
  if (!fs.existsSync(androidBundle)) {
315
333
  console.error(
316
334
  "SlopCode Android CLI bootstrap bundle is missing. Reinstall from Termux with: npm install -g slopcode@latest --include=optional",
@@ -319,6 +337,7 @@ if (libc() === "bionic" && androidInteractive(args)) {
319
337
  }
320
338
  if (bun && fs.existsSync(androidBundle)) {
321
339
  const runtimeRoot = path.dirname(path.dirname(resolved.path))
340
+ startupLog("launcher.android.legacy_bundle", { bundle: androidBundle })
322
341
  run(bun, {
323
342
  args: [androidBundle, ...args],
324
343
  env: {