xshell 1.2.32 → 1.2.34

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 CHANGED
@@ -120,9 +120,10 @@ export declare function fdelete(fp: string, { print }?: {
120
120
  red?: boolean;
121
121
  }): Promise<boolean>;
122
122
  /** 清空文件夹中的内容,实际为删除该文件夹后新建 */
123
- export declare function fdclear(fpd: string, { print }?: {
123
+ export declare function fdclear(fpd: string, { print, permission }?: {
124
124
  print?: boolean;
125
- }): Promise<void>;
125
+ permission?: boolean;
126
+ }): Promise<string>;
126
127
  export interface FCopyOptions {
127
128
  print?: boolean;
128
129
  overwrite?: boolean;
package/file.js CHANGED
@@ -288,11 +288,18 @@ export async function fdelete(fp, { print = true } = {}) {
288
288
  }
289
289
  }
290
290
  /** 清空文件夹中的内容,实际为删除该文件夹后新建 */
291
- export async function fdclear(fpd, { print = true } = {}) {
291
+ export async function fdclear(fpd, { print = true, permission = false } = {}) {
292
+ const need_permission = permission && process.platform !== 'win32';
293
+ let stat;
294
+ if (need_permission)
295
+ stat = await fstat(fpd);
292
296
  await fdelete(fpd, noprint);
293
- await fmkdir(fpd, noprint);
297
+ await fmkdir(fpd, need_permission ? { print: false, mode: Number(stat.mode) } : noprint);
298
+ if (need_permission)
299
+ await fsp.chown(fpd, Number(stat.uid), Number(stat.gid));
294
300
  if (print)
295
301
  console.log(`清空了文件夹 ${fpd}`);
302
+ return fpd;
296
303
  }
297
304
  /** 复制文件或文件夹
298
305
  会在因不存在父文件夹导致复制失败时,自动创建父文件夹,并再次尝试复制
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "xshell",
3
- "version": "1.2.32",
3
+ "version": "1.2.34",
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.29.0",
61
- "@typescript-eslint/parser": "^8.29.0",
62
- "@typescript-eslint/utils": "^8.29.0",
60
+ "@typescript-eslint/eslint-plugin": "^8.29.1",
61
+ "@typescript-eslint/parser": "^8.29.1",
62
+ "@typescript-eslint/utils": "^8.29.1",
63
63
  "archiver": "^7.0.1",
64
64
  "chalk": "^5.4.1",
65
65
  "cli-table3": "^0.6.5",
@@ -98,7 +98,7 @@
98
98
  "undici": "^7.7.0",
99
99
  "vinyl": "^3.0.0",
100
100
  "vinyl-fs": "^4.0.0",
101
- "webpack": "^5.98.0",
101
+ "webpack": "^5.99.5",
102
102
  "webpack-bundle-analyzer": "^4.10.2",
103
103
  "ws": "^8.18.1"
104
104
  },
@@ -118,7 +118,7 @@
118
118
  "@types/tough-cookie": "^4.0.5",
119
119
  "@types/ua-parser-js": "^0.7.39",
120
120
  "@types/vinyl-fs": "^3.0.5",
121
- "@types/vscode": "^1.99.0",
121
+ "@types/vscode": "^1.99.1",
122
122
  "@types/webpack-bundle-analyzer": "^4.7.0"
123
123
  },
124
124
  "pnpm": {
package/path.d.ts CHANGED
@@ -54,7 +54,7 @@ export declare function extname(path: string): string;
54
54
  /** `/` */
55
55
  export declare const sep = "/";
56
56
  /** The platform-specific file delimiter. ';' or ':'. */
57
- export declare const delimiter: ":" | ";";
57
+ export declare const delimiter: ";" | ":";
58
58
  /** Returns an object from a path string - the opposite of format().
59
59
  @param path path to evaluate.
60
60
  @throws {TypeError} if `path` is not a string. */
@@ -81,7 +81,7 @@ export declare let path: {
81
81
  basename: typeof basename;
82
82
  extname: typeof extname;
83
83
  sep: string;
84
- delimiter: ":" | ";";
84
+ delimiter: ";" | ":";
85
85
  parse: typeof parse;
86
86
  format: typeof format;
87
87
  toNamespacedPath: typeof toNamespacedPath;