@netlify/plugin-nextjs 5.14.3 → 5.14.4
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.
|
@@ -534,7 +534,7 @@ var copyHandlerDependenciesForNodeMiddleware = async (ctx) => {
|
|
|
534
534
|
const parts = [shim];
|
|
535
535
|
const entry = "server/middleware.js";
|
|
536
536
|
const nft = `${entry}.nft.json`;
|
|
537
|
-
const nftFilesPath = join(process.cwd(), ctx.
|
|
537
|
+
const nftFilesPath = join(process.cwd(), ctx.distDir, nft);
|
|
538
538
|
const nftManifest = JSON.parse(await readFile(nftFilesPath, "utf8"));
|
|
539
539
|
const files = nftManifest.files.map((file) => join("server", file));
|
|
540
540
|
files.push(entry);
|
|
@@ -86,7 +86,7 @@ var pipeline = (0, import_util.promisify)(import_stream.pipeline);
|
|
|
86
86
|
|
|
87
87
|
// package.json
|
|
88
88
|
var name = "@netlify/plugin-nextjs";
|
|
89
|
-
var version = "5.14.
|
|
89
|
+
var version = "5.14.4";
|
|
90
90
|
|
|
91
91
|
// src/run/handlers/tags-handler.cts
|
|
92
92
|
var import_storage = require("../storage/storage.cjs");
|
package/dist/run/next.cjs
CHANGED
|
@@ -498,6 +498,7 @@ var import_request_context = require("./handlers/request-context.cjs");
|
|
|
498
498
|
var import_tracer = require("./handlers/tracer.cjs");
|
|
499
499
|
var import_storage = require("./storage/storage.cjs");
|
|
500
500
|
process.env.NODE_ENV = "production";
|
|
501
|
+
process.env.NEXT_OTEL_FETCH_DISABLED = "1";
|
|
501
502
|
var { getRequestHandlers } = require("next/dist/server/lib/start-server.js");
|
|
502
503
|
var ResponseCache = require("next/dist/server/response-cache/index.js").default;
|
|
503
504
|
var originalGet = ResponseCache.prototype.get;
|
|
@@ -25,7 +25,7 @@ __export(regional_blob_store_exports, {
|
|
|
25
25
|
});
|
|
26
26
|
module.exports = __toCommonJS(regional_blob_store_exports);
|
|
27
27
|
|
|
28
|
-
// node_modules/@netlify/
|
|
28
|
+
// node_modules/@netlify/runtime-utils/dist/main.js
|
|
29
29
|
var getString = (input) => typeof input === "string" ? input : JSON.stringify(input);
|
|
30
30
|
var base64Decode = globalThis.Buffer ? (input) => Buffer.from(input, "base64").toString() : (input) => atob(input);
|
|
31
31
|
var base64Encode = globalThis.Buffer ? (input) => Buffer.from(getString(input)).toString("base64") : (input) => btoa(getString(input));
|
|
@@ -337,6 +337,22 @@ var getClientOptions = (options, contextOverride) => {
|
|
|
337
337
|
return clientOptions;
|
|
338
338
|
};
|
|
339
339
|
|
|
340
|
+
// node_modules/@netlify/otel/dist/main.js
|
|
341
|
+
var GET_TRACER = "__netlify__getTracer";
|
|
342
|
+
var getTracer = (name, version) => {
|
|
343
|
+
return globalThis[GET_TRACER]?.(name, version);
|
|
344
|
+
};
|
|
345
|
+
function withActiveSpan(tracer, name, optionsOrFn, contextOrFn, fn) {
|
|
346
|
+
const func = typeof contextOrFn === "function" ? contextOrFn : typeof optionsOrFn === "function" ? optionsOrFn : fn;
|
|
347
|
+
if (!func) {
|
|
348
|
+
throw new Error("function to execute with active span is missing");
|
|
349
|
+
}
|
|
350
|
+
if (!tracer) {
|
|
351
|
+
return func();
|
|
352
|
+
}
|
|
353
|
+
return tracer.withActiveSpan(name, optionsOrFn, contextOrFn, func);
|
|
354
|
+
}
|
|
355
|
+
|
|
340
356
|
// node_modules/@netlify/blobs/dist/main.js
|
|
341
357
|
var DEPLOY_STORE_PREFIX = "deploy:";
|
|
342
358
|
var LEGACY_STORE_INTERNAL_PREFIX = "netlify-internal/legacy-namespace/";
|
|
@@ -369,154 +385,229 @@ var Store = class _Store {
|
|
|
369
385
|
}
|
|
370
386
|
}
|
|
371
387
|
async get(key, options) {
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
388
|
+
return withActiveSpan(getTracer(), "blobs.get", async (span) => {
|
|
389
|
+
const { consistency, type } = options ?? {};
|
|
390
|
+
span?.setAttributes({
|
|
391
|
+
"blobs.store": this.name,
|
|
392
|
+
"blobs.key": key,
|
|
393
|
+
"blobs.type": type,
|
|
394
|
+
"blobs.method": "GET",
|
|
395
|
+
"blobs.consistency": consistency
|
|
396
|
+
});
|
|
397
|
+
const res = await this.client.makeRequest({
|
|
398
|
+
consistency,
|
|
399
|
+
key,
|
|
400
|
+
method: "get",
|
|
401
|
+
storeName: this.name
|
|
402
|
+
});
|
|
403
|
+
span?.setAttributes({
|
|
404
|
+
"blobs.response.status": res.status
|
|
405
|
+
});
|
|
406
|
+
if (res.status === 404) {
|
|
407
|
+
return null;
|
|
408
|
+
}
|
|
409
|
+
if (res.status !== 200) {
|
|
410
|
+
throw new BlobsInternalError(res);
|
|
411
|
+
}
|
|
412
|
+
if (type === void 0 || type === "text") {
|
|
413
|
+
return res.text();
|
|
414
|
+
}
|
|
415
|
+
if (type === "arrayBuffer") {
|
|
416
|
+
return res.arrayBuffer();
|
|
417
|
+
}
|
|
418
|
+
if (type === "blob") {
|
|
419
|
+
return res.blob();
|
|
420
|
+
}
|
|
421
|
+
if (type === "json") {
|
|
422
|
+
return res.json();
|
|
423
|
+
}
|
|
424
|
+
if (type === "stream") {
|
|
425
|
+
return res.body;
|
|
426
|
+
}
|
|
378
427
|
throw new BlobsInternalError(res);
|
|
379
|
-
}
|
|
380
|
-
if (type === void 0 || type === "text") {
|
|
381
|
-
return res.text();
|
|
382
|
-
}
|
|
383
|
-
if (type === "arrayBuffer") {
|
|
384
|
-
return res.arrayBuffer();
|
|
385
|
-
}
|
|
386
|
-
if (type === "blob") {
|
|
387
|
-
return res.blob();
|
|
388
|
-
}
|
|
389
|
-
if (type === "json") {
|
|
390
|
-
return res.json();
|
|
391
|
-
}
|
|
392
|
-
if (type === "stream") {
|
|
393
|
-
return res.body;
|
|
394
|
-
}
|
|
395
|
-
throw new BlobsInternalError(res);
|
|
428
|
+
});
|
|
396
429
|
}
|
|
397
430
|
async getMetadata(key, { consistency } = {}) {
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
431
|
+
return withActiveSpan(getTracer(), "blobs.getMetadata", async (span) => {
|
|
432
|
+
span?.setAttributes({
|
|
433
|
+
"blobs.store": this.name,
|
|
434
|
+
"blobs.key": key,
|
|
435
|
+
"blobs.method": "HEAD",
|
|
436
|
+
"blobs.consistency": consistency
|
|
437
|
+
});
|
|
438
|
+
const res = await this.client.makeRequest({ consistency, key, method: "head", storeName: this.name });
|
|
439
|
+
span?.setAttributes({
|
|
440
|
+
"blobs.response.status": res.status
|
|
441
|
+
});
|
|
442
|
+
if (res.status === 404) {
|
|
443
|
+
return null;
|
|
444
|
+
}
|
|
445
|
+
if (res.status !== 200 && res.status !== 304) {
|
|
446
|
+
throw new BlobsInternalError(res);
|
|
447
|
+
}
|
|
448
|
+
const etag = res?.headers.get("etag") ?? void 0;
|
|
449
|
+
const metadata = getMetadataFromResponse(res);
|
|
450
|
+
const result = {
|
|
451
|
+
etag,
|
|
452
|
+
metadata
|
|
453
|
+
};
|
|
454
|
+
return result;
|
|
455
|
+
});
|
|
412
456
|
}
|
|
413
457
|
async getWithMetadata(key, options) {
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
458
|
+
return withActiveSpan(getTracer(), "blobs.getWithMetadata", async (span) => {
|
|
459
|
+
const { consistency, etag: requestETag, type } = options ?? {};
|
|
460
|
+
const headers = requestETag ? { "if-none-match": requestETag } : void 0;
|
|
461
|
+
span?.setAttributes({
|
|
462
|
+
"blobs.store": this.name,
|
|
463
|
+
"blobs.key": key,
|
|
464
|
+
"blobs.method": "GET",
|
|
465
|
+
"blobs.consistency": options?.consistency,
|
|
466
|
+
"blobs.type": type,
|
|
467
|
+
"blobs.request.etag": requestETag
|
|
468
|
+
});
|
|
469
|
+
const res = await this.client.makeRequest({
|
|
470
|
+
consistency,
|
|
471
|
+
headers,
|
|
472
|
+
key,
|
|
473
|
+
method: "get",
|
|
474
|
+
storeName: this.name
|
|
475
|
+
});
|
|
476
|
+
const responseETag = res?.headers.get("etag") ?? void 0;
|
|
477
|
+
span?.setAttributes({
|
|
478
|
+
"blobs.response.etag": responseETag,
|
|
479
|
+
"blobs.response.status": res.status
|
|
480
|
+
});
|
|
481
|
+
if (res.status === 404) {
|
|
482
|
+
return null;
|
|
483
|
+
}
|
|
484
|
+
if (res.status !== 200 && res.status !== 304) {
|
|
485
|
+
throw new BlobsInternalError(res);
|
|
486
|
+
}
|
|
487
|
+
const metadata = getMetadataFromResponse(res);
|
|
488
|
+
const result = {
|
|
489
|
+
etag: responseETag,
|
|
490
|
+
metadata
|
|
491
|
+
};
|
|
492
|
+
if (res.status === 304 && requestETag) {
|
|
493
|
+
return { data: null, ...result };
|
|
494
|
+
}
|
|
495
|
+
if (type === void 0 || type === "text") {
|
|
496
|
+
return { data: await res.text(), ...result };
|
|
497
|
+
}
|
|
498
|
+
if (type === "arrayBuffer") {
|
|
499
|
+
return { data: await res.arrayBuffer(), ...result };
|
|
500
|
+
}
|
|
501
|
+
if (type === "blob") {
|
|
502
|
+
return { data: await res.blob(), ...result };
|
|
503
|
+
}
|
|
504
|
+
if (type === "json") {
|
|
505
|
+
return { data: await res.json(), ...result };
|
|
506
|
+
}
|
|
507
|
+
if (type === "stream") {
|
|
508
|
+
return { data: res.body, ...result };
|
|
509
|
+
}
|
|
510
|
+
throw new Error(`Invalid 'type' property: ${type}. Expected: arrayBuffer, blob, json, stream, or text.`);
|
|
422
511
|
});
|
|
423
|
-
if (res.status === 404) {
|
|
424
|
-
return null;
|
|
425
|
-
}
|
|
426
|
-
if (res.status !== 200 && res.status !== 304) {
|
|
427
|
-
throw new BlobsInternalError(res);
|
|
428
|
-
}
|
|
429
|
-
const responseETag = res?.headers.get("etag") ?? void 0;
|
|
430
|
-
const metadata = getMetadataFromResponse(res);
|
|
431
|
-
const result = {
|
|
432
|
-
etag: responseETag,
|
|
433
|
-
metadata
|
|
434
|
-
};
|
|
435
|
-
if (res.status === 304 && requestETag) {
|
|
436
|
-
return { data: null, ...result };
|
|
437
|
-
}
|
|
438
|
-
if (type === void 0 || type === "text") {
|
|
439
|
-
return { data: await res.text(), ...result };
|
|
440
|
-
}
|
|
441
|
-
if (type === "arrayBuffer") {
|
|
442
|
-
return { data: await res.arrayBuffer(), ...result };
|
|
443
|
-
}
|
|
444
|
-
if (type === "blob") {
|
|
445
|
-
return { data: await res.blob(), ...result };
|
|
446
|
-
}
|
|
447
|
-
if (type === "json") {
|
|
448
|
-
return { data: await res.json(), ...result };
|
|
449
|
-
}
|
|
450
|
-
if (type === "stream") {
|
|
451
|
-
return { data: res.body, ...result };
|
|
452
|
-
}
|
|
453
|
-
throw new Error(`Invalid 'type' property: ${type}. Expected: arrayBuffer, blob, json, stream, or text.`);
|
|
454
512
|
}
|
|
455
513
|
list(options = {}) {
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
514
|
+
return withActiveSpan(getTracer(), "blobs.list", (span) => {
|
|
515
|
+
span?.setAttributes({
|
|
516
|
+
"blobs.store": this.name,
|
|
517
|
+
"blobs.method": "GET",
|
|
518
|
+
"blobs.list.paginate": options.paginate ?? false
|
|
519
|
+
});
|
|
520
|
+
const iterator = this.getListIterator(options);
|
|
521
|
+
if (options.paginate) {
|
|
522
|
+
return iterator;
|
|
523
|
+
}
|
|
524
|
+
return collectIterator(iterator).then(
|
|
525
|
+
(items) => items.reduce(
|
|
526
|
+
(acc, item) => ({
|
|
527
|
+
blobs: [...acc.blobs, ...item.blobs],
|
|
528
|
+
directories: [...acc.directories, ...item.directories]
|
|
529
|
+
}),
|
|
530
|
+
{ blobs: [], directories: [] }
|
|
531
|
+
)
|
|
532
|
+
);
|
|
533
|
+
});
|
|
469
534
|
}
|
|
470
535
|
async set(key, data, options = {}) {
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
536
|
+
return withActiveSpan(getTracer(), "blobs.set", async (span) => {
|
|
537
|
+
span?.setAttributes({
|
|
538
|
+
"blobs.store": this.name,
|
|
539
|
+
"blobs.key": key,
|
|
540
|
+
"blobs.method": "PUT",
|
|
541
|
+
"blobs.data.size": typeof data == "string" ? data.length : data instanceof Blob ? data.size : data.byteLength,
|
|
542
|
+
"blobs.data.type": typeof data == "string" ? "string" : data instanceof Blob ? "blob" : "arrayBuffer",
|
|
543
|
+
"blobs.atomic": Boolean(options.onlyIfMatch ?? options.onlyIfNew)
|
|
544
|
+
});
|
|
545
|
+
_Store.validateKey(key);
|
|
546
|
+
const conditions = _Store.getConditions(options);
|
|
547
|
+
const res = await this.client.makeRequest({
|
|
548
|
+
conditions,
|
|
549
|
+
body: data,
|
|
550
|
+
key,
|
|
551
|
+
metadata: options.metadata,
|
|
552
|
+
method: "put",
|
|
553
|
+
storeName: this.name
|
|
554
|
+
});
|
|
555
|
+
const etag = res.headers.get("etag") ?? "";
|
|
556
|
+
span?.setAttributes({
|
|
557
|
+
"blobs.response.etag": etag,
|
|
558
|
+
"blobs.response.status": res.status
|
|
559
|
+
});
|
|
560
|
+
if (conditions) {
|
|
561
|
+
return res.status === STATUS_PRE_CONDITION_FAILED ? { modified: false } : { etag, modified: true };
|
|
562
|
+
}
|
|
563
|
+
if (res.status === STATUS_OK) {
|
|
564
|
+
return {
|
|
565
|
+
etag,
|
|
566
|
+
modified: true
|
|
567
|
+
};
|
|
568
|
+
}
|
|
569
|
+
throw new BlobsInternalError(res);
|
|
480
570
|
});
|
|
481
|
-
const etag = res.headers.get("etag") ?? "";
|
|
482
|
-
if (conditions) {
|
|
483
|
-
return res.status === STATUS_PRE_CONDITION_FAILED ? { modified: false } : { etag, modified: true };
|
|
484
|
-
}
|
|
485
|
-
if (res.status === STATUS_OK) {
|
|
486
|
-
return {
|
|
487
|
-
etag,
|
|
488
|
-
modified: true
|
|
489
|
-
};
|
|
490
|
-
}
|
|
491
|
-
throw new BlobsInternalError(res);
|
|
492
571
|
}
|
|
493
572
|
async setJSON(key, data, options = {}) {
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
method: "put",
|
|
507
|
-
storeName: this.name
|
|
508
|
-
});
|
|
509
|
-
const etag = res.headers.get("etag") ?? "";
|
|
510
|
-
if (conditions) {
|
|
511
|
-
return res.status === STATUS_PRE_CONDITION_FAILED ? { modified: false } : { etag, modified: true };
|
|
512
|
-
}
|
|
513
|
-
if (res.status === STATUS_OK) {
|
|
514
|
-
return {
|
|
515
|
-
etag,
|
|
516
|
-
modified: true
|
|
573
|
+
return withActiveSpan(getTracer(), "blobs.setJSON", async (span) => {
|
|
574
|
+
span?.setAttributes({
|
|
575
|
+
"blobs.store": this.name,
|
|
576
|
+
"blobs.key": key,
|
|
577
|
+
"blobs.method": "PUT",
|
|
578
|
+
"blobs.data.type": "json"
|
|
579
|
+
});
|
|
580
|
+
_Store.validateKey(key);
|
|
581
|
+
const conditions = _Store.getConditions(options);
|
|
582
|
+
const payload = JSON.stringify(data);
|
|
583
|
+
const headers = {
|
|
584
|
+
"content-type": "application/json"
|
|
517
585
|
};
|
|
518
|
-
|
|
519
|
-
|
|
586
|
+
const res = await this.client.makeRequest({
|
|
587
|
+
...conditions,
|
|
588
|
+
body: payload,
|
|
589
|
+
headers,
|
|
590
|
+
key,
|
|
591
|
+
metadata: options.metadata,
|
|
592
|
+
method: "put",
|
|
593
|
+
storeName: this.name
|
|
594
|
+
});
|
|
595
|
+
const etag = res.headers.get("etag") ?? "";
|
|
596
|
+
span?.setAttributes({
|
|
597
|
+
"blobs.response.etag": etag,
|
|
598
|
+
"blobs.response.status": res.status
|
|
599
|
+
});
|
|
600
|
+
if (conditions) {
|
|
601
|
+
return res.status === STATUS_PRE_CONDITION_FAILED ? { modified: false } : { etag, modified: true };
|
|
602
|
+
}
|
|
603
|
+
if (res.status === STATUS_OK) {
|
|
604
|
+
return {
|
|
605
|
+
etag,
|
|
606
|
+
modified: true
|
|
607
|
+
};
|
|
608
|
+
}
|
|
609
|
+
throw new BlobsInternalError(res);
|
|
610
|
+
});
|
|
520
611
|
}
|
|
521
612
|
static formatListResultBlob(result) {
|
|
522
613
|
if (!result.key) {
|
|
@@ -595,42 +686,54 @@ var Store = class _Store {
|
|
|
595
686
|
let done = false;
|
|
596
687
|
return {
|
|
597
688
|
async next() {
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
689
|
+
return withActiveSpan(getTracer(), "blobs.list.next", async (span) => {
|
|
690
|
+
span?.setAttributes({
|
|
691
|
+
"blobs.store": storeName,
|
|
692
|
+
"blobs.method": "GET",
|
|
693
|
+
"blobs.list.paginate": options?.paginate ?? false,
|
|
694
|
+
"blobs.list.done": done,
|
|
695
|
+
"blobs.list.cursor": currentCursor ?? void 0
|
|
696
|
+
});
|
|
697
|
+
if (done) {
|
|
698
|
+
return { done: true, value: void 0 };
|
|
699
|
+
}
|
|
700
|
+
const nextParameters = { ...parameters };
|
|
701
|
+
if (currentCursor !== null) {
|
|
702
|
+
nextParameters.cursor = currentCursor;
|
|
703
|
+
}
|
|
704
|
+
const res = await client.makeRequest({
|
|
705
|
+
method: "get",
|
|
706
|
+
parameters: nextParameters,
|
|
707
|
+
storeName
|
|
708
|
+
});
|
|
709
|
+
span?.setAttributes({
|
|
710
|
+
"blobs.response.status": res.status
|
|
711
|
+
});
|
|
712
|
+
let blobs = [];
|
|
713
|
+
let directories = [];
|
|
714
|
+
if (![200, 204, 404].includes(res.status)) {
|
|
715
|
+
throw new BlobsInternalError(res);
|
|
623
716
|
}
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
717
|
+
if (res.status === 404) {
|
|
718
|
+
done = true;
|
|
719
|
+
} else {
|
|
720
|
+
const page = await res.json();
|
|
721
|
+
if (page.next_cursor) {
|
|
722
|
+
currentCursor = page.next_cursor;
|
|
723
|
+
} else {
|
|
724
|
+
done = true;
|
|
725
|
+
}
|
|
726
|
+
blobs = (page.blobs ?? []).map(_Store.formatListResultBlob).filter(Boolean);
|
|
727
|
+
directories = page.directories ?? [];
|
|
632
728
|
}
|
|
633
|
-
|
|
729
|
+
return {
|
|
730
|
+
done: false,
|
|
731
|
+
value: {
|
|
732
|
+
blobs,
|
|
733
|
+
directories
|
|
734
|
+
}
|
|
735
|
+
};
|
|
736
|
+
});
|
|
634
737
|
}
|
|
635
738
|
};
|
|
636
739
|
}
|