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 +1 -1
- package/dist/{index-5m65k8kw.js → index-v3pyz7g9.js} +22 -5
- package/dist/index.js +1 -1
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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