tnp-core 18.0.46 → 18.0.49

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.
Files changed (104) hide show
  1. package/README.md +20 -20
  2. package/assets/shared/shared_folder_info.txt +1 -1
  3. package/browser/README.md +24 -24
  4. package/browser/esm2022/lib/core-imports.mjs +65 -9
  5. package/browser/esm2022/lib/core-models.mjs +61 -9
  6. package/browser/esm2022/lib/helpers-messages.mjs +9 -4
  7. package/browser/esm2022/lib/helpers.mjs +164 -373
  8. package/browser/esm2022/lib/utils.mjs +769 -190
  9. package/browser/fesm2022/tnp-core.mjs +1548 -1062
  10. package/browser/fesm2022/tnp-core.mjs.map +1 -1
  11. package/browser/lib/core-imports.d.ts +41 -1
  12. package/browser/lib/core-models.d.ts +68 -38
  13. package/browser/lib/helpers-messages.d.ts +6 -3
  14. package/browser/lib/helpers.d.ts +22 -0
  15. package/browser/lib/utils.d.ts +77 -13
  16. package/cli.backend.d.ts +1 -0
  17. package/cli.backend.js +15 -2
  18. package/cli.backend.js.map +1 -1
  19. package/client/README.md +24 -24
  20. package/client/esm2022/lib/core-imports.mjs +65 -9
  21. package/client/esm2022/lib/core-models.mjs +61 -9
  22. package/client/esm2022/lib/helpers-messages.mjs +9 -4
  23. package/client/esm2022/lib/helpers.mjs +164 -373
  24. package/client/esm2022/lib/utils.mjs +769 -190
  25. package/client/fesm2022/tnp-core.mjs +1548 -1062
  26. package/client/fesm2022/tnp-core.mjs.map +1 -1
  27. package/client/lib/core-imports.d.ts +41 -1
  28. package/client/lib/core-models.d.ts +68 -38
  29. package/client/lib/helpers-messages.d.ts +6 -3
  30. package/client/lib/helpers.d.ts +22 -0
  31. package/client/lib/utils.d.ts +77 -13
  32. package/index.js +15 -2
  33. package/index.js.map +1 -1
  34. package/lib/build-info._auto-generated_.js.map +1 -1
  35. package/lib/command-exists.js +20 -20
  36. package/lib/command-exists.js.map +1 -1
  37. package/lib/core-cli.js +49 -66
  38. package/lib/core-cli.js.map +1 -1
  39. package/lib/core-config.js.map +1 -1
  40. package/lib/core-imports.d.ts +41 -25
  41. package/lib/core-imports.js +202 -80
  42. package/lib/core-imports.js.map +1 -1
  43. package/lib/core-models.d.ts +68 -38
  44. package/lib/core-models.js +62 -8
  45. package/lib/core-models.js.map +1 -1
  46. package/lib/framework-name.js +2 -2
  47. package/lib/framework-name.js.map +1 -1
  48. package/lib/helpers-isomorphic.js +33 -52
  49. package/lib/helpers-isomorphic.js.map +1 -1
  50. package/lib/helpers-messages.d.ts +6 -3
  51. package/lib/helpers-messages.js +79 -102
  52. package/lib/helpers-messages.js.map +1 -1
  53. package/lib/helpers.d.ts +21 -3
  54. package/lib/helpers.js +723 -971
  55. package/lib/helpers.js.map +1 -1
  56. package/lib/index._auto-generated_.js.map +1 -1
  57. package/lib/index.js +23 -10
  58. package/lib/index.js.map +1 -1
  59. package/lib/node-chalk-mock.js +2 -2
  60. package/lib/node-chalk-mock.js.map +1 -1
  61. package/lib/node-path-mock.js +2 -2
  62. package/lib/node-path-mock.js.map +1 -1
  63. package/lib/progress-data.js +21 -23
  64. package/lib/progress-data.js.map +1 -1
  65. package/lib/public-api.js +19 -6
  66. package/lib/public-api.js.map +1 -1
  67. package/lib/required-global-npm-packages.js.map +1 -1
  68. package/lib/required.d.ts +44 -0
  69. package/lib/safe-types/glob.d.ts +102 -0
  70. package/lib/safe-types/minimatch/assert-valid-pattern.d.ts +1 -0
  71. package/lib/safe-types/minimatch/ast.d.ts +17 -0
  72. package/lib/safe-types/minimatch/brace-expressions.d.ts +7 -0
  73. package/lib/safe-types/minimatch/escape.d.ts +11 -0
  74. package/lib/safe-types/minimatch/index.d copy.d.ts +93 -0
  75. package/lib/safe-types/minimatch/index.d.ts +93 -0
  76. package/lib/safe-types/minimatch/unescapd.d.ts +16 -0
  77. package/lib/safe-types/minimatch/unescape.d.ts +16 -0
  78. package/lib/safe-types/minimatch.d.ts +0 -0
  79. package/lib/safe-types/rimraf.d.ts +28 -0
  80. package/lib/utils.d.ts +89 -14
  81. package/lib/utils.js +1261 -1075
  82. package/lib/utils.js.map +1 -1
  83. package/migrations/index.js +15 -2
  84. package/migrations/index.js.map +1 -1
  85. package/migrations/migrations_index._auto-generated_.js.map +1 -1
  86. package/package.json +25 -91
  87. package/src.d.ts +1 -1
  88. package/tmp-environment.json +8 -404
  89. package/websql/README.md +24 -24
  90. package/websql/esm2022/lib/core-imports.mjs +65 -9
  91. package/websql/esm2022/lib/core-models.mjs +61 -9
  92. package/websql/esm2022/lib/helpers-messages.mjs +9 -4
  93. package/websql/esm2022/lib/helpers.mjs +164 -373
  94. package/websql/esm2022/lib/utils.mjs +766 -187
  95. package/websql/fesm2022/tnp-core.mjs +1546 -1060
  96. package/websql/fesm2022/tnp-core.mjs.map +1 -1
  97. package/websql/lib/core-imports.d.ts +41 -1
  98. package/websql/lib/core-models.d.ts +68 -38
  99. package/websql/lib/helpers-messages.d.ts +6 -3
  100. package/websql/lib/helpers.d.ts +22 -0
  101. package/websql/lib/utils.d.ts +77 -13
  102. package/browser/package.json +0 -25
  103. package/taon.jsonc +0 -65
  104. package/websql/package.json +0 -25
