mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-19 17:38:19 +08:00
ui: upgrade to webpack5
This commit is contained in:
1 parent
8648929063
commit
a05125c6b0
134 files changed
+503
-457
No files matched your search
@@ -1,5 +1,3 @@
|
||||
import { inspect } from 'util';
|
||||
|
||||
declare global {
|
||||
interface StringConstructor {
|
||||
random: (digit?: number, dict?: string) => string;
|
||||
@@ -33,24 +31,23 @@ String.random = function random(digit = 32, dict = defaultDict) {
|
||||
return str;
|
||||
};
|
||||
|
||||
String.prototype.format = function formatStr(...args) {
|
||||
let result = this;
|
||||
if (args.length) {
|
||||
if (args.length === 1 && typeof args[0] === 'object') {
|
||||
const t = args[0];
|
||||
for (const key in t) {
|
||||
if (!key.startsWith('_') && t[key] !== undefined) {
|
||||
if (t._inspect && typeof t[key] === 'object') {
|
||||
t[key] = inspect(t[key], { colors: process?.stderr?.isTTY });
|
||||
if (!String.prototype.format) {
|
||||
String.prototype.format = function formatStr(...args) {
|
||||
let result = this;
|
||||
if (args.length) {
|
||||
if (args.length === 1 && typeof args[0] === 'object') {
|
||||
const t = args[0];
|
||||
for (const key in t) {
|
||||
if (!key.startsWith('_') && t[key] !== undefined) {
|
||||
const reg = new RegExp(`(\\{${key}\\})`, 'g');
|
||||
result = result.replace(reg, t[key]);
|
||||
}
|
||||
const reg = new RegExp(`(\\{${key}\\})`, 'g');
|
||||
result = result.replace(reg, t[key]);
|
||||
}
|
||||
}
|
||||
} else return this.formatFromArray(args);
|
||||
}
|
||||
return result;
|
||||
};
|
||||
} else return this.formatFromArray(args);
|
||||
}
|
||||
return result;
|
||||
};
|
||||
}
|
||||
|
||||
String.prototype.formatFromArray = function formatStr(args) {
|
||||
let result = this;
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import os from 'os';
|
||||
import path from 'path';
|
||||
import { Duplex } from 'stream';
|
||||
import { inspect } from 'util';
|
||||
import fs from 'fs-extra';
|
||||
import type { Moment } from 'moment-timezone';
|
||||
import { isMoment } from 'moment-timezone';
|
||||
@@ -29,6 +30,25 @@ export function folderSize(folderPath: string) {
|
||||
return size;
|
||||
}
|
||||
|
||||
String.prototype.format = function formatStr(...args) {
|
||||
let result = this;
|
||||
if (args.length) {
|
||||
if (args.length === 1 && typeof args[0] === 'object') {
|
||||
const t = args[0];
|
||||
for (const key in t) {
|
||||
if (!key.startsWith('_') && t[key] !== undefined) {
|
||||
if (t._inspect && typeof t[key] === 'object') {
|
||||
t[key] = inspect(t[key], { colors: process?.stderr?.isTTY });
|
||||
}
|
||||
const reg = new RegExp(`(\\{${key}\\})`, 'g');
|
||||
result = result.replace(reg, t[key]);
|
||||
}
|
||||
}
|
||||
} else return this.formatFromArray(args);
|
||||
}
|
||||
return result;
|
||||
};
|
||||
|
||||
export function isClass(obj: any, strict = false) {
|
||||
if (typeof obj !== 'function') return false;
|
||||
const str = obj.toString();
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@hydrooj/utils",
|
||||
"version": "1.3.3",
|
||||
"version": "1.3.4",
|
||||
"description": "hydrooj utils",
|
||||
"main": "package.json",
|
||||
"repository": "https://github.com/hydro-dev/Hydro.git",
|
||||
|
||||
Reference in new issue
Block a user