Cars project 3 do dokończenia
This commit is contained in:
1 parent
3b96ac1be8
commit
b3be59a011
159 files changed
+9794
-3786
No files matched your search
+59
-21
@@ -15,13 +15,23 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
|
||||
}) : function(o, v) {
|
||||
o["default"] = v;
|
||||
});
|
||||
var __importStar = (this && this.__importStar) || function (mod) {
|
||||
if (mod && mod.__esModule) return mod;
|
||||
var result = {};
|
||||
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
||||
__setModuleDefault(result, mod);
|
||||
return result;
|
||||
};
|
||||
var __importStar = (this && this.__importStar) || (function () {
|
||||
var ownKeys = function(o) {
|
||||
ownKeys = Object.getOwnPropertyNames || function (o) {
|
||||
var ar = [];
|
||||
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
||||
return ar;
|
||||
};
|
||||
return ownKeys(o);
|
||||
};
|
||||
return function (mod) {
|
||||
if (mod && mod.__esModule) return mod;
|
||||
var result = {};
|
||||
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
||||
__setModuleDefault(result, mod);
|
||||
return result;
|
||||
};
|
||||
})();
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.PathScurry = exports.Path = exports.PathScurryDarwin = exports.PathScurryPosix = exports.PathScurryWin32 = exports.PathScurryBase = exports.PathPosix = exports.PathWin32 = exports.PathBase = exports.ChildrenCache = exports.ResolveCache = void 0;
|
||||
const lru_cache_1 = require("lru-cache");
|
||||
@@ -55,14 +65,29 @@ const fsFromOption = (fsOption) => !fsOption || fsOption === defaultFS || fsOpti
|
||||
...fsOption,
|
||||
promises: {
|
||||
...defaultFS.promises,
|
||||
...(fsOption.promises || {}),
|
||||
...(fsOption.promises),
|
||||
},
|
||||
};
|
||||
// turn something like //?/c:/ into c:\
|
||||
// turn something like //?/c:/ into c:\, and //?/UNC/host/share/ or
|
||||
// //host/share into \\host\share\
|
||||
const uncDriveRegexp = /^\\\\\?\\([a-z]:)\\?$/i;
|
||||
const uncToDrive = (rootPath) => rootPath.replace(/\//g, '\\').replace(uncDriveRegexp, '$1\\');
|
||||
const uncLongRegexp = /^\\\\\?\\UNC\\([^\\]+\\[^\\]+)\\?$/i;
|
||||
const uncShareRegexp = /^\\\\[^\\?]+\\[^\\]+$/;
|
||||
const uncToDrive = (rootPath) => rootPath
|
||||
.replace(/\//g, '\\')
|
||||
.replace(uncDriveRegexp, '$1\\')
|
||||
.replace(uncLongRegexp, '\\\\$1\\')
|
||||
.replace(uncShareRegexp, '$&\\');
|
||||
// path.win32.parse() only finds the //?/UNC/ of a long UNC root
|
||||
const longUncRoot = /^[\\/]{2}\?[\\/]unc[\\/][^\\/]+[\\/][^\\/]+(?:[\\/]|$)/i;
|
||||
// //?/c:/x is the same path as c:/x
|
||||
const longDrivePrefix = /^[\\/]{2}\?[\\/](?=[a-z]:)/i;
|
||||
// //?/UNC/host/share/x is the same path as //host/share/x. This
|
||||
// matches up to the / after UNC, which with a \ in front of it is
|
||||
// the // in front of the host.
|
||||
const longUncPrefix = /^[\\/]{2}\?[\\/]unc(?=[\\/][^\\/]+[\\/][^\\/])/i;
|
||||
// windows paths are separated by either / or \
|
||||
const eitherSep = /[\\\/]/;
|
||||
const eitherSep = /[\\/]/;
|
||||
const UNKNOWN = 0; // may not even exist, for all we know
|
||||
const IFIFO = 0b0001;
|
||||
const IFCHR = 0b0010;
|
||||
@@ -335,6 +360,15 @@ class PathBase {
|
||||
this.#fs = fsFromOption(opts.fs);
|
||||
}
|
||||
}
|
||||
/**
|
||||
* The file system methods that this Path uses, for a new root on
|
||||
* another drive or UNC share.
|
||||
*
|
||||
* @internal
|
||||
*/
|
||||
get fs() {
|
||||
return this.#fs;
|
||||
}
|
||||
/**
|
||||
* Returns the depth of the Path object from its root.
|
||||
*
|
||||
@@ -1123,7 +1157,7 @@ class PathBase {
|
||||
const rp = await this.#fs.promises.realpath(this.fullpath());
|
||||
return (this.#realpath = this.resolve(rp));
|
||||
}
|
||||
catch (_) {
|
||||
catch {
|
||||
this.#markENOREALPATH();
|
||||
}
|
||||
}
|
||||
@@ -1139,7 +1173,7 @@ class PathBase {
|
||||
const rp = this.#fs.realpathSync(this.fullpath());
|
||||
return (this.#realpath = this.resolve(rp));
|
||||
}
|
||||
catch (_) {
|
||||
catch {
|
||||
this.#markENOREALPATH();
|
||||
}
|
||||
}
|
||||
@@ -1208,14 +1242,15 @@ class PathWin32 extends PathBase {
|
||||
* @internal
|
||||
*/
|
||||
getRootString(path) {
|
||||
return node_path_1.win32.parse(path).root;
|
||||
return longUncRoot.exec(path)?.[0] ?? node_path_1.win32.parse(path).root;
|
||||
}
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
getRoot(rootPath) {
|
||||
rootPath = uncToDrive(rootPath.toUpperCase());
|
||||
if (rootPath === this.root.name) {
|
||||
// a root with no drive or UNC host is the root of this path
|
||||
if (rootPath === this.root.name || /^[\\/]$/.test(rootPath)) {
|
||||
return this.root;
|
||||
}
|
||||
// ok, not that one, check if it matches another we know about
|
||||
@@ -1225,7 +1260,10 @@ class PathWin32 extends PathBase {
|
||||
}
|
||||
}
|
||||
// otherwise, have to create a new one.
|
||||
return (this.roots[rootPath] = new PathScurryWin32(rootPath, this).root);
|
||||
return (this.roots[rootPath] = new PathScurryWin32(rootPath, {
|
||||
nocase: this.nocase,
|
||||
fs: this.fs,
|
||||
}).root);
|
||||
}
|
||||
/**
|
||||
* @internal
|
||||
@@ -1234,11 +1272,7 @@ class PathWin32 extends PathBase {
|
||||
// windows can (rarely) have case-sensitive filesystem, but
|
||||
// UNC and drive letters are always case-insensitive, and canonically
|
||||
// represented uppercase.
|
||||
rootPath = rootPath
|
||||
.toUpperCase()
|
||||
.replace(/\//g, '\\')
|
||||
.replace(uncDriveRegexp, '$1\\');
|
||||
return rootPath === compare;
|
||||
return uncToDrive(rootPath.toUpperCase()) === compare;
|
||||
}
|
||||
}
|
||||
exports.PathWin32 = PathWin32;
|
||||
@@ -1919,6 +1953,10 @@ class PathScurryWin32 extends PathScurryBase {
|
||||
sep = '\\';
|
||||
constructor(cwd = process.cwd(), opts = {}) {
|
||||
const { nocase = true } = opts;
|
||||
// use the same root as resolve() does for these paths
|
||||
if (typeof cwd === 'string' && !cwd.startsWith('file://')) {
|
||||
cwd = cwd.replace(longDrivePrefix, '').replace(longUncPrefix, '\\');
|
||||
}
|
||||
super(cwd, node_path_1.win32, '\\', { ...opts, nocase });
|
||||
this.nocase = nocase;
|
||||
for (let p = this.cwd; p; p = p.parent) {
|
||||
|
||||
Reference in new issue
Block a user