js-dev-tool 1.0.0 → 1.0.3
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/basic-types.d.ts +36 -107
- package/common/index.d.ts +1 -1
- package/common/index.js +1 -41
- package/extras/tiny-progress.d.ts +1 -1
- package/extras/tiny-progress.js +1 -11
- package/index.d.ts +1 -6
- package/index.js +1 -1
- package/lib/unzip.min.js +1 -3
- package/lib/zip.min.js +1 -2
- package/lib/zlibjs.d.ts +1 -1
- package/package.json +2 -2
- package/progress/index.d.ts +1 -3
- package/progress/index.js +2 -38
- package/progress/progress-extras.d.ts +9 -0
- package/progress/progress-extras.js +1 -12
- package/progress/rnd-spinner.js +2 -6
- package/progress/spinners.d.ts +1 -3
- package/progress/test.js +1 -18
- package/regex.d.ts +3 -66
- package/scripts/publish-version.json +1 -1
- package/scripts/unzip.js +1 -2
- package/scripts/zip.js +6 -58
- package/tool-lib/cjbm.js +1 -117
- package/tool-lib/cmt-trick.js +1 -44
- package/tool-lib/ps.js +65 -72
- package/tool-lib/rws.js +13 -19
- package/tool-lib/tools.d.ts +3 -94
- package/tool-lib/zip-task.js +1 -2
- package/tools.d.ts +6 -6
- package/tools.js +8 -120
- package/tsconfig.json +7 -2
- package/utils.d.ts +23 -55
- package/utils.js +12 -245
package/basic-types.d.ts
CHANGED
|
@@ -8,8 +8,6 @@
|
|
|
8
8
|
/**
|
|
9
9
|
* @file basic-types/index.d.ts
|
|
10
10
|
*/
|
|
11
|
-
|
|
12
|
-
// --------------------- define primative types.
|
|
13
11
|
/**
|
|
14
12
|
* #### To Be Defined
|
|
15
13
|
*
|
|
@@ -24,10 +22,7 @@ type TBD<T> = T | undefined;
|
|
|
24
22
|
* + 2 character shorten
|
|
25
23
|
*/
|
|
26
24
|
type TBC<T> = T | null;
|
|
27
|
-
|
|
28
|
-
// needed?
|
|
29
25
|
type DecideType<T> = T extends infer P? P : T;
|
|
30
|
-
|
|
31
26
|
/**
|
|
32
27
|
* T is falsy then return A, trusy then B
|
|
33
28
|
*
|
|
@@ -36,7 +31,7 @@ type DecideType<T> = T extends infer P? P : T;
|
|
|
36
31
|
* type Conditional<T, A, B> = void extends T ? A : T extends (void | false | undefined) ? A : B;
|
|
37
32
|
*
|
|
38
33
|
* function x<T extends true | void, R extends ConditionalX<T, string, string[]>>(need?: T): R {
|
|
39
|
-
*
|
|
34
|
+
* return (need? "": [""]) as R;
|
|
40
35
|
* }
|
|
41
36
|
* // string | string[]
|
|
42
37
|
* const xret = x();
|
|
@@ -44,7 +39,7 @@ type DecideType<T> = T extends infer P? P : T;
|
|
|
44
39
|
* const xret2 = x(true);
|
|
45
40
|
*
|
|
46
41
|
* function ok<T extends true | void, R extends Conditional<T, string, string[]>>(need?: T): R {
|
|
47
|
-
*
|
|
42
|
+
* return (need? "": [""]) as R;
|
|
48
43
|
* }
|
|
49
44
|
* // string
|
|
50
45
|
* const okret = ok();
|
|
@@ -55,30 +50,14 @@ type DecideType<T> = T extends infer P? P : T;
|
|
|
55
50
|
* @date 20/03/31
|
|
56
51
|
*/
|
|
57
52
|
type Conditional<T, A, B> = void extends T ? A : T extends (void | false | undefined) ? A : B;
|
|
58
|
-
// or
|
|
59
|
-
// /**
|
|
60
|
-
// * @deprecated often not working properly (maybe)
|
|
61
|
-
// */
|
|
62
|
-
// type Conditional<T, A, B> = undefined extends T ? B : false extends T ? B : A;
|
|
63
|
-
|
|
64
53
|
type BasicIterator<T> = Iterator<T, T, T>;
|
|
65
|
-
|
|
66
54
|
/**
|
|
67
55
|
* Remove readonly
|
|
68
56
|
*/
|
|
69
57
|
type Writable<T> = {
|
|
70
|
-
|
|
58
|
+
-readonly [P in keyof T]: T[P];
|
|
71
59
|
};
|
|
72
|
-
|
|
73
|
-
// 2020/3/12 20:36:52
|
|
74
60
|
type JsonValueTypes = string | number | boolean | object | Array<number | string | boolean | object>;
|
|
75
|
-
|
|
76
|
-
// /**
|
|
77
|
-
// * get property type.
|
|
78
|
-
// */
|
|
79
|
-
// type TypeOf<T, K extends keyof T> = T[K];
|
|
80
|
-
// // -> same as like SkillPlanDataType["plans"]
|
|
81
|
-
|
|
82
61
|
/**
|
|
83
62
|
* pickup public fields and methods from `typescript` class.
|
|
84
63
|
*
|
|
@@ -94,14 +73,9 @@ type JsonValueTypes = string | number | boolean | object | Array<number | string
|
|
|
94
73
|
* @see ReadOnly
|
|
95
74
|
*/
|
|
96
75
|
type InterfaceType<T> = {
|
|
97
|
-
|
|
76
|
+
[P in keyof T]: T[P];
|
|
98
77
|
};
|
|
99
|
-
// or
|
|
100
|
-
// type InterfaceType<T> = Pick<T, keyof T>;
|
|
101
|
-
|
|
102
78
|
type TStdFunction<R = any> = (...args: any[]) => R;
|
|
103
|
-
|
|
104
|
-
|
|
105
79
|
/**
|
|
106
80
|
* mark a specific property as `required`
|
|
107
81
|
*/
|
|
@@ -118,60 +92,40 @@ type RequiredPick<T, K extends keyof T> = Required<Pick<T, K>>;
|
|
|
118
92
|
* pick any `property` as partial
|
|
119
93
|
*/
|
|
120
94
|
type PartialPick<T, K extends keyof T> = Partial<Pick<T, K>>;
|
|
121
|
-
|
|
122
|
-
// // The opposite of Pick. Return type without specified property
|
|
123
95
|
/**
|
|
124
96
|
* NOTE: can use ts builtin `Omit` instead
|
|
125
97
|
*/
|
|
126
98
|
type Flip<T, K extends keyof T> = {
|
|
127
|
-
|
|
99
|
+
[P in Exclude<keyof T, K>]: T[P];
|
|
128
100
|
};
|
|
129
|
-
|
|
130
101
|
/**
|
|
131
102
|
*
|
|
132
103
|
* @date 2019/8/19
|
|
133
104
|
* @see Parameters
|
|
134
105
|
*/
|
|
135
106
|
type RequiredParameters<TFunction extends (...args: any) => any> = Required<
|
|
136
|
-
|
|
107
|
+
Parameters<TFunction>
|
|
137
108
|
>;
|
|
138
|
-
// /**
|
|
139
|
-
// * Extracts the type of the 'this' parameter of a function type, or 'unknown' if the function type has no 'this' parameter.
|
|
140
|
-
// */
|
|
141
|
-
// type ThisParameterType<T> = T extends (this: unknown, ...args: any[]) => any ? unknown : T extends (this: infer U, ...args: any[]) => any ? U : unknown;
|
|
142
|
-
// /**
|
|
143
|
-
// * Removes the 'this' parameter from a function type.
|
|
144
|
-
// */
|
|
145
|
-
// type OmitThisParameter<T> = unknown extends ThisParameterType<T> ? T : T extends (...args: infer A) => infer R ? (...args: A) => R : T;
|
|
146
|
-
|
|
147
109
|
type PickProperties<P, T> = { [K in keyof T]-?: T[K] extends P ? K : never }[keyof T];
|
|
148
110
|
type PickNumberProperties<T> = PickProperties<number, T>;
|
|
149
111
|
type PickStringProperties<T> = PickProperties<string, T>;
|
|
150
|
-
|
|
151
112
|
type NonFunctionPropertyNames<T> = { [K in keyof T]-?: T[K] extends Function ? never : K }[keyof T];
|
|
152
113
|
type NonFunctionProperties<T> = Pick<T, NonFunctionPropertyNames<T>>;
|
|
153
|
-
|
|
154
114
|
/**
|
|
155
115
|
* extract () => number | string functoin names from T
|
|
156
116
|
*/
|
|
157
117
|
type NorSFunctions<T> = { [K in keyof T]: T[K] extends (() => number | string) ? K : never }[keyof T];
|
|
158
|
-
// type FunctionPropertyNames<T> = { [K in keyof T]: T[K] extends Function ? K : never }[keyof T];
|
|
159
|
-
// type FunctionProperties<T> = Pick<T, FunctionPropertyNames<T>>;
|
|
160
|
-
// type OKKK<T> = Exclude<FunctionProperties<T>, never>;
|
|
161
118
|
type Unpacked<T> =
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
119
|
+
T extends Array<infer U> ? U :
|
|
120
|
+
T extends (...args: any[]) => infer U ? U :
|
|
121
|
+
T extends Promise<infer U> ? U :
|
|
122
|
+
T;
|
|
167
123
|
/**
|
|
168
124
|
* cannot apply to parameter required function. (?)
|
|
169
125
|
*/
|
|
170
126
|
type SimpleUnpack<T> = T extends (...args: any[]) => infer U ? U :
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
T;
|
|
174
|
-
|
|
127
|
+
T extends Promise<infer U> ? U :
|
|
128
|
+
T;
|
|
175
129
|
/**
|
|
176
130
|
* usage:
|
|
177
131
|
* ```
|
|
@@ -183,78 +137,55 @@ type SimpleUnpack<T> = T extends (...args: any[]) => infer U ? U :
|
|
|
183
137
|
* ```
|
|
184
138
|
*/
|
|
185
139
|
type UnpackReturnType<T extends (...args: any[]) => any> = Unpacked<ReturnType<T>>;
|
|
186
|
-
// type XUnpackReturnType<T> = T extends (...args: any[]) => any? Unpacked<ReturnType<T>>: T;
|
|
187
|
-
|
|
188
|
-
// // ERROR: TS2345
|
|
189
|
-
// type AvoidTS2345<T, K extends keyof T> = T[K];
|
|
190
|
-
// // OK, but... . . . .
|
|
191
|
-
// type AvoidTS2345<T, K extends keyof T> = K extends infer X? T[K]: any;
|
|
192
|
-
|
|
193
|
-
// 1/30/2019, 4:14:25 PM
|
|
194
140
|
/**
|
|
195
141
|
* http query parameter types. (maybe not enough.
|
|
196
142
|
*/
|
|
197
143
|
type QueryValueTypes = string | number | boolean | Date;
|
|
198
|
-
|
|
199
144
|
/**
|
|
200
145
|
* means can convert to Date object.
|
|
201
146
|
*/
|
|
202
147
|
type DateString = string;
|
|
203
|
-
|
|
204
148
|
/**
|
|
205
149
|
* document.querySelector etc
|
|
206
150
|
*/
|
|
207
151
|
type TQuerySelector = string;
|
|
208
|
-
|
|
209
|
-
// --------------------- define unique types.
|
|
210
152
|
type NumberMap<T> = {
|
|
211
|
-
|
|
153
|
+
[index: number]: T;
|
|
212
154
|
};
|
|
213
|
-
|
|
214
155
|
type UndefableStringMap<T> = TBD<Record<string, T>>;
|
|
215
|
-
|
|
216
156
|
/**
|
|
217
157
|
* for lazy assign class.
|
|
218
158
|
*/
|
|
219
159
|
type TypedCtor<T> = {
|
|
220
|
-
|
|
221
|
-
|
|
160
|
+
new (...args: any[]): T;
|
|
161
|
+
prototype: T;
|
|
222
162
|
};
|
|
223
|
-
// DEVNOTE: 2022/02/15 its a same declare, so marged
|
|
224
163
|
interface ITypedCtor<T> extends TypedCtor<T> {}
|
|
225
|
-
|
|
226
164
|
/**
|
|
227
165
|
* Array.sort etc...
|
|
228
166
|
*/
|
|
229
167
|
declare type TComparator<T> = (a: T, b: T) => number;
|
|
230
|
-
|
|
231
168
|
declare const enum ETypeOf {
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
169
|
+
VBigInt = "bigint",
|
|
170
|
+
VBool = "boolean",
|
|
171
|
+
VFn = "function",
|
|
172
|
+
VNum = "number",
|
|
173
|
+
VO = "object",
|
|
174
|
+
VS = "string",
|
|
175
|
+
VSym = "symbol",
|
|
176
|
+
VUndef = "undefined"
|
|
240
177
|
}
|
|
241
178
|
declare namespace ETypeOf {
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
179
|
+
export type Values = "bigint" | "boolean" | "function" | "number" | "object" | "string" | "symbol" | "undefined";
|
|
180
|
+
export type Bi = bigint;
|
|
181
|
+
export type B = boolean;
|
|
182
|
+
export type F = Function;
|
|
183
|
+
export type N = number;
|
|
184
|
+
export type O = object;
|
|
185
|
+
export type S = string;
|
|
186
|
+
export type Sym = symbol;
|
|
187
|
+
export type U = undefined;
|
|
251
188
|
}
|
|
252
|
-
// /**
|
|
253
|
-
// * @param {ETypeOf.S} v
|
|
254
|
-
// */
|
|
255
|
-
// function isOK(v: ETypeOf.S): v is ETypeOf.S
|
|
256
|
-
// let x: bigint;
|
|
257
|
-
|
|
258
189
|
/**
|
|
259
190
|
* Generates all combinations of the string S. The order of characters does not matter.
|
|
260
191
|
* @template S - The target string type
|
|
@@ -263,17 +194,15 @@ declare namespace ETypeOf {
|
|
|
263
194
|
type Combination<
|
|
264
195
|
S extends string, Pre extends string = "",
|
|
265
196
|
> = S extends `${infer First}${infer Post}` ?
|
|
266
|
-
|
|
267
|
-
|
|
197
|
+
`${First}${Combination<`${Pre}${Post}`>}` | Combination<Post, `${Pre}${First}`> : "";
|
|
268
198
|
/**
|
|
269
199
|
* Generates all fixed combinations of the string S. The order of characters is preserved.
|
|
270
200
|
* @template S - The target string type
|
|
271
201
|
* @template Pre - The prefix string (used internally)
|
|
272
202
|
*/
|
|
273
|
-
// DEVNOTE: 2025/01/27 - これは文字の順序が限定される
|
|
274
203
|
type FixedCombination<
|
|
275
204
|
S extends string,
|
|
276
205
|
Pre extends string = ""
|
|
277
|
-
> = S extends `${infer First}${infer Post}`
|
|
278
|
-
|
|
279
|
-
|
|
206
|
+
> = S extends `${infer First}${infer Post}`
|
|
207
|
+
? `${Pre}${First}${FixedCombination<Post, "">}` | FixedCombination<Post, `${Pre}${First}`>
|
|
208
|
+
: "";
|
package/common/index.d.ts
CHANGED
|
@@ -40,4 +40,4 @@ export function renderLine(msg?: string): void;
|
|
|
40
40
|
* @param {boolean} enabled
|
|
41
41
|
* @param {NodeJS.WriteStream} [output]
|
|
42
42
|
*/
|
|
43
|
-
export function cursor(enabled: boolean, output?: NodeJS.WriteStream): void;
|
|
43
|
+
export function cursor(enabled: boolean, output?: NodeJS.WriteStream): void;
|
package/common/index.js
CHANGED
|
@@ -9,21 +9,15 @@
|
|
|
9
9
|
* @file js-dev-scripts/common/index.js
|
|
10
10
|
*/
|
|
11
11
|
// @ts-check
|
|
12
|
-
|
|
13
|
-
// NOTE: fs-extra are bit slower.
|
|
14
12
|
const fs = require("fs");
|
|
15
|
-
// const util = require('util');
|
|
16
13
|
const path = require("path");
|
|
17
|
-
// for clearLine...
|
|
18
14
|
const rl = require("readline");
|
|
19
|
-
|
|
20
15
|
/**
|
|
21
16
|
* @param {string} dest
|
|
22
17
|
*/
|
|
23
18
|
function checkParentDirectory(dest) {
|
|
24
19
|
const parent = path.dirname(dest);
|
|
25
20
|
if (!fs.existsSync(parent)) {
|
|
26
|
-
// DEVNOTE: fix Error: ENOENT: no such file or directory, mkdir ./path/to/dir
|
|
27
21
|
fs.mkdirSync(parent, { recursive: true });
|
|
28
22
|
}
|
|
29
23
|
}
|
|
@@ -34,52 +28,19 @@ function createLogStreamAndResolvePath(logPath) {
|
|
|
34
28
|
checkParentDirectory(logPath);
|
|
35
29
|
return fs.createWriteStream(logPath);
|
|
36
30
|
}
|
|
37
|
-
|
|
38
31
|
/**
|
|
39
32
|
* use process.stderr stream
|
|
40
33
|
*
|
|
41
34
|
* @param {string} [msg] if empty string or undefined then only clear line and move cursor to head.
|
|
42
35
|
*/
|
|
43
|
-
// CHANGES: 2020/2/18 18:28:17 - fix ちらつき
|
|
44
|
-
// dir <number>
|
|
45
|
-
// -1: to the left from cursor
|
|
46
|
-
// 1: to the right from cursor
|
|
47
|
-
// 0: the entire line
|
|
48
|
-
//
|
|
49
|
-
// function renderLine(msg) {
|
|
50
|
-
// const output = process.stderr;
|
|
51
|
-
// // move cursor to line head
|
|
52
|
-
// // @ts-ignore
|
|
53
|
-
// rl.cursorTo(output, 0);
|
|
54
|
-
// // write the message.
|
|
55
|
-
// msg && output.write(msg);
|
|
56
|
-
// // clear line to the right from cursor
|
|
57
|
-
// // @ts-ignore
|
|
58
|
-
// rl.clearLine(output, 0);
|
|
59
|
-
// }
|
|
60
|
-
|
|
61
|
-
// FIX: 2025/5/13 output.clearLine is not a function
|
|
62
36
|
function renderLine(msg /*, del = "\x1B[?25l"*/) {
|
|
63
37
|
const output = process.stderr || process.stdout;
|
|
64
|
-
// output.write(del); // clear cursol
|
|
65
|
-
// clear line to the right from cursor
|
|
66
38
|
// @ts-ignore
|
|
67
39
|
rl.clearLine(output, 0);
|
|
68
|
-
// output.clearLine(0);
|
|
69
|
-
|
|
70
|
-
// move cursor to line head
|
|
71
40
|
// @ts-ignore
|
|
72
41
|
rl.cursorTo(output, 0);
|
|
73
|
-
// output.cursorTo(0);
|
|
74
|
-
|
|
75
42
|
msg && output.write(msg);
|
|
76
|
-
// // write the message.
|
|
77
|
-
// // msg && output.write(msg);
|
|
78
|
-
// output.write(`${spin_char[spin_count]} ${msg}`);
|
|
79
|
-
// spin_count++;
|
|
80
|
-
// spin_count >= spin_char.length && (spin_count = 0);
|
|
81
43
|
}
|
|
82
|
-
|
|
83
44
|
/**
|
|
84
45
|
*
|
|
85
46
|
* @param {boolean} enabled
|
|
@@ -92,10 +53,9 @@ const cursor = (enabled, output = process.stderr) => {
|
|
|
92
53
|
output.write("\x1B[?25l");
|
|
93
54
|
}
|
|
94
55
|
};
|
|
95
|
-
|
|
96
56
|
module.exports = {
|
|
97
57
|
checkParentDirectory,
|
|
98
58
|
createLogStreamAndResolvePath,
|
|
99
59
|
renderLine,
|
|
100
60
|
cursor,
|
|
101
|
-
};
|
|
61
|
+
};
|
|
@@ -11,4 +11,4 @@ import * as progress from "../progress/";
|
|
|
11
11
|
* @param {() => string} [messageEmiter]
|
|
12
12
|
*/
|
|
13
13
|
export function create(fps?: number, messageEmiter?: () => string): ReturnType<typeof progress.createProgressObject>;
|
|
14
|
-
export type Progress = ReturnType<typeof progress.createProgressObject>;
|
|
14
|
+
export type Progress = ReturnType<typeof progress.createProgressObject>;
|
package/extras/tiny-progress.js
CHANGED
|
@@ -15,13 +15,10 @@ p = t.create();
|
|
|
15
15
|
p.run();
|
|
16
16
|
p.stop();
|
|
17
17
|
*/
|
|
18
|
-
|
|
19
18
|
const p = require("../progress/");
|
|
20
19
|
const rndSpinners = require("../progress/rnd-spinner");
|
|
21
|
-
|
|
22
20
|
let fired = 0;
|
|
23
21
|
let pending = 0;
|
|
24
|
-
|
|
25
22
|
/** @type {() => { fired: number; pending: number; errors?: number; }} */
|
|
26
23
|
const cb = () => {
|
|
27
24
|
return {
|
|
@@ -29,9 +26,7 @@ const cb = () => {
|
|
|
29
26
|
pending: ++pending,
|
|
30
27
|
};
|
|
31
28
|
};
|
|
32
|
-
|
|
33
29
|
let tag = "progress test";
|
|
34
|
-
|
|
35
30
|
/**
|
|
36
31
|
* progress callback
|
|
37
32
|
* @type {() => string}
|
|
@@ -41,21 +36,17 @@ const pcb = () => {
|
|
|
41
36
|
const { fired, pending, errors } = cb();
|
|
42
37
|
return `${tag} | error: ${(errors + "").padEnd(3)} | send: ${(fired + "").padStart(3)}, pending: ${(pending + "").padEnd(5)}`;
|
|
43
38
|
} else {
|
|
44
|
-
// error
|
|
45
39
|
return "- - error - -";
|
|
46
40
|
}
|
|
47
41
|
};
|
|
48
|
-
|
|
49
42
|
/** @type {ReturnType<typeof p.createProgressObject>} */
|
|
50
43
|
let progress;
|
|
51
|
-
|
|
52
44
|
/**
|
|
53
45
|
* @param {number} [fps]
|
|
54
46
|
* @param {() => string} [messageEmiter]
|
|
55
47
|
*/
|
|
56
48
|
const create = (fps = 30, messageEmiter) => {
|
|
57
49
|
const spinner = rndSpinners.getRandomFrame();
|
|
58
|
-
// const pong = rndSpinners.pong;
|
|
59
50
|
!messageEmiter && (messageEmiter = pcb);
|
|
60
51
|
progress = p.createProgressObject(
|
|
61
52
|
spinner.frames,
|
|
@@ -68,7 +59,6 @@ const create = (fps = 30, messageEmiter) => {
|
|
|
68
59
|
progress.setFPS(fps);
|
|
69
60
|
return progress;
|
|
70
61
|
};
|
|
71
|
-
|
|
72
62
|
module.exports = {
|
|
73
63
|
create,
|
|
74
|
-
};
|
|
64
|
+
};
|
package/index.d.ts
CHANGED
|
@@ -17,11 +17,6 @@
|
|
|
17
17
|
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
18
18
|
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
19
19
|
*/
|
|
20
|
-
|
|
21
20
|
export * as progress from "./progress";
|
|
22
21
|
export * as common from "./common";
|
|
23
|
-
export * as utils from "./utils";
|
|
24
|
-
// declare namespace progress {
|
|
25
|
-
// export * as spinners from "./progress/spinners.json";
|
|
26
|
-
// }
|
|
27
|
-
|
|
22
|
+
export * as utils from "./utils";
|
package/index.js
CHANGED
package/lib/unzip.min.js
CHANGED
|
@@ -322,7 +322,6 @@
|
|
|
322
322
|
0 < F[c] && (h += N(a, F[c])),
|
|
323
323
|
e >= f && ((a.g = e), (d = P(a)), (e = a.g));
|
|
324
324
|
k--;
|
|
325
|
-
|
|
326
325
|
)
|
|
327
326
|
d[e] = d[e++ - h];
|
|
328
327
|
for (; 8 <= a.j; ) (a.j -= 8), a.i--;
|
|
@@ -344,7 +343,6 @@
|
|
|
344
343
|
0 < F[c] && (h += N(a, F[c])),
|
|
345
344
|
e + k > f && ((d = ra(a)), (f = d.length));
|
|
346
345
|
k--;
|
|
347
|
-
|
|
348
346
|
)
|
|
349
347
|
d[e] = d[e++ - h];
|
|
350
348
|
for (; 8 <= a.j; ) (a.j -= 8), a.i--;
|
|
@@ -809,4 +807,4 @@
|
|
|
809
807
|
n("Zlib.Unzip.prototype.getCommentAsString", X.prototype.J);
|
|
810
808
|
n("Zlib.Unzip.FileHeader.prototype.getComment", Y.prototype.s);
|
|
811
809
|
n("Zlib.Unzip.FileHeader.prototype.getCommentAsString", Y.prototype.m);
|
|
812
|
-
}).call(this);
|
|
810
|
+
}).call(this);
|
package/lib/zip.min.js
CHANGED
|
@@ -261,7 +261,6 @@
|
|
|
261
261
|
for (
|
|
262
262
|
m = new Uint8Array(this.c.buffer);
|
|
263
263
|
m.length <= h + f.length + 5;
|
|
264
|
-
|
|
265
264
|
)
|
|
266
265
|
m = new Uint8Array(m.length << 1);
|
|
267
266
|
m.set(this.c);
|
|
@@ -1033,4 +1032,4 @@
|
|
|
1033
1032
|
G("Zlib.Zip.prototype.setPassword", $.prototype.q);
|
|
1034
1033
|
Ra("Zlib.Zip.CompressionMethod", { STORE: 0, DEFLATE: 8 });
|
|
1035
1034
|
Ra("Zlib.Zip.OperatingSystem", { MSDOS: 0, UNIX: 3, MACINTOSH: 7 });
|
|
1036
|
-
}).call(this);
|
|
1035
|
+
}).call(this);
|
package/lib/zlibjs.d.ts
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "js-dev-tool",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.3",
|
|
4
4
|
"bin": {
|
|
5
5
|
"jstool": "./tools.js"
|
|
6
6
|
},
|
|
@@ -46,6 +46,6 @@
|
|
|
46
46
|
"replace": "^1.2.2",
|
|
47
47
|
"rm-cstyle-cmts": "^3.3.22",
|
|
48
48
|
"terser": "^5.44.1",
|
|
49
|
-
"tin-args": "^0.0.
|
|
49
|
+
"tin-args": "^0.0.16"
|
|
50
50
|
}
|
|
51
51
|
}
|
package/progress/index.d.ts
CHANGED
|
@@ -28,7 +28,6 @@ export function createProgressSync(frames: string[], formatOpt?: {
|
|
|
28
28
|
fmt: string;
|
|
29
29
|
payload?: Record<string, string>;
|
|
30
30
|
}): (msg: string, done?: boolean) => void;
|
|
31
|
-
|
|
32
31
|
/**
|
|
33
32
|
*
|
|
34
33
|
* @param {string[]} frames progress frame.
|
|
@@ -73,7 +72,6 @@ export function createProgressObject(frames: string[], formatOpt: TProgressForma
|
|
|
73
72
|
*/
|
|
74
73
|
stop(): void;
|
|
75
74
|
};
|
|
76
|
-
|
|
77
75
|
declare global {
|
|
78
76
|
type TWebpackProgressHandler = (percentage: number, message: string, ...args: string[]) => void;
|
|
79
77
|
}
|
|
@@ -89,4 +87,4 @@ export function createWebpackProgressPluginHandler(logFilePath?: string, disable
|
|
|
89
87
|
*
|
|
90
88
|
* @param {string} logFilePath log output path name.
|
|
91
89
|
*/
|
|
92
|
-
export function createBrowserifyFileEventLogger(logFilePath: string): (counter: number, message: string, ...args: string[]) => void;
|
|
90
|
+
export function createBrowserifyFileEventLogger(logFilePath: string): (counter: number, message: string, ...args: string[]) => void;
|
package/progress/index.js
CHANGED
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
https://opensource.org/licenses/mit-license.php
|
|
6
6
|
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
7
7
|
*/
|
|
8
|
+
/// <reference path="./index.d.ts" preserve="true"/>
|
|
8
9
|
const lib = require("../common");
|
|
9
10
|
const {
|
|
10
11
|
checkENV,
|
|
@@ -12,7 +13,6 @@ const {
|
|
|
12
13
|
wppHandlerV4,
|
|
13
14
|
isWebpackV5later,
|
|
14
15
|
} = require("./progress-extras");
|
|
15
|
-
|
|
16
16
|
/**
|
|
17
17
|
*
|
|
18
18
|
* @param {string[]} frames progress frame.
|
|
@@ -32,7 +32,6 @@ const createProgressSync = (frames, formatOpt) => {
|
|
|
32
32
|
let keys;
|
|
33
33
|
if (formatOpt) {
|
|
34
34
|
fmt = formatOpt.fmt;
|
|
35
|
-
// FIXME: 2023/10/27 - which use payload?
|
|
36
35
|
payload = formatOpt.payload || {};
|
|
37
36
|
keys = Object.keys(payload);
|
|
38
37
|
}
|
|
@@ -51,7 +50,6 @@ const createProgressSync = (frames, formatOpt) => {
|
|
|
51
50
|
}
|
|
52
51
|
return `[${tick}]: ${msg}`;
|
|
53
52
|
};
|
|
54
|
-
// let prev = "";
|
|
55
53
|
return /**@type {(msg: string, done?: boolean) => void}*/ (
|
|
56
54
|
msg,
|
|
57
55
|
done = false,
|
|
@@ -59,19 +57,8 @@ const createProgressSync = (frames, formatOpt) => {
|
|
|
59
57
|
const tick = done ? "-done-" : frames[index++ % fsize];
|
|
60
58
|
const line = msg ? formater(tick, msg) : "";
|
|
61
59
|
lib.renderLine(line);
|
|
62
|
-
// if (line) {
|
|
63
|
-
// // if (prev !== line) {
|
|
64
|
-
// // renderLine(line);
|
|
65
|
-
// // prev = line;
|
|
66
|
-
// // }
|
|
67
|
-
// lib.renderLine(line);
|
|
68
|
-
// } else {
|
|
69
|
-
// lib.renderLine();
|
|
70
|
-
// }
|
|
71
|
-
// // !line && (renderLine(), 1) || renderLine(line);
|
|
72
60
|
};
|
|
73
61
|
};
|
|
74
|
-
|
|
75
62
|
/**
|
|
76
63
|
* @typedef {{ fmt: string, payload?: Record<string, string> }} TProgressFormatOptions
|
|
77
64
|
*/
|
|
@@ -87,17 +74,12 @@ const createProgressSync = (frames, formatOpt) => {
|
|
|
87
74
|
const createProgressObject = (frames, formatOpt, callback) => {
|
|
88
75
|
let done = false;
|
|
89
76
|
const render = () => {
|
|
90
|
-
// DEVNOTE: 2025/01/24 - やはりこれがいいね...
|
|
91
77
|
process.nextTick(progress, callback(), done);
|
|
92
|
-
// progress(callback(), done);
|
|
93
78
|
};
|
|
94
|
-
|
|
95
79
|
let progress = createProgressSync(frames, formatOpt);
|
|
96
80
|
/** @type {ReturnType<typeof setInterval> | undefined} */
|
|
97
81
|
let timer;
|
|
98
82
|
let ms = 33;
|
|
99
|
-
|
|
100
|
-
// progressObject
|
|
101
83
|
return {
|
|
102
84
|
/**
|
|
103
85
|
* @param {string[]} [newFrames]
|
|
@@ -167,7 +149,6 @@ const createProgressObject = (frames, formatOpt, callback) => {
|
|
|
167
149
|
},
|
|
168
150
|
};
|
|
169
151
|
};
|
|
170
|
-
|
|
171
152
|
/**
|
|
172
153
|
* create async progress
|
|
173
154
|
*
|
|
@@ -175,13 +156,7 @@ const createProgressObject = (frames, formatOpt, callback) => {
|
|
|
175
156
|
* @param {string[]} frames progress frame.
|
|
176
157
|
*/
|
|
177
158
|
const createProgress = (timeSpanMS, frames) => {
|
|
178
|
-
// let index = 0;
|
|
179
|
-
// return /**@type {(text: string) => void}*/ text => {
|
|
180
|
-
// const line = text === void 0? "" : `[${frames[index++ % frames.length]}]: ${text}`;
|
|
181
|
-
// !line && (progress(), 1) || process.nextTick(progress, line);
|
|
182
|
-
// }
|
|
183
159
|
const { performance } = require("perf_hooks");
|
|
184
|
-
|
|
185
160
|
let index = 0;
|
|
186
161
|
const fsize = frames.length;
|
|
187
162
|
let x = performance.now();
|
|
@@ -195,7 +170,6 @@ const createProgress = (timeSpanMS, frames) => {
|
|
|
195
170
|
(!line && (lib.renderLine(), 1)) || process.nextTick(lib.renderLine, line);
|
|
196
171
|
};
|
|
197
172
|
};
|
|
198
|
-
|
|
199
173
|
/**
|
|
200
174
|
* see https://webpack.js.org/plugins/progress-plugin/
|
|
201
175
|
*
|
|
@@ -211,11 +185,9 @@ function createWebpackProgressPluginHandler(
|
|
|
211
185
|
const formatPercentage = (/** @type {number} */ pct) => {
|
|
212
186
|
return `processing ${(pct * 100).toFixed(4)}%`;
|
|
213
187
|
};
|
|
214
|
-
|
|
215
188
|
let dotted = 0;
|
|
216
189
|
const renderDot = () => {
|
|
217
190
|
process.stderr.write(".");
|
|
218
|
-
// FIXME: first renderDot line length is not 100
|
|
219
191
|
dotted++;
|
|
220
192
|
if (dotted % 100 === 0) {
|
|
221
193
|
process.stderr.write("\n");
|
|
@@ -223,8 +195,6 @@ function createWebpackProgressPluginHandler(
|
|
|
223
195
|
};
|
|
224
196
|
/** @type {((msg?: string) => void) | undefined} */
|
|
225
197
|
const renderer = process.env.CI ? renderDot : lib.renderLine;
|
|
226
|
-
|
|
227
|
-
// (percentage: number, msg: string, moduleProgress?: string, activeModules?: string, moduleName?: string) => void
|
|
228
198
|
/** @type {TWebpackProgressHandler} */
|
|
229
199
|
let wppHandler;
|
|
230
200
|
{
|
|
@@ -236,7 +206,6 @@ function createWebpackProgressPluginHandler(
|
|
|
236
206
|
const wppLogger = lib.createLogStreamAndResolvePath(logFilePath);
|
|
237
207
|
/** @type {((p: number) => void) | undefined} */
|
|
238
208
|
let writeCallback;
|
|
239
|
-
|
|
240
209
|
if (!disableRenderLine) {
|
|
241
210
|
writeCallback = shorttenProgress;
|
|
242
211
|
}
|
|
@@ -251,7 +220,6 @@ function createWebpackProgressPluginHandler(
|
|
|
251
220
|
};
|
|
252
221
|
} else {
|
|
253
222
|
if (disableRenderLine) {
|
|
254
|
-
// DEVNOTE: 2022/02/16 ignore CI process
|
|
255
223
|
wppHandler = () => {};
|
|
256
224
|
} else {
|
|
257
225
|
const processType = checkENV();
|
|
@@ -267,10 +235,8 @@ function createWebpackProgressPluginHandler(
|
|
|
267
235
|
}
|
|
268
236
|
}
|
|
269
237
|
}
|
|
270
|
-
|
|
271
238
|
return wppHandler;
|
|
272
239
|
}
|
|
273
|
-
|
|
274
240
|
/**
|
|
275
241
|
* logger for browserify
|
|
276
242
|
*
|
|
@@ -294,12 +260,10 @@ function createBrowserifyFileEventLogger(logFilePath) {
|
|
|
294
260
|
};
|
|
295
261
|
return logger;
|
|
296
262
|
}
|
|
297
|
-
|
|
298
263
|
module.exports = {
|
|
299
264
|
createProgress,
|
|
300
265
|
createProgressSync,
|
|
301
266
|
createProgressObject,
|
|
302
|
-
|
|
303
267
|
createWebpackProgressPluginHandler,
|
|
304
268
|
createBrowserifyFileEventLogger,
|
|
305
|
-
};
|
|
269
|
+
};
|