@opennextjs/cloudflare 0.6.1 → 0.6.3
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.
|
@@ -170,7 +170,7 @@ globalThis.__BUILD_TIMESTAMP_MS__ = ${Date.now()};
|
|
|
170
170
|
await updateWorkerBundledCode(openNextServerBundle, buildOpts);
|
|
171
171
|
const isMonorepo = monorepoRoot !== appPath;
|
|
172
172
|
if (isMonorepo) {
|
|
173
|
-
fs.writeFileSync(path.join(outputPath, "handler.mjs"), `export
|
|
173
|
+
fs.writeFileSync(path.join(outputPath, "handler.mjs"), `export { handler } from "./${normalizePath(packagePath)}/handler.mjs";`);
|
|
174
174
|
}
|
|
175
175
|
console.log(`\x1b[35mWorker saved in \`${getOutputWorkerPath(buildOpts)}\` 🚀\n\x1b[0m`);
|
|
176
176
|
}
|
|
@@ -1,14 +1,36 @@
|
|
|
1
1
|
import { spawnSync } from "node:child_process";
|
|
2
2
|
import logger from "@opennextjs/aws/logger.js";
|
|
3
|
+
/**
|
|
4
|
+
* Prepends CLI flags with `--` so that certain package managers can pass args through to wrangler
|
|
5
|
+
* properly.
|
|
6
|
+
*
|
|
7
|
+
* npm and yarn require `--` to be used, while pnpm and bun require that it is not used.
|
|
8
|
+
*
|
|
9
|
+
* @param options Build options.
|
|
10
|
+
* @param args CLI args.
|
|
11
|
+
* @returns Arguments with a passthrough flag injected when needed.
|
|
12
|
+
*/
|
|
13
|
+
function injectPassthroughFlagForArgs(options, args) {
|
|
14
|
+
if (options.packager !== "npm" && options.packager !== "yarn") {
|
|
15
|
+
return args;
|
|
16
|
+
}
|
|
17
|
+
const flagInArgsIndex = args.findIndex((v) => v.startsWith("--"));
|
|
18
|
+
if (flagInArgsIndex !== -1) {
|
|
19
|
+
args.splice(flagInArgsIndex, 0, "--");
|
|
20
|
+
}
|
|
21
|
+
return args;
|
|
22
|
+
}
|
|
3
23
|
export function runWrangler(options, args, wranglerOpts = {}) {
|
|
4
24
|
const result = spawnSync(options.packager, [
|
|
5
25
|
options.packager === "bun" ? "x" : "exec",
|
|
6
26
|
"wrangler",
|
|
7
|
-
...
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
27
|
+
...injectPassthroughFlagForArgs(options, [
|
|
28
|
+
...args,
|
|
29
|
+
wranglerOpts.environment && `--env ${wranglerOpts.environment}`,
|
|
30
|
+
wranglerOpts.target === "remote" && !wranglerOpts.excludeRemoteFlag && "--remote",
|
|
31
|
+
wranglerOpts.target === "local" && "--local",
|
|
32
|
+
].filter((v) => !!v)),
|
|
33
|
+
], {
|
|
12
34
|
shell: true,
|
|
13
35
|
stdio: wranglerOpts.logging === "error" ? ["ignore", "ignore", "inherit"] : "inherit",
|
|
14
36
|
});
|