@opennextjs/cloudflare 0.0.0-88fe982 → 0.0.0-e2c4535

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 CHANGED
@@ -1,8 +1,10 @@
1
1
  # Next.js builder for Cloudflare
2
2
 
3
+ How to update a Next.js application to run on Cloudflare.
4
+
3
5
  ## Configure your app
4
6
 
5
- - add the following `devDependency` to the `package.json`:
7
+ - add the following `devDependencies` to the `package.json`:
6
8
 
7
9
  ```bash
8
10
  pnpm add -D wrangler@latest @opennextjs/cloudflare
package/dist/index.mjs CHANGED
@@ -1,3 +1,4 @@
1
+ #!/usr/bin/env node
1
2
  var __create = Object.create;
2
3
  var __defProp = Object.defineProperty;
3
4
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
@@ -24,9 +25,9 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
24
25
  mod
25
26
  ));
26
27
 
27
- // ../node_modules/.pnpm/balanced-match@1.0.2/node_modules/balanced-match/index.js
28
+ // ../../node_modules/.pnpm/balanced-match@1.0.2/node_modules/balanced-match/index.js
28
29
  var require_balanced_match = __commonJS({
29
- "../node_modules/.pnpm/balanced-match@1.0.2/node_modules/balanced-match/index.js"(exports, module) {
30
+ "../../node_modules/.pnpm/balanced-match@1.0.2/node_modules/balanced-match/index.js"(exports, module) {
30
31
  "use strict";
31
32
  module.exports = balanced;
32
33
  function balanced(a, b, str) {
@@ -82,9 +83,9 @@ var require_balanced_match = __commonJS({
82
83
  }
83
84
  });
84
85
 
85
- // ../node_modules/.pnpm/brace-expansion@2.0.1/node_modules/brace-expansion/index.js
86
+ // ../../node_modules/.pnpm/brace-expansion@2.0.1/node_modules/brace-expansion/index.js
86
87
  var require_brace_expansion = __commonJS({
87
- "../node_modules/.pnpm/brace-expansion@2.0.1/node_modules/brace-expansion/index.js"(exports, module) {
88
+ "../../node_modules/.pnpm/brace-expansion@2.0.1/node_modules/brace-expansion/index.js"(exports, module) {
88
89
  "use strict";
89
90
  var balanced = require_balanced_match();
90
91
  module.exports = expandTop;
@@ -283,7 +284,7 @@ function assertDirArg(path6, argName, make) {
283
284
  }
284
285
 
285
286
  // src/index.ts
286
- import { existsSync as existsSync3 } from "node:fs";
287
+ import { existsSync as existsSync4 } from "node:fs";
287
288
 
288
289
  // src/build/build.ts
289
290
  import { rm } from "node:fs/promises";
@@ -309,7 +310,7 @@ function runNextBuildCommand(packager, nextAppDir2) {
309
310
 
310
311
  // src/build/build-worker.ts
311
312
  import { build } from "esbuild";
312
- import { readFileSync as readFileSync4 } from "node:fs";
313
+ import { existsSync as existsSync3, readFileSync as readFileSync4 } from "node:fs";
313
314
  import { cp, readFile, writeFile } from "node:fs/promises";
314
315
 
315
316
  // src/build/patches/investigated/patch-require.ts
@@ -331,10 +332,10 @@ function copyTemplates(srcDir, nextjsAppPaths) {
331
332
  // src/build/patches/to-investigate/patch-read-file.ts
332
333
  import { readFileSync } from "node:fs";
333
334
 
334
- // ../node_modules/.pnpm/minimatch@10.0.1/node_modules/minimatch/dist/esm/index.js
335
+ // ../../node_modules/.pnpm/minimatch@10.0.1/node_modules/minimatch/dist/esm/index.js
335
336
  var import_brace_expansion = __toESM(require_brace_expansion(), 1);
336
337
 
337
- // ../node_modules/.pnpm/minimatch@10.0.1/node_modules/minimatch/dist/esm/assert-valid-pattern.js
338
+ // ../../node_modules/.pnpm/minimatch@10.0.1/node_modules/minimatch/dist/esm/assert-valid-pattern.js
338
339
  var MAX_PATTERN_LENGTH = 1024 * 64;
339
340
  var assertValidPattern = (pattern) => {
340
341
  if (typeof pattern !== "string") {
@@ -345,7 +346,7 @@ var assertValidPattern = (pattern) => {
345
346
  }
346
347
  };
347
348
 
348
- // ../node_modules/.pnpm/minimatch@10.0.1/node_modules/minimatch/dist/esm/brace-expressions.js
349
+ // ../../node_modules/.pnpm/minimatch@10.0.1/node_modules/minimatch/dist/esm/brace-expressions.js
349
350
  var posixClasses = {
350
351
  "[:alnum:]": ["\\p{L}\\p{Nl}\\p{Nd}", true],
351
352
  "[:alpha:]": ["\\p{L}\\p{Nl}", true],
@@ -454,12 +455,12 @@ var parseClass = (glob2, position) => {
454
455
  return [comb, uflag, endPos - pos, true];
455
456
  };
456
457
 
457
- // ../node_modules/.pnpm/minimatch@10.0.1/node_modules/minimatch/dist/esm/unescape.js
458
+ // ../../node_modules/.pnpm/minimatch@10.0.1/node_modules/minimatch/dist/esm/unescape.js
458
459
  var unescape = (s, { windowsPathsNoEscape = false } = {}) => {
459
460
  return windowsPathsNoEscape ? s.replace(/\[([^\/\\])\]/g, "$1") : s.replace(/((?!\\).|^)\[([^\/\\])\]/g, "$1$2").replace(/\\([^\/])/g, "$1");
460
461
  };
461
462
 
462
- // ../node_modules/.pnpm/minimatch@10.0.1/node_modules/minimatch/dist/esm/ast.js
463
+ // ../../node_modules/.pnpm/minimatch@10.0.1/node_modules/minimatch/dist/esm/ast.js
463
464
  var types = /* @__PURE__ */ new Set(["!", "?", "+", "*", "@"]);
464
465
  var isExtglobType = (c) => types.has(c);
465
466
  var startNoTraversal = "(?!(?:^|/)\\.\\.?(?:$|/))";
@@ -938,12 +939,12 @@ var AST = class _AST {
938
939
  }
939
940
  };
940
941
 
941
- // ../node_modules/.pnpm/minimatch@10.0.1/node_modules/minimatch/dist/esm/escape.js
942
+ // ../../node_modules/.pnpm/minimatch@10.0.1/node_modules/minimatch/dist/esm/escape.js
942
943
  var escape = (s, { windowsPathsNoEscape = false } = {}) => {
943
944
  return windowsPathsNoEscape ? s.replace(/[?*()[\]]/g, "[$&]") : s.replace(/[?*()[\]\\]/g, "\\$&");
944
945
  };
945
946
 
946
- // ../node_modules/.pnpm/minimatch@10.0.1/node_modules/minimatch/dist/esm/index.js
947
+ // ../../node_modules/.pnpm/minimatch@10.0.1/node_modules/minimatch/dist/esm/index.js
947
948
  var minimatch = (p, pattern, options = {}) => {
948
949
  assertValidPattern(pattern);
949
950
  if (!options.nocomment && pattern.charAt(0) === "#") {
@@ -1661,10 +1662,10 @@ minimatch.Minimatch = Minimatch;
1661
1662
  minimatch.escape = escape;
1662
1663
  minimatch.unescape = unescape;
1663
1664
 
1664
- // ../node_modules/.pnpm/glob@11.0.0/node_modules/glob/dist/esm/glob.js
1665
+ // ../../node_modules/.pnpm/glob@11.0.0/node_modules/glob/dist/esm/glob.js
1665
1666
  import { fileURLToPath as fileURLToPath2 } from "node:url";
1666
1667
 
1667
- // ../node_modules/.pnpm/lru-cache@11.0.0/node_modules/lru-cache/dist/esm/index.js
1668
+ // ../../node_modules/.pnpm/lru-cache@11.0.0/node_modules/lru-cache/dist/esm/index.js
1668
1669
  var perf = typeof performance === "object" && performance && typeof performance.now === "function" ? performance : Date;
1669
1670
  var warned = /* @__PURE__ */ new Set();
1670
1671
  var PROCESS = typeof process === "object" && !!process ? process : {};
@@ -3033,14 +3034,14 @@ var LRUCache = class _LRUCache {
3033
3034
  }
3034
3035
  };
3035
3036
 
3036
- // ../node_modules/.pnpm/path-scurry@2.0.0/node_modules/path-scurry/dist/esm/index.js
3037
+ // ../../node_modules/.pnpm/path-scurry@2.0.0/node_modules/path-scurry/dist/esm/index.js
3037
3038
  import { posix, win32 } from "node:path";
3038
3039
  import { fileURLToPath } from "node:url";
3039
3040
  import { lstatSync, readdir as readdirCB, readdirSync, readlinkSync, realpathSync as rps } from "fs";
3040
3041
  import * as actualFS from "node:fs";
3041
3042
  import { lstat, readdir, readlink, realpath } from "node:fs/promises";
3042
3043
 
3043
- // ../node_modules/.pnpm/minipass@7.1.2/node_modules/minipass/dist/esm/index.js
3044
+ // ../../node_modules/.pnpm/minipass@7.1.2/node_modules/minipass/dist/esm/index.js
3044
3045
  import { EventEmitter } from "node:events";
3045
3046
  import Stream from "node:stream";
3046
3047
  import { StringDecoder } from "node:string_decoder";
@@ -3918,7 +3919,7 @@ var Minipass = class extends EventEmitter {
3918
3919
  }
3919
3920
  };
3920
3921
 
3921
- // ../node_modules/.pnpm/path-scurry@2.0.0/node_modules/path-scurry/dist/esm/index.js
3922
+ // ../../node_modules/.pnpm/path-scurry@2.0.0/node_modules/path-scurry/dist/esm/index.js
3922
3923
  var realpathSync = rps.native;
3923
3924
  var defaultFS = {
3924
3925
  lstatSync,
@@ -5644,7 +5645,7 @@ var PathScurryDarwin = class extends PathScurryPosix {
5644
5645
  var Path = process.platform === "win32" ? PathWin32 : PathPosix;
5645
5646
  var PathScurry = process.platform === "win32" ? PathScurryWin32 : process.platform === "darwin" ? PathScurryDarwin : PathScurryPosix;
5646
5647
 
5647
- // ../node_modules/.pnpm/glob@11.0.0/node_modules/glob/dist/esm/pattern.js
5648
+ // ../../node_modules/.pnpm/glob@11.0.0/node_modules/glob/dist/esm/pattern.js
5648
5649
  var isPatternList = (pl) => pl.length >= 1;
5649
5650
  var isGlobList = (gl) => gl.length >= 1;
5650
5651
  var Pattern = class _Pattern {
@@ -5809,7 +5810,7 @@ var Pattern = class _Pattern {
5809
5810
  }
5810
5811
  };
5811
5812
 
5812
- // ../node_modules/.pnpm/glob@11.0.0/node_modules/glob/dist/esm/ignore.js
5813
+ // ../../node_modules/.pnpm/glob@11.0.0/node_modules/glob/dist/esm/ignore.js
5813
5814
  var defaultPlatform2 = typeof process === "object" && process && typeof process.platform === "string" ? process.platform : "linux";
5814
5815
  var Ignore = class {
5815
5816
  relative;
@@ -5896,7 +5897,7 @@ var Ignore = class {
5896
5897
  }
5897
5898
  };
5898
5899
 
5899
- // ../node_modules/.pnpm/glob@11.0.0/node_modules/glob/dist/esm/processor.js
5900
+ // ../../node_modules/.pnpm/glob@11.0.0/node_modules/glob/dist/esm/processor.js
5900
5901
  var HasWalkedCache = class _HasWalkedCache {
5901
5902
  store;
5902
5903
  constructor(store = /* @__PURE__ */ new Map()) {
@@ -6117,7 +6118,7 @@ var Processor = class _Processor {
6117
6118
  }
6118
6119
  };
6119
6120
 
6120
- // ../node_modules/.pnpm/glob@11.0.0/node_modules/glob/dist/esm/walker.js
6121
+ // ../../node_modules/.pnpm/glob@11.0.0/node_modules/glob/dist/esm/walker.js
6121
6122
  var makeIgnore = (ignore, opts) => typeof ignore === "string" ? new Ignore([ignore], opts) : Array.isArray(ignore) ? new Ignore(ignore, opts) : ignore;
6122
6123
  var GlobUtil = class {
6123
6124
  path;
@@ -6444,7 +6445,7 @@ var GlobStream = class extends GlobUtil {
6444
6445
  }
6445
6446
  };
6446
6447
 
6447
- // ../node_modules/.pnpm/glob@11.0.0/node_modules/glob/dist/esm/glob.js
6448
+ // ../../node_modules/.pnpm/glob@11.0.0/node_modules/glob/dist/esm/glob.js
6448
6449
  var defaultPlatform3 = typeof process === "object" && process && typeof process.platform === "string" ? process.platform : "linux";
6449
6450
  var Glob = class {
6450
6451
  absolute;
@@ -6644,7 +6645,7 @@ var Glob = class {
6644
6645
  }
6645
6646
  };
6646
6647
 
6647
- // ../node_modules/.pnpm/glob@11.0.0/node_modules/glob/dist/esm/has-magic.js
6648
+ // ../../node_modules/.pnpm/glob@11.0.0/node_modules/glob/dist/esm/has-magic.js
6648
6649
  var hasMagic = (pattern, options = {}) => {
6649
6650
  if (!Array.isArray(pattern)) {
6650
6651
  pattern = [pattern];
@@ -6656,7 +6657,7 @@ var hasMagic = (pattern, options = {}) => {
6656
6657
  return false;
6657
6658
  };
6658
6659
 
6659
- // ../node_modules/.pnpm/glob@11.0.0/node_modules/glob/dist/esm/index.js
6660
+ // ../../node_modules/.pnpm/glob@11.0.0/node_modules/glob/dist/esm/index.js
6660
6661
  function globStreamSync(pattern, options = {}) {
6661
6662
  return new Glob(pattern, options).streamSync();
6662
6663
  }
@@ -6969,7 +6970,7 @@ async function updateWebpackChunksFile(nextjsAppPaths) {
6969
6970
  }
6970
6971
 
6971
6972
  // src/build/build-worker.ts
6972
- async function buildWorker(outputDir2, nextjsAppPaths, templateSrcDir) {
6973
+ async function buildWorker(inputNextAppDir, outputDir2, nextjsAppPaths, templateSrcDir) {
6973
6974
  const templateDir = copyTemplates(templateSrcDir, nextjsAppPaths);
6974
6975
  const workerEntrypoint = `${templateDir}/worker.ts`;
6975
6976
  const workerOutputFile = `${outputDir2}/index.mjs`;
@@ -7067,6 +7068,11 @@ Request = globalThis.Request;
7067
7068
  await cp(`${nextjsAppPaths.dotNextDir}/static`, `${outputDir2}/assets/_next/static`, {
7068
7069
  recursive: true
7069
7070
  });
7071
+ if (existsSync3(`${inputNextAppDir}/public`)) {
7072
+ await cp(`${inputNextAppDir}/public`, `${outputDir2}/assets`, {
7073
+ recursive: true
7074
+ });
7075
+ }
7070
7076
  console.log(`\x1B[35mWorker saved in \`${workerOutputFile}\` \u{1F680}
7071
7077
  \x1B[0m`);
