next-bun-compile 0.6.3 → 0.6.5
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-dxk9rwqh.js → index-mcq5wghd.js} +45 -28
- package/dist/index.js +1 -1
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -112,24 +112,46 @@ function generateStubs(standaloneDir) {
|
|
|
112
112
|
}
|
|
113
113
|
}
|
|
114
114
|
function findTurbopackAliases(standaloneNextDir) {
|
|
115
|
+
const seen = new Map;
|
|
116
|
+
const serverDir = join(standaloneNextDir, "server");
|
|
117
|
+
if (existsSync(serverDir)) {
|
|
118
|
+
const re = /require\(["']([^"'\s/]+-[0-9a-f]{16})["']\)/g;
|
|
119
|
+
for (const f of walkDir(serverDir)) {
|
|
120
|
+
if (!f.absolutePath.endsWith(".js"))
|
|
121
|
+
continue;
|
|
122
|
+
let content;
|
|
123
|
+
try {
|
|
124
|
+
content = readFileSync(f.absolutePath, "utf-8");
|
|
125
|
+
} catch {
|
|
126
|
+
continue;
|
|
127
|
+
}
|
|
128
|
+
let m;
|
|
129
|
+
while (m = re.exec(content)) {
|
|
130
|
+
const alias = m[1];
|
|
131
|
+
if (seen.has(alias))
|
|
132
|
+
continue;
|
|
133
|
+
seen.set(alias, alias.replace(/-[0-9a-f]{16}$/, ""));
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
}
|
|
115
137
|
const nodeModulesDir = join(standaloneNextDir, "node_modules");
|
|
116
|
-
if (
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
for (const entry of readdirSync(nodeModulesDir)) {
|
|
120
|
-
if (!/-[0-9a-f]{16}$/.test(entry))
|
|
121
|
-
continue;
|
|
122
|
-
const aliasPath = join(nodeModulesDir, entry);
|
|
123
|
-
try {
|
|
124
|
-
if (!lstatSync(aliasPath).isSymbolicLink())
|
|
138
|
+
if (existsSync(nodeModulesDir)) {
|
|
139
|
+
for (const entry of readdirSync(nodeModulesDir)) {
|
|
140
|
+
if (!/-[0-9a-f]{16}$/.test(entry))
|
|
125
141
|
continue;
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
142
|
+
if (seen.has(entry))
|
|
143
|
+
continue;
|
|
144
|
+
const aliasPath = join(nodeModulesDir, entry);
|
|
145
|
+
try {
|
|
146
|
+
if (!lstatSync(aliasPath).isSymbolicLink())
|
|
147
|
+
continue;
|
|
148
|
+
seen.set(entry, basename(realpathSync(aliasPath)));
|
|
149
|
+
} catch {
|
|
150
|
+
continue;
|
|
151
|
+
}
|
|
130
152
|
}
|
|
131
153
|
}
|
|
132
|
-
return
|
|
154
|
+
return Array.from(seen, ([alias, target]) => ({ alias, target }));
|
|
133
155
|
}
|
|
134
156
|
function findServerDir(standaloneDir) {
|
|
135
157
|
if (existsSync(join(standaloneDir, "server.js"))) {
|
|
@@ -387,20 +409,15 @@ async function extractAssets() {
|
|
|
387
409
|
for (const [alias, target] of turbopackAliases) {
|
|
388
410
|
const aliasPath = path.join(baseDir, ".next/node_modules", alias);
|
|
389
411
|
if (fs.existsSync(aliasPath)) continue;
|
|
390
|
-
fs.mkdirSync(
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
fs.writeFileSync(
|
|
400
|
-
path.join(aliasPath, "index.js"),
|
|
401
|
-
"module.exports = require(" + JSON.stringify(target) + ");"
|
|
402
|
-
);
|
|
403
|
-
}
|
|
412
|
+
fs.mkdirSync(aliasPath, { recursive: true });
|
|
413
|
+
fs.writeFileSync(
|
|
414
|
+
path.join(aliasPath, "package.json"),
|
|
415
|
+
JSON.stringify({ name: alias, main: "index.js" })
|
|
416
|
+
);
|
|
417
|
+
fs.writeFileSync(
|
|
418
|
+
path.join(aliasPath, "index.js"),
|
|
419
|
+
"module.exports = require(" + JSON.stringify(target) + ");"
|
|
420
|
+
);
|
|
404
421
|
}
|
|
405
422
|
if (n > 0) console.log(\`Extracted \${n} assets\`);
|
|
406
423
|
}
|
package/dist/index.js
CHANGED