uloop-cli 0.59.0 → 0.60.0

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.
@@ -5763,7 +5763,7 @@ var import_path3 = require("path");
5763
5763
 
5764
5764
  // src/default-tools.json
5765
5765
  var default_tools_default = {
5766
- version: "0.59.0",
5766
+ version: "0.60.0",
5767
5767
  tools: [
5768
5768
  {
5769
5769
  name: "compile",
@@ -5849,10 +5849,6 @@ var default_tools_default = {
5849
5849
  FilterValue: {
5850
5850
  type: "string",
5851
5851
  description: "Filter value"
5852
- },
5853
- SaveXml: {
5854
- type: "boolean",
5855
- description: "Save test results as XML"
5856
5852
  }
5857
5853
  }
5858
5854
  }
@@ -6084,10 +6080,6 @@ var default_tools_default = {
6084
6080
  CompileOnly: {
6085
6081
  type: "boolean",
6086
6082
  description: "Compile only without execution"
6087
- },
6088
- AutoQualifyUnityTypesOnce: {
6089
- type: "boolean",
6090
- description: "Auto-qualify Unity types"
6091
6083
  }
6092
6084
  }
6093
6085
  }
@@ -6215,7 +6207,7 @@ function getCachedServerVersion() {
6215
6207
  }
6216
6208
 
6217
6209
  // src/version.ts
6218
- var VERSION = "0.59.0";
6210
+ var VERSION = "0.60.0";
6219
6211
 
6220
6212
  // src/spinner.ts
6221
6213
  var SPINNER_FRAMES = ["\u280B", "\u2819", "\u2839", "\u2838", "\u283C", "\u2834", "\u2826", "\u2827", "\u2807", "\u280F"];
@@ -7264,6 +7256,7 @@ var import_node_util = require("node:util");
7264
7256
  var import_promises2 = require("node:fs/promises");
7265
7257
  var import_node_fs = require("node:fs");
7266
7258
  var import_node_path = require("node:path");
7259
+ var import_node_assert = __toESM(require("node:assert"), 1);
7267
7260
  var resolveUnityHubProjectFiles = () => {
7268
7261
  if (process.platform === "darwin") {
7269
7262
  const home = process.env.HOME;
@@ -7416,6 +7409,99 @@ var updateLastModifiedIfExists = async (projectPath, when) => {
7416
7409
  return;
7417
7410
  }
7418
7411
  };
7412
+ var resolveUnityHubProjectsInfoFile = () => {
7413
+ if (process.platform === "darwin") {
7414
+ const home = process.env.HOME;
7415
+ if (!home) {
7416
+ return void 0;
7417
+ }
7418
+ return (0, import_node_path.join)(home, "Library", "Application Support", "UnityHub", "projectsInfo.json");
7419
+ }
7420
+ if (process.platform === "win32") {
7421
+ const appData = process.env.APPDATA;
7422
+ if (!appData) {
7423
+ return void 0;
7424
+ }
7425
+ return (0, import_node_path.join)(appData, "UnityHub", "projectsInfo.json");
7426
+ }
7427
+ return void 0;
7428
+ };
7429
+ var parseCliArgs = (cliArgsString) => {
7430
+ (0, import_node_assert.default)(cliArgsString !== null && cliArgsString !== void 0, "cliArgsString must not be null");
7431
+ const trimmed = cliArgsString.trim();
7432
+ if (trimmed.length === 0) {
7433
+ return [];
7434
+ }
7435
+ const tokens = [];
7436
+ let current = "";
7437
+ let inQuote = null;
7438
+ for (const char of trimmed) {
7439
+ if (inQuote !== null) {
7440
+ if (char === inQuote) {
7441
+ tokens.push(current);
7442
+ current = "";
7443
+ inQuote = null;
7444
+ } else {
7445
+ current += char;
7446
+ }
7447
+ continue;
7448
+ }
7449
+ if (char === '"' || char === "'") {
7450
+ inQuote = char;
7451
+ continue;
7452
+ }
7453
+ if (char === " ") {
7454
+ if (current.length > 0) {
7455
+ tokens.push(current);
7456
+ current = "";
7457
+ }
7458
+ continue;
7459
+ }
7460
+ current += char;
7461
+ }
7462
+ if (current.length > 0) {
7463
+ tokens.push(current);
7464
+ }
7465
+ return tokens;
7466
+ };
7467
+ var getProjectCliArgs = async (projectPath) => {
7468
+ (0, import_node_assert.default)(projectPath !== null && projectPath !== void 0, "projectPath must not be null");
7469
+ const infoFilePath = resolveUnityHubProjectsInfoFile();
7470
+ if (!infoFilePath) {
7471
+ logDebug("projectsInfo.json path could not be resolved.");
7472
+ return [];
7473
+ }
7474
+ logDebug(`Reading projectsInfo.json: ${infoFilePath}`);
7475
+ let content;
7476
+ try {
7477
+ content = await (0, import_promises2.readFile)(infoFilePath, "utf8");
7478
+ } catch {
7479
+ logDebug("projectsInfo.json not found or not readable.");
7480
+ return [];
7481
+ }
7482
+ let json;
7483
+ try {
7484
+ json = JSON.parse(content);
7485
+ } catch {
7486
+ logDebug("projectsInfo.json parse failed.");
7487
+ return [];
7488
+ }
7489
+ const normalizedProjectPath = normalizePath(projectPath);
7490
+ const projectKey = Object.keys(json).find((key) => pathsEqual(key, normalizedProjectPath));
7491
+ if (!projectKey) {
7492
+ logDebug(`No entry found for project: ${normalizedProjectPath}`);
7493
+ return [];
7494
+ }
7495
+ const projectInfo = json[projectKey];
7496
+ const cliArgsString = projectInfo?.cliArgs;
7497
+ if (!cliArgsString || cliArgsString.trim().length === 0) {
7498
+ logDebug("cliArgs is empty or not defined.");
7499
+ return [];
7500
+ }
7501
+ const parsed = parseCliArgs(cliArgsString);
7502
+ logDebug(`Parsed Unity Hub cliArgs: ${JSON.stringify(parsed)}`);
7503
+ return parsed;
7504
+ };
7419
7505
 
7420
7506
  // node_modules/launch-unity/dist/lib.js
7421
7507
  var execFileAsync = (0, import_node_util.promisify)(import_node_child_process.execFile);
@@ -7811,7 +7897,7 @@ function findUnityProjectBfs(rootDir, maxDepth) {
7811
7897
  }
7812
7898
  return void 0;
7813
7899
  }
7814
- function launch(opts) {
7900
+ async function launch(opts) {
7815
7901
  const { projectPath, platform, unityArgs, unityVersion } = opts;
7816
7902
  const unityPath = getUnityPath(unityVersion);
7817
7903
  console.log(`Detected Unity version: ${unityVersion}`);
@@ -7825,6 +7911,10 @@ function launch(opts) {
7825
7911
  if (platform && platform.length > 0 && !unityArgsContainBuildTarget) {
7826
7912
  args.push("-buildTarget", platform);
7827
7913
  }
7914
+ const hubCliArgs = await getProjectCliArgs(projectPath);
7915
+ if (hubCliArgs.length > 0) {
7916
+ args.push(...hubCliArgs);
7917
+ }
7828
7918
  if (unityArgs.length > 0) {
7829
7919
  args.push(...unityArgs);
7830
7920
  }
@@ -7900,7 +7990,7 @@ async function runLaunchCommand(projectPath, options) {
7900
7990
  unityArgs: [],
7901
7991
  unityVersion
7902
7992
  };
7903
- launch(resolved);
7993
+ await launch(resolved);
7904
7994
  const now = /* @__PURE__ */ new Date();
7905
7995
  await updateLastModifiedIfExists(resolvedProjectPath, now);
7906
7996
  }
@@ -8149,16 +8239,22 @@ async function runWithErrorHandling(fn) {
8149
8239
  if (message === "UNITY_COMPILING") {
8150
8240
  console.error("\x1B[33m\u23F3 Unity is compiling scripts.\x1B[0m");
8151
8241
  console.error("Please wait for compilation to finish and try again.");
8242
+ console.error("");
8243
+ console.error("If the issue persists, run: uloop fix");
8152
8244
  process.exit(1);
8153
8245
  }
8154
8246
  if (message === "UNITY_DOMAIN_RELOAD") {
8155
8247
  console.error("\x1B[33m\u23F3 Unity is reloading (Domain Reload in progress).\x1B[0m");
8156
8248
  console.error("Please wait a moment and try again.");
8249
+ console.error("");
8250
+ console.error("If the issue persists, run: uloop fix");
8157
8251
  process.exit(1);
8158
8252
  }
8159
8253
  if (message === "UNITY_SERVER_STARTING") {
8160
8254
  console.error("\x1B[33m\u23F3 Unity server is starting.\x1B[0m");
8161
8255
  console.error("Please wait a moment and try again.");
8256
+ console.error("");
8257
+ console.error("If the issue persists, run: uloop fix");
8162
8258
  process.exit(1);
8163
8259
  }
8164
8260
  if (message === "UNITY_NO_RESPONSE") {