uloop-cli 1.6.3 → 1.7.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.
- package/dist/cli.bundle.cjs +37 -30
- package/dist/cli.bundle.cjs.map +2 -2
- package/package.json +6 -6
- package/src/__tests__/port-resolver.test.ts +45 -0
- package/src/__tests__/project-root.test.ts +35 -1
- package/src/default-tools.json +1 -1
- package/src/port-resolver.ts +39 -38
- package/src/project-root.ts +6 -1
- package/src/version.ts +1 -1
package/dist/cli.bundle.cjs
CHANGED
|
@@ -5486,6 +5486,8 @@ var DirectUnityClient = class {
|
|
|
5486
5486
|
this.port = port;
|
|
5487
5487
|
this.host = host;
|
|
5488
5488
|
}
|
|
5489
|
+
port;
|
|
5490
|
+
host;
|
|
5489
5491
|
socket = null;
|
|
5490
5492
|
requestId = 0;
|
|
5491
5493
|
receiveBuffer = Buffer.alloc(0);
|
|
@@ -5603,8 +5605,12 @@ function isUnityProject(dirPath) {
|
|
|
5603
5605
|
const hasProjectSettings = (0, import_fs.existsSync)((0, import_path.join)(dirPath, "ProjectSettings"));
|
|
5604
5606
|
return hasAssets && hasProjectSettings;
|
|
5605
5607
|
}
|
|
5608
|
+
function getUnitySettingsCandidatePaths(dirPath) {
|
|
5609
|
+
const settingsPath = (0, import_path.join)(dirPath, "UserSettings/UnityMcpSettings.json");
|
|
5610
|
+
return [settingsPath, `${settingsPath}.tmp`, `${settingsPath}.bak`];
|
|
5611
|
+
}
|
|
5606
5612
|
function hasUloopInstalled(dirPath) {
|
|
5607
|
-
return (
|
|
5613
|
+
return getUnitySettingsCandidatePaths(dirPath).some((path) => (0, import_fs.existsSync)(path));
|
|
5608
5614
|
}
|
|
5609
5615
|
function isUnityProjectWithUloop(dirPath) {
|
|
5610
5616
|
return isUnityProject(dirPath) && hasUloopInstalled(dirPath);
|
|
@@ -5747,6 +5753,7 @@ var UnityNotRunningError = class extends Error {
|
|
|
5747
5753
|
super("UNITY_NOT_RUNNING");
|
|
5748
5754
|
this.projectRoot = projectRoot;
|
|
5749
5755
|
}
|
|
5756
|
+
projectRoot;
|
|
5750
5757
|
};
|
|
5751
5758
|
function normalizePort(port) {
|
|
5752
5759
|
if (typeof port !== "number") {
|
|
@@ -5810,34 +5817,32 @@ Run 'uloop launch -r' to restart Unity.`
|
|
|
5810
5817
|
);
|
|
5811
5818
|
}
|
|
5812
5819
|
async function readPortFromSettingsOrThrow(projectRoot) {
|
|
5813
|
-
const settingsPath
|
|
5814
|
-
|
|
5815
|
-
|
|
5816
|
-
|
|
5817
|
-
|
|
5818
|
-
|
|
5819
|
-
|
|
5820
|
-
|
|
5821
|
-
|
|
5822
|
-
|
|
5823
|
-
|
|
5824
|
-
|
|
5825
|
-
|
|
5826
|
-
|
|
5827
|
-
|
|
5828
|
-
|
|
5829
|
-
|
|
5830
|
-
|
|
5831
|
-
|
|
5832
|
-
|
|
5833
|
-
|
|
5834
|
-
|
|
5835
|
-
|
|
5836
|
-
|
|
5837
|
-
if (port === null) {
|
|
5838
|
-
throw createSettingsReadError(projectRoot);
|
|
5820
|
+
for (const settingsPath of getUnitySettingsCandidatePaths(projectRoot)) {
|
|
5821
|
+
let content;
|
|
5822
|
+
try {
|
|
5823
|
+
content = await (0, import_promises.readFile)(settingsPath, "utf-8");
|
|
5824
|
+
} catch {
|
|
5825
|
+
continue;
|
|
5826
|
+
}
|
|
5827
|
+
let parsed;
|
|
5828
|
+
try {
|
|
5829
|
+
parsed = JSON.parse(content);
|
|
5830
|
+
} catch {
|
|
5831
|
+
continue;
|
|
5832
|
+
}
|
|
5833
|
+
if (typeof parsed !== "object" || parsed === null) {
|
|
5834
|
+
continue;
|
|
5835
|
+
}
|
|
5836
|
+
const settings = parsed;
|
|
5837
|
+
if (settings.isServerRunning === false) {
|
|
5838
|
+
throw new UnityNotRunningError(projectRoot);
|
|
5839
|
+
}
|
|
5840
|
+
const port = resolvePortFromUnitySettings(settings);
|
|
5841
|
+
if (port !== null) {
|
|
5842
|
+
return port;
|
|
5843
|
+
}
|
|
5839
5844
|
}
|
|
5840
|
-
|
|
5845
|
+
throw createSettingsReadError(projectRoot);
|
|
5841
5846
|
}
|
|
5842
5847
|
|
|
5843
5848
|
// src/project-validator.ts
|
|
@@ -5850,6 +5855,8 @@ var ProjectMismatchError = class extends Error {
|
|
|
5850
5855
|
this.expectedProjectRoot = expectedProjectRoot;
|
|
5851
5856
|
this.connectedProjectRoot = connectedProjectRoot;
|
|
5852
5857
|
}
|
|
5858
|
+
expectedProjectRoot;
|
|
5859
|
+
connectedProjectRoot;
|
|
5853
5860
|
};
|
|
5854
5861
|
var JSON_RPC_METHOD_NOT_FOUND = -32601;
|
|
5855
5862
|
async function normalizePath(path) {
|
|
@@ -5888,7 +5895,7 @@ var import_path4 = require("path");
|
|
|
5888
5895
|
|
|
5889
5896
|
// src/default-tools.json
|
|
5890
5897
|
var default_tools_default = {
|
|
5891
|
-
version: "1.
|
|
5898
|
+
version: "1.7.0",
|
|
5892
5899
|
tools: [
|
|
5893
5900
|
{
|
|
5894
5901
|
name: "compile",
|
|
@@ -6521,7 +6528,7 @@ function getCachedServerVersion() {
|
|
|
6521
6528
|
}
|
|
6522
6529
|
|
|
6523
6530
|
// src/version.ts
|
|
6524
|
-
var VERSION = "1.
|
|
6531
|
+
var VERSION = "1.7.0";
|
|
6525
6532
|
|
|
6526
6533
|
// src/spinner.ts
|
|
6527
6534
|
var SPINNER_FRAMES = ["\u280B", "\u2819", "\u2839", "\u2838", "\u283C", "\u2834", "\u2826", "\u2827", "\u2807", "\u280F"];
|