next-bun-compile 0.9.0 → 0.10.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.
- package/README.md +1 -1
- package/dist/cli.js +1 -1
- package/dist/{index-45tzedws.js → index-hb6dh1nm.js} +4 -6
- package/dist/index.js +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -89,7 +89,7 @@ You'll need to upload `.next/static/` to your CDN separately.
|
|
|
89
89
|
|
|
90
90
|
## Performance
|
|
91
91
|
|
|
92
|
-
The compiled binary
|
|
92
|
+
The compiled binary is minified, and dead code paths (dev-only modules, non-turbo runtimes) are eliminated via `--define` flags. Startup skips module resolution for the bundled server core entirely — the code is already in the binary.
|
|
93
93
|
|
|
94
94
|
Benchmarks on a real Next.js app (both running on Bun's runtime):
|
|
95
95
|
|
package/dist/cli.js
CHANGED
|
@@ -46,10 +46,9 @@ function walkDir(dir, base = dir) {
|
|
|
46
46
|
}
|
|
47
47
|
return results;
|
|
48
48
|
}
|
|
49
|
-
function toVarName(filePath) {
|
|
50
|
-
const hash = createHash("sha256").update(filePath).digest("hex").slice(0, 6);
|
|
49
|
+
function toVarName(filePath, index) {
|
|
51
50
|
const safe = filePath.replace(/[^a-zA-Z0-9]/g, "_").slice(0, 40);
|
|
52
|
-
return `asset_${
|
|
51
|
+
return `asset_${index}_${safe}`;
|
|
53
52
|
}
|
|
54
53
|
function findPackageDirs(standaloneDir, pkg) {
|
|
55
54
|
const dirs = [];
|
|
@@ -560,8 +559,8 @@ function generateEntryPoint(options) {
|
|
|
560
559
|
const buildHash = hasher.digest("hex");
|
|
561
560
|
const imports = [];
|
|
562
561
|
const mapEntries = [];
|
|
563
|
-
for (const asset of assetsToEmbed) {
|
|
564
|
-
const varName = toVarName(asset.urlPath);
|
|
562
|
+
for (const [i, asset] of assetsToEmbed.entries()) {
|
|
563
|
+
const varName = toVarName(asset.urlPath, i);
|
|
565
564
|
const importPath = relative(serverDir, asset.absolutePath).replace(/\\/g, "/");
|
|
566
565
|
imports.push(`import ${varName} from "./${importPath}" with { type: "file" };`);
|
|
567
566
|
mapEntries.push(` ["${asset.urlPath}", ${varName}],`);
|
|
@@ -844,7 +843,6 @@ function compile(options) {
|
|
|
844
843
|
"--production",
|
|
845
844
|
"--compile",
|
|
846
845
|
"--minify",
|
|
847
|
-
"--bytecode",
|
|
848
846
|
"--sourcemap",
|
|
849
847
|
"--define",
|
|
850
848
|
"process.env.TURBOPACK=1",
|
package/dist/index.js
CHANGED