@@ -0,0 +1,102 @@
1
+ import events = require('events');
2
+ import fs = require('fs');
3
+ import { MinimatchOptions, Minimatch } from './minimatch/index';
4
+ export declare function GLOB(pattern: string, cb: (err: Error | null, matches: string[]) => void): void;
5
+ export declare function GLOB(pattern: string, options: GLOB.IOptions, cb: (err: Error | null, matches: string[]) => void): void;
6
+ export declare namespace GLOB {
7
+ function __promisify__(pattern: string, options?: IOptions): Promise<string[]>;
8
+ function sync(pattern: string, options?: IOptions): string[];
9
+ function hasMagic(pattern: string, options?: IOptions): boolean;
10
+ let Glob: IGlobStatic;
11
+ let GlobSync: IGlobSyncStatic;
12
+ interface IOptions extends MinimatchOptions {
13
+ cwd?: string;
14
+ root?: string;
15
+ dot?: boolean;
16
+ nomount?: boolean;
17
+ mark?: boolean;
18
+ nosort?: boolean;
19
+ stat?: boolean;
20
+ silent?: boolean;
21
+ strict?: boolean;
22
+ cache?: {
23
+ [path: string]: any;
24
+ };
25
+ statCache?: {
26
+ [path: string]: fs.Stats;
27
+ };
28
+ symlinks?: any;
29
+ sync?: boolean;
30
+ nounique?: boolean;
31
+ nonull?: boolean;
32
+ debug?: boolean;
33
+ nobrace?: boolean;
34
+ noglobstar?: boolean;
35
+ noext?: boolean;
36
+ nocase?: boolean;
37
+ matchBase?: any;
38
+ nodir?: boolean;
39
+ ignore?: any;
40
+ follow?: boolean;
41
+ realpath?: boolean;
42
+ nonegate?: boolean;
43
+ nocomment?: boolean;
44
+ absolute?: boolean;
45
+ /** Deprecated. */
46
+ globDebug?: boolean;
47
+ }
48
+ interface IGlobStatic extends events.EventEmitter {
49
+ new (pattern: string, cb?: (err: Error | null, matches: string[]) => void): IGlob;
50
+ new (pattern: string, options: IOptions, cb?: (err: Error | null, matches: string[]) => void): IGlob;
51
+ prototype: IGlob;
52
+ }
53
+ interface IGlobSyncStatic {
54
+ new (pattern: string, options?: IOptions): IGlobBase;
55
+ prototype: IGlobBase;
56
+ }
57
+ interface IGlobBase {
58
+ minimatch: Minimatch;
59
+ options: IOptions;
60
+ aborted: boolean;
61
+ cache: {
62
+ [path: string]: any;
63
+ };
64
+ statCache: {
65
+ [path: string]: fs.Stats;
66
+ };
67
+ symlinks: {
68
+ [path: string]: boolean;
69
+ };
70
+ realpathCache: {
71
+ [path: string]: string;
72
+ };
73
+ found: string[];
74
+ }
75
+ interface IGlob extends IGlobBase, events.EventEmitter {
76
+ pause(): void;
77
+ resume(): void;
78
+ abort(): void;
79
+ /** Deprecated. */
80
+ EOF: any;
81
+ /** Deprecated. */
82
+ paused: boolean;
83
+ /** Deprecated. */
84
+ maxDepth: number;
85
+ /** Deprecated. */
86
+ maxLength: number;
87
+ /** Deprecated. */
88
+ changedCwd: boolean;
89
+ /** Deprecated. */
90
+ cwd: string;
91
+ /** Deprecated. */
92
+ root: string;
93
+ /** Deprecated. */
94
+ error: any;
95
+ /** Deprecated. */
96
+ matches: string[];
97
+ /** Deprecated. */
98
+ log(...args: any[]): void;
99
+ /** Deprecated. */
100
+ emitMatch(m: any): void;
101
+ }
102
+ }
@@ -0,0 +1 @@
1
+ export declare const assertValidPattern: (pattern: any) => void;
@@ -0,0 +1,17 @@
1
+ import { MinimatchOptions, MMRegExp } from './index.js';
2
+ export type ExtglobType = '!' | '?' | '+' | '*' | '@';
3
+ export declare class AST {
4
+ type: ExtglobType | null;
5
+ constructor(type: ExtglobType | null, parent?: AST, options?: MinimatchOptions);
6
+ get hasMagic(): boolean | undefined;
7
+ toString(): string;
8
+ push(...parts: (string | AST)[]): void;
9
+ toJSON(): any[];
10
+ isStart(): boolean;
11
+ isEnd(): boolean;
12
+ copyIn(part: AST | string): void;
13
+ clone(parent: AST): AST;
14
+ static fromGlob(pattern: string, options?: MinimatchOptions): AST;
15
+ toMMPattern(): MMRegExp | string;
16
+ toRegExpSource(allowDot?: boolean): [re: string, body: string, hasMagic: boolean, uflag: boolean];
17
+ }
@@ -0,0 +1,7 @@
1
+ export type ParseClassResult = [
2
+ src: string,
3
+ uFlag: boolean,
4
+ consumed: number,
5
+ hasMagic: boolean
6
+ ];
7
+ export declare const parseClass: (glob: string, position: number) => ParseClassResult;
@@ -0,0 +1,11 @@
1
+ import { MinimatchOptions } from './index.js';
2
+ /**
3
+ * Escape all magic characters in a glob pattern.
4
+ *
5
+ * If the {@link windowsPathsNoEscape | GlobOptions.windowsPathsNoEscape}
6
+ * option is used, then characters are escaped by wrapping in `[]`, because
7
+ * a magic character wrapped in a character class can only be satisfied by
8
+ * that exact character. In this mode, `\` is _not_ escaped, because it is
9
+ * not interpreted as a magic character, but instead as a path separator.
10
+ */
11
+ export declare const escape: (s: string, { windowsPathsNoEscape, }?: Pick<MinimatchOptions, 'windowsPathsNoEscape'>) => string;
@@ -0,0 +1,93 @@
1
+ import { AST } from './ast.js';
2
+ type Platform = 'aix' | 'android' | 'darwin' | 'freebsd' | 'haiku' | 'linux' | 'openbsd' | 'sunos' | 'win32' | 'cygwin' | 'netbsd';
3
+ export interface MinimatchOptions {
4
+ nobrace?: boolean;
5
+ nocomment?: boolean;
6
+ nonegate?: boolean;
7
+ debug?: boolean;
8
+ noglobstar?: boolean;
9
+ noext?: boolean;
10
+ nonull?: boolean;
11
+ windowsPathsNoEscape?: boolean;
12
+ allowWindowsEscape?: boolean;
13
+ partial?: boolean;
14
+ dot?: boolean;
15
+ nocase?: boolean;
16
+ nocaseMagicOnly?: boolean;
17
+ magicalBraces?: boolean;
18
+ matchBase?: boolean;
19
+ flipNegate?: boolean;
20
+ preserveMultipleSlashes?: boolean;
21
+ optimizationLevel?: number;
22
+ platform?: Platform;
23
+ windowsNoMagicRoot?: boolean;
24
+ }
25
+ export declare const minimatch: {
26
+ (p: string, pattern: string, options?: MinimatchOptions): boolean;
27
+ sep: Sep;
28
+ GLOBSTAR: typeof GLOBSTAR;
29
+ filter: (pattern: string, options?: MinimatchOptions) => (p: string) => boolean;
30
+ defaults: (def: MinimatchOptions) => typeof minimatch;
31
+ braceExpand: (pattern: string, options?: MinimatchOptions) => string[];
32
+ makeRe: (pattern: string, options?: MinimatchOptions) => false | MMRegExp;
33
+ match: (list: string[], pattern: string, options?: MinimatchOptions) => string[];
34
+ AST: typeof AST;
35
+ Minimatch: typeof Minimatch;
36
+ escape: (s: string, { windowsPathsNoEscape, }?: Pick<MinimatchOptions, "windowsPathsNoEscape">) => string;
37
+ unescape: (s: string, { windowsPathsNoEscape, }?: Pick<MinimatchOptions, "windowsPathsNoEscape">) => string;
38
+ };
39
+ type Sep = '\\' | '/';
40
+ export declare const sep: Sep;
41
+ export declare const GLOBSTAR: unique symbol;
42
+ export declare const filter: (pattern: string, options?: MinimatchOptions) => (p: string) => boolean;
43
+ export declare const defaults: (def: MinimatchOptions) => typeof minimatch;
44
+ export declare const braceExpand: (pattern: string, options?: MinimatchOptions) => string[];
45
+ export declare const makeRe: (pattern: string, options?: MinimatchOptions) => false | MMRegExp;
46
+ export declare const match: (list: string[], pattern: string, options?: MinimatchOptions) => string[];
47
+ export type MMRegExp = RegExp & {
48
+ _src?: string;
49
+ _glob?: string;
50
+ };
51
+ export type ParseReturnFiltered = string | MMRegExp | typeof GLOBSTAR;
52
+ export type ParseReturn = ParseReturnFiltered | false;
53
+ export declare class Minimatch {
54
+ options: MinimatchOptions;
55
+ set: ParseReturnFiltered[][];
56
+ pattern: string;
57
+ windowsPathsNoEscape: boolean;
58
+ nonegate: boolean;
59
+ negate: boolean;
60
+ comment: boolean;
61
+ empty: boolean;
62
+ preserveMultipleSlashes: boolean;
63
+ partial: boolean;
64
+ globSet: string[];
65
+ globParts: string[][];
66
+ nocase: boolean;
67
+ isWindows: boolean;
68
+ platform: Platform;
69
+ windowsNoMagicRoot: boolean;
70
+ regexp: false | null | MMRegExp;
71
+ constructor(pattern: string, options?: MinimatchOptions);
72
+ hasMagic(): boolean;
73
+ debug(..._: any[]): void;
74
+ make(): void;
75
+ preprocess(globParts: string[][]): string[][];
76
+ adjascentGlobstarOptimize(globParts: string[][]): string[][];
77
+ levelOneOptimize(globParts: string[][]): string[][];
78
+ levelTwoFileOptimize(parts: string | string[]): string[];
79
+ firstPhasePreProcess(globParts: string[][]): string[][];
80
+ secondPhasePreProcess(globParts: string[][]): string[][];
81
+ partsMatch(a: string[], b: string[], emptyGSMatch?: boolean): false | string[];
82
+ parseNegate(): void;
83
+ matchOne(file: string[], pattern: ParseReturn[], partial?: boolean): boolean;
84
+ braceExpand(): string[];
85
+ parse(pattern: string): ParseReturn;
86
+ makeRe(): false | MMRegExp;
87
+ slashSplit(p: string): string[];
88
+ match(f: string, partial?: boolean): boolean;
89
+ static defaults(def: MinimatchOptions): typeof Minimatch;
90
+ }
91
+ export { AST } from './ast.js';
92
+ export { escape } from './escape.js';
93
+ export { unescape } from './unescape.js';
@@ -0,0 +1,93 @@
1
+ import { AST } from './ast.js';
2
+ type Platform = 'aix' | 'android' | 'darwin' | 'freebsd' | 'haiku' | 'linux' | 'openbsd' | 'sunos' | 'win32' | 'cygwin' | 'netbsd';
3
+ export interface MinimatchOptions {
4
+ nobrace?: boolean;
5
+ nocomment?: boolean;
6
+ nonegate?: boolean;
7
+ debug?: boolean;
8
+ noglobstar?: boolean;
9
+ noext?: boolean;
10
+ nonull?: boolean;
11
+ windowsPathsNoEscape?: boolean;
12
+ allowWindowsEscape?: boolean;
13
+ partial?: boolean;
14
+ dot?: boolean;
15
+ nocase?: boolean;
16
+ nocaseMagicOnly?: boolean;
17
+ magicalBraces?: boolean;
18
+ matchBase?: boolean;
19
+ flipNegate?: boolean;
20
+ preserveMultipleSlashes?: boolean;
21
+ optimizationLevel?: number;
22
+ platform?: Platform;
23
+ windowsNoMagicRoot?: boolean;
24
+ }
25
+ export declare const minimatch: {
26
+ (p: string, pattern: string, options?: MinimatchOptions): boolean;
27
+ sep: Sep;
28
+ GLOBSTAR: typeof GLOBSTAR;
29
+ filter: (pattern: string, options?: MinimatchOptions) => (p: string) => boolean;
30
+ defaults: (def: MinimatchOptions) => typeof minimatch;
31
+ braceExpand: (pattern: string, options?: MinimatchOptions) => string[];
32
+ makeRe: (pattern: string, options?: MinimatchOptions) => false | MMRegExp;
33
+ match: (list: string[], pattern: string, options?: MinimatchOptions) => string[];
34
+ AST: typeof AST;
35
+ Minimatch: typeof Minimatch;
36
+ escape: (s: string, { windowsPathsNoEscape, }?: Pick<MinimatchOptions, "windowsPathsNoEscape">) => string;
37
+ unescape: (s: string, { windowsPathsNoEscape, }?: Pick<MinimatchOptions, "windowsPathsNoEscape">) => string;
38
+ };
39
+ type Sep = '\\' | '/';
40
+ export declare const sep: Sep;
41
+ export declare const GLOBSTAR: unique symbol;
42
+ export declare const filter: (pattern: string, options?: MinimatchOptions) => (p: string) => boolean;
43
+ export declare const defaults: (def: MinimatchOptions) => typeof minimatch;
44
+ export declare const braceExpand: (pattern: string, options?: MinimatchOptions) => string[];
45
+ export declare const makeRe: (pattern: string, options?: MinimatchOptions) => false | MMRegExp;
46
+ export declare const match: (list: string[], pattern: string, options?: MinimatchOptions) => string[];
47
+ export type MMRegExp = RegExp & {
48
+ _src?: string;
49
+ _glob?: string;
50
+ };
51
+ export type ParseReturnFiltered = string | MMRegExp | typeof GLOBSTAR;
52
+ export type ParseReturn = ParseReturnFiltered | false;
53
+ export declare class Minimatch {
54
+ options: MinimatchOptions;
55
+ set: ParseReturnFiltered[][];
56
+ pattern: string;
57
+ windowsPathsNoEscape: boolean;
58
+ nonegate: boolean;
59
+ negate: boolean;
60
+ comment: boolean;
61
+ empty: boolean;
62
+ preserveMultipleSlashes: boolean;
63
+ partial: boolean;
64
+ globSet: string[];
65
+ globParts: string[][];
66
+ nocase: boolean;
67
+ isWindows: boolean;
68
+ platform: Platform;
69
+ windowsNoMagicRoot: boolean;
70
+ regexp: false | null | MMRegExp;
71
+ constructor(pattern: string, options?: MinimatchOptions);
72
+ hasMagic(): boolean;
73
+ debug(..._: any[]): void;
74
+ make(): void;
75
+ preprocess(globParts: string[][]): string[][];
76
+ adjascentGlobstarOptimize(globParts: string[][]): string[][];
77
+ levelOneOptimize(globParts: string[][]): string[][];
78
+ levelTwoFileOptimize(parts: string | string[]): string[];
79
+ firstPhasePreProcess(globParts: string[][]): string[][];
80
+ secondPhasePreProcess(globParts: string[][]): string[][];
81
+ partsMatch(a: string[], b: string[], emptyGSMatch?: boolean): false | string[];
82
+ parseNegate(): void;
83
+ matchOne(file: string[], pattern: ParseReturn[], partial?: boolean): boolean;
84
+ braceExpand(): string[];
85
+ parse(pattern: string): ParseReturn;
86
+ makeRe(): false | MMRegExp;
87
+ slashSplit(p: string): string[];
88
+ match(f: string, partial?: boolean): boolean;
89
+ static defaults(def: MinimatchOptions): typeof Minimatch;
90
+ }
91
+ export { AST } from './ast.js';
92
+ export { escape } from './escape.js';
93
+ export { unescape } from './unescape.js';
@@ -0,0 +1,16 @@
1
+ import { MinimatchOptions } from './index.js';
2
+ /**
3
+ * Un-escape a string that has been escaped with {@link escape}.
4
+ *
5
+ * If the {@link windowsPathsNoEscape} option is used, then square-brace
6
+ * escapes are removed, but not backslash escapes. For example, it will turn
7
+ * the string `'[*]'` into `*`, but it will not turn `'\\*'` into `'*'`,
8
+ * becuase `\` is a path separator in `windowsPathsNoEscape` mode.
9
+ *
10
+ * When `windowsPathsNoEscape` is not set, then both brace escapes and
11
+ * backslash escapes are removed.
12
+ *
13
+ * Slashes (and backslashes in `windowsPathsNoEscape` mode) cannot be escaped
14
+ * or unescaped.
15
+ */
16
+ export declare const unescape: (s: string, { windowsPathsNoEscape, }?: Pick<MinimatchOptions, 'windowsPathsNoEscape'>) => string;
@@ -0,0 +1,16 @@
1
+ import { MinimatchOptions } from './index.js';
2
+ /**
3
+ * Un-escape a string that has been escaped with {@link escape}.
4
+ *
5
+ * If the {@link windowsPathsNoEscape} option is used, then square-brace
6
+ * escapes are removed, but not backslash escapes. For example, it will turn
7
+ * the string `'[*]'` into `*`, but it will not turn `'\\*'` into `'*'`,
8
+ * becuase `\` is a path separator in `windowsPathsNoEscape` mode.
9
+ *
10
+ * When `windowsPathsNoEscape` is not set, then both brace escapes and
11
+ * backslash escapes are removed.
12
+ *
13
+ * Slashes (and backslashes in `windowsPathsNoEscape` mode) cannot be escaped
14
+ * or unescaped.
15
+ */
16
+ export declare const unescape: (s: string, { windowsPathsNoEscape, }?: Pick<MinimatchOptions, 'windowsPathsNoEscape'>) => string;
File without changes
@@ -0,0 +1,28 @@
1
+ import fs = require('fs');
2
+ import { GLOB } from './glob';
3
+ export declare function RIMRAF(path: string, options: RIMRAF.Options, callback: (error: Error) => void): void;
4
+ export declare function RIMRAF(path: string, callback: (error: Error) => void): void;
5
+ export declare namespace RIMRAF {
6
+ function __promisify__(path: string, options?: Options): Promise<void>;
7
+ function sync(path: string, options?: Options): void;
8
+ let EMFILE_MAX: number;
9
+ let BUSYTRIES_MAX: number;
10
+ interface Options {
11
+ maxBusyTries?: number;
12
+ emfileWait?: boolean;
13
+ disableGlob?: boolean;
14
+ glob?: GLOB.IOptions | false;
15
+ unlink?: typeof fs.unlink;
16
+ chmod?: typeof fs.chmod;
17
+ stat?: typeof fs.stat;
18
+ lstat?: typeof fs.lstat;
19
+ rmdir?: typeof fs.rmdir;
20
+ readdir?: typeof fs.readdir;
21
+ unlinkSync?: typeof fs.unlinkSync;
22
+ chmodSync?: typeof fs.chmodSync;
23
+ statSync?: typeof fs.statSync;
24
+ lstatSync?: typeof fs.lstatSync;
25
+ rmdirSync?: typeof fs.rmdirSync;
26
+ readdirSync?: typeof fs.readdirSync;
27
+ }
28
+ }
package/lib/utils.d.ts CHANGED
@@ -1,7 +1,12 @@
1
- import { CoreModels } from './core-models';
2
1
  import { Blob } from 'buffer';
