forked from olcxjas-softworks/LarpixClient
update electron to v43
This commit is contained in:
parent
68ac0beedf
commit
fb6c8b6ee9
5385 changed files with 513060 additions and 123058 deletions
76
electron/node_modules/cross-dirname/dist/cjs/index.cjs
generated
vendored
Normal file
76
electron/node_modules/cross-dirname/dist/cjs/index.cjs
generated
vendored
Normal file
|
|
@ -0,0 +1,76 @@
|
|||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.getFilename = exports.getDirname = void 0;
|
||||
const DIRNAME_POSIX_REGEX = /^((?:\.(?![^\/]))|(?:(?:\/?|)(?:[\s\S]*?)))(?:\/+?|)(?:(?:\.{1,2}|[^\/]+?|)(?:\.[^.\/]*|))(?:[\/]*)$/;
|
||||
const DIRNAME_WIN32_REGEX = /^((?:\.(?![^\\]))|(?:(?:\\?|)(?:[\s\S]*?)))(?:\\+?|)(?:(?:\.{1,2}|[^\\]+?|)(?:\.[^.\\]*|))(?:[\\]*)$/;
|
||||
const EXTRACT_PATH_REGEX = /@?(?<path>[file:\/\/]?[^\(\s]+):[0-9]+:[0-9]+/;
|
||||
const WIN_POSIX_DRIVE_REGEX = /^\/[A-Z]:\/*/;
|
||||
const pathDirname = (path) => {
|
||||
let dirname = DIRNAME_POSIX_REGEX.exec(path)?.[1];
|
||||
if (!dirname) {
|
||||
dirname = DIRNAME_WIN32_REGEX.exec(path)?.[1];
|
||||
}
|
||||
if (!dirname) {
|
||||
throw new Error(`Can't extract dirname from ${path}`);
|
||||
}
|
||||
return dirname;
|
||||
};
|
||||
const getPathFromErrorStack = () => {
|
||||
let path = '';
|
||||
const stack = new Error().stack;
|
||||
if (!stack) {
|
||||
console.warn("Error has no stack!");
|
||||
return path;
|
||||
}
|
||||
// Node.js
|
||||
let initiator = stack.split('\n').slice(4, 5)[0];
|
||||
// Other
|
||||
if (!initiator) {
|
||||
initiator = stack.split('\n').slice(3, 4)[0];
|
||||
}
|
||||
if (initiator) {
|
||||
path = EXTRACT_PATH_REGEX.exec(initiator)?.groups?.path || '';
|
||||
}
|
||||
if (!initiator || !path) {
|
||||
console.warn("Can't get path from error stack!");
|
||||
}
|
||||
return path;
|
||||
};
|
||||
const getPath = () => {
|
||||
let path = getPathFromErrorStack();
|
||||
// Remove protocol
|
||||
const protocol = "file://";
|
||||
if (path.indexOf(protocol) >= 0) {
|
||||
path = path.slice(protocol.length);
|
||||
}
|
||||
// Transform to win32 path
|
||||
if (WIN_POSIX_DRIVE_REGEX.test(path)) {
|
||||
path = path.slice(1).replace(/\//g, '\\');
|
||||
}
|
||||
return path;
|
||||
};
|
||||
/**
|
||||
* Cross platform implementation for `__dirname`.
|
||||
*
|
||||
* @note Please do not use this method in nested other methods,
|
||||
* instead always use it in the root of your file, otherwise it may return wrong results.
|
||||
* @returns What `__dirname` would return in CJS
|
||||
*/
|
||||
const getDirname = () => {
|
||||
let path = getPath();
|
||||
const dirname = pathDirname(path);
|
||||
return dirname;
|
||||
};
|
||||
exports.getDirname = getDirname;
|
||||
/**
|
||||
* Cross platform implementation for `__filename`.
|
||||
*
|
||||
* @note Please do not use this method in nested other methods,
|
||||
* instead always use it in the root of your file, otherwise it may return wrong results.
|
||||
* @returns What `__filename` would return in CJS
|
||||
*/
|
||||
const getFilename = () => {
|
||||
let filename = getPath();
|
||||
return filename;
|
||||
};
|
||||
exports.getFilename = getFilename;
|
||||
71
electron/node_modules/cross-dirname/dist/esm/index.mjs
generated
vendored
Normal file
71
electron/node_modules/cross-dirname/dist/esm/index.mjs
generated
vendored
Normal file
|
|
@ -0,0 +1,71 @@
|
|||
const DIRNAME_POSIX_REGEX = /^((?:\.(?![^\/]))|(?:(?:\/?|)(?:[\s\S]*?)))(?:\/+?|)(?:(?:\.{1,2}|[^\/]+?|)(?:\.[^.\/]*|))(?:[\/]*)$/;
|
||||
const DIRNAME_WIN32_REGEX = /^((?:\.(?![^\\]))|(?:(?:\\?|)(?:[\s\S]*?)))(?:\\+?|)(?:(?:\.{1,2}|[^\\]+?|)(?:\.[^.\\]*|))(?:[\\]*)$/;
|
||||
const EXTRACT_PATH_REGEX = /@?(?<path>[file:\/\/]?[^\(\s]+):[0-9]+:[0-9]+/;
|
||||
const WIN_POSIX_DRIVE_REGEX = /^\/[A-Z]:\/*/;
|
||||
const pathDirname = (path) => {
|
||||
let dirname = DIRNAME_POSIX_REGEX.exec(path)?.[1];
|
||||
if (!dirname) {
|
||||
dirname = DIRNAME_WIN32_REGEX.exec(path)?.[1];
|
||||
}
|
||||
if (!dirname) {
|
||||
throw new Error(`Can't extract dirname from ${path}`);
|
||||
}
|
||||
return dirname;
|
||||
};
|
||||
const getPathFromErrorStack = () => {
|
||||
let path = '';
|
||||
const stack = new Error().stack;
|
||||
if (!stack) {
|
||||
console.warn("Error has no stack!");
|
||||
return path;
|
||||
}
|
||||
// Node.js
|
||||
let initiator = stack.split('\n').slice(4, 5)[0];
|
||||
// Other
|
||||
if (!initiator) {
|
||||
initiator = stack.split('\n').slice(3, 4)[0];
|
||||
}
|
||||
if (initiator) {
|
||||
path = EXTRACT_PATH_REGEX.exec(initiator)?.groups?.path || '';
|
||||
}
|
||||
if (!initiator || !path) {
|
||||
console.warn("Can't get path from error stack!");
|
||||
}
|
||||
return path;
|
||||
};
|
||||
const getPath = () => {
|
||||
let path = getPathFromErrorStack();
|
||||
// Remove protocol
|
||||
const protocol = "file://";
|
||||
if (path.indexOf(protocol) >= 0) {
|
||||
path = path.slice(protocol.length);
|
||||
}
|
||||
// Transform to win32 path
|
||||
if (WIN_POSIX_DRIVE_REGEX.test(path)) {
|
||||
path = path.slice(1).replace(/\//g, '\\');
|
||||
}
|
||||
return path;
|
||||
};
|
||||
/**
|
||||
* Cross platform implementation for `__dirname`.
|
||||
*
|
||||
* @note Please do not use this method in nested other methods,
|
||||
* instead always use it in the root of your file, otherwise it may return wrong results.
|
||||
* @returns What `__dirname` would return in CJS
|
||||
*/
|
||||
export const getDirname = () => {
|
||||
let path = getPath();
|
||||
const dirname = pathDirname(path);
|
||||
return dirname;
|
||||
};
|
||||
/**
|
||||
* Cross platform implementation for `__filename`.
|
||||
*
|
||||
* @note Please do not use this method in nested other methods,
|
||||
* instead always use it in the root of your file, otherwise it may return wrong results.
|
||||
* @returns What `__filename` would return in CJS
|
||||
*/
|
||||
export const getFilename = () => {
|
||||
let filename = getPath();
|
||||
return filename;
|
||||
};
|
||||
16
electron/node_modules/cross-dirname/dist/types/index.d.ts
generated
vendored
Normal file
16
electron/node_modules/cross-dirname/dist/types/index.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
/**
|
||||
* Cross platform implementation for `__dirname`.
|
||||
*
|
||||
* @note Please do not use this method in nested other methods,
|
||||
* instead always use it in the root of your file, otherwise it may return wrong results.
|
||||
* @returns What `__dirname` would return in CJS
|
||||
*/
|
||||
export declare const getDirname: () => string;
|
||||
/**
|
||||
* Cross platform implementation for `__filename`.
|
||||
*
|
||||
* @note Please do not use this method in nested other methods,
|
||||
* instead always use it in the root of your file, otherwise it may return wrong results.
|
||||
* @returns What `__filename` would return in CJS
|
||||
*/
|
||||
export declare const getFilename: () => string;
|
||||
Loading…
Add table
Add a link
Reference in a new issue