7072
7078
  }
@@ -7169,7 +7175,7 @@ async function build2(inputNextAppDir, opts) {
7169
7175
  await cleanDirectory(outputDir2);
7170
7176
  const nextjsAppPaths = getNextjsAppPaths(inputNextAppDir);
7171
7177
  const templateDir = path5.join(path5.dirname(fileURLToPath3(import.meta.url)), "templates");
7172
- await buildWorker(outputDir2, nextjsAppPaths, templateDir);
7178
+ await buildWorker(inputNextAppDir, outputDir2, nextjsAppPaths, templateDir);
7173
7179
  }
7174
7180
  async function cleanDirectory(path6) {
7175
7181
  return await rm(path6, { recursive: true, force: true });
@@ -7178,7 +7184,7 @@ async function cleanDirectory(path6) {
7178
7184
  // src/index.ts
7179
7185
  var nextAppDir = resolve2(".");
7180
7186
  console.log(`Building the Next.js app in the current folder (${nextAppDir})`);
7181
- if (!["js", "cjs", "mjs", "ts"].some((ext2) => existsSync3(`./next.config.${ext2}`))) {
7187
+ if (!["js", "cjs", "mjs", "ts"].some((ext2) => existsSync4(`./next.config.${ext2}`))) {
7182
7188
  throw new Error("Error: Not in a Next.js app project");
7183
7189
  }
7184
7190
  var { skipBuild, outputDir } = getArgs();
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.0.0-88fe982",
4
+ "version": "0.0.0-e2c4535",
5
5
  "bin": "dist/index.mjs",
6
6
  "files": [
7
7
  "README.md",
@@ -9,8 +9,8 @@
9
9
  ],
10
10
  "repository": {
11
11
  "type": "git",
12
- "url": "https://github.com/flarelabs-net/poc-next.git",
13
- "directory": "builder"
12
+ "url": "https://github.com/opennextjs/opennextjs-cloudflare.git",
13
+ "directory": "packages/cloudflare"
14
14
  },
15
15
  "keywords": [
16
16
  "cloudflare",
@@ -19,9 +19,9 @@
19
19
  ],
20
20
  "license": "MIT",
21
21
  "bugs": {
22
- "url": "https://github.com/flarelabs-net/poc-next/issues"
22
+ "url": "https://github.com/opennextjs/opennextjs-cloudflare/issues"
23
23
  },
24
- "homepage": "https://github.com/flarelabs-net/poc-next",
24
+ "homepage": "https://github.com/opennextjs/opennextjs-cloudflare",
25
25
  "devDependencies": {
26
26
  "@types/node": "^22.2.0",
27
27
  "esbuild": "^0.23.0",