@series-inc/stowkit-cli 0.1.13 → 0.1.14
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/server.js +42 -6
- package/package.json +2 -2
package/dist/server.js
CHANGED
|
@@ -721,19 +721,55 @@ async function handleRequest(req, res, staticApps) {
|
|
|
721
721
|
if (projectConfig && Date.now() - lastScanTime > 5000) {
|
|
722
722
|
lastScanTime = Date.now();
|
|
723
723
|
const scan = await scanDirectory(projectConfig.srcArtDir);
|
|
724
|
-
//
|
|
725
|
-
const
|
|
726
|
-
const
|
|
727
|
-
|
|
728
|
-
...scan.
|
|
724
|
+
// Compare top-level (non-child) asset IDs with disk files
|
|
725
|
+
const currentAssets = assets.filter(a => !a.parentId);
|
|
726
|
+
const currentIds = new Set(currentAssets.map(a => a.id));
|
|
727
|
+
const diskFiles = new Map([
|
|
728
|
+
...scan.sourceFiles.map(f => [f.relativePath, f]),
|
|
729
|
+
...scan.matFiles.map(f => [f.relativePath, f]),
|
|
729
730
|
]);
|
|
730
|
-
const
|
|
731
|
+
const diskIds = new Set(diskFiles.keys());
|
|
732
|
+
// Check for added/removed files
|
|
733
|
+
let changed = currentIds.size !== diskIds.size ||
|
|
731
734
|
[...currentIds].some(id => !diskIds.has(id)) ||
|
|
732
735
|
[...diskIds].some(id => !currentIds.has(id));
|
|
736
|
+
// Check for modified files (size or mtime changed)
|
|
737
|
+
const modifiedIds = [];
|
|
738
|
+
if (!changed) {
|
|
739
|
+
for (const asset of currentAssets) {
|
|
740
|
+
const diskFile = diskFiles.get(asset.id);
|
|
741
|
+
if (diskFile && asset.sourceSize > 0 && diskFile.size !== asset.sourceSize) {
|
|
742
|
+
modifiedIds.push(asset.id);
|
|
743
|
+
}
|
|
744
|
+
}
|
|
745
|
+
}
|
|
733
746
|
if (changed) {
|
|
734
747
|
await openProject(projectConfig.projectDir);
|
|
735
748
|
queueProcessing();
|
|
736
749
|
}
|
|
750
|
+
else if (modifiedIds.length > 0) {
|
|
751
|
+
// Re-read source and reprocess modified assets without full project reload
|
|
752
|
+
for (const id of modifiedIds) {
|
|
753
|
+
const asset = assets.find(a => a.id === id);
|
|
754
|
+
if (!asset)
|
|
755
|
+
continue;
|
|
756
|
+
const diskFile = diskFiles.get(id);
|
|
757
|
+
if (diskFile)
|
|
758
|
+
asset.sourceSize = diskFile.size;
|
|
759
|
+
BlobStore.remove(id);
|
|
760
|
+
// Also clear children for GLB containers
|
|
761
|
+
if (asset.type === AssetType.GlbContainer) {
|
|
762
|
+
const prefix = id + '/';
|
|
763
|
+
for (const child of assets) {
|
|
764
|
+
if (child.id.startsWith(prefix))
|
|
765
|
+
BlobStore.remove(child.id);
|
|
766
|
+
}
|
|
767
|
+
}
|
|
768
|
+
asset.status = 'pending';
|
|
769
|
+
broadcast({ type: 'asset-update', id, updates: { status: 'pending', sourceSize: asset.sourceSize } });
|
|
770
|
+
}
|
|
771
|
+
queueProcessing({ ids: modifiedIds });
|
|
772
|
+
}
|
|
737
773
|
}
|
|
738
774
|
json(res, {
|
|
739
775
|
project: projectConfig ? {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@series-inc/stowkit-cli",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.14",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"bin": {
|
|
6
6
|
"stowkit": "./dist/cli.js"
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
"dev": "tsc --watch"
|
|
18
18
|
},
|
|
19
19
|
"dependencies": {
|
|
20
|
-
"@series-inc/stowkit-packer-gui": "^0.1.
|
|
20
|
+
"@series-inc/stowkit-packer-gui": "^0.1.7",
|
|
21
21
|
"@series-inc/stowkit-editor": "^0.1.2",
|
|
22
22
|
"draco3d": "^1.5.7",
|
|
23
23
|
"fbx-parser": "^2.1.3",
|