opencode-preview-plus 0.13.0 → 0.13.1

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.
@@ -2844,7 +2844,12 @@ function clearExternalPreviewFilesForTest() {
2844
2844
  }
2845
2845
  var IGNORED_DIRS = /* @__PURE__ */ new Set(["node_modules", ".git", "dist", ".next", "__pycache__", ".venv", "venv"]);
2846
2846
  async function collectPreviewFiles(directory, base = directory) {
2847
- const entries = await readdir(directory, { withFileTypes: true });
2847
+ let entries;
2848
+ try {
2849
+ entries = await readdir(directory, { withFileTypes: true });
2850
+ } catch {
2851
+ return [];
2852
+ }
2848
2853
  const files = await Promise.all(
2849
2854
  entries.map(async (entry) => {
2850
2855
  const absolutePath = path2.join(directory, entry.name);
@@ -2863,12 +2868,22 @@ async function collectPreviewFiles(directory, base = directory) {
2863
2868
  return files.flat().sort((a, b) => a.localeCompare(b));
2864
2869
  }
2865
2870
  async function collectEmptyDirectories(directory, base = directory) {
2866
- const entries = await readdir(directory, { withFileTypes: true });
2871
+ let entries;
2872
+ try {
2873
+ entries = await readdir(directory, { withFileTypes: true });
2874
+ } catch {
2875
+ return [];
2876
+ }
2867
2877
  const childDirectories = entries.filter((entry) => entry.isDirectory() && !IGNORED_DIRS.has(entry.name));
2868
2878
  const nested = await Promise.all(
2869
2879
  childDirectories.map(async (entry) => {
2870
2880
  const absolutePath = path2.join(directory, entry.name);
2871
- const childEntries = await readdir(absolutePath, { withFileTypes: true });
2881
+ let childEntries;
2882
+ try {
2883
+ childEntries = await readdir(absolutePath, { withFileTypes: true });
2884
+ } catch {
2885
+ return [];
2886
+ }
2872
2887
  const childResults = await collectEmptyDirectories(absolutePath, base);
2873
2888
  if (childEntries.length === 0) {
2874
2889
  return [path2.relative(base, absolutePath).split(path2.sep).join("/"), ...childResults];
package/dist/index.js CHANGED
@@ -4,7 +4,7 @@ import {
4
4
  isPreviewable,
5
5
  registerExternalPreviewFile,
6
6
  startServer
7
- } from "./chunk-ZHJFGWJ2.js";
7
+ } from "./chunk-NQ3FC3FR.js";
8
8
 
9
9
  // src/index.ts
10
10
  import { stat } from "fs/promises";
package/dist/server.js CHANGED
@@ -11,7 +11,7 @@ import {
11
11
  resolveExternalPreviewFile,
12
12
  startServer,
13
13
  stopServer
14
- } from "./chunk-ZHJFGWJ2.js";
14
+ } from "./chunk-NQ3FC3FR.js";
15
15
  export {
16
16
  buildExternalPreviewUrl,
17
17
  clearExternalPreviewFilesForTest,
package/dist/tui.js CHANGED
@@ -2827,7 +2827,12 @@ function resolveExternalPreviewFile(token) {
2827
2827
  }
2828
2828
  var IGNORED_DIRS = /* @__PURE__ */ new Set(["node_modules", ".git", "dist", ".next", "__pycache__", ".venv", "venv"]);
2829
2829
  async function collectPreviewFiles(directory, base = directory) {
2830
- const entries = await readdir(directory, { withFileTypes: true });
2830
+ let entries;
2831
+ try {
2832
+ entries = await readdir(directory, { withFileTypes: true });
2833
+ } catch {
2834
+ return [];
2835
+ }
2831
2836
  const files = await Promise.all(
2832
2837
  entries.map(async (entry) => {
2833
2838
  const absolutePath = path2.join(directory, entry.name);
@@ -2846,12 +2851,22 @@ async function collectPreviewFiles(directory, base = directory) {
2846
2851
  return files.flat().sort((a, b) => a.localeCompare(b));
2847
2852
  }
2848
2853
  async function collectEmptyDirectories(directory, base = directory) {
2849
- const entries = await readdir(directory, { withFileTypes: true });
2854
+ let entries;
2855
+ try {
2856
+ entries = await readdir(directory, { withFileTypes: true });
2857
+ } catch {
2858
+ return [];
2859
+ }
2850
2860
  const childDirectories = entries.filter((entry) => entry.isDirectory() && !IGNORED_DIRS.has(entry.name));
2851
2861
  const nested = await Promise.all(
2852
2862
  childDirectories.map(async (entry) => {
2853
2863
  const absolutePath = path2.join(directory, entry.name);
2854
- const childEntries = await readdir(absolutePath, { withFileTypes: true });
2864
+ let childEntries;
2865
+ try {
2866
+ childEntries = await readdir(absolutePath, { withFileTypes: true });
2867
+ } catch {
2868
+ return [];
2869
+ }
2855
2870
  const childResults = await collectEmptyDirectories(absolutePath, base);
2856
2871
  if (childEntries.length === 0) {
2857
2872
  return [path2.relative(base, absolutePath).split(path2.sep).join("/"), ...childResults];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "opencode-preview-plus",
3
- "version": "0.13.0",
3
+ "version": "0.13.1",
4
4
  "description": "OpenCode plugin for Markdown and DrawIO preview with live reload",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",