@opennextjs/cloudflare 0.5.4 → 0.5.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.
@@ -117,10 +117,11 @@ export async function bundleServer(buildOpts) {
117
117
  platform: "node",
118
118
  banner: {
119
119
  js: `
120
- // __dirname is used by unbundled js files (which don't inherit the __dirname present in the define field)
120
+ // Used by unbundled js files (which don't inherit the __dirname present in the define field)
121
121
  // so we also need to set it on the global scope
122
122
  // Note: this was hit in the next/dist/compiled/@opentelemetry/api module
123
123
  globalThis.__dirname ??= "";
124
+ globalThis.__filename ??= "";
124
125
 
125
126
  // Do not crash on cache not supported
126
127
  // https://github.com/cloudflare/workerd/pull/2434
@@ -13,7 +13,9 @@ export function patchVercelOgLibrary(buildOpts) {
13
13
  const { appBuildOutputPath, outputDir } = buildOpts;
14
14
  const functionsPath = path.join(outputDir, "server-functions/default");
15
15
  const packagePath = path.join(functionsPath, getPackagePath(buildOpts));
16
- for (const traceInfoPath of globSync(path.join(appBuildOutputPath, ".next/server/**/*.nft.json"))) {
16
+ for (const traceInfoPath of globSync(path.join(appBuildOutputPath, ".next/server/**/*.nft.json"), {
17
+ windowsPathsNoEscape: true,
18
+ })) {
17
19
  const traceInfo = JSON.parse(readFileSync(traceInfoPath, { encoding: "utf8" }));
18
20
  const tracedNodePath = traceInfo.files.find((p) => p.endsWith("@vercel/og/index.node.js"));
19
21
  if (!tracedNodePath)
@@ -18,7 +18,9 @@ async function getRule(buildOpts) {
18
18
  const { outputDir } = buildOpts;
19
19
  const baseDir = join(outputDir, "server-functions/default", getPackagePath(buildOpts), ".next");
20
20
  const appDir = join(baseDir, "server/app");
21
- const manifests = await glob(join(baseDir, "**/*_client-reference-manifest.js"));
21
+ const manifests = await glob(join(baseDir, "**/*_client-reference-manifest.js"), {
22
+ windowsPathsNoEscape: true,
23
+ });
22
24
  const returnManifests = manifests
23
25
  .map((manifest) => {
24
26
  const endsWith = normalizePath(relative(baseDir, manifest));
@@ -18,7 +18,7 @@ async function getRule(buildOpts) {
18
18
  const { outputDir } = buildOpts;
19
19
  const baseDir = join(outputDir, "server-functions/default", getPackagePath(buildOpts));
20
20
  const dotNextDir = join(baseDir, ".next");
21
- const manifests = await glob(join(dotNextDir, "**/*-manifest.json"));
21
+ const manifests = await glob(join(dotNextDir, "**/*-manifest.json"), { windowsPathsNoEscape: true });
22
22
  const returnManifests = (await Promise.all(manifests.map(async (manifest) => `
23
23
  if ($PATH.endsWith("${normalizePath("/" + relative(dotNextDir, manifest))}")) {
24
24
  return ${await readFile(manifest, "utf-8")};
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@opennextjs/cloudflare",
3
3
  "description": "Cloudflare builder for next apps",
4
- "version": "0.5.4",
4
+ "version": "0.5.5",
5
5
  "type": "module",
6
6
  "bin": {
7
7
  "opennextjs-cloudflare": "dist/cli/index.js"