uloop-cli 0.58.0 → 0.59.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/dist/cli.bundle.cjs +108 -4
- package/dist/cli.bundle.cjs.map +3 -3
- package/package.json +2 -2
- package/src/cli.ts +6 -0
- package/src/commands/launch.ts +1 -1
- package/src/default-tools.json +1 -1
- package/src/version.ts +1 -1
package/dist/cli.bundle.cjs
CHANGED
|
@@ -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.
|
|
5766
|
+
version: "0.59.1",
|
|
5767
5767
|
tools: [
|
|
5768
5768
|
{
|
|
5769
5769
|
name: "compile",
|
|
@@ -6215,7 +6215,7 @@ function getCachedServerVersion() {
|
|
|
6215
6215
|
}
|
|
6216
6216
|
|
|
6217
6217
|
// src/version.ts
|
|
6218
|
-
var VERSION = "0.
|
|
6218
|
+
var VERSION = "0.59.1";
|
|
6219
6219
|
|
|
6220
6220
|
// src/spinner.ts
|
|
6221
6221
|
var SPINNER_FRAMES = ["\u280B", "\u2819", "\u2839", "\u2838", "\u283C", "\u2834", "\u2826", "\u2827", "\u2807", "\u280F"];
|
|
@@ -7264,6 +7264,7 @@ var import_node_util = require("node:util");
|
|
|
7264
7264
|
var import_promises2 = require("node:fs/promises");
|
|
7265
7265
|
var import_node_fs = require("node:fs");
|
|
7266
7266
|
var import_node_path = require("node:path");
|
|
7267
|
+
var import_node_assert = __toESM(require("node:assert"), 1);
|
|
7267
7268
|
var resolveUnityHubProjectFiles = () => {
|
|
7268
7269
|
if (process.platform === "darwin") {
|
|
7269
7270
|
const home = process.env.HOME;
|
|
@@ -7416,6 +7417,99 @@ var updateLastModifiedIfExists = async (projectPath, when) => {
|
|
|
7416
7417
|
return;
|
|
7417
7418
|
}
|
|
7418
7419
|
};
|
|
7420
|
+
var resolveUnityHubProjectsInfoFile = () => {
|
|
7421
|
+
if (process.platform === "darwin") {
|
|
7422
|
+
const home = process.env.HOME;
|
|
7423
|
+
if (!home) {
|
|
7424
|
+
return void 0;
|
|
7425
|
+
}
|
|
7426
|
+
return (0, import_node_path.join)(home, "Library", "Application Support", "UnityHub", "projectsInfo.json");
|
|
7427
|
+
}
|
|
7428
|
+
if (process.platform === "win32") {
|
|
7429
|
+
const appData = process.env.APPDATA;
|
|
7430
|
+
if (!appData) {
|
|
7431
|
+
return void 0;
|
|
7432
|
+
}
|
|
7433
|
+
return (0, import_node_path.join)(appData, "UnityHub", "projectsInfo.json");
|
|
7434
|
+
}
|
|
7435
|
+
return void 0;
|
|
7436
|
+
};
|
|
7437
|
+
var parseCliArgs = (cliArgsString) => {
|
|
7438
|
+
(0, import_node_assert.default)(cliArgsString !== null && cliArgsString !== void 0, "cliArgsString must not be null");
|
|
7439
|
+
const trimmed = cliArgsString.trim();
|
|
7440
|
+
if (trimmed.length === 0) {
|
|
7441
|
+
return [];
|
|
7442
|
+
}
|
|
7443
|
+
const tokens = [];
|
|
7444
|
+
let current = "";
|
|
7445
|
+
let inQuote = null;
|
|
7446
|
+
for (const char of trimmed) {
|
|
7447
|
+
if (inQuote !== null) {
|
|
7448
|
+
if (char === inQuote) {
|
|
7449
|
+
tokens.push(current);
|
|
7450
|
+
current = "";
|
|
7451
|
+
inQuote = null;
|
|
7452
|
+
} else {
|
|
7453
|
+
current += char;
|
|
7454
|
+
}
|
|
7455
|
+
continue;
|
|
7456
|
+
}
|
|
7457
|
+
if (char === '"' || char === "'") {
|
|
7458
|
+
inQuote = char;
|
|
7459
|
+
continue;
|
|
7460
|
+
}
|
|
7461
|
+
if (char === " ") {
|
|
7462
|
+
if (current.length > 0) {
|
|
7463
|
+
tokens.push(current);
|
|
7464
|
+
current = "";
|
|
7465
|
+
}
|
|
7466
|
+
continue;
|
|
7467
|
+
}
|
|
7468
|
+
current += char;
|
|
7469
|
+
}
|
|
7470
|
+
if (current.length > 0) {
|
|
7471
|
+
tokens.push(current);
|
|
7472
|
+
}
|
|
7473
|
+
return tokens;
|
|
7474
|
+
};
|
|
7475
|
+
var getProjectCliArgs = async (projectPath) => {
|
|
7476
|
+
(0, import_node_assert.default)(projectPath !== null && projectPath !== void 0, "projectPath must not be null");
|
|
7477
|
+
const infoFilePath = resolveUnityHubProjectsInfoFile();
|
|
7478
|
+
if (!infoFilePath) {
|
|
7479
|
+
logDebug("projectsInfo.json path could not be resolved.");
|
|
7480
|
+
return [];
|
|
7481
|
+
}
|
|
7482
|
+
logDebug(`Reading projectsInfo.json: ${infoFilePath}`);
|
|
7483
|
+
let content;
|
|
7484
|
+
try {
|
|
7485
|
+
content = await (0, import_promises2.readFile)(infoFilePath, "utf8");
|
|
7486
|
+
} catch {
|
|
7487
|
+
logDebug("projectsInfo.json not found or not readable.");
|
|
7488
|
+
return [];
|
|
7489
|
+
}
|
|
7490
|
+
let json;
|
|
7491
|
+
try {
|
|
7492
|
+
json = JSON.parse(content);
|
|
7493
|
+
} catch {
|
|
7494
|
+
logDebug("projectsInfo.json parse failed.");
|
|
7495
|
+
return [];
|
|
7496
|
+
}
|
|
7497
|
+
const normalizedProjectPath = normalizePath(projectPath);
|
|
7498
|
+
const projectKey = Object.keys(json).find((key) => pathsEqual(key, normalizedProjectPath));
|
|
7499
|
+
if (!projectKey) {
|
|
7500
|
+
logDebug(`No entry found for project: ${normalizedProjectPath}`);
|
|
7501
|
+
return [];
|
|
7502
|
+
}
|
|
7503
|
+
const projectInfo = json[projectKey];
|
|
7504
|
+
const cliArgsString = projectInfo?.cliArgs;
|
|
7505
|
+
if (!cliArgsString || cliArgsString.trim().length === 0) {
|
|
7506
|
+
logDebug("cliArgs is empty or not defined.");
|
|
7507
|
+
return [];
|
|
7508
|
+
}
|
|
7509
|
+
const parsed = parseCliArgs(cliArgsString);
|
|
7510
|
+
logDebug(`Parsed Unity Hub cliArgs: ${JSON.stringify(parsed)}`);
|
|
7511
|
+
return parsed;
|
|
7512
|
+
};
|
|
7419
7513
|
|
|
7420
7514
|
// node_modules/launch-unity/dist/lib.js
|
|
7421
7515
|
var execFileAsync = (0, import_node_util.promisify)(import_node_child_process.execFile);
|
|
@@ -7811,7 +7905,7 @@ function findUnityProjectBfs(rootDir, maxDepth) {
|
|
|
7811
7905
|
}
|
|
7812
7906
|
return void 0;
|
|
7813
7907
|
}
|
|
7814
|
-
function launch(opts) {
|
|
7908
|
+
async function launch(opts) {
|
|
7815
7909
|
const { projectPath, platform, unityArgs, unityVersion } = opts;
|
|
7816
7910
|
const unityPath = getUnityPath(unityVersion);
|
|
7817
7911
|
console.log(`Detected Unity version: ${unityVersion}`);
|
|
@@ -7825,6 +7919,10 @@ function launch(opts) {
|
|
|
7825
7919
|
if (platform && platform.length > 0 && !unityArgsContainBuildTarget) {
|
|
7826
7920
|
args.push("-buildTarget", platform);
|
|
7827
7921
|
}
|
|
7922
|
+
const hubCliArgs = await getProjectCliArgs(projectPath);
|
|
7923
|
+
if (hubCliArgs.length > 0) {
|
|
7924
|
+
args.push(...hubCliArgs);
|
|
7925
|
+
}
|
|
7828
7926
|
if (unityArgs.length > 0) {
|
|
7829
7927
|
args.push(...unityArgs);
|
|
7830
7928
|
}
|
|
@@ -7900,7 +7998,7 @@ async function runLaunchCommand(projectPath, options) {
|
|
|
7900
7998
|
unityArgs: [],
|
|
7901
7999
|
unityVersion
|
|
7902
8000
|
};
|
|
7903
|
-
launch(resolved);
|
|
8001
|
+
await launch(resolved);
|
|
7904
8002
|
const now = /* @__PURE__ */ new Date();
|
|
7905
8003
|
await updateLastModifiedIfExists(resolvedProjectPath, now);
|
|
7906
8004
|
}
|
|
@@ -8149,16 +8247,22 @@ async function runWithErrorHandling(fn) {
|
|
|
8149
8247
|
if (message === "UNITY_COMPILING") {
|
|
8150
8248
|
console.error("\x1B[33m\u23F3 Unity is compiling scripts.\x1B[0m");
|
|
8151
8249
|
console.error("Please wait for compilation to finish and try again.");
|
|
8250
|
+
console.error("");
|
|
8251
|
+
console.error("If the issue persists, run: uloop fix");
|
|
8152
8252
|
process.exit(1);
|
|
8153
8253
|
}
|
|
8154
8254
|
if (message === "UNITY_DOMAIN_RELOAD") {
|
|
8155
8255
|
console.error("\x1B[33m\u23F3 Unity is reloading (Domain Reload in progress).\x1B[0m");
|
|
8156
8256
|
console.error("Please wait a moment and try again.");
|
|
8257
|
+
console.error("");
|
|
8258
|
+
console.error("If the issue persists, run: uloop fix");
|
|
8157
8259
|
process.exit(1);
|
|
8158
8260
|
}
|
|
8159
8261
|
if (message === "UNITY_SERVER_STARTING") {
|
|
8160
8262
|
console.error("\x1B[33m\u23F3 Unity server is starting.\x1B[0m");
|
|
8161
8263
|
console.error("Please wait a moment and try again.");
|
|
8264
|
+
console.error("");
|
|
8265
|
+
console.error("If the issue persists, run: uloop fix");
|
|
8162
8266
|
process.exit(1);
|
|
8163
8267
|
}
|
|
8164
8268
|
if (message === "UNITY_NO_RESPONSE") {
|