xshell 1.2.49 → 1.2.52
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/builder.js +4 -4
- package/file.d.ts +38 -3
- package/file.js +109 -2
- package/net.d.ts +4 -1
- package/net.js +2 -1
- package/package.json +14 -15
- package/prototype.browser.d.ts +1 -0
- package/prototype.browser.js +7 -4
- package/prototype.d.ts +1 -0
- package/prototype.js +7 -4
- package/react.development.js +16 -24
- package/react.development.js.map +1 -1
- package/react.production.js +15936 -15929
- package/react.production.js.map +1 -1
- package/utils.browser.d.ts +4 -0
- package/utils.browser.js +11 -1
- package/utils.d.ts +4 -2
- package/utils.js +9 -4
- package/Terminal.d.ts +0 -19
- package/Terminal.js +0 -98
package/builder.js
CHANGED
|
@@ -2,7 +2,7 @@ import { fileURLToPath } from 'url';
|
|
|
2
2
|
import { not_empty } from "./prototype.js";
|
|
3
3
|
import { noprint } from "./process.js";
|
|
4
4
|
import { Lock, filter_values } from "./utils.js";
|
|
5
|
-
import { fcopy, fmkdir, fwrite, fread } from "./file.js";
|
|
5
|
+
import { fcopy, fmkdir, fwrite, fread, print_info } from "./file.js";
|
|
6
6
|
import { path } from "./path.js";
|
|
7
7
|
const monaco_files = [
|
|
8
8
|
'loader.js',
|
|
@@ -563,7 +563,7 @@ export class Bundler {
|
|
|
563
563
|
await this.build(print);
|
|
564
564
|
await this.close();
|
|
565
565
|
}
|
|
566
|
-
async build_htmls(print =
|
|
566
|
+
async build_htmls(print = print_info) {
|
|
567
567
|
await Promise.all(Object.entries(this.htmls).map(async ([fp_html, { entry = 'index.js', device_viewport: device_width = false, icon, manifest, dependencies: _dependencies = [], title, scripts, mscripts, notice = false, heads, }]) => {
|
|
568
568
|
const html_template = '<!doctype html>\n' +
|
|
569
569
|
'<html>\n' +
|
|
@@ -606,7 +606,7 @@ export class Bundler {
|
|
|
606
606
|
if (print.files)
|
|
607
607
|
console.log(`${this.name} 的所有 html 页面构建完成`);
|
|
608
608
|
}
|
|
609
|
-
async build_single_js(print =
|
|
609
|
+
async build_single_js(print = print_info) {
|
|
610
610
|
const { js, entry } = this.single_js;
|
|
611
611
|
await fwrite(`${this.fpd_out}${js}`, [
|
|
612
612
|
...this.resolve_dependency_assets(this.dependencies, false, { production: this.production })
|
|
@@ -643,7 +643,7 @@ export class Bundler {
|
|
|
643
643
|
];
|
|
644
644
|
}).flat();
|
|
645
645
|
}
|
|
646
|
-
async copy_files({ dependencies: _dependencies = this.dependencies, production = this.production, assets = this.assets, fpd_root = this.fpd_root, fpd_out = this.fpd_out, print =
|
|
646
|
+
async copy_files({ dependencies: _dependencies = this.dependencies, production = this.production, assets = this.assets, fpd_root = this.fpd_root, fpd_out = this.fpd_out, print = print_info } = {}) {
|
|
647
647
|
if (print.files)
|
|
648
648
|
console.log(`复制 ${this.name} 的依赖文件到 ${this.fpd_out}`);
|
|
649
649
|
if (_dependencies.length)
|
package/file.d.ts
CHANGED
|
@@ -6,6 +6,20 @@ export type FileHandle = fsp.FileHandle & {
|
|
|
6
6
|
fp: string;
|
|
7
7
|
};
|
|
8
8
|
export declare const encodings: readonly ["utf-8", "gb18030", "shift-jis", "utf-16le"];
|
|
9
|
+
export declare const print_files: {
|
|
10
|
+
readonly info: true;
|
|
11
|
+
readonly files: true;
|
|
12
|
+
};
|
|
13
|
+
export declare const print_info: {
|
|
14
|
+
readonly info: true;
|
|
15
|
+
readonly files: false;
|
|
16
|
+
};
|
|
17
|
+
export declare const print_info_options: {
|
|
18
|
+
readonly print: {
|
|
19
|
+
readonly info: true;
|
|
20
|
+
readonly files: false;
|
|
21
|
+
};
|
|
22
|
+
};
|
|
9
23
|
export declare const ramdisk: boolean;
|
|
10
24
|
/** fp 所指向的 文件/ 文件夹 是否存在
|
|
11
25
|
Does the file/folder pointed to by fp exist? */
|
|
@@ -19,7 +33,8 @@ export declare function fexists(fp: string, { print }?: {
|
|
|
19
33
|
|
|
20
34
|
- flags: `'r'` https://nodejs.org/docs/latest/api/fs.html#file-system-flags
|
|
21
35
|
- options?:
|
|
22
|
-
- mode?: `'0o666'` Sets the file mode (permission and sticky bits) if the file is created.
|
|
36
|
+
- mode?: `'0o666'` Sets the file mode (permission and sticky bits) if the file is created.
|
|
37
|
+
- print?: `false` */
|
|
23
38
|
export declare function fopen(fp: string, flags?: string | number, { mode, print }?: {
|
|
24
39
|
mode?: fs.Mode;
|
|
25
40
|
print?: boolean;
|
|
@@ -61,11 +76,11 @@ export interface FWriteOptions {
|
|
|
61
76
|
print?: boolean;
|
|
62
77
|
mtime?: number;
|
|
63
78
|
}
|
|
64
|
-
/** 写入 data 到 fp
|
|
79
|
+
/** 写入 data 到 fp 路径或句柄所指的文件
|
|
65
80
|
会在因不存在父文件夹导致写入失败时,自动创建父文件夹,并再次尝试写入
|
|
66
81
|
最好预先创建父文件夹,减少文件系统操作,提升性能
|
|
67
82
|
返回写入的文件路径
|
|
68
|
-
- fp:
|
|
83
|
+
- fp: 目标文件完整路径或句柄
|
|
69
84
|
- data: 支持下面几种类型
|
|
70
85
|
- string: 写入文本
|
|
71
86
|
- Uint8Array, Buffer: 写入二进制 buffer
|
|
@@ -268,4 +283,24 @@ export declare function ftail(fp: string, handler: (lines: string[]) => void | P
|
|
|
268
283
|
export declare function freplace(fp: string, pattern: string | RegExp, replacement: string, { print }?: {
|
|
269
284
|
print?: boolean;
|
|
270
285
|
}): Promise<void>;
|
|
286
|
+
interface FSyncOptions {
|
|
287
|
+
print?: {
|
|
288
|
+
info: boolean;
|
|
289
|
+
files: boolean;
|
|
290
|
+
};
|
|
291
|
+
delete?: boolean;
|
|
292
|
+
}
|
|
293
|
+
/** 同步文件或文件夹 fp_src 到 fp_dst ,返回 fp_dst
|
|
294
|
+
- fp_src: 源文件或文件夹
|
|
295
|
+
- fp_dst: 目标文件或文件夹
|
|
296
|
+
- options?:
|
|
297
|
+
- print?: `print_info`
|
|
298
|
+
- delete?: `false` */
|
|
299
|
+
export declare function fsync(fp_src: string, fp_dst: string, { print, delete: _delete }?: FSyncOptions): Promise<string>;
|
|
300
|
+
/** 根据对象的 fp 属性进行字典序排序 */
|
|
301
|
+
export declare function fp_sorter(l: {
|
|
302
|
+
fp: string;
|
|
303
|
+
}, r: {
|
|
304
|
+
fp: string;
|
|
305
|
+
}): 0 | 1 | -1;
|
|
271
306
|
export declare function log_action(action: string, fp_src: string, fp_dst: string, sep?: string): void;
|
package/file.js
CHANGED
|
@@ -4,10 +4,13 @@ import { t } from "./i18n/instance.js";
|
|
|
4
4
|
import { noop, to_json } from "./prototype.js";
|
|
5
5
|
import { pack, parse } from "./io.js";
|
|
6
6
|
import { path } from "./path.js";
|
|
7
|
-
import { check, Lock, WritableMemoryStream, url_width, throttle, decode } from "./utils.js";
|
|
7
|
+
import { check, Lock, WritableMemoryStream, url_width, throttle, decode, strcmp } from "./utils.js";
|
|
8
8
|
import { noprint } from "./process.js";
|
|
9
9
|
export { fsp };
|
|
10
10
|
export const encodings = ['utf-8', 'gb18030', 'shift-jis', 'utf-16le'];
|
|
11
|
+
export const print_files = { info: true, files: true };
|
|
12
|
+
export const print_info = { info: true, files: false };
|
|
13
|
+
export const print_info_options = { print: print_info };
|
|
11
14
|
export const ramdisk = fexists('T:/TEMP/', noprint);
|
|
12
15
|
/** fp 所指向的 文件/ 文件夹 是否存在
|
|
13
16
|
Does the file/folder pointed to by fp exist? */
|
|
@@ -24,7 +27,8 @@ export function fexists(fp, { print = true } = {}) {
|
|
|
24
27
|
|
|
25
28
|
- flags: `'r'` https://nodejs.org/docs/latest/api/fs.html#file-system-flags
|
|
26
29
|
- options?:
|
|
27
|
-
- mode?: `'0o666'` Sets the file mode (permission and sticky bits) if the file is created.
|
|
30
|
+
- mode?: `'0o666'` Sets the file mode (permission and sticky bits) if the file is created.
|
|
31
|
+
- print?: `false` */
|
|
28
32
|
export async function fopen(fp, flags = 'r', { mode, print } = {}) {
|
|
29
33
|
if (print)
|
|
30
34
|
console.log(t('打开文件'), fp);
|
|
@@ -824,6 +828,109 @@ export async function freplace(fp, pattern, replacement, { print = true } = {})
|
|
|
824
828
|
await fwrite(fp, (await fread(fp, { print }))
|
|
825
829
|
.replaceAll(pattern, replacement), { print });
|
|
826
830
|
}
|
|
831
|
+
/** 同步文件或文件夹 fp_src 到 fp_dst ,返回 fp_dst
|
|
832
|
+
- fp_src: 源文件或文件夹
|
|
833
|
+
- fp_dst: 目标文件或文件夹
|
|
834
|
+
- options?:
|
|
835
|
+
- print?: `print_info`
|
|
836
|
+
- delete?: `false` */
|
|
837
|
+
export async function fsync(fp_src, fp_dst, { print = print_files, delete: _delete = false } = {}) {
|
|
838
|
+
if (print.info)
|
|
839
|
+
log_action('同步', fp_src, fp_dst);
|
|
840
|
+
if (fp_src.isdir) {
|
|
841
|
+
let dst_stats;
|
|
842
|
+
try {
|
|
843
|
+
dst_stats = (await flist(fp_dst, { stats: true, deep: true, print: false })).sort(fp_sorter);
|
|
844
|
+
}
|
|
845
|
+
catch (error) {
|
|
846
|
+
if (error.code === 'ENOENT')
|
|
847
|
+
return fcopy(fp_src, fp_dst, { print: print.info });
|
|
848
|
+
else
|
|
849
|
+
throw error;
|
|
850
|
+
}
|
|
851
|
+
const src_stats = (await flist(fp_src, { deep: true, print: false, stats: true }))
|
|
852
|
+
.sort(fp_sorter);
|
|
853
|
+
let p = 0, q = 0;
|
|
854
|
+
let tasks = [];
|
|
855
|
+
let fpd_changeds = [];
|
|
856
|
+
let fpd_deleteds = [];
|
|
857
|
+
const sync_change = ({ fp }, modify) => {
|
|
858
|
+
if (fpd_changeds.some(fpd_created => fp.startsWith(fpd_created)))
|
|
859
|
+
return;
|
|
860
|
+
if (fp.isdir)
|
|
861
|
+
fpd_changeds.push(fp);
|
|
862
|
+
if (print.files)
|
|
863
|
+
log_action(`同步${modify ? '修改' : '新增'}`, `${fp_src}${fp}`, `${fp_dst}${fp}`);
|
|
864
|
+
tasks.push(fcopy(`${fp_src}${fp}`, `${fp_dst}${fp}`, noprint));
|
|
865
|
+
};
|
|
866
|
+
const sync_delete = ({ fp }) => {
|
|
867
|
+
if (fpd_deleteds.some(fpd_deleted => fp.startsWith(fpd_deleted)))
|
|
868
|
+
return;
|
|
869
|
+
if (fp.isdir)
|
|
870
|
+
fpd_deleteds.push(fp);
|
|
871
|
+
if (print.files)
|
|
872
|
+
console.log('同步删除', `${fp_dst}${fp}`);
|
|
873
|
+
tasks.push(fdelete(`${fp_dst}${fp}`, noprint));
|
|
874
|
+
};
|
|
875
|
+
for (; p < src_stats.length && q < dst_stats.length;) {
|
|
876
|
+
const src = src_stats[p];
|
|
877
|
+
const dst = dst_stats[q];
|
|
878
|
+
if (src.fp === dst.fp) {
|
|
879
|
+
if (!src.fp.isdir && !compare_stat(src, dst))
|
|
880
|
+
sync_change(src, true);
|
|
881
|
+
++p;
|
|
882
|
+
++q;
|
|
883
|
+
}
|
|
884
|
+
else if (src.fp < dst.fp) { // dst 缺少了文件 / 文件夹
|
|
885
|
+
sync_change(src, false);
|
|
886
|
+
++p;
|
|
887
|
+
}
|
|
888
|
+
else { // dst 多了文件 / 文件夹
|
|
889
|
+
if (_delete)
|
|
890
|
+
sync_delete(dst);
|
|
891
|
+
++q;
|
|
892
|
+
}
|
|
893
|
+
}
|
|
894
|
+
for (; p < src_stats.length; ++p)
|
|
895
|
+
sync_change(src_stats[p], false);
|
|
896
|
+
if (_delete)
|
|
897
|
+
for (; q < dst_stats.length; ++q)
|
|
898
|
+
sync_delete(dst_stats[q]);
|
|
899
|
+
await Promise.all(tasks);
|
|
900
|
+
}
|
|
901
|
+
else {
|
|
902
|
+
let same = true;
|
|
903
|
+
const [src_stat, dst_stat] = await Promise.all([
|
|
904
|
+
fstat(fp_src),
|
|
905
|
+
(async () => {
|
|
906
|
+
try {
|
|
907
|
+
return await fstat(fp_dst);
|
|
908
|
+
}
|
|
909
|
+
catch (error) {
|
|
910
|
+
if (error.code === 'ENOENT')
|
|
911
|
+
same = false;
|
|
912
|
+
else
|
|
913
|
+
throw error;
|
|
914
|
+
}
|
|
915
|
+
})()
|
|
916
|
+
]);
|
|
917
|
+
if (same)
|
|
918
|
+
same = compare_stat(src_stat, dst_stat);
|
|
919
|
+
if (same)
|
|
920
|
+
log_action('跳过相同', fp_src, fp_dst);
|
|
921
|
+
else
|
|
922
|
+
await fcopy(fp_src, fp_dst, { print: print.info });
|
|
923
|
+
}
|
|
924
|
+
return fp_dst;
|
|
925
|
+
}
|
|
926
|
+
/** 根据对象的 fp 属性进行字典序排序 */
|
|
927
|
+
export function fp_sorter(l, r) {
|
|
928
|
+
return strcmp(l.fp, r.fp);
|
|
929
|
+
}
|
|
930
|
+
/** 返回修改时间与大小是否相同 */
|
|
931
|
+
function compare_stat(src, dst) {
|
|
932
|
+
return src.size === dst.size && Math.abs(Number(src.mtimeMs) - Number(dst.mtimeMs)) <= 1;
|
|
933
|
+
}
|
|
827
934
|
export function log_action(action, fp_src, fp_dst, sep = '->') {
|
|
828
935
|
console.log(`${`${action} ${fp_src}`.pad(url_width)} ${sep} ${fp_dst}`);
|
|
829
936
|
}
|
package/net.d.ts
CHANGED
|
@@ -15,6 +15,9 @@ export declare enum MyProxy {
|
|
|
15
15
|
whistle = "http://localhost:8899",
|
|
16
16
|
work = "http://localhost:10090"
|
|
17
17
|
}
|
|
18
|
+
export declare const byproxy: {
|
|
19
|
+
readonly proxy: true;
|
|
20
|
+
};
|
|
18
21
|
export declare const cookies: {
|
|
19
22
|
store: MemoryCookieStore;
|
|
20
23
|
jar: CookieJar;
|
|
@@ -297,5 +300,5 @@ export declare class RemoteClient {
|
|
|
297
300
|
[inspect.custom](): {
|
|
298
301
|
remote: string;
|
|
299
302
|
websocket: string;
|
|
300
|
-
} & Omit<this,
|
|
303
|
+
} & Omit<this, typeof import("util").inspect.custom | "call" | "websocket" | "remote" | "send">;
|
|
301
304
|
}
|
package/net.js
CHANGED
|
@@ -16,6 +16,7 @@ export var MyProxy;
|
|
|
16
16
|
MyProxy["whistle"] = "http://localhost:8899";
|
|
17
17
|
MyProxy["work"] = "http://localhost:10090";
|
|
18
18
|
})(MyProxy || (MyProxy = {}));
|
|
19
|
+
export const byproxy = { proxy: true };
|
|
19
20
|
// ------------------------------------ fetch, request
|
|
20
21
|
export const cookies = {
|
|
21
22
|
store: null,
|
|
@@ -107,7 +108,7 @@ export async function request(url, options = {}) {
|
|
|
107
108
|
let headers = {
|
|
108
109
|
'accept-language': 'zh-CN,zh;q=0.9,en-US;q=0.8,en;q=0.7,ja-JP;q=0.6,ja;q=0.5',
|
|
109
110
|
'accept-encoding': 'gzip, deflate, br',
|
|
110
|
-
'user-agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/
|
|
111
|
+
'user-agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/138.0.0.0 Safari/537.36',
|
|
111
112
|
'sec-ch-ua-platform': '"Windows"',
|
|
112
113
|
'sec-ch-ua-platform-version': '"19.0.0"',
|
|
113
114
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "xshell",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.52",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "./index.js",
|
|
6
6
|
"bin": {
|
|
@@ -49,27 +49,27 @@
|
|
|
49
49
|
]
|
|
50
50
|
},
|
|
51
51
|
"dependencies": {
|
|
52
|
-
"@babel/core": "^7.27.
|
|
53
|
-
"@babel/parser": "^7.27.
|
|
54
|
-
"@babel/traverse": "^7.27.
|
|
52
|
+
"@babel/core": "^7.27.7",
|
|
53
|
+
"@babel/parser": "^7.27.7",
|
|
54
|
+
"@babel/traverse": "^7.27.7",
|
|
55
55
|
"@koa/cors": "^5.0.0",
|
|
56
|
-
"@stylistic/eslint-plugin": "^5.
|
|
56
|
+
"@stylistic/eslint-plugin": "^5.1.0",
|
|
57
57
|
"@svgr/webpack": "^8.1.0",
|
|
58
58
|
"@types/sass-loader": "^8.0.9",
|
|
59
59
|
"@types/ws": "^8.18.1",
|
|
60
|
-
"@typescript-eslint/eslint-plugin": "^8.35.
|
|
61
|
-
"@typescript-eslint/parser": "^8.35.
|
|
62
|
-
"@typescript-eslint/utils": "^8.35.
|
|
60
|
+
"@typescript-eslint/eslint-plugin": "^8.35.1",
|
|
61
|
+
"@typescript-eslint/parser": "^8.35.1",
|
|
62
|
+
"@typescript-eslint/utils": "^8.35.1",
|
|
63
63
|
"archiver": "^7.0.1",
|
|
64
64
|
"chalk": "^5.4.1",
|
|
65
65
|
"commander": "^14.0.0",
|
|
66
66
|
"css-loader": "^7.1.2",
|
|
67
67
|
"emoji-regex": "^10.4.0",
|
|
68
|
-
"eslint": "^9.
|
|
68
|
+
"eslint": "^9.30.0",
|
|
69
69
|
"eslint-plugin-import": "^2.32.0",
|
|
70
70
|
"eslint-plugin-react": "^7.37.5",
|
|
71
71
|
"https-proxy-agent": "^7.0.6",
|
|
72
|
-
"i18next": "^25.
|
|
72
|
+
"i18next": "^25.3.0",
|
|
73
73
|
"i18next-scanner": "^4.6.0",
|
|
74
74
|
"koa": "^3.0.0",
|
|
75
75
|
"koa-compress": "^5.1.1",
|
|
@@ -78,7 +78,6 @@
|
|
|
78
78
|
"mime-types": "^3.0.1",
|
|
79
79
|
"react": "^19.1.0",
|
|
80
80
|
"react-i18next": "^15.5.3",
|
|
81
|
-
"react-object-model": "^1.2.24",
|
|
82
81
|
"resolve-path": "^1.4.0",
|
|
83
82
|
"sass": "^1.89.2",
|
|
84
83
|
"sass-loader": "^16.0.5",
|
|
@@ -90,13 +89,13 @@
|
|
|
90
89
|
"tslib": "^2.8.1",
|
|
91
90
|
"typescript": "^5.8.3",
|
|
92
91
|
"ua-parser-js": "^2.0.4",
|
|
93
|
-
"undici": "^7.
|
|
92
|
+
"undici": "^7.11.0",
|
|
94
93
|
"webpack": "^5.99.9",
|
|
95
94
|
"webpack-bundle-analyzer": "^4.10.2",
|
|
96
|
-
"ws": "^8.18.
|
|
95
|
+
"ws": "^8.18.3"
|
|
97
96
|
},
|
|
98
97
|
"devDependencies": {
|
|
99
|
-
"@babel/types": "^7.27.
|
|
98
|
+
"@babel/types": "^7.27.7",
|
|
100
99
|
"@types/archiver": "^6.0.3",
|
|
101
100
|
"@types/babel__traverse": "^7.20.7",
|
|
102
101
|
"@types/eslint": "^9.6.1",
|
|
@@ -104,7 +103,7 @@
|
|
|
104
103
|
"@types/koa": "^2.15.0",
|
|
105
104
|
"@types/koa-compress": "^4.0.6",
|
|
106
105
|
"@types/mime-types": "^3.0.1",
|
|
107
|
-
"@types/node": "^24.0.
|
|
106
|
+
"@types/node": "^24.0.8",
|
|
108
107
|
"@types/react": "^19.1.8",
|
|
109
108
|
"@types/tough-cookie": "^4.0.5",
|
|
110
109
|
"@types/ua-parser-js": "^0.7.39",
|
package/prototype.browser.d.ts
CHANGED
|
@@ -224,6 +224,7 @@ export declare const empty: (value: any) => boolean;
|
|
|
224
224
|
export declare const is_key_type: IsKeyType;
|
|
225
225
|
type IsKeyType = (key: any) => key is string | number | symbol;
|
|
226
226
|
export declare function rethrow(error: Error): void;
|
|
227
|
+
export declare function to_snake_case(str: string): string;
|
|
227
228
|
export declare function to_method_property_descriptors(methods: {
|
|
228
229
|
[name: string]: Function;
|
|
229
230
|
}): PropertyDescriptorMap;
|
package/prototype.browser.js
CHANGED
|
@@ -13,6 +13,12 @@ export const is_key_type = ((key) => key_types.includes(typeof key));
|
|
|
13
13
|
export function rethrow(error) {
|
|
14
14
|
throw error;
|
|
15
15
|
}
|
|
16
|
+
export function to_snake_case(str) {
|
|
17
|
+
return str.replace(/([A-Z])/g, '_$1')
|
|
18
|
+
.toLowerCase()
|
|
19
|
+
.replace('-', '_')
|
|
20
|
+
.strip_if_start('_');
|
|
21
|
+
}
|
|
16
22
|
export function to_method_property_descriptors(methods) {
|
|
17
23
|
return Object.fromEntries(Object.entries(methods)
|
|
18
24
|
.map(([name, value]) => ([name, {
|
|
@@ -120,10 +126,7 @@ Object.defineProperties(String.prototype, {
|
|
|
120
126
|
return new RegExp(this.replace(new RegExp(`[${replace_chars}]`, 'g'), '\\$&'), flags);
|
|
121
127
|
},
|
|
122
128
|
to_snake_case() {
|
|
123
|
-
return this
|
|
124
|
-
.toLowerCase()
|
|
125
|
-
.replace('-', '_')
|
|
126
|
-
.replace(/^_+/, '');
|
|
129
|
+
return to_snake_case(this);
|
|
127
130
|
},
|
|
128
131
|
refmt(pattern, pattern_, preservations = '', flags = '', transformer = (name, value) => value || '', pattern_placeholder = /\{.*?\}/g) {
|
|
129
132
|
// --- 转换 pattern 为 pattern_regx
|
package/prototype.d.ts
CHANGED
|
@@ -254,6 +254,7 @@ export declare const empty: (value: any) => boolean;
|
|
|
254
254
|
export declare const is_key_type: IsKeyType;
|
|
255
255
|
type IsKeyType = (key: any) => key is string | number | symbol;
|
|
256
256
|
export declare function rethrow(error: Error): void;
|
|
257
|
+
export declare function to_snake_case(str: string): string;
|
|
257
258
|
export declare function to_method_property_descriptors(methods: {
|
|
258
259
|
[name: string]: Function;
|
|
259
260
|
}): PropertyDescriptorMap;
|
package/prototype.js
CHANGED
|
@@ -14,6 +14,12 @@ export const is_key_type = ((key) => key_types.includes(typeof key));
|
|
|
14
14
|
export function rethrow(error) {
|
|
15
15
|
throw error;
|
|
16
16
|
}
|
|
17
|
+
export function to_snake_case(str) {
|
|
18
|
+
return str.replace(/([A-Z])/g, '_$1')
|
|
19
|
+
.toLowerCase()
|
|
20
|
+
.replace('-', '_')
|
|
21
|
+
.strip_if_start('_');
|
|
22
|
+
}
|
|
17
23
|
export function to_method_property_descriptors(methods) {
|
|
18
24
|
return Object.fromEntries(Object.entries(methods)
|
|
19
25
|
.map(([name, value]) => ([name, {
|
|
@@ -124,10 +130,7 @@ if (!globalThis.my_prototype_defined) {
|
|
|
124
130
|
return new RegExp(this.replace(new RegExp(`[${replace_chars}]`, 'g'), '\\$&'), flags);
|
|
125
131
|
},
|
|
126
132
|
to_snake_case() {
|
|
127
|
-
return this
|
|
128
|
-
.toLowerCase()
|
|
129
|
-
.replace('-', '_')
|
|
130
|
-
.replace(/^_+/, '');
|
|
133
|
+
return to_snake_case(this);
|
|
131
134
|
},
|
|
132
135
|
refmt(pattern, pattern_, preservations = '', flags = '', transformer = (name, value) => value || '', pattern_placeholder = /\{.*?\}/g) {
|
|
133
136
|
// --- 转换 pattern 为 pattern_regx
|
package/react.development.js
CHANGED
|
@@ -1533,9 +1533,8 @@
|
|
|
1533
1533
|
} finally {
|
|
1534
1534
|
setCurrentFiber(previousFiber);
|
|
1535
1535
|
}
|
|
1536
|
-
|
|
1537
|
-
|
|
1538
|
-
);
|
|
1536
|
+
// removed by dead control flow
|
|
1537
|
+
{}
|
|
1539
1538
|
}
|
|
1540
1539
|
function setCurrentFiber(fiber) {
|
|
1541
1540
|
ReactSharedInternals.getCurrentStack =
|
|
@@ -25462,17 +25461,12 @@ function checkDCE() {
|
|
|
25462
25461
|
// a false positive.
|
|
25463
25462
|
throw new Error('^_^');
|
|
25464
25463
|
}
|
|
25465
|
-
|
|
25466
|
-
|
|
25467
|
-
__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(checkDCE);
|
|
25468
|
-
} catch (err) {
|
|
25469
|
-
// DevTools shouldn't crash React, no matter what.
|
|
25470
|
-
// We should still report in case we break this code.
|
|
25471
|
-
console.error(err);
|
|
25472
|
-
}
|
|
25464
|
+
// removed by dead control flow
|
|
25465
|
+
{}
|
|
25473
25466
|
}
|
|
25474
25467
|
|
|
25475
|
-
if (false)
|
|
25468
|
+
if (false) // removed by dead control flow
|
|
25469
|
+
{} else {
|
|
25476
25470
|
module.exports = __webpack_require__(/*! ./cjs/react-dom-client.development.js */ "./node_modules/.pnpm/react-dom@19.1.0_react@19.1.0/node_modules/react-dom/cjs/react-dom-client.development.js");
|
|
25477
25471
|
}
|
|
25478
25472
|
|
|
@@ -25505,17 +25499,12 @@ function checkDCE() {
|
|
|
25505
25499
|
// a false positive.
|
|
25506
25500
|
throw new Error('^_^');
|
|
25507
25501
|
}
|
|
25508
|
-
|
|
25509
|
-
|
|
25510
|
-
__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(checkDCE);
|
|
25511
|
-
} catch (err) {
|
|
25512
|
-
// DevTools shouldn't crash React, no matter what.
|
|
25513
|
-
// We should still report in case we break this code.
|
|
25514
|
-
console.error(err);
|
|
25515
|
-
}
|
|
25502
|
+
// removed by dead control flow
|
|
25503
|
+
{}
|
|
25516
25504
|
}
|
|
25517
25505
|
|
|
25518
|
-
if (false)
|
|
25506
|
+
if (false) // removed by dead control flow
|
|
25507
|
+
{} else {
|
|
25519
25508
|
module.exports = __webpack_require__(/*! ./cjs/react-dom.development.js */ "./node_modules/.pnpm/react-dom@19.1.0_react@19.1.0/node_modules/react-dom/cjs/react-dom.development.js");
|
|
25520
25509
|
}
|
|
25521
25510
|
|
|
@@ -27151,7 +27140,8 @@ if (false) {} else {
|
|
|
27151
27140
|
|
|
27152
27141
|
|
|
27153
27142
|
|
|
27154
|
-
if (false)
|
|
27143
|
+
if (false) // removed by dead control flow
|
|
27144
|
+
{} else {
|
|
27155
27145
|
module.exports = __webpack_require__(/*! ./cjs/react.development.js */ "./node_modules/.pnpm/react@19.1.0/node_modules/react/cjs/react.development.js");
|
|
27156
27146
|
}
|
|
27157
27147
|
|
|
@@ -27166,7 +27156,8 @@ if (false) {} else {
|
|
|
27166
27156
|
|
|
27167
27157
|
|
|
27168
27158
|
|
|
27169
|
-
if (false)
|
|
27159
|
+
if (false) // removed by dead control flow
|
|
27160
|
+
{} else {
|
|
27170
27161
|
module.exports = __webpack_require__(/*! ./cjs/react-jsx-runtime.development.js */ "./node_modules/.pnpm/react@19.1.0/node_modules/react/cjs/react-jsx-runtime.development.js");
|
|
27171
27162
|
}
|
|
27172
27163
|
|
|
@@ -27555,7 +27546,8 @@ if (false) {} else {
|
|
|
27555
27546
|
|
|
27556
27547
|
|
|
27557
27548
|
|
|
27558
|
-
if (false)
|
|
27549
|
+
if (false) // removed by dead control flow
|
|
27550
|
+
{} else {
|
|
27559
27551
|
module.exports = __webpack_require__(/*! ./cjs/scheduler.development.js */ "./node_modules/.pnpm/scheduler@0.26.0/node_modules/scheduler/cjs/scheduler.development.js");
|
|
27560
27552
|
}
|
|
27561
27553
|
|