@netlify/plugin-nextjs 5.1.2 → 5.2.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/dist/build/advanced-api-routes.js +121 -4
- package/dist/build/cache.js +25 -4
- package/dist/build/content/prerendered.js +237 -8
- package/dist/build/content/server.js +259 -14
- package/dist/build/content/static.js +96 -11
- package/dist/build/functions/edge.js +511 -5
- package/dist/build/functions/server.js +131 -12
- package/dist/build/image-cdn.js +1615 -3
- package/dist/build/plugin-context.js +236 -5
- package/dist/build/templates/handler-monorepo.tmpl.js +3 -0
- package/dist/build/templates/handler.tmpl.js +3 -0
- package/dist/build/verification.js +81 -8
- package/dist/esm-chunks/{package-RVJOBSMH.js → package-SCUAWNXR.js} +23 -23
- package/dist/index.js +25 -36
- package/dist/run/config.js +25 -6
- package/dist/run/constants.js +7 -5
- package/dist/run/handlers/cache.cjs +6 -567
- package/dist/run/handlers/request-context.cjs +8 -1
- package/dist/run/handlers/server.js +20 -22
- package/dist/run/handlers/tracing.js +27022 -10456
- package/dist/run/headers.js +198 -8
- package/dist/run/next.cjs +106 -655
- package/dist/{esm-chunks/chunk-PMRBBOBY.js → run/regional-blob-store.cjs} +117 -263
- package/dist/run/revalidate.js +17 -3
- package/dist/run/systemlog.js +94 -3
- package/dist/shared/blobkey.js +15 -3
- package/edge-runtime/lib/response.ts +3 -2
- package/package.json +1 -1
- package/dist/esm-chunks/chunk-3SUDZQ7L.js +0 -40
- package/dist/esm-chunks/chunk-4BNHE6TP.js +0 -278
- package/dist/esm-chunks/chunk-72ZI2IVI.js +0 -36
- package/dist/esm-chunks/chunk-BG455SFE.js +0 -133
- package/dist/esm-chunks/chunk-HESS57SH.js +0 -127
- package/dist/esm-chunks/chunk-HYBEXB2Z.js +0 -105
- package/dist/esm-chunks/chunk-K7BTUM7O.js +0 -97
- package/dist/esm-chunks/chunk-L6OM53B6.js +0 -238
- package/dist/esm-chunks/chunk-MCEOSJH6.js +0 -1637
- package/dist/esm-chunks/chunk-MRD3XSKD.js +0 -248
- package/dist/esm-chunks/chunk-RL4K4CVH.js +0 -27
- package/dist/esm-chunks/chunk-TYCYFZ22.js +0 -25
- package/dist/esm-chunks/chunk-UTQSBE5O.js +0 -524
- package/dist/esm-chunks/chunk-UYKENJEU.js +0 -19
- package/dist/esm-chunks/chunk-V2T6NUOM.js +0 -113
package/dist/run/next.cjs
CHANGED
|
@@ -5,9 +5,6 @@ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
|
5
5
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
6
|
var __getProtoOf = Object.getPrototypeOf;
|
|
7
7
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
-
var __esm = (fn, res) => function __init() {
|
|
9
|
-
return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
|
|
10
|
-
};
|
|
11
8
|
var __commonJS = (cb, mod) => function __require() {
|
|
12
9
|
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
13
10
|
};
|
|
@@ -41,12 +38,9 @@ var require_lists = __commonJS({
|
|
|
41
38
|
value: true
|
|
42
39
|
});
|
|
43
40
|
exports2.fsSyncMethods = exports2.fsProps = exports2.fsAsyncMethods = void 0;
|
|
44
|
-
var fsProps = ["constants", "F_OK", "R_OK", "W_OK", "X_OK", "Stats"];
|
|
45
|
-
exports2.
|
|
46
|
-
var
|
|
47
|
-
exports2.fsSyncMethods = fsSyncMethods;
|
|
48
|
-
var fsAsyncMethods = ["rename", "ftruncate", "truncate", "chown", "fchown", "lchown", "chmod", "fchmod", "lchmod", "stat", "lstat", "fstat", "link", "symlink", "readlink", "realpath", "unlink", "rmdir", "mkdir", "mkdirp", "readdir", "close", "open", "utimes", "futimes", "fsync", "write", "read", "readFile", "writeFile", "appendFile", "exists", "access", "fdatasync", "mkdtemp", "copyFile", "rm", "watchFile", "unwatchFile", "watch"];
|
|
49
|
-
exports2.fsAsyncMethods = fsAsyncMethods;
|
|
41
|
+
var fsProps = exports2.fsProps = ["constants", "F_OK", "R_OK", "W_OK", "X_OK", "Stats"];
|
|
42
|
+
var fsSyncMethods = exports2.fsSyncMethods = ["renameSync", "ftruncateSync", "truncateSync", "chownSync", "fchownSync", "lchownSync", "chmodSync", "fchmodSync", "lchmodSync", "statSync", "lstatSync", "fstatSync", "linkSync", "symlinkSync", "readlinkSync", "realpathSync", "unlinkSync", "rmdirSync", "mkdirSync", "mkdirpSync", "readdirSync", "closeSync", "openSync", "utimesSync", "futimesSync", "fsyncSync", "writeSync", "readSync", "readFileSync", "writeFileSync", "appendFileSync", "existsSync", "accessSync", "fdatasyncSync", "mkdtempSync", "copyFileSync", "rmSync", "createReadStream", "createWriteStream"];
|
|
43
|
+
var fsAsyncMethods = exports2.fsAsyncMethods = ["rename", "ftruncate", "truncate", "chown", "fchown", "lchown", "chmod", "fchmod", "lchmod", "stat", "lstat", "fstat", "link", "symlink", "readlink", "realpath", "unlink", "rmdir", "mkdir", "mkdirp", "readdir", "close", "open", "utimes", "futimes", "fsync", "write", "read", "readFile", "writeFile", "appendFile", "exists", "access", "fdatasync", "mkdtemp", "copyFile", "rm", "watchFile", "unwatchFile", "watch"];
|
|
50
44
|
}
|
|
51
45
|
});
|
|
52
46
|
|
|
@@ -238,56 +232,42 @@ var require_correctPath = __commonJS({
|
|
|
238
232
|
var require_patchRequire = __commonJS({
|
|
239
233
|
"node_modules/fs-monkey/lib/patchRequire.js"(exports2) {
|
|
240
234
|
"use strict";
|
|
241
|
-
function _typeof(
|
|
235
|
+
function _typeof(o) {
|
|
242
236
|
"@babel/helpers - typeof";
|
|
243
|
-
return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(
|
|
244
|
-
return typeof
|
|
245
|
-
} : function(
|
|
246
|
-
return
|
|
247
|
-
}, _typeof(
|
|
237
|
+
return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o2) {
|
|
238
|
+
return typeof o2;
|
|
239
|
+
} : function(o2) {
|
|
240
|
+
return o2 && "function" == typeof Symbol && o2.constructor === Symbol && o2 !== Symbol.prototype ? "symbol" : typeof o2;
|
|
241
|
+
}, _typeof(o);
|
|
248
242
|
}
|
|
249
243
|
Object.defineProperty(exports2, "__esModule", {
|
|
250
244
|
value: true
|
|
251
245
|
});
|
|
252
246
|
exports2["default"] = patchRequire;
|
|
253
247
|
var path = _interopRequireWildcard(require("path"));
|
|
254
|
-
function _getRequireWildcardCache(
|
|
255
|
-
if (typeof WeakMap
|
|
248
|
+
function _getRequireWildcardCache(e) {
|
|
249
|
+
if ("function" != typeof WeakMap)
|
|
256
250
|
return null;
|
|
257
|
-
var
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
var
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
|
|
276
|
-
for (var key in obj) {
|
|
277
|
-
if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
|
|
278
|
-
var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
|
|
279
|
-
if (desc && (desc.get || desc.set)) {
|
|
280
|
-
Object.defineProperty(newObj, key, desc);
|
|
281
|
-
} else {
|
|
282
|
-
newObj[key] = obj[key];
|
|
283
|
-
}
|
|
251
|
+
var r = /* @__PURE__ */ new WeakMap(), t = /* @__PURE__ */ new WeakMap();
|
|
252
|
+
return (_getRequireWildcardCache = function _getRequireWildcardCache2(e2) {
|
|
253
|
+
return e2 ? t : r;
|
|
254
|
+
})(e);
|
|
255
|
+
}
|
|
256
|
+
function _interopRequireWildcard(e, r) {
|
|
257
|
+
if (!r && e && e.__esModule)
|
|
258
|
+
return e;
|
|
259
|
+
if (null === e || "object" != _typeof(e) && "function" != typeof e)
|
|
260
|
+
return { "default": e };
|
|
261
|
+
var t = _getRequireWildcardCache(r);
|
|
262
|
+
if (t && t.has(e))
|
|
263
|
+
return t.get(e);
|
|
264
|
+
var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor;
|
|
265
|
+
for (var u in e)
|
|
266
|
+
if ("default" !== u && {}.hasOwnProperty.call(e, u)) {
|
|
267
|
+
var i = a ? Object.getOwnPropertyDescriptor(e, u) : null;
|
|
268
|
+
i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u];
|
|
284
269
|
}
|
|
285
|
-
|
|
286
|
-
newObj["default"] = obj;
|
|
287
|
-
if (cache) {
|
|
288
|
-
cache.set(obj, newObj);
|
|
289
|
-
}
|
|
290
|
-
return newObj;
|
|
270
|
+
return n["default"] = e, t && t.set(e, n), n;
|
|
291
271
|
}
|
|
292
272
|
var isWin32 = process.platform === "win32";
|
|
293
273
|
var correctPath = isWin32 ? require_correctPath().correctPath : function(p) {
|
|
@@ -473,32 +453,32 @@ var require_patchRequire = __commonJS({
|
|
|
473
453
|
var require_lib = __commonJS({
|
|
474
454
|
"node_modules/fs-monkey/lib/index.js"(exports2) {
|
|
475
455
|
"use strict";
|
|
476
|
-
function _typeof(
|
|
456
|
+
function _typeof(o) {
|
|
477
457
|
"@babel/helpers - typeof";
|
|
478
|
-
return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(
|
|
479
|
-
return typeof
|
|
480
|
-
} : function(
|
|
481
|
-
return
|
|
482
|
-
}, _typeof(
|
|
458
|
+
return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o2) {
|
|
459
|
+
return typeof o2;
|
|
460
|
+
} : function(o2) {
|
|
461
|
+
return o2 && "function" == typeof Symbol && o2.constructor === Symbol && o2 !== Symbol.prototype ? "symbol" : typeof o2;
|
|
462
|
+
}, _typeof(o);
|
|
483
463
|
}
|
|
484
464
|
Object.defineProperty(exports2, "__esModule", {
|
|
485
465
|
value: true
|
|
486
466
|
});
|
|
487
467
|
Object.defineProperty(exports2, "patchFs", {
|
|
488
468
|
enumerable: true,
|
|
489
|
-
get: function
|
|
469
|
+
get: function get2() {
|
|
490
470
|
return _patchFs["default"];
|
|
491
471
|
}
|
|
492
472
|
});
|
|
493
473
|
Object.defineProperty(exports2, "patchRequire", {
|
|
494
474
|
enumerable: true,
|
|
495
|
-
get: function
|
|
475
|
+
get: function get2() {
|
|
496
476
|
return _patchRequire["default"];
|
|
497
477
|
}
|
|
498
478
|
});
|
|
499
479
|
Object.defineProperty(exports2, "unixify", {
|
|
500
480
|
enumerable: true,
|
|
501
|
-
get: function
|
|
481
|
+
get: function get2() {
|
|
502
482
|
return _correctPath.unixify;
|
|
503
483
|
}
|
|
504
484
|
});
|
|
@@ -508,43 +488,29 @@ var require_lib = __commonJS({
|
|
|
508
488
|
var _correctPath = require_correctPath();
|
|
509
489
|
var util = _interopRequireWildcard(require_lists());
|
|
510
490
|
exports2.util = util;
|
|
511
|
-
function _getRequireWildcardCache(
|
|
512
|
-
if (typeof WeakMap
|
|
491
|
+
function _getRequireWildcardCache(e) {
|
|
492
|
+
if ("function" != typeof WeakMap)
|
|
513
493
|
return null;
|
|
514
|
-
var
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
var
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
|
|
533
|
-
for (var key in obj) {
|
|
534
|
-
if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
|
|
535
|
-
var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
|
|
536
|
-
if (desc && (desc.get || desc.set)) {
|
|
537
|
-
Object.defineProperty(newObj, key, desc);
|
|
538
|
-
} else {
|
|
539
|
-
newObj[key] = obj[key];
|
|
540
|
-
}
|
|
494
|
+
var r = /* @__PURE__ */ new WeakMap(), t = /* @__PURE__ */ new WeakMap();
|
|
495
|
+
return (_getRequireWildcardCache = function _getRequireWildcardCache2(e2) {
|
|
496
|
+
return e2 ? t : r;
|
|
497
|
+
})(e);
|
|
498
|
+
}
|
|
499
|
+
function _interopRequireWildcard(e, r) {
|
|
500
|
+
if (!r && e && e.__esModule)
|
|
501
|
+
return e;
|
|
502
|
+
if (null === e || "object" != _typeof(e) && "function" != typeof e)
|
|
503
|
+
return { "default": e };
|
|
504
|
+
var t = _getRequireWildcardCache(r);
|
|
505
|
+
if (t && t.has(e))
|
|
506
|
+
return t.get(e);
|
|
507
|
+
var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor;
|
|
508
|
+
for (var u in e)
|
|
509
|
+
if ("default" !== u && {}.hasOwnProperty.call(e, u)) {
|
|
510
|
+
var i = a ? Object.getOwnPropertyDescriptor(e, u) : null;
|
|
511
|
+
i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u];
|
|
541
512
|
}
|
|
542
|
-
|
|
543
|
-
newObj["default"] = obj;
|
|
544
|
-
if (cache) {
|
|
545
|
-
cache.set(obj, newObj);
|
|
546
|
-
}
|
|
547
|
-
return newObj;
|
|
513
|
+
return n["default"] = e, t && t.set(e, n), n;
|
|
548
514
|
}
|
|
549
515
|
function _interopRequireDefault(obj) {
|
|
550
516
|
return obj && obj.__esModule ? obj : { "default": obj };
|
|
@@ -552,31 +518,6 @@ var require_lib = __commonJS({
|
|
|
552
518
|
}
|
|
553
519
|
});
|
|
554
520
|
|
|
555
|
-
// src/shared/blobkey.ts
|
|
556
|
-
var blobkey_exports = {};
|
|
557
|
-
__export(blobkey_exports, {
|
|
558
|
-
encodeBlobKey: () => encodeBlobKey
|
|
559
|
-
});
|
|
560
|
-
async function encodeBlobKey(key) {
|
|
561
|
-
const buffer = import_node_buffer.Buffer.from(key);
|
|
562
|
-
const base64 = buffer.toString("base64url");
|
|
563
|
-
if (base64.length <= maxLength) {
|
|
564
|
-
return base64;
|
|
565
|
-
}
|
|
566
|
-
const digest = await import_node_crypto.webcrypto.subtle.digest("SHA-256", buffer);
|
|
567
|
-
const hash = import_node_buffer.Buffer.from(digest).toString("base64url");
|
|
568
|
-
return `${base64.slice(0, maxLength - hash.length - 1)}-${hash}`;
|
|
569
|
-
}
|
|
570
|
-
var import_node_buffer, import_node_crypto, maxLength;
|
|
571
|
-
var init_blobkey = __esm({
|
|
572
|
-
"src/shared/blobkey.ts"() {
|
|
573
|
-
"use strict";
|
|
574
|
-
import_node_buffer = require("node:buffer");
|
|
575
|
-
import_node_crypto = require("node:crypto");
|
|
576
|
-
maxLength = 180;
|
|
577
|
-
}
|
|
578
|
-
});
|
|
579
|
-
|
|
580
521
|
// src/run/next.cts
|
|
581
522
|
var next_exports = {};
|
|
582
523
|
__export(next_exports, {
|
|
@@ -585,560 +526,70 @@ __export(next_exports, {
|
|
|
585
526
|
module.exports = __toCommonJS(next_exports);
|
|
586
527
|
var import_promises = __toESM(require("fs/promises"));
|
|
587
528
|
var import_path = require("path");
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
var
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
var base64Encode = (input) => {
|
|
611
|
-
const { Buffer: Buffer3 } = globalThis;
|
|
612
|
-
if (Buffer3) {
|
|
613
|
-
return Buffer3.from(input).toString("base64");
|
|
614
|
-
}
|
|
615
|
-
return btoa(input);
|
|
616
|
-
};
|
|
617
|
-
var BASE64_PREFIX = "b64;";
|
|
618
|
-
var METADATA_HEADER_INTERNAL = "x-amz-meta-user";
|
|
619
|
-
var METADATA_HEADER_EXTERNAL = "netlify-blobs-metadata";
|
|
620
|
-
var METADATA_MAX_SIZE = 2 * 1024;
|
|
621
|
-
var encodeMetadata = (metadata) => {
|
|
622
|
-
if (!metadata) {
|
|
623
|
-
return null;
|
|
624
|
-
}
|
|
625
|
-
const encodedObject = base64Encode(JSON.stringify(metadata));
|
|
626
|
-
const payload = `b64;${encodedObject}`;
|
|
627
|
-
if (METADATA_HEADER_EXTERNAL.length + payload.length > METADATA_MAX_SIZE) {
|
|
628
|
-
throw new Error("Metadata object exceeds the maximum size");
|
|
629
|
-
}
|
|
630
|
-
return payload;
|
|
631
|
-
};
|
|
632
|
-
var decodeMetadata = (header) => {
|
|
633
|
-
if (!header || !header.startsWith(BASE64_PREFIX)) {
|
|
634
|
-
return {};
|
|
635
|
-
}
|
|
636
|
-
const encodedData = header.slice(BASE64_PREFIX.length);
|
|
637
|
-
const decodedData = base64Decode(encodedData);
|
|
638
|
-
const metadata = JSON.parse(decodedData);
|
|
639
|
-
return metadata;
|
|
640
|
-
};
|
|
641
|
-
var getMetadataFromResponse = (response) => {
|
|
642
|
-
if (!response.headers) {
|
|
643
|
-
return {};
|
|
644
|
-
}
|
|
645
|
-
const value = response.headers.get(METADATA_HEADER_EXTERNAL) || response.headers.get(METADATA_HEADER_INTERNAL);
|
|
646
|
-
try {
|
|
647
|
-
return decodeMetadata(value);
|
|
648
|
-
} catch {
|
|
649
|
-
throw new Error(
|
|
650
|
-
"An internal error occurred while trying to retrieve the metadata for an entry. Please try updating to the latest version of the Netlify Blobs client."
|
|
651
|
-
);
|
|
652
|
-
}
|
|
653
|
-
};
|
|
654
|
-
var BlobsConsistencyError = class extends Error {
|
|
655
|
-
constructor() {
|
|
656
|
-
super(
|
|
657
|
-
`Netlify Blobs has failed to perform a read using strong consistency because the environment has not been configured with a 'uncachedEdgeURL' property`
|
|
658
|
-
);
|
|
659
|
-
this.name = "BlobsConsistencyError";
|
|
660
|
-
}
|
|
661
|
-
};
|
|
662
|
-
var getEnvironment = () => {
|
|
663
|
-
const { Deno, Netlify, process: process2 } = globalThis;
|
|
664
|
-
return Netlify?.env ?? Deno?.env ?? {
|
|
665
|
-
delete: (key) => delete process2?.env[key],
|
|
666
|
-
get: (key) => process2?.env[key],
|
|
667
|
-
has: (key) => Boolean(process2?.env[key]),
|
|
668
|
-
set: (key, value) => {
|
|
669
|
-
if (process2?.env) {
|
|
670
|
-
process2.env[key] = value;
|
|
671
|
-
}
|
|
672
|
-
},
|
|
673
|
-
toObject: () => process2?.env ?? {}
|
|
674
|
-
};
|
|
675
|
-
};
|
|
676
|
-
var getEnvironmentContext = () => {
|
|
677
|
-
const context = globalThis.netlifyBlobsContext || getEnvironment().get("NETLIFY_BLOBS_CONTEXT");
|
|
678
|
-
if (typeof context !== "string" || !context) {
|
|
679
|
-
return {};
|
|
680
|
-
}
|
|
681
|
-
const data = base64Decode(context);
|
|
682
|
-
try {
|
|
683
|
-
return JSON.parse(data);
|
|
684
|
-
} catch {
|
|
685
|
-
}
|
|
686
|
-
return {};
|
|
687
|
-
};
|
|
688
|
-
var MissingBlobsEnvironmentError = class extends Error {
|
|
689
|
-
constructor(requiredProperties) {
|
|
690
|
-
super(
|
|
691
|
-
`The environment has not been configured to use Netlify Blobs. To use it manually, supply the following properties when creating a store: ${requiredProperties.join(
|
|
692
|
-
", "
|
|
693
|
-
)}`
|
|
694
|
-
);
|
|
695
|
-
this.name = "MissingBlobsEnvironmentError";
|
|
696
|
-
}
|
|
697
|
-
};
|
|
698
|
-
var DEFAULT_RETRY_DELAY = getEnvironment().get("NODE_ENV") === "test" ? 1 : 5e3;
|
|
699
|
-
var MIN_RETRY_DELAY = 1e3;
|
|
700
|
-
var MAX_RETRY = 5;
|
|
701
|
-
var RATE_LIMIT_HEADER = "X-RateLimit-Reset";
|
|
702
|
-
var fetchAndRetry = async (fetch, url, options, attemptsLeft = MAX_RETRY) => {
|
|
703
|
-
try {
|
|
704
|
-
const res = await fetch(url, options);
|
|
705
|
-
if (attemptsLeft > 0 && (res.status === 429 || res.status >= 500)) {
|
|
706
|
-
const delay = getDelay(res.headers.get(RATE_LIMIT_HEADER));
|
|
707
|
-
await sleep(delay);
|
|
708
|
-
return fetchAndRetry(fetch, url, options, attemptsLeft - 1);
|
|
709
|
-
}
|
|
710
|
-
return res;
|
|
711
|
-
} catch (error) {
|
|
712
|
-
if (attemptsLeft === 0) {
|
|
713
|
-
throw error;
|
|
714
|
-
}
|
|
715
|
-
const delay = getDelay();
|
|
716
|
-
await sleep(delay);
|
|
717
|
-
return fetchAndRetry(fetch, url, options, attemptsLeft - 1);
|
|
718
|
-
}
|
|
719
|
-
};
|
|
720
|
-
var getDelay = (rateLimitReset) => {
|
|
721
|
-
if (!rateLimitReset) {
|
|
722
|
-
return DEFAULT_RETRY_DELAY;
|
|
723
|
-
}
|
|
724
|
-
return Math.max(Number(rateLimitReset) * 1e3 - Date.now(), MIN_RETRY_DELAY);
|
|
725
|
-
};
|
|
726
|
-
var sleep = (ms) => new Promise((resolve2) => {
|
|
727
|
-
setTimeout(resolve2, ms);
|
|
728
|
-
});
|
|
729
|
-
var SIGNED_URL_ACCEPT_HEADER = "application/json;type=signed-url";
|
|
730
|
-
var Client = class {
|
|
731
|
-
constructor({ apiURL, consistency, edgeURL, fetch, siteID, token, uncachedEdgeURL }) {
|
|
732
|
-
this.apiURL = apiURL;
|
|
733
|
-
this.consistency = consistency ?? "eventual";
|
|
734
|
-
this.edgeURL = edgeURL;
|
|
735
|
-
this.fetch = fetch ?? globalThis.fetch;
|
|
736
|
-
this.siteID = siteID;
|
|
737
|
-
this.token = token;
|
|
738
|
-
this.uncachedEdgeURL = uncachedEdgeURL;
|
|
739
|
-
if (!this.fetch) {
|
|
740
|
-
throw new Error(
|
|
741
|
-
"Netlify Blobs could not find a `fetch` client in the global scope. You can either update your runtime to a version that includes `fetch` (like Node.js 18.0.0 or above), or you can supply your own implementation using the `fetch` property."
|
|
742
|
-
);
|
|
743
|
-
}
|
|
744
|
-
}
|
|
745
|
-
async getFinalRequest({
|
|
746
|
-
consistency: opConsistency,
|
|
747
|
-
key,
|
|
748
|
-
metadata,
|
|
749
|
-
method,
|
|
750
|
-
parameters = {},
|
|
751
|
-
storeName
|
|
752
|
-
}) {
|
|
753
|
-
const encodedMetadata = encodeMetadata(metadata);
|
|
754
|
-
const consistency = opConsistency ?? this.consistency;
|
|
755
|
-
let urlPath = `/${this.siteID}`;
|
|
756
|
-
if (storeName) {
|
|
757
|
-
urlPath += `/${storeName}`;
|
|
758
|
-
}
|
|
759
|
-
if (key) {
|
|
760
|
-
urlPath += `/${key}`;
|
|
761
|
-
}
|
|
762
|
-
if (this.edgeURL) {
|
|
763
|
-
if (consistency === "strong" && !this.uncachedEdgeURL) {
|
|
764
|
-
throw new BlobsConsistencyError();
|
|
765
|
-
}
|
|
766
|
-
const headers = {
|
|
767
|
-
authorization: `Bearer ${this.token}`
|
|
768
|
-
};
|
|
769
|
-
if (encodedMetadata) {
|
|
770
|
-
headers[METADATA_HEADER_INTERNAL] = encodedMetadata;
|
|
771
|
-
}
|
|
772
|
-
const url2 = new URL(urlPath, consistency === "strong" ? this.uncachedEdgeURL : this.edgeURL);
|
|
773
|
-
for (const key2 in parameters) {
|
|
774
|
-
url2.searchParams.set(key2, parameters[key2]);
|
|
775
|
-
}
|
|
776
|
-
return {
|
|
777
|
-
headers,
|
|
778
|
-
url: url2.toString()
|
|
529
|
+
var import_fs_monkey = __toESM(require_lib());
|
|
530
|
+
var import_request_context = require("./handlers/request-context.cjs");
|
|
531
|
+
var import_tracer = require("./handlers/tracer.cjs");
|
|
532
|
+
var import_regional_blob_store = require("./regional-blob-store.cjs");
|
|
533
|
+
console.time("import next server");
|
|
534
|
+
var { getRequestHandlers } = require("next/dist/server/lib/start-server.js");
|
|
535
|
+
var ResponseCache = require("next/dist/server/response-cache/index.js").default;
|
|
536
|
+
var originalGet = ResponseCache.prototype.get;
|
|
537
|
+
ResponseCache.prototype.get = function get(...getArgs) {
|
|
538
|
+
if (!this.didAddBackgroundWorkTracking) {
|
|
539
|
+
if (typeof this.batcher !== "undefined") {
|
|
540
|
+
const originalBatcherBatch = this.batcher.batch;
|
|
541
|
+
this.batcher.batch = async (key, fn) => {
|
|
542
|
+
const trackedFn = async (...workFnArgs) => {
|
|
543
|
+
const workPromise = fn(...workFnArgs);
|
|
544
|
+
const requestContext = (0, import_request_context.getRequestContext)();
|
|
545
|
+
if (requestContext && workPromise instanceof Promise) {
|
|
546
|
+
requestContext.trackBackgroundWork(workPromise);
|
|
547
|
+
}
|
|
548
|
+
return await workPromise;
|
|
549
|
+
};
|
|
550
|
+
return originalBatcherBatch.call(this.batcher, key, trackedFn);
|
|
779
551
|
};
|
|
780
|
-
}
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
552
|
+
} else if (typeof this.pendingResponses !== "undefined") {
|
|
553
|
+
const backgroundWork = /* @__PURE__ */ new Map();
|
|
554
|
+
const originalPendingResponsesSet = this.pendingResponses.set;
|
|
555
|
+
this.pendingResponses.set = async (key, value) => {
|
|
556
|
+
const requestContext = (0, import_request_context.getRequestContext)();
|
|
557
|
+
if (requestContext && !this.pendingResponses.has(key)) {
|
|
558
|
+
const workPromise = new Promise((_resolve) => {
|
|
559
|
+
backgroundWork.set(key, _resolve);
|
|
560
|
+
});
|
|
561
|
+
requestContext.trackBackgroundWork(workPromise);
|
|
562
|
+
}
|
|
563
|
+
return originalPendingResponsesSet.call(this.pendingResponses, key, value);
|
|
790
564
|
};
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
url: url.toString()
|
|
565
|
+
const originalPendingResponsesDelete = this.pendingResponses.delete;
|
|
566
|
+
this.pendingResponses.delete = async (key) => {
|
|
567
|
+
const _resolve = backgroundWork.get(key);
|
|
568
|
+
if (_resolve) {
|
|
569
|
+
_resolve();
|
|
570
|
+
}
|
|
571
|
+
return originalPendingResponsesDelete.call(this.pendingResponses, key);
|
|
799
572
|
};
|
|
800
573
|
}
|
|
801
|
-
|
|
802
|
-
headers: { ...apiHeaders, accept: SIGNED_URL_ACCEPT_HEADER },
|
|
803
|
-
method
|
|
804
|
-
});
|
|
805
|
-
if (res.status !== 200) {
|
|
806
|
-
throw new Error(`Netlify Blobs has generated an internal error: ${res.status} response`);
|
|
807
|
-
}
|
|
808
|
-
const { url: signedURL } = await res.json();
|
|
809
|
-
const userHeaders = encodedMetadata ? { [METADATA_HEADER_INTERNAL]: encodedMetadata } : void 0;
|
|
810
|
-
return {
|
|
811
|
-
headers: userHeaders,
|
|
812
|
-
url: signedURL
|
|
813
|
-
};
|
|
814
|
-
}
|
|
815
|
-
async makeRequest({
|
|
816
|
-
body,
|
|
817
|
-
consistency,
|
|
818
|
-
headers: extraHeaders,
|
|
819
|
-
key,
|
|
820
|
-
metadata,
|
|
821
|
-
method,
|
|
822
|
-
parameters,
|
|
823
|
-
storeName
|
|
824
|
-
}) {
|
|
825
|
-
const { headers: baseHeaders = {}, url } = await this.getFinalRequest({
|
|
826
|
-
consistency,
|
|
827
|
-
key,
|
|
828
|
-
metadata,
|
|
829
|
-
method,
|
|
830
|
-
parameters,
|
|
831
|
-
storeName
|
|
832
|
-
});
|
|
833
|
-
const headers = {
|
|
834
|
-
...baseHeaders,
|
|
835
|
-
...extraHeaders
|
|
836
|
-
};
|
|
837
|
-
if (method === "put") {
|
|
838
|
-
headers["cache-control"] = "max-age=0, stale-while-revalidate=60";
|
|
839
|
-
}
|
|
840
|
-
const options = {
|
|
841
|
-
body,
|
|
842
|
-
headers,
|
|
843
|
-
method
|
|
844
|
-
};
|
|
845
|
-
if (body instanceof ReadableStream) {
|
|
846
|
-
options.duplex = "half";
|
|
847
|
-
}
|
|
848
|
-
return fetchAndRetry(this.fetch, url, options);
|
|
849
|
-
}
|
|
850
|
-
};
|
|
851
|
-
var getClientOptions = (options, contextOverride) => {
|
|
852
|
-
const context = contextOverride ?? getEnvironmentContext();
|
|
853
|
-
const siteID = context.siteID ?? options.siteID;
|
|
854
|
-
const token = context.token ?? options.token;
|
|
855
|
-
if (!siteID || !token) {
|
|
856
|
-
throw new MissingBlobsEnvironmentError(["siteID", "token"]);
|
|
857
|
-
}
|
|
858
|
-
const clientOptions = {
|
|
859
|
-
apiURL: context.apiURL ?? options.apiURL,
|
|
860
|
-
consistency: options.consistency,
|
|
861
|
-
edgeURL: context.edgeURL ?? options.edgeURL,
|
|
862
|
-
fetch: options.fetch,
|
|
863
|
-
siteID,
|
|
864
|
-
token,
|
|
865
|
-
uncachedEdgeURL: context.uncachedEdgeURL ?? options.uncachedEdgeURL
|
|
866
|
-
};
|
|
867
|
-
return clientOptions;
|
|
868
|
-
};
|
|
869
|
-
|
|
870
|
-
// node_modules/@netlify/blobs/dist/main.js
|
|
871
|
-
var DEPLOY_STORE_PREFIX = "deploy:";
|
|
872
|
-
var LEGACY_STORE_INTERNAL_PREFIX = "netlify-internal/legacy-namespace/";
|
|
873
|
-
var SITE_STORE_PREFIX = "site:";
|
|
874
|
-
var Store = class _Store {
|
|
875
|
-
constructor(options) {
|
|
876
|
-
this.client = options.client;
|
|
877
|
-
if ("deployID" in options) {
|
|
878
|
-
_Store.validateDeployID(options.deployID);
|
|
879
|
-
this.name = DEPLOY_STORE_PREFIX + options.deployID;
|
|
880
|
-
} else if (options.name.startsWith(LEGACY_STORE_INTERNAL_PREFIX)) {
|
|
881
|
-
const storeName = options.name.slice(LEGACY_STORE_INTERNAL_PREFIX.length);
|
|
882
|
-
_Store.validateStoreName(storeName);
|
|
883
|
-
this.name = storeName;
|
|
884
|
-
} else {
|
|
885
|
-
_Store.validateStoreName(options.name);
|
|
886
|
-
this.name = SITE_STORE_PREFIX + options.name;
|
|
887
|
-
}
|
|
888
|
-
}
|
|
889
|
-
async delete(key) {
|
|
890
|
-
const res = await this.client.makeRequest({ key, method: "delete", storeName: this.name });
|
|
891
|
-
if (![200, 204, 404].includes(res.status)) {
|
|
892
|
-
throw new BlobsInternalError(res.status);
|
|
893
|
-
}
|
|
894
|
-
}
|
|
895
|
-
async get(key, options) {
|
|
896
|
-
const { consistency, type } = options ?? {};
|
|
897
|
-
const res = await this.client.makeRequest({ consistency, key, method: "get", storeName: this.name });
|
|
898
|
-
if (res.status === 404) {
|
|
899
|
-
return null;
|
|
900
|
-
}
|
|
901
|
-
if (res.status !== 200) {
|
|
902
|
-
throw new BlobsInternalError(res.status);
|
|
903
|
-
}
|
|
904
|
-
if (type === void 0 || type === "text") {
|
|
905
|
-
return res.text();
|
|
906
|
-
}
|
|
907
|
-
if (type === "arrayBuffer") {
|
|
908
|
-
return res.arrayBuffer();
|
|
909
|
-
}
|
|
910
|
-
if (type === "blob") {
|
|
911
|
-
return res.blob();
|
|
912
|
-
}
|
|
913
|
-
if (type === "json") {
|
|
914
|
-
return res.json();
|
|
915
|
-
}
|
|
916
|
-
if (type === "stream") {
|
|
917
|
-
return res.body;
|
|
918
|
-
}
|
|
919
|
-
throw new BlobsInternalError(res.status);
|
|
920
|
-
}
|
|
921
|
-
async getMetadata(key, { consistency } = {}) {
|
|
922
|
-
const res = await this.client.makeRequest({ consistency, key, method: "head", storeName: this.name });
|
|
923
|
-
if (res.status === 404) {
|
|
924
|
-
return null;
|
|
925
|
-
}
|
|
926
|
-
if (res.status !== 200 && res.status !== 304) {
|
|
927
|
-
throw new BlobsInternalError(res.status);
|
|
928
|
-
}
|
|
929
|
-
const etag = res?.headers.get("etag") ?? void 0;
|
|
930
|
-
const metadata = getMetadataFromResponse(res);
|
|
931
|
-
const result = {
|
|
932
|
-
etag,
|
|
933
|
-
metadata
|
|
934
|
-
};
|
|
935
|
-
return result;
|
|
936
|
-
}
|
|
937
|
-
async getWithMetadata(key, options) {
|
|
938
|
-
const { consistency, etag: requestETag, type } = options ?? {};
|
|
939
|
-
const headers = requestETag ? { "if-none-match": requestETag } : void 0;
|
|
940
|
-
const res = await this.client.makeRequest({
|
|
941
|
-
consistency,
|
|
942
|
-
headers,
|
|
943
|
-
key,
|
|
944
|
-
method: "get",
|
|
945
|
-
storeName: this.name
|
|
946
|
-
});
|
|
947
|
-
if (res.status === 404) {
|
|
948
|
-
return null;
|
|
949
|
-
}
|
|
950
|
-
if (res.status !== 200 && res.status !== 304) {
|
|
951
|
-
throw new BlobsInternalError(res.status);
|
|
952
|
-
}
|
|
953
|
-
const responseETag = res?.headers.get("etag") ?? void 0;
|
|
954
|
-
const metadata = getMetadataFromResponse(res);
|
|
955
|
-
const result = {
|
|
956
|
-
etag: responseETag,
|
|
957
|
-
metadata
|
|
958
|
-
};
|
|
959
|
-
if (res.status === 304 && requestETag) {
|
|
960
|
-
return { data: null, ...result };
|
|
961
|
-
}
|
|
962
|
-
if (type === void 0 || type === "text") {
|
|
963
|
-
return { data: await res.text(), ...result };
|
|
964
|
-
}
|
|
965
|
-
if (type === "arrayBuffer") {
|
|
966
|
-
return { data: await res.arrayBuffer(), ...result };
|
|
967
|
-
}
|
|
968
|
-
if (type === "blob") {
|
|
969
|
-
return { data: await res.blob(), ...result };
|
|
970
|
-
}
|
|
971
|
-
if (type === "json") {
|
|
972
|
-
return { data: await res.json(), ...result };
|
|
973
|
-
}
|
|
974
|
-
if (type === "stream") {
|
|
975
|
-
return { data: res.body, ...result };
|
|
976
|
-
}
|
|
977
|
-
throw new Error(`Invalid 'type' property: ${type}. Expected: arrayBuffer, blob, json, stream, or text.`);
|
|
978
|
-
}
|
|
979
|
-
list(options = {}) {
|
|
980
|
-
const iterator = this.getListIterator(options);
|
|
981
|
-
if (options.paginate) {
|
|
982
|
-
return iterator;
|
|
983
|
-
}
|
|
984
|
-
return collectIterator(iterator).then(
|
|
985
|
-
(items) => items.reduce(
|
|
986
|
-
(acc, item) => ({
|
|
987
|
-
blobs: [...acc.blobs, ...item.blobs],
|
|
988
|
-
directories: [...acc.directories, ...item.directories]
|
|
989
|
-
}),
|
|
990
|
-
{ blobs: [], directories: [] }
|
|
991
|
-
)
|
|
992
|
-
);
|
|
993
|
-
}
|
|
994
|
-
async set(key, data, { metadata } = {}) {
|
|
995
|
-
_Store.validateKey(key);
|
|
996
|
-
const res = await this.client.makeRequest({
|
|
997
|
-
body: data,
|
|
998
|
-
key,
|
|
999
|
-
metadata,
|
|
1000
|
-
method: "put",
|
|
1001
|
-
storeName: this.name
|
|
1002
|
-
});
|
|
1003
|
-
if (res.status !== 200) {
|
|
1004
|
-
throw new BlobsInternalError(res.status);
|
|
1005
|
-
}
|
|
1006
|
-
}
|
|
1007
|
-
async setJSON(key, data, { metadata } = {}) {
|
|
1008
|
-
_Store.validateKey(key);
|
|
1009
|
-
const payload = JSON.stringify(data);
|
|
1010
|
-
const headers = {
|
|
1011
|
-
"content-type": "application/json"
|
|
1012
|
-
};
|
|
1013
|
-
const res = await this.client.makeRequest({
|
|
1014
|
-
body: payload,
|
|
1015
|
-
headers,
|
|
1016
|
-
key,
|
|
1017
|
-
metadata,
|
|
1018
|
-
method: "put",
|
|
1019
|
-
storeName: this.name
|
|
1020
|
-
});
|
|
1021
|
-
if (res.status !== 200) {
|
|
1022
|
-
throw new BlobsInternalError(res.status);
|
|
1023
|
-
}
|
|
1024
|
-
}
|
|
1025
|
-
static formatListResultBlob(result) {
|
|
1026
|
-
if (!result.key) {
|
|
1027
|
-
return null;
|
|
1028
|
-
}
|
|
1029
|
-
return {
|
|
1030
|
-
etag: result.etag,
|
|
1031
|
-
key: result.key
|
|
1032
|
-
};
|
|
1033
|
-
}
|
|
1034
|
-
static validateKey(key) {
|
|
1035
|
-
if (key === "") {
|
|
1036
|
-
throw new Error("Blob key must not be empty.");
|
|
1037
|
-
}
|
|
1038
|
-
if (key.startsWith("/") || key.startsWith("%2F")) {
|
|
1039
|
-
throw new Error("Blob key must not start with forward slash (/).");
|
|
1040
|
-
}
|
|
1041
|
-
if (new TextEncoder().encode(key).length > 600) {
|
|
1042
|
-
throw new Error(
|
|
1043
|
-
"Blob key must be a sequence of Unicode characters whose UTF-8 encoding is at most 600 bytes long."
|
|
1044
|
-
);
|
|
1045
|
-
}
|
|
1046
|
-
}
|
|
1047
|
-
static validateDeployID(deployID) {
|
|
1048
|
-
if (!/^\w{1,24}$/.test(deployID)) {
|
|
1049
|
-
throw new Error(`'${deployID}' is not a valid Netlify deploy ID.`);
|
|
1050
|
-
}
|
|
1051
|
-
}
|
|
1052
|
-
static validateStoreName(name) {
|
|
1053
|
-
if (name.includes("/") || name.includes("%2F")) {
|
|
1054
|
-
throw new Error("Store name must not contain forward slashes (/).");
|
|
1055
|
-
}
|
|
1056
|
-
if (new TextEncoder().encode(name).length > 64) {
|
|
1057
|
-
throw new Error(
|
|
1058
|
-
"Store name must be a sequence of Unicode characters whose UTF-8 encoding is at most 64 bytes long."
|
|
1059
|
-
);
|
|
1060
|
-
}
|
|
574
|
+
this.didAddBackgroundWorkTracking = true;
|
|
1061
575
|
}
|
|
1062
|
-
|
|
1063
|
-
const { client, name: storeName } = this;
|
|
1064
|
-
const parameters = {};
|
|
1065
|
-
if (options?.prefix) {
|
|
1066
|
-
parameters.prefix = options.prefix;
|
|
1067
|
-
}
|
|
1068
|
-
if (options?.directories) {
|
|
1069
|
-
parameters.directories = "true";
|
|
1070
|
-
}
|
|
1071
|
-
return {
|
|
1072
|
-
[Symbol.asyncIterator]() {
|
|
1073
|
-
let currentCursor = null;
|
|
1074
|
-
let done = false;
|
|
1075
|
-
return {
|
|
1076
|
-
async next() {
|
|
1077
|
-
if (done) {
|
|
1078
|
-
return { done: true, value: void 0 };
|
|
1079
|
-
}
|
|
1080
|
-
const nextParameters = { ...parameters };
|
|
1081
|
-
if (currentCursor !== null) {
|
|
1082
|
-
nextParameters.cursor = currentCursor;
|
|
1083
|
-
}
|
|
1084
|
-
const res = await client.makeRequest({
|
|
1085
|
-
method: "get",
|
|
1086
|
-
parameters: nextParameters,
|
|
1087
|
-
storeName
|
|
1088
|
-
});
|
|
1089
|
-
const page = await res.json();
|
|
1090
|
-
if (page.next_cursor) {
|
|
1091
|
-
currentCursor = page.next_cursor;
|
|
1092
|
-
} else {
|
|
1093
|
-
done = true;
|
|
1094
|
-
}
|
|
1095
|
-
const blobs = (page.blobs ?? []).map(_Store.formatListResultBlob).filter(Boolean);
|
|
1096
|
-
return {
|
|
1097
|
-
done: false,
|
|
1098
|
-
value: {
|
|
1099
|
-
blobs,
|
|
1100
|
-
directories: page.directories ?? []
|
|
1101
|
-
}
|
|
1102
|
-
};
|
|
1103
|
-
}
|
|
1104
|
-
};
|
|
1105
|
-
}
|
|
1106
|
-
};
|
|
1107
|
-
}
|
|
1108
|
-
};
|
|
1109
|
-
var getDeployStore = (options = {}) => {
|
|
1110
|
-
const context = getEnvironmentContext();
|
|
1111
|
-
const deployID = options.deployID ?? context.deployID;
|
|
1112
|
-
if (!deployID) {
|
|
1113
|
-
throw new MissingBlobsEnvironmentError(["deployID"]);
|
|
1114
|
-
}
|
|
1115
|
-
const clientOptions = getClientOptions(options, context);
|
|
1116
|
-
const client = new Client(clientOptions);
|
|
1117
|
-
return new Store({ client, deployID });
|
|
576
|
+
return originalGet.apply(this, getArgs);
|
|
1118
577
|
};
|
|
1119
|
-
|
|
1120
|
-
// src/run/next.cts
|
|
1121
|
-
var import_fs_monkey = __toESM(require_lib());
|
|
1122
|
-
var import_request_context = require("./handlers/request-context.cjs");
|
|
1123
|
-
var import_tracer = require("./handlers/tracer.cjs");
|
|
1124
|
-
console.time("import next server");
|
|
1125
|
-
var { getRequestHandlers } = require("next/dist/server/lib/start-server.js");
|
|
1126
578
|
console.timeEnd("import next server");
|
|
1127
|
-
var fetchBeforeNextPatchedIt = globalThis.fetch;
|
|
1128
579
|
async function getMockedRequestHandlers(...args) {
|
|
1129
580
|
const tracer = (0, import_tracer.getTracer)();
|
|
1130
581
|
return tracer.withActiveSpan("mocked request handler", async () => {
|
|
1131
582
|
const ofs = { ...import_promises.default };
|
|
1132
|
-
const { encodeBlobKey
|
|
583
|
+
const { encodeBlobKey } = await import("../shared/blobkey.js");
|
|
1133
584
|
async function readFileFallbackBlobStore(...fsargs) {
|
|
1134
585
|
const [path, options] = fsargs;
|
|
1135
586
|
try {
|
|
1136
587
|
return await ofs.readFile(path, options);
|
|
1137
588
|
} catch (error) {
|
|
1138
589
|
if (typeof path === "string" && path.endsWith(".html")) {
|
|
1139
|
-
const store =
|
|
590
|
+
const store = (0, import_regional_blob_store.getRegionalBlobStore)();
|
|
1140
591
|
const relPath = (0, import_path.relative)((0, import_path.resolve)(".next/server/pages"), path);
|
|
1141
|
-
const file = await store.get(await
|
|
592
|
+
const file = await store.get(await encodeBlobKey(relPath));
|
|
1142
593
|
if (file !== null) {
|
|
1143
594
|
const requestContext = (0, import_request_context.getRequestContext)();
|
|
1144
595
|
if (requestContext) {
|