@galacean/cli 0.0.1-alpha.7 → 0.0.1-alpha.9
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 +196 -243
- package/package.json +19 -23
package/dist/cli.bundle.cjs
CHANGED
|
@@ -4260,7 +4260,7 @@ async function readJsonFile(filePath, label) {
|
|
|
4260
4260
|
try {
|
|
4261
4261
|
raw = await (0, import_promises3.readFile)(filePath, "utf-8");
|
|
4262
4262
|
} catch {
|
|
4263
|
-
throw new
|
|
4263
|
+
throw new Error(`Cannot read ${label}: ${filePath}`);
|
|
4264
4264
|
}
|
|
4265
4265
|
try {
|
|
4266
4266
|
return JSON.parse(raw);
|
|
@@ -4336,51 +4336,13 @@ async function readManifest(projectDir) {
|
|
|
4336
4336
|
async function readAssetMeta(projectDir, metaPath) {
|
|
4337
4337
|
return readJsonFile(import_node_path3.default.resolve(projectDir, metaPath), "asset meta");
|
|
4338
4338
|
}
|
|
4339
|
-
|
|
4340
|
-
let dependencies;
|
|
4341
|
-
if (project.dependencies && typeof project.dependencies === "object") {
|
|
4342
|
-
dependencies = project.dependencies;
|
|
4343
|
-
} else if (typeof project.dependencies === "string") {
|
|
4344
|
-
try {
|
|
4345
|
-
const parsed = JSON.parse(project.dependencies);
|
|
4346
|
-
if (parsed && typeof parsed === "object" && !Array.isArray(parsed)) {
|
|
4347
|
-
dependencies = parsed;
|
|
4348
|
-
}
|
|
4349
|
-
} catch (err) {
|
|
4350
|
-
console.warn(`[${commandName}] Failed to parse project.dependencies:`, err);
|
|
4351
|
-
}
|
|
4352
|
-
}
|
|
4353
|
-
if (!dependencies || Object.keys(dependencies).length === 0) {
|
|
4354
|
-
let setting = project.setting;
|
|
4355
|
-
if (typeof setting === "string") {
|
|
4356
|
-
try {
|
|
4357
|
-
setting = JSON.parse(setting);
|
|
4358
|
-
} catch (err) {
|
|
4359
|
-
console.warn(`[${commandName}] Failed to parse project.setting:`, err);
|
|
4360
|
-
}
|
|
4361
|
-
}
|
|
4362
|
-
if (setting && typeof setting === "object") {
|
|
4363
|
-
const settingDeps = setting.dependencies;
|
|
4364
|
-
if (settingDeps && typeof settingDeps === "object" && !Array.isArray(settingDeps)) {
|
|
4365
|
-
dependencies = settingDeps;
|
|
4366
|
-
}
|
|
4367
|
-
}
|
|
4368
|
-
}
|
|
4369
|
-
return dependencies;
|
|
4370
|
-
}
|
|
4371
|
-
var import_promises3, import_node_path3, FileReadError, MANAGED_PROJECT_PATHS;
|
|
4339
|
+
var import_promises3, import_node_path3, MANAGED_PROJECT_PATHS;
|
|
4372
4340
|
var init_local_project = __esm({
|
|
4373
4341
|
"src/local-project.ts"() {
|
|
4374
4342
|
"use strict";
|
|
4375
4343
|
import_promises3 = require("node:fs/promises");
|
|
4376
4344
|
import_node_path3 = __toESM(require("node:path"));
|
|
4377
4345
|
init_utils();
|
|
4378
|
-
FileReadError = class extends Error {
|
|
4379
|
-
constructor(label, filePath) {
|
|
4380
|
-
super(`Cannot read ${label}: ${filePath}`);
|
|
4381
|
-
this.name = "FileReadError";
|
|
4382
|
-
}
|
|
4383
|
-
};
|
|
4384
4346
|
MANAGED_PROJECT_PATHS = [".galacean", "assets", "project.galacean"];
|
|
4385
4347
|
}
|
|
4386
4348
|
});
|
|
@@ -4459,24 +4421,6 @@ function findCaseFoldMoveConflicts(moves) {
|
|
|
4459
4421
|
}
|
|
4460
4422
|
const conflicts = [];
|
|
4461
4423
|
const dedup = /* @__PURE__ */ new Set();
|
|
4462
|
-
for (const [, bucket] of targetsByKey) {
|
|
4463
|
-
if (bucket.length < 2) continue;
|
|
4464
|
-
for (let i = 0; i < bucket.length; i++) {
|
|
4465
|
-
for (let j = i + 1; j < bucket.length; j++) {
|
|
4466
|
-
if (bucket[i].assetId === bucket[j].assetId) continue;
|
|
4467
|
-
if (bucket[i].normalizedPath === bucket[j].normalizedPath) continue;
|
|
4468
|
-
const signature = [bucket[i].assetId, bucket[j].assetId].sort().join("|");
|
|
4469
|
-
if (dedup.has(signature)) continue;
|
|
4470
|
-
dedup.add(signature);
|
|
4471
|
-
conflicts.push({
|
|
4472
|
-
oldAssetId: bucket[i].assetId,
|
|
4473
|
-
oldPath: bucket[i].rawPath,
|
|
4474
|
-
targetAssetId: bucket[j].assetId,
|
|
4475
|
-
targetPath: bucket[j].rawPath
|
|
4476
|
-
});
|
|
4477
|
-
}
|
|
4478
|
-
}
|
|
4479
|
-
}
|
|
4480
4424
|
for (const move of moves) {
|
|
4481
4425
|
const normalizedOldPath = normalizePath(move.oldPath);
|
|
4482
4426
|
const key = caseFoldKey(normalizedOldPath);
|
|
@@ -4504,7 +4448,7 @@ async function shouldUseCaseFoldGuards(projectDir) {
|
|
|
4504
4448
|
} catch {
|
|
4505
4449
|
return false;
|
|
4506
4450
|
}
|
|
4507
|
-
const probeName = `.case-fold-probe-${(0,
|
|
4451
|
+
const probeName = `.case-fold-probe-${(0, import_node_crypto.randomUUID)()}-Aa.tmp`;
|
|
4508
4452
|
const probePath = import_node_path4.default.join(resolvedProjectDir, probeName);
|
|
4509
4453
|
const foldedProbePath = import_node_path4.default.join(resolvedProjectDir, probeName.toLowerCase());
|
|
4510
4454
|
try {
|
|
@@ -4530,11 +4474,11 @@ async function shouldUseCaseFoldGuards(projectDir) {
|
|
|
4530
4474
|
}
|
|
4531
4475
|
}
|
|
4532
4476
|
}
|
|
4533
|
-
var
|
|
4477
|
+
var import_node_crypto, import_promises4, import_node_path4;
|
|
4534
4478
|
var init_path_case_guard = __esm({
|
|
4535
4479
|
"src/path-case-guard.ts"() {
|
|
4536
4480
|
"use strict";
|
|
4537
|
-
|
|
4481
|
+
import_node_crypto = require("node:crypto");
|
|
4538
4482
|
import_promises4 = require("node:fs/promises");
|
|
4539
4483
|
import_node_path4 = __toESM(require("node:path"));
|
|
4540
4484
|
init_utils();
|
|
@@ -68035,6 +67979,9 @@ var init_en = __esm({
|
|
|
68035
67979
|
title: "Alpha Output Required",
|
|
68036
67980
|
info: "Determines whether to preserve the alpha channel in the output. When set to true, the alpha channel is always preserved, when set to false, the engine automatically decides whether to preserve it."
|
|
68037
67981
|
},
|
|
67982
|
+
"render-target": {
|
|
67983
|
+
title: "Render Target"
|
|
67984
|
+
},
|
|
68038
67985
|
viewport: {
|
|
68039
67986
|
title: "Viewport"
|
|
68040
67987
|
},
|
|
@@ -68627,10 +68574,6 @@ var init_en = __esm({
|
|
|
68627
68574
|
label: "Font",
|
|
68628
68575
|
info: "The font asset to use for rendering text"
|
|
68629
68576
|
},
|
|
68630
|
-
"font-family": {
|
|
68631
|
-
label: "Font Family",
|
|
68632
|
-
info: "The font family name when using system fonts"
|
|
68633
|
-
},
|
|
68634
68577
|
width: {
|
|
68635
68578
|
label: "Width",
|
|
68636
68579
|
info: "The width of the text renderer"
|
|
@@ -69176,6 +69119,9 @@ var init_en = __esm({
|
|
|
69176
69119
|
"physics-material": {
|
|
69177
69120
|
title: "Physics Material"
|
|
69178
69121
|
},
|
|
69122
|
+
"render-target": {
|
|
69123
|
+
title: "Render Target"
|
|
69124
|
+
},
|
|
69179
69125
|
"entity-script": {
|
|
69180
69126
|
title: "Entity Script"
|
|
69181
69127
|
},
|
|
@@ -71354,6 +71300,9 @@ var init_zh = __esm({
|
|
|
71354
71300
|
title: "\u9700\u8981\u900F\u660E\u901A\u9053",
|
|
71355
71301
|
info: "\u786E\u5B9A\u662F\u5426\u5728\u8F93\u51FA\u4E2D\u4FDD\u7559\u900F\u660E\u901A\u9053\u3002\u8BBE\u7F6E\u4E3A true \u65F6\uFF0C\u59CB\u7EC8\u4FDD\u7559\u900F\u660E\u901A\u9053\uFF1B\u8BBE\u7F6E\u4E3A false \u65F6\uFF0C\u5F15\u64CE\u4F1A\u81EA\u52A8\u51B3\u5B9A\u662F\u5426\u4FDD\u7559\u900F\u660E\u901A\u9053\u3002"
|
|
71356
71302
|
},
|
|
71303
|
+
"render-target": {
|
|
71304
|
+
title: "\u6E32\u67D3\u76EE\u6807"
|
|
71305
|
+
},
|
|
71357
71306
|
viewport: {
|
|
71358
71307
|
title: "\u89C6\u53E3"
|
|
71359
71308
|
},
|
|
@@ -71946,10 +71895,6 @@ var init_zh = __esm({
|
|
|
71946
71895
|
label: "\u5B57\u4F53",
|
|
71947
71896
|
info: "\u7528\u4E8E\u6E32\u67D3\u6587\u672C\u7684\u5B57\u4F53\u8D44\u4EA7"
|
|
71948
71897
|
},
|
|
71949
|
-
"font-family": {
|
|
71950
|
-
label: "\u5B57\u4F53\u65CF",
|
|
71951
|
-
info: "\u4F7F\u7528\u7CFB\u7EDF\u5B57\u4F53\u65F6\u7684\u5B57\u4F53\u65CF\u540D\u79F0"
|
|
71952
|
-
},
|
|
71953
71898
|
width: {
|
|
71954
71899
|
label: "\u5BBD\u5EA6",
|
|
71955
71900
|
info: "\u6587\u672C\u6E32\u67D3\u5668\u7684\u5BBD\u5EA6"
|
|
@@ -72495,6 +72440,9 @@ var init_zh = __esm({
|
|
|
72495
72440
|
"physics-material": {
|
|
72496
72441
|
title: "\u7269\u7406\u6750\u8D28"
|
|
72497
72442
|
},
|
|
72443
|
+
"render-target": {
|
|
72444
|
+
title: "\u6E32\u67D3\u76EE\u6807"
|
|
72445
|
+
},
|
|
72498
72446
|
"entity-script": {
|
|
72499
72447
|
title: "\u5B9E\u4F53\u811A\u672C"
|
|
72500
72448
|
},
|
|
@@ -74671,6 +74619,9 @@ var init_ja = __esm({
|
|
|
74671
74619
|
title: "\u30A2\u30EB\u30D5\u30A1\u51FA\u529B\u304C\u5FC5\u8981\u3067\u3059",
|
|
74672
74620
|
info: "\u51FA\u529B\u3067\u30A2\u30EB\u30D5\u30A1\u30C1\u30E3\u30F3\u30CD\u30EB\u3092\u4FDD\u6301\u3059\u308B\u304B\u3069\u3046\u304B\u3092\u6C7A\u5B9A\u3057\u307E\u3059\u3002true\u306B\u8A2D\u5B9A\u3059\u308B\u3068\u3001\u30A2\u30EB\u30D5\u30A1\u30C1\u30E3\u30F3\u30CD\u30EB\u306F\u5E38\u306B\u4FDD\u6301\u3055\u308C\u307E\u3059\u3002false\u306B\u8A2D\u5B9A\u3059\u308B\u3068\u3001\u30A8\u30F3\u30B8\u30F3\u304C\u81EA\u52D5\u7684\u306B\u4FDD\u6301\u3059\u308B\u304B\u3069\u3046\u304B\u3092\u6C7A\u5B9A\u3057\u307E\u3059\u3002"
|
|
74673
74621
|
},
|
|
74622
|
+
"render-target": {
|
|
74623
|
+
title: "\u30EC\u30F3\u30C0\u30FC\u30BF\u30FC\u30B2\u30C3\u30C8"
|
|
74624
|
+
},
|
|
74674
74625
|
viewport: {
|
|
74675
74626
|
title: "\u30D3\u30E5\u30FC\u30DD\u30FC\u30C8"
|
|
74676
74627
|
},
|
|
@@ -75278,10 +75229,6 @@ var init_ja = __esm({
|
|
|
75278
75229
|
label: "\u30D5\u30A9\u30F3\u30C8",
|
|
75279
75230
|
info: "\u30C6\u30AD\u30B9\u30C8\u306E\u30EC\u30F3\u30C0\u30EA\u30F3\u30B0\u306B\u4F7F\u7528\u3059\u308B\u30D5\u30A9\u30F3\u30C8\u30A2\u30BB\u30C3\u30C8"
|
|
75280
75231
|
},
|
|
75281
|
-
"font-family": {
|
|
75282
|
-
label: "\u30D5\u30A9\u30F3\u30C8\u30D5\u30A1\u30DF\u30EA\u30FC",
|
|
75283
|
-
info: "\u30B7\u30B9\u30C6\u30E0\u30D5\u30A9\u30F3\u30C8\u3092\u4F7F\u7528\u3059\u308B\u5834\u5408\u306E\u30D5\u30A9\u30F3\u30C8\u30D5\u30A1\u30DF\u30EA\u30FC\u540D"
|
|
75284
|
-
},
|
|
75285
75232
|
width: {
|
|
75286
75233
|
label: "\u5E45",
|
|
75287
75234
|
info: "\u30C6\u30AD\u30B9\u30C8\u30EC\u30F3\u30C0\u30E9\u30FC\u306E\u5E45"
|
|
@@ -75827,6 +75774,9 @@ var init_ja = __esm({
|
|
|
75827
75774
|
"physics-material": {
|
|
75828
75775
|
title: "\u7269\u7406\u7D20\u6750"
|
|
75829
75776
|
},
|
|
75777
|
+
"render-target": {
|
|
75778
|
+
title: "\u30EC\u30F3\u30C0\u30FC\u30BF\u30FC\u30B2\u30C3\u30C8"
|
|
75779
|
+
},
|
|
75830
75780
|
"entity-script": {
|
|
75831
75781
|
title: "\u30A8\u30F3\u30C6\u30A3\u30C6\u30A3\u30B9\u30AF\u30EA\u30D7\u30C8"
|
|
75832
75782
|
},
|
|
@@ -86356,7 +86306,7 @@ var init_logger = __esm({
|
|
|
86356
86306
|
"../utils/src/logger.ts"() {
|
|
86357
86307
|
"use strict";
|
|
86358
86308
|
VERBOSE_MODE = false;
|
|
86359
|
-
if (typeof window !== "undefined"
|
|
86309
|
+
if (typeof window !== "undefined") {
|
|
86360
86310
|
VERBOSE_MODE = localStorage.getItem("GALACEAN_EDITOR_LOGGER_MODE") === "verbose";
|
|
86361
86311
|
}
|
|
86362
86312
|
PREFIX = "editor";
|
|
@@ -88557,18 +88507,18 @@ var init_VanillaPackage = __esm({
|
|
|
88557
88507
|
init_Package();
|
|
88558
88508
|
VanillaPackage = class extends Package {
|
|
88559
88509
|
_template = `
|
|
88560
|
-
\u251C\u2500\u2500 public
|
|
88561
|
-
\u251C\u2500\u2500 src
|
|
88562
|
-
\u2502 \u251C\u2500\u2500 scripts
|
|
88563
|
-
\u2502 \u2502 \u2514\u2500\u2500 index.ts
|
|
88564
|
-
\u2502 \u2514\u2500\u2500 index.ts
|
|
88565
|
-
\u251C\u2500\u2500 index.html
|
|
88566
|
-
\u251C\u2500\u2500 main.js
|
|
88567
|
-
\u251C\u2500\u2500 package.json
|
|
88568
|
-
\u251C\u2500\u2500 project.json
|
|
88569
|
-
\u251C\u2500\u2500 tsconfig.json
|
|
88570
|
-
\u2514\u2500\u2500 vite.config.ts
|
|
88571
|
-
`;
|
|
88510
|
+
\u251C\u2500\u2500 public
|
|
88511
|
+
\u251C\u2500\u2500 src
|
|
88512
|
+
\u2502 \u251C\u2500\u2500 scripts
|
|
88513
|
+
\u2502 \u2502 \u2514\u2500\u2500 index.ts
|
|
88514
|
+
\u2502 \u2514\u2500\u2500 index.ts
|
|
88515
|
+
\u251C\u2500\u2500 index.html
|
|
88516
|
+
\u251C\u2500\u2500 main.js
|
|
88517
|
+
\u251C\u2500\u2500 package.json
|
|
88518
|
+
\u251C\u2500\u2500 project.json
|
|
88519
|
+
\u251C\u2500\u2500 tsconfig.json
|
|
88520
|
+
\u2514\u2500\u2500 vite.config.ts
|
|
88521
|
+
`;
|
|
88572
88522
|
async create(projectFile, originalVirtualFileMap, cacheMap, features, download = false, debug) {
|
|
88573
88523
|
this.dispose();
|
|
88574
88524
|
await this._fixFilePath(projectFile);
|
|
@@ -88704,6 +88654,20 @@ var init_cli_vanilla_package = __esm({
|
|
|
88704
88654
|
builderPkgPath = require2.resolve("@editor/builder/package.json");
|
|
88705
88655
|
templateDir = import_node_path12.default.join(import_node_path12.default.dirname(builderPkgPath), "templates/web");
|
|
88706
88656
|
CLIVanillaPackage = class extends VanillaPackage {
|
|
88657
|
+
// 修正父类 _template 的缩进(父类 template literal 缩进导致 parseAsciiTree level 偏移)
|
|
88658
|
+
_template = `
|
|
88659
|
+
\u251C\u2500\u2500 public
|
|
88660
|
+
\u251C\u2500\u2500 src
|
|
88661
|
+
\u2502 \u251C\u2500\u2500 scripts
|
|
88662
|
+
\u2502 \u2502 \u2514\u2500\u2500 index.ts
|
|
88663
|
+
\u2502 \u2514\u2500\u2500 index.ts
|
|
88664
|
+
\u251C\u2500\u2500 index.html
|
|
88665
|
+
\u251C\u2500\u2500 main.js
|
|
88666
|
+
\u251C\u2500\u2500 package.json
|
|
88667
|
+
\u251C\u2500\u2500 project.json
|
|
88668
|
+
\u251C\u2500\u2500 tsconfig.json
|
|
88669
|
+
\u2514\u2500\u2500 vite.config.ts
|
|
88670
|
+
`;
|
|
88707
88671
|
async _loadTemplate() {
|
|
88708
88672
|
const [entry, scriptEntry, packageJson, html, main, tsconfig, viteConfig] = await Promise.all([
|
|
88709
88673
|
import_promises8.default.readFile(import_node_path12.default.join(templateDir, "src/index.ts.ejs"), "utf-8"),
|
|
@@ -89264,7 +89228,7 @@ var init_ktx_parse_modern = __esm({
|
|
|
89264
89228
|
|
|
89265
89229
|
// src/cli-ktx2-encoder.ts
|
|
89266
89230
|
function sha256Hex(data) {
|
|
89267
|
-
return (0,
|
|
89231
|
+
return (0, import_node_crypto3.createHash)("sha256").update(data).digest("hex");
|
|
89268
89232
|
}
|
|
89269
89233
|
function toArrayBuffer(buffer2) {
|
|
89270
89234
|
return buffer2.buffer.slice(buffer2.byteOffset, buffer2.byteOffset + buffer2.byteLength);
|
|
@@ -89300,10 +89264,7 @@ async function loadBundledBasisAssets() {
|
|
|
89300
89264
|
assertChecksum(BASIS_JS_FILENAME, jsBuffer, BASIS_JS_SHA256);
|
|
89301
89265
|
assertChecksum(BASIS_WASM_FILENAME, wasmBuffer, BASIS_WASM_SHA256);
|
|
89302
89266
|
return { workerCode: buildWorkerCode(jsBuffer.toString("utf-8")), wasmBinary: toArrayBuffer(wasmBuffer) };
|
|
89303
|
-
})()
|
|
89304
|
-
bundledBasisAssetsPromise = null;
|
|
89305
|
-
throw err;
|
|
89306
|
-
});
|
|
89267
|
+
})();
|
|
89307
89268
|
}
|
|
89308
89269
|
return bundledBasisAssetsPromise;
|
|
89309
89270
|
}
|
|
@@ -89364,12 +89325,12 @@ parentPort.on("message", async (msg) => {
|
|
|
89364
89325
|
});
|
|
89365
89326
|
`;
|
|
89366
89327
|
}
|
|
89367
|
-
var import_node_worker_threads,
|
|
89328
|
+
var import_node_worker_threads, import_node_crypto3, import_promises9, import_node_fs, import_node_path13, BASIS_JS_FILENAME, BASIS_WASM_FILENAME, BASIS_JS_SHA256, BASIS_WASM_SHA256, bundledBasisAssetsPromise, CLIKtx2Encoder;
|
|
89368
89329
|
var init_cli_ktx2_encoder = __esm({
|
|
89369
89330
|
"src/cli-ktx2-encoder.ts"() {
|
|
89370
89331
|
"use strict";
|
|
89371
89332
|
import_node_worker_threads = require("node:worker_threads");
|
|
89372
|
-
|
|
89333
|
+
import_node_crypto3 = require("node:crypto");
|
|
89373
89334
|
import_promises9 = require("node:fs/promises");
|
|
89374
89335
|
import_node_fs = require("node:fs");
|
|
89375
89336
|
import_node_path13 = require("node:path");
|
|
@@ -89380,25 +89341,10 @@ var init_cli_ktx2_encoder = __esm({
|
|
|
89380
89341
|
BASIS_WASM_SHA256 = "62ce0364ea8f4969e1e4277ce275213dcce5b234c8c96586da06e3879010341c";
|
|
89381
89342
|
bundledBasisAssetsPromise = null;
|
|
89382
89343
|
CLIKtx2Encoder = class {
|
|
89383
|
-
|
|
89384
|
-
|
|
89385
|
-
|
|
89386
|
-
|
|
89387
|
-
let data;
|
|
89388
|
-
let width;
|
|
89389
|
-
let height;
|
|
89390
|
-
if (rawInfo) {
|
|
89391
|
-
data = buffer2 instanceof ArrayBuffer ? new Uint8Array(buffer2) : new Uint8Array(buffer2);
|
|
89392
|
-
width = rawInfo.width;
|
|
89393
|
-
height = rawInfo.height;
|
|
89394
|
-
} else {
|
|
89395
|
-
const sharp = (await import("sharp")).default;
|
|
89396
|
-
const input = buffer2 instanceof ArrayBuffer ? Buffer.from(buffer2) : buffer2;
|
|
89397
|
-
const decoded = await sharp(input).raw().ensureAlpha().toBuffer({ resolveWithObject: true });
|
|
89398
|
-
data = decoded.data;
|
|
89399
|
-
width = decoded.info.width;
|
|
89400
|
-
height = decoded.info.height;
|
|
89401
|
-
}
|
|
89344
|
+
async encode(buffer2, options = {}) {
|
|
89345
|
+
const sharp = (await import("sharp")).default;
|
|
89346
|
+
const input = buffer2 instanceof ArrayBuffer ? Buffer.from(buffer2) : buffer2;
|
|
89347
|
+
const { data, info } = await sharp(input).raw().ensureAlpha().toBuffer({ resolveWithObject: true });
|
|
89402
89348
|
const { workerCode, wasmBinary } = await loadBundledBasisAssets();
|
|
89403
89349
|
const wasmCopy = wasmBinary.slice(0);
|
|
89404
89350
|
return new Promise((resolve4, reject) => {
|
|
@@ -89427,14 +89373,12 @@ var init_cli_ktx2_encoder = __esm({
|
|
|
89427
89373
|
});
|
|
89428
89374
|
const rgbaBuffer = new ArrayBuffer(data.byteLength);
|
|
89429
89375
|
new Uint8Array(rgbaBuffer).set(data);
|
|
89430
|
-
worker.postMessage(
|
|
89431
|
-
rgbaBuffer,
|
|
89432
|
-
wasmCopy
|
|
89433
|
-
|
|
89376
|
+
worker.postMessage(
|
|
89377
|
+
{ rgbaData: new Uint8Array(rgbaBuffer), width: info.width, height: info.height, options, wasmBinary: wasmCopy },
|
|
89378
|
+
[rgbaBuffer, wasmCopy]
|
|
89379
|
+
);
|
|
89434
89380
|
});
|
|
89435
89381
|
}
|
|
89436
|
-
// 与 plugins/main/src/assets/texture/ktx2-encoder.ts:setTextureParams 逻辑一致。
|
|
89437
|
-
// 统一入口待 @galacean/tools-ktx2-encoder(submodule)导出后迁移。
|
|
89438
89382
|
setTextureParams(buffer2, params) {
|
|
89439
89383
|
const container = read(buffer2);
|
|
89440
89384
|
container.keyValue["GalaceanTextureParams"] = new Uint8Array([
|
|
@@ -89575,16 +89519,19 @@ function dilateColorNode(data, width, height, options) {
|
|
|
89575
89519
|
}
|
|
89576
89520
|
return result;
|
|
89577
89521
|
}
|
|
89578
|
-
async function
|
|
89522
|
+
async function dilateColorBuffer(imageBuffer, options) {
|
|
89579
89523
|
const sharp = (await import("sharp")).default;
|
|
89580
|
-
const
|
|
89524
|
+
const image = sharp(imageBuffer);
|
|
89525
|
+
const { data, info } = await image.ensureAlpha().raw().toBuffer({ resolveWithObject: true });
|
|
89581
89526
|
const processed = dilateColorNode(
|
|
89582
89527
|
new Uint8Array(data.buffer, data.byteOffset, data.byteLength),
|
|
89583
89528
|
info.width,
|
|
89584
89529
|
info.height,
|
|
89585
89530
|
options
|
|
89586
89531
|
);
|
|
89587
|
-
return
|
|
89532
|
+
return sharp(Buffer.from(processed), {
|
|
89533
|
+
raw: { width: info.width, height: info.height, channels: 4 }
|
|
89534
|
+
}).png().toBuffer();
|
|
89588
89535
|
}
|
|
89589
89536
|
var init_cli_color_dilate = __esm({
|
|
89590
89537
|
"src/cli-color-dilate.ts"() {
|
|
@@ -90055,14 +90002,8 @@ async function loadDomainState(projectDir) {
|
|
|
90055
90002
|
let sceneSettings;
|
|
90056
90003
|
const assetMeta = /* @__PURE__ */ new Map();
|
|
90057
90004
|
for (const [assetId, entry] of Object.entries(manifest.entries)) {
|
|
90058
|
-
|
|
90059
|
-
const
|
|
90060
|
-
if (inlineMeta && typeof inlineMeta === "object") {
|
|
90061
|
-
meta3 = inlineMeta;
|
|
90062
|
-
} else {
|
|
90063
|
-
const metaText = await import_promises10.default.readFile(`${projectDir}/${metaFilePath(entry.path)}`, "utf-8");
|
|
90064
|
-
meta3 = JSON.parse(metaText);
|
|
90065
|
-
}
|
|
90005
|
+
const metaText = await import_promises10.default.readFile(`${projectDir}/${metaFilePath(entry.path)}`, "utf-8");
|
|
90006
|
+
const meta3 = JSON.parse(metaText);
|
|
90066
90007
|
const serverId = meta3.serverId || entry.serverId || `local-${assetId}`;
|
|
90067
90008
|
assetMeta.set(assetId, { serverId, meta: meta3 });
|
|
90068
90009
|
const isFolder = entry.type === "Folder";
|
|
@@ -90465,9 +90406,8 @@ var init_asset_types = __esm({
|
|
|
90465
90406
|
Scene: "Scene",
|
|
90466
90407
|
Prefab: "Prefab",
|
|
90467
90408
|
Material: "Material",
|
|
90468
|
-
Texture2D: "
|
|
90469
|
-
TextureCube: "
|
|
90470
|
-
HDR: "HDR",
|
|
90409
|
+
Texture2D: "Texture2D",
|
|
90410
|
+
TextureCube: "TextureCube",
|
|
90471
90411
|
script: "script",
|
|
90472
90412
|
Shader: "Shader",
|
|
90473
90413
|
ShaderChunk: "ShaderChunk",
|
|
@@ -90484,7 +90424,7 @@ var init_asset_types = __esm({
|
|
|
90484
90424
|
PrimitiveMesh: "PrimitiveMesh",
|
|
90485
90425
|
glTF: "GLTF",
|
|
90486
90426
|
Mesh: "Mesh",
|
|
90487
|
-
AmbientLight: "
|
|
90427
|
+
AmbientLight: "AmbientLight",
|
|
90488
90428
|
LottieClip: "LottieAnimation",
|
|
90489
90429
|
XRReferenceImage: "XRReferenceImage",
|
|
90490
90430
|
GameDesignGraph: "GameDesignGraph"
|
|
@@ -90499,15 +90439,8 @@ __export(cli_builder_exports, {
|
|
|
90499
90439
|
TEXT_ASSET_TYPES: () => TEXT_ASSET_TYPES,
|
|
90500
90440
|
assertSafeBuildOutputDir: () => assertSafeBuildOutputDir,
|
|
90501
90441
|
buildProject: () => buildProject,
|
|
90502
|
-
buildProjectAssets: () => buildProjectAssets
|
|
90503
|
-
warnSkippedScenePrefabs: () => warnSkippedScenePrefabs
|
|
90442
|
+
buildProjectAssets: () => buildProjectAssets
|
|
90504
90443
|
});
|
|
90505
|
-
function warnSkippedScenePrefabs(skippedAssets) {
|
|
90506
|
-
const skippedScenePrefabs = skippedAssets.filter((a) => a.reason?.includes("Scene") || a.reason?.includes("Prefab"));
|
|
90507
|
-
if (skippedScenePrefabs.length === 0) return null;
|
|
90508
|
-
return `[cliCompile] Warning: ${skippedScenePrefabs.length} Scene/Prefab asset(s) were skipped, feature detection may be incomplete:
|
|
90509
|
-
` + skippedScenePrefabs.map((a) => ` - ${a.path}: ${a.reason}`).join("\n");
|
|
90510
|
-
}
|
|
90511
90444
|
function isHttpUrl(url2) {
|
|
90512
90445
|
return typeof url2 === "string" && /^https?:\/\//.test(url2);
|
|
90513
90446
|
}
|
|
@@ -90603,35 +90536,30 @@ function buildProjectAssets(manifest, projectDir) {
|
|
|
90603
90536
|
if (e.type === "Folder") folderPathToId.set(e.path, id);
|
|
90604
90537
|
}
|
|
90605
90538
|
for (const [assetId, entry] of Object.entries(entries)) {
|
|
90539
|
+
const metaPath = import_node_path14.default.join(projectDir, metaFilePath(entry.path));
|
|
90540
|
+
let metaText;
|
|
90541
|
+
try {
|
|
90542
|
+
metaText = import_node_fs2.default.readFileSync(metaPath, "utf-8");
|
|
90543
|
+
} catch (e) {
|
|
90544
|
+
console.warn(`[buildProjectAssets] Failed to read meta file: ${metaPath}`, e);
|
|
90545
|
+
skippedAssets.push({
|
|
90546
|
+
assetId,
|
|
90547
|
+
path: entry.path,
|
|
90548
|
+
reason: `failed to read meta file: ${e instanceof Error ? e.message : String(e)}`
|
|
90549
|
+
});
|
|
90550
|
+
continue;
|
|
90551
|
+
}
|
|
90606
90552
|
let meta3;
|
|
90607
|
-
|
|
90608
|
-
|
|
90609
|
-
|
|
90610
|
-
|
|
90611
|
-
|
|
90612
|
-
|
|
90613
|
-
|
|
90614
|
-
|
|
90615
|
-
}
|
|
90616
|
-
|
|
90617
|
-
skippedAssets.push({
|
|
90618
|
-
assetId,
|
|
90619
|
-
path: entry.path,
|
|
90620
|
-
reason: `failed to read meta file: ${e instanceof Error ? e.message : String(e)}`
|
|
90621
|
-
});
|
|
90622
|
-
continue;
|
|
90623
|
-
}
|
|
90624
|
-
try {
|
|
90625
|
-
meta3 = JSON.parse(metaText);
|
|
90626
|
-
} catch (e) {
|
|
90627
|
-
console.warn(`[buildProjectAssets] Failed to parse meta JSON: ${metaPath}`, e);
|
|
90628
|
-
skippedAssets.push({
|
|
90629
|
-
assetId,
|
|
90630
|
-
path: entry.path,
|
|
90631
|
-
reason: `failed to parse meta JSON: ${e instanceof Error ? e.message : String(e)}`
|
|
90632
|
-
});
|
|
90633
|
-
continue;
|
|
90634
|
-
}
|
|
90553
|
+
try {
|
|
90554
|
+
meta3 = JSON.parse(metaText);
|
|
90555
|
+
} catch (e) {
|
|
90556
|
+
console.warn(`[buildProjectAssets] Failed to parse meta JSON: ${metaPath}`, e);
|
|
90557
|
+
skippedAssets.push({
|
|
90558
|
+
assetId,
|
|
90559
|
+
path: entry.path,
|
|
90560
|
+
reason: `failed to parse meta JSON: ${e instanceof Error ? e.message : String(e)}`
|
|
90561
|
+
});
|
|
90562
|
+
continue;
|
|
90635
90563
|
}
|
|
90636
90564
|
metaMap.set(assetId, meta3);
|
|
90637
90565
|
const parts = entry.path.split("/");
|
|
@@ -90692,7 +90620,7 @@ async function cliCompile(vfs, config2, options) {
|
|
|
90692
90620
|
continue;
|
|
90693
90621
|
}
|
|
90694
90622
|
file2.exportPath = url2;
|
|
90695
|
-
idMd5Map.set(file2.id, (0, import_js_md52.
|
|
90623
|
+
idMd5Map.set(file2.id, (0, import_js_md52.md5)(url2));
|
|
90696
90624
|
continue;
|
|
90697
90625
|
}
|
|
90698
90626
|
if (url2?.startsWith("file://")) {
|
|
@@ -90741,16 +90669,17 @@ async function cliCompile(vfs, config2, options) {
|
|
|
90741
90669
|
let cacheKey;
|
|
90742
90670
|
let binaryBuffer = null;
|
|
90743
90671
|
if (typeof content === "string") {
|
|
90744
|
-
cacheKey = (0, import_js_md52.
|
|
90672
|
+
cacheKey = (0, import_js_md52.md5)(content);
|
|
90745
90673
|
} else {
|
|
90746
90674
|
binaryBuffer = await content.arrayBuffer();
|
|
90747
|
-
cacheKey = (0, import_js_md52.
|
|
90675
|
+
cacheKey = (0, import_js_md52.md5)(binaryBuffer);
|
|
90748
90676
|
}
|
|
90749
90677
|
if (type === "Texture2D" && binaryBuffer) {
|
|
90750
|
-
|
|
90751
|
-
let dilatedRaw = null;
|
|
90678
|
+
let imgBuf = new Uint8Array(binaryBuffer);
|
|
90752
90679
|
if (meta3.colorDilate) {
|
|
90753
|
-
|
|
90680
|
+
const dilated = await dilateColorBuffer(imgBuf, { range: 4, alpha: 2 });
|
|
90681
|
+
imgBuf = new Uint8Array(dilated);
|
|
90682
|
+
binaryBuffer = imgBuf.buffer;
|
|
90754
90683
|
}
|
|
90755
90684
|
const runtimeOptions = meta3.runtimeOptions;
|
|
90756
90685
|
let useKtx2 = !!(options.ktx2 && ktx2Encoder);
|
|
@@ -90760,18 +90689,12 @@ async function cliCompile(vfs, config2, options) {
|
|
|
90760
90689
|
if (useKtx2) {
|
|
90761
90690
|
const ktx2Mode = runtimeOptions?.overwrite ? runtimeOptions.mode : options.ktx2Mode;
|
|
90762
90691
|
const ktx2Quality = runtimeOptions?.overwrite ? runtimeOptions.quality : options.ktx2Quality;
|
|
90763
|
-
const
|
|
90764
|
-
|
|
90765
|
-
|
|
90766
|
-
|
|
90767
|
-
|
|
90768
|
-
|
|
90769
|
-
qualityLevel: ktx2Quality ?? 150,
|
|
90770
|
-
generateMipmap: !!(meta3.mipmap ?? true),
|
|
90771
|
-
isSetKTX2SRGBTransferFunc: !!(meta3.isSRGBColorSpace ?? true)
|
|
90772
|
-
},
|
|
90773
|
-
rawInfo
|
|
90774
|
-
);
|
|
90692
|
+
const encoded = await ktx2Encoder.encode(imgBuf.buffer, {
|
|
90693
|
+
isUASTC: ktx2Mode === "UASTC",
|
|
90694
|
+
qualityLevel: ktx2Quality ?? 150,
|
|
90695
|
+
generateMipmap: !!(meta3.mipmap ?? true),
|
|
90696
|
+
isSetKTX2SRGBTransferFunc: !!(meta3.isSRGBColorSpace ?? true)
|
|
90697
|
+
});
|
|
90775
90698
|
const withParams = ktx2Encoder.setTextureParams(encoded, {
|
|
90776
90699
|
wrapModeU: meta3.wrapModeU ?? 1,
|
|
90777
90700
|
wrapModeV: meta3.wrapModeV ?? 1,
|
|
@@ -90779,30 +90702,21 @@ async function cliCompile(vfs, config2, options) {
|
|
|
90779
90702
|
anisoLevel: meta3.anisoLevel ?? 1
|
|
90780
90703
|
});
|
|
90781
90704
|
const encodedBuffer = toBlobArrayBuffer(withParams);
|
|
90782
|
-
cacheKey = (0, import_js_md52.
|
|
90705
|
+
cacheKey = (0, import_js_md52.md5)(encodedBuffer);
|
|
90783
90706
|
cacheMap.set(cacheKey, new Blob([encodedBuffer]));
|
|
90784
90707
|
file2.exportType = "KTX2";
|
|
90785
90708
|
const pathParts = file2.path.split("/");
|
|
90786
90709
|
const pathName = pathParts[pathParts.length - 1].replace(/\.[^.]+$/, ".ktx2");
|
|
90787
90710
|
file2.exportPath = pathParts.slice(0, -1).concat(pathName).join("/");
|
|
90788
90711
|
} else {
|
|
90789
|
-
let texInput = imgBuf;
|
|
90790
|
-
if (dilatedRaw) {
|
|
90791
|
-
const sharp = (await import("sharp")).default;
|
|
90792
|
-
texInput = new Uint8Array(
|
|
90793
|
-
await sharp(Buffer.from(dilatedRaw.data), {
|
|
90794
|
-
raw: { width: dilatedRaw.width, height: dilatedRaw.height, channels: 4 }
|
|
90795
|
-
}).png().toBuffer()
|
|
90796
|
-
);
|
|
90797
|
-
}
|
|
90798
90712
|
const encoded = await encodeEditorTexture2D(
|
|
90799
|
-
|
|
90713
|
+
imgBuf,
|
|
90800
90714
|
file2.id,
|
|
90801
90715
|
file2.name ?? file2.path.split("/").pop() ?? "",
|
|
90802
90716
|
meta3
|
|
90803
90717
|
);
|
|
90804
90718
|
const encodedBuffer = toBlobArrayBuffer(encoded);
|
|
90805
|
-
cacheKey = (0, import_js_md52.
|
|
90719
|
+
cacheKey = (0, import_js_md52.md5)(encodedBuffer);
|
|
90806
90720
|
cacheMap.set(cacheKey, new Blob([encodedBuffer]));
|
|
90807
90721
|
}
|
|
90808
90722
|
} else {
|
|
@@ -90855,8 +90769,6 @@ async function cliCompile(vfs, config2, options) {
|
|
|
90855
90769
|
}
|
|
90856
90770
|
throw new Error("No scene found in project. Use --scene <sceneId> to specify one.");
|
|
90857
90771
|
}
|
|
90858
|
-
const featureWarning = warnSkippedScenePrefabs(skippedAssets);
|
|
90859
|
-
if (featureWarning) console.warn(featureWarning);
|
|
90860
90772
|
const features = collectFeatures(scenes, prefabs, config2.engineVersion, config2.dependencies);
|
|
90861
90773
|
const projectSchema = {
|
|
90862
90774
|
plugins: [],
|
|
@@ -130226,33 +130138,36 @@ var HttpSyncApiClient = class {
|
|
|
130226
130138
|
if (!this.isRecord(json2) || !this.isRecord(json2.data)) {
|
|
130227
130139
|
throw new Error("Invalid response: missing data field");
|
|
130228
130140
|
}
|
|
130229
|
-
|
|
130230
|
-
|
|
130141
|
+
if (!this.isRemoteProjectDetail(json2.data)) {
|
|
130142
|
+
throw new Error("Invalid response: invalid project detail");
|
|
130143
|
+
}
|
|
130144
|
+
const data = json2.data;
|
|
130145
|
+
if (typeof data.content === "string") {
|
|
130231
130146
|
try {
|
|
130232
|
-
|
|
130147
|
+
;
|
|
130148
|
+
data.content = JSON.parse(data.content);
|
|
130233
130149
|
} catch {
|
|
130234
130150
|
throw new Error("Invalid response: invalid content field");
|
|
130235
130151
|
}
|
|
130236
130152
|
}
|
|
130237
|
-
if (typeof
|
|
130153
|
+
if (typeof data.setting === "string") {
|
|
130238
130154
|
try {
|
|
130239
|
-
|
|
130155
|
+
;
|
|
130156
|
+
data.setting = JSON.parse(data.setting);
|
|
130240
130157
|
} catch {
|
|
130241
130158
|
throw new Error("Invalid response: invalid setting field");
|
|
130242
130159
|
}
|
|
130243
130160
|
}
|
|
130244
|
-
if (typeof
|
|
130161
|
+
if (typeof data.dependencies === "string") {
|
|
130245
130162
|
try {
|
|
130246
|
-
|
|
130163
|
+
;
|
|
130164
|
+
data.dependencies = JSON.parse(data.dependencies);
|
|
130247
130165
|
} catch {
|
|
130248
|
-
const fallback =
|
|
130249
|
-
|
|
130166
|
+
const fallback = data.setting?.dependencies;
|
|
130167
|
+
data.dependencies = this.isRecord(fallback) ? fallback : {};
|
|
130250
130168
|
}
|
|
130251
130169
|
}
|
|
130252
|
-
|
|
130253
|
-
throw new Error("Invalid response: invalid project detail");
|
|
130254
|
-
}
|
|
130255
|
-
return raw;
|
|
130170
|
+
return data;
|
|
130256
130171
|
}
|
|
130257
130172
|
async downloadAsset(url2, options) {
|
|
130258
130173
|
const res = await fetch(url2, { signal: options?.signal });
|
|
@@ -130417,7 +130332,6 @@ var http = __toESM(require("node:http"));
|
|
|
130417
130332
|
|
|
130418
130333
|
// src/config.ts
|
|
130419
130334
|
var import_promises2 = require("node:fs/promises");
|
|
130420
|
-
var import_node_crypto = require("node:crypto");
|
|
130421
130335
|
var import_node_os = __toESM(require("node:os"));
|
|
130422
130336
|
var import_node_path2 = __toESM(require("node:path"));
|
|
130423
130337
|
init_utils();
|
|
@@ -130480,9 +130394,7 @@ async function writeConfigs(updates, targetPath) {
|
|
|
130480
130394
|
Object.assign(config2, updates);
|
|
130481
130395
|
await (0, import_promises2.mkdir)(import_node_path2.default.dirname(configPath), { recursive: true });
|
|
130482
130396
|
const data = JSON.stringify(config2, null, 2) + "\n";
|
|
130483
|
-
|
|
130484
|
-
await (0, import_promises2.writeFile)(tmpPath, data, { mode: 384 });
|
|
130485
|
-
await (0, import_promises2.rename)(tmpPath, configPath);
|
|
130397
|
+
await (0, import_promises2.writeFile)(configPath, data, { mode: 384 });
|
|
130486
130398
|
await (0, import_promises2.chmod)(configPath, 384);
|
|
130487
130399
|
return configPath;
|
|
130488
130400
|
}
|
|
@@ -130754,7 +130666,35 @@ async function initProject(opts) {
|
|
|
130754
130666
|
console.warn("[init] Failed to parse project.content:", err);
|
|
130755
130667
|
}
|
|
130756
130668
|
}
|
|
130757
|
-
|
|
130669
|
+
let dependencies;
|
|
130670
|
+
if (project.dependencies && typeof project.dependencies === "object") {
|
|
130671
|
+
dependencies = project.dependencies;
|
|
130672
|
+
} else if (typeof project.dependencies === "string") {
|
|
130673
|
+
try {
|
|
130674
|
+
const parsed = JSON.parse(project.dependencies);
|
|
130675
|
+
if (parsed && typeof parsed === "object" && !Array.isArray(parsed)) {
|
|
130676
|
+
dependencies = parsed;
|
|
130677
|
+
}
|
|
130678
|
+
} catch (err) {
|
|
130679
|
+
console.warn("[init] Failed to parse project.dependencies:", err);
|
|
130680
|
+
}
|
|
130681
|
+
}
|
|
130682
|
+
if (!dependencies || Object.keys(dependencies).length === 0) {
|
|
130683
|
+
let setting = project.setting;
|
|
130684
|
+
if (typeof setting === "string") {
|
|
130685
|
+
try {
|
|
130686
|
+
setting = JSON.parse(setting);
|
|
130687
|
+
} catch (err) {
|
|
130688
|
+
console.warn("[init] Failed to parse project.setting:", err);
|
|
130689
|
+
}
|
|
130690
|
+
}
|
|
130691
|
+
if (setting && typeof setting === "object") {
|
|
130692
|
+
const settingDeps = setting.dependencies;
|
|
130693
|
+
if (settingDeps && typeof settingDeps === "object" && !Array.isArray(settingDeps)) {
|
|
130694
|
+
dependencies = settingDeps;
|
|
130695
|
+
}
|
|
130696
|
+
}
|
|
130697
|
+
}
|
|
130758
130698
|
const pathMap = buildLocalPathMap(project.assets);
|
|
130759
130699
|
const contents = /* @__PURE__ */ new Map();
|
|
130760
130700
|
const hashes = /* @__PURE__ */ new Map();
|
|
@@ -131154,7 +131094,35 @@ async function pullProject(opts) {
|
|
|
131154
131094
|
if (project.content && typeof project.content === "object") {
|
|
131155
131095
|
sceneId = project.content.scene ?? "";
|
|
131156
131096
|
}
|
|
131157
|
-
|
|
131097
|
+
let dependencies;
|
|
131098
|
+
if (project.dependencies && typeof project.dependencies === "object") {
|
|
131099
|
+
dependencies = project.dependencies;
|
|
131100
|
+
} else if (typeof project.dependencies === "string") {
|
|
131101
|
+
try {
|
|
131102
|
+
const parsed = JSON.parse(project.dependencies);
|
|
131103
|
+
if (parsed && typeof parsed === "object" && !Array.isArray(parsed)) {
|
|
131104
|
+
dependencies = parsed;
|
|
131105
|
+
}
|
|
131106
|
+
} catch (err) {
|
|
131107
|
+
console.warn("[pull] Failed to parse project.dependencies:", err);
|
|
131108
|
+
}
|
|
131109
|
+
}
|
|
131110
|
+
if (!dependencies || Object.keys(dependencies).length === 0) {
|
|
131111
|
+
let setting = project.setting;
|
|
131112
|
+
if (typeof setting === "string") {
|
|
131113
|
+
try {
|
|
131114
|
+
setting = JSON.parse(setting);
|
|
131115
|
+
} catch (err) {
|
|
131116
|
+
console.warn("[pull] Failed to parse project.setting:", err);
|
|
131117
|
+
}
|
|
131118
|
+
}
|
|
131119
|
+
if (setting && typeof setting === "object") {
|
|
131120
|
+
const settingDeps = setting.dependencies;
|
|
131121
|
+
if (settingDeps && typeof settingDeps === "object" && !Array.isArray(settingDeps)) {
|
|
131122
|
+
dependencies = settingDeps;
|
|
131123
|
+
}
|
|
131124
|
+
}
|
|
131125
|
+
}
|
|
131158
131126
|
await atomicWriteFile(
|
|
131159
131127
|
fs6,
|
|
131160
131128
|
import_node_path5.default.resolve(projectDir, "project.galacean"),
|
|
@@ -131180,7 +131148,7 @@ async function pullProject(opts) {
|
|
|
131180
131148
|
}
|
|
131181
131149
|
|
|
131182
131150
|
// src/commands/push/push-project.ts
|
|
131183
|
-
var
|
|
131151
|
+
var import_node_crypto2 = require("node:crypto");
|
|
131184
131152
|
var import_node_path8 = __toESM(require("node:path"));
|
|
131185
131153
|
init_hash();
|
|
131186
131154
|
init_fs();
|
|
@@ -131290,7 +131258,7 @@ var BUILTIN_REMOTE_ASSETS = [
|
|
|
131290
131258
|
{
|
|
131291
131259
|
id: "",
|
|
131292
131260
|
uuid: "ff6b0f7b-8927-4de9-8d62-c2ca147bc4a3",
|
|
131293
|
-
name: "
|
|
131261
|
+
name: "DigtalHuman",
|
|
131294
131262
|
type: 1,
|
|
131295
131263
|
parentId: "0000006",
|
|
131296
131264
|
meta: '{"type":"Folder","id":"ff6b0f7b-8927-4de9-8d62-c2ca147bc4a3","version":"1.0.1"}',
|
|
@@ -132060,11 +132028,6 @@ async function pushProject(opts) {
|
|
|
132060
132028
|
manifest.entries[id].contentHash = orig.contentHash;
|
|
132061
132029
|
}
|
|
132062
132030
|
}
|
|
132063
|
-
const remotePath = import_node_path8.default.resolve(projectDir, ".galacean/remote.json");
|
|
132064
|
-
try {
|
|
132065
|
-
await fs6.remove(remotePath);
|
|
132066
|
-
} catch {
|
|
132067
|
-
}
|
|
132068
132031
|
throw err;
|
|
132069
132032
|
}
|
|
132070
132033
|
}
|
|
@@ -132186,7 +132149,7 @@ async function pushProject(opts) {
|
|
|
132186
132149
|
const parentId = resolveParentId(import_node_path8.default.posix.dirname(folderPath), folderIdByPath, folderPath);
|
|
132187
132150
|
const existingMeta = await readMetaFileIfExists(fs6, absFolderPath) ?? {};
|
|
132188
132151
|
const persistedId = resolvePersistedId(existingMeta);
|
|
132189
|
-
const assetId = persistedId ?? (0,
|
|
132152
|
+
const assetId = persistedId ?? (0, import_node_crypto2.randomUUID)();
|
|
132190
132153
|
const baseMeta = {
|
|
132191
132154
|
...stripLocalMetaFields(existingMeta),
|
|
132192
132155
|
type: "Folder",
|
|
@@ -132252,7 +132215,7 @@ async function pushProject(opts) {
|
|
|
132252
132215
|
);
|
|
132253
132216
|
}
|
|
132254
132217
|
const persistedId = resolvePersistedId(existingMeta);
|
|
132255
|
-
const assetId = persistedId ?? (0,
|
|
132218
|
+
const assetId = persistedId ?? (0, import_node_crypto2.randomUUID)();
|
|
132256
132219
|
const baseMeta = {
|
|
132257
132220
|
...stripLocalMetaFields(existingMeta),
|
|
132258
132221
|
type: metaType,
|
|
@@ -134236,9 +134199,6 @@ var FileWatcher = class {
|
|
|
134236
134199
|
const rel = import_node_path10.default.relative(this.opts.watchDir, filePath);
|
|
134237
134200
|
this._onRawEvent(rel);
|
|
134238
134201
|
});
|
|
134239
|
-
this.watcher.on("error", (err) => {
|
|
134240
|
-
console.error("[FileWatcher] watcher error:", err);
|
|
134241
|
-
});
|
|
134242
134202
|
}
|
|
134243
134203
|
close() {
|
|
134244
134204
|
if (this.closed) return;
|
|
@@ -134394,7 +134354,7 @@ function registerProjectInfo(parent) {
|
|
|
134394
134354
|
try {
|
|
134395
134355
|
remote = await readNodeRemoteConfig(dir);
|
|
134396
134356
|
} catch (err) {
|
|
134397
|
-
if (!(
|
|
134357
|
+
if (!err?.message?.startsWith("Cannot read")) throw err;
|
|
134398
134358
|
}
|
|
134399
134359
|
if (globals.json) {
|
|
134400
134360
|
console.log(
|
|
@@ -134486,7 +134446,7 @@ function registerAssetInfo(parent) {
|
|
|
134486
134446
|
try {
|
|
134487
134447
|
meta3 = await readAssetMeta(dir, metaFilePath(entry.path));
|
|
134488
134448
|
} catch (err) {
|
|
134489
|
-
if (!(
|
|
134449
|
+
if (!err?.message?.startsWith("Cannot read")) throw err;
|
|
134490
134450
|
}
|
|
134491
134451
|
if (globals.json) {
|
|
134492
134452
|
console.log(JSON.stringify({ ...entry, meta: meta3 }, null, 2));
|
|
@@ -134909,14 +134869,6 @@ async function execTool(options) {
|
|
|
134909
134869
|
if (isUnsupportedHeadlessTool(options.toolId)) {
|
|
134910
134870
|
throw new EditorAPIError2("NOT_SUPPORTED", buildUnsupportedToolMessage(options.toolId));
|
|
134911
134871
|
}
|
|
134912
|
-
let params = {};
|
|
134913
|
-
if (options.params) {
|
|
134914
|
-
try {
|
|
134915
|
-
params = JSON.parse(options.params);
|
|
134916
|
-
} catch {
|
|
134917
|
-
throw new Error(`Invalid JSON in params: ${options.params}`);
|
|
134918
|
-
}
|
|
134919
|
-
}
|
|
134920
134872
|
const { HeadlessRoot: HeadlessRoot2 } = await Promise.resolve().then(() => (init_headless(), headless_exports));
|
|
134921
134873
|
const { loadDomainState: loadDomainState2, saveDomainState: saveDomainState2 } = await Promise.resolve().then(() => (init_domain_bridge(), domain_bridge_exports));
|
|
134922
134874
|
const projectDir = import_node_path17.default.resolve(options.projectDir);
|
|
@@ -134928,6 +134880,7 @@ async function execTool(options) {
|
|
|
134928
134880
|
});
|
|
134929
134881
|
root2.loadState(state);
|
|
134930
134882
|
api2.init(root2);
|
|
134883
|
+
const params = options.params ? JSON.parse(options.params) : {};
|
|
134931
134884
|
const result = await root2.runInUndoGroup(`exec:${options.toolId}`, () => api2.invoke(options.toolId, params));
|
|
134932
134885
|
const saved = !options.dryRun && root2.isDirty;
|
|
134933
134886
|
if (saved) {
|
|
@@ -134966,7 +134919,7 @@ function readCliVersionFromPackageJson() {
|
|
|
134966
134919
|
const parsed = JSON.parse(raw);
|
|
134967
134920
|
return typeof parsed.version === "string" && parsed.version.length > 0 ? parsed.version : "0.0.0";
|
|
134968
134921
|
}
|
|
134969
|
-
var CLI_VERSION = "0.0.1-alpha.
|
|
134922
|
+
var CLI_VERSION = "0.0.1-alpha.9".length > 0 ? "0.0.1-alpha.9" : readCliVersionFromPackageJson();
|
|
134970
134923
|
|
|
134971
134924
|
// src/push-output.ts
|
|
134972
134925
|
function printPushResult(result, options = {}) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@galacean/cli",
|
|
3
|
-
"version": "0.0.1-alpha.
|
|
3
|
+
"version": "0.0.1-alpha.9",
|
|
4
4
|
"main": "dist/cli.bundle.cjs",
|
|
5
5
|
"bin": {
|
|
6
6
|
"galacean": "bin/galacean.js"
|
|
@@ -15,18 +15,7 @@
|
|
|
15
15
|
"README.md"
|
|
16
16
|
],
|
|
17
17
|
"publishConfig": {
|
|
18
|
-
"
|
|
19
|
-
"bin": {
|
|
20
|
-
"galacean": "bin/galacean.js"
|
|
21
|
-
}
|
|
22
|
-
},
|
|
23
|
-
"scripts": {
|
|
24
|
-
"build": "node build.mjs",
|
|
25
|
-
"build:tsc": "tsc -p tsconfig.build.json",
|
|
26
|
-
"prepublishOnly": "node build.mjs",
|
|
27
|
-
"update:basis-assets": "node scripts/update-basis-assets.mjs",
|
|
28
|
-
"test": "vitest run",
|
|
29
|
-
"test:watch": "vitest"
|
|
18
|
+
"registry": "https://registry.npmjs.org/"
|
|
30
19
|
},
|
|
31
20
|
"dependencies": {
|
|
32
21
|
"chokidar": "^4.0.3",
|
|
@@ -36,15 +25,22 @@
|
|
|
36
25
|
"sharp": "^0.33.0"
|
|
37
26
|
},
|
|
38
27
|
"devDependencies": {
|
|
39
|
-
"@editor/builder": "workspace:*",
|
|
40
|
-
"@editor/constants": "workspace:*",
|
|
41
|
-
"@editor/editor-api": "workspace:*",
|
|
42
|
-
"@editor/model": "workspace:*",
|
|
43
|
-
"@editor/storage": "workspace:*",
|
|
44
|
-
"@editor/vfs": "workspace:*",
|
|
45
28
|
"@types/node": "^22.10.2",
|
|
46
|
-
"
|
|
47
|
-
"
|
|
48
|
-
"
|
|
29
|
+
"vitest": "^2.0.0",
|
|
30
|
+
"@editor/constants": "2.0.3",
|
|
31
|
+
"@editor/builder": "1.0.0",
|
|
32
|
+
"@editor/model": "2.0.3",
|
|
33
|
+
"@editor/storage": "0.0.1",
|
|
34
|
+
"@editor/editor-api": "1.0.0",
|
|
35
|
+
"@editor/vfs": "1.0.0",
|
|
36
|
+
"tsconfig": "1.0.1",
|
|
37
|
+
"config": "1.0.1"
|
|
38
|
+
},
|
|
39
|
+
"scripts": {
|
|
40
|
+
"build": "node build.mjs",
|
|
41
|
+
"build:tsc": "tsc -p tsconfig.build.json",
|
|
42
|
+
"update:basis-assets": "node scripts/update-basis-assets.mjs",
|
|
43
|
+
"test": "vitest run",
|
|
44
|
+
"test:watch": "vitest"
|
|
49
45
|
}
|
|
50
|
-
}
|
|
46
|
+
}
|