@galacean/cli 0.0.1-alpha.8 → 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 +852 -890
- package/package.json +19 -23
package/dist/cli.bundle.cjs
CHANGED
|
@@ -1197,7 +1197,7 @@ var require_command = __commonJS({
|
|
|
1197
1197
|
var EventEmitter3 = require("node:events").EventEmitter;
|
|
1198
1198
|
var childProcess = require("node:child_process");
|
|
1199
1199
|
var path16 = require("node:path");
|
|
1200
|
-
var
|
|
1200
|
+
var fs6 = require("node:fs");
|
|
1201
1201
|
var process5 = require("node:process");
|
|
1202
1202
|
var { Argument: Argument2, humanReadableArgName } = require_argument();
|
|
1203
1203
|
var { CommanderError: CommanderError2 } = require_error();
|
|
@@ -2191,7 +2191,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
2191
2191
|
* @param {string} subcommandName
|
|
2192
2192
|
*/
|
|
2193
2193
|
_checkForMissingExecutable(executableFile, executableDir, subcommandName) {
|
|
2194
|
-
if (
|
|
2194
|
+
if (fs6.existsSync(executableFile)) return;
|
|
2195
2195
|
const executableDirMessage = executableDir ? `searched for local subcommand relative to directory '${executableDir}'` : "no directory for search for local subcommand, use .executableDir() to supply a custom directory";
|
|
2196
2196
|
const executableMissing = `'${executableFile}' does not exist
|
|
2197
2197
|
- if '${subcommandName}' is not meant to be an executable command, remove description parameter from '.command()' and use '.description()' instead
|
|
@@ -2210,10 +2210,10 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
2210
2210
|
const sourceExt = [".js", ".ts", ".tsx", ".mjs", ".cjs"];
|
|
2211
2211
|
function findFile(baseDir, baseName) {
|
|
2212
2212
|
const localBin = path16.resolve(baseDir, baseName);
|
|
2213
|
-
if (
|
|
2213
|
+
if (fs6.existsSync(localBin)) return localBin;
|
|
2214
2214
|
if (sourceExt.includes(path16.extname(baseName))) return void 0;
|
|
2215
2215
|
const foundExt = sourceExt.find(
|
|
2216
|
-
(ext) =>
|
|
2216
|
+
(ext) => fs6.existsSync(`${localBin}${ext}`)
|
|
2217
2217
|
);
|
|
2218
2218
|
if (foundExt) return `${localBin}${foundExt}`;
|
|
2219
2219
|
return void 0;
|
|
@@ -2225,7 +2225,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
2225
2225
|
if (this._scriptPath) {
|
|
2226
2226
|
let resolvedScriptPath;
|
|
2227
2227
|
try {
|
|
2228
|
-
resolvedScriptPath =
|
|
2228
|
+
resolvedScriptPath = fs6.realpathSync(this._scriptPath);
|
|
2229
2229
|
} catch {
|
|
2230
2230
|
resolvedScriptPath = this._scriptPath;
|
|
2231
2231
|
}
|
|
@@ -3515,16 +3515,16 @@ var init_utils = __esm({
|
|
|
3515
3515
|
// ../storage/src/manifest.ts
|
|
3516
3516
|
function generateManifest(pathMap, contentHashes) {
|
|
3517
3517
|
const entries = {};
|
|
3518
|
-
for (const [assetId,
|
|
3518
|
+
for (const [assetId, entry] of pathMap) {
|
|
3519
3519
|
entries[assetId] = {
|
|
3520
3520
|
assetId,
|
|
3521
|
-
name:
|
|
3522
|
-
path:
|
|
3523
|
-
type:
|
|
3521
|
+
name: entry.name,
|
|
3522
|
+
path: entry.localPath,
|
|
3523
|
+
type: entry.metaType,
|
|
3524
3524
|
contentHash: contentHashes.get(assetId) ?? "",
|
|
3525
|
-
remoteVersion:
|
|
3526
|
-
serverId:
|
|
3527
|
-
url:
|
|
3525
|
+
remoteVersion: entry.meta.version ?? "",
|
|
3526
|
+
serverId: entry.serverId,
|
|
3527
|
+
url: entry.url
|
|
3528
3528
|
};
|
|
3529
3529
|
}
|
|
3530
3530
|
return { version: 1, entries };
|
|
@@ -3536,13 +3536,13 @@ var init_manifest = __esm({
|
|
|
3536
3536
|
});
|
|
3537
3537
|
|
|
3538
3538
|
// ../storage/src/meta-file.ts
|
|
3539
|
-
function generateMetaFile(
|
|
3540
|
-
const { locked: _locked, id: _id, ...restMeta } =
|
|
3539
|
+
function generateMetaFile(entry) {
|
|
3540
|
+
const { locked: _locked, id: _id, ...restMeta } = entry.meta;
|
|
3541
3541
|
return {
|
|
3542
3542
|
...restMeta,
|
|
3543
|
-
type:
|
|
3544
|
-
assetId:
|
|
3545
|
-
serverId:
|
|
3543
|
+
type: entry.metaType,
|
|
3544
|
+
assetId: entry.assetId,
|
|
3545
|
+
serverId: entry.serverId
|
|
3546
3546
|
};
|
|
3547
3547
|
}
|
|
3548
3548
|
function metaFilePath(contentPath) {
|
|
@@ -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);
|
|
@@ -4294,9 +4294,9 @@ async function resetNodeManagedProjectPaths(dirPath) {
|
|
|
4294
4294
|
)
|
|
4295
4295
|
);
|
|
4296
4296
|
}
|
|
4297
|
-
async function assertDirectoryEmpty(
|
|
4297
|
+
async function assertDirectoryEmpty(fs6, dirPath) {
|
|
4298
4298
|
try {
|
|
4299
|
-
const entries = await
|
|
4299
|
+
const entries = await fs6.readdir(dirPath);
|
|
4300
4300
|
if (entries.length > 0) {
|
|
4301
4301
|
throw new Error(`Output directory is not empty: ${dirPath}. Use --force to continue.`);
|
|
4302
4302
|
}
|
|
@@ -4304,8 +4304,8 @@ async function assertDirectoryEmpty(fs5, dirPath) {
|
|
|
4304
4304
|
if (!isMissingPathError(err)) throw err;
|
|
4305
4305
|
}
|
|
4306
4306
|
}
|
|
4307
|
-
async function resetManagedProjectPaths(
|
|
4308
|
-
await Promise.all(MANAGED_PROJECT_PATHS.map((managedPath) =>
|
|
4307
|
+
async function resetManagedProjectPaths(fs6, dirPath) {
|
|
4308
|
+
await Promise.all(MANAGED_PROJECT_PATHS.map((managedPath) => fs6.remove(import_node_path3.default.join(dirPath, managedPath))));
|
|
4309
4309
|
}
|
|
4310
4310
|
async function readProjectConfig(projectDir) {
|
|
4311
4311
|
return readJsonFile(import_node_path3.default.resolve(projectDir, "project.galacean"), "project config");
|
|
@@ -4319,9 +4319,9 @@ async function readNodeRemoteConfig(projectDir) {
|
|
|
4319
4319
|
}
|
|
4320
4320
|
return { projectId, serverUrl: typeof serverUrl === "string" ? serverUrl : "" };
|
|
4321
4321
|
}
|
|
4322
|
-
async function readRemoteConfig(
|
|
4322
|
+
async function readRemoteConfig(fs6, projectDir) {
|
|
4323
4323
|
const remotePath = import_node_path3.default.resolve(projectDir, ".galacean/remote.json");
|
|
4324
|
-
const raw = decodeUtf8(await
|
|
4324
|
+
const raw = decodeUtf8(await fs6.readFile(remotePath));
|
|
4325
4325
|
const parsed = safeParseJsonObject(raw);
|
|
4326
4326
|
const projectId = parsed.projectId;
|
|
4327
4327
|
const serverUrl = parsed.serverUrl;
|
|
@@ -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
|
});
|
|
@@ -4403,21 +4365,21 @@ var init_path_utils = __esm({
|
|
|
4403
4365
|
});
|
|
4404
4366
|
|
|
4405
4367
|
// ../storage/src/fs.ts
|
|
4406
|
-
async function atomicWriteFile(
|
|
4407
|
-
if (
|
|
4368
|
+
async function atomicWriteFile(fs6, filePath, content) {
|
|
4369
|
+
if (fs6.rename) {
|
|
4408
4370
|
const tmp = filePath + ".tmp";
|
|
4409
|
-
await
|
|
4371
|
+
await fs6.writeFile(tmp, content);
|
|
4410
4372
|
try {
|
|
4411
|
-
await
|
|
4373
|
+
await fs6.rename(tmp, filePath);
|
|
4412
4374
|
} catch (err) {
|
|
4413
4375
|
try {
|
|
4414
|
-
await
|
|
4376
|
+
await fs6.remove(tmp);
|
|
4415
4377
|
} catch {
|
|
4416
4378
|
}
|
|
4417
4379
|
throw err;
|
|
4418
4380
|
}
|
|
4419
4381
|
} else {
|
|
4420
|
-
await
|
|
4382
|
+
await fs6.writeFile(filePath, content);
|
|
4421
4383
|
}
|
|
4422
4384
|
}
|
|
4423
4385
|
var init_fs = __esm({
|
|
@@ -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();
|
|
@@ -43063,10 +43007,10 @@ void main () {
|
|
|
43063
43007
|
}
|
|
43064
43008
|
};
|
|
43065
43009
|
_proto._emitByBurst = function _emitByBurst(lastPlayTime, playTime) {
|
|
43066
|
-
var
|
|
43067
|
-
var duration3 =
|
|
43010
|
+
var main = this._generator.main;
|
|
43011
|
+
var duration3 = main.duration;
|
|
43068
43012
|
var cycleCount = Math.floor((playTime - lastPlayTime) / duration3);
|
|
43069
|
-
if (
|
|
43013
|
+
if (main.isLoop && (cycleCount > 0 || playTime % duration3 < lastPlayTime % duration3)) {
|
|
43070
43014
|
var middleTime = Math.ceil(lastPlayTime / duration3) * duration3;
|
|
43071
43015
|
this._emitBySubBurst(lastPlayTime, middleTime, duration3);
|
|
43072
43016
|
this._currentBurstIndex = 0;
|
|
@@ -44476,16 +44420,16 @@ void main () {
|
|
|
44476
44420
|
_proto._emit = function _emit(playTime, count) {
|
|
44477
44421
|
var emission = this.emission;
|
|
44478
44422
|
if (emission.enabled) {
|
|
44479
|
-
var
|
|
44423
|
+
var main = this.main;
|
|
44480
44424
|
var notRetireParticleCount = this._getNotRetiredParticleCount();
|
|
44481
|
-
if (notRetireParticleCount >=
|
|
44425
|
+
if (notRetireParticleCount >= main.maxParticles) {
|
|
44482
44426
|
return;
|
|
44483
44427
|
}
|
|
44484
44428
|
var position = ParticleGenerator2._tempVector30;
|
|
44485
44429
|
var direction = ParticleGenerator2._tempVector31;
|
|
44486
44430
|
var transform2 = this._renderer.entity.transform;
|
|
44487
44431
|
var shape = emission.shape;
|
|
44488
|
-
var positionScale =
|
|
44432
|
+
var positionScale = main._getPositionScale();
|
|
44489
44433
|
for (var i = 0; i < count; i++) {
|
|
44490
44434
|
if (shape == null ? void 0 : shape.enabled) {
|
|
44491
44435
|
shape._generatePositionAndDirection(emission._shapeRand, playTime, position, direction);
|
|
@@ -44494,7 +44438,7 @@ void main () {
|
|
|
44494
44438
|
} else {
|
|
44495
44439
|
position.set(0, 0, 0);
|
|
44496
44440
|
direction.set(0, 0, -1);
|
|
44497
|
-
if (
|
|
44441
|
+
if (main.simulationSpace === ParticleSimulationSpace.Local) {
|
|
44498
44442
|
direction.multiply(positionScale);
|
|
44499
44443
|
}
|
|
44500
44444
|
}
|
|
@@ -44504,10 +44448,10 @@ void main () {
|
|
|
44504
44448
|
};
|
|
44505
44449
|
_proto._update = function _update(elapsedTime) {
|
|
44506
44450
|
var lastAlive = this.isAlive;
|
|
44507
|
-
var _this = this,
|
|
44508
|
-
var duration3 =
|
|
44451
|
+
var _this = this, main = _this.main, emission = _this.emission;
|
|
44452
|
+
var duration3 = main.duration;
|
|
44509
44453
|
var lastPlayTime = this._playTime;
|
|
44510
|
-
var deltaTime = elapsedTime *
|
|
44454
|
+
var deltaTime = elapsedTime * main.simulationSpeed;
|
|
44511
44455
|
if (this._playStartDelay > 0) {
|
|
44512
44456
|
var remainingDelay = this._playStartDelay -= deltaTime;
|
|
44513
44457
|
if (remainingDelay < 0) {
|
|
@@ -44520,23 +44464,23 @@ void main () {
|
|
|
44520
44464
|
this._playTime += deltaTime;
|
|
44521
44465
|
this._retireActiveParticles();
|
|
44522
44466
|
this._freeRetiredParticles();
|
|
44523
|
-
if (
|
|
44467
|
+
if (main.simulationSpace === ParticleSimulationSpace.World) {
|
|
44524
44468
|
this._retireTransformedBounds();
|
|
44525
44469
|
}
|
|
44526
44470
|
if (emission.enabled && this._isPlaying) {
|
|
44527
|
-
if (this._currentParticleCount >
|
|
44471
|
+
if (this._currentParticleCount > main._maxParticleBuffer) {
|
|
44528
44472
|
var notRetireParticleCount = this._getNotRetiredParticleCount();
|
|
44529
|
-
if (notRetireParticleCount <
|
|
44473
|
+
if (notRetireParticleCount < main._maxParticleBuffer) {
|
|
44530
44474
|
this._resizeInstanceBuffer(false);
|
|
44531
44475
|
}
|
|
44532
44476
|
}
|
|
44533
44477
|
emission._emit(lastPlayTime, this._playTime);
|
|
44534
|
-
if (!
|
|
44478
|
+
if (!main.isLoop && this._playTime > duration3) {
|
|
44535
44479
|
this._isPlaying = false;
|
|
44536
44480
|
}
|
|
44537
44481
|
}
|
|
44538
44482
|
if (this.isAlive) {
|
|
44539
|
-
if (
|
|
44483
|
+
if (main.simulationSpace === ParticleSimulationSpace.World) {
|
|
44540
44484
|
this._generateTransformedBounds();
|
|
44541
44485
|
}
|
|
44542
44486
|
} else {
|
|
@@ -44786,9 +44730,9 @@ void main () {
|
|
|
44786
44730
|
if (nextFreeElement >= this._currentParticleCount) {
|
|
44787
44731
|
nextFreeElement = 0;
|
|
44788
44732
|
}
|
|
44789
|
-
var
|
|
44733
|
+
var main = this.main;
|
|
44790
44734
|
if (nextFreeElement === this._firstRetiredElement) {
|
|
44791
|
-
var increaseCount = Math.min(ParticleGenerator2._particleIncreaseCount,
|
|
44735
|
+
var increaseCount = Math.min(ParticleGenerator2._particleIncreaseCount, main._maxParticleBuffer - this._currentParticleCount);
|
|
44792
44736
|
if (increaseCount === 0) {
|
|
44793
44737
|
return;
|
|
44794
44738
|
}
|
|
@@ -44796,42 +44740,42 @@ void main () {
|
|
|
44796
44740
|
nextFreeElement = firstFreeElement + 1;
|
|
44797
44741
|
}
|
|
44798
44742
|
var pos, rot;
|
|
44799
|
-
if (
|
|
44743
|
+
if (main.simulationSpace === ParticleSimulationSpace.World) {
|
|
44800
44744
|
pos = transform2.worldPosition;
|
|
44801
44745
|
rot = transform2.worldRotationQuaternion;
|
|
44802
44746
|
}
|
|
44803
|
-
var startSpeed =
|
|
44747
|
+
var startSpeed = main.startSpeed.evaluate(void 0, main._startSpeedRand.random());
|
|
44804
44748
|
var instanceVertices = this._instanceVertices;
|
|
44805
44749
|
var offset = firstFreeElement * ParticleBufferUtils.instanceVertexFloatStride;
|
|
44806
44750
|
position.copyToArray(instanceVertices, offset);
|
|
44807
|
-
instanceVertices[offset + ParticleBufferUtils.startLifeTimeOffset] =
|
|
44751
|
+
instanceVertices[offset + ParticleBufferUtils.startLifeTimeOffset] = main.startLifetime.evaluate(void 0, main._startLifeTimeRand.random());
|
|
44808
44752
|
direction.copyToArray(instanceVertices, offset + 4);
|
|
44809
44753
|
instanceVertices[offset + ParticleBufferUtils.timeOffset] = playTime;
|
|
44810
44754
|
var startColor = ParticleGenerator2._tempColor0;
|
|
44811
|
-
|
|
44755
|
+
main.startColor.evaluate(void 0, main._startColorRand.random(), startColor);
|
|
44812
44756
|
startColor.copyToArray(instanceVertices, offset + 8);
|
|
44813
44757
|
var duration3 = this.main.duration;
|
|
44814
44758
|
var normalizedEmitAge = playTime % duration3 / duration3;
|
|
44815
|
-
var startSizeRand =
|
|
44816
|
-
if (
|
|
44817
|
-
instanceVertices[offset + 12] =
|
|
44818
|
-
instanceVertices[offset + 13] =
|
|
44819
|
-
instanceVertices[offset + 14] =
|
|
44759
|
+
var startSizeRand = main._startSizeRand;
|
|
44760
|
+
if (main.startSize3D) {
|
|
44761
|
+
instanceVertices[offset + 12] = main.startSizeX.evaluate(normalizedEmitAge, startSizeRand.random());
|
|
44762
|
+
instanceVertices[offset + 13] = main.startSizeY.evaluate(normalizedEmitAge, startSizeRand.random());
|
|
44763
|
+
instanceVertices[offset + 14] = main.startSizeZ.evaluate(normalizedEmitAge, startSizeRand.random());
|
|
44820
44764
|
} else {
|
|
44821
|
-
var size =
|
|
44765
|
+
var size = main.startSize.evaluate(normalizedEmitAge, startSizeRand.random());
|
|
44822
44766
|
instanceVertices[offset + 12] = size;
|
|
44823
44767
|
instanceVertices[offset + 13] = size;
|
|
44824
44768
|
instanceVertices[offset + 14] = size;
|
|
44825
44769
|
}
|
|
44826
|
-
var startRotationRand =
|
|
44770
|
+
var startRotationRand = main._startRotationRand, flipRotation = main.flipRotation;
|
|
44827
44771
|
var isFlip = flipRotation > startRotationRand.random();
|
|
44828
44772
|
if (this._renderer.renderMode !== ParticleRenderMode.Mesh) {
|
|
44829
44773
|
isFlip = !isFlip;
|
|
44830
44774
|
}
|
|
44831
|
-
var rotationZ =
|
|
44832
|
-
if (
|
|
44833
|
-
var rotationX =
|
|
44834
|
-
var rotationY =
|
|
44775
|
+
var rotationZ = main.startRotationZ.evaluate(void 0, startRotationRand.random());
|
|
44776
|
+
if (main.startRotation3D) {
|
|
44777
|
+
var rotationX = main.startRotationX.evaluate(void 0, startRotationRand.random());
|
|
44778
|
+
var rotationY = main.startRotationY.evaluate(void 0, startRotationRand.random());
|
|
44835
44779
|
instanceVertices[offset + 15] = isFlip ? -rotationX : rotationX;
|
|
44836
44780
|
instanceVertices[offset + 16] = isFlip ? -rotationY : rotationY;
|
|
44837
44781
|
instanceVertices[offset + 17] = isFlip ? -rotationZ : rotationZ;
|
|
@@ -44839,12 +44783,12 @@ void main () {
|
|
|
44839
44783
|
instanceVertices[offset + 15] = isFlip ? -rotationZ : rotationZ;
|
|
44840
44784
|
}
|
|
44841
44785
|
instanceVertices[offset + 18] = startSpeed;
|
|
44842
|
-
switch (
|
|
44786
|
+
switch (main.gravityModifier.mode) {
|
|
44843
44787
|
case ParticleCurveMode.Constant:
|
|
44844
|
-
instanceVertices[offset + 19] =
|
|
44788
|
+
instanceVertices[offset + 19] = main.gravityModifier.constant;
|
|
44845
44789
|
break;
|
|
44846
44790
|
case ParticleCurveMode.TwoConstants:
|
|
44847
|
-
instanceVertices[offset + 19] =
|
|
44791
|
+
instanceVertices[offset + 19] = main.gravityModifier.evaluate(void 0, main._gravityModifierRand.random());
|
|
44848
44792
|
break;
|
|
44849
44793
|
}
|
|
44850
44794
|
var colorOverLifetime = this.colorOverLifetime;
|
|
@@ -45000,7 +44944,7 @@ void main () {
|
|
|
45000
44944
|
_proto._calculateGeneratorBounds = function _calculateGeneratorBounds(maxLifetime, bounds) {
|
|
45001
44945
|
var directionMax = ParticleGenerator2._tempVector30, directionMin = ParticleGenerator2._tempVector31, speedMinMax = ParticleGenerator2._tempVector20;
|
|
45002
44946
|
var min = bounds.min, max = bounds.max;
|
|
45003
|
-
var
|
|
44947
|
+
var main = this.main;
|
|
45004
44948
|
var shape = this.emission.shape;
|
|
45005
44949
|
if (shape == null ? void 0 : shape.enabled) {
|
|
45006
44950
|
shape._getPositionRange(min, max);
|
|
@@ -45011,19 +44955,19 @@ void main () {
|
|
|
45011
44955
|
directionMin.set(0, 0, -1);
|
|
45012
44956
|
directionMax.set(0, 0, 0);
|
|
45013
44957
|
}
|
|
45014
|
-
this._getExtremeValueFromZero(
|
|
44958
|
+
this._getExtremeValueFromZero(main.startSpeed, speedMinMax);
|
|
45015
44959
|
var speedMin = speedMinMax.x, speedMax = speedMinMax.y;
|
|
45016
44960
|
var dirMinX = directionMin.x, dirMinY = directionMin.y, dirMinZ = directionMin.z;
|
|
45017
44961
|
var dirMaxX = directionMax.x, dirMaxY = directionMax.y, dirMaxZ = directionMax.z;
|
|
45018
44962
|
min.set(min.x + Math.min(dirMinX * speedMax, dirMaxX * speedMin) * maxLifetime, min.y + Math.min(dirMinY * speedMax, dirMaxY * speedMin) * maxLifetime, min.z + Math.min(dirMinZ * speedMax, dirMaxZ * speedMin) * maxLifetime);
|
|
45019
44963
|
max.set(max.x + Math.max(dirMinX * speedMin, dirMaxX * speedMax) * maxLifetime, max.y + Math.max(dirMinY * speedMin, dirMaxY * speedMax) * maxLifetime, max.z + Math.max(dirMinZ * speedMin, dirMaxZ * speedMax) * maxLifetime);
|
|
45020
|
-
var maxSize =
|
|
45021
|
-
if (
|
|
45022
|
-
var startSizeYMax =
|
|
44964
|
+
var maxSize = main.startSize._getMax();
|
|
44965
|
+
if (main.startSize3D) {
|
|
44966
|
+
var startSizeYMax = main.startSizeY._getMax();
|
|
45023
44967
|
if (this._renderer.renderMode === ParticleRenderMode.Billboard || ParticleRenderMode.StretchBillboard || ParticleRenderMode.HorizontalBillboard) {
|
|
45024
44968
|
maxSize = Math.max(maxSize, startSizeYMax);
|
|
45025
44969
|
} else {
|
|
45026
|
-
var startSizeZMax =
|
|
44970
|
+
var startSizeZMax = main.startSizeZ._getMax();
|
|
45027
44971
|
maxSize = Math.max(maxSize, startSizeYMax, startSizeZMax);
|
|
45028
44972
|
}
|
|
45029
44973
|
}
|
|
@@ -53009,13 +52953,13 @@ var require_main4 = __commonJS({
|
|
|
53009
52953
|
});
|
|
53010
52954
|
};
|
|
53011
52955
|
_proto._getBufferData = function _getBufferData(buffers, restoreInfo) {
|
|
53012
|
-
var
|
|
52956
|
+
var main = restoreInfo.main;
|
|
53013
52957
|
var data;
|
|
53014
|
-
if (
|
|
53015
|
-
var buffer2 = buffers[
|
|
53016
|
-
data = new
|
|
52958
|
+
if (main) {
|
|
52959
|
+
var buffer2 = buffers[main.bufferIndex];
|
|
52960
|
+
data = new main.TypedArray(buffer2, main.byteOffset, main.length);
|
|
53017
52961
|
} else {
|
|
53018
|
-
data = new
|
|
52962
|
+
data = new main.TypedArray(main.length);
|
|
53019
52963
|
}
|
|
53020
52964
|
var sparseCount = restoreInfo.sparseCount;
|
|
53021
52965
|
if (sparseCount) {
|
|
@@ -53054,8 +52998,8 @@ var require_main4 = __commonJS({
|
|
|
53054
52998
|
this.buffer = buffer2;
|
|
53055
52999
|
this.data = data;
|
|
53056
53000
|
};
|
|
53057
|
-
var BufferDataRestoreInfo = function BufferDataRestoreInfo2(
|
|
53058
|
-
this.main =
|
|
53001
|
+
var BufferDataRestoreInfo = function BufferDataRestoreInfo2(main, typeSize, sparseCount, sparseIndices, sparseValues) {
|
|
53002
|
+
this.main = main;
|
|
53059
53003
|
this.typeSize = typeSize;
|
|
53060
53004
|
this.sparseCount = sparseCount;
|
|
53061
53005
|
this.sparseIndices = sparseIndices;
|
|
@@ -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
|
},
|
|
@@ -84845,15 +84795,15 @@ var require_mobx_cjs_development = __commonJS({
|
|
|
84845
84795
|
if (!globalState.trackingDerivation) {
|
|
84846
84796
|
return this.has_(key);
|
|
84847
84797
|
}
|
|
84848
|
-
var
|
|
84849
|
-
if (!
|
|
84850
|
-
var newEntry =
|
|
84798
|
+
var entry = this.hasMap_.get(key);
|
|
84799
|
+
if (!entry) {
|
|
84800
|
+
var newEntry = entry = new ObservableValue(this.has_(key), referenceEnhancer, this.name_ + "." + stringifyKey(key) + "?", false);
|
|
84851
84801
|
this.hasMap_.set(key, newEntry);
|
|
84852
84802
|
onBecomeUnobserved(newEntry, function() {
|
|
84853
84803
|
return _this2.hasMap_["delete"](key);
|
|
84854
84804
|
});
|
|
84855
84805
|
}
|
|
84856
|
-
return
|
|
84806
|
+
return entry.get();
|
|
84857
84807
|
};
|
|
84858
84808
|
_proto.set = function set3(key, value) {
|
|
84859
84809
|
var hasKey = this.has_(key);
|
|
@@ -85549,12 +85499,12 @@ var require_mobx_cjs_development = __commonJS({
|
|
|
85549
85499
|
return key in this.target_;
|
|
85550
85500
|
}
|
|
85551
85501
|
this.pendingKeys_ || (this.pendingKeys_ = /* @__PURE__ */ new Map());
|
|
85552
|
-
var
|
|
85553
|
-
if (!
|
|
85554
|
-
|
|
85555
|
-
this.pendingKeys_.set(key,
|
|
85502
|
+
var entry = this.pendingKeys_.get(key);
|
|
85503
|
+
if (!entry) {
|
|
85504
|
+
entry = new ObservableValue(key in this.target_, referenceEnhancer, this.name_ + "." + stringifyKey(key) + "?", false);
|
|
85505
|
+
this.pendingKeys_.set(key, entry);
|
|
85556
85506
|
}
|
|
85557
|
-
return
|
|
85507
|
+
return entry.get();
|
|
85558
85508
|
};
|
|
85559
85509
|
_proto.make_ = function make_2(key, annotation) {
|
|
85560
85510
|
if (annotation === true) {
|
|
@@ -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);
|
|
@@ -88642,20 +88592,20 @@ var init_VanillaPackage = __esm({
|
|
|
88642
88592
|
}, "");
|
|
88643
88593
|
this._eta.configure({ functionHeader });
|
|
88644
88594
|
const eta = this._eta;
|
|
88645
|
-
const
|
|
88646
|
-
const
|
|
88595
|
+
const entry = eta.renderString(templates.entry, params);
|
|
88596
|
+
const html = eta.renderString(templates.html, params);
|
|
88647
88597
|
const mainEntry = eta.renderString(templates.main, params);
|
|
88648
|
-
const
|
|
88649
|
-
const
|
|
88650
|
-
const
|
|
88598
|
+
const scriptEntry = eta.renderString(templates.scriptEntry, params);
|
|
88599
|
+
const packageJson = eta.renderString(templates.packageJson, params);
|
|
88600
|
+
const viteConfig = eta.renderString(templates.viteConfig, params);
|
|
88651
88601
|
const vfs = this._vfs;
|
|
88652
|
-
vfs.getFileByPath("/src/index.ts").content =
|
|
88653
|
-
vfs.getFileByPath("/src/scripts/index.ts").content =
|
|
88654
|
-
vfs.getFileByPath("/package.json").content = JSON.stringify(JSON.parse(
|
|
88655
|
-
vfs.getFileByPath("/index.html").content =
|
|
88602
|
+
vfs.getFileByPath("/src/index.ts").content = entry;
|
|
88603
|
+
vfs.getFileByPath("/src/scripts/index.ts").content = scriptEntry;
|
|
88604
|
+
vfs.getFileByPath("/package.json").content = JSON.stringify(JSON.parse(packageJson), null, 2);
|
|
88605
|
+
vfs.getFileByPath("/index.html").content = html;
|
|
88656
88606
|
vfs.getFileByPath("/main.js").content = mainEntry;
|
|
88657
88607
|
vfs.getFileByPath("/tsconfig.json").content = templates.tsconfig;
|
|
88658
|
-
vfs.getFileByPath("/vite.config.ts").content =
|
|
88608
|
+
vfs.getFileByPath("/vite.config.ts").content = viteConfig;
|
|
88659
88609
|
}
|
|
88660
88610
|
/**
|
|
88661
88611
|
* 写入文件到虚拟文件系统
|
|
@@ -88691,21 +88641,44 @@ function cliUploadFactory() {
|
|
|
88691
88641
|
upload.download = true;
|
|
88692
88642
|
return upload;
|
|
88693
88643
|
}
|
|
88694
|
-
var
|
|
88644
|
+
var import_promises8, import_node_path12, import_node_module, import_meta, require2, builderPkgPath, templateDir, CLIVanillaPackage;
|
|
88695
88645
|
var init_cli_vanilla_package = __esm({
|
|
88696
88646
|
"src/cli-vanilla-package.ts"() {
|
|
88697
88647
|
"use strict";
|
|
88648
|
+
import_promises8 = __toESM(require("node:fs/promises"));
|
|
88649
|
+
import_node_path12 = __toESM(require("node:path"));
|
|
88650
|
+
import_node_module = require("node:module");
|
|
88698
88651
|
init_VanillaPackage();
|
|
88699
|
-
|
|
88700
|
-
|
|
88701
|
-
|
|
88702
|
-
|
|
88703
|
-
import_main_js = __toESM(require_main_js());
|
|
88704
|
-
import_tsconfig_json = __toESM(require_tsconfig_json());
|
|
88705
|
-
import_vite_config_ts = __toESM(require_vite_config_ts());
|
|
88652
|
+
import_meta = {};
|
|
88653
|
+
require2 = (0, import_node_module.createRequire)(typeof __filename !== "undefined" ? __filename : import_meta.url);
|
|
88654
|
+
builderPkgPath = require2.resolve("@editor/builder/package.json");
|
|
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([
|
|
88673
|
+
import_promises8.default.readFile(import_node_path12.default.join(templateDir, "src/index.ts.ejs"), "utf-8"),
|
|
88674
|
+
import_promises8.default.readFile(import_node_path12.default.join(templateDir, "src/scripts/index.ts.ejs"), "utf-8"),
|
|
88675
|
+
import_promises8.default.readFile(import_node_path12.default.join(templateDir, "package.json.ejs"), "utf-8"),
|
|
88676
|
+
import_promises8.default.readFile(import_node_path12.default.join(templateDir, "index.html.ejs"), "utf-8"),
|
|
88677
|
+
import_promises8.default.readFile(import_node_path12.default.join(templateDir, "main.js.ejs"), "utf-8"),
|
|
88678
|
+
import_promises8.default.readFile(import_node_path12.default.join(templateDir, "tsconfig.json.ejs"), "utf-8"),
|
|
88679
|
+
import_promises8.default.readFile(import_node_path12.default.join(templateDir, "vite.config.ts.ejs"), "utf-8")
|
|
88680
|
+
]);
|
|
88681
|
+
return { entry, scriptEntry, packageJson, html, main, tsconfig, viteConfig };
|
|
88709
88682
|
}
|
|
88710
88683
|
async _writeFiles(project, cacheMap, download = false) {
|
|
88711
88684
|
const needWrittenLocally = download && !this._buildOptions.assetOptions.uploadCDN;
|
|
@@ -89255,16 +89228,16 @@ var init_ktx_parse_modern = __esm({
|
|
|
89255
89228
|
|
|
89256
89229
|
// src/cli-ktx2-encoder.ts
|
|
89257
89230
|
function sha256Hex(data) {
|
|
89258
|
-
return (0,
|
|
89231
|
+
return (0, import_node_crypto3.createHash)("sha256").update(data).digest("hex");
|
|
89259
89232
|
}
|
|
89260
89233
|
function toArrayBuffer(buffer2) {
|
|
89261
89234
|
return buffer2.buffer.slice(buffer2.byteOffset, buffer2.byteOffset + buffer2.byteLength);
|
|
89262
89235
|
}
|
|
89263
89236
|
function resolveBundledAssetPath(filename) {
|
|
89264
89237
|
const candidates = [
|
|
89265
|
-
(0,
|
|
89238
|
+
(0, import_node_path13.join)(__dirname, "../assets", filename),
|
|
89266
89239
|
// dev: running from src/, assets at package root
|
|
89267
|
-
(0,
|
|
89240
|
+
(0, import_node_path13.join)(__dirname, "assets", filename)
|
|
89268
89241
|
// prod: running from dist/, assets copied by build.mjs
|
|
89269
89242
|
];
|
|
89270
89243
|
for (const candidate of candidates) {
|
|
@@ -89287,14 +89260,11 @@ async function loadBundledBasisAssets() {
|
|
|
89287
89260
|
bundledBasisAssetsPromise = (async () => {
|
|
89288
89261
|
const jsPath = resolveBundledAssetPath(BASIS_JS_FILENAME);
|
|
89289
89262
|
const wasmPath = resolveBundledAssetPath(BASIS_WASM_FILENAME);
|
|
89290
|
-
const [jsBuffer, wasmBuffer] = await Promise.all([(0,
|
|
89263
|
+
const [jsBuffer, wasmBuffer] = await Promise.all([(0, import_promises9.readFile)(jsPath), (0, import_promises9.readFile)(wasmPath)]);
|
|
89291
89264
|
assertChecksum(BASIS_JS_FILENAME, jsBuffer, BASIS_JS_SHA256);
|
|
89292
89265
|
assertChecksum(BASIS_WASM_FILENAME, wasmBuffer, BASIS_WASM_SHA256);
|
|
89293
89266
|
return { workerCode: buildWorkerCode(jsBuffer.toString("utf-8")), wasmBinary: toArrayBuffer(wasmBuffer) };
|
|
89294
|
-
})()
|
|
89295
|
-
bundledBasisAssetsPromise = null;
|
|
89296
|
-
throw err;
|
|
89297
|
-
});
|
|
89267
|
+
})();
|
|
89298
89268
|
}
|
|
89299
89269
|
return bundledBasisAssetsPromise;
|
|
89300
89270
|
}
|
|
@@ -89355,15 +89325,15 @@ parentPort.on("message", async (msg) => {
|
|
|
89355
89325
|
});
|
|
89356
89326
|
`;
|
|
89357
89327
|
}
|
|
89358
|
-
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;
|
|
89359
89329
|
var init_cli_ktx2_encoder = __esm({
|
|
89360
89330
|
"src/cli-ktx2-encoder.ts"() {
|
|
89361
89331
|
"use strict";
|
|
89362
89332
|
import_node_worker_threads = require("node:worker_threads");
|
|
89363
|
-
|
|
89364
|
-
|
|
89333
|
+
import_node_crypto3 = require("node:crypto");
|
|
89334
|
+
import_promises9 = require("node:fs/promises");
|
|
89365
89335
|
import_node_fs = require("node:fs");
|
|
89366
|
-
|
|
89336
|
+
import_node_path13 = require("node:path");
|
|
89367
89337
|
init_ktx_parse_modern();
|
|
89368
89338
|
BASIS_JS_FILENAME = "basis_encoder.js";
|
|
89369
89339
|
BASIS_WASM_FILENAME = "basis_encoder.wasm";
|
|
@@ -89371,25 +89341,10 @@ var init_cli_ktx2_encoder = __esm({
|
|
|
89371
89341
|
BASIS_WASM_SHA256 = "62ce0364ea8f4969e1e4277ce275213dcce5b234c8c96586da06e3879010341c";
|
|
89372
89342
|
bundledBasisAssetsPromise = null;
|
|
89373
89343
|
CLIKtx2Encoder = class {
|
|
89374
|
-
|
|
89375
|
-
|
|
89376
|
-
|
|
89377
|
-
|
|
89378
|
-
let data;
|
|
89379
|
-
let width;
|
|
89380
|
-
let height;
|
|
89381
|
-
if (rawInfo) {
|
|
89382
|
-
data = buffer2 instanceof ArrayBuffer ? new Uint8Array(buffer2) : new Uint8Array(buffer2);
|
|
89383
|
-
width = rawInfo.width;
|
|
89384
|
-
height = rawInfo.height;
|
|
89385
|
-
} else {
|
|
89386
|
-
const sharp = (await import("sharp")).default;
|
|
89387
|
-
const input = buffer2 instanceof ArrayBuffer ? Buffer.from(buffer2) : buffer2;
|
|
89388
|
-
const decoded = await sharp(input).raw().ensureAlpha().toBuffer({ resolveWithObject: true });
|
|
89389
|
-
data = decoded.data;
|
|
89390
|
-
width = decoded.info.width;
|
|
89391
|
-
height = decoded.info.height;
|
|
89392
|
-
}
|
|
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 });
|
|
89393
89348
|
const { workerCode, wasmBinary } = await loadBundledBasisAssets();
|
|
89394
89349
|
const wasmCopy = wasmBinary.slice(0);
|
|
89395
89350
|
return new Promise((resolve4, reject) => {
|
|
@@ -89418,14 +89373,12 @@ var init_cli_ktx2_encoder = __esm({
|
|
|
89418
89373
|
});
|
|
89419
89374
|
const rgbaBuffer = new ArrayBuffer(data.byteLength);
|
|
89420
89375
|
new Uint8Array(rgbaBuffer).set(data);
|
|
89421
|
-
worker.postMessage(
|
|
89422
|
-
rgbaBuffer,
|
|
89423
|
-
wasmCopy
|
|
89424
|
-
|
|
89376
|
+
worker.postMessage(
|
|
89377
|
+
{ rgbaData: new Uint8Array(rgbaBuffer), width: info.width, height: info.height, options, wasmBinary: wasmCopy },
|
|
89378
|
+
[rgbaBuffer, wasmCopy]
|
|
89379
|
+
);
|
|
89425
89380
|
});
|
|
89426
89381
|
}
|
|
89427
|
-
// 与 plugins/main/src/assets/texture/ktx2-encoder.ts:setTextureParams 逻辑一致。
|
|
89428
|
-
// 统一入口待 @galacean/tools-ktx2-encoder(submodule)导出后迁移。
|
|
89429
89382
|
setTextureParams(buffer2, params) {
|
|
89430
89383
|
const container = read(buffer2);
|
|
89431
89384
|
container.keyValue["GalaceanTextureParams"] = new Uint8Array([
|
|
@@ -89566,16 +89519,19 @@ function dilateColorNode(data, width, height, options) {
|
|
|
89566
89519
|
}
|
|
89567
89520
|
return result;
|
|
89568
89521
|
}
|
|
89569
|
-
async function
|
|
89522
|
+
async function dilateColorBuffer(imageBuffer, options) {
|
|
89570
89523
|
const sharp = (await import("sharp")).default;
|
|
89571
|
-
const
|
|
89524
|
+
const image = sharp(imageBuffer);
|
|
89525
|
+
const { data, info } = await image.ensureAlpha().raw().toBuffer({ resolveWithObject: true });
|
|
89572
89526
|
const processed = dilateColorNode(
|
|
89573
89527
|
new Uint8Array(data.buffer, data.byteOffset, data.byteLength),
|
|
89574
89528
|
info.width,
|
|
89575
89529
|
info.height,
|
|
89576
89530
|
options
|
|
89577
89531
|
);
|
|
89578
|
-
return
|
|
89532
|
+
return sharp(Buffer.from(processed), {
|
|
89533
|
+
raw: { width: info.width, height: info.height, channels: 4 }
|
|
89534
|
+
}).png().toBuffer();
|
|
89579
89535
|
}
|
|
89580
89536
|
var init_cli_color_dilate = __esm({
|
|
89581
89537
|
"src/cli-color-dilate.ts"() {
|
|
@@ -89589,11 +89545,11 @@ function createManifestEntryIndex(entries, options = {}) {
|
|
|
89589
89545
|
const localPathRegistry = createLocalPathRegistry();
|
|
89590
89546
|
const pathToId = /* @__PURE__ */ new Map();
|
|
89591
89547
|
const folderIdByPath = /* @__PURE__ */ new Map();
|
|
89592
|
-
for (const [assetId,
|
|
89593
|
-
const canonicalPath = assertCanonicalAssetPath(
|
|
89548
|
+
for (const [assetId, entry] of Object.entries(entries)) {
|
|
89549
|
+
const canonicalPath = assertCanonicalAssetPath(entry.path, `Manifest entry '${assetId}' path`);
|
|
89594
89550
|
registerLocalPathOrThrow(localPathRegistry, assetId, canonicalPath, caseFold);
|
|
89595
89551
|
pathToId.set(canonicalPath, assetId);
|
|
89596
|
-
if (
|
|
89552
|
+
if (entry.type === "Folder") {
|
|
89597
89553
|
folderIdByPath.set(canonicalPath, assetId);
|
|
89598
89554
|
}
|
|
89599
89555
|
}
|
|
@@ -89720,8 +89676,8 @@ var init_sync_adapter = __esm({
|
|
|
89720
89676
|
function extractMaterialProps(matData) {
|
|
89721
89677
|
const props = {};
|
|
89722
89678
|
if (matData.shaderData && typeof matData.shaderData === "object") {
|
|
89723
|
-
for (const [key,
|
|
89724
|
-
props[key] =
|
|
89679
|
+
for (const [key, entry] of Object.entries(matData.shaderData)) {
|
|
89680
|
+
props[key] = entry.value !== void 0 ? entry.value : entry;
|
|
89725
89681
|
}
|
|
89726
89682
|
} else {
|
|
89727
89683
|
for (const [key, value] of Object.entries(matData)) {
|
|
@@ -89938,11 +89894,11 @@ function buildMaterialMainData(name, props, original) {
|
|
|
89938
89894
|
const shaderData = Object.fromEntries(shaderDataEntries);
|
|
89939
89895
|
if (original) {
|
|
89940
89896
|
const originalShaderData = original.shaderData ?? {};
|
|
89941
|
-
for (const [key,
|
|
89897
|
+
for (const [key, entry] of Object.entries(shaderData)) {
|
|
89942
89898
|
const orig = originalShaderData[key];
|
|
89943
89899
|
if (orig && typeof orig === "object" && typeof orig.type === "string") {
|
|
89944
89900
|
;
|
|
89945
|
-
|
|
89901
|
+
entry.type = orig.type;
|
|
89946
89902
|
}
|
|
89947
89903
|
}
|
|
89948
89904
|
const preservedOriginalEntries = Object.fromEntries(
|
|
@@ -89997,7 +89953,7 @@ var init_scene_parser = __esm({
|
|
|
89997
89953
|
async function readLocalTextAsset(projectDir, entryPath, entryUrl, label) {
|
|
89998
89954
|
if (isCdnUrl(entryUrl)) return null;
|
|
89999
89955
|
try {
|
|
90000
|
-
return await
|
|
89956
|
+
return await import_promises10.default.readFile(`${projectDir}/${entryPath}`, "utf-8");
|
|
90001
89957
|
} catch (error49) {
|
|
90002
89958
|
if (isEnoent(error49)) return null;
|
|
90003
89959
|
throw new Error(`[domain-bridge] failed to read ${label} ${entryPath}: ${errorMessage(error49)}`);
|
|
@@ -90011,7 +89967,7 @@ function parseJsonWithPath(text, filePath) {
|
|
|
90011
89967
|
}
|
|
90012
89968
|
}
|
|
90013
89969
|
function resolveSceneAssetId(config2, manifest) {
|
|
90014
|
-
const sceneAssetIds = Object.entries(manifest.entries).filter(([,
|
|
89970
|
+
const sceneAssetIds = Object.entries(manifest.entries).filter(([, entry]) => entry.type === "Scene").map(([assetId]) => assetId);
|
|
90015
89971
|
if (typeof config2.sceneId === "string" && config2.sceneId.length > 0) {
|
|
90016
89972
|
const configuredEntry = manifest.entries[config2.sceneId];
|
|
90017
89973
|
if (configuredEntry?.type === "Scene") {
|
|
@@ -90022,7 +89978,7 @@ function resolveSceneAssetId(config2, manifest) {
|
|
|
90022
89978
|
}
|
|
90023
89979
|
async function readRemoteProjectId(projectDir) {
|
|
90024
89980
|
try {
|
|
90025
|
-
const remoteText = await
|
|
89981
|
+
const remoteText = await import_promises10.default.readFile(`${projectDir}/.galacean/remote.json`, "utf-8");
|
|
90026
89982
|
const remote = JSON.parse(remoteText);
|
|
90027
89983
|
return typeof remote.projectId === "string" ? remote.projectId : "";
|
|
90028
89984
|
} catch (error49) {
|
|
@@ -90031,10 +89987,10 @@ async function readRemoteProjectId(projectDir) {
|
|
|
90031
89987
|
}
|
|
90032
89988
|
}
|
|
90033
89989
|
async function loadDomainState(projectDir) {
|
|
90034
|
-
const configText = await
|
|
89990
|
+
const configText = await import_promises10.default.readFile(`${projectDir}/project.galacean`, "utf-8");
|
|
90035
89991
|
const config2 = JSON.parse(configText);
|
|
90036
89992
|
const remoteProjectId = await readRemoteProjectId(projectDir);
|
|
90037
|
-
const manifestText = await
|
|
89993
|
+
const manifestText = await import_promises10.default.readFile(`${projectDir}/.galacean/manifest.json`, "utf-8");
|
|
90038
89994
|
const manifest = JSON.parse(manifestText);
|
|
90039
89995
|
const sceneAssetId = resolveSceneAssetId(config2, manifest);
|
|
90040
89996
|
if (sceneAssetId) {
|
|
@@ -90045,25 +90001,19 @@ async function loadDomainState(projectDir) {
|
|
|
90045
90001
|
const rootEntityIds = [];
|
|
90046
90002
|
let sceneSettings;
|
|
90047
90003
|
const assetMeta = /* @__PURE__ */ new Map();
|
|
90048
|
-
for (const [assetId,
|
|
90049
|
-
|
|
90050
|
-
const
|
|
90051
|
-
|
|
90052
|
-
meta3 = inlineMeta;
|
|
90053
|
-
} else {
|
|
90054
|
-
const metaText = await import_promises9.default.readFile(`${projectDir}/${metaFilePath(entry2.path)}`, "utf-8");
|
|
90055
|
-
meta3 = JSON.parse(metaText);
|
|
90056
|
-
}
|
|
90057
|
-
const serverId = meta3.serverId || entry2.serverId || `local-${assetId}`;
|
|
90004
|
+
for (const [assetId, entry] of Object.entries(manifest.entries)) {
|
|
90005
|
+
const metaText = await import_promises10.default.readFile(`${projectDir}/${metaFilePath(entry.path)}`, "utf-8");
|
|
90006
|
+
const meta3 = JSON.parse(metaText);
|
|
90007
|
+
const serverId = meta3.serverId || entry.serverId || `local-${assetId}`;
|
|
90058
90008
|
assetMeta.set(assetId, { serverId, meta: meta3 });
|
|
90059
|
-
const isFolder =
|
|
90060
|
-
const parentId = findParentAssetId(
|
|
90009
|
+
const isFolder = entry.type === "Folder";
|
|
90010
|
+
const parentId = findParentAssetId(entry.path, manifest.entries);
|
|
90061
90011
|
const assetState = {
|
|
90062
90012
|
id: assetId,
|
|
90063
|
-
name: assetNameFromPath(
|
|
90064
|
-
type:
|
|
90013
|
+
name: assetNameFromPath(entry.path, entry.type),
|
|
90014
|
+
type: entry.type,
|
|
90065
90015
|
parentFolderId: parentId,
|
|
90066
|
-
url:
|
|
90016
|
+
url: entry.url || void 0,
|
|
90067
90017
|
meta: meta3,
|
|
90068
90018
|
serverId,
|
|
90069
90019
|
status: "ready"
|
|
@@ -90071,34 +90021,34 @@ async function loadDomainState(projectDir) {
|
|
|
90071
90021
|
if (!isFolder) {
|
|
90072
90022
|
if (assetId === sceneAssetId) {
|
|
90073
90023
|
try {
|
|
90074
|
-
const sceneText = await
|
|
90024
|
+
const sceneText = await import_promises10.default.readFile(`${projectDir}/${entry.path}`, "utf-8");
|
|
90075
90025
|
const sceneFile = JSON.parse(sceneText);
|
|
90076
90026
|
parseSceneEntities(sceneFile, entities, rootEntityIds);
|
|
90077
90027
|
if (sceneFile.scene && typeof sceneFile.scene === "object") {
|
|
90078
90028
|
sceneSettings = sceneFile.scene;
|
|
90079
90029
|
}
|
|
90080
90030
|
} catch (error49) {
|
|
90081
|
-
throw new Error(`[domain-bridge] failed to parse scene file ${
|
|
90031
|
+
throw new Error(`[domain-bridge] failed to parse scene file ${entry.path}: ${errorMessage(error49)}`);
|
|
90082
90032
|
}
|
|
90083
|
-
} else if (
|
|
90084
|
-
const text = await readLocalTextAsset(projectDir,
|
|
90033
|
+
} else if (entry.type === "script") {
|
|
90034
|
+
const text = await readLocalTextAsset(projectDir, entry.path, entry.url, "script");
|
|
90085
90035
|
if (text !== null) assetState.content = { code: text };
|
|
90086
|
-
} else if (
|
|
90087
|
-
const text = await readLocalTextAsset(projectDir,
|
|
90088
|
-
if (text !== null) assetState.content = parseJsonWithPath(text,
|
|
90089
|
-
} else if (
|
|
90090
|
-
const text = await readLocalTextAsset(projectDir,
|
|
90036
|
+
} else if (entry.type === "Prefab") {
|
|
90037
|
+
const text = await readLocalTextAsset(projectDir, entry.path, entry.url, "prefab");
|
|
90038
|
+
if (text !== null) assetState.content = parseJsonWithPath(text, entry.path);
|
|
90039
|
+
} else if (entry.type === "Shader" || entry.type === "ShaderChunk") {
|
|
90040
|
+
const text = await readLocalTextAsset(projectDir, entry.path, entry.url, entry.type.toLowerCase());
|
|
90091
90041
|
if (text !== null) assetState.content = { source: text };
|
|
90092
|
-
} else if (
|
|
90093
|
-
const text = await readLocalTextAsset(projectDir,
|
|
90042
|
+
} else if (entry.type === "Material") {
|
|
90043
|
+
const text = await readLocalTextAsset(projectDir, entry.path, entry.url, "material");
|
|
90094
90044
|
if (text !== null) {
|
|
90095
|
-
const matData = parseJsonWithPath(text,
|
|
90045
|
+
const matData = parseJsonWithPath(text, entry.path);
|
|
90096
90046
|
const props = extractMaterialProps(matData);
|
|
90097
90047
|
if (Object.keys(props).length > 0) assetState.props = props;
|
|
90098
90048
|
assetState.content = matData;
|
|
90099
90049
|
}
|
|
90100
|
-
} else if (isCdnUrl(
|
|
90101
|
-
assetState.url =
|
|
90050
|
+
} else if (isCdnUrl(entry.url)) {
|
|
90051
|
+
assetState.url = entry.url;
|
|
90102
90052
|
} else {
|
|
90103
90053
|
assetState.url = "";
|
|
90104
90054
|
}
|
|
@@ -90121,11 +90071,11 @@ async function loadDomainState(projectDir) {
|
|
|
90121
90071
|
}
|
|
90122
90072
|
};
|
|
90123
90073
|
}
|
|
90124
|
-
var
|
|
90074
|
+
var import_promises10;
|
|
90125
90075
|
var init_load = __esm({
|
|
90126
90076
|
"src/domain-bridge/load.ts"() {
|
|
90127
90077
|
"use strict";
|
|
90128
|
-
|
|
90078
|
+
import_promises10 = __toESM(require("node:fs/promises"));
|
|
90129
90079
|
init_meta_file();
|
|
90130
90080
|
init_sync_adapter();
|
|
90131
90081
|
init_utils();
|
|
@@ -90136,7 +90086,7 @@ var init_load = __esm({
|
|
|
90136
90086
|
// src/domain-bridge/save.ts
|
|
90137
90087
|
async function isSameFileSystemEntry(pathA, pathB) {
|
|
90138
90088
|
try {
|
|
90139
|
-
const [a, b] = await Promise.all([
|
|
90089
|
+
const [a, b] = await Promise.all([import_promises11.default.stat(pathA), import_promises11.default.stat(pathB)]);
|
|
90140
90090
|
return a.dev === b.dev && a.ino === b.ino;
|
|
90141
90091
|
} catch (error49) {
|
|
90142
90092
|
if (isEnoent(error49)) return false;
|
|
@@ -90145,8 +90095,8 @@ async function isSameFileSystemEntry(pathA, pathB) {
|
|
|
90145
90095
|
}
|
|
90146
90096
|
async function atomicWriteNodeFs(filePath, content) {
|
|
90147
90097
|
const tmp = filePath + ".tmp";
|
|
90148
|
-
await
|
|
90149
|
-
await
|
|
90098
|
+
await import_promises11.default.writeFile(tmp, content);
|
|
90099
|
+
await import_promises11.default.rename(tmp, filePath);
|
|
90150
90100
|
}
|
|
90151
90101
|
async function saveDomainState(projectDir, state, ctx) {
|
|
90152
90102
|
let sceneJson;
|
|
@@ -90174,7 +90124,7 @@ async function saveDomainState(projectDir, state, ctx) {
|
|
|
90174
90124
|
const newPathMap = buildLocalPathMap(remoteAssets);
|
|
90175
90125
|
const useCaseFoldGuards = await shouldUseCaseFoldGuards(projectDir);
|
|
90176
90126
|
if (useCaseFoldGuards) {
|
|
90177
|
-
const pathCollisions = findCaseFoldPathCollisions(Array.from(newPathMap.values(), (
|
|
90127
|
+
const pathCollisions = findCaseFoldPathCollisions(Array.from(newPathMap.values(), (entry) => entry.localPath));
|
|
90178
90128
|
if (pathCollisions.length > 0) {
|
|
90179
90129
|
const preview = formatConflictPreview(pathCollisions.map((item) => `${item.firstPath} <-> ${item.secondPath}`));
|
|
90180
90130
|
throw new Error(
|
|
@@ -90183,18 +90133,18 @@ async function saveDomainState(projectDir, state, ctx) {
|
|
|
90183
90133
|
}
|
|
90184
90134
|
}
|
|
90185
90135
|
const contentHashes = /* @__PURE__ */ new Map();
|
|
90186
|
-
const removedEntries = Object.entries(ctx.manifest.entries).filter(([assetId]) => !state.assets[assetId]).map(([,
|
|
90187
|
-
for (const [,
|
|
90188
|
-
if (
|
|
90189
|
-
await
|
|
90136
|
+
const removedEntries = Object.entries(ctx.manifest.entries).filter(([assetId]) => !state.assets[assetId]).map(([, entry]) => entry);
|
|
90137
|
+
for (const [, entry] of newPathMap) {
|
|
90138
|
+
if (entry.isFolder) {
|
|
90139
|
+
await import_promises11.default.mkdir(`${projectDir}/${entry.localPath}`, { recursive: true });
|
|
90190
90140
|
}
|
|
90191
90141
|
}
|
|
90192
90142
|
const pendingFileMoves = [];
|
|
90193
|
-
for (const [assetId,
|
|
90194
|
-
if (
|
|
90143
|
+
for (const [assetId, entry] of newPathMap) {
|
|
90144
|
+
if (entry.isFolder) continue;
|
|
90195
90145
|
const oldEntry = ctx.manifest.entries[assetId];
|
|
90196
|
-
if (oldEntry && oldEntry.path !==
|
|
90197
|
-
pendingFileMoves.push({ assetId, oldPath: oldEntry.path, newPath:
|
|
90146
|
+
if (oldEntry && oldEntry.path !== entry.localPath) {
|
|
90147
|
+
pendingFileMoves.push({ assetId, oldPath: oldEntry.path, newPath: entry.localPath });
|
|
90198
90148
|
}
|
|
90199
90149
|
}
|
|
90200
90150
|
if (useCaseFoldGuards) {
|
|
@@ -90218,12 +90168,12 @@ async function saveDomainState(projectDir, state, ctx) {
|
|
|
90218
90168
|
}
|
|
90219
90169
|
const tempPath = `${move.oldPath}.__tmp_move__${tempMoveIndex++}`;
|
|
90220
90170
|
try {
|
|
90221
|
-
await
|
|
90171
|
+
await import_promises11.default.rename(`${projectDir}/${move.oldPath}`, `${projectDir}/${tempPath}`);
|
|
90222
90172
|
} catch (e) {
|
|
90223
90173
|
if (!isEnoent(e)) throw e;
|
|
90224
90174
|
}
|
|
90225
90175
|
try {
|
|
90226
|
-
await
|
|
90176
|
+
await import_promises11.default.rename(`${projectDir}/${metaFilePath(move.oldPath)}`, `${projectDir}/${metaFilePath(tempPath)}`);
|
|
90227
90177
|
} catch (e) {
|
|
90228
90178
|
if (!isEnoent(e)) throw e;
|
|
90229
90179
|
}
|
|
@@ -90235,19 +90185,19 @@ async function saveDomainState(projectDir, state, ctx) {
|
|
|
90235
90185
|
await atomicWriteNodeFs(`${projectDir}/${sceneNewEntry.localPath}`, sceneJson);
|
|
90236
90186
|
}
|
|
90237
90187
|
}
|
|
90238
|
-
for (const [assetId,
|
|
90239
|
-
if (
|
|
90188
|
+
for (const [assetId, entry] of newPathMap) {
|
|
90189
|
+
if (entry.isFolder) continue;
|
|
90240
90190
|
if (assetId === ctx.sceneAssetId && sceneJson) {
|
|
90241
90191
|
const oldEntry2 = ctx.manifest.entries[assetId];
|
|
90242
|
-
if (oldEntry2 && oldEntry2.path !==
|
|
90192
|
+
if (oldEntry2 && oldEntry2.path !== entry.localPath) {
|
|
90243
90193
|
const sourcePath = moveSourceByAssetId.get(assetId) ?? oldEntry2.path;
|
|
90244
90194
|
try {
|
|
90245
|
-
await
|
|
90195
|
+
await import_promises11.default.unlink(`${projectDir}/${sourcePath}`);
|
|
90246
90196
|
} catch (e) {
|
|
90247
90197
|
if (!isEnoent(e)) throw e;
|
|
90248
90198
|
}
|
|
90249
90199
|
try {
|
|
90250
|
-
await
|
|
90200
|
+
await import_promises11.default.unlink(`${projectDir}/${metaFilePath(sourcePath)}`);
|
|
90251
90201
|
} catch (e) {
|
|
90252
90202
|
if (!isEnoent(e)) throw e;
|
|
90253
90203
|
}
|
|
@@ -90258,31 +90208,31 @@ async function saveDomainState(projectDir, state, ctx) {
|
|
|
90258
90208
|
const asset2 = state.assets[assetId];
|
|
90259
90209
|
if (!asset2) continue;
|
|
90260
90210
|
const oldEntry = ctx.manifest.entries[assetId];
|
|
90261
|
-
const newPath =
|
|
90211
|
+
const newPath = entry.localPath;
|
|
90262
90212
|
let renameSourceMissing = false;
|
|
90263
90213
|
if (oldEntry && oldEntry.path !== newPath) {
|
|
90264
90214
|
const sourcePath = moveSourceByAssetId.get(assetId) ?? oldEntry.path;
|
|
90265
90215
|
try {
|
|
90266
|
-
await
|
|
90216
|
+
await import_promises11.default.rename(`${projectDir}/${sourcePath}`, `${projectDir}/${newPath}`);
|
|
90267
90217
|
} catch (e) {
|
|
90268
90218
|
if (!isEnoent(e)) throw e;
|
|
90269
90219
|
renameSourceMissing = true;
|
|
90270
90220
|
}
|
|
90271
90221
|
try {
|
|
90272
|
-
await
|
|
90222
|
+
await import_promises11.default.rename(`${projectDir}/${metaFilePath(sourcePath)}`, `${projectDir}/${metaFilePath(newPath)}`);
|
|
90273
90223
|
} catch (e) {
|
|
90274
90224
|
if (!isEnoent(e)) throw e;
|
|
90275
90225
|
}
|
|
90276
90226
|
}
|
|
90277
90227
|
if (asset2.type === "script" && asset2.content) {
|
|
90278
90228
|
const code = typeof asset2.content.code === "string" ? asset2.content.code : JSON.stringify(asset2.content);
|
|
90279
|
-
await
|
|
90229
|
+
await import_promises11.default.writeFile(`${projectDir}/${newPath}`, code);
|
|
90280
90230
|
contentHashes.set(assetId, md5Text(code));
|
|
90281
90231
|
continue;
|
|
90282
90232
|
}
|
|
90283
90233
|
if (asset2.type === "Prefab" && asset2.content) {
|
|
90284
90234
|
const json2 = JSON.stringify(asset2.content);
|
|
90285
|
-
await
|
|
90235
|
+
await import_promises11.default.writeFile(`${projectDir}/${newPath}`, json2);
|
|
90286
90236
|
contentHashes.set(assetId, md5Text(json2));
|
|
90287
90237
|
continue;
|
|
90288
90238
|
}
|
|
@@ -90290,19 +90240,19 @@ async function saveDomainState(projectDir, state, ctx) {
|
|
|
90290
90240
|
const json2 = JSON.stringify(
|
|
90291
90241
|
buildMaterialMainData(asset2.name, asset2.props ?? {}, asset2.content)
|
|
90292
90242
|
);
|
|
90293
|
-
await
|
|
90243
|
+
await import_promises11.default.writeFile(`${projectDir}/${newPath}`, json2);
|
|
90294
90244
|
contentHashes.set(assetId, md5Text(json2));
|
|
90295
90245
|
continue;
|
|
90296
90246
|
}
|
|
90297
90247
|
if ((asset2.type === "Shader" || asset2.type === "ShaderChunk") && asset2.content != null) {
|
|
90298
90248
|
const source = typeof asset2.content.source === "string" ? asset2.content.source : "";
|
|
90299
|
-
await
|
|
90249
|
+
await import_promises11.default.writeFile(`${projectDir}/${newPath}`, source);
|
|
90300
90250
|
contentHashes.set(assetId, md5Text(source));
|
|
90301
90251
|
continue;
|
|
90302
90252
|
}
|
|
90303
90253
|
if (asset2.content != null) {
|
|
90304
90254
|
const text = JSON.stringify(asset2.content);
|
|
90305
|
-
await
|
|
90255
|
+
await import_promises11.default.writeFile(`${projectDir}/${newPath}`, text);
|
|
90306
90256
|
contentHashes.set(assetId, md5Text(text));
|
|
90307
90257
|
continue;
|
|
90308
90258
|
}
|
|
@@ -90316,7 +90266,7 @@ async function saveDomainState(projectDir, state, ctx) {
|
|
|
90316
90266
|
throw new Error(`[saveDomainState] Invalid data URL for asset '${assetId}': missing base64 payload`);
|
|
90317
90267
|
}
|
|
90318
90268
|
const buf = Buffer.from(base643, "base64");
|
|
90319
|
-
await
|
|
90269
|
+
await import_promises11.default.writeFile(`${projectDir}/${newPath}`, buf);
|
|
90320
90270
|
contentHashes.set(assetId, md5Buffer(buf.buffer.slice(buf.byteOffset, buf.byteOffset + buf.byteLength)));
|
|
90321
90271
|
continue;
|
|
90322
90272
|
}
|
|
@@ -90330,28 +90280,28 @@ async function saveDomainState(projectDir, state, ctx) {
|
|
|
90330
90280
|
}
|
|
90331
90281
|
}
|
|
90332
90282
|
const newFolderPathKeys = /* @__PURE__ */ new Set();
|
|
90333
|
-
for (const [,
|
|
90334
|
-
if (
|
|
90283
|
+
for (const [, entry] of newPathMap) {
|
|
90284
|
+
if (entry.isFolder) newFolderPathKeys.add(pathCompareKey(entry.localPath, useCaseFoldGuards));
|
|
90335
90285
|
}
|
|
90336
|
-
for (const [assetId,
|
|
90337
|
-
if (!
|
|
90286
|
+
for (const [assetId, entry] of newPathMap) {
|
|
90287
|
+
if (!entry.isFolder) continue;
|
|
90338
90288
|
const oldEntry = ctx.manifest.entries[assetId];
|
|
90339
90289
|
const oldPathReusedAsTarget = oldEntry ? newFolderPathKeys.has(pathCompareKey(oldEntry.path, useCaseFoldGuards)) : false;
|
|
90340
|
-
if (oldEntry && oldEntry.path !==
|
|
90290
|
+
if (oldEntry && oldEntry.path !== entry.localPath) {
|
|
90341
90291
|
const oldFolderPath = `${projectDir}/${oldEntry.path}`;
|
|
90342
|
-
const newFolderPath = `${projectDir}/${
|
|
90343
|
-
if (isCaseOnlyPathChange(oldEntry.path,
|
|
90344
|
-
await
|
|
90292
|
+
const newFolderPath = `${projectDir}/${entry.localPath}`;
|
|
90293
|
+
if (isCaseOnlyPathChange(oldEntry.path, entry.localPath) && await isSameFileSystemEntry(oldFolderPath, newFolderPath)) {
|
|
90294
|
+
await import_promises11.default.rename(oldFolderPath, newFolderPath);
|
|
90345
90295
|
continue;
|
|
90346
90296
|
}
|
|
90347
90297
|
if (!oldPathReusedAsTarget) {
|
|
90348
90298
|
try {
|
|
90349
|
-
await
|
|
90299
|
+
await import_promises11.default.unlink(`${projectDir}/${metaFilePath(oldEntry.path)}`);
|
|
90350
90300
|
} catch (e) {
|
|
90351
90301
|
if (!isEnoent(e)) throw e;
|
|
90352
90302
|
}
|
|
90353
90303
|
try {
|
|
90354
|
-
await
|
|
90304
|
+
await import_promises11.default.rm(`${projectDir}/${oldEntry.path}`, { recursive: true, force: true });
|
|
90355
90305
|
} catch (e) {
|
|
90356
90306
|
if (!isEnoent(e)) throw e;
|
|
90357
90307
|
}
|
|
@@ -90359,28 +90309,28 @@ async function saveDomainState(projectDir, state, ctx) {
|
|
|
90359
90309
|
}
|
|
90360
90310
|
}
|
|
90361
90311
|
const newPathKeys = new Set(
|
|
90362
|
-
Array.from(newPathMap.values(), (
|
|
90312
|
+
Array.from(newPathMap.values(), (entry) => pathCompareKey(entry.localPath, useCaseFoldGuards))
|
|
90363
90313
|
);
|
|
90364
90314
|
const removedOrdered = [
|
|
90365
|
-
...removedEntries.filter((
|
|
90366
|
-
...removedEntries.filter((
|
|
90315
|
+
...removedEntries.filter((entry) => entry.type !== "Folder"),
|
|
90316
|
+
...removedEntries.filter((entry) => entry.type === "Folder").sort((a, b) => b.path.split("/").length - a.path.split("/").length)
|
|
90367
90317
|
];
|
|
90368
|
-
for (const
|
|
90369
|
-
if (newPathKeys.has(pathCompareKey(
|
|
90318
|
+
for (const entry of removedOrdered) {
|
|
90319
|
+
if (newPathKeys.has(pathCompareKey(entry.path, useCaseFoldGuards))) continue;
|
|
90370
90320
|
try {
|
|
90371
|
-
await
|
|
90321
|
+
await import_promises11.default.unlink(`${projectDir}/${metaFilePath(entry.path)}`);
|
|
90372
90322
|
} catch (e) {
|
|
90373
90323
|
if (!isEnoent(e)) throw e;
|
|
90374
90324
|
}
|
|
90375
90325
|
try {
|
|
90376
|
-
await
|
|
90326
|
+
await import_promises11.default.rm(`${projectDir}/${entry.path}`, { recursive: true, force: true });
|
|
90377
90327
|
} catch (e) {
|
|
90378
90328
|
if (!isEnoent(e)) throw e;
|
|
90379
90329
|
}
|
|
90380
90330
|
}
|
|
90381
90331
|
const manifestPath = `${projectDir}/.galacean/manifest.json`;
|
|
90382
90332
|
try {
|
|
90383
|
-
const diskManifestText = await
|
|
90333
|
+
const diskManifestText = await import_promises11.default.readFile(manifestPath, "utf-8");
|
|
90384
90334
|
const diskManifest = JSON.parse(diskManifestText);
|
|
90385
90335
|
if (diskManifest.entries) {
|
|
90386
90336
|
for (const [assetId, diskEntry] of Object.entries(diskManifest.entries)) {
|
|
@@ -90394,20 +90344,20 @@ async function saveDomainState(projectDir, state, ctx) {
|
|
|
90394
90344
|
console.warn("[saveDomainState] Failed to read existing manifest for serverId merge:", err);
|
|
90395
90345
|
}
|
|
90396
90346
|
await Promise.all(
|
|
90397
|
-
[...newPathMap.values()].map((
|
|
90398
|
-
const meta3 = generateMetaFile(
|
|
90399
|
-
return
|
|
90347
|
+
[...newPathMap.values()].map((entry) => {
|
|
90348
|
+
const meta3 = generateMetaFile(entry);
|
|
90349
|
+
return import_promises11.default.writeFile(`${projectDir}/${metaFilePath(entry.localPath)}`, JSON.stringify(meta3, null, 2));
|
|
90400
90350
|
})
|
|
90401
90351
|
);
|
|
90402
90352
|
const newManifest = generateManifest(newPathMap, contentHashes);
|
|
90403
90353
|
await atomicWriteNodeFs(manifestPath, JSON.stringify(newManifest, null, 2));
|
|
90404
90354
|
await atomicWriteNodeFs(`${projectDir}/project.galacean`, JSON.stringify(ctx.config, null, 2));
|
|
90405
90355
|
}
|
|
90406
|
-
var
|
|
90356
|
+
var import_promises11;
|
|
90407
90357
|
var init_save = __esm({
|
|
90408
90358
|
"src/domain-bridge/save.ts"() {
|
|
90409
90359
|
"use strict";
|
|
90410
|
-
|
|
90360
|
+
import_promises11 = __toESM(require("node:fs/promises"));
|
|
90411
90361
|
init_hash();
|
|
90412
90362
|
init_manifest();
|
|
90413
90363
|
init_meta_file();
|
|
@@ -90456,9 +90406,8 @@ var init_asset_types = __esm({
|
|
|
90456
90406
|
Scene: "Scene",
|
|
90457
90407
|
Prefab: "Prefab",
|
|
90458
90408
|
Material: "Material",
|
|
90459
|
-
Texture2D: "
|
|
90460
|
-
TextureCube: "
|
|
90461
|
-
HDR: "HDR",
|
|
90409
|
+
Texture2D: "Texture2D",
|
|
90410
|
+
TextureCube: "TextureCube",
|
|
90462
90411
|
script: "script",
|
|
90463
90412
|
Shader: "Shader",
|
|
90464
90413
|
ShaderChunk: "ShaderChunk",
|
|
@@ -90475,7 +90424,7 @@ var init_asset_types = __esm({
|
|
|
90475
90424
|
PrimitiveMesh: "PrimitiveMesh",
|
|
90476
90425
|
glTF: "GLTF",
|
|
90477
90426
|
Mesh: "Mesh",
|
|
90478
|
-
AmbientLight: "
|
|
90427
|
+
AmbientLight: "AmbientLight",
|
|
90479
90428
|
LottieClip: "LottieAnimation",
|
|
90480
90429
|
XRReferenceImage: "XRReferenceImage",
|
|
90481
90430
|
GameDesignGraph: "GameDesignGraph"
|
|
@@ -90490,15 +90439,8 @@ __export(cli_builder_exports, {
|
|
|
90490
90439
|
TEXT_ASSET_TYPES: () => TEXT_ASSET_TYPES,
|
|
90491
90440
|
assertSafeBuildOutputDir: () => assertSafeBuildOutputDir,
|
|
90492
90441
|
buildProject: () => buildProject,
|
|
90493
|
-
buildProjectAssets: () => buildProjectAssets
|
|
90494
|
-
warnSkippedScenePrefabs: () => warnSkippedScenePrefabs
|
|
90442
|
+
buildProjectAssets: () => buildProjectAssets
|
|
90495
90443
|
});
|
|
90496
|
-
function warnSkippedScenePrefabs(skippedAssets) {
|
|
90497
|
-
const skippedScenePrefabs = skippedAssets.filter((a) => a.reason?.includes("Scene") || a.reason?.includes("Prefab"));
|
|
90498
|
-
if (skippedScenePrefabs.length === 0) return null;
|
|
90499
|
-
return `[cliCompile] Warning: ${skippedScenePrefabs.length} Scene/Prefab asset(s) were skipped, feature detection may be incomplete:
|
|
90500
|
-
` + skippedScenePrefabs.map((a) => ` - ${a.path}: ${a.reason}`).join("\n");
|
|
90501
|
-
}
|
|
90502
90444
|
function isHttpUrl(url2) {
|
|
90503
90445
|
return typeof url2 === "string" && /^https?:\/\//.test(url2);
|
|
90504
90446
|
}
|
|
@@ -90508,12 +90450,12 @@ function toBlobArrayBuffer(bytes) {
|
|
|
90508
90450
|
return copy2.buffer;
|
|
90509
90451
|
}
|
|
90510
90452
|
function normalizePathForComparison(filePath) {
|
|
90511
|
-
const normalized =
|
|
90453
|
+
const normalized = import_node_path14.default.resolve(filePath);
|
|
90512
90454
|
return process.platform === "linux" ? normalized : normalized.toLowerCase();
|
|
90513
90455
|
}
|
|
90514
90456
|
function isSameOrNestedPath(targetPath, basePath) {
|
|
90515
|
-
const relative5 =
|
|
90516
|
-
return relative5 === "" || !relative5.startsWith("..") && !
|
|
90457
|
+
const relative5 = import_node_path14.default.relative(basePath, targetPath);
|
|
90458
|
+
return relative5 === "" || !relative5.startsWith("..") && !import_node_path14.default.isAbsolute(relative5);
|
|
90517
90459
|
}
|
|
90518
90460
|
function assertSafeBuildOutputDir(projectDir, outputDir) {
|
|
90519
90461
|
const normalizedProjectDir = normalizePathForComparison(projectDir);
|
|
@@ -90524,7 +90466,7 @@ function assertSafeBuildOutputDir(projectDir, outputDir) {
|
|
|
90524
90466
|
);
|
|
90525
90467
|
}
|
|
90526
90468
|
for (const managedPath of MANAGED_PROJECT_PATHS) {
|
|
90527
|
-
const normalizedManagedPath = normalizePathForComparison(
|
|
90469
|
+
const normalizedManagedPath = normalizePathForComparison(import_node_path14.default.join(projectDir, managedPath));
|
|
90528
90470
|
const overlapsManagedPath = managedPath === "project.galacean" ? normalizedOutputDir === normalizedManagedPath : isSameOrNestedPath(normalizedOutputDir, normalizedManagedPath);
|
|
90529
90471
|
if (overlapsManagedPath) {
|
|
90530
90472
|
throw new Error(
|
|
@@ -90534,8 +90476,8 @@ function assertSafeBuildOutputDir(projectDir, outputDir) {
|
|
|
90534
90476
|
}
|
|
90535
90477
|
}
|
|
90536
90478
|
async function buildProject(options) {
|
|
90537
|
-
const projectDir =
|
|
90538
|
-
const outputDir =
|
|
90479
|
+
const projectDir = import_node_path14.default.resolve(options.projectDir);
|
|
90480
|
+
const outputDir = import_node_path14.default.resolve(options.output);
|
|
90539
90481
|
assertSafeBuildOutputDir(projectDir, outputDir);
|
|
90540
90482
|
console.log("Reading project...");
|
|
90541
90483
|
const { state, ctx } = await loadDomainState(projectDir);
|
|
@@ -90593,53 +90535,48 @@ function buildProjectAssets(manifest, projectDir) {
|
|
|
90593
90535
|
for (const [id, e] of Object.entries(entries)) {
|
|
90594
90536
|
if (e.type === "Folder") folderPathToId.set(e.path, id);
|
|
90595
90537
|
}
|
|
90596
|
-
for (const [assetId,
|
|
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
|
+
}
|
|
90597
90552
|
let meta3;
|
|
90598
|
-
|
|
90599
|
-
|
|
90600
|
-
|
|
90601
|
-
|
|
90602
|
-
|
|
90603
|
-
|
|
90604
|
-
|
|
90605
|
-
|
|
90606
|
-
}
|
|
90607
|
-
|
|
90608
|
-
skippedAssets.push({
|
|
90609
|
-
assetId,
|
|
90610
|
-
path: entry2.path,
|
|
90611
|
-
reason: `failed to read meta file: ${e instanceof Error ? e.message : String(e)}`
|
|
90612
|
-
});
|
|
90613
|
-
continue;
|
|
90614
|
-
}
|
|
90615
|
-
try {
|
|
90616
|
-
meta3 = JSON.parse(metaText);
|
|
90617
|
-
} catch (e) {
|
|
90618
|
-
console.warn(`[buildProjectAssets] Failed to parse meta JSON: ${metaPath}`, e);
|
|
90619
|
-
skippedAssets.push({
|
|
90620
|
-
assetId,
|
|
90621
|
-
path: entry2.path,
|
|
90622
|
-
reason: `failed to parse meta JSON: ${e instanceof Error ? e.message : String(e)}`
|
|
90623
|
-
});
|
|
90624
|
-
continue;
|
|
90625
|
-
}
|
|
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;
|
|
90626
90563
|
}
|
|
90627
90564
|
metaMap.set(assetId, meta3);
|
|
90628
|
-
const parts =
|
|
90565
|
+
const parts = entry.path.split("/");
|
|
90629
90566
|
const fileName = parts[parts.length - 1];
|
|
90630
|
-
const ext = TYPE_EXTENSION[
|
|
90567
|
+
const ext = TYPE_EXTENSION[entry.type];
|
|
90631
90568
|
const name = ext && fileName.endsWith(ext) ? fileName.slice(0, -ext.length) : fileName;
|
|
90632
90569
|
let parentId = null;
|
|
90633
90570
|
if (parts.length > 2) {
|
|
90634
90571
|
parentId = folderPathToId.get(parts.slice(0, -1).join("/")) ?? null;
|
|
90635
90572
|
}
|
|
90636
|
-
const isFolder =
|
|
90637
|
-
const filePath =
|
|
90573
|
+
const isFolder = entry.type === "Folder";
|
|
90574
|
+
const filePath = import_node_path14.default.join(projectDir, entry.path);
|
|
90638
90575
|
const fileUrl = !isFolder && import_node_fs2.default.existsSync(filePath) ? `file://${filePath}` : (
|
|
90639
90576
|
// Non-http URLs are treated as local/non-materialized inputs and will be validated later in compile.
|
|
90640
|
-
!isFolder && isHttpUrl(
|
|
90577
|
+
!isFolder && isHttpUrl(entry.url) ? entry.url : isFolder ? "" : `file://${filePath}`
|
|
90641
90578
|
);
|
|
90642
|
-
const serverId = typeof meta3.serverId === "string" && meta3.serverId.length > 0 ? meta3.serverId : typeof
|
|
90579
|
+
const serverId = typeof meta3.serverId === "string" && meta3.serverId.length > 0 ? meta3.serverId : typeof entry.serverId === "string" && entry.serverId.length > 0 ? entry.serverId : `local-${assetId}`;
|
|
90643
90580
|
assets.push({
|
|
90644
90581
|
id: serverId,
|
|
90645
90582
|
uuid: assetId,
|
|
@@ -90683,13 +90620,13 @@ async function cliCompile(vfs, config2, options) {
|
|
|
90683
90620
|
continue;
|
|
90684
90621
|
}
|
|
90685
90622
|
file2.exportPath = url2;
|
|
90686
|
-
idMd5Map.set(file2.id, (0, import_js_md52.
|
|
90623
|
+
idMd5Map.set(file2.id, (0, import_js_md52.md5)(url2));
|
|
90687
90624
|
continue;
|
|
90688
90625
|
}
|
|
90689
90626
|
if (url2?.startsWith("file://")) {
|
|
90690
90627
|
const filePath = url2.slice(7);
|
|
90691
90628
|
try {
|
|
90692
|
-
const buf = await
|
|
90629
|
+
const buf = await import_promises12.default.readFile(filePath);
|
|
90693
90630
|
content = TEXT_ASSET_TYPES.has(type) ? buf.toString("utf-8") : new Blob([buf]);
|
|
90694
90631
|
} catch (e) {
|
|
90695
90632
|
console.warn(`[cliCompile] Failed to read asset file: ${filePath}`, e);
|
|
@@ -90732,16 +90669,17 @@ async function cliCompile(vfs, config2, options) {
|
|
|
90732
90669
|
let cacheKey;
|
|
90733
90670
|
let binaryBuffer = null;
|
|
90734
90671
|
if (typeof content === "string") {
|
|
90735
|
-
cacheKey = (0, import_js_md52.
|
|
90672
|
+
cacheKey = (0, import_js_md52.md5)(content);
|
|
90736
90673
|
} else {
|
|
90737
90674
|
binaryBuffer = await content.arrayBuffer();
|
|
90738
|
-
cacheKey = (0, import_js_md52.
|
|
90675
|
+
cacheKey = (0, import_js_md52.md5)(binaryBuffer);
|
|
90739
90676
|
}
|
|
90740
90677
|
if (type === "Texture2D" && binaryBuffer) {
|
|
90741
|
-
|
|
90742
|
-
let dilatedRaw = null;
|
|
90678
|
+
let imgBuf = new Uint8Array(binaryBuffer);
|
|
90743
90679
|
if (meta3.colorDilate) {
|
|
90744
|
-
|
|
90680
|
+
const dilated = await dilateColorBuffer(imgBuf, { range: 4, alpha: 2 });
|
|
90681
|
+
imgBuf = new Uint8Array(dilated);
|
|
90682
|
+
binaryBuffer = imgBuf.buffer;
|
|
90745
90683
|
}
|
|
90746
90684
|
const runtimeOptions = meta3.runtimeOptions;
|
|
90747
90685
|
let useKtx2 = !!(options.ktx2 && ktx2Encoder);
|
|
@@ -90751,18 +90689,12 @@ async function cliCompile(vfs, config2, options) {
|
|
|
90751
90689
|
if (useKtx2) {
|
|
90752
90690
|
const ktx2Mode = runtimeOptions?.overwrite ? runtimeOptions.mode : options.ktx2Mode;
|
|
90753
90691
|
const ktx2Quality = runtimeOptions?.overwrite ? runtimeOptions.quality : options.ktx2Quality;
|
|
90754
|
-
const
|
|
90755
|
-
|
|
90756
|
-
|
|
90757
|
-
|
|
90758
|
-
|
|
90759
|
-
|
|
90760
|
-
qualityLevel: ktx2Quality ?? 150,
|
|
90761
|
-
generateMipmap: !!(meta3.mipmap ?? true),
|
|
90762
|
-
isSetKTX2SRGBTransferFunc: !!(meta3.isSRGBColorSpace ?? true)
|
|
90763
|
-
},
|
|
90764
|
-
rawInfo
|
|
90765
|
-
);
|
|
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
|
+
});
|
|
90766
90698
|
const withParams = ktx2Encoder.setTextureParams(encoded, {
|
|
90767
90699
|
wrapModeU: meta3.wrapModeU ?? 1,
|
|
90768
90700
|
wrapModeV: meta3.wrapModeV ?? 1,
|
|
@@ -90770,30 +90702,21 @@ async function cliCompile(vfs, config2, options) {
|
|
|
90770
90702
|
anisoLevel: meta3.anisoLevel ?? 1
|
|
90771
90703
|
});
|
|
90772
90704
|
const encodedBuffer = toBlobArrayBuffer(withParams);
|
|
90773
|
-
cacheKey = (0, import_js_md52.
|
|
90705
|
+
cacheKey = (0, import_js_md52.md5)(encodedBuffer);
|
|
90774
90706
|
cacheMap.set(cacheKey, new Blob([encodedBuffer]));
|
|
90775
90707
|
file2.exportType = "KTX2";
|
|
90776
90708
|
const pathParts = file2.path.split("/");
|
|
90777
90709
|
const pathName = pathParts[pathParts.length - 1].replace(/\.[^.]+$/, ".ktx2");
|
|
90778
90710
|
file2.exportPath = pathParts.slice(0, -1).concat(pathName).join("/");
|
|
90779
90711
|
} else {
|
|
90780
|
-
let texInput = imgBuf;
|
|
90781
|
-
if (dilatedRaw) {
|
|
90782
|
-
const sharp = (await import("sharp")).default;
|
|
90783
|
-
texInput = new Uint8Array(
|
|
90784
|
-
await sharp(Buffer.from(dilatedRaw.data), {
|
|
90785
|
-
raw: { width: dilatedRaw.width, height: dilatedRaw.height, channels: 4 }
|
|
90786
|
-
}).png().toBuffer()
|
|
90787
|
-
);
|
|
90788
|
-
}
|
|
90789
90712
|
const encoded = await encodeEditorTexture2D(
|
|
90790
|
-
|
|
90713
|
+
imgBuf,
|
|
90791
90714
|
file2.id,
|
|
90792
90715
|
file2.name ?? file2.path.split("/").pop() ?? "",
|
|
90793
90716
|
meta3
|
|
90794
90717
|
);
|
|
90795
90718
|
const encodedBuffer = toBlobArrayBuffer(encoded);
|
|
90796
|
-
cacheKey = (0, import_js_md52.
|
|
90719
|
+
cacheKey = (0, import_js_md52.md5)(encodedBuffer);
|
|
90797
90720
|
cacheMap.set(cacheKey, new Blob([encodedBuffer]));
|
|
90798
90721
|
}
|
|
90799
90722
|
} else {
|
|
@@ -90846,8 +90769,6 @@ async function cliCompile(vfs, config2, options) {
|
|
|
90846
90769
|
}
|
|
90847
90770
|
throw new Error("No scene found in project. Use --scene <sceneId> to specify one.");
|
|
90848
90771
|
}
|
|
90849
|
-
const featureWarning = warnSkippedScenePrefabs(skippedAssets);
|
|
90850
|
-
if (featureWarning) console.warn(featureWarning);
|
|
90851
90772
|
const features = collectFeatures(scenes, prefabs, config2.engineVersion, config2.dependencies);
|
|
90852
90773
|
const projectSchema = {
|
|
90853
90774
|
plugins: [],
|
|
@@ -90864,33 +90785,33 @@ function createSkippedAssetsError(skippedAssets) {
|
|
|
90864
90785
|
${details}`);
|
|
90865
90786
|
}
|
|
90866
90787
|
async function writeOutputToDisk(vfs, outputDir) {
|
|
90867
|
-
await
|
|
90868
|
-
await
|
|
90788
|
+
await import_promises12.default.rm(outputDir, { recursive: true, force: true });
|
|
90789
|
+
await import_promises12.default.mkdir(outputDir, { recursive: true });
|
|
90869
90790
|
const writes = [];
|
|
90870
90791
|
for (const [vfsPath, vfile] of vfs.filePathMap) {
|
|
90871
90792
|
if (vfile.type === "Folder" || vfile.type === 1) continue;
|
|
90872
90793
|
const content = vfile.content;
|
|
90873
90794
|
if (content == null) continue;
|
|
90874
|
-
const outputPath =
|
|
90795
|
+
const outputPath = import_node_path14.default.join(outputDir, vfsPath);
|
|
90875
90796
|
writes.push(
|
|
90876
|
-
|
|
90797
|
+
import_promises12.default.mkdir(import_node_path14.default.dirname(outputPath), { recursive: true }).then(async () => {
|
|
90877
90798
|
if (content instanceof Blob) {
|
|
90878
|
-
await
|
|
90799
|
+
await import_promises12.default.writeFile(outputPath, Buffer.from(await content.arrayBuffer()));
|
|
90879
90800
|
} else {
|
|
90880
|
-
await
|
|
90801
|
+
await import_promises12.default.writeFile(outputPath, content, "utf-8");
|
|
90881
90802
|
}
|
|
90882
90803
|
})
|
|
90883
90804
|
);
|
|
90884
90805
|
}
|
|
90885
90806
|
await Promise.all(writes);
|
|
90886
90807
|
}
|
|
90887
|
-
var
|
|
90808
|
+
var import_promises12, import_node_fs2, import_node_path14, import_js_md52;
|
|
90888
90809
|
var init_cli_builder = __esm({
|
|
90889
90810
|
"src/cli-builder.ts"() {
|
|
90890
90811
|
"use strict";
|
|
90891
|
-
|
|
90812
|
+
import_promises12 = __toESM(require("node:fs/promises"));
|
|
90892
90813
|
import_node_fs2 = __toESM(require("node:fs"));
|
|
90893
|
-
|
|
90814
|
+
import_node_path14 = __toESM(require("node:path"));
|
|
90894
90815
|
import_js_md52 = __toESM(require_md52());
|
|
90895
90816
|
init_src();
|
|
90896
90817
|
init_meta_file();
|
|
@@ -101811,42 +101732,42 @@ function extractDefs(ctx, schema) {
|
|
|
101811
101732
|
if (!root2)
|
|
101812
101733
|
throw new Error("Unprocessed schema. This is a bug in Zod.");
|
|
101813
101734
|
const idToSchema = /* @__PURE__ */ new Map();
|
|
101814
|
-
for (const
|
|
101815
|
-
const id = ctx.metadataRegistry.get(
|
|
101735
|
+
for (const entry of ctx.seen.entries()) {
|
|
101736
|
+
const id = ctx.metadataRegistry.get(entry[0])?.id;
|
|
101816
101737
|
if (id) {
|
|
101817
101738
|
const existing = idToSchema.get(id);
|
|
101818
|
-
if (existing && existing !==
|
|
101739
|
+
if (existing && existing !== entry[0]) {
|
|
101819
101740
|
throw new Error(`Duplicate schema id "${id}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);
|
|
101820
101741
|
}
|
|
101821
|
-
idToSchema.set(id,
|
|
101742
|
+
idToSchema.set(id, entry[0]);
|
|
101822
101743
|
}
|
|
101823
101744
|
}
|
|
101824
|
-
const makeURI = (
|
|
101745
|
+
const makeURI = (entry) => {
|
|
101825
101746
|
const defsSegment = ctx.target === "draft-2020-12" ? "$defs" : "definitions";
|
|
101826
101747
|
if (ctx.external) {
|
|
101827
|
-
const externalId = ctx.external.registry.get(
|
|
101748
|
+
const externalId = ctx.external.registry.get(entry[0])?.id;
|
|
101828
101749
|
const uriGenerator = ctx.external.uri ?? ((id2) => id2);
|
|
101829
101750
|
if (externalId) {
|
|
101830
101751
|
return { ref: uriGenerator(externalId) };
|
|
101831
101752
|
}
|
|
101832
|
-
const id =
|
|
101833
|
-
|
|
101753
|
+
const id = entry[1].defId ?? entry[1].schema.id ?? `schema${ctx.counter++}`;
|
|
101754
|
+
entry[1].defId = id;
|
|
101834
101755
|
return { defId: id, ref: `${uriGenerator("__shared")}#/${defsSegment}/${id}` };
|
|
101835
101756
|
}
|
|
101836
|
-
if (
|
|
101757
|
+
if (entry[1] === root2) {
|
|
101837
101758
|
return { ref: "#" };
|
|
101838
101759
|
}
|
|
101839
101760
|
const uriPrefix = `#`;
|
|
101840
101761
|
const defUriPrefix = `${uriPrefix}/${defsSegment}/`;
|
|
101841
|
-
const defId =
|
|
101762
|
+
const defId = entry[1].schema.id ?? `__schema${ctx.counter++}`;
|
|
101842
101763
|
return { defId, ref: defUriPrefix + defId };
|
|
101843
101764
|
};
|
|
101844
|
-
const extractToDef = (
|
|
101845
|
-
if (
|
|
101765
|
+
const extractToDef = (entry) => {
|
|
101766
|
+
if (entry[1].schema.$ref) {
|
|
101846
101767
|
return;
|
|
101847
101768
|
}
|
|
101848
|
-
const seen =
|
|
101849
|
-
const { ref, defId } = makeURI(
|
|
101769
|
+
const seen = entry[1];
|
|
101770
|
+
const { ref, defId } = makeURI(entry);
|
|
101850
101771
|
seen.def = { ...seen.schema };
|
|
101851
101772
|
if (defId)
|
|
101852
101773
|
seen.defId = defId;
|
|
@@ -101857,8 +101778,8 @@ function extractDefs(ctx, schema) {
|
|
|
101857
101778
|
schema2.$ref = ref;
|
|
101858
101779
|
};
|
|
101859
101780
|
if (ctx.cycles === "throw") {
|
|
101860
|
-
for (const
|
|
101861
|
-
const seen =
|
|
101781
|
+
for (const entry of ctx.seen.entries()) {
|
|
101782
|
+
const seen = entry[1];
|
|
101862
101783
|
if (seen.cycle) {
|
|
101863
101784
|
throw new Error(`Cycle detected: #/${seen.cycle?.join("/")}/<root>
|
|
101864
101785
|
|
|
@@ -101866,31 +101787,31 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
101866
101787
|
}
|
|
101867
101788
|
}
|
|
101868
101789
|
}
|
|
101869
|
-
for (const
|
|
101870
|
-
const seen =
|
|
101871
|
-
if (schema ===
|
|
101872
|
-
extractToDef(
|
|
101790
|
+
for (const entry of ctx.seen.entries()) {
|
|
101791
|
+
const seen = entry[1];
|
|
101792
|
+
if (schema === entry[0]) {
|
|
101793
|
+
extractToDef(entry);
|
|
101873
101794
|
continue;
|
|
101874
101795
|
}
|
|
101875
101796
|
if (ctx.external) {
|
|
101876
|
-
const ext = ctx.external.registry.get(
|
|
101877
|
-
if (schema !==
|
|
101878
|
-
extractToDef(
|
|
101797
|
+
const ext = ctx.external.registry.get(entry[0])?.id;
|
|
101798
|
+
if (schema !== entry[0] && ext) {
|
|
101799
|
+
extractToDef(entry);
|
|
101879
101800
|
continue;
|
|
101880
101801
|
}
|
|
101881
101802
|
}
|
|
101882
|
-
const id = ctx.metadataRegistry.get(
|
|
101803
|
+
const id = ctx.metadataRegistry.get(entry[0])?.id;
|
|
101883
101804
|
if (id) {
|
|
101884
|
-
extractToDef(
|
|
101805
|
+
extractToDef(entry);
|
|
101885
101806
|
continue;
|
|
101886
101807
|
}
|
|
101887
101808
|
if (seen.cycle) {
|
|
101888
|
-
extractToDef(
|
|
101809
|
+
extractToDef(entry);
|
|
101889
101810
|
continue;
|
|
101890
101811
|
}
|
|
101891
101812
|
if (seen.count > 1) {
|
|
101892
101813
|
if (ctx.reused === "ref") {
|
|
101893
|
-
extractToDef(
|
|
101814
|
+
extractToDef(entry);
|
|
101894
101815
|
continue;
|
|
101895
101816
|
}
|
|
101896
101817
|
}
|
|
@@ -101962,8 +101883,8 @@ function finalize(ctx, schema) {
|
|
|
101962
101883
|
path: seen.path ?? []
|
|
101963
101884
|
});
|
|
101964
101885
|
};
|
|
101965
|
-
for (const
|
|
101966
|
-
flattenRef(
|
|
101886
|
+
for (const entry of [...ctx.seen.entries()].reverse()) {
|
|
101887
|
+
flattenRef(entry[0]);
|
|
101967
101888
|
}
|
|
101968
101889
|
const result = {};
|
|
101969
101890
|
if (ctx.target === "draft-2020-12") {
|
|
@@ -101983,8 +101904,8 @@ function finalize(ctx, schema) {
|
|
|
101983
101904
|
}
|
|
101984
101905
|
Object.assign(result, root2.def ?? root2.schema);
|
|
101985
101906
|
const defs = ctx.external?.defs ?? {};
|
|
101986
|
-
for (const
|
|
101987
|
-
const seen =
|
|
101907
|
+
for (const entry of ctx.seen.entries()) {
|
|
101908
|
+
const seen = entry[1];
|
|
101988
101909
|
if (seen.def && seen.defId) {
|
|
101989
101910
|
defs[seen.defId] = seen.def;
|
|
101990
101911
|
}
|
|
@@ -102094,8 +102015,8 @@ function toJSONSchema(input, params) {
|
|
|
102094
102015
|
const registry2 = input;
|
|
102095
102016
|
const ctx2 = initializeContext({ ...params, processors: allProcessors });
|
|
102096
102017
|
const defs = {};
|
|
102097
|
-
for (const
|
|
102098
|
-
const [_24, schema] =
|
|
102018
|
+
for (const entry of registry2._idmap.entries()) {
|
|
102019
|
+
const [_24, schema] = entry;
|
|
102099
102020
|
process3(schema, ctx2);
|
|
102100
102021
|
}
|
|
102101
102022
|
const schemas = {};
|
|
@@ -102105,8 +102026,8 @@ function toJSONSchema(input, params) {
|
|
|
102105
102026
|
defs
|
|
102106
102027
|
};
|
|
102107
102028
|
ctx2.external = external;
|
|
102108
|
-
for (const
|
|
102109
|
-
const [key, schema] =
|
|
102029
|
+
for (const entry of registry2._idmap.entries()) {
|
|
102030
|
+
const [key, schema] = entry;
|
|
102110
102031
|
extractDefs(ctx2, schema);
|
|
102111
102032
|
schemas[key] = finalize(ctx2, schema);
|
|
102112
102033
|
}
|
|
@@ -117565,16 +117486,16 @@ var require_BufferList = __commonJS({
|
|
|
117565
117486
|
this.length = 0;
|
|
117566
117487
|
}
|
|
117567
117488
|
BufferList.prototype.push = function push(v) {
|
|
117568
|
-
var
|
|
117569
|
-
if (this.length > 0) this.tail.next =
|
|
117570
|
-
else this.head =
|
|
117571
|
-
this.tail =
|
|
117489
|
+
var entry = { data: v, next: null };
|
|
117490
|
+
if (this.length > 0) this.tail.next = entry;
|
|
117491
|
+
else this.head = entry;
|
|
117492
|
+
this.tail = entry;
|
|
117572
117493
|
++this.length;
|
|
117573
117494
|
};
|
|
117574
117495
|
BufferList.prototype.unshift = function unshift(v) {
|
|
117575
|
-
var
|
|
117576
|
-
if (this.length === 0) this.tail =
|
|
117577
|
-
this.head =
|
|
117496
|
+
var entry = { data: v, next: this.head };
|
|
117497
|
+
if (this.length === 0) this.tail = entry;
|
|
117498
|
+
this.head = entry;
|
|
117578
117499
|
++this.length;
|
|
117579
117500
|
};
|
|
117580
117501
|
BufferList.prototype.shift = function shift() {
|
|
@@ -117992,18 +117913,18 @@ var require_stream_writable = __commonJS({
|
|
|
117992
117913
|
}
|
|
117993
117914
|
function clearBuffer(stream, state) {
|
|
117994
117915
|
state.bufferProcessing = true;
|
|
117995
|
-
var
|
|
117996
|
-
if (stream._writev &&
|
|
117916
|
+
var entry = state.bufferedRequest;
|
|
117917
|
+
if (stream._writev && entry && entry.next) {
|
|
117997
117918
|
var l = state.bufferedRequestCount;
|
|
117998
117919
|
var buffer2 = new Array(l);
|
|
117999
117920
|
var holder = state.corkedRequestsFree;
|
|
118000
|
-
holder.entry =
|
|
117921
|
+
holder.entry = entry;
|
|
118001
117922
|
var count = 0;
|
|
118002
117923
|
var allBuffers = true;
|
|
118003
|
-
while (
|
|
118004
|
-
buffer2[count] =
|
|
118005
|
-
if (!
|
|
118006
|
-
|
|
117924
|
+
while (entry) {
|
|
117925
|
+
buffer2[count] = entry;
|
|
117926
|
+
if (!entry.isBuf) allBuffers = false;
|
|
117927
|
+
entry = entry.next;
|
|
118007
117928
|
count += 1;
|
|
118008
117929
|
}
|
|
118009
117930
|
buffer2.allBuffers = allBuffers;
|
|
@@ -118018,21 +117939,21 @@ var require_stream_writable = __commonJS({
|
|
|
118018
117939
|
}
|
|
118019
117940
|
state.bufferedRequestCount = 0;
|
|
118020
117941
|
} else {
|
|
118021
|
-
while (
|
|
118022
|
-
var chunk =
|
|
118023
|
-
var encoding =
|
|
118024
|
-
var cb =
|
|
117942
|
+
while (entry) {
|
|
117943
|
+
var chunk = entry.chunk;
|
|
117944
|
+
var encoding = entry.encoding;
|
|
117945
|
+
var cb = entry.callback;
|
|
118025
117946
|
var len = state.objectMode ? 1 : chunk.length;
|
|
118026
117947
|
doWrite(stream, state, false, len, chunk, encoding, cb);
|
|
118027
|
-
|
|
117948
|
+
entry = entry.next;
|
|
118028
117949
|
state.bufferedRequestCount--;
|
|
118029
117950
|
if (state.writing) {
|
|
118030
117951
|
break;
|
|
118031
117952
|
}
|
|
118032
117953
|
}
|
|
118033
|
-
if (
|
|
117954
|
+
if (entry === null) state.lastBufferedRequest = null;
|
|
118034
117955
|
}
|
|
118035
|
-
state.bufferedRequest =
|
|
117956
|
+
state.bufferedRequest = entry;
|
|
118036
117957
|
state.bufferProcessing = false;
|
|
118037
117958
|
}
|
|
118038
117959
|
Writable.prototype._write = function(chunk, encoding, cb) {
|
|
@@ -118104,13 +118025,13 @@ var require_stream_writable = __commonJS({
|
|
|
118104
118025
|
stream.writable = false;
|
|
118105
118026
|
}
|
|
118106
118027
|
function onCorkedFinish(corkReq, state, err) {
|
|
118107
|
-
var
|
|
118028
|
+
var entry = corkReq.entry;
|
|
118108
118029
|
corkReq.entry = null;
|
|
118109
|
-
while (
|
|
118110
|
-
var cb =
|
|
118030
|
+
while (entry) {
|
|
118031
|
+
var cb = entry.callback;
|
|
118111
118032
|
state.pendingcb--;
|
|
118112
118033
|
cb(err);
|
|
118113
|
-
|
|
118034
|
+
entry = entry.next;
|
|
118114
118035
|
}
|
|
118115
118036
|
state.corkedRequestsFree.next = corkReq;
|
|
118116
118037
|
}
|
|
@@ -125953,9 +125874,9 @@ var require_object = __commonJS({
|
|
|
125953
125874
|
*/
|
|
125954
125875
|
filter: function(search) {
|
|
125955
125876
|
var result = [];
|
|
125956
|
-
this.forEach(function(relativePath2,
|
|
125957
|
-
if (search(relativePath2,
|
|
125958
|
-
result.push(
|
|
125877
|
+
this.forEach(function(relativePath2, entry) {
|
|
125878
|
+
if (search(relativePath2, entry)) {
|
|
125879
|
+
result.push(entry);
|
|
125959
125880
|
}
|
|
125960
125881
|
});
|
|
125961
125882
|
return result;
|
|
@@ -126996,24 +126917,24 @@ var init_import = __esm({
|
|
|
126996
126917
|
const manifest = parseResult.data;
|
|
126997
126918
|
const isCdnMode = manifest.mode === "cdn";
|
|
126998
126919
|
const files = /* @__PURE__ */ new Map();
|
|
126999
|
-
for (const
|
|
127000
|
-
const metaFile = zip.file(
|
|
126920
|
+
for (const entry of manifest.assets) {
|
|
126921
|
+
const metaFile = zip.file(entry.metaFile);
|
|
127001
126922
|
if (!metaFile) {
|
|
127002
|
-
throw new EditorAPIError("OPERATION_FAILED", `Missing metadata for asset: ${
|
|
126923
|
+
throw new EditorAPIError("OPERATION_FAILED", `Missing metadata for asset: ${entry.name} (${entry.metaFile})`);
|
|
127003
126924
|
}
|
|
127004
126925
|
const meta3 = JSON.parse(await metaFile.async("text"));
|
|
127005
126926
|
if (isCdnMode) {
|
|
127006
|
-
files.set(
|
|
126927
|
+
files.set(entry.uuid, { main: new Blob([]), meta: meta3 });
|
|
127007
126928
|
} else {
|
|
127008
|
-
const mainFile = zip.file(
|
|
126929
|
+
const mainFile = zip.file(entry.mainFile);
|
|
127009
126930
|
if (!mainFile) {
|
|
127010
126931
|
throw new EditorAPIError(
|
|
127011
126932
|
"OPERATION_FAILED",
|
|
127012
|
-
`Missing main file for asset: ${
|
|
126933
|
+
`Missing main file for asset: ${entry.name} (${entry.mainFile})`
|
|
127013
126934
|
);
|
|
127014
126935
|
}
|
|
127015
|
-
const
|
|
127016
|
-
files.set(
|
|
126936
|
+
const main = await mainFile.async("blob");
|
|
126937
|
+
files.set(entry.uuid, { main, meta: meta3 });
|
|
127017
126938
|
}
|
|
127018
126939
|
}
|
|
127019
126940
|
const result = await assetFacade.importResourcePackageData(manifest, files, {
|
|
@@ -129818,9 +129739,9 @@ var init_ContextQuery = __esm({
|
|
|
129818
129739
|
}
|
|
129819
129740
|
return null;
|
|
129820
129741
|
}
|
|
129821
|
-
const
|
|
129822
|
-
if (!
|
|
129823
|
-
return deepClone2({ id:
|
|
129742
|
+
const entry = Object.entries(entity.components).find(([, c]) => types.includes(c.type));
|
|
129743
|
+
if (!entry) return null;
|
|
129744
|
+
return deepClone2({ id: entry[0], ...entry[1] });
|
|
129824
129745
|
}
|
|
129825
129746
|
/**
|
|
129826
129747
|
* 收集实体及其所有后代 ID(含自身),迭代实现。
|
|
@@ -130095,7 +130016,7 @@ var init_EditorCoreAPI = __esm({
|
|
|
130095
130016
|
|
|
130096
130017
|
// src/cli.ts
|
|
130097
130018
|
var import_node_os2 = __toESM(require("node:os"));
|
|
130098
|
-
var
|
|
130019
|
+
var import_node_path18 = __toESM(require("node:path"));
|
|
130099
130020
|
var import_node_process2 = __toESM(require("node:process"));
|
|
130100
130021
|
|
|
130101
130022
|
// node_modules/commander/esm.mjs
|
|
@@ -130133,7 +130054,7 @@ var NodeFs = class {
|
|
|
130133
130054
|
}
|
|
130134
130055
|
async readdir(p) {
|
|
130135
130056
|
const entries = await (0, import_promises.readdir)(p, { withFileTypes: true });
|
|
130136
|
-
return entries.map((
|
|
130057
|
+
return entries.map((entry) => ({ name: entry.name, kind: entry.isDirectory() ? "directory" : "file" }));
|
|
130137
130058
|
}
|
|
130138
130059
|
async remove(p) {
|
|
130139
130060
|
await (0, import_promises.rm)(p, { recursive: true, force: true });
|
|
@@ -130217,33 +130138,36 @@ var HttpSyncApiClient = class {
|
|
|
130217
130138
|
if (!this.isRecord(json2) || !this.isRecord(json2.data)) {
|
|
130218
130139
|
throw new Error("Invalid response: missing data field");
|
|
130219
130140
|
}
|
|
130220
|
-
|
|
130221
|
-
|
|
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") {
|
|
130222
130146
|
try {
|
|
130223
|
-
|
|
130147
|
+
;
|
|
130148
|
+
data.content = JSON.parse(data.content);
|
|
130224
130149
|
} catch {
|
|
130225
130150
|
throw new Error("Invalid response: invalid content field");
|
|
130226
130151
|
}
|
|
130227
130152
|
}
|
|
130228
|
-
if (typeof
|
|
130153
|
+
if (typeof data.setting === "string") {
|
|
130229
130154
|
try {
|
|
130230
|
-
|
|
130155
|
+
;
|
|
130156
|
+
data.setting = JSON.parse(data.setting);
|
|
130231
130157
|
} catch {
|
|
130232
130158
|
throw new Error("Invalid response: invalid setting field");
|
|
130233
130159
|
}
|
|
130234
130160
|
}
|
|
130235
|
-
if (typeof
|
|
130161
|
+
if (typeof data.dependencies === "string") {
|
|
130236
130162
|
try {
|
|
130237
|
-
|
|
130163
|
+
;
|
|
130164
|
+
data.dependencies = JSON.parse(data.dependencies);
|
|
130238
130165
|
} catch {
|
|
130239
|
-
const fallback =
|
|
130240
|
-
|
|
130166
|
+
const fallback = data.setting?.dependencies;
|
|
130167
|
+
data.dependencies = this.isRecord(fallback) ? fallback : {};
|
|
130241
130168
|
}
|
|
130242
130169
|
}
|
|
130243
|
-
|
|
130244
|
-
throw new Error("Invalid response: invalid project detail");
|
|
130245
|
-
}
|
|
130246
|
-
return raw;
|
|
130170
|
+
return data;
|
|
130247
130171
|
}
|
|
130248
130172
|
async downloadAsset(url2, options) {
|
|
130249
130173
|
const res = await fetch(url2, { signal: options?.signal });
|
|
@@ -130408,7 +130332,6 @@ var http = __toESM(require("node:http"));
|
|
|
130408
130332
|
|
|
130409
130333
|
// src/config.ts
|
|
130410
130334
|
var import_promises2 = require("node:fs/promises");
|
|
130411
|
-
var import_node_crypto = require("node:crypto");
|
|
130412
130335
|
var import_node_os = __toESM(require("node:os"));
|
|
130413
130336
|
var import_node_path2 = __toESM(require("node:path"));
|
|
130414
130337
|
init_utils();
|
|
@@ -130471,9 +130394,7 @@ async function writeConfigs(updates, targetPath) {
|
|
|
130471
130394
|
Object.assign(config2, updates);
|
|
130472
130395
|
await (0, import_promises2.mkdir)(import_node_path2.default.dirname(configPath), { recursive: true });
|
|
130473
130396
|
const data = JSON.stringify(config2, null, 2) + "\n";
|
|
130474
|
-
|
|
130475
|
-
await (0, import_promises2.writeFile)(tmpPath, data, { mode: 384 });
|
|
130476
|
-
await (0, import_promises2.rename)(tmpPath, configPath);
|
|
130397
|
+
await (0, import_promises2.writeFile)(configPath, data, { mode: 384 });
|
|
130477
130398
|
await (0, import_promises2.chmod)(configPath, 384);
|
|
130478
130399
|
return configPath;
|
|
130479
130400
|
}
|
|
@@ -130705,23 +130626,23 @@ init_hash();
|
|
|
130705
130626
|
|
|
130706
130627
|
// ../storage/src/project-writer.ts
|
|
130707
130628
|
init_meta_file();
|
|
130708
|
-
async function writeProject(
|
|
130629
|
+
async function writeProject(fs6, root2, opts) {
|
|
130709
130630
|
const { pathMap, manifest, remoteConfig, projectConfig, metaFiles, contents } = opts;
|
|
130710
|
-
await
|
|
130711
|
-
await
|
|
130712
|
-
await
|
|
130713
|
-
await
|
|
130714
|
-
await
|
|
130715
|
-
for (const [,
|
|
130716
|
-
if (
|
|
130717
|
-
}
|
|
130718
|
-
for (const [assetId,
|
|
130719
|
-
if (!
|
|
130631
|
+
await fs6.mkdir(`${root2}/.galacean`);
|
|
130632
|
+
await fs6.mkdir(`${root2}/.galacean/cache`);
|
|
130633
|
+
await fs6.writeFile(`${root2}/.galacean/manifest.json`, JSON.stringify(manifest, null, 2));
|
|
130634
|
+
await fs6.writeFile(`${root2}/.galacean/remote.json`, JSON.stringify(remoteConfig, null, 2));
|
|
130635
|
+
await fs6.writeFile(`${root2}/project.galacean`, JSON.stringify(projectConfig, null, 2));
|
|
130636
|
+
for (const [, entry] of pathMap) {
|
|
130637
|
+
if (entry.isFolder) await fs6.mkdir(`${root2}/${entry.localPath}`);
|
|
130638
|
+
}
|
|
130639
|
+
for (const [assetId, entry] of pathMap) {
|
|
130640
|
+
if (!entry.isFolder) {
|
|
130720
130641
|
const content = contents.get(assetId);
|
|
130721
|
-
if (content) await
|
|
130642
|
+
if (content) await fs6.writeFile(`${root2}/${entry.localPath}`, content);
|
|
130722
130643
|
}
|
|
130723
130644
|
const meta3 = metaFiles.get(assetId);
|
|
130724
|
-
if (meta3) await
|
|
130645
|
+
if (meta3) await fs6.writeFile(`${root2}/${metaFilePath(entry.localPath)}`, JSON.stringify(meta3, null, 2));
|
|
130725
130646
|
}
|
|
130726
130647
|
}
|
|
130727
130648
|
|
|
@@ -130729,9 +130650,9 @@ async function writeProject(fs5, root2, opts) {
|
|
|
130729
130650
|
init_local_project();
|
|
130730
130651
|
init_utils();
|
|
130731
130652
|
async function initProject(opts) {
|
|
130732
|
-
const { projectId, outputDir, apiClient, fs:
|
|
130653
|
+
const { projectId, outputDir, apiClient, fs: fs6, serverUrl = "", force = false } = opts;
|
|
130733
130654
|
if (!force) {
|
|
130734
|
-
await assertDirectoryEmpty(
|
|
130655
|
+
await assertDirectoryEmpty(fs6, outputDir);
|
|
130735
130656
|
}
|
|
130736
130657
|
const project = await apiClient.fetchProject(projectId);
|
|
130737
130658
|
let sceneId = "";
|
|
@@ -130745,7 +130666,35 @@ async function initProject(opts) {
|
|
|
130745
130666
|
console.warn("[init] Failed to parse project.content:", err);
|
|
130746
130667
|
}
|
|
130747
130668
|
}
|
|
130748
|
-
|
|
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
|
+
}
|
|
130749
130698
|
const pathMap = buildLocalPathMap(project.assets);
|
|
130750
130699
|
const contents = /* @__PURE__ */ new Map();
|
|
130751
130700
|
const hashes = /* @__PURE__ */ new Map();
|
|
@@ -130772,13 +130721,13 @@ async function initProject(opts) {
|
|
|
130772
130721
|
}
|
|
130773
130722
|
const manifest = generateManifest(pathMap, hashes);
|
|
130774
130723
|
const metaFiles = /* @__PURE__ */ new Map();
|
|
130775
|
-
for (const [id,
|
|
130776
|
-
metaFiles.set(id, generateMetaFile(
|
|
130724
|
+
for (const [id, entry] of pathMap) {
|
|
130725
|
+
metaFiles.set(id, generateMetaFile(entry));
|
|
130777
130726
|
}
|
|
130778
130727
|
if (force) {
|
|
130779
|
-
await resetManagedProjectPaths(
|
|
130728
|
+
await resetManagedProjectPaths(fs6, outputDir);
|
|
130780
130729
|
}
|
|
130781
|
-
await writeProject(
|
|
130730
|
+
await writeProject(fs6, outputDir, {
|
|
130782
130731
|
pathMap,
|
|
130783
130732
|
manifest,
|
|
130784
130733
|
remoteConfig: { projectId, serverUrl },
|
|
@@ -130804,9 +130753,9 @@ init_local_project();
|
|
|
130804
130753
|
init_path_case_guard();
|
|
130805
130754
|
init_utils();
|
|
130806
130755
|
var CONCURRENCY_LIMIT = 5;
|
|
130807
|
-
async function readManifest2(
|
|
130756
|
+
async function readManifest2(fs6, projectDir) {
|
|
130808
130757
|
const manifestPath = import_node_path5.default.resolve(projectDir, ".galacean/manifest.json");
|
|
130809
|
-
const raw = decodeUtf8(await
|
|
130758
|
+
const raw = decodeUtf8(await fs6.readFile(manifestPath));
|
|
130810
130759
|
let parsed;
|
|
130811
130760
|
try {
|
|
130812
130761
|
parsed = JSON.parse(raw);
|
|
@@ -130824,16 +130773,16 @@ function isPathUnderFolder(assetPath, folderPath) {
|
|
|
130824
130773
|
return normalizedAsset === normalizedFolder || normalizedAsset.startsWith(`${normalizedFolder}/`);
|
|
130825
130774
|
}
|
|
130826
130775
|
async function pullProject(opts) {
|
|
130827
|
-
const { projectDir, apiClient, fs:
|
|
130776
|
+
const { projectDir, apiClient, fs: fs6, signal, caseFoldGuards } = opts;
|
|
130828
130777
|
throwIfAborted(signal);
|
|
130829
|
-
const remote = await readRemoteConfig(
|
|
130830
|
-
const manifest = await readManifest2(
|
|
130778
|
+
const remote = await readRemoteConfig(fs6, projectDir);
|
|
130779
|
+
const manifest = await readManifest2(fs6, projectDir);
|
|
130831
130780
|
throwIfAborted(signal);
|
|
130832
130781
|
const project = await apiClient.fetchProject(remote.projectId, { signal });
|
|
130833
130782
|
const newPathMap = buildLocalPathMap(project.assets);
|
|
130834
130783
|
const useCaseFoldGuards = caseFoldGuards ?? await shouldUseCaseFoldGuards(projectDir);
|
|
130835
130784
|
if (useCaseFoldGuards) {
|
|
130836
|
-
const pathCollisions = findCaseFoldPathCollisions(Array.from(newPathMap.values(), (
|
|
130785
|
+
const pathCollisions = findCaseFoldPathCollisions(Array.from(newPathMap.values(), (entry) => entry.localPath));
|
|
130837
130786
|
if (pathCollisions.length > 0) {
|
|
130838
130787
|
const preview = formatConflictPreview(pathCollisions.map((item) => `${item.firstPath} <-> ${item.secondPath}`));
|
|
130839
130788
|
throw new Error(
|
|
@@ -130841,10 +130790,10 @@ async function pullProject(opts) {
|
|
|
130841
130790
|
);
|
|
130842
130791
|
}
|
|
130843
130792
|
}
|
|
130844
|
-
for (const [,
|
|
130845
|
-
if (!
|
|
130793
|
+
for (const [, entry] of newPathMap) {
|
|
130794
|
+
if (!entry.isFolder && entry.url?.startsWith("data:")) {
|
|
130846
130795
|
throw new Error(
|
|
130847
|
-
`[pull] Unexpected data: URL for asset '${
|
|
130796
|
+
`[pull] Unexpected data: URL for asset '${entry.assetId}' (path: ${entry.localPath}). Server should return http(s) URLs; data: URLs indicate a server-side issue.`
|
|
130848
130797
|
);
|
|
130849
130798
|
}
|
|
130850
130799
|
}
|
|
@@ -130900,12 +130849,12 @@ async function pullProject(opts) {
|
|
|
130900
130849
|
const foldersToDelete = toDelete.filter((e) => e.type === "Folder").sort((a, b) => b.path.split("/").length - a.path.split("/").length);
|
|
130901
130850
|
for (const local of filesToDelete) {
|
|
130902
130851
|
try {
|
|
130903
|
-
await
|
|
130852
|
+
await fs6.remove(import_node_path5.default.resolve(projectDir, local.path));
|
|
130904
130853
|
} catch (err) {
|
|
130905
130854
|
if (!isEnoent(err)) throw err;
|
|
130906
130855
|
}
|
|
130907
130856
|
try {
|
|
130908
|
-
await
|
|
130857
|
+
await fs6.remove(import_node_path5.default.resolve(projectDir, metaFilePath(local.path)));
|
|
130909
130858
|
} catch (err) {
|
|
130910
130859
|
if (!isEnoent(err)) throw err;
|
|
130911
130860
|
}
|
|
@@ -130913,14 +130862,14 @@ async function pullProject(opts) {
|
|
|
130913
130862
|
}
|
|
130914
130863
|
const movedResult = [];
|
|
130915
130864
|
const pullWarnings = [];
|
|
130916
|
-
const fileMoves = toMove.filter(({ entry
|
|
130917
|
-
const folderMoves = toMove.filter(({ entry
|
|
130865
|
+
const fileMoves = toMove.filter(({ entry }) => !entry.isFolder);
|
|
130866
|
+
const folderMoves = toMove.filter(({ entry }) => entry.isFolder);
|
|
130918
130867
|
if (useCaseFoldGuards) {
|
|
130919
130868
|
const moveConflicts = findCaseFoldMoveConflicts(
|
|
130920
|
-
fileMoves.map(({ entry
|
|
130921
|
-
assetId:
|
|
130869
|
+
fileMoves.map(({ entry, oldPath }) => ({
|
|
130870
|
+
assetId: entry.assetId,
|
|
130922
130871
|
oldPath,
|
|
130923
|
-
newPath:
|
|
130872
|
+
newPath: entry.localPath
|
|
130924
130873
|
}))
|
|
130925
130874
|
);
|
|
130926
130875
|
if (moveConflicts.length > 0) {
|
|
@@ -130932,22 +130881,22 @@ async function pullProject(opts) {
|
|
|
130932
130881
|
}
|
|
130933
130882
|
const preparedFileMoves = [];
|
|
130934
130883
|
const skippedFileMoveSourcePathSet = /* @__PURE__ */ new Set();
|
|
130935
|
-
for (const { entry
|
|
130884
|
+
for (const { entry, oldPath } of fileMoves) {
|
|
130936
130885
|
const oldAbs = import_node_path5.default.resolve(projectDir, oldPath);
|
|
130937
|
-
const newAbs = import_node_path5.default.resolve(projectDir,
|
|
130886
|
+
const newAbs = import_node_path5.default.resolve(projectDir, entry.localPath);
|
|
130938
130887
|
const isCaseOnlyRename = oldAbs.toLowerCase() === newAbs.toLowerCase() && oldAbs !== newAbs;
|
|
130939
130888
|
let content;
|
|
130940
130889
|
try {
|
|
130941
|
-
content = await
|
|
130890
|
+
content = await fs6.readFile(oldAbs);
|
|
130942
130891
|
} catch (err) {
|
|
130943
|
-
const warnMsg = `Skip move for ${oldPath} -> ${
|
|
130892
|
+
const warnMsg = `Skip move for ${oldPath} -> ${entry.localPath}: failed to read source file`;
|
|
130944
130893
|
console.warn(`[pull] ${warnMsg}`, err);
|
|
130945
130894
|
pullWarnings.push(warnMsg);
|
|
130946
130895
|
skippedFileMoveSourcePathSet.add(normalizePath(oldPath));
|
|
130947
130896
|
continue;
|
|
130948
130897
|
}
|
|
130949
130898
|
preparedFileMoves.push({
|
|
130950
|
-
entry
|
|
130899
|
+
entry,
|
|
130951
130900
|
oldPath,
|
|
130952
130901
|
oldAbs,
|
|
130953
130902
|
newAbs,
|
|
@@ -130968,41 +130917,41 @@ async function pullProject(opts) {
|
|
|
130968
130917
|
}
|
|
130969
130918
|
return !blockedByFolder;
|
|
130970
130919
|
});
|
|
130971
|
-
const activeFileMoveTargetPathSet = new Set(activeFileMoves.map(({ entry
|
|
130920
|
+
const activeFileMoveTargetPathSet = new Set(activeFileMoves.map(({ entry }) => normalizePath(entry.localPath)));
|
|
130972
130921
|
for (const move of activeFileMoves) {
|
|
130973
|
-
const { entry
|
|
130922
|
+
const { entry, oldPath, oldAbs, newAbs, isCaseOnlyRename, content } = move;
|
|
130974
130923
|
const parentDir = import_node_path5.default.dirname(newAbs);
|
|
130975
130924
|
try {
|
|
130976
|
-
await
|
|
130925
|
+
await fs6.mkdir(parentDir);
|
|
130977
130926
|
} catch {
|
|
130978
130927
|
}
|
|
130979
130928
|
if (isCaseOnlyRename) {
|
|
130980
130929
|
try {
|
|
130981
|
-
await
|
|
130930
|
+
await fs6.remove(oldAbs);
|
|
130982
130931
|
} catch (err) {
|
|
130983
130932
|
if (!isEnoent(err)) throw err;
|
|
130984
130933
|
}
|
|
130985
130934
|
try {
|
|
130986
|
-
await
|
|
130935
|
+
await fs6.remove(oldAbs + ".meta.json");
|
|
130987
130936
|
} catch (err) {
|
|
130988
130937
|
if (!isEnoent(err)) throw err;
|
|
130989
130938
|
}
|
|
130990
130939
|
}
|
|
130991
|
-
await
|
|
130992
|
-
await
|
|
130993
|
-
manifest.entries[
|
|
130994
|
-
assetId:
|
|
130995
|
-
path:
|
|
130996
|
-
type:
|
|
130997
|
-
contentHash: manifest.entries[
|
|
130998
|
-
remoteVersion:
|
|
130999
|
-
serverId:
|
|
131000
|
-
url:
|
|
130940
|
+
await fs6.writeFile(newAbs, content);
|
|
130941
|
+
await fs6.writeFile(newAbs + ".meta.json", JSON.stringify(generateMetaFile(entry), null, 2));
|
|
130942
|
+
manifest.entries[entry.assetId] = {
|
|
130943
|
+
assetId: entry.assetId,
|
|
130944
|
+
path: entry.localPath,
|
|
130945
|
+
type: entry.metaType,
|
|
130946
|
+
contentHash: manifest.entries[entry.assetId]?.contentHash ?? "",
|
|
130947
|
+
remoteVersion: entry.meta.version ?? "",
|
|
130948
|
+
serverId: entry.serverId,
|
|
130949
|
+
url: entry.url
|
|
131001
130950
|
};
|
|
131002
130951
|
movedResult.push({
|
|
131003
|
-
assetId:
|
|
130952
|
+
assetId: entry.assetId,
|
|
131004
130953
|
oldPath,
|
|
131005
|
-
path:
|
|
130954
|
+
path: entry.localPath
|
|
131006
130955
|
});
|
|
131007
130956
|
}
|
|
131008
130957
|
for (const move of activeFileMoves) {
|
|
@@ -131012,142 +130961,170 @@ async function pullProject(opts) {
|
|
|
131012
130961
|
continue;
|
|
131013
130962
|
}
|
|
131014
130963
|
try {
|
|
131015
|
-
await
|
|
130964
|
+
await fs6.remove(oldAbs);
|
|
131016
130965
|
} catch (err) {
|
|
131017
130966
|
if (!isEnoent(err)) throw err;
|
|
131018
130967
|
}
|
|
131019
130968
|
try {
|
|
131020
|
-
await
|
|
130969
|
+
await fs6.remove(oldAbs + ".meta.json");
|
|
131021
130970
|
} catch (err) {
|
|
131022
130971
|
if (!isEnoent(err)) throw err;
|
|
131023
130972
|
}
|
|
131024
130973
|
}
|
|
131025
130974
|
const activeFolderMoveTargetPathSet = new Set(
|
|
131026
|
-
folderMoves.filter(({ oldPath }) => !blockedFolderMoveOldPathSet.has(normalizePath(oldPath))).map(({ entry
|
|
130975
|
+
folderMoves.filter(({ oldPath }) => !blockedFolderMoveOldPathSet.has(normalizePath(oldPath))).map(({ entry }) => pathCompareKey(entry.localPath, useCaseFoldGuards))
|
|
131027
130976
|
);
|
|
131028
|
-
for (const { entry
|
|
130977
|
+
for (const { entry, oldPath } of folderMoves) {
|
|
131029
130978
|
const normalizedOldPath = normalizePath(oldPath);
|
|
131030
130979
|
if (blockedFolderMoveOldPathSet.has(normalizedOldPath)) {
|
|
131031
|
-
console.warn(`[pull] Skip folder move for ${oldPath} -> ${
|
|
130980
|
+
console.warn(`[pull] Skip folder move for ${oldPath} -> ${entry.localPath}: child file move source read failed`);
|
|
131032
130981
|
continue;
|
|
131033
130982
|
}
|
|
131034
130983
|
const oldAbs = import_node_path5.default.resolve(projectDir, oldPath);
|
|
131035
|
-
const newAbs = import_node_path5.default.resolve(projectDir,
|
|
130984
|
+
const newAbs = import_node_path5.default.resolve(projectDir, entry.localPath);
|
|
131036
130985
|
const isCaseOnlyRename = oldAbs.toLowerCase() === newAbs.toLowerCase() && oldAbs !== newAbs;
|
|
131037
130986
|
const oldPathReusedAsMoveTarget = activeFolderMoveTargetPathSet.has(pathCompareKey(oldPath, useCaseFoldGuards));
|
|
131038
130987
|
if (isCaseOnlyRename && useCaseFoldGuards) {
|
|
131039
|
-
if (
|
|
131040
|
-
await
|
|
130988
|
+
if (fs6.rename) {
|
|
130989
|
+
await fs6.rename(oldAbs, newAbs);
|
|
131041
130990
|
}
|
|
131042
130991
|
try {
|
|
131043
|
-
await
|
|
130992
|
+
await fs6.remove(oldAbs + ".meta.json");
|
|
131044
130993
|
} catch (err) {
|
|
131045
130994
|
if (!isEnoent(err)) throw err;
|
|
131046
130995
|
}
|
|
131047
130996
|
} else {
|
|
131048
130997
|
try {
|
|
131049
|
-
await
|
|
130998
|
+
await fs6.mkdir(newAbs);
|
|
131050
130999
|
} catch {
|
|
131051
131000
|
}
|
|
131052
131001
|
if (!oldPathReusedAsMoveTarget) {
|
|
131053
131002
|
try {
|
|
131054
|
-
await
|
|
131003
|
+
await fs6.remove(oldAbs);
|
|
131055
131004
|
} catch (err) {
|
|
131056
131005
|
if (!isEnoent(err)) throw err;
|
|
131057
131006
|
}
|
|
131058
131007
|
try {
|
|
131059
|
-
await
|
|
131008
|
+
await fs6.remove(oldAbs + ".meta.json");
|
|
131060
131009
|
} catch (err) {
|
|
131061
131010
|
if (!isEnoent(err)) throw err;
|
|
131062
131011
|
}
|
|
131063
131012
|
}
|
|
131064
131013
|
}
|
|
131065
|
-
await
|
|
131066
|
-
manifest.entries[
|
|
131067
|
-
assetId:
|
|
131068
|
-
path:
|
|
131069
|
-
type:
|
|
131070
|
-
contentHash: manifest.entries[
|
|
131071
|
-
remoteVersion:
|
|
131072
|
-
serverId:
|
|
131073
|
-
url:
|
|
131014
|
+
await fs6.writeFile(newAbs + ".meta.json", JSON.stringify(generateMetaFile(entry), null, 2));
|
|
131015
|
+
manifest.entries[entry.assetId] = {
|
|
131016
|
+
assetId: entry.assetId,
|
|
131017
|
+
path: entry.localPath,
|
|
131018
|
+
type: entry.metaType,
|
|
131019
|
+
contentHash: manifest.entries[entry.assetId]?.contentHash ?? "",
|
|
131020
|
+
remoteVersion: entry.meta.version ?? "",
|
|
131021
|
+
serverId: entry.serverId,
|
|
131022
|
+
url: entry.url
|
|
131074
131023
|
};
|
|
131075
131024
|
movedResult.push({
|
|
131076
|
-
assetId:
|
|
131025
|
+
assetId: entry.assetId,
|
|
131077
131026
|
oldPath,
|
|
131078
|
-
path:
|
|
131027
|
+
path: entry.localPath
|
|
131079
131028
|
});
|
|
131080
131029
|
}
|
|
131081
131030
|
for (const local of foldersToDelete) {
|
|
131082
131031
|
try {
|
|
131083
|
-
await
|
|
131032
|
+
await fs6.remove(import_node_path5.default.resolve(projectDir, local.path));
|
|
131084
131033
|
} catch (err) {
|
|
131085
131034
|
if (!isEnoent(err)) throw err;
|
|
131086
131035
|
}
|
|
131087
131036
|
try {
|
|
131088
|
-
await
|
|
131037
|
+
await fs6.remove(import_node_path5.default.resolve(projectDir, metaFilePath(local.path)));
|
|
131089
131038
|
} catch (err) {
|
|
131090
131039
|
if (!isEnoent(err)) throw err;
|
|
131091
131040
|
}
|
|
131092
131041
|
delete manifest.entries[local.assetId];
|
|
131093
131042
|
}
|
|
131094
131043
|
const addedFolders = toAdd.filter((e) => e.isFolder).sort((a, b) => a.localPath.split("/").length - b.localPath.split("/").length);
|
|
131095
|
-
for (const
|
|
131096
|
-
await
|
|
131097
|
-
await
|
|
131098
|
-
import_node_path5.default.resolve(projectDir,
|
|
131099
|
-
JSON.stringify(generateMetaFile(
|
|
131044
|
+
for (const entry of addedFolders) {
|
|
131045
|
+
await fs6.mkdir(import_node_path5.default.resolve(projectDir, entry.localPath));
|
|
131046
|
+
await fs6.writeFile(
|
|
131047
|
+
import_node_path5.default.resolve(projectDir, entry.localPath) + ".meta.json",
|
|
131048
|
+
JSON.stringify(generateMetaFile(entry), null, 2)
|
|
131100
131049
|
);
|
|
131101
|
-
manifest.entries[
|
|
131102
|
-
assetId:
|
|
131103
|
-
path:
|
|
131104
|
-
type:
|
|
131050
|
+
manifest.entries[entry.assetId] = {
|
|
131051
|
+
assetId: entry.assetId,
|
|
131052
|
+
path: entry.localPath,
|
|
131053
|
+
type: entry.metaType,
|
|
131105
131054
|
contentHash: "",
|
|
131106
|
-
remoteVersion:
|
|
131107
|
-
serverId:
|
|
131108
|
-
url:
|
|
131055
|
+
remoteVersion: entry.meta.version ?? "",
|
|
131056
|
+
serverId: entry.serverId,
|
|
131057
|
+
url: entry.url
|
|
131109
131058
|
};
|
|
131110
131059
|
}
|
|
131111
131060
|
const addedResult = [];
|
|
131112
|
-
for (const
|
|
131113
|
-
const abs = import_node_path5.default.resolve(projectDir,
|
|
131114
|
-
const content = downloadedContent.get(
|
|
131115
|
-
if (content !== void 0) await
|
|
131116
|
-
await
|
|
131117
|
-
manifest.entries[
|
|
131118
|
-
assetId:
|
|
131119
|
-
path:
|
|
131120
|
-
type:
|
|
131121
|
-
contentHash: downloadedHash.get(
|
|
131122
|
-
remoteVersion:
|
|
131123
|
-
serverId:
|
|
131124
|
-
url:
|
|
131125
|
-
};
|
|
131126
|
-
addedResult.push({ assetId:
|
|
131061
|
+
for (const entry of toAdd.filter((e) => !e.isFolder)) {
|
|
131062
|
+
const abs = import_node_path5.default.resolve(projectDir, entry.localPath);
|
|
131063
|
+
const content = downloadedContent.get(entry.assetId);
|
|
131064
|
+
if (content !== void 0) await fs6.writeFile(abs, content);
|
|
131065
|
+
await fs6.writeFile(abs + ".meta.json", JSON.stringify(generateMetaFile(entry), null, 2));
|
|
131066
|
+
manifest.entries[entry.assetId] = {
|
|
131067
|
+
assetId: entry.assetId,
|
|
131068
|
+
path: entry.localPath,
|
|
131069
|
+
type: entry.metaType,
|
|
131070
|
+
contentHash: downloadedHash.get(entry.assetId) ?? "",
|
|
131071
|
+
remoteVersion: entry.meta.version ?? "",
|
|
131072
|
+
serverId: entry.serverId,
|
|
131073
|
+
url: entry.url
|
|
131074
|
+
};
|
|
131075
|
+
addedResult.push({ assetId: entry.assetId, path: entry.localPath });
|
|
131127
131076
|
}
|
|
131128
131077
|
const updatedResult = [];
|
|
131129
|
-
for (const
|
|
131130
|
-
const abs = import_node_path5.default.resolve(projectDir,
|
|
131131
|
-
const content = downloadedContent.get(
|
|
131132
|
-
if (content !== void 0) await
|
|
131133
|
-
await
|
|
131134
|
-
manifest.entries[
|
|
131135
|
-
...manifest.entries[
|
|
131136
|
-
contentHash: downloadedHash.get(
|
|
131137
|
-
remoteVersion:
|
|
131138
|
-
serverId:
|
|
131139
|
-
url:
|
|
131140
|
-
};
|
|
131141
|
-
updatedResult.push({ assetId:
|
|
131142
|
-
}
|
|
131143
|
-
await atomicWriteFile(
|
|
131078
|
+
for (const entry of toUpdate) {
|
|
131079
|
+
const abs = import_node_path5.default.resolve(projectDir, entry.localPath);
|
|
131080
|
+
const content = downloadedContent.get(entry.assetId);
|
|
131081
|
+
if (content !== void 0) await fs6.writeFile(abs, content);
|
|
131082
|
+
await fs6.writeFile(abs + ".meta.json", JSON.stringify(generateMetaFile(entry), null, 2));
|
|
131083
|
+
manifest.entries[entry.assetId] = {
|
|
131084
|
+
...manifest.entries[entry.assetId],
|
|
131085
|
+
contentHash: downloadedHash.get(entry.assetId) ?? manifest.entries[entry.assetId]?.contentHash ?? "",
|
|
131086
|
+
remoteVersion: entry.meta.version ?? "",
|
|
131087
|
+
serverId: entry.serverId,
|
|
131088
|
+
url: entry.url
|
|
131089
|
+
};
|
|
131090
|
+
updatedResult.push({ assetId: entry.assetId, path: entry.localPath });
|
|
131091
|
+
}
|
|
131092
|
+
await atomicWriteFile(fs6, import_node_path5.default.resolve(projectDir, ".galacean/manifest.json"), JSON.stringify(manifest, null, 2));
|
|
131144
131093
|
let sceneId = "";
|
|
131145
131094
|
if (project.content && typeof project.content === "object") {
|
|
131146
131095
|
sceneId = project.content.scene ?? "";
|
|
131147
131096
|
}
|
|
131148
|
-
|
|
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
|
+
}
|
|
131149
131126
|
await atomicWriteFile(
|
|
131150
|
-
|
|
131127
|
+
fs6,
|
|
131151
131128
|
import_node_path5.default.resolve(projectDir, "project.galacean"),
|
|
131152
131129
|
JSON.stringify(
|
|
131153
131130
|
{
|
|
@@ -131171,7 +131148,7 @@ async function pullProject(opts) {
|
|
|
131171
131148
|
}
|
|
131172
131149
|
|
|
131173
131150
|
// src/commands/push/push-project.ts
|
|
131174
|
-
var
|
|
131151
|
+
var import_node_crypto2 = require("node:crypto");
|
|
131175
131152
|
var import_node_path8 = __toESM(require("node:path"));
|
|
131176
131153
|
init_hash();
|
|
131177
131154
|
init_fs();
|
|
@@ -131281,7 +131258,7 @@ var BUILTIN_REMOTE_ASSETS = [
|
|
|
131281
131258
|
{
|
|
131282
131259
|
id: "",
|
|
131283
131260
|
uuid: "ff6b0f7b-8927-4de9-8d62-c2ca147bc4a3",
|
|
131284
|
-
name: "
|
|
131261
|
+
name: "DigtalHuman",
|
|
131285
131262
|
type: 1,
|
|
131286
131263
|
parentId: "0000006",
|
|
131287
131264
|
meta: '{"type":"Folder","id":"ff6b0f7b-8927-4de9-8d62-c2ca147bc4a3","version":"1.0.1"}',
|
|
@@ -131755,7 +131732,7 @@ function areStringRecordEqual(a, b) {
|
|
|
131755
131732
|
}
|
|
131756
131733
|
function resolveProjectSceneId(projectConfig, manifest) {
|
|
131757
131734
|
const configuredSceneId = typeof projectConfig.sceneId === "string" ? projectConfig.sceneId : "";
|
|
131758
|
-
const sceneAssetIds = Object.entries(manifest.entries).filter(([,
|
|
131735
|
+
const sceneAssetIds = Object.entries(manifest.entries).filter(([, entry]) => entry.type === "Scene").map(([assetId]) => assetId);
|
|
131759
131736
|
if (configuredSceneId) {
|
|
131760
131737
|
if (manifest.entries[configuredSceneId]?.type === "Scene") return configuredSceneId;
|
|
131761
131738
|
if (Object.keys(manifest.entries).length === 0) return configuredSceneId;
|
|
@@ -131780,33 +131757,33 @@ function isPathInsideFolder(childPath, folderPath) {
|
|
|
131780
131757
|
const normalizedFolder = folderPath.replaceAll("\\", "/").replace(/\/+$/, "");
|
|
131781
131758
|
return normalizedChild.startsWith(`${normalizedFolder}/`);
|
|
131782
131759
|
}
|
|
131783
|
-
function shouldTreatMissingLocalFileAsDelete(
|
|
131784
|
-
if (!
|
|
131785
|
-
if (
|
|
131786
|
-
if (typeof
|
|
131760
|
+
function shouldTreatMissingLocalFileAsDelete(entry) {
|
|
131761
|
+
if (!entry.serverId || entry.serverId.startsWith("local-")) return true;
|
|
131762
|
+
if (entry.contentHash) return true;
|
|
131763
|
+
if (typeof entry.url === "string" && entry.url.length > 0) return false;
|
|
131787
131764
|
return true;
|
|
131788
131765
|
}
|
|
131789
131766
|
function hasMaterializedDescendant(manifestEntries, folderPath) {
|
|
131790
|
-
for (const
|
|
131791
|
-
if (!isPathInsideFolder(
|
|
131792
|
-
if (
|
|
131767
|
+
for (const entry of Object.values(manifestEntries)) {
|
|
131768
|
+
if (!isPathInsideFolder(entry.path, folderPath)) continue;
|
|
131769
|
+
if (entry.contentHash) return true;
|
|
131793
131770
|
}
|
|
131794
131771
|
return false;
|
|
131795
131772
|
}
|
|
131796
131773
|
function hasRemoteOnlyDescendant(manifestEntries, folderPath) {
|
|
131797
|
-
for (const
|
|
131798
|
-
if (
|
|
131799
|
-
if (!isPathInsideFolder(
|
|
131800
|
-
if (!shouldTreatMissingLocalFileAsDelete(
|
|
131774
|
+
for (const entry of Object.values(manifestEntries)) {
|
|
131775
|
+
if (entry.type === "Folder") continue;
|
|
131776
|
+
if (!isPathInsideFolder(entry.path, folderPath)) continue;
|
|
131777
|
+
if (!shouldTreatMissingLocalFileAsDelete(entry)) return true;
|
|
131801
131778
|
}
|
|
131802
131779
|
return false;
|
|
131803
131780
|
}
|
|
131804
131781
|
|
|
131805
131782
|
// src/commands/push/io.ts
|
|
131806
|
-
async function assertNoCaseOnlyPathCoexistence(
|
|
131783
|
+
async function assertNoCaseOnlyPathCoexistence(fs6, projectDir, manifestEntries, localDirs, localFiles, manifestEntryByPath) {
|
|
131807
131784
|
const manifestByLowerPath = /* @__PURE__ */ new Map();
|
|
131808
|
-
for (const [assetId,
|
|
131809
|
-
const normalizedPath = normalizePath(
|
|
131785
|
+
for (const [assetId, entry] of Object.entries(manifestEntries)) {
|
|
131786
|
+
const normalizedPath = normalizePath(entry.path);
|
|
131810
131787
|
const lowerPath = normalizePathLower(normalizedPath);
|
|
131811
131788
|
const existing = manifestByLowerPath.get(lowerPath);
|
|
131812
131789
|
if (existing && existing.assetId !== assetId && existing.path !== normalizedPath) {
|
|
@@ -131814,7 +131791,7 @@ async function assertNoCaseOnlyPathCoexistence(fs5, projectDir, manifestEntries,
|
|
|
131814
131791
|
`[push] Manifest has case-colliding paths: '${existing.path}' and '${normalizedPath}'. Keep only one path and retry.`
|
|
131815
131792
|
);
|
|
131816
131793
|
}
|
|
131817
|
-
manifestByLowerPath.set(lowerPath, { assetId, path: normalizedPath, type:
|
|
131794
|
+
manifestByLowerPath.set(lowerPath, { assetId, path: normalizedPath, type: entry.type });
|
|
131818
131795
|
}
|
|
131819
131796
|
const localDirSet = new Set(localDirs.map((p) => normalizePath(p)));
|
|
131820
131797
|
const localFileSet = new Set(localFiles.map((p) => normalizePath(p)));
|
|
@@ -131838,7 +131815,7 @@ async function assertNoCaseOnlyPathCoexistence(fs5, projectDir, manifestEntries,
|
|
|
131838
131815
|
continue;
|
|
131839
131816
|
}
|
|
131840
131817
|
if (localFileSet.has(localPath) && matched.type !== "Folder" && !localFileSet.has(matched.path)) {
|
|
131841
|
-
const localMeta = await readMetaFileIfExists(
|
|
131818
|
+
const localMeta = await readMetaFileIfExists(fs6, import_node_path7.default.resolve(projectDir, localPath)) ?? {};
|
|
131842
131819
|
const persistedId = resolvePersistedId(localMeta);
|
|
131843
131820
|
if (persistedId && persistedId === matched.assetId) {
|
|
131844
131821
|
continue;
|
|
@@ -131849,10 +131826,10 @@ async function assertNoCaseOnlyPathCoexistence(fs5, projectDir, manifestEntries,
|
|
|
131849
131826
|
);
|
|
131850
131827
|
}
|
|
131851
131828
|
}
|
|
131852
|
-
async function readEngineVersion(
|
|
131829
|
+
async function readEngineVersion(fs6, projectDir) {
|
|
131853
131830
|
const projectPath = import_node_path7.default.resolve(projectDir, "project.galacean");
|
|
131854
131831
|
try {
|
|
131855
|
-
const raw = decodeUtf8(await
|
|
131832
|
+
const raw = decodeUtf8(await fs6.readFile(projectPath));
|
|
131856
131833
|
const parsed = parseJsonObjectOrThrow(raw, projectPath);
|
|
131857
131834
|
const engineVersion = parsed.engineVersion;
|
|
131858
131835
|
return typeof engineVersion === "string" && engineVersion.length > 0 ? engineVersion : void 0;
|
|
@@ -131861,17 +131838,17 @@ async function readEngineVersion(fs5, projectDir) {
|
|
|
131861
131838
|
throw error49;
|
|
131862
131839
|
}
|
|
131863
131840
|
}
|
|
131864
|
-
async function readProjectConfig2(
|
|
131841
|
+
async function readProjectConfig2(fs6, projectDir) {
|
|
131865
131842
|
const projectPath = import_node_path7.default.resolve(projectDir, "project.galacean");
|
|
131866
131843
|
try {
|
|
131867
|
-
const raw = decodeUtf8(await
|
|
131844
|
+
const raw = decodeUtf8(await fs6.readFile(projectPath));
|
|
131868
131845
|
return parseJsonObjectOrThrow(raw, projectPath);
|
|
131869
131846
|
} catch (error49) {
|
|
131870
131847
|
if (isEnoent(error49)) return {};
|
|
131871
131848
|
throw error49;
|
|
131872
131849
|
}
|
|
131873
131850
|
}
|
|
131874
|
-
async function autoCreateRemoteProject(
|
|
131851
|
+
async function autoCreateRemoteProject(fs6, projectDir, opts, projectConfig, resolvedSceneId) {
|
|
131875
131852
|
const { serverUrl, apiClient } = opts;
|
|
131876
131853
|
if (!serverUrl || !apiClient) {
|
|
131877
131854
|
throw new Error("No remote.json found. To auto-create, provide --serverUrl and --token.");
|
|
@@ -131900,7 +131877,7 @@ async function autoCreateRemoteProject(fs5, projectDir, opts, projectConfig, res
|
|
|
131900
131877
|
const remoteConfig = { projectId, serverUrl };
|
|
131901
131878
|
throwIfAborted(opts.signal);
|
|
131902
131879
|
const remotePath = import_node_path7.default.resolve(projectDir, ".galacean/remote.json");
|
|
131903
|
-
await
|
|
131880
|
+
await fs6.writeFile(remotePath, JSON.stringify(remoteConfig, null, 2));
|
|
131904
131881
|
return remoteConfig;
|
|
131905
131882
|
}
|
|
131906
131883
|
async function syncRemoteProjectMetadata(apiClient, projectId, localConfig, resolvedSceneId, remoteProject, signal) {
|
|
@@ -131927,31 +131904,31 @@ async function syncRemoteProjectMetadata(apiClient, projectId, localConfig, reso
|
|
|
131927
131904
|
await apiClient.updateProjectSchema(projectId, { scene: localSceneId }, { signal });
|
|
131928
131905
|
}
|
|
131929
131906
|
}
|
|
131930
|
-
async function listFilesAndDirs(
|
|
131907
|
+
async function listFilesAndDirs(fs6, root2) {
|
|
131931
131908
|
const files = [];
|
|
131932
131909
|
const dirs = [];
|
|
131933
131910
|
const stack = [root2];
|
|
131934
131911
|
while (stack.length) {
|
|
131935
131912
|
const current = stack.pop();
|
|
131936
|
-
const entries = await
|
|
131937
|
-
for (const
|
|
131938
|
-
if (isIgnoredLocalEntryName(
|
|
131939
|
-
const fullPath = import_node_path7.default.join(current,
|
|
131940
|
-
if (
|
|
131913
|
+
const entries = await fs6.readdir(current);
|
|
131914
|
+
for (const entry of entries) {
|
|
131915
|
+
if (isIgnoredLocalEntryName(entry.name)) continue;
|
|
131916
|
+
const fullPath = import_node_path7.default.join(current, entry.name);
|
|
131917
|
+
if (entry.kind === "directory") {
|
|
131941
131918
|
if (fullPath !== root2) dirs.push(fullPath);
|
|
131942
131919
|
stack.push(fullPath);
|
|
131943
131920
|
} else {
|
|
131944
|
-
if (
|
|
131921
|
+
if (entry.name.endsWith(".meta.json")) continue;
|
|
131945
131922
|
files.push(fullPath);
|
|
131946
131923
|
}
|
|
131947
131924
|
}
|
|
131948
131925
|
}
|
|
131949
131926
|
return { files, dirs };
|
|
131950
131927
|
}
|
|
131951
|
-
async function readMetaFileIfExists(
|
|
131928
|
+
async function readMetaFileIfExists(fs6, absContentPath) {
|
|
131952
131929
|
const p = metaFilePath(absContentPath);
|
|
131953
131930
|
try {
|
|
131954
|
-
const raw = decodeUtf8(await
|
|
131931
|
+
const raw = decodeUtf8(await fs6.readFile(p));
|
|
131955
131932
|
return safeParseJsonObject(raw);
|
|
131956
131933
|
} catch (err) {
|
|
131957
131934
|
if (!isEnoent(err)) {
|
|
@@ -131960,7 +131937,7 @@ async function readMetaFileIfExists(fs5, absContentPath) {
|
|
|
131960
131937
|
return void 0;
|
|
131961
131938
|
}
|
|
131962
131939
|
}
|
|
131963
|
-
async function writeMetaFile(
|
|
131940
|
+
async function writeMetaFile(fs6, absContentPath, meta3, assetId, serverId, metaType) {
|
|
131964
131941
|
const p = metaFilePath(absContentPath);
|
|
131965
131942
|
const { locked: _locked, ...restMeta } = meta3;
|
|
131966
131943
|
const merged = {
|
|
@@ -131969,17 +131946,17 @@ async function writeMetaFile(fs5, absContentPath, meta3, assetId, serverId, meta
|
|
|
131969
131946
|
assetId,
|
|
131970
131947
|
serverId
|
|
131971
131948
|
};
|
|
131972
|
-
await
|
|
131949
|
+
await fs6.writeFile(p, JSON.stringify(merged, null, 2));
|
|
131973
131950
|
}
|
|
131974
131951
|
|
|
131975
131952
|
// src/commands/push/push-project.ts
|
|
131976
131953
|
async function pushProject(opts) {
|
|
131977
|
-
const { projectDir, apiClient, fs:
|
|
131954
|
+
const { projectDir, apiClient, fs: fs6, signal } = opts;
|
|
131978
131955
|
throwIfAborted(signal);
|
|
131979
131956
|
const manifestPath = import_node_path8.default.resolve(projectDir, ".galacean/manifest.json");
|
|
131980
|
-
const manifestRaw = await
|
|
131957
|
+
const manifestRaw = await fs6.readFile(manifestPath);
|
|
131981
131958
|
const manifest = parseManifest(manifestRaw, manifestPath);
|
|
131982
|
-
const projectConfig = await readProjectConfig2(
|
|
131959
|
+
const projectConfig = await readProjectConfig2(fs6, projectDir);
|
|
131983
131960
|
const resolvedProjectSceneId = resolveProjectSceneId(projectConfig, manifest);
|
|
131984
131961
|
const pushed = [];
|
|
131985
131962
|
const deleted = [];
|
|
@@ -131988,32 +131965,32 @@ async function pushProject(opts) {
|
|
|
131988
131965
|
try {
|
|
131989
131966
|
const assetsRoot = import_node_path8.default.resolve(projectDir, "assets");
|
|
131990
131967
|
throwIfAborted(signal);
|
|
131991
|
-
const { files: localFilesAbs, dirs: localDirsAbs } = await listFilesAndDirs(
|
|
131968
|
+
const { files: localFilesAbs, dirs: localDirsAbs } = await listFilesAndDirs(fs6, assetsRoot);
|
|
131992
131969
|
const manifestEntryByPath = /* @__PURE__ */ new Map();
|
|
131993
131970
|
const folderIdByPath = /* @__PURE__ */ new Map();
|
|
131994
|
-
for (const [assetId,
|
|
131995
|
-
manifestEntryByPath.set(
|
|
131996
|
-
if (
|
|
131971
|
+
for (const [assetId, entry] of Object.entries(manifest.entries)) {
|
|
131972
|
+
manifestEntryByPath.set(entry.path, { assetId, entry });
|
|
131973
|
+
if (entry.type === "Folder") folderIdByPath.set(entry.path, assetId);
|
|
131997
131974
|
}
|
|
131998
131975
|
const localDirs = localDirsAbs.map((abs) => toManifestPath(projectDir, abs)).filter((p) => p !== "assets");
|
|
131999
131976
|
const localFiles = localFilesAbs.map((abs) => toManifestPath(projectDir, abs));
|
|
132000
|
-
await assertNoCaseOnlyPathCoexistence(
|
|
131977
|
+
await assertNoCaseOnlyPathCoexistence(fs6, projectDir, manifest.entries, localDirs, localFiles, manifestEntryByPath);
|
|
132001
131978
|
const newFolderPaths = localDirs.filter((p) => !manifestEntryByPath.has(p));
|
|
132002
131979
|
const newFilePaths = localFiles.filter((p) => !manifestEntryByPath.has(p));
|
|
132003
131980
|
const localDirSet = new Set(localDirs);
|
|
132004
131981
|
const localFileSet = new Set(localFiles);
|
|
132005
131982
|
const folderCaseRenameMap = /* @__PURE__ */ new Map();
|
|
132006
131983
|
const manifestFolderByLowerPath = /* @__PURE__ */ new Map();
|
|
132007
|
-
for (const [assetId,
|
|
132008
|
-
if (
|
|
132009
|
-
const lowerPath = normalizePathLower(
|
|
131984
|
+
for (const [assetId, entry] of Object.entries(manifest.entries)) {
|
|
131985
|
+
if (entry.type !== "Folder") continue;
|
|
131986
|
+
const lowerPath = normalizePathLower(entry.path);
|
|
132010
131987
|
const existing = manifestFolderByLowerPath.get(lowerPath);
|
|
132011
131988
|
if (existing && existing.assetId !== assetId) {
|
|
132012
131989
|
throw new Error(
|
|
132013
|
-
`[push] Manifest has case-colliding folder paths: '${existing.path}' and '${
|
|
131990
|
+
`[push] Manifest has case-colliding folder paths: '${existing.path}' and '${entry.path}'. Keep only one path and retry.`
|
|
132014
131991
|
);
|
|
132015
131992
|
}
|
|
132016
|
-
manifestFolderByLowerPath.set(lowerPath, { assetId, path:
|
|
131993
|
+
manifestFolderByLowerPath.set(lowerPath, { assetId, path: entry.path });
|
|
132017
131994
|
}
|
|
132018
131995
|
for (const folderPath of newFolderPaths) {
|
|
132019
131996
|
const matched = manifestFolderByLowerPath.get(normalizePathLower(folderPath));
|
|
@@ -132030,7 +132007,7 @@ async function pushProject(opts) {
|
|
|
132030
132007
|
const effectiveNewFolderPaths = newFolderPaths;
|
|
132031
132008
|
let remote = null;
|
|
132032
132009
|
try {
|
|
132033
|
-
remote = await readRemoteConfig(
|
|
132010
|
+
remote = await readRemoteConfig(fs6, projectDir);
|
|
132034
132011
|
} catch (err) {
|
|
132035
132012
|
if (!isEnoent(err)) throw err;
|
|
132036
132013
|
}
|
|
@@ -132038,12 +132015,12 @@ async function pushProject(opts) {
|
|
|
132038
132015
|
const backup = new Map(
|
|
132039
132016
|
Object.entries(manifest.entries).map(([id, e]) => [id, { serverId: e.serverId, contentHash: e.contentHash }])
|
|
132040
132017
|
);
|
|
132041
|
-
for (const
|
|
132042
|
-
|
|
132043
|
-
|
|
132018
|
+
for (const entry of Object.values(manifest.entries)) {
|
|
132019
|
+
entry.serverId = "";
|
|
132020
|
+
entry.contentHash = "";
|
|
132044
132021
|
}
|
|
132045
132022
|
try {
|
|
132046
|
-
remote = await autoCreateRemoteProject(
|
|
132023
|
+
remote = await autoCreateRemoteProject(fs6, projectDir, opts, projectConfig, resolvedProjectSceneId);
|
|
132047
132024
|
} catch (err) {
|
|
132048
132025
|
for (const [id, orig] of backup) {
|
|
132049
132026
|
if (manifest.entries[id]) {
|
|
@@ -132051,15 +132028,10 @@ async function pushProject(opts) {
|
|
|
132051
132028
|
manifest.entries[id].contentHash = orig.contentHash;
|
|
132052
132029
|
}
|
|
132053
132030
|
}
|
|
132054
|
-
const remotePath = import_node_path8.default.resolve(projectDir, ".galacean/remote.json");
|
|
132055
|
-
try {
|
|
132056
|
-
await fs5.remove(remotePath);
|
|
132057
|
-
} catch {
|
|
132058
|
-
}
|
|
132059
132031
|
throw err;
|
|
132060
132032
|
}
|
|
132061
132033
|
}
|
|
132062
|
-
const engineVersion = await readEngineVersion(
|
|
132034
|
+
const engineVersion = await readEngineVersion(fs6, projectDir);
|
|
132063
132035
|
const existingServerAssets = /* @__PURE__ */ new Map();
|
|
132064
132036
|
const serverAssetDetails = [];
|
|
132065
132037
|
let remoteProjectDetail = null;
|
|
@@ -132076,54 +132048,54 @@ async function pushProject(opts) {
|
|
|
132076
132048
|
}
|
|
132077
132049
|
}
|
|
132078
132050
|
const unregisteredBuiltins = [];
|
|
132079
|
-
for (const [assetId,
|
|
132080
|
-
const isUnregistered = !
|
|
132081
|
-
const isFolderOrCdn =
|
|
132051
|
+
for (const [assetId, entry] of Object.entries(manifest.entries)) {
|
|
132052
|
+
const isUnregistered = !entry.serverId || entry.serverId.startsWith("local-");
|
|
132053
|
+
const isFolderOrCdn = entry.type === "Folder" || entry.url?.startsWith("http");
|
|
132082
132054
|
if (!isUnregistered || !isFolderOrCdn) continue;
|
|
132083
|
-
if (
|
|
132084
|
-
if (localDirSet.has(
|
|
132085
|
-
unregisteredBuiltins.push([assetId,
|
|
132055
|
+
if (entry.type === "Folder") {
|
|
132056
|
+
if (localDirSet.has(entry.path) || isBuiltinFolderAssetId(assetId)) {
|
|
132057
|
+
unregisteredBuiltins.push([assetId, entry]);
|
|
132086
132058
|
continue;
|
|
132087
132059
|
}
|
|
132088
|
-
const folderMeta = await readMetaFileIfExists(
|
|
132060
|
+
const folderMeta = await readMetaFileIfExists(fs6, import_node_path8.default.resolve(projectDir, entry.path));
|
|
132089
132061
|
if (folderMeta) {
|
|
132090
|
-
unregisteredBuiltins.push([assetId,
|
|
132062
|
+
unregisteredBuiltins.push([assetId, entry]);
|
|
132091
132063
|
}
|
|
132092
132064
|
continue;
|
|
132093
132065
|
}
|
|
132094
|
-
if (localFileSet.has(
|
|
132095
|
-
unregisteredBuiltins.push([assetId,
|
|
132066
|
+
if (localFileSet.has(entry.path) || isBuiltinAssetId(assetId)) {
|
|
132067
|
+
unregisteredBuiltins.push([assetId, entry]);
|
|
132096
132068
|
continue;
|
|
132097
132069
|
}
|
|
132098
|
-
const fileMeta = await readMetaFileIfExists(
|
|
132070
|
+
const fileMeta = await readMetaFileIfExists(fs6, import_node_path8.default.resolve(projectDir, entry.path));
|
|
132099
132071
|
if (fileMeta) {
|
|
132100
|
-
unregisteredBuiltins.push([assetId,
|
|
132072
|
+
unregisteredBuiltins.push([assetId, entry]);
|
|
132101
132073
|
}
|
|
132102
132074
|
}
|
|
132103
132075
|
if (unregisteredBuiltins.length > 0) {
|
|
132104
132076
|
if (!remote) {
|
|
132105
|
-
remote = await autoCreateRemoteProject(
|
|
132077
|
+
remote = await autoCreateRemoteProject(fs6, projectDir, opts, projectConfig, resolvedProjectSceneId);
|
|
132106
132078
|
}
|
|
132107
132079
|
const builtinFolders = unregisteredBuiltins.filter(([_24, e]) => e.type === "Folder").sort(([, a], [, b]) => a.path.split("/").length - b.path.split("/").length);
|
|
132108
132080
|
const builtinFiles = unregisteredBuiltins.filter(([_24, e]) => e.type !== "Folder");
|
|
132109
|
-
for (const [assetId,
|
|
132081
|
+
for (const [assetId, entry] of [...builtinFolders, ...builtinFiles]) {
|
|
132110
132082
|
throwIfAborted(signal);
|
|
132111
|
-
const absPath = import_node_path8.default.resolve(projectDir,
|
|
132112
|
-
const existingMeta = await readMetaFileIfExists(
|
|
132083
|
+
const absPath = import_node_path8.default.resolve(projectDir, entry.path);
|
|
132084
|
+
const existingMeta = await readMetaFileIfExists(fs6, absPath) ?? {};
|
|
132113
132085
|
const existingId = existingServerAssets.get(assetId);
|
|
132114
132086
|
if (existingId) {
|
|
132115
|
-
|
|
132116
|
-
await writeMetaFile(
|
|
132087
|
+
entry.serverId = existingId;
|
|
132088
|
+
await writeMetaFile(fs6, absPath, existingMeta, assetId, existingId, entry.type);
|
|
132117
132089
|
continue;
|
|
132118
132090
|
}
|
|
132119
|
-
const parentId = resolveParentId(import_node_path8.default.posix.dirname(
|
|
132120
|
-
const serverName = getServerFileName(
|
|
132091
|
+
const parentId = resolveParentId(import_node_path8.default.posix.dirname(entry.path), folderIdByPath, entry.path);
|
|
132092
|
+
const serverName = getServerFileName(entry.path, entry.type);
|
|
132121
132093
|
const lockedFromMeta = existingMeta.locked;
|
|
132122
132094
|
const shouldForceLocked = isBuiltinAssetId(assetId);
|
|
132123
132095
|
const lockedForServer = shouldForceLocked ? true : typeof lockedFromMeta === "boolean" ? lockedFromMeta : void 0;
|
|
132124
132096
|
const metaForServer = {
|
|
132125
132097
|
...stripLocalMetaFields(existingMeta),
|
|
132126
|
-
type:
|
|
132098
|
+
type: entry.type,
|
|
132127
132099
|
id: assetId,
|
|
132128
132100
|
version: existingMeta.version || engineVersion,
|
|
132129
132101
|
...lockedForServer === void 0 ? {} : { locked: lockedForServer }
|
|
@@ -132135,12 +132107,12 @@ async function pushProject(opts) {
|
|
|
132135
132107
|
name: serverName,
|
|
132136
132108
|
meta: JSON.stringify(metaForServer),
|
|
132137
132109
|
parentId,
|
|
132138
|
-
url:
|
|
132110
|
+
url: entry.type !== "Folder" ? entry.url : void 0
|
|
132139
132111
|
},
|
|
132140
132112
|
{ signal }
|
|
132141
132113
|
);
|
|
132142
|
-
|
|
132143
|
-
await writeMetaFile(
|
|
132114
|
+
entry.serverId = created.id;
|
|
132115
|
+
await writeMetaFile(fs6, absPath, existingMeta, assetId, created.id, entry.type);
|
|
132144
132116
|
}
|
|
132145
132117
|
}
|
|
132146
132118
|
effectiveNewFolderPaths.sort((a, b) => a.split("/").length - b.split("/").length);
|
|
@@ -132155,9 +132127,9 @@ async function pushProject(opts) {
|
|
|
132155
132127
|
if (!existingEntry || existingEntry.type !== "Folder") {
|
|
132156
132128
|
throw new Error(`[push] Missing tracked folder entry for case-only rename: '${oldPath}' -> '${folderPath}'`);
|
|
132157
132129
|
}
|
|
132158
|
-
let existingMeta2 = await readMetaFileIfExists(
|
|
132130
|
+
let existingMeta2 = await readMetaFileIfExists(fs6, absFolderPath) ?? {};
|
|
132159
132131
|
if (Object.keys(existingMeta2).length === 0) {
|
|
132160
|
-
existingMeta2 = await readMetaFileIfExists(
|
|
132132
|
+
existingMeta2 = await readMetaFileIfExists(fs6, import_node_path8.default.resolve(projectDir, oldPath)) ?? {};
|
|
132161
132133
|
}
|
|
132162
132134
|
const baseMeta2 = {
|
|
132163
132135
|
...stripLocalMetaFields(existingMeta2),
|
|
@@ -132165,7 +132137,7 @@ async function pushProject(opts) {
|
|
|
132165
132137
|
id: assetId2,
|
|
132166
132138
|
version: engineVersion
|
|
132167
132139
|
};
|
|
132168
|
-
await writeMetaFile(
|
|
132140
|
+
await writeMetaFile(fs6, absFolderPath, baseMeta2, assetId2, existingEntry.serverId, "Folder");
|
|
132169
132141
|
existingEntry.path = folderPath;
|
|
132170
132142
|
existingEntry.remoteVersion = existingEntry.remoteVersion || engineVersion || "";
|
|
132171
132143
|
manifestEntryByPath.delete(oldPath);
|
|
@@ -132175,9 +132147,9 @@ async function pushProject(opts) {
|
|
|
132175
132147
|
continue;
|
|
132176
132148
|
}
|
|
132177
132149
|
const parentId = resolveParentId(import_node_path8.default.posix.dirname(folderPath), folderIdByPath, folderPath);
|
|
132178
|
-
const existingMeta = await readMetaFileIfExists(
|
|
132150
|
+
const existingMeta = await readMetaFileIfExists(fs6, absFolderPath) ?? {};
|
|
132179
132151
|
const persistedId = resolvePersistedId(existingMeta);
|
|
132180
|
-
const assetId = persistedId ?? (0,
|
|
132152
|
+
const assetId = persistedId ?? (0, import_node_crypto2.randomUUID)();
|
|
132181
132153
|
const baseMeta = {
|
|
132182
132154
|
...stripLocalMetaFields(existingMeta),
|
|
132183
132155
|
type: "Folder",
|
|
@@ -132186,7 +132158,7 @@ async function pushProject(opts) {
|
|
|
132186
132158
|
};
|
|
132187
132159
|
const existingId = existingServerAssets.get(assetId);
|
|
132188
132160
|
if (existingId) {
|
|
132189
|
-
await writeMetaFile(
|
|
132161
|
+
await writeMetaFile(fs6, absFolderPath, baseMeta, assetId, existingId, "Folder");
|
|
132190
132162
|
manifest.entries[assetId] = {
|
|
132191
132163
|
assetId,
|
|
132192
132164
|
path: folderPath,
|
|
@@ -132201,7 +132173,7 @@ async function pushProject(opts) {
|
|
|
132201
132173
|
continue;
|
|
132202
132174
|
}
|
|
132203
132175
|
if (!persistedId) {
|
|
132204
|
-
await writeMetaFile(
|
|
132176
|
+
await writeMetaFile(fs6, absFolderPath, baseMeta, assetId, "", "Folder");
|
|
132205
132177
|
}
|
|
132206
132178
|
const metaForServer = safeParseJsonObject(JSON.stringify(baseMeta));
|
|
132207
132179
|
const created = await apiClient.createAsset(
|
|
@@ -132215,7 +132187,7 @@ async function pushProject(opts) {
|
|
|
132215
132187
|
{ signal }
|
|
132216
132188
|
);
|
|
132217
132189
|
const returnedMeta = parseJsonObjectOrThrow(created.meta, `createAsset response for folder '${folderPath}'`);
|
|
132218
|
-
await writeMetaFile(
|
|
132190
|
+
await writeMetaFile(fs6, absFolderPath, returnedMeta, assetId, created.id, "Folder");
|
|
132219
132191
|
manifest.entries[assetId] = {
|
|
132220
132192
|
assetId,
|
|
132221
132193
|
path: folderPath,
|
|
@@ -132232,8 +132204,8 @@ async function pushProject(opts) {
|
|
|
132232
132204
|
throwIfAborted(signal);
|
|
132233
132205
|
const parentId = resolveParentId(import_node_path8.default.posix.dirname(filePath), folderIdByPath, filePath);
|
|
132234
132206
|
const absFilePath = import_node_path8.default.resolve(projectDir, filePath);
|
|
132235
|
-
const content = await
|
|
132236
|
-
const existingMeta = await readMetaFileIfExists(
|
|
132207
|
+
const content = await fs6.readFile(absFilePath);
|
|
132208
|
+
const existingMeta = await readMetaFileIfExists(fs6, absFilePath) ?? {};
|
|
132237
132209
|
const persistedType = existingMeta.type;
|
|
132238
132210
|
const localFileName = import_node_path8.default.posix.basename(filePath);
|
|
132239
132211
|
const metaType = (typeof persistedType === "string" && persistedType.length > 0 ? persistedType : void 0) ?? (localFileName.endsWith(".ts") ? "script" : void 0);
|
|
@@ -132243,7 +132215,7 @@ async function pushProject(opts) {
|
|
|
132243
132215
|
);
|
|
132244
132216
|
}
|
|
132245
132217
|
const persistedId = resolvePersistedId(existingMeta);
|
|
132246
|
-
const assetId = persistedId ?? (0,
|
|
132218
|
+
const assetId = persistedId ?? (0, import_node_crypto2.randomUUID)();
|
|
132247
132219
|
const baseMeta = {
|
|
132248
132220
|
...stripLocalMetaFields(existingMeta),
|
|
132249
132221
|
type: metaType,
|
|
@@ -132255,7 +132227,7 @@ async function pushProject(opts) {
|
|
|
132255
132227
|
const existingId = existingServerAssets.get(assetId);
|
|
132256
132228
|
if (existingId) {
|
|
132257
132229
|
const upload = await apiClient.uploadAsset(existingId, content, serverName, { signal });
|
|
132258
|
-
await writeMetaFile(
|
|
132230
|
+
await writeMetaFile(fs6, absFilePath, baseMeta, assetId, existingId, metaType);
|
|
132259
132231
|
manifest.entries[assetId] = {
|
|
132260
132232
|
assetId,
|
|
132261
132233
|
path: filePath,
|
|
@@ -132270,7 +132242,7 @@ async function pushProject(opts) {
|
|
|
132270
132242
|
continue;
|
|
132271
132243
|
}
|
|
132272
132244
|
if (!persistedId) {
|
|
132273
|
-
await writeMetaFile(
|
|
132245
|
+
await writeMetaFile(fs6, absFilePath, baseMeta, assetId, "", metaType);
|
|
132274
132246
|
}
|
|
132275
132247
|
const metaForServer = safeParseJsonObject(JSON.stringify(baseMeta));
|
|
132276
132248
|
const created = await apiClient.createAsset(
|
|
@@ -132285,7 +132257,7 @@ async function pushProject(opts) {
|
|
|
132285
132257
|
{ signal }
|
|
132286
132258
|
);
|
|
132287
132259
|
const returnedMeta = parseJsonObjectOrThrow(created.meta, `createAsset response for file '${filePath}'`);
|
|
132288
|
-
await writeMetaFile(
|
|
132260
|
+
await writeMetaFile(fs6, absFilePath, returnedMeta, assetId, created.id, metaType);
|
|
132289
132261
|
manifest.entries[assetId] = {
|
|
132290
132262
|
assetId,
|
|
132291
132263
|
path: filePath,
|
|
@@ -132299,56 +132271,56 @@ async function pushProject(opts) {
|
|
|
132299
132271
|
pushed.push({ assetId, path: filePath, serverId: created.id, url: created.url });
|
|
132300
132272
|
}
|
|
132301
132273
|
const deletedLocalAssetIds = /* @__PURE__ */ new Set();
|
|
132302
|
-
for (const [assetId,
|
|
132274
|
+
for (const [assetId, entry] of Object.entries(manifest.entries)) {
|
|
132303
132275
|
throwIfAborted(signal);
|
|
132304
|
-
if (
|
|
132305
|
-
const filePath = import_node_path8.default.resolve(projectDir,
|
|
132276
|
+
if (entry.type === "Folder") continue;
|
|
132277
|
+
const filePath = import_node_path8.default.resolve(projectDir, entry.path);
|
|
132306
132278
|
let content;
|
|
132307
132279
|
try {
|
|
132308
|
-
content = await
|
|
132280
|
+
content = await fs6.readFile(filePath);
|
|
132309
132281
|
} catch (err) {
|
|
132310
132282
|
if (!isEnoent(err)) {
|
|
132311
132283
|
throw err;
|
|
132312
132284
|
}
|
|
132313
|
-
if (shouldTreatMissingLocalFileAsDelete(
|
|
132285
|
+
if (shouldTreatMissingLocalFileAsDelete(entry)) {
|
|
132314
132286
|
deletedLocalAssetIds.add(assetId);
|
|
132315
132287
|
continue;
|
|
132316
132288
|
}
|
|
132317
132289
|
warnings.push(
|
|
132318
|
-
`[push] Missing local file for remote-only asset '${
|
|
132290
|
+
`[push] Missing local file for remote-only asset '${entry.path}'; leaving manifest entry unchanged.`
|
|
132319
132291
|
);
|
|
132320
132292
|
continue;
|
|
132321
132293
|
}
|
|
132322
132294
|
const currentHash = md5Buffer(content);
|
|
132323
|
-
const isLocalOnly = !
|
|
132324
|
-
if (currentHash ===
|
|
132325
|
-
const serverName = getServerFileName(
|
|
132295
|
+
const isLocalOnly = !entry.serverId || entry.serverId.startsWith("local-");
|
|
132296
|
+
if (currentHash === entry.contentHash && !isLocalOnly) continue;
|
|
132297
|
+
const serverName = getServerFileName(entry.path, entry.type);
|
|
132326
132298
|
if (isLocalOnly) {
|
|
132327
132299
|
const existingId = existingServerAssets.get(assetId);
|
|
132328
132300
|
if (existingId) {
|
|
132329
132301
|
const upload = await apiClient.uploadAsset(existingId, content, serverName, { signal });
|
|
132330
|
-
const absFilePath = import_node_path8.default.resolve(projectDir,
|
|
132331
|
-
const existingMeta = await readMetaFileIfExists(
|
|
132332
|
-
const metaType = typeof existingMeta.type === "string" && existingMeta.type ||
|
|
132333
|
-
await writeMetaFile(
|
|
132334
|
-
|
|
132335
|
-
|
|
132336
|
-
|
|
132337
|
-
pushed.push({ assetId, path:
|
|
132302
|
+
const absFilePath = import_node_path8.default.resolve(projectDir, entry.path);
|
|
132303
|
+
const existingMeta = await readMetaFileIfExists(fs6, absFilePath) ?? {};
|
|
132304
|
+
const metaType = typeof existingMeta.type === "string" && existingMeta.type || entry.type;
|
|
132305
|
+
await writeMetaFile(fs6, absFilePath, existingMeta, assetId, existingId, metaType);
|
|
132306
|
+
entry.contentHash = currentHash;
|
|
132307
|
+
entry.serverId = existingId;
|
|
132308
|
+
entry.url = upload.url;
|
|
132309
|
+
pushed.push({ assetId, path: entry.path, serverId: existingId, url: upload.url });
|
|
132338
132310
|
} else {
|
|
132339
132311
|
if (!remote) {
|
|
132340
|
-
remote = await autoCreateRemoteProject(
|
|
132312
|
+
remote = await autoCreateRemoteProject(fs6, projectDir, opts, projectConfig, resolvedProjectSceneId);
|
|
132341
132313
|
}
|
|
132342
|
-
const absFilePath = import_node_path8.default.resolve(projectDir,
|
|
132343
|
-
const existingMeta = await readMetaFileIfExists(
|
|
132344
|
-
const metaType = typeof existingMeta.type === "string" && existingMeta.type ||
|
|
132314
|
+
const absFilePath = import_node_path8.default.resolve(projectDir, entry.path);
|
|
132315
|
+
const existingMeta = await readMetaFileIfExists(fs6, absFilePath) ?? {};
|
|
132316
|
+
const metaType = typeof existingMeta.type === "string" && existingMeta.type || entry.type;
|
|
132345
132317
|
const metaForServer = {
|
|
132346
132318
|
...stripLocalMetaFields(existingMeta),
|
|
132347
132319
|
type: metaType,
|
|
132348
132320
|
id: assetId,
|
|
132349
132321
|
version: engineVersion
|
|
132350
132322
|
};
|
|
132351
|
-
const parentId = resolveParentId(import_node_path8.default.posix.dirname(
|
|
132323
|
+
const parentId = resolveParentId(import_node_path8.default.posix.dirname(entry.path), folderIdByPath, entry.path);
|
|
132352
132324
|
const created = await apiClient.createAsset(
|
|
132353
132325
|
{
|
|
132354
132326
|
projectId: remote.projectId,
|
|
@@ -132360,28 +132332,28 @@ async function pushProject(opts) {
|
|
|
132360
132332
|
},
|
|
132361
132333
|
{ signal }
|
|
132362
132334
|
);
|
|
132363
|
-
const returnedMeta = parseJsonObjectOrThrow(created.meta, `createAsset response for file '${
|
|
132364
|
-
await writeMetaFile(
|
|
132365
|
-
|
|
132366
|
-
|
|
132367
|
-
|
|
132368
|
-
pushed.push({ assetId, path:
|
|
132335
|
+
const returnedMeta = parseJsonObjectOrThrow(created.meta, `createAsset response for file '${entry.path}'`);
|
|
132336
|
+
await writeMetaFile(fs6, absFilePath, returnedMeta, assetId, created.id, metaType);
|
|
132337
|
+
entry.contentHash = currentHash;
|
|
132338
|
+
entry.serverId = created.id;
|
|
132339
|
+
entry.url = created.url;
|
|
132340
|
+
pushed.push({ assetId, path: entry.path, serverId: created.id, url: created.url });
|
|
132369
132341
|
}
|
|
132370
132342
|
} else {
|
|
132371
|
-
const upload = await apiClient.uploadAsset(
|
|
132372
|
-
|
|
132373
|
-
|
|
132374
|
-
pushed.push({ assetId, path:
|
|
132343
|
+
const upload = await apiClient.uploadAsset(entry.serverId, content, serverName, { signal });
|
|
132344
|
+
entry.contentHash = currentHash;
|
|
132345
|
+
entry.url = upload.url;
|
|
132346
|
+
pushed.push({ assetId, path: entry.path, serverId: entry.serverId, url: upload.url });
|
|
132375
132347
|
}
|
|
132376
132348
|
}
|
|
132377
132349
|
const deletedFolderPaths = [];
|
|
132378
132350
|
const folderDeleteCandidates = Object.values(manifest.entries).filter(
|
|
132379
|
-
(
|
|
132351
|
+
(entry) => entry.type === "Folder" && !localDirSet.has(entry.path)
|
|
132380
132352
|
);
|
|
132381
132353
|
for (const folderEntry of folderDeleteCandidates) {
|
|
132382
132354
|
const folderPath = folderEntry.path;
|
|
132383
132355
|
const hasDeletedDescendant = Object.entries(manifest.entries).some(
|
|
132384
|
-
([assetId,
|
|
132356
|
+
([assetId, entry]) => deletedLocalAssetIds.has(assetId) && isPathInsideFolder(entry.path, folderPath)
|
|
132385
132357
|
);
|
|
132386
132358
|
if (hasDeletedDescendant || hasMaterializedDescendant(manifest.entries, folderPath)) {
|
|
132387
132359
|
deletedFolderPaths.push(folderPath);
|
|
@@ -132393,9 +132365,9 @@ async function pushProject(opts) {
|
|
|
132393
132365
|
}
|
|
132394
132366
|
deletedFolderPaths.sort((a, b) => a.length - b.length);
|
|
132395
132367
|
for (const folderPath of deletedFolderPaths) {
|
|
132396
|
-
for (const [assetId,
|
|
132397
|
-
if (
|
|
132398
|
-
if (
|
|
132368
|
+
for (const [assetId, entry] of Object.entries(manifest.entries)) {
|
|
132369
|
+
if (entry.path === folderPath || isPathInsideFolder(entry.path, folderPath)) {
|
|
132370
|
+
if (entry.type !== "Folder" && !shouldTreatMissingLocalFileAsDelete(entry)) continue;
|
|
132399
132371
|
deletedLocalAssetIds.add(assetId);
|
|
132400
132372
|
}
|
|
132401
132373
|
}
|
|
@@ -132415,12 +132387,12 @@ async function pushProject(opts) {
|
|
|
132415
132387
|
pendingManifestDeletes.push({ assetId, entry: removedEntry });
|
|
132416
132388
|
const absFilePath = import_node_path8.default.resolve(projectDir, removedEntry.path);
|
|
132417
132389
|
try {
|
|
132418
|
-
await
|
|
132390
|
+
await fs6.remove(metaFilePath(absFilePath));
|
|
132419
132391
|
} catch (err) {
|
|
132420
132392
|
if (!isEnoent(err)) throw err;
|
|
132421
132393
|
}
|
|
132422
132394
|
try {
|
|
132423
|
-
await
|
|
132395
|
+
await fs6.remove(absFilePath);
|
|
132424
132396
|
} catch (err) {
|
|
132425
132397
|
if (!isEnoent(err)) throw err;
|
|
132426
132398
|
}
|
|
@@ -132452,10 +132424,10 @@ async function pushProject(opts) {
|
|
|
132452
132424
|
await apiClient.deleteAssets(remote.projectId, toDelete, { signal });
|
|
132453
132425
|
deleted.push(...toDelete);
|
|
132454
132426
|
}
|
|
132455
|
-
for (const { assetId, entry
|
|
132427
|
+
for (const { assetId, entry } of pendingManifestDeletes) {
|
|
132456
132428
|
delete manifest.entries[assetId];
|
|
132457
|
-
manifestEntryByPath.delete(
|
|
132458
|
-
if (
|
|
132429
|
+
manifestEntryByPath.delete(entry.path);
|
|
132430
|
+
if (entry.type === "Folder") folderIdByPath.delete(entry.path);
|
|
132459
132431
|
}
|
|
132460
132432
|
if (remote && remoteProjectDetail) {
|
|
132461
132433
|
await syncRemoteProjectMetadata(
|
|
@@ -132472,7 +132444,7 @@ async function pushProject(opts) {
|
|
|
132472
132444
|
}
|
|
132473
132445
|
let writeError;
|
|
132474
132446
|
try {
|
|
132475
|
-
await atomicWriteFile(
|
|
132447
|
+
await atomicWriteFile(fs6, manifestPath, JSON.stringify(manifest, null, 2));
|
|
132476
132448
|
} catch (err) {
|
|
132477
132449
|
writeError = err;
|
|
132478
132450
|
}
|
|
@@ -132542,11 +132514,11 @@ var normalizeFilter = (filter) => {
|
|
|
132542
132514
|
return filter;
|
|
132543
132515
|
if (typeof filter === "string") {
|
|
132544
132516
|
const fl = filter.trim();
|
|
132545
|
-
return (
|
|
132517
|
+
return (entry) => entry.basename === fl;
|
|
132546
132518
|
}
|
|
132547
132519
|
if (Array.isArray(filter)) {
|
|
132548
132520
|
const trItems = filter.map((item) => item.trim());
|
|
132549
|
-
return (
|
|
132521
|
+
return (entry) => trItems.some((f) => entry.basename === f);
|
|
132550
132522
|
}
|
|
132551
132523
|
return emptyFn;
|
|
132552
132524
|
};
|
|
@@ -132591,23 +132563,23 @@ var ReaddirpStream = class extends import_node_stream.Readable {
|
|
|
132591
132563
|
const { path: path16, depth } = par;
|
|
132592
132564
|
const slice = fil.splice(0, batch).map((dirent) => this._formatEntry(dirent, path16));
|
|
132593
132565
|
const awaited = await Promise.all(slice);
|
|
132594
|
-
for (const
|
|
132595
|
-
if (!
|
|
132566
|
+
for (const entry of awaited) {
|
|
132567
|
+
if (!entry)
|
|
132596
132568
|
continue;
|
|
132597
132569
|
if (this.destroyed)
|
|
132598
132570
|
return;
|
|
132599
|
-
const entryType = await this._getEntryType(
|
|
132600
|
-
if (entryType === "directory" && this._directoryFilter(
|
|
132571
|
+
const entryType = await this._getEntryType(entry);
|
|
132572
|
+
if (entryType === "directory" && this._directoryFilter(entry)) {
|
|
132601
132573
|
if (depth <= this._maxDepth) {
|
|
132602
|
-
this.parents.push(this._exploreDir(
|
|
132574
|
+
this.parents.push(this._exploreDir(entry.fullPath, depth + 1));
|
|
132603
132575
|
}
|
|
132604
132576
|
if (this._wantsDir) {
|
|
132605
|
-
this.push(
|
|
132577
|
+
this.push(entry);
|
|
132606
132578
|
batch--;
|
|
132607
132579
|
}
|
|
132608
|
-
} else if ((entryType === "file" || this._includeAsFile(
|
|
132580
|
+
} else if ((entryType === "file" || this._includeAsFile(entry)) && this._fileFilter(entry)) {
|
|
132609
132581
|
if (this._wantsFile) {
|
|
132610
|
-
this.push(
|
|
132582
|
+
this.push(entry);
|
|
132611
132583
|
batch--;
|
|
132612
132584
|
}
|
|
132613
132585
|
}
|
|
@@ -132639,17 +132611,17 @@ var ReaddirpStream = class extends import_node_stream.Readable {
|
|
|
132639
132611
|
return { files, depth, path: path16 };
|
|
132640
132612
|
}
|
|
132641
132613
|
async _formatEntry(dirent, path16) {
|
|
132642
|
-
let
|
|
132614
|
+
let entry;
|
|
132643
132615
|
const basename4 = this._isDirent ? dirent.name : dirent;
|
|
132644
132616
|
try {
|
|
132645
132617
|
const fullPath = (0, import_node_path9.resolve)((0, import_node_path9.join)(path16, basename4));
|
|
132646
|
-
|
|
132647
|
-
|
|
132618
|
+
entry = { path: (0, import_node_path9.relative)(this._root, fullPath), fullPath, basename: basename4 };
|
|
132619
|
+
entry[this._statsProp] = this._isDirent ? dirent : await this._stat(fullPath);
|
|
132648
132620
|
} catch (err) {
|
|
132649
132621
|
this._onError(err);
|
|
132650
132622
|
return;
|
|
132651
132623
|
}
|
|
132652
|
-
return
|
|
132624
|
+
return entry;
|
|
132653
132625
|
}
|
|
132654
132626
|
_onError(err) {
|
|
132655
132627
|
if (isNormalFlowError(err) && !this.destroyed) {
|
|
@@ -132658,17 +132630,17 @@ var ReaddirpStream = class extends import_node_stream.Readable {
|
|
|
132658
132630
|
this.destroy(err);
|
|
132659
132631
|
}
|
|
132660
132632
|
}
|
|
132661
|
-
async _getEntryType(
|
|
132662
|
-
if (!
|
|
132633
|
+
async _getEntryType(entry) {
|
|
132634
|
+
if (!entry && this._statsProp in entry) {
|
|
132663
132635
|
return "";
|
|
132664
132636
|
}
|
|
132665
|
-
const stats =
|
|
132637
|
+
const stats = entry[this._statsProp];
|
|
132666
132638
|
if (stats.isFile())
|
|
132667
132639
|
return "file";
|
|
132668
132640
|
if (stats.isDirectory())
|
|
132669
132641
|
return "directory";
|
|
132670
132642
|
if (stats && stats.isSymbolicLink()) {
|
|
132671
|
-
const full =
|
|
132643
|
+
const full = entry.fullPath;
|
|
132672
132644
|
try {
|
|
132673
132645
|
const entryRealPath = await (0, import_promises5.realpath)(full);
|
|
132674
132646
|
const entryRealPathStats = await (0, import_promises5.lstat)(entryRealPath);
|
|
@@ -132690,8 +132662,8 @@ var ReaddirpStream = class extends import_node_stream.Readable {
|
|
|
132690
132662
|
}
|
|
132691
132663
|
}
|
|
132692
132664
|
}
|
|
132693
|
-
_includeAsFile(
|
|
132694
|
-
const stats =
|
|
132665
|
+
_includeAsFile(entry) {
|
|
132666
|
+
const stats = entry && entry[this._statsProp];
|
|
132695
132667
|
return stats && this._wantsEverything && !stats.isDirectory();
|
|
132696
132668
|
}
|
|
132697
132669
|
};
|
|
@@ -133017,10 +132989,10 @@ var foreach = (val, fn) => {
|
|
|
133017
132989
|
fn(val);
|
|
133018
132990
|
}
|
|
133019
132991
|
};
|
|
133020
|
-
var addAndConvert = (
|
|
133021
|
-
let container =
|
|
132992
|
+
var addAndConvert = (main, prop, item) => {
|
|
132993
|
+
let container = main[prop];
|
|
133022
132994
|
if (!(container instanceof Set)) {
|
|
133023
|
-
|
|
132995
|
+
main[prop] = container = /* @__PURE__ */ new Set([container]);
|
|
133024
132996
|
}
|
|
133025
132997
|
container.add(item);
|
|
133026
132998
|
};
|
|
@@ -133032,12 +133004,12 @@ var clearItem = (cont) => (key) => {
|
|
|
133032
133004
|
delete cont[key];
|
|
133033
133005
|
}
|
|
133034
133006
|
};
|
|
133035
|
-
var delFromSet = (
|
|
133036
|
-
const container =
|
|
133007
|
+
var delFromSet = (main, prop, item) => {
|
|
133008
|
+
const container = main[prop];
|
|
133037
133009
|
if (container instanceof Set) {
|
|
133038
133010
|
container.delete(item);
|
|
133039
133011
|
} else if (container === item) {
|
|
133040
|
-
delete
|
|
133012
|
+
delete main[prop];
|
|
133041
133013
|
}
|
|
133042
133014
|
};
|
|
133043
133015
|
var isEmptySet = (val) => val instanceof Set ? val.size === 0 : !val;
|
|
@@ -133272,11 +133244,11 @@ var NodeFsHandler = class {
|
|
|
133272
133244
|
* @param item basename of this item
|
|
133273
133245
|
* @returns true if no more processing is needed for this entry.
|
|
133274
133246
|
*/
|
|
133275
|
-
async _handleSymlink(
|
|
133247
|
+
async _handleSymlink(entry, directory, path16, item) {
|
|
133276
133248
|
if (this.fsw.closed) {
|
|
133277
133249
|
return;
|
|
133278
133250
|
}
|
|
133279
|
-
const full =
|
|
133251
|
+
const full = entry.fullPath;
|
|
133280
133252
|
const dir = this.fsw._getWatchedDir(directory);
|
|
133281
133253
|
if (!this.fsw.options.followSymlinks) {
|
|
133282
133254
|
this.fsw._incrReadyCount();
|
|
@@ -133292,12 +133264,12 @@ var NodeFsHandler = class {
|
|
|
133292
133264
|
if (dir.has(item)) {
|
|
133293
133265
|
if (this.fsw._symlinkPaths.get(full) !== linkPath) {
|
|
133294
133266
|
this.fsw._symlinkPaths.set(full, linkPath);
|
|
133295
|
-
this.fsw._emit(EV.CHANGE, path16,
|
|
133267
|
+
this.fsw._emit(EV.CHANGE, path16, entry.stats);
|
|
133296
133268
|
}
|
|
133297
133269
|
} else {
|
|
133298
133270
|
dir.add(item);
|
|
133299
133271
|
this.fsw._symlinkPaths.set(full, linkPath);
|
|
133300
|
-
this.fsw._emit(EV.ADD, path16,
|
|
133272
|
+
this.fsw._emit(EV.ADD, path16, entry.stats);
|
|
133301
133273
|
}
|
|
133302
133274
|
this.fsw._emitReady();
|
|
133303
133275
|
return true;
|
|
@@ -133315,20 +133287,20 @@ var NodeFsHandler = class {
|
|
|
133315
133287
|
const previous = this.fsw._getWatchedDir(wh.path);
|
|
133316
133288
|
const current = /* @__PURE__ */ new Set();
|
|
133317
133289
|
let stream = this.fsw._readdirp(directory, {
|
|
133318
|
-
fileFilter: (
|
|
133319
|
-
directoryFilter: (
|
|
133290
|
+
fileFilter: (entry) => wh.filterPath(entry),
|
|
133291
|
+
directoryFilter: (entry) => wh.filterDir(entry)
|
|
133320
133292
|
});
|
|
133321
133293
|
if (!stream)
|
|
133322
133294
|
return;
|
|
133323
|
-
stream.on(STR_DATA, async (
|
|
133295
|
+
stream.on(STR_DATA, async (entry) => {
|
|
133324
133296
|
if (this.fsw.closed) {
|
|
133325
133297
|
stream = void 0;
|
|
133326
133298
|
return;
|
|
133327
133299
|
}
|
|
133328
|
-
const item =
|
|
133300
|
+
const item = entry.path;
|
|
133329
133301
|
let path16 = sysPath.join(directory, item);
|
|
133330
133302
|
current.add(item);
|
|
133331
|
-
if (
|
|
133303
|
+
if (entry.stats.isSymbolicLink() && await this._handleSymlink(entry, directory, path16, item)) {
|
|
133332
133304
|
return;
|
|
133333
133305
|
}
|
|
133334
133306
|
if (this.fsw.closed) {
|
|
@@ -133415,8 +133387,8 @@ var NodeFsHandler = class {
|
|
|
133415
133387
|
}
|
|
133416
133388
|
const wh = this.fsw._getWatchHelpers(path16);
|
|
133417
133389
|
if (priorWh) {
|
|
133418
|
-
wh.filterPath = (
|
|
133419
|
-
wh.filterDir = (
|
|
133390
|
+
wh.filterPath = (entry) => priorWh.filterPath(entry);
|
|
133391
|
+
wh.filterDir = (entry) => priorWh.filterDir(entry);
|
|
133420
133392
|
}
|
|
133421
133393
|
try {
|
|
133422
133394
|
const stats = await statMethods[wh.statMethod](wh.watchPath);
|
|
@@ -133645,18 +133617,18 @@ var WatchHelper = class {
|
|
|
133645
133617
|
this.followSymlinks = follow;
|
|
133646
133618
|
this.statMethod = follow ? STAT_METHOD_F : STAT_METHOD_L;
|
|
133647
133619
|
}
|
|
133648
|
-
entryPath(
|
|
133649
|
-
return sysPath2.join(this.watchPath, sysPath2.relative(this.watchPath,
|
|
133620
|
+
entryPath(entry) {
|
|
133621
|
+
return sysPath2.join(this.watchPath, sysPath2.relative(this.watchPath, entry.fullPath));
|
|
133650
133622
|
}
|
|
133651
|
-
filterPath(
|
|
133652
|
-
const { stats } =
|
|
133623
|
+
filterPath(entry) {
|
|
133624
|
+
const { stats } = entry;
|
|
133653
133625
|
if (stats && stats.isSymbolicLink())
|
|
133654
|
-
return this.filterDir(
|
|
133655
|
-
const resolvedPath = this.entryPath(
|
|
133626
|
+
return this.filterDir(entry);
|
|
133627
|
+
const resolvedPath = this.entryPath(entry);
|
|
133656
133628
|
return this.fsw._isntIgnored(resolvedPath, stats) && this.fsw._hasReadPermissions(stats);
|
|
133657
133629
|
}
|
|
133658
|
-
filterDir(
|
|
133659
|
-
return this.fsw._isntIgnored(this.entryPath(
|
|
133630
|
+
filterDir(entry) {
|
|
133631
|
+
return this.fsw._isntIgnored(this.entryPath(entry), entry.stats);
|
|
133660
133632
|
}
|
|
133661
133633
|
};
|
|
133662
133634
|
var FSWatcher = class extends import_events.EventEmitter {
|
|
@@ -133843,10 +133815,10 @@ var FSWatcher = class extends import_events.EventEmitter {
|
|
|
133843
133815
|
*/
|
|
133844
133816
|
getWatched() {
|
|
133845
133817
|
const watchList = {};
|
|
133846
|
-
this._watched.forEach((
|
|
133818
|
+
this._watched.forEach((entry, dir) => {
|
|
133847
133819
|
const key = this.options.cwd ? sysPath2.relative(this.options.cwd, dir) : dir;
|
|
133848
133820
|
const index2 = key || ONE_DOT;
|
|
133849
|
-
watchList[index2] =
|
|
133821
|
+
watchList[index2] = entry.getChildren().sort();
|
|
133850
133822
|
});
|
|
133851
133823
|
return watchList;
|
|
133852
133824
|
}
|
|
@@ -133886,9 +133858,9 @@ var FSWatcher = class extends import_events.EventEmitter {
|
|
|
133886
133858
|
if (event === EVENTS.UNLINK) {
|
|
133887
133859
|
this._pendingUnlinks.set(path16, [event, ...args]);
|
|
133888
133860
|
setTimeout(() => {
|
|
133889
|
-
this._pendingUnlinks.forEach((
|
|
133890
|
-
this.emit(...
|
|
133891
|
-
this.emit(EVENTS.ALL, ...
|
|
133861
|
+
this._pendingUnlinks.forEach((entry, path17) => {
|
|
133862
|
+
this.emit(...entry);
|
|
133863
|
+
this.emit(EVENTS.ALL, ...entry);
|
|
133892
133864
|
this._pendingUnlinks.delete(path17);
|
|
133893
133865
|
});
|
|
133894
133866
|
}, typeof opts.atomic === "number" ? opts.atomic : 100);
|
|
@@ -134227,9 +134199,6 @@ var FileWatcher = class {
|
|
|
134227
134199
|
const rel = import_node_path10.default.relative(this.opts.watchDir, filePath);
|
|
134228
134200
|
this._onRawEvent(rel);
|
|
134229
134201
|
});
|
|
134230
|
-
this.watcher.on("error", (err) => {
|
|
134231
|
-
console.error("[FileWatcher] watcher error:", err);
|
|
134232
|
-
});
|
|
134233
134202
|
}
|
|
134234
134203
|
close() {
|
|
134235
134204
|
if (this.closed) return;
|
|
@@ -134277,7 +134246,7 @@ function watchProject(opts) {
|
|
|
134277
134246
|
const {
|
|
134278
134247
|
projectDir,
|
|
134279
134248
|
apiClient,
|
|
134280
|
-
fs:
|
|
134249
|
+
fs: fs6,
|
|
134281
134250
|
debounceMs,
|
|
134282
134251
|
onPush,
|
|
134283
134252
|
onError,
|
|
@@ -134301,7 +134270,7 @@ function watchProject(opts) {
|
|
|
134301
134270
|
const result = await pushProject({
|
|
134302
134271
|
projectDir: import_node_path11.default.resolve(projectDir),
|
|
134303
134272
|
apiClient,
|
|
134304
|
-
fs:
|
|
134273
|
+
fs: fs6,
|
|
134305
134274
|
signal,
|
|
134306
134275
|
serverUrl,
|
|
134307
134276
|
token
|
|
@@ -134385,7 +134354,7 @@ function registerProjectInfo(parent) {
|
|
|
134385
134354
|
try {
|
|
134386
134355
|
remote = await readNodeRemoteConfig(dir);
|
|
134387
134356
|
} catch (err) {
|
|
134388
|
-
if (!(
|
|
134357
|
+
if (!err?.message?.startsWith("Cannot read")) throw err;
|
|
134389
134358
|
}
|
|
134390
134359
|
if (globals.json) {
|
|
134391
134360
|
console.log(
|
|
@@ -134469,25 +134438,25 @@ function registerAssetInfo(parent) {
|
|
|
134469
134438
|
const dir = projectDir ?? process.cwd();
|
|
134470
134439
|
const globals = parent.optsWithGlobals();
|
|
134471
134440
|
const manifest = await readManifest(dir);
|
|
134472
|
-
const
|
|
134473
|
-
if (!
|
|
134441
|
+
const entry = manifest.entries[assetId];
|
|
134442
|
+
if (!entry) {
|
|
134474
134443
|
throw new Error(`Asset "${assetId}" not found in manifest`);
|
|
134475
134444
|
}
|
|
134476
134445
|
let meta3 = null;
|
|
134477
134446
|
try {
|
|
134478
|
-
meta3 = await readAssetMeta(dir, metaFilePath(
|
|
134447
|
+
meta3 = await readAssetMeta(dir, metaFilePath(entry.path));
|
|
134479
134448
|
} catch (err) {
|
|
134480
|
-
if (!(
|
|
134449
|
+
if (!err?.message?.startsWith("Cannot read")) throw err;
|
|
134481
134450
|
}
|
|
134482
134451
|
if (globals.json) {
|
|
134483
|
-
console.log(JSON.stringify({ ...
|
|
134452
|
+
console.log(JSON.stringify({ ...entry, meta: meta3 }, null, 2));
|
|
134484
134453
|
} else {
|
|
134485
|
-
console.log(`Asset ID: ${
|
|
134486
|
-
console.log(`Path: ${
|
|
134487
|
-
console.log(`Type: ${
|
|
134488
|
-
console.log(`Content Hash: ${
|
|
134489
|
-
console.log(`Server ID: ${
|
|
134490
|
-
console.log(`URL: ${
|
|
134454
|
+
console.log(`Asset ID: ${entry.assetId}`);
|
|
134455
|
+
console.log(`Path: ${entry.path}`);
|
|
134456
|
+
console.log(`Type: ${entry.type}`);
|
|
134457
|
+
console.log(`Content Hash: ${entry.contentHash}`);
|
|
134458
|
+
console.log(`Server ID: ${entry.serverId}`);
|
|
134459
|
+
console.log(`URL: ${entry.url}`);
|
|
134491
134460
|
if (meta3) {
|
|
134492
134461
|
console.log(`Meta: ${JSON.stringify(meta3, null, 2)}`);
|
|
134493
134462
|
}
|
|
@@ -134499,8 +134468,8 @@ function registerAssetInfo(parent) {
|
|
|
134499
134468
|
init_local_project();
|
|
134500
134469
|
function buildTreeFromPaths(entries) {
|
|
134501
134470
|
const root2 = { name: "", children: [] };
|
|
134502
|
-
for (const
|
|
134503
|
-
const parts =
|
|
134471
|
+
for (const entry of Object.values(entries)) {
|
|
134472
|
+
const parts = entry.path.split("/").filter(Boolean);
|
|
134504
134473
|
let current = root2;
|
|
134505
134474
|
for (let i = 0; i < parts.length; i++) {
|
|
134506
134475
|
const part = parts[i];
|
|
@@ -134508,7 +134477,7 @@ function buildTreeFromPaths(entries) {
|
|
|
134508
134477
|
if (!current.children) current.children = [];
|
|
134509
134478
|
let child = current.children.find((c) => c.name === part);
|
|
134510
134479
|
if (!child) {
|
|
134511
|
-
child = isLeaf ? { name: part, type:
|
|
134480
|
+
child = isLeaf ? { name: part, type: entry.type } : { name: part, children: [] };
|
|
134512
134481
|
current.children.push(child);
|
|
134513
134482
|
}
|
|
134514
134483
|
if (!isLeaf) current = child;
|
|
@@ -134545,7 +134514,7 @@ function registerAssetTree(parent) {
|
|
|
134545
134514
|
}
|
|
134546
134515
|
|
|
134547
134516
|
// src/commands/build.ts
|
|
134548
|
-
var
|
|
134517
|
+
var import_node_path15 = __toESM(require("node:path"));
|
|
134549
134518
|
function parseKtx2Quality(raw) {
|
|
134550
134519
|
if (raw == null) return void 0;
|
|
134551
134520
|
const value = Number(raw);
|
|
@@ -134565,8 +134534,8 @@ function registerBuildCommand(program3) {
|
|
|
134565
134534
|
try {
|
|
134566
134535
|
const { buildProject: buildProject2 } = await Promise.resolve().then(() => (init_cli_builder(), cli_builder_exports));
|
|
134567
134536
|
await buildProject2({
|
|
134568
|
-
projectDir:
|
|
134569
|
-
output:
|
|
134537
|
+
projectDir: import_node_path15.default.resolve(dir),
|
|
134538
|
+
output: import_node_path15.default.resolve(cmdOpts.output),
|
|
134570
134539
|
ktx2: cmdOpts.ktx2 ?? false,
|
|
134571
134540
|
ktx2Mode: cmdOpts.ktx2Mode,
|
|
134572
134541
|
ktx2Quality,
|
|
@@ -134579,8 +134548,8 @@ function registerBuildCommand(program3) {
|
|
|
134579
134548
|
}
|
|
134580
134549
|
|
|
134581
134550
|
// src/commands/create.ts
|
|
134582
|
-
var
|
|
134583
|
-
var
|
|
134551
|
+
var import_promises13 = require("node:fs/promises");
|
|
134552
|
+
var import_node_path16 = __toESM(require("node:path"));
|
|
134584
134553
|
init_manifest();
|
|
134585
134554
|
init_meta_file();
|
|
134586
134555
|
init_path_tree();
|
|
@@ -134804,14 +134773,14 @@ function buildDefaultScene(platform) {
|
|
|
134804
134773
|
async function createProject(opts) {
|
|
134805
134774
|
const { name, platform = "3d", engineVersion = "1.6.0", force = false } = opts;
|
|
134806
134775
|
const outputDir = opts.outputDir ?? `./${slugify(name)}`;
|
|
134807
|
-
const absDir =
|
|
134808
|
-
await (0,
|
|
134776
|
+
const absDir = import_node_path16.default.resolve(outputDir);
|
|
134777
|
+
await (0, import_promises13.mkdir)(absDir, { recursive: true });
|
|
134809
134778
|
if (!force) {
|
|
134810
134779
|
await assertNodeDirectoryEmpty(absDir);
|
|
134811
134780
|
} else {
|
|
134812
134781
|
await resetNodeManagedProjectPaths(absDir);
|
|
134813
134782
|
}
|
|
134814
|
-
await (0,
|
|
134783
|
+
await (0, import_promises13.mkdir)(import_node_path16.default.join(absDir, ".galacean/cache"), { recursive: true });
|
|
134815
134784
|
const sceneJson = JSON.stringify(buildDefaultScene(platform), null, 2);
|
|
134816
134785
|
const sceneAsset = {
|
|
134817
134786
|
id: `local-${DEFAULT_SCENE_ID}`,
|
|
@@ -134825,24 +134794,24 @@ async function createProject(opts) {
|
|
|
134825
134794
|
const allAssets = [sceneAsset, ...BUILTIN_REMOTE_ASSETS];
|
|
134826
134795
|
const pathMap = buildLocalPathMap(allAssets);
|
|
134827
134796
|
const contentHashes = /* @__PURE__ */ new Map();
|
|
134828
|
-
for (const [,
|
|
134829
|
-
if (
|
|
134830
|
-
await (0,
|
|
134797
|
+
for (const [, entry] of pathMap) {
|
|
134798
|
+
if (entry.isFolder) {
|
|
134799
|
+
await (0, import_promises13.mkdir)(import_node_path16.default.join(absDir, entry.localPath), { recursive: true });
|
|
134831
134800
|
}
|
|
134832
134801
|
}
|
|
134833
134802
|
const sceneEntry = pathMap.get(DEFAULT_SCENE_ID);
|
|
134834
|
-
await (0,
|
|
134803
|
+
await (0, import_promises13.writeFile)(import_node_path16.default.join(absDir, sceneEntry.localPath), sceneJson);
|
|
134835
134804
|
contentHashes.set(DEFAULT_SCENE_ID, md5Text(sceneJson));
|
|
134836
|
-
for (const [,
|
|
134837
|
-
const meta3 = generateMetaFile(
|
|
134838
|
-
const metaPath =
|
|
134839
|
-
await (0,
|
|
134840
|
-
await (0,
|
|
134805
|
+
for (const [, entry] of pathMap) {
|
|
134806
|
+
const meta3 = generateMetaFile(entry);
|
|
134807
|
+
const metaPath = import_node_path16.default.join(absDir, metaFilePath(entry.localPath));
|
|
134808
|
+
await (0, import_promises13.mkdir)(import_node_path16.default.dirname(metaPath), { recursive: true });
|
|
134809
|
+
await (0, import_promises13.writeFile)(metaPath, JSON.stringify(meta3, null, 2));
|
|
134841
134810
|
}
|
|
134842
134811
|
const manifest = generateManifest(pathMap, contentHashes);
|
|
134843
|
-
await (0,
|
|
134812
|
+
await (0, import_promises13.writeFile)(import_node_path16.default.join(absDir, ".galacean/manifest.json"), JSON.stringify(manifest, null, 2));
|
|
134844
134813
|
const projectConfig = { name, platform, engineVersion, sceneId: DEFAULT_SCENE_ID };
|
|
134845
|
-
await (0,
|
|
134814
|
+
await (0, import_promises13.writeFile)(import_node_path16.default.join(absDir, "project.galacean"), JSON.stringify(projectConfig, null, 2));
|
|
134846
134815
|
return { outputDir };
|
|
134847
134816
|
}
|
|
134848
134817
|
function registerCreateCommand(program3) {
|
|
@@ -134854,12 +134823,12 @@ function registerCreateCommand(program3) {
|
|
|
134854
134823
|
engineVersion: options.engineVersion,
|
|
134855
134824
|
force: options.force
|
|
134856
134825
|
});
|
|
134857
|
-
console.log(`Project created at: ${
|
|
134826
|
+
console.log(`Project created at: ${import_node_path16.default.resolve(outputDir)}`);
|
|
134858
134827
|
});
|
|
134859
134828
|
}
|
|
134860
134829
|
|
|
134861
134830
|
// src/commands/exec.ts
|
|
134862
|
-
var
|
|
134831
|
+
var import_node_path17 = __toESM(require("node:path"));
|
|
134863
134832
|
var UNSUPPORTED_HEADLESS_TOOL_IDS = /* @__PURE__ */ new Set(["prefab.create", "prefab.instantiate", "grp.import"]);
|
|
134864
134833
|
var HEADLESS_TOOL_FOLLOWUP_ISSUES = {
|
|
134865
134834
|
"prefab.create": 3583,
|
|
@@ -134900,17 +134869,9 @@ async function execTool(options) {
|
|
|
134900
134869
|
if (isUnsupportedHeadlessTool(options.toolId)) {
|
|
134901
134870
|
throw new EditorAPIError2("NOT_SUPPORTED", buildUnsupportedToolMessage(options.toolId));
|
|
134902
134871
|
}
|
|
134903
|
-
let params = {};
|
|
134904
|
-
if (options.params) {
|
|
134905
|
-
try {
|
|
134906
|
-
params = JSON.parse(options.params);
|
|
134907
|
-
} catch {
|
|
134908
|
-
throw new Error(`Invalid JSON in params: ${options.params}`);
|
|
134909
|
-
}
|
|
134910
|
-
}
|
|
134911
134872
|
const { HeadlessRoot: HeadlessRoot2 } = await Promise.resolve().then(() => (init_headless(), headless_exports));
|
|
134912
134873
|
const { loadDomainState: loadDomainState2, saveDomainState: saveDomainState2 } = await Promise.resolve().then(() => (init_domain_bridge(), domain_bridge_exports));
|
|
134913
|
-
const projectDir =
|
|
134874
|
+
const projectDir = import_node_path17.default.resolve(options.projectDir);
|
|
134914
134875
|
const { state, ctx } = await loadDomainState2(projectDir);
|
|
134915
134876
|
const root2 = new HeadlessRoot2(ctx.remoteProjectId, {
|
|
134916
134877
|
name: ctx.config.name,
|
|
@@ -134919,6 +134880,7 @@ async function execTool(options) {
|
|
|
134919
134880
|
});
|
|
134920
134881
|
root2.loadState(state);
|
|
134921
134882
|
api2.init(root2);
|
|
134883
|
+
const params = options.params ? JSON.parse(options.params) : {};
|
|
134922
134884
|
const result = await root2.runInUndoGroup(`exec:${options.toolId}`, () => api2.invoke(options.toolId, params));
|
|
134923
134885
|
const saved = !options.dryRun && root2.isDirty;
|
|
134924
134886
|
if (saved) {
|
|
@@ -134931,7 +134893,7 @@ function registerExecCommand(program3) {
|
|
|
134931
134893
|
program3.command("exec [toolId] [params]").description("Execute an editor-api tool on a local project").option("-p, --project <dir>", "project directory", ".").option("--list", "list all available tools").option("--schema <toolId>", "show tool input schema").option("--dry-run", "show what would change without saving").action(async (toolId, paramsStr, opts) => {
|
|
134932
134894
|
try {
|
|
134933
134895
|
const result = await execTool({
|
|
134934
|
-
projectDir:
|
|
134896
|
+
projectDir: import_node_path17.default.resolve(opts.project),
|
|
134935
134897
|
toolId,
|
|
134936
134898
|
params: paramsStr,
|
|
134937
134899
|
list: opts.list,
|
|
@@ -134951,13 +134913,13 @@ function registerExecCommand(program3) {
|
|
|
134951
134913
|
|
|
134952
134914
|
// src/cli-version.ts
|
|
134953
134915
|
var import_node_fs3 = require("node:fs");
|
|
134954
|
-
var
|
|
134916
|
+
var import_meta2 = {};
|
|
134955
134917
|
function readCliVersionFromPackageJson() {
|
|
134956
|
-
const raw = (0, import_node_fs3.readFileSync)(new URL("../package.json",
|
|
134918
|
+
const raw = (0, import_node_fs3.readFileSync)(new URL("../package.json", import_meta2.url), "utf-8");
|
|
134957
134919
|
const parsed = JSON.parse(raw);
|
|
134958
134920
|
return typeof parsed.version === "string" && parsed.version.length > 0 ? parsed.version : "0.0.0";
|
|
134959
134921
|
}
|
|
134960
|
-
var CLI_VERSION = "0.0.1-alpha.
|
|
134922
|
+
var CLI_VERSION = "0.0.1-alpha.9".length > 0 ? "0.0.1-alpha.9" : readCliVersionFromPackageJson();
|
|
134961
134923
|
|
|
134962
134924
|
// src/push-output.ts
|
|
134963
134925
|
function printPushResult(result, options = {}) {
|
|
@@ -135006,7 +134968,7 @@ program2.command("init <projectId>").description("Initialize a project locally")
|
|
|
135006
134968
|
const globals = program2.optsWithGlobals();
|
|
135007
134969
|
const serverUrl = await getServerUrl(globals);
|
|
135008
134970
|
const token = getToken(globals);
|
|
135009
|
-
const outputDir = cmdOpts.output ?? cmdOpts.outputDir ??
|
|
134971
|
+
const outputDir = cmdOpts.output ?? cmdOpts.outputDir ?? import_node_path18.default.resolve(globals._config?.projectsDir ?? import_node_path18.default.join(import_node_os2.default.homedir(), ".galacean/workspace"), projectId);
|
|
135010
134972
|
await initProject({
|
|
135011
134973
|
projectId,
|
|
135012
134974
|
outputDir,
|
|
@@ -135022,7 +134984,7 @@ program2.command("pull [projectDir]").description("Pull remote changes to local"
|
|
|
135022
134984
|
const serverUrl = await getServerUrl(globals, dir);
|
|
135023
134985
|
const token = getToken(globals);
|
|
135024
134986
|
const result = await pullProject({
|
|
135025
|
-
projectDir:
|
|
134987
|
+
projectDir: import_node_path18.default.resolve(dir),
|
|
135026
134988
|
apiClient: new HttpSyncApiClient(serverUrl, token),
|
|
135027
134989
|
fs: new NodeFs()
|
|
135028
134990
|
});
|
|
@@ -135054,7 +135016,7 @@ program2.command("push [projectDir]").description("Push local changes to remote"
|
|
|
135054
135016
|
const serverUrl = await getServerUrl(globals, dir);
|
|
135055
135017
|
const token = getToken(globals);
|
|
135056
135018
|
const result = await pushProject({
|
|
135057
|
-
projectDir:
|
|
135019
|
+
projectDir: import_node_path18.default.resolve(dir),
|
|
135058
135020
|
apiClient: new HttpSyncApiClient(serverUrl, token),
|
|
135059
135021
|
fs: new NodeFs(),
|
|
135060
135022
|
serverUrl,
|
|
@@ -135067,7 +135029,7 @@ program2.command("watch [projectDir]").description("Watch for local changes and
|
|
|
135067
135029
|
const globals = program2.optsWithGlobals();
|
|
135068
135030
|
const serverUrl = await getServerUrl(globals, dir);
|
|
135069
135031
|
const token = getToken(globals);
|
|
135070
|
-
const absProjectDir =
|
|
135032
|
+
const absProjectDir = import_node_path18.default.resolve(dir);
|
|
135071
135033
|
const handle2 = watchProject({
|
|
135072
135034
|
projectDir: absProjectDir,
|
|
135073
135035
|
apiClient: new HttpSyncApiClient(serverUrl, token),
|
|
@@ -135081,7 +135043,7 @@ program2.command("watch [projectDir]").description("Watch for local changes and
|
|
|
135081
135043
|
console.error(err);
|
|
135082
135044
|
}
|
|
135083
135045
|
});
|
|
135084
|
-
console.log(`Watching ${
|
|
135046
|
+
console.log(`Watching ${import_node_path18.default.join(absProjectDir, "assets")} for changes...`);
|
|
135085
135047
|
console.log("Press Ctrl+C to stop");
|
|
135086
135048
|
await new Promise((resolve4) => {
|
|
135087
135049
|
const shutdown = () => {
|