@vercel/next 3.3.0 → 3.3.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.
@@ -11,7 +11,7 @@ const path_1 = require("path");
|
|
11
11
|
const constants_1 = require("./constants");
|
12
12
|
const zlib_1 = __importDefault(require("zlib"));
|
13
13
|
const util_1 = require("util");
|
14
|
-
const
|
14
|
+
const utils_1 = require("../utils");
|
15
15
|
// @ts-expect-error this is a prebuilt file, based on `../../scripts/build-edge-function-template.js`
|
16
16
|
const ___get_nextjs_edge_function_js_1 = __importDefault(require("../../dist/___get-nextjs-edge-function.js"));
|
17
17
|
const gzip = (0, util_1.promisify)(zlib_1.default.gzip);
|
@@ -73,6 +73,6 @@ async function validateSize(script, wasmFiles) {
|
|
73
73
|
const content = Buffer.concat(buffers);
|
74
74
|
const gzipped = await gzip(content);
|
75
75
|
if (gzipped.length > constants_1.EDGE_FUNCTION_SIZE_LIMIT) {
|
76
|
-
throw new Error(`Exceeds maximum edge function size: ${(0,
|
76
|
+
throw new Error(`Exceeds maximum edge function size: ${(0, utils_1.prettyBytes)(gzipped.length)} / ${(0, utils_1.prettyBytes)(constants_1.EDGE_FUNCTION_SIZE_LIMIT)}`);
|
77
77
|
}
|
78
78
|
}
|
package/dist/index.js
CHANGED
@@ -38155,6 +38155,184 @@ function RateLimit(rps, { timeUnit = 1000, uniformDistribution = false } = {}) {
|
|
38155
38155
|
exports.RateLimit = RateLimit;
|
38156
38156
|
|
38157
38157
|
|
38158
|
+
/***/ }),
|
38159
|
+
|
38160
|
+
/***/ 1446:
|
38161
|
+
/***/ ((module) => {
|
38162
|
+
|
38163
|
+
"use strict";
|
38164
|
+
/*!
|
38165
|
+
* bytes
|
38166
|
+
* Copyright(c) 2012-2014 TJ Holowaychuk
|
38167
|
+
* Copyright(c) 2015 Jed Watson
|
38168
|
+
* MIT Licensed
|
38169
|
+
*/
|
38170
|
+
|
38171
|
+
|
38172
|
+
|
38173
|
+
/**
|
38174
|
+
* Module exports.
|
38175
|
+
* @public
|
38176
|
+
*/
|
38177
|
+
|
38178
|
+
module.exports = bytes;
|
38179
|
+
module.exports.format = format;
|
38180
|
+
module.exports.parse = parse;
|
38181
|
+
|
38182
|
+
/**
|
38183
|
+
* Module variables.
|
38184
|
+
* @private
|
38185
|
+
*/
|
38186
|
+
|
38187
|
+
var formatThousandsRegExp = /\B(?=(\d{3})+(?!\d))/g;
|
38188
|
+
|
38189
|
+
var formatDecimalsRegExp = /(?:\.0*|(\.[^0]+)0+)$/;
|
38190
|
+
|
38191
|
+
var map = {
|
38192
|
+
b: 1,
|
38193
|
+
kb: 1 << 10,
|
38194
|
+
mb: 1 << 20,
|
38195
|
+
gb: 1 << 30,
|
38196
|
+
tb: Math.pow(1024, 4),
|
38197
|
+
pb: Math.pow(1024, 5),
|
38198
|
+
};
|
38199
|
+
|
38200
|
+
var parseRegExp = /^((-|\+)?(\d+(?:\.\d+)?)) *(kb|mb|gb|tb|pb)$/i;
|
38201
|
+
|
38202
|
+
/**
|
38203
|
+
* Convert the given value in bytes into a string or parse to string to an integer in bytes.
|
38204
|
+
*
|
38205
|
+
* @param {string|number} value
|
38206
|
+
* @param {{
|
38207
|
+
* case: [string],
|
38208
|
+
* decimalPlaces: [number]
|
38209
|
+
* fixedDecimals: [boolean]
|
38210
|
+
* thousandsSeparator: [string]
|
38211
|
+
* unitSeparator: [string]
|
38212
|
+
* }} [options] bytes options.
|
38213
|
+
*
|
38214
|
+
* @returns {string|number|null}
|
38215
|
+
*/
|
38216
|
+
|
38217
|
+
function bytes(value, options) {
|
38218
|
+
if (typeof value === 'string') {
|
38219
|
+
return parse(value);
|
38220
|
+
}
|
38221
|
+
|
38222
|
+
if (typeof value === 'number') {
|
38223
|
+
return format(value, options);
|
38224
|
+
}
|
38225
|
+
|
38226
|
+
return null;
|
38227
|
+
}
|
38228
|
+
|
38229
|
+
/**
|
38230
|
+
* Format the given value in bytes into a string.
|
38231
|
+
*
|
38232
|
+
* If the value is negative, it is kept as such. If it is a float,
|
38233
|
+
* it is rounded.
|
38234
|
+
*
|
38235
|
+
* @param {number} value
|
38236
|
+
* @param {object} [options]
|
38237
|
+
* @param {number} [options.decimalPlaces=2]
|
38238
|
+
* @param {number} [options.fixedDecimals=false]
|
38239
|
+
* @param {string} [options.thousandsSeparator=]
|
38240
|
+
* @param {string} [options.unit=]
|
38241
|
+
* @param {string} [options.unitSeparator=]
|
38242
|
+
*
|
38243
|
+
* @returns {string|null}
|
38244
|
+
* @public
|
38245
|
+
*/
|
38246
|
+
|
38247
|
+
function format(value, options) {
|
38248
|
+
if (!Number.isFinite(value)) {
|
38249
|
+
return null;
|
38250
|
+
}
|
38251
|
+
|
38252
|
+
var mag = Math.abs(value);
|
38253
|
+
var thousandsSeparator = (options && options.thousandsSeparator) || '';
|
38254
|
+
var unitSeparator = (options && options.unitSeparator) || '';
|
38255
|
+
var decimalPlaces = (options && options.decimalPlaces !== undefined) ? options.decimalPlaces : 2;
|
38256
|
+
var fixedDecimals = Boolean(options && options.fixedDecimals);
|
38257
|
+
var unit = (options && options.unit) || '';
|
38258
|
+
|
38259
|
+
if (!unit || !map[unit.toLowerCase()]) {
|
38260
|
+
if (mag >= map.pb) {
|
38261
|
+
unit = 'PB';
|
38262
|
+
} else if (mag >= map.tb) {
|
38263
|
+
unit = 'TB';
|
38264
|
+
} else if (mag >= map.gb) {
|
38265
|
+
unit = 'GB';
|
38266
|
+
} else if (mag >= map.mb) {
|
38267
|
+
unit = 'MB';
|
38268
|
+
} else if (mag >= map.kb) {
|
38269
|
+
unit = 'KB';
|
38270
|
+
} else {
|
38271
|
+
unit = 'B';
|
38272
|
+
}
|
38273
|
+
}
|
38274
|
+
|
38275
|
+
var val = value / map[unit.toLowerCase()];
|
38276
|
+
var str = val.toFixed(decimalPlaces);
|
38277
|
+
|
38278
|
+
if (!fixedDecimals) {
|
38279
|
+
str = str.replace(formatDecimalsRegExp, '$1');
|
38280
|
+
}
|
38281
|
+
|
38282
|
+
if (thousandsSeparator) {
|
38283
|
+
str = str.split('.').map(function (s, i) {
|
38284
|
+
return i === 0
|
38285
|
+
? s.replace(formatThousandsRegExp, thousandsSeparator)
|
38286
|
+
: s
|
38287
|
+
}).join('.');
|
38288
|
+
}
|
38289
|
+
|
38290
|
+
return str + unitSeparator + unit;
|
38291
|
+
}
|
38292
|
+
|
38293
|
+
/**
|
38294
|
+
* Parse the string value into an integer in bytes.
|
38295
|
+
*
|
38296
|
+
* If no unit is given, it is assumed the value is in bytes.
|
38297
|
+
*
|
38298
|
+
* @param {number|string} val
|
38299
|
+
*
|
38300
|
+
* @returns {number|null}
|
38301
|
+
* @public
|
38302
|
+
*/
|
38303
|
+
|
38304
|
+
function parse(val) {
|
38305
|
+
if (typeof val === 'number' && !isNaN(val)) {
|
38306
|
+
return val;
|
38307
|
+
}
|
38308
|
+
|
38309
|
+
if (typeof val !== 'string') {
|
38310
|
+
return null;
|
38311
|
+
}
|
38312
|
+
|
38313
|
+
// Test if the string passed is valid
|
38314
|
+
var results = parseRegExp.exec(val);
|
38315
|
+
var floatValue;
|
38316
|
+
var unit = 'b';
|
38317
|
+
|
38318
|
+
if (!results) {
|
38319
|
+
// Nothing could be extracted from the given string
|
38320
|
+
floatValue = parseInt(val, 10);
|
38321
|
+
unit = 'b'
|
38322
|
+
} else {
|
38323
|
+
// Retrieve the value and the unit
|
38324
|
+
floatValue = parseFloat(results[1]);
|
38325
|
+
unit = results[4].toLowerCase();
|
38326
|
+
}
|
38327
|
+
|
38328
|
+
if (isNaN(floatValue)) {
|
38329
|
+
return null;
|
38330
|
+
}
|
38331
|
+
|
38332
|
+
return Math.floor(map[unit] * floatValue);
|
38333
|
+
}
|
38334
|
+
|
38335
|
+
|
38158
38336
|
/***/ }),
|
38159
38337
|
|
38160
38338
|
/***/ 8376:
|
@@ -43398,7 +43576,7 @@ const MIB = 1024 * KIB;
|
|
43398
43576
|
/**
|
43399
43577
|
* The maximum size of a *compressed* edge function.
|
43400
43578
|
*/
|
43401
|
-
exports.EDGE_FUNCTION_SIZE_LIMIT = MIB;
|
43579
|
+
exports.EDGE_FUNCTION_SIZE_LIMIT = 4 * MIB;
|
43402
43580
|
|
43403
43581
|
|
43404
43582
|
/***/ }),
|
@@ -43420,7 +43598,7 @@ const path_1 = __webpack_require__(5622);
|
|
43420
43598
|
const constants_1 = __webpack_require__(6974);
|
43421
43599
|
const zlib_1 = __importDefault(__webpack_require__(8761));
|
43422
43600
|
const util_1 = __webpack_require__(1669);
|
43423
|
-
const
|
43601
|
+
const utils_1 = __webpack_require__(4411);
|
43424
43602
|
// @ts-expect-error this is a prebuilt file, based on `../../scripts/build-edge-function-template.js`
|
43425
43603
|
const ___get_nextjs_edge_function_js_1 = __importDefault(__webpack_require__(8250));
|
43426
43604
|
const gzip = (0, util_1.promisify)(zlib_1.default.gzip);
|
@@ -43482,7 +43660,7 @@ async function validateSize(script, wasmFiles) {
|
|
43482
43660
|
const content = Buffer.concat(buffers);
|
43483
43661
|
const gzipped = await gzip(content);
|
43484
43662
|
if (gzipped.length > constants_1.EDGE_FUNCTION_SIZE_LIMIT) {
|
43485
|
-
throw new Error(`Exceeds maximum edge function size: ${(0,
|
43663
|
+
throw new Error(`Exceeds maximum edge function size: ${(0, utils_1.prettyBytes)(gzipped.length)} / ${(0, utils_1.prettyBytes)(constants_1.EDGE_FUNCTION_SIZE_LIMIT)}`);
|
43486
43664
|
}
|
43487
43665
|
}
|
43488
43666
|
|
@@ -46996,7 +47174,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
46996
47174
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
46997
47175
|
};
|
46998
47176
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
46999
|
-
exports.upgradeMiddlewareManifest = exports.getMiddlewareManifest = exports.getMiddlewareBundle = exports.getSourceFilePathFromPage = exports.isDynamicRoute = exports.normalizePage = exports.getNextConfig = exports.normalizePackageJson = exports.validateEntrypoint = exports.excludeFiles = exports.getPrivateOutputs = exports.updateRouteSrc = exports.getNextServerPath = exports.normalizeIndexOutput = exports.getStaticFiles = exports.onPrerenderRoute = exports.onPrerenderRouteInitial = exports.detectLambdaLimitExceeding = exports.outputFunctionFileSizeInfo = exports.getPageLambdaGroups = exports.MAX_UNCOMPRESSED_LAMBDA_SIZE = exports.addLocaleOrDefault = exports.normalizeLocalePath = exports.getPrerenderManifest = exports.getRequiredServerFilesManifest = exports.getExportStatus = exports.getExportIntent = exports.createLambdaFromPseudoLayers = exports.createPseudoLayer = exports.ExperimentalTraceVersion = exports.collectTracedFiles = exports.getFilesMapFromReasons = exports.filterStaticPages = exports.getImagesManifest = exports.localizeDynamicRoutes = exports.getDynamicRoutes = exports.getRoutesManifest = void 0;
|
47177
|
+
exports.upgradeMiddlewareManifest = exports.getMiddlewareManifest = exports.getMiddlewareBundle = exports.getSourceFilePathFromPage = exports.isDynamicRoute = exports.normalizePage = exports.getNextConfig = exports.normalizePackageJson = exports.validateEntrypoint = exports.excludeFiles = exports.getPrivateOutputs = exports.updateRouteSrc = exports.getNextServerPath = exports.normalizeIndexOutput = exports.getStaticFiles = exports.onPrerenderRoute = exports.onPrerenderRouteInitial = exports.detectLambdaLimitExceeding = exports.outputFunctionFileSizeInfo = exports.getPageLambdaGroups = exports.MAX_UNCOMPRESSED_LAMBDA_SIZE = exports.addLocaleOrDefault = exports.normalizeLocalePath = exports.getPrerenderManifest = exports.getRequiredServerFilesManifest = exports.getExportStatus = exports.getExportIntent = exports.createLambdaFromPseudoLayers = exports.createPseudoLayer = exports.ExperimentalTraceVersion = exports.collectTracedFiles = exports.getFilesMapFromReasons = exports.filterStaticPages = exports.getImagesManifest = exports.localizeDynamicRoutes = exports.getDynamicRoutes = exports.getRoutesManifest = exports.prettyBytes = void 0;
|
47000
47178
|
const build_utils_1 = __webpack_require__(3445);
|
47001
47179
|
const async_sema_1 = __webpack_require__(7916);
|
47002
47180
|
const buffer_crc32_1 = __importDefault(__webpack_require__(360));
|
@@ -47012,6 +47190,9 @@ const text_table_1 = __importDefault(__webpack_require__(3221));
|
|
47012
47190
|
const pretty_bytes_1 = __importDefault(__webpack_require__(539));
|
47013
47191
|
const get_edge_function_source_1 = __webpack_require__(8055);
|
47014
47192
|
const sourcemapped_1 = __webpack_require__(9239);
|
47193
|
+
const bytes_1 = __importDefault(__webpack_require__(1446));
|
47194
|
+
const _prettyBytes = (n) => (0, bytes_1.default)(n, { unitSeparator: ' ' });
|
47195
|
+
exports.prettyBytes = _prettyBytes;
|
47015
47196
|
// Identify /[param]/ in route string
|
47016
47197
|
// eslint-disable-next-line no-useless-escape
|
47017
47198
|
const TEST_DYNAMIC_ROUTE = /\/\[[^\/]+?\](?=\/|$)/;
|
package/dist/utils.js
CHANGED
@@ -22,7 +22,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
22
22
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
23
23
|
};
|
24
24
|
Object.defineProperty(exports, "__esModule", { value: true });
|
25
|
-
exports.upgradeMiddlewareManifest = exports.getMiddlewareManifest = exports.getMiddlewareBundle = exports.getSourceFilePathFromPage = exports.isDynamicRoute = exports.normalizePage = exports.getNextConfig = exports.normalizePackageJson = exports.validateEntrypoint = exports.excludeFiles = exports.getPrivateOutputs = exports.updateRouteSrc = exports.getNextServerPath = exports.normalizeIndexOutput = exports.getStaticFiles = exports.onPrerenderRoute = exports.onPrerenderRouteInitial = exports.detectLambdaLimitExceeding = exports.outputFunctionFileSizeInfo = exports.getPageLambdaGroups = exports.MAX_UNCOMPRESSED_LAMBDA_SIZE = exports.addLocaleOrDefault = exports.normalizeLocalePath = exports.getPrerenderManifest = exports.getRequiredServerFilesManifest = exports.getExportStatus = exports.getExportIntent = exports.createLambdaFromPseudoLayers = exports.createPseudoLayer = exports.ExperimentalTraceVersion = exports.collectTracedFiles = exports.getFilesMapFromReasons = exports.filterStaticPages = exports.getImagesManifest = exports.localizeDynamicRoutes = exports.getDynamicRoutes = exports.getRoutesManifest = void 0;
|
25
|
+
exports.upgradeMiddlewareManifest = exports.getMiddlewareManifest = exports.getMiddlewareBundle = exports.getSourceFilePathFromPage = exports.isDynamicRoute = exports.normalizePage = exports.getNextConfig = exports.normalizePackageJson = exports.validateEntrypoint = exports.excludeFiles = exports.getPrivateOutputs = exports.updateRouteSrc = exports.getNextServerPath = exports.normalizeIndexOutput = exports.getStaticFiles = exports.onPrerenderRoute = exports.onPrerenderRouteInitial = exports.detectLambdaLimitExceeding = exports.outputFunctionFileSizeInfo = exports.getPageLambdaGroups = exports.MAX_UNCOMPRESSED_LAMBDA_SIZE = exports.addLocaleOrDefault = exports.normalizeLocalePath = exports.getPrerenderManifest = exports.getRequiredServerFilesManifest = exports.getExportStatus = exports.getExportIntent = exports.createLambdaFromPseudoLayers = exports.createPseudoLayer = exports.ExperimentalTraceVersion = exports.collectTracedFiles = exports.getFilesMapFromReasons = exports.filterStaticPages = exports.getImagesManifest = exports.localizeDynamicRoutes = exports.getDynamicRoutes = exports.getRoutesManifest = exports.prettyBytes = void 0;
|
26
26
|
const build_utils_1 = require("@vercel/build-utils");
|
27
27
|
const async_sema_1 = require("async-sema");
|
28
28
|
const buffer_crc32_1 = __importDefault(require("buffer-crc32"));
|
@@ -38,6 +38,9 @@ const text_table_1 = __importDefault(require("text-table"));
|
|
38
38
|
const pretty_bytes_1 = __importDefault(require("pretty-bytes"));
|
39
39
|
const get_edge_function_source_1 = require("./edge-function-source/get-edge-function-source");
|
40
40
|
const sourcemapped_1 = require("./sourcemapped");
|
41
|
+
const bytes_1 = __importDefault(require("bytes"));
|
42
|
+
const _prettyBytes = (n) => (0, bytes_1.default)(n, { unitSeparator: ' ' });
|
43
|
+
exports.prettyBytes = _prettyBytes;
|
41
44
|
// Identify /[param]/ in route string
|
42
45
|
// eslint-disable-next-line no-useless-escape
|
43
46
|
const TEST_DYNAMIC_ROUTE = /\/\[[^\/]+?\](?=\/|$)/;
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@vercel/next",
|
3
|
-
"version": "3.3.
|
3
|
+
"version": "3.3.1",
|
4
4
|
"license": "MIT",
|
5
5
|
"main": "./dist/index",
|
6
6
|
"homepage": "https://vercel.com/docs/runtimes#official-runtimes/next-js",
|
@@ -34,6 +34,7 @@
|
|
34
34
|
"devDependencies": {
|
35
35
|
"@types/aws-lambda": "8.10.19",
|
36
36
|
"@types/buffer-crc32": "0.2.0",
|
37
|
+
"@types/bytes": "3.1.1",
|
37
38
|
"@types/convert-source-map": "1.5.2",
|
38
39
|
"@types/find-up": "4.0.0",
|
39
40
|
"@types/fs-extra": "8.0.0",
|
@@ -49,6 +50,7 @@
|
|
49
50
|
"@vercel/routing-utils": "2.1.3",
|
50
51
|
"async-sema": "3.0.1",
|
51
52
|
"buffer-crc32": "0.2.13",
|
53
|
+
"bytes": "3.1.2",
|
52
54
|
"cheerio": "1.0.0-rc.10",
|
53
55
|
"convert-source-map": "1.8.0",
|
54
56
|
"esbuild": "0.12.22",
|
@@ -69,5 +71,5 @@
|
|
69
71
|
"typescript": "4.5.2",
|
70
72
|
"webpack-sources": "3.2.3"
|
71
73
|
},
|
72
|
-
"gitHead": "
|
74
|
+
"gitHead": "a036b033986a99061a9678efec033b9a7cbdfd4e"
|
73
75
|
}
|