@epic-web/workshop-utils 6.62.1 → 6.62.2
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/apps.server.js +42 -11
- package/package.json +1 -1
package/dist/apps.server.js
CHANGED
|
@@ -842,18 +842,49 @@ async function getExtraApps({ timings, request, } = {}) {
|
|
|
842
842
|
const extraDirInfo = await resolveExtraDir();
|
|
843
843
|
if (!extraDirInfo)
|
|
844
844
|
return [];
|
|
845
|
+
// Read directory entries - only return empty array for non-existent directories
|
|
846
|
+
// to match the original readDir behavior. Other errors (EACCES, EMFILE, etc.) propagate.
|
|
847
|
+
let entries = [];
|
|
848
|
+
try {
|
|
849
|
+
entries = await fs.promises.readdir(extraDirInfo.fullPath, {
|
|
850
|
+
withFileTypes: true,
|
|
851
|
+
});
|
|
852
|
+
}
|
|
853
|
+
catch (error) {
|
|
854
|
+
if (error instanceof Error &&
|
|
855
|
+
'code' in error &&
|
|
856
|
+
error.code === 'ENOENT') {
|
|
857
|
+
return [];
|
|
858
|
+
}
|
|
859
|
+
throw error;
|
|
860
|
+
}
|
|
845
861
|
// Filter to only include directories, not files like README.mdx
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
.
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
862
|
+
// Also follow symlinks to check if they point to directories
|
|
863
|
+
const extraDirs = [];
|
|
864
|
+
for (const entry of entries) {
|
|
865
|
+
const fullPath = path.join(extraDirInfo.fullPath, entry.name);
|
|
866
|
+
if (entry.isDirectory()) {
|
|
867
|
+
extraDirs.push(fullPath);
|
|
868
|
+
}
|
|
869
|
+
else if (entry.isSymbolicLink()) {
|
|
870
|
+
// Follow symlink to check if it points to a directory
|
|
871
|
+
try {
|
|
872
|
+
const stat = await fs.promises.stat(fullPath);
|
|
873
|
+
if (stat.isDirectory()) {
|
|
874
|
+
extraDirs.push(fullPath);
|
|
875
|
+
}
|
|
876
|
+
else {
|
|
877
|
+
log(`Skipping non-directory symlink in extras: ${entry.name}`);
|
|
878
|
+
}
|
|
879
|
+
}
|
|
880
|
+
catch (error) {
|
|
881
|
+
log(`Skipping unresolvable symlink in extras: ${entry.name} (${getErrorMessage(error)})`);
|
|
882
|
+
}
|
|
883
|
+
}
|
|
884
|
+
else {
|
|
885
|
+
log(`Skipping non-directory in extras: ${entry.name}`);
|
|
886
|
+
}
|
|
887
|
+
}
|
|
857
888
|
const extraApps = [];
|
|
858
889
|
for (const extraDir of extraDirs) {
|
|
859
890
|
const index = extraDirs.indexOf(extraDir);
|