xshell 1.2.76 → 1.2.78
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/file.d.ts +4 -2
- package/file.js +4 -4
- package/package.json +5 -5
- package/utils.browser.d.ts +7 -0
- package/utils.browser.js +2 -0
package/file.d.ts
CHANGED
|
@@ -36,7 +36,7 @@ export declare function fexists(fp: string, { print }?: {
|
|
|
36
36
|
|
|
37
37
|
- flags: `'r'` https://nodejs.org/docs/latest/api/fs.html#file-system-flags
|
|
38
38
|
- options?:
|
|
39
|
-
- mode?: `'0o666'`
|
|
39
|
+
- mode?: `'0o666'` 设置新建文件时的 mode (permission and sticky bits)
|
|
40
40
|
- print?: `false` */
|
|
41
41
|
export declare function fopen(fp: string, flags?: string | number, { mode, print }?: {
|
|
42
42
|
mode?: fs.Mode;
|
|
@@ -79,6 +79,7 @@ export interface FWriteOptions {
|
|
|
79
79
|
print?: boolean;
|
|
80
80
|
mtime?: number;
|
|
81
81
|
flush?: boolean;
|
|
82
|
+
mode?: fs.Mode;
|
|
82
83
|
}
|
|
83
84
|
/** 写入 data 到 fp 路径或句柄所指的文件
|
|
84
85
|
会在因不存在父文件夹导致写入失败时,自动创建父文件夹,并再次尝试写入
|
|
@@ -92,7 +93,8 @@ export interface FWriteOptions {
|
|
|
92
93
|
- options?:
|
|
93
94
|
- print?: `true`
|
|
94
95
|
- mtime?: 在写入后设置修改时间 (utc 毫秒数)
|
|
95
|
-
- flush?: 用 filehandle.sync() 刷到硬盘,确保已写入
|
|
96
|
+
- flush?: 用 filehandle.sync() 刷到硬盘,确保已写入
|
|
97
|
+
- mode?: 设置 0o755 之类的 mode */
|
|
96
98
|
export declare function fwrite(fp: string, data: string | Uint8Array | any, options?: FWriteOptions): Promise<string>;
|
|
97
99
|
export declare function fwrite(fp: FileHandle, data: string | Uint8Array | any, options?: FWriteOptions): Promise<FileHandle>;
|
|
98
100
|
export declare function fwrite(fp: string | FileHandle, data: string | Uint8Array | any, options?: FWriteOptions): Promise<string | FileHandle>;
|
package/file.js
CHANGED
|
@@ -28,7 +28,7 @@ export function fexists(fp, { print = true } = {}) {
|
|
|
28
28
|
|
|
29
29
|
- flags: `'r'` https://nodejs.org/docs/latest/api/fs.html#file-system-flags
|
|
30
30
|
- options?:
|
|
31
|
-
- mode?: `'0o666'`
|
|
31
|
+
- mode?: `'0o666'` 设置新建文件时的 mode (permission and sticky bits)
|
|
32
32
|
- print?: `false` */
|
|
33
33
|
export async function fopen(fp, flags = 'r', { mode, print } = {}) {
|
|
34
34
|
if (print)
|
|
@@ -87,7 +87,7 @@ export async function fequals(fp_left, fp_right, { print = true } = {}) {
|
|
|
87
87
|
return false;
|
|
88
88
|
}
|
|
89
89
|
}
|
|
90
|
-
export async function fwrite(fp, data, { print = true, mtime, flush } = {}) {
|
|
90
|
+
export async function fwrite(fp, data, { print = true, mtime, flush, mode } = {}) {
|
|
91
91
|
const is_handle = typeof fp === 'object' && fp && 'fd' in fp;
|
|
92
92
|
if (is_handle) {
|
|
93
93
|
if (print)
|
|
@@ -102,7 +102,7 @@ export async function fwrite(fp, data, { print = true, mtime, flush } = {}) {
|
|
|
102
102
|
data = to_json(data);
|
|
103
103
|
// 需要设置修改时间,先打开文件再写入
|
|
104
104
|
if (mtime !== undefined && !is_handle) {
|
|
105
|
-
let handle = await fopen(fp, 'w',
|
|
105
|
+
let handle = await fopen(fp, 'w', { mode, print: false });
|
|
106
106
|
try {
|
|
107
107
|
await handle.write(data, 0);
|
|
108
108
|
const mseconds = mtime / 1000;
|
|
@@ -113,7 +113,7 @@ export async function fwrite(fp, data, { print = true, mtime, flush } = {}) {
|
|
|
113
113
|
}
|
|
114
114
|
return fp;
|
|
115
115
|
}
|
|
116
|
-
const write_options = { flush };
|
|
116
|
+
const write_options = { flush, mode };
|
|
117
117
|
try {
|
|
118
118
|
await fsp.writeFile(fp, data, write_options);
|
|
119
119
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "xshell",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.78",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "./index.js",
|
|
6
6
|
"bin": {
|
|
@@ -57,9 +57,9 @@
|
|
|
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.39.
|
|
61
|
-
"@typescript-eslint/parser": "^8.39.
|
|
62
|
-
"@typescript-eslint/utils": "^8.39.
|
|
60
|
+
"@typescript-eslint/eslint-plugin": "^8.39.1",
|
|
61
|
+
"@typescript-eslint/parser": "^8.39.1",
|
|
62
|
+
"@typescript-eslint/utils": "^8.39.1",
|
|
63
63
|
"archiver": "^7.0.1",
|
|
64
64
|
"chalk": "^5.5.0",
|
|
65
65
|
"commander": "^14.0.0",
|
|
@@ -105,7 +105,7 @@
|
|
|
105
105
|
"@types/koa-compress": "^4.0.6",
|
|
106
106
|
"@types/mime-types": "^3.0.1",
|
|
107
107
|
"@types/node": "^24.2.1",
|
|
108
|
-
"@types/react": "^19.1.
|
|
108
|
+
"@types/react": "^19.1.10",
|
|
109
109
|
"@types/tough-cookie": "^4.0.5",
|
|
110
110
|
"@types/ua-parser-js": "^0.7.39",
|
|
111
111
|
"@types/vscode": "^1.102.0",
|
package/utils.browser.d.ts
CHANGED
|
@@ -2,6 +2,13 @@ import './prototype.browser.ts';
|
|
|
2
2
|
import './platform.browser.ts';
|
|
3
3
|
export * from './utils.common.ts';
|
|
4
4
|
export declare function pause(milliseconds?: number): Promise<void>;
|
|
5
|
+
/** 表单 Form.Item 必填 `<Form.Item {...required}>` */
|
|
6
|
+
export declare const required: {
|
|
7
|
+
required: boolean;
|
|
8
|
+
rules: {
|
|
9
|
+
required: boolean;
|
|
10
|
+
}[];
|
|
11
|
+
};
|
|
5
12
|
/** 切换所有已选择的 items 中是否包含当前 item */
|
|
6
13
|
export declare function switch_selecteds<TItem>(selecteds: TItem[], item: TItem): TItem[];
|
|
7
14
|
export declare function apply_css(css: string): void;
|
package/utils.browser.js
CHANGED
|
@@ -7,6 +7,8 @@ export async function pause(milliseconds = 3000) {
|
|
|
7
7
|
debugger;
|
|
8
8
|
}
|
|
9
9
|
globalThis.pause = pause;
|
|
10
|
+
/** 表单 Form.Item 必填 `<Form.Item {...required}>` */
|
|
11
|
+
export const required = { required: true, rules: [{ required: true }] };
|
|
10
12
|
/** 切换所有已选择的 items 中是否包含当前 item */
|
|
11
13
|
export function switch_selecteds(selecteds, item) {
|
|
12
14
|
return selecteds.includes(item) ?
|