@vercel/next 3.1.8 → 3.1.11
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/index.js +194 -3
- package/package.json +4 -4
package/dist/index.js
CHANGED
@@ -10154,6 +10154,177 @@ try {
|
|
10154
10154
|
}));
|
10155
10155
|
|
10156
10156
|
|
10157
|
+
/***/ }),
|
10158
|
+
|
10159
|
+
/***/ 6171:
|
10160
|
+
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
|
10161
|
+
|
10162
|
+
"use strict";
|
10163
|
+
|
10164
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
10165
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
10166
|
+
};
|
10167
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
10168
|
+
exports.RateLimit = exports.Sema = void 0;
|
10169
|
+
const events_1 = __importDefault(__webpack_require__(8614));
|
10170
|
+
function arrayMove(src, srcIndex, dst, dstIndex, len) {
|
10171
|
+
for (let j = 0; j < len; ++j) {
|
10172
|
+
dst[j + dstIndex] = src[j + srcIndex];
|
10173
|
+
src[j + srcIndex] = void 0;
|
10174
|
+
}
|
10175
|
+
}
|
10176
|
+
function pow2AtLeast(n) {
|
10177
|
+
n = n >>> 0;
|
10178
|
+
n = n - 1;
|
10179
|
+
n = n | (n >> 1);
|
10180
|
+
n = n | (n >> 2);
|
10181
|
+
n = n | (n >> 4);
|
10182
|
+
n = n | (n >> 8);
|
10183
|
+
n = n | (n >> 16);
|
10184
|
+
return n + 1;
|
10185
|
+
}
|
10186
|
+
function getCapacity(capacity) {
|
10187
|
+
return pow2AtLeast(Math.min(Math.max(16, capacity), 1073741824));
|
10188
|
+
}
|
10189
|
+
// Deque is based on https://github.com/petkaantonov/deque/blob/master/js/deque.js
|
10190
|
+
// Released under the MIT License: https://github.com/petkaantonov/deque/blob/6ef4b6400ad3ba82853fdcc6531a38eb4f78c18c/LICENSE
|
10191
|
+
class Deque {
|
10192
|
+
constructor(capacity) {
|
10193
|
+
this._capacity = getCapacity(capacity);
|
10194
|
+
this._length = 0;
|
10195
|
+
this._front = 0;
|
10196
|
+
this.arr = [];
|
10197
|
+
}
|
10198
|
+
push(item) {
|
10199
|
+
const length = this._length;
|
10200
|
+
this.checkCapacity(length + 1);
|
10201
|
+
const i = (this._front + length) & (this._capacity - 1);
|
10202
|
+
this.arr[i] = item;
|
10203
|
+
this._length = length + 1;
|
10204
|
+
return length + 1;
|
10205
|
+
}
|
10206
|
+
pop() {
|
10207
|
+
const length = this._length;
|
10208
|
+
if (length === 0) {
|
10209
|
+
return void 0;
|
10210
|
+
}
|
10211
|
+
const i = (this._front + length - 1) & (this._capacity - 1);
|
10212
|
+
const ret = this.arr[i];
|
10213
|
+
this.arr[i] = void 0;
|
10214
|
+
this._length = length - 1;
|
10215
|
+
return ret;
|
10216
|
+
}
|
10217
|
+
shift() {
|
10218
|
+
const length = this._length;
|
10219
|
+
if (length === 0) {
|
10220
|
+
return void 0;
|
10221
|
+
}
|
10222
|
+
const front = this._front;
|
10223
|
+
const ret = this.arr[front];
|
10224
|
+
this.arr[front] = void 0;
|
10225
|
+
this._front = (front + 1) & (this._capacity - 1);
|
10226
|
+
this._length = length - 1;
|
10227
|
+
return ret;
|
10228
|
+
}
|
10229
|
+
get length() {
|
10230
|
+
return this._length;
|
10231
|
+
}
|
10232
|
+
checkCapacity(size) {
|
10233
|
+
if (this._capacity < size) {
|
10234
|
+
this.resizeTo(getCapacity(this._capacity * 1.5 + 16));
|
10235
|
+
}
|
10236
|
+
}
|
10237
|
+
resizeTo(capacity) {
|
10238
|
+
const oldCapacity = this._capacity;
|
10239
|
+
this._capacity = capacity;
|
10240
|
+
const front = this._front;
|
10241
|
+
const length = this._length;
|
10242
|
+
if (front + length > oldCapacity) {
|
10243
|
+
const moveItemsCount = (front + length) & (oldCapacity - 1);
|
10244
|
+
arrayMove(this.arr, 0, this.arr, oldCapacity, moveItemsCount);
|
10245
|
+
}
|
10246
|
+
}
|
10247
|
+
}
|
10248
|
+
class ReleaseEmitter extends events_1.default {
|
10249
|
+
}
|
10250
|
+
function isFn(x) {
|
10251
|
+
return typeof x === 'function';
|
10252
|
+
}
|
10253
|
+
function defaultInit() {
|
10254
|
+
return '1';
|
10255
|
+
}
|
10256
|
+
class Sema {
|
10257
|
+
constructor(nr, { initFn = defaultInit, pauseFn, resumeFn, capacity = 10, } = {}) {
|
10258
|
+
if (isFn(pauseFn) !== isFn(resumeFn)) {
|
10259
|
+
throw new Error('pauseFn and resumeFn must be both set for pausing');
|
10260
|
+
}
|
10261
|
+
this.nrTokens = nr;
|
10262
|
+
this.free = new Deque(nr);
|
10263
|
+
this.waiting = new Deque(capacity);
|
10264
|
+
this.releaseEmitter = new ReleaseEmitter();
|
10265
|
+
this.noTokens = initFn === defaultInit;
|
10266
|
+
this.pauseFn = pauseFn;
|
10267
|
+
this.resumeFn = resumeFn;
|
10268
|
+
this.paused = false;
|
10269
|
+
this.releaseEmitter.on('release', (token) => {
|
10270
|
+
const p = this.waiting.shift();
|
10271
|
+
if (p) {
|
10272
|
+
p.resolve(token);
|
10273
|
+
}
|
10274
|
+
else {
|
10275
|
+
if (this.resumeFn && this.paused) {
|
10276
|
+
this.paused = false;
|
10277
|
+
this.resumeFn();
|
10278
|
+
}
|
10279
|
+
this.free.push(token);
|
10280
|
+
}
|
10281
|
+
});
|
10282
|
+
for (let i = 0; i < nr; i++) {
|
10283
|
+
this.free.push(initFn());
|
10284
|
+
}
|
10285
|
+
}
|
10286
|
+
tryAcquire() {
|
10287
|
+
return this.free.pop();
|
10288
|
+
}
|
10289
|
+
async acquire() {
|
10290
|
+
let token = this.tryAcquire();
|
10291
|
+
if (token !== void 0) {
|
10292
|
+
return token;
|
10293
|
+
}
|
10294
|
+
return new Promise((resolve, reject) => {
|
10295
|
+
if (this.pauseFn && !this.paused) {
|
10296
|
+
this.paused = true;
|
10297
|
+
this.pauseFn();
|
10298
|
+
}
|
10299
|
+
this.waiting.push({ resolve, reject });
|
10300
|
+
});
|
10301
|
+
}
|
10302
|
+
release(token) {
|
10303
|
+
this.releaseEmitter.emit('release', this.noTokens ? '1' : token);
|
10304
|
+
}
|
10305
|
+
drain() {
|
10306
|
+
const a = new Array(this.nrTokens);
|
10307
|
+
for (let i = 0; i < this.nrTokens; i++) {
|
10308
|
+
a[i] = this.acquire();
|
10309
|
+
}
|
10310
|
+
return Promise.all(a);
|
10311
|
+
}
|
10312
|
+
nrWaiting() {
|
10313
|
+
return this.waiting.length;
|
10314
|
+
}
|
10315
|
+
}
|
10316
|
+
exports.Sema = Sema;
|
10317
|
+
function RateLimit(rps, { timeUnit = 1000, uniformDistribution = false, } = {}) {
|
10318
|
+
const sema = new Sema(uniformDistribution ? 1 : rps);
|
10319
|
+
const delay = uniformDistribution ? timeUnit / rps : timeUnit;
|
10320
|
+
return async function rl() {
|
10321
|
+
await sema.acquire();
|
10322
|
+
setTimeout(() => sema.release(), delay);
|
10323
|
+
};
|
10324
|
+
}
|
10325
|
+
exports.RateLimit = RateLimit;
|
10326
|
+
|
10327
|
+
|
10157
10328
|
/***/ }),
|
10158
10329
|
|
10159
10330
|
/***/ 31:
|
@@ -11654,6 +11825,7 @@ const fsSymbols = {
|
|
11654
11825
|
stat: FS_FN,
|
11655
11826
|
statSync: FS_FN
|
11656
11827
|
};
|
11828
|
+
const fsExtraSymbols = Object.assign(Object.assign({}, fsSymbols), { pathExists: FS_FN, pathExistsSync: FS_FN, readJson: FS_FN, readJSON: FS_FN, readJsonSync: FS_FN, readJSONSync: FS_FN });
|
11657
11829
|
const staticModules = Object.assign(Object.create(null), {
|
11658
11830
|
bindings: {
|
11659
11831
|
default: BINDINGS
|
@@ -11668,6 +11840,8 @@ const staticModules = Object.assign(Object.create(null), {
|
|
11668
11840
|
}
|
11669
11841
|
},
|
11670
11842
|
fs: Object.assign({ default: fsSymbols }, fsSymbols),
|
11843
|
+
'fs-extra': Object.assign({ default: fsExtraSymbols }, fsExtraSymbols),
|
11844
|
+
'graceful-fs': Object.assign({ default: fsSymbols }, fsSymbols),
|
11671
11845
|
process: Object.assign({ default: staticProcess }, staticProcess),
|
11672
11846
|
// populated below
|
11673
11847
|
path: {
|
@@ -12475,6 +12649,7 @@ const resolve_dependency_1 = __importDefault(__webpack_require__(2278));
|
|
12475
12649
|
const micromatch_1 = __webpack_require__(1189);
|
12476
12650
|
const sharedlib_emit_1 = __webpack_require__(2985);
|
12477
12651
|
const path_2 = __webpack_require__(5622);
|
12652
|
+
const async_sema_1 = __webpack_require__(6171);
|
12478
12653
|
const fsReadFile = graceful_fs_1.default.promises.readFile;
|
12479
12654
|
const fsReadlink = graceful_fs_1.default.promises.readlink;
|
12480
12655
|
const fsStat = graceful_fs_1.default.promises.stat;
|
@@ -12509,7 +12684,10 @@ async function nodeFileTrace(files, opts = {}) {
|
|
12509
12684
|
exports.nodeFileTrace = nodeFileTrace;
|
12510
12685
|
;
|
12511
12686
|
class Job {
|
12512
|
-
constructor({ base = process.cwd(), processCwd, exports, conditions = exports || ['node'], exportsOnly = false, paths = {}, ignore, log = false, mixedModules = false, ts = true, analysis = {}, cache,
|
12687
|
+
constructor({ base = process.cwd(), processCwd, exports, conditions = exports || ['node'], exportsOnly = false, paths = {}, ignore, log = false, mixedModules = false, ts = true, analysis = {}, cache,
|
12688
|
+
// we use a default of 1024 concurrency to balance
|
12689
|
+
// performance and memory usage for fs operations
|
12690
|
+
fileIOConcurrency = 1024, }) {
|
12513
12691
|
this.reasons = new Map();
|
12514
12692
|
this.ts = ts;
|
12515
12693
|
base = path_1.resolve(base);
|
@@ -12553,6 +12731,7 @@ class Job {
|
|
12553
12731
|
this.paths = resolvedPaths;
|
12554
12732
|
this.log = log;
|
12555
12733
|
this.mixedModules = mixedModules;
|
12734
|
+
this.fileIOQueue = new async_sema_1.Sema(fileIOConcurrency);
|
12556
12735
|
this.analysis = {};
|
12557
12736
|
if (analysis !== false) {
|
12558
12737
|
Object.assign(this.analysis, {
|
@@ -12585,6 +12764,7 @@ class Job {
|
|
12585
12764
|
const cached = this.symlinkCache.get(path);
|
12586
12765
|
if (cached !== undefined)
|
12587
12766
|
return cached;
|
12767
|
+
await this.fileIOQueue.acquire();
|
12588
12768
|
try {
|
12589
12769
|
const link = await fsReadlink(path);
|
12590
12770
|
// also copy stat cache to symlink
|
@@ -12600,6 +12780,9 @@ class Job {
|
|
12600
12780
|
this.symlinkCache.set(path, null);
|
12601
12781
|
return null;
|
12602
12782
|
}
|
12783
|
+
finally {
|
12784
|
+
this.fileIOQueue.release();
|
12785
|
+
}
|
12603
12786
|
}
|
12604
12787
|
async isFile(path) {
|
12605
12788
|
const stats = await this.stat(path);
|
@@ -12617,6 +12800,7 @@ class Job {
|
|
12617
12800
|
const cached = this.statCache.get(path);
|
12618
12801
|
if (cached)
|
12619
12802
|
return cached;
|
12803
|
+
await this.fileIOQueue.acquire();
|
12620
12804
|
try {
|
12621
12805
|
const stats = await fsStat(path);
|
12622
12806
|
this.statCache.set(path, stats);
|
@@ -12629,6 +12813,9 @@ class Job {
|
|
12629
12813
|
}
|
12630
12814
|
throw e;
|
12631
12815
|
}
|
12816
|
+
finally {
|
12817
|
+
this.fileIOQueue.release();
|
12818
|
+
}
|
12632
12819
|
}
|
12633
12820
|
async resolve(id, parent, job, cjsResolve) {
|
12634
12821
|
return resolve_dependency_1.default(id, parent, job, cjsResolve);
|
@@ -12637,6 +12824,7 @@ class Job {
|
|
12637
12824
|
const cached = this.fileCache.get(path);
|
12638
12825
|
if (cached !== undefined)
|
12639
12826
|
return cached;
|
12827
|
+
await this.fileIOQueue.acquire();
|
12640
12828
|
try {
|
12641
12829
|
const source = (await fsReadFile(path)).toString();
|
12642
12830
|
this.fileCache.set(path, source);
|
@@ -12649,6 +12837,9 @@ class Job {
|
|
12649
12837
|
}
|
12650
12838
|
throw e;
|
12651
12839
|
}
|
12840
|
+
finally {
|
12841
|
+
this.fileIOQueue.release();
|
12842
|
+
}
|
12652
12843
|
}
|
12653
12844
|
async realpath(path, parent, seen = new Set()) {
|
12654
12845
|
if (seen.has(path))
|
@@ -42886,14 +43077,14 @@ const build = async ({ files, workPath, repoRootPath, entrypoint, config = {}, m
|
|
42886
43077
|
typeof images.dangerouslyAllowSVG !== 'boolean') {
|
42887
43078
|
throw new build_utils_1.NowBuildError({
|
42888
43079
|
code: 'NEXT_IMAGES_DANGEROUSLYALLOWSVG',
|
42889
|
-
message: 'image-manifest.json "images.dangerouslyAllowSVG" must be
|
43080
|
+
message: 'image-manifest.json "images.dangerouslyAllowSVG" must be a boolean. Contact support if this continues to happen.',
|
42890
43081
|
});
|
42891
43082
|
}
|
42892
43083
|
if (typeof images.contentSecurityPolicy !== 'undefined' &&
|
42893
43084
|
typeof images.contentSecurityPolicy !== 'string') {
|
42894
43085
|
throw new build_utils_1.NowBuildError({
|
42895
43086
|
code: 'NEXT_IMAGES_CONTENTSECURITYPOLICY',
|
42896
|
-
message: 'image-manifest.json "images.contentSecurityPolicy" must be
|
43087
|
+
message: 'image-manifest.json "images.contentSecurityPolicy" must be a string. Contact support if this continues to happen.',
|
42897
43088
|
});
|
42898
43089
|
}
|
42899
43090
|
break;
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@vercel/next",
|
3
|
-
"version": "3.1.
|
3
|
+
"version": "3.1.11",
|
4
4
|
"license": "MIT",
|
5
5
|
"main": "./dist/index",
|
6
6
|
"homepage": "https://vercel.com/docs/runtimes#official-runtimes/next-js",
|
@@ -45,8 +45,8 @@
|
|
45
45
|
"@types/semver": "6.0.0",
|
46
46
|
"@types/text-table": "0.2.1",
|
47
47
|
"@types/webpack-sources": "3.2.0",
|
48
|
-
"@vercel/build-utils": "5.0.
|
49
|
-
"@vercel/nft": "0.
|
48
|
+
"@vercel/build-utils": "5.0.7",
|
49
|
+
"@vercel/nft": "0.21.0",
|
50
50
|
"@vercel/routing-utils": "2.0.0",
|
51
51
|
"async-sema": "3.0.1",
|
52
52
|
"buffer-crc32": "0.2.13",
|
@@ -70,5 +70,5 @@
|
|
70
70
|
"typescript": "4.5.2",
|
71
71
|
"webpack-sources": "3.2.3"
|
72
72
|
},
|
73
|
-
"gitHead": "
|
73
|
+
"gitHead": "e8c7db59cf2746422f1f7e14cc6b7f901c243d50"
|
74
74
|
}
|