@opennextjs/cloudflare 0.0.0-9aff12e → 0.0.0-acc0c5e
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/index.mjs +16 -20
- package/package.json +1 -1
package/dist/cli/index.mjs
CHANGED
|
@@ -225,7 +225,8 @@ var UserConfig = {
|
|
|
225
225
|
function getConfig(appDir, outputDir2) {
|
|
226
226
|
const dotNext = path.join(outputDir2, ".next");
|
|
227
227
|
const appPath = getNextjsApplicationPath(dotNext).replace(/\/$/, "");
|
|
228
|
-
const
|
|
228
|
+
const standaloneRoot = path.join(dotNext, "standalone");
|
|
229
|
+
const standaloneApp = path.join(standaloneRoot, appPath);
|
|
229
230
|
const standaloneAppDotNext = path.join(standaloneApp, ".next");
|
|
230
231
|
const standaloneAppServer = path.join(standaloneAppDotNext, "server");
|
|
231
232
|
const nodeModules = path.join(standaloneApp, "node_modules");
|
|
@@ -235,6 +236,7 @@ function getConfig(appDir, outputDir2) {
|
|
|
235
236
|
nextApp: appDir,
|
|
236
237
|
builderOutput: outputDir2,
|
|
237
238
|
dotNext,
|
|
239
|
+
standaloneRoot,
|
|
238
240
|
standaloneApp,
|
|
239
241
|
standaloneAppDotNext,
|
|
240
242
|
standaloneAppServer,
|
|
@@ -6924,30 +6926,24 @@ import fs2, { writeFileSync } from "node:fs";
|
|
|
6924
6926
|
import path10 from "node:path";
|
|
6925
6927
|
function patchWranglerDeps(config) {
|
|
6926
6928
|
console.log("# patchWranglerDeps");
|
|
6927
|
-
const
|
|
6928
|
-
|
|
6929
|
-
"node_modules",
|
|
6930
|
-
"next",
|
|
6931
|
-
"dist",
|
|
6932
|
-
"compiled",
|
|
6933
|
-
"next-server",
|
|
6934
|
-
"pages.runtime.prod.js"
|
|
6935
|
-
);
|
|
6929
|
+
const distPath = getDistPath(config);
|
|
6930
|
+
const pagesRuntimeFile = path10.join(distPath, "compiled", "next-server", "pages.runtime.prod.js");
|
|
6936
6931
|
const patchedPagesRuntime = fs2.readFileSync(pagesRuntimeFile, "utf-8").replace(`e.exports=require("critters")`, `e.exports={}`);
|
|
6937
6932
|
fs2.writeFileSync(pagesRuntimeFile, patchedPagesRuntime);
|
|
6938
|
-
const tracerFile = path10.join(
|
|
6939
|
-
config.paths.standaloneApp,
|
|
6940
|
-
"node_modules",
|
|
6941
|
-
"next",
|
|
6942
|
-
"dist",
|
|
6943
|
-
"server",
|
|
6944
|
-
"lib",
|
|
6945
|
-
"trace",
|
|
6946
|
-
"tracer.js"
|
|
6947
|
-
);
|
|
6933
|
+
const tracerFile = path10.join(distPath, "server", "lib", "trace", "tracer.js");
|
|
6948
6934
|
const pacthedTracer = fs2.readFileSync(tracerFile, "utf-8").replaceAll(/\w+\s*=\s*require\([^/]*opentelemetry.*\)/g, `throw new Error("@opentelemetry/api")`);
|
|
6949
6935
|
writeFileSync(tracerFile, pacthedTracer);
|
|
6950
6936
|
}
|
|
6937
|
+
function getDistPath(config) {
|
|
6938
|
+
for (const root of [config.paths.standaloneApp, config.paths.standaloneRoot]) {
|
|
6939
|
+
try {
|
|
6940
|
+
const distPath = path10.join(root, "node_modules", "next", "dist");
|
|
6941
|
+
if (fs2.statSync(distPath).isDirectory()) return distPath;
|
|
6942
|
+
} catch {
|
|
6943
|
+
}
|
|
6944
|
+
}
|
|
6945
|
+
throw new Error("Unexpected error: unable to detect the node_modules/next/dist directory");
|
|
6946
|
+
}
|
|
6951
6947
|
|
|
6952
6948
|
// src/cli/build/build-worker.ts
|
|
6953
6949
|
import path12 from "node:path";
|
package/package.json
CHANGED