@epic-web/workshop-utils 6.62.1 → 6.62.3

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.
Files changed (2) hide show
  1. package/dist/apps.server.js +40 -11
  2. package/package.json +1 -1
@@ -842,18 +842,47 @@ 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 && 'code' in error && error.code === 'ENOENT') {
855
+ return [];
856
+ }
857
+ throw error;
858
+ }
845
859
  // Filter to only include directories, not files like README.mdx
846
- const entries = await fs.promises
847
- .readdir(extraDirInfo.fullPath, { withFileTypes: true })
848
- .catch(() => []);
849
- const extraDirs = entries
850
- .filter((entry) => {
851
- if (entry.isDirectory())
852
- return true;
853
- log(`Skipping non-directory in extras: ${entry.name}`);
854
- return false;
855
- })
856
- .map((entry) => path.join(extraDirInfo.fullPath, entry.name));
860
+ // Also follow symlinks to check if they point to directories
861
+ const extraDirs = [];
862
+ for (const entry of entries) {
863
+ const fullPath = path.join(extraDirInfo.fullPath, entry.name);
864
+ if (entry.isDirectory()) {
865
+ extraDirs.push(fullPath);
866
+ }
867
+ else if (entry.isSymbolicLink()) {
868
+ // Follow symlink to check if it points to a directory
869
+ try {
870
+ const stat = await fs.promises.stat(fullPath);
871
+ if (stat.isDirectory()) {
872
+ extraDirs.push(fullPath);
873
+ }
874
+ else {
875
+ log(`Skipping non-directory symlink in extras: ${entry.name}`);
876
+ }
877
+ }
878
+ catch (error) {
879
+ log(`Skipping unresolvable symlink in extras: ${entry.name} (${getErrorMessage(error)})`);
880
+ }
881
+ }
882
+ else {
883
+ log(`Skipping non-directory in extras: ${entry.name}`);
884
+ }
885
+ }
857
886
  const extraApps = [];
858
887
  for (const extraDir of extraDirs) {
859
888
  const index = extraDirs.indexOf(extraDir);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@epic-web/workshop-utils",
3
- "version": "6.62.1",
3
+ "version": "6.62.3",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },