Initial boiler plate project
This commit is contained in:
6
node_modules/next/dist/lib/fs/rename.d.ts
generated
vendored
Normal file
6
node_modules/next/dist/lib/fs/rename.d.ts
generated
vendored
Normal file
@ -0,0 +1,6 @@
|
||||
/**
|
||||
* A drop-in replacement for `fs.rename` that:
|
||||
* - allows to move across multiple disks
|
||||
* - attempts to retry the operation for certain error codes on Windows
|
||||
*/
|
||||
export declare function rename(source: string, target: string, windowsRetryTimeout?: number | false): Promise<void>;
|
||||
128
node_modules/next/dist/lib/fs/rename.js
generated
vendored
Normal file
128
node_modules/next/dist/lib/fs/rename.js
generated
vendored
Normal file
@ -0,0 +1,128 @@
|
||||
/*
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2015 - present Microsoft Corporation
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
*/ // This file is based on https://github.com/microsoft/vscode/blob/f860fcf11022f10a992440fd54c6e45674e39617/src/vs/base/node/pfs.ts
|
||||
// See the LICENSE at the top of the file
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
Object.defineProperty(exports, "rename", {
|
||||
enumerable: true,
|
||||
get: function() {
|
||||
return rename;
|
||||
}
|
||||
});
|
||||
const _gracefulfs = /*#__PURE__*/ _interop_require_wildcard(require("graceful-fs"));
|
||||
const _util = require("util");
|
||||
function _getRequireWildcardCache(nodeInterop) {
|
||||
if (typeof WeakMap !== "function") return null;
|
||||
var cacheBabelInterop = new WeakMap();
|
||||
var cacheNodeInterop = new WeakMap();
|
||||
return (_getRequireWildcardCache = function(nodeInterop) {
|
||||
return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
|
||||
})(nodeInterop);
|
||||
}
|
||||
function _interop_require_wildcard(obj, nodeInterop) {
|
||||
if (!nodeInterop && obj && obj.__esModule) {
|
||||
return obj;
|
||||
}
|
||||
if (obj === null || typeof obj !== "object" && typeof obj !== "function") {
|
||||
return {
|
||||
default: obj
|
||||
};
|
||||
}
|
||||
var cache = _getRequireWildcardCache(nodeInterop);
|
||||
if (cache && cache.has(obj)) {
|
||||
return cache.get(obj);
|
||||
}
|
||||
var newObj = {
|
||||
__proto__: null
|
||||
};
|
||||
var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
|
||||
for(var key in obj){
|
||||
if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
|
||||
var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
|
||||
if (desc && (desc.get || desc.set)) {
|
||||
Object.defineProperty(newObj, key, desc);
|
||||
} else {
|
||||
newObj[key] = obj[key];
|
||||
}
|
||||
}
|
||||
}
|
||||
newObj.default = obj;
|
||||
if (cache) {
|
||||
cache.set(obj, newObj);
|
||||
}
|
||||
return newObj;
|
||||
}
|
||||
async function rename(source, target, windowsRetryTimeout = 60000 /* matches graceful-fs */ ) {
|
||||
if (source === target) {
|
||||
return; // simulate node.js behaviour here and do a no-op if paths match
|
||||
}
|
||||
if (process.platform === "win32" && typeof windowsRetryTimeout === "number") {
|
||||
// On Windows, a rename can fail when either source or target
|
||||
// is locked by AV software. We do leverage graceful-fs to iron
|
||||
// out these issues, however in case the target file exists,
|
||||
// graceful-fs will immediately return without retry for fs.rename().
|
||||
await renameWithRetry(source, target, Date.now(), windowsRetryTimeout);
|
||||
} else {
|
||||
await (0, _util.promisify)(_gracefulfs.rename)(source, target);
|
||||
}
|
||||
}
|
||||
async function renameWithRetry(source, target, startTime, retryTimeout, attempt = 0) {
|
||||
try {
|
||||
return await (0, _util.promisify)(_gracefulfs.rename)(source, target);
|
||||
} catch (error) {
|
||||
if (error.code !== "EACCES" && error.code !== "EPERM" && error.code !== "EBUSY") {
|
||||
throw error // only for errors we think are temporary
|
||||
;
|
||||
}
|
||||
if (Date.now() - startTime >= retryTimeout) {
|
||||
console.error(`[node.js fs] rename failed after ${attempt} retries with error: ${error}`);
|
||||
throw error // give up after configurable timeout
|
||||
;
|
||||
}
|
||||
if (attempt === 0) {
|
||||
let abortRetry = false;
|
||||
try {
|
||||
const stat = await (0, _util.promisify)(_gracefulfs.stat)(target);
|
||||
if (!stat.isFile()) {
|
||||
abortRetry = true // if target is not a file, EPERM error may be raised and we should not attempt to retry
|
||||
;
|
||||
}
|
||||
} catch (e) {
|
||||
// Ignore
|
||||
}
|
||||
if (abortRetry) {
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
// Delay with incremental backoff up to 100ms
|
||||
await timeout(Math.min(100, attempt * 10));
|
||||
// Attempt again
|
||||
return renameWithRetry(source, target, startTime, retryTimeout, attempt + 1);
|
||||
}
|
||||
}
|
||||
const timeout = (millis)=>new Promise((resolve)=>setTimeout(resolve, millis));
|
||||
|
||||
//# sourceMappingURL=rename.js.map
|
||||
1
node_modules/next/dist/lib/fs/rename.js.map
generated
vendored
Normal file
1
node_modules/next/dist/lib/fs/rename.js.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"sources":["../../../src/lib/fs/rename.ts"],"names":["rename","source","target","windowsRetryTimeout","process","platform","renameWithRetry","Date","now","promisify","fs","startTime","retryTimeout","attempt","error","code","console","abortRetry","stat","isFile","e","timeout","Math","min","millis","Promise","resolve","setTimeout"],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;CAsBC,GAED,kIAAkI;AAClI,yCAAyC;;;;;+BAUnBA;;;eAAAA;;;oEARF;sBACM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAOnB,eAAeA,OACpBC,MAAc,EACdC,MAAc,EACdC,sBAAsC,MAAM,uBAAuB,GAAxB;IAE3C,IAAIF,WAAWC,QAAQ;QACrB,QAAO,gEAAgE;IACzE;IAEA,IAAIE,QAAQC,QAAQ,KAAK,WAAW,OAAOF,wBAAwB,UAAU;QAC3E,6DAA6D;QAC7D,+DAA+D;QAC/D,4DAA4D;QAC5D,qEAAqE;QACrE,MAAMG,gBAAgBL,QAAQC,QAAQK,KAAKC,GAAG,IAAIL;IACpD,OAAO;QACL,MAAMM,IAAAA,eAAS,EAACC,YAAGV,MAAM,EAAEC,QAAQC;IACrC;AACF;AAEA,eAAeI,gBACbL,MAAc,EACdC,MAAc,EACdS,SAAiB,EACjBC,YAAoB,EACpBC,UAAU,CAAC;IAEX,IAAI;QACF,OAAO,MAAMJ,IAAAA,eAAS,EAACC,YAAGV,MAAM,EAAEC,QAAQC;IAC5C,EAAE,OAAOY,OAAY;QACnB,IACEA,MAAMC,IAAI,KAAK,YACfD,MAAMC,IAAI,KAAK,WACfD,MAAMC,IAAI,KAAK,SACf;YACA,MAAMD,MAAM,yCAAyC;;QACvD;QAEA,IAAIP,KAAKC,GAAG,KAAKG,aAAaC,cAAc;YAC1CI,QAAQF,KAAK,CACX,CAAC,iCAAiC,EAAED,QAAQ,qBAAqB,EAAEC,MAAM,CAAC;YAG5E,MAAMA,MAAM,qCAAqC;;QACnD;QAEA,IAAID,YAAY,GAAG;YACjB,IAAII,aAAa;YACjB,IAAI;gBACF,MAAMC,OAAO,MAAMT,IAAAA,eAAS,EAACC,YAAGQ,IAAI,EAAEhB;gBACtC,IAAI,CAACgB,KAAKC,MAAM,IAAI;oBAClBF,aAAa,KAAK,wFAAwF;;gBAC5G;YACF,EAAE,OAAOG,GAAG;YACV,SAAS;YACX;YAEA,IAAIH,YAAY;gBACd,MAAMH;YACR;QACF;QAEA,6CAA6C;QAC7C,MAAMO,QAAQC,KAAKC,GAAG,CAAC,KAAKV,UAAU;QAEtC,gBAAgB;QAChB,OAAOP,gBAAgBL,QAAQC,QAAQS,WAAWC,cAAcC,UAAU;IAC5E;AACF;AAEA,MAAMQ,UAAU,CAACG,SACf,IAAIC,QAAQ,CAACC,UAAYC,WAAWD,SAASF"}
|
||||
1
node_modules/next/dist/lib/fs/write-atomic.d.ts
generated
vendored
Normal file
1
node_modules/next/dist/lib/fs/write-atomic.d.ts
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
export declare function writeFileAtomic(filePath: string, content: string): Promise<void>;
|
||||
28
node_modules/next/dist/lib/fs/write-atomic.js
generated
vendored
Normal file
28
node_modules/next/dist/lib/fs/write-atomic.js
generated
vendored
Normal file
@ -0,0 +1,28 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
Object.defineProperty(exports, "writeFileAtomic", {
|
||||
enumerable: true,
|
||||
get: function() {
|
||||
return writeFileAtomic;
|
||||
}
|
||||
});
|
||||
const _promises = require("fs/promises");
|
||||
const _rename = require("./rename");
|
||||
async function writeFileAtomic(filePath, content) {
|
||||
const tempPath = filePath + ".tmp." + Math.random().toString(36).slice(2);
|
||||
try {
|
||||
await (0, _promises.writeFile)(tempPath, content, "utf-8");
|
||||
await (0, _rename.rename)(tempPath, filePath);
|
||||
} catch (e) {
|
||||
try {
|
||||
await (0, _promises.unlink)(tempPath);
|
||||
} catch {
|
||||
// ignore
|
||||
}
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
||||
//# sourceMappingURL=write-atomic.js.map
|
||||
1
node_modules/next/dist/lib/fs/write-atomic.js.map
generated
vendored
Normal file
1
node_modules/next/dist/lib/fs/write-atomic.js.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"sources":["../../../src/lib/fs/write-atomic.ts"],"names":["writeFileAtomic","filePath","content","tempPath","Math","random","toString","slice","writeFile","rename","e","unlink"],"mappings":";;;;+BAGsBA;;;eAAAA;;;0BAHY;wBACX;AAEhB,eAAeA,gBACpBC,QAAgB,EAChBC,OAAe;IAEf,MAAMC,WAAWF,WAAW,UAAUG,KAAKC,MAAM,GAAGC,QAAQ,CAAC,IAAIC,KAAK,CAAC;IACvE,IAAI;QACF,MAAMC,IAAAA,mBAAS,EAACL,UAAUD,SAAS;QACnC,MAAMO,IAAAA,cAAM,EAACN,UAAUF;IACzB,EAAE,OAAOS,GAAG;QACV,IAAI;YACF,MAAMC,IAAAA,gBAAM,EAACR;QACf,EAAE,OAAM;QACN,SAAS;QACX;QACA,MAAMO;IACR;AACF"}
|
||||
Reference in New Issue
Block a user