@netlify/plugin-nextjs 5.2.1 → 5.3.0
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 +1 -1
- package/dist/build/cache.js +1 -1
- package/dist/build/content/prerendered.js +4 -4
- package/dist/build/content/server.js +10 -9
- package/dist/build/content/static.js +4 -4
- package/dist/build/functions/edge.js +2 -2
- package/dist/build/functions/server.js +4 -4
- package/dist/build/image-cdn.js +17 -33
- package/dist/build/plugin-context.js +17 -5
- package/dist/build/templates/handler-monorepo.tmpl.js +1 -3
- package/dist/build/templates/handler.tmpl.js +1 -3
- package/dist/build/verification.js +2 -2
- package/dist/esm-chunks/{chunk-PDPDW32D.js → chunk-5QSXBV7L.js} +1 -1
- package/dist/esm-chunks/{chunk-PJG75HGC.js → chunk-EFGWM7RS.js} +38 -655
- package/dist/esm-chunks/{chunk-VZNKO4OO.js → chunk-FHR56UHE.js} +56 -111
- package/dist/esm-chunks/{chunk-Y3K5Q6FP.js → chunk-GNGHTHMQ.js} +51 -86
- package/dist/esm-chunks/{chunk-5JVNISGM.js → chunk-OEQOKJGE.js} +1 -2
- package/dist/esm-chunks/{package-SCUAWNXR.js → package-HC2KHZCZ.js} +10 -10
- package/dist/index.js +3 -3
- package/dist/run/config.js +1 -1
- package/dist/run/constants.js +1 -1
- package/dist/run/handlers/cache.cjs +74 -230
- package/dist/run/handlers/server.js +353 -501
- package/dist/run/handlers/tracer.cjs +36 -60
- package/dist/run/handlers/tracing.js +1192 -1592
- package/dist/run/headers.js +2 -2
- package/dist/run/next.cjs +42 -78
- package/dist/run/revalidate.js +1 -1
- package/dist/run/systemlog.cjs +98 -0
- package/dist/shared/blobkey.js +1 -1
- package/edge-runtime/lib/response.ts +6 -3
- package/package.json +1 -1
- package/dist/run/systemlog.js +0 -107
package/dist/run/headers.js
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
return createRequire(import.meta.url);
|
|
5
5
|
})();
|
|
6
6
|
|
|
7
|
-
import "../esm-chunks/chunk-
|
|
7
|
+
import "../esm-chunks/chunk-OEQOKJGE.js";
|
|
8
8
|
|
|
9
9
|
// src/run/headers.ts
|
|
10
10
|
import { encodeBlobKey } from "../shared/blobkey.js";
|
|
@@ -58,7 +58,7 @@ var mapHeaderValues = (header, callback) => {
|
|
|
58
58
|
};
|
|
59
59
|
var setVaryHeaders = (headers, request, { basePath, i18n }) => {
|
|
60
60
|
const netlifyVaryValues = {
|
|
61
|
-
header: ["x-nextjs-data"],
|
|
61
|
+
header: ["x-nextjs-data", "x-next-debug-logging"],
|
|
62
62
|
language: [],
|
|
63
63
|
cookie: ["__prerender_bypass", "__next_preview_data"],
|
|
64
64
|
query: [],
|
package/dist/run/next.cjs
CHANGED
|
@@ -57,14 +57,12 @@ var require_patchFs = __commonJS({
|
|
|
57
57
|
var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"];
|
|
58
58
|
if (!it) {
|
|
59
59
|
if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") {
|
|
60
|
-
if (it)
|
|
61
|
-
o = it;
|
|
60
|
+
if (it) o = it;
|
|
62
61
|
var i = 0;
|
|
63
62
|
var F = function F2() {
|
|
64
63
|
};
|
|
65
64
|
return { s: F, n: function n() {
|
|
66
|
-
if (i >= o.length)
|
|
67
|
-
return { done: true };
|
|
65
|
+
if (i >= o.length) return { done: true };
|
|
68
66
|
return { done: false, value: o[i++] };
|
|
69
67
|
}, e: function e(_e) {
|
|
70
68
|
throw _e;
|
|
@@ -84,32 +82,23 @@ var require_patchFs = __commonJS({
|
|
|
84
82
|
err = _e2;
|
|
85
83
|
}, f: function f() {
|
|
86
84
|
try {
|
|
87
|
-
if (!normalCompletion && it["return"] != null)
|
|
88
|
-
it["return"]();
|
|
85
|
+
if (!normalCompletion && it["return"] != null) it["return"]();
|
|
89
86
|
} finally {
|
|
90
|
-
if (didErr)
|
|
91
|
-
throw err;
|
|
87
|
+
if (didErr) throw err;
|
|
92
88
|
}
|
|
93
89
|
} };
|
|
94
90
|
}
|
|
95
91
|
function _unsupportedIterableToArray(o, minLen) {
|
|
96
|
-
if (!o)
|
|
97
|
-
|
|
98
|
-
if (typeof o === "string")
|
|
99
|
-
return _arrayLikeToArray(o, minLen);
|
|
92
|
+
if (!o) return;
|
|
93
|
+
if (typeof o === "string") return _arrayLikeToArray(o, minLen);
|
|
100
94
|
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
101
|
-
if (n === "Object" && o.constructor)
|
|
102
|
-
|
|
103
|
-
if (n === "
|
|
104
|
-
return Array.from(o);
|
|
105
|
-
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))
|
|
106
|
-
return _arrayLikeToArray(o, minLen);
|
|
95
|
+
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
96
|
+
if (n === "Map" || n === "Set") return Array.from(o);
|
|
97
|
+
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
|
|
107
98
|
}
|
|
108
99
|
function _arrayLikeToArray(arr, len) {
|
|
109
|
-
if (len == null || len > arr.length)
|
|
110
|
-
|
|
111
|
-
for (var i = 0, arr2 = new Array(len); i < len; i++)
|
|
112
|
-
arr2[i] = arr[i];
|
|
100
|
+
if (len == null || len > arr.length) len = arr.length;
|
|
101
|
+
for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
|
|
113
102
|
return arr2;
|
|
114
103
|
}
|
|
115
104
|
function patchFs2(vol) {
|
|
@@ -126,8 +115,7 @@ var require_patchFs = __commonJS({
|
|
|
126
115
|
try {
|
|
127
116
|
for (_iterator.s(); !(_step = _iterator.n()).done; ) {
|
|
128
117
|
var prop = _step.value;
|
|
129
|
-
if (typeof vol[prop] !== "undefined")
|
|
130
|
-
patch(prop, vol[prop]);
|
|
118
|
+
if (typeof vol[prop] !== "undefined") patch(prop, vol[prop]);
|
|
131
119
|
}
|
|
132
120
|
} catch (err) {
|
|
133
121
|
_iterator.e(err);
|
|
@@ -146,14 +134,12 @@ var require_patchFs = __commonJS({
|
|
|
146
134
|
if (typeof vol.WriteStream === "function") {
|
|
147
135
|
patch("WriteStream", vol.WriteStream.bind(null, vol));
|
|
148
136
|
}
|
|
149
|
-
if (typeof vol._toUnixTimestamp === "function")
|
|
150
|
-
patchMethod("_toUnixTimestamp");
|
|
137
|
+
if (typeof vol._toUnixTimestamp === "function") patchMethod("_toUnixTimestamp");
|
|
151
138
|
var _iterator2 = _createForOfIteratorHelper(_lists.fsAsyncMethods), _step2;
|
|
152
139
|
try {
|
|
153
140
|
for (_iterator2.s(); !(_step2 = _iterator2.n()).done; ) {
|
|
154
141
|
var method = _step2.value;
|
|
155
|
-
if (typeof vol[method] === "function")
|
|
156
|
-
patchMethod(method);
|
|
142
|
+
if (typeof vol[method] === "function") patchMethod(method);
|
|
157
143
|
}
|
|
158
144
|
} catch (err) {
|
|
159
145
|
_iterator2.e(err);
|
|
@@ -164,8 +150,7 @@ var require_patchFs = __commonJS({
|
|
|
164
150
|
try {
|
|
165
151
|
for (_iterator3.s(); !(_step3 = _iterator3.n()).done; ) {
|
|
166
152
|
var _method = _step3.value;
|
|
167
|
-
if (typeof vol[_method] === "function")
|
|
168
|
-
patchMethod(_method);
|
|
153
|
+
if (typeof vol[_method] === "function") patchMethod(_method);
|
|
169
154
|
}
|
|
170
155
|
} catch (err) {
|
|
171
156
|
_iterator3.e(err);
|
|
@@ -173,8 +158,7 @@ var require_patchFs = __commonJS({
|
|
|
173
158
|
_iterator3.f();
|
|
174
159
|
}
|
|
175
160
|
return function unpatch() {
|
|
176
|
-
for (var key in bkp)
|
|
177
|
-
fs2[key] = bkp[key];
|
|
161
|
+
for (var key in bkp) fs2[key] = bkp[key];
|
|
178
162
|
};
|
|
179
163
|
}
|
|
180
164
|
}
|
|
@@ -246,27 +230,22 @@ var require_patchRequire = __commonJS({
|
|
|
246
230
|
exports2["default"] = patchRequire;
|
|
247
231
|
var path = _interopRequireWildcard(require("path"));
|
|
248
232
|
function _getRequireWildcardCache(e) {
|
|
249
|
-
if ("function" != typeof WeakMap)
|
|
250
|
-
return null;
|
|
233
|
+
if ("function" != typeof WeakMap) return null;
|
|
251
234
|
var r = /* @__PURE__ */ new WeakMap(), t = /* @__PURE__ */ new WeakMap();
|
|
252
235
|
return (_getRequireWildcardCache = function _getRequireWildcardCache2(e2) {
|
|
253
236
|
return e2 ? t : r;
|
|
254
237
|
})(e);
|
|
255
238
|
}
|
|
256
239
|
function _interopRequireWildcard(e, r) {
|
|
257
|
-
if (!r && e && e.__esModule)
|
|
258
|
-
|
|
259
|
-
if (null === e || "object" != _typeof(e) && "function" != typeof e)
|
|
260
|
-
return { "default": e };
|
|
240
|
+
if (!r && e && e.__esModule) return e;
|
|
241
|
+
if (null === e || "object" != _typeof(e) && "function" != typeof e) return { "default": e };
|
|
261
242
|
var t = _getRequireWildcardCache(r);
|
|
262
|
-
if (t && t.has(e))
|
|
263
|
-
return t.get(e);
|
|
243
|
+
if (t && t.has(e)) return t.get(e);
|
|
264
244
|
var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor;
|
|
265
|
-
for (var u in e)
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
}
|
|
245
|
+
for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) {
|
|
246
|
+
var i = a ? Object.getOwnPropertyDescriptor(e, u) : null;
|
|
247
|
+
i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u];
|
|
248
|
+
}
|
|
270
249
|
return n["default"] = e, t && t.set(e, n), n;
|
|
271
250
|
}
|
|
272
251
|
var isWin32 = process.platform === "win32";
|
|
@@ -314,12 +293,10 @@ var require_patchRequire = __commonJS({
|
|
|
314
293
|
var cache = stat.cache;
|
|
315
294
|
if (cache !== null) {
|
|
316
295
|
var _result = cache.get(filename);
|
|
317
|
-
if (_result !== void 0)
|
|
318
|
-
return _result;
|
|
296
|
+
if (_result !== void 0) return _result;
|
|
319
297
|
}
|
|
320
298
|
var result = internalModuleStat(filename);
|
|
321
|
-
if (cache !== null)
|
|
322
|
-
cache.set(filename, result);
|
|
299
|
+
if (cache !== null) cache.set(filename, result);
|
|
323
300
|
return result;
|
|
324
301
|
}
|
|
325
302
|
stat.cache = null;
|
|
@@ -330,8 +307,7 @@ var require_patchRequire = __commonJS({
|
|
|
330
307
|
var packageMainCache = /* @__PURE__ */ Object.create(null);
|
|
331
308
|
function readPackage(requestPath) {
|
|
332
309
|
var entry = packageMainCache[requestPath];
|
|
333
|
-
if (entry)
|
|
334
|
-
return entry;
|
|
310
|
+
if (entry) return entry;
|
|
335
311
|
var jsonPath = path.resolve(requestPath, "package.json");
|
|
336
312
|
var json = internalModuleReadFile(path._makeLong(jsonPath));
|
|
337
313
|
if (json === void 0) {
|
|
@@ -366,8 +342,7 @@ var require_patchRequire = __commonJS({
|
|
|
366
342
|
}
|
|
367
343
|
function tryPackage(requestPath, exts, isMain) {
|
|
368
344
|
var pkg = readPackage(requestPath);
|
|
369
|
-
if (!pkg)
|
|
370
|
-
return false;
|
|
345
|
+
if (!pkg) return false;
|
|
371
346
|
var filename = path.resolve(requestPath, pkg);
|
|
372
347
|
return tryFile(filename, isMain) || tryExtensions(filename, exts, isMain) || tryExtensions(path.resolve(filename, "index"), exts, isMain);
|
|
373
348
|
}
|
|
@@ -393,14 +368,12 @@ var require_patchRequire = __commonJS({
|
|
|
393
368
|
}
|
|
394
369
|
var cacheKey = request + "\0" + (paths.length === 1 ? paths[0] : paths.join("\0"));
|
|
395
370
|
var entry = Module._pathCache[cacheKey];
|
|
396
|
-
if (entry)
|
|
397
|
-
return entry;
|
|
371
|
+
if (entry) return entry;
|
|
398
372
|
var exts;
|
|
399
373
|
var trailingSlash = request.length > 0 && request.charCodeAt(request.length - 1) === 47;
|
|
400
374
|
for (var i = 0; i < paths.length; i++) {
|
|
401
375
|
var curPath = paths[i];
|
|
402
|
-
if (curPath && stat(curPath) < 1)
|
|
403
|
-
continue;
|
|
376
|
+
if (curPath && stat(curPath) < 1) continue;
|
|
404
377
|
var basePath = correctPath(path.resolve(curPath, request));
|
|
405
378
|
var filename;
|
|
406
379
|
var rc = stat(basePath);
|
|
@@ -412,24 +385,20 @@ var require_patchRequire = __commonJS({
|
|
|
412
385
|
filename = toRealPath(basePath);
|
|
413
386
|
}
|
|
414
387
|
} else if (rc === 1) {
|
|
415
|
-
if (exts === void 0)
|
|
416
|
-
exts = Object.keys(Module._extensions);
|
|
388
|
+
if (exts === void 0) exts = Object.keys(Module._extensions);
|
|
417
389
|
filename = tryPackage(basePath, exts, isMain);
|
|
418
390
|
}
|
|
419
391
|
if (!filename) {
|
|
420
|
-
if (exts === void 0)
|
|
421
|
-
exts = Object.keys(Module._extensions);
|
|
392
|
+
if (exts === void 0) exts = Object.keys(Module._extensions);
|
|
422
393
|
filename = tryExtensions(basePath, exts, isMain);
|
|
423
394
|
}
|
|
424
395
|
}
|
|
425
396
|
if (!filename && rc === 1) {
|
|
426
|
-
if (exts === void 0)
|
|
427
|
-
exts = Object.keys(Module._extensions);
|
|
397
|
+
if (exts === void 0) exts = Object.keys(Module._extensions);
|
|
428
398
|
filename = tryPackage(basePath, exts, isMain);
|
|
429
399
|
}
|
|
430
400
|
if (!filename && rc === 1) {
|
|
431
|
-
if (exts === void 0)
|
|
432
|
-
exts = Object.keys(Module._extensions);
|
|
401
|
+
if (exts === void 0) exts = Object.keys(Module._extensions);
|
|
433
402
|
filename = tryExtensions(path.resolve(basePath, "index"), exts, isMain);
|
|
434
403
|
}
|
|
435
404
|
if (filename) {
|
|
@@ -489,27 +458,22 @@ var require_lib = __commonJS({
|
|
|
489
458
|
var util = _interopRequireWildcard(require_lists());
|
|
490
459
|
exports2.util = util;
|
|
491
460
|
function _getRequireWildcardCache(e) {
|
|
492
|
-
if ("function" != typeof WeakMap)
|
|
493
|
-
return null;
|
|
461
|
+
if ("function" != typeof WeakMap) return null;
|
|
494
462
|
var r = /* @__PURE__ */ new WeakMap(), t = /* @__PURE__ */ new WeakMap();
|
|
495
463
|
return (_getRequireWildcardCache = function _getRequireWildcardCache2(e2) {
|
|
496
464
|
return e2 ? t : r;
|
|
497
465
|
})(e);
|
|
498
466
|
}
|
|
499
467
|
function _interopRequireWildcard(e, r) {
|
|
500
|
-
if (!r && e && e.__esModule)
|
|
501
|
-
|
|
502
|
-
if (null === e || "object" != _typeof(e) && "function" != typeof e)
|
|
503
|
-
return { "default": e };
|
|
468
|
+
if (!r && e && e.__esModule) return e;
|
|
469
|
+
if (null === e || "object" != _typeof(e) && "function" != typeof e) return { "default": e };
|
|
504
470
|
var t = _getRequireWildcardCache(r);
|
|
505
|
-
if (t && t.has(e))
|
|
506
|
-
return t.get(e);
|
|
471
|
+
if (t && t.has(e)) return t.get(e);
|
|
507
472
|
var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor;
|
|
508
|
-
for (var u in e)
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
}
|
|
473
|
+
for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) {
|
|
474
|
+
var i = a ? Object.getOwnPropertyDescriptor(e, u) : null;
|
|
475
|
+
i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u];
|
|
476
|
+
}
|
|
513
477
|
return n["default"] = e, t && t.set(e, n), n;
|
|
514
478
|
}
|
|
515
479
|
function _interopRequireDefault(obj) {
|
package/dist/run/revalidate.js
CHANGED
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
|
|
20
|
+
// src/run/systemlog.cts
|
|
21
|
+
var systemlog_exports = {};
|
|
22
|
+
__export(systemlog_exports, {
|
|
23
|
+
LogLevel: () => LogLevel,
|
|
24
|
+
logger: () => systemLogger
|
|
25
|
+
});
|
|
26
|
+
module.exports = __toCommonJS(systemlog_exports);
|
|
27
|
+
|
|
28
|
+
// node_modules/@netlify/functions/dist/chunk-HYMERDCV.mjs
|
|
29
|
+
var import_process = require("process");
|
|
30
|
+
var systemLogTag = "__nfSystemLog";
|
|
31
|
+
var serializeError = (error) => {
|
|
32
|
+
const cause = error?.cause instanceof Error ? serializeError(error.cause) : error.cause;
|
|
33
|
+
return {
|
|
34
|
+
error: error.message,
|
|
35
|
+
error_cause: cause,
|
|
36
|
+
error_stack: error.stack
|
|
37
|
+
};
|
|
38
|
+
};
|
|
39
|
+
var LogLevel = /* @__PURE__ */ ((LogLevel2) => {
|
|
40
|
+
LogLevel2[LogLevel2["Debug"] = 1] = "Debug";
|
|
41
|
+
LogLevel2[LogLevel2["Log"] = 2] = "Log";
|
|
42
|
+
LogLevel2[LogLevel2["Error"] = 3] = "Error";
|
|
43
|
+
return LogLevel2;
|
|
44
|
+
})(LogLevel || {});
|
|
45
|
+
var SystemLogger = class _SystemLogger {
|
|
46
|
+
fields;
|
|
47
|
+
logLevel;
|
|
48
|
+
constructor(fields = {}, logLevel = 2) {
|
|
49
|
+
this.fields = fields;
|
|
50
|
+
this.logLevel = logLevel;
|
|
51
|
+
}
|
|
52
|
+
doLog(logger, message) {
|
|
53
|
+
if (import_process.env.NETLIFY_DEV && !import_process.env.NETLIFY_ENABLE_SYSTEM_LOGGING) {
|
|
54
|
+
return;
|
|
55
|
+
}
|
|
56
|
+
logger(systemLogTag, JSON.stringify({ msg: message, fields: this.fields }));
|
|
57
|
+
}
|
|
58
|
+
log(message) {
|
|
59
|
+
if (this.logLevel > 2) {
|
|
60
|
+
return;
|
|
61
|
+
}
|
|
62
|
+
this.doLog(console.log, message);
|
|
63
|
+
}
|
|
64
|
+
debug(message) {
|
|
65
|
+
if (this.logLevel > 1) {
|
|
66
|
+
return;
|
|
67
|
+
}
|
|
68
|
+
this.doLog(console.debug, message);
|
|
69
|
+
}
|
|
70
|
+
error(message) {
|
|
71
|
+
if (this.logLevel > 3) {
|
|
72
|
+
return;
|
|
73
|
+
}
|
|
74
|
+
this.doLog(console.error, message);
|
|
75
|
+
}
|
|
76
|
+
withLogLevel(level) {
|
|
77
|
+
return new _SystemLogger(this.fields, level);
|
|
78
|
+
}
|
|
79
|
+
withFields(fields) {
|
|
80
|
+
return new _SystemLogger(
|
|
81
|
+
{
|
|
82
|
+
...this.fields,
|
|
83
|
+
...fields
|
|
84
|
+
},
|
|
85
|
+
this.logLevel
|
|
86
|
+
);
|
|
87
|
+
}
|
|
88
|
+
withError(error) {
|
|
89
|
+
const fields = error instanceof Error ? serializeError(error) : { error };
|
|
90
|
+
return this.withFields(fields);
|
|
91
|
+
}
|
|
92
|
+
};
|
|
93
|
+
var systemLogger = new SystemLogger();
|
|
94
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
95
|
+
0 && (module.exports = {
|
|
96
|
+
LogLevel,
|
|
97
|
+
logger
|
|
98
|
+
});
|
package/dist/shared/blobkey.js
CHANGED
|
@@ -3,6 +3,8 @@ import { HTMLRewriter } from '../vendor/deno.land/x/html_rewriter@v0.1.0-pre.17/
|
|
|
3
3
|
|
|
4
4
|
import { updateModifiedHeaders } from './headers.ts'
|
|
5
5
|
import type { StructuredLogger } from './logging.ts'
|
|
6
|
+
import { addMiddlewareHeaders, isMiddlewareRequest, isMiddlewareResponse } from './middleware.ts'
|
|
7
|
+
import { RequestData } from './next-request.ts'
|
|
6
8
|
import {
|
|
7
9
|
addBasePath,
|
|
8
10
|
normalizeDataUrl,
|
|
@@ -10,8 +12,6 @@ import {
|
|
|
10
12
|
normalizeTrailingSlash,
|
|
11
13
|
relativizeURL,
|
|
12
14
|
} from './util.ts'
|
|
13
|
-
import { addMiddlewareHeaders, isMiddlewareRequest, isMiddlewareResponse } from './middleware.ts'
|
|
14
|
-
import { RequestData } from './next-request.ts'
|
|
15
15
|
|
|
16
16
|
export interface FetchEventResult {
|
|
17
17
|
response: Response
|
|
@@ -182,8 +182,11 @@ export const buildResponse = async ({
|
|
|
182
182
|
// The rewrite target is a data request, but a middleware rewrite target is always for the page route,
|
|
183
183
|
// so we need to tell the server this is a data request. Setting the `x-nextjs-data` header is not enough. 🤷
|
|
184
184
|
rewriteUrl.searchParams.set('__nextDataReq', '1')
|
|
185
|
-
rewriteUrl.pathname = normalizeTrailingSlash(rewriteUrl.pathname, nextConfig?.trailingSlash)
|
|
186
185
|
}
|
|
186
|
+
|
|
187
|
+
// respect trailing slash rules to prevent 308s
|
|
188
|
+
rewriteUrl.pathname = normalizeTrailingSlash(rewriteUrl.pathname, nextConfig?.trailingSlash)
|
|
189
|
+
|
|
187
190
|
const target = normalizeLocalizedTarget({ target: rewriteUrl.toString(), request, nextConfig })
|
|
188
191
|
if (target === request.url) {
|
|
189
192
|
logger.withFields({ rewrite_url: rewrite }).debug('Rewrite url is same as original url')
|
package/package.json
CHANGED
package/dist/run/systemlog.js
DELETED
|
@@ -1,107 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
var require = await (async () => {
|
|
3
|
-
var { createRequire } = await import("node:module");
|
|
4
|
-
return createRequire(import.meta.url);
|
|
5
|
-
})();
|
|
6
|
-
|
|
7
|
-
import {
|
|
8
|
-
__commonJS,
|
|
9
|
-
__require,
|
|
10
|
-
__toESM
|
|
11
|
-
} from "../esm-chunks/chunk-5JVNISGM.js";
|
|
12
|
-
|
|
13
|
-
// node_modules/@netlify/functions/dist/lib/system_logger.js
|
|
14
|
-
var require_system_logger = __commonJS({
|
|
15
|
-
"node_modules/@netlify/functions/dist/lib/system_logger.js"(exports) {
|
|
16
|
-
"use strict";
|
|
17
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
-
exports.systemLogger = exports.LogLevel = void 0;
|
|
19
|
-
var process_1 = __require("process");
|
|
20
|
-
var systemLogTag = "__nfSystemLog";
|
|
21
|
-
var serializeError = (error) => {
|
|
22
|
-
const cause = error?.cause instanceof Error ? serializeError(error.cause) : error.cause;
|
|
23
|
-
return {
|
|
24
|
-
error: error.message,
|
|
25
|
-
error_cause: cause,
|
|
26
|
-
error_stack: error.stack
|
|
27
|
-
};
|
|
28
|
-
};
|
|
29
|
-
var LogLevel2;
|
|
30
|
-
(function(LogLevel3) {
|
|
31
|
-
LogLevel3[LogLevel3["Debug"] = 1] = "Debug";
|
|
32
|
-
LogLevel3[LogLevel3["Log"] = 2] = "Log";
|
|
33
|
-
LogLevel3[LogLevel3["Error"] = 3] = "Error";
|
|
34
|
-
})(LogLevel2 = exports.LogLevel || (exports.LogLevel = {}));
|
|
35
|
-
var SystemLogger = class _SystemLogger {
|
|
36
|
-
fields;
|
|
37
|
-
logLevel;
|
|
38
|
-
constructor(fields = {}, logLevel = LogLevel2.Log) {
|
|
39
|
-
this.fields = fields;
|
|
40
|
-
this.logLevel = logLevel;
|
|
41
|
-
}
|
|
42
|
-
doLog(logger, message) {
|
|
43
|
-
if (process_1.env.NETLIFY_DEV && !process_1.env.NETLIFY_ENABLE_SYSTEM_LOGGING) {
|
|
44
|
-
return;
|
|
45
|
-
}
|
|
46
|
-
logger(systemLogTag, JSON.stringify({ msg: message, fields: this.fields }));
|
|
47
|
-
}
|
|
48
|
-
log(message) {
|
|
49
|
-
if (this.logLevel > LogLevel2.Log) {
|
|
50
|
-
return;
|
|
51
|
-
}
|
|
52
|
-
this.doLog(console.log, message);
|
|
53
|
-
}
|
|
54
|
-
debug(message) {
|
|
55
|
-
if (this.logLevel > LogLevel2.Debug) {
|
|
56
|
-
return;
|
|
57
|
-
}
|
|
58
|
-
this.doLog(console.debug, message);
|
|
59
|
-
}
|
|
60
|
-
error(message) {
|
|
61
|
-
if (this.logLevel > LogLevel2.Error) {
|
|
62
|
-
return;
|
|
63
|
-
}
|
|
64
|
-
this.doLog(console.error, message);
|
|
65
|
-
}
|
|
66
|
-
withLogLevel(level) {
|
|
67
|
-
return new _SystemLogger(this.fields, level);
|
|
68
|
-
}
|
|
69
|
-
withFields(fields) {
|
|
70
|
-
return new _SystemLogger({
|
|
71
|
-
...this.fields,
|
|
72
|
-
...fields
|
|
73
|
-
}, this.logLevel);
|
|
74
|
-
}
|
|
75
|
-
withError(error) {
|
|
76
|
-
const fields = error instanceof Error ? serializeError(error) : { error };
|
|
77
|
-
return this.withFields(fields);
|
|
78
|
-
}
|
|
79
|
-
};
|
|
80
|
-
exports.systemLogger = new SystemLogger();
|
|
81
|
-
}
|
|
82
|
-
});
|
|
83
|
-
|
|
84
|
-
// node_modules/@netlify/functions/dist/internal.js
|
|
85
|
-
var require_internal = __commonJS({
|
|
86
|
-
"node_modules/@netlify/functions/dist/internal.js"(exports) {
|
|
87
|
-
"use strict";
|
|
88
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
89
|
-
exports.LogLevel = exports.systemLogger = void 0;
|
|
90
|
-
var system_logger_js_1 = require_system_logger();
|
|
91
|
-
Object.defineProperty(exports, "systemLogger", { enumerable: true, get: function() {
|
|
92
|
-
return system_logger_js_1.systemLogger;
|
|
93
|
-
} });
|
|
94
|
-
Object.defineProperty(exports, "LogLevel", { enumerable: true, get: function() {
|
|
95
|
-
return system_logger_js_1.LogLevel;
|
|
96
|
-
} });
|
|
97
|
-
}
|
|
98
|
-
});
|
|
99
|
-
|
|
100
|
-
// src/run/systemlog.ts
|
|
101
|
-
var import_internal = __toESM(require_internal(), 1);
|
|
102
|
-
var export_LogLevel = import_internal.LogLevel;
|
|
103
|
-
var export_logger = import_internal.systemLogger;
|
|
104
|
-
export {
|
|
105
|
-
export_LogLevel as LogLevel,
|
|
106
|
-
export_logger as logger
|
|
107
|
-
};
|