@netlify/plugin-nextjs 5.0.0-rc.3 → 5.0.0-rc.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.
- package/README.md +16 -0
- package/dist/build/content/prerendered.js +1 -1
- package/dist/build/content/server.js +3 -1
- package/dist/build/content/static.js +3 -1
- package/dist/build/functions/edge.js +2 -2
- package/dist/build/functions/server.js +5 -3
- package/dist/build/image-cdn.js +1 -3
- package/dist/build/plugin-context.js +1 -1
- package/dist/build/verification.js +18 -0
- package/dist/esm-chunks/{chunk-655Y7ISI.js → chunk-3NYX5FXN.js} +30 -33
- package/dist/esm-chunks/{chunk-UTCWWUFW.js → chunk-637Y3P2U.js} +99 -65
- package/dist/esm-chunks/{chunk-GFISNHVP.js → chunk-CSTSA3JJ.js} +46 -42
- package/dist/esm-chunks/chunk-FMO6SJ5E.js +1625 -0
- package/dist/esm-chunks/chunk-MGPEWDDD.js +68 -0
- package/dist/esm-chunks/{chunk-ATFMKC2X.js → chunk-OBKVBMAL.js} +1 -1
- package/dist/esm-chunks/chunk-PJG75HGC.js +2454 -0
- package/dist/esm-chunks/{chunk-LWQKZVSS.js → chunk-VSH4JS2L.js} +3 -1
- package/dist/esm-chunks/{chunk-A6CMEU53.js → chunk-W7XTKMHH.js} +4 -4
- package/dist/esm-chunks/{chunk-MPZEWLBG.js → chunk-WFVNEURA.js} +13 -2
- package/dist/esm-chunks/{package-N25EXX4H.js → package-67C5TREY.js} +5 -4
- package/dist/index.js +27 -9
- package/dist/run/handlers/cache.cjs +103 -69
- package/dist/run/handlers/server.js +18 -4
- package/dist/run/handlers/tracing.js +42 -2471
- package/dist/run/headers.js +1 -1
- package/dist/run/next.cjs +97 -63
- package/package.json +2 -10
- package/dist/esm-chunks/chunk-XXBTIYSL.js +0 -7199
package/dist/run/headers.js
CHANGED
|
@@ -10,7 +10,7 @@ import {
|
|
|
10
10
|
setCacheStatusHeader,
|
|
11
11
|
setCacheTagsHeaders,
|
|
12
12
|
setVaryHeaders
|
|
13
|
-
} from "../esm-chunks/chunk-
|
|
13
|
+
} from "../esm-chunks/chunk-637Y3P2U.js";
|
|
14
14
|
import "../esm-chunks/chunk-TYCYFZ22.js";
|
|
15
15
|
import "../esm-chunks/chunk-5JVNISGM.js";
|
|
16
16
|
export {
|
package/dist/run/next.cjs
CHANGED
|
@@ -586,42 +586,33 @@ module.exports = __toCommonJS(next_exports);
|
|
|
586
586
|
var import_promises = __toESM(require("fs/promises"));
|
|
587
587
|
var import_path = require("path");
|
|
588
588
|
|
|
589
|
-
// node_modules/@netlify/blobs/dist/
|
|
590
|
-
var
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
var import_stream = __toESM(require("stream"), 1);
|
|
595
|
-
var import_util = require("util");
|
|
596
|
-
var BlobsConsistencyError = class extends Error {
|
|
597
|
-
constructor() {
|
|
598
|
-
super(
|
|
599
|
-
`Netlify Blobs has failed to perform a read using strong consistency because the environment has not been configured with a 'uncachedEdgeURL' property`
|
|
600
|
-
);
|
|
601
|
-
this.name = "BlobsConsistencyError";
|
|
589
|
+
// node_modules/@netlify/blobs/dist/chunk-6TGYNZGH.js
|
|
590
|
+
var BlobsInternalError = class extends Error {
|
|
591
|
+
constructor(statusCode) {
|
|
592
|
+
super(`Netlify Blobs has generated an internal error: ${statusCode} response`);
|
|
593
|
+
this.name = "BlobsInternalError";
|
|
602
594
|
}
|
|
603
595
|
};
|
|
604
|
-
var
|
|
605
|
-
const
|
|
606
|
-
|
|
607
|
-
|
|
596
|
+
var collectIterator = async (iterator) => {
|
|
597
|
+
const result = [];
|
|
598
|
+
for await (const item of iterator) {
|
|
599
|
+
result.push(item);
|
|
608
600
|
}
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
}
|
|
601
|
+
return result;
|
|
602
|
+
};
|
|
603
|
+
var base64Decode = (input) => {
|
|
604
|
+
const { Buffer: Buffer3 } = globalThis;
|
|
605
|
+
if (Buffer3) {
|
|
606
|
+
return Buffer3.from(input, "base64").toString();
|
|
613
607
|
}
|
|
614
|
-
return
|
|
608
|
+
return atob(input);
|
|
615
609
|
};
|
|
616
|
-
var
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
", "
|
|
621
|
-
)}`
|
|
622
|
-
);
|
|
623
|
-
this.name = "MissingBlobsEnvironmentError";
|
|
610
|
+
var base64Encode = (input) => {
|
|
611
|
+
const { Buffer: Buffer3 } = globalThis;
|
|
612
|
+
if (Buffer3) {
|
|
613
|
+
return Buffer3.from(input).toString("base64");
|
|
624
614
|
}
|
|
615
|
+
return btoa(input);
|
|
625
616
|
};
|
|
626
617
|
var BASE64_PREFIX = "b64;";
|
|
627
618
|
var METADATA_HEADER_INTERNAL = "x-amz-meta-user";
|
|
@@ -631,7 +622,7 @@ var encodeMetadata = (metadata) => {
|
|
|
631
622
|
if (!metadata) {
|
|
632
623
|
return null;
|
|
633
624
|
}
|
|
634
|
-
const encodedObject =
|
|
625
|
+
const encodedObject = base64Encode(JSON.stringify(metadata));
|
|
635
626
|
const payload = `b64;${encodedObject}`;
|
|
636
627
|
if (METADATA_HEADER_EXTERNAL.length + payload.length > METADATA_MAX_SIZE) {
|
|
637
628
|
throw new Error("Metadata object exceeds the maximum size");
|
|
@@ -643,7 +634,7 @@ var decodeMetadata = (header) => {
|
|
|
643
634
|
return {};
|
|
644
635
|
}
|
|
645
636
|
const encodedData = header.slice(BASE64_PREFIX.length);
|
|
646
|
-
const decodedData =
|
|
637
|
+
const decodedData = base64Decode(encodedData);
|
|
647
638
|
const metadata = JSON.parse(decodedData);
|
|
648
639
|
return metadata;
|
|
649
640
|
};
|
|
@@ -660,7 +651,51 @@ var getMetadataFromResponse = (response) => {
|
|
|
660
651
|
);
|
|
661
652
|
}
|
|
662
653
|
};
|
|
663
|
-
var
|
|
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;
|
|
664
699
|
var MIN_RETRY_DELAY = 1e3;
|
|
665
700
|
var MAX_RETRY = 5;
|
|
666
701
|
var RATE_LIMIT_HEADER = "X-RateLimit-Reset";
|
|
@@ -691,6 +726,7 @@ var getDelay = (rateLimitReset) => {
|
|
|
691
726
|
var sleep = (ms) => new Promise((resolve2) => {
|
|
692
727
|
setTimeout(resolve2, ms);
|
|
693
728
|
});
|
|
729
|
+
var SIGNED_URL_ACCEPT_HEADER = "application/json;type=signed-url";
|
|
694
730
|
var Client = class {
|
|
695
731
|
constructor({ apiURL, consistency, edgeURL, fetch, siteID, token, uncachedEdgeURL }) {
|
|
696
732
|
this.apiURL = apiURL;
|
|
@@ -716,6 +752,13 @@ var Client = class {
|
|
|
716
752
|
}) {
|
|
717
753
|
const encodedMetadata = encodeMetadata(metadata);
|
|
718
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
|
+
}
|
|
719
762
|
if (this.edgeURL) {
|
|
720
763
|
if (consistency === "strong" && !this.uncachedEdgeURL) {
|
|
721
764
|
throw new BlobsConsistencyError();
|
|
@@ -726,8 +769,7 @@ var Client = class {
|
|
|
726
769
|
if (encodedMetadata) {
|
|
727
770
|
headers[METADATA_HEADER_INTERNAL] = encodedMetadata;
|
|
728
771
|
}
|
|
729
|
-
const
|
|
730
|
-
const url2 = new URL(path, consistency === "strong" ? this.uncachedEdgeURL : this.edgeURL);
|
|
772
|
+
const url2 = new URL(urlPath, consistency === "strong" ? this.uncachedEdgeURL : this.edgeURL);
|
|
731
773
|
for (const key2 in parameters) {
|
|
732
774
|
url2.searchParams.set(key2, parameters[key2]);
|
|
733
775
|
}
|
|
@@ -737,28 +779,29 @@ var Client = class {
|
|
|
737
779
|
};
|
|
738
780
|
}
|
|
739
781
|
const apiHeaders = { authorization: `Bearer ${this.token}` };
|
|
740
|
-
const url = new URL(`/api/v1/
|
|
782
|
+
const url = new URL(`/api/v1/blobs${urlPath}`, this.apiURL ?? "https://api.netlify.com");
|
|
741
783
|
for (const key2 in parameters) {
|
|
742
784
|
url.searchParams.set(key2, parameters[key2]);
|
|
743
785
|
}
|
|
744
|
-
|
|
745
|
-
if (key === void 0) {
|
|
786
|
+
if (storeName === void 0 || key === void 0) {
|
|
746
787
|
return {
|
|
747
788
|
headers: apiHeaders,
|
|
748
789
|
url: url.toString()
|
|
749
790
|
};
|
|
750
791
|
}
|
|
751
|
-
url.pathname += `/${key}`;
|
|
752
792
|
if (encodedMetadata) {
|
|
753
793
|
apiHeaders[METADATA_HEADER_EXTERNAL] = encodedMetadata;
|
|
754
794
|
}
|
|
755
|
-
if (method === "head") {
|
|
795
|
+
if (method === "head" || method === "delete") {
|
|
756
796
|
return {
|
|
757
797
|
headers: apiHeaders,
|
|
758
798
|
url: url.toString()
|
|
759
799
|
};
|
|
760
800
|
}
|
|
761
|
-
const res = await this.fetch(url.toString(), {
|
|
801
|
+
const res = await this.fetch(url.toString(), {
|
|
802
|
+
headers: { ...apiHeaders, accept: SIGNED_URL_ACCEPT_HEADER },
|
|
803
|
+
method
|
|
804
|
+
});
|
|
762
805
|
if (res.status !== 200) {
|
|
763
806
|
throw new Error(`Netlify Blobs has generated an internal error: ${res.status} response`);
|
|
764
807
|
}
|
|
@@ -823,29 +866,24 @@ var getClientOptions = (options, contextOverride) => {
|
|
|
823
866
|
};
|
|
824
867
|
return clientOptions;
|
|
825
868
|
};
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
};
|
|
832
|
-
var collectIterator = async (iterator) => {
|
|
833
|
-
const result = [];
|
|
834
|
-
for await (const item of iterator) {
|
|
835
|
-
result.push(item);
|
|
836
|
-
}
|
|
837
|
-
return result;
|
|
838
|
-
};
|
|
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:";
|
|
839
874
|
var Store = class _Store {
|
|
840
875
|
constructor(options) {
|
|
841
876
|
this.client = options.client;
|
|
842
|
-
this.consistency = options.consistency ?? "eventual";
|
|
843
877
|
if ("deployID" in options) {
|
|
844
878
|
_Store.validateDeployID(options.deployID);
|
|
845
|
-
this.name =
|
|
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;
|
|
846
884
|
} else {
|
|
847
885
|
_Store.validateStoreName(options.name);
|
|
848
|
-
this.name = options.name;
|
|
886
|
+
this.name = SITE_STORE_PREFIX + options.name;
|
|
849
887
|
}
|
|
850
888
|
}
|
|
851
889
|
async delete(key) {
|
|
@@ -1000,7 +1038,7 @@ var Store = class _Store {
|
|
|
1000
1038
|
if (key.startsWith("/") || key.startsWith("%2F")) {
|
|
1001
1039
|
throw new Error("Blob key must not start with forward slash (/).");
|
|
1002
1040
|
}
|
|
1003
|
-
if (
|
|
1041
|
+
if (new TextEncoder().encode(key).length > 600) {
|
|
1004
1042
|
throw new Error(
|
|
1005
1043
|
"Blob key must be a sequence of Unicode characters whose UTF-8 encoding is at most 600 bytes long."
|
|
1006
1044
|
);
|
|
@@ -1012,13 +1050,10 @@ var Store = class _Store {
|
|
|
1012
1050
|
}
|
|
1013
1051
|
}
|
|
1014
1052
|
static validateStoreName(name) {
|
|
1015
|
-
if (name.startsWith("deploy:") || name.startsWith("deploy%3A1")) {
|
|
1016
|
-
throw new Error("Store name must not start with the `deploy:` reserved keyword.");
|
|
1017
|
-
}
|
|
1018
1053
|
if (name.includes("/") || name.includes("%2F")) {
|
|
1019
1054
|
throw new Error("Store name must not contain forward slashes (/).");
|
|
1020
1055
|
}
|
|
1021
|
-
if (
|
|
1056
|
+
if (new TextEncoder().encode(name).length > 64) {
|
|
1022
1057
|
throw new Error(
|
|
1023
1058
|
"Store name must be a sequence of Unicode characters whose UTF-8 encoding is at most 64 bytes long."
|
|
1024
1059
|
);
|
|
@@ -1081,7 +1116,6 @@ var getDeployStore = (options = {}) => {
|
|
|
1081
1116
|
const client = new Client(clientOptions);
|
|
1082
1117
|
return new Store({ client, deployID });
|
|
1083
1118
|
};
|
|
1084
|
-
var pipeline = (0, import_util.promisify)(import_stream.default.pipeline);
|
|
1085
1119
|
|
|
1086
1120
|
// node_modules/@opentelemetry/api/build/esm/platform/node/globalThis.js
|
|
1087
1121
|
var _globalThis = typeof globalThis === "object" ? globalThis : global;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@netlify/plugin-nextjs",
|
|
3
|
-
"version": "5.0.0-rc.
|
|
3
|
+
"version": "5.0.0-rc.5",
|
|
4
4
|
"description": "Run Next.js seamlessly on Netlify",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"type": "module",
|
|
@@ -26,13 +26,5 @@
|
|
|
26
26
|
"bugs": {
|
|
27
27
|
"url": "https://github.com/netlify/next-runtime-minimal/issues"
|
|
28
28
|
},
|
|
29
|
-
"homepage": "https://github.com/netlify/next-runtime-minimal#readme"
|
|
30
|
-
"clean-package": {
|
|
31
|
-
"indent": 2,
|
|
32
|
-
"remove": [
|
|
33
|
-
"dependencies",
|
|
34
|
-
"devDependencies",
|
|
35
|
-
"scripts"
|
|
36
|
-
]
|
|
37
|
-
}
|
|
29
|
+
"homepage": "https://github.com/netlify/next-runtime-minimal#readme"
|
|
38
30
|
}
|