2
+ import { CoreModels } from './core-models';
3
3
  export declare namespace Utils {
4
4
  export const uniqArray: <T = any>(array: any[], uniqueProperty?: keyof T) => T[];
5
+ /**
6
+ * @param anyObject
7
+ * @returns object with sorted keys
8
+ */
9
+ export const sortKeys: (anyObject: any) => any;
5
10
  /**
6
11
  * Example:
7
12
  * new RegExp(escapeStringForRegEx('a.b.c'),'g') => /a\.b\.c/g
@@ -12,8 +17,13 @@ export declare namespace Utils {
12
17
  export const fullDate: () => string;
13
18
  export const getFreePort: (options?: {
14
19
  startFrom?: number;
15
- howManyFreePortsAfterThatPort?: number;
16
20
  }) => Promise<number>;
21
+ export const requireUncached: (module: string) => any;
22
+ /**
23
+ * similar to camelCase but remove
24
+ * all non word / repeated characters
25
+ */
26
+ export const camelize: (str?: string) => string;
17
27
  interface AttrJsoncProp {
18
28
  name: string;
19
29
  value?: any;
@@ -150,6 +160,7 @@ export declare namespace UtilsProcess {
150
160
  * TODO IMPLEMENT
151
161
  * start async node process
152
162
  */
163
+ export const startAsync: (command: string, cwd: string, options?: Omit<CoreModels.ExecuteOptions, "tryAgainWhenFailAfter">) => Promise<void>;
153
164
  /**
154
165
  * This let you start child process and resolve promise when some
155
166
  * condition is met. It is useful for example when you want to start
@@ -171,6 +182,34 @@ export declare namespace UtilsProcess {
171
182
  */
172
183
  export const startInNewTerminalWindow: (command: string, options?: Pick<ProcessStartOptions, "cwd" | "hideOutput">) => any;
173
184
  export const getBashOrShellName: () => "browser" | "cmd" | "powershell" | "gitbash" | "cygwin" | "unknown" | "bash" | "zsh" | "fish" | "sh";
185
+ /**
186
+ * Get CPU and memory usage for a single PID.
187
+ */
188
+ export const getUsageForPid: (pid: number) => Promise<{
189
+ cpu: number;
190
+ memoryInGB: number;
191
+ memoryInMB: number;
192
+ }>;
193
+ /**
194
+ * Cross-platform function to list *direct* child PIDs of a given PID.
195
+ * Uses the appropriate command depending on `process.platform`.
196
+ */
197
+ export function getChildPidsOnce(pid: number): Promise<number[]>;
198
+ /**
199
+ * Get CPU and memory usage for the current process (the Node.js process itself),
200
+ * plus any child processes spawned by it.
201
+ */
202
+ export const getCurrentProcessAndChildUsage: () => Promise<{
203
+ current: {
204
+ cpu: number;
205
+ memoryInMB: number;
206
+ };
207
+ children: Array<{
208
+ pid: number;
209
+ cpu: number;
210
+ memoryInMB: number;
211
+ }>;
212
+ }>;
174
213
  export {};
175
214
  }
176
215
  export declare namespace UtilsOs {
@@ -196,11 +235,17 @@ export declare namespace UtilsOs {
196
235
  * Electron backend or browser.
197
236
  */
198
237
  const isRunningInElectron: () => boolean;
238
+ /**
239
+ * Check whether the current process is running inside
240
+ * a Visual Studio Code extension.
241
+ */
242
+ const isRunningInVscodeExtension: () => boolean;
199
243
  /**
200
244
  * Check wether the current process is running inside
201
245
  * windows subsystem for linux (WSL).
202
246
  */
203
247
  const isRunningInWsl: () => boolean;
248
+ const isRunningInWindowsCmd: () => boolean;
204
249
  const isRunningInDocker: () => boolean;
205
250
  const isRunningInLinuxGraphicsCapableEnvironment: () => boolean;
206
251
  /**
@@ -238,11 +283,30 @@ export declare namespace UtilsMigrations {
238
283
  const isValidTimestamp: (value: any) => boolean;
239
284
  }
240
285
  export declare namespace UtilsTerminal {
286
+ type SelectActionChoice = {
287
+ [choice: string]: {
288
+ /**
289
+ * Title of the choice
290
+ */
291
+ name: string;
292
+ /**
293
+ * Action to execute
294
+ */
295
+ action?: () => any;
296
+ /**
297
+ * If choice is visible
298
+ * default: true
299
+ */
300
+ visible?: boolean;
301
+ };
302
+ };
303
+ export const wait: (second: number) => Promise<void>;
241
304
  export const clearConsole: () => void;
242
305
  export const multiselect: <T = string>(options: {
243
306
  question: string;
244
307
  /**
245
308
  * If true, then only one choice can be selected
309
+ * @deprecated use select instead
246
310
  */
247
311
  onlyOneChoice?: boolean;
248
312
  choices: {
@@ -256,18 +320,24 @@ export declare namespace UtilsTerminal {
256
320
  autocomplete?: boolean;
257
321
  defaultSelected?: string[];
258
322
  }) => Promise<T[]>;
259
- type SelectActionChoice = {
260
- [choice: string]: {
261
- /**
262
- * Title of the choice
263
- */
264
- name: string;
265
- /**
266
- * Action to execute
267
- */
268
- action?: () => any;
269
- };
270
- };
323
+ /**
324
+ * Similar to select but executes action if provided
325
+ * @returns selected and executed value
326
+ */
327
+ export const multiselectActionAndExecute: <CHOICE extends SelectActionChoice = SelectActionChoice>(choices: CHOICE, options?: {
328
+ question?: string;
329
+ autocomplete?: boolean;
330
+ defaultSelected?: string;
331
+ hint?: string;
332
+ executeActionsOnDefault?: boolean;
333
+ }) => Promise<{
334
+ selected: (keyof CHOICE)[];
335
+ actionResults: unknown[];
336
+ /**
337
+ * object containing all selected actions
338
+ */
339
+ actions: (() => any)[];
340
+ }>;
271
341
  /**
272
342
  * Similar to select but executes action if provided
273
343
  * @returns selected and executed value
@@ -279,7 +349,12 @@ export declare namespace UtilsTerminal {
279
349
  hint?: string;
280
350
  executeActionOnDefault?: boolean;
281
351
  }) => Promise<{
352
+ selected: any;
353
+ action: () => Promise<any>;
354
+ actionResult?: undefined;
355
+ } | {
282
356
  selected: keyof CHOICE;
357
+ actionResult: unknown;
283
358
  action: () => Promise<any>;
284
359
  }>;
285
360
  export const select: <T = string>(options: {