next-bun-compile 0.6.1 → 0.6.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/cli.js CHANGED
@@ -2,7 +2,7 @@
2
2
  import {
3
3
  compile,
4
4
  generateEntryPoint
5
- } from "./index-5m65k8kw.js";
5
+ } from "./index-v3pyz7g9.js";
6
6
 
7
7
  // src/cli.ts
8
8
  import { existsSync } from "node:fs";
@@ -12,13 +12,26 @@ import {
12
12
  } from "node:fs";
13
13
  import { join, relative } from "node:path";
14
14
  import { createHash } from "node:crypto";
15
+ function tryStat(p) {
16
+ try {
17
+ return statSync(p);
18
+ } catch (err) {
19
+ const code = err.code;
20
+ if (code === "EPERM" || code === "EACCES" || code === "ENOENT")
21
+ return null;
22
+ throw err;
23
+ }
24
+ }
15
25
  function walkDir(dir, base = dir) {
16
26
  const results = [];
17
27
  if (!existsSync(dir))
18
28
  return results;
19
29
  for (const entry of readdirSync(dir)) {
20
30
  const full = join(dir, entry);
21
- if (statSync(full).isDirectory()) {
31
+ const stat = tryStat(full);
32
+ if (!stat)
33
+ continue;
34
+ if (stat.isDirectory()) {
22
35
  results.push(...walkDir(full, base));
23
36
  } else {
24
37
  results.push({ absolutePath: full, relativePath: relative(base, full) });
@@ -107,7 +120,8 @@ function findServerDir(standaloneDir) {
107
120
  if (entry === "node_modules")
108
121
  continue;
109
122
  const full = join(dir, entry);
110
- if (!statSync(full).isDirectory())
123
+ const stat = tryStat(full);
124
+ if (!stat || !stat.isDirectory())
111
125
  continue;
112
126
  if (existsSync(join(full, "server.js")))
113
127
  return full;
@@ -163,12 +177,14 @@ function collectExternalModules(standaloneDir) {
163
177
  if (entry.startsWith(".") || entry === "next-bun-compile")
164
178
  continue;
165
179
  const entryPath = join(dir, entry);
166
- if (!statSync(entryPath).isDirectory())
180
+ const stat = tryStat(entryPath);
181
+ if (!stat || !stat.isDirectory())
167
182
  continue;
168
183
  if (entry.startsWith("@")) {
169
184
  for (const sub of readdirSync(entryPath)) {
170
185
  const subPath = join(entryPath, sub);
171
- if (statSync(subPath).isDirectory())
186
+ const subStat = tryStat(subPath);
187
+ if (subStat && subStat.isDirectory())
172
188
  addPkg(`${entry}/${sub}`, subPath);
173
189
  }
174
190
  } else {
@@ -206,7 +222,8 @@ function fixModuleResolution(standaloneDir) {
206
222
  continue;
207
223
  for (const entry of readdirSync(compiledDir)) {
208
224
  const dir = join(compiledDir, entry);
209
- if (!statSync(dir).isDirectory())
225
+ const stat = tryStat(dir);
226
+ if (!stat || !stat.isDirectory())
210
227
  continue;
211
228
  const pkgJsonPath = join(dir, "package.json");
212
229
  const indexPath = join(dir, "index.js");
package/dist/index.js CHANGED
@@ -2,7 +2,7 @@ import {
2
2
  __require,
3
3
  compile,
4
4
  generateEntryPoint
5
- } from "./index-5m65k8kw.js";
5
+ } from "./index-v3pyz7g9.js";
6
6
 
7
7
  // src/index.ts
8
8
  import { join } from "node:path";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "next-bun-compile",
3
- "version": "0.6.1",
3
+ "version": "0.6.2",
4
4
  "description": "Next.js Build Adapter that compiles your app into a Bun single-file executable